var Rxe=Object.defineProperty;var I$=e=>{throw TypeError(e)};var Lxe=(e,t,r)=>t in e?Rxe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Cn=(e,t,r)=>Lxe(e,typeof t!="symbol"?t+"":t,r),f3=(e,t,r)=>t.has(e)||I$("Cannot "+r);var qe=(e,t,r)=>(f3(e,t,"read from private field"),r?r.call(e):t.get(e)),Nr=(e,t,r)=>t.has(e)?I$("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Qt=(e,t,r,n)=>(f3(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),hn=(e,t,r)=>(f3(e,t,"access private method"),r);var xN=(e,t,r,n)=>({set _(a){Qt(e,t,a,r)},get _(){return qe(e,t,n)}});function Fxe(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 zc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Sn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Mxe(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 BY={exports:{}},Qk={},zY={exports:{}},bn={};/**
* @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 qj=Symbol.for("react.element"),$xe=Symbol.for("react.portal"),Bxe=Symbol.for("react.fragment"),zxe=Symbol.for("react.strict_mode"),qxe=Symbol.for("react.profiler"),Uxe=Symbol.for("react.provider"),Vxe=Symbol.for("react.context"),Hxe=Symbol.for("react.forward_ref"),Wxe=Symbol.for("react.suspense"),Gxe=Symbol.for("react.memo"),Kxe=Symbol.for("react.lazy"),R$=Symbol.iterator;function Xxe(e){return e===null||typeof e!="object"?null:(e=R$&&e[R$]||e["@@iterator"],typeof e=="function"?e:null)}var qY={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},UY=Object.assign,VY={};function Jy(e,t,r){this.props=e,this.context=t,this.refs=VY,this.updater=r||qY}Jy.prototype.isReactComponent={};Jy.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")};Jy.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function HY(){}HY.prototype=Jy.prototype;function DI(e,t,r){this.props=e,this.context=t,this.refs=VY,this.updater=r||qY}var II=DI.prototype=new HY;II.constructor=DI;UY(II,Jy.prototype);II.isPureReactComponent=!0;var L$=Array.isArray,WY=Object.prototype.hasOwnProperty,RI={current:null},GY={key:!0,ref:!0,__self:!0,__source:!0};function KY(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)WY.call(t,n)&&!GY.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:qj,type:e,key:i,ref:o,props:a,_owner:RI.current}}function Yxe(e,t){return{$$typeof:qj,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function LI(e){return typeof e=="object"&&e!==null&&e.$$typeof===qj}function Zxe(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(r){return t[r]})}var F$=/\/+/g;function h3(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Zxe(""+e.key):t.toString(36)}function YS(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 qj:case $xe:o=!0}}if(o)return o=e,a=a(o),e=n===""?"."+h3(o,0):n,L$(a)?(r="",e!=null&&(r=e.replace(F$,"$&/")+"/"),YS(a,t,r,"",function(u){return u})):a!=null&&(LI(a)&&(a=Yxe(a,r+(!a.key||o&&o.key===a.key?"":(""+a.key).replace(F$,"$&/")+"/")+e)),t.push(a)),1;if(o=0,n=n===""?".":n+":",L$(e))for(var l=0;l<e.length;l++){i=e[l];var c=n+h3(i,l);o+=YS(i,t,r,c,a)}else if(c=Xxe(e),typeof c=="function")for(e=c.call(e),l=0;!(i=e.next()).done;)i=i.value,c=n+h3(i,l++),o+=YS(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 gN(e,t,r){if(e==null)return e;var n=[],a=0;return YS(e,n,"","",function(i){return t.call(r,i,a++)}),n}function Jxe(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 el={current:null},ZS={transition:null},Qxe={ReactCurrentDispatcher:el,ReactCurrentBatchConfig:ZS,ReactCurrentOwner:RI};function XY(){throw Error("act(...) is not supported in production builds of React.")}bn.Children={map:gN,forEach:function(e,t,r){gN(e,function(){t.apply(this,arguments)},r)},count:function(e){var t=0;return gN(e,function(){t++}),t},toArray:function(e){return gN(e,function(t){return t})||[]},only:function(e){if(!LI(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};bn.Component=Jy;bn.Fragment=Bxe;bn.Profiler=qxe;bn.PureComponent=DI;bn.StrictMode=zxe;bn.Suspense=Wxe;bn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Qxe;bn.act=XY;bn.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=UY({},e.props),a=e.key,i=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,o=RI.current),t.key!==void 0&&(a=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)WY.call(t,c)&&!GY.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:qj,type:e.type,key:a,ref:i,props:n,_owner:o}};bn.createContext=function(e){return e={$$typeof:Vxe,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:Uxe,_context:e},e.Consumer=e};bn.createElement=KY;bn.createFactory=function(e){var t=KY.bind(null,e);return t.type=e,t};bn.createRef=function(){return{current:null}};bn.forwardRef=function(e){return{$$typeof:Hxe,render:e}};bn.isValidElement=LI;bn.lazy=function(e){return{$$typeof:Kxe,_payload:{_status:-1,_result:e},_init:Jxe}};bn.memo=function(e,t){return{$$typeof:Gxe,type:e,compare:t===void 0?null:t}};bn.startTransition=function(e){var t=ZS.transition;ZS.transition={};try{e()}finally{ZS.transition=t}};bn.unstable_act=XY;bn.useCallback=function(e,t){return el.current.useCallback(e,t)};bn.useContext=function(e){return el.current.useContext(e)};bn.useDebugValue=function(){};bn.useDeferredValue=function(e){return el.current.useDeferredValue(e)};bn.useEffect=function(e,t){return el.current.useEffect(e,t)};bn.useId=function(){return el.current.useId()};bn.useImperativeHandle=function(e,t,r){return el.current.useImperativeHandle(e,t,r)};bn.useInsertionEffect=function(e,t){return el.current.useInsertionEffect(e,t)};bn.useLayoutEffect=function(e,t){return el.current.useLayoutEffect(e,t)};bn.useMemo=function(e,t){return el.current.useMemo(e,t)};bn.useReducer=function(e,t,r){return el.current.useReducer(e,t,r)};bn.useRef=function(e){return el.current.useRef(e)};bn.useState=function(e){return el.current.useState(e)};bn.useSyncExternalStore=function(e,t,r){return el.current.useSyncExternalStore(e,t,r)};bn.useTransition=function(){return el.current.useTransition()};bn.version="18.3.1";zY.exports=bn;var w=zY.exports;const ye=Sn(w),FI=Fxe({__proto__:null,default:ye},[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 e0e=w,t0e=Symbol.for("react.element"),r0e=Symbol.for("react.fragment"),n0e=Object.prototype.hasOwnProperty,s0e=e0e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a0e={key:!0,ref:!0,__self:!0,__source:!0};function YY(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)n0e.call(t,n)&&!a0e.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:t0e,type:e,key:i,ref:o,props:a,_owner:s0e.current}}Qk.Fragment=r0e;Qk.jsx=YY;Qk.jsxs=YY;BY.exports=Qk;var s=BY.exports,ZY={exports:{}},fc={},JY={exports:{}},QY={};/**
* @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(z,M){var B=z.length;z.push(M);e:for(;0<B;){var K=B-1>>>1,C=z[K];if(0<a(C,M))z[K]=M,z[B]=C,B=K;else break e}}function r(z){return z.length===0?null:z[0]}function n(z){if(z.length===0)return null;var M=z[0],B=z.pop();if(B!==M){z[0]=B;e:for(var K=0,C=z.length,A=C>>>1;K<A;){var I=2*(K+1)-1,U=z[I],Y=I+1,te=z[Y];if(0>a(U,B))Y<C&&0>a(te,U)?(z[K]=te,z[Y]=B,K=Y):(z[K]=U,z[I]=B,K=I);else if(Y<C&&0>a(te,B))z[K]=te,z[Y]=B,K=Y;else break e}}return M}function a(z,M){var B=z.sortIndex-M.sortIndex;return B!==0?B:z.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,x=!1,p=!1,g=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function b(z){for(var M=r(u);M!==null;){if(M.callback===null)n(u);else if(M.startTime<=z)n(u),M.sortIndex=M.expirationTime,t(c,M);else break;M=r(u)}}function N(z){if(p=!1,b(z),!x)if(r(c)!==null)x=!0,H(j);else{var M=r(u);M!==null&&V(N,M.startTime-z)}}function j(z,M){x=!1,p&&(p=!1,v(P),P=-1),h=!0;var B=m;try{for(b(M),f=r(c);f!==null&&(!(f.expirationTime>M)||z&&!k());){var K=f.callback;if(typeof K=="function"){f.callback=null,m=f.priorityLevel;var C=K(f.expirationTime<=M);M=e.unstable_now(),typeof C=="function"?f.callback=C:f===r(c)&&n(c),b(M)}else n(c);f=r(c)}if(f!==null)var A=!0;else{var I=r(u);I!==null&&V(N,I.startTime-M),A=!1}return A}finally{f=null,m=B,h=!1}}var _=!1,S=null,P=-1,T=5,R=-1;function k(){return!(e.unstable_now()-R<T)}function E(){if(S!==null){var z=e.unstable_now();R=z;var M=!0;try{M=S(!0,z)}finally{M?q():(_=!1,S=null)}}else _=!1}var q;if(typeof y=="function")q=function(){y(E)};else if(typeof MessageChannel<"u"){var O=new MessageChannel,L=O.port2;O.port1.onmessage=E,q=function(){L.postMessage(null)}}else q=function(){g(E,0)};function H(z){S=z,_||(_=!0,q())}function V(z,M){P=g(function(){z(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(z){z.callback=null},e.unstable_continueExecution=function(){x||h||(x=!0,H(j))},e.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):T=0<z?Math.floor(1e3/z):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_getFirstCallbackNode=function(){return r(c)},e.unstable_next=function(z){switch(m){case 1:case 2:case 3:var M=3;break;default:M=m}var B=m;m=M;try{return z()}finally{m=B}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(z,M){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var B=m;m=z;try{return M()}finally{m=B}},e.unstable_scheduleCallback=function(z,M,B){var K=e.unstable_now();switch(typeof B=="object"&&B!==null?(B=B.delay,B=typeof B=="number"&&0<B?K+B:K):B=K,z){case 1:var C=-1;break;case 2:C=250;break;case 5:C=1073741823;break;case 4:C=1e4;break;default:C=5e3}return C=B+C,z={id:d++,callback:M,priorityLevel:z,startTime:B,expirationTime:C,sortIndex:-1},B>K?(z.sortIndex=B,t(u,z),r(c)===null&&z===r(u)&&(p?(v(P),P=-1):p=!0,V(N,B-K))):(z.sortIndex=C,t(c,z),x||h||(x=!0,H(j))),z},e.unstable_shouldYield=k,e.unstable_wrapCallback=function(z){var M=m;return function(){var B=m;m=M;try{return z.apply(this,arguments)}finally{m=B}}}})(QY);JY.exports=QY;var i0e=JY.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 o0e=w,oc=i0e;function Ot(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 eZ=new Set,e2={};function M0(e,t){ny(e,t),ny(e+"Capture",t)}function ny(e,t){for(e2[e]=t,e=0;e<t.length;e++)eZ.add(t[e])}var ch=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),oO=Object.prototype.hasOwnProperty,l0e=/^[: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]*$/,M$={},$$={};function c0e(e){return oO.call($$,e)?!0:oO.call(M$,e)?!1:l0e.test(e)?$$[e]=!0:(M$[e]=!0,!1)}function u0e(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 d0e(e,t,r,n){if(t===null||typeof t>"u"||u0e(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 tl(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 to={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){to[e]=new tl(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];to[t]=new tl(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){to[e]=new tl(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){to[e]=new tl(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){to[e]=new tl(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){to[e]=new tl(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){to[e]=new tl(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){to[e]=new tl(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){to[e]=new tl(e,5,!1,e.toLowerCase(),null,!1,!1)});var MI=/[\-:]([a-z])/g;function $I(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(MI,$I);to[t]=new tl(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(MI,$I);to[t]=new tl(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(MI,$I);to[t]=new tl(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){to[e]=new tl(e,1,!1,e.toLowerCase(),null,!1,!1)});to.xlinkHref=new tl("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){to[e]=new tl(e,1,!1,e.toLowerCase(),null,!0,!0)});function BI(e,t,r,n){var a=to.hasOwnProperty(t)?to[t]:null;(a!==null?a.type!==0:n||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(d0e(t,r,a,n)&&(r=null),n||a===null?c0e(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 Sh=o0e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,vN=Symbol.for("react.element"),Jg=Symbol.for("react.portal"),Qg=Symbol.for("react.fragment"),zI=Symbol.for("react.strict_mode"),lO=Symbol.for("react.profiler"),tZ=Symbol.for("react.provider"),rZ=Symbol.for("react.context"),qI=Symbol.for("react.forward_ref"),cO=Symbol.for("react.suspense"),uO=Symbol.for("react.suspense_list"),UI=Symbol.for("react.memo"),cm=Symbol.for("react.lazy"),nZ=Symbol.for("react.offscreen"),B$=Symbol.iterator;function vb(e){return e===null||typeof e!="object"?null:(e=B$&&e[B$]||e["@@iterator"],typeof e=="function"?e:null)}var ca=Object.assign,m3;function Zb(e){if(m3===void 0)try{throw Error()}catch(r){var t=r.stack.trim().match(/\n( *(at )?)/);m3=t&&t[1]||""}return`
`+m3+e}var p3=!1;function x3(e,t){if(!e||p3)return"";p3=!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{p3=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?Zb(e):""}function f0e(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=x3(e.type,!1),e;case 11:return e=x3(e.type.render,!1),e;case 1:return e=x3(e.type,!0),e;default:return""}}function dO(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 Qg:return"Fragment";case Jg:return"Portal";case lO:return"Profiler";case zI:return"StrictMode";case cO:return"Suspense";case uO:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case rZ:return(e.displayName||"Context")+".Consumer";case tZ:return(e._context.displayName||"Context")+".Provider";case qI:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case UI:return t=e.displayName||null,t!==null?t:dO(e.type)||"Memo";case cm:t=e._payload,e=e._init;try{return dO(e(t))}catch{}}return null}function h0e(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 dO(t);case 8:return t===zI?"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 tp(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function sZ(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function m0e(e){var t=sZ(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 yN(e){e._valueTracker||(e._valueTracker=m0e(e))}function aZ(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=sZ(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function A5(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 fO(e,t){var r=t.checked;return ca({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function z$(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=tp(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 iZ(e,t){t=t.checked,t!=null&&BI(e,"checked",t,!1)}function hO(e,t){iZ(e,t);var r=tp(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")?mO(e,t.type,r):t.hasOwnProperty("defaultValue")&&mO(e,t.type,tp(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function q$(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 mO(e,t,r){(t!=="number"||A5(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var Jb=Array.isArray;function bv(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=""+tp(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 pO(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(Ot(91));return ca({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function U$(e,t){var r=t.value;if(r==null){if(r=t.children,t=t.defaultValue,r!=null){if(t!=null)throw Error(Ot(92));if(Jb(r)){if(1<r.length)throw Error(Ot(93));r=r[0]}t=r}t==null&&(t=""),r=t}e._wrapperState={initialValue:tp(r)}}function oZ(e,t){var r=tp(t.value),n=tp(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 V$(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function lZ(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 xO(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?lZ(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var bN,cZ=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(bN=bN||document.createElement("div"),bN.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=bN.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function t2(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var fw={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},p0e=["Webkit","ms","Moz","O"];Object.keys(fw).forEach(function(e){p0e.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),fw[t]=fw[e]})});function uZ(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||fw.hasOwnProperty(e)&&fw[e]?(""+t).trim():t+"px"}function dZ(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var n=r.indexOf("--")===0,a=uZ(r,t[r],n);r==="float"&&(r="cssFloat"),n?e.setProperty(r,a):e[r]=a}}var x0e=ca({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 gO(e,t){if(t){if(x0e[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Ot(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Ot(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Ot(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Ot(62))}}function vO(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 yO=null;function VI(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var bO=null,wv=null,jv=null;function H$(e){if(e=Hj(e)){if(typeof bO!="function")throw Error(Ot(280));var t=e.stateNode;t&&(t=sC(t),bO(e.stateNode,e.type,t))}}function fZ(e){wv?jv?jv.push(e):jv=[e]:wv=e}function hZ(){if(wv){var e=wv,t=jv;if(jv=wv=null,H$(e),t)for(e=0;e<t.length;e++)H$(t[e])}}function mZ(e,t){return e(t)}function pZ(){}var g3=!1;function xZ(e,t,r){if(g3)return e(t,r);g3=!0;try{return mZ(e,t,r)}finally{g3=!1,(wv!==null||jv!==null)&&(pZ(),hZ())}}function r2(e,t){var r=e.stateNode;if(r===null)return null;var n=sC(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(Ot(231,t,typeof r));return r}var wO=!1;if(ch)try{var yb={};Object.defineProperty(yb,"passive",{get:function(){wO=!0}}),window.addEventListener("test",yb,yb),window.removeEventListener("test",yb,yb)}catch{wO=!1}function g0e(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 hw=!1,T5=null,P5=!1,jO=null,v0e={onError:function(e){hw=!0,T5=e}};function y0e(e,t,r,n,a,i,o,l,c){hw=!1,T5=null,g0e.apply(v0e,arguments)}function b0e(e,t,r,n,a,i,o,l,c){if(y0e.apply(this,arguments),hw){if(hw){var u=T5;hw=!1,T5=null}else throw Error(Ot(198));P5||(P5=!0,jO=u)}}function $0(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 gZ(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 W$(e){if($0(e)!==e)throw Error(Ot(188))}function w0e(e){var t=e.alternate;if(!t){if(t=$0(e),t===null)throw Error(Ot(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 W$(a),e;if(i===n)return W$(a),t;i=i.sibling}throw Error(Ot(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(Ot(189))}}if(r.alternate!==n)throw Error(Ot(190))}if(r.tag!==3)throw Error(Ot(188));return r.stateNode.current===r?e:t}function vZ(e){return e=w0e(e),e!==null?yZ(e):null}function yZ(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=yZ(e);if(t!==null)return t;e=e.sibling}return null}var bZ=oc.unstable_scheduleCallback,G$=oc.unstable_cancelCallback,j0e=oc.unstable_shouldYield,_0e=oc.unstable_requestPaint,Da=oc.unstable_now,N0e=oc.unstable_getCurrentPriorityLevel,HI=oc.unstable_ImmediatePriority,wZ=oc.unstable_UserBlockingPriority,O5=oc.unstable_NormalPriority,S0e=oc.unstable_LowPriority,jZ=oc.unstable_IdlePriority,eC=null,Gd=null;function k0e(e){if(Gd&&typeof Gd.onCommitFiberRoot=="function")try{Gd.onCommitFiberRoot(eC,e,void 0,(e.current.flags&128)===128)}catch{}}var Vu=Math.clz32?Math.clz32:A0e,C0e=Math.log,E0e=Math.LN2;function A0e(e){return e>>>=0,e===0?32:31-(C0e(e)/E0e|0)|0}var wN=64,jN=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 D5(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-Vu(t),a=1<<r,n|=e[r],t&=~a;return n}function T0e(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 P0e(e,t){for(var r=e.suspendedLanes,n=e.pingedLanes,a=e.expirationTimes,i=e.pendingLanes;0<i;){var o=31-Vu(i),l=1<<o,c=a[o];c===-1?(!(l&r)||l&n)&&(a[o]=T0e(l,t)):c<=t&&(e.expiredLanes|=l),i&=~l}}function _O(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function _Z(){var e=wN;return wN<<=1,!(wN&4194240)&&(wN=64),e}function v3(e){for(var t=[],r=0;31>r;r++)t.push(e);return t}function Uj(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Vu(t),e[t]=r}function O0e(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-Vu(r),i=1<<a;t[a]=0,n[a]=-1,e[a]=-1,r&=~i}}function WI(e,t){var r=e.entangledLanes|=t;for(e=e.entanglements;r;){var n=31-Vu(r),a=1<<n;a&t|e[n]&t&&(e[n]|=t),r&=~a}}var cs=0;function NZ(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var SZ,GI,kZ,CZ,EZ,NO=!1,_N=[],zm=null,qm=null,Um=null,n2=new Map,s2=new Map,hm=[],D0e="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":zm=null;break;case"dragenter":case"dragleave":qm=null;break;case"mouseover":case"mouseout":Um=null;break;case"pointerover":case"pointerout":n2.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":s2.delete(t.pointerId)}}function bb(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=Hj(t),t!==null&&GI(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,a!==null&&t.indexOf(a)===-1&&t.push(a),e)}function I0e(e,t,r,n,a){switch(t){case"focusin":return zm=bb(zm,e,t,r,n,a),!0;case"dragenter":return qm=bb(qm,e,t,r,n,a),!0;case"mouseover":return Um=bb(Um,e,t,r,n,a),!0;case"pointerover":var i=a.pointerId;return n2.set(i,bb(n2.get(i)||null,e,t,r,n,a)),!0;case"gotpointercapture":return i=a.pointerId,s2.set(i,bb(s2.get(i)||null,e,t,r,n,a)),!0}return!1}function AZ(e){var t=Nx(e.target);if(t!==null){var r=$0(t);if(r!==null){if(t=r.tag,t===13){if(t=gZ(r),t!==null){e.blockedOn=t,EZ(e.priority,function(){kZ(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 JS(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);yO=n,r.target.dispatchEvent(n),yO=null}else return t=Hj(r),t!==null&&GI(t),e.blockedOn=r,!1;t.shift()}return!0}function X$(e,t,r){JS(e)&&r.delete(t)}function R0e(){NO=!1,zm!==null&&JS(zm)&&(zm=null),qm!==null&&JS(qm)&&(qm=null),Um!==null&&JS(Um)&&(Um=null),n2.forEach(X$),s2.forEach(X$)}function wb(e,t){e.blockedOn===t&&(e.blockedOn=null,NO||(NO=!0,oc.unstable_scheduleCallback(oc.unstable_NormalPriority,R0e)))}function a2(e){function t(a){return wb(a,e)}if(0<_N.length){wb(_N[0],e);for(var r=1;r<_N.length;r++){var n=_N[r];n.blockedOn===e&&(n.blockedOn=null)}}for(zm!==null&&wb(zm,e),qm!==null&&wb(qm,e),Um!==null&&wb(Um,e),n2.forEach(t),s2.forEach(t),r=0;r<hm.length;r++)n=hm[r],n.blockedOn===e&&(n.blockedOn=null);for(;0<hm.length&&(r=hm[0],r.blockedOn===null);)AZ(r),r.blockedOn===null&&hm.shift()}var _v=Sh.ReactCurrentBatchConfig,I5=!0;function L0e(e,t,r,n){var a=cs,i=_v.transition;_v.transition=null;try{cs=1,KI(e,t,r,n)}finally{cs=a,_v.transition=i}}function F0e(e,t,r,n){var a=cs,i=_v.transition;_v.transition=null;try{cs=4,KI(e,t,r,n)}finally{cs=a,_v.transition=i}}function KI(e,t,r,n){if(I5){var a=SO(e,t,r,n);if(a===null)E3(e,t,n,R5,r),K$(e,n);else if(I0e(a,e,t,r,n))n.stopPropagation();else if(K$(e,n),t&4&&-1<D0e.indexOf(e)){for(;a!==null;){var i=Hj(a);if(i!==null&&SZ(i),i=SO(e,t,r,n),i===null&&E3(e,t,n,R5,r),i===a)break;a=i}a!==null&&n.stopPropagation()}else E3(e,t,n,null,r)}}var R5=null;function SO(e,t,r,n){if(R5=null,e=VI(n),e=Nx(e),e!==null)if(t=$0(e),t===null)e=null;else if(r=t.tag,r===13){if(e=gZ(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 R5=e,null}function TZ(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(N0e()){case HI:return 1;case wZ:return 4;case O5:case S0e:return 16;case jZ:return 536870912;default:return 16}default:return 16}}var Pm=null,XI=null,QS=null;function PZ(){if(QS)return QS;var e,t=XI,r=t.length,n,a="value"in Pm?Pm.value:Pm.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 QS=a.slice(e,1<n?1-n:void 0)}function e5(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 NN(){return!0}function Y$(){return!1}function hc(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)?NN:Y$,this.isPropagationStopped=Y$,this}return ca(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=NN)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=NN)},persist:function(){},isPersistent:NN}),t}var Qy={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},YI=hc(Qy),Vj=ca({},Qy,{view:0,detail:0}),M0e=hc(Vj),y3,b3,jb,tC=ca({},Vj,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ZI,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!==jb&&(jb&&e.type==="mousemove"?(y3=e.screenX-jb.screenX,b3=e.screenY-jb.screenY):b3=y3=0,jb=e),y3)},movementY:function(e){return"movementY"in e?e.movementY:b3}}),Z$=hc(tC),$0e=ca({},tC,{dataTransfer:0}),B0e=hc($0e),z0e=ca({},Vj,{relatedTarget:0}),w3=hc(z0e),q0e=ca({},Qy,{animationName:0,elapsedTime:0,pseudoElement:0}),U0e=hc(q0e),V0e=ca({},Qy,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),H0e=hc(V0e),W0e=ca({},Qy,{data:0}),J$=hc(W0e),G0e={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},K0e={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"},X0e={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Y0e(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=X0e[e])?!!t[e]:!1}function ZI(){return Y0e}var Z0e=ca({},Vj,{key:function(e){if(e.key){var t=G0e[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=e5(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?K0e[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ZI,charCode:function(e){return e.type==="keypress"?e5(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?e5(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),J0e=hc(Z0e),Q0e=ca({},tC,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Q$=hc(Q0e),ege=ca({},Vj,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ZI}),tge=hc(ege),rge=ca({},Qy,{propertyName:0,elapsedTime:0,pseudoElement:0}),nge=hc(rge),sge=ca({},tC,{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}),age=hc(sge),ige=[9,13,27,32],JI=ch&&"CompositionEvent"in window,mw=null;ch&&"documentMode"in document&&(mw=document.documentMode);var oge=ch&&"TextEvent"in window&&!mw,OZ=ch&&(!JI||mw&&8<mw&&11>=mw),eB=" ",tB=!1;function DZ(e,t){switch(e){case"keyup":return ige.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function IZ(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ev=!1;function lge(e,t){switch(e){case"compositionend":return IZ(t);case"keypress":return t.which!==32?null:(tB=!0,eB);case"textInput":return e=t.data,e===eB&&tB?null:e;default:return null}}function cge(e,t){if(ev)return e==="compositionend"||!JI&&DZ(e,t)?(e=PZ(),QS=XI=Pm=null,ev=!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 OZ&&t.locale!=="ko"?null:t.data;default:return null}}var uge={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 rB(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!uge[e.type]:t==="textarea"}function RZ(e,t,r,n){fZ(n),t=L5(t,"onChange"),0<t.length&&(r=new YI("onChange","change",null,r,n),e.push({event:r,listeners:t}))}var pw=null,i2=null;function dge(e){WZ(e,0)}function rC(e){var t=nv(e);if(aZ(t))return e}function fge(e,t){if(e==="change")return t}var LZ=!1;if(ch){var j3;if(ch){var _3="oninput"in document;if(!_3){var nB=document.createElement("div");nB.setAttribute("oninput","return;"),_3=typeof nB.oninput=="function"}j3=_3}else j3=!1;LZ=j3&&(!document.documentMode||9<document.documentMode)}function sB(){pw&&(pw.detachEvent("onpropertychange",FZ),i2=pw=null)}function FZ(e){if(e.propertyName==="value"&&rC(i2)){var t=[];RZ(t,i2,e,VI(e)),xZ(dge,t)}}function hge(e,t,r){e==="focusin"?(sB(),pw=t,i2=r,pw.attachEvent("onpropertychange",FZ)):e==="focusout"&&sB()}function mge(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return rC(i2)}function pge(e,t){if(e==="click")return rC(t)}function xge(e,t){if(e==="input"||e==="change")return rC(t)}function gge(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Ju=typeof Object.is=="function"?Object.is:gge;function o2(e,t){if(Ju(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(!oO.call(t,a)||!Ju(e[a],t[a]))return!1}return!0}function aB(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function iB(e,t){var r=aB(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=aB(r)}}function MZ(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?MZ(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function $Z(){for(var e=window,t=A5();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=A5(e.document)}return t}function QI(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 vge(e){var t=$Z(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&MZ(r.ownerDocument.documentElement,r)){if(n!==null&&QI(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=iB(r,i);var o=iB(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 yge=ch&&"documentMode"in document&&11>=document.documentMode,tv=null,kO=null,xw=null,CO=!1;function oB(e,t,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;CO||tv==null||tv!==A5(n)||(n=tv,"selectionStart"in n&&QI(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}),xw&&o2(xw,n)||(xw=n,n=L5(kO,"onSelect"),0<n.length&&(t=new YI("onSelect","select",null,t,r),e.push({event:t,listeners:n}),t.target=tv)))}function SN(e,t){var r={};return r[e.toLowerCase()]=t.toLowerCase(),r["Webkit"+e]="webkit"+t,r["Moz"+e]="moz"+t,r}var rv={animationend:SN("Animation","AnimationEnd"),animationiteration:SN("Animation","AnimationIteration"),animationstart:SN("Animation","AnimationStart"),transitionend:SN("Transition","TransitionEnd")},N3={},BZ={};ch&&(BZ=document.createElement("div").style,"AnimationEvent"in window||(delete rv.animationend.animation,delete rv.animationiteration.animation,delete rv.animationstart.animation),"TransitionEvent"in window||delete rv.transitionend.transition);function nC(e){if(N3[e])return N3[e];if(!rv[e])return e;var t=rv[e],r;for(r in t)if(t.hasOwnProperty(r)&&r in BZ)return N3[e]=t[r];return e}var zZ=nC("animationend"),qZ=nC("animationiteration"),UZ=nC("animationstart"),VZ=nC("transitionend"),HZ=new Map,lB="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 jp(e,t){HZ.set(e,t),M0(t,[e])}for(var S3=0;S3<lB.length;S3++){var k3=lB[S3],bge=k3.toLowerCase(),wge=k3[0].toUpperCase()+k3.slice(1);jp(bge,"on"+wge)}jp(zZ,"onAnimationEnd");jp(qZ,"onAnimationIteration");jp(UZ,"onAnimationStart");jp("dblclick","onDoubleClick");jp("focusin","onFocus");jp("focusout","onBlur");jp(VZ,"onTransitionEnd");ny("onMouseEnter",["mouseout","mouseover"]);ny("onMouseLeave",["mouseout","mouseover"]);ny("onPointerEnter",["pointerout","pointerover"]);ny("onPointerLeave",["pointerout","pointerover"]);M0("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));M0("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));M0("onBeforeInput",["compositionend","keypress","textInput","paste"]);M0("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));M0("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));M0("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ew="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(" "),jge=new Set("cancel close invalid load scroll toggle".split(" ").concat(ew));function cB(e,t,r){var n=e.type||"unknown-event";e.currentTarget=r,b0e(n,t,void 0,e),e.currentTarget=null}function WZ(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;cB(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;cB(a,l,u),i=c}}}if(P5)throw e=jO,P5=!1,jO=null,e}function $s(e,t){var r=t[OO];r===void 0&&(r=t[OO]=new Set);var n=e+"__bubble";r.has(n)||(GZ(t,e,2,!1),r.add(n))}function C3(e,t,r){var n=0;t&&(n|=4),GZ(r,e,n,t)}var kN="_reactListening"+Math.random().toString(36).slice(2);function l2(e){if(!e[kN]){e[kN]=!0,eZ.forEach(function(r){r!=="selectionchange"&&(jge.has(r)||C3(r,!1,e),C3(r,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[kN]||(t[kN]=!0,C3("selectionchange",!1,t))}}function GZ(e,t,r,n){switch(TZ(t)){case 1:var a=L0e;break;case 4:a=F0e;break;default:a=KI}r=a.bind(null,t,r,e),a=void 0,!wO||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 E3(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=Nx(l),o===null)return;if(c=o.tag,c===5||c===6){n=i=o;continue e}l=l.parentNode}}n=n.return}xZ(function(){var u=i,d=VI(r),f=[];e:{var m=HZ.get(e);if(m!==void 0){var h=YI,x=e;switch(e){case"keypress":if(e5(r)===0)break e;case"keydown":case"keyup":h=J0e;break;case"focusin":x="focus",h=w3;break;case"focusout":x="blur",h=w3;break;case"beforeblur":case"afterblur":h=w3;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=Z$;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=B0e;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=tge;break;case zZ:case qZ:case UZ:h=U0e;break;case VZ:h=nge;break;case"scroll":h=M0e;break;case"wheel":h=age;break;case"copy":case"cut":case"paste":h=H0e;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=Q$}var p=(t&4)!==0,g=!p&&e==="scroll",v=p?m!==null?m+"Capture":null:m;p=[];for(var y=u,b;y!==null;){b=y;var N=b.stateNode;if(b.tag===5&&N!==null&&(b=N,v!==null&&(N=r2(y,v),N!=null&&p.push(c2(y,N,b)))),g)break;y=y.return}0<p.length&&(m=new h(m,x,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!==yO&&(x=r.relatedTarget||r.fromElement)&&(Nx(x)||x[uh]))break e;if((h||m)&&(m=d.window===d?d:(m=d.ownerDocument)?m.defaultView||m.parentWindow:window,h?(x=r.relatedTarget||r.toElement,h=u,x=x?Nx(x):null,x!==null&&(g=$0(x),x!==g||x.tag!==5&&x.tag!==6)&&(x=null)):(h=null,x=u),h!==x)){if(p=Z$,N="onMouseLeave",v="onMouseEnter",y="mouse",(e==="pointerout"||e==="pointerover")&&(p=Q$,N="onPointerLeave",v="onPointerEnter",y="pointer"),g=h==null?m:nv(h),b=x==null?m:nv(x),m=new p(N,y+"leave",h,r,d),m.target=g,m.relatedTarget=b,N=null,Nx(d)===u&&(p=new p(v,y+"enter",x,r,d),p.target=b,p.relatedTarget=g,N=p),g=N,h&&x)t:{for(p=h,v=x,y=0,b=p;b;b=yg(b))y++;for(b=0,N=v;N;N=yg(N))b++;for(;0<y-b;)p=yg(p),y--;for(;0<b-y;)v=yg(v),b--;for(;y--;){if(p===v||v!==null&&p===v.alternate)break t;p=yg(p),v=yg(v)}p=null}else p=null;h!==null&&uB(f,m,h,p,!1),x!==null&&g!==null&&uB(f,g,x,p,!0)}}e:{if(m=u?nv(u):window,h=m.nodeName&&m.nodeName.toLowerCase(),h==="select"||h==="input"&&m.type==="file")var j=fge;else if(rB(m))if(LZ)j=xge;else{j=mge;var _=hge}else(h=m.nodeName)&&h.toLowerCase()==="input"&&(m.type==="checkbox"||m.type==="radio")&&(j=pge);if(j&&(j=j(e,u))){RZ(f,j,r,d);break e}_&&_(e,m,u),e==="focusout"&&(_=m._wrapperState)&&_.controlled&&m.type==="number"&&mO(m,"number",m.value)}switch(_=u?nv(u):window,e){case"focusin":(rB(_)||_.contentEditable==="true")&&(tv=_,kO=u,xw=null);break;case"focusout":xw=kO=tv=null;break;case"mousedown":CO=!0;break;case"contextmenu":case"mouseup":case"dragend":CO=!1,oB(f,r,d);break;case"selectionchange":if(yge)break;case"keydown":case"keyup":oB(f,r,d)}var S;if(JI)e:{switch(e){case"compositionstart":var P="onCompositionStart";break e;case"compositionend":P="onCompositionEnd";break e;case"compositionupdate":P="onCompositionUpdate";break e}P=void 0}else ev?DZ(e,r)&&(P="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(P="onCompositionStart");P&&(OZ&&r.locale!=="ko"&&(ev||P!=="onCompositionStart"?P==="onCompositionEnd"&&ev&&(S=PZ()):(Pm=d,XI="value"in Pm?Pm.value:Pm.textContent,ev=!0)),_=L5(u,P),0<_.length&&(P=new J$(P,e,null,r,d),f.push({event:P,listeners:_}),S?P.data=S:(S=IZ(r),S!==null&&(P.data=S)))),(S=oge?lge(e,r):cge(e,r))&&(u=L5(u,"onBeforeInput"),0<u.length&&(d=new J$("onBeforeInput","beforeinput",null,r,d),f.push({event:d,listeners:u}),d.data=S))}WZ(f,t)})}function c2(e,t,r){return{instance:e,listener:t,currentTarget:r}}function L5(e,t){for(var r=t+"Capture",n=[];e!==null;){var a=e,i=a.stateNode;a.tag===5&&i!==null&&(a=i,i=r2(e,r),i!=null&&n.unshift(c2(e,i,a)),i=r2(e,t),i!=null&&n.push(c2(e,i,a))),e=e.return}return n}function yg(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function uB(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=r2(r,i),c!=null&&o.unshift(c2(r,c,l))):a||(c=r2(r,i),c!=null&&o.push(c2(r,c,l)))),r=r.return}o.length!==0&&e.push({event:t,listeners:o})}var _ge=/\r\n?/g,Nge=/\u0000|\uFFFD/g;function dB(e){return(typeof e=="string"?e:""+e).replace(_ge,`
`).replace(Nge,"")}function CN(e,t,r){if(t=dB(t),dB(e)!==t&&r)throw Error(Ot(425))}function F5(){}var EO=null,AO=null;function TO(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 PO=typeof setTimeout=="function"?setTimeout:void 0,Sge=typeof clearTimeout=="function"?clearTimeout:void 0,fB=typeof Promise=="function"?Promise:void 0,kge=typeof queueMicrotask=="function"?queueMicrotask:typeof fB<"u"?function(e){return fB.resolve(null).then(e).catch(Cge)}:PO;function Cge(e){setTimeout(function(){throw e})}function A3(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),a2(t);return}n--}else r!=="$"&&r!=="$?"&&r!=="$!"||n++;r=a}while(r);a2(t)}function Vm(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 hB(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 e1=Math.random().toString(36).slice(2),Fd="__reactFiber$"+e1,u2="__reactProps$"+e1,uh="__reactContainer$"+e1,OO="__reactEvents$"+e1,Ege="__reactListeners$"+e1,Age="__reactHandles$"+e1;function Nx(e){var t=e[Fd];if(t)return t;for(var r=e.parentNode;r;){if(t=r[uh]||r[Fd]){if(r=t.alternate,t.child!==null||r!==null&&r.child!==null)for(e=hB(e);e!==null;){if(r=e[Fd])return r;e=hB(e)}return t}e=r,r=e.parentNode}return null}function Hj(e){return e=e[Fd]||e[uh],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function nv(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(Ot(33))}function sC(e){return e[u2]||null}var DO=[],sv=-1;function _p(e){return{current:e}}function Vs(e){0>sv||(e.current=DO[sv],DO[sv]=null,sv--)}function As(e,t){sv++,DO[sv]=e.current,e.current=t}var rp={},ko=_p(rp),gl=_p(!1),i0=rp;function sy(e,t){var r=e.type.contextTypes;if(!r)return rp;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 vl(e){return e=e.childContextTypes,e!=null}function M5(){Vs(gl),Vs(ko)}function mB(e,t,r){if(ko.current!==rp)throw Error(Ot(168));As(ko,t),As(gl,r)}function KZ(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(Ot(108,h0e(e)||"Unknown",a));return ca({},r,n)}function $5(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||rp,i0=ko.current,As(ko,e),As(gl,gl.current),!0}function pB(e,t,r){var n=e.stateNode;if(!n)throw Error(Ot(169));r?(e=KZ(e,t,i0),n.__reactInternalMemoizedMergedChildContext=e,Vs(gl),Vs(ko),As(ko,e)):Vs(gl),As(gl,r)}var qf=null,aC=!1,T3=!1;function XZ(e){qf===null?qf=[e]:qf.push(e)}function Tge(e){aC=!0,XZ(e)}function Np(){if(!T3&&qf!==null){T3=!0;var e=0,t=cs;try{var r=qf;for(cs=1;e<r.length;e++){var n=r[e];do n=n(!0);while(n!==null)}qf=null,aC=!1}catch(a){throw qf!==null&&(qf=qf.slice(e+1)),bZ(HI,Np),a}finally{cs=t,T3=!1}}return null}var av=[],iv=0,B5=null,z5=0,Rc=[],Lc=0,o0=null,Wf=1,Gf="";function cx(e,t){av[iv++]=z5,av[iv++]=B5,B5=e,z5=t}function YZ(e,t,r){Rc[Lc++]=Wf,Rc[Lc++]=Gf,Rc[Lc++]=o0,o0=e;var n=Wf;e=Gf;var a=32-Vu(n)-1;n&=~(1<<a),r+=1;var i=32-Vu(t)+a;if(30<i){var o=a-a%5;i=(n&(1<<o)-1).toString(32),n>>=o,a-=o,Wf=1<<32-Vu(t)+a|r<<a|n,Gf=i+e}else Wf=1<<i|r<<a|n,Gf=e}function eR(e){e.return!==null&&(cx(e,1),YZ(e,1,0))}function tR(e){for(;e===B5;)B5=av[--iv],av[iv]=null,z5=av[--iv],av[iv]=null;for(;e===o0;)o0=Rc[--Lc],Rc[Lc]=null,Gf=Rc[--Lc],Rc[Lc]=null,Wf=Rc[--Lc],Rc[Lc]=null}var rc=null,Jl=null,Ys=!1,Fu=null;function ZZ(e,t){var r=qc(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 xB(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,rc=e,Jl=Vm(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,rc=e,Jl=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(r=o0!==null?{id:Wf,overflow:Gf}:null,e.memoizedState={dehydrated:t,treeContext:r,retryLane:1073741824},r=qc(18,null,null,0),r.stateNode=t,r.return=e,e.child=r,rc=e,Jl=null,!0):!1;default:return!1}}function IO(e){return(e.mode&1)!==0&&(e.flags&128)===0}function RO(e){if(Ys){var t=Jl;if(t){var r=t;if(!xB(e,t)){if(IO(e))throw Error(Ot(418));t=Vm(r.nextSibling);var n=rc;t&&xB(e,t)?ZZ(n,r):(e.flags=e.flags&-4097|2,Ys=!1,rc=e)}}else{if(IO(e))throw Error(Ot(418));e.flags=e.flags&-4097|2,Ys=!1,rc=e}}}function gB(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;rc=e}function EN(e){if(e!==rc)return!1;if(!Ys)return gB(e),Ys=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!TO(e.type,e.memoizedProps)),t&&(t=Jl)){if(IO(e))throw JZ(),Error(Ot(418));for(;t;)ZZ(e,t),t=Vm(t.nextSibling)}if(gB(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Ot(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"){if(t===0){Jl=Vm(e.nextSibling);break e}t--}else r!=="$"&&r!=="$!"&&r!=="$?"||t++}e=e.nextSibling}Jl=null}}else Jl=rc?Vm(e.stateNode.nextSibling):null;return!0}function JZ(){for(var e=Jl;e;)e=Vm(e.nextSibling)}function ay(){Jl=rc=null,Ys=!1}function rR(e){Fu===null?Fu=[e]:Fu.push(e)}var Pge=Sh.ReactCurrentBatchConfig;function _b(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(Ot(309));var n=r.stateNode}if(!n)throw Error(Ot(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(Ot(284));if(!r._owner)throw Error(Ot(290,e))}return e}function AN(e,t){throw e=Object.prototype.toString.call(t),Error(Ot(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function vB(e){var t=e._init;return t(e._payload)}function QZ(e){function t(v,y){if(e){var b=v.deletions;b===null?(v.deletions=[y],v.flags|=16):b.push(y)}}function r(v,y){if(!e)return null;for(;y!==null;)t(v,y),y=y.sibling;return null}function n(v,y){for(v=new Map;y!==null;)y.key!==null?v.set(y.key,y):v.set(y.index,y),y=y.sibling;return v}function a(v,y){return v=Km(v,y),v.index=0,v.sibling=null,v}function i(v,y,b){return v.index=b,e?(b=v.alternate,b!==null?(b=b.index,b<y?(v.flags|=2,y):b):(v.flags|=2,y)):(v.flags|=1048576,y)}function o(v){return e&&v.alternate===null&&(v.flags|=2),v}function l(v,y,b,N){return y===null||y.tag!==6?(y=F3(b,v.mode,N),y.return=v,y):(y=a(y,b),y.return=v,y)}function c(v,y,b,N){var j=b.type;return j===Qg?d(v,y,b.props.children,N,b.key):y!==null&&(y.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===cm&&vB(j)===y.type)?(N=a(y,b.props),N.ref=_b(v,y,b),N.return=v,N):(N=o5(b.type,b.key,b.props,null,v.mode,N),N.ref=_b(v,y,b),N.return=v,N)}function u(v,y,b,N){return y===null||y.tag!==4||y.stateNode.containerInfo!==b.containerInfo||y.stateNode.implementation!==b.implementation?(y=M3(b,v.mode,N),y.return=v,y):(y=a(y,b.children||[]),y.return=v,y)}function d(v,y,b,N,j){return y===null||y.tag!==7?(y=Vx(b,v.mode,N,j),y.return=v,y):(y=a(y,b),y.return=v,y)}function f(v,y,b){if(typeof y=="string"&&y!==""||typeof y=="number")return y=F3(""+y,v.mode,b),y.return=v,y;if(typeof y=="object"&&y!==null){switch(y.$$typeof){case vN:return b=o5(y.type,y.key,y.props,null,v.mode,b),b.ref=_b(v,null,y),b.return=v,b;case Jg:return y=M3(y,v.mode,b),y.return=v,y;case cm:var N=y._init;return f(v,N(y._payload),b)}if(Jb(y)||vb(y))return y=Vx(y,v.mode,b,null),y.return=v,y;AN(v,y)}return null}function m(v,y,b,N){var j=y!==null?y.key:null;if(typeof b=="string"&&b!==""||typeof b=="number")return j!==null?null:l(v,y,""+b,N);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case vN:return b.key===j?c(v,y,b,N):null;case Jg:return b.key===j?u(v,y,b,N):null;case cm:return j=b._init,m(v,y,j(b._payload),N)}if(Jb(b)||vb(b))return j!==null?null:d(v,y,b,N,null);AN(v,b)}return null}function h(v,y,b,N,j){if(typeof N=="string"&&N!==""||typeof N=="number")return v=v.get(b)||null,l(y,v,""+N,j);if(typeof N=="object"&&N!==null){switch(N.$$typeof){case vN:return v=v.get(N.key===null?b:N.key)||null,c(y,v,N,j);case Jg:return v=v.get(N.key===null?b:N.key)||null,u(y,v,N,j);case cm:var _=N._init;return h(v,y,b,_(N._payload),j)}if(Jb(N)||vb(N))return v=v.get(b)||null,d(y,v,N,j,null);AN(y,N)}return null}function x(v,y,b,N){for(var j=null,_=null,S=y,P=y=0,T=null;S!==null&&P<b.length;P++){S.index>P?(T=S,S=null):T=S.sibling;var R=m(v,S,b[P],N);if(R===null){S===null&&(S=T);break}e&&S&&R.alternate===null&&t(v,S),y=i(R,y,P),_===null?j=R:_.sibling=R,_=R,S=T}if(P===b.length)return r(v,S),Ys&&cx(v,P),j;if(S===null){for(;P<b.length;P++)S=f(v,b[P],N),S!==null&&(y=i(S,y,P),_===null?j=S:_.sibling=S,_=S);return Ys&&cx(v,P),j}for(S=n(v,S);P<b.length;P++)T=h(S,v,P,b[P],N),T!==null&&(e&&T.alternate!==null&&S.delete(T.key===null?P:T.key),y=i(T,y,P),_===null?j=T:_.sibling=T,_=T);return e&&S.forEach(function(k){return t(v,k)}),Ys&&cx(v,P),j}function p(v,y,b,N){var j=vb(b);if(typeof j!="function")throw Error(Ot(150));if(b=j.call(b),b==null)throw Error(Ot(151));for(var _=j=null,S=y,P=y=0,T=null,R=b.next();S!==null&&!R.done;P++,R=b.next()){S.index>P?(T=S,S=null):T=S.sibling;var k=m(v,S,R.value,N);if(k===null){S===null&&(S=T);break}e&&S&&k.alternate===null&&t(v,S),y=i(k,y,P),_===null?j=k:_.sibling=k,_=k,S=T}if(R.done)return r(v,S),Ys&&cx(v,P),j;if(S===null){for(;!R.done;P++,R=b.next())R=f(v,R.value,N),R!==null&&(y=i(R,y,P),_===null?j=R:_.sibling=R,_=R);return Ys&&cx(v,P),j}for(S=n(v,S);!R.done;P++,R=b.next())R=h(S,v,P,R.value,N),R!==null&&(e&&R.alternate!==null&&S.delete(R.key===null?P:R.key),y=i(R,y,P),_===null?j=R:_.sibling=R,_=R);return e&&S.forEach(function(E){return t(v,E)}),Ys&&cx(v,P),j}function g(v,y,b,N){if(typeof b=="object"&&b!==null&&b.type===Qg&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case vN:e:{for(var j=b.key,_=y;_!==null;){if(_.key===j){if(j=b.type,j===Qg){if(_.tag===7){r(v,_.sibling),y=a(_,b.props.children),y.return=v,v=y;break e}}else if(_.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===cm&&vB(j)===_.type){r(v,_.sibling),y=a(_,b.props),y.ref=_b(v,_,b),y.return=v,v=y;break e}r(v,_);break}else t(v,_);_=_.sibling}b.type===Qg?(y=Vx(b.props.children,v.mode,N,b.key),y.return=v,v=y):(N=o5(b.type,b.key,b.props,null,v.mode,N),N.ref=_b(v,y,b),N.return=v,v=N)}return o(v);case Jg:e:{for(_=b.key;y!==null;){if(y.key===_)if(y.tag===4&&y.stateNode.containerInfo===b.containerInfo&&y.stateNode.implementation===b.implementation){r(v,y.sibling),y=a(y,b.children||[]),y.return=v,v=y;break e}else{r(v,y);break}else t(v,y);y=y.sibling}y=M3(b,v.mode,N),y.return=v,v=y}return o(v);case cm:return _=b._init,g(v,y,_(b._payload),N)}if(Jb(b))return x(v,y,b,N);if(vb(b))return p(v,y,b,N);AN(v,b)}return typeof b=="string"&&b!==""||typeof b=="number"?(b=""+b,y!==null&&y.tag===6?(r(v,y.sibling),y=a(y,b),y.return=v,v=y):(r(v,y),y=F3(b,v.mode,N),y.return=v,v=y),o(v)):r(v,y)}return g}var iy=QZ(!0),eJ=QZ(!1),q5=_p(null),U5=null,ov=null,nR=null;function sR(){nR=ov=U5=null}function aR(e){var t=q5.current;Vs(q5),e._currentValue=t}function LO(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 Nv(e,t){U5=e,nR=ov=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(pl=!0),e.firstContext=null)}function tu(e){var t=e._currentValue;if(nR!==e)if(e={context:e,memoizedValue:t,next:null},ov===null){if(U5===null)throw Error(Ot(308));ov=e,U5.dependencies={lanes:0,firstContext:e}}else ov=ov.next=e;return t}var Sx=null;function iR(e){Sx===null?Sx=[e]:Sx.push(e)}function tJ(e,t,r,n){var a=t.interleaved;return a===null?(r.next=r,iR(t)):(r.next=a.next,a.next=r),t.interleaved=r,dh(e,n)}function dh(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 um=!1;function oR(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function rJ(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 eh(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Hm(e,t,r){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,Ln&2){var a=n.pending;return a===null?t.next=t:(t.next=a.next,a.next=t),n.pending=t,dh(e,r)}return a=n.interleaved,a===null?(t.next=t,iR(n)):(t.next=a.next,a.next=t),n.interleaved=t,dh(e,r)}function t5(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,WI(e,r)}}function yB(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 V5(e,t,r,n){var a=e.updateQueue;um=!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 x=e,p=l;switch(m=t,h=r,p.tag){case 1:if(x=p.payload,typeof x=="function"){f=x.call(h,f,m);break e}f=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=p.payload,m=typeof x=="function"?x.call(h,f,m):x,m==null)break e;f=ca({},f,m);break e;case 2:um=!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);c0|=o,e.lanes=o,e.memoizedState=f}}function bB(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(Ot(191,a));a.call(n)}}}var Wj={},Kd=_p(Wj),d2=_p(Wj),f2=_p(Wj);function kx(e){if(e===Wj)throw Error(Ot(174));return e}function lR(e,t){switch(As(f2,t),As(d2,e),As(Kd,Wj),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:xO(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=xO(t,e)}Vs(Kd),As(Kd,t)}function oy(){Vs(Kd),Vs(d2),Vs(f2)}function nJ(e){kx(f2.current);var t=kx(Kd.current),r=xO(t,e.type);t!==r&&(As(d2,e),As(Kd,r))}function cR(e){d2.current===e&&(Vs(Kd),Vs(d2))}var aa=_p(0);function H5(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 P3=[];function uR(){for(var e=0;e<P3.length;e++)P3[e]._workInProgressVersionPrimary=null;P3.length=0}var r5=Sh.ReactCurrentDispatcher,O3=Sh.ReactCurrentBatchConfig,l0=0,oa=null,hi=null,Ei=null,W5=!1,gw=!1,h2=0,Oge=0;function oo(){throw Error(Ot(321))}function dR(e,t){if(t===null)return!1;for(var r=0;r<t.length&&r<e.length;r++)if(!Ju(e[r],t[r]))return!1;return!0}function fR(e,t,r,n,a,i){if(l0=i,oa=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,r5.current=e===null||e.memoizedState===null?Lge:Fge,e=r(n,a),gw){i=0;do{if(gw=!1,h2=0,25<=i)throw Error(Ot(301));i+=1,Ei=hi=null,t.updateQueue=null,r5.current=Mge,e=r(n,a)}while(gw)}if(r5.current=G5,t=hi!==null&&hi.next!==null,l0=0,Ei=hi=oa=null,W5=!1,t)throw Error(Ot(300));return e}function hR(){var e=h2!==0;return h2=0,e}function Pd(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ei===null?oa.memoizedState=Ei=e:Ei=Ei.next=e,Ei}function ru(){if(hi===null){var e=oa.alternate;e=e!==null?e.memoizedState:null}else e=hi.next;var t=Ei===null?oa.memoizedState:Ei.next;if(t!==null)Ei=t,hi=e;else{if(e===null)throw Error(Ot(310));hi=e,e={memoizedState:hi.memoizedState,baseState:hi.baseState,baseQueue:hi.baseQueue,queue:hi.queue,next:null},Ei===null?oa.memoizedState=Ei=e:Ei=Ei.next=e}return Ei}function m2(e,t){return typeof t=="function"?t(e):t}function D3(e){var t=ru(),r=t.queue;if(r===null)throw Error(Ot(311));r.lastRenderedReducer=e;var n=hi,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((l0&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,oa.lanes|=d,c0|=d}u=u.next}while(u!==null&&u!==i);c===null?o=n:c.next=l,Ju(n,t.memoizedState)||(pl=!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,oa.lanes|=i,c0|=i,a=a.next;while(a!==e)}else a===null&&(r.lanes=0);return[t.memoizedState,r.dispatch]}function I3(e){var t=ru(),r=t.queue;if(r===null)throw Error(Ot(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);Ju(i,t.memoizedState)||(pl=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),r.lastRenderedState=i}return[i,n]}function sJ(){}function aJ(e,t){var r=oa,n=ru(),a=t(),i=!Ju(n.memoizedState,a);if(i&&(n.memoizedState=a,pl=!0),n=n.queue,mR(lJ.bind(null,r,n,e),[e]),n.getSnapshot!==t||i||Ei!==null&&Ei.memoizedState.tag&1){if(r.flags|=2048,p2(9,oJ.bind(null,r,n,a,t),void 0,null),Ri===null)throw Error(Ot(349));l0&30||iJ(r,t,a)}return a}function iJ(e,t,r){e.flags|=16384,e={getSnapshot:t,value:r},t=oa.updateQueue,t===null?(t={lastEffect:null,stores:null},oa.updateQueue=t,t.stores=[e]):(r=t.stores,r===null?t.stores=[e]:r.push(e))}function oJ(e,t,r,n){t.value=r,t.getSnapshot=n,cJ(t)&&uJ(e)}function lJ(e,t,r){return r(function(){cJ(t)&&uJ(e)})}function cJ(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!Ju(e,r)}catch{return!0}}function uJ(e){var t=dh(e,1);t!==null&&Hu(t,e,1,-1)}function wB(e){var t=Pd();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:m2,lastRenderedState:e},t.queue=e,e=e.dispatch=Rge.bind(null,oa,e),[t.memoizedState,e]}function p2(e,t,r,n){return e={tag:e,create:t,destroy:r,deps:n,next:null},t=oa.updateQueue,t===null?(t={lastEffect:null,stores:null},oa.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 dJ(){return ru().memoizedState}function n5(e,t,r,n){var a=Pd();oa.flags|=e,a.memoizedState=p2(1|t,r,void 0,n===void 0?null:n)}function iC(e,t,r,n){var a=ru();n=n===void 0?null:n;var i=void 0;if(hi!==null){var o=hi.memoizedState;if(i=o.destroy,n!==null&&dR(n,o.deps)){a.memoizedState=p2(t,r,i,n);return}}oa.flags|=e,a.memoizedState=p2(1|t,r,i,n)}function jB(e,t){return n5(8390656,8,e,t)}function mR(e,t){return iC(2048,8,e,t)}function fJ(e,t){return iC(4,2,e,t)}function hJ(e,t){return iC(4,4,e,t)}function mJ(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 pJ(e,t,r){return r=r!=null?r.concat([e]):null,iC(4,4,mJ.bind(null,t,e),r)}function pR(){}function xJ(e,t){var r=ru();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&dR(t,n[1])?n[0]:(r.memoizedState=[e,t],e)}function gJ(e,t){var r=ru();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&dR(t,n[1])?n[0]:(e=e(),r.memoizedState=[e,t],e)}function vJ(e,t,r){return l0&21?(Ju(r,t)||(r=_Z(),oa.lanes|=r,c0|=r,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,pl=!0),e.memoizedState=r)}function Dge(e,t){var r=cs;cs=r!==0&&4>r?r:4,e(!0);var n=O3.transition;O3.transition={};try{e(!1),t()}finally{cs=r,O3.transition=n}}function yJ(){return ru().memoizedState}function Ige(e,t,r){var n=Gm(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},bJ(e))wJ(t,r);else if(r=tJ(e,t,r,n),r!==null){var a=Go();Hu(r,e,n,a),jJ(r,t,n)}}function Rge(e,t,r){var n=Gm(e),a={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(bJ(e))wJ(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,Ju(l,o)){var c=t.interleaved;c===null?(a.next=a,iR(t)):(a.next=c.next,c.next=a),t.interleaved=a;return}}catch{}finally{}r=tJ(e,t,a,n),r!==null&&(a=Go(),Hu(r,e,n,a),jJ(r,t,n))}}function bJ(e){var t=e.alternate;return e===oa||t!==null&&t===oa}function wJ(e,t){gw=W5=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function jJ(e,t,r){if(r&4194240){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,WI(e,r)}}var G5={readContext:tu,useCallback:oo,useContext:oo,useEffect:oo,useImperativeHandle:oo,useInsertionEffect:oo,useLayoutEffect:oo,useMemo:oo,useReducer:oo,useRef:oo,useState:oo,useDebugValue:oo,useDeferredValue:oo,useTransition:oo,useMutableSource:oo,useSyncExternalStore:oo,useId:oo,unstable_isNewReconciler:!1},Lge={readContext:tu,useCallback:function(e,t){return Pd().memoizedState=[e,t===void 0?null:t],e},useContext:tu,useEffect:jB,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,n5(4194308,4,mJ.bind(null,t,e),r)},useLayoutEffect:function(e,t){return n5(4194308,4,e,t)},useInsertionEffect:function(e,t){return n5(4,2,e,t)},useMemo:function(e,t){var r=Pd();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=Pd();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=Ige.bind(null,oa,e),[n.memoizedState,e]},useRef:function(e){var t=Pd();return e={current:e},t.memoizedState=e},useState:wB,useDebugValue:pR,useDeferredValue:function(e){return Pd().memoizedState=e},useTransition:function(){var e=wB(!1),t=e[0];return e=Dge.bind(null,e[1]),Pd().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=oa,a=Pd();if(Ys){if(r===void 0)throw Error(Ot(407));r=r()}else{if(r=t(),Ri===null)throw Error(Ot(349));l0&30||iJ(n,t,r)}a.memoizedState=r;var i={value:r,getSnapshot:t};return a.queue=i,jB(lJ.bind(null,n,i,e),[e]),n.flags|=2048,p2(9,oJ.bind(null,n,i,r,t),void 0,null),r},useId:function(){var e=Pd(),t=Ri.identifierPrefix;if(Ys){var r=Gf,n=Wf;r=(n&~(1<<32-Vu(n)-1)).toString(32)+r,t=":"+t+"R"+r,r=h2++,0<r&&(t+="H"+r.toString(32)),t+=":"}else r=Oge++,t=":"+t+"r"+r.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Fge={readContext:tu,useCallback:xJ,useContext:tu,useEffect:mR,useImperativeHandle:pJ,useInsertionEffect:fJ,useLayoutEffect:hJ,useMemo:gJ,useReducer:D3,useRef:dJ,useState:function(){return D3(m2)},useDebugValue:pR,useDeferredValue:function(e){var t=ru();return vJ(t,hi.memoizedState,e)},useTransition:function(){var e=D3(m2)[0],t=ru().memoizedState;return[e,t]},useMutableSource:sJ,useSyncExternalStore:aJ,useId:yJ,unstable_isNewReconciler:!1},Mge={readContext:tu,useCallback:xJ,useContext:tu,useEffect:mR,useImperativeHandle:pJ,useInsertionEffect:fJ,useLayoutEffect:hJ,useMemo:gJ,useReducer:I3,useRef:dJ,useState:function(){return I3(m2)},useDebugValue:pR,useDeferredValue:function(e){var t=ru();return hi===null?t.memoizedState=e:vJ(t,hi.memoizedState,e)},useTransition:function(){var e=I3(m2)[0],t=ru().memoizedState;return[e,t]},useMutableSource:sJ,useSyncExternalStore:aJ,useId:yJ,unstable_isNewReconciler:!1};function Tu(e,t){if(e&&e.defaultProps){t=ca({},t),e=e.defaultProps;for(var r in e)t[r]===void 0&&(t[r]=e[r]);return t}return t}function FO(e,t,r,n){t=e.memoizedState,r=r(n,t),r=r==null?t:ca({},t,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var oC={isMounted:function(e){return(e=e._reactInternals)?$0(e)===e:!1},enqueueSetState:function(e,t,r){e=e._reactInternals;var n=Go(),a=Gm(e),i=eh(n,a);i.payload=t,r!=null&&(i.callback=r),t=Hm(e,i,a),t!==null&&(Hu(t,e,a,n),t5(t,e,a))},enqueueReplaceState:function(e,t,r){e=e._reactInternals;var n=Go(),a=Gm(e),i=eh(n,a);i.tag=1,i.payload=t,r!=null&&(i.callback=r),t=Hm(e,i,a),t!==null&&(Hu(t,e,a,n),t5(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var r=Go(),n=Gm(e),a=eh(r,n);a.tag=2,t!=null&&(a.callback=t),t=Hm(e,a,n),t!==null&&(Hu(t,e,n,r),t5(t,e,n))}};function _B(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?!o2(r,n)||!o2(a,i):!0}function _J(e,t,r){var n=!1,a=rp,i=t.contextType;return typeof i=="object"&&i!==null?i=tu(i):(a=vl(t)?i0:ko.current,n=t.contextTypes,i=(n=n!=null)?sy(e,a):rp),t=new t(r,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=oC,e.stateNode=t,t._reactInternals=e,n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=a,e.__reactInternalMemoizedMaskedChildContext=i),t}function NB(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&&oC.enqueueReplaceState(t,t.state,null)}function MO(e,t,r,n){var a=e.stateNode;a.props=r,a.state=e.memoizedState,a.refs={},oR(e);var i=t.contextType;typeof i=="object"&&i!==null?a.context=tu(i):(i=vl(t)?i0:ko.current,a.context=sy(e,i)),a.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(FO(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&&oC.enqueueReplaceState(a,a.state,null),V5(e,r,a,n),a.state=e.memoizedState),typeof a.componentDidMount=="function"&&(e.flags|=4194308)}function ly(e,t){try{var r="",n=t;do r+=f0e(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 R3(e,t,r){return{value:e,source:null,stack:r??null,digest:t??null}}function $O(e,t){try{console.error(t.value)}catch(r){setTimeout(function(){throw r})}}var $ge=typeof WeakMap=="function"?WeakMap:Map;function NJ(e,t,r){r=eh(-1,r),r.tag=3,r.payload={element:null};var n=t.value;return r.callback=function(){X5||(X5=!0,XO=n),$O(e,t)},r}function SJ(e,t,r){r=eh(-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(){$O(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(r.callback=function(){$O(e,t),typeof n!="function"&&(Wm===null?Wm=new Set([this]):Wm.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),r}function SB(e,t,r){var n=e.pingCache;if(n===null){n=e.pingCache=new $ge;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=Qge.bind(null,e,t,r),t.then(e,e))}function kB(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 CB(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=eh(-1,1),t.tag=2,Hm(r,t,1))),r.lanes|=1),e)}var Bge=Sh.ReactCurrentOwner,pl=!1;function Fo(e,t,r,n){t.child=e===null?eJ(t,null,r,n):iy(t,e.child,r,n)}function EB(e,t,r,n,a){r=r.render;var i=t.ref;return Nv(t,a),n=fR(e,t,r,n,i,a),r=hR(),e!==null&&!pl?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,fh(e,t,a)):(Ys&&r&&eR(t),t.flags|=1,Fo(e,t,n,a),t.child)}function AB(e,t,r,n,a){if(e===null){var i=r.type;return typeof i=="function"&&!_R(i)&&i.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(t.tag=15,t.type=i,kJ(e,t,i,n,a)):(e=o5(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:o2,r(o,n)&&e.ref===t.ref)return fh(e,t,a)}return t.flags|=1,e=Km(i,n),e.ref=t.ref,e.return=t,t.child=e}function kJ(e,t,r,n,a){if(e!==null){var i=e.memoizedProps;if(o2(i,n)&&e.ref===t.ref)if(pl=!1,t.pendingProps=n=i,(e.lanes&a)!==0)e.flags&131072&&(pl=!0);else return t.lanes=e.lanes,fh(e,t,a)}return BO(e,t,r,n,a)}function CJ(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},As(cv,zl),zl|=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,As(cv,zl),zl|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=i!==null?i.baseLanes:r,As(cv,zl),zl|=n}else i!==null?(n=i.baseLanes|r,t.memoizedState=null):n=r,As(cv,zl),zl|=n;return Fo(e,t,a,r),t.child}function EJ(e,t){var r=t.ref;(e===null&&r!==null||e!==null&&e.ref!==r)&&(t.flags|=512,t.flags|=2097152)}function BO(e,t,r,n,a){var i=vl(r)?i0:ko.current;return i=sy(t,i),Nv(t,a),r=fR(e,t,r,n,i,a),n=hR(),e!==null&&!pl?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,fh(e,t,a)):(Ys&&n&&eR(t),t.flags|=1,Fo(e,t,r,a),t.child)}function TB(e,t,r,n,a){if(vl(r)){var i=!0;$5(t)}else i=!1;if(Nv(t,a),t.stateNode===null)s5(e,t),_J(t,r,n),MO(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=tu(u):(u=vl(r)?i0:ko.current,u=sy(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)&&NB(t,o,n,u),um=!1;var m=t.memoizedState;o.state=m,V5(t,n,o,a),c=t.memoizedState,l!==n||m!==c||gl.current||um?(typeof d=="function"&&(FO(t,r,d,n),c=t.memoizedState),(l=um||_B(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,rJ(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:Tu(t.type,l),o.props=u,f=t.pendingProps,m=o.context,c=r.contextType,typeof c=="object"&&c!==null?c=tu(c):(c=vl(r)?i0:ko.current,c=sy(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)&&NB(t,o,n,c),um=!1,m=t.memoizedState,o.state=m,V5(t,n,o,a);var x=t.memoizedState;l!==f||m!==x||gl.current||um?(typeof h=="function"&&(FO(t,r,h,n),x=t.memoizedState),(u=um||_B(t,r,u,n,m,x,c)||!1)?(d||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(n,x,c),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(n,x,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=x),o.props=n,o.state=x,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 zO(e,t,r,n,i,a)}function zO(e,t,r,n,a,i){EJ(e,t);var o=(t.flags&128)!==0;if(!n&&!o)return a&&pB(t,r,!1),fh(e,t,i);n=t.stateNode,Bge.current=t;var l=o&&typeof r.getDerivedStateFromError!="function"?null:n.render();return t.flags|=1,e!==null&&o?(t.child=iy(t,e.child,null,i),t.child=iy(t,null,l,i)):Fo(e,t,l,i),t.memoizedState=n.state,a&&pB(t,r,!0),t.child}function AJ(e){var t=e.stateNode;t.pendingContext?mB(e,t.pendingContext,t.pendingContext!==t.context):t.context&&mB(e,t.context,!1),lR(e,t.containerInfo)}function PB(e,t,r,n,a){return ay(),rR(a),t.flags|=256,Fo(e,t,r,n),t.child}var qO={dehydrated:null,treeContext:null,retryLane:0};function UO(e){return{baseLanes:e,cachePool:null,transitions:null}}function TJ(e,t,r){var n=t.pendingProps,a=aa.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),As(aa,a&1),e===null)return RO(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=uC(o,n,0,null),e=Vx(e,n,r,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=UO(r),t.memoizedState=qO,e):xR(t,o));if(a=e.memoizedState,a!==null&&(l=a.dehydrated,l!==null))return zge(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=Km(a,c),n.subtreeFlags=a.subtreeFlags&14680064),l!==null?i=Km(l,i):(i=Vx(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?UO(r):{baseLanes:o.baseLanes|r,cachePool:null,transitions:o.transitions},i.memoizedState=o,i.childLanes=e.childLanes&~r,t.memoizedState=qO,n}return i=e.child,e=i.sibling,n=Km(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 xR(e,t){return t=uC({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function TN(e,t,r,n){return n!==null&&rR(n),iy(t,e.child,null,r),e=xR(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function zge(e,t,r,n,a,i,o){if(r)return t.flags&256?(t.flags&=-257,n=R3(Error(Ot(422))),TN(e,t,o,n)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=n.fallback,a=t.mode,n=uC({mode:"visible",children:n.children},a,0,null),i=Vx(i,a,o,null),i.flags|=2,n.return=t,i.return=t,n.sibling=i,t.child=n,t.mode&1&&iy(t,e.child,null,o),t.child.memoizedState=UO(o),t.memoizedState=qO,i);if(!(t.mode&1))return TN(e,t,o,null);if(a.data==="$!"){if(n=a.nextSibling&&a.nextSibling.dataset,n)var l=n.dgst;return n=l,i=Error(Ot(419)),n=R3(i,n,void 0),TN(e,t,o,n)}if(l=(o&e.childLanes)!==0,pl||l){if(n=Ri,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,dh(e,a),Hu(n,e,a,-1))}return jR(),n=R3(Error(Ot(421))),TN(e,t,o,n)}return a.data==="$?"?(t.flags|=128,t.child=e.child,t=eve.bind(null,e),a._reactRetry=t,null):(e=i.treeContext,Jl=Vm(a.nextSibling),rc=t,Ys=!0,Fu=null,e!==null&&(Rc[Lc++]=Wf,Rc[Lc++]=Gf,Rc[Lc++]=o0,Wf=e.id,Gf=e.overflow,o0=t),t=xR(t,n.children),t.flags|=4096,t)}function OB(e,t,r){e.lanes|=t;var n=e.alternate;n!==null&&(n.lanes|=t),LO(e.return,t,r)}function L3(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 PJ(e,t,r){var n=t.pendingProps,a=n.revealOrder,i=n.tail;if(Fo(e,t,n.children,r),n=aa.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&&OB(e,r,t);else if(e.tag===19)OB(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(As(aa,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&&H5(e)===null&&(a=r),r=r.sibling;r=a,r===null?(a=t.child,t.child=null):(a=r.sibling,r.sibling=null),L3(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&&H5(e)===null){t.child=a;break}e=a.sibling,a.sibling=r,r=a,a=e}L3(t,!0,r,null,i);break;case"together":L3(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function s5(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function fh(e,t,r){if(e!==null&&(t.dependencies=e.dependencies),c0|=t.lanes,!(r&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(Ot(153));if(t.child!==null){for(e=t.child,r=Km(e,e.pendingProps),t.child=r,r.return=t;e.sibling!==null;)e=e.sibling,r=r.sibling=Km(e,e.pendingProps),r.return=t;r.sibling=null}return t.child}function qge(e,t,r){switch(t.tag){case 3:AJ(t),ay();break;case 5:nJ(t);break;case 1:vl(t.type)&&$5(t);break;case 4:lR(t,t.stateNode.containerInfo);break;case 10:var n=t.type._context,a=t.memoizedProps.value;As(q5,n._currentValue),n._currentValue=a;break;case 13:if(n=t.memoizedState,n!==null)return n.dehydrated!==null?(As(aa,aa.current&1),t.flags|=128,null):r&t.child.childLanes?TJ(e,t,r):(As(aa,aa.current&1),e=fh(e,t,r),e!==null?e.sibling:null);As(aa,aa.current&1);break;case 19:if(n=(r&t.childLanes)!==0,e.flags&128){if(n)return PJ(e,t,r);t.flags|=128}if(a=t.memoizedState,a!==null&&(a.rendering=null,a.tail=null,a.lastEffect=null),As(aa,aa.current),n)break;return null;case 22:case 23:return t.lanes=0,CJ(e,t,r)}return fh(e,t,r)}var OJ,VO,DJ,IJ;OJ=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}};VO=function(){};DJ=function(e,t,r,n){var a=e.memoizedProps;if(a!==n){e=t.stateNode,kx(Kd.current);var i=null;switch(r){case"input":a=fO(e,a),n=fO(e,n),i=[];break;case"select":a=ca({},a,{value:void 0}),n=ca({},n,{value:void 0}),i=[];break;case"textarea":a=pO(e,a),n=pO(e,n),i=[];break;default:typeof a.onClick!="function"&&typeof n.onClick=="function"&&(e.onclick=F5)}gO(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"&&(e2.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"&&(e2.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&$s("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)}};IJ=function(e,t,r,n){r!==n&&(t.flags|=4)};function Nb(e,t){if(!Ys)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 lo(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 Uge(e,t,r){var n=t.pendingProps;switch(tR(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return lo(t),null;case 1:return vl(t.type)&&M5(),lo(t),null;case 3:return n=t.stateNode,oy(),Vs(gl),Vs(ko),uR(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(EN(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Fu!==null&&(JO(Fu),Fu=null))),VO(e,t),lo(t),null;case 5:cR(t);var a=kx(f2.current);if(r=t.type,e!==null&&t.stateNode!=null)DJ(e,t,r,n,a),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!n){if(t.stateNode===null)throw Error(Ot(166));return lo(t),null}if(e=kx(Kd.current),EN(t)){n=t.stateNode,r=t.type;var i=t.memoizedProps;switch(n[Fd]=t,n[u2]=i,e=(t.mode&1)!==0,r){case"dialog":$s("cancel",n),$s("close",n);break;case"iframe":case"object":case"embed":$s("load",n);break;case"video":case"audio":for(a=0;a<ew.length;a++)$s(ew[a],n);break;case"source":$s("error",n);break;case"img":case"image":case"link":$s("error",n),$s("load",n);break;case"details":$s("toggle",n);break;case"input":z$(n,i),$s("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!i.multiple},$s("invalid",n);break;case"textarea":U$(n,i),$s("invalid",n)}gO(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&&CN(n.textContent,l,e),a=["children",l]):typeof l=="number"&&n.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&CN(n.textContent,l,e),a=["children",""+l]):e2.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&$s("scroll",n)}switch(r){case"input":yN(n),q$(n,i,!0);break;case"textarea":yN(n),V$(n);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(n.onclick=F5)}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=lZ(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[Fd]=t,e[u2]=n,OJ(e,t,!1,!1),t.stateNode=e;e:{switch(o=vO(r,n),r){case"dialog":$s("cancel",e),$s("close",e),a=n;break;case"iframe":case"object":case"embed":$s("load",e),a=n;break;case"video":case"audio":for(a=0;a<ew.length;a++)$s(ew[a],e);a=n;break;case"source":$s("error",e),a=n;break;case"img":case"image":case"link":$s("error",e),$s("load",e),a=n;break;case"details":$s("toggle",e),a=n;break;case"input":z$(e,n),a=fO(e,n),$s("invalid",e);break;case"option":a=n;break;case"select":e._wrapperState={wasMultiple:!!n.multiple},a=ca({},n,{value:void 0}),$s("invalid",e);break;case"textarea":U$(e,n),a=pO(e,n),$s("invalid",e);break;default:a=n}gO(r,a),l=a;for(i in l)if(l.hasOwnProperty(i)){var c=l[i];i==="style"?dZ(e,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&cZ(e,c)):i==="children"?typeof c=="string"?(r!=="textarea"||c!=="")&&t2(e,c):typeof c=="number"&&t2(e,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(e2.hasOwnProperty(i)?c!=null&&i==="onScroll"&&$s("scroll",e):c!=null&&BI(e,i,c,o))}switch(r){case"input":yN(e),q$(e,n,!1);break;case"textarea":yN(e),V$(e);break;case"option":n.value!=null&&e.setAttribute("value",""+tp(n.value));break;case"select":e.multiple=!!n.multiple,i=n.value,i!=null?bv(e,!!n.multiple,i,!1):n.defaultValue!=null&&bv(e,!!n.multiple,n.defaultValue,!0);break;default:typeof a.onClick=="function"&&(e.onclick=F5)}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 lo(t),null;case 6:if(e&&t.stateNode!=null)IJ(e,t,e.memoizedProps,n);else{if(typeof n!="string"&&t.stateNode===null)throw Error(Ot(166));if(r=kx(f2.current),kx(Kd.current),EN(t)){if(n=t.stateNode,r=t.memoizedProps,n[Fd]=t,(i=n.nodeValue!==r)&&(e=rc,e!==null))switch(e.tag){case 3:CN(n.nodeValue,r,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&CN(n.nodeValue,r,(e.mode&1)!==0)}i&&(t.flags|=4)}else n=(r.nodeType===9?r:r.ownerDocument).createTextNode(n),n[Fd]=t,t.stateNode=n}return lo(t),null;case 13:if(Vs(aa),n=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Ys&&Jl!==null&&t.mode&1&&!(t.flags&128))JZ(),ay(),t.flags|=98560,i=!1;else if(i=EN(t),n!==null&&n.dehydrated!==null){if(e===null){if(!i)throw Error(Ot(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(Ot(317));i[Fd]=t}else ay(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;lo(t),i=!1}else Fu!==null&&(JO(Fu),Fu=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||aa.current&1?yi===0&&(yi=3):jR())),t.updateQueue!==null&&(t.flags|=4),lo(t),null);case 4:return oy(),VO(e,t),e===null&&l2(t.stateNode.containerInfo),lo(t),null;case 10:return aR(t.type._context),lo(t),null;case 17:return vl(t.type)&&M5(),lo(t),null;case 19:if(Vs(aa),i=t.memoizedState,i===null)return lo(t),null;if(n=(t.flags&128)!==0,o=i.rendering,o===null)if(n)Nb(i,!1);else{if(yi!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=H5(e),o!==null){for(t.flags|=128,Nb(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 As(aa,aa.current&1|2),t.child}e=e.sibling}i.tail!==null&&Da()>cy&&(t.flags|=128,n=!0,Nb(i,!1),t.lanes=4194304)}else{if(!n)if(e=H5(o),e!==null){if(t.flags|=128,n=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),Nb(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!Ys)return lo(t),null}else 2*Da()-i.renderingStartTime>cy&&r!==1073741824&&(t.flags|=128,n=!0,Nb(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=Da(),t.sibling=null,r=aa.current,As(aa,n?r&1|2:r&1),t):(lo(t),null);case 22:case 23:return wR(),n=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==n&&(t.flags|=8192),n&&t.mode&1?zl&1073741824&&(lo(t),t.subtreeFlags&6&&(t.flags|=8192)):lo(t),null;case 24:return null;case 25:return null}throw Error(Ot(156,t.tag))}function Vge(e,t){switch(tR(t),t.tag){case 1:return vl(t.type)&&M5(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return oy(),Vs(gl),Vs(ko),uR(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return cR(t),null;case 13:if(Vs(aa),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Ot(340));ay()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Vs(aa),null;case 4:return oy(),null;case 10:return aR(t.type._context),null;case 22:case 23:return wR(),null;case 24:return null;default:return null}}var PN=!1,yo=!1,Hge=typeof WeakSet=="function"?WeakSet:Set,tr=null;function lv(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){xa(e,t,n)}else r.current=null}function HO(e,t,r){try{r()}catch(n){xa(e,t,n)}}var DB=!1;function Wge(e,t){if(EO=I5,e=$Z(),QI(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(AO={focusedElem:e,selectionRange:r},I5=!1,tr=t;tr!==null;)if(t=tr,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,tr=e;else for(;tr!==null;){t=tr;try{var x=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var p=x.memoizedProps,g=x.memoizedState,v=t.stateNode,y=v.getSnapshotBeforeUpdate(t.elementType===t.type?p:Tu(t.type,p),g);v.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var b=t.stateNode.containerInfo;b.nodeType===1?b.textContent="":b.nodeType===9&&b.documentElement&&b.removeChild(b.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Ot(163))}}catch(N){xa(t,t.return,N)}if(e=t.sibling,e!==null){e.return=t.return,tr=e;break}tr=t.return}return x=DB,DB=!1,x}function vw(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&&HO(t,r,i)}a=a.next}while(a!==n)}}function lC(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 WO(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 RJ(e){var t=e.alternate;t!==null&&(e.alternate=null,RJ(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Fd],delete t[u2],delete t[OO],delete t[Ege],delete t[Age])),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 LJ(e){return e.tag===5||e.tag===3||e.tag===4}function IB(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||LJ(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 GO(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=F5));else if(n!==4&&(e=e.child,e!==null))for(GO(e,t,r),e=e.sibling;e!==null;)GO(e,t,r),e=e.sibling}function KO(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(KO(e,t,r),e=e.sibling;e!==null;)KO(e,t,r),e=e.sibling}var Xi=null,Iu=!1;function Yh(e,t,r){for(r=r.child;r!==null;)FJ(e,t,r),r=r.sibling}function FJ(e,t,r){if(Gd&&typeof Gd.onCommitFiberUnmount=="function")try{Gd.onCommitFiberUnmount(eC,r)}catch{}switch(r.tag){case 5:yo||lv(r,t);case 6:var n=Xi,a=Iu;Xi=null,Yh(e,t,r),Xi=n,Iu=a,Xi!==null&&(Iu?(e=Xi,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):Xi.removeChild(r.stateNode));break;case 18:Xi!==null&&(Iu?(e=Xi,r=r.stateNode,e.nodeType===8?A3(e.parentNode,r):e.nodeType===1&&A3(e,r),a2(e)):A3(Xi,r.stateNode));break;case 4:n=Xi,a=Iu,Xi=r.stateNode.containerInfo,Iu=!0,Yh(e,t,r),Xi=n,Iu=a;break;case 0:case 11:case 14:case 15:if(!yo&&(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)&&HO(r,t,o),a=a.next}while(a!==n)}Yh(e,t,r);break;case 1:if(!yo&&(lv(r,t),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(l){xa(r,t,l)}Yh(e,t,r);break;case 21:Yh(e,t,r);break;case 22:r.mode&1?(yo=(n=yo)||r.memoizedState!==null,Yh(e,t,r),yo=n):Yh(e,t,r);break;default:Yh(e,t,r)}}function RB(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new Hge),t.forEach(function(n){var a=tve.bind(null,e,n);r.has(n)||(r.add(n),n.then(a,a))})}}function wu(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:Xi=l.stateNode,Iu=!1;break e;case 3:Xi=l.stateNode.containerInfo,Iu=!0;break e;case 4:Xi=l.stateNode.containerInfo,Iu=!0;break e}l=l.return}if(Xi===null)throw Error(Ot(160));FJ(i,o,a),Xi=null,Iu=!1;var c=a.alternate;c!==null&&(c.return=null),a.return=null}catch(u){xa(a,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)MJ(t,e),t=t.sibling}function MJ(e,t){var r=e.alternate,n=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(wu(t,e),Nd(e),n&4){try{vw(3,e,e.return),lC(3,e)}catch(p){xa(e,e.return,p)}try{vw(5,e,e.return)}catch(p){xa(e,e.return,p)}}break;case 1:wu(t,e),Nd(e),n&512&&r!==null&&lv(r,r.return);break;case 5:if(wu(t,e),Nd(e),n&512&&r!==null&&lv(r,r.return),e.flags&32){var a=e.stateNode;try{t2(a,"")}catch(p){xa(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&&iZ(a,i),vO(l,o);var u=vO(l,i);for(o=0;o<c.length;o+=2){var d=c[o],f=c[o+1];d==="style"?dZ(a,f):d==="dangerouslySetInnerHTML"?cZ(a,f):d==="children"?t2(a,f):BI(a,d,f,u)}switch(l){case"input":hO(a,i);break;case"textarea":oZ(a,i);break;case"select":var m=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!i.multiple;var h=i.value;h!=null?bv(a,!!i.multiple,h,!1):m!==!!i.multiple&&(i.defaultValue!=null?bv(a,!!i.multiple,i.defaultValue,!0):bv(a,!!i.multiple,i.multiple?[]:"",!1))}a[u2]=i}catch(p){xa(e,e.return,p)}}break;case 6:if(wu(t,e),Nd(e),n&4){if(e.stateNode===null)throw Error(Ot(162));a=e.stateNode,i=e.memoizedProps;try{a.nodeValue=i}catch(p){xa(e,e.return,p)}}break;case 3:if(wu(t,e),Nd(e),n&4&&r!==null&&r.memoizedState.isDehydrated)try{a2(t.containerInfo)}catch(p){xa(e,e.return,p)}break;case 4:wu(t,e),Nd(e);break;case 13:wu(t,e),Nd(e),a=e.child,a.flags&8192&&(i=a.memoizedState!==null,a.stateNode.isHidden=i,!i||a.alternate!==null&&a.alternate.memoizedState!==null||(yR=Da())),n&4&&RB(e);break;case 22:if(d=r!==null&&r.memoizedState!==null,e.mode&1?(yo=(u=yo)||d,wu(t,e),yo=u):wu(t,e),Nd(e),n&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(tr=e,d=e.child;d!==null;){for(f=tr=d;tr!==null;){switch(m=tr,h=m.child,m.tag){case 0:case 11:case 14:case 15:vw(4,m,m.return);break;case 1:lv(m,m.return);var x=m.stateNode;if(typeof x.componentWillUnmount=="function"){n=m,r=m.return;try{t=n,x.props=t.memoizedProps,x.state=t.memoizedState,x.componentWillUnmount()}catch(p){xa(n,r,p)}}break;case 5:lv(m,m.return);break;case 22:if(m.memoizedState!==null){FB(f);continue}}h!==null?(h.return=m,tr=h):FB(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=uZ("display",o))}catch(p){xa(e,e.return,p)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?"":f.memoizedProps}catch(p){xa(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:wu(t,e),Nd(e),n&4&&RB(e);break;case 21:break;default:wu(t,e),Nd(e)}}function Nd(e){var t=e.flags;if(t&2){try{e:{for(var r=e.return;r!==null;){if(LJ(r)){var n=r;break e}r=r.return}throw Error(Ot(160))}switch(n.tag){case 5:var a=n.stateNode;n.flags&32&&(t2(a,""),n.flags&=-33);var i=IB(e);KO(e,i,a);break;case 3:case 4:var o=n.stateNode.containerInfo,l=IB(e);GO(e,l,o);break;default:throw Error(Ot(161))}}catch(c){xa(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Gge(e,t,r){tr=e,$J(e)}function $J(e,t,r){for(var n=(e.mode&1)!==0;tr!==null;){var a=tr,i=a.child;if(a.tag===22&&n){var o=a.memoizedState!==null||PN;if(!o){var l=a.alternate,c=l!==null&&l.memoizedState!==null||yo;l=PN;var u=yo;if(PN=o,(yo=c)&&!u)for(tr=a;tr!==null;)o=tr,c=o.child,o.tag===22&&o.memoizedState!==null?MB(a):c!==null?(c.return=o,tr=c):MB(a);for(;i!==null;)tr=i,$J(i),i=i.sibling;tr=a,PN=l,yo=u}LB(e)}else a.subtreeFlags&8772&&i!==null?(i.return=a,tr=i):LB(e)}}function LB(e){for(;tr!==null;){var t=tr;if(t.flags&8772){var r=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:yo||lC(5,t);break;case 1:var n=t.stateNode;if(t.flags&4&&!yo)if(r===null)n.componentDidMount();else{var a=t.elementType===t.type?r.memoizedProps:Tu(t.type,r.memoizedProps);n.componentDidUpdate(a,r.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&bB(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}bB(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&&a2(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Ot(163))}yo||t.flags&512&&WO(t)}catch(m){xa(t,t.return,m)}}if(t===e){tr=null;break}if(r=t.sibling,r!==null){r.return=t.return,tr=r;break}tr=t.return}}function FB(e){for(;tr!==null;){var t=tr;if(t===e){tr=null;break}var r=t.sibling;if(r!==null){r.return=t.return,tr=r;break}tr=t.return}}function MB(e){for(;tr!==null;){var t=tr;try{switch(t.tag){case 0:case 11:case 15:var r=t.return;try{lC(4,t)}catch(c){xa(t,r,c)}break;case 1:var n=t.stateNode;if(typeof n.componentDidMount=="function"){var a=t.return;try{n.componentDidMount()}catch(c){xa(t,a,c)}}var i=t.return;try{WO(t)}catch(c){xa(t,i,c)}break;case 5:var o=t.return;try{WO(t)}catch(c){xa(t,o,c)}}}catch(c){xa(t,t.return,c)}if(t===e){tr=null;break}var l=t.sibling;if(l!==null){l.return=t.return,tr=l;break}tr=t.return}}var Kge=Math.ceil,K5=Sh.ReactCurrentDispatcher,gR=Sh.ReactCurrentOwner,Wc=Sh.ReactCurrentBatchConfig,Ln=0,Ri=null,Ya=null,eo=0,zl=0,cv=_p(0),yi=0,x2=null,c0=0,cC=0,vR=0,yw=null,fl=null,yR=0,cy=1/0,$f=null,X5=!1,XO=null,Wm=null,ON=!1,Om=null,Y5=0,bw=0,YO=null,a5=-1,i5=0;function Go(){return Ln&6?Da():a5!==-1?a5:a5=Da()}function Gm(e){return e.mode&1?Ln&2&&eo!==0?eo&-eo:Pge.transition!==null?(i5===0&&(i5=_Z()),i5):(e=cs,e!==0||(e=window.event,e=e===void 0?16:TZ(e.type)),e):1}function Hu(e,t,r,n){if(50<bw)throw bw=0,YO=null,Error(Ot(185));Uj(e,r,n),(!(Ln&2)||e!==Ri)&&(e===Ri&&(!(Ln&2)&&(cC|=r),yi===4&&mm(e,eo)),yl(e,n),r===1&&Ln===0&&!(t.mode&1)&&(cy=Da()+500,aC&&Np()))}function yl(e,t){var r=e.callbackNode;P0e(e,t);var n=D5(e,e===Ri?eo:0);if(n===0)r!==null&&G$(r),e.callbackNode=null,e.callbackPriority=0;else if(t=n&-n,e.callbackPriority!==t){if(r!=null&&G$(r),t===1)e.tag===0?Tge($B.bind(null,e)):XZ($B.bind(null,e)),kge(function(){!(Ln&6)&&Np()}),r=null;else{switch(NZ(n)){case 1:r=HI;break;case 4:r=wZ;break;case 16:r=O5;break;case 536870912:r=jZ;break;default:r=O5}r=GJ(r,BJ.bind(null,e))}e.callbackPriority=t,e.callbackNode=r}}function BJ(e,t){if(a5=-1,i5=0,Ln&6)throw Error(Ot(327));var r=e.callbackNode;if(Sv()&&e.callbackNode!==r)return null;var n=D5(e,e===Ri?eo:0);if(n===0)return null;if(n&30||n&e.expiredLanes||t)t=Z5(e,n);else{t=n;var a=Ln;Ln|=2;var i=qJ();(Ri!==e||eo!==t)&&($f=null,cy=Da()+500,Ux(e,t));do try{Zge();break}catch(l){zJ(e,l)}while(!0);sR(),K5.current=i,Ln=a,Ya!==null?t=0:(Ri=null,eo=0,t=yi)}if(t!==0){if(t===2&&(a=_O(e),a!==0&&(n=a,t=ZO(e,a))),t===1)throw r=x2,Ux(e,0),mm(e,n),yl(e,Da()),r;if(t===6)mm(e,n);else{if(a=e.current.alternate,!(n&30)&&!Xge(a)&&(t=Z5(e,n),t===2&&(i=_O(e),i!==0&&(n=i,t=ZO(e,i))),t===1))throw r=x2,Ux(e,0),mm(e,n),yl(e,Da()),r;switch(e.finishedWork=a,e.finishedLanes=n,t){case 0:case 1:throw Error(Ot(345));case 2:ux(e,fl,$f);break;case 3:if(mm(e,n),(n&130023424)===n&&(t=yR+500-Da(),10<t)){if(D5(e,0)!==0)break;if(a=e.suspendedLanes,(a&n)!==n){Go(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=PO(ux.bind(null,e,fl,$f),t);break}ux(e,fl,$f);break;case 4:if(mm(e,n),(n&4194240)===n)break;for(t=e.eventTimes,a=-1;0<n;){var o=31-Vu(n);i=1<<o,o=t[o],o>a&&(a=o),n&=~i}if(n=a,n=Da()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*Kge(n/1960))-n,10<n){e.timeoutHandle=PO(ux.bind(null,e,fl,$f),n);break}ux(e,fl,$f);break;case 5:ux(e,fl,$f);break;default:throw Error(Ot(329))}}}return yl(e,Da()),e.callbackNode===r?BJ.bind(null,e):null}function ZO(e,t){var r=yw;return e.current.memoizedState.isDehydrated&&(Ux(e,t).flags|=256),e=Z5(e,t),e!==2&&(t=fl,fl=r,t!==null&&JO(t)),e}function JO(e){fl===null?fl=e:fl.push.apply(fl,e)}function Xge(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(!Ju(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 mm(e,t){for(t&=~vR,t&=~cC,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var r=31-Vu(t),n=1<<r;e[r]=-1,t&=~n}}function $B(e){if(Ln&6)throw Error(Ot(327));Sv();var t=D5(e,0);if(!(t&1))return yl(e,Da()),null;var r=Z5(e,t);if(e.tag!==0&&r===2){var n=_O(e);n!==0&&(t=n,r=ZO(e,n))}if(r===1)throw r=x2,Ux(e,0),mm(e,t),yl(e,Da()),r;if(r===6)throw Error(Ot(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,ux(e,fl,$f),yl(e,Da()),null}function bR(e,t){var r=Ln;Ln|=1;try{return e(t)}finally{Ln=r,Ln===0&&(cy=Da()+500,aC&&Np())}}function u0(e){Om!==null&&Om.tag===0&&!(Ln&6)&&Sv();var t=Ln;Ln|=1;var r=Wc.transition,n=cs;try{if(Wc.transition=null,cs=1,e)return e()}finally{cs=n,Wc.transition=r,Ln=t,!(Ln&6)&&Np()}}function wR(){zl=cv.current,Vs(cv)}function Ux(e,t){e.finishedWork=null,e.finishedLanes=0;var r=e.timeoutHandle;if(r!==-1&&(e.timeoutHandle=-1,Sge(r)),Ya!==null)for(r=Ya.return;r!==null;){var n=r;switch(tR(n),n.tag){case 1:n=n.type.childContextTypes,n!=null&&M5();break;case 3:oy(),Vs(gl),Vs(ko),uR();break;case 5:cR(n);break;case 4:oy();break;case 13:Vs(aa);break;case 19:Vs(aa);break;case 10:aR(n.type._context);break;case 22:case 23:wR()}r=r.return}if(Ri=e,Ya=e=Km(e.current,null),eo=zl=t,yi=0,x2=null,vR=cC=c0=0,fl=yw=null,Sx!==null){for(t=0;t<Sx.length;t++)if(r=Sx[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}Sx=null}return e}function zJ(e,t){do{var r=Ya;try{if(sR(),r5.current=G5,W5){for(var n=oa.memoizedState;n!==null;){var a=n.queue;a!==null&&(a.pending=null),n=n.next}W5=!1}if(l0=0,Ei=hi=oa=null,gw=!1,h2=0,gR.current=null,r===null||r.return===null){yi=1,x2=t,Ya=null;break}e:{var i=e,o=r.return,l=r,c=t;if(t=eo,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=kB(o);if(h!==null){h.flags&=-257,CB(h,o,l,i,t),h.mode&1&&SB(i,u,t),t=h,c=u;var x=t.updateQueue;if(x===null){var p=new Set;p.add(c),t.updateQueue=p}else x.add(c);break e}else{if(!(t&1)){SB(i,u,t),jR();break e}c=Error(Ot(426))}}else if(Ys&&l.mode&1){var g=kB(o);if(g!==null){!(g.flags&65536)&&(g.flags|=256),CB(g,o,l,i,t),rR(ly(c,l));break e}}i=c=ly(c,l),yi!==4&&(yi=2),yw===null?yw=[i]:yw.push(i),i=o;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var v=NJ(i,c,t);yB(i,v);break e;case 1:l=c;var y=i.type,b=i.stateNode;if(!(i.flags&128)&&(typeof y.getDerivedStateFromError=="function"||b!==null&&typeof b.componentDidCatch=="function"&&(Wm===null||!Wm.has(b)))){i.flags|=65536,t&=-t,i.lanes|=t;var N=SJ(i,l,t);yB(i,N);break e}}i=i.return}while(i!==null)}VJ(r)}catch(j){t=j,Ya===r&&r!==null&&(Ya=r=r.return);continue}break}while(!0)}function qJ(){var e=K5.current;return K5.current=G5,e===null?G5:e}function jR(){(yi===0||yi===3||yi===2)&&(yi=4),Ri===null||!(c0&268435455)&&!(cC&268435455)||mm(Ri,eo)}function Z5(e,t){var r=Ln;Ln|=2;var n=qJ();(Ri!==e||eo!==t)&&($f=null,Ux(e,t));do try{Yge();break}catch(a){zJ(e,a)}while(!0);if(sR(),Ln=r,K5.current=n,Ya!==null)throw Error(Ot(261));return Ri=null,eo=0,yi}function Yge(){for(;Ya!==null;)UJ(Ya)}function Zge(){for(;Ya!==null&&!j0e();)UJ(Ya)}function UJ(e){var t=WJ(e.alternate,e,zl);e.memoizedProps=e.pendingProps,t===null?VJ(e):Ya=t,gR.current=null}function VJ(e){var t=e;do{var r=t.alternate;if(e=t.return,t.flags&32768){if(r=Vge(r,t),r!==null){r.flags&=32767,Ya=r;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{yi=6,Ya=null;return}}else if(r=Uge(r,t,zl),r!==null){Ya=r;return}if(t=t.sibling,t!==null){Ya=t;return}Ya=t=e}while(t!==null);yi===0&&(yi=5)}function ux(e,t,r){var n=cs,a=Wc.transition;try{Wc.transition=null,cs=1,Jge(e,t,r,n)}finally{Wc.transition=a,cs=n}return null}function Jge(e,t,r,n){do Sv();while(Om!==null);if(Ln&6)throw Error(Ot(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(Ot(177));e.callbackNode=null,e.callbackPriority=0;var i=r.lanes|r.childLanes;if(O0e(e,i),e===Ri&&(Ya=Ri=null,eo=0),!(r.subtreeFlags&2064)&&!(r.flags&2064)||ON||(ON=!0,GJ(O5,function(){return Sv(),null})),i=(r.flags&15990)!==0,r.subtreeFlags&15990||i){i=Wc.transition,Wc.transition=null;var o=cs;cs=1;var l=Ln;Ln|=4,gR.current=null,Wge(e,r),MJ(r,e),vge(AO),I5=!!EO,AO=EO=null,e.current=r,Gge(r),_0e(),Ln=l,cs=o,Wc.transition=i}else e.current=r;if(ON&&(ON=!1,Om=e,Y5=a),i=e.pendingLanes,i===0&&(Wm=null),k0e(r.stateNode),yl(e,Da()),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(X5)throw X5=!1,e=XO,XO=null,e;return Y5&1&&e.tag!==0&&Sv(),i=e.pendingLanes,i&1?e===YO?bw++:(bw=0,YO=e):bw=0,Np(),null}function Sv(){if(Om!==null){var e=NZ(Y5),t=Wc.transition,r=cs;try{if(Wc.transition=null,cs=16>e?16:e,Om===null)var n=!1;else{if(e=Om,Om=null,Y5=0,Ln&6)throw Error(Ot(331));var a=Ln;for(Ln|=4,tr=e.current;tr!==null;){var i=tr,o=i.child;if(tr.flags&16){var l=i.deletions;if(l!==null){for(var c=0;c<l.length;c++){var u=l[c];for(tr=u;tr!==null;){var d=tr;switch(d.tag){case 0:case 11:case 15:vw(8,d,i)}var f=d.child;if(f!==null)f.return=d,tr=f;else for(;tr!==null;){d=tr;var m=d.sibling,h=d.return;if(RJ(d),d===u){tr=null;break}if(m!==null){m.return=h,tr=m;break}tr=h}}}var x=i.alternate;if(x!==null){var p=x.child;if(p!==null){x.child=null;do{var g=p.sibling;p.sibling=null,p=g}while(p!==null)}}tr=i}}if(i.subtreeFlags&2064&&o!==null)o.return=i,tr=o;else e:for(;tr!==null;){if(i=tr,i.flags&2048)switch(i.tag){case 0:case 11:case 15:vw(9,i,i.return)}var v=i.sibling;if(v!==null){v.return=i.return,tr=v;break e}tr=i.return}}var y=e.current;for(tr=y;tr!==null;){o=tr;var b=o.child;if(o.subtreeFlags&2064&&b!==null)b.return=o,tr=b;else e:for(o=y;tr!==null;){if(l=tr,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:lC(9,l)}}catch(j){xa(l,l.return,j)}if(l===o){tr=null;break e}var N=l.sibling;if(N!==null){N.return=l.return,tr=N;break e}tr=l.return}}if(Ln=a,Np(),Gd&&typeof Gd.onPostCommitFiberRoot=="function")try{Gd.onPostCommitFiberRoot(eC,e)}catch{}n=!0}return n}finally{cs=r,Wc.transition=t}}return!1}function BB(e,t,r){t=ly(r,t),t=NJ(e,t,1),e=Hm(e,t,1),t=Go(),e!==null&&(Uj(e,1,t),yl(e,t))}function xa(e,t,r){if(e.tag===3)BB(e,e,r);else for(;t!==null;){if(t.tag===3){BB(t,e,r);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(Wm===null||!Wm.has(n))){e=ly(r,e),e=SJ(t,e,1),t=Hm(t,e,1),e=Go(),t!==null&&(Uj(t,1,e),yl(t,e));break}}t=t.return}}function Qge(e,t,r){var n=e.pingCache;n!==null&&n.delete(t),t=Go(),e.pingedLanes|=e.suspendedLanes&r,Ri===e&&(eo&r)===r&&(yi===4||yi===3&&(eo&130023424)===eo&&500>Da()-yR?Ux(e,0):vR|=r),yl(e,t)}function HJ(e,t){t===0&&(e.mode&1?(t=jN,jN<<=1,!(jN&130023424)&&(jN=4194304)):t=1);var r=Go();e=dh(e,t),e!==null&&(Uj(e,t,r),yl(e,r))}function eve(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),HJ(e,r)}function tve(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(Ot(314))}n!==null&&n.delete(t),HJ(e,r)}var WJ;WJ=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||gl.current)pl=!0;else{if(!(e.lanes&r)&&!(t.flags&128))return pl=!1,qge(e,t,r);pl=!!(e.flags&131072)}else pl=!1,Ys&&t.flags&1048576&&YZ(t,z5,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;s5(e,t),e=t.pendingProps;var a=sy(t,ko.current);Nv(t,r),a=fR(null,t,n,e,a,r);var i=hR();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,vl(n)?(i=!0,$5(t)):i=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,oR(t),a.updater=oC,t.stateNode=a,a._reactInternals=t,MO(t,n,e,r),t=zO(null,t,n,!0,i,r)):(t.tag=0,Ys&&i&&eR(t),Fo(null,t,a,r),t=t.child),t;case 16:n=t.elementType;e:{switch(s5(e,t),e=t.pendingProps,a=n._init,n=a(n._payload),t.type=n,a=t.tag=nve(n),e=Tu(n,e),a){case 0:t=BO(null,t,n,e,r);break e;case 1:t=TB(null,t,n,e,r);break e;case 11:t=EB(null,t,n,e,r);break e;case 14:t=AB(null,t,n,Tu(n.type,e),r);break e}throw Error(Ot(306,n,""))}return t;case 0:return n=t.type,a=t.pendingProps,a=t.elementType===n?a:Tu(n,a),BO(e,t,n,a,r);case 1:return n=t.type,a=t.pendingProps,a=t.elementType===n?a:Tu(n,a),TB(e,t,n,a,r);case 3:e:{if(AJ(t),e===null)throw Error(Ot(387));n=t.pendingProps,i=t.memoizedState,a=i.element,rJ(e,t),V5(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=ly(Error(Ot(423)),t),t=PB(e,t,n,r,a);break e}else if(n!==a){a=ly(Error(Ot(424)),t),t=PB(e,t,n,r,a);break e}else for(Jl=Vm(t.stateNode.containerInfo.firstChild),rc=t,Ys=!0,Fu=null,r=eJ(t,null,n,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(ay(),n===a){t=fh(e,t,r);break e}Fo(e,t,n,r)}t=t.child}return t;case 5:return nJ(t),e===null&&RO(t),n=t.type,a=t.pendingProps,i=e!==null?e.memoizedProps:null,o=a.children,TO(n,a)?o=null:i!==null&&TO(n,i)&&(t.flags|=32),EJ(e,t),Fo(e,t,o,r),t.child;case 6:return e===null&&RO(t),null;case 13:return TJ(e,t,r);case 4:return lR(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=iy(t,null,n,r):Fo(e,t,n,r),t.child;case 11:return n=t.type,a=t.pendingProps,a=t.elementType===n?a:Tu(n,a),EB(e,t,n,a,r);case 7:return Fo(e,t,t.pendingProps,r),t.child;case 8:return Fo(e,t,t.pendingProps.children,r),t.child;case 12:return Fo(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,As(q5,n._currentValue),n._currentValue=o,i!==null)if(Ju(i.value,o)){if(i.children===a.children&&!gl.current){t=fh(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=eh(-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),LO(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(Ot(341));o.lanes|=r,l=o.alternate,l!==null&&(l.lanes|=r),LO(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}Fo(e,t,a.children,r),t=t.child}return t;case 9:return a=t.type,n=t.pendingProps.children,Nv(t,r),a=tu(a),n=n(a),t.flags|=1,Fo(e,t,n,r),t.child;case 14:return n=t.type,a=Tu(n,t.pendingProps),a=Tu(n.type,a),AB(e,t,n,a,r);case 15:return kJ(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,a=t.pendingProps,a=t.elementType===n?a:Tu(n,a),s5(e,t),t.tag=1,vl(n)?(e=!0,$5(t)):e=!1,Nv(t,r),_J(t,n,a),MO(t,n,a,r),zO(null,t,n,!0,e,r);case 19:return PJ(e,t,r);case 22:return CJ(e,t,r)}throw Error(Ot(156,t.tag))};function GJ(e,t){return bZ(e,t)}function rve(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 qc(e,t,r,n){return new rve(e,t,r,n)}function _R(e){return e=e.prototype,!(!e||!e.isReactComponent)}function nve(e){if(typeof e=="function")return _R(e)?1:0;if(e!=null){if(e=e.$$typeof,e===qI)return 11;if(e===UI)return 14}return 2}function Km(e,t){var r=e.alternate;return r===null?(r=qc(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 o5(e,t,r,n,a,i){var o=2;if(n=e,typeof e=="function")_R(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case Qg:return Vx(r.children,a,i,t);case zI:o=8,a|=8;break;case lO:return e=qc(12,r,t,a|2),e.elementType=lO,e.lanes=i,e;case cO:return e=qc(13,r,t,a),e.elementType=cO,e.lanes=i,e;case uO:return e=qc(19,r,t,a),e.elementType=uO,e.lanes=i,e;case nZ:return uC(r,a,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case tZ:o=10;break e;case rZ:o=9;break e;case qI:o=11;break e;case UI:o=14;break e;case cm:o=16,n=null;break e}throw Error(Ot(130,e==null?e:typeof e,""))}return t=qc(o,r,t,a),t.elementType=e,t.type=n,t.lanes=i,t}function Vx(e,t,r,n){return e=qc(7,e,n,t),e.lanes=r,e}function uC(e,t,r,n){return e=qc(22,e,n,t),e.elementType=nZ,e.lanes=r,e.stateNode={isHidden:!1},e}function F3(e,t,r){return e=qc(6,e,null,t),e.lanes=r,e}function M3(e,t,r){return t=qc(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function sve(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=v3(0),this.expirationTimes=v3(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=v3(0),this.identifierPrefix=n,this.onRecoverableError=a,this.mutableSourceEagerHydrationData=null}function NR(e,t,r,n,a,i,o,l,c){return e=new sve(e,t,r,l,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=qc(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},oR(i),e}function ave(e,t,r){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Jg,key:n==null?null:""+n,children:e,containerInfo:t,implementation:r}}function KJ(e){if(!e)return rp;e=e._reactInternals;e:{if($0(e)!==e||e.tag!==1)throw Error(Ot(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(vl(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(Ot(171))}if(e.tag===1){var r=e.type;if(vl(r))return KZ(e,r,t)}return t}function XJ(e,t,r,n,a,i,o,l,c){return e=NR(r,n,!0,e,a,i,o,l,c),e.context=KJ(null),r=e.current,n=Go(),a=Gm(r),i=eh(n,a),i.callback=t??null,Hm(r,i,a),e.current.lanes=a,Uj(e,a,n),yl(e,n),e}function dC(e,t,r,n){var a=t.current,i=Go(),o=Gm(a);return r=KJ(r),t.context===null?t.context=r:t.pendingContext=r,t=eh(i,o),t.payload={element:e},n=n===void 0?null:n,n!==null&&(t.callback=n),e=Hm(a,t,o),e!==null&&(Hu(e,a,o,i),t5(e,a,o)),o}function J5(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 zB(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<t?r:t}}function SR(e,t){zB(e,t),(e=e.alternate)&&zB(e,t)}function ive(){return null}var YJ=typeof reportError=="function"?reportError:function(e){console.error(e)};function kR(e){this._internalRoot=e}fC.prototype.render=kR.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(Ot(409));dC(e,t,null,null)};fC.prototype.unmount=kR.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;u0(function(){dC(null,e,null,null)}),t[uh]=null}};function fC(e){this._internalRoot=e}fC.prototype.unstable_scheduleHydration=function(e){if(e){var t=CZ();e={blockedOn:null,target:e,priority:t};for(var r=0;r<hm.length&&t!==0&&t<hm[r].priority;r++);hm.splice(r,0,e),r===0&&AZ(e)}};function CR(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function hC(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function qB(){}function ove(e,t,r,n,a){if(a){if(typeof n=="function"){var i=n;n=function(){var u=J5(o);i.call(u)}}var o=XJ(t,n,e,0,null,!1,!1,"",qB);return e._reactRootContainer=o,e[uh]=o.current,l2(e.nodeType===8?e.parentNode:e),u0(),o}for(;a=e.lastChild;)e.removeChild(a);if(typeof n=="function"){var l=n;n=function(){var u=J5(c);l.call(u)}}var c=NR(e,0,!1,null,null,!1,!1,"",qB);return e._reactRootContainer=c,e[uh]=c.current,l2(e.nodeType===8?e.parentNode:e),u0(function(){dC(t,c,r,n)}),c}function mC(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=J5(o);l.call(c)}}dC(t,o,e,a)}else o=ove(r,t,e,a,n);return J5(o)}SZ=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var r=Qb(t.pendingLanes);r!==0&&(WI(t,r|1),yl(t,Da()),!(Ln&6)&&(cy=Da()+500,Np()))}break;case 13:u0(function(){var n=dh(e,1);if(n!==null){var a=Go();Hu(n,e,1,a)}}),SR(e,1)}};GI=function(e){if(e.tag===13){var t=dh(e,134217728);if(t!==null){var r=Go();Hu(t,e,134217728,r)}SR(e,134217728)}};kZ=function(e){if(e.tag===13){var t=Gm(e),r=dh(e,t);if(r!==null){var n=Go();Hu(r,e,t,n)}SR(e,t)}};CZ=function(){return cs};EZ=function(e,t){var r=cs;try{return cs=e,t()}finally{cs=r}};bO=function(e,t,r){switch(t){case"input":if(hO(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=sC(n);if(!a)throw Error(Ot(90));aZ(n),hO(n,a)}}}break;case"textarea":oZ(e,r);break;case"select":t=r.value,t!=null&&bv(e,!!r.multiple,t,!1)}};mZ=bR;pZ=u0;var lve={usingClientEntryPoint:!1,Events:[Hj,nv,sC,fZ,hZ,bR]},Sb={findFiberByHostInstance:Nx,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},cve={bundleType:Sb.bundleType,version:Sb.version,rendererPackageName:Sb.rendererPackageName,rendererConfig:Sb.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Sh.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=vZ(e),e===null?null:e.stateNode},findFiberByHostInstance:Sb.findFiberByHostInstance||ive,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 DN=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!DN.isDisabled&&DN.supportsFiber)try{eC=DN.inject(cve),Gd=DN}catch{}}fc.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=lve;fc.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!CR(t))throw Error(Ot(200));return ave(e,t,null,r)};fc.createRoot=function(e,t){if(!CR(e))throw Error(Ot(299));var r=!1,n="",a=YJ;return t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(n=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),t=NR(e,1,!1,null,null,r,!1,n,a),e[uh]=t.current,l2(e.nodeType===8?e.parentNode:e),new kR(t)};fc.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(Ot(188)):(e=Object.keys(e).join(","),Error(Ot(268,e)));return e=vZ(t),e=e===null?null:e.stateNode,e};fc.flushSync=function(e){return u0(e)};fc.hydrate=function(e,t,r){if(!hC(t))throw Error(Ot(200));return mC(null,e,t,!0,r)};fc.hydrateRoot=function(e,t,r){if(!CR(e))throw Error(Ot(405));var n=r!=null&&r.hydratedSources||null,a=!1,i="",o=YJ;if(r!=null&&(r.unstable_strictMode===!0&&(a=!0),r.identifierPrefix!==void 0&&(i=r.identifierPrefix),r.onRecoverableError!==void 0&&(o=r.onRecoverableError)),t=XJ(t,null,e,1,r??null,a,!1,i,o),e[uh]=t.current,l2(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 fC(t)};fc.render=function(e,t,r){if(!hC(t))throw Error(Ot(200));return mC(null,e,t,!1,r)};fc.unmountComponentAtNode=function(e){if(!hC(e))throw Error(Ot(40));return e._reactRootContainer?(u0(function(){mC(null,null,e,!1,function(){e._reactRootContainer=null,e[uh]=null})}),!0):!1};fc.unstable_batchedUpdates=bR;fc.unstable_renderSubtreeIntoContainer=function(e,t,r,n){if(!hC(r))throw Error(Ot(200));if(e==null||e._reactInternals===void 0)throw Error(Ot(38));return mC(e,t,r,!1,n)};fc.version="18.3.1-next-f1338f8080-20240426";function ZJ(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(ZJ)}catch(e){console.error(e)}}ZJ(),ZY.exports=fc;var Uc=ZY.exports;const JJ=Sn(Uc);var QJ,UB=Uc;QJ=UB.createRoot,UB.hydrateRoot;const uve=1,dve=1e6;let $3=0;function fve(){return $3=($3+1)%Number.MAX_SAFE_INTEGER,$3.toString()}const B3=new Map,VB=e=>{if(B3.has(e))return;const t=setTimeout(()=>{B3.delete(e),ww({type:"REMOVE_TOAST",toastId:e})},dve);B3.set(e,t)},hve=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,uve)};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?VB(r):e.toasts.forEach(n=>{VB(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)}}},l5=[];let c5={toasts:[]};function ww(e){c5=hve(c5,e),l5.forEach(t=>{t(c5)})}function mve({...e}){const t=fve(),r=a=>ww({type:"UPDATE_TOAST",toast:{...a,id:t}}),n=()=>ww({type:"DISMISS_TOAST",toastId:t});return ww({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:a=>{a||n()}}}),{id:t,dismiss:n,update:r}}function eQ(){const[e,t]=w.useState(c5);return w.useEffect(()=>(l5.push(t),()=>{const r=l5.indexOf(t);r>-1&&l5.splice(r,1)}),[e]),{...e,toast:mve,dismiss:r=>ww({type:"DISMISS_TOAST",toastId:r})}}function Tt(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 HB(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function hh(...e){return t=>{let r=!1;const n=e.map(a=>{const i=HB(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():HB(e[a],null)}}}}function Pr(...e){return w.useCallback(hh(...e),e)}function pve(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 ei(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,...x}=f,p=((v=m==null?void 0:m[e])==null?void 0:v[c])||l,g=w.useMemo(()=>x,Object.values(x));return s.jsx(p.Provider,{value:g,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,x=w.useContext(h);if(x)return x;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,xve(a,...t)]}function xve(...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 np(e){const t=gve(e),r=w.forwardRef((n,a)=>{const{children:i,...o}=n,l=w.Children.toArray(i),c=l.find(vve);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 tQ=np("Slot");function gve(e){const t=w.forwardRef((r,n)=>{const{children:a,...i}=r;if(w.isValidElement(a)){const o=bve(a),l=yve(i,a.props);return a.type!==w.Fragment&&(l.ref=n?hh(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 rQ=Symbol("radix.slottable");function nQ(e){const t=({children:r})=>s.jsx(s.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=rQ,t}function vve(e){return w.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===rQ}function yve(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 bve(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 Gj(e){const t=e+"CollectionProvider",[r,n]=ei(t),[a,i]=r(t,{collectionRef:{current:null},itemMap:new Map}),o=p=>{const{scope:g,children:v}=p,y=ye.useRef(null),b=ye.useRef(new Map).current;return s.jsx(a,{scope:g,itemMap:b,collectionRef:y,children:v})};o.displayName=t;const l=e+"CollectionSlot",c=np(l),u=ye.forwardRef((p,g)=>{const{scope:v,children:y}=p,b=i(l,v),N=Pr(g,b.collectionRef);return s.jsx(c,{ref:N,children:y})});u.displayName=l;const d=e+"CollectionItemSlot",f="data-radix-collection-item",m=np(d),h=ye.forwardRef((p,g)=>{const{scope:v,children:y,...b}=p,N=ye.useRef(null),j=Pr(g,N),_=i(d,v);return ye.useEffect(()=>(_.itemMap.set(N,{ref:N,...b}),()=>void _.itemMap.delete(N))),s.jsx(m,{[f]:"",ref:j,children:y})});h.displayName=d;function x(p){const g=i(e+"CollectionConsumer",p);return ye.useCallback(()=>{const y=g.collectionRef.current;if(!y)return[];const b=Array.from(y.querySelectorAll(`[${f}]`));return Array.from(g.itemMap.values()).sort((_,S)=>b.indexOf(_.ref.current)-b.indexOf(S.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:o,Slot:u,ItemSlot:h},x,n]}var wve=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Vt=wve.reduce((e,t)=>{const r=np(`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 ER(e,t){e&&Uc.flushSync(()=>e.dispatchEvent(t))}function ya(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 jve(e,t=globalThis==null?void 0:globalThis.document){const r=ya(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 _ve="DismissableLayer",QO="dismissableLayer.update",Nve="dismissableLayer.pointerDownOutside",Sve="dismissableLayer.focusOutside",WB,sQ=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),B0=w.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:o,onDismiss:l,...c}=e,u=w.useContext(sQ),[d,f]=w.useState(null),m=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=w.useState({}),x=Pr(t,S=>f(S)),p=Array.from(u.layers),[g]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=p.indexOf(g),y=d?p.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,N=y>=v,j=Cve(S=>{const P=S.target,T=[...u.branches].some(R=>R.contains(P));!N||T||(a==null||a(S),o==null||o(S),S.defaultPrevented||l==null||l())},m),_=Eve(S=>{const P=S.target;[...u.branches].some(R=>R.contains(P))||(i==null||i(S),o==null||o(S),S.defaultPrevented||l==null||l())},m);return jve(S=>{y===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&&(WB=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),GB(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=WB)}},[d,m,r,u]),w.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),GB())},[d,u]),w.useEffect(()=>{const S=()=>h({});return document.addEventListener(QO,S),()=>document.removeEventListener(QO,S)},[]),s.jsx(Vt.div,{...c,ref:x,style:{pointerEvents:b?N?"auto":"none":void 0,...e.style},onFocusCapture:Tt(e.onFocusCapture,_.onFocusCapture),onBlurCapture:Tt(e.onBlurCapture,_.onBlurCapture),onPointerDownCapture:Tt(e.onPointerDownCapture,j.onPointerDownCapture)})});B0.displayName=_ve;var kve="DismissableLayerBranch",aQ=w.forwardRef((e,t)=>{const r=w.useContext(sQ),n=w.useRef(null),a=Pr(t,n);return w.useEffect(()=>{const i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),s.jsx(Vt.div,{...e,ref:a})});aQ.displayName=kve;function Cve(e,t=globalThis==null?void 0:globalThis.document){const r=ya(e),n=w.useRef(!1),a=w.useRef(()=>{});return w.useEffect(()=>{const i=l=>{if(l.target&&!n.current){let c=function(){iQ(Nve,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 Eve(e,t=globalThis==null?void 0:globalThis.document){const r=ya(e),n=w.useRef(!1);return w.useEffect(()=>{const a=i=>{i.target&&!n.current&&iQ(Sve,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 GB(){const e=new CustomEvent(QO);document.dispatchEvent(e)}function iQ(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?ER(a,i):a.dispatchEvent(i)}var Ave=B0,Tve=aQ,_a=globalThis!=null&&globalThis.document?w.useLayoutEffect:()=>{},Pve="Portal",t1=w.forwardRef((e,t)=>{var l;const{container:r,...n}=e,[a,i]=w.useState(!1);_a(()=>i(!0),[]);const o=r||a&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return o?JJ.createPortal(s.jsx(Vt.div,{...n,ref:t}),o):null});t1.displayName=Pve;function Ove(e,t){return w.useReducer((r,n)=>t[r][n]??r,e)}var ti=e=>{const{present:t,children:r}=e,n=Dve(t),a=typeof r=="function"?r({present:n.isPresent}):w.Children.only(r),i=Pr(n.ref,Ive(a));return typeof r=="function"||n.isPresent?w.cloneElement(a,{ref:i}):null};ti.displayName="Presence";function Dve(e){const[t,r]=w.useState(),n=w.useRef(null),a=w.useRef(e),i=w.useRef("none"),o=e?"mounted":"unmounted",[l,c]=Ove(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{const u=IN(n.current);i.current=l==="mounted"?u:"none"},[l]),_a(()=>{const u=n.current,d=a.current;if(d!==e){const m=i.current,h=IN(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]),_a(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,f=h=>{const p=IN(n.current).includes(h.animationName);if(h.target===t&&p&&(c("ANIMATION_END"),!a.current)){const g=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=g)})}},m=h=>{h.target===t&&(i.current=IN(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 IN(e){return(e==null?void 0:e.animationName)||"none"}function Ive(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 Rve=FI[" useInsertionEffect ".trim().toString()]||_a;function Zo({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[a,i,o]=Lve({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=Fve(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 Lve({defaultProp:e,onChange:t}){const[r,n]=w.useState(e),a=w.useRef(r),i=w.useRef(t);return Rve(()=>{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 Fve(e){return typeof e=="function"}var oQ=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"}),Mve="VisuallyHidden",pC=w.forwardRef((e,t)=>s.jsx(Vt.span,{...e,ref:t,style:{...oQ,...e.style}}));pC.displayName=Mve;var $ve=pC,AR="ToastProvider",[TR,Bve,zve]=Gj("Toast"),[lQ]=ei("Toast",[zve]),[qve,xC]=lQ(AR),cQ=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 \`${AR}\`. Expected non-empty \`string\`.`),s.jsx(TR.Provider,{scope:t,children:s.jsx(qve,{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})})};cQ.displayName=AR;var uQ="ToastViewport",Uve=["F8"],e6="toast.viewportPause",t6="toast.viewportResume",dQ=w.forwardRef((e,t)=>{const{__scopeToast:r,hotkey:n=Uve,label:a="Notifications ({hotkey})",...i}=e,o=xC(uQ,r),l=Bve(r),c=w.useRef(null),u=w.useRef(null),d=w.useRef(null),f=w.useRef(null),m=Pr(t,f,o.onViewportChange),h=n.join("+").replace(/Key/g,"").replace(/Digit/g,""),x=o.toastCount>0;w.useEffect(()=>{const g=v=>{var b;n.length!==0&&n.every(N=>v[N]||v.code===N)&&((b=f.current)==null||b.focus())};return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[n]),w.useEffect(()=>{const g=c.current,v=f.current;if(x&&g&&v){const y=()=>{if(!o.isClosePausedRef.current){const _=new CustomEvent(e6);v.dispatchEvent(_),o.isClosePausedRef.current=!0}},b=()=>{if(o.isClosePausedRef.current){const _=new CustomEvent(t6);v.dispatchEvent(_),o.isClosePausedRef.current=!1}},N=_=>{!g.contains(_.relatedTarget)&&b()},j=()=>{g.contains(document.activeElement)||b()};return g.addEventListener("focusin",y),g.addEventListener("focusout",N),g.addEventListener("pointermove",y),g.addEventListener("pointerleave",j),window.addEventListener("blur",y),window.addEventListener("focus",b),()=>{g.removeEventListener("focusin",y),g.removeEventListener("focusout",N),g.removeEventListener("pointermove",y),g.removeEventListener("pointerleave",j),window.removeEventListener("blur",y),window.removeEventListener("focus",b)}}},[x,o.isClosePausedRef]);const p=w.useCallback(({tabbingDirection:g})=>{const y=l().map(b=>{const N=b.ref.current,j=[N,...rye(N)];return g==="forwards"?j:j.reverse()});return(g==="forwards"?y.reverse():y).flat()},[l]);return w.useEffect(()=>{const g=f.current;if(g){const v=y=>{var j,_,S;const b=y.altKey||y.ctrlKey||y.metaKey;if(y.key==="Tab"&&!b){const P=document.activeElement,T=y.shiftKey;if(y.target===g&&T){(j=u.current)==null||j.focus();return}const E=p({tabbingDirection:T?"backwards":"forwards"}),q=E.findIndex(O=>O===P);z3(E.slice(q+1))?y.preventDefault():T?(_=u.current)==null||_.focus():(S=d.current)==null||S.focus()}};return g.addEventListener("keydown",v),()=>g.removeEventListener("keydown",v)}},[l,p]),s.jsxs(Tve,{ref:c,role:"region","aria-label":a.replace("{hotkey}",h),tabIndex:-1,style:{pointerEvents:x?void 0:"none"},children:[x&&s.jsx(r6,{ref:u,onFocusFromOutsideViewport:()=>{const g=p({tabbingDirection:"forwards"});z3(g)}}),s.jsx(TR.Slot,{scope:r,children:s.jsx(Vt.ol,{tabIndex:-1,...i,ref:m})}),x&&s.jsx(r6,{ref:d,onFocusFromOutsideViewport:()=>{const g=p({tabbingDirection:"backwards"});z3(g)}})]})});dQ.displayName=uQ;var fQ="ToastFocusProxy",r6=w.forwardRef((e,t)=>{const{__scopeToast:r,onFocusFromOutsideViewport:n,...a}=e,i=xC(fQ,r);return s.jsx(pC,{"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()}})});r6.displayName=fQ;var Kj="Toast",Vve="toast.swipeStart",Hve="toast.swipeMove",Wve="toast.swipeCancel",Gve="toast.swipeEnd",hQ=w.forwardRef((e,t)=>{const{forceMount:r,open:n,defaultOpen:a,onOpenChange:i,...o}=e,[l,c]=Zo({prop:n,defaultProp:a??!0,onChange:i,caller:Kj});return s.jsx(ti,{present:r||l,children:s.jsx(Yve,{open:l,...o,ref:t,onClose:()=>c(!1),onPause:ya(e.onPause),onResume:ya(e.onResume),onSwipeStart:Tt(e.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Tt(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:Tt(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:Tt(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)})})})});hQ.displayName=Kj;var[Kve,Xve]=lQ(Kj,{onClose(){}}),Yve=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,...x}=e,p=xC(Kj,r),[g,v]=w.useState(null),y=Pr(t,O=>v(O)),b=w.useRef(null),N=w.useRef(null),j=a||p.duration,_=w.useRef(0),S=w.useRef(j),P=w.useRef(0),{onToastAdd:T,onToastRemove:R}=p,k=ya(()=>{var L;(g==null?void 0:g.contains(document.activeElement))&&((L=p.viewport)==null||L.focus()),o()}),E=w.useCallback(O=>{!O||O===1/0||(window.clearTimeout(P.current),_.current=new Date().getTime(),P.current=window.setTimeout(k,O))},[k]);w.useEffect(()=>{const O=p.viewport;if(O){const L=()=>{E(S.current),u==null||u()},H=()=>{const V=new Date().getTime()-_.current;S.current=S.current-V,window.clearTimeout(P.current),c==null||c()};return O.addEventListener(e6,H),O.addEventListener(t6,L),()=>{O.removeEventListener(e6,H),O.removeEventListener(t6,L)}}},[p.viewport,j,c,u,E]),w.useEffect(()=>{i&&!p.isClosePausedRef.current&&E(j)},[i,j,p.isClosePausedRef,E]),w.useEffect(()=>(T(),()=>R()),[T,R]);const q=w.useMemo(()=>g?bQ(g):null,[g]);return p.viewport?s.jsxs(s.Fragment,{children:[q&&s.jsx(Zve,{__scopeToast:r,role:"status","aria-live":n==="foreground"?"assertive":"polite","aria-atomic":!0,children:q}),s.jsx(Kve,{scope:r,onClose:k,children:Uc.createPortal(s.jsx(TR.ItemSlot,{scope:r,children:s.jsx(Ave,{asChild:!0,onEscapeKeyDown:Tt(l,()=>{p.isFocusedToastEscapeKeyDownRef.current||k(),p.isFocusedToastEscapeKeyDownRef.current=!1}),children:s.jsx(Vt.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":p.swipeDirection,...x,ref:y,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:Tt(e.onKeyDown,O=>{O.key==="Escape"&&(l==null||l(O.nativeEvent),O.nativeEvent.defaultPrevented||(p.isFocusedToastEscapeKeyDownRef.current=!0,k()))}),onPointerDown:Tt(e.onPointerDown,O=>{O.button===0&&(b.current={x:O.clientX,y:O.clientY})}),onPointerMove:Tt(e.onPointerMove,O=>{if(!b.current)return;const L=O.clientX-b.current.x,H=O.clientY-b.current.y,V=!!N.current,z=["left","right"].includes(p.swipeDirection),M=["left","up"].includes(p.swipeDirection)?Math.min:Math.max,B=z?M(0,L):0,K=z?0:M(0,H),C=O.pointerType==="touch"?10:2,A={x:B,y:K},I={originalEvent:O,delta:A};V?(N.current=A,RN(Hve,f,I,{discrete:!1})):KB(A,p.swipeDirection,C)?(N.current=A,RN(Vve,d,I,{discrete:!1}),O.target.setPointerCapture(O.pointerId)):(Math.abs(L)>C||Math.abs(H)>C)&&(b.current=null)}),onPointerUp:Tt(e.onPointerUp,O=>{const L=N.current,H=O.target;if(H.hasPointerCapture(O.pointerId)&&H.releasePointerCapture(O.pointerId),N.current=null,b.current=null,L){const V=O.currentTarget,z={originalEvent:O,delta:L};KB(L,p.swipeDirection,p.swipeThreshold)?RN(Gve,h,z,{discrete:!0}):RN(Wve,m,z,{discrete:!0}),V.addEventListener("click",M=>M.preventDefault(),{once:!0})}})})})}),p.viewport)})]}):null}),Zve=e=>{const{__scopeToast:t,children:r,...n}=e,a=xC(Kj,t),[i,o]=w.useState(!1),[l,c]=w.useState(!1);return eye(()=>o(!0)),w.useEffect(()=>{const u=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(u)},[]),l?null:s.jsx(t1,{asChild:!0,children:s.jsx(pC,{...n,children:i&&s.jsxs(s.Fragment,{children:[a.label," ",r]})})})},Jve="ToastTitle",mQ=w.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e;return s.jsx(Vt.div,{...n,ref:t})});mQ.displayName=Jve;var Qve="ToastDescription",pQ=w.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e;return s.jsx(Vt.div,{...n,ref:t})});pQ.displayName=Qve;var xQ="ToastAction",gQ=w.forwardRef((e,t)=>{const{altText:r,...n}=e;return r.trim()?s.jsx(yQ,{altText:r,asChild:!0,children:s.jsx(PR,{...n,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${xQ}\`. Expected non-empty \`string\`.`),null)});gQ.displayName=xQ;var vQ="ToastClose",PR=w.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e,a=Xve(vQ,r);return s.jsx(yQ,{asChild:!0,children:s.jsx(Vt.button,{type:"button",...n,ref:t,onClick:Tt(e.onClick,a.onClose)})})});PR.displayName=vQ;var yQ=w.forwardRef((e,t)=>{const{__scopeToast:r,altText:n,...a}=e;return s.jsx(Vt.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":n||void 0,...a,ref:t})});function bQ(e){const t=[];return Array.from(e.childNodes).forEach(n=>{if(n.nodeType===n.TEXT_NODE&&n.textContent&&t.push(n.textContent),tye(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(...bQ(n))}}),t}function RN(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?ER(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 eye(e=()=>{}){const t=ya(e);_a(()=>{let r=0,n=0;return r=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(r),window.cancelAnimationFrame(n)}},[t])}function tye(e){return e.nodeType===e.ELEMENT_NODE}function rye(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 z3(e){const t=document.activeElement;return e.some(r=>r===t?!0:(r.focus(),document.activeElement!==t))}var nye=cQ,wQ=dQ,jQ=hQ,_Q=mQ,NQ=pQ,SQ=gQ,kQ=PR;function CQ(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=CQ(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function tn(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=CQ(e))&&(n&&(n+=" "),n+=t);return n}const XB=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,YB=tn,r1=(e,t)=>r=>{var n;if((t==null?void 0:t.variants)==null)return YB(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=XB(d)||XB(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(x=>{let[p,g]=x;return Array.isArray(g)?g.includes({...i,...l}[p]):{...i,...l}[p]===g})?[...u,f,m]:u},[]);return YB(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 sye=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),EQ=(...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 aye={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 iye=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,...aye,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:EQ("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 lt=(e,t)=>{const r=w.forwardRef(({className:n,...a},i)=>w.createElement(iye,{ref:i,iconNode:t,className:EQ(`lucide-${sye(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 LN=lt("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 AQ=lt("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 Hn=lt("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 Zr=lt("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 n6=lt("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 lu=lt("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 TQ=lt("BadgeCheck",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
* @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 OR=lt("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 s6=lt("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 ZB=lt("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 _l=lt("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 oye=lt("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 Dm=lt("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 Qn=lt("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 lye=lt("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 yr=lt("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 a6=lt("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 gC=lt("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 mh=lt("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 Hs=lt("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 i6=lt("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 n1=lt("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 cye=lt("ChartLine",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]]);/**
* @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 uye=lt("ChartPie",[["path",{d:"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z",key:"pzmjnu"}],["path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83",key:"k2fpak"}]]);/**
* @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 PQ=lt("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 Rn=lt("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 Qu=lt("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 vC=lt("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 nu=lt("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 OQ=lt("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 g2=lt("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 Li=lt("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=lt("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 Zn=lt("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 gx=lt("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 dye=lt("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 vs=lt("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 DR=lt("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 fye=lt("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 hye=lt("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 Ql=lt("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 $r=lt("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 mye=lt("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 Xj=lt("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 DQ=lt("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 pye=lt("Compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
* @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 xye=lt("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 uy=lt("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 gye=lt("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 vye=lt("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 kv=lt("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 FN=lt("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 ro=lt("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 s1=lt("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 Kn=lt("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 yC=lt("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 es=lt("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 JB=lt("FileCheck2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m3 15 2 2 4-4",key:"1lhrkk"}]]);/**
* @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 sp=lt("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 yye=lt("FileDown",[["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:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]]);/**
* @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 o6=lt("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 ph=lt("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 Kt=lt("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 bye=lt("FileX2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m8 12.5-5 5",key:"b853mi"}],["path",{d:"m3 12.5 5 5",key:"1qls4r"}]]);/**
* @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 IR=lt("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 RR=lt("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 wye=lt("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 jye=lt("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 LR=lt("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 IQ=lt("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 ap=lt("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 Na=lt("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 _ye=lt("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 RQ=lt("HeartHandshake",[["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"}],["path",{d:"M12 5 9.04 7.96a2.17 2.17 0 0 0 0 3.08c.82.82 2.13.85 3 .07l2.07-1.9a2.82 2.82 0 0 1 3.79 0l2.96 2.66",key:"4oyue0"}],["path",{d:"m18 15-2-2",key:"60u0ii"}],["path",{d:"m15 18-2-2",key:"6p76be"}]]);/**
* @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=lt("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 MR=lt("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 Nye=lt("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 dy=lt("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 Sye=lt("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 kye=lt("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 Cye=lt("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 $R=lt("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 u5=lt("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 Bu=lt("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 LQ=lt("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 Eye=lt("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 it=lt("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 QB=lt("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 e9=lt("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 _n=lt("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 Is=lt("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 Aye=lt("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 Tye=lt("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 Pye=lt("MessageSquarePlus",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/**
* @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 Fi=lt("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 Oye=lt("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 Dye=lt("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 kb=lt("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 Iye=lt("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 Rye=lt("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 t9=lt("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 bC=lt("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 a1=lt("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 Lye=lt("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 Qa=lt("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 BR=lt("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 Qs=lt("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 l6=lt("Repeat",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]);/**
* @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 q3=lt("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 FQ=lt("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 Fye=lt("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 Mye=lt("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 c6=lt("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 Rs=lt("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 Js=lt("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 $ye=lt("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 wi=lt("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 Jo=lt("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 Bye=lt("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 zye=lt("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 Mi=lt("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 MQ=lt("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 no=lt("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 Sp=lt("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 ri=lt("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 ed=lt("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 td=lt("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 qye=lt("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 lc=lt("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 fy=lt("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 r9=lt("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 rd=lt("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 Uye=lt("UserX",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]]);/**
* @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 Ko=lt("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 er=lt("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 Vye=lt("Wallet",[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]]);/**
* @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 v2=lt("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 Hye=lt("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 $i=lt("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 wC=lt("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"}]]),zR="-",Wye=e=>{const t=Kye(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:o=>{const l=o.split(zR);return l[0]===""&&l.length!==1&&l.shift(),$Q(l,t)||Gye(o)},getConflictingClassGroupIds:(o,l)=>{const c=r[o]||[];return l&&n[o]?[...c,...n[o]]:c}}},$Q=(e,t)=>{var o;if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),a=n?$Q(e.slice(1),n):void 0;if(a)return a;if(t.validators.length===0)return;const i=e.join(zR);return(o=t.validators.find(({validator:l})=>l(i)))==null?void 0:o.classGroupId},n9=/^\[(.+)\]$/,Gye=e=>{if(n9.test(e)){const t=n9.exec(e)[1],r=t==null?void 0:t.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},Kye=e=>{const{theme:t,prefix:r}=e,n={nextPart:new Map,validators:[]};return Yye(Object.entries(e.classGroups),r).forEach(([i,o])=>{u6(o,n,i,t)}),n},u6=(e,t,r,n)=>{e.forEach(a=>{if(typeof a=="string"){const i=a===""?t:s9(t,a);i.classGroupId=r;return}if(typeof a=="function"){if(Xye(a)){u6(a(n),t,r,n);return}t.validators.push({validator:a,classGroupId:r});return}Object.entries(a).forEach(([i,o])=>{u6(o,s9(t,i),r,n)})})},s9=(e,t)=>{let r=e;return t.split(zR).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},Xye=e=>e.isThemeGetter,Yye=(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,Zye=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)}}},BQ="!",Jye=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 g=0;g<l.length;g++){let v=l[g];if(u===0){if(v===a&&(n||l.slice(g,g+i)===t)){c.push(l.slice(d,g)),d=g+i;continue}if(v==="/"){f=g;continue}}v==="["?u++:v==="]"&&u--}const m=c.length===0?l:l.substring(d),h=m.startsWith(BQ),x=h?m.substring(1):m,p=f&&f>d?f-d:void 0;return{modifiers:c,hasImportantModifier:h,baseClassName:x,maybePostfixModifierPosition:p}};return r?l=>r({className:l,parseClassName:o}):o},Qye=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},e1e=e=>({cache:Zye(e.cacheSize),parseClassName:Jye(e),...Wye(e)}),t1e=/\s+/,r1e=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a}=t,i=[],o=e.trim().split(t1e);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 x=!!h,p=n(x?m.substring(0,h):m);if(!p){if(!x){l=u+(l.length>0?" "+l:l);continue}if(p=n(m),!p){l=u+(l.length>0?" "+l:l);continue}x=!1}const g=Qye(d).join(":"),v=f?g+BQ:g,y=v+p;if(i.includes(y))continue;i.push(y);const b=a(p,x);for(let N=0;N<b.length;++N){const j=b[N];i.push(v+j)}l=u+(l.length>0?" "+l:l)}return l};function n1e(){let e=0,t,r,n="";for(;e<arguments.length;)(t=arguments[e++])&&(r=zQ(t))&&(n&&(n+=" "),n+=r);return n}const zQ=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=zQ(e[n]))&&(r&&(r+=" "),r+=t);return r};function s1e(e,...t){let r,n,a,i=o;function o(c){const u=t.reduce((d,f)=>f(d),e());return r=e1e(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=r1e(c,r);return a(c,d),d}return function(){return i(n1e.apply(null,arguments))}}const Ms=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},qQ=/^\[(?:([a-z-]+):)?(.+)\]$/i,a1e=/^\d+\/\d+$/,i1e=new Set(["px","full","screen"]),o1e=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,l1e=/\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$/,c1e=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,u1e=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,d1e=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Of=e=>Cv(e)||i1e.has(e)||a1e.test(e),Zh=e=>i1(e,"length",y1e),Cv=e=>!!e&&!Number.isNaN(Number(e)),U3=e=>i1(e,"number",Cv),Cb=e=>!!e&&Number.isInteger(Number(e)),f1e=e=>e.endsWith("%")&&Cv(e.slice(0,-1)),ln=e=>qQ.test(e),Jh=e=>o1e.test(e),h1e=new Set(["length","size","percentage"]),m1e=e=>i1(e,h1e,UQ),p1e=e=>i1(e,"position",UQ),x1e=new Set(["image","url"]),g1e=e=>i1(e,x1e,w1e),v1e=e=>i1(e,"",b1e),Eb=()=>!0,i1=(e,t,r)=>{const n=qQ.exec(e);return n?n[1]?typeof t=="string"?n[1]===t:t.has(n[1]):r(n[2]):!1},y1e=e=>l1e.test(e)&&!c1e.test(e),UQ=()=>!1,b1e=e=>u1e.test(e),w1e=e=>d1e.test(e),j1e=()=>{const e=Ms("colors"),t=Ms("spacing"),r=Ms("blur"),n=Ms("brightness"),a=Ms("borderColor"),i=Ms("borderRadius"),o=Ms("borderSpacing"),l=Ms("borderWidth"),c=Ms("contrast"),u=Ms("grayscale"),d=Ms("hueRotate"),f=Ms("invert"),m=Ms("gap"),h=Ms("gradientColorStops"),x=Ms("gradientColorStopPositions"),p=Ms("inset"),g=Ms("margin"),v=Ms("opacity"),y=Ms("padding"),b=Ms("saturate"),N=Ms("scale"),j=Ms("sepia"),_=Ms("skew"),S=Ms("space"),P=Ms("translate"),T=()=>["auto","contain","none"],R=()=>["auto","hidden","clip","visible","scroll"],k=()=>["auto",ln,t],E=()=>[ln,t],q=()=>["",Of,Zh],O=()=>["auto",Cv,ln],L=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],H=()=>["solid","dashed","dotted","double","none"],V=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],z=()=>["start","end","center","between","around","evenly","stretch"],M=()=>["","0",ln],B=()=>["auto","avoid","all","avoid-page","page","left","right","column"],K=()=>[Cv,ln];return{cacheSize:500,separator:":",theme:{colors:[Eb],spacing:[Of,Zh],blur:["none","",Jh,ln],brightness:K(),borderColor:[e],borderRadius:["none","","full",Jh,ln],borderSpacing:E(),borderWidth:q(),contrast:K(),grayscale:M(),hueRotate:K(),invert:M(),gap:E(),gradientColorStops:[e],gradientColorStopPositions:[f1e,Zh],inset:k(),margin:k(),opacity:K(),padding:E(),saturate:K(),scale:K(),sepia:M(),skew:K(),space:E(),translate:E()},classGroups:{aspect:[{aspect:["auto","square","video",ln]}],container:["container"],columns:[{columns:[Jh]}],"break-after":[{"break-after":B()}],"break-before":[{"break-before":B()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...L(),ln]}],overflow:[{overflow:R()}],"overflow-x":[{"overflow-x":R()}],"overflow-y":[{"overflow-y":R()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],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",Cb,ln]}],basis:[{basis:k()}],"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",Cb,ln]}],"grid-cols":[{"grid-cols":[Eb]}],"col-start-end":[{col:["auto",{span:["full",Cb,ln]},ln]}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":[Eb]}],"row-start-end":[{row:["auto",{span:[Cb,ln]},ln]}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"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",...z()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...z(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...z(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[y]}],px:[{px:[y]}],py:[{py:[y]}],ps:[{ps:[y]}],pe:[{pe:[y]}],pt:[{pt:[y]}],pr:[{pr:[y]}],pb:[{pb:[y]}],pl:[{pl:[y]}],m:[{m:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"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:[Jh]},Jh]}],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",Jh,Zh]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",U3]}],"font-family":[{font:[Eb]}],"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",Cv,U3]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Of,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",Of,Zh]}],"underline-offset":[{"underline-offset":["auto",Of,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:E()}],"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:[...L(),p1e]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",m1e]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},g1e]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[x]}],"gradient-via-pos":[{via:[x]}],"gradient-to-pos":[{to:[x]}],"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":[Of,ln]}],"outline-w":[{outline:[Of,Zh]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:q()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[v]}],"ring-offset-w":[{"ring-offset":[Of,Zh]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Jh,v1e]}],"shadow-color":[{shadow:[Eb]}],opacity:[{opacity:[v]}],"mix-blend":[{"mix-blend":[...V(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":V()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",Jh,ln]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[f]}],saturate:[{saturate:[b]}],sepia:[{sepia:[j]}],"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":[b]}],"backdrop-sepia":[{"backdrop-sepia":[j]}],"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:[Cb,ln]}],"translate-x":[{"translate-x":[P]}],"translate-y":[{"translate-y":[P]}],"skew-x":[{"skew-x":[_]}],"skew-y":[{"skew-y":[_]}],"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":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"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:[Of,Zh,U3]}],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"]}}},_1e=s1e(j1e);function yt(...e){return _1e(tn(e))}const N1e=nye,VQ=w.forwardRef(({className:e,...t},r)=>s.jsx(wQ,{ref:r,className:yt("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}));VQ.displayName=wQ.displayName;const S1e=r1("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"}}),HQ=w.forwardRef(({className:e,variant:t,...r},n)=>s.jsx(jQ,{ref:n,className:yt(S1e({variant:t}),e),...r}));HQ.displayName=jQ.displayName;const k1e=w.forwardRef(({className:e,...t},r)=>s.jsx(SQ,{ref:r,className:yt("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}));k1e.displayName=SQ.displayName;const WQ=w.forwardRef(({className:e,...t},r)=>s.jsx(kQ,{ref:r,className:yt("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($i,{className:"h-4 w-4"})}));WQ.displayName=kQ.displayName;const GQ=w.forwardRef(({className:e,...t},r)=>s.jsx(_Q,{ref:r,className:yt("text-sm font-semibold",e),...t}));GQ.displayName=_Q.displayName;const KQ=w.forwardRef(({className:e,...t},r)=>s.jsx(NQ,{ref:r,className:yt("text-sm opacity-90",e),...t}));KQ.displayName=NQ.displayName;function C1e(){const{toasts:e}=eQ();return s.jsxs(N1e,{children:[e.map(function({id:t,title:r,description:n,action:a,...i}){return s.jsxs(HQ,{...i,children:[s.jsxs("div",{className:"grid gap-1",children:[r&&s.jsx(GQ,{children:r}),n&&s.jsx(KQ,{children:n})]}),a,s.jsx(WQ,{})]},t)}),s.jsx(VQ,{})]})}var a9=["light","dark"],E1e="(prefers-color-scheme: dark)",A1e=w.createContext(void 0),T1e={setTheme:e=>{},themes:[]},P1e=()=>{var e;return(e=w.useContext(A1e))!=null?e:T1e};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(x=>`'${x}'`).join(",")})`};`:`var d=document.documentElement,n='${r}',s='setAttribute';`,f=a?a9.includes(i)&&i?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${i}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",m=(x,p=!1,g=!0)=>{let v=o?o[x]:x,y=p?x+"|| ''":`'${v}'`,b="";return a&&g&&!p&&a9.includes(x)&&(b+=`d.style.colorScheme = '${x}';`),r==="class"?p||v?b+=`c.add(${y})`:b+="null":v&&(b+=`d[s](n,${y})`),b},h=e?`!function(){${d}${m(e)}}()`:n?`!function(){try{${d}var e=localStorage.getItem('${t}');if('system'===e||(!e&&${u})){var t='${E1e}',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 O1e=e=>{switch(e){case"success":return R1e;case"info":return F1e;case"warning":return L1e;case"error":return M1e;default:return null}},D1e=Array(12).fill(0),I1e=({visible:e,className:t})=>ye.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},ye.createElement("div",{className:"sonner-spinner"},D1e.map((r,n)=>ye.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),R1e=ye.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ye.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"})),L1e=ye.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},ye.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"})),F1e=ye.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ye.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"})),M1e=ye.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ye.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"})),$1e=ye.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"},ye.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),ye.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),B1e=()=>{let[e,t]=ye.useState(document.hidden);return ye.useEffect(()=>{let r=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e},d6=1,z1e=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:d6++,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],ye.isValidElement(u))i=!1,this.create({id:n,type:"default",message:u});else if(U1e(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)||d6++;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}},ul=new z1e,q1e=(e,t)=>{let r=(t==null?void 0:t.id)||d6++;return ul.addToast({title:e,...t,id:r}),r},U1e=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",V1e=q1e,H1e=()=>ul.toasts,W1e=()=>ul.getActiveToasts(),ae=Object.assign(V1e,{success:ul.success,info:ul.info,warning:ul.warning,error:ul.error,custom:ul.custom,message:ul.message,promise:ul.promise,dismiss:ul.dismiss,loading:ul.loading},{getHistory:H1e,getToasts:W1e});function G1e(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))}G1e(`: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 MN(e){return e.label!==void 0}var K1e=3,X1e="32px",Y1e="16px",i9=4e3,Z1e=356,J1e=14,Q1e=20,ebe=200;function ju(...e){return e.filter(Boolean).join(" ")}function tbe(e){let[t,r]=e.split("-"),n=[];return t&&n.push(t),r&&n.push(r),n}var rbe=e=>{var t,r,n,a,i,o,l,c,u,d,f;let{invert:m,toast:h,unstyled:x,interacting:p,setHeights:g,visibleToasts:v,heights:y,index:b,toasts:N,expanded:j,removeToast:_,defaultRichColors:S,closeButton:P,style:T,cancelButtonStyle:R,actionButtonStyle:k,className:E="",descriptionClassName:q="",duration:O,position:L,gap:H,loadingIcon:V,expandByDefault:z,classNames:M,icons:B,closeButtonAriaLabel:K="Close toast",pauseWhenPageIsHidden:C}=e,[A,I]=ye.useState(null),[U,Y]=ye.useState(null),[te,re]=ye.useState(!1),[J,ie]=ye.useState(!1),[be,Q]=ye.useState(!1),[Ve,W]=ye.useState(!1),[Z,he]=ye.useState(!1),[se,oe]=ye.useState(0),[le,Me]=ye.useState(0),de=ye.useRef(h.duration||O||i9),me=ye.useRef(null),Le=ye.useRef(null),Ke=b===0,ve=b+1<=v,_e=h.type,Ue=h.dismissible!==!1,Qe=h.className||"",st=h.descriptionClassName||"",Fe=ye.useMemo(()=>y.findIndex(Gt=>Gt.toastId===h.id)||0,[y,h.id]),Ge=ye.useMemo(()=>{var Gt;return(Gt=h.closeButton)!=null?Gt:P},[h.closeButton,P]),ht=ye.useMemo(()=>h.duration||O||i9,[h.duration,O]),ut=ye.useRef(0),Mt=ye.useRef(0),Wt=ye.useRef(0),zt=ye.useRef(null),[Lt,or]=L.split("-"),Yt=ye.useMemo(()=>y.reduce((Gt,Jt,mr)=>mr>=Fe?Gt:Gt+Jt.height,0),[y,Fe]),ot=B1e(),fr=h.invert||m,Et=_e==="loading";Mt.current=ye.useMemo(()=>Fe*H+Yt,[Fe,Yt]),ye.useEffect(()=>{de.current=ht},[ht]),ye.useEffect(()=>{re(!0)},[]),ye.useEffect(()=>{let Gt=Le.current;if(Gt){let Jt=Gt.getBoundingClientRect().height;return Me(Jt),g(mr=>[{toastId:h.id,height:Jt,position:h.position},...mr]),()=>g(mr=>mr.filter(mn=>mn.toastId!==h.id))}},[g,h.id]),ye.useLayoutEffect(()=>{if(!te)return;let Gt=Le.current,Jt=Gt.style.height;Gt.style.height="auto";let mr=Gt.getBoundingClientRect().height;Gt.style.height=Jt,Me(mr),g(mn=>mn.find(Xt=>Xt.toastId===h.id)?mn.map(Xt=>Xt.toastId===h.id?{...Xt,height:mr}:Xt):[{toastId:h.id,height:mr,position:h.position},...mn])},[te,h.title,h.description,g,h.id]);let Ct=ye.useCallback(()=>{ie(!0),oe(Mt.current),g(Gt=>Gt.filter(Jt=>Jt.toastId!==h.id)),setTimeout(()=>{_(h)},ebe)},[h,_,g,Mt]);ye.useEffect(()=>{if(h.promise&&_e==="loading"||h.duration===1/0||h.type==="loading")return;let Gt;return j||p||C&&ot?(()=>{if(Wt.current<ut.current){let Jt=new Date().getTime()-ut.current;de.current=de.current-Jt}Wt.current=new Date().getTime()})():de.current!==1/0&&(ut.current=new Date().getTime(),Gt=setTimeout(()=>{var Jt;(Jt=h.onAutoClose)==null||Jt.call(h,h),Ct()},de.current)),()=>clearTimeout(Gt)},[j,p,h,_e,C,ot,Ct]),ye.useEffect(()=>{h.delete&&Ct()},[Ct,h.delete]);function hr(){var Gt,Jt,mr;return B!=null&&B.loading?ye.createElement("div",{className:ju(M==null?void 0:M.loader,(Gt=h==null?void 0:h.classNames)==null?void 0:Gt.loader,"sonner-loader"),"data-visible":_e==="loading"},B.loading):V?ye.createElement("div",{className:ju(M==null?void 0:M.loader,(Jt=h==null?void 0:h.classNames)==null?void 0:Jt.loader,"sonner-loader"),"data-visible":_e==="loading"},V):ye.createElement(I1e,{className:ju(M==null?void 0:M.loader,(mr=h==null?void 0:h.classNames)==null?void 0:mr.loader),visible:_e==="loading"})}return ye.createElement("li",{tabIndex:0,ref:Le,className:ju(E,Qe,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||x),"data-mounted":te,"data-promise":!!h.promise,"data-swiped":Z,"data-removed":J,"data-visible":ve,"data-y-position":Lt,"data-x-position":or,"data-index":b,"data-front":Ke,"data-swiping":be,"data-dismissible":Ue,"data-type":_e,"data-invert":fr,"data-swipe-out":Ve,"data-swipe-direction":U,"data-expanded":!!(j||z&&te),style:{"--index":b,"--toasts-before":b,"--z-index":N.length-b,"--offset":`${J?se:Mt.current}px`,"--initial-height":z?"auto":`${le}px`,...T,...h.style},onDragEnd:()=>{Q(!1),I(null),zt.current=null},onPointerDown:Gt=>{Et||!Ue||(me.current=new Date,oe(Mt.current),Gt.target.setPointerCapture(Gt.pointerId),Gt.target.tagName!=="BUTTON"&&(Q(!0),zt.current={x:Gt.clientX,y:Gt.clientY}))},onPointerUp:()=>{var Gt,Jt,mr,mn;if(Ve||!Ue)return;zt.current=null;let Xt=Number(((Gt=Le.current)==null?void 0:Gt.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),fn=Number(((Jt=Le.current)==null?void 0:Jt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Xn=new Date().getTime()-((mr=me.current)==null?void 0:mr.getTime()),rn=A==="x"?Xt:fn,wn=Math.abs(rn)/Xn;if(Math.abs(rn)>=Q1e||wn>.11){oe(Mt.current),(mn=h.onDismiss)==null||mn.call(h,h),Y(A==="x"?Xt>0?"right":"left":fn>0?"down":"up"),Ct(),W(!0),he(!1);return}Q(!1),I(null)},onPointerMove:Gt=>{var Jt,mr,mn,Xt;if(!zt.current||!Ue||((Jt=window.getSelection())==null?void 0:Jt.toString().length)>0)return;let fn=Gt.clientY-zt.current.y,Xn=Gt.clientX-zt.current.x,rn=(mr=e.swipeDirections)!=null?mr:tbe(L);!A&&(Math.abs(Xn)>1||Math.abs(fn)>1)&&I(Math.abs(Xn)>Math.abs(fn)?"x":"y");let wn={x:0,y:0};A==="y"?(rn.includes("top")||rn.includes("bottom"))&&(rn.includes("top")&&fn<0||rn.includes("bottom")&&fn>0)&&(wn.y=fn):A==="x"&&(rn.includes("left")||rn.includes("right"))&&(rn.includes("left")&&Xn<0||rn.includes("right")&&Xn>0)&&(wn.x=Xn),(Math.abs(wn.x)>0||Math.abs(wn.y)>0)&&he(!0),(mn=Le.current)==null||mn.style.setProperty("--swipe-amount-x",`${wn.x}px`),(Xt=Le.current)==null||Xt.style.setProperty("--swipe-amount-y",`${wn.y}px`)}},Ge&&!h.jsx?ye.createElement("button",{"aria-label":K,"data-disabled":Et,"data-close-button":!0,onClick:Et||!Ue?()=>{}:()=>{var Gt;Ct(),(Gt=h.onDismiss)==null||Gt.call(h,h)},className:ju(M==null?void 0:M.closeButton,(a=h==null?void 0:h.classNames)==null?void 0:a.closeButton)},(i=B==null?void 0:B.close)!=null?i:$1e):null,h.jsx||w.isValidElement(h.title)?h.jsx?h.jsx:typeof h.title=="function"?h.title():h.title:ye.createElement(ye.Fragment,null,_e||h.icon||h.promise?ye.createElement("div",{"data-icon":"",className:ju(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||hr():null,h.type!=="loading"?h.icon||(B==null?void 0:B[_e])||O1e(_e):null):null,ye.createElement("div",{"data-content":"",className:ju(M==null?void 0:M.content,(l=h==null?void 0:h.classNames)==null?void 0:l.content)},ye.createElement("div",{"data-title":"",className:ju(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?ye.createElement("div",{"data-description":"",className:ju(q,st,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&&MN(h.cancel)?ye.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||R,onClick:Gt=>{var Jt,mr;MN(h.cancel)&&Ue&&((mr=(Jt=h.cancel).onClick)==null||mr.call(Jt,Gt),Ct())},className:ju(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&&MN(h.action)?ye.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||k,onClick:Gt=>{var Jt,mr;MN(h.action)&&((mr=(Jt=h.action).onClick)==null||mr.call(Jt,Gt),!Gt.defaultPrevented&&Ct())},className:ju(M==null?void 0:M.actionButton,(f=h==null?void 0:h.classNames)==null?void 0:f.actionButton)},h.action.label):null))};function o9(){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 nbe(e,t){let r={};return[e,t].forEach((n,a)=>{let i=a===1,o=i?"--mobile-offset":"--offset",l=i?Y1e:X1e;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 sbe=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:x=K1e,toastOptions:p,dir:g=o9(),gap:v=J1e,loadingIcon:y,icons:b,containerAriaLabel:N="Notifications",pauseWhenPageIsHidden:j}=e,[_,S]=ye.useState([]),P=ye.useMemo(()=>Array.from(new Set([n].concat(_.filter(C=>C.position).map(C=>C.position)))),[_,n]),[T,R]=ye.useState([]),[k,E]=ye.useState(!1),[q,O]=ye.useState(!1),[L,H]=ye.useState(d!=="system"?d:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),V=ye.useRef(null),z=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),M=ye.useRef(null),B=ye.useRef(!1),K=ye.useCallback(C=>{S(A=>{var I;return(I=A.find(U=>U.id===C.id))!=null&&I.delete||ul.dismiss(C.id),A.filter(({id:U})=>U!==C.id)})},[]);return ye.useEffect(()=>ul.subscribe(C=>{if(C.dismiss){S(A=>A.map(I=>I.id===C.id?{...I,delete:!0}:I));return}setTimeout(()=>{JJ.flushSync(()=>{S(A=>{let I=A.findIndex(U=>U.id===C.id);return I!==-1?[...A.slice(0,I),{...A[I],...C},...A.slice(I+1)]:[C,...A]})})})}),[]),ye.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 C=window.matchMedia("(prefers-color-scheme: dark)");try{C.addEventListener("change",({matches:A})=>{H(A?"dark":"light")})}catch{C.addListener(({matches:I})=>{try{H(I?"dark":"light")}catch(U){console.error(U)}})}},[d]),ye.useEffect(()=>{_.length<=1&&E(!1)},[_]),ye.useEffect(()=>{let C=A=>{var I,U;a.every(Y=>A[Y]||A.code===Y)&&(E(!0),(I=V.current)==null||I.focus()),A.code==="Escape"&&(document.activeElement===V.current||(U=V.current)!=null&&U.contains(document.activeElement))&&E(!1)};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[a]),ye.useEffect(()=>{if(V.current)return()=>{M.current&&(M.current.focus({preventScroll:!0}),M.current=null,B.current=!1)}},[V.current]),ye.createElement("section",{ref:t,"aria-label":`${N} ${z}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},P.map((C,A)=>{var I;let[U,Y]=C.split("-");return _.length?ye.createElement("ol",{key:C,dir:g==="auto"?o9():g,tabIndex:-1,ref:V,className:l,"data-sonner-toaster":!0,"data-theme":L,"data-y-position":U,"data-lifted":k&&_.length>1&&!i,"data-x-position":Y,style:{"--front-toast-height":`${((I=T[0])==null?void 0:I.height)||0}px`,"--width":`${Z1e}px`,"--gap":`${v}px`,...h,...nbe(c,u)},onBlur:te=>{B.current&&!te.currentTarget.contains(te.relatedTarget)&&(B.current=!1,M.current&&(M.current.focus({preventScroll:!0}),M.current=null))},onFocus:te=>{te.target instanceof HTMLElement&&te.target.dataset.dismissible==="false"||B.current||(B.current=!0,M.current=te.relatedTarget)},onMouseEnter:()=>E(!0),onMouseMove:()=>E(!0),onMouseLeave:()=>{q||E(!1)},onDragEnd:()=>E(!1),onPointerDown:te=>{te.target instanceof HTMLElement&&te.target.dataset.dismissible==="false"||O(!0)},onPointerUp:()=>O(!1)},_.filter(te=>!te.position&&A===0||te.position===C).map((te,re)=>{var J,ie;return ye.createElement(rbe,{key:te.id,icons:b,index:re,toast:te,defaultRichColors:f,duration:(J=p==null?void 0:p.duration)!=null?J:m,className:p==null?void 0:p.className,descriptionClassName:p==null?void 0:p.descriptionClassName,invert:r,visibleToasts:x,closeButton:(ie=p==null?void 0:p.closeButton)!=null?ie:o,interacting:q,position:C,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:_.filter(be=>be.position==te.position),heights:T.filter(be=>be.position==te.position),setHeights:R,expandByDefault:i,gap:v,loadingIcon:y,expanded:k,pauseWhenPageIsHidden:j,swipeDirections:e.swipeDirections})})):null}))});const abe=({...e})=>{const{theme:t="system"}=P1e();return s.jsx(sbe,{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 ibe=FI[" useId ".trim().toString()]||(()=>{}),obe=0;function Za(e){const[t,r]=w.useState(ibe());return _a(()=>{r(n=>n??String(obe++))},[e]),t?`radix-${t}`:""}const lbe=["top","right","bottom","left"],ip=Math.min,Vl=Math.max,Q5=Math.round,$N=Math.floor,Xd=e=>({x:e,y:e}),cbe={left:"right",right:"left",bottom:"top",top:"bottom"},ube={start:"end",end:"start"};function f6(e,t,r){return Vl(e,ip(t,r))}function xh(e,t){return typeof e=="function"?e(t):e}function gh(e){return e.split("-")[0]}function o1(e){return e.split("-")[1]}function qR(e){return e==="x"?"y":"x"}function UR(e){return e==="y"?"height":"width"}const dbe=new Set(["top","bottom"]);function zd(e){return dbe.has(gh(e))?"y":"x"}function VR(e){return qR(zd(e))}function fbe(e,t,r){r===void 0&&(r=!1);const n=o1(e),a=VR(e),i=UR(a);let o=a==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(o=e4(o)),[o,e4(o)]}function hbe(e){const t=e4(e);return[h6(e),t,h6(t)]}function h6(e){return e.replace(/start|end/g,t=>ube[t])}const l9=["left","right"],c9=["right","left"],mbe=["top","bottom"],pbe=["bottom","top"];function xbe(e,t,r){switch(e){case"top":case"bottom":return r?t?c9:l9:t?l9:c9;case"left":case"right":return t?mbe:pbe;default:return[]}}function gbe(e,t,r,n){const a=o1(e);let i=xbe(gh(e),r==="start",n);return a&&(i=i.map(o=>o+"-"+a),t&&(i=i.concat(i.map(h6)))),i}function e4(e){return e.replace(/left|right|bottom|top/g,t=>cbe[t])}function vbe(e){return{top:0,right:0,bottom:0,left:0,...e}}function XQ(e){return typeof e!="number"?vbe(e):{top:e,right:e,bottom:e,left:e}}function t4(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 u9(e,t,r){let{reference:n,floating:a}=e;const i=zd(t),o=VR(t),l=UR(o),c=gh(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(o1(t)){case"start":h[o]-=m*(r&&u?-1:1);break;case"end":h[o]+=m*(r&&u?-1:1);break}return h}const ybe=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}=u9(u,n,c),m=n,h={},x=0;for(let p=0;p<l.length;p++){const{name:g,fn:v}=l[p],{x:y,y:b,data:N,reset:j}=await v({x:d,y:f,initialPlacement:n,placement:m,strategy:a,middlewareData:h,rects:u,platform:o,elements:{reference:e,floating:t}});d=y??d,f=b??f,h={...h,[g]:{...h[g],...N}},j&&x<=50&&(x++,typeof j=="object"&&(j.placement&&(m=j.placement),j.rects&&(u=j.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:a}):j.rects),{x:d,y:f}=u9(u,m,c)),p=-1)}return{x:d,y:f,placement:m,strategy:a,middlewareData:h}};async function y2(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}=xh(t,e),x=XQ(h),g=l[m?f==="floating"?"reference":"floating":f],v=t4(await i.getClippingRect({element:(r=await(i.isElement==null?void 0:i.isElement(g)))==null||r?g:g.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:u,rootBoundary:d,strategy:c})),y=f==="floating"?{x:n,y:a,width:o.floating.width,height:o.floating.height}:o.reference,b=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),N=await(i.isElement==null?void 0:i.isElement(b))?await(i.getScale==null?void 0:i.getScale(b))||{x:1,y:1}:{x:1,y:1},j=t4(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:y,offsetParent:b,strategy:c}):y);return{top:(v.top-j.top+x.top)/N.y,bottom:(j.bottom-v.bottom+x.bottom)/N.y,left:(v.left-j.left+x.left)/N.x,right:(j.right-v.right+x.right)/N.x}}const bbe=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}=xh(e,t)||{};if(u==null)return{};const f=XQ(d),m={x:r,y:n},h=VR(a),x=UR(h),p=await o.getDimensions(u),g=h==="y",v=g?"top":"left",y=g?"bottom":"right",b=g?"clientHeight":"clientWidth",N=i.reference[x]+i.reference[h]-m[h]-i.floating[x],j=m[h]-i.reference[h],_=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let S=_?_[b]:0;(!S||!await(o.isElement==null?void 0:o.isElement(_)))&&(S=l.floating[b]||i.floating[x]);const P=N/2-j/2,T=S/2-p[x]/2-1,R=ip(f[v],T),k=ip(f[y],T),E=R,q=S-p[x]-k,O=S/2-p[x]/2+P,L=f6(E,O,q),H=!c.arrow&&o1(a)!=null&&O!==L&&i.reference[x]/2-(O<E?R:k)-p[x]/2<0,V=H?O<E?O-E:O-q:0;return{[h]:m[h]+V,data:{[h]:L,centerOffset:O-L-V,...H&&{alignmentOffset:V}},reset:H}}}),wbe=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:x="none",flipAlignment:p=!0,...g}=xh(e,t);if((r=i.arrow)!=null&&r.alignmentOffset)return{};const v=gh(a),y=zd(l),b=gh(l)===l,N=await(c.isRTL==null?void 0:c.isRTL(u.floating)),j=m||(b||!p?[e4(l)]:hbe(l)),_=x!=="none";!m&&_&&j.push(...gbe(l,p,x,N));const S=[l,...j],P=await y2(t,g),T=[];let R=((n=i.flip)==null?void 0:n.overflows)||[];if(d&&T.push(P[v]),f){const O=fbe(a,o,N);T.push(P[O[0]],P[O[1]])}if(R=[...R,{placement:a,overflows:T}],!T.every(O=>O<=0)){var k,E;const O=(((k=i.flip)==null?void 0:k.index)||0)+1,L=S[O];if(L&&(!(f==="alignment"?y!==zd(L):!1)||R.every(z=>z.overflows[0]>0&&zd(z.placement)===y)))return{data:{index:O,overflows:R},reset:{placement:L}};let H=(E=R.filter(V=>V.overflows[0]<=0).sort((V,z)=>V.overflows[1]-z.overflows[1])[0])==null?void 0:E.placement;if(!H)switch(h){case"bestFit":{var q;const V=(q=R.filter(z=>{if(_){const M=zd(z.placement);return M===y||M==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(M=>M>0).reduce((M,B)=>M+B,0)]).sort((z,M)=>z[1]-M[1])[0])==null?void 0:q[0];V&&(H=V);break}case"initialPlacement":H=l;break}if(a!==H)return{reset:{placement:H}}}return{}}}};function d9(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function f9(e){return lbe.some(t=>e[t]>=0)}const jbe=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:n="referenceHidden",...a}=xh(e,t);switch(n){case"referenceHidden":{const i=await y2(t,{...a,elementContext:"reference"}),o=d9(i,r.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:f9(o)}}}case"escaped":{const i=await y2(t,{...a,altBoundary:!0}),o=d9(i,r.floating);return{data:{escapedOffsets:o,escaped:f9(o)}}}default:return{}}}}},YQ=new Set(["left","top"]);async function _be(e,t){const{placement:r,platform:n,elements:a}=e,i=await(n.isRTL==null?void 0:n.isRTL(a.floating)),o=gh(r),l=o1(r),c=zd(r)==="y",u=YQ.has(o)?-1:1,d=i&&c?-1:1,f=xh(t,e);let{mainAxis:m,crossAxis:h,alignmentAxis:x}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof x=="number"&&(h=l==="end"?x*-1:x),c?{x:h*d,y:m*u}:{x:m*u,y:h*d}}const Nbe=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 _be(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}}}}},Sbe=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:g=>{let{x:v,y}=g;return{x:v,y}}},...c}=xh(e,t),u={x:r,y:n},d=await y2(t,c),f=zd(gh(a)),m=qR(f);let h=u[m],x=u[f];if(i){const g=m==="y"?"top":"left",v=m==="y"?"bottom":"right",y=h+d[g],b=h-d[v];h=f6(y,h,b)}if(o){const g=f==="y"?"top":"left",v=f==="y"?"bottom":"right",y=x+d[g],b=x-d[v];x=f6(y,x,b)}const p=l.fn({...t,[m]:h,[f]:x});return{...p,data:{x:p.x-r,y:p.y-n,enabled:{[m]:i,[f]:o}}}}}},kbe=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}=xh(e,t),d={x:r,y:n},f=zd(a),m=qR(f);let h=d[m],x=d[f];const p=xh(l,t),g=typeof p=="number"?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(c){const b=m==="y"?"height":"width",N=i.reference[m]-i.floating[b]+g.mainAxis,j=i.reference[m]+i.reference[b]-g.mainAxis;h<N?h=N:h>j&&(h=j)}if(u){var v,y;const b=m==="y"?"width":"height",N=YQ.has(gh(a)),j=i.reference[f]-i.floating[b]+(N&&((v=o.offset)==null?void 0:v[f])||0)+(N?0:g.crossAxis),_=i.reference[f]+i.reference[b]+(N?0:((y=o.offset)==null?void 0:y[f])||0)-(N?g.crossAxis:0);x<j?x=j:x>_&&(x=_)}return{[m]:h,[f]:x}}}},Cbe=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}=xh(e,t),d=await y2(t,u),f=gh(a),m=o1(a),h=zd(a)==="y",{width:x,height:p}=i.floating;let g,v;f==="top"||f==="bottom"?(g=f,v=m===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(v=f,g=m==="end"?"top":"bottom");const y=p-d.top-d.bottom,b=x-d.left-d.right,N=ip(p-d[g],y),j=ip(x-d[v],b),_=!t.middlewareData.shift;let S=N,P=j;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(P=b),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(S=y),_&&!m){const R=Vl(d.left,0),k=Vl(d.right,0),E=Vl(d.top,0),q=Vl(d.bottom,0);h?P=x-2*(R!==0||k!==0?R+k:Vl(d.left,d.right)):S=p-2*(E!==0||q!==0?E+q:Vl(d.top,d.bottom))}await c({...t,availableWidth:P,availableHeight:S});const T=await o.getDimensions(l.floating);return x!==T.width||p!==T.height?{reset:{rects:!0}}:{}}}};function jC(){return typeof window<"u"}function l1(e){return ZQ(e)?(e.nodeName||"").toLowerCase():"#document"}function nc(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function of(e){var t;return(t=(ZQ(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function ZQ(e){return jC()?e instanceof Node||e instanceof nc(e).Node:!1}function nd(e){return jC()?e instanceof Element||e instanceof nc(e).Element:!1}function tf(e){return jC()?e instanceof HTMLElement||e instanceof nc(e).HTMLElement:!1}function h9(e){return!jC()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof nc(e).ShadowRoot}const Ebe=new Set(["inline","contents"]);function Yj(e){const{overflow:t,overflowX:r,overflowY:n,display:a}=sd(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!Ebe.has(a)}const Abe=new Set(["table","td","th"]);function Tbe(e){return Abe.has(l1(e))}const Pbe=[":popover-open",":modal"];function _C(e){return Pbe.some(t=>{try{return e.matches(t)}catch{return!1}})}const Obe=["transform","translate","scale","rotate","perspective"],Dbe=["transform","translate","scale","rotate","perspective","filter"],Ibe=["paint","layout","strict","content"];function HR(e){const t=WR(),r=nd(e)?sd(e):e;return Obe.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)||Dbe.some(n=>(r.willChange||"").includes(n))||Ibe.some(n=>(r.contain||"").includes(n))}function Rbe(e){let t=op(e);for(;tf(t)&&!hy(t);){if(HR(t))return t;if(_C(t))return null;t=op(t)}return null}function WR(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Lbe=new Set(["html","body","#document"]);function hy(e){return Lbe.has(l1(e))}function sd(e){return nc(e).getComputedStyle(e)}function NC(e){return nd(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function op(e){if(l1(e)==="html")return e;const t=e.assignedSlot||e.parentNode||h9(e)&&e.host||of(e);return h9(t)?t.host:t}function JQ(e){const t=op(e);return hy(t)?e.ownerDocument?e.ownerDocument.body:e.body:tf(t)&&Yj(t)?t:JQ(t)}function b2(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const a=JQ(e),i=a===((n=e.ownerDocument)==null?void 0:n.body),o=nc(a);if(i){const l=m6(o);return t.concat(o,o.visualViewport||[],Yj(a)?a:[],l&&r?b2(l):[])}return t.concat(a,b2(a,[],r))}function m6(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function QQ(e){const t=sd(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const a=tf(e),i=a?e.offsetWidth:r,o=a?e.offsetHeight:n,l=Q5(r)!==i||Q5(n)!==o;return l&&(r=i,n=o),{width:r,height:n,$:l}}function GR(e){return nd(e)?e:e.contextElement}function Ev(e){const t=GR(e);if(!tf(t))return Xd(1);const r=t.getBoundingClientRect(),{width:n,height:a,$:i}=QQ(t);let o=(i?Q5(r.width):r.width)/n,l=(i?Q5(r.height):r.height)/a;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const Fbe=Xd(0);function eee(e){const t=nc(e);return!WR()||!t.visualViewport?Fbe:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Mbe(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==nc(e)?!1:t}function d0(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const a=e.getBoundingClientRect(),i=GR(e);let o=Xd(1);t&&(n?nd(n)&&(o=Ev(n)):o=Ev(e));const l=Mbe(i,r,n)?eee(i):Xd(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=nc(i),h=n&&nd(n)?nc(n):n;let x=m,p=m6(x);for(;p&&n&&h!==x;){const g=Ev(p),v=p.getBoundingClientRect(),y=sd(p),b=v.left+(p.clientLeft+parseFloat(y.paddingLeft))*g.x,N=v.top+(p.clientTop+parseFloat(y.paddingTop))*g.y;c*=g.x,u*=g.y,d*=g.x,f*=g.y,c+=b,u+=N,x=nc(p),p=m6(x)}}return t4({width:d,height:f,x:c,y:u})}function KR(e,t){const r=NC(e).scrollLeft;return t?t.left+r:d0(of(e)).left+r}function tee(e,t,r){r===void 0&&(r=!1);const n=e.getBoundingClientRect(),a=n.left+t.scrollLeft-(r?0:KR(e,n)),i=n.top+t.scrollTop;return{x:a,y:i}}function $be(e){let{elements:t,rect:r,offsetParent:n,strategy:a}=e;const i=a==="fixed",o=of(n),l=t?_C(t.floating):!1;if(n===o||l&&i)return r;let c={scrollLeft:0,scrollTop:0},u=Xd(1);const d=Xd(0),f=tf(n);if((f||!f&&!i)&&((l1(n)!=="body"||Yj(o))&&(c=NC(n)),tf(n))){const h=d0(n);u=Ev(n),d.x=h.x+n.clientLeft,d.y=h.y+n.clientTop}const m=o&&!f&&!i?tee(o,c,!0):Xd(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 Bbe(e){return Array.from(e.getClientRects())}function zbe(e){const t=of(e),r=NC(e),n=e.ownerDocument.body,a=Vl(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),i=Vl(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let o=-r.scrollLeft+KR(e);const l=-r.scrollTop;return sd(n).direction==="rtl"&&(o+=Vl(t.clientWidth,n.clientWidth)-a),{width:a,height:i,x:o,y:l}}function qbe(e,t){const r=nc(e),n=of(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=WR();(!u||u&&t==="fixed")&&(l=a.offsetLeft,c=a.offsetTop)}return{width:i,height:o,x:l,y:c}}const Ube=new Set(["absolute","fixed"]);function Vbe(e,t){const r=d0(e,!0,t==="fixed"),n=r.top+e.clientTop,a=r.left+e.clientLeft,i=tf(e)?Ev(e):Xd(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 m9(e,t,r){let n;if(t==="viewport")n=qbe(e,r);else if(t==="document")n=zbe(of(e));else if(nd(t))n=Vbe(t,r);else{const a=eee(e);n={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return t4(n)}function ree(e,t){const r=op(e);return r===t||!nd(r)||hy(r)?!1:sd(r).position==="fixed"||ree(r,t)}function Hbe(e,t){const r=t.get(e);if(r)return r;let n=b2(e,[],!1).filter(l=>nd(l)&&l1(l)!=="body"),a=null;const i=sd(e).position==="fixed";let o=i?op(e):e;for(;nd(o)&&!hy(o);){const l=sd(o),c=HR(o);!c&&l.position==="fixed"&&(a=null),(i?!c&&!a:!c&&l.position==="static"&&!!a&&Ube.has(a.position)||Yj(o)&&!c&&ree(e,o))?n=n.filter(d=>d!==o):a=l,o=op(o)}return t.set(e,n),n}function Wbe(e){let{element:t,boundary:r,rootBoundary:n,strategy:a}=e;const o=[...r==="clippingAncestors"?_C(t)?[]:Hbe(t,this._c):[].concat(r),n],l=o[0],c=o.reduce((u,d)=>{const f=m9(t,d,a);return u.top=Vl(f.top,u.top),u.right=ip(f.right,u.right),u.bottom=ip(f.bottom,u.bottom),u.left=Vl(f.left,u.left),u},m9(t,l,a));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Gbe(e){const{width:t,height:r}=QQ(e);return{width:t,height:r}}function Kbe(e,t,r){const n=tf(t),a=of(t),i=r==="fixed",o=d0(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const c=Xd(0);function u(){c.x=KR(a)}if(n||!n&&!i)if((l1(t)!=="body"||Yj(a))&&(l=NC(t)),n){const h=d0(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?tee(a,l):Xd(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 V3(e){return sd(e).position==="static"}function p9(e,t){if(!tf(e)||sd(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return of(e)===r&&(r=r.ownerDocument.body),r}function nee(e,t){const r=nc(e);if(_C(e))return r;if(!tf(e)){let a=op(e);for(;a&&!hy(a);){if(nd(a)&&!V3(a))return a;a=op(a)}return r}let n=p9(e,t);for(;n&&Tbe(n)&&V3(n);)n=p9(n,t);return n&&hy(n)&&V3(n)&&!HR(n)?r:n||Rbe(e)||r}const Xbe=async function(e){const t=this.getOffsetParent||nee,r=this.getDimensions,n=await r(e.floating);return{reference:Kbe(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function Ybe(e){return sd(e).direction==="rtl"}const Zbe={convertOffsetParentRelativeRectToViewportRelativeRect:$be,getDocumentElement:of,getClippingRect:Wbe,getOffsetParent:nee,getElementRects:Xbe,getClientRects:Bbe,getDimensions:Gbe,getScale:Ev,isElement:nd,isRTL:Ybe};function see(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Jbe(e,t){let r=null,n;const a=of(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 x=$N(f),p=$N(a.clientWidth-(d+m)),g=$N(a.clientHeight-(f+h)),v=$N(d),b={rootMargin:-x+"px "+-p+"px "+-g+"px "+-v+"px",threshold:Vl(0,ip(1,c))||1};let N=!0;function j(_){const S=_[0].intersectionRatio;if(S!==c){if(!N)return o();S?o(!1,S):n=setTimeout(()=>{o(!1,1e-7)},1e3)}S===1&&!see(u,e.getBoundingClientRect())&&o(),N=!1}try{r=new IntersectionObserver(j,{...b,root:a.ownerDocument})}catch{r=new IntersectionObserver(j,b)}r.observe(e)}return o(!0),i}function Qbe(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=GR(e),d=a||i?[...u?b2(u):[],...b2(t)]:[];d.forEach(v=>{a&&v.addEventListener("scroll",r,{passive:!0}),i&&v.addEventListener("resize",r)});const f=u&&l?Jbe(u,r):null;let m=-1,h=null;o&&(h=new ResizeObserver(v=>{let[y]=v;y&&y.target===u&&h&&(h.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var b;(b=h)==null||b.observe(t)})),r()}),u&&!c&&h.observe(u),h.observe(t));let x,p=c?d0(e):null;c&&g();function g(){const v=d0(e);p&&!see(p,v)&&r(),p=v,x=requestAnimationFrame(g)}return r(),()=>{var v;d.forEach(y=>{a&&y.removeEventListener("scroll",r),i&&y.removeEventListener("resize",r)}),f==null||f(),(v=h)==null||v.disconnect(),h=null,c&&cancelAnimationFrame(x)}}const ewe=Nbe,twe=Sbe,rwe=wbe,nwe=Cbe,swe=jbe,x9=bbe,awe=kbe,iwe=(e,t,r)=>{const n=new Map,a={platform:Zbe,...r},i={...a.platform,_c:n};return ybe(e,t,{...a,platform:i})};var owe=typeof document<"u",lwe=function(){},d5=owe?w.useLayoutEffect:lwe;function r4(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(!r4(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)&&!r4(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function aee(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function g9(e,t){const r=aee(e);return Math.round(t*r)/r}function H3(e){const t=w.useRef(e);return d5(()=>{t.current=e}),t}function cwe(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);r4(m,n)||h(n);const[x,p]=w.useState(null),[g,v]=w.useState(null),y=w.useCallback(z=>{z!==_.current&&(_.current=z,p(z))},[]),b=w.useCallback(z=>{z!==S.current&&(S.current=z,v(z))},[]),N=i||x,j=o||g,_=w.useRef(null),S=w.useRef(null),P=w.useRef(d),T=c!=null,R=H3(c),k=H3(a),E=H3(u),q=w.useCallback(()=>{if(!_.current||!S.current)return;const z={placement:t,strategy:r,middleware:m};k.current&&(z.platform=k.current),iwe(_.current,S.current,z).then(M=>{const B={...M,isPositioned:E.current!==!1};O.current&&!r4(P.current,B)&&(P.current=B,Uc.flushSync(()=>{f(B)}))})},[m,t,r,k,E]);d5(()=>{u===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,f(z=>({...z,isPositioned:!1})))},[u]);const O=w.useRef(!1);d5(()=>(O.current=!0,()=>{O.current=!1}),[]),d5(()=>{if(N&&(_.current=N),j&&(S.current=j),N&&j){if(R.current)return R.current(N,j,q);q()}},[N,j,q,R,T]);const L=w.useMemo(()=>({reference:_,floating:S,setReference:y,setFloating:b}),[y,b]),H=w.useMemo(()=>({reference:N,floating:j}),[N,j]),V=w.useMemo(()=>{const z={position:r,left:0,top:0};if(!H.floating)return z;const M=g9(H.floating,d.x),B=g9(H.floating,d.y);return l?{...z,transform:"translate("+M+"px, "+B+"px)",...aee(H.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:M,top:B}},[r,l,H.floating,d.x,d.y]);return w.useMemo(()=>({...d,update:q,refs:L,elements:H,floatingStyles:V}),[d,q,L,H,V])}const uwe=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?x9({element:n.current,padding:a}).fn(r):{}:n?x9({element:n,padding:a}).fn(r):{}}}},dwe=(e,t)=>({...ewe(e),options:[e,t]}),fwe=(e,t)=>({...twe(e),options:[e,t]}),hwe=(e,t)=>({...awe(e),options:[e,t]}),mwe=(e,t)=>({...rwe(e),options:[e,t]}),pwe=(e,t)=>({...nwe(e),options:[e,t]}),xwe=(e,t)=>({...swe(e),options:[e,t]}),gwe=(e,t)=>({...uwe(e),options:[e,t]});var vwe="Arrow",iee=w.forwardRef((e,t)=>{const{children:r,width:n=10,height:a=5,...i}=e;return s.jsx(Vt.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"})})});iee.displayName=vwe;var ywe=iee;function SC(e){const[t,r]=w.useState(void 0);return _a(()=>{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 XR="Popper",[oee,kp]=ei(XR),[bwe,lee]=oee(XR),cee=e=>{const{__scopePopper:t,children:r}=e,[n,a]=w.useState(null);return s.jsx(bwe,{scope:t,anchor:n,onAnchorChange:a,children:r})};cee.displayName=XR;var uee="PopperAnchor",dee=w.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:n,...a}=e,i=lee(uee,r),o=w.useRef(null),l=Pr(t,o);return w.useEffect(()=>{i.onAnchorChange((n==null?void 0:n.current)||o.current)}),n?null:s.jsx(Vt.div,{...a,ref:l})});dee.displayName=uee;var YR="PopperContent",[wwe,jwe]=oee(YR),fee=w.forwardRef((e,t)=>{var te,re,J,ie,be,Q;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:x,...p}=e,g=lee(YR,r),[v,y]=w.useState(null),b=Pr(t,Ve=>y(Ve)),[N,j]=w.useState(null),_=SC(N),S=(_==null?void 0:_.width)??0,P=(_==null?void 0:_.height)??0,T=n+(i!=="center"?"-"+i:""),R=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},k=Array.isArray(u)?u:[u],E=k.length>0,q={padding:R,boundary:k.filter(Nwe),altBoundary:E},{refs:O,floatingStyles:L,placement:H,isPositioned:V,middlewareData:z}=cwe({strategy:"fixed",placement:T,whileElementsMounted:(...Ve)=>Qbe(...Ve,{animationFrame:h==="always"}),elements:{reference:g.anchor},middleware:[dwe({mainAxis:a+P,alignmentAxis:o}),c&&fwe({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?hwe():void 0,...q}),c&&mwe({...q}),pwe({...q,apply:({elements:Ve,rects:W,availableWidth:Z,availableHeight:he})=>{const{width:se,height:oe}=W.reference,le=Ve.floating.style;le.setProperty("--radix-popper-available-width",`${Z}px`),le.setProperty("--radix-popper-available-height",`${he}px`),le.setProperty("--radix-popper-anchor-width",`${se}px`),le.setProperty("--radix-popper-anchor-height",`${oe}px`)}}),N&&gwe({element:N,padding:l}),Swe({arrowWidth:S,arrowHeight:P}),m&&xwe({strategy:"referenceHidden",...q})]}),[M,B]=pee(H),K=ya(x);_a(()=>{V&&(K==null||K())},[V,K]);const C=(te=z.arrow)==null?void 0:te.x,A=(re=z.arrow)==null?void 0:re.y,I=((J=z.arrow)==null?void 0:J.centerOffset)!==0,[U,Y]=w.useState();return _a(()=>{v&&Y(window.getComputedStyle(v).zIndex)},[v]),s.jsx("div",{ref:O.setFloating,"data-radix-popper-content-wrapper":"",style:{...L,transform:V?L.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:U,"--radix-popper-transform-origin":[(ie=z.transformOrigin)==null?void 0:ie.x,(be=z.transformOrigin)==null?void 0:be.y].join(" "),...((Q=z.hide)==null?void 0:Q.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:s.jsx(wwe,{scope:r,placedSide:M,onArrowChange:j,arrowX:C,arrowY:A,shouldHideArrow:I,children:s.jsx(Vt.div,{"data-side":M,"data-align":B,...p,ref:b,style:{...p.style,animation:V?void 0:"none"}})})})});fee.displayName=YR;var hee="PopperArrow",_we={top:"bottom",right:"left",bottom:"top",left:"right"},mee=w.forwardRef(function(t,r){const{__scopePopper:n,...a}=t,i=jwe(hee,n),o=_we[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(ywe,{...a,ref:r,style:{...a.style,display:"block"}})})});mee.displayName=hee;function Nwe(e){return e!==null}var Swe=e=>({name:"transformOrigin",options:e,fn(t){var g,v,y;const{placement:r,rects:n,middlewareData:a}=t,o=((g=a.arrow)==null?void 0:g.centerOffset)!==0,l=o?0:e.arrowWidth,c=o?0:e.arrowHeight,[u,d]=pee(r),f={start:"0%",center:"50%",end:"100%"}[d],m=(((v=a.arrow)==null?void 0:v.x)??0)+l/2,h=(((y=a.arrow)==null?void 0:y.y)??0)+c/2;let x="",p="";return u==="bottom"?(x=o?f:`${m}px`,p=`${-c}px`):u==="top"?(x=o?f:`${m}px`,p=`${n.floating.height+c}px`):u==="right"?(x=`${-c}px`,p=o?f:`${h}px`):u==="left"&&(x=`${n.floating.width+c}px`,p=o?f:`${h}px`),{data:{x,y:p}}}});function pee(e){const[t,r="center"]=e.split("-");return[t,r]}var kC=cee,Zj=dee,CC=fee,EC=mee,[AC]=ei("Tooltip",[kp]),TC=kp(),xee="TooltipProvider",kwe=700,p6="tooltip.open",[Cwe,ZR]=AC(xee),gee=e=>{const{__scopeTooltip:t,delayDuration:r=kwe,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(Cwe,{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})};gee.displayName=xee;var w2="Tooltip",[Ewe,PC]=AC(w2),vee=e=>{const{__scopeTooltip:t,children:r,open:n,defaultOpen:a,onOpenChange:i,disableHoverableContent:o,delayDuration:l}=e,c=ZR(w2,e.__scopeTooltip),u=TC(t),[d,f]=w.useState(null),m=Za(),h=w.useRef(0),x=o??c.disableHoverableContent,p=l??c.delayDuration,g=w.useRef(!1),[v,y]=Zo({prop:n,defaultProp:a??!1,onChange:S=>{S?(c.onOpen(),document.dispatchEvent(new CustomEvent(p6))):c.onClose(),i==null||i(S)},caller:w2}),b=w.useMemo(()=>v?g.current?"delayed-open":"instant-open":"closed",[v]),N=w.useCallback(()=>{window.clearTimeout(h.current),h.current=0,g.current=!1,y(!0)},[y]),j=w.useCallback(()=>{window.clearTimeout(h.current),h.current=0,y(!1)},[y]),_=w.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{g.current=!0,y(!0),h.current=0},p)},[p,y]);return w.useEffect(()=>()=>{h.current&&(window.clearTimeout(h.current),h.current=0)},[]),s.jsx(kC,{...u,children:s.jsx(Ewe,{scope:t,contentId:m,open:v,stateAttribute:b,trigger:d,onTriggerChange:f,onTriggerEnter:w.useCallback(()=>{c.isOpenDelayedRef.current?_():N()},[c.isOpenDelayedRef,_,N]),onTriggerLeave:w.useCallback(()=>{x?j():(window.clearTimeout(h.current),h.current=0)},[j,x]),onOpen:N,onClose:j,disableHoverableContent:x,children:r})})};vee.displayName=w2;var x6="TooltipTrigger",yee=w.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,a=PC(x6,r),i=ZR(x6,r),o=TC(r),l=w.useRef(null),c=Pr(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(Zj,{asChild:!0,...o,children:s.jsx(Vt.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...n,ref:c,onPointerMove:Tt(e.onPointerMove,m=>{m.pointerType!=="touch"&&!d.current&&!i.isPointerInTransitRef.current&&(a.onTriggerEnter(),d.current=!0)}),onPointerLeave:Tt(e.onPointerLeave,()=>{a.onTriggerLeave(),d.current=!1}),onPointerDown:Tt(e.onPointerDown,()=>{a.open&&a.onClose(),u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:Tt(e.onFocus,()=>{u.current||a.onOpen()}),onBlur:Tt(e.onBlur,a.onClose),onClick:Tt(e.onClick,a.onClose)})})});yee.displayName=x6;var Awe="TooltipPortal",[WCt,Twe]=AC(Awe,{forceMount:void 0}),my="TooltipContent",bee=w.forwardRef((e,t)=>{const r=Twe(my,e.__scopeTooltip),{forceMount:n=r.forceMount,side:a="top",...i}=e,o=PC(my,e.__scopeTooltip);return s.jsx(ti,{present:n||o.open,children:o.disableHoverableContent?s.jsx(wee,{side:a,...i,ref:t}):s.jsx(Pwe,{side:a,...i,ref:t})})}),Pwe=w.forwardRef((e,t)=>{const r=PC(my,e.__scopeTooltip),n=ZR(my,e.__scopeTooltip),a=w.useRef(null),i=Pr(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((x,p)=>{const g=x.currentTarget,v={x:x.clientX,y:x.clientY},y=Lwe(v,g.getBoundingClientRect()),b=Fwe(v,y),N=Mwe(p.getBoundingClientRect()),j=Bwe([...b,...N]);l(j),f(!0)},[f]);return w.useEffect(()=>()=>m(),[m]),w.useEffect(()=>{if(c&&d){const x=g=>h(g,d),p=g=>h(g,c);return c.addEventListener("pointerleave",x),d.addEventListener("pointerleave",p),()=>{c.removeEventListener("pointerleave",x),d.removeEventListener("pointerleave",p)}}},[c,d,h,m]),w.useEffect(()=>{if(o){const x=p=>{const g=p.target,v={x:p.clientX,y:p.clientY},y=(c==null?void 0:c.contains(g))||(d==null?void 0:d.contains(g)),b=!$we(v,o);y?m():b&&(m(),u())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[c,d,o,u,m]),s.jsx(wee,{...e,ref:i})}),[Owe,Dwe]=AC(w2,{isInside:!1}),Iwe=nQ("TooltipContent"),wee=w.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":a,onEscapeKeyDown:i,onPointerDownOutside:o,...l}=e,c=PC(my,r),u=TC(r),{onClose:d}=c;return w.useEffect(()=>(document.addEventListener(p6,d),()=>document.removeEventListener(p6,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(B0,{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(Iwe,{children:n}),s.jsx(Owe,{scope:r,isInside:!0,children:s.jsx($ve,{id:c.contentId,role:"tooltip",children:a||n})})]})})});bee.displayName=my;var jee="TooltipArrow",Rwe=w.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,a=TC(r);return Dwe(jee,r).isInside?null:s.jsx(EC,{...a,...n,ref:t})});Rwe.displayName=jee;function Lwe(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 Fwe(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 Mwe(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 $we(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 Bwe(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),zwe(t)}function zwe(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 qwe=gee,Uwe=vee,Vwe=yee,_ee=bee;const z0=qwe,Kf=Uwe,Xf=Vwe,qd=w.forwardRef(({className:e,sideOffset:t=4,...r},n)=>s.jsx(_ee,{ref:n,sideOffset:t,className:yt("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}));qd.displayName=_ee.displayName;var c1=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(){}},f0=typeof window>"u"||"Deno"in globalThis;function Mo(){}function Hwe(e,t){return typeof e=="function"?e(t):e}function g6(e){return typeof e=="number"&&e>=0&&e!==1/0}function Nee(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Xm(e,t){return typeof e=="function"?e(t):e}function Oc(e,t){return typeof e=="function"?e(t):e}function v9(e,t){const{type:r="all",exact:n,fetchStatus:a,predicate:i,queryKey:o,stale:l}=e;if(o){if(n){if(t.queryHash!==JR(o,t.options))return!1}else if(!j2(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 y9(e,t){const{exact:r,status:n,predicate:a,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(r){if(h0(t.options.mutationKey)!==h0(i))return!1}else if(!j2(t.options.mutationKey,i))return!1}return!(n&&t.state.status!==n||a&&!a(t))}function JR(e,t){return((t==null?void 0:t.queryKeyHashFn)||h0)(e)}function h0(e){return JSON.stringify(e,(t,r)=>v6(r)?Object.keys(r).sort().reduce((n,a)=>(n[a]=r[a],n),{}):r)}function j2(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>j2(e[r],t[r])):!1}function See(e,t){if(e===t)return e;const r=b9(e)&&b9(t);if(r||v6(e)&&v6(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]=See(e[f],t[f]),l[f]===e[f]&&e[f]!==void 0&&u++)}return a===o&&u===a?e:l}return t}function n4(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 b9(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function v6(e){if(!w9(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!w9(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function w9(e){return Object.prototype.toString.call(e)==="[object Object]"}function Wwe(e){return new Promise(t=>{setTimeout(t,e)})}function y6(e,t,r){return typeof r.structuralSharing=="function"?r.structuralSharing(e,t):r.structuralSharing!==!1?See(e,t):t}function Gwe(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function Kwe(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var QR=Symbol();function kee(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===QR?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Cee(e,t){return typeof e=="function"?e(...t):!!e}var Ix,wm,Hv,TY,Xwe=(TY=class extends c1{constructor(){super();Nr(this,Ix);Nr(this,wm);Nr(this,Hv);Qt(this,Hv,t=>{if(!f0&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){qe(this,wm)||this.setEventListener(qe(this,Hv))}onUnsubscribe(){var t;this.hasListeners()||((t=qe(this,wm))==null||t.call(this),Qt(this,wm,void 0))}setEventListener(t){var r;Qt(this,Hv,t),(r=qe(this,wm))==null||r.call(this),Qt(this,wm,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){qe(this,Ix)!==t&&(Qt(this,Ix,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof qe(this,Ix)=="boolean"?qe(this,Ix):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Ix=new WeakMap,wm=new WeakMap,Hv=new WeakMap,TY),eL=new Xwe,Wv,jm,Gv,PY,Ywe=(PY=class extends c1{constructor(){super();Nr(this,Wv,!0);Nr(this,jm);Nr(this,Gv);Qt(this,Gv,t=>{if(!f0&&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(){qe(this,jm)||this.setEventListener(qe(this,Gv))}onUnsubscribe(){var t;this.hasListeners()||((t=qe(this,jm))==null||t.call(this),Qt(this,jm,void 0))}setEventListener(t){var r;Qt(this,Gv,t),(r=qe(this,jm))==null||r.call(this),Qt(this,jm,t(this.setOnline.bind(this)))}setOnline(t){qe(this,Wv)!==t&&(Qt(this,Wv,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return qe(this,Wv)}},Wv=new WeakMap,jm=new WeakMap,Gv=new WeakMap,PY),s4=new Ywe;function b6(){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 Zwe(e){return Math.min(1e3*2**e,3e4)}function Eee(e){return(e??"online")==="online"?s4.isOnline():!0}var Aee=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function W3(e){return e instanceof Aee}function Tee(e){let t=!1,r=0,n=!1,a;const i=b6(),o=p=>{var g;n||(m(new Aee(p)),(g=e.abort)==null||g.call(e))},l=()=>{t=!0},c=()=>{t=!1},u=()=>eL.isFocused()&&(e.networkMode==="always"||s4.isOnline())&&e.canRun(),d=()=>Eee(e.networkMode)&&e.canRun(),f=p=>{var g;n||(n=!0,(g=e.onSuccess)==null||g.call(e,p),a==null||a(),i.resolve(p))},m=p=>{var g;n||(n=!0,(g=e.onError)==null||g.call(e,p),a==null||a(),i.reject(p))},h=()=>new Promise(p=>{var g;a=v=>{(n||u())&&p(v)},(g=e.onPause)==null||g.call(e)}).then(()=>{var p;a=void 0,n||(p=e.onContinue)==null||p.call(e)}),x=()=>{if(n)return;let p;const g=r===0?e.initialPromise:void 0;try{p=g??e.fn()}catch(v){p=Promise.reject(v)}Promise.resolve(p).then(f).catch(v=>{var _;if(n)return;const y=e.retry??(f0?0:3),b=e.retryDelay??Zwe,N=typeof b=="function"?b(r,v):b,j=y===!0||typeof y=="number"&&r<y||typeof y=="function"&&y(r,v);if(t||!j){m(v);return}r++,(_=e.onFail)==null||_.call(e,r,v),Wwe(N).then(()=>u()?void 0:h()).then(()=>{t?m(v):x()})})};return{promise:i,cancel:o,continue:()=>(a==null||a(),i),cancelRetry:l,continueRetry:c,canStart:d,start:()=>(d()?x():h().then(x),i)}}var Jwe=e=>setTimeout(e,0);function Qwe(){let e=[],t=0,r=l=>{l()},n=l=>{l()},a=Jwe;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 xi=Qwe(),Rx,OY,Pee=(OY=class{constructor(){Nr(this,Rx)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),g6(this.gcTime)&&Qt(this,Rx,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(f0?1/0:5*60*1e3))}clearGcTimeout(){qe(this,Rx)&&(clearTimeout(qe(this,Rx)),Qt(this,Rx,void 0))}},Rx=new WeakMap,OY),Kv,Lx,Tc,Fx,po,Mj,Mx,Ou,Mf,DY,e2e=(DY=class extends Pee{constructor(t){super();Nr(this,Ou);Nr(this,Kv);Nr(this,Lx);Nr(this,Tc);Nr(this,Fx);Nr(this,po);Nr(this,Mj);Nr(this,Mx);Qt(this,Mx,!1),Qt(this,Mj,t.defaultOptions),this.setOptions(t.options),this.observers=[],Qt(this,Fx,t.client),Qt(this,Tc,qe(this,Fx).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Qt(this,Kv,t2e(this.options)),this.state=t.state??qe(this,Kv),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=qe(this,po))==null?void 0:t.promise}setOptions(t){this.options={...qe(this,Mj),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&qe(this,Tc).remove(this)}setData(t,r){const n=y6(this.state.data,t,this.options);return hn(this,Ou,Mf).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(t,r){hn(this,Ou,Mf).call(this,{type:"setState",state:t,setStateOptions:r})}cancel(t){var n,a;const r=(n=qe(this,po))==null?void 0:n.promise;return(a=qe(this,po))==null||a.cancel(t),r?r.then(Mo).catch(Mo):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(qe(this,Kv))}isActive(){return this.observers.some(t=>Oc(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===QR||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Xm(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:!Nee(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=qe(this,po))==null||r.continue()}onOnline(){var r;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=qe(this,po))==null||r.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),qe(this,Tc).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(qe(this,po)&&(qe(this,Mx)?qe(this,po).cancel({revert:!0}):qe(this,po).cancelRetry()),this.scheduleGc()),qe(this,Tc).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||hn(this,Ou,Mf).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(qe(this,po))return qe(this,po).continueRetry(),qe(this,po).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:()=>(Qt(this,Mx,!0),n.signal)})},i=()=>{const m=kee(this.options,r),x=(()=>{const p={client:qe(this,Fx),queryKey:this.queryKey,meta:this.meta};return a(p),p})();return Qt(this,Mx,!1),this.options.persister?this.options.persister(m,x,this):m(x)},l=(()=>{const m={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:qe(this,Fx),state:this.state,fetchFn:i};return a(m),m})();(u=this.options.behavior)==null||u.onFetch(l,this),Qt(this,Lx,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=l.fetchOptions)==null?void 0:d.meta))&&hn(this,Ou,Mf).call(this,{type:"fetch",meta:(f=l.fetchOptions)==null?void 0:f.meta});const c=m=>{var h,x,p,g;W3(m)&&m.silent||hn(this,Ou,Mf).call(this,{type:"error",error:m}),W3(m)||((x=(h=qe(this,Tc).config).onError)==null||x.call(h,m,this),(g=(p=qe(this,Tc).config).onSettled)==null||g.call(p,this.state.data,m,this)),this.scheduleGc()};return Qt(this,po,Tee({initialPromise:r==null?void 0:r.initialPromise,fn:l.fetchFn,abort:n.abort.bind(n),onSuccess:m=>{var h,x,p,g;if(m===void 0){c(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(m)}catch(v){c(v);return}(x=(h=qe(this,Tc).config).onSuccess)==null||x.call(h,m,this),(g=(p=qe(this,Tc).config).onSettled)==null||g.call(p,m,this.state.error,this),this.scheduleGc()},onError:c,onFail:(m,h)=>{hn(this,Ou,Mf).call(this,{type:"failed",failureCount:m,error:h})},onPause:()=>{hn(this,Ou,Mf).call(this,{type:"pause"})},onContinue:()=>{hn(this,Ou,Mf).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0})),qe(this,po).start()}},Kv=new WeakMap,Lx=new WeakMap,Tc=new WeakMap,Fx=new WeakMap,po=new WeakMap,Mj=new WeakMap,Mx=new WeakMap,Ou=new WeakSet,Mf=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,...Oee(n.data,this.options),fetchMeta:t.meta??null};case"success":return Qt(this,Lx,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 W3(a)&&a.revert&&qe(this,Lx)?{...qe(this,Lx),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),xi.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),qe(this,Tc).notify({query:this,type:"updated",action:t})})},DY);function Oee(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Eee(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function t2e(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 Id,IY,r2e=(IY=class extends c1{constructor(t={}){super();Nr(this,Id);this.config=t,Qt(this,Id,new Map)}build(t,r,n){const a=r.queryKey,i=r.queryHash??JR(a,r);let o=this.get(i);return o||(o=new e2e({client:t,queryKey:a,queryHash:i,options:t.defaultQueryOptions(r),state:n,defaultOptions:t.getQueryDefaults(a)}),this.add(o)),o}add(t){qe(this,Id).has(t.queryHash)||(qe(this,Id).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const r=qe(this,Id).get(t.queryHash);r&&(t.destroy(),r===t&&qe(this,Id).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){xi.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return qe(this,Id).get(t)}getAll(){return[...qe(this,Id).values()]}find(t){const r={exact:!0,...t};return this.getAll().find(n=>v9(r,n))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(n=>v9(t,n)):r}notify(t){xi.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){xi.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){xi.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Id=new WeakMap,IY),Rd,Ro,$x,Ld,om,RY,n2e=(RY=class extends Pee{constructor(t){super();Nr(this,Ld);Nr(this,Rd);Nr(this,Ro);Nr(this,$x);this.mutationId=t.mutationId,Qt(this,Ro,t.mutationCache),Qt(this,Rd,[]),this.state=t.state||Dee(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){qe(this,Rd).includes(t)||(qe(this,Rd).push(t),this.clearGcTimeout(),qe(this,Ro).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Qt(this,Rd,qe(this,Rd).filter(r=>r!==t)),this.scheduleGc(),qe(this,Ro).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){qe(this,Rd).length||(this.state.status==="pending"?this.scheduleGc():qe(this,Ro).remove(this))}continue(){var t;return((t=qe(this,$x))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var i,o,l,c,u,d,f,m,h,x,p,g,v,y,b,N,j,_,S,P;const r=()=>{hn(this,Ld,om).call(this,{type:"continue"})};Qt(this,$x,Tee({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(T,R)=>{hn(this,Ld,om).call(this,{type:"failed",failureCount:T,error:R})},onPause:()=>{hn(this,Ld,om).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>qe(this,Ro).canRun(this)}));const n=this.state.status==="pending",a=!qe(this,$x).canStart();try{if(n)r();else{hn(this,Ld,om).call(this,{type:"pending",variables:t,isPaused:a}),await((o=(i=qe(this,Ro).config).onMutate)==null?void 0:o.call(i,t,this));const R=await((c=(l=this.options).onMutate)==null?void 0:c.call(l,t));R!==this.state.context&&hn(this,Ld,om).call(this,{type:"pending",context:R,variables:t,isPaused:a})}const T=await qe(this,$x).start();return await((d=(u=qe(this,Ro).config).onSuccess)==null?void 0:d.call(u,T,t,this.state.context,this)),await((m=(f=this.options).onSuccess)==null?void 0:m.call(f,T,t,this.state.context)),await((x=(h=qe(this,Ro).config).onSettled)==null?void 0:x.call(h,T,null,this.state.variables,this.state.context,this)),await((g=(p=this.options).onSettled)==null?void 0:g.call(p,T,null,t,this.state.context)),hn(this,Ld,om).call(this,{type:"success",data:T}),T}catch(T){try{throw await((y=(v=qe(this,Ro).config).onError)==null?void 0:y.call(v,T,t,this.state.context,this)),await((N=(b=this.options).onError)==null?void 0:N.call(b,T,t,this.state.context)),await((_=(j=qe(this,Ro).config).onSettled)==null?void 0:_.call(j,void 0,T,this.state.variables,this.state.context,this)),await((P=(S=this.options).onSettled)==null?void 0:P.call(S,void 0,T,t,this.state.context)),T}finally{hn(this,Ld,om).call(this,{type:"error",error:T})}}finally{qe(this,Ro).runNext(this)}}},Rd=new WeakMap,Ro=new WeakMap,$x=new WeakMap,Ld=new WeakSet,om=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),xi.batch(()=>{qe(this,Rd).forEach(n=>{n.onMutationUpdate(t)}),qe(this,Ro).notify({mutation:this,type:"updated",action:t})})},RY);function Dee(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Vf,Du,$j,LY,s2e=(LY=class extends c1{constructor(t={}){super();Nr(this,Vf);Nr(this,Du);Nr(this,$j);this.config=t,Qt(this,Vf,new Set),Qt(this,Du,new Map),Qt(this,$j,0)}build(t,r,n){const a=new n2e({mutationCache:this,mutationId:++xN(this,$j)._,options:t.defaultMutationOptions(r),state:n});return this.add(a),a}add(t){qe(this,Vf).add(t);const r=BN(t);if(typeof r=="string"){const n=qe(this,Du).get(r);n?n.push(t):qe(this,Du).set(r,[t])}this.notify({type:"added",mutation:t})}remove(t){if(qe(this,Vf).delete(t)){const r=BN(t);if(typeof r=="string"){const n=qe(this,Du).get(r);if(n)if(n.length>1){const a=n.indexOf(t);a!==-1&&n.splice(a,1)}else n[0]===t&&qe(this,Du).delete(r)}}this.notify({type:"removed",mutation:t})}canRun(t){const r=BN(t);if(typeof r=="string"){const n=qe(this,Du).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=BN(t);if(typeof r=="string"){const a=(n=qe(this,Du).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(){xi.batch(()=>{qe(this,Vf).forEach(t=>{this.notify({type:"removed",mutation:t})}),qe(this,Vf).clear(),qe(this,Du).clear()})}getAll(){return Array.from(qe(this,Vf))}find(t){const r={exact:!0,...t};return this.getAll().find(n=>y9(r,n))}findAll(t={}){return this.getAll().filter(r=>y9(t,r))}notify(t){xi.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>r.state.isPaused);return xi.batch(()=>Promise.all(t.map(r=>r.continue().catch(Mo))))}},Vf=new WeakMap,Du=new WeakMap,$j=new WeakMap,LY);function BN(e){var t;return(t=e.options.scope)==null?void 0:t.id}function j9(e){return{onFetch:(t,r)=>{var d,f,m,h,x;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=((x=t.state.data)==null?void 0:x.pageParams)||[];let l={pages:[],pageParams:[]},c=0;const u=async()=>{let p=!1;const g=b=>{Object.defineProperty(b,"signal",{enumerable:!0,get:()=>(t.signal.aborted?p=!0:t.signal.addEventListener("abort",()=>{p=!0}),t.signal)})},v=kee(t.options,t.fetchOptions),y=async(b,N,j)=>{if(p)return Promise.reject();if(N==null&&b.pages.length)return Promise.resolve(b);const S=(()=>{const k={client:t.client,queryKey:t.queryKey,pageParam:N,direction:j?"backward":"forward",meta:t.options.meta};return g(k),k})(),P=await v(S),{maxPages:T}=t.options,R=j?Kwe:Gwe;return{pages:R(b.pages,P,T),pageParams:R(b.pageParams,N,T)}};if(a&&i.length){const b=a==="backward",N=b?a2e:_9,j={pages:i,pageParams:o},_=N(n,j);l=await y(j,_,b)}else{const b=e??i.length;do{const N=c===0?o[0]??n.initialPageParam:_9(n,l);if(c>0&&N==null)break;l=await y(l,N),c++}while(c<b)}return l};t.options.persister?t.fetchFn=()=>{var p,g;return(g=(p=t.options).persister)==null?void 0:g.call(p,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=u}}}function _9(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 a2e(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 ma,_m,Nm,Xv,Yv,Sm,Zv,Jv,FY,i2e=(FY=class{constructor(e={}){Nr(this,ma);Nr(this,_m);Nr(this,Nm);Nr(this,Xv);Nr(this,Yv);Nr(this,Sm);Nr(this,Zv);Nr(this,Jv);Qt(this,ma,e.queryCache||new r2e),Qt(this,_m,e.mutationCache||new s2e),Qt(this,Nm,e.defaultOptions||{}),Qt(this,Xv,new Map),Qt(this,Yv,new Map),Qt(this,Sm,0)}mount(){xN(this,Sm)._++,qe(this,Sm)===1&&(Qt(this,Zv,eL.subscribe(async e=>{e&&(await this.resumePausedMutations(),qe(this,ma).onFocus())})),Qt(this,Jv,s4.subscribe(async e=>{e&&(await this.resumePausedMutations(),qe(this,ma).onOnline())})))}unmount(){var e,t;xN(this,Sm)._--,qe(this,Sm)===0&&((e=qe(this,Zv))==null||e.call(this),Qt(this,Zv,void 0),(t=qe(this,Jv))==null||t.call(this),Qt(this,Jv,void 0))}isFetching(e){return qe(this,ma).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return qe(this,_m).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=qe(this,ma).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=qe(this,ma).build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(Xm(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return qe(this,ma).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=qe(this,ma).get(n.queryHash),i=a==null?void 0:a.state.data,o=Hwe(t,i);if(o!==void 0)return qe(this,ma).build(this,n).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return xi.batch(()=>qe(this,ma).findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,r)]))}getQueryState(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=qe(this,ma).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=qe(this,ma);xi.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=qe(this,ma);return xi.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=xi.batch(()=>qe(this,ma).findAll(e).map(a=>a.cancel(r)));return Promise.all(n).then(Mo).catch(Mo)}invalidateQueries(e,t={}){return xi.batch(()=>(qe(this,ma).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=xi.batch(()=>qe(this,ma).findAll(e).filter(a=>!a.isDisabled()&&!a.isStatic()).map(a=>{let i=a.fetch(void 0,r);return r.throwOnError||(i=i.catch(Mo)),a.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(n).then(Mo)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=qe(this,ma).build(this,t);return r.isStaleByTime(Xm(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Mo).catch(Mo)}fetchInfiniteQuery(e){return e.behavior=j9(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Mo).catch(Mo)}ensureInfiniteQueryData(e){return e.behavior=j9(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return s4.isOnline()?qe(this,_m).resumePausedMutations():Promise.resolve()}getQueryCache(){return qe(this,ma)}getMutationCache(){return qe(this,_m)}getDefaultOptions(){return qe(this,Nm)}setDefaultOptions(e){Qt(this,Nm,e)}setQueryDefaults(e,t){qe(this,Xv).set(h0(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...qe(this,Xv).values()],r={};return t.forEach(n=>{j2(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){qe(this,Yv).set(h0(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...qe(this,Yv).values()],r={};return t.forEach(n=>{j2(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...qe(this,Nm).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=JR(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===QR&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...qe(this,Nm).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){qe(this,ma).clear(),qe(this,_m).clear()}},ma=new WeakMap,_m=new WeakMap,Nm=new WeakMap,Xv=new WeakMap,Yv=new WeakMap,Sm=new WeakMap,Zv=new WeakMap,Jv=new WeakMap,FY),ll,En,Bj,Lo,Bx,Qv,km,Cm,zj,ey,ty,zx,qx,Em,ry,Jn,tw,w6,j6,_6,N6,S6,k6,C6,Iee,MY,o2e=(MY=class extends c1{constructor(t,r){super();Nr(this,Jn);Nr(this,ll);Nr(this,En);Nr(this,Bj);Nr(this,Lo);Nr(this,Bx);Nr(this,Qv);Nr(this,km);Nr(this,Cm);Nr(this,zj);Nr(this,ey);Nr(this,ty);Nr(this,zx);Nr(this,qx);Nr(this,Em);Nr(this,ry,new Set);this.options=r,Qt(this,ll,t),Qt(this,Cm,null),Qt(this,km,b6()),this.options.experimental_prefetchInRender||qe(this,km).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&&(qe(this,En).addObserver(this),N9(qe(this,En),this.options)?hn(this,Jn,tw).call(this):this.updateResult(),hn(this,Jn,N6).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return E6(qe(this,En),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return E6(qe(this,En),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,hn(this,Jn,S6).call(this),hn(this,Jn,k6).call(this),qe(this,En).removeObserver(this)}setOptions(t){const r=this.options,n=qe(this,En);if(this.options=qe(this,ll).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Oc(this.options.enabled,qe(this,En))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");hn(this,Jn,C6).call(this),qe(this,En).setOptions(this.options),r._defaulted&&!n4(this.options,r)&&qe(this,ll).getQueryCache().notify({type:"observerOptionsUpdated",query:qe(this,En),observer:this});const a=this.hasListeners();a&&S9(qe(this,En),n,this.options,r)&&hn(this,Jn,tw).call(this),this.updateResult(),a&&(qe(this,En)!==n||Oc(this.options.enabled,qe(this,En))!==Oc(r.enabled,qe(this,En))||Xm(this.options.staleTime,qe(this,En))!==Xm(r.staleTime,qe(this,En)))&&hn(this,Jn,w6).call(this);const i=hn(this,Jn,j6).call(this);a&&(qe(this,En)!==n||Oc(this.options.enabled,qe(this,En))!==Oc(r.enabled,qe(this,En))||i!==qe(this,Em))&&hn(this,Jn,_6).call(this,i)}getOptimisticResult(t){const r=qe(this,ll).getQueryCache().build(qe(this,ll),t),n=this.createResult(r,t);return c2e(this,n)&&(Qt(this,Lo,n),Qt(this,Qv,this.options),Qt(this,Bx,qe(this,En).state)),n}getCurrentResult(){return qe(this,Lo)}trackResult(t,r){return new Proxy(t,{get:(n,a)=>(this.trackProp(a),r==null||r(a),Reflect.get(n,a))})}trackProp(t){qe(this,ry).add(t)}getCurrentQuery(){return qe(this,En)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const r=qe(this,ll).defaultQueryOptions(t),n=qe(this,ll).getQueryCache().build(qe(this,ll),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(t){return hn(this,Jn,tw).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),qe(this,Lo)))}createResult(t,r){var T;const n=qe(this,En),a=this.options,i=qe(this,Lo),o=qe(this,Bx),l=qe(this,Qv),u=t!==n?t.state:qe(this,Bj),{state:d}=t;let f={...d},m=!1,h;if(r._optimisticResults){const R=this.hasListeners(),k=!R&&N9(t,r),E=R&&S9(t,n,r,a);(k||E)&&(f={...f,...Oee(d.data,t.options)}),r._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:x,errorUpdatedAt:p,status:g}=f;h=f.data;let v=!1;if(r.placeholderData!==void 0&&h===void 0&&g==="pending"){let R;i!=null&&i.isPlaceholderData&&r.placeholderData===(l==null?void 0:l.placeholderData)?(R=i.data,v=!0):R=typeof r.placeholderData=="function"?r.placeholderData((T=qe(this,ty))==null?void 0:T.state.data,qe(this,ty)):r.placeholderData,R!==void 0&&(g="success",h=y6(i==null?void 0:i.data,R,r),m=!0)}if(r.select&&h!==void 0&&!v)if(i&&h===(o==null?void 0:o.data)&&r.select===qe(this,zj))h=qe(this,ey);else try{Qt(this,zj,r.select),h=r.select(h),h=y6(i==null?void 0:i.data,h,r),Qt(this,ey,h),Qt(this,Cm,null)}catch(R){Qt(this,Cm,R)}qe(this,Cm)&&(x=qe(this,Cm),h=qe(this,ey),p=Date.now(),g="error");const y=f.fetchStatus==="fetching",b=g==="pending",N=g==="error",j=b&&y,_=h!==void 0,P={status:g,fetchStatus:f.fetchStatus,isPending:b,isSuccess:g==="success",isError:N,isInitialLoading:j,isLoading:j,data:h,dataUpdatedAt:f.dataUpdatedAt,error:x,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:y,isRefetching:y&&!b,isLoadingError:N&&!_,isPaused:f.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:N&&_,isStale:tL(t,r),refetch:this.refetch,promise:qe(this,km),isEnabled:Oc(r.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const R=q=>{P.status==="error"?q.reject(P.error):P.data!==void 0&&q.resolve(P.data)},k=()=>{const q=Qt(this,km,P.promise=b6());R(q)},E=qe(this,km);switch(E.status){case"pending":t.queryHash===n.queryHash&&R(E);break;case"fulfilled":(P.status==="error"||P.data!==E.value)&&k();break;case"rejected":(P.status!=="error"||P.error!==E.reason)&&k();break}}return P}updateResult(){const t=qe(this,Lo),r=this.createResult(qe(this,En),this.options);if(Qt(this,Bx,qe(this,En).state),Qt(this,Qv,this.options),qe(this,Bx).data!==void 0&&Qt(this,ty,qe(this,En)),n4(r,t))return;Qt(this,Lo,r);const n=()=>{if(!t)return!0;const{notifyOnChangeProps:a}=this.options,i=typeof a=="function"?a():a;if(i==="all"||!i&&!qe(this,ry).size)return!0;const o=new Set(i??qe(this,ry));return this.options.throwOnError&&o.add("error"),Object.keys(qe(this,Lo)).some(l=>{const c=l;return qe(this,Lo)[c]!==t[c]&&o.has(c)})};hn(this,Jn,Iee).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&hn(this,Jn,N6).call(this)}},ll=new WeakMap,En=new WeakMap,Bj=new WeakMap,Lo=new WeakMap,Bx=new WeakMap,Qv=new WeakMap,km=new WeakMap,Cm=new WeakMap,zj=new WeakMap,ey=new WeakMap,ty=new WeakMap,zx=new WeakMap,qx=new WeakMap,Em=new WeakMap,ry=new WeakMap,Jn=new WeakSet,tw=function(t){hn(this,Jn,C6).call(this);let r=qe(this,En).fetch(this.options,t);return t!=null&&t.throwOnError||(r=r.catch(Mo)),r},w6=function(){hn(this,Jn,S6).call(this);const t=Xm(this.options.staleTime,qe(this,En));if(f0||qe(this,Lo).isStale||!g6(t))return;const n=Nee(qe(this,Lo).dataUpdatedAt,t)+1;Qt(this,zx,setTimeout(()=>{qe(this,Lo).isStale||this.updateResult()},n))},j6=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(qe(this,En)):this.options.refetchInterval)??!1},_6=function(t){hn(this,Jn,k6).call(this),Qt(this,Em,t),!(f0||Oc(this.options.enabled,qe(this,En))===!1||!g6(qe(this,Em))||qe(this,Em)===0)&&Qt(this,qx,setInterval(()=>{(this.options.refetchIntervalInBackground||eL.isFocused())&&hn(this,Jn,tw).call(this)},qe(this,Em)))},N6=function(){hn(this,Jn,w6).call(this),hn(this,Jn,_6).call(this,hn(this,Jn,j6).call(this))},S6=function(){qe(this,zx)&&(clearTimeout(qe(this,zx)),Qt(this,zx,void 0))},k6=function(){qe(this,qx)&&(clearInterval(qe(this,qx)),Qt(this,qx,void 0))},C6=function(){const t=qe(this,ll).getQueryCache().build(qe(this,ll),this.options);if(t===qe(this,En))return;const r=qe(this,En);Qt(this,En,t),Qt(this,Bj,t.state),this.hasListeners()&&(r==null||r.removeObserver(this),t.addObserver(this))},Iee=function(t){xi.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(qe(this,Lo))}),qe(this,ll).getQueryCache().notify({query:qe(this,En),type:"observerResultsUpdated"})})},MY);function l2e(e,t){return Oc(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function N9(e,t){return l2e(e,t)||e.state.data!==void 0&&E6(e,t,t.refetchOnMount)}function E6(e,t,r){if(Oc(t.enabled,e)!==!1&&Xm(t.staleTime,e)!=="static"){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&tL(e,t)}return!1}function S9(e,t,r,n){return(e!==t||Oc(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&tL(e,r)}function tL(e,t){return Oc(t.enabled,e)!==!1&&e.isStaleByTime(Xm(t.staleTime,e))}function c2e(e,t){return!n4(e.getCurrentResult(),t)}var Am,Tm,cl,Hf,lh,f5,A6,$Y,u2e=($Y=class extends c1{constructor(r,n){super();Nr(this,lh);Nr(this,Am);Nr(this,Tm);Nr(this,cl);Nr(this,Hf);Qt(this,Am,r),this.setOptions(n),this.bindMethods(),hn(this,lh,f5).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=qe(this,Am).defaultMutationOptions(r),n4(this.options,n)||qe(this,Am).getMutationCache().notify({type:"observerOptionsUpdated",mutation:qe(this,cl),observer:this}),n!=null&&n.mutationKey&&this.options.mutationKey&&h0(n.mutationKey)!==h0(this.options.mutationKey)?this.reset():((a=qe(this,cl))==null?void 0:a.state.status)==="pending"&&qe(this,cl).setOptions(this.options)}onUnsubscribe(){var r;this.hasListeners()||(r=qe(this,cl))==null||r.removeObserver(this)}onMutationUpdate(r){hn(this,lh,f5).call(this),hn(this,lh,A6).call(this,r)}getCurrentResult(){return qe(this,Tm)}reset(){var r;(r=qe(this,cl))==null||r.removeObserver(this),Qt(this,cl,void 0),hn(this,lh,f5).call(this),hn(this,lh,A6).call(this)}mutate(r,n){var a;return Qt(this,Hf,n),(a=qe(this,cl))==null||a.removeObserver(this),Qt(this,cl,qe(this,Am).getMutationCache().build(qe(this,Am),this.options)),qe(this,cl).addObserver(this),qe(this,cl).execute(r)}},Am=new WeakMap,Tm=new WeakMap,cl=new WeakMap,Hf=new WeakMap,lh=new WeakSet,f5=function(){var n;const r=((n=qe(this,cl))==null?void 0:n.state)??Dee();Qt(this,Tm,{...r,isPending:r.status==="pending",isSuccess:r.status==="success",isError:r.status==="error",isIdle:r.status==="idle",mutate:this.mutate,reset:this.reset})},A6=function(r){xi.batch(()=>{var n,a,i,o,l,c,u,d;if(qe(this,Hf)&&this.hasListeners()){const f=qe(this,Tm).variables,m=qe(this,Tm).context;(r==null?void 0:r.type)==="success"?((a=(n=qe(this,Hf)).onSuccess)==null||a.call(n,r.data,f,m),(o=(i=qe(this,Hf)).onSettled)==null||o.call(i,r.data,null,f,m)):(r==null?void 0:r.type)==="error"&&((c=(l=qe(this,Hf)).onError)==null||c.call(l,r.error,f,m),(d=(u=qe(this,Hf)).onSettled)==null||d.call(u,void 0,r.error,f,m))}this.listeners.forEach(f=>{f(qe(this,Tm))})})},$Y),Ree=w.createContext(void 0),u1=e=>{const t=w.useContext(Ree);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},d2e=({client:e,children:t})=>(w.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),s.jsx(Ree.Provider,{value:e,children:t})),Lee=w.createContext(!1),f2e=()=>w.useContext(Lee);Lee.Provider;function h2e(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var m2e=w.createContext(h2e()),p2e=()=>w.useContext(m2e),x2e=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},g2e=e=>{w.useEffect(()=>{e.clearReset()},[e])},v2e=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:a})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(a&&e.data===void 0||Cee(r,[e.error,n])),y2e=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))}},b2e=(e,t)=>e.isLoading&&e.isFetching&&!t,w2e=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,k9=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function j2e(e,t,r){var f,m,h,x,p;const n=f2e(),a=p2e(),i=u1(),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",y2e(o),x2e(o,a),g2e(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(g=>{const v=d?c.subscribe(xi.batchCalls(g)):Mo;return c.updateResult(),v},[c,d]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),w.useEffect(()=>{c.setOptions(o)},[o,c]),w2e(o,u))throw k9(o,c,a);if(v2e({result:u,errorResetBoundary:a,throwOnError:o.throwOnError,query:i.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw u.error;if((x=(h=i.getDefaultOptions().queries)==null?void 0:h._experimental_afterQuery)==null||x.call(h,o,u),o.experimental_prefetchInRender&&!f0&&b2e(u,n)){const g=l?k9(o,c,a):(p=i.getQueryCache().get(o.queryHash))==null?void 0:p.promise;g==null||g.catch(Mo).finally(()=>{c.updateResult()})}return o.notifyOnChangeProps?u:c.trackResult(u)}function la(e,t){return j2e(e,o2e)}function Mc(e,t){const r=u1(),[n]=w.useState(()=>new u2e(r,e));w.useEffect(()=>{n.setOptions(e)},[n,e]);const a=w.useSyncExternalStore(w.useCallback(o=>n.subscribe(xi.batchCalls(o)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),i=w.useCallback((o,l)=>{n.mutate(o,l).catch(Mo)},[n]);if(a.error&&Cee(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 _2(){return _2=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},_2.apply(null,arguments)}var Im;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(Im||(Im={}));const C9="popstate";function _2e(e){e===void 0&&(e={});function t(n,a){let{pathname:i,search:o,hash:l}=n.location;return T6("",{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:a4(a)}return S2e(t,r,null,e)}function Ma(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function rL(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function N2e(){return Math.random().toString(36).substr(2,8)}function E9(e,t){return{usr:e.state,key:e.key,idx:t}}function T6(e,t,r,n){return r===void 0&&(r=null),_2({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?d1(t):t,{state:r,key:t&&t.key||n||N2e()})}function a4(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 d1(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 S2e(e,t,r,n){n===void 0&&(n={});let{window:a=document.defaultView,v5Compat:i=!1}=n,o=a.history,l=Im.Pop,c=null,u=d();u==null&&(u=0,o.replaceState(_2({},o.state,{idx:u}),""));function d(){return(o.state||{idx:null}).idx}function f(){l=Im.Pop;let g=d(),v=g==null?null:g-u;u=g,c&&c({action:l,location:p.location,delta:v})}function m(g,v){l=Im.Push;let y=T6(p.location,g,v);u=d()+1;let b=E9(y,u),N=p.createHref(y);try{o.pushState(b,"",N)}catch(j){if(j instanceof DOMException&&j.name==="DataCloneError")throw j;a.location.assign(N)}i&&c&&c({action:l,location:p.location,delta:1})}function h(g,v){l=Im.Replace;let y=T6(p.location,g,v);u=d();let b=E9(y,u),N=p.createHref(y);o.replaceState(b,"",N),i&&c&&c({action:l,location:p.location,delta:0})}function x(g){let v=a.location.origin!=="null"?a.location.origin:a.location.href,y=typeof g=="string"?g:a4(g);return y=y.replace(/ $/,"%20"),Ma(v,"No window.location.(origin|href) available to create URL for href: "+y),new URL(y,v)}let p={get action(){return l},get location(){return e(a,o)},listen(g){if(c)throw new Error("A history only accepts one active listener");return a.addEventListener(C9,f),c=g,()=>{a.removeEventListener(C9,f),c=null}},createHref(g){return t(a,g)},createURL:x,encodeLocation(g){let v=x(g);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:m,replace:h,go(g){return o.go(g)}};return p}var A9;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(A9||(A9={}));function k2e(e,t,r){return r===void 0&&(r="/"),C2e(e,t,r)}function C2e(e,t,r,n){let a=typeof t=="string"?d1(t):t,i=nL(a.pathname||"/",r);if(i==null)return null;let o=Fee(e);E2e(o);let l=null,c=B2e(i);for(let u=0;l==null&&u<o.length;++u)l=F2e(o[u],c);return l}function Fee(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("/")&&(Ma(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=Ym([n,c.relativePath]),d=r.concat(c);i.children&&i.children.length>0&&(Ma(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),Fee(i.children,t,d,u)),!(i.path==null&&!i.index)&&t.push({path:u,score:R2e(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 Mee(i.path))a(i,o,c)}),t}function Mee(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=Mee(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 E2e(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:L2e(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const A2e=/^:[\w-]+$/,T2e=3,P2e=2,O2e=1,D2e=10,I2e=-2,T9=e=>e==="*";function R2e(e,t){let r=e.split("/"),n=r.length;return r.some(T9)&&(n+=I2e),t&&(n+=P2e),r.filter(a=>!T9(a)).reduce((a,i)=>a+(A2e.test(i)?T2e:i===""?O2e:D2e),n)}function L2e(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 F2e(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=M2e({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:Ym([i,f.pathname]),pathnameBase:H2e(Ym([i,f.pathnameBase])),route:m}),f.pathnameBase!=="/"&&(i=Ym([i,f.pathnameBase]))}return o}function M2e(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=$2e(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 x=l[f];return h&&!x?u[m]=void 0:u[m]=(x||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:o,pattern:e}}function $2e(e,t,r){t===void 0&&(t=!1),r===void 0&&(r=!0),rL(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 B2e(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return rL(!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 nL(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 z2e=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,q2e=e=>z2e.test(e);function U2e(e,t){t===void 0&&(t="/");let{pathname:r,search:n="",hash:a=""}=typeof e=="string"?d1(e):e,i;if(r)if(q2e(r))i=r;else{if(r.includes("//")){let o=r;r=$ee(r),rL(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+r))}r.startsWith("/")?i=P9(r.substring(1),"/"):i=P9(r,t)}else i=t;return{pathname:i,search:W2e(n),hash:G2e(a)}}function P9(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 G3(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 V2e(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function sL(e,t){let r=V2e(e);return t?r.map((n,a)=>a===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function aL(e,t,r,n){n===void 0&&(n=!1);let a;typeof e=="string"?a=d1(e):(a=_2({},e),Ma(!a.pathname||!a.pathname.includes("?"),G3("?","pathname","search",a)),Ma(!a.pathname||!a.pathname.includes("#"),G3("#","pathname","hash",a)),Ma(!a.search||!a.search.includes("#"),G3("#","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=U2e(a,l),u=o&&o!=="/"&&o.endsWith("/"),d=(i||o===".")&&r.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}const $ee=e=>e.replace(/\/\/+/g,"/"),Ym=e=>$ee(e.join("/")),H2e=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),W2e=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,G2e=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function K2e(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const Bee=["post","put","patch","delete"];new Set(Bee);const X2e=["get",...Bee];new Set(X2e);/**
* 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 N2(){return N2=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},N2.apply(null,arguments)}const iL=w.createContext(null),Y2e=w.createContext(null),Cp=w.createContext(null),OC=w.createContext(null),kh=w.createContext({outlet:null,matches:[],isDataRoute:!1}),zee=w.createContext(null);function Z2e(e,t){let{relative:r}=t===void 0?{}:t;f1()||Ma(!1);let{basename:n,navigator:a}=w.useContext(Cp),{hash:i,pathname:o,search:l}=Uee(e,{relative:r}),c=o;return n!=="/"&&(c=o==="/"?n:Ym([n,o])),a.createHref({pathname:c,search:l,hash:i})}function f1(){return w.useContext(OC)!=null}function cu(){return f1()||Ma(!1),w.useContext(OC).location}function qee(e){w.useContext(Cp).static||w.useLayoutEffect(e)}function Zt(){let{isDataRoute:e}=w.useContext(kh);return e?uje():J2e()}function J2e(){f1()||Ma(!1);let e=w.useContext(iL),{basename:t,future:r,navigator:n}=w.useContext(Cp),{matches:a}=w.useContext(kh),{pathname:i}=cu(),o=JSON.stringify(sL(a,r.v7_relativeSplatPath)),l=w.useRef(!1);return qee(()=>{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=aL(u,JSON.parse(o),i,d.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:Ym([t,f.pathname])),(d.replace?n.replace:n.push)(f,d.state,d)},[t,n,o,i,e])}function so(){let{matches:e}=w.useContext(kh),t=e[e.length-1];return t?t.params:{}}function Uee(e,t){let{relative:r}=t===void 0?{}:t,{future:n}=w.useContext(Cp),{matches:a}=w.useContext(kh),{pathname:i}=cu(),o=JSON.stringify(sL(a,n.v7_relativeSplatPath));return w.useMemo(()=>aL(e,JSON.parse(o),i,r==="path"),[e,o,i,r])}function Q2e(e,t){return eje(e,t)}function eje(e,t,r,n){f1()||Ma(!1);let{navigator:a}=w.useContext(Cp),{matches:i}=w.useContext(kh),o=i[i.length-1],l=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let u=cu(),d;if(t){var f;let g=typeof t=="string"?d1(t):t;c==="/"||(f=g.pathname)!=null&&f.startsWith(c)||Ma(!1),d=g}else d=u;let m=d.pathname||"/",h=m;if(c!=="/"){let g=c.replace(/^\//,"").split("/");h="/"+m.replace(/^\//,"").split("/").slice(g.length).join("/")}let x=k2e(e,{pathname:h}),p=aje(x&&x.map(g=>Object.assign({},g,{params:Object.assign({},l,g.params),pathname:Ym([c,a.encodeLocation?a.encodeLocation(g.pathname).pathname:g.pathname]),pathnameBase:g.pathnameBase==="/"?c:Ym([c,a.encodeLocation?a.encodeLocation(g.pathnameBase).pathname:g.pathnameBase])})),i,r,n);return t&&p?w.createElement(OC.Provider,{value:{location:N2({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:Im.Pop}},p):p}function tje(){let e=cje(),t=K2e(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 rje=w.createElement(tje,null);class nje 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(kh.Provider,{value:this.props.routeContext},w.createElement(zee.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function sje(e){let{routeContext:t,match:r,children:n}=e,a=w.useContext(iL);return a&&a.static&&a.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=r.route.id),w.createElement(kh.Provider,{value:t},n)}function aje(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||Ma(!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,x=f.route.loader&&m[f.route.id]===void 0&&(!h||h[f.route.id]===void 0);if(f.route.lazy||x){c=!0,u>=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((d,f,m)=>{let h,x=!1,p=null,g=null;r&&(h=l&&f.route.id?l[f.route.id]:void 0,p=f.route.errorElement||rje,c&&(u<0&&m===0?(dje("route-fallback"),x=!0,g=null):u===m&&(x=!0,g=f.route.hydrateFallbackElement||null)));let v=t.concat(o.slice(0,m+1)),y=()=>{let b;return h?b=p:x?b=g:f.route.Component?b=w.createElement(f.route.Component,null):f.route.element?b=f.route.element:b=d,w.createElement(sje,{match:f,routeContext:{outlet:d,matches:v,isDataRoute:r!=null},children:b})};return r&&(f.route.ErrorBoundary||f.route.errorElement||m===0)?w.createElement(nje,{location:r.location,revalidation:r.revalidation,component:p,error:h,children:y(),routeContext:{outlet:null,matches:v,isDataRoute:!0}}):y()},null)}var Vee=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(Vee||{}),Hee=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}(Hee||{});function ije(e){let t=w.useContext(iL);return t||Ma(!1),t}function oje(e){let t=w.useContext(Y2e);return t||Ma(!1),t}function lje(e){let t=w.useContext(kh);return t||Ma(!1),t}function Wee(e){let t=lje(),r=t.matches[t.matches.length-1];return r.route.id||Ma(!1),r.route.id}function cje(){var e;let t=w.useContext(zee),r=oje(),n=Wee();return t!==void 0?t:(e=r.errors)==null?void 0:e[n]}function uje(){let{router:e}=ije(Vee.UseNavigateStable),t=Wee(Hee.UseNavigateStable),r=w.useRef(!1);return qee(()=>{r.current=!0}),w.useCallback(function(a,i){i===void 0&&(i={}),r.current&&(typeof a=="number"?e.navigate(a):e.navigate(a,N2({fromRouteId:t},i)))},[e,t])}const O9={};function dje(e,t,r){O9[e]||(O9[e]=!0)}function fje(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function D9(e){let{to:t,replace:r,state:n,relative:a}=e;f1()||Ma(!1);let{future:i,static:o}=w.useContext(Cp),{matches:l}=w.useContext(kh),{pathname:c}=cu(),u=Zt(),d=aL(t,sL(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 St(e){Ma(!1)}function hje(e){let{basename:t="/",children:r=null,location:n,navigationType:a=Im.Pop,navigator:i,static:o=!1,future:l}=e;f1()&&Ma(!1);let c=t.replace(/^\/*/,"/"),u=w.useMemo(()=>({basename:c,navigator:i,static:o,future:N2({v7_relativeSplatPath:!1},l)}),[c,l,i,o]);typeof n=="string"&&(n=d1(n));let{pathname:d="/",search:f="",hash:m="",state:h=null,key:x="default"}=n,p=w.useMemo(()=>{let g=nL(d,c);return g==null?null:{location:{pathname:g,search:f,hash:m,state:h,key:x},navigationType:a}},[c,d,f,m,h,x,a]);return p==null?null:w.createElement(Cp.Provider,{value:u},w.createElement(OC.Provider,{children:r,value:p}))}function mje(e){let{children:t,location:r}=e;return Q2e(P6(t),r)}new Promise(()=>{});function P6(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,P6(n.props.children,i));return}n.type!==St&&Ma(!1),!n.props.index||!n.props.children||Ma(!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=P6(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 O6(){return O6=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},O6.apply(null,arguments)}function pje(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 xje(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function gje(e,t){return e.button===0&&(!t||t==="_self")&&!xje(e)}function D6(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 vje(e,t){let r=D6(e);return t&&t.forEach((n,a)=>{r.has(a)||t.getAll(a).forEach(i=>{r.append(a,i)})}),r}const yje=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],bje="6";try{window.__reactRouterVersion=bje}catch{}const wje="startTransition",I9=FI[wje];function jje(e){let{basename:t,children:r,future:n,window:a}=e,i=w.useRef();i.current==null&&(i.current=_2e({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&&I9?I9(()=>c(f)):c(f)},[c,u]);return w.useLayoutEffect(()=>o.listen(d),[o,d]),w.useEffect(()=>fje(n),[n]),w.createElement(hje,{basename:t,children:r,location:l.location,navigationType:l.action,navigator:o,future:n})}const _je=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Nje=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,nt=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=pje(t,yje),{basename:h}=w.useContext(Cp),x,p=!1;if(typeof u=="string"&&Nje.test(u)&&(x=u,_je))try{let b=new URL(window.location.href),N=u.startsWith("//")?new URL(b.protocol+u):new URL(u),j=nL(N.pathname,h);N.origin===b.origin&&j!=null?u=j+N.search+N.hash:p=!0}catch{}let g=Z2e(u,{relative:a}),v=Sje(u,{replace:o,state:l,target:c,preventScrollReset:d,relative:a,viewTransition:f});function y(b){n&&n(b),b.defaultPrevented||v(b)}return w.createElement("a",O6({},m,{href:x||g,onClick:p||i?n:y,ref:r,target:c}))});var R9;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(R9||(R9={}));var L9;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(L9||(L9={}));function Sje(e,t){let{target:r,replace:n,state:a,preventScrollReset:i,relative:o,viewTransition:l}=t===void 0?{}:t,c=Zt(),u=cu(),d=Uee(e,{relative:o});return w.useCallback(f=>{if(gje(f,r)){f.preventDefault();let m=n!==void 0?n:a4(u)===a4(d);c(e,{replace:m,state:a,preventScrollReset:i,relative:o,viewTransition:l})}},[u,c,d,n,a,r,e,i,o,l])}function Jj(e){let t=w.useRef(D6(e)),r=w.useRef(!1),n=cu(),a=w.useMemo(()=>vje(n.search,r.current?null:t.current),[n.search]),i=Zt(),o=w.useCallback((l,c)=>{const u=D6(typeof l=="function"?l(a):l);r.current=!0,i("?"+u,c)},[i,a]);return[a,o]}var I6=function(e,t){return I6=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])},I6(e,t)};function Gee(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");I6(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}var $c=function(){return $c=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},$c.apply(this,arguments)};function Ep(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 Kee(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 Xee(e,t){return function(r,n){t(r,n,e)}}function Yee(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 x={};for(var p in n)x[p]=p==="access"?{}:n[p];for(var p in n.access)x.access[p]=n.access[p];x.addInitializer=function(v){if(m)throw new TypeError("Cannot add initializers after decoration has completed");i.push(o(v||null))};var g=(0,r[h])(l==="accessor"?{get:d.get,set:d.set}:d[c],x);if(l==="accessor"){if(g===void 0)continue;if(g===null||typeof g!="object")throw new TypeError("Object expected");(f=o(g.get))&&(d.get=f),(f=o(g.set))&&(d.set=f),(f=o(g.init))&&a.unshift(f)}else(f=o(g))&&(l==="field"?a.unshift(f):d[c]=f)}u&&Object.defineProperty(u,n.name,d),m=!0}function Zee(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 Jee(e){return typeof e=="symbol"?e:"".concat(e)}function Qee(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 ete(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)}function pr(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 tte(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 DC=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 rte(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&DC(t,e,r)}function i4(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 oL(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 nte(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(oL(arguments[t]));return e}function ste(){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 lL(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 py(e){return this instanceof py?(this.v=e,this):new py(e)}function ate(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(x){return Promise.resolve(x).then(h,f)}}function l(h,x){n[h]&&(a[h]=function(p){return new Promise(function(g,v){i.push([h,p,g,v])>1||c(h,p)})},x&&(a[h]=x(a[h])))}function c(h,x){try{u(n[h](x))}catch(p){m(i[0][3],p)}}function u(h){h.value instanceof py?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,x){h(x),i.shift(),i.length&&c(i[0][0],i[0][1])}}function ite(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:py(e[a](o)),done:!1}:i?i(o):o}:i}}function ote(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 i4=="function"?i4(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 lte(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var kje=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},R6=function(e){return R6=Object.getOwnPropertyNames||function(t){var r=[];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[r.length]=n);return r},R6(e)};function cte(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=R6(e),n=0;n<r.length;n++)r[n]!=="default"&&DC(t,e,r[n]);return kje(t,e),t}function ute(e){return e&&e.__esModule?e:{default:e}}function dte(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 fte(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 hte(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 mte(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 Cje=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 pte(e){function t(i){e.error=e.hasError?new Cje(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 xte(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 Eje={__extends:Gee,__assign:$c,__rest:Ep,__decorate:Kee,__param:Xee,__esDecorate:Yee,__runInitializers:Zee,__propKey:Jee,__setFunctionName:Qee,__metadata:ete,__awaiter:pr,__generator:tte,__createBinding:DC,__exportStar:rte,__values:i4,__read:oL,__spread:nte,__spreadArrays:ste,__spreadArray:lL,__await:py,__asyncGenerator:ate,__asyncDelegator:ite,__asyncValues:ote,__makeTemplateObject:lte,__importStar:cte,__importDefault:ute,__classPrivateFieldGet:dte,__classPrivateFieldSet:fte,__classPrivateFieldIn:hte,__addDisposableResource:mte,__disposeResources:pte,__rewriteRelativeImportExtension:xte},Aje=Object.freeze(Object.defineProperty({__proto__:null,__addDisposableResource:mte,get __assign(){return $c},__asyncDelegator:ite,__asyncGenerator:ate,__asyncValues:ote,__await:py,__awaiter:pr,__classPrivateFieldGet:dte,__classPrivateFieldIn:hte,__classPrivateFieldSet:fte,__createBinding:DC,__decorate:Kee,__disposeResources:pte,__esDecorate:Yee,__exportStar:rte,__extends:Gee,__generator:tte,__importDefault:ute,__importStar:cte,__makeTemplateObject:lte,__metadata:ete,__param:Xee,__propKey:Jee,__read:oL,__rest:Ep,__rewriteRelativeImportExtension:xte,__runInitializers:Zee,__setFunctionName:Qee,__spread:nte,__spreadArray:lL,__spreadArrays:ste,__values:i4,default:Eje},Symbol.toStringTag,{value:"Module"})),Tje=e=>e?(...t)=>e(...t):(...t)=>fetch(...t);class cL extends Error{constructor(t,r="FunctionsError",n){super(t),this.name=r,this.context=n}}class Pje extends cL{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class F9 extends cL{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class M9 extends cL{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var L6;(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"})(L6||(L6={}));class Oje{constructor(t,{headers:r={},customFetch:n,region:a=L6.Any}={}){this.url=t,this.headers=r,this.region=a,this.fetch=Tje(n)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t){return pr(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 x=new URL(`${this.url}/${r}`);h&&h!=="any"&&(m["x-region"]=h,x.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 g=d;f&&(o=new AbortController,i=setTimeout(()=>o.abort(),f),d?(g=o.signal,d.addEventListener("abort",()=>o.abort())):g=o.signal);const v=yield this.fetch(x.toString(),{method:c||"POST",headers:Object.assign(Object.assign(Object.assign({},m),this.headers),l),body:p,signal:g}).catch(j=>{throw new Pje(j)}),y=v.headers.get("x-relay-error");if(y&&y==="true")throw new F9(v);if(!v.ok)throw new M9(v);let b=((a=v.headers.get("Content-Type"))!==null&&a!==void 0?a:"text/plain").split(";")[0].trim(),N;return b==="application/json"?N=yield v.json():b==="application/octet-stream"||b==="application/pdf"?N=yield v.blob():b==="text/event-stream"?N=v:b==="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 M9||l instanceof F9?l.context:void 0}}finally{i&&clearTimeout(i)}})}}var hl={};const h1=Mxe(Aje);var zN={},qN={},UN={},VN={},HN={},WN={},$9;function gte(){if($9)return WN;$9=1,Object.defineProperty(WN,"__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 WN.default=e,WN}var B9;function vte(){if(B9)return HN;B9=1,Object.defineProperty(HN,"__esModule",{value:!0});const t=h1.__importDefault(gte());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,x=null,p=null,g=c.status,v=c.statusText;if(c.ok){if(this.method!=="HEAD"){const j=await c.text();j===""||(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"))?x=j:x=JSON.parse(j))}const b=(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("/");b&&N&&N.length>1&&(p=parseInt(N[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(x)&&(x.length>1?(h={code:"PGRST116",details:`Results contain ${x.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},x=null,p=null,g=406,v="Not Acceptable"):x.length===1?x=x[0]:x=null)}else{const b=await c.text();try{h=JSON.parse(b),Array.isArray(h)&&c.status===404&&(x=[],h=null,g=200,v="OK")}catch{c.status===404&&b===""?(g=204,v="No Content"):h={message:b}}if(h&&this.isMaybeSingle&&(!((m=h==null?void 0:h.details)===null||m===void 0)&&m.includes("0 rows"))&&(h=null,g=200,v="OK"),h&&this.shouldThrowOnError)throw new t.default(h)}return{error:h,data:x,count:p,status:g,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 HN.default=r,HN}var z9;function yte(){if(z9)return VN;z9=1,Object.defineProperty(VN,"__esModule",{value:!0});const t=h1.__importDefault(vte());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 VN.default=r,VN}var q9;function uL(){if(q9)return UN;q9=1,Object.defineProperty(UN,"__esModule",{value:!0});const t=h1.__importDefault(yte()),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 UN.default=n,UN}var U9;function bte(){if(U9)return qN;U9=1,Object.defineProperty(qN,"__esModule",{value:!0});const t=h1.__importDefault(uL());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 qN.default=r,qN}var V9;function Dje(){if(V9)return zN;V9=1,Object.defineProperty(zN,"__esModule",{value:!0});const e=h1,t=e.__importDefault(bte()),r=e.__importDefault(uL());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,g])=>g!==void 0).map(([p,g])=>[p,Array.isArray(g)?`{${g.join(",")}}`:`${g}`]).forEach(([p,g])=>{m.searchParams.append(p,g)})):(f="POST",h=o);const x=new Headers(this.headers);return u&&x.set("Prefer",`count=${u}`),new r.default({method:f,url:m,headers:x,schema:this.schemaName,body:h,fetch:(d=this.fetch)!==null&&d!==void 0?d:fetch})}}return zN.default=n,zN}Object.defineProperty(hl,"__esModule",{value:!0});var wte=hl.PostgrestError=Pte=hl.PostgrestBuilder=Ate=hl.PostgrestTransformBuilder=Cte=hl.PostgrestFilterBuilder=Ste=hl.PostgrestQueryBuilder=_te=hl.PostgrestClient=void 0;const m1=h1,jte=m1.__importDefault(Dje());var _te=hl.PostgrestClient=jte.default;const Nte=m1.__importDefault(bte());var Ste=hl.PostgrestQueryBuilder=Nte.default;const kte=m1.__importDefault(uL());var Cte=hl.PostgrestFilterBuilder=kte.default;const Ete=m1.__importDefault(yte());var Ate=hl.PostgrestTransformBuilder=Ete.default;const Tte=m1.__importDefault(vte());var Pte=hl.PostgrestBuilder=Tte.default;const Ote=m1.__importDefault(gte());wte=hl.PostgrestError=Ote.default;var Dte=hl.default={PostgrestClient:jte.default,PostgrestQueryBuilder:Nte.default,PostgrestFilterBuilder:kte.default,PostgrestTransformBuilder:Ete.default,PostgrestBuilder:Tte.default,PostgrestError:Ote.default};const Ije=Object.freeze(Object.defineProperty({__proto__:null,get PostgrestBuilder(){return Pte},get PostgrestClient(){return _te},get PostgrestError(){return wte},get PostgrestFilterBuilder(){return Cte},get PostgrestQueryBuilder(){return Ste},get PostgrestTransformBuilder(){return Ate},default:Dte},Symbol.toStringTag,{value:"Module"})),{PostgrestClient:Rje,PostgrestQueryBuilder:KCt,PostgrestFilterBuilder:XCt,PostgrestTransformBuilder:YCt,PostgrestBuilder:ZCt,PostgrestError:JCt}=Dte||Ije;class Lje{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 Fje="2.81.1",Mje=`realtime-js/${Fje}`,Ite="1.0.0",$je="2.0.0",H9=Ite,F6=1e4,Bje=1e3,zje=100;var vx;(function(e){e[e.connecting=0]="connecting",e[e.open=1]="open",e[e.closing=2]="closing",e[e.closed=3]="closed"})(vx||(vx={}));var fi;(function(e){e.closed="closed",e.errored="errored",e.joined="joined",e.joining="joining",e.leaving="leaving"})(fi||(fi={}));var Dc;(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"})(Dc||(Dc={}));var M6;(function(e){e.websocket="websocket"})(M6||(M6={}));var yx;(function(e){e.Connecting="connecting",e.Open="open",e.Closing="closing",e.Closed="closed"})(yx||(yx={}));class qje{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,x=>f.setUint8(m++,x.charCodeAt(0))),Array.from(i,x=>f.setUint8(m++,x.charCodeAt(0))),Array.from(o,x=>f.setUint8(m++,x.charCodeAt(0))),Array.from(l,x=>f.setUint8(m++,x.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),x=0;h.setUint8(x++,this.KINDS.userBroadcastPush),h.setUint8(x++,a.length),h.setUint8(x++,i.length),h.setUint8(x++,o.length),h.setUint8(x++,l.length),h.setUint8(x++,this.JSON_ENCODING),Array.from(a,g=>h.setUint8(x++,g.charCodeAt(0))),Array.from(i,g=>h.setUint8(x++,g.charCodeAt(0))),Array.from(o,g=>h.setUint8(x++,g.charCodeAt(0))),Array.from(l,g=>h.setUint8(x++,g.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))),x={status:m,response:h};return{join_ref:u,ref:d,topic:f,event:Dc.reply,payload:x}}_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,x={type:this.BROADCAST,event:d,payload:h};return o>0&&(x.meta=JSON.parse(f)),{join_ref:null,ref:null,topic:u,event:this.BROADCAST,payload:x}}_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 Rte{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 Ss;(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"})(Ss||(Ss={}));const W9=(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]=Uje(o,e,t,a),i),{}):{}},Uje=(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)?Lte(i,o):$6(o)},Lte=(e,t)=>{if(e.charAt(0)==="_"){const r=e.slice(1,e.length);return Gje(t,r)}switch(e){case Ss.bool:return Vje(t);case Ss.float4:case Ss.float8:case Ss.int2:case Ss.int4:case Ss.int8:case Ss.numeric:case Ss.oid:return Hje(t);case Ss.json:case Ss.jsonb:return Wje(t);case Ss.timestamp:return Kje(t);case Ss.abstime:case Ss.date:case Ss.daterange:case Ss.int4range:case Ss.int8range:case Ss.money:case Ss.reltime:case Ss.text:case Ss.time:case Ss.timestamptz:case Ss.timetz:case Ss.tsrange:case Ss.tstzrange:return $6(t);default:return $6(t)}},$6=e=>e,Vje=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},Hje=e=>{if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},Wje=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch(t){return console.log(`JSON parse error: ${t}`),e}return e},Gje=(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=>Lte(t,l))}return e},Kje=e=>typeof e=="string"?e.replace(" ","T"):e,Fte=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 K3{constructor(t,r,n={},a=F6){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 G9;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(G9||(G9={}));class jw{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=jw.syncState(this.state,a,i,o),this.pendingDiffs.forEach(c=>{this.state=jw.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=jw.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(g=>g.presence_ref),h=f.map(g=>g.presence_ref),x=d.filter(g=>h.indexOf(g.presence_ref)<0),p=f.filter(g=>m.indexOf(g.presence_ref)<0);x.length>0&&(l[u]=x),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 K9;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(K9||(K9={}));var _w;(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(_w||(_w={}));var Bf;(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(Bf||(Bf={}));class dL{constructor(t,r={config:{}},n){var a,i;if(this.topic=t,this.params=r,this.socket=n,this.bindings={},this.state=fi.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 K3(this,Dc.join,this.params,this.timeout),this.rejoinTimer=new Rte(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=fi.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=fi.closed,this.socket._remove(this)}),this._onError(o=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,o),this.state=fi.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=fi.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",o=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,o),this.state=fi.errored,this.rejoinTimer.scheduleTimeout())}),this._on(Dc.reply,{},(o,l)=>{this._trigger(this._replyEventName(l),o)}),this.presence=new jw(this),this.broadcastEndpointURL=Fte(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==fi.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[_w.PRESENCE]&&this.bindings[_w.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(Bf.CHANNEL_ERROR,h)),this._onClose(()=>t==null?void 0:t(Bf.CLOSED)),this.updateJoinPayload(Object.assign({config:m},f)),this.joinedOnce=!0,this._rejoin(r),this.joinPush.receive("ok",async({postgres_changes:h})=>{var x;if(this.socket.setAuth(),h===void 0){t==null||t(Bf.SUBSCRIBED);return}else{const p=this.bindings.postgres_changes,g=(x=p==null?void 0:p.length)!==null&&x!==void 0?x:0,v=[];for(let y=0;y<g;y++){const b=p[y],{filter:{event:N,schema:j,table:_,filter:S}}=b,P=h&&h[y];if(P&&P.event===N&&P.schema===j&&P.table===_&&P.filter===S)v.push(Object.assign(Object.assign({},b),{id:P.id}));else{this.unsubscribe(),this.state=fi.errored,t==null||t(Bf.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=v,t&&t(Bf.SUBSCRIBED);return}}).receive("error",h=>{this.state=fi.errored,t==null||t(Bf.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(h).join(", ")||"error")))}).receive("timeout",()=>{t==null||t(Bf.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===fi.joined&&t===_w.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=fi.leaving;const r=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(Dc.close,"leave",this._joinRef())};this.joinPush.destroy();let n=null;return new Promise(a=>{n=new K3(this,Dc.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=fi.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 K3(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>zje){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}=Dc;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 x,p,g;return((x=h.filter)===null||x===void 0?void 0:x.event)==="*"||((g=(p=h.filter)===null||p===void 0?void 0:p.event)===null||g===void 0?void 0:g.toLocaleLowerCase())===o}).map(h=>h.callback(m,n)):(i=this.bindings[o])===null||i===void 0||i.filter(h=>{var x,p,g,v,y,b;if(["broadcast","presence","postgres_changes"].includes(o))if("id"in h){const N=h.id,j=(x=h.filter)===null||x===void 0?void 0:x.event;return N&&((p=r.ids)===null||p===void 0?void 0:p.includes(N))&&(j==="*"||(j==null?void 0:j.toLocaleLowerCase())===((g=r.data)===null||g===void 0?void 0:g.type.toLocaleLowerCase()))}else{const N=(y=(v=h==null?void 0:h.filter)===null||v===void 0?void 0:v.event)===null||y===void 0?void 0:y.toLocaleLowerCase();return N==="*"||N===((b=r==null?void 0:r.event)===null||b===void 0?void 0:b.toLocaleLowerCase())}else return h.type.toLocaleLowerCase()===o}).map(h=>{if(typeof m=="object"&&"ids"in m){const x=m.data,{schema:p,table:g,commit_timestamp:v,type:y,errors:b}=x;m=Object.assign(Object.assign({},{schema:p,table:g,commit_timestamp:v,eventType:y,new:{},old:{},errors:b}),this._getPayloadRecords(x))}h.callback(m,n)})}_isClosed(){return this.state===fi.closed}_isJoined(){return this.state===fi.joined}_isJoining(){return this.state===fi.joining}_isLeaving(){return this.state===fi.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&&dL.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(Dc.close,{},t)}_onError(t){this._on(Dc.error,{},r=>t(r))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(t=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=fi.joining,this.joinPush.resend(t))}_getPayloadRecords(t){const r={new:{},old:{}};return(t.type==="INSERT"||t.type==="UPDATE")&&(r.new=W9(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(r.old=W9(t.columns,t.old_record)),r}}const X3=()=>{},GN={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},Xje=[1e3,2e3,5e3,1e4],Yje=1e4,Zje=`
addEventListener("message", (e) => {
if (e.data.event === "start") {
setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
}
});`;class Jje{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=F6,this.transport=null,this.heartbeatIntervalMs=GN.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=X3,this.ref=0,this.reconnectTimer=null,this.vsn=H9,this.logger=X3,this.conn=null,this.sendBuffer=[],this.serializer=new qje,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}/${M6.websocket}`,this.httpEndpoint=Fte(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=Lje.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 vx.connecting:return yx.Connecting;case vx.open:return yx.Open;case vx.closing:return yx.Closing;default:return yx.Closed}}isConnected(){return this.connectionState()===yx.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 dL(`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(Bje,"heartbeat timeout"),setTimeout(()=>{var r;this.isConnected()||(r=this.reconnectTimer)===null||r===void 0||r.scheduleTimeout()},GN.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===vx.open||this.conn.readyState===vx.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(Dc.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([Zje],{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:Mje};r&&n.updateJoinPayload(a),n.joinedOnce&&n._isJoined()&&n._push(Dc.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 Rte(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},GN.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:F6,this.heartbeatIntervalMs=(a=t==null?void 0:t.heartbeatIntervalMs)!==null&&a!==void 0?a:GN.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:X3,this.vsn=(c=t==null?void 0:t.vsn)!==null&&c!==void 0?c:H9,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:x=>Xje[x-1]||Yje,this.vsn){case Ite:this.encode=(d=t==null?void 0:t.encode)!==null&&d!==void 0?d:(x,p)=>p(JSON.stringify(x)),this.decode=(f=t==null?void 0:t.decode)!==null&&f!==void 0?f:(x,p)=>p(JSON.parse(x));break;case $je: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 fL extends Error{constructor(t){super(t),this.__isStorageError=!0,this.name="StorageError"}}function na(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}class Qje extends fL{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 B6 extends fL{constructor(t,r){super(t),this.name="StorageUnknownError",this.originalError=r}}const hL=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),e_e=()=>Response,z6=e=>{if(Array.isArray(e))return e.map(r=>z6(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]=z6(n)}),t},t_e=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)},Y3=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)},r_e=(e,t,r)=>pr(void 0,void 0,void 0,function*(){const n=yield e_e();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 Qje(Y3(a),i,o))}).catch(a=>{t(new B6(Y3(a),a))}):t(new B6(Y3(e),e))}),n_e=(e,t,r,n)=>{const a={method:e,headers:(t==null?void 0:t.headers)||{}};return e==="GET"||!n?a:(t_e(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 Qj(e,t,r,n,a,i){return pr(this,void 0,void 0,function*(){return new Promise((o,l)=>{e(r,n_e(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=>r_e(c,l,n))})})}function S2(e,t,r,n){return pr(this,void 0,void 0,function*(){return Qj(e,"GET",t,r,n)})}function Pu(e,t,r,n,a){return pr(this,void 0,void 0,function*(){return Qj(e,"POST",t,n,a,r)})}function q6(e,t,r,n,a){return pr(this,void 0,void 0,function*(){return Qj(e,"PUT",t,n,a,r)})}function s_e(e,t,r,n){return pr(this,void 0,void 0,function*(){return Qj(e,"HEAD",t,Object.assign(Object.assign({},r),{noResolveJson:!0}),n)})}function mL(e,t,r,n,a){return pr(this,void 0,void 0,function*(){return Qj(e,"DELETE",t,n,a,r)})}class a_e{constructor(t,r){this.downloadFn=t,this.shouldThrowOnError=r}then(t,r){return this.execute().then(t,r)}execute(){return pr(this,void 0,void 0,function*(){try{return{data:(yield this.downloadFn()).body,error:null}}catch(t){if(this.shouldThrowOnError)throw t;if(na(t))return{data:null,error:t};throw t}})}}var Mte;class i_e{constructor(t,r){this.downloadFn=t,this.shouldThrowOnError=r,this[Mte]="BlobDownloadBuilder",this.promise=null}asStream(){return new a_e(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 pr(this,void 0,void 0,function*(){try{return{data:yield(yield this.downloadFn()).blob(),error:null}}catch(t){if(this.shouldThrowOnError)throw t;if(na(t))return{data:null,error:t};throw t}})}}Mte=Symbol.toStringTag;const o_e={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},X9={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class l_e{constructor(t,r={},n,a){this.shouldThrowOnError=!1,this.url=t,this.headers=r,this.bucketId=n,this.fetch=hL(a)}throwOnError(){return this.shouldThrowOnError=!0,this}uploadOrUpdate(t,r,n,a){return pr(this,void 0,void 0,function*(){try{let i;const o=Object.assign(Object.assign({},X9),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"?q6:Pu)(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(na(i))return{data:null,error:i};throw i}})}upload(t,r,n){return pr(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",t,r,n)})}uploadToSignedUrl(t,r,n,a){return pr(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:X9.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 q6(this.fetch,l.toString(),c,{headers:d});return{data:{path:i,fullPath:f.Key},error:null}}catch(c){if(this.shouldThrowOnError)throw c;if(na(c))return{data:null,error:c};throw c}})}createSignedUploadUrl(t,r){return pr(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 Pu(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 fL("No token returned by API");return{data:{signedUrl:o.toString(),path:t,token:l},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(na(n))return{data:null,error:n};throw n}})}update(t,r,n){return pr(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",t,r,n)})}move(t,r,n){return pr(this,void 0,void 0,function*(){try{return{data:yield Pu(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(na(a))return{data:null,error:a};throw a}})}copy(t,r,n){return pr(this,void 0,void 0,function*(){try{return{data:{path:(yield Pu(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(na(a))return{data:null,error:a};throw a}})}createSignedUrl(t,r,n){return pr(this,void 0,void 0,function*(){try{let a=this._getFinalPath(t),i=yield Pu(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(na(a))return{data:null,error:a};throw a}})}createSignedUrls(t,r,n){return pr(this,void 0,void 0,function*(){try{const a=yield Pu(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(na(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=()=>S2(this.fetch,`${this.url}/${a}/${l}${o}`,{headers:this.headers,noResolveJson:!0});return new i_e(c,this.shouldThrowOnError)}info(t){return pr(this,void 0,void 0,function*(){const r=this._getFinalPath(t);try{const n=yield S2(this.fetch,`${this.url}/object/info/${r}`,{headers:this.headers});return{data:z6(n),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(na(n))return{data:null,error:n};throw n}})}exists(t){return pr(this,void 0,void 0,function*(){const r=this._getFinalPath(t);try{return yield s_e(this.fetch,`${this.url}/object/${r}`,{headers:this.headers}),{data:!0,error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(na(n)&&n instanceof B6){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 pr(this,void 0,void 0,function*(){try{return{data:yield mL(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:t},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(na(r))return{data:null,error:r};throw r}})}list(t,r,n){return pr(this,void 0,void 0,function*(){try{const a=Object.assign(Object.assign(Object.assign({},o_e),r),{prefix:t||""});return{data:yield Pu(this.fetch,`${this.url}/object/list/${this.bucketId}`,a,{headers:this.headers},n),error:null}}catch(a){if(this.shouldThrowOnError)throw a;if(na(a))return{data:null,error:a};throw a}})}listV2(t,r){return pr(this,void 0,void 0,function*(){try{const n=Object.assign({},t);return{data:yield Pu(this.fetch,`${this.url}/object/list-v2/${this.bucketId}`,n,{headers:this.headers},r),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(na(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 $te="2.81.1",Bte={"X-Client-Info":`storage-js/${$te}`};class c_e{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({},Bte),r),this.fetch=hL(n)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(t){return pr(this,void 0,void 0,function*(){try{const r=this.listBucketOptionsToQueryString(t);return{data:yield S2(this.fetch,`${this.url}/bucket${r}`,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(na(r))return{data:null,error:r};throw r}})}getBucket(t){return pr(this,void 0,void 0,function*(){try{return{data:yield S2(this.fetch,`${this.url}/bucket/${t}`,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(na(r))return{data:null,error:r};throw r}})}createBucket(t){return pr(this,arguments,void 0,function*(r,n={public:!1}){try{return{data:yield Pu(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(na(a))return{data:null,error:a};throw a}})}updateBucket(t,r){return pr(this,void 0,void 0,function*(){try{return{data:yield q6(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(na(n))return{data:null,error:n};throw n}})}emptyBucket(t){return pr(this,void 0,void 0,function*(){try{return{data:yield Pu(this.fetch,`${this.url}/bucket/${t}/empty`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(na(r))return{data:null,error:r};throw r}})}deleteBucket(t){return pr(this,void 0,void 0,function*(){try{return{data:yield mL(this.fetch,`${this.url}/bucket/${t}`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(na(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 u_e{constructor(t,r={},n){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},Bte),r),this.fetch=hL(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(t){return pr(this,void 0,void 0,function*(){try{return{data:yield Pu(this.fetch,`${this.url}/bucket`,{name:t},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(na(r))return{data:null,error:r};throw r}})}listBuckets(t){return pr(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 S2(this.fetch,a,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(na(r))return{data:null,error:r};throw r}})}deleteBucket(t){return pr(this,void 0,void 0,function*(){try{return{data:yield mL(this.fetch,`${this.url}/bucket/${t}`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(na(r))return{data:null,error:r};throw r}})}}const pL={"X-Client-Info":`storage-js/${$te}`,"Content-Type":"application/json"};class zte extends Error{constructor(t){super(t),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}}function Gl(e){return typeof e=="object"&&e!==null&&"__isStorageVectorsError"in e}class Z3 extends zte{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 d_e extends zte{constructor(t,r){super(t),this.name="StorageVectorsUnknownError",this.originalError=r}}var Y9;(function(e){e.InternalError="InternalError",e.S3VectorConflictException="S3VectorConflictException",e.S3VectorNotFoundException="S3VectorNotFoundException",e.S3VectorBucketNotEmpty="S3VectorBucketNotEmpty",e.S3VectorMaxBucketsExceeded="S3VectorMaxBucketsExceeded",e.S3VectorMaxIndexesExceeded="S3VectorMaxIndexesExceeded"})(Y9||(Y9={}));const xL=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),f_e=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)},Z9=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),h_e=(e,t,r)=>pr(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 Z3(Z9(o),a,l))}).catch(()=>{const o=a+"",l=i.statusText||`HTTP ${a} error`;t(new Z3(l,a,o))});else{const o=a+"",l=i.statusText||`HTTP ${a} error`;t(new Z3(l,a,o))}}else t(new d_e(Z9(e),e))}),m_e=(e,t,r,n)=>{const a={method:e,headers:(t==null?void 0:t.headers)||{}};return n?(f_e(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 p_e(e,t,r,n,a,i){return pr(this,void 0,void 0,function*(){return new Promise((o,l)=>{e(r,m_e(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=>h_e(c,l,n))})})}function Kl(e,t,r,n,a){return pr(this,void 0,void 0,function*(){return p_e(e,"POST",t,n,a,r)})}class x_e{constructor(t,r={},n){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},pL),r),this.fetch=xL(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createIndex(t){return pr(this,void 0,void 0,function*(){try{return{data:(yield Kl(this.fetch,`${this.url}/CreateIndex`,t,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Gl(r))return{data:null,error:r};throw r}})}getIndex(t,r){return pr(this,void 0,void 0,function*(){try{return{data:yield Kl(this.fetch,`${this.url}/GetIndex`,{vectorBucketName:t,indexName:r},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Gl(n))return{data:null,error:n};throw n}})}listIndexes(t){return pr(this,void 0,void 0,function*(){try{return{data:yield Kl(this.fetch,`${this.url}/ListIndexes`,t,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Gl(r))return{data:null,error:r};throw r}})}deleteIndex(t,r){return pr(this,void 0,void 0,function*(){try{return{data:(yield Kl(this.fetch,`${this.url}/DeleteIndex`,{vectorBucketName:t,indexName:r},{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Gl(n))return{data:null,error:n};throw n}})}}class g_e{constructor(t,r={},n){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},pL),r),this.fetch=xL(n)}throwOnError(){return this.shouldThrowOnError=!0,this}putVectors(t){return pr(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 Kl(this.fetch,`${this.url}/PutVectors`,t,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Gl(r))return{data:null,error:r};throw r}})}getVectors(t){return pr(this,void 0,void 0,function*(){try{return{data:yield Kl(this.fetch,`${this.url}/GetVectors`,t,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Gl(r))return{data:null,error:r};throw r}})}listVectors(t){return pr(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 Kl(this.fetch,`${this.url}/ListVectors`,t,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Gl(r))return{data:null,error:r};throw r}})}queryVectors(t){return pr(this,void 0,void 0,function*(){try{return{data:yield Kl(this.fetch,`${this.url}/QueryVectors`,t,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Gl(r))return{data:null,error:r};throw r}})}deleteVectors(t){return pr(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 Kl(this.fetch,`${this.url}/DeleteVectors`,t,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Gl(r))return{data:null,error:r};throw r}})}}class v_e{constructor(t,r={},n){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},pL),r),this.fetch=xL(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(t){return pr(this,void 0,void 0,function*(){try{return{data:(yield Kl(this.fetch,`${this.url}/CreateVectorBucket`,{vectorBucketName:t},{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Gl(r))return{data:null,error:r};throw r}})}getBucket(t){return pr(this,void 0,void 0,function*(){try{return{data:yield Kl(this.fetch,`${this.url}/GetVectorBucket`,{vectorBucketName:t},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Gl(r))return{data:null,error:r};throw r}})}listBuckets(){return pr(this,arguments,void 0,function*(t={}){try{return{data:yield Kl(this.fetch,`${this.url}/ListVectorBuckets`,t,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Gl(r))return{data:null,error:r};throw r}})}deleteBucket(t){return pr(this,void 0,void 0,function*(){try{return{data:(yield Kl(this.fetch,`${this.url}/DeleteVectorBucket`,{vectorBucketName:t},{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Gl(r))return{data:null,error:r};throw r}})}}class y_e extends v_e{constructor(t,r={}){super(t,r.headers||{},r.fetch)}from(t){return new b_e(this.url,this.headers,t,this.fetch)}}class b_e extends x_e{constructor(t,r,n,a){super(t,r,a),this.vectorBucketName=n}createIndex(t){const r=Object.create(null,{createIndex:{get:()=>super.createIndex}});return pr(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 pr(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 pr(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 pr(this,void 0,void 0,function*(){return r.deleteIndex.call(this,this.vectorBucketName,t)})}index(t){return new w_e(this.url,this.headers,this.vectorBucketName,t,this.fetch)}}class w_e extends g_e{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 pr(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 pr(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 pr(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 pr(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 pr(this,void 0,void 0,function*(){return r.deleteVectors.call(this,Object.assign(Object.assign({},t),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}}class j_e extends c_e{constructor(t,r={},n,a){super(t,r,n,a)}from(t){return new l_e(this.url,this.headers,t,this.fetch)}get vectors(){return new y_e(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new u_e(this.url+"/iceberg",this.headers,this.fetch)}}const __e="2.81.1";let rw="";typeof Deno<"u"?rw="deno":typeof document<"u"?rw="web":typeof navigator<"u"&&navigator.product==="ReactNative"?rw="react-native":rw="node";const N_e={"X-Client-Info":`supabase-js-${rw}/${__e}`},S_e={headers:N_e},k_e={schema:"public"},C_e={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},E_e={},A_e=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),T_e=()=>Headers,P_e=(e,t,r)=>{const n=A_e(r),a=T_e();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 O_e(e){return e.endsWith("/")?e:e+"/"}function D_e(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 I_e(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(O_e(t))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}const qte="2.81.1",Vg=30*1e3,U6=3,J3=U6*Vg,R_e="http://localhost:9999",L_e="supabase.auth.token",F_e={"X-Client-Info":`gotrue-js/${qte}`},V6="X-Supabase-Api-Version",Ute={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},M_e=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,$_e=10*60*1e3;class k2 extends Error{constructor(t,r,n){super(t),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=n}}function wr(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}class B_e extends k2{constructor(t,r,n){super(t,r,n),this.name="AuthApiError",this.status=r,this.code=n}}function z_e(e){return wr(e)&&e.name==="AuthApiError"}class bx extends k2{constructor(t,r){super(t),this.name="AuthUnknownError",this.originalError=r}}class Ap extends k2{constructor(t,r,n,a){super(t,n,a),this.name=r,this.status=n}}class Cu extends Ap{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function q_e(e){return wr(e)&&e.name==="AuthSessionMissingError"}class bg extends Ap{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class KN extends Ap{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}}class XN extends Ap{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 U_e(e){return wr(e)&&e.name==="AuthImplicitGrantRedirectError"}class J9 extends Ap{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 H6 extends Ap{constructor(t,r){super(t,"AuthRetryableFetchError",r,void 0)}}function Q3(e){return wr(e)&&e.name==="AuthRetryableFetchError"}class Q9 extends Ap{constructor(t,r,n){super(t,"AuthWeakPasswordError",r,"weak_password"),this.reasons=n}}class W6 extends Ap{constructor(t){super(t,"AuthInvalidJwtError",400,"invalid_jwt")}}const o4="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),ez=`
\r=`.split(""),V_e=(()=>{const e=new Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<ez.length;t+=1)e[ez[t].charCodeAt(0)]=-2;for(let t=0;t<o4.length;t+=1)e[o4[t].charCodeAt(0)]=t;return e})();function tz(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(o4[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(o4[n]),t.queuedBits-=6}}function Vte(e,t,r){const n=V_e[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 rz(e){const t=[],r=o=>{t.push(String.fromCodePoint(o))},n={utf8seq:0,codepoint:0},a={queue:0,queuedBits:0},i=o=>{G_e(o,n,r)};for(let o=0;o<e.length;o+=1)Vte(e.charCodeAt(o),a,i);return t.join("")}function H_e(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 W_e(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}H_e(n,t)}}function G_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 Av(e){const t=[],r={queue:0,queuedBits:0},n=a=>{t.push(a)};for(let a=0;a<e.length;a+=1)Vte(e.charCodeAt(a),r,n);return new Uint8Array(t)}function K_e(e){const t=[];return W_e(e,r=>t.push(r)),new Uint8Array(t)}function Cx(e){const t=[],r={queue:0,queuedBits:0},n=a=>{t.push(a)};return e.forEach(a=>tz(a,r,n)),tz(null,r,n),t.join("")}function X_e(e){return Math.round(Date.now()/1e3)+e}function Y_e(){return Symbol("auth-callback")}const Wi=()=>typeof window<"u"&&typeof document<"u",nx={tested:!1,writable:!1},Hte=()=>{if(!Wi())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(nx.tested)return nx.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),nx.tested=!0,nx.writable=!0}catch{nx.tested=!0,nx.writable=!1}return nx.writable};function Z_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 Wte=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),J_e=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function",Hg=async(e,t,r)=>{await e.setItem(t,JSON.stringify(r))},sx=async(e,t)=>{const r=await e.getItem(t);if(!r)return null;try{return JSON.parse(r)}catch{return r}},Qh=async(e,t)=>{await e.removeItem(t)};class IC{constructor(){this.promise=new IC.promiseConstructor((t,r)=>{this.resolve=t,this.reject=r})}}IC.promiseConstructor=Promise;function eT(e){const t=e.split(".");if(t.length!==3)throw new W6("Invalid JWT structure");for(let n=0;n<t.length;n++)if(!M_e.test(t[n]))throw new W6("JWT not in base64url format");return{header:JSON.parse(rz(t[0])),payload:JSON.parse(rz(t[1])),signature:Av(t[2]),raw:{header:t[0],payload:t[1]}}}async function Q_e(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function eNe(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 tNe(e){return("0"+e.toString(16)).substr(-2)}function rNe(){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,tNe).join("")}async function nNe(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 sNe(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 nNe(e);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function wg(e,t,r=!1){const n=rNe();let a=n;r&&(a+="/PASSWORD_RECOVERY"),await Hg(e,`${t}-code-verifier`,a);const i=await sNe(n);return[i,n===i?"plain":"s256"]}const aNe=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function iNe(e){const t=e.headers.get(V6);if(!t||!t.match(aNe))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function oNe(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 lNe(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 cNe=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function jg(e){if(!cNe.test(e))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function tT(){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 uNe(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 nz(e){return JSON.parse(JSON.stringify(e))}const dx=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),dNe=[502,503,504];async function sz(e){var t;if(!J_e(e))throw new H6(dx(e),0);if(dNe.includes(e.status))throw new H6(dx(e),e.status);let r;try{r=await e.json()}catch(i){throw new bx(dx(i),i)}let n;const a=iNe(e);if(a&&a.getTime()>=Ute["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 Q9(dx(r),e.status,((t=r.weak_password)===null||t===void 0?void 0:t.reasons)||[]);if(n==="session_not_found")throw new Cu}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 Q9(dx(r),e.status,r.weak_password.reasons);throw new B_e(dx(r),e.status||500,n)}const fNe=(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 Lr(e,t,r,n){var a;const i=Object.assign({},n==null?void 0:n.headers);i[V6]||(i[V6]=Ute["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 hNe(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 hNe(e,t,r,n,a,i){const o=fNe(t,n,a,i);let l;try{l=await e(r,Object.assign({},o))}catch(c){throw console.error(c),new H6(dx(c),0)}if(l.ok||await sz(l),n!=null&&n.noResolveJson)return l;try{return await l.json()}catch(c){await sz(c)}}function Eu(e){var t;let r=null;xNe(e)&&(r=Object.assign({},e),e.expires_at||(r.expires_at=X_e(e.expires_in)));const n=(t=e.user)!==null&&t!==void 0?t:e;return{data:{session:r,user:n},error:null}}function az(e){const t=Eu(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 pm(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}function mNe(e){return{data:e,error:null}}function pNe(e){const{action_link:t,email_otp:r,hashed_token:n,redirect_to:a,verification_type:i}=e,o=Ep(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 iz(e){return e}function xNe(e){return e.access_token&&e.refresh_token&&e.expires_in}const rT=["global","local","others"];class gNe{constructor({url:t="",headers:r={},fetch:n}){this.url=t,this.headers=r,this.fetch=Wte(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=rT[0]){if(rT.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${rT.join(", ")}`);try{return await Lr(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(n){if(wr(n))return{data:null,error:n};throw n}}async inviteUserByEmail(t,r={}){try{return await Lr(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:pm})}catch(n){if(wr(n))return{data:{user:null},error:n};throw n}}async generateLink(t){try{const{options:r}=t,n=Ep(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 Lr(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:a,headers:this.headers,xform:pNe,redirectTo:r==null?void 0:r.redirectTo})}catch(r){if(wr(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(t){try{return await Lr(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:pm})}catch(r){if(wr(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 Lr(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:iz});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(x=>{const p=parseInt(x.split(";")[0].split("=")[1].substring(0,1)),g=JSON.parse(x.split(";")[1].split("=")[1]);u[`${g}Page`]=p}),u.total=parseInt(m)),{data:Object.assign(Object.assign({},f),u),error:null}}catch(u){if(wr(u))return{data:{users:[]},error:u};throw u}}async getUserById(t){jg(t);try{return await Lr(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:pm})}catch(r){if(wr(r))return{data:{user:null},error:r};throw r}}async updateUserById(t,r){jg(t);try{return await Lr(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:r,headers:this.headers,xform:pm})}catch(n){if(wr(n))return{data:{user:null},error:n};throw n}}async deleteUser(t,r=!1){jg(t);try{return await Lr(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:r},xform:pm})}catch(n){if(wr(n))return{data:{user:null},error:n};throw n}}async _listFactors(t){jg(t.userId);try{const{data:r,error:n}=await Lr(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(wr(r))return{data:null,error:r};throw r}}async _deleteFactor(t){jg(t.userId),jg(t.id);try{return{data:await Lr(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(r){if(wr(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 Lr(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:iz});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(x=>{const p=parseInt(x.split(";")[0].split("=")[1].substring(0,1)),g=JSON.parse(x.split(";")[1].split("=")[1]);u[`${g}Page`]=p}),u.total=parseInt(m)),{data:Object.assign(Object.assign({},f),u),error:null}}catch(u){if(wr(u))return{data:{clients:[]},error:u};throw u}}async _createOAuthClient(t){try{return await Lr(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(wr(r))return{data:null,error:r};throw r}}async _getOAuthClient(t){try{return await Lr(this.fetch,"GET",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(wr(r))return{data:null,error:r};throw r}}async _updateOAuthClient(t,r){try{return await Lr(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${t}`,{body:r,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(wr(n))return{data:null,error:n};throw n}}async _deleteOAuthClient(t){try{return await Lr(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(wr(r))return{data:null,error:r};throw r}}async _regenerateOAuthClientSecret(t){try{return await Lr(this.fetch,"POST",`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(wr(r))return{data:null,error:r};throw r}}}function oz(e={}){return{getItem:t=>e[t]||null,setItem:(t,r)=>{e[t]=r},removeItem:t=>{delete e[t]}}}const _g={debug:!!(globalThis&&Hte()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class Gte extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}class vNe extends Gte{}async function yNe(e,t,r){_g.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);const n=new globalThis.AbortController;return t>0&&setTimeout(()=>{n.abort(),_g.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){_g.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,a.name);try{return await r()}finally{_g.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,a.name)}}else{if(t===0)throw _g.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new vNe(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(_g.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 bNe(){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 Kte(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function wNe(e){return parseInt(e,16)}function jNe(e){const t=new TextEncoder().encode(e);return"0x"+Array.from(t,n=>n.toString(16).padStart(2,"0")).join("")}function _Ne(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=Kte(e.address),x=d?`${d}://${n}`:n,p=e.statement?`${e.statement}
`:"",g=`${x} 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 y=`
Resources:`;for(const b of u){if(!b||typeof b!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${b}`);y+=`
- ${b}`}v+=y}return`${g}
${v}`}class Xa 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 l4 extends Xa{constructor(t,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:t}),this.name="WebAuthnUnknownError",this.originalError=r}}function NNe({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 Xa({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 Xa({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 Xa({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 Xa({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 Xa({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if(e.name==="NotAllowedError")return new Xa({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 Xa({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new Xa({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(Xte(o)){if(i.rp.id!==o)return new Xa({message:`The RP ID "${i.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new Xa({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 Xa({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 Xa({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 Xa({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}function SNe({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 Xa({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if(e.name==="NotAllowedError")return new Xa({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="SecurityError"){const n=window.location.hostname;if(Xte(n)){if(r.rpId!==n)return new Xa({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new Xa({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="UnknownError")return new Xa({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 Xa({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}class kNe{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 CNe=new kNe;function ENe(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=Ep(e,["challenge","user","excludeCredentials"]),i=Av(t).buffer,o=Object.assign(Object.assign({},r),{id:Av(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:Av(u.id).buffer,type:u.type||"public-key",transports:u.transports})}}return l}function ANe(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=Ep(e,["challenge","allowCredentials"]),a=Av(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:Av(l.id).buffer,type:l.type||"public-key",transports:l.transports})}}return i}function TNe(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:Cx(new Uint8Array(e.response.attestationObject)),clientDataJSON:Cx(new Uint8Array(e.response.clientDataJSON))},type:"public-key",clientExtensionResults:e.getClientExtensionResults(),authenticatorAttachment:(t=r.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function PNe(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:Cx(new Uint8Array(a.authenticatorData)),clientDataJSON:Cx(new Uint8Array(a.clientDataJSON)),signature:Cx(new Uint8Array(a.signature)),userHandle:a.userHandle?Cx(new Uint8Array(a.userHandle)):void 0},type:"public-key",clientExtensionResults:n,authenticatorAttachment:(t=r.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function Xte(e){return e==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function lz(){var e,t;return!!(Wi()&&"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 ONe(e){try{const t=await navigator.credentials.create(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new l4("Browser returned unexpected credential type",t)}:{data:null,error:new l4("Empty credential response",t)}}catch(t){return{data:null,error:NNe({error:t,options:e})}}}async function DNe(e){try{const t=await navigator.credentials.get(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new l4("Browser returned unexpected credential type",t)}:{data:null,error:new l4("Empty credential response",t)}}catch(t){return{data:null,error:SNe({error:t,options:e})}}}const INe={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},RNe={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function c4(...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]=c4(l,o):n[i]=c4(o)}else n[i]=o}return n}function LNe(e,t){return c4(INe,e,t||{})}function FNe(e,t){return c4(RNe,e,t||{})}class MNe{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??CNe.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=LNe(o.webauthn.credential_options.publicKey,i==null?void 0:i.create),{data:d,error:f}=await ONe({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=FNe(o.webauthn.credential_options.publicKey,i==null?void 0:i.request),{data:d,error:f}=await DNe(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 wr(o)?{data:null,error:o}:{data:null,error:new bx("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 k2("rpId is required for WebAuthn authentication")};try{if(!lz())return{data:null,error:new bx("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 wr(o)?{data:null,error:o}:{data:null,error:new bx("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 k2("rpId is required for WebAuthn registration")};try{if(!lz())return{data:null,error:new bx("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 wr(o)?{data:null,error:o}:{data:null,error:new bx("Unexpected error in register",o)}}}}bNe();const $Ne={url:R_e,storageKey:L_e,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:F_e,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1};async function cz(e,t,r){return await r()}const Ng={};class C2{get jwks(){var t,r;return(r=(t=Ng[this.storageKey])===null||t===void 0?void 0:t.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(t){Ng[this.storageKey]=Object.assign(Object.assign({},Ng[this.storageKey]),{jwks:t})}get jwks_cached_at(){var t,r;return(r=(t=Ng[this.storageKey])===null||t===void 0?void 0:t.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(t){Ng[this.storageKey]=Object.assign(Object.assign({},Ng[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({},$Ne),t);if(this.storageKey=i.storageKey,this.instanceID=(r=C2.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,C2.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!i.debug,typeof i.debug=="function"&&(this.logger=i.debug),this.instanceID>0&&Wi()){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 gNe({url:i.url,headers:i.headers,fetch:i.fetch}),this.url=i.url,this.headers=i.headers,this.fetch=Wte(i.fetch),this.lock=i.lock||cz,this.detectSessionInUrl=i.detectSessionInUrl,this.flowType=i.flowType,this.hasCustomAuthorizationHeader=i.hasCustomAuthorizationHeader,this.throwOnError=i.throwOnError,i.lock?this.lock=i.lock:Wi()&&(!((n=globalThis==null?void 0:globalThis.navigator)===null||n===void 0)&&n.locks)?this.lock=yNe:this.lock=cz,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 MNe(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:Hte()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=oz(this.memoryStorage)),i.userStorage&&(this.userStorage=i.userStorage)):(this.memoryStorage={},this.storage=oz(this.memoryStorage)),Wi()&&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} (${qte}) ${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(Wi()&&(r=Z_e(window.location.href),this._isImplicitGrantCallback(r)?n="implicit":await this._isPKCECallback(r)&&(n="pkce")),Wi()&&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),U_e(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 wr(r)?this._returnResult({error:r}):this._returnResult({error:new bx("Unexpected error during initialization",r)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var r,n,a;try{const i=await Lr(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:Eu}),{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(wr(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,x=null;this.flowType==="pkce"&&([h,x]=await wg(this.storage,this.storageKey)),i=await Lr(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:x},xform:Eu})}else if("phone"in t){const{phone:d,password:f,options:m}=t;i=await Lr(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:Eu})}else throw new KN("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(wr(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 Lr(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:az})}else if("phone"in t){const{phone:i,password:o,options:l}=t;r=await Lr(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:az})}else throw new KN("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 bg;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(wr(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,x;if("message"in t)h=t.message,x=t.signature;else{const{chain:p,wallet:g,statement:v,options:y}=t;let b;if(Wi())if(typeof g=="object")b=g;else{const T=window;if("ethereum"in T&&typeof T.ethereum=="object"&&"request"in T.ethereum&&typeof T.ethereum.request=="function")b=T.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 g!="object"||!(y!=null&&y.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");b=g}const N=new URL((r=y==null?void 0:y.url)!==null&&r!==void 0?r:window.location.href),j=await b.request({method:"eth_requestAccounts"}).then(T=>T).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!j||j.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const _=Kte(j[0]);let S=(n=y==null?void 0:y.signInWithEthereum)===null||n===void 0?void 0:n.chainId;if(!S){const T=await b.request({method:"eth_chainId"});S=wNe(T)}const P={domain:N.host,address:_,statement:v,uri:N.href,version:"1",chainId:S,nonce:(a=y==null?void 0:y.signInWithEthereum)===null||a===void 0?void 0:a.nonce,issuedAt:(o=(i=y==null?void 0:y.signInWithEthereum)===null||i===void 0?void 0:i.issuedAt)!==null&&o!==void 0?o:new Date,expirationTime:(l=y==null?void 0:y.signInWithEthereum)===null||l===void 0?void 0:l.expirationTime,notBefore:(c=y==null?void 0:y.signInWithEthereum)===null||c===void 0?void 0:c.notBefore,requestId:(u=y==null?void 0:y.signInWithEthereum)===null||u===void 0?void 0:u.requestId,resources:(d=y==null?void 0:y.signInWithEthereum)===null||d===void 0?void 0:d.resources};h=_Ne(P),x=await b.request({method:"personal_sign",params:[jNe(h),_]})}try{const{data:p,error:g}=await Lr(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:h,signature:x},!((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:Eu});if(g)throw g;if(!p||!p.session||!p.user){const v=new bg;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:g})}catch(p){if(wr(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 x,p;if("message"in t)x=t.message,p=t.signature;else{const{chain:g,wallet:v,statement:y,options:b}=t;let N;if(Wi())if(typeof v=="object")N=v;else{const _=window;if("solana"in _&&typeof _.solana=="object"&&("signIn"in _.solana&&typeof _.solana.signIn=="function"||"signMessage"in _.solana&&typeof _.solana.signMessage=="function"))N=_.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"||!(b!=null&&b.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");N=v}const j=new URL((r=b==null?void 0:b.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in N&&N.signIn){const _=await N.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},b==null?void 0:b.signInWithSolana),{version:"1",domain:j.host,uri:j.href}),y?{statement:y}:null));let S;if(Array.isArray(_)&&_[0]&&typeof _[0]=="object")S=_[0];else if(_&&typeof _=="object"&&"signedMessage"in _&&"signature"in _)S=_;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)x=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");x=[`${j.host} wants you to sign in with your Solana account:`,N.publicKey.toBase58(),...y?["",y,""]:[""],"Version: 1",`URI: ${j.href}`,`Issued At: ${(a=(n=b==null?void 0:b.signInWithSolana)===null||n===void 0?void 0:n.issuedAt)!==null&&a!==void 0?a:new Date().toISOString()}`,...!((i=b==null?void 0:b.signInWithSolana)===null||i===void 0)&&i.notBefore?[`Not Before: ${b.signInWithSolana.notBefore}`]:[],...!((o=b==null?void 0:b.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${b.signInWithSolana.expirationTime}`]:[],...!((l=b==null?void 0:b.signInWithSolana)===null||l===void 0)&&l.chainId?[`Chain ID: ${b.signInWithSolana.chainId}`]:[],...!((c=b==null?void 0:b.signInWithSolana)===null||c===void 0)&&c.nonce?[`Nonce: ${b.signInWithSolana.nonce}`]:[],...!((u=b==null?void 0:b.signInWithSolana)===null||u===void 0)&&u.requestId?[`Request ID: ${b.signInWithSolana.requestId}`]:[],...!((f=(d=b==null?void 0:b.signInWithSolana)===null||d===void 0?void 0:d.resources)===null||f===void 0)&&f.length?["Resources",...b.signInWithSolana.resources.map(S=>`- ${S}`)]:[]].join(`
`);const _=await N.signMessage(new TextEncoder().encode(x),"utf8");if(!_||!(_ instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");p=_}}try{const{data:g,error:v}=await Lr(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:x,signature:Cx(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:Eu});if(v)throw v;if(!g||!g.session||!g.user){const y=new bg;return this._returnResult({data:{user:null,session:null},error:y})}return g.session&&(await this._saveSession(g.session),await this._notifyAllSubscribers("SIGNED_IN",g.session)),this._returnResult({data:Object.assign({},g),error:v})}catch(g){if(wr(g))return this._returnResult({data:{user:null,session:null},error:g});throw g}}async _exchangeCodeForSession(t){const r=await sx(this.storage,`${this.storageKey}-code-verifier`),[n,a]=(r??"").split("/");try{const{data:i,error:o}=await Lr(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:n},xform:Eu});if(await Qh(this.storage,`${this.storageKey}-code-verifier`),o)throw o;if(!i||!i.session||!i.user){const l=new bg;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(wr(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 Lr(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:Eu}),{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 bg;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(wr(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 wg(this.storage,this.storageKey));const{error:f}=await Lr(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 Lr(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 KN("You must provide either an email or phone number.")}catch(l){if(wr(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 Lr(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:i}}),redirectTo:a,xform:Eu});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(wr(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 wg(this.storage,this.storageKey));const u=await Lr(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:mNe});return!((i=u.data)===null||i===void 0)&&i.url&&Wi()&&!(!((o=t.options)===null||o===void 0)&&o.skipBrowserRedirect)&&window.location.assign(u.data.url),this._returnResult(u)}catch(l){if(wr(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 Cu;const{error:a}=await Lr(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(wr(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 Lr(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 Lr(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 KN("You must provide either an email or phone number and a type")}catch(r){if(wr(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 sx(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()<J3:!1;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",t.expires_at),!n){if(this.userStorage){const o=await sx(this.userStorage,this.storageKey+"-user");o!=null&&o.user?t.user=o.user:t.user=tT()}if(this.storage.isServer&&t.user&&!t.user.__isUserNotAvailableProxy){const o={value:this.suppressGetSessionWarning};t.user=uNe(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 Lr(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:pm}):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 Cu}:await Lr(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:pm})})}catch(r){if(wr(r))return q_e(r)&&(await this._removeSession(),await Qh(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 Cu;const o=a.session;let l=null,c=null;this.flowType==="pkce"&&t.email!=null&&([l,c]=await wg(this.storage,this.storageKey));const{data:u,error:d}=await Lr(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:pm});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(wr(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 Cu;const r=Date.now()/1e3;let n=r,a=!0,i=null;const{payload:o}=eT(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(wr(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 Cu;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(wr(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async _getSessionFromURL(t,r){try{if(!Wi())throw new XN("No browser detected.");if(t.error||t.error_description||t.error_code)throw new XN(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 J9("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new XN("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 J9("No code detected.");const{data:y,error:b}=await this._exchangeCodeForSession(t.code);if(b)throw b;const N=new URL(window.location.href);return N.searchParams.delete("code"),window.history.replaceState(window.history.state,"",N.toString()),{data:{session:y.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 XN("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<=Vg&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${h}s, should have been closer to ${f}s`);const x=m-f;d-x>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",x,m,d):d-x<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",x,m,d);const{data:p,error:g}=await this._getUser(i);if(g)throw g;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(wr(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 sx(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&&!(z_e(l)&&(l.status===404||l.status===401||l.status===403)))return this._returnResult({error:l})}return t!=="others"&&(await this._removeSession(),await Qh(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(t){const r=Y_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 wg(this.storage,this.storageKey,!0));try{return await Lr(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(wr(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(wr(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 Lr(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 Wi()&&!(!((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(wr(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 Lr(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:Eu}),{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 bg}):(m.session&&(await this._saveSession(m.session),await this._notifyAllSubscribers("USER_UPDATED",m.session)),this._returnResult({data:m,error:h}))}catch(a){if(wr(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 Lr(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(wr(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 eNe(async a=>(a>0&&await Q_e(200*Math.pow(2,a-1)),this._debug(r,"refreshing attempt",a),await Lr(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:Eu})),(a,i)=>{const o=200*Math.pow(2,a);return i&&Q3(i)&&Date.now()+o-n<Vg})}catch(n){if(this._debug(r,"error",n),wr(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),Wi()&&!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 sx(this.storage,this.storageKey);if(a&&this.userStorage){let o=await sx(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:a.user},await Hg(this.userStorage,this.storageKey+"-user",o)),a.user=(t=o==null?void 0:o.user)!==null&&t!==void 0?t:tT()}else if(a&&!a.user&&!a.user){const o=await sx(this.storage,this.storageKey+"-user");o&&(o!=null&&o.user)?(a.user=o.user,await Qh(this.storage,this.storageKey+"-user"),await Hg(this.storage,this.storageKey,a)):a.user=tT()}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()<J3;if(this._debug(n,`session has${i?"":" not"} expired with margin of ${J3}s`),i){if(this.autoRefreshToken&&a.refresh_token){const{error:o}=await this._callRefreshToken(a.refresh_token);o&&(console.error(o),Q3(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 Cu;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const a=`#_callRefreshToken(${t.substring(0,5)}...)`;this._debug(a,"begin");try{this.refreshingDeferred=new IC;const{data:i,error:o}=await this._refreshAccessToken(t);if(o)throw o;if(!i.session)throw new Cu;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),wr(i)){const o={data:null,error:i};return Q3(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 Hg(this.userStorage,this.storageKey+"-user",{user:r.user});const a=Object.assign({},r);delete a.user;const i=nz(a);await Hg(this.storage,this.storageKey,i)}else{const a=nz(r);await Hg(this.storage,this.storageKey,a)}}async _removeSession(){this._debug("#_removeSession()"),await Qh(this.storage,this.storageKey),await Qh(this.storage,this.storageKey+"-code-verifier"),await Qh(this.storage,this.storageKey+"-user"),this.userStorage&&await Qh(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const t=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{t&&Wi()&&(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(),Vg);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)/Vg);this._debug("#_autoRefreshTokenTick()",`access token expires in ${a} ticks, a tick lasts ${Vg}ms, refresh threshold is ${U6} ticks`),a<=U6&&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 Gte)this._debug("auto refresh token tick lock not available");else throw t}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Wi()||!(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 wg(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 Lr(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(wr(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 Lr(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(wr(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"?TNe(t.webauthn.credential_response):PNe(t.webauthn.credential_response)})}:{code:t.code}),{data:l,error:c}=await Lr(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(wr(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 Lr(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:ENe(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:ANe(l.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(r){if(wr(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}=eT(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 Lr(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 Cu})})}catch(r){if(wr(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 Cu});const o=await Lr(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&&Wi()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(n){if(wr(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 Cu});const o=await Lr(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&&Wi()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(n){if(wr(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+$_e>a)return n;const{data:i,error:o}=await Lr(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:x}=await this.getSession();if(x||!h.session)return this._returnResult({data:null,error:x});n=h.session.access_token}const{header:a,payload:i,signature:o,raw:{header:l,payload:c}}=eT(n);r!=null&&r.allowExpired||oNe(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=lNe(a.alg),f=await crypto.subtle.importKey("jwk",u,d,!0,["verify"]);if(!await crypto.subtle.verify(d,f,o,K_e(`${l}.${c}`)))throw new W6("Invalid JWT signature");return{data:{claims:i,header:a,signature:o},error:null}}catch(n){if(wr(n))return this._returnResult({data:null,error:n});throw n}}}C2.nextInstanceID={};const BNe=C2;class zNe extends BNe{constructor(t){super(t)}}class qNe{constructor(t,r,n){var a,i,o;this.supabaseUrl=t,this.supabaseKey=r;const l=I_e(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:k_e,realtime:E_e,auth:Object.assign(Object.assign({},C_e),{storageKey:c}),global:S_e},d=D_e(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=P_e(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 Rje(new URL("rest/v1",l).href,{headers:this.headers,schema:d.db.schema,fetch:this.fetch}),this.storage=new j_e(this.storageUrl.href,this.headers,this.fetch,n==null?void 0:n.storage),d.accessToken||this._listenForAuthEvents()}get functions(){return new Oje(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 zNe({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(x=>x.toLowerCase()==="authorization")})}_initRealtimeClient(t){return new Jje(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 UNe=(e,t,r)=>new qNe(e,t,r);function VNe(){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}VNe()&&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 HNe="https://pedagobridge.com",WNe="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiIsImlzcyI6InN1cGFiYXNlIiwiaWF0IjoxNzc2MjQzNzQyLCJleHAiOjIwOTE2MDM3NDJ9.73Zk3EieShL_u8EKlAW2LekPnT1agaI3de2bE8hkWq4",ce=UNe(HNe,WNe,{auth:{storage:localStorage,persistSession:!0,autoRefreshToken:!0}}),GNe=5*6e4,KNe=5,XNe=40;class YNe{constructor(){Cn(this,"sessionId");Cn(this,"floodWindowStart",0);Cn(this,"floodTotal",0);Cn(this,"floodSuppressed",0);Cn(this,"floodPerKey",new Map);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"}isFlooding(t,r){if(t==="info")return!1;const n=Date.now();n-this.floodWindowStart>GNe&&(this.floodWindowStart=n,this.floodTotal=0,this.floodPerKey.clear());const a=`${t}|${r.replace(/\d+/g,"#").slice(0,160)}`,i=(this.floodPerKey.get(a)??0)+1;return this.floodPerKey.set(a,i),this.floodTotal+=1,i>KNe||this.floodTotal>XNe?(this.floodSuppressed+=1,!0):!1}async getCurrentUser(){try{const{data:{user:t}}=await ce.auth.getUser();return t}catch{return null}}async log(t){try{if(this.isFlooding(t.level,t.message))return;const r=await this.getCurrentUser(),a={...(t.context?JSON.parse(JSON.stringify(t.context)):null)||{},sessionId:this.sessionId};this.floodSuppressed>0&&(a.suppressedLogs=this.floodSuppressed,this.floodSuppressed=0);const{error:i}=await ce.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 Oi=new YNe;let nT=!1;if(typeof window<"u"){const e=console.error.bind(console);console.error=(...t)=>{if(e(...t),nT)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]"))){nT=!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);Oi.error(n||"console.error",a,{action:"console_error"})}finally{nT=!1}}}}const Yte=w.createContext(void 0);function ZNe({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:g}}=ce.auth.onAuthStateChange((v,y)=>{var b,N,j;p&&(v==="SIGNED_IN"?Oi.auth("login",!0,{email:(b=y==null?void 0:y.user)==null?void 0:b.email}):v==="SIGNED_OUT"?Oi.auth("logout",!0):v==="USER_UPDATED"?Oi.info("User updated",{action:"user_updated",metadata:{userId:(N=y==null?void 0:y.user)==null?void 0:N.id}}):v==="PASSWORD_RECOVERY"&&Oi.auth("password_reset",!0,{email:(j=y==null?void 0:y.user)==null?void 0:j.email}),a(y),r((y==null?void 0:y.user)??null),y!=null&&y.user?setTimeout(()=>{p&&h(y.user.id)},0):(o(!1),c(!1),d(!1),m(!1)))});return ce.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,g.unsubscribe()}},[]);const h=async p=>{try{const{data:g,error:v}=await ce.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(g){const y=g.map(b=>b.role);o(y.includes("admin")),c(y.includes("trainer")),d(y.includes("school"))}}catch(g){console.error("Error checking roles:",g),o(!1),c(!1),d(!1)}finally{m(!1)}},x=async()=>{Oi.auth("logout",!0,{userId:t==null?void 0:t.id}),await ce.auth.signOut(),r(null),a(null),o(!1),c(!1),d(!1)};return s.jsx(Yte.Provider,{value:{user:t,session:n,isAdmin:i,isTrainer:l,isSchool:u,loading:f,signOut:x},children:e})}function Br(){const e=w.useContext(Yte);if(e===void 0)throw new Error("useAuth must be used within an AuthProvider");return e}function vn({children:e,requireAdmin:t,requireTrainer:r}){const{user:n,isAdmin:a,isTrainer:i,loading:o}=Br(),l=Zt();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(it,{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 uz="/assets/logo-DpJyQIgQ.jpg",E2=r1("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?tQ:"button";return s.jsx(o,{className:yt(E2({variant:t,size:r,className:e})),ref:i,...a})});ne.displayName="Button";var sT="focusScope.autoFocusOnMount",aT="focusScope.autoFocusOnUnmount",dz={bubbles:!1,cancelable:!0},JNe="FocusScope",e_=w.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:a,onUnmountAutoFocus:i,...o}=e,[l,c]=w.useState(null),u=ya(a),d=ya(i),f=w.useRef(null),m=Pr(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(b){if(h.paused||!l)return;const N=b.target;l.contains(N)?f.current=N:lm(f.current,{select:!0})},g=function(b){if(h.paused||!l)return;const N=b.relatedTarget;N!==null&&(l.contains(N)||lm(f.current,{select:!0}))},v=function(b){if(document.activeElement===document.body)for(const j of b)j.removedNodes.length>0&&lm(l)};document.addEventListener("focusin",p),document.addEventListener("focusout",g);const y=new MutationObserver(v);return l&&y.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",g),y.disconnect()}}},[n,l,h.paused]),w.useEffect(()=>{if(l){hz.add(h);const p=document.activeElement;if(!l.contains(p)){const v=new CustomEvent(sT,dz);l.addEventListener(sT,u),l.dispatchEvent(v),v.defaultPrevented||(QNe(sSe(Zte(l)),{select:!0}),document.activeElement===p&&lm(l))}return()=>{l.removeEventListener(sT,u),setTimeout(()=>{const v=new CustomEvent(aT,dz);l.addEventListener(aT,d),l.dispatchEvent(v),v.defaultPrevented||lm(p??document.body,{select:!0}),l.removeEventListener(aT,d),hz.remove(h)},0)}}},[l,u,d,h]);const x=w.useCallback(p=>{if(!r&&!n||h.paused)return;const g=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,v=document.activeElement;if(g&&v){const y=p.currentTarget,[b,N]=eSe(y);b&&N?!p.shiftKey&&v===N?(p.preventDefault(),r&&lm(b,{select:!0})):p.shiftKey&&v===b&&(p.preventDefault(),r&&lm(N,{select:!0})):v===y&&p.preventDefault()}},[r,n,h.paused]);return s.jsx(Vt.div,{tabIndex:-1,...o,ref:m,onKeyDown:x})});e_.displayName=JNe;function QNe(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(lm(n,{select:t}),document.activeElement!==r)return}function eSe(e){const t=Zte(e),r=fz(t,e),n=fz(t.reverse(),e);return[r,n]}function Zte(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 fz(e,t){for(const r of e)if(!tSe(r,{upTo:t}))return r}function tSe(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 rSe(e){return e instanceof HTMLInputElement&&"select"in e}function lm(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&rSe(e)&&t&&e.select()}}var hz=nSe();function nSe(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=mz(e,t),e.unshift(t)},remove(t){var r;e=mz(e,t),(r=e[0])==null||r.resume()}}}function mz(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function sSe(e){return e.filter(t=>t.tagName!=="A")}var iT=0;function RC(){w.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??pz()),document.body.insertAdjacentElement("beforeend",e[1]??pz()),iT++,()=>{iT===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),iT--}},[])}function pz(){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 h5="right-scroll-bar-position",m5="width-before-scroll-bar",aSe="with-scroll-bars-hidden",iSe="--removed-body-scroll-bar-size";function oT(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function oSe(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 lSe=typeof window<"u"?w.useLayoutEffect:w.useEffect,xz=new WeakMap;function cSe(e,t){var r=oSe(null,function(n){return e.forEach(function(a){return oT(a,n)})});return lSe(function(){var n=xz.get(r);if(n){var a=new Set(n),i=new Set(e),o=r.current;a.forEach(function(l){i.has(l)||oT(l,null)}),i.forEach(function(l){a.has(l)||oT(l,o)})}xz.set(r,e)},[e]),r}function uSe(e){return e}function dSe(e,t){t===void 0&&(t=uSe);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 fSe(e){e===void 0&&(e={});var t=dSe(null);return t.options=$c({async:!0,ssr:!1},e),t}var Jte=function(e){var t=e.sideCar,r=Ep(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,$c({},r))};Jte.isSideCarExport=!0;function hSe(e,t){return e.useMedium(t),Jte}var Qte=fSe(),lT=function(){},LC=w.forwardRef(function(e,t){var r=w.useRef(null),n=w.useState({onScrollCapture:lT,onWheelCapture:lT,onTouchMoveCapture:lT}),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,x=e.noIsolation,p=e.inert,g=e.allowPinchZoom,v=e.as,y=v===void 0?"div":v,b=e.gapMode,N=Ep(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),j=m,_=cSe([r,t]),S=$c($c({},N),a);return w.createElement(w.Fragment,null,d&&w.createElement(j,{sideCar:Qte,removeScrollBar:u,shards:f,noRelative:h,noIsolation:x,inert:p,setCallbacks:i,allowPinchZoom:!!g,lockRef:r,gapMode:b}),o?w.cloneElement(w.Children.only(l),$c($c({},S),{ref:_})):w.createElement(y,$c({},S,{className:c,ref:_}),l))});LC.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};LC.classNames={fullWidth:m5,zeroRight:h5};var mSe=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function pSe(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=mSe();return t&&e.setAttribute("nonce",t),e}function xSe(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function gSe(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var vSe=function(){var e=0,t=null;return{add:function(r){e==0&&(t=pSe())&&(xSe(t,r),gSe(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},ySe=function(){var e=vSe();return function(t,r){w.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},ere=function(){var e=ySe(),t=function(r){var n=r.styles,a=r.dynamic;return e(n,a),null};return t},bSe={left:0,top:0,right:0,gap:0},cT=function(e){return parseInt(e||"",10)||0},wSe=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[cT(r),cT(n),cT(a)]},jSe=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return bSe;var t=wSe(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])}},_Se=ere(),Tv="data-scroll-locked",NSe=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(aSe,` {
overflow: hidden `).concat(n,`;
padding-right: `).concat(l,"px ").concat(n,`;
}
body[`).concat(Tv,`] {
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(h5,` {
right: `).concat(l,"px ").concat(n,`;
}
.`).concat(m5,` {
margin-right: `).concat(l,"px ").concat(n,`;
}
.`).concat(h5," .").concat(h5,` {
right: 0 `).concat(n,`;
}
.`).concat(m5," .").concat(m5,` {
margin-right: 0 `).concat(n,`;
}
body[`).concat(Tv,`] {
`).concat(iSe,": ").concat(l,`px;
}
`)},gz=function(){var e=parseInt(document.body.getAttribute(Tv)||"0",10);return isFinite(e)?e:0},SSe=function(){w.useEffect(function(){return document.body.setAttribute(Tv,(gz()+1).toString()),function(){var e=gz()-1;e<=0?document.body.removeAttribute(Tv):document.body.setAttribute(Tv,e.toString())}},[])},kSe=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,a=n===void 0?"margin":n;SSe();var i=w.useMemo(function(){return jSe(a)},[a]);return w.createElement(_Se,{styles:NSe(i,!t,a,r?"":"!important")})},G6=!1;if(typeof window<"u")try{var YN=Object.defineProperty({},"passive",{get:function(){return G6=!0,!0}});window.addEventListener("test",YN,YN),window.removeEventListener("test",YN,YN)}catch{G6=!1}var Sg=G6?{passive:!1}:!1,CSe=function(e){return e.tagName==="TEXTAREA"},tre=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!CSe(e)&&r[t]==="visible")},ESe=function(e){return tre(e,"overflowY")},ASe=function(e){return tre(e,"overflowX")},vz=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var a=rre(e,n);if(a){var i=nre(e,n),o=i[1],l=i[2];if(o>l)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},TSe=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},PSe=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},rre=function(e,t){return e==="v"?ESe(t):ASe(t)},nre=function(e,t){return e==="v"?TSe(t):PSe(t)},OSe=function(e,t){return e==="h"&&t==="rtl"?-1:1},DSe=function(e,t,r,n,a){var i=OSe(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=nre(e,l),x=h[0],p=h[1],g=h[2],v=p-g-i*x;(x||v)&&rre(e,l)&&(f+=v,m+=x);var y=l.parentNode;l=y&&y.nodeType===Node.DOCUMENT_FRAGMENT_NODE?y.host:y}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(d&&Math.abs(f)<1||!d&&Math.abs(m)<1)&&(u=!0),u},ZN=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},yz=function(e){return[e.deltaX,e.deltaY]},bz=function(e){return e&&"current"in e?e.current:e},ISe=function(e,t){return e[0]===t[0]&&e[1]===t[1]},RSe=function(e){return`
.block-interactivity-`.concat(e,` {pointer-events: none;}
.allow-interactivity-`).concat(e,` {pointer-events: all;}
`)},LSe=0,kg=[];function FSe(e){var t=w.useRef([]),r=w.useRef([0,0]),n=w.useRef(),a=w.useState(LSe++)[0],i=w.useState(ere)[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=lL([e.lockRef.current],(e.shards||[]).map(bz),!0).filter(Boolean);return p.forEach(function(g){return g.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),p.forEach(function(g){return g.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var l=w.useCallback(function(p,g){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!o.current.allowPinchZoom;var v=ZN(p),y=r.current,b="deltaX"in p?p.deltaX:y[0]-v[0],N="deltaY"in p?p.deltaY:y[1]-v[1],j,_=p.target,S=Math.abs(b)>Math.abs(N)?"h":"v";if("touches"in p&&S==="h"&&_.type==="range")return!1;var P=vz(S,_);if(!P)return!0;if(P?j=S:(j=S==="v"?"h":"v",P=vz(S,_)),!P)return!1;if(!n.current&&"changedTouches"in p&&(b||N)&&(n.current=j),!j)return!0;var T=n.current||j;return DSe(T,g,p,T==="h"?b:N)},[]),c=w.useCallback(function(p){var g=p;if(!(!kg.length||kg[kg.length-1]!==i)){var v="deltaY"in g?yz(g):ZN(g),y=t.current.filter(function(j){return j.name===g.type&&(j.target===g.target||g.target===j.shadowParent)&&ISe(j.delta,v)})[0];if(y&&y.should){g.cancelable&&g.preventDefault();return}if(!y){var b=(o.current.shards||[]).map(bz).filter(Boolean).filter(function(j){return j.contains(g.target)}),N=b.length>0?l(g,b[0]):!o.current.noIsolation;N&&g.cancelable&&g.preventDefault()}}},[]),u=w.useCallback(function(p,g,v,y){var b={name:p,delta:g,target:v,should:y,shadowParent:MSe(v)};t.current.push(b),setTimeout(function(){t.current=t.current.filter(function(N){return N!==b})},1)},[]),d=w.useCallback(function(p){r.current=ZN(p),n.current=void 0},[]),f=w.useCallback(function(p){u(p.type,yz(p),p.target,l(p,e.lockRef.current))},[]),m=w.useCallback(function(p){u(p.type,ZN(p),p.target,l(p,e.lockRef.current))},[]);w.useEffect(function(){return kg.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:m}),document.addEventListener("wheel",c,Sg),document.addEventListener("touchmove",c,Sg),document.addEventListener("touchstart",d,Sg),function(){kg=kg.filter(function(p){return p!==i}),document.removeEventListener("wheel",c,Sg),document.removeEventListener("touchmove",c,Sg),document.removeEventListener("touchstart",d,Sg)}},[]);var h=e.removeScrollBar,x=e.inert;return w.createElement(w.Fragment,null,x?w.createElement(i,{styles:RSe(a)}):null,h?w.createElement(kSe,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function MSe(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const $Se=hSe(Qte,FSe);var t_=w.forwardRef(function(e,t){return w.createElement(LC,$c({},e,{ref:t,sideCar:$Se}))});t_.classNames=LC.classNames;var BSe=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Cg=new WeakMap,JN=new WeakMap,QN={},uT=0,sre=function(e){return e&&(e.host||sre(e.parentNode))},zSe=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=sre(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})},qSe=function(e,t,r,n){var a=zSe(t,Array.isArray(e)?e:[e]);QN[r]||(QN[r]=new WeakMap);var i=QN[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),x=h!==null&&h!=="false",p=(Cg.get(m)||0)+1,g=(i.get(m)||0)+1;Cg.set(m,p),i.set(m,g),o.push(m),p===1&&x&&JN.set(m,!0),g===1&&m.setAttribute(r,"true"),x||m.setAttribute(n,"true")}catch(v){console.error("aria-hidden: cannot operate on ",m,v)}})};return d(t),l.clear(),uT++,function(){o.forEach(function(f){var m=Cg.get(f)-1,h=i.get(f)-1;Cg.set(f,m),i.set(f,h),m||(JN.has(f)||f.removeAttribute(n),JN.delete(f)),h||f.removeAttribute(r)}),uT--,uT||(Cg=new WeakMap,Cg=new WeakMap,JN=new WeakMap,QN={})}},FC=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),a=BSe(e);return a?(n.push.apply(n,Array.from(a.querySelectorAll("[aria-live]"))),qSe(n,a,r,"aria-hidden")):function(){return null}},MC="Dialog",[are,ire]=ei(MC),[USe,dd]=are(MC),ore=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]=Zo({prop:n,defaultProp:a??!1,onChange:i,caller:MC});return s.jsx(USe,{scope:t,triggerRef:l,contentRef:c,contentId:Za(),titleId:Za(),descriptionId:Za(),open:u,onOpenChange:d,onOpenToggle:w.useCallback(()=>d(f=>!f),[d]),modal:o,children:r})};ore.displayName=MC;var lre="DialogTrigger",cre=w.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=dd(lre,r),i=Pr(t,a.triggerRef);return s.jsx(Vt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":yL(a.open),...n,ref:i,onClick:Tt(e.onClick,a.onOpenToggle)})});cre.displayName=lre;var gL="DialogPortal",[VSe,ure]=are(gL,{forceMount:void 0}),dre=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:a}=e,i=dd(gL,t);return s.jsx(VSe,{scope:t,forceMount:r,children:w.Children.map(n,o=>s.jsx(ti,{present:r||i.open,children:s.jsx(t1,{asChild:!0,container:a,children:o})}))})};dre.displayName=gL;var u4="DialogOverlay",fre=w.forwardRef((e,t)=>{const r=ure(u4,e.__scopeDialog),{forceMount:n=r.forceMount,...a}=e,i=dd(u4,e.__scopeDialog);return i.modal?s.jsx(ti,{present:n||i.open,children:s.jsx(WSe,{...a,ref:t})}):null});fre.displayName=u4;var HSe=np("DialogOverlay.RemoveScroll"),WSe=w.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=dd(u4,r);return s.jsx(t_,{as:HSe,allowPinchZoom:!0,shards:[a.contentRef],children:s.jsx(Vt.div,{"data-state":yL(a.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),m0="DialogContent",hre=w.forwardRef((e,t)=>{const r=ure(m0,e.__scopeDialog),{forceMount:n=r.forceMount,...a}=e,i=dd(m0,e.__scopeDialog);return s.jsx(ti,{present:n||i.open,children:i.modal?s.jsx(GSe,{...a,ref:t}):s.jsx(KSe,{...a,ref:t})})});hre.displayName=m0;var GSe=w.forwardRef((e,t)=>{const r=dd(m0,e.__scopeDialog),n=w.useRef(null),a=Pr(t,r.contentRef,n);return w.useEffect(()=>{const i=n.current;if(i)return FC(i)},[]),s.jsx(mre,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Tt(e.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=r.triggerRef.current)==null||o.focus()}),onPointerDownOutside:Tt(e.onPointerDownOutside,i=>{const o=i.detail.originalEvent,l=o.button===0&&o.ctrlKey===!0;(o.button===2||l)&&i.preventDefault()}),onFocusOutside:Tt(e.onFocusOutside,i=>i.preventDefault())})}),KSe=w.forwardRef((e,t)=>{const r=dd(m0,e.__scopeDialog),n=w.useRef(!1),a=w.useRef(!1);return s.jsx(mre,{...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()}})}),mre=w.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:a,onCloseAutoFocus:i,...o}=e,l=dd(m0,r),c=w.useRef(null),u=Pr(t,c);return RC(),s.jsxs(s.Fragment,{children:[s.jsx(e_,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:a,onUnmountAutoFocus:i,children:s.jsx(B0,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":yL(l.open),...o,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),s.jsxs(s.Fragment,{children:[s.jsx(YSe,{titleId:l.titleId}),s.jsx(JSe,{contentRef:c,descriptionId:l.descriptionId})]})]})}),vL="DialogTitle",pre=w.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=dd(vL,r);return s.jsx(Vt.h2,{id:a.titleId,...n,ref:t})});pre.displayName=vL;var xre="DialogDescription",gre=w.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=dd(xre,r);return s.jsx(Vt.p,{id:a.descriptionId,...n,ref:t})});gre.displayName=xre;var vre="DialogClose",yre=w.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=dd(vre,r);return s.jsx(Vt.button,{type:"button",...n,ref:t,onClick:Tt(e.onClick,()=>a.onOpenChange(!1))})});yre.displayName=vre;function yL(e){return e?"open":"closed"}var bre="DialogTitleWarning",[XSe,wre]=pve(bre,{contentName:m0,titleName:vL,docsSlug:"dialog"}),YSe=({titleId:e})=>{const t=wre(bre),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},ZSe="DialogDescriptionWarning",JSe=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${wre(ZSe).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},$C=ore,bL=cre,BC=dre,p1=fre,x1=hre,r_=pre,n_=gre,zC=yre;const wL=$C,jL=bL,QSe=BC,jre=w.forwardRef(({className:e,...t},r)=>s.jsx(p1,{className:yt("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}));jre.displayName=p1.displayName;const e5e=r1("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"}}),qC=w.forwardRef(({side:e="right",className:t,children:r,...n},a)=>s.jsxs(QSe,{children:[s.jsx(jre,{}),s.jsxs(x1,{ref:a,className:yt(e5e({side:e}),t),...n,children:[r,s.jsxs(zC,{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($i,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));qC.displayName=x1.displayName;const UC=({className:e,...t})=>s.jsx("div",{className:yt("flex flex-col space-y-2 text-center sm:text-left",e),...t});UC.displayName="SheetHeader";const VC=w.forwardRef(({className:e,...t},r)=>s.jsx(r_,{ref:r,className:yt("text-lg font-semibold text-foreground",e),...t}));VC.displayName=r_.displayName;const _re=w.forwardRef(({className:e,...t},r)=>s.jsx(n_,{ref:r,className:yt("text-sm text-muted-foreground",e),...t}));_re.displayName=n_.displayName;var t5e=w.createContext(void 0);function q0(e){const t=w.useContext(t5e);return e||t||"ltr"}var dT="rovingFocusGroup.onEntryFocus",r5e={bubbles:!1,cancelable:!0},s_="RovingFocusGroup",[K6,Nre,n5e]=Gj(s_),[s5e,g1]=ei(s_,[n5e]),[a5e,i5e]=s5e(s_),Sre=w.forwardRef((e,t)=>s.jsx(K6.Provider,{scope:e.__scopeRovingFocusGroup,children:s.jsx(K6.Slot,{scope:e.__scopeRovingFocusGroup,children:s.jsx(o5e,{...e,ref:t})})}));Sre.displayName=s_;var o5e=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=Pr(t,m),x=q0(i),[p,g]=Zo({prop:o,defaultProp:l??null,onChange:c,caller:s_}),[v,y]=w.useState(!1),b=ya(u),N=Nre(r),j=w.useRef(!1),[_,S]=w.useState(0);return w.useEffect(()=>{const P=m.current;if(P)return P.addEventListener(dT,b),()=>P.removeEventListener(dT,b)},[b]),s.jsx(a5e,{scope:r,orientation:n,dir:x,loop:a,currentTabStopId:p,onItemFocus:w.useCallback(P=>g(P),[g]),onItemShiftTab:w.useCallback(()=>y(!0),[]),onFocusableItemAdd:w.useCallback(()=>S(P=>P+1),[]),onFocusableItemRemove:w.useCallback(()=>S(P=>P-1),[]),children:s.jsx(Vt.div,{tabIndex:v||_===0?-1:0,"data-orientation":n,...f,ref:h,style:{outline:"none",...e.style},onMouseDown:Tt(e.onMouseDown,()=>{j.current=!0}),onFocus:Tt(e.onFocus,P=>{const T=!j.current;if(P.target===P.currentTarget&&T&&!v){const R=new CustomEvent(dT,r5e);if(P.currentTarget.dispatchEvent(R),!R.defaultPrevented){const k=N().filter(H=>H.focusable),E=k.find(H=>H.active),q=k.find(H=>H.id===p),L=[E,q,...k].filter(Boolean).map(H=>H.ref.current);Ere(L,d)}}j.current=!1}),onBlur:Tt(e.onBlur,()=>y(!1))})})}),kre="RovingFocusGroupItem",Cre=w.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:a=!1,tabStopId:i,children:o,...l}=e,c=Za(),u=i||c,d=i5e(kre,r),f=d.currentTabStopId===u,m=Nre(r),{onFocusableItemAdd:h,onFocusableItemRemove:x,currentTabStopId:p}=d;return w.useEffect(()=>{if(n)return h(),()=>x()},[n,h,x]),s.jsx(K6.ItemSlot,{scope:r,id:u,focusable:n,active:a,children:s.jsx(Vt.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...l,ref:t,onMouseDown:Tt(e.onMouseDown,g=>{n?d.onItemFocus(u):g.preventDefault()}),onFocus:Tt(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:Tt(e.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){d.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const v=u5e(g,d.orientation,d.dir);if(v!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let b=m().filter(N=>N.focusable).map(N=>N.ref.current);if(v==="last")b.reverse();else if(v==="prev"||v==="next"){v==="prev"&&b.reverse();const N=b.indexOf(g.currentTarget);b=d.loop?d5e(b,N+1):b.slice(N+1)}setTimeout(()=>Ere(b))}}),children:typeof o=="function"?o({isCurrentTabStop:f,hasTabStop:p!=null}):o})})});Cre.displayName=kre;var l5e={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function c5e(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function u5e(e,t,r){const n=c5e(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return l5e[n]}function Ere(e,t=!1){const r=document.activeElement;for(const n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}function d5e(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var _L=Sre,NL=Cre,X6=["Enter"," "],f5e=["ArrowDown","PageUp","Home"],Are=["ArrowUp","PageDown","End"],h5e=[...f5e,...Are],m5e={ltr:[...X6,"ArrowRight"],rtl:[...X6,"ArrowLeft"]},p5e={ltr:["ArrowLeft"],rtl:["ArrowRight"]},a_="Menu",[A2,x5e,g5e]=Gj(a_),[U0,Tre]=ei(a_,[g5e,kp,g1]),HC=kp(),Pre=g1(),[v5e,V0]=U0(a_),[y5e,i_]=U0(a_),Ore=e=>{const{__scopeMenu:t,open:r=!1,children:n,dir:a,onOpenChange:i,modal:o=!0}=e,l=HC(t),[c,u]=w.useState(null),d=w.useRef(!1),f=ya(i),m=q0(a);return w.useEffect(()=>{const h=()=>{d.current=!0,document.addEventListener("pointerdown",x,{capture:!0,once:!0}),document.addEventListener("pointermove",x,{capture:!0,once:!0})},x=()=>d.current=!1;return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",x,{capture:!0}),document.removeEventListener("pointermove",x,{capture:!0})}},[]),s.jsx(kC,{...l,children:s.jsx(v5e,{scope:t,open:r,onOpenChange:f,content:c,onContentChange:u,children:s.jsx(y5e,{scope:t,onClose:w.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:m,modal:o,children:n})})})};Ore.displayName=a_;var b5e="MenuAnchor",SL=w.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,a=HC(r);return s.jsx(Zj,{...a,...n,ref:t})});SL.displayName=b5e;var kL="MenuPortal",[w5e,Dre]=U0(kL,{forceMount:void 0}),Ire=e=>{const{__scopeMenu:t,forceMount:r,children:n,container:a}=e,i=V0(kL,t);return s.jsx(w5e,{scope:t,forceMount:r,children:s.jsx(ti,{present:r||i.open,children:s.jsx(t1,{asChild:!0,container:a,children:n})})})};Ire.displayName=kL;var Gc="MenuContent",[j5e,CL]=U0(Gc),Rre=w.forwardRef((e,t)=>{const r=Dre(Gc,e.__scopeMenu),{forceMount:n=r.forceMount,...a}=e,i=V0(Gc,e.__scopeMenu),o=i_(Gc,e.__scopeMenu);return s.jsx(A2.Provider,{scope:e.__scopeMenu,children:s.jsx(ti,{present:n||i.open,children:s.jsx(A2.Slot,{scope:e.__scopeMenu,children:o.modal?s.jsx(_5e,{...a,ref:t}):s.jsx(N5e,{...a,ref:t})})})})}),_5e=w.forwardRef((e,t)=>{const r=V0(Gc,e.__scopeMenu),n=w.useRef(null),a=Pr(t,n);return w.useEffect(()=>{const i=n.current;if(i)return FC(i)},[]),s.jsx(EL,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:Tt(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),N5e=w.forwardRef((e,t)=>{const r=V0(Gc,e.__scopeMenu);return s.jsx(EL,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),S5e=np("MenuContent.ScrollLock"),EL=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:x,...p}=e,g=V0(Gc,r),v=i_(Gc,r),y=HC(r),b=Pre(r),N=x5e(r),[j,_]=w.useState(null),S=w.useRef(null),P=Pr(t,S,g.onContentChange),T=w.useRef(0),R=w.useRef(""),k=w.useRef(0),E=w.useRef(null),q=w.useRef("right"),O=w.useRef(0),L=x?t_:w.Fragment,H=x?{as:S5e,allowPinchZoom:!0}:void 0,V=M=>{var te,re;const B=R.current+M,K=N().filter(J=>!J.disabled),C=document.activeElement,A=(te=K.find(J=>J.ref.current===C))==null?void 0:te.textValue,I=K.map(J=>J.textValue),U=F5e(I,B,A),Y=(re=K.find(J=>J.textValue===U))==null?void 0:re.ref.current;(function J(ie){R.current=ie,window.clearTimeout(T.current),ie!==""&&(T.current=window.setTimeout(()=>J(""),1e3))})(B),Y&&setTimeout(()=>Y.focus())};w.useEffect(()=>()=>window.clearTimeout(T.current),[]),RC();const z=w.useCallback(M=>{var K,C;return q.current===((K=E.current)==null?void 0:K.side)&&$5e(M,(C=E.current)==null?void 0:C.area)},[]);return s.jsx(j5e,{scope:r,searchRef:R,onItemEnter:w.useCallback(M=>{z(M)&&M.preventDefault()},[z]),onItemLeave:w.useCallback(M=>{var B;z(M)||((B=S.current)==null||B.focus(),_(null))},[z]),onTriggerLeave:w.useCallback(M=>{z(M)&&M.preventDefault()},[z]),pointerGraceTimerRef:k,onPointerGraceIntentChange:w.useCallback(M=>{E.current=M},[]),children:s.jsx(L,{...H,children:s.jsx(e_,{asChild:!0,trapped:a,onMountAutoFocus:Tt(i,M=>{var B;M.preventDefault(),(B=S.current)==null||B.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:s.jsx(B0,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:m,onDismiss:h,children:s.jsx(_L,{asChild:!0,...b,dir:v.dir,orientation:"vertical",loop:n,currentTabStopId:j,onCurrentTabStopIdChange:_,onEntryFocus:Tt(c,M=>{v.isUsingKeyboardRef.current||M.preventDefault()}),preventScrollOnEntryFocus:!0,children:s.jsx(CC,{role:"menu","aria-orientation":"vertical","data-state":Zre(g.open),"data-radix-menu-content":"",dir:v.dir,...y,...p,ref:P,style:{outline:"none",...p.style},onKeyDown:Tt(p.onKeyDown,M=>{const K=M.target.closest("[data-radix-menu-content]")===M.currentTarget,C=M.ctrlKey||M.altKey||M.metaKey,A=M.key.length===1;K&&(M.key==="Tab"&&M.preventDefault(),!C&&A&&V(M.key));const I=S.current;if(M.target!==I||!h5e.includes(M.key))return;M.preventDefault();const Y=N().filter(te=>!te.disabled).map(te=>te.ref.current);Are.includes(M.key)&&Y.reverse(),R5e(Y)}),onBlur:Tt(e.onBlur,M=>{M.currentTarget.contains(M.target)||(window.clearTimeout(T.current),R.current="")}),onPointerMove:Tt(e.onPointerMove,T2(M=>{const B=M.target,K=O.current!==M.clientX;if(M.currentTarget.contains(B)&&K){const C=M.clientX>O.current?"right":"left";q.current=C,O.current=M.clientX}}))})})})})})})});Rre.displayName=Gc;var k5e="MenuGroup",AL=w.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return s.jsx(Vt.div,{role:"group",...n,ref:t})});AL.displayName=k5e;var C5e="MenuLabel",Lre=w.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return s.jsx(Vt.div,{...n,ref:t})});Lre.displayName=C5e;var d4="MenuItem",wz="menu.itemSelect",WC=w.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:n,...a}=e,i=w.useRef(null),o=i_(d4,e.__scopeMenu),l=CL(d4,e.__scopeMenu),c=Pr(t,i),u=w.useRef(!1),d=()=>{const f=i.current;if(!r&&f){const m=new CustomEvent(wz,{bubbles:!0,cancelable:!0});f.addEventListener(wz,h=>n==null?void 0:n(h),{once:!0}),ER(f,m),m.defaultPrevented?u.current=!1:o.onClose()}};return s.jsx(Fre,{...a,ref:c,disabled:r,onClick:Tt(e.onClick,d),onPointerDown:f=>{var m;(m=e.onPointerDown)==null||m.call(e,f),u.current=!0},onPointerUp:Tt(e.onPointerUp,f=>{var m;u.current||(m=f.currentTarget)==null||m.click()}),onKeyDown:Tt(e.onKeyDown,f=>{const m=l.searchRef.current!=="";r||m&&f.key===" "||X6.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});WC.displayName=d4;var Fre=w.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:n=!1,textValue:a,...i}=e,o=CL(d4,r),l=Pre(r),c=w.useRef(null),u=Pr(t,c),[d,f]=w.useState(!1),[m,h]=w.useState("");return w.useEffect(()=>{const x=c.current;x&&h((x.textContent??"").trim())},[i.children]),s.jsx(A2.ItemSlot,{scope:r,disabled:n,textValue:a??m,children:s.jsx(NL,{asChild:!0,...l,focusable:!n,children:s.jsx(Vt.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...i,ref:u,onPointerMove:Tt(e.onPointerMove,T2(x=>{n?o.onItemLeave(x):(o.onItemEnter(x),x.defaultPrevented||x.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Tt(e.onPointerLeave,T2(x=>o.onItemLeave(x))),onFocus:Tt(e.onFocus,()=>f(!0)),onBlur:Tt(e.onBlur,()=>f(!1))})})})}),E5e="MenuCheckboxItem",Mre=w.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:n,...a}=e;return s.jsx(Ure,{scope:e.__scopeMenu,checked:r,children:s.jsx(WC,{role:"menuitemcheckbox","aria-checked":f4(r)?"mixed":r,...a,ref:t,"data-state":PL(r),onSelect:Tt(a.onSelect,()=>n==null?void 0:n(f4(r)?!0:!r),{checkForDefaultPrevented:!1})})})});Mre.displayName=E5e;var $re="MenuRadioGroup",[A5e,T5e]=U0($re,{value:void 0,onValueChange:()=>{}}),Bre=w.forwardRef((e,t)=>{const{value:r,onValueChange:n,...a}=e,i=ya(n);return s.jsx(A5e,{scope:e.__scopeMenu,value:r,onValueChange:i,children:s.jsx(AL,{...a,ref:t})})});Bre.displayName=$re;var zre="MenuRadioItem",qre=w.forwardRef((e,t)=>{const{value:r,...n}=e,a=T5e(zre,e.__scopeMenu),i=r===a.value;return s.jsx(Ure,{scope:e.__scopeMenu,checked:i,children:s.jsx(WC,{role:"menuitemradio","aria-checked":i,...n,ref:t,"data-state":PL(i),onSelect:Tt(n.onSelect,()=>{var o;return(o=a.onValueChange)==null?void 0:o.call(a,r)},{checkForDefaultPrevented:!1})})})});qre.displayName=zre;var TL="MenuItemIndicator",[Ure,P5e]=U0(TL,{checked:!1}),Vre=w.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:n,...a}=e,i=P5e(TL,r);return s.jsx(ti,{present:n||f4(i.checked)||i.checked===!0,children:s.jsx(Vt.span,{...a,ref:t,"data-state":PL(i.checked)})})});Vre.displayName=TL;var O5e="MenuSeparator",Hre=w.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return s.jsx(Vt.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});Hre.displayName=O5e;var D5e="MenuArrow",Wre=w.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,a=HC(r);return s.jsx(EC,{...a,...n,ref:t})});Wre.displayName=D5e;var I5e="MenuSub",[QCt,Gre]=U0(I5e),nw="MenuSubTrigger",Kre=w.forwardRef((e,t)=>{const r=V0(nw,e.__scopeMenu),n=i_(nw,e.__scopeMenu),a=Gre(nw,e.__scopeMenu),i=CL(nw,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(SL,{asChild:!0,...u,children:s.jsx(Fre,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":a.contentId,"data-state":Zre(r.open),...e,ref:hh(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:Tt(e.onPointerMove,T2(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:Tt(e.onPointerLeave,T2(f=>{var h,x;d();const m=(h=r.content)==null?void 0:h.getBoundingClientRect();if(m){const p=(x=r.content)==null?void 0:x.dataset.side,g=p==="right",v=g?-5:5,y=m[g?"left":"right"],b=m[g?"right":"left"];i.onPointerGraceIntentChange({area:[{x:f.clientX+v,y:f.clientY},{x:y,y:m.top},{x:b,y:m.top},{x:b,y:m.bottom},{x:y,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:Tt(e.onKeyDown,f=>{var h;const m=i.searchRef.current!=="";e.disabled||m&&f.key===" "||m5e[n.dir].includes(f.key)&&(r.onOpenChange(!0),(h=r.content)==null||h.focus(),f.preventDefault())})})})});Kre.displayName=nw;var Xre="MenuSubContent",Yre=w.forwardRef((e,t)=>{const r=Dre(Gc,e.__scopeMenu),{forceMount:n=r.forceMount,...a}=e,i=V0(Gc,e.__scopeMenu),o=i_(Gc,e.__scopeMenu),l=Gre(Xre,e.__scopeMenu),c=w.useRef(null),u=Pr(t,c);return s.jsx(A2.Provider,{scope:e.__scopeMenu,children:s.jsx(ti,{present:n||i.open,children:s.jsx(A2.Slot,{scope:e.__scopeMenu,children:s.jsx(EL,{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:Tt(e.onFocusOutside,d=>{d.target!==l.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:Tt(e.onEscapeKeyDown,d=>{o.onClose(),d.preventDefault()}),onKeyDown:Tt(e.onKeyDown,d=>{var h;const f=d.currentTarget.contains(d.target),m=p5e[o.dir].includes(d.key);f&&m&&(i.onOpenChange(!1),(h=l.trigger)==null||h.focus(),d.preventDefault())})})})})})});Yre.displayName=Xre;function Zre(e){return e?"open":"closed"}function f4(e){return e==="indeterminate"}function PL(e){return f4(e)?"indeterminate":e?"checked":"unchecked"}function R5e(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function L5e(e,t){return e.map((r,n)=>e[(t+n)%e.length])}function F5e(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=L5e(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 M5e(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 $5e(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return M5e(r,t)}function T2(e){return t=>t.pointerType==="mouse"?e(t):void 0}var B5e=Ore,z5e=SL,q5e=Ire,U5e=Rre,V5e=AL,H5e=Lre,W5e=WC,G5e=Mre,K5e=Bre,X5e=qre,Y5e=Vre,Z5e=Hre,J5e=Wre,Q5e=Kre,e4e=Yre,GC="DropdownMenu",[t4e]=ei(GC,[Tre]),rl=Tre(),[r4e,Jre]=t4e(GC),Qre=e=>{const{__scopeDropdownMenu:t,children:r,dir:n,open:a,defaultOpen:i,onOpenChange:o,modal:l=!0}=e,c=rl(t),u=w.useRef(null),[d,f]=Zo({prop:a,defaultProp:i??!1,onChange:o,caller:GC});return s.jsx(r4e,{scope:t,triggerId:Za(),triggerRef:u,contentId:Za(),open:d,onOpenChange:f,onOpenToggle:w.useCallback(()=>f(m=>!m),[f]),modal:l,children:s.jsx(B5e,{...c,open:d,onOpenChange:f,dir:n,modal:l,children:r})})};Qre.displayName=GC;var ene="DropdownMenuTrigger",tne=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...a}=e,i=Jre(ene,r),o=rl(r);return s.jsx(z5e,{asChild:!0,...o,children:s.jsx(Vt.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:hh(t,i.triggerRef),onPointerDown:Tt(e.onPointerDown,l=>{!n&&l.button===0&&l.ctrlKey===!1&&(i.onOpenToggle(),i.open||l.preventDefault())}),onKeyDown:Tt(e.onKeyDown,l=>{n||(["Enter"," "].includes(l.key)&&i.onOpenToggle(),l.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});tne.displayName=ene;var n4e="DropdownMenuPortal",rne=e=>{const{__scopeDropdownMenu:t,...r}=e,n=rl(t);return s.jsx(q5e,{...n,...r})};rne.displayName=n4e;var nne="DropdownMenuContent",sne=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,a=Jre(nne,r),i=rl(r),o=w.useRef(!1);return s.jsx(U5e,{id:a.contentId,"aria-labelledby":a.triggerId,...i,...n,ref:t,onCloseAutoFocus:Tt(e.onCloseAutoFocus,l=>{var c;o.current||(c=a.triggerRef.current)==null||c.focus(),o.current=!1,l.preventDefault()}),onInteractOutside:Tt(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)"}})});sne.displayName=nne;var s4e="DropdownMenuGroup",a4e=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,a=rl(r);return s.jsx(V5e,{...a,...n,ref:t})});a4e.displayName=s4e;var i4e="DropdownMenuLabel",ane=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,a=rl(r);return s.jsx(H5e,{...a,...n,ref:t})});ane.displayName=i4e;var o4e="DropdownMenuItem",ine=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,a=rl(r);return s.jsx(W5e,{...a,...n,ref:t})});ine.displayName=o4e;var l4e="DropdownMenuCheckboxItem",one=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,a=rl(r);return s.jsx(G5e,{...a,...n,ref:t})});one.displayName=l4e;var c4e="DropdownMenuRadioGroup",u4e=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,a=rl(r);return s.jsx(K5e,{...a,...n,ref:t})});u4e.displayName=c4e;var d4e="DropdownMenuRadioItem",lne=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,a=rl(r);return s.jsx(X5e,{...a,...n,ref:t})});lne.displayName=d4e;var f4e="DropdownMenuItemIndicator",cne=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,a=rl(r);return s.jsx(Y5e,{...a,...n,ref:t})});cne.displayName=f4e;var h4e="DropdownMenuSeparator",une=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,a=rl(r);return s.jsx(Z5e,{...a,...n,ref:t})});une.displayName=h4e;var m4e="DropdownMenuArrow",p4e=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,a=rl(r);return s.jsx(J5e,{...a,...n,ref:t})});p4e.displayName=m4e;var x4e="DropdownMenuSubTrigger",dne=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,a=rl(r);return s.jsx(Q5e,{...a,...n,ref:t})});dne.displayName=x4e;var g4e="DropdownMenuSubContent",fne=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,a=rl(r);return s.jsx(e4e,{...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)"}})});fne.displayName=g4e;var v4e=Qre,y4e=tne,b4e=rne,hne=sne,mne=ane,pne=ine,xne=one,gne=lne,vne=cne,yne=une,bne=dne,wne=fne;const p5=v4e,x5=y4e,w4e=w.forwardRef(({className:e,inset:t,children:r,...n},a)=>s.jsxs(bne,{ref:a,className:yt("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(nu,{className:"ml-auto h-4 w-4"})]}));w4e.displayName=bne.displayName;const j4e=w.forwardRef(({className:e,...t},r)=>s.jsx(wne,{ref:r,className:yt("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}));j4e.displayName=wne.displayName;const Nw=w.forwardRef(({className:e,sideOffset:t=4,...r},n)=>s.jsx(b4e,{children:s.jsx(hne,{ref:n,sideOffset:t,className:yt("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})}));Nw.displayName=hne.displayName;const Io=w.forwardRef(({className:e,inset:t,...r},n)=>s.jsx(pne,{ref:n,className:yt("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}));Io.displayName=pne.displayName;const _4e=w.forwardRef(({className:e,children:t,checked:r,...n},a)=>s.jsxs(xne,{ref:a,className:yt("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(vne,{children:s.jsx(Rn,{className:"h-4 w-4"})})}),t]}));_4e.displayName=xne.displayName;const N4e=w.forwardRef(({className:e,children:t,...r},n)=>s.jsxs(gne,{ref:n,className:yt("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(vne,{children:s.jsx(DR,{className:"h-2 w-2 fill-current"})})}),t]}));N4e.displayName=gne.displayName;const S4e=w.forwardRef(({className:e,inset:t,...r},n)=>s.jsx(mne,{ref:n,className:yt("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...r}));S4e.displayName=mne.displayName;const h4=w.forwardRef(({className:e,...t},r)=>s.jsx(yne,{ref:r,className:yt("-mx-1 my-1 h-px bg-muted",e),...t}));h4.displayName=yne.displayName;const k4e=r1("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Te({className:e,variant:t,...r}){return s.jsx("div",{className:yt(k4e({variant:t}),e),...r})}var KC="Popover",[jne]=ei(KC,[kp]),o_=kp(),[C4e,Tp]=jne(KC),_ne=e=>{const{__scopePopover:t,children:r,open:n,defaultOpen:a,onOpenChange:i,modal:o=!1}=e,l=o_(t),c=w.useRef(null),[u,d]=w.useState(!1),[f,m]=Zo({prop:n,defaultProp:a??!1,onChange:i,caller:KC});return s.jsx(kC,{...l,children:s.jsx(C4e,{scope:t,contentId:Za(),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})})};_ne.displayName=KC;var Nne="PopoverAnchor",E4e=w.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,a=Tp(Nne,r),i=o_(r),{onCustomAnchorAdd:o,onCustomAnchorRemove:l}=a;return w.useEffect(()=>(o(),()=>l()),[o,l]),s.jsx(Zj,{...i,...n,ref:t})});E4e.displayName=Nne;var Sne="PopoverTrigger",kne=w.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,a=Tp(Sne,r),i=o_(r),o=Pr(t,a.triggerRef),l=s.jsx(Vt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":Pne(a.open),...n,ref:o,onClick:Tt(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?l:s.jsx(Zj,{asChild:!0,...i,children:l})});kne.displayName=Sne;var OL="PopoverPortal",[A4e,T4e]=jne(OL,{forceMount:void 0}),Cne=e=>{const{__scopePopover:t,forceMount:r,children:n,container:a}=e,i=Tp(OL,t);return s.jsx(A4e,{scope:t,forceMount:r,children:s.jsx(ti,{present:r||i.open,children:s.jsx(t1,{asChild:!0,container:a,children:n})})})};Cne.displayName=OL;var xy="PopoverContent",Ene=w.forwardRef((e,t)=>{const r=T4e(xy,e.__scopePopover),{forceMount:n=r.forceMount,...a}=e,i=Tp(xy,e.__scopePopover);return s.jsx(ti,{present:n||i.open,children:i.modal?s.jsx(O4e,{...a,ref:t}):s.jsx(D4e,{...a,ref:t})})});Ene.displayName=xy;var P4e=np("PopoverContent.RemoveScroll"),O4e=w.forwardRef((e,t)=>{const r=Tp(xy,e.__scopePopover),n=w.useRef(null),a=Pr(t,n),i=w.useRef(!1);return w.useEffect(()=>{const o=n.current;if(o)return FC(o)},[]),s.jsx(t_,{as:P4e,allowPinchZoom:!0,children:s.jsx(Ane,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Tt(e.onCloseAutoFocus,o=>{var l;o.preventDefault(),i.current||(l=r.triggerRef.current)==null||l.focus()}),onPointerDownOutside:Tt(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:Tt(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),D4e=w.forwardRef((e,t)=>{const r=Tp(xy,e.__scopePopover),n=w.useRef(!1),a=w.useRef(!1);return s.jsx(Ane,{...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()}})}),Ane=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=Tp(xy,r),h=o_(r);return RC(),s.jsx(e_,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:a,onUnmountAutoFocus:i,children:s.jsx(B0,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:d,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onDismiss:()=>m.onOpenChange(!1),children:s.jsx(CC,{"data-state":Pne(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)"}})})})}),Tne="PopoverClose",I4e=w.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,a=Tp(Tne,r);return s.jsx(Vt.button,{type:"button",...n,ref:t,onClick:Tt(e.onClick,()=>a.onOpenChange(!1))})});I4e.displayName=Tne;var R4e="PopoverArrow",L4e=w.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,a=o_(r);return s.jsx(EC,{...a,...n,ref:t})});L4e.displayName=R4e;function Pne(e){return e?"open":"closed"}var F4e=_ne,M4e=kne,$4e=Cne,One=Ene;const lp=F4e,cp=M4e,vh=w.forwardRef(({className:e,align:t="center",sideOffset:r=4,...n},a)=>s.jsx($4e,{children:s.jsx(One,{ref:a,align:t,sideOffset:r,className:yt("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})}));vh.displayName=One.displayName;function Y6(e,[t,r]){return Math.min(r,Math.max(t,e))}function B4e(e,t){return w.useReducer((r,n)=>t[r][n]??r,e)}var DL="ScrollArea",[Dne]=ei(DL),[z4e,uu]=Dne(DL),Ine=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,x]=w.useState(null),[p,g]=w.useState(null),[v,y]=w.useState(0),[b,N]=w.useState(0),[j,_]=w.useState(!1),[S,P]=w.useState(!1),T=Pr(t,k=>c(k)),R=q0(a);return s.jsx(z4e,{scope:r,type:n,dir:R,scrollHideDelay:i,scrollArea:l,viewport:u,onViewportChange:d,content:f,onContentChange:m,scrollbarX:h,onScrollbarXChange:x,scrollbarXEnabled:j,onScrollbarXEnabledChange:_,scrollbarY:p,onScrollbarYChange:g,scrollbarYEnabled:S,onScrollbarYEnabledChange:P,onCornerWidthChange:y,onCornerHeightChange:N,children:s.jsx(Vt.div,{dir:R,...o,ref:T,style:{position:"relative","--radix-scroll-area-corner-width":v+"px","--radix-scroll-area-corner-height":b+"px",...e.style}})})});Ine.displayName=DL;var Rne="ScrollAreaViewport",Lne=w.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:a,...i}=e,o=uu(Rne,r),l=w.useRef(null),c=Pr(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(Vt.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})})]})});Lne.displayName=Rne;var lf="ScrollAreaScrollbar",IL=w.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=uu(lf,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(q4e,{...n,ref:t,forceMount:r}):a.type==="scroll"?s.jsx(U4e,{...n,ref:t,forceMount:r}):a.type==="auto"?s.jsx(Fne,{...n,ref:t,forceMount:r}):a.type==="always"?s.jsx(RL,{...n,ref:t}):null});IL.displayName=lf;var q4e=w.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=uu(lf,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(ti,{present:r||i,children:s.jsx(Fne,{"data-state":i?"visible":"hidden",...n,ref:t})})}),U4e=w.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=uu(lf,e.__scopeScrollArea),i=e.orientation==="horizontal",o=YC(()=>c("SCROLL_END"),100),[l,c]=B4e("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(ti,{present:r||l!=="hidden",children:s.jsx(RL,{"data-state":l==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:Tt(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:Tt(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),Fne=w.forwardRef((e,t)=>{const r=uu(lf,e.__scopeScrollArea),{forceMount:n,...a}=e,[i,o]=w.useState(!1),l=e.orientation==="horizontal",c=YC(()=>{if(r.viewport){const u=r.viewport.offsetWidth<r.viewport.scrollWidth,d=r.viewport.offsetHeight<r.viewport.scrollHeight;o(l?u:d)}},10);return gy(r.viewport,c),gy(r.content,c),s.jsx(ti,{present:n||i,children:s.jsx(RL,{"data-state":i?"visible":"hidden",...a,ref:t})})}),RL=w.forwardRef((e,t)=>{const{orientation:r="vertical",...n}=e,a=uu(lf,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=qne(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 X4e(m,o.current,l,h)}return r==="horizontal"?s.jsx(V4e,{...d,ref:t,onThumbPositionChange:()=>{if(a.viewport&&i.current){const m=a.viewport.scrollLeft,h=jz(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(H4e,{...d,ref:t,onThumbPositionChange:()=>{if(a.viewport&&i.current){const m=a.viewport.scrollTop,h=jz(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}),V4e=w.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...a}=e,i=uu(lf,e.__scopeScrollArea),[o,l]=w.useState(),c=w.useRef(null),u=Pr(t,c,i.onScrollbarXChange);return w.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),s.jsx($ne,{"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":XC(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),Vne(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:p4(o.paddingLeft),paddingEnd:p4(o.paddingRight)}})}})}),H4e=w.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...a}=e,i=uu(lf,e.__scopeScrollArea),[o,l]=w.useState(),c=w.useRef(null),u=Pr(t,c,i.onScrollbarYChange);return w.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),s.jsx($ne,{"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":XC(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),Vne(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:p4(o.paddingTop),paddingEnd:p4(o.paddingBottom)}})}})}),[W4e,Mne]=Dne(lf),$ne=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=uu(lf,r),[x,p]=w.useState(null),g=Pr(t,T=>p(T)),v=w.useRef(null),y=w.useRef(""),b=h.viewport,N=n.content-n.viewport,j=ya(d),_=ya(c),S=YC(f,10);function P(T){if(v.current){const R=T.clientX-v.current.left,k=T.clientY-v.current.top;u({x:R,y:k})}}return w.useEffect(()=>{const T=R=>{const k=R.target;(x==null?void 0:x.contains(k))&&j(R,N)};return document.addEventListener("wheel",T,{passive:!1}),()=>document.removeEventListener("wheel",T,{passive:!1})},[b,x,N,j]),w.useEffect(_,[n,_]),gy(x,S),gy(h.content,S),s.jsx(W4e,{scope:r,scrollbar:x,hasThumb:a,onThumbChange:ya(i),onThumbPointerUp:ya(o),onThumbPositionChange:_,onThumbPointerDown:ya(l),children:s.jsx(Vt.div,{...m,ref:g,style:{position:"absolute",...m.style},onPointerDown:Tt(e.onPointerDown,T=>{T.button===0&&(T.target.setPointerCapture(T.pointerId),v.current=x.getBoundingClientRect(),y.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",h.viewport&&(h.viewport.style.scrollBehavior="auto"),P(T))}),onPointerMove:Tt(e.onPointerMove,P),onPointerUp:Tt(e.onPointerUp,T=>{const R=T.target;R.hasPointerCapture(T.pointerId)&&R.releasePointerCapture(T.pointerId),document.body.style.webkitUserSelect=y.current,h.viewport&&(h.viewport.style.scrollBehavior=""),v.current=null})})})}),m4="ScrollAreaThumb",Bne=w.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=Mne(m4,e.__scopeScrollArea);return s.jsx(ti,{present:r||a.hasThumb,children:s.jsx(G4e,{ref:t,...n})})}),G4e=w.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...a}=e,i=uu(m4,r),o=Mne(m4,r),{onThumbPositionChange:l}=o,c=Pr(t,f=>o.onThumbChange(f)),u=w.useRef(void 0),d=YC(()=>{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=Y4e(f,l);u.current=h,l()}};return l(),f.addEventListener("scroll",m),()=>f.removeEventListener("scroll",m)}},[i.viewport,d,l]),s.jsx(Vt.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:Tt(e.onPointerDownCapture,f=>{const h=f.target.getBoundingClientRect(),x=f.clientX-h.left,p=f.clientY-h.top;o.onThumbPointerDown({x,y:p})}),onPointerUp:Tt(e.onPointerUp,o.onThumbPointerUp)})});Bne.displayName=m4;var LL="ScrollAreaCorner",zne=w.forwardRef((e,t)=>{const r=uu(LL,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?s.jsx(K4e,{...e,ref:t}):null});zne.displayName=LL;var K4e=w.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,a=uu(LL,r),[i,o]=w.useState(0),[l,c]=w.useState(0),u=!!(i&&l);return gy(a.scrollbarX,()=>{var f;const d=((f=a.scrollbarX)==null?void 0:f.offsetHeight)||0;a.onCornerHeightChange(d),c(d)}),gy(a.scrollbarY,()=>{var f;const d=((f=a.scrollbarY)==null?void 0:f.offsetWidth)||0;a.onCornerWidthChange(d),o(d)}),u?s.jsx(Vt.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 p4(e){return e?parseInt(e,10):0}function qne(e,t){const r=e/t;return isNaN(r)?0:r}function XC(e){const t=qne(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function X4e(e,t,r,n="ltr"){const a=XC(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 Une([c,u],f)(e)}function jz(e,t,r="ltr"){const n=XC(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=Y6(e,c);return Une([0,o],[0,l])(u)}function Une(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 Vne(e,t){return e>0&&e<t}var Y4e=(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 YC(e,t){const r=ya(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 gy(e,t){const r=ya(t);_a(()=>{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 Hne=Ine,Z4e=Lne,J4e=zne;const su=w.forwardRef(({className:e,children:t,...r},n)=>s.jsxs(Hne,{ref:n,className:yt("relative overflow-hidden",e),...r,children:[s.jsx(Z4e,{className:"h-full w-full rounded-[inherit]",children:t}),s.jsx(x4,{}),s.jsx(J4e,{})]}));su.displayName=Hne.displayName;const x4=w.forwardRef(({className:e,orientation:t="vertical",...r},n)=>s.jsx(IL,{ref:n,orientation:t,className:yt("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(Bne,{className:"relative flex-1 rounded-full bg-border"})}));x4.displayName=IL.displayName;function Ir(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 Nl(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function $o(e,t){const r=Ir(e);return isNaN(t)?Nl(e,NaN):(t&&r.setDate(r.getDate()+t),r)}function cc(e,t){const r=Ir(e);if(isNaN(t))return Nl(e,NaN);if(!t)return r;const n=r.getDate(),a=Nl(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 FL=6048e5,Q4e=864e5,Wne=6e4,Gne=36e5,eS=43200,_z=1440;let eke={};function v1(){return eke}function ad(e,t){var l,c,u,d;const r=v1(),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=Ir(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 p0(e){return ad(e,{weekStartsOn:1})}function Kne(e){const t=Ir(e),r=t.getFullYear(),n=Nl(e,0);n.setFullYear(r+1,0,4),n.setHours(0,0,0,0);const a=p0(n),i=Nl(e,0);i.setFullYear(r,0,4),i.setHours(0,0,0,0);const o=p0(i);return t.getTime()>=a.getTime()?r+1:t.getTime()>=o.getTime()?r:r-1}function x0(e){const t=Ir(e);return t.setHours(0,0,0,0),t}function vy(e){const t=Ir(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 Ud(e,t){const r=x0(e),n=x0(t),a=+r-vy(r),i=+n-vy(n);return Math.round((a-i)/Q4e)}function tke(e){const t=Kne(e),r=Nl(e,0);return r.setFullYear(t,0,4),r.setHours(0,0,0,0),p0(r)}function Z6(e,t){const r=t*7;return $o(e,r)}function rke(e,t){return cc(e,t*12)}function nke(e){let t;return e.forEach(function(r){const n=Ir(r);(t===void 0||t<n||isNaN(Number(n)))&&(t=n)}),t||new Date(NaN)}function ske(e){let t;return e.forEach(r=>{const n=Ir(r);(!t||t>n||isNaN(+n))&&(t=n)}),t||new Date(NaN)}function g5(e,t){const r=Ir(e),n=Ir(t),a=r.getTime()-n.getTime();return a<0?-1:a>0?1:a}function ake(e){return Nl(e,Date.now())}function Uo(e,t){const r=x0(e),n=x0(t);return+r==+n}function ML(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function ike(e){if(!ML(e)&&typeof e!="number")return!1;const t=Ir(e);return!isNaN(Number(t))}function yy(e,t){const r=Ir(e),n=Ir(t),a=r.getFullYear()-n.getFullYear(),i=r.getMonth()-n.getMonth();return a*12+i}function oke(e,t,r){const n=ad(e,r),a=ad(t,r),i=+n-vy(n),o=+a-vy(a);return Math.round((i-o)/FL)}function lke(e){return t=>{const n=(e?Math[e]:Math.trunc)(t);return n===0?0:n}}function cke(e,t){return+Ir(e)-+Ir(t)}function Xne(e){const t=Ir(e);return t.setHours(23,59,59,999),t}function l_(e){const t=Ir(e),r=t.getMonth();return t.setFullYear(t.getFullYear(),r+1,0),t.setHours(23,59,59,999),t}function uke(e){const t=Ir(e);return+Xne(t)==+l_(t)}function dke(e,t){const r=Ir(e),n=Ir(t),a=g5(r,n),i=Math.abs(yy(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=g5(r,n)===-a;uke(Ir(e))&&i===1&&g5(e,n)===1&&(l=!1),o=a*(i-Number(l))}return o===0?0:o}function fke(e,t,r){const n=cke(e,t)/1e3;return lke(r==null?void 0:r.roundingMethod)(n)}function hke(e,t){const r=Ir(e.start),n=Ir(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(Ir(o)),o.setDate(o.getDate()+l),o.setHours(0,0,0,0);return a?c.reverse():c}function _o(e){const t=Ir(e);return t.setDate(1),t.setHours(0,0,0,0),t}function Yne(e){const t=Ir(e),r=Nl(e,0);return r.setFullYear(t.getFullYear(),0,1),r.setHours(0,0,0,0),r}function ZC(e,t){var l,c,u,d;const r=v1(),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=Ir(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 Zne(e){return ZC(e,{weekStartsOn:1})}const mke={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"}},pke=(e,t,r)=>{let n;const a=mke[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 Pv(e){return(t={})=>{const r=t.width?String(t.width):e.defaultWidth;return e.formats[r]||e.formats[e.defaultWidth]}}const xke={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},gke={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},vke={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},yke={date:Pv({formats:xke,defaultWidth:"full"}),time:Pv({formats:gke,defaultWidth:"full"}),dateTime:Pv({formats:vke,defaultWidth:"full"})},bke={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},wke=(e,t,r,n)=>bke[e];function Md(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 jke={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},_ke={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Nke={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"]},Ske={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"]},kke={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"}},Cke={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"}},Eke=(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"},Ake={ordinalNumber:Eke,era:Md({values:jke,defaultWidth:"wide"}),quarter:Md({values:_ke,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Md({values:Nke,defaultWidth:"wide"}),day:Md({values:Ske,defaultWidth:"wide"}),dayPeriod:Md({values:kke,defaultWidth:"wide",formattingValues:Cke,defaultFormattingWidth:"wide"})};function $d(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)?Pke(l,f=>f.test(o)):Tke(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 Tke(e,t){for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t(e[r]))return r}function Pke(e,t){for(let r=0;r<e.length;r++)if(t(e[r]))return r}function Jne(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 Oke=/^(\d+)(th|st|nd|rd)?/i,Dke=/\d+/i,Ike={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},Rke={any:[/^b/i,/^(a|c)/i]},Lke={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Fke={any:[/1/i,/2/i,/3/i,/4/i]},Mke={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},$ke={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]},Bke={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},zke={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]},qke={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},Uke={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}},Vke={ordinalNumber:Jne({matchPattern:Oke,parsePattern:Dke,valueCallback:e=>parseInt(e,10)}),era:$d({matchPatterns:Ike,defaultMatchWidth:"wide",parsePatterns:Rke,defaultParseWidth:"any"}),quarter:$d({matchPatterns:Lke,defaultMatchWidth:"wide",parsePatterns:Fke,defaultParseWidth:"any",valueCallback:e=>e+1}),month:$d({matchPatterns:Mke,defaultMatchWidth:"wide",parsePatterns:$ke,defaultParseWidth:"any"}),day:$d({matchPatterns:Bke,defaultMatchWidth:"wide",parsePatterns:zke,defaultParseWidth:"any"}),dayPeriod:$d({matchPatterns:qke,defaultMatchWidth:"any",parsePatterns:Uke,defaultParseWidth:"any"})},$L={code:"en-US",formatDistance:pke,formatLong:yke,formatRelative:wke,localize:Ake,match:Vke,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Hke(e){const t=Ir(e);return Ud(t,Yne(t))+1}function Qne(e){const t=Ir(e),r=+p0(t)-+tke(t);return Math.round(r/FL)+1}function ese(e,t){var d,f,m,h;const r=Ir(e),n=r.getFullYear(),a=v1(),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=Nl(e,0);o.setFullYear(n+1,0,i),o.setHours(0,0,0,0);const l=ad(o,t),c=Nl(e,0);c.setFullYear(n,0,i),c.setHours(0,0,0,0);const u=ad(c,t);return r.getTime()>=l.getTime()?n+1:r.getTime()>=u.getTime()?n:n-1}function Wke(e,t){var l,c,u,d;const r=v1(),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=ese(e,t),i=Nl(e,0);return i.setFullYear(a,0,n),i.setHours(0,0,0,0),ad(i,t)}function tse(e,t){const r=Ir(e),n=+ad(r,t)-+Wke(r,t);return Math.round(n/FL)+1}function as(e,t){const r=e<0?"-":"",n=Math.abs(e).toString().padStart(t,"0");return r+n}const em={y(e,t){const r=e.getFullYear(),n=r>0?r:1-r;return as(t==="yy"?n%100:n,t.length)},M(e,t){const r=e.getMonth();return t==="M"?String(r+1):as(r+1,2)},d(e,t){return as(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 as(e.getHours()%12||12,t.length)},H(e,t){return as(e.getHours(),t.length)},m(e,t){return as(e.getMinutes(),t.length)},s(e,t){return as(e.getSeconds(),t.length)},S(e,t){const r=t.length,n=e.getMilliseconds(),a=Math.trunc(n*Math.pow(10,r-3));return as(a,t.length)}},Eg={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Nz={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 em.y(e,t)},Y:function(e,t,r,n){const a=ese(e,n),i=a>0?a:1-a;if(t==="YY"){const o=i%100;return as(o,2)}return t==="Yo"?r.ordinalNumber(i,{unit:"year"}):as(i,t.length)},R:function(e,t){const r=Kne(e);return as(r,t.length)},u:function(e,t){const r=e.getFullYear();return as(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 as(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 as(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 em.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 as(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=tse(e,n);return t==="wo"?r.ordinalNumber(a,{unit:"week"}):as(a,t.length)},I:function(e,t,r){const n=Qne(e);return t==="Io"?r.ordinalNumber(n,{unit:"week"}):as(n,t.length)},d:function(e,t,r){return t==="do"?r.ordinalNumber(e.getDate(),{unit:"date"}):em.d(e,t)},D:function(e,t,r){const n=Hke(e);return t==="Do"?r.ordinalNumber(n,{unit:"dayOfYear"}):as(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 as(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 as(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 as(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=Eg.noon:n===0?a=Eg.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=Eg.evening:n>=12?a=Eg.afternoon:n>=4?a=Eg.morning:a=Eg.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 em.h(e,t)},H:function(e,t,r){return t==="Ho"?r.ordinalNumber(e.getHours(),{unit:"hour"}):em.H(e,t)},K:function(e,t,r){const n=e.getHours()%12;return t==="Ko"?r.ordinalNumber(n,{unit:"hour"}):as(n,t.length)},k:function(e,t,r){let n=e.getHours();return n===0&&(n=24),t==="ko"?r.ordinalNumber(n,{unit:"hour"}):as(n,t.length)},m:function(e,t,r){return t==="mo"?r.ordinalNumber(e.getMinutes(),{unit:"minute"}):em.m(e,t)},s:function(e,t,r){return t==="so"?r.ordinalNumber(e.getSeconds(),{unit:"second"}):em.s(e,t)},S:function(e,t){return em.S(e,t)},X:function(e,t,r){const n=e.getTimezoneOffset();if(n===0)return"Z";switch(t){case"X":return kz(n);case"XXXX":case"XX":return fx(n);case"XXXXX":case"XXX":default:return fx(n,":")}},x:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"x":return kz(n);case"xxxx":case"xx":return fx(n);case"xxxxx":case"xxx":default:return fx(n,":")}},O:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Sz(n,":");case"OOOO":default:return"GMT"+fx(n,":")}},z:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Sz(n,":");case"zzzz":default:return"GMT"+fx(n,":")}},t:function(e,t,r){const n=Math.trunc(e.getTime()/1e3);return as(n,t.length)},T:function(e,t,r){const n=e.getTime();return as(n,t.length)}};function Sz(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+as(i,2)}function kz(e,t){return e%60===0?(e>0?"-":"+")+as(Math.abs(e)/60,2):fx(e,t)}function fx(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),a=as(Math.trunc(n/60),2),i=as(n%60,2);return r+a+t+i}const Cz=(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"})}},rse=(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"})}},Gke=(e,t)=>{const r=e.match(/(P+)(p+)?/)||[],n=r[1],a=r[2];if(!a)return Cz(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}}",Cz(n,t)).replace("{{time}}",rse(a,t))},Kke={p:rse,P:Gke},Xke=/^D+$/,Yke=/^Y+$/,Zke=["D","DD","YY","YYYY"];function Jke(e){return Xke.test(e)}function Qke(e){return Yke.test(e)}function eCe(e,t,r){const n=tCe(e,t,r);if(console.warn(n),Zke.includes(e))throw new RangeError(n)}function tCe(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 rCe=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,nCe=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,sCe=/^'([^]*?)'?$/,aCe=/''/g,iCe=/[a-zA-Z]/;function Dt(e,t,r){var d,f,m,h,x,p,g,v;const n=v1(),a=(r==null?void 0:r.locale)??n.locale??$L,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=(x=r==null?void 0:r.locale)==null?void 0:x.options)==null?void 0:p.weekStartsOn)??n.weekStartsOn??((v=(g=n.locale)==null?void 0:g.options)==null?void 0:v.weekStartsOn)??0,l=Ir(e);if(!ike(l))throw new RangeError("Invalid time value");let c=t.match(nCe).map(y=>{const b=y[0];if(b==="p"||b==="P"){const N=Kke[b];return N(y,a.formatLong)}return y}).join("").match(rCe).map(y=>{if(y==="''")return{isToken:!1,value:"'"};const b=y[0];if(b==="'")return{isToken:!1,value:oCe(y)};if(Nz[b])return{isToken:!0,value:y};if(b.match(iCe))throw new RangeError("Format string contains an unescaped latin alphabet character `"+b+"`");return{isToken:!1,value:y}});a.localize.preprocessor&&(c=a.localize.preprocessor(l,c));const u={firstWeekContainsDate:i,weekStartsOn:o,locale:a};return c.map(y=>{if(!y.isToken)return y.value;const b=y.value;(!(r!=null&&r.useAdditionalWeekYearTokens)&&Qke(b)||!(r!=null&&r.useAdditionalDayOfYearTokens)&&Jke(b))&&eCe(b,t,String(e));const N=Nz[b[0]];return N(l,b,a.localize,u)}).join("")}function oCe(e){const t=e.match(sCe);return t?t[1].replace(aCe,"'"):e}function lCe(e,t,r){const n=v1(),a=(r==null?void 0:r.locale)??n.locale??$L,i=2520,o=g5(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=Ir(t),u=Ir(e)):(c=Ir(e),u=Ir(t));const d=fke(u,c),f=(vy(u)-vy(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<_z){const x=Math.round(m/60);return a.formatDistance("aboutXHours",x,l)}else{if(m<i)return a.formatDistance("xDays",1,l);if(m<eS){const x=Math.round(m/_z);return a.formatDistance("xDays",x,l)}else if(m<eS*2)return h=Math.round(m/eS),a.formatDistance("aboutXMonths",h,l)}if(h=dke(u,c),h<12){const x=Math.round(m/eS);return a.formatDistance("xMonths",x,l)}else{const x=h%12,p=Math.trunc(h/12);return x<3?a.formatDistance("aboutXYears",p,l):x<9?a.formatDistance("overXYears",p,l):a.formatDistance("almostXYears",p+1,l)}}function cCe(e,t){return lCe(e,ake(e),t)}function uCe(e){const t=Ir(e),r=t.getFullYear(),n=t.getMonth(),a=Nl(e,0);return a.setFullYear(r,n+1,0),a.setHours(0,0,0,0),a.getDate()}function dCe(e){return Math.trunc(+Ir(e)/1e3)}function fCe(e){const t=Ir(e),r=t.getMonth();return t.setFullYear(t.getFullYear(),r+1,0),t.setHours(0,0,0,0),t}function hCe(e,t){return oke(fCe(e),_o(e),t)+1}function J6(e,t){const r=Ir(e),n=Ir(t);return r.getTime()>n.getTime()}function nse(e,t){const r=Ir(e),n=Ir(t);return+r<+n}function JC(e,t){const r=Ir(e),n=Ir(t);return r.getFullYear()===n.getFullYear()&&r.getMonth()===n.getMonth()}function mCe(e,t){const r=Ir(e),n=Ir(t);return r.getFullYear()===n.getFullYear()}function Hx(e,t){return $o(e,-t)}function ml(e,t){const n=vCe(e);let a;if(n.date){const c=yCe(n.date,2);a=bCe(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=wCe(n.time),isNaN(o)))return new Date(NaN);if(n.timezone){if(l=jCe(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 tS={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},pCe=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,xCe=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,gCe=/^([+-])(\d{2})(?::?(\d{2}))?$/;function vCe(e){const t={},r=e.split(tS.dateTimeDelimiter);let n;if(r.length>2)return t;if(/:/.test(r[0])?n=r[0]:(t.date=r[0],n=r[1],tS.timeZoneDelimiter.test(t.date)&&(t.date=e.split(tS.timeZoneDelimiter)[0],n=e.substr(t.date.length,e.length))),n){const a=tS.timezone.exec(n);a?(t.time=n.replace(a[1],""),t.timezone=a[1]):t.time=n}return t}function yCe(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 bCe(e,t){if(t===null)return new Date(NaN);const r=e.match(pCe);if(!r)return new Date(NaN);const n=!!r[4],a=Ab(r[1]),i=Ab(r[2])-1,o=Ab(r[3]),l=Ab(r[4]),c=Ab(r[5])-1;if(n)return CCe(t,l,c)?_Ce(t,l,c):new Date(NaN);{const u=new Date(0);return!SCe(t,i,o)||!kCe(t,a)?new Date(NaN):(u.setUTCFullYear(t,i,Math.max(a,o)),u)}}function Ab(e){return e?parseInt(e):1}function wCe(e){const t=e.match(xCe);if(!t)return NaN;const r=fT(t[1]),n=fT(t[2]),a=fT(t[3]);return ECe(r,n,a)?r*Gne+n*Wne+a*1e3:NaN}function fT(e){return e&&parseFloat(e.replace(",","."))||0}function jCe(e){if(e==="Z")return 0;const t=e.match(gCe);if(!t)return 0;const r=t[1]==="+"?-1:1,n=parseInt(t[2]),a=t[3]&&parseInt(t[3])||0;return ACe(n,a)?r*(n*Gne+a*Wne):NaN}function _Ce(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 NCe=[31,null,31,30,31,30,31,31,30,31,30,31];function sse(e){return e%400===0||e%4===0&&e%100!==0}function SCe(e,t,r){return t>=0&&t<=11&&r>=1&&r<=(NCe[t]||(sse(e)?29:28))}function kCe(e,t){return t>=1&&t<=(sse(e)?366:365)}function CCe(e,t,r){return t>=1&&t<=53&&r>=0&&r<=6}function ECe(e,t,r){return e===24?t===0&&r===0:r>=0&&r<60&&t>=0&&t<60&&e>=0&&e<25}function ACe(e,t){return t>=0&&t<=59}function hT(e,t){const r=Ir(e),n=r.getFullYear(),a=r.getDate(),i=Nl(e,0);i.setFullYear(n,t,15),i.setHours(0,0,0,0);const o=uCe(i);return r.setMonth(t,Math.min(a,o)),r}function Ez(e,t){const r=Ir(e);return isNaN(+r)?Nl(e,NaN):(r.setFullYear(t),r)}function TCe(e,t){return cc(e,-1)}const PCe={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"}},OCe=(e,t,r)=>{let n;const a=PCe[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},DCe={full:"EEEE d MMMM y",long:"d MMMM y",medium:"d MMM y",short:"dd/MM/y"},ICe={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},RCe={full:"{{date}} 'à' {{time}}",long:"{{date}} 'à' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},LCe={date:Pv({formats:DCe,defaultWidth:"full"}),time:Pv({formats:ICe,defaultWidth:"full"}),dateTime:Pv({formats:RCe,defaultWidth:"full"})},FCe={lastWeek:"eeee 'dernier à' p",yesterday:"'hier à' p",today:"'aujourd’hui à' p",tomorrow:"'demain à' p'",nextWeek:"eeee 'prochain à' p",other:"P"},MCe=(e,t,r,n)=>FCe[e],$Ce={narrow:["av. J.-C","ap. J.-C"],abbreviated:["av. J.-C","ap. J.-C"],wide:["avant Jésus-Christ","après Jésus-Christ"]},BCe={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"]},zCe={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"]},qCe={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"]},UCe={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"}},VCe=(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},HCe=["MMM","MMMM"],WCe={preprocessor:(e,t)=>e.getDate()===1||!t.some(n=>n.isToken&&HCe.includes(n.value))?t:t.map(n=>n.isToken&&n.value==="do"?{isToken:!0,value:"d"}:n),ordinalNumber:VCe,era:Md({values:$Ce,defaultWidth:"wide"}),quarter:Md({values:BCe,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Md({values:zCe,defaultWidth:"wide"}),day:Md({values:qCe,defaultWidth:"wide"}),dayPeriod:Md({values:UCe,defaultWidth:"wide"})},GCe=/^(\d+)(ième|ère|ème|er|e)?/i,KCe=/\d+/i,XCe={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},YCe={any:[/^av/i,/^ap/i]},ZCe={narrow:/^T?[1234]/i,abbreviated:/^[1234](er|ème|e)? trim\.?/i,wide:/^[1234](er|ème|e)? trimestre/i},JCe={any:[/1/i,/2/i,/3/i,/4/i]},QCe={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},eEe={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]},tEe={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},rEe={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]},nEe={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},sEe={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}},aEe={ordinalNumber:Jne({matchPattern:GCe,parsePattern:KCe,valueCallback:e=>parseInt(e)}),era:$d({matchPatterns:XCe,defaultMatchWidth:"wide",parsePatterns:YCe,defaultParseWidth:"any"}),quarter:$d({matchPatterns:ZCe,defaultMatchWidth:"wide",parsePatterns:JCe,defaultParseWidth:"any",valueCallback:e=>e+1}),month:$d({matchPatterns:QCe,defaultMatchWidth:"wide",parsePatterns:eEe,defaultParseWidth:"any"}),day:$d({matchPatterns:tEe,defaultMatchWidth:"wide",parsePatterns:rEe,defaultParseWidth:"any"}),dayPeriod:$d({matchPatterns:nEe,defaultMatchWidth:"any",parsePatterns:sEe,defaultParseWidth:"any"})},br={code:"fr",formatDistance:OCe,formatLong:LCe,formatRelative:MCe,localize:WCe,match:aEe,options:{weekStartsOn:1,firstWeekContainsDate:4}},Az=()=>{const{user:e,isAdmin:t}=Br(),r=Zt(),[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:y,error:b}=await ce.from("notifications").select("*").eq("user_id",e.id).order("created_at",{ascending:!1}).limit(20);b&&console.error("Error loading user notifications:",b);let N=(y||[]).map(j=>({...j,source:"user"}));if(t){const{data:j,error:_}=await ce.from("admin_notifications").select("*").order("created_at",{ascending:!1}).limit(20);_&&console.error("Error loading admin notifications:",_);const S=(j||[]).map(P=>({...P,link:typeof P.metadata=="object"&&P.metadata!==null&&"link"in P.metadata?String(P.metadata.link):null,source:"admin"}));N=[...N,...S]}N.sort((j,_)=>new Date(_.created_at).getTime()-new Date(j.created_at).getTime()),N=N.slice(0,30),a(N),o(N.filter(j=>!j.is_read).length),d(!1)};w.useEffect(()=>{if(!e)return;f();const y=ce.channel("user-notifications").on("postgres_changes",{event:"INSERT",schema:"public",table:"notifications",filter:`user_id=eq.${e.id}`},N=>{const j={...N.new,source:"user"};a(_=>[j,..._].slice(0,30)),o(_=>_+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 b=null;return t&&(b=ce.channel("admin-notifications").on("postgres_changes",{event:"INSERT",schema:"public",table:"admin_notifications"},N=>{const j=N.new,_={...j,link:typeof j.metadata=="object"&&j.metadata!==null&&"link"in j.metadata?String(j.metadata.link):null,source:"admin"};a(S=>[_,...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()),()=>{ce.removeChannel(y),b&&ce.removeChannel(b)}},[e,t]);const m=async y=>{const b=y.source==="admin"?"admin_notifications":"notifications";await ce.from(b).update({is_read:!0}).eq("id",y.id),a(N=>N.map(j=>j.id===y.id?{...j,is_read:!0}:j)),o(N=>Math.max(0,N-1))},h=async()=>{const y=n.filter(N=>!N.is_read&&N.source==="user"),b=n.filter(N=>!N.is_read&&N.source==="admin");y.length>0&&await ce.from("notifications").update({is_read:!0}).in("id",y.map(N=>N.id)),b.length>0&&t&&await ce.from("admin_notifications").update({is_read:!0}).in("id",b.map(N=>N.id)),a(N=>N.map(j=>({...j,is_read:!0}))),o(0)},x=async y=>{const b=y.source==="admin"?"admin_notifications":"notifications";await ce.from(b).delete().eq("id",y.id),a(N=>N.filter(j=>j.id!==y.id)),y.is_read||o(N=>Math.max(0,N-1))},p=y=>{y.is_read||m(y),y.link&&(c(!1),r(y.link))},g=(y,b)=>{if(b==="admin")return s.jsx(Jo,{className:"h-4 w-4 text-amber-500"});switch(y){case"application":return s.jsx(fy,{className:"h-4 w-4 text-primary"});case"message":return s.jsx(Fi,{className:"h-4 w-4 text-blue-500"});case"success":return s.jsx(Rn,{className:"h-4 w-4 text-green-500"});case"warning":return s.jsx(Li,{className:"h-4 w-4 text-amber-500"});default:return s.jsx(dy,{className:"h-4 w-4 text-muted-foreground"})}},v=(y,b)=>{if(b==="admin")return s.jsx(Te,{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"},j={application:"Candidature",message:"Message",success:"Succès",warning:"Attention",info:"Info"};return s.jsx(Te,{className:N[y]||N.info,variant:"secondary",children:j[y]||"Info"})};return e?s.jsxs(lp,{open:l,onOpenChange:c,children:[s.jsx(cp,{asChild:!0,children:s.jsxs(ne,{variant:"ghost",size:"icon",className:"relative",children:[s.jsx(ZB,{className:"h-5 w-5"}),i>0&&s.jsx(Te,{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(vh,{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(su,{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(ZB,{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(y=>s.jsx("div",{className:`p-4 transition-colors ${y.is_read?"":"bg-primary/5"} ${y.link?"hover:bg-muted/50 cursor-pointer":""}`,onClick:()=>y.link&&p(y),children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("div",{className:"mt-0.5",children:g(y.type,y.source)}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[v(y.type,y.source),!y.is_read&&s.jsx("span",{className:"h-2 w-2 bg-primary rounded-full"}),y.link&&s.jsx(Te,{variant:"outline",className:"text-xs",children:"Voir détails"})]}),s.jsx("p",{className:"font-medium text-sm truncate",children:y.title}),s.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:y.message}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:cCe(new Date(y.created_at),{addSuffix:!0,locale:br})})]}),s.jsxs("div",{className:"flex flex-col gap-1",children:[!y.is_read&&s.jsx(ne,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:b=>{b.stopPropagation(),m(y)},children:s.jsx(Rn,{className:"h-4 w-4"})}),s.jsx(ne,{variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive",onClick:b=>{b.stopPropagation(),x(y)},children:s.jsx(ri,{className:"h-4 w-4"})})]})]})},`${y.source}-${y.id}`))})})]})]}):null},Xe=w.forwardRef(({className:e,type:t,...r},n)=>s.jsx("input",{type:t,className:yt("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}));Xe.displayName="Input";var ase={exports:{}},ise={};/**
* @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 by=w;function iEe(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var oEe=typeof Object.is=="function"?Object.is:iEe,lEe=by.useState,cEe=by.useEffect,uEe=by.useLayoutEffect,dEe=by.useDebugValue;function fEe(e,t){var r=t(),n=lEe({inst:{value:r,getSnapshot:t}}),a=n[0].inst,i=n[1];return uEe(function(){a.value=r,a.getSnapshot=t,mT(a)&&i({inst:a})},[e,r,t]),cEe(function(){return mT(a)&&i({inst:a}),e(function(){mT(a)&&i({inst:a})})},[e]),dEe(r),r}function mT(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!oEe(e,r)}catch{return!0}}function hEe(e,t){return t()}var mEe=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?hEe:fEe;ise.useSyncExternalStore=by.useSyncExternalStore!==void 0?by.useSyncExternalStore:mEe;ase.exports=ise;var pEe=ase.exports;function xEe(){return pEe.useSyncExternalStore(gEe,()=>!0,()=>!1)}function gEe(){return()=>{}}var BL="Avatar",[vEe]=ei(BL),[yEe,ose]=vEe(BL),lse=w.forwardRef((e,t)=>{const{__scopeAvatar:r,...n}=e,[a,i]=w.useState("idle");return s.jsx(yEe,{scope:r,imageLoadingStatus:a,onImageLoadingStatusChange:i,children:s.jsx(Vt.span,{...n,ref:t})})});lse.displayName=BL;var cse="AvatarImage",use=w.forwardRef((e,t)=>{const{__scopeAvatar:r,src:n,onLoadingStatusChange:a=()=>{},...i}=e,o=ose(cse,r),l=bEe(n,i),c=ya(u=>{a(u),o.onImageLoadingStatusChange(u)});return _a(()=>{l!=="idle"&&c(l)},[l,c]),l==="loaded"?s.jsx(Vt.img,{...i,ref:t,src:n}):null});use.displayName=cse;var dse="AvatarFallback",fse=w.forwardRef((e,t)=>{const{__scopeAvatar:r,delayMs:n,...a}=e,i=ose(dse,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(Vt.span,{...a,ref:t}):null});fse.displayName=dse;function Tz(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function bEe(e,{referrerPolicy:t,crossOrigin:r}){const n=xEe(),a=w.useRef(null),i=n?(a.current||(a.current=new window.Image),a.current):null,[o,l]=w.useState(()=>Tz(i,e));return _a(()=>{l(Tz(i,e))},[i,e]),_a(()=>{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 hse=lse,mse=use,pse=fse;const bs=w.forwardRef(({className:e,...t},r)=>s.jsx(hse,{ref:r,className:yt("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));bs.displayName=hse.displayName;const ji=w.forwardRef(({className:e,...t},r)=>s.jsx(mse,{ref:r,className:yt("aspect-square h-full w-full",e),...t}));ji.displayName=mse.displayName;const ws=w.forwardRef(({className:e,...t},r)=>s.jsx(pse,{ref:r,className:yt("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...t}));ws.displayName=pse.displayName;const wEe="https://pedagobridge.com/functions/v1/ai-assistant",Tb={"/training-request":{description:"Formulaire de création d'une offre de formation pour les écoles",suggestions:[{icon:Ql,text:"Comment remplir ce formulaire ?",category:"Aide formulaire"},{icon:Kt,text:"Quels domaines de formation choisir ?",category:"Conseil"},{icon:gx,text:"Qu'est-ce que la modalité de formation ?",category:"Explication"},{icon:a6,text:"Comment définir un bon TJM ?",category:"Budget"}]},"/trainer-register":{description:"Formulaire d'inscription pour les formateurs",suggestions:[{icon:Ql,text:"Comment m'inscrire comme formateur ?",category:"Inscription"},{icon:Kt,text:"Quelles spécialités indiquer ?",category:"Profil"},{icon:gx,text:"Quels documents dois-je fournir ?",category:"Documents"},{icon:er,text:"Comment être visible sur la plateforme ?",category:"Visibilité"}]},"/school-register":{description:"Formulaire d'inscription pour les écoles",suggestions:[{icon:a6,text:"Comment inscrire mon établissement ?",category:"Inscription"},{icon:Kt,text:"Quelles informations fournir ?",category:"Profil"},{icon:gx,text:"Comment publier des offres ensuite ?",category:"Offres"},{icon:er,text:"Comment contacter des formateurs ?",category:"Contact"}]},"/trainer-profile":{description:"Page de profil du formateur connecté",suggestions:[{icon:Kt,text:"Comment compléter mon profil ?",category:"Profil"},{icon:Ql,text:"Comment obtenir mon NDA ?",category:"NDA"},{icon:gx,text:"Quels documents télécharger ?",category:"Documents"},{icon:er,text:"Comment améliorer ma visibilité ?",category:"Visibilité"}]},default:{description:"Navigation générale sur PedagoBridge",suggestions:[{icon:er,text:"Comment trouver un formateur ?",category:"Recherche"},{icon:Kt,text:"Comment publier une offre de formation ?",category:"Écoles"},{icon:_l,text:"Comment m'inscrire comme formateur ?",category:"Formateurs"},{icon:gx,text:"Comment fonctionne la plateforme ?",category:"Général"}]}};function jEe({trigger:e,side:t="right"}){var j;const{user:r}=Br(),n=cu(),[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 _=n.pathname;if(Tb[_])return Tb[_];const S=Object.keys(Tb).find(P=>P!=="default"&&_.startsWith(P));return S?Tb[S]:Tb.default})(),g=p.suggestions;w.useEffect(()=>{m.current&&(m.current.scrollTop=m.current.scrollHeight)},[o]),w.useEffect(()=>{a&&h.current&&setTimeout(()=>{var _;return(_=h.current)==null?void 0:_.focus()},100)},[a]);const v=async _=>{var E,q,O;const S=await fetch(wEe,{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiIsImlzcyI6InN1cGFiYXNlIiwiaWF0IjoxNzc2MjQzNzQyLCJleHAiOjIwOTE2MDM3NDJ9.73Zk3EieShL_u8EKlAW2LekPnT1agaI3de2bE8hkWq4"},body:JSON.stringify({messages:_,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 P=S.body.getReader(),T=new TextDecoder;let R="",k="";for(;;){const{done:L,value:H}=await P.read();if(L)break;R+=T.decode(H,{stream:!0});let V;for(;(V=R.indexOf(`
`))!==-1;){let z=R.slice(0,V);if(R=R.slice(V+1),z.endsWith("\r")&&(z=z.slice(0,-1)),z.startsWith(":")||z.trim()===""||!z.startsWith("data: "))continue;const M=z.slice(6).trim();if(M==="[DONE]")break;try{const K=(O=(q=(E=JSON.parse(M).choices)==null?void 0:E[0])==null?void 0:q.delta)==null?void 0:O.content;K&&(k+=K,l(C=>{const A=C[C.length-1];return(A==null?void 0:A.role)==="assistant"?C.map((I,U)=>U===C.length-1?{...I,content:k}:I):[...C,{role:"assistant",content:k}]}))}catch{R=z+`
`+R;break}}}},y=async _=>{var P;if(!_.trim()||d)return;const S={role:"user",content:_.trim()};l(T=>[...T,S]),u(""),f(!0);try{await v([...o,S])}catch(T){console.error("Chat error:",T),ae.error(T instanceof Error?T.message:"Erreur de l'assistant"),l(R=>{const k=R[R.length-1];return(k==null?void 0:k.role)==="assistant"&&!k.content?R.slice(0,-1):R})}finally{f(!1),(P=h.current)==null||P.focus()}},b=_=>{_.preventDefault(),y(c)},N=_=>{y(_)};return r?s.jsxs(wL,{open:a,onOpenChange:i,children:[s.jsx(jL,{asChild:!0,children:e||s.jsxs(ne,{variant:"ghost",size:"sm",className:"flex items-center gap-1",children:[s.jsx(Dm,{className:"h-4 w-4"}),"Assistant"]})}),s.jsxs(qC,{side:t,className:"w-[400px] sm:w-[450px] p-0 flex flex-col",children:[s.jsx(UC,{className:"p-4 border-b bg-primary/5",children:s.jsxs(VC,{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(Dm,{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(su,{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(Mi,{className:"h-4 w-4 text-primary"}),"Comment puis-je vous aider ?"]}),s.jsx("div",{className:"grid gap-2",children:g.map((_,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(_.text),children:[s.jsx(_.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:_.category}),s.jsx("div",{className:"text-xs font-medium",children:_.text})]})]},S))})]}):s.jsxs("div",{className:"space-y-3",children:[o.map((_,S)=>s.jsxs("div",{className:`flex gap-2 ${_.role==="user"?"justify-end":"justify-start"}`,children:[_.role==="assistant"&&s.jsx(bs,{className:"h-6 w-6 shrink-0",children:s.jsx(ws,{className:"bg-primary/10 text-primary text-xs",children:s.jsx(Dm,{className:"h-3 w-3"})})}),s.jsx("div",{className:`max-w-[85%] rounded-xl px-3 py-2 ${_.role==="user"?"bg-primary text-primary-foreground":"bg-muted"}`,children:s.jsx("p",{className:"whitespace-pre-wrap text-xs",children:_.content})}),_.role==="user"&&s.jsx(bs,{className:"h-6 w-6 shrink-0",children:s.jsx(ws,{className:"bg-secondary text-xs",children:s.jsx(Ko,{className:"h-3 w-3"})})})]},S)),d&&((j=o[o.length-1])==null?void 0:j.role)==="user"&&s.jsxs("div",{className:"flex gap-2 justify-start",children:[s.jsx(bs,{className:"h-6 w-6 shrink-0",children:s.jsx(ws,{className:"bg-primary/10 text-primary text-xs",children:s.jsx(Dm,{className:"h-3 w-3"})})}),s.jsx("div",{className:"bg-muted rounded-xl px-3 py-2",children:s.jsx(it,{className:"h-3 w-3 animate-spin"})})]})]})}),s.jsxs("form",{onSubmit:b,className:"p-3 border-t bg-muted/30",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Xe,{ref:h,value:c,onChange:_=>u(_.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(it,{className:"h-4 w-4 animate-spin"}):s.jsx(Js,{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 _Ee=()=>{const{user:e,isAdmin:t,isTrainer:r,isSchool:n,signOut:a}=Br(),i=Zt(),o=cu(),[l,c]=w.useState(!1),u=p=>{if(c(!1),o.pathname!=="/")i("/",{state:{scrollTo:p}});else{const g=document.getElementById(p);g&&g.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(yr,{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(Ql,{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(wi,{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(yr,{className:"h-4 w-4"}),"Inscrire mon établissement"]})]}):s.jsxs(p5,{modal:!1,children:[s.jsx(x5,{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(Qu,{className:"h-3.5 w-3.5 opacity-60"})]})}),s.jsxs(Nw,{align:"start",className:"z-[100] bg-background border border-border shadow-lg min-w-[220px]",children:[s.jsxs(Io,{className:"cursor-pointer",onSelect:()=>d("/pour-les-ecoles"),children:[s.jsx(yr,{className:"mr-2 h-4 w-4"}),"Pour les établissements"]}),s.jsxs(Io,{className:"cursor-pointer",onSelect:()=>d("/constitution-de-programme"),children:[s.jsx(Ql,{className:"mr-2 h-4 w-4"}),"Constitution de programmes"]}),s.jsxs(Io,{className:"cursor-pointer",onSelect:()=>d("/offre-ecoles"),children:[s.jsx(Kt,{className:"mr-2 h-4 w-4"}),"Offre SaaS"]}),s.jsx(h4,{}),s.jsxs(Io,{className:"cursor-pointer font-medium text-primary",onSelect:()=>d("/school-register"),children:[s.jsx(yr,{className:"mr-2 h-4 w-4"}),"Inscrire mon établissement"]})]})]}),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:"Entreprises"}),s.jsxs("button",{type:"button",onClick:()=>d("/formation-entreprise"),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(Na,{className:"h-4 w-4 opacity-60"}),"Formation en entreprise"]}),s.jsxs("button",{type:"button",onClick:()=>d("/conseil-conduite-du-changement"),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(l6,{className:"h-4 w-4 opacity-60"}),"Conduite du changement"]}),s.jsxs("button",{type:"button",onClick:()=>d("/training-request?type=company"),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(yr,{className:"h-4 w-4"}),"Décrire mon besoin"]})]}):s.jsxs(p5,{modal:!1,children:[s.jsx(x5,{asChild:!0,children:s.jsxs("button",{className:"text-sm font-medium hover:text-primary transition-colors flex items-center gap-1",children:["Entreprises",s.jsx(Qu,{className:"h-3.5 w-3.5 opacity-60"})]})}),s.jsxs(Nw,{align:"start",className:"z-[100] bg-background border border-border shadow-lg min-w-[240px]",children:[s.jsxs(Io,{className:"cursor-pointer",onSelect:()=>d("/formation-entreprise"),children:[s.jsx(Na,{className:"mr-2 h-4 w-4"}),"Formation en entreprise"]}),s.jsxs(Io,{className:"cursor-pointer",onSelect:()=>d("/conseil-conduite-du-changement"),children:[s.jsx(l6,{className:"mr-2 h-4 w-4"}),"Conduite du changement"]}),s.jsx(h4,{}),s.jsxs(Io,{className:"cursor-pointer font-medium text-primary",onSelect:()=>d("/training-request?type=company"),children:[s.jsx(yr,{className:"mr-2 h-4 w-4"}),"Décrire mon besoin"]})]})]}),e&&s.jsx(jEe,{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(Dm,{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(yr,{className:"mr-2 h-4 w-4"}),"Mon Espace"]}),e&&s.jsx(Az,{}),t&&s.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>d("/admin"),children:[s.jsx(Jo,{className:"mr-2 h-4 w-4"}),"Administration"]}),r&&s.jsxs(p5,{modal:!1,children:[s.jsx(x5,{asChild:!0,children:s.jsxs(ne,{variant:"outline",size:"sm",children:[s.jsx(Ko,{className:"mr-2 h-4 w-4"}),"Mon Espace"]})}),s.jsxs(Nw,{align:"end",className:"z-[100] bg-background border border-border shadow-lg min-w-[200px]",children:[s.jsxs(Io,{className:"cursor-pointer",onSelect:()=>d("/trainer/profile"),children:[s.jsx(Ko,{className:"mr-2 h-4 w-4"}),"Mon Profil"]}),s.jsxs(Io,{className:"cursor-pointer",onSelect:()=>d("/trainer/planning"),children:[s.jsx(mh,{className:"mr-2 h-4 w-4"}),"Mon Planning"]}),s.jsxs(Io,{className:"cursor-pointer",onSelect:()=>d("/trainer/bpf"),children:[s.jsx(Ql,{className:"mr-2 h-4 w-4"}),"Mon BPF"]}),s.jsxs(Io,{className:"cursor-pointer",onSelect:()=>d("/trainer/applications"),children:[s.jsx(Qn,{className:"mr-2 h-4 w-4"}),"Mes Candidatures"]}),s.jsxs(Io,{className:"cursor-pointer",onSelect:()=>d("/trainer/messages"),children:[s.jsx(Fi,{className:"mr-2 h-4 w-4"}),"Messages"]}),s.jsxs(Io,{className:"cursor-pointer",onSelect:()=>d("/trainer/contract"),children:[s.jsx(Kt,{className:"mr-2 h-4 w-4"}),"Mon Contrat"]})]})]}),e?s.jsxs(ne,{onClick:f,variant:"ghost",size:"sm",children:[s.jsx(e9,{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"})]}),x=()=>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(Az,{})]}),n&&s.jsxs(ne,{variant:"outline",className:"w-full justify-start h-12",onClick:()=>d("/school/dashboard"),children:[s.jsx(yr,{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(Ko,{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(mh,{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(Ql,{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(Jo,{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(e9,{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:uz,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(wL,{open:l,onOpenChange:c,children:[s.jsx(jL,{asChild:!0,children:s.jsxs(ne,{variant:"ghost",size:"icon",className:"h-10 w-10",children:[s.jsx(Aye,{className:"h-6 w-6"}),s.jsx("span",{className:"sr-only",children:"Menu"})]})}),s.jsxs(qC,{side:"right",className:"w-[300px] sm:w-[350px] p-0",children:[s.jsx(UC,{className:"p-6 pb-4 border-b border-border",children:s.jsxs(VC,{className:"flex items-center gap-3",children:[s.jsx("img",{src:uz,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(x,{})]})]})]})]})]})})})},NEe=()=>{const e=Zt(),t=cu(),{data:r}=la({queryKey:["top-skills-footer"],queryFn:async()=>{const{data:i}=await ce.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(nt,{to:"/fonctionnalites",className:"hover:text-secondary transition-colors text-left",children:"Fonctionnalités"})}),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(nt,{to:"/ecoles",className:"hover:text-secondary transition-colors text-left",children:"Nos écoles"})}),s.jsx("li",{children:s.jsx(nt,{to:"/outils/planning-bpf",className:"hover:text-secondary transition-colors text-left",children:"Planning + BPF"})}),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(nt,{to:"/tarif-formateur",className:"hover:text-secondary transition-colors text-left",children:"Tarif d'un formateur"})}),s.jsx("li",{children:s.jsx(nt,{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("/formation-entreprise"),className:"hover:text-secondary transition-colors text-left",children:"Formation en entreprise"})}),s.jsx("li",{children:s.jsx("button",{onClick:()=>e("/conseil-conduite-du-changement"),className:"hover:text-secondary transition-colors text-left",children:"Conduite du changement"})}),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(nt,{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"})]})]})})},xse="pedagobridge_cookie_consent",Q6="pb_vid",e8="pb_vn",Ex="pb_sid",Pz=60*60*24*397,t8=60*30,SEe="pb:consent-changed",sw=e=>{if(typeof document>"u")return null;const t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):null},aw=(e,t,r)=>{if(typeof document>"u")return;const n=location.protocol==="https:"?"; Secure":"";document.cookie=`${e}=${encodeURIComponent(t)}; path=/; max-age=${r}; SameSite=Lax${n}`},kEe=e=>{typeof document>"u"||(document.cookie=`${e}=; path=/; max-age=0; SameSite=Lax`)},gse=()=>{if(typeof localStorage>"u")return"unset";const e=localStorage.getItem(xse);return e==="accepted"||e==="declined"?e:"unset"},zL=()=>gse()==="accepted",Oz=e=>{localStorage.setItem(xse,e),e==="declined"?[Q6,e8,Ex].forEach(kEe):yse(),window.dispatchEvent(new CustomEvent(SEe,{detail:e}))},g4=()=>typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2,11)}`;let vse=!1;function yse(){if(!zL())return null;let e=sw(Q6),t=Number(sw(e8)||"0");return e||(e=g4(),t=0,vse=!0),sw(Ex)?aw(Ex,sw(Ex),t8):(t+=1,aw(Ex,g4(),t8)),aw(Q6,e,Pz),aw(e8,String(t),Pz),{visitorId:e,visitNo:t}}function CEe(){if(zL()){const r=sw(Ex);if(r)return r;const n=g4();return aw(Ex,n,t8),n}const e="pb_session_id";let t=sessionStorage.getItem(e);return t||(t=g4(),sessionStorage.setItem(e,t)),t}function EEe(){const e=yse();return e?{visitor_id:e.visitorId,visit_no:e.visitNo,returning:e.visitNo>1&&!vse}:{}}function AEe(){const[e,t]=w.useState(!1);w.useEffect(()=>{if(gse()==="unset"){const a=setTimeout(()=>t(!0),1e3);return()=>clearTimeout(a)}},[]);const r=()=>{Oz("accepted"),t(!1)},n=()=>{Oz("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(xye,{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:["Nous utilisons des cookies de mesure d'audience pour comprendre comment le site est utilisé. Aucun cookie non essentiel n'est déposé tant que vous n'avez pas accepté, et vous pouvez refuser sans perdre l'accès au site. Détails dans notre"," ",s.jsx(nt,{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($i,{className:"h-4 w-4"})})]})})})}):null}const ba=({children:e})=>s.jsxs("div",{className:"min-h-screen flex flex-col",children:[s.jsx(_Ee,{}),s.jsx("main",{className:"flex-1 pt-16",children:e}),s.jsx(NEe,{}),s.jsx(AEe,{})]});class TEe extends ye.Component{constructor(r){super(r);Cn(this,"handleReload",()=>{window.location.reload()});this.state={hasError:!1,error:null}}static getDerivedStateFromError(r){return{hasError:!0,error:r}}componentDidCatch(r,n){Oi.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(td,{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(Qs,{className:"h-4 w-4"}),"Recharger la page"]}),!1]})}):this.props.children}}const PEe=/PedagoBridgePrerender|HeadlessChrome|Lighthouse|bot\b|crawler|spider|slurp|GPTBot|ClaudeBot|Claude-Web|PerplexityBot|Bytespider|AhrefsBot|SemrushBot|DataForSeo|facebookexternalhit|WhatsApp|Twitterbot|Discordbot|TelegramBot|Applebot|YandexBot|Baiduspider|DuckDuckBot|python-requests|axios|curl|wget|node-fetch/i,OEe=()=>typeof navigator>"u"||navigator.webdriver?!0:PEe.test(navigator.userAgent||""),DEe=new Set(["page_view"]);class IEe{async getCurrentUserId(){var t;try{const{data:r}=await ce.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={}}){if(!OEe()&&!(!zL()&&!DEe.has(t)))try{const o=await this.getCurrentUserId(),l=CEe();await ce.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,ua:(navigator.userAgent||"").slice(0,200),...EEe()}})}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,a="trainers"){const i=t.trim();i.length<2||await this.track({eventType:"search",eventName:`Search — ${a}`,metadata:{query:i.slice(0,120),filters:r,resultsCount:n,context:a}})}async trackFilterUsed(t,r,n,a="trainers"){!r||r==="all"||await this.track({eventType:"filter_used",eventName:`Filter — ${t}`,metadata:{filterName:t,value:String(r).slice(0,120),resultsCount:n,context:a}})}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 trackOfferCreated(t,r={}){await this.track({eventType:"offer_created",eventName:"Offre publiée",schoolRequestId:t,metadata:r})}async trackFeatureUse(t,r,n={}){await this.track({eventType:"feature_use",eventName:`${t} — ${r}`,metadata:{...n,feature:t,action:r}})}async trackLogin(t){await this.track({eventType:"login",eventName:"Connexion",metadata:{role:t}})}async trackProfileUpdate(t,r={}){await this.track({eventType:"profile_update",eventName:"Profil formateur enregistré",trainerProfileId:t,metadata:r})}async trackDocumentUpload(t,r){await this.track({eventType:"document_upload",eventName:`Document déposé — ${t}`,trainerProfileId:r,metadata:{docType:t}})}async trackContractStep(t,r={}){await this.track({eventType:"contract_step",eventName:`Contrat — ${t}`,metadata:{...r,step:t}})}async trackFormSubmit(t,r={}){await this.track({eventType:"form_submit",eventName:`Form — ${t}`,metadata:{...r,form:t}})}async trackContactInteraction(t,r,n={}){const a=t==="hover"?"contact_hover":t==="select"?"contact_select":"contact_copy";await this.track({eventType:a,eventName:`Contact ${t} — ${n.field??"unknown"}`,trainerProfileId:r,metadata:{...n,action:t}})}async trackNameCopied(t,r){await this.track({eventType:"name_copied",eventName:"Trainer Name Copied",trainerProfileId:t,metadata:{trainerName:r}})}}const dn=new IEe,REe="/assets/hero-training-Bapo3PNV.jpg",LEe=()=>{const e=Zt();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(${REe})`,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(Mye,{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(Zr,{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(er,{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(Zr,{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"})]})]})]})]})},je=w.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:yt("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));je.displayName="Card";const mt=w.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:yt("flex flex-col space-y-1.5 p-6",e),...t}));mt.displayName="CardHeader";const gt=w.forwardRef(({className:e,...t},r)=>s.jsx("h3",{ref:r,className:yt("text-2xl font-semibold leading-none tracking-tight",e),...t}));gt.displayName="CardTitle";const Kr=w.forwardRef(({className:e,...t},r)=>s.jsx("p",{ref:r,className:yt("text-sm text-muted-foreground",e),...t}));Kr.displayName="CardDescription";const Ee=w.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:yt("p-6 pt-0",e),...t}));Ee.displayName="CardContent";const bse=w.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:yt("flex items-center p-6 pt-0",e),...t}));bse.displayName="CardFooter";const FEe=[{icon:er,title:"Expertise Collective",description:"Une équipe de formateurs qualifiés et finement sélectionnés"},{icon:Sp,title:"Approche Personnalisée",description:"Des programmes sur mesure adaptés aux besoins spécifiques de chaque établissement"},{icon:lu,title:"Excellence Pédagogique",description:"Méthodes innovantes et éprouvées pour maximiser l'apprentissage"},{icon:FR,title:"Passion & Engagement",description:"Un collectif uni par la volonté de transmettre et de faire progresser"}],MEe=()=>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:FEe.map((e,t)=>{const r=e.icon;return s.jsxs(je,{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."})]})})]})}),$Ee=[{icon:OR,title:"Prix Transparent",description:"Trouver un formateur avec PedagoBridge ne coûte pas plus cher qu'une recherche classique"},{icon:lu,title:"Qualité Garantie",description:"Nous assurons la qualité pédagogique de chaque formateur par un processus de validation rigoureux"},{icon:Jo,title:"Garantie de Remplacement",description:"En cas d'urgence ou d'empêchement, nous garantissons un formateur de remplacement qualifié"},{icon:Hs,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"}],BEe=()=>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:$Ee.map((e,t)=>{const r=e.icon,n=s.jsxs(je,{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(Zr,{className:"h-4 w-4"})]})]});return e.link?s.jsx(nt,{to:e.link,className:"block group",children:n},t):s.jsx("div",{children:n},t)})})]})});function id({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(Te,{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(Jo,{className:a[e]}),"Certifié PedagoBridge"]});return t?s.jsx(z0,{children:s.jsxs(Kf,{children:[s.jsx(Xf,{asChild:!0,children:i}),s.jsx(qd,{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(lu,{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(Zn,{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(Zn,{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(Zn,{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(Zn,{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(no,{className:"h-3.5 w-3.5 text-amber-500"}),s.jsx("span",{children:"Prioritaire pour les missions et le support"})]})]})})]})}):i}const zEe={fluent:"Bilingue",advanced:"Anglais courant",intermediate:"Anglais intermédiaire",basic:"Anglais basique"},qEe={fluent:"Peut former entièrement en anglais",advanced:"Niveau professionnel C1/C2",intermediate:"Niveau B2",basic:"Notions de base"},wse=({level:e,className:t=""})=>!e||!["fluent","advanced"].includes(e)?null:s.jsx(z0,{children:s.jsxs(Kf,{children:[s.jsx(Xf,{asChild:!0,children:s.jsxs(Te,{variant:"outline",className:`bg-blue-50 text-blue-700 border-blue-200 gap-1 ${t}`,children:[s.jsx(kye,{className:"h-3 w-3"}),zEe[e]||"Anglophone"]})}),s.jsx(qd,{children:s.jsx("p",{children:qEe[e]||"Compétent en anglais"})})]})});function UEe(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 pT=24*60*60*1e3;function VEe(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*pT?r+=8:n>30*pT&&n<=90*pT&&(r+=4)}return e.referral_count&&e.referral_count>0&&(r+=Math.min(e.referral_count*4,12)),r}function Dz(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 Iz(e){return!e.country||e.country==="France"}function HEe(e,t,r){const n=Dz(e,r),a=Dz(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=Iz(e),c=Iz(t);if(l!==c)return l?-1:1;const u=e.view_count||0,d=t.view_count||0;if(u!==d)return d-u;const f=e.updated_at?new Date(e.updated_at).getTime():0,m=t.updated_at?new Date(t.updated_at).getTime():0;return f!==m?m-f:e.id<t.id?-1:e.id>t.id?1:0}function WEe(e,t,r=Date.now()){return{...e,isAffiliated:t.has(e.id)||!!e.manual_certified,completenessScore:UEe(e),engagementScore:VEe(e,r)}}function Zm(e,t,r){const n=Date.now();return e.map(a=>WEe(a,t,n)).sort((a,i)=>HEe(a,i,r))}const GEe=()=>{const e=Zt(),[t,r]=w.useState([]),[n,a]=w.useState(!0),i=10,o=async c=>{try{await ce.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([ce.rpc("get_public_trainer_profiles"),ce.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(x=>x.trainer_id))||[]),h=Zm(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(it,{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(je,{className:"hover:shadow-lg transition-all duration-300 border-border/50 group",children:s.jsxs(Ee,{className:"p-6 text-center",children:[s.jsxs(bs,{className:"w-24 h-24 mx-auto mb-4",children:[c.photo_url?s.jsx(ji,{src:c.photo_url,alt:c.name}):null,s.jsx(ws,{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(id,{size:"sm"})]}),c.english_level&&s.jsx("div",{className:"flex justify-center mb-1",children:s.jsx(wse,{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(Te,{variant:"secondary",className:"text-xs",children:u},d)),c.specialties.length>3&&s.jsxs(Te,{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(Zr,{className:"ml-2 h-4 w-4 group-hover:translate-x-1 transition-transform"})]})})]})})},xT=[{icon:DQ,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:FN,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:FN,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:FN,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:FN,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:Xj,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:Iye,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:Jo,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:Rye,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:jye,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:_l,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:FR,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:vye,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:Qn,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:Na,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:er,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:Hye,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"]}],KEe=()=>{const e=Zt(),[t,r]=w.useState({});w.useEffect(()=>{(async()=>{const{data:o,error:l}=await ce.from("trainer_profiles").select("specialties").eq("status","approved");if(l){console.error("Error fetching trainer specialties:",l);return}const c={};xT.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 x=!1;for(const p of xT)if(p.keywords.some(g=>h.includes(g)||g.includes(h))){c[p.name].add(m),x=!0;break}!x&&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:xT.map((i,o)=>{const l=i.icon,c=t[i.name]||i.topics;return s.jsxs(je,{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(Te,{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(Te,{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 QC(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 qL="Radio",[XEe,jse]=ei(qL),[YEe,ZEe]=XEe(qL),_se=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=Pr(t,g=>m(g)),x=w.useRef(!1),p=f?u||!!f.closest("form"):!0;return s.jsxs(YEe,{scope:r,checked:a,disabled:o,children:[s.jsx(Vt.button,{type:"button",role:"radio","aria-checked":a,"data-state":Cse(a),"data-disabled":o?"":void 0,disabled:o,value:l,...d,ref:h,onClick:Tt(e.onClick,g=>{a||c==null||c(),p&&(x.current=g.isPropagationStopped(),x.current||g.stopPropagation())})}),p&&s.jsx(kse,{control:f,bubbles:!x.current,name:n,value:l,checked:a,required:i,disabled:o,form:u,style:{transform:"translateX(-100%)"}})]})});_se.displayName=qL;var Nse="RadioIndicator",Sse=w.forwardRef((e,t)=>{const{__scopeRadio:r,forceMount:n,...a}=e,i=ZEe(Nse,r);return s.jsx(ti,{present:n||i.checked,children:s.jsx(Vt.span,{"data-state":Cse(i.checked),"data-disabled":i.disabled?"":void 0,...a,ref:t})})});Sse.displayName=Nse;var JEe="RadioBubbleInput",kse=w.forwardRef(({__scopeRadio:e,control:t,checked:r,bubbles:n=!0,...a},i)=>{const o=w.useRef(null),l=Pr(o,i),c=QC(r),u=SC(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 x=new Event("click",{bubbles:n});h.call(d,r),d.dispatchEvent(x)}},[c,r,n]),s.jsx(Vt.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}})});kse.displayName=JEe;function Cse(e){return e?"checked":"unchecked"}var QEe=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],eE="RadioGroup",[eAe]=ei(eE,[g1,jse]),Ese=g1(),Ase=jse(),[tAe,rAe]=eAe(eE),Tse=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=Ese(r),x=q0(u),[p,g]=Zo({prop:i,defaultProp:a??null,onChange:f,caller:eE});return s.jsx(tAe,{scope:r,name:n,required:o,disabled:l,value:p,onValueChange:g,children:s.jsx(_L,{asChild:!0,...h,orientation:c,dir:x,loop:d,children:s.jsx(Vt.div,{role:"radiogroup","aria-required":o,"aria-orientation":c,"data-disabled":l?"":void 0,dir:x,...m,ref:t})})})});Tse.displayName=eE;var Pse="RadioGroupItem",Ose=w.forwardRef((e,t)=>{const{__scopeRadioGroup:r,disabled:n,...a}=e,i=rAe(Pse,r),o=i.disabled||n,l=Ese(r),c=Ase(r),u=w.useRef(null),d=Pr(t,u),f=i.value===a.value,m=w.useRef(!1);return w.useEffect(()=>{const h=p=>{QEe.includes(p.key)&&(m.current=!0)},x=()=>m.current=!1;return document.addEventListener("keydown",h),document.addEventListener("keyup",x),()=>{document.removeEventListener("keydown",h),document.removeEventListener("keyup",x)}},[]),s.jsx(NL,{asChild:!0,...l,focusable:!o,active:f,children:s.jsx(_se,{disabled:o,required:i.required,checked:f,...c,...a,name:i.name,ref:d,onCheck:()=>i.onValueChange(a.value),onKeyDown:Tt(h=>{h.key==="Enter"&&h.preventDefault()}),onFocus:Tt(a.onFocus,()=>{var h;m.current&&((h=u.current)==null||h.click())})})})});Ose.displayName=Pse;var nAe="RadioGroupIndicator",Dse=w.forwardRef((e,t)=>{const{__scopeRadioGroup:r,...n}=e,a=Ase(r);return s.jsx(Sse,{...a,...n,ref:t})});Dse.displayName=nAe;var Ise=Tse,Rse=Ose,sAe=Dse;const Wx=w.forwardRef(({className:e,...t},r)=>s.jsx(Ise,{className:yt("grid gap-2",e),...t,ref:r}));Wx.displayName=Ise.displayName;const qo=w.forwardRef(({className:e,...t},r)=>s.jsx(Rse,{ref:r,className:yt("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(sAe,{className:"flex items-center justify-center",children:s.jsx(DR,{className:"h-2.5 w-2.5 fill-current text-current"})})}));qo.displayName=Rse.displayName;var aAe="Label",Lse=w.forwardRef((e,t)=>s.jsx(Vt.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())}}));Lse.displayName=aAe;var Fse=Lse;const iAe=r1("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),We=w.forwardRef(({className:e,...t},r)=>s.jsx(Fse,{ref:r,className:yt(iAe(),e),...t}));We.displayName=Fse.displayName;function kt(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 Ov extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Mse extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const $se={};function g0(e){return $se}function oAe(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 r8(e,t){return typeof t=="bigint"?t.toString():t}function UL(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function VL(e){return e==null}function HL(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}const Rz=Symbol("evaluating");function Ps(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Rz)return n===void 0&&(n=Rz,n=r()),n},set(a){Object.defineProperty(e,t,{value:a})},configurable:!0})}function H0(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function W0(...e){const t={};for(const r of e){const n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Lz(e){return JSON.stringify(e)}function lAe(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Bse="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function v4(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const cAe=UL(()=>{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 P2(e){if(v4(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const r=t.prototype;return!(v4(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function zse(e){return P2(e)?{...e}:Array.isArray(e)?[...e]:e}const uAe=new Set(["string","number","symbol"]);function wy(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Pp(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 Vr(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 dAe(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function fAe(e,t){const r=e._zod.def,n=W0(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 H0(this,"shape",a),a},checks:[]});return Pp(e,n)}function hAe(e,t){const r=e._zod.def,n=W0(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 H0(this,"shape",a),a},checks:[]});return Pp(e,n)}function mAe(e,t){if(!P2(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=W0(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return H0(this,"shape",i),i},checks:[]});return Pp(e,a)}function pAe(e,t){if(!P2(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 H0(this,"shape",n),n},checks:e._zod.def.checks};return Pp(e,r)}function xAe(e,t){const r=W0(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return H0(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return Pp(e,r)}function gAe(e,t,r){const n=W0(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 H0(this,"shape",i),i},checks:[]});return Pp(t,n)}function vAe(e,t,r){const n=W0(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 H0(this,"shape",i),i},checks:[]});return Pp(t,n)}function uv(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 qse(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function rS(e){return typeof e=="string"?e:e==null?void 0:e.message}function v0(e,t,r){var a,i,o,l,c,u;const n={...e,path:e.path??[]};if(!e.message){const d=rS((o=(i=(a=e.inst)==null?void 0:a._zod.def)==null?void 0:i.error)==null?void 0:o.call(i,e))??rS((l=t==null?void 0:t.error)==null?void 0:l.call(t,e))??rS((c=r.customError)==null?void 0:c.call(r,e))??rS((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 WL(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function O2(...e){const[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}const Use=(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,r8,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Vse=kt("$ZodError",Use),Hse=kt("$ZodError",Use,{Parent:Error});function yAe(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 bAe(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 GL=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 Ov;if(o.issues.length){const l=new((a==null?void 0:a.Err)??e)(o.issues.map(c=>v0(c,i,g0())));throw Bse(l,a==null?void 0:a.callee),l}return o.value},KL=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=>v0(c,i,g0())));throw Bse(l,a==null?void 0:a.callee),l}return o.value},tE=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 Ov;return i.issues.length?{success:!1,error:new(e??Vse)(i.issues.map(o=>v0(o,a,g0())))}:{success:!0,data:i.value}},wAe=tE(Hse),rE=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=>v0(o,a,g0())))}:{success:!0,data:i.value}},jAe=rE(Hse),_Ae=e=>(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return GL(e)(t,r,a)},NAe=e=>(t,r,n)=>GL(e)(t,r,n),SAe=e=>async(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return KL(e)(t,r,a)},kAe=e=>async(t,r,n)=>KL(e)(t,r,n),CAe=e=>(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return tE(e)(t,r,a)},EAe=e=>(t,r,n)=>tE(e)(t,r,n),AAe=e=>async(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return rE(e)(t,r,a)},TAe=e=>async(t,r,n)=>rE(e)(t,r,n),PAe=/^[cC][^\s-]{8,}$/,OAe=/^[0-9a-z]+$/,DAe=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,IAe=/^[0-9a-vA-V]{20}$/,RAe=/^[A-Za-z0-9]{27}$/,LAe=/^[a-zA-Z0-9_-]{21}$/,FAe=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,MAe=/^([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)$/,$Ae=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,BAe="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function zAe(){return new RegExp(BAe,"u")}const qAe=/^(?:(?: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])$/,UAe=/^(([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}|:))$/,VAe=/^((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])$/,HAe=/^(([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])$/,WAe=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Wse=/^[A-Za-z0-9_-]*$/,GAe=/^\+(?:[0-9]){6,14}[0-9]$/,Gse="(?:(?:\\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])))",KAe=new RegExp(`^${Gse}$`);function Kse(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 XAe(e){return new RegExp(`^${Kse(e)}$`)}function YAe(e){const t=Kse({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(`^${Gse}T(?:${n})$`)}const ZAe=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}$`)},JAe=/^[^A-Z]*$/,QAe=/^[^a-z]*$/,cf=kt("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),e3e=kt("$ZodCheckMaxLength",(e,t)=>{var r;cf.init(e,t),(r=e._zod.def).when??(r.when=n=>{const a=n.value;return!VL(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=WL(a);n.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),t3e=kt("$ZodCheckMinLength",(e,t)=>{var r;cf.init(e,t),(r=e._zod.def).when??(r.when=n=>{const a=n.value;return!VL(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=WL(a);n.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),r3e=kt("$ZodCheckLengthEquals",(e,t)=>{var r;cf.init(e,t),(r=e._zod.def).when??(r.when=n=>{const a=n.value;return!VL(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=WL(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})}}),nE=kt("$ZodCheckStringFormat",(e,t)=>{var r,n;cf.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=()=>{})}),n3e=kt("$ZodCheckRegex",(e,t)=>{nE.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})}}),s3e=kt("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=JAe),nE.init(e,t)}),a3e=kt("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=QAe),nE.init(e,t)}),i3e=kt("$ZodCheckIncludes",(e,t)=>{cf.init(e,t);const r=wy(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})}}),o3e=kt("$ZodCheckStartsWith",(e,t)=>{cf.init(e,t);const r=new RegExp(`^${wy(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})}}),l3e=kt("$ZodCheckEndsWith",(e,t)=>{cf.init(e,t);const r=new RegExp(`.*${wy(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})}}),c3e=kt("$ZodCheckOverwrite",(e,t)=>{cf.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class u3e{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 d3e={major:4,minor:1,patch:13},ni=kt("$ZodType",(e,t)=>{var a;var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=d3e;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=uv(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,x=m._zod.check(l);if(x instanceof Promise&&(u==null?void 0:u.async)===!1)throw new Ov;if(f||x instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await x,l.issues.length!==h&&(d||(d=uv(l,h)))});else{if(l.issues.length===h)continue;d||(d=uv(l,h))}}return f?f.then(()=>l):l},o=(l,c,u)=>{if(uv(l))return l.aborted=!0,l;const d=i(c,n,u);if(d instanceof Promise){if(u.async===!1)throw new Ov;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 Ov;return u.then(d=>i(d,n,c))}return i(u,n,c)}}e["~standard"]={validate:i=>{var o;try{const l=wAe(e,i);return l.success?{value:l.data}:{issues:(o=l.error)==null?void 0:o.issues}}catch{return jAe(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}}),XL=kt("$ZodString",(e,t)=>{var r;ni.init(e,t),e._zod.pattern=[...((r=e==null?void 0:e._zod.bag)==null?void 0:r.patterns)??[]].pop()??ZAe(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}}),ea=kt("$ZodStringFormat",(e,t)=>{nE.init(e,t),XL.init(e,t)}),f3e=kt("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=MAe),ea.init(e,t)}),h3e=kt("$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());ea.init(e,t)}),m3e=kt("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=$Ae),ea.init(e,t)}),p3e=kt("$ZodURL",(e,t)=>{ea.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})}}}),x3e=kt("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=zAe()),ea.init(e,t)}),g3e=kt("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=LAe),ea.init(e,t)}),v3e=kt("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=PAe),ea.init(e,t)}),y3e=kt("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=OAe),ea.init(e,t)}),b3e=kt("$ZodULID",(e,t)=>{t.pattern??(t.pattern=DAe),ea.init(e,t)}),w3e=kt("$ZodXID",(e,t)=>{t.pattern??(t.pattern=IAe),ea.init(e,t)}),j3e=kt("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=RAe),ea.init(e,t)}),_3e=kt("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=YAe(t)),ea.init(e,t)}),N3e=kt("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=KAe),ea.init(e,t)}),S3e=kt("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=XAe(t)),ea.init(e,t)}),k3e=kt("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=FAe),ea.init(e,t)}),C3e=kt("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=qAe),ea.init(e,t),e._zod.bag.format="ipv4"}),E3e=kt("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=UAe),ea.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})}}}),A3e=kt("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=VAe),ea.init(e,t)}),T3e=kt("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=HAe),ea.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 Xse(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const P3e=kt("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=WAe),ea.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Xse(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function O3e(e){if(!Wse.test(e))return!1;const t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Xse(r)}const D3e=kt("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Wse),ea.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{O3e(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),I3e=kt("$ZodE164",(e,t)=>{t.pattern??(t.pattern=GAe),ea.init(e,t)});function R3e(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 L3e=kt("$ZodJWT",(e,t)=>{ea.init(e,t),e._zod.check=r=>{R3e(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),F3e=kt("$ZodUnknown",(e,t)=>{ni.init(e,t),e._zod.parse=r=>r}),M3e=kt("$ZodNever",(e,t)=>{ni.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function Mz(e,t,r){e.issues.length&&t.issues.push(...qse(r,e.issues)),t.value[r]=e.value}const $3e=kt("$ZodArray",(e,t)=>{ni.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=>Mz(u,r,o))):Mz(c,r,o)}return i.length?Promise.all(i).then(()=>r):r}});function y4(e,t,r,n){e.issues.length&&t.issues.push(...qse(r,e.issues)),e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function Yse(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=dAe(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Zse(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=>y4(m,r,d,t))):y4(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 B3e=kt("$ZodObject",(e,t)=>{ni.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=UL(()=>Yse(t));Ps(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=v4,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 x=f[m]._zod.run({value:u[m],issues:[]},c);x instanceof Promise?d.push(x.then(p=>y4(p,l,m,u))):y4(x,l,m,u)}return i?Zse(d,u,l,c,n.value,e):d.length?Promise.all(d).then(()=>l):l}}),z3e=kt("$ZodObjectJIT",(e,t)=>{B3e.init(e,t);const r=e._zod.parse,n=UL(()=>Yse(t)),a=m=>{const h=new u3e(["shape","payload","ctx"]),x=n.value,p=b=>{const N=Lz(b);return`shape[${N}]._zod.run({ value: input[${N}], issues: [] }, ctx)`};h.write("const input = payload.value;");const g=Object.create(null);let v=0;for(const b of x.keys)g[b]=`key_${v++}`;h.write("const newResult = {};");for(const b of x.keys){const N=g[b],j=Lz(b);h.write(`const ${N} = ${p(b)};`),h.write(`
if (${N}.issues.length) {
payload.issues = payload.issues.concat(${N}.issues.map(iss => ({
...iss,
path: iss.path ? [${j}, ...iss.path] : [${j}]
})));
}
if (${N}.value === undefined) {
if (${j} in input) {
newResult[${j}] = undefined;
}
} else {
newResult[${j}] = ${N}.value;
}
`)}h.write("payload.value = newResult;"),h.write("return payload;");const y=h.compile();return(b,N)=>y(m,b,N)};let i;const o=v4,l=!$se.jitless,u=l&&cAe.value,d=t.catchall;let f;e._zod.parse=(m,h)=>{f??(f=n.value);const x=m.value;return o(x)?l&&u&&(h==null?void 0:h.async)===!1&&h.jitless!==!0?(i||(i=a(t.shape)),m=i(m,h),d?Zse([],x,m,h,f,e):m):r(m,h):(m.issues.push({expected:"object",code:"invalid_type",input:x,inst:e}),m)}});function $z(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=>!uv(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=>v0(o,n,g0())))}),t)}const q3e=kt("$ZodUnion",(e,t)=>{ni.init(e,t),Ps(e._zod,"optin",()=>t.options.some(a=>a._zod.optin==="optional")?"optional":void 0),Ps(e._zod,"optout",()=>t.options.some(a=>a._zod.optout==="optional")?"optional":void 0),Ps(e._zod,"values",()=>{if(t.options.every(a=>a._zod.values))return new Set(t.options.flatMap(a=>Array.from(a._zod.values)))}),Ps(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=>HL(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=>$z(c,a,e,i)):$z(l,a,e,i)}}),U3e=kt("$ZodIntersection",(e,t)=>{ni.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])=>Bz(r,c,u)):Bz(r,i,o)}});function n8(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(P2(e)&&P2(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=n8(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=n8(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 Bz(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),uv(e))return e;const n=n8(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 V3e=kt("$ZodEnum",(e,t)=>{ni.init(e,t);const r=oAe(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(a=>uAe.has(typeof a)).map(a=>typeof a=="string"?wy(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}}),H3e=kt("$ZodLiteral",(e,t)=>{if(ni.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"?wy(n):n?wy(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}}),W3e=kt("$ZodTransform",(e,t)=>{ni.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Mse(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 Ov;return r.value=a,r}});function zz(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const G3e=kt("$ZodOptional",(e,t)=>{ni.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Ps(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Ps(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${HL(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=>zz(i,r.value)):zz(a,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),K3e=kt("$ZodNullable",(e,t)=>{ni.init(e,t),Ps(e._zod,"optin",()=>t.innerType._zod.optin),Ps(e._zod,"optout",()=>t.innerType._zod.optout),Ps(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${HL(r.source)}|null)$`):void 0}),Ps(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)}),X3e=kt("$ZodDefault",(e,t)=>{ni.init(e,t),e._zod.optin="optional",Ps(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=>qz(i,t)):qz(a,t)}});function qz(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Y3e=kt("$ZodPrefault",(e,t)=>{ni.init(e,t),e._zod.optin="optional",Ps(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))}),Z3e=kt("$ZodNonOptional",(e,t)=>{ni.init(e,t),Ps(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=>Uz(i,e)):Uz(a,e)}});function Uz(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 J3e=kt("$ZodCatch",(e,t)=>{ni.init(e,t),Ps(e._zod,"optin",()=>t.innerType._zod.optin),Ps(e._zod,"optout",()=>t.innerType._zod.optout),Ps(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=>v0(o,n,g0()))},input:r.value}),r.issues=[]),r)):(r.value=a.value,a.issues.length&&(r.value=t.catchValue({...r,error:{issues:a.issues.map(i=>v0(i,n,g0()))},input:r.value}),r.issues=[]),r)}}),Q3e=kt("$ZodPipe",(e,t)=>{ni.init(e,t),Ps(e._zod,"values",()=>t.in._zod.values),Ps(e._zod,"optin",()=>t.in._zod.optin),Ps(e._zod,"optout",()=>t.out._zod.optout),Ps(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=>nS(o,t.in,n)):nS(i,t.in,n)}const a=t.in._zod.run(r,n);return a instanceof Promise?a.then(i=>nS(i,t.out,n)):nS(a,t.out,n)}});function nS(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const eTe=kt("$ZodReadonly",(e,t)=>{ni.init(e,t),Ps(e._zod,"propValues",()=>t.innerType._zod.propValues),Ps(e._zod,"values",()=>t.innerType._zod.values),Ps(e._zod,"optin",()=>{var r,n;return(n=(r=t.innerType)==null?void 0:r._zod)==null?void 0:n.optin}),Ps(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(Vz):Vz(a)}});function Vz(e){return e.value=Object.freeze(e.value),e}const tTe=kt("$ZodCustom",(e,t)=>{cf.init(e,t),ni.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=>Hz(i,r,n,e));Hz(a,r,n,e)}});function Hz(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(O2(a))}}var Wz;class rTe{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 nTe(){return new rTe}(Wz=globalThis).__zod_globalRegistry??(Wz.__zod_globalRegistry=nTe());const sS=globalThis.__zod_globalRegistry;function sTe(e,t){return new e({type:"string",...Vr(t)})}function aTe(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Vr(t)})}function Gz(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Vr(t)})}function iTe(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Vr(t)})}function oTe(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Vr(t)})}function lTe(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Vr(t)})}function cTe(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Vr(t)})}function uTe(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Vr(t)})}function dTe(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Vr(t)})}function fTe(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Vr(t)})}function hTe(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Vr(t)})}function mTe(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Vr(t)})}function pTe(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Vr(t)})}function xTe(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Vr(t)})}function gTe(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Vr(t)})}function vTe(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Vr(t)})}function yTe(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Vr(t)})}function bTe(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Vr(t)})}function wTe(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Vr(t)})}function jTe(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Vr(t)})}function _Te(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Vr(t)})}function NTe(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Vr(t)})}function STe(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Vr(t)})}function kTe(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Vr(t)})}function CTe(e,t){return new e({type:"string",format:"date",check:"string_format",...Vr(t)})}function ETe(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Vr(t)})}function ATe(e,t){return new e({type:"string",format:"duration",check:"string_format",...Vr(t)})}function TTe(e){return new e({type:"unknown"})}function PTe(e,t){return new e({type:"never",...Vr(t)})}function Jse(e,t){return new e3e({check:"max_length",...Vr(t),maximum:e})}function b4(e,t){return new t3e({check:"min_length",...Vr(t),minimum:e})}function Qse(e,t){return new r3e({check:"length_equals",...Vr(t),length:e})}function OTe(e,t){return new n3e({check:"string_format",format:"regex",...Vr(t),pattern:e})}function DTe(e){return new s3e({check:"string_format",format:"lowercase",...Vr(e)})}function ITe(e){return new a3e({check:"string_format",format:"uppercase",...Vr(e)})}function RTe(e,t){return new i3e({check:"string_format",format:"includes",...Vr(t),includes:e})}function LTe(e,t){return new o3e({check:"string_format",format:"starts_with",...Vr(t),prefix:e})}function FTe(e,t){return new l3e({check:"string_format",format:"ends_with",...Vr(t),suffix:e})}function y1(e){return new c3e({check:"overwrite",tx:e})}function MTe(e){return y1(t=>t.normalize(e))}function $Te(){return y1(e=>e.trim())}function BTe(){return y1(e=>e.toLowerCase())}function zTe(){return y1(e=>e.toUpperCase())}function qTe(){return y1(e=>lAe(e))}function UTe(e,t,r){return new e({type:"array",element:t,...Vr(r)})}function VTe(e,t,r){return new e({type:"custom",check:"custom",fn:t,...Vr(r)})}function HTe(e){const t=WTe(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(O2(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(O2(a))}},e(r.value,r)));return t}function WTe(e,t){const r=new cf({check:"custom",...Vr(t)});return r._zod.check=e,r}const GTe=kt("ZodISODateTime",(e,t)=>{_3e.init(e,t),ua.init(e,t)});function KTe(e){return kTe(GTe,e)}const XTe=kt("ZodISODate",(e,t)=>{N3e.init(e,t),ua.init(e,t)});function YTe(e){return CTe(XTe,e)}const ZTe=kt("ZodISOTime",(e,t)=>{S3e.init(e,t),ua.init(e,t)});function JTe(e){return ETe(ZTe,e)}const QTe=kt("ZodISODuration",(e,t)=>{k3e.init(e,t),ua.init(e,t)});function ePe(e){return ATe(QTe,e)}const eae=(e,t)=>{Vse.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>bAe(e,r)},flatten:{value:r=>yAe(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,r8,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,r8,2)}},isEmpty:{get(){return e.issues.length===0}}})},Kz=kt("ZodError",eae),du=kt("ZodError",eae,{Parent:Error}),tPe=GL(du),rPe=KL(du),nPe=tE(du),sPe=rE(du),aPe=_Ae(du),iPe=NAe(du),oPe=SAe(du),lPe=kAe(du),cPe=CAe(du),uPe=EAe(du),dPe=AAe(du),fPe=TAe(du),Ni=kt("ZodType",(e,t)=>(ni.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(W0(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]})),e.clone=(r,n)=>Pp(e,r,n),e.brand=()=>e,e.register=(r,n)=>(r.add(e,n),e),e.parse=(r,n)=>tPe(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>nPe(e,r,n),e.parseAsync=async(r,n)=>rPe(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>sPe(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>aPe(e,r,n),e.decode=(r,n)=>iPe(e,r,n),e.encodeAsync=async(r,n)=>oPe(e,r,n),e.decodeAsync=async(r,n)=>lPe(e,r,n),e.safeEncode=(r,n)=>cPe(e,r,n),e.safeDecode=(r,n)=>uPe(e,r,n),e.safeEncodeAsync=async(r,n)=>dPe(e,r,n),e.safeDecodeAsync=async(r,n)=>fPe(e,r,n),e.refine=(r,n)=>e.check(rOe(r,n)),e.superRefine=r=>e.check(nOe(r)),e.overwrite=r=>e.check(y1(r)),e.optional=()=>Zz(e),e.nullable=()=>Jz(e),e.nullish=()=>Zz(Jz(e)),e.nonoptional=r=>XPe(e,r),e.array=()=>rae(e),e.or=r=>FPe([e,r]),e.and=r=>$Pe(e,r),e.transform=r=>Qz(e,UPe(r)),e.default=r=>WPe(e,r),e.prefault=r=>KPe(e,r),e.catch=r=>ZPe(e,r),e.pipe=r=>Qz(e,r),e.readonly=()=>eOe(e),e.describe=r=>{const n=e.clone();return sS.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){var r;return(r=sS.get(e))==null?void 0:r.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return sS.get(e);const n=e.clone();return sS.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),tae=kt("_ZodString",(e,t)=>{XL.init(e,t),Ni.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(OTe(...n)),e.includes=(...n)=>e.check(RTe(...n)),e.startsWith=(...n)=>e.check(LTe(...n)),e.endsWith=(...n)=>e.check(FTe(...n)),e.min=(...n)=>e.check(b4(...n)),e.max=(...n)=>e.check(Jse(...n)),e.length=(...n)=>e.check(Qse(...n)),e.nonempty=(...n)=>e.check(b4(1,...n)),e.lowercase=n=>e.check(DTe(n)),e.uppercase=n=>e.check(ITe(n)),e.trim=()=>e.check($Te()),e.normalize=(...n)=>e.check(MTe(...n)),e.toLowerCase=()=>e.check(BTe()),e.toUpperCase=()=>e.check(zTe()),e.slugify=()=>e.check(qTe())}),hPe=kt("ZodString",(e,t)=>{XL.init(e,t),tae.init(e,t),e.email=r=>e.check(aTe(mPe,r)),e.url=r=>e.check(uTe(pPe,r)),e.jwt=r=>e.check(STe(TPe,r)),e.emoji=r=>e.check(dTe(xPe,r)),e.guid=r=>e.check(Gz(Xz,r)),e.uuid=r=>e.check(iTe(aS,r)),e.uuidv4=r=>e.check(oTe(aS,r)),e.uuidv6=r=>e.check(lTe(aS,r)),e.uuidv7=r=>e.check(cTe(aS,r)),e.nanoid=r=>e.check(fTe(gPe,r)),e.guid=r=>e.check(Gz(Xz,r)),e.cuid=r=>e.check(hTe(vPe,r)),e.cuid2=r=>e.check(mTe(yPe,r)),e.ulid=r=>e.check(pTe(bPe,r)),e.base64=r=>e.check(jTe(CPe,r)),e.base64url=r=>e.check(_Te(EPe,r)),e.xid=r=>e.check(xTe(wPe,r)),e.ksuid=r=>e.check(gTe(jPe,r)),e.ipv4=r=>e.check(vTe(_Pe,r)),e.ipv6=r=>e.check(yTe(NPe,r)),e.cidrv4=r=>e.check(bTe(SPe,r)),e.cidrv6=r=>e.check(wTe(kPe,r)),e.e164=r=>e.check(NTe(APe,r)),e.datetime=r=>e.check(KTe(r)),e.date=r=>e.check(YTe(r)),e.time=r=>e.check(JTe(r)),e.duration=r=>e.check(ePe(r))});function yn(e){return sTe(hPe,e)}const ua=kt("ZodStringFormat",(e,t)=>{ea.init(e,t),tae.init(e,t)}),mPe=kt("ZodEmail",(e,t)=>{m3e.init(e,t),ua.init(e,t)}),Xz=kt("ZodGUID",(e,t)=>{f3e.init(e,t),ua.init(e,t)}),aS=kt("ZodUUID",(e,t)=>{h3e.init(e,t),ua.init(e,t)}),pPe=kt("ZodURL",(e,t)=>{p3e.init(e,t),ua.init(e,t)}),xPe=kt("ZodEmoji",(e,t)=>{x3e.init(e,t),ua.init(e,t)}),gPe=kt("ZodNanoID",(e,t)=>{g3e.init(e,t),ua.init(e,t)}),vPe=kt("ZodCUID",(e,t)=>{v3e.init(e,t),ua.init(e,t)}),yPe=kt("ZodCUID2",(e,t)=>{y3e.init(e,t),ua.init(e,t)}),bPe=kt("ZodULID",(e,t)=>{b3e.init(e,t),ua.init(e,t)}),wPe=kt("ZodXID",(e,t)=>{w3e.init(e,t),ua.init(e,t)}),jPe=kt("ZodKSUID",(e,t)=>{j3e.init(e,t),ua.init(e,t)}),_Pe=kt("ZodIPv4",(e,t)=>{C3e.init(e,t),ua.init(e,t)}),NPe=kt("ZodIPv6",(e,t)=>{E3e.init(e,t),ua.init(e,t)}),SPe=kt("ZodCIDRv4",(e,t)=>{A3e.init(e,t),ua.init(e,t)}),kPe=kt("ZodCIDRv6",(e,t)=>{T3e.init(e,t),ua.init(e,t)}),CPe=kt("ZodBase64",(e,t)=>{P3e.init(e,t),ua.init(e,t)}),EPe=kt("ZodBase64URL",(e,t)=>{D3e.init(e,t),ua.init(e,t)}),APe=kt("ZodE164",(e,t)=>{I3e.init(e,t),ua.init(e,t)}),TPe=kt("ZodJWT",(e,t)=>{L3e.init(e,t),ua.init(e,t)}),PPe=kt("ZodUnknown",(e,t)=>{F3e.init(e,t),Ni.init(e,t)});function Yz(){return TTe(PPe)}const OPe=kt("ZodNever",(e,t)=>{M3e.init(e,t),Ni.init(e,t)});function DPe(e){return PTe(OPe,e)}const IPe=kt("ZodArray",(e,t)=>{$3e.init(e,t),Ni.init(e,t),e.element=t.element,e.min=(r,n)=>e.check(b4(r,n)),e.nonempty=r=>e.check(b4(1,r)),e.max=(r,n)=>e.check(Jse(r,n)),e.length=(r,n)=>e.check(Qse(r,n)),e.unwrap=()=>e.element});function rae(e,t){return UTe(IPe,e,t)}const RPe=kt("ZodObject",(e,t)=>{z3e.init(e,t),Ni.init(e,t),Ps(e,"shape",()=>t.shape),e.keyof=()=>nae(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Yz()}),e.loose=()=>e.clone({...e._zod.def,catchall:Yz()}),e.strict=()=>e.clone({...e._zod.def,catchall:DPe()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>mAe(e,r),e.safeExtend=r=>pAe(e,r),e.merge=r=>xAe(e,r),e.pick=r=>fAe(e,r),e.omit=r=>hAe(e,r),e.partial=(...r)=>gAe(sae,e,r[0]),e.required=(...r)=>vAe(aae,e,r[0])});function G0(e,t){const r={type:"object",shape:e??{},...Vr(t)};return new RPe(r)}const LPe=kt("ZodUnion",(e,t)=>{q3e.init(e,t),Ni.init(e,t),e.options=t.options});function FPe(e,t){return new LPe({type:"union",options:e,...Vr(t)})}const MPe=kt("ZodIntersection",(e,t)=>{U3e.init(e,t),Ni.init(e,t)});function $Pe(e,t){return new MPe({type:"intersection",left:e,right:t})}const s8=kt("ZodEnum",(e,t)=>{V3e.init(e,t),Ni.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 s8({...t,checks:[],...Vr(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 s8({...t,checks:[],...Vr(a),entries:i})}});function nae(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new s8({type:"enum",entries:r,...Vr(t)})}const BPe=kt("ZodLiteral",(e,t)=>{H3e.init(e,t),Ni.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 zPe(e,t){return new BPe({type:"literal",values:Array.isArray(e)?e:[e],...Vr(t)})}const qPe=kt("ZodTransform",(e,t)=>{W3e.init(e,t),Ni.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Mse(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(O2(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(O2(o))}};const a=t.transform(r.value,r);return a instanceof Promise?a.then(i=>(r.value=i,r)):(r.value=a,r)}});function UPe(e){return new qPe({type:"transform",transform:e})}const sae=kt("ZodOptional",(e,t)=>{G3e.init(e,t),Ni.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Zz(e){return new sae({type:"optional",innerType:e})}const VPe=kt("ZodNullable",(e,t)=>{K3e.init(e,t),Ni.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Jz(e){return new VPe({type:"nullable",innerType:e})}const HPe=kt("ZodDefault",(e,t)=>{X3e.init(e,t),Ni.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function WPe(e,t){return new HPe({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():zse(t)}})}const GPe=kt("ZodPrefault",(e,t)=>{Y3e.init(e,t),Ni.init(e,t),e.unwrap=()=>e._zod.def.innerType});function KPe(e,t){return new GPe({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():zse(t)}})}const aae=kt("ZodNonOptional",(e,t)=>{Z3e.init(e,t),Ni.init(e,t),e.unwrap=()=>e._zod.def.innerType});function XPe(e,t){return new aae({type:"nonoptional",innerType:e,...Vr(t)})}const YPe=kt("ZodCatch",(e,t)=>{J3e.init(e,t),Ni.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function ZPe(e,t){return new YPe({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const JPe=kt("ZodPipe",(e,t)=>{Q3e.init(e,t),Ni.init(e,t),e.in=t.in,e.out=t.out});function Qz(e,t){return new JPe({type:"pipe",in:e,out:t})}const QPe=kt("ZodReadonly",(e,t)=>{eTe.init(e,t),Ni.init(e,t),e.unwrap=()=>e._zod.def.innerType});function eOe(e){return new QPe({type:"readonly",innerType:e})}const tOe=kt("ZodCustom",(e,t)=>{tTe.init(e,t),Ni.init(e,t)});function rOe(e,t={}){return VTe(tOe,e,t)}function nOe(e){return HTe(e)}const eq=G0({contactType:nae(["establishment","trainer"]),name:yn().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:yn().trim().email("Email invalide").max(255,"L'email ne peut pas dépasser 255 caractères"),message:yn().trim().max(2e3,"Le message ne peut pas dépasser 2000 caractères").optional()});G0({schoolName:yn().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:yn().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:yn().trim().email("Email invalide").max(255,"L'email ne peut pas dépasser 255 caractères"),contactPhone:yn().trim().max(20,"Le téléphone ne peut pas dépasser 20 caractères").optional(),contactPosition:yn().trim().max(100,"Le poste ne peut pas dépasser 100 caractères").optional(),trainingNeeds:rae(yn().trim().max(200)).min(1,"Ajoutez au moins un besoin en formation").max(20,"Maximum 20 besoins"),startDate:yn().optional(),endDate:yn().optional(),durationHours:yn().optional(),numTrainers:yn().optional(),estimatedBudget:yn().trim().max(100,"Le budget ne peut pas dépasser 100 caractères").optional(),description:yn().trim().min(20,"La description doit contenir au moins 20 caractères").max(5e3,"La description ne peut pas dépasser 5000 caractères")});G0({name:yn().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:yn().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:yn()}).refine(e=>e.password===e.confirmPassword,{message:"Les mots de passe ne correspondent pas",path:["confirmPassword"]});const sOe=G0({email:yn().trim().email("Email invalide").max(255,"L'email ne peut pas dépasser 255 caractères")});G0({email:yn().trim().email("Email invalide").max(255,"L'email ne peut pas dépasser 255 caractères"),password:yn().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 YL(e){const{schema:t,fieldLabels:r={}}=e,[n,a]=w.useState({}),[i,o]=w.useState(new Set),l=w.useRef(null),c=w.useCallback((g,v,y)=>{try{return y&&t.parse(y),a(b=>{const N={...b};return delete N[g],N}),!0}catch(b){if(b instanceof Kz){const N=b.issues.find(j=>j.path[0]===g);if(N){const j=r[g]||g;let _=N.message;return _.toLowerCase().includes("required")||_.toLowerCase().includes("requis")?_=`${j} est requis`:_.includes(j)||(_=`${j} : ${_}`),a(S=>({...S,[g]:{message:_,touched:!0}})),!1}}return!0}},[t,r]),u=w.useCallback((g,v,y)=>{o(b=>new Set(b).add(g)),c(g,v,y)},[c]),d=w.useCallback(g=>{try{return t.parse(g),a({}),!0}catch(v){if(v instanceof Kz){const y={};return v.issues.forEach(b=>{var S;const N=((S=b.path[0])==null?void 0:S.toString())||"",j=r[N]||N;let _=b.message;_.toLowerCase().includes("required")||_.toLowerCase().includes("requis")?_=`${j} est requis`:_.includes(j)||(_=`${j} : ${_}`),y[N]={message:_,touched:!0}}),a(y),f(Object.keys(y)[0]),!1}return!1}},[t,r]),f=w.useCallback(g=>{g&&setTimeout(()=>{var y;const v=document.querySelector(`[data-field="${g}"], [name="${g}"], #${g}`);v&&(v.scrollIntoView({behavior:"smooth",block:"center"}),(y=v.focus)==null||y.call(v))},100)},[]),m=w.useCallback(g=>{const v=n[g];return v!=null&&v.touched||i.has(g)?v==null?void 0:v.message:void 0},[n,i]),h=w.useCallback(g=>!!m(g),[m]),x=w.useCallback(()=>{a({}),o(new Set)},[]),p=w.useCallback(g=>{a(v=>{const y={...v};return delete y[g],y})},[]);return{errors:n,touchedFields:i,formRef:l,validateField:c,handleBlur:u,validateAll:d,getFieldError:m,hasFieldError:h,clearErrors:x,clearFieldError:p,scrollToFirstError:f}}const gn=w.forwardRef(({className:e,...t},r)=>s.jsx("textarea",{className:yt("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 ZL=w.forwardRef(({id:e,label:t,error:r,required:n,className:a,labelClassName:i,children:o},l)=>s.jsxs("div",{ref:l,className:yt("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:yt("text-sm font-medium",r&&"text-destructive",i),children:[t,n&&s.jsx("span",{className:"text-destructive ml-0.5",children:"*"})]}),r&&s.jsx(Li,{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})]}));ZL.displayName="FormFieldWrapper";const Yi=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(ZL,{id:e||"",label:t,error:r,required:n,children:s.jsx(Xe,{ref:c,id:e,"data-field":e,className:yt(r&&"border-destructive bg-destructive/5 focus-visible:ring-destructive",a),onBlur:u,...l})})});Yi.displayName="FormInput";const sE=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(ZL,{id:e||"",label:t,error:r,required:n,children:s.jsx(gn,{ref:c,id:e,"data-field":e,className:yt(r&&"border-destructive bg-destructive/5 focus-visible:ring-destructive",a),onBlur:u,...l})})});sE.displayName="FormTextarea";const aOe={name:"Le nom",email:"L'email",message:"Le message",contactType:"Le type de contact"},aE=()=>{const{toast:e}=eQ(),[t,r]=w.useState({contactType:"establishment",name:"",email:"",message:""}),[n,a]=w.useState(!1),{getFieldError:i,validateAll:o,handleBlur:l,clearFieldError:c}=YL({schema:eq,fieldLabels:aOe}),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=eq.parse(t),{error:x}=await ce.from("contact_messages").insert({name:h.name,email:h.email,message:h.message,subject:h.contactType==="establishment"?"Demande établissement":"Demande formateur"});x&&console.error("Database error:",x);const{data:p,error:g}=await ce.functions.invoke("send-contact-email",{body:h});if(g)throw console.error("Edge function error:",g),g;console.log("Email sent successfully:",p),dn.trackFormSubmit("contact",{contactType:h.contactType}),Oi.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),Oi.error("Contact form submission failed",h,{formName:"contact"});const x=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:x,variant:"destructive"})}finally{a(!1)}},d=m=>{const{name:h,value:x}=m.target;r({...t,[h]:x}),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(je,{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(Wx,{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(qo,{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(qo,{value:"trainer",id:"trainer"}),s.jsx(We,{htmlFor:"trainer",className:"cursor-pointer",children:"Un formateur"})]})]})]}),s.jsx(Yi,{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(Yi,{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(sE,{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(je,{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(_n,{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(je,{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(a1,{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(je,{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(Is,{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(je,{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 iae({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=sOe.parse({email:a}),x=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 x.json();if(!x.ok)throw new Error(p.error||"Erreur serveur");p.alreadySubscribed?ae.error("Vous êtes déjà inscrit à la newsletter"):(dn.trackFormSubmit("newsletter"),ae.success("Merci ! Un email de bienvenue vous a été envoyé."),i(""))}catch(h){if(h.errors){const x=((m=h.errors[0])==null?void 0:m.message)||"Email invalide";u(x),ae.error(x)}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(_n,{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(Xe,{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 iOe="/assets/logo-efrei-hGFND0X_.svg",oOe="/assets/logo-imie-C3T8YoOg.png",lOe="/assets/logo-croix-rouge-DNxBrTcL.jpg",cOe="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=",uOe="/assets/logo-schools-group-jGL8DzpO.png",dOe=[{name:"EFREI",logo:iOe},{name:"IMIE",logo:oOe},{name:"Croix-Rouge",logo:lOe},{name:"IPSSI",logo:cOe},{name:"Schools Group",logo:uOe}],fOe=()=>{const[e,t]=w.useState([]),[r,n]=w.useState(!0);w.useEffect(()=>{(async()=>{try{const{data:o,error:l}=await ce.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=[...dOe.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(it,{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}`)})})]})})},hOe=()=>{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([ce.from("trainer_profiles").select("*",{count:"exact",head:!0}).eq("status","approved").eq("is_visible",!0),ce.from("school_profiles").select("*",{count:"exact",head:!0}),ce.from("school_requests").select("*",{count:"exact",head:!0}).eq("status","approved").eq("is_filled",!1),ce.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:er,value:e.trainersCount,label:"Formateurs inscrits",suffix:"+"},{icon:yr,value:e.schoolsCount,label:"Établissements partenaires",suffix:""},{icon:Qn,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 oae={exports:{}},mOe="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",pOe=mOe,xOe=pOe;function lae(){}function cae(){}cae.resetWarningCache=lae;var gOe=function(){function e(n,a,i,o,l,c){if(c!==xOe){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:cae,resetWarningCache:lae};return r.PropTypes=r,r};oae.exports=gOe();var vOe=oae.exports;const _r=Sn(vOe);function yOe(e){return e&&typeof e=="object"&&"default"in e?e.default:e}var uae=w,bOe=yOe(uae);function tq(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function wOe(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var jOe=!!(typeof window<"u"&&window.document&&window.document.createElement);function _Oe(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){wOe(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 x=l;return l=void 0,o=[],x};var m=f.prototype;return m.UNSAFE_componentWillMount=function(){o.push(this),c()},m.componentDidUpdate=function(){c()},m.componentWillUnmount=function(){var x=o.indexOf(this);o.splice(x,1),c()},m.render=function(){return bOe.createElement(i,this.props)},f}(uae.PureComponent);return tq(u,"displayName","SideEffect("+n(i)+")"),tq(u,"canUseDOM",jOe),u}}var NOe=_Oe;const SOe=Sn(NOe);var kOe=typeof Element<"u",COe=typeof Map=="function",EOe=typeof Set=="function",AOe=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function v5(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(!v5(e[n],t[n]))return!1;return!0}var i;if(COe&&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(!v5(n.value[1],t.get(n.value[0])))return!1;return!0}if(EOe&&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(AOe&&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(kOe&&e instanceof Element)return!1;for(n=r;n--!==0;)if(!((a[n]==="_owner"||a[n]==="__v"||a[n]==="__o")&&e.$$typeof)&&!v5(e[a[n]],t[a[n]]))return!1;return!0}return e!==e&&t!==t}var TOe=function(t,r){try{return v5(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 POe=Sn(TOe);/*
object-assign
(c) Sindre Sorhus
@license MIT
*/var rq=Object.getOwnPropertySymbols,OOe=Object.prototype.hasOwnProperty,DOe=Object.prototype.propertyIsEnumerable;function IOe(e){if(e==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function ROe(){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 LOe=ROe()?Object.assign:function(e,t){for(var r,n=IOe(e),a,i=1;i<arguments.length;i++){r=Object(arguments[i]);for(var o in r)OOe.call(r,o)&&(n[o]=r[o]);if(rq){a=rq(r);for(var l=0;l<a.length;l++)DOe.call(r,a[l])&&(n[a[l]]=r[a[l]])}}return n};const FOe=Sn(LOe);var Gx={BODY:"bodyAttributes",HTML:"htmlAttributes",TITLE:"titleAttributes"},en={BASE:"base",BODY:"body",HEAD:"head",HTML:"html",LINK:"link",META:"meta",NOSCRIPT:"noscript",SCRIPT:"script",STYLE:"style",TITLE:"title"};Object.keys(en).map(function(e){return en[e]});var Xs={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"},w4={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},D2={DEFAULT_TITLE:"defaultTitle",DEFER:"defer",ENCODE_SPECIAL_CHARACTERS:"encodeSpecialCharacters",ON_CHANGE_CLIENT_STATE:"onChangeClientState",TITLE_TEMPLATE:"titleTemplate"},MOe=Object.keys(w4).reduce(function(e,t){return e[w4[t]]=t,e},{}),$Oe=[en.NOSCRIPT,en.SCRIPT,en.STYLE],zu="data-react-helmet",BOe=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},zOe=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},qOe=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}}(),il=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},UOe=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)},nq=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},VOe=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},a8=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,"'")},HOe=function(t){var r=Dv(t,en.TITLE),n=Dv(t,D2.TITLE_TEMPLATE);if(n&&r)return n.replace(/%s/g,function(){return Array.isArray(r)?r.join(""):r});var a=Dv(t,D2.DEFAULT_TITLE);return r||a||void 0},WOe=function(t){return Dv(t,D2.ON_CHANGE_CLIENT_STATE)||function(){}},gT=function(t,r){return r.filter(function(n){return typeof n[t]<"u"}).map(function(n){return n[t]}).reduce(function(n,a){return il({},n,a)},{})},GOe=function(t,r){return r.filter(function(n){return typeof n[en.BASE]<"u"}).map(function(n){return n[en.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},[])},Pb=function(t,r,n){var a={};return n.filter(function(i){return Array.isArray(i[t])?!0:(typeof i[t]<"u"&&ZOe("Helmet: "+t+' should be of type "Array". Instead found type "'+BOe(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,x=Object.keys(m),p=0;p<x.length;p++){var g=x[p],v=g.toLowerCase();r.indexOf(v)!==-1&&!(h===Xs.REL&&m[h].toLowerCase()==="canonical")&&!(v===Xs.REL&&m[v].toLowerCase()==="stylesheet")&&(h=v),r.indexOf(g)!==-1&&(g===Xs.INNER_HTML||g===Xs.CSS_TEXT||g===Xs.ITEM_PROP)&&(h=g)}if(!h||!m[h])return!1;var y=m[h].toLowerCase();return a[h]||(a[h]={}),l[h]||(l[h]={}),a[h][y]?!1:(l[h][y]=!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=FOe({},a[d],l[d]);a[d]=f}return i},[]).reverse()},Dv=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},KOe=function(t){return{baseTag:GOe([Xs.HREF,Xs.TARGET],t),bodyAttributes:gT(Gx.BODY,t),defer:Dv(t,D2.DEFER),encode:Dv(t,D2.ENCODE_SPECIAL_CHARACTERS),htmlAttributes:gT(Gx.HTML,t),linkTags:Pb(en.LINK,[Xs.REL,Xs.HREF],t),metaTags:Pb(en.META,[Xs.NAME,Xs.CHARSET,Xs.HTTPEQUIV,Xs.PROPERTY,Xs.ITEM_PROP],t),noscriptTags:Pb(en.NOSCRIPT,[Xs.INNER_HTML],t),onChangeClientState:WOe(t),scriptTags:Pb(en.SCRIPT,[Xs.SRC,Xs.INNER_HTML],t),styleTags:Pb(en.STYLE,[Xs.CSS_TEXT],t),title:HOe(t),titleAttributes:gT(Gx.TITLE,t)}},i8=function(){var e=Date.now();return function(t){var r=Date.now();r-e>16?(e=r,t(r)):setTimeout(function(){i8(t)},0)}}(),sq=function(t){return clearTimeout(t)},XOe=typeof window<"u"?window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||i8:global.requestAnimationFrame||i8,YOe=typeof window<"u"?window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||sq:global.cancelAnimationFrame||sq,ZOe=function(t){return console&&typeof console.warn=="function"&&console.warn(t)},Ob=null,JOe=function(t){Ob&&YOe(Ob),t.defer?Ob=XOe(function(){aq(t,function(){Ob=null})}):(aq(t),Ob=null)},aq=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;o8(en.BODY,a),o8(en.HTML,i),QOe(m,h);var x={baseTag:Ag(en.BASE,n),linkTags:Ag(en.LINK,o),metaTags:Ag(en.META,l),noscriptTags:Ag(en.NOSCRIPT,c),scriptTags:Ag(en.SCRIPT,d),styleTags:Ag(en.STYLE,f)},p={},g={};Object.keys(x).forEach(function(v){var y=x[v],b=y.newTags,N=y.oldTags;b.length&&(p[v]=b),N.length&&(g[v]=x[v].oldTags)}),r&&r(),u(t,p,g)},dae=function(t){return Array.isArray(t)?t.join(""):t},QOe=function(t,r){typeof t<"u"&&document.title!==t&&(document.title=dae(t)),o8(en.TITLE,r)},o8=function(t,r){var n=document.getElementsByTagName(t)[0];if(n){for(var a=n.getAttribute(zu),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(zu):n.getAttribute(zu)!==l.join(",")&&n.setAttribute(zu,l.join(","))}},Ag=function(t,r){var n=document.head||document.querySelector(en.HEAD),a=n.querySelectorAll(t+"["+zu+"]"),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===Xs.INNER_HTML)u.innerHTML=c.innerHTML;else if(d===Xs.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(zu,"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}},fae=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},"")},e6e=function(t,r,n,a){var i=fae(n),o=dae(r);return i?"<"+t+" "+zu+'="true" '+i+">"+a8(o,a)+"</"+t+">":"<"+t+" "+zu+'="true">'+a8(o,a)+"</"+t+">"},t6e=function(t,r,n){return r.reduce(function(a,i){var o=Object.keys(i).filter(function(u){return!(u===Xs.INNER_HTML||u===Xs.CSS_TEXT)}).reduce(function(u,d){var f=typeof i[d]>"u"?d:d+'="'+a8(i[d],n)+'"';return u?u+" "+f:f},""),l=i.innerHTML||i.cssText||"",c=$Oe.indexOf(t)===-1;return a+"<"+t+" "+zu+'="true" '+o+(c?"/>":">"+l+"</"+t+">")},"")},hae=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Object.keys(t).reduce(function(n,a){return n[w4[a]||a]=t[a],n},r)},r6e=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Object.keys(t).reduce(function(n,a){return n[MOe[a]||a]=t[a],n},r)},n6e=function(t,r,n){var a,i=(a={key:r},a[zu]=!0,a),o=hae(n,i);return[ye.createElement(en.TITLE,o,r)]},s6e=function(t,r){return r.map(function(n,a){var i,o=(i={key:a},i[zu]=!0,i);return Object.keys(n).forEach(function(l){var c=w4[l]||l;if(c===Xs.INNER_HTML||c===Xs.CSS_TEXT){var u=n.innerHTML||n.cssText;o.dangerouslySetInnerHTML={__html:u}}else o[c]=n[l]}),ye.createElement(t,o)})},Df=function(t,r,n){switch(t){case en.TITLE:return{toComponent:function(){return n6e(t,r.title,r.titleAttributes)},toString:function(){return e6e(t,r.title,r.titleAttributes,n)}};case Gx.BODY:case Gx.HTML:return{toComponent:function(){return hae(r)},toString:function(){return fae(r)}};default:return{toComponent:function(){return s6e(t,r)},toString:function(){return t6e(t,r,n)}}}},mae=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:Df(en.BASE,r,a),bodyAttributes:Df(Gx.BODY,n,a),htmlAttributes:Df(Gx.HTML,i,a),link:Df(en.LINK,o,a),meta:Df(en.META,l,a),noscript:Df(en.NOSCRIPT,c,a),script:Df(en.SCRIPT,u,a),style:Df(en.STYLE,d,a),title:Df(en.TITLE,{title:m,titleAttributes:h},a)}},a6e=function(t){var r,n;return n=r=function(a){UOe(i,a);function i(){return zOe(this,i),VOe(this,a.apply(this,arguments))}return i.prototype.shouldComponentUpdate=function(l){return!POe(this.props,l)},i.prototype.mapNestedChildrenToProps=function(l,c){if(!c)return null;switch(l.type){case en.SCRIPT:case en.NOSCRIPT:return{innerHTML:c};case en.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 il({},d,(c={},c[u.type]=[].concat(d[u.type]||[],[il({},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 en.TITLE:return il({},f,(c={},c[d.type]=h,c.titleAttributes=il({},m),c));case en.BODY:return il({},f,{bodyAttributes:il({},m)});case en.HTML:return il({},f,{htmlAttributes:il({},m)})}return il({},f,(u={},u[d.type]=il({},m),u))},i.prototype.mapArrayTypeChildrenToProps=function(l,c){var u=il({},c);return Object.keys(l).forEach(function(d){var f;u=il({},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 ye.Children.forEach(l,function(f){if(!(!f||!f.props)){var m=f.props,h=m.children,x=nq(m,["children"]),p=r6e(x);switch(u.warnOnInvalidChildren(f,h),f.type){case en.LINK:case en.META:case en.NOSCRIPT:case en.SCRIPT:case en.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=nq(l,["children"]),d=il({},u);return c&&(d=this.mapChildrenToProps(c,d)),ye.createElement(t,d)},qOe(i,null,[{key:"canUseDOM",set:function(l){t.canUseDOM=l}}]),i}(ye.Component),r.propTypes={base:_r.object,bodyAttributes:_r.object,children:_r.oneOfType([_r.arrayOf(_r.node),_r.node]),defaultTitle:_r.string,defer:_r.bool,encodeSpecialCharacters:_r.bool,htmlAttributes:_r.object,link:_r.arrayOf(_r.object),meta:_r.arrayOf(_r.object),noscript:_r.arrayOf(_r.object),onChangeClientState:_r.func,script:_r.arrayOf(_r.object),style:_r.arrayOf(_r.object),title:_r.string,titleAttributes:_r.object,titleTemplate:_r.string},r.defaultProps={defer:!0,encodeSpecialCharacters:!0},r.peek=t.peek,r.rewind=function(){var a=t.rewind();return a||(a=mae({baseTag:[],bodyAttributes:{},htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}})),a},n},i6e=function(){return null},o6e=SOe(KOe,JOe,mae)(i6e),au=a6e(o6e);au.renderStatic=au.rewind;const Yd="https://pedagobridge.com";function nr({title:e,description:t="PedagoBridge connecte établissements de formation et formateurs experts certifiés. Qualité garantie, transparence totale.",image:r=`${Yd}/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?`${Yd}${n}`:Yd,h=["formateurs experts","formation professionnelle","établissement formation","recrutement formateurs","formation continue"],x=[...new Set([...h,...o])];return s.jsxs(au,{children:[s.jsx("title",{children:f}),s.jsx("meta",{name:"description",content:t}),s.jsx("meta",{name:"keywords",content:x.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 pae({name:e="PedagoBridge",description:t="Plateforme de mise en relation entre formateurs experts et établissements de formation",url:r=Yd,logo:n=`${Yd}/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(au,{children:s.jsx("script",{type:"application/ld+json",children:JSON.stringify(i)})})}function l6e({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=`${Yd}${c}`),s.jsx(au,{children:s.jsx("script",{type:"application/ld+json",children:JSON.stringify(u)})})}function b1({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=`${Yd}${i}`),s.jsx(au,{children:s.jsx("script",{type:"application/ld+json",children:JSON.stringify(o)})})}function ms({items:e}){const t={"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:e.map((r,n)=>({"@type":"ListItem",position:n+1,name:r.name,item:`${Yd}${r.url}`}))};return s.jsx(au,{children:s.jsx("script",{type:"application/ld+json",children:JSON.stringify(t)})})}function JL({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:`${Yd}/logo.jpg`}},datePublished:a,mainEntityOfPage:{"@type":"WebPage","@id":`${Yd}${o}`}};return i&&(l.dateModified=i),r&&(l.image=r),s.jsx(au,{children:s.jsx("script",{type:"application/ld+json",children:JSON.stringify(l)})})}function ao({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(au,{children:s.jsx("script",{type:"application/ld+json",children:JSON.stringify(t)})})}const QL=()=>{const e=Zt();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(yr,{className:"h-4 w-4"}),"Inscrire mon établissement",s.jsx(Zr,{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(Ql,{className:"h-4 w-4"}),"Constitution de programme"]})]})]})})})},c6e=()=>{const e=cu();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(nr,{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(ao,{items:t}),s.jsx(LEe,{}),s.jsx(hOe,{}),s.jsx(QL,{}),s.jsx("div",{id:"values",children:s.jsx(BEe,{})}),s.jsx("div",{id:"about",children:s.jsx(MEe,{})}),s.jsx("div",{id:"domains",children:s.jsx(KEe,{})}),s.jsx("div",{id:"trainers",children:s.jsx(GEe,{})}),s.jsx(fOe,{}),s.jsx("div",{id:"contact",children:s.jsx(aE,{})}),s.jsx("div",{className:"container mx-auto px-4 py-16",children:s.jsx(iae,{})})]})},u6e=[{icon:Js,title:"Publier un besoin de formation",description:"Décrivez votre besoin (domaine, dates, niveau, lieu) en quelques minutes. La publication est gratuite et vous recevez des candidatures de formateurs experts.",link:"/training-request"},{icon:Rs,title:"Rechercher des formateurs vérifiés",description:"Parcourez l'annuaire des formateurs certifiés, filtrez par spécialité, domaine et localisation, et consultez leurs profils détaillés.",link:"/trainers"},{icon:Mi,title:"Recommandations intelligentes",description:"Pour chaque besoin publié, la plateforme vous propose automatiquement les formateurs les plus pertinents de notre réseau.",link:"/training-offers"},{icon:Fi,title:"Messagerie & suivi de mission",description:"Échangez avec les formateurs, sélectionnez vos candidats et suivez vos missions de bout en bout, directement sur la plateforme."},{icon:Ql,title:"Constitution de programmes",description:"Nous vous accompagnons pour structurer vos programmes pédagogiques : objectifs, découpage en modules et choix des formateurs. Premier entretien gratuit.",link:"/constitution-de-programme"},{icon:no,title:"Avis & évaluations",description:"Évaluez les formateurs après chaque mission. Les retours alimentent la qualité et la confiance de tout le réseau."}],d6e=[{icon:rd,title:"Profil & CV analysés par IA",description:"Créez votre profil gratuitement et importez votre CV : nos outils en extraient automatiquement vos spécialités et compétences.",link:"/trainer-register"},{icon:Kt,title:"Candidater aux offres",description:"Postulez en un clic aux besoins publiés par les écoles et organismes, et suivez l'état de vos candidatures.",link:"/training-offers"},{icon:mh,title:"Planning & calendrier",description:"Gérez vos interventions dans un calendrier dédié (saisie manuelle, import Excel, synchronisation iCal) avec un export simple pour les écoles.",link:"/fonctionnalites/planning-formateur"},{icon:gC,title:"Assistant BPF",description:"Préparez votre Bilan Pédagogique et Financier : heures dispensées et heures-stagiaires calculées depuis votre planning, avec récapitulatif PDF.",link:"/fonctionnalites/assistant-bpf"},{icon:Kt,title:"Facturation",description:"Générez vos factures de mission directement à partir de votre planning, sans ressaisie.",link:"/trainer/planning"},{icon:wi,title:"Assistance NDA",description:"Nous vous aidons à obtenir votre numéro de déclaration d'activité (NDA) pour exercer en tant que formateur déclaré.",link:"/assistance-nda"}],f6e=[{icon:OR,title:"Prix transparent, 0 commission",description:"Trouver un formateur avec PedagoBridge ne coûte pas plus cher qu'une recherche classique. Inscription et publication d'offres gratuites."},{icon:lu,title:"Qualité garantie",description:"Chaque formateur passe par un processus de validation rigoureux (vérification des diplômes et références)."},{icon:Jo,title:"Garantie de remplacement",description:"En cas d'urgence ou d'empêchement, nous garantissons un formateur de remplacement qualifié."}];function h6e({f:e}){const t=e.icon,r=s.jsxs(je,{className:"h-full p-7 transition-all duration-300 border-border/50 hover:shadow-lg hover:border-primary/40",children:[s.jsx("div",{className:"inline-flex items-center justify-center w-14 h-14 rounded-full bg-primary/10 text-primary mb-5",children:s.jsx(t,{className:"h-7 w-7"})}),s.jsx("h3",{className:"text-xl font-semibold mb-3",children:e.title}),s.jsx("p",{className:"text-muted-foreground leading-relaxed",children:e.description}),e.link&&s.jsxs("span",{className:"inline-flex items-center gap-1 mt-5 font-semibold text-primary group-hover:gap-2 transition-all",children:["En savoir plus",s.jsx(Zr,{className:"h-4 w-4"})]})]});return e.link?s.jsx(nt,{to:e.link,className:"block group",children:r}):s.jsx("div",{children:r})}function vT({title:e,subtitle:t,items:r}){return s.jsx("section",{className:"py-16",children:s.jsxs("div",{className:"container mx-auto px-4",children:[s.jsxs("div",{className:"text-center mb-12",children:[s.jsx("h2",{className:"text-3xl md:text-4xl font-bold mb-3",children:e}),s.jsx("p",{className:"text-lg text-muted-foreground max-w-2xl mx-auto",children:t})]}),s.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6 max-w-6xl mx-auto",children:r.map((n,a)=>s.jsx(h6e,{f:n},a))})]})})}function m6e(){return s.jsxs(s.Fragment,{children:[s.jsx(nr,{title:"Fonctionnalités",description:"Découvrez toutes les fonctionnalités de PedagoBridge : publication de besoins, recherche de formateurs vérifiés, recommandations, planning, assistant BPF, facturation et assistance NDA.",url:"/fonctionnalites",keywords:["fonctionnalités PedagoBridge","plateforme formateurs","planning formateur","assistant BPF","trouver formateur","assistance NDA"]}),s.jsx("section",{className:"bg-gradient-to-br from-primary/5 to-secondary/5 border-b border-border/50",children:s.jsxs("div",{className:"container mx-auto px-4 py-20 text-center",children:[s.jsx("h1",{className:"text-4xl md:text-5xl font-bold mb-5",children:"Toutes les fonctionnalités de PedagoBridge"}),s.jsx("p",{className:"text-xl text-muted-foreground max-w-3xl mx-auto",children:"Une plateforme complète pour mettre en relation, gratuitement, les écoles et organismes de formation avec des formateurs experts certifiés — et leur donner les outils pour gérer leurs missions de A à Z."}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 justify-center mt-8",children:[s.jsx(ne,{asChild:!0,size:"lg",children:s.jsxs(nt,{to:"/school-register",children:[s.jsx(yr,{className:"mr-2 h-5 w-5"}),"Inscrire mon établissement"]})}),s.jsx(ne,{asChild:!0,size:"lg",variant:"outline",children:s.jsxs(nt,{to:"/trainer-register",children:[s.jsx(rd,{className:"mr-2 h-5 w-5"}),"Devenir formateur"]})})]})]})}),s.jsx(vT,{title:"Pour les écoles & organismes",subtitle:"Trouvez le bon formateur et pilotez vos missions, sans frais ni commission.",items:u6e}),s.jsx("div",{className:"bg-muted/30",children:s.jsx(vT,{title:"Pour les formateurs",subtitle:"Développez votre activité et gérez votre administratif au même endroit.",items:d6e})}),s.jsx(vT,{title:"Nos garanties",subtitle:"Ce qui fait de PedagoBridge votre partenaire de confiance.",items:f6e}),s.jsx("section",{className:"py-16",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsxs(je,{className:"max-w-4xl mx-auto p-10 text-center bg-gradient-to-br from-primary/5 to-secondary/5 border-primary/30",children:[s.jsx("h2",{className:"text-2xl md:text-3xl font-bold mb-3",children:"Prêt à commencer ?"}),s.jsx("p",{className:"text-muted-foreground text-lg mb-8 max-w-2xl mx-auto",children:"L'inscription est gratuite, que vous soyez un établissement à la recherche de formateurs ou un formateur souhaitant développer son activité."}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 justify-center",children:[s.jsx(ne,{asChild:!0,size:"lg",children:s.jsxs(nt,{to:"/school-register",children:[s.jsx(yr,{className:"mr-2 h-5 w-5"}),"Inscrire mon établissement"]})}),s.jsx(ne,{asChild:!0,size:"lg",variant:"outline",children:s.jsxs(nt,{to:"/trainer-register",children:[s.jsx(rd,{className:"mr-2 h-5 w-5"}),"Devenir formateur"]})})]})]})})})]})}const iq=[{question:"Comment gérer le planning d'un formateur indépendant ?",answer:"Avec PedagoBridge, vous saisissez vos interventions dans un calendrier dédié, ou vous importez votre planning depuis un fichier Excel, ou encore vous synchronisez votre agenda via iCal. Chaque séance enregistre l'école, le module, le groupe, le nombre de stagiaires, le mode (présentiel/distanciel) et la demi-journée — tout ce dont vous avez besoin pour suivre votre activité et préparer votre BPF."},{question:"Peut-on importer un planning Excel existant ?",answer:"Oui. PedagoBridge lit les tableaux structurés automatiquement et utilise l'IA pour interpréter les plannings en grille libre. Vous validez chaque ligne détectée avant l'import, puis vos interventions apparaissent directement dans votre calendrier."},{question:"Le planning formateur est-il gratuit ?",answer:"La création de votre profil et l'accès à la plateforme sont gratuits. Le module de planning avancé est proposé aux formateurs du réseau ; consultez la page Tarifs planning pour le détail."},{question:"Comment calculer ses heures dispensées et heures-stagiaires ?",answer:"Les heures dispensées et les heures-stagiaires sont calculées automatiquement à partir de vos séances (durée × nombre de stagiaires). Ces totaux alimentent directement l'assistant BPF et vos factures, sans aucune ressaisie."}],p6e=[{icon:mh,title:"Calendrier dédié à vos interventions",text:"Visualisez toutes vos séances mois par mois : école, module, groupe/promo, demi-journée (matin/après-midi), présentiel ou distanciel."},{icon:ph,title:"Import Excel intelligent",text:"Importez votre planning depuis un fichier .xlsx. Les tableaux propres sont lus directement, les grilles libres sont interprétées par IA — vous validez avant l'import."},{icon:Qs,title:"Synchronisation iCal",text:"Connectez votre agenda (Google Agenda, Outlook, Apple) en iCal pour retrouver vos interventions là où vous travaillez déjà."},{icon:$r,title:"Heures dispensées automatiques",text:"Heures de formation et heures-stagiaires calculées séance par séance — la base de votre Bilan Pédagogique et Financier."},{icon:Kt,title:"Facturation sans ressaisie",text:"Générez vos factures de mission directement depuis votre planning : les dates, volumes et clients sont déjà renseignés."},{icon:ro,title:"Export pour les écoles",text:"Partagez un récapitulatif clair de vos interventions avec les établissements, en quelques clics."}],x6e=[{n:"1",title:"Créez votre profil",text:"Inscription gratuite en quelques minutes, CV analysé par IA."},{n:"2",title:"Ajoutez vos interventions",text:"Saisie manuelle, import Excel ou synchronisation iCal."},{n:"3",title:"Pilotez votre activité",text:"Heures, factures et BPF générés automatiquement depuis votre planning."}];function g6e(){return s.jsxs(s.Fragment,{children:[s.jsx(nr,{title:"Logiciel de planning pour formateur indépendant",description:"Gérez le planning de vos interventions de formateur : calendrier dédié, import Excel, synchronisation iCal, calcul automatique des heures dispensées, facturation et export pour les écoles. Gratuit à l'inscription.",url:"/fonctionnalites/planning-formateur",keywords:["planning formateur","logiciel planning formateur indépendant","agenda formateur","gérer ses interventions formateur","import Excel planning formateur","synchronisation iCal formateur","heures dispensées","calendrier formateur"]}),s.jsx(ms,{items:[{name:"Accueil",url:"/"},{name:"Fonctionnalités",url:"/fonctionnalites"},{name:"Planning formateur",url:"/fonctionnalites/planning-formateur"}]}),s.jsx(ao,{items:iq}),s.jsx("section",{className:"bg-gradient-to-br from-primary/5 to-secondary/5 border-b border-border/50",children:s.jsxs("div",{className:"container mx-auto px-4 py-20 text-center",children:[s.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-2xl bg-primary/10 text-primary mb-6",children:s.jsx(mh,{className:"h-8 w-8"})}),s.jsx("h1",{className:"text-4xl md:text-5xl font-bold mb-5",children:"Le planning des formateurs indépendants, enfin simple"}),s.jsx("p",{className:"text-xl text-muted-foreground max-w-3xl mx-auto",children:"Centralisez toutes vos interventions dans un calendrier pensé pour les formateurs : saisie manuelle, import Excel ou synchronisation iCal. Vos heures dispensées, vos factures et votre Bilan Pédagogique et Financier en découlent automatiquement."}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 justify-center mt-8",children:[s.jsx(ne,{asChild:!0,size:"lg",children:s.jsxs(nt,{to:"/trainer-register",children:[s.jsx(rd,{className:"mr-2 h-5 w-5"}),"Créer mon planning gratuitement"]})}),s.jsx(ne,{asChild:!0,size:"lg",variant:"outline",children:s.jsx(nt,{to:"/fonctionnalites/assistant-bpf",children:"Découvrir l'assistant BPF"})})]})]})}),s.jsx("section",{className:"py-16",children:s.jsxs("div",{className:"container mx-auto px-4 max-w-3xl",children:[s.jsx("h2",{className:"text-3xl font-bold mb-4",children:"Pourquoi un planning dédié aux formateurs ?"}),s.jsxs("p",{className:"text-muted-foreground leading-relaxed mb-4",children:["Quand on intervient pour plusieurs écoles et organismes de formation, suivre ses séances dans un tableur devient vite ingérable : dates éparpillées, demi-journées, groupes, bons de commande… et au moment du ",s.jsx("strong",{children:"Bilan Pédagogique et Financier"}),", il faut tout recompter à la main."]}),s.jsxs("p",{className:"text-muted-foreground leading-relaxed",children:["Le planning formateur de PedagoBridge réunit toutes vos interventions au même endroit. Chaque séance est enregistrée avec son école, son module, son groupe et son nombre de stagiaires — pour que vos",s.jsx("strong",{children:" heures dispensées"}),", vos ",s.jsx("strong",{children:"factures"})," et votre ",s.jsx("strong",{children:"BPF"})," se calculent tout seuls."]})]})}),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:"Tout ce que fait votre planning"}),s.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6 max-w-6xl mx-auto",children:p6e.map((e,t)=>{const r=e.icon;return s.jsxs(je,{className:"h-full p-7 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-5",children:s.jsx(r,{className:"h-7 w-7"})}),s.jsx("h3",{className:"text-xl font-semibold mb-3",children:e.title}),s.jsx("p",{className:"text-muted-foreground leading-relaxed",children:e.text})]},t)})})]})}),s.jsx("section",{className:"py-16",children:s.jsxs("div",{className:"container mx-auto px-4 max-w-5xl",children:[s.jsx("h2",{className:"text-3xl font-bold text-center mb-12",children:"Comment ça marche"}),s.jsx("div",{className:"grid md:grid-cols-3 gap-8",children:x6e.map(e=>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 text-primary-foreground font-bold text-lg mb-4",children:e.n}),s.jsx("h3",{className:"text-lg font-semibold mb-2",children:e.title}),s.jsx("p",{className:"text-muted-foreground",children:e.text})]},e.n))})]})}),s.jsx("section",{className:"py-16 bg-muted/30",children:s.jsxs("div",{className:"container mx-auto px-4 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-6",children:iq.map((e,t)=>s.jsxs(je,{className:"p-6 border-border/50",children:[s.jsxs("h3",{className:"font-semibold text-lg mb-2 flex items-start gap-2",children:[s.jsx(Zn,{className:"h-5 w-5 text-primary mt-1 shrink-0"}),e.question]}),s.jsx("p",{className:"text-muted-foreground leading-relaxed",children:e.answer})]},t))})]})}),s.jsx("section",{className:"py-16",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsxs(je,{className:"max-w-4xl mx-auto p-10 text-center bg-gradient-to-br from-primary/5 to-secondary/5 border-primary/30",children:[s.jsx("h2",{className:"text-2xl md:text-3xl font-bold mb-3",children:"Reprenez le contrôle de votre planning"}),s.jsx("p",{className:"text-muted-foreground text-lg mb-8 max-w-2xl mx-auto",children:"Inscription gratuite. Importez votre planning existant en quelques minutes et laissez PedagoBridge calculer vos heures, vos factures et votre BPF."}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 justify-center",children:[s.jsx(ne,{asChild:!0,size:"lg",children:s.jsxs(nt,{to:"/trainer-register",children:[s.jsx(rd,{className:"mr-2 h-5 w-5"}),"Devenir formateur"]})}),s.jsx(ne,{asChild:!0,size:"lg",variant:"outline",children:s.jsxs(nt,{to:"/fonctionnalites",children:["Toutes les fonctionnalités",s.jsx(Zr,{className:"ml-2 h-4 w-4"})]})})]})]})})})]})}const oq=[{question:"Qu'est-ce que le Bilan Pédagogique et Financier (BPF) ?",answer:"Le BPF est le bilan annuel que tout organisme de formation — y compris les formateurs indépendants déclarés — doit transmettre à l'administration. Il déclare notamment le nombre d'heures de formation dispensées, le nombre d'heures-stagiaires et la répartition des produits et charges liés à l'activité de formation."},{question:"Comment remplir son BPF facilement ?",answer:"L'assistant BPF de PedagoBridge part directement de votre planning : il additionne les heures dispensées et les heures-stagiaires de toutes vos séances de l'année, puis vous fournit un récapitulatif clair, exportable en PDF, prêt à reporter dans votre déclaration officielle."},{question:"Quelle différence entre heures dispensées et heures-stagiaires ?",answer:"Les heures dispensées correspondent au volume horaire des séances que vous animez. Les heures-stagiaires multiplient ce volume par le nombre de participants (par exemple 7 heures pour 12 stagiaires = 84 heures-stagiaires). Le BPF demande les deux : l'assistant les calcule automatiquement pour vous."},{question:"L'assistant BPF est-il réservé aux formateurs PedagoBridge ?",answer:"L'assistant BPF est inclus dans l'espace formateur de PedagoBridge. L'inscription est gratuite ; il s'appuie sur votre planning d'interventions pour produire vos totaux annuels sans ressaisie."}],v6e=[{icon:$r,title:"Heures dispensées calculées",text:"Le total des heures de formation que vous avez animées sur l'année, agrégé automatiquement depuis votre planning."},{icon:er,title:"Heures-stagiaires automatiques",text:"Volume horaire × nombre de participants, calculé séance par séance — sans tableur ni recomptage manuel."},{icon:mh,title:"Basé sur votre planning réel",text:"Chaque intervention saisie ou importée alimente le bilan : aucune double saisie, des chiffres toujours à jour."},{icon:yye,title:"Récapitulatif PDF",text:"Un document de synthèse clair et exportable, prêt à reporter dans votre déclaration officielle."}],y6e=[{n:"1",title:"Renseignez votre planning",text:"Saisie manuelle, import Excel ou synchronisation iCal de vos interventions."},{n:"2",title:"L'assistant calcule",text:"Heures dispensées et heures-stagiaires additionnées sur toute l'année."},{n:"3",title:"Exportez votre bilan",text:"Récapitulatif PDF prêt pour votre déclaration BPF."}];function b6e(){return s.jsxs(s.Fragment,{children:[s.jsx(nr,{title:"Assistant BPF en ligne — Bilan Pédagogique et Financier",description:"Préparez votre Bilan Pédagogique et Financier (BPF) sans effort : heures dispensées et heures-stagiaires calculées automatiquement depuis votre planning d'interventions, avec récapitulatif PDF. Pensé pour les formateurs indépendants et organismes de formation.",url:"/fonctionnalites/assistant-bpf",keywords:["BPF","bilan pédagogique et financier","assistant BPF","BPF en ligne","remplir son BPF","heures stagiaires","heures dispensées","BPF formateur indépendant","BPF organisme de formation"]}),s.jsx(ms,{items:[{name:"Accueil",url:"/"},{name:"Fonctionnalités",url:"/fonctionnalites"},{name:"Assistant BPF",url:"/fonctionnalites/assistant-bpf"}]}),s.jsx(ao,{items:oq}),s.jsx("section",{className:"bg-gradient-to-br from-primary/5 to-secondary/5 border-b border-border/50",children:s.jsxs("div",{className:"container mx-auto px-4 py-20 text-center",children:[s.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-2xl bg-primary/10 text-primary mb-6",children:s.jsx(gC,{className:"h-8 w-8"})}),s.jsx("h1",{className:"text-4xl md:text-5xl font-bold mb-5",children:"Votre Bilan Pédagogique et Financier, sans calcul manuel"}),s.jsx("p",{className:"text-xl text-muted-foreground max-w-3xl mx-auto",children:"L'assistant BPF de PedagoBridge transforme votre planning d'interventions en totaux prêts à déclarer : heures dispensées, heures-stagiaires et récapitulatif PDF. Fini les tableurs en fin d'année."}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 justify-center mt-8",children:[s.jsx(ne,{asChild:!0,size:"lg",children:s.jsxs(nt,{to:"/trainer-register",children:[s.jsx(rd,{className:"mr-2 h-5 w-5"}),"Préparer mon BPF gratuitement"]})}),s.jsx(ne,{asChild:!0,size:"lg",variant:"outline",children:s.jsx(nt,{to:"/fonctionnalites/planning-formateur",children:"Voir le planning formateur"})})]})]})}),s.jsx("section",{className:"py-16",children:s.jsxs("div",{className:"container mx-auto px-4 max-w-3xl",children:[s.jsx("h2",{className:"text-3xl font-bold mb-4",children:"Le BPF, simplifié pour les formateurs"}),s.jsxs("p",{className:"text-muted-foreground leading-relaxed mb-4",children:["Chaque année, les organismes de formation et formateurs déclarés doivent produire leur",s.jsx("strong",{children:" Bilan Pédagogique et Financier"}),". L'exercice est souvent redouté : il faut retrouver toutes ses séances, additionner les heures, multiplier par le nombre de stagiaires… un travail fastidieux et source d'erreurs quand tout vit dans des fichiers épars."]}),s.jsxs("p",{className:"text-muted-foreground leading-relaxed",children:["Parce que PedagoBridge connaît déjà votre ",s.jsx(nt,{to:"/fonctionnalites/planning-formateur",className:"text-primary font-medium",children:"planning d'interventions"}),", l'assistant BPF fait le calcul pour vous : ",s.jsx("strong",{children:"heures dispensées"})," et",s.jsx("strong",{children:" heures-stagiaires"})," agrégées sur l'année, prêtes à reporter dans votre déclaration."]})]})}),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:"Ce que l'assistant calcule pour vous"}),s.jsx("div",{className:"grid md:grid-cols-2 gap-6 max-w-4xl mx-auto",children:v6e.map((e,t)=>{const r=e.icon;return s.jsxs(je,{className:"h-full p-7 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-5",children:s.jsx(r,{className:"h-7 w-7"})}),s.jsx("h3",{className:"text-xl font-semibold mb-3",children:e.title}),s.jsx("p",{className:"text-muted-foreground leading-relaxed",children:e.text})]},t)})})]})}),s.jsx("section",{className:"py-16",children:s.jsxs("div",{className:"container mx-auto px-4 max-w-5xl",children:[s.jsx("h2",{className:"text-3xl font-bold text-center mb-12",children:"De votre planning à votre BPF en 3 étapes"}),s.jsx("div",{className:"grid md:grid-cols-3 gap-8",children:y6e.map(e=>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 text-primary-foreground font-bold text-lg mb-4",children:e.n}),s.jsx("h3",{className:"text-lg font-semibold mb-2",children:e.title}),s.jsx("p",{className:"text-muted-foreground",children:e.text})]},e.n))})]})}),s.jsx("section",{className:"py-16 bg-muted/30",children:s.jsxs("div",{className:"container mx-auto px-4 max-w-3xl",children:[s.jsx("h2",{className:"text-3xl font-bold text-center mb-10",children:"Questions fréquentes sur le BPF"}),s.jsx("div",{className:"space-y-6",children:oq.map((e,t)=>s.jsxs(je,{className:"p-6 border-border/50",children:[s.jsxs("h3",{className:"font-semibold text-lg mb-2 flex items-start gap-2",children:[s.jsx(Zn,{className:"h-5 w-5 text-primary mt-1 shrink-0"}),e.question]}),s.jsx("p",{className:"text-muted-foreground leading-relaxed",children:e.answer})]},t))})]})}),s.jsx("section",{className:"py-16",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsxs(je,{className:"max-w-4xl mx-auto p-10 text-center bg-gradient-to-br from-primary/5 to-secondary/5 border-primary/30",children:[s.jsx("div",{className:"inline-flex items-center justify-center w-12 h-12 rounded-full bg-primary/10 text-primary mb-4",children:s.jsx(wi,{className:"h-6 w-6"})}),s.jsx("h2",{className:"text-2xl md:text-3xl font-bold mb-3",children:"Anticipez votre BPF dès aujourd'hui"}),s.jsx("p",{className:"text-muted-foreground text-lg mb-8 max-w-2xl mx-auto",children:"Tenez votre planning à jour toute l'année et votre Bilan Pédagogique et Financier sera prêt en un clic. L'inscription formateur est gratuite."}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 justify-center",children:[s.jsx(ne,{asChild:!0,size:"lg",children:s.jsxs(nt,{to:"/trainer-register",children:[s.jsx(rd,{className:"mr-2 h-5 w-5"}),"Devenir formateur"]})}),s.jsx(ne,{asChild:!0,size:"lg",variant:"outline",children:s.jsxs(nt,{to:"/fonctionnalites",children:["Toutes les fonctionnalités",s.jsx(Zr,{className:"ml-2 h-4 w-4"})]})})]})]})})})]})}const lq=[{question:"Le planning et l'assistant BPF, c'est le même outil ?",answer:"Oui, ce sont les deux faces d'un même outil. Vous saisissez (ou importez) vos interventions dans le planning ; l'assistant BPF les agrège automatiquement pour produire votre Bilan Pédagogique et Financier. Aucune double saisie : ce que vous entrez une fois dans le calendrier alimente vos heures, vos factures et votre déclaration."},{question:"Puis-je importer mon planning Excel annuel ?",answer:"Oui. PedagoBridge lit directement les plannings annuels au format « grille » (les mois en colonnes, les jours en lignes, matin / après-midi) — le format que la plupart des formateurs utilisent déjà — et détecte automatiquement l'année, les mois et les demi-journées. Vous validez la liste des séances détectées avant de les ajouter à votre calendrier."},{question:"Comment sont calculées les heures dispensées et heures-stagiaires ?",answer:"Chaque séance enregistre sa durée (ou sa demi-journée) et son nombre de stagiaires. L'assistant BPF calcule les heures dispensées (somme des durées) et les heures-stagiaires (durée × nombre de stagiaires) par exercice, sans aucune ressaisie."},{question:"Faut-il payer pour utiliser le planning et le BPF ?",answer:"La création de votre profil et l'accès à la plateforme sont gratuits. Le module de planning et l'assistant BPF sont proposés aux formateurs du réseau — consultez la page Tarifs planning pour le détail."}],w6e=[{icon:mh,title:"Un calendrier pensé pour les formateurs",text:"Chaque séance porte l'école, le module, le groupe/promo, la demi-journée (matin/après-midi) et le mode présentiel ou distanciel."},{icon:ph,title:"Import de votre planning annuel",text:"Déposez votre fichier Excel — même en grille annuelle (mois en colonnes, jours en lignes). PedagoBridge le lit directement et vous validez avant l'import."},{icon:Qs,title:"Synchronisation iCal",text:"Connectez Google Agenda, Outlook ou Apple en iCal pour retrouver vos interventions là où vous travaillez déjà."}],j6e=[{icon:$r,title:"Heures dispensées automatiques",text:"La somme de vos séances par exercice, calculée séance par séance — la base de votre Bilan Pédagogique et Financier."},{icon:gC,title:"Heures-stagiaires sans calcul manuel",text:"Durée × nombre de stagiaires pour chaque intervention, agrégées automatiquement sur l'année."},{icon:uye,title:"Récapitulatif BPF prêt à déclarer",text:"Un récapitulatif calculé depuis votre planning, exportable en PDF — vous ne recomptez plus rien à la main."}],_6e=[{n:"1",title:"Remplissez votre planning",text:"Saisie manuelle, import Excel annuel ou synchronisation iCal."},{n:"2",title:"Vos heures se calculent seules",text:"Heures dispensées et heures-stagiaires agrégées par exercice."},{n:"3",title:"Éditez BPF & factures",text:"Récapitulatif BPF en PDF et factures pré-remplies depuis vos séances."}];function cq({points:e}){return s.jsx("div",{className:"grid md:grid-cols-3 gap-6",children:e.map((t,r)=>{const n=t.icon;return s.jsxs(je,{className:"h-full p-7 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-5",children:s.jsx(n,{className:"h-7 w-7"})}),s.jsx("h3",{className:"text-xl font-semibold mb-3",children:t.title}),s.jsx("p",{className:"text-muted-foreground leading-relaxed",children:t.text})]},r)})})}function N6e(){return s.jsxs(s.Fragment,{children:[s.jsx(nr,{title:"Planning formateur + Assistant BPF : l'outil qui pilote votre activité",description:"Un seul outil pour les formateurs indépendants et organismes de formation : un planning d'interventions (calendrier, import Excel annuel, iCal) qui alimente automatiquement votre Bilan Pédagogique et Financier — heures dispensées, heures-stagiaires, factures. Gratuit à l'inscription.",url:"/outils/planning-bpf",keywords:["planning formateur","assistant BPF","bilan pédagogique et financier","heures dispensées","heures stagiaires","import Excel planning formateur","logiciel BPF organisme de formation","calendrier formateur indépendant"]}),s.jsx(ms,{items:[{name:"Accueil",url:"/"},{name:"Outils",url:"/fonctionnalites"},{name:"Planning + BPF",url:"/outils/planning-bpf"}]}),s.jsx(ao,{items:lq}),s.jsx("section",{className:"bg-gradient-to-br from-primary/5 to-secondary/5 border-b border-border/50",children:s.jsxs("div",{className:"container mx-auto px-4 py-20 text-center",children:[s.jsxs("div",{className:"inline-flex items-center gap-2 text-sm font-medium text-primary bg-primary/10 rounded-full px-4 py-1.5 mb-6",children:[s.jsx(Mi,{className:"h-4 w-4"})," Planning + BPF, un seul outil"]}),s.jsx("h1",{className:"text-4xl md:text-5xl font-bold mb-5 max-w-4xl mx-auto",children:"Votre planning remplit votre Bilan Pédagogique et Financier"}),s.jsx("p",{className:"text-xl text-muted-foreground max-w-3xl mx-auto",children:"Saisissez vos interventions une seule fois. PedagoBridge en déduit vos heures dispensées, vos heures-stagiaires, vos factures et votre BPF — sans tableur, sans ressaisie, sans recompter."}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 justify-center mt-8",children:[s.jsx(ne,{asChild:!0,size:"lg",children:s.jsxs(nt,{to:"/trainer/planning",children:[s.jsx(mh,{className:"mr-2 h-5 w-5"}),"Ouvrir mon planning"]})}),s.jsx(ne,{asChild:!0,size:"lg",variant:"outline",children:s.jsx(nt,{to:"/trainer/bpf",children:"Voir l'assistant BPF"})})]})]})}),s.jsx("section",{className:"py-16",children:s.jsxs("div",{className:"container mx-auto px-4 max-w-3xl",children:[s.jsx("h2",{className:"text-3xl font-bold mb-4",children:"Deux corvées, une seule saisie"}),s.jsxs("p",{className:"text-muted-foreground leading-relaxed mb-4",children:["Quand on intervient pour plusieurs écoles et organismes de formation, deux tâches reviennent sans cesse : tenir son ",s.jsx("strong",{children:"planning"})," à jour et, chaque année, produire son ",s.jsx("strong",{children:"Bilan Pédagogique et Financier"}),". La plupart des formateurs jonglent entre un tableur annuel, des bons de commande éparpillés et un fichier BPF qu'il faut recomposer à la main."]}),s.jsx("p",{className:"text-muted-foreground leading-relaxed",children:"PedagoBridge relie les deux. Le planning n'est pas un simple agenda : c'est la source de vérité de votre activité. Chaque séance que vous y enregistrez — ou que vous importez depuis votre Excel annuel — alimente directement le calcul de vos heures, vos factures et votre BPF. Vous saisissez une fois, tout le reste suit."})]})}),s.jsx("section",{className:"py-16 bg-muted/30",children:s.jsxs("div",{className:"container mx-auto px-4 max-w-6xl",children:[s.jsxs("div",{className:"text-center mb-12",children:[s.jsx("span",{className:"text-sm font-semibold text-primary uppercase tracking-wide",children:"Le planning"}),s.jsx("h2",{className:"text-3xl font-bold mt-2",children:"Toutes vos interventions, au même endroit"})]}),s.jsx(cq,{points:w6e})]})}),s.jsx("section",{className:"py-16",children:s.jsxs("div",{className:"container mx-auto px-4 max-w-6xl",children:[s.jsxs("div",{className:"text-center mb-12",children:[s.jsx("span",{className:"text-sm font-semibold text-primary uppercase tracking-wide",children:"L'assistant BPF"}),s.jsx("h2",{className:"text-3xl font-bold mt-2",children:"Votre Bilan Pédagogique et Financier, calculé pour vous"})]}),s.jsx(cq,{points:j6e})]})}),s.jsx("section",{className:"py-16 bg-muted/30",children:s.jsxs("div",{className:"container mx-auto px-4 max-w-5xl",children:[s.jsx("h2",{className:"text-3xl font-bold text-center mb-12",children:"Du calendrier au BPF, en 3 temps"}),s.jsx("div",{className:"grid md:grid-cols-3 gap-8",children:_6e.map(e=>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 text-primary-foreground font-bold text-lg mb-4",children:e.n}),s.jsx("h3",{className:"text-lg font-semibold mb-2",children:e.title}),s.jsx("p",{className:"text-muted-foreground",children:e.text})]},e.n))}),s.jsxs("div",{className:"flex flex-wrap gap-4 justify-center mt-12 text-sm",children:[s.jsxs(nt,{to:"/fonctionnalites/planning-formateur",className:"text-primary hover:underline inline-flex items-center gap-1",children:["En savoir plus sur le planning ",s.jsx(Zr,{className:"h-3.5 w-3.5"})]}),s.jsxs(nt,{to:"/fonctionnalites/assistant-bpf",className:"text-primary hover:underline inline-flex items-center gap-1",children:["En savoir plus sur le BPF ",s.jsx(Zr,{className:"h-3.5 w-3.5"})]}),s.jsxs(nt,{to:"/tarifs-planning",className:"text-primary hover:underline inline-flex items-center gap-1",children:["Tarifs planning ",s.jsx(Zr,{className:"h-3.5 w-3.5"})]})]})]})}),s.jsx("section",{className:"py-16",children:s.jsxs("div",{className:"container mx-auto px-4 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-6",children:lq.map((e,t)=>s.jsxs(je,{className:"p-6 border-border/50",children:[s.jsxs("h3",{className:"font-semibold text-lg mb-2 flex items-start gap-2",children:[s.jsx(Zn,{className:"h-5 w-5 text-primary mt-1 shrink-0"}),e.question]}),s.jsx("p",{className:"text-muted-foreground leading-relaxed",children:e.answer})]},t))})]})}),s.jsx("section",{className:"py-16 bg-muted/30",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsxs(je,{className:"max-w-4xl mx-auto p-10 text-center bg-gradient-to-br from-primary/5 to-secondary/5 border-primary/30",children:[s.jsx("h2",{className:"text-2xl md:text-3xl font-bold mb-3",children:"Arrêtez de recompter vos heures"}),s.jsx("p",{className:"text-muted-foreground text-lg mb-8 max-w-2xl mx-auto",children:"Inscription gratuite. Importez votre planning annuel en quelques minutes et laissez PedagoBridge calculer vos heures, vos factures et votre BPF."}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 justify-center",children:[s.jsx(ne,{asChild:!0,size:"lg",children:s.jsxs(nt,{to:"/trainer-register",children:[s.jsx(rd,{className:"mr-2 h-5 w-5"}),"Créer mon compte formateur"]})}),s.jsx(ne,{asChild:!0,size:"lg",variant:"outline",children:s.jsxs(nt,{to:"/fonctionnalites",children:["Toutes les fonctionnalités",s.jsx(Zr,{className:"ml-2 h-4 w-4"})]})})]})]})})})]})}const Wu=ce;function S6e(){const[e,t]=w.useState(null);return w.useEffect(()=>{(async()=>{const{data:r,error:n}=await Wu.from("school_profiles").select("id, name, logo_url, description, address, is_featured, is_verified, is_affiliated").or("is_verified.eq.true,is_affiliated.eq.true").order("is_featured",{ascending:!1}).order("name",{ascending:!0});if(n){console.error("Error loading schools:",n),t([]);return}t(r||[])})()},[]),s.jsxs(s.Fragment,{children:[s.jsx(nr,{title:"Écoles & organismes de formation partenaires",description:"Découvrez les écoles et organismes de formation qui recrutent des formateurs indépendants sur PedagoBridge. Établissements vérifiés, offres de mission et profils détaillés.",url:"/ecoles",keywords:["écoles partenaires","organismes de formation","établissements formation","écoles qui recrutent formateurs","annuaire écoles formation"]}),s.jsx(ms,{items:[{name:"Accueil",url:"/"},{name:"Écoles",url:"/ecoles"}]}),s.jsx("section",{className:"bg-gradient-to-br from-primary/5 to-secondary/5 border-b border-border/50",children:s.jsxs("div",{className:"container mx-auto px-4 py-16 text-center",children:[s.jsx("div",{className:"inline-flex items-center justify-center w-14 h-14 rounded-2xl bg-primary/10 text-primary mb-5",children:s.jsx(yr,{className:"h-7 w-7"})}),s.jsx("h1",{className:"text-4xl font-bold mb-4",children:"Nos écoles & organismes de formation"}),s.jsx("p",{className:"text-lg text-muted-foreground max-w-2xl mx-auto",children:"Les établissements partenaires qui font confiance à PedagoBridge pour trouver leurs formateurs."})]})}),s.jsx("section",{className:"py-14",children:s.jsx("div",{className:"container mx-auto px-4 max-w-6xl",children:e===null?s.jsxs("div",{className:"flex items-center justify-center gap-2 text-muted-foreground py-20",children:[s.jsx(it,{className:"w-5 h-5 animate-spin"})," Chargement des écoles…"]}):e.length===0?s.jsx("p",{className:"text-center text-muted-foreground py-20",children:"Aucune école à afficher pour le moment."}):s.jsx(s.Fragment,{children:s.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-6",children:e.map(r=>s.jsx(nt,{to:`/ecoles/${r.id}`,className:"group",children:s.jsxs(je,{className:`h-full p-6 border-border/50 transition-shadow hover:shadow-md ${r.is_featured?"ring-2 ring-amber-300/70":""}`,children:[s.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[r.logo_url?s.jsx("img",{src:r.logo_url,alt:r.name,className:"h-12 w-12 rounded-lg object-contain bg-white border"}):s.jsx("div",{className:"h-12 w-12 rounded-lg bg-primary/10 text-primary flex items-center justify-center",children:s.jsx(yr,{className:"h-6 w-6"})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("h3",{className:"font-semibold truncate",children:r.name}),r.address&&s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:r.address})]})]}),s.jsxs("div",{className:"flex flex-wrap gap-1.5 mb-3",children:[r.is_featured&&s.jsxs(Te,{className:"bg-amber-100 text-amber-700 border-amber-300 text-[10px]",children:[s.jsx(no,{className:"w-3 h-3 mr-1 fill-amber-500 text-amber-500"})," Mis en avant"]}),r.is_verified&&s.jsxs(Te,{variant:"outline",className:"text-[10px]",children:[s.jsx(TQ,{className:"w-3 h-3 mr-1 text-primary"})," Vérifié"]})]}),r.description&&s.jsx("p",{className:"text-sm text-muted-foreground line-clamp-3",children:r.description}),s.jsxs("span",{className:"mt-3 inline-flex items-center gap-1 text-sm text-primary opacity-0 group-hover:opacity-100 transition-opacity",children:["Voir le profil ",s.jsx(Zr,{className:"h-3.5 w-3.5"})]})]})},r.id))})})})})]})}function k6e(){var i;const{id:e}=so(),[t,r]=w.useState(null),[n,a]=w.useState([]);return w.useEffect(()=>{e&&(async()=>{const{data:o,error:l}=await Wu.from("school_profiles").select("id, name, logo_url, description, address, website_url, is_featured, is_verified, user_id").eq("id",e).maybeSingle();if(l||!o){r("notfound");return}const c=o;if(r(c),c.user_id){const{data:u}=await ce.from("school_requests").select("id, description, city, subject_areas, start_date, tjm_offered").eq("user_id",c.user_id).eq("status","approved").eq("is_filled",!1).order("created_at",{ascending:!1});a(u||[])}})()},[e]),t===null?s.jsxs("div",{className:"flex items-center justify-center gap-2 text-muted-foreground py-32",children:[s.jsx(it,{className:"w-5 h-5 animate-spin"})," Chargement…"]}):t==="notfound"?s.jsxs("div",{className:"container mx-auto px-4 py-32 text-center",children:[s.jsx("h1",{className:"text-2xl font-bold mb-3",children:"École introuvable"}),s.jsx("p",{className:"text-muted-foreground mb-6",children:"Ce profil n'existe pas ou n'est pas public."}),s.jsx(ne,{asChild:!0,variant:"outline",children:s.jsxs(nt,{to:"/ecoles",children:[s.jsx(Hn,{className:"mr-2 h-4 w-4"}),"Toutes les écoles"]})})]}):s.jsxs(s.Fragment,{children:[s.jsx(nr,{title:`${t.name} — profil établissement`,description:((i=t.description)==null?void 0:i.slice(0,155))||`Découvrez ${t.name}, établissement partenaire de PedagoBridge, et ses offres de mission pour formateurs.`,url:`/ecoles/${t.id}`}),s.jsx(ms,{items:[{name:"Accueil",url:"/"},{name:"Écoles",url:"/ecoles"},{name:t.name,url:`/ecoles/${t.id}`}]}),s.jsx("section",{className:"bg-gradient-to-br from-primary/5 to-secondary/5 border-b border-border/50",children:s.jsxs("div",{className:"container mx-auto px-4 py-14 max-w-5xl",children:[s.jsxs(nt,{to:"/ecoles",className:"inline-flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground mb-6",children:[s.jsx(Hn,{className:"h-4 w-4"})," Toutes les écoles"]}),s.jsxs("div",{className:"flex flex-col sm:flex-row items-start gap-6",children:[t.logo_url?s.jsx("img",{src:t.logo_url,alt:t.name,className:"h-24 w-24 rounded-xl object-contain bg-white border"}):s.jsx("div",{className:"h-24 w-24 rounded-xl bg-primary/10 text-primary flex items-center justify-center",children:s.jsx(yr,{className:"h-12 w-12"})}),s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-2",children:[s.jsx("h1",{className:"text-3xl font-bold",children:t.name}),t.is_featured&&s.jsxs(Te,{className:"bg-amber-100 text-amber-700 border-amber-300",children:[s.jsx(no,{className:"w-3 h-3 mr-1 fill-amber-500 text-amber-500"})," Mis en avant"]}),t.is_verified&&s.jsxs(Te,{variant:"outline",children:[s.jsx(TQ,{className:"w-3 h-3 mr-1 text-primary"})," Vérifié"]})]}),s.jsxs("div",{className:"flex flex-wrap gap-4 text-sm text-muted-foreground",children:[t.address&&s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx(Is,{className:"h-4 w-4"}),t.address]}),t.website_url&&s.jsxs("a",{href:t.website_url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-primary hover:underline",children:[s.jsx(ap,{className:"h-4 w-4"})," Site web"]})]})]})]})]})}),s.jsx("section",{className:"py-12",children:s.jsxs("div",{className:"container mx-auto px-4 max-w-5xl grid md:grid-cols-3 gap-8",children:[s.jsxs("div",{className:"md:col-span-2 space-y-8",children:[t.description&&s.jsxs("div",{children:[s.jsx("h2",{className:"text-xl font-semibold mb-3",children:"À propos"}),s.jsx("p",{className:"text-muted-foreground leading-relaxed whitespace-pre-wrap",children:t.description})]}),s.jsxs("div",{children:[s.jsxs("h2",{className:"text-xl font-semibold mb-4 flex items-center gap-2",children:[s.jsx(Qn,{className:"h-5 w-5 text-primary"})," Offres de mission en cours",n.length>0&&s.jsx(Te,{variant:"secondary",children:n.length})]}),n.length===0?s.jsx("p",{className:"text-sm text-muted-foreground",children:"Aucune offre publiée pour le moment."}):s.jsx("div",{className:"space-y-3",children:n.map(o=>s.jsx(nt,{to:`/training-offers/${o.id}`,children:s.jsxs(je,{className:"p-4 border-border/50 hover:shadow-md transition-shadow",children:[s.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:(o.subject_areas||[]).slice(0,3).map((l,c)=>s.jsx(Te,{variant:"outline",className:"text-[10px]",children:l},c))}),s.jsx("p",{className:"text-sm line-clamp-2",children:o.description}),s.jsxs("div",{className:"flex flex-wrap gap-3 text-xs text-muted-foreground mt-2",children:[o.city&&s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx(Is,{className:"h-3 w-3"}),o.city]}),o.tjm_offered!=null&&s.jsxs("span",{children:["TJM : ",o.tjm_offered," €"]})]})]})},o.id))})]})]}),s.jsx("aside",{children:s.jsxs(je,{className:"p-6 border-primary/30 bg-gradient-to-br from-primary/5 to-secondary/5 text-center",children:[s.jsx("h3",{className:"font-semibold mb-2",children:"Formateur ?"}),s.jsxs("p",{className:"text-sm text-muted-foreground mb-4",children:["Rejoignez PedagoBridge pour candidater aux missions de ",t.name," et d'autres établissements."]}),s.jsx(ne,{asChild:!0,className:"w-full",children:s.jsxs(nt,{to:"/trainer-register",children:["Devenir formateur ",s.jsx(Zr,{className:"ml-2 h-4 w-4"})]})})]})})]})})]})}const uq=[{question:"Comment apparaître en premier dans la liste des formateurs sur PedagoBridge ?",answer:"Le classement suit des niveaux successifs : d'abord la pertinence par rapport à la recherche de l'école, puis le badge Certifié PedagoBridge, puis la qualité et l'activité de votre profil (profil complet, populaire, à jour), enfin un léger avantage France. Concrètement : soyez certifié, complétez votre profil à 100 %, nommez vos spécialités exactement comme les écoles les recherchent, et gardez votre profil à jour."},{question:"Est-ce qu'ajouter beaucoup de spécialités améliore mon classement ?",answer:"Non — au contraire. Empiler des spécialités vagues ou hors de votre domaine vous dessert : nos outils privilégient désormais les profils précis. Un formateur qui correspond exactement à un besoin passe devant un profil « fourre-tout ». Indiquez 3 à 8 spécialités réelles, nommées précisément (ex. « Cybersécurité », « Power BI », « Développement web »)."},{question:"Comment devenir formateur certifié PedagoBridge ?",answer:"Vous devenez certifié lorsque votre contrat est contre-signé par PedagoBridge, ou via une certification manuelle par notre équipe. Le badge Certifié vous fait passer devant les formateurs non certifiés et s'affiche sur toutes les pages."},{question:"Les vues de mon profil comptent-elles ?",answer:"Oui, un profil populaire remonte — mais les vues sont « amorties » : rafraîchir la page en boucle n'a quasiment aucun effet. Ce qui compte vraiment, c'est un profil complet, à jour et certifié."}],C6e=[{icon:lu,title:"Être certifié PedagoBridge",text:"Le levier le plus fort : un contrat contre-signé (ou une certification manuelle) vous place devant les non-certifiés, partout sur le site."},{icon:fy,title:"Compléter votre profil à 100 %",text:"Photo, bio détaillée (200+ caractères), CV en ligne, départements d'intervention, liens LinkedIn & site web, et email vérifié — chaque élément ajoute des points de qualité."},{icon:Sp,title:"Des spécialités précises",text:"3 à 8 spécialités réelles, nommées exactement comme les écoles les recherchent. La précision prime sur la quantité : un profil ciblé bat un profil fourre-tout."},{icon:Qs,title:"Rester actif",text:"Un profil mis à jour récemment est favorisé — c'est aussi ce qui donne leur chance aux nouveaux formateurs. Repassez sur votre profil de temps en temps."},{icon:IQ,title:"Parrainer des formateurs",text:"Faire venir d'autres formateurs vous récompense (statut Ambassadeur) et améliore votre visibilité."}],E6e=[{n:"1",title:"Pertinence",text:"Quand une école cherche un domaine ou une ville, les formateurs qui correspondent le mieux sortent en premier. Hors de votre domaine, vous redescendez — c'est voulu."},{n:"2",title:"Certifié PedagoBridge",text:"À pertinence égale, les formateurs certifiés (badge vert) passent devant."},{n:"3",title:"Qualité + activité",text:"Profil complet + populaire + actif sur la plateforme."},{n:"4",title:"France",text:"À qualité égale, léger avantage aux formateurs basés en France."}],A6e=["Empiler des spécialités vagues ou hors de votre domaine (ça n'aide plus — ça nuit).","Bourrer la bio de mots-clés au lieu de les mettre en spécialités.","Gonfler artificiellement les vues (elles sont amorties)."];function T6e(){return s.jsxs(s.Fragment,{children:[s.jsx(nr,{title:"Comment apparaître en haut des résultats — Guide formateur",description:"Guide pratique pour les formateurs : comment être mieux classé et plus visible auprès des écoles sur PedagoBridge. Certification, profil complet, spécialités précises, activité et parrainage.",url:"/guide-formateur",keywords:["mieux classé formateur","être visible formateur","apparaître en premier formateur","référencement formateur","certifié PedagoBridge","profil formateur complet"]}),s.jsx(ms,{items:[{name:"Accueil",url:"/"},{name:"Guide formateur — mieux se classer",url:"/guide-formateur"}]}),s.jsx(ao,{items:uq}),s.jsx("section",{className:"bg-gradient-to-br from-primary/5 to-secondary/5 border-b border-border/50",children:s.jsxs("div",{className:"container mx-auto px-4 py-20 text-center",children:[s.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-2xl bg-primary/10 text-primary mb-6",children:s.jsx(ed,{className:"h-8 w-8"})}),s.jsx("h1",{className:"text-4xl md:text-5xl font-bold mb-5",children:"Apparaître en haut des résultats"}),s.jsx("p",{className:"text-xl text-muted-foreground max-w-3xl mx-auto",children:"Comment les formateurs sont classés sur PedagoBridge — et ce que vous pouvez faire, concrètement, pour que les écoles vous trouvent en premier."}),s.jsx("div",{className:"flex flex-col sm:flex-row gap-3 justify-center mt-8",children:s.jsx(ne,{asChild:!0,size:"lg",children:s.jsx(nt,{to:"/trainer/profile",children:"Compléter mon profil"})})})]})}),s.jsx("section",{className:"py-16",children:s.jsxs("div",{className:"container mx-auto px-4 max-w-4xl",children:[s.jsx("h2",{className:"text-3xl font-bold text-center mb-4",children:"Comment le classement est décidé"}),s.jsx("p",{className:"text-muted-foreground text-center max-w-2xl mx-auto mb-12",children:"Les formateurs sont triés par niveaux successifs : on compare d'abord le niveau 1, puis, en cas d'égalité, le niveau 2, et ainsi de suite."}),s.jsx("div",{className:"space-y-4",children:E6e.map(e=>s.jsxs("div",{className:"flex gap-4 p-5 rounded-lg border bg-muted/30",children:[s.jsx("div",{className:"shrink-0 inline-flex items-center justify-center w-10 h-10 rounded-full bg-primary text-primary-foreground font-bold",children:e.n}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-semibold",children:e.title}),s.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:e.text})]})]},e.n))}),s.jsxs("p",{className:"text-sm text-muted-foreground mt-6 text-center",children:[s.jsx("strong",{children:"Important :"})," la pertinence prime. Vous apparaissez en haut ",s.jsx("em",{children:"quand vous êtes réellement pertinent"})," pour la recherche de l'école."]})]})}),s.jsx("section",{className:"py-16 bg-muted/30",children:s.jsxs("div",{className:"container mx-auto px-4",children:[s.jsxs("h2",{className:"text-3xl font-bold text-center mb-12 flex items-center justify-center gap-2",children:[s.jsx(LQ,{className:"h-7 w-7 text-primary"})," Les 5 leviers que vous contrôlez"]}),s.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6 max-w-6xl mx-auto",children:C6e.map((e,t)=>{const r=e.icon;return s.jsxs(je,{className:"h-full p-7 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-5",children:s.jsx(r,{className:"h-7 w-7"})}),s.jsx("h3",{className:"text-lg font-semibold mb-2",children:e.title}),s.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:e.text})]},t)})})]})}),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-6 flex items-center gap-2",children:[s.jsx(vs,{className:"h-6 w-6 text-red-500"})," Ce qui ne marche pas"]}),s.jsx("ul",{className:"space-y-3",children:A6e.map((e,t)=>s.jsxs("li",{className:"flex items-start gap-3 text-muted-foreground",children:[s.jsx(vs,{className:"h-5 w-5 text-red-400 mt-0.5 shrink-0"}),s.jsx("span",{children:e})]},t))})]})}),s.jsx("section",{className:"py-16 bg-muted/30",children:s.jsxs("div",{className:"container mx-auto px-4 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-6",children:uq.map((e,t)=>s.jsxs(je,{className:"p-6 border-border/50",children:[s.jsxs("h3",{className:"font-semibold text-lg mb-2 flex items-start gap-2",children:[s.jsx(Zn,{className:"h-5 w-5 text-primary mt-1 shrink-0"}),e.question]}),s.jsx("p",{className:"text-muted-foreground leading-relaxed",children:e.answer})]},t))})]})}),s.jsx("section",{className:"py-16",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsxs(je,{className:"max-w-4xl mx-auto p-10 text-center bg-gradient-to-br from-primary/5 to-secondary/5 border-primary/30",children:[s.jsx("h2",{className:"text-2xl md:text-3xl font-bold mb-3",children:"Prêt à grimper dans le classement ?"}),s.jsx("p",{className:"text-muted-foreground text-lg mb-8 max-w-2xl mx-auto",children:"Commencez par compléter votre profil et soigner vos spécialités. Le reste suit."}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 justify-center",children:[s.jsx(ne,{asChild:!0,size:"lg",children:s.jsxs(nt,{to:"/trainer/profile",children:["Compléter mon profil",s.jsx(Zr,{className:"ml-2 h-4 w-4"})]})}),s.jsx(ne,{asChild:!0,size:"lg",variant:"outline",children:s.jsx(nt,{to:"/fonctionnalites",children:"Toutes les fonctionnalités"})})]})]})})})]})}const dq=[{question:"Qu'est-ce que la conduite du changement ?",answer:"La conduite du changement (ou change management) regroupe l'ensemble des méthodes qui permettent à une entreprise de réussir une transformation en embarquant ses équipes : analyse des impacts, stratégie d'accompagnement, communication, montée en compétences et mesure de l'adoption. L'enjeu n'est pas seulement technique : il est avant tout humain, car la majorité des projets de transformation échouent par manque d'appropriation par les collaborateurs."},{question:"Pour quels projets faire appel à un accompagnement au changement ?",answer:"Tout projet qui modifie les habitudes de travail : transformation digitale, déploiement d'un nouvel outil (ERP, CRM, logiciel métier), réorganisation, fusion ou rapprochement, passage à de nouvelles méthodes (agile, télétravail), démarche qualité ou RSE. Dès qu'un changement touche les processus et les personnes, un accompagnement structuré sécurise l'adoption."},{question:"En quoi PedagoBridge est-il légitime sur la conduite du changement ?",answer:"PedagoBridge s'appuie sur un réseau d'experts indépendants vérifiés et sur une expertise reconnue de la montée en compétences. Or la formation est le cœur de toute transformation réussie. Nous combinons donc consultants en conduite du changement et formateurs métiers pour vous accompagner de la stratégie jusqu'à l'ancrage des nouvelles pratiques sur le terrain."},{question:"Combien coûte un accompagnement à la conduite du changement ?",answer:"Chaque mission est dimensionnée selon l'ampleur du projet, le nombre de collaborateurs concernés et la durée d'accompagnement. Le premier entretien de cadrage est gratuit et sans engagement : nous vous remettons ensuite une proposition claire et un devis adapté à votre contexte."},{question:"Comment se déroule une mission de conduite du changement ?",answer:"Après un premier échange gratuit, un expert dédié réalise un diagnostic et vous propose une feuille de route. Vient ensuite le déploiement : communication, accompagnement des managers et des équipes, formation et montée en compétences, puis mesure de l'adoption pour ancrer durablement les nouvelles pratiques."}],P6e=[{icon:pye,title:"Diagnostic & analyse d'impact",text:"Cartographie des parties prenantes, évaluation des impacts métier et organisationnels, identification des résistances : on part de votre réalité terrain."},{icon:Sp,title:"Stratégie & feuille de route",text:"Une trajectoire de changement claire, avec jalons, indicateurs et plan d'accompagnement aligné sur les objectifs de votre transformation."},{icon:Fi,title:"Communication & engagement",text:"Plan de communication, implication des sponsors et des relais internes pour donner du sens au changement et embarquer les collaborateurs."},{icon:Na,title:"Formation & montée en compétences",text:"Le cœur du métier de PedagoBridge : des formateurs experts pour outiller vos équipes sur les nouveaux outils, processus et savoir-faire."},{icon:RQ,title:"Accompagnement des managers",text:"Les managers de proximité sont les premiers leviers d'adoption : nous les équipons pour porter le changement auprès de leurs équipes."},{icon:cye,title:"Mesure de l'adoption & ancrage",text:"Indicateurs d'appropriation, points d'étape et ajustements pour transformer l'essai et ancrer durablement les nouvelles pratiques."}],O6e=["Transformation digitale","Déploiement d'un nouvel outil (ERP, CRM, logiciel métier)","Réorganisation ou nouvelle organisation","Fusion / rapprochement d'équipes","Nouvelles méthodes de travail (agile, télétravail)","Démarche qualité, RSE ou conformité"],D6e=[{n:"1",title:"Échange sur votre projet",text:"Un premier entretien de cadrage gratuit pour comprendre votre transformation et vos enjeux d'adoption."},{n:"2",title:"Diagnostic & feuille de route",text:"Un expert dédié réalise le diagnostic et vous propose un plan d'accompagnement adapté."},{n:"3",title:"Déploiement & ancrage",text:"Accompagnement terrain, communication, formation des équipes et mesure de l'adoption."}];function I6e(){return s.jsxs(s.Fragment,{children:[s.jsx(nr,{title:"Conseil en conduite du changement pour entreprises",description:"Réussissez vos transformations avec PedagoBridge : des experts en conduite du changement pour piloter vos projets (digitalisation, nouvel outil, réorganisation) et faire adopter durablement les nouvelles pratiques par vos équipes. Premier entretien gratuit.",url:"/conseil-conduite-du-changement",keywords:["conduite du changement","conseil en conduite du changement","accompagnement au changement","change management","gestion du changement","consultant conduite du changement","accompagnement transformation digitale","adoption nouvel outil entreprise","conduite du changement entreprise"]}),s.jsx(ms,{items:[{name:"Accueil",url:"/"},{name:"Conduite du changement",url:"/conseil-conduite-du-changement"}]}),s.jsx(ao,{items:dq}),s.jsx("section",{className:"bg-gradient-to-br from-primary/5 to-secondary/5 border-b border-border/50",children:s.jsxs("div",{className:"container mx-auto px-4 py-20 text-center",children:[s.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-2xl bg-primary/10 text-primary mb-6",children:s.jsx(l6,{className:"h-8 w-8"})}),s.jsx("h1",{className:"text-4xl md:text-5xl font-bold mb-5",children:"Réussissez vos transformations grâce à la conduite du changement"}),s.jsx("p",{className:"text-xl text-muted-foreground max-w-3xl mx-auto",children:"Digitalisation, nouvel outil, réorganisation… une transformation ne réussit que si vos équipes l'adoptent. PedagoBridge vous accompagne avec des experts en conduite du changement — de la stratégie jusqu'à la montée en compétences sur le terrain."}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 justify-center mt-8",children:[s.jsx(ne,{asChild:!0,size:"lg",children:s.jsxs(nt,{to:"/training-request?type=company&source=conduite-changement",children:[s.jsx(yr,{className:"mr-2 h-5 w-5"}),"Décrire mon projet"]})}),s.jsx(ne,{asChild:!0,size:"lg",variant:"outline",children:s.jsx(nt,{to:"/trainers",children:"Découvrir nos experts"})})]})]})}),s.jsx("section",{className:"py-16",children:s.jsxs("div",{className:"container mx-auto px-4 max-w-3xl",children:[s.jsx("h2",{className:"text-3xl font-bold mb-4",children:"Pourquoi la conduite du changement ?"}),s.jsxs("p",{className:"text-muted-foreground leading-relaxed mb-4",children:["On estime que près de ",s.jsx("strong",{children:"70 % des projets de transformation n'atteignent pas leurs objectifs"}),", rarement à cause de la technologie : la première cause est le facteur humain — des équipes insuffisamment préparées, informées ou accompagnées."]}),s.jsxs("p",{className:"text-muted-foreground leading-relaxed",children:["La conduite du changement met l'adoption au centre. Au-delà de la formation, PedagoBridge vous aide à structurer votre transformation, embarquer vos collaborateurs et ",s.jsx("strong",{children:"ancrer durablement les nouvelles pratiques"}),", en combinant consultants spécialisés et formateurs experts de notre réseau."]})]})}),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:"Notre accompagnement, de la stratégie à l'ancrage"}),s.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6 max-w-6xl mx-auto",children:P6e.map((e,t)=>{const r=e.icon;return s.jsxs(je,{className:"h-full p-7 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-5",children:s.jsx(r,{className:"h-7 w-7"})}),s.jsx("h3",{className:"text-xl font-semibold mb-3",children:e.title}),s.jsx("p",{className:"text-muted-foreground leading-relaxed",children:e.text})]},t)})})]})}),s.jsx("section",{className:"py-16",children:s.jsxs("div",{className:"container mx-auto px-4 max-w-4xl",children:[s.jsx("h2",{className:"text-3xl font-bold text-center mb-10",children:"Quand faire appel à nous ?"}),s.jsx("div",{className:"grid sm:grid-cols-2 gap-4",children:O6e.map((e,t)=>s.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-lg border border-border/50 bg-card",children:[s.jsx(Zn,{className:"h-5 w-5 text-primary mt-0.5 shrink-0"}),s.jsx("span",{className:"text-muted-foreground",children:e})]},t))})]})}),s.jsx("section",{className:"py-16 bg-muted/30",children:s.jsxs("div",{className:"container mx-auto px-4 max-w-5xl",children:[s.jsx("h2",{className:"text-3xl font-bold text-center mb-12",children:"Comment ça marche"}),s.jsx("div",{className:"grid md:grid-cols-3 gap-8",children:D6e.map(e=>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 text-primary-foreground font-bold text-lg mb-4",children:e.n}),s.jsx("h3",{className:"text-lg font-semibold mb-2",children:e.title}),s.jsx("p",{className:"text-muted-foreground",children:e.text})]},e.n))})]})}),s.jsx("section",{className:"py-16",children:s.jsxs("div",{className:"container mx-auto px-4 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-6",children:dq.map((e,t)=>s.jsxs(je,{className:"p-6 border-border/50",children:[s.jsxs("h3",{className:"font-semibold text-lg mb-2 flex items-start gap-2",children:[s.jsx(Zn,{className:"h-5 w-5 text-primary mt-1 shrink-0"}),e.question]}),s.jsx("p",{className:"text-muted-foreground leading-relaxed",children:e.answer})]},t))})]})}),s.jsx("section",{className:"py-16",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsxs(je,{className:"max-w-4xl mx-auto p-10 text-center bg-gradient-to-br from-primary/5 to-secondary/5 border-primary/30",children:[s.jsx("div",{className:"inline-flex items-center justify-center w-12 h-12 rounded-full bg-primary/10 text-primary mb-4",children:s.jsx(RQ,{className:"h-6 w-6"})}),s.jsx("h2",{className:"text-2xl md:text-3xl font-bold mb-3",children:"Parlons de votre transformation"}),s.jsx("p",{className:"text-muted-foreground text-lg mb-8 max-w-2xl mx-auto",children:"Décrivez votre projet en quelques minutes. Le premier entretien de cadrage est gratuit et sans engagement — nous revenons vers vous avec une proposition d'accompagnement adaptée."}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 justify-center",children:[s.jsx(ne,{asChild:!0,size:"lg",children:s.jsxs(nt,{to:"/training-request?type=company&source=conduite-changement",children:[s.jsx(yr,{className:"mr-2 h-5 w-5"}),"Décrire mon projet"]})}),s.jsx(ne,{asChild:!0,size:"lg",variant:"outline",children:s.jsxs(nt,{to:"/fonctionnalites",children:["Toutes nos solutions",s.jsx(Zr,{className:"ml-2 h-4 w-4"})]})})]})]})})})]})}const fq=[{question:"Comment PedagoBridge trouve-t-il les meilleures formations pour mes salariés ?",answer:"Vous nous décrivez votre besoin (compétences visées, public, format, budget, dates). Nous analysons votre demande et sélectionnons dans notre réseau les formateurs experts et programmes les plus pertinents — vérifiés et évalués. Vous recevez des propositions comparables et choisissez en toute transparence."},{question:"Le service est-il vraiment gratuit pour mon entreprise ?",answer:"Oui. La mise en relation et l'accompagnement sont gratuits et sans commission : vous ne payez que la formation elle-même, au tarif du formateur. C'est notre différence — trouver une formation de qualité ne doit pas coûter plus cher qu'une recherche classique."},{question:"Pouvez-vous nous aider à financer la formation (OPCO, CPF, plan de développement) ?",answer:"Nous vous orientons vers les dispositifs de financement adaptés à votre situation : plan de développement des compétences, prise en charge par votre OPCO, ou mobilisation du CPF du salarié. Nous privilégions les formateurs en mesure de délivrer des formations finançables. La décision et l'éligibilité finale relèvent de votre financeur."},{question:"Proposez-vous des formations sur-mesure en intra-entreprise ?",answer:"Oui. Au-delà des formations sur catalogue, nous construisons des parcours sur-mesure animés dans vos locaux ou à distance, adaptés à vos outils, vos processus et vos objectifs. Idéal pour former une équipe entière sur un même sujet."},{question:"Je suis salarié : puis-je proposer une formation à mon employeur via PedagoBridge ?",answer:"Absolument. Décrivez la formation que vous souhaitez suivre : nous identifions le bon formateur et les pistes de financement (plan de développement des compétences, CPF, OPCO), et nous vous aidons à construire un dossier clair à présenter à votre service RH ou à votre manager."}],R6e=[{icon:Rs,title:"Analyse de votre besoin",text:"Compétences visées, public, niveau, format (présentiel/distanciel), budget et délais : on part de vos objectifs métier, pas d'un catalogue figé."},{icon:lu,title:"Formateurs & programmes vérifiés",text:"Une sélection de formateurs experts indépendants, diplômes et références vérifiés, évalués après chaque mission par les clients du réseau."},{icon:yr,title:"Sur-mesure intra-entreprise",text:"Des parcours conçus pour vos équipes, dans vos locaux ou à distance, adaptés à vos outils et à votre contexte."},{icon:Vye,title:"Accompagnement au financement",text:"On vous oriente vers les bons dispositifs : plan de développement des compétences, OPCO, CPF — pour optimiser la prise en charge."},{icon:OR,title:"Gratuit, 0 commission",text:"La mise en relation et l'accompagnement sont gratuits. Vous payez la formation au tarif du formateur, sans marge cachée."},{icon:wi,title:"Qualité & remplacement garantis",text:"Processus de validation rigoureux et garantie de remplacement en cas d'empêchement : votre montée en compétences est sécurisée."}],L6e=[{n:"1",title:"Décrivez votre besoin",text:"Compétences à développer, équipe concernée, format et budget — en quelques minutes, gratuitement."},{n:"2",title:"Recevez une sélection",text:"Nous vous proposons les formateurs et programmes les plus pertinents, avec les pistes de financement."},{n:"3",title:"Formez vos équipes",text:"Vous choisissez, la formation se déroule, et chaque intervenant est évalué pour garantir la qualité."}];function F6e(){return s.jsxs(s.Fragment,{children:[s.jsx(nr,{title:"Formation professionnelle pour entreprises — trouvez la meilleure formation pour vos salariés",description:"PedagoBridge trouve gratuitement les meilleures formations pour vos salariés : formateurs experts vérifiés, parcours sur-mesure intra-entreprise, accompagnement au financement (OPCO, CPF, plan de développement des compétences). 0 commission.",url:"/formation-entreprise",keywords:["formation entreprise","formation professionnelle entreprise","formation des salariés","former ses salariés","plan de développement des compétences","formation intra-entreprise","financement formation OPCO","formation CPF entreprise","montée en compétences salariés","trouver une formation pour mes équipes"]}),s.jsx(ms,{items:[{name:"Accueil",url:"/"},{name:"Formation en entreprise",url:"/formation-entreprise"}]}),s.jsx(ao,{items:fq}),s.jsx("section",{className:"bg-gradient-to-br from-primary/5 to-secondary/5 border-b border-border/50",children:s.jsxs("div",{className:"container mx-auto px-4 py-20 text-center",children:[s.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-2xl bg-primary/10 text-primary mb-6",children:s.jsx(Na,{className:"h-8 w-8"})}),s.jsx("h1",{className:"text-4xl md:text-5xl font-bold mb-5",children:"La meilleure formation pour vos salariés, trouvée pour vous"}),s.jsx("p",{className:"text-xl text-muted-foreground max-w-3xl mx-auto",children:"Dites-nous quelles compétences développer dans vos équipes : PedagoBridge sélectionne les formateurs experts les plus pertinents, vous oriente sur le financement (OPCO, CPF, plan de développement) et sécurise la qualité. Gratuit, sans commission."}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 justify-center mt-8",children:[s.jsx(ne,{asChild:!0,size:"lg",children:s.jsxs(nt,{to:"/training-request?type=company&source=formation-entreprise",children:[s.jsx(yr,{className:"mr-2 h-5 w-5"}),"Trouver des formations pour mes équipes"]})}),s.jsx(ne,{asChild:!0,size:"lg",variant:"outline",children:s.jsx(nt,{to:"/trainers",children:"Parcourir les formateurs"})})]})]})}),s.jsx("section",{className:"py-16",children:s.jsxs("div",{className:"container mx-auto px-4 max-w-3xl",children:[s.jsx("h2",{className:"text-3xl font-bold mb-4",children:"Former vos équipes, sans la charge de la recherche"}),s.jsx("p",{className:"text-muted-foreground leading-relaxed mb-4",children:"Trouver le bon formateur prend du temps : comparer les offres, vérifier les références, négocier les tarifs, comprendre les financements… Pendant ce temps, les besoins en compétences de vos équipes, eux, n'attendent pas."}),s.jsxs("p",{className:"text-muted-foreground leading-relaxed",children:["PedagoBridge fait ce travail pour vous. Nous puisons dans un ",s.jsx("strong",{children:"réseau de formateurs experts vérifiés"})," pour vous proposer les formations les plus adaptées à vos objectifs, en",s.jsx("strong",{children:" présentiel ou à distance"}),", sur catalogue ou ",s.jsx("strong",{children:"sur-mesure"})," — et nous vous aidons à mobiliser les bons dispositifs de financement."]})]})}),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:"Ce que nous faisons pour vous"}),s.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6 max-w-6xl mx-auto",children:R6e.map((e,t)=>{const r=e.icon;return s.jsxs(je,{className:"h-full p-7 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-5",children:s.jsx(r,{className:"h-7 w-7"})}),s.jsx("h3",{className:"text-xl font-semibold mb-3",children:e.title}),s.jsx("p",{className:"text-muted-foreground leading-relaxed",children:e.text})]},t)})})]})}),s.jsx("section",{className:"py-16",children:s.jsxs("div",{className:"container mx-auto px-4 max-w-5xl",children:[s.jsx("h2",{className:"text-3xl font-bold text-center mb-12",children:"Comment ça marche"}),s.jsx("div",{className:"grid md:grid-cols-3 gap-8",children:L6e.map(e=>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 text-primary-foreground font-bold text-lg mb-4",children:e.n}),s.jsx("h3",{className:"text-lg font-semibold mb-2",children:e.title}),s.jsx("p",{className:"text-muted-foreground",children:e.text})]},e.n))})]})}),s.jsx("section",{className:"py-16 bg-muted/30",children:s.jsx("div",{className:"container mx-auto px-4 max-w-4xl",children:s.jsxs(je,{className:"p-8 md:p-10 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-5",children:s.jsx(er,{className:"h-7 w-7"})}),s.jsx("h2",{className:"text-2xl md:text-3xl font-bold mb-4",children:"Vous êtes salarié et vous voulez vous former ?"}),s.jsxs("p",{className:"text-muted-foreground leading-relaxed mb-4",children:["Vous avez identifié une compétence à acquérir mais ne savez pas comment la proposer à votre entreprise ? Nous vous aidons à ",s.jsx("strong",{children:"trouver la bonne formation"}),", à identifier les",s.jsx("strong",{children:" dispositifs de financement"})," (plan de développement des compétences, CPF, OPCO) et à construire un ",s.jsx("strong",{children:"dossier clair"})," à présenter à votre RH ou à votre manager."]}),s.jsx("ul",{className:"space-y-3 mb-7",children:["Une formation adaptée à votre objectif professionnel","Les pistes de financement mobilisables, expliquées simplement","Un argumentaire prêt à présenter à votre employeur"].map((e,t)=>s.jsxs("li",{className:"flex items-start gap-3",children:[s.jsx(Zn,{className:"h-5 w-5 text-primary mt-0.5 shrink-0"}),s.jsx("span",{className:"text-muted-foreground",children:e})]},t))}),s.jsx(ne,{asChild:!0,size:"lg",children:s.jsxs(nt,{to:"/training-request?type=company&source=formation-entreprise",children:[s.jsx(Sp,{className:"mr-2 h-5 w-5"}),"Proposer une formation à mon employeur"]})})]})})}),s.jsx("section",{className:"py-16",children:s.jsxs("div",{className:"container mx-auto px-4 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-6",children:fq.map((e,t)=>s.jsxs(je,{className:"p-6 border-border/50",children:[s.jsxs("h3",{className:"font-semibold text-lg mb-2 flex items-start gap-2",children:[s.jsx(Zn,{className:"h-5 w-5 text-primary mt-1 shrink-0"}),e.question]}),s.jsx("p",{className:"text-muted-foreground leading-relaxed",children:e.answer})]},t))})]})}),s.jsx("section",{className:"py-16",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsxs(je,{className:"max-w-4xl mx-auto p-10 text-center bg-gradient-to-br from-primary/5 to-secondary/5 border-primary/30",children:[s.jsx("div",{className:"inline-flex items-center justify-center w-12 h-12 rounded-full bg-primary/10 text-primary mb-4",children:s.jsx(rd,{className:"h-6 w-6"})}),s.jsx("h2",{className:"text-2xl md:text-3xl font-bold mb-3",children:"Développez les compétences de vos équipes"}),s.jsx("p",{className:"text-muted-foreground text-lg mb-8 max-w-2xl mx-auto",children:"Décrivez votre besoin de formation : nous revenons vers vous avec une sélection de formateurs experts et les pistes de financement. Gratuit, sans engagement."}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 justify-center",children:[s.jsx(ne,{asChild:!0,size:"lg",children:s.jsxs(nt,{to:"/training-request?type=company&source=formation-entreprise",children:[s.jsx(yr,{className:"mr-2 h-5 w-5"}),"Décrire mon besoin de formation"]})}),s.jsx(ne,{asChild:!0,size:"lg",variant:"outline",children:s.jsxs(nt,{to:"/conseil-conduite-du-changement",children:["Conduite du changement",s.jsx(Zr,{className:"ml-2 h-4 w-4"})]})})]})]})})})]})}const M6e=()=>{const e=Zt(),t=cu();w.useEffect(()=>{Oi.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:Rs,path:"/training-offers"},{title:"Nos formateurs",description:"Parcourez les profils de nos experts",icon:er,path:"/trainers"},{title:"Blog",description:"Consultez nos articles",icon:_l,path:"/blog"}];return s.jsxs(s.Fragment,{children:[s.jsx(nr,{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(je,{className:"mb-8",children:s.jsxs(Ee,{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(Hn,{className:"mr-2 h-4 w-4"}),"Retour"]}),s.jsxs(ne,{onClick:()=>e("/"),size:"lg",children:[s.jsx(MR,{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(je,{className:"hover:shadow-lg transition-all duration-300 cursor-pointer group",onClick:()=>e(n.path),children:s.jsxs(Ee,{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 iE="Tabs",[$6e]=ei(iE,[g1]),xae=g1(),[B6e,eF]=$6e(iE),gae=w.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,onValueChange:a,defaultValue:i,orientation:o="horizontal",dir:l,activationMode:c="automatic",...u}=e,d=q0(l),[f,m]=Zo({prop:n,onChange:a,defaultProp:i??"",caller:iE});return s.jsx(B6e,{scope:r,baseId:Za(),value:f,onValueChange:m,orientation:o,dir:d,activationMode:c,children:s.jsx(Vt.div,{dir:d,"data-orientation":o,...u,ref:t})})});gae.displayName=iE;var vae="TabsList",yae=w.forwardRef((e,t)=>{const{__scopeTabs:r,loop:n=!0,...a}=e,i=eF(vae,r),o=xae(r);return s.jsx(_L,{asChild:!0,...o,orientation:i.orientation,dir:i.dir,loop:n,children:s.jsx(Vt.div,{role:"tablist","aria-orientation":i.orientation,...a,ref:t})})});yae.displayName=vae;var bae="TabsTrigger",wae=w.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,disabled:a=!1,...i}=e,o=eF(bae,r),l=xae(r),c=Nae(o.baseId,n),u=Sae(o.baseId,n),d=n===o.value;return s.jsx(NL,{asChild:!0,...l,focusable:!a,active:d,children:s.jsx(Vt.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:Tt(e.onMouseDown,f=>{!a&&f.button===0&&f.ctrlKey===!1?o.onValueChange(n):f.preventDefault()}),onKeyDown:Tt(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&o.onValueChange(n)}),onFocus:Tt(e.onFocus,()=>{const f=o.activationMode!=="manual";!d&&!a&&f&&o.onValueChange(n)})})})});wae.displayName=bae;var jae="TabsContent",_ae=w.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,forceMount:a,children:i,...o}=e,l=eF(jae,r),c=Nae(l.baseId,n),u=Sae(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(ti,{present:a||d,children:({present:m})=>s.jsx(Vt.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})})});_ae.displayName=jae;function Nae(e,t){return`${e}-trigger-${t}`}function Sae(e,t){return`${e}-content-${t}`}var z6e=gae,kae=yae,Cae=wae,Eae=_ae;const uf=z6e,fd=w.forwardRef(({className:e,...t},r)=>s.jsx(kae,{ref:r,className:yt("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));fd.displayName=kae.displayName;const Mn=w.forwardRef(({className:e,...t},r)=>s.jsx(Cae,{ref:r,className:yt("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}));Mn.displayName=Cae.displayName;const Os=w.forwardRef(({className:e,...t},r)=>s.jsx(Eae,{ref:r,className:yt("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Os.displayName=Eae.displayName;const qn=$C,Xo=bL,q6e=BC,Aae=w.forwardRef(({className:e,...t},r)=>s.jsx(p1,{ref:r,className:yt("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}));Aae.displayName=p1.displayName;const $n=w.forwardRef(({className:e,children:t,...r},n)=>s.jsxs(q6e,{children:[s.jsx(Aae,{}),s.jsxs(x1,{ref:n,className:yt("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(zC,{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($i,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));$n.displayName=x1.displayName;const Un=({className:e,...t})=>s.jsx("div",{className:yt("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Un.displayName="DialogHeader";const bl=({className:e,...t})=>s.jsx("div",{className:yt("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});bl.displayName="DialogFooter";const Vn=w.forwardRef(({className:e,...t},r)=>s.jsx(r_,{ref:r,className:yt("text-lg font-semibold leading-none tracking-tight",e),...t}));Vn.displayName=r_.displayName;const Sa=w.forwardRef(({className:e,...t},r)=>s.jsx(n_,{ref:r,className:yt("text-sm text-muted-foreground",e),...t}));Sa.displayName=n_.displayName;function U6e(){const e=Zt(),[t]=Jj(),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,x]=w.useState(r==="school"?"school":"trainer"),[p,g]=w.useState(!1),[v,y]=w.useState(""),[b,N]=w.useState(!1);w.useEffect(()=>{const{data:{subscription:T}}=ce.auth.onAuthStateChange(async(R,k)=>{k&&setTimeout(async()=>{var O;const{data:E}=await ce.from("user_roles").select("role").eq("user_id",k.user.id),q=(E==null?void 0:E.map(L=>L.role))||[];if(q.includes("school"))e("/school/dashboard");else if(q.includes("trainer")){const{data:L}=await ce.from("trainer_profiles").select("id, bio, specialties").eq("user_id",k.user.id).single(),H=!L||!L.bio&&((O=L.specialties)==null?void 0:O.length)===0;e(H?"/trainer/profile":"/training-offers")}else e("/")},0)});return ce.auth.getSession().then(({data:{session:R}})=>{R&&e("/")}),()=>T.unsubscribe()},[e]),w.useEffect(()=>{r==="school"&&x("school")},[r]);const j=async()=>{o(!0);try{const{error:T}=await ce.auth.signInWithOAuth({provider:"google",options:{redirectTo:`${window.location.origin}/auth`,queryParams:{access_type:"offline",prompt:"consent"}}});if(T)throw T}catch(T){console.error("Google login error:",T),Oi.error("Google login failed",T,{action:"google_login",formName:"Auth"}),ae.error(T.message||"Erreur lors de la connexion avec Google"),o(!1)}},_=async T=>{if(T.preventDefault(),!v.trim()){ae.error("Veuillez entrer votre adresse email");return}c(!0);try{const{error:R}=await ce.auth.resetPasswordForEmail(v.trim(),{redirectTo:`${window.location.origin}/reset-password`});if(R)throw R;N(!0),Oi.formSubmit("password_reset_request",!0,{email:v}),ae.success("Email de réinitialisation envoyé !")}catch(R){console.error("Reset password error:",R),Oi.error("Password reset failed",R,{action:"password_reset",formName:"Auth"}),ae.error(R.message||"Erreur lors de l'envoi de l'email")}finally{c(!1)}},S=async T=>{var R;T.preventDefault(),a(!0);try{const{data:k,error:E}=await ce.auth.signInWithPassword({email:u,password:f});if(E)throw E;Oi.formSubmit("login",!0,{email:u,role:h}),dn.trackLogin(h),ae.success("Connexion réussie");const{data:q}=await ce.from("user_roles").select("role").eq("user_id",k.user.id),O=(q==null?void 0:q.map(L=>L.role))||[];if(O.includes("school"))e("/school/dashboard");else if(O.includes("trainer")){const{data:L}=await ce.from("trainer_profiles").select("id, bio, specialties").eq("user_id",k.user.id).single(),H=!L||!L.bio&&((R=L.specialties)==null?void 0:R.length)===0;e(H?"/trainer/profile":"/training-offers")}else e("/")}catch(k){console.error("Login error:",k),Oi.error("Login failed",k,{action:"login",formName:"Auth",metadata:{email:u}});let E="Erreur lors de la connexion";k.message.includes("Invalid login credentials")?E="Email ou mot de passe incorrect.":k.message.includes("Email not confirmed")?E="Veuillez confirmer votre email avant de vous connecter.":E=k.message||"Erreur lors de la connexion.",ae.error(E)}finally{a(!1)}},P=()=>{g(!1),y(""),N(!1)};return s.jsxs(s.Fragment,{children:[s.jsx(nr,{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(Hn,{className:"mr-2 h-4 w-4"}),"Retour à l'accueil"]}),s.jsxs(je,{children:[s.jsxs(mt,{className:"text-center pb-4",children:[s.jsx(gt,{className:"text-2xl",children:"Connexion"}),s.jsx(Kr,{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(Ee,{children:[s.jsx(uf,{value:h,onValueChange:x,className:"mb-6",children:s.jsxs(fd,{className:"grid w-full grid-cols-2",children:[s.jsxs(Mn,{value:"trainer",className:"flex items-center gap-2",children:[s.jsx(Na,{className:"h-4 w-4"}),"Formateur"]}),s.jsxs(Mn,{value:"school",className:"flex items-center gap-2",children:[s.jsx(yr,{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(yr,{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:j,disabled:i,children:[i?s.jsx(it,{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(Xe,{id:"login-email",type:"email",placeholder:"votre@email.com",value:u,onChange:T=>d(T.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:()=>g(!0),className:"text-sm text-primary hover:underline",children:"Mot de passe oublié ?"})]}),s.jsx(Xe,{id:"login-password",type:"password",placeholder:"••••••",value:f,onChange:T=>m(T.target.value),required:!0})]}),s.jsx(ne,{type:"submit",className:"w-full",disabled:n,children:n?s.jsxs(s.Fragment,{children:[s.jsx(it,{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(Na,{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(yr,{className:"mr-2 h-4 w-4"}),"Créer un compte établissement"]})]})]})]})]})]}),s.jsx(qn,{open:p,onOpenChange:P,children:s.jsxs($n,{className:"sm:max-w-md",children:[s.jsxs(Un,{children:[s.jsxs(Vn,{className:"flex items-center gap-2",children:[s.jsx(_n,{className:"h-5 w-5"}),"Réinitialiser le mot de passe"]}),s.jsx(Sa,{children:b?"Un email de réinitialisation a été envoyé à votre adresse.":"Entrez votre adresse email pour recevoir un lien de réinitialisation."})]}),b?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:P,className:"w-full",children:"Fermer"})]}):s.jsxs("form",{onSubmit:_,className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"reset-email",children:"Email"}),s.jsx(Xe,{id:"reset-email",type:"email",placeholder:"votre@email.com",value:v,onChange:T=>y(T.target.value),required:!0})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(ne,{type:"button",variant:"outline",onClick:P,className:"flex-1",children:"Annuler"}),s.jsx(ne,{type:"submit",disabled:l,className:"flex-1",children:l?s.jsxs(s.Fragment,{children:[s.jsx(it,{className:"mr-2 h-4 w-4 animate-spin"}),"Envoi..."]}):"Envoyer"})]})]})]})})]})]})}var oE="Checkbox",[V6e]=ei(oE),[H6e,tF]=V6e(oE);function W6e(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]=Zo({prop:r,defaultProp:a??!1,onChange:c,caller:oE}),[x,p]=w.useState(null),[g,v]=w.useState(null),y=w.useRef(!1),b=x?!!o||!!x.closest("form"):!0,N={checked:m,disabled:i,setChecked:h,control:x,setControl:p,name:l,form:o,value:d,hasConsumerStoppedPropagationRef:y,required:u,defaultChecked:Jm(a)?!1:a,isFormControl:b,bubbleInput:g,setBubbleInput:v};return s.jsx(H6e,{scope:t,...N,children:G6e(f)?f(N):n})}var Tae="CheckboxTrigger",Pae=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:x}=tF(Tae,e),p=Pr(a,d),g=w.useRef(c);return w.useEffect(()=>{const v=i==null?void 0:i.form;if(v){const y=()=>f(g.current);return v.addEventListener("reset",y),()=>v.removeEventListener("reset",y)}},[i,f]),s.jsx(Vt.button,{type:"button",role:"checkbox","aria-checked":Jm(c)?"mixed":c,"aria-required":u,"data-state":Lae(c),"data-disabled":l?"":void 0,disabled:l,value:o,...n,ref:p,onKeyDown:Tt(t,v=>{v.key==="Enter"&&v.preventDefault()}),onClick:Tt(r,v=>{f(y=>Jm(y)?!0:!y),x&&h&&(m.current=v.isPropagationStopped(),m.current||v.stopPropagation())})})});Pae.displayName=Tae;var rF=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(W6e,{__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(Pae,{...f,ref:t,__scopeCheckbox:r}),m&&s.jsx(Rae,{__scopeCheckbox:r})]})})});rF.displayName=oE;var Oae="CheckboxIndicator",Dae=w.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:n,...a}=e,i=tF(Oae,r);return s.jsx(ti,{present:n||Jm(i.checked)||i.checked===!0,children:s.jsx(Vt.span,{"data-state":Lae(i.checked),"data-disabled":i.disabled?"":void 0,...a,ref:t,style:{pointerEvents:"none",...e.style}})})});Dae.displayName=Oae;var Iae="CheckboxBubbleInput",Rae=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}=tF(Iae,e),x=Pr(r,h),p=QC(i),g=SC(n);w.useEffect(()=>{const y=m;if(!y)return;const b=window.HTMLInputElement.prototype,j=Object.getOwnPropertyDescriptor(b,"checked").set,_=!a.current;if(p!==i&&j){const S=new Event("click",{bubbles:_});y.indeterminate=Jm(i),j.call(y,Jm(i)?!1:i),y.dispatchEvent(S)}},[m,p,i,a]);const v=w.useRef(Jm(i)?!1:i);return s.jsx(Vt.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??v.current,required:l,disabled:c,name:u,value:d,form:f,...t,tabIndex:-1,ref:x,style:{...t.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Rae.displayName=Iae;function G6e(e){return typeof e=="function"}function Jm(e){return e==="indeterminate"}function Lae(e){return Jm(e)?"indeterminate":e?"checked":"unchecked"}const Yo=w.forwardRef(({className:e,...t},r)=>s.jsx(rF,{ref:r,className:yt("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(Dae,{className:yt("flex items-center justify-center text-current"),children:s.jsx(Rn,{className:"h-4 w-4"})})}));Yo.displayName=rF.displayName;var Fae="AlertDialog",[K6e]=ei(Fae,[ire]),Ch=ire(),Mae=e=>{const{__scopeAlertDialog:t,...r}=e,n=Ch(t);return s.jsx($C,{...n,...r,modal:!0})};Mae.displayName=Fae;var X6e="AlertDialogTrigger",$ae=w.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,a=Ch(r);return s.jsx(bL,{...a,...n,ref:t})});$ae.displayName=X6e;var Y6e="AlertDialogPortal",Bae=e=>{const{__scopeAlertDialog:t,...r}=e,n=Ch(t);return s.jsx(BC,{...n,...r})};Bae.displayName=Y6e;var Z6e="AlertDialogOverlay",zae=w.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,a=Ch(r);return s.jsx(p1,{...a,...n,ref:t})});zae.displayName=Z6e;var Iv="AlertDialogContent",[J6e,Q6e]=K6e(Iv),e8e=nQ("AlertDialogContent"),qae=w.forwardRef((e,t)=>{const{__scopeAlertDialog:r,children:n,...a}=e,i=Ch(r),o=w.useRef(null),l=Pr(t,o),c=w.useRef(null);return s.jsx(XSe,{contentName:Iv,titleName:Uae,docsSlug:"alert-dialog",children:s.jsx(J6e,{scope:r,cancelRef:c,children:s.jsxs(x1,{role:"alertdialog",...i,...a,ref:l,onOpenAutoFocus:Tt(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(e8e,{children:n}),s.jsx(r8e,{contentRef:o})]})})})});qae.displayName=Iv;var Uae="AlertDialogTitle",Vae=w.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,a=Ch(r);return s.jsx(r_,{...a,...n,ref:t})});Vae.displayName=Uae;var Hae="AlertDialogDescription",Wae=w.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,a=Ch(r);return s.jsx(n_,{...a,...n,ref:t})});Wae.displayName=Hae;var t8e="AlertDialogAction",Gae=w.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,a=Ch(r);return s.jsx(zC,{...a,...n,ref:t})});Gae.displayName=t8e;var Kae="AlertDialogCancel",Xae=w.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,{cancelRef:a}=Q6e(Kae,r),i=Ch(r),o=Pr(t,a);return s.jsx(zC,{...i,...n,ref:o})});Xae.displayName=Kae;var r8e=({contentRef:e})=>{const t=`\`${Iv}\` requires a description for the component to be accessible for screen reader users.
You can add a description to the \`${Iv}\` by passing a \`${Hae}\` 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 \`${Iv}\`. 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},n8e=Mae,s8e=$ae,a8e=Bae,Yae=zae,Zae=qae,Jae=Gae,Qae=Xae,eie=Vae,tie=Wae;const Gu=n8e,th=s8e,i8e=a8e,rie=w.forwardRef(({className:e,...t},r)=>s.jsx(Yae,{className:yt("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}));rie.displayName=Yae.displayName;const Kc=w.forwardRef(({className:e,...t},r)=>s.jsxs(i8e,{children:[s.jsx(rie,{}),s.jsx(Zae,{ref:r,className:yt("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})]}));Kc.displayName=Zae.displayName;const Xc=({className:e,...t})=>s.jsx("div",{className:yt("flex flex-col space-y-2 text-center sm:text-left",e),...t});Xc.displayName="AlertDialogHeader";const Yc=({className:e,...t})=>s.jsx("div",{className:yt("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Yc.displayName="AlertDialogFooter";const Zc=w.forwardRef(({className:e,...t},r)=>s.jsx(eie,{ref:r,className:yt("text-lg font-semibold",e),...t}));Zc.displayName=eie.displayName;const Jc=w.forwardRef(({className:e,...t},r)=>s.jsx(tie,{ref:r,className:yt("text-sm text-muted-foreground",e),...t}));Jc.displayName=tie.displayName;const Qc=w.forwardRef(({className:e,...t},r)=>s.jsx(Jae,{ref:r,className:yt(E2(),e),...t}));Qc.displayName=Jae.displayName;const Ku=w.forwardRef(({className:e,...t},r)=>s.jsx(Qae,{ref:r,className:yt(E2({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));Ku.displayName=Qae.displayName;function o8e(){const e=Zt(),[t]=Jj(),[r,n]=w.useState(!1),[a,i]=w.useState(!1);w.useEffect(()=>{const b=t.get("ref");b&&localStorage.setItem("pb_ref",b)},[t]);const[o,l]=w.useState(""),[c,u]=w.useState(""),[d,f]=w.useState(""),[m,h]=w.useState(""),[x,p]=w.useState(!1),g=async b=>{if(b.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(!x){ae.error("Veuillez accepter les CGU et la politique de confidentialité");return}n(!0);try{const{data:N,error:j}=await ce.auth.signUp({email:c.trim(),password:d,options:{emailRedirectTo:`${window.location.origin}/`,data:{name:o.trim()}}});if(j)throw j;if(!N.user)throw new Error("Erreur lors de la création du compte");const{error:_}=await ce.from("user_roles").insert({user_id:N.user.id,role:"trainer"});_&&console.error("Error assigning role:",_);const S=t.get("ref")||localStorage.getItem("pb_ref"),{error:P}=await ce.from("trainer_profiles").insert({user_id:N.user.id,email:c.trim(),name:o.trim(),status:"pending",...S?{referred_by_code:S}:{}});P||localStorage.removeItem("pb_ref"),P?console.error("Error creating profile:",P):dn.trackSignup("trainer");try{await ce.functions.invoke("notify-trainer-signup",{body:{trainerName:o.trim(),trainerEmail:c.trim()}})}catch(T){console.error("Error sending notification email:",T)}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")},y=()=>{e("/")};return s.jsxs(s.Fragment,{children:[s.jsx(nr,{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(Hn,{className:"mr-2 h-4 w-4"}),"Retour à la connexion"]}),s.jsxs(je,{children:[s.jsxs(mt,{className:"text-center",children:[s.jsx(gt,{className:"text-2xl",children:"Créer un compte formateur"}),s.jsx(Kr,{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:Qn,text:"Offres de formation en continu"},{icon:no,text:"Badge formateur certifié"},{icon:Wr,text:"Profil visible par les écoles"}].map(b=>{const N=b.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:b.text})]},b.text)})})]}),s.jsxs(Ee,{children:[s.jsxs("form",{onSubmit:g,className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"name",children:"Nom complet *"}),s.jsx(Xe,{id:"name",type:"text",placeholder:"Jean Dupont",value:o,onChange:b=>l(b.target.value),required:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"email",children:"Email *"}),s.jsx(Xe,{id:"email",type:"email",placeholder:"jean.dupont@example.com",value:c,onChange:b=>u(b.target.value),required:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"password",children:"Mot de passe *"}),s.jsx(Xe,{id:"password",type:"password",placeholder:"Minimum 6 caractères",value:d,onChange:b=>f(b.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(Xe,{id:"confirmPassword",type:"password",placeholder:"Confirmez votre mot de passe",value:m,onChange:b=>h(b.target.value),required:!0})]}),s.jsxs("div",{className:"flex items-start space-x-2 pt-2",children:[s.jsx(Yo,{id:"terms",checked:x,onCheckedChange:b=>p(b)}),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(it,{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(wi,{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(Gu,{open:a,onOpenChange:i,children:s.jsxs(Kc,{children:[s.jsxs(Xc,{children:[s.jsx(Zc,{children:"Compte créé avec succès ! 🎉"}),s.jsx(Jc,{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(Yc,{className:"flex-col sm:flex-row gap-2",children:[s.jsx(ne,{variant:"outline",onClick:y,className:"w-full sm:w-auto",children:"Compléter plus tard"}),s.jsx(Qc,{onClick:v,className:"w-full sm:w-auto",children:"Compléter mon profil"})]})]})})]})}var hq=1,l8e=.9,c8e=.8,u8e=.17,yT=.1,bT=.999,d8e=.9999,f8e=.99,h8e=/[\\\/_+.#"@\[\(\{&]/,m8e=/[\\\/_+.#"@\[\(\{&]/g,p8e=/[\s-]/,nie=/[\s-]/g;function l8(e,t,r,n,a,i,o){if(i===t.length)return a===e.length?hq:f8e;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,x;u>=0;)f=l8(e,t,r,n,u+1,i+1,o),f>d&&(u===a?f*=hq:h8e.test(e.charAt(u-1))?(f*=c8e,h=e.slice(a,u-1).match(m8e),h&&a>0&&(f*=Math.pow(bT,h.length))):p8e.test(e.charAt(u-1))?(f*=l8e,x=e.slice(a,u-1).match(nie),x&&a>0&&(f*=Math.pow(bT,x.length))):(f*=u8e,a>0&&(f*=Math.pow(bT,u-a))),e.charAt(u)!==t.charAt(i)&&(f*=d8e)),(f<yT&&r.charAt(u-1)===n.charAt(i+1)||n.charAt(i+1)===n.charAt(i)&&r.charAt(u-1)!==n.charAt(i))&&(m=l8(e,t,r,n,u+1,i+2,o),m*yT>f&&(f=m*yT)),f>d&&(d=f),u=r.indexOf(c,u+1);return o[l]=d,d}function mq(e){return e.toLowerCase().replace(nie," ")}function x8e(e,t,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,l8(e,t,mq(e),mq(t),0,0,{})}var Db='[cmdk-group=""]',wT='[cmdk-group-items=""]',g8e='[cmdk-group-heading=""]',sie='[cmdk-item=""]',pq=`${sie}:not([aria-disabled="true"])`,c8="cmdk-item-select",Wg="data-value",v8e=(e,t,r)=>x8e(e,t,r),aie=w.createContext(void 0),c_=()=>w.useContext(aie),iie=w.createContext(void 0),nF=()=>w.useContext(iie),oie=w.createContext(void 0),lie=w.forwardRef((e,t)=>{let r=Gg(()=>{var C,A;return{search:"",value:(A=(C=e.value)!=null?C:e.defaultValue)!=null?A:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),n=Gg(()=>new Set),a=Gg(()=>new Map),i=Gg(()=>new Map),o=Gg(()=>new Set),l=cie(e),{label:c,children:u,value:d,onValueChange:f,filter:m,shouldFilter:h,loop:x,disablePointerSelection:p=!1,vimBindings:g=!0,...v}=e,y=Za(),b=Za(),N=Za(),j=w.useRef(null),_=A8e();y0(()=>{if(d!==void 0){let C=d.trim();r.current.value=C,S.emit()}},[d]),y0(()=>{_(6,q)},[]);let S=w.useMemo(()=>({subscribe:C=>(o.current.add(C),()=>o.current.delete(C)),snapshot:()=>r.current,setState:(C,A,I)=>{var U,Y,te,re;if(!Object.is(r.current[C],A)){if(r.current[C]=A,C==="search")E(),R(),_(1,k);else if(C==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let J=document.getElementById(N);J?J.focus():(U=document.getElementById(y))==null||U.focus()}if(_(7,()=>{var J;r.current.selectedItemId=(J=O())==null?void 0:J.id,S.emit()}),I||_(5,q),((Y=l.current)==null?void 0:Y.value)!==void 0){let J=A??"";(re=(te=l.current).onValueChange)==null||re.call(te,J);return}}S.emit()}},emit:()=>{o.current.forEach(C=>C())}}),[]),P=w.useMemo(()=>({value:(C,A,I)=>{var U;A!==((U=i.current.get(C))==null?void 0:U.value)&&(i.current.set(C,{value:A,keywords:I}),r.current.filtered.items.set(C,T(A,I)),_(2,()=>{R(),S.emit()}))},item:(C,A)=>(n.current.add(C),A&&(a.current.has(A)?a.current.get(A).add(C):a.current.set(A,new Set([C]))),_(3,()=>{E(),R(),r.current.value||k(),S.emit()}),()=>{i.current.delete(C),n.current.delete(C),r.current.filtered.items.delete(C);let I=O();_(4,()=>{E(),(I==null?void 0:I.getAttribute("id"))===C&&k(),S.emit()})}),group:C=>(a.current.has(C)||a.current.set(C,new Set),()=>{i.current.delete(C),a.current.delete(C)}),filter:()=>l.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:y,inputId:N,labelId:b,listInnerRef:j}),[]);function T(C,A){var I,U;let Y=(U=(I=l.current)==null?void 0:I.filter)!=null?U:v8e;return C?Y(C,r.current.search,A):0}function R(){if(!r.current.search||l.current.shouldFilter===!1)return;let C=r.current.filtered.items,A=[];r.current.filtered.groups.forEach(U=>{let Y=a.current.get(U),te=0;Y.forEach(re=>{let J=C.get(re);te=Math.max(J,te)}),A.push([U,te])});let I=j.current;L().sort((U,Y)=>{var te,re;let J=U.getAttribute("id"),ie=Y.getAttribute("id");return((te=C.get(ie))!=null?te:0)-((re=C.get(J))!=null?re:0)}).forEach(U=>{let Y=U.closest(wT);Y?Y.appendChild(U.parentElement===Y?U:U.closest(`${wT} > *`)):I.appendChild(U.parentElement===I?U:U.closest(`${wT} > *`))}),A.sort((U,Y)=>Y[1]-U[1]).forEach(U=>{var Y;let te=(Y=j.current)==null?void 0:Y.querySelector(`${Db}[${Wg}="${encodeURIComponent(U[0])}"]`);te==null||te.parentElement.appendChild(te)})}function k(){let C=L().find(I=>I.getAttribute("aria-disabled")!=="true"),A=C==null?void 0:C.getAttribute(Wg);S.setState("value",A||void 0)}function E(){var C,A,I,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 te of n.current){let re=(A=(C=i.current.get(te))==null?void 0:C.value)!=null?A:"",J=(U=(I=i.current.get(te))==null?void 0:I.keywords)!=null?U:[],ie=T(re,J);r.current.filtered.items.set(te,ie),ie>0&&Y++}for(let[te,re]of a.current)for(let J of re)if(r.current.filtered.items.get(J)>0){r.current.filtered.groups.add(te);break}r.current.filtered.count=Y}function q(){var C,A,I;let U=O();U&&(((C=U.parentElement)==null?void 0:C.firstChild)===U&&((I=(A=U.closest(Db))==null?void 0:A.querySelector(g8e))==null||I.scrollIntoView({block:"nearest"})),U.scrollIntoView({block:"nearest"}))}function O(){var C;return(C=j.current)==null?void 0:C.querySelector(`${sie}[aria-selected="true"]`)}function L(){var C;return Array.from(((C=j.current)==null?void 0:C.querySelectorAll(pq))||[])}function H(C){let A=L()[C];A&&S.setState("value",A.getAttribute(Wg))}function V(C){var A;let I=O(),U=L(),Y=U.findIndex(re=>re===I),te=U[Y+C];(A=l.current)!=null&&A.loop&&(te=Y+C<0?U[U.length-1]:Y+C===U.length?U[0]:U[Y+C]),te&&S.setState("value",te.getAttribute(Wg))}function z(C){let A=O(),I=A==null?void 0:A.closest(Db),U;for(;I&&!U;)I=C>0?C8e(I,Db):E8e(I,Db),U=I==null?void 0:I.querySelector(pq);U?S.setState("value",U.getAttribute(Wg)):V(C)}let M=()=>H(L().length-1),B=C=>{C.preventDefault(),C.metaKey?M():C.altKey?z(1):V(1)},K=C=>{C.preventDefault(),C.metaKey?H(0):C.altKey?z(-1):V(-1)};return w.createElement(Vt.div,{ref:t,tabIndex:-1,...v,"cmdk-root":"",onKeyDown:C=>{var A;(A=v.onKeyDown)==null||A.call(v,C);let I=C.nativeEvent.isComposing||C.keyCode===229;if(!(C.defaultPrevented||I))switch(C.key){case"n":case"j":{g&&C.ctrlKey&&B(C);break}case"ArrowDown":{B(C);break}case"p":case"k":{g&&C.ctrlKey&&K(C);break}case"ArrowUp":{K(C);break}case"Home":{C.preventDefault(),H(0);break}case"End":{C.preventDefault(),M();break}case"Enter":{C.preventDefault();let U=O();if(U){let Y=new Event(c8);U.dispatchEvent(Y)}}}}},w.createElement("label",{"cmdk-label":"",htmlFor:P.inputId,id:P.labelId,style:P8e},c),lE(e,C=>w.createElement(iie.Provider,{value:S},w.createElement(aie.Provider,{value:P},C))))}),y8e=w.forwardRef((e,t)=>{var r,n;let a=Za(),i=w.useRef(null),o=w.useContext(oie),l=c_(),c=cie(e),u=(n=(r=c.current)==null?void 0:r.forceMount)!=null?n:o==null?void 0:o.forceMount;y0(()=>{if(!u)return l.item(a,o==null?void 0:o.id)},[u]);let d=uie(a,i,[e.value,e.children,i],e.keywords),f=nF(),m=up(_=>_.value&&_.value===d.current),h=up(_=>u||l.filter()===!1?!0:_.search?_.filtered.items.get(a)>0:!0);w.useEffect(()=>{let _=i.current;if(!(!_||e.disabled))return _.addEventListener(c8,x),()=>_.removeEventListener(c8,x)},[h,e.onSelect,e.disabled]);function x(){var _,S;p(),(S=(_=c.current).onSelect)==null||S.call(_,d.current)}function p(){f.setState("value",d.current,!0)}if(!h)return null;let{disabled:g,value:v,onSelect:y,forceMount:b,keywords:N,...j}=e;return w.createElement(Vt.div,{ref:hh(i,t),...j,id:a,"cmdk-item":"",role:"option","aria-disabled":!!g,"aria-selected":!!m,"data-disabled":!!g,"data-selected":!!m,onPointerMove:g||l.getDisablePointerSelection()?void 0:p,onClick:g?void 0:x},e.children)}),b8e=w.forwardRef((e,t)=>{let{heading:r,children:n,forceMount:a,...i}=e,o=Za(),l=w.useRef(null),c=w.useRef(null),u=Za(),d=c_(),f=up(h=>a||d.filter()===!1?!0:h.search?h.filtered.groups.has(o):!0);y0(()=>d.group(o),[]),uie(o,l,[e.value,e.heading,c]);let m=w.useMemo(()=>({id:o,forceMount:a}),[a]);return w.createElement(Vt.div,{ref:hh(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),lE(e,h=>w.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?u:void 0},w.createElement(oie.Provider,{value:m},h))))}),w8e=w.forwardRef((e,t)=>{let{alwaysRender:r,...n}=e,a=w.useRef(null),i=up(o=>!o.search);return!r&&!i?null:w.createElement(Vt.div,{ref:hh(a,t),...n,"cmdk-separator":"",role:"separator"})}),j8e=w.forwardRef((e,t)=>{let{onValueChange:r,...n}=e,a=e.value!=null,i=nF(),o=up(u=>u.search),l=up(u=>u.selectedItemId),c=c_();return w.useEffect(()=>{e.value!=null&&i.setState("search",e.value)},[e.value]),w.createElement(Vt.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)}})}),_8e=w.forwardRef((e,t)=>{let{children:r,label:n="Suggestions",...a}=e,i=w.useRef(null),o=w.useRef(null),l=up(u=>u.selectedItemId),c=c_();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(Vt.div,{ref:hh(i,t),...a,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":n,id:c.listId},lE(e,u=>w.createElement("div",{ref:hh(o,c.listInnerRef),"cmdk-list-sizer":""},u)))}),N8e=w.forwardRef((e,t)=>{let{open:r,onOpenChange:n,overlayClassName:a,contentClassName:i,container:o,...l}=e;return w.createElement($C,{open:r,onOpenChange:n},w.createElement(BC,{container:o},w.createElement(p1,{"cmdk-overlay":"",className:a}),w.createElement(x1,{"aria-label":e.label,"cmdk-dialog":"",className:i},w.createElement(lie,{ref:t,...l}))))}),S8e=w.forwardRef((e,t)=>up(r=>r.filtered.count===0)?w.createElement(Vt.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),k8e=w.forwardRef((e,t)=>{let{progress:r,children:n,label:a="Loading...",...i}=e;return w.createElement(Vt.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},lE(e,o=>w.createElement("div",{"aria-hidden":!0},o)))}),Sl=Object.assign(lie,{List:_8e,Item:y8e,Input:j8e,Group:b8e,Separator:w8e,Dialog:N8e,Empty:S8e,Loading:k8e});function C8e(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function E8e(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function cie(e){let t=w.useRef(e);return y0(()=>{t.current=e}),t}var y0=typeof window>"u"?w.useEffect:w.useLayoutEffect;function Gg(e){let t=w.useRef();return t.current===void 0&&(t.current=e()),t}function up(e){let t=nF(),r=()=>e(t.snapshot());return w.useSyncExternalStore(t.subscribe,r,r)}function uie(e,t,r,n=[]){let a=w.useRef(),i=c_();return y0(()=>{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(Wg,l),a.current=l}),a}var A8e=()=>{let[e,t]=w.useState(),r=Gg(()=>new Map);return y0(()=>{r.current.forEach(n=>n()),r.current=new Map},[e]),(n,a)=>{r.current.set(n,a),t({})}};function T8e(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function lE({asChild:e,children:t},r){return e&&w.isValidElement(t)?w.cloneElement(T8e(t),{ref:t.ref},r(t.props.children)):r(t)}var P8e={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const dp=w.forwardRef(({className:e,...t},r)=>s.jsx(Sl,{ref:r,className:yt("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));dp.displayName=Sl.displayName;const O8e=({children:e,...t})=>s.jsx(qn,{...t,children:s.jsx($n,{className:"overflow-hidden p-0 shadow-lg",children:s.jsx(dp,{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})})}),fp=w.forwardRef(({className:e,...t},r)=>s.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[s.jsx(Rs,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),s.jsx(Sl.Input,{ref:r,className:yt("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})]}));fp.displayName=Sl.Input.displayName;const hp=w.forwardRef(({className:e,...t},r)=>s.jsx(Sl.List,{ref:r,className:yt("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));hp.displayName=Sl.List.displayName;const mp=w.forwardRef((e,t)=>s.jsx(Sl.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));mp.displayName=Sl.Empty.displayName;const rh=w.forwardRef(({className:e,...t},r)=>s.jsx(Sl.Group,{ref:r,className:yt("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}));rh.displayName=Sl.Group.displayName;const D8e=w.forwardRef(({className:e,...t},r)=>s.jsx(Sl.Separator,{ref:r,className:yt("-mx-1 h-px bg-border",e),...t}));D8e.displayName=Sl.Separator.displayName;const qu=w.forwardRef(({className:e,...t},r)=>s.jsx(Sl.Item,{ref:r,className:yt("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}));qu.displayName=Sl.Item.displayName;function I8e(){const[e,t]=w.useState(!1),[r,n]=w.useState(""),[a,i]=w.useState([]),[o,l]=w.useState(!1),c=Zt();w.useEffect(()=>{const h=x=>{x.key==="k"&&(x.metaKey||x.ctrlKey)&&(x.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 x=[];h.toLowerCase();try{const{data:p}=await ce.from("trainer_profiles").select("id, name, email, status").or(`name.ilike.%${h}%,email.ilike.%${h}%`).limit(5);p&&x.push(...p.map(b=>({id:b.id,type:"trainer",title:b.name,subtitle:`${b.email} - ${b.status==="approved"?"Approuvé":b.status==="pending"?"En attente":"Rejeté"}`,href:"/admin/trainers"})));const{data:g}=await ce.from("school_profiles").select("id, name, contact_email").or(`name.ilike.%${h}%,contact_email.ilike.%${h}%`).limit(5);g&&x.push(...g.map(b=>({id:b.id,type:"school",title:b.name,subtitle:b.contact_email||void 0,href:"/admin/schools"})));const{data:v}=await ce.from("school_requests").select("id, school_name, description, status").or(`school_name.ilike.%${h}%,description.ilike.%${h}%`).limit(5);v&&x.push(...v.map(b=>({id:b.id,type:"offer",title:b.school_name,subtitle:b.description.substring(0,50)+"...",href:"/admin/training-requests"})));const{data:y}=await ce.from("blog_posts").select("id, title, slug, status").or(`title.ilike.%${h}%`).limit(5);y&&x.push(...y.map(b=>({id:b.id,type:"blog",title:b.title,subtitle:b.status==="published"?"Publié":"Brouillon",href:`/admin/blog/edit/${b.id}`}))),i(x)}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(Ko,{className:"h-4 w-4"});case"school":return s.jsx(yr,{className:"h-4 w-4"});case"offer":return s.jsx(Qn,{className:"h-4 w-4"});case"blog":return s.jsx(Kt,{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,x)=>(h[x.type]||(h[x.type]=[]),h[x.type].push(x),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(Rs,{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(O8e,{open:e,onOpenChange:t,children:[s.jsx(fp,{placeholder:"Rechercher formateurs, écoles, offres, articles...",value:r,onValueChange:n}),s.jsxs(hp,{children:[s.jsx(mp,{children:o?"Recherche en cours...":"Aucun résultat trouvé."}),Object.entries(m).map(([h,x],p)=>s.jsx(rh,{heading:f(h),children:x.map(g=>s.jsxs(qu,{value:g.title,onSelect:()=>{c(g.href),t(!1),n("")},children:[d(g.type),s.jsxs("div",{className:"ml-2 flex-1",children:[s.jsx("p",{className:"text-sm font-medium",children:g.title}),g.subtitle&&s.jsx("p",{className:"text-xs text-muted-foreground",children:g.subtitle})]})]},g.id))},h))]})]})]})}function R8e(){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([ce.from("trainer_profiles").select("id",{count:"exact",head:!0}).eq("status","pending"),ce.from("school_requests").select("id",{count:"exact",head:!0}).eq("status","pending"),ce.from("school_profiles").select("id",{count:"exact",head:!0}).eq("is_verified",!1),ce.from("trainer_contracts").select("id",{count:"exact",head:!0}).eq("status","signed").eq("counter_signed",!1),ce.from("trainer_profiles").select("id",{count:"exact",head:!0}).eq("status","approved").eq("is_visible",!1),ce.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:yt("animate-pulse rounded-md bg-muted",e),...t})}const L8e=[{title:"Formateurs",description:"Gérer les profils, approuver les inscriptions",icon:er,path:"/admin/trainers",color:"bg-blue-500",countKey:"pendingTrainers"},{title:"Contrats",description:"Contre-signer les contrats formateurs, voir les prestations",icon:c6,path:"/admin/contracts",color:"bg-amber-500",highlight:!0,countKey:"contractsToCountersign"},{title:"Suivi Missions",description:"Vue d'ensemble des candidatures et missions",icon:Ql,path:"/admin/missions",color:"bg-teal-500"},{title:"Invitations",description:"Inviter de nouveaux formateurs par email",icon:_n,path:"/admin/invitations",color:"bg-purple-500"},{title:"Offres de Formation",description:"Valider et gérer les offres des écoles",icon:Qn,path:"/admin/training-requests",color:"bg-green-500",countKey:"pendingOffers"},{title:"Écoles",description:"Voir la liste des établissements inscrits",icon:yr,path:"/admin/schools",color:"bg-orange-500",countKey:"pendingSchools"},{title:"Documents",description:"Vérifier et valider les documents des formateurs",icon:sp,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:Xj,path:"/admin/drive",color:"bg-emerald-600"},{title:"Formateurs hors plateforme",description:"Profils issus des CV du Drive, jamais publics — à inviter pour qu'ils créent leur compte",icon:er,path:"/admin/off-platform-trainers",color:"bg-teal-600"},{title:"Demandes NDA",description:"Aider les formateurs à obtenir leur NDA",icon:Kt,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:_n,path:"/admin/linkedin-lead",color:"bg-sky-500"},{title:"Factures",description:"Gérer la facturation des missions avec formateurs certifiés",icon:BR,path:"/admin/invoices",color:"bg-emerald-500"},{title:"Avis Écoles",description:"Consulter les avis des formateurs sur les écoles",icon:no,path:"/admin/school-reviews",color:"bg-yellow-500"},{title:"Blog",description:"Créer et gérer les articles du blog",icon:Kt,path:"/admin/blog",color:"bg-indigo-500"},{title:"Calendrier Éditorial",description:"Planifier la publication des articles",icon:Hs,path:"/admin/editorial-calendar",color:"bg-pink-500"},{title:"Newsletter",description:"Gérer les abonnés et les envois",icon:Fi,path:"/admin/newsletter",color:"bg-cyan-500"},{title:"Emailing Formateurs",description:"Email de masse aux formateurs inscrits + liste importée (filtres ville/module)",icon:_n,path:"/admin/trainer-mailing",color:"bg-violet-500"},{title:"Délivrabilité Emails",description:"Suivre le taux de délivrance des emails",icon:_n,path:"/admin/email-dashboard",color:"bg-rose-500"},{title:"Messages Contact",description:"Consulter les messages du formulaire de contact",icon:Fi,path:"/admin/contact-messages",color:"bg-slate-500"},{title:"Prospection",description:"Gérer les prospects écoles et entreprises",icon:Sp,path:"/admin/prospection",color:"bg-fuchsia-500"},{title:"Logs Application",description:"Consulter les journaux d'activité",icon:Kt,path:"/admin/logs",color:"bg-gray-500"},{title:"Analytics",description:"Statistiques et performances de la plateforme",icon:n1,path:"/admin/analytics",color:"bg-red-500"}],F8e=[{title:"Glossaire",description:"Dictionnaire des termes de la formation",icon:Kt,path:"/admin/glossary",color:"bg-violet-500"},{title:"Fiches Métiers",description:"Pages métiers pour le SEO",icon:Qn,path:"/admin/jobs",color:"bg-sky-500"},{title:"Ressources",description:"Templates et documents téléchargeables",icon:Kt,path:"/admin/resources",color:"bg-lime-500"}];function Ib({icon:e,title:t,count:r,path:n,color:a,label:i}){return r===0?null:s.jsx(nt,{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(Te,{variant:"destructive",className:"text-xs",children:r})]})})}function M8e(){const{isAdmin:e,isTrainer:t}=Br(),r=Zt(),{pendingTrainers:n,pendingOffers:a,pendingSchools:i,contractsToCountersign:o,hiddenApprovedTrainers:l,pendingNDARequests:c,loading:u}=R8e();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(nr,{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(Jo,{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(I8e,{})]}),u?s.jsxs(je,{className:"mb-8",children:[s.jsx(mt,{children:s.jsx(Yr,{className:"h-6 w-48"})}),s.jsx(Ee,{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(je,{className:"mb-8 border-destructive/50 bg-destructive/5",children:[s.jsxs(mt,{className:"pb-3",children:[s.jsxs(gt,{className:"text-lg flex items-center gap-2",children:[s.jsx(Li,{className:"h-5 w-5 text-destructive"}),"Actions prioritaires",s.jsx(Te,{variant:"destructive",children:d})]}),s.jsx(Kr,{children:"Ces éléments nécessitent votre attention"})]}),s.jsx(Ee,{children:s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[s.jsx(Ib,{icon:er,title:"Nouveaux formateurs",count:n,path:"/admin/trainers",color:"bg-blue-500"}),s.jsx(Ib,{icon:Qn,title:"Nouvelles offres",count:a,path:"/admin/training-requests",color:"bg-green-500"}),s.jsx(Ib,{icon:yr,title:"Écoles à vérifier",count:i,path:"/admin/schools",color:"bg-orange-500"}),s.jsx(Ib,{icon:c6,title:"Contrats à contre-signer",count:o,path:"/admin/contracts",color:"bg-amber-500"}),s.jsx(Ib,{icon:yC,title:"Formateurs masqués",count:l,path:"/admin/trainers",color:"bg-gray-500",label:"approuvé(s) non visible(s)"})]})})]}):s.jsx(je,{className:"mb-8 border-green-500/50 bg-green-500/5",children:s.jsx(Ee,{className:"py-6",children:s.jsx("p",{className:"text-center text-muted-foreground",children:"✓ Aucune action prioritaire en attente"})})}),t&&s.jsxs(je,{className:"mb-8 border-primary/50 bg-primary/5",children:[s.jsxs(mt,{className:"pb-3",children:[s.jsxs(gt,{className:"text-lg flex items-center gap-2",children:[s.jsx(r9,{className:"h-5 w-5 text-primary"}),"Mon Profil Formateur"]}),s.jsx(Kr,{children:"Vous êtes également formateur sur la plateforme"})]}),s.jsx(Ee,{children:s.jsxs("div",{className:"flex flex-wrap gap-3",children:[s.jsx(nt,{to:"/trainer-profile",children:s.jsx(je,{className:"hover:shadow-md transition-all cursor-pointer group",children:s.jsxs(Ee,{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(r9,{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(nt,{to:"/trainer-applications",children:s.jsx(je,{className:"hover:shadow-md transition-all cursor-pointer group",children:s.jsxs(Ee,{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(Qn,{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(nt,{to:"/trainer/contract",children:s.jsx(je,{className:"hover:shadow-md transition-all cursor-pointer group",children:s.jsxs(Ee,{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(c6,{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:L8e.map(m=>{const h=f(m.countKey);return s.jsx(nt,{to:m.path,children:s.jsx(je,{className:`hover:shadow-lg transition-all cursor-pointer group h-full ${m.highlight?"ring-2 ring-amber-400":""}`,children:s.jsx(mt,{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(gt,{className:"text-lg group-hover:text-primary transition-colors flex items-center gap-2",children:[m.title,s.jsx(Kn,{className:"w-4 h-4 opacity-0 group-hover:opacity-50 transition-opacity"})]}),s.jsx(Kr,{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(n1,{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:F8e.map(m=>s.jsx(nt,{to:m.path,children:s.jsx(je,{className:"hover:shadow-lg transition-all cursor-pointer group h-full",children:s.jsx(mt,{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(gt,{className:"text-lg group-hover:text-primary transition-colors flex items-center gap-2",children:[m.title,s.jsx(Kn,{className:"w-4 h-4 opacity-0 group-hover:opacity-50 transition-opacity"})]}),s.jsx(Kr,{className:"text-sm mt-1",children:m.description})]})]})})})},m.path))})]})]})]})}const die=w.forwardRef(({...e},t)=>s.jsx("nav",{ref:t,"aria-label":"breadcrumb",...e}));die.displayName="Breadcrumb";const fie=w.forwardRef(({className:e,...t},r)=>s.jsx("ol",{ref:r,className:yt("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",e),...t}));fie.displayName="BreadcrumbList";const u8=w.forwardRef(({className:e,...t},r)=>s.jsx("li",{ref:r,className:yt("inline-flex items-center gap-1.5",e),...t}));u8.displayName="BreadcrumbItem";const d8=w.forwardRef(({asChild:e,className:t,...r},n)=>{const a=e?tQ:"a";return s.jsx(a,{ref:n,className:yt("transition-colors hover:text-foreground",t),...r})});d8.displayName="BreadcrumbLink";const hie=w.forwardRef(({className:e,...t},r)=>s.jsx("span",{ref:r,role:"link","aria-disabled":"true","aria-current":"page",className:yt("font-normal text-foreground",e),...t}));hie.displayName="BreadcrumbPage";const mie=({children:e,className:t,...r})=>s.jsx("li",{role:"presentation","aria-hidden":"true",className:yt("[&>svg]:size-3.5",t),...r,children:e??s.jsx(nu,{})});mie.displayName="BreadcrumbSeparator";function ta({items:e}){return s.jsx(die,{className:"mb-6",children:s.jsxs(fie,{children:[s.jsx(u8,{children:s.jsx(d8,{asChild:!0,children:s.jsxs(nt,{to:"/admin",className:"flex items-center gap-2",children:[s.jsx(MR,{className:"h-4 w-4"}),"Admin"]})})}),e.map((t,r)=>s.jsxs(u8,{children:[s.jsx(mie,{}),r===e.length-1||!t.href?s.jsx(hie,{children:t.label}):s.jsx(d8,{asChild:!0,children:s.jsx(nt,{to:t.href,children:t.label})})]},r))]})})}function $8e(){const e=Zt(),[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 ce.auth.getSession();if(!l){ae.error("Vous devez être connecté"),e("/auth");return}const{data:c,error:u}=await ce.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(ta,{items:[{label:"Invitations"}]}),s.jsxs(je,{children:[s.jsxs(mt,{children:[s.jsx(gt,{className:"text-2xl",children:"Inviter un formateur"}),s.jsx(Kr,{children:"Envoyez une invitation par email pour permettre à un formateur de créer son compte"})]}),s.jsxs(Ee,{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(_n,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),s.jsx(Xe,{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(it,{className:"mr-2 h-4 w-4 animate-spin"}),"Envoi en cours..."]}):s.jsxs(s.Fragment,{children:[s.jsx(_n,{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 B8e(){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:x}=await ce.functions.invoke("manage-blacklist",{body:{action:"list"}});x||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:x,error:p}=await ce.functions.invoke("manage-blacklist",{body:{action:"add",email:h}});if(l(!1),p||x!=null&&x.error){ae.error((x==null?void 0:x.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:x,error:p}=await ce.functions.invoke("manage-blacklist",{body:{action:"remove",email:h}});if(u(null),p||x!=null&&x.error){ae.error((x==null?void 0:x.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(s6,{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(Xe,{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(it,{className:"w-4 h-4 mr-2 animate-spin"}):s.jsx(s6,{className:"w-4 h-4 mr-2"}),"Blacklister"]})]}),r?s.jsx("div",{className:"flex justify-center py-8",children:s.jsx(it,{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(it,{className:"w-4 h-4 animate-spin"}):s.jsx(ri,{className:"w-4 h-4"})})]},h.email))})]})}var z8e="Separator",xq="horizontal",q8e=["horizontal","vertical"],pie=w.forwardRef((e,t)=>{const{decorative:r,orientation:n=xq,...a}=e,i=U8e(n)?n:xq,l=r?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return s.jsx(Vt.div,{"data-orientation":i,...l,...a,ref:t})});pie.displayName=z8e;function U8e(e){return q8e.includes(e)}var xie=pie;const Mu=w.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...n},a)=>s.jsx(xie,{ref:a,decorative:r,orientation:t,className:yt("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...n}));Mu.displayName=xie.displayName;const V8e="trainer-documents",H8e=3600;async function Kx(e){if(e.document_path){const{data:t,error:r}=await ce.storage.from(V8e).createSignedUrl(e.document_path,H8e);return r||!(t!=null&&t.signedUrl)?null:t.signedUrl}return e.document_url??null}async function cE(e){return Promise.all(e.map(async t=>({...t,viewUrl:await Kx(t)})))}async function y5(e){if(e.cv_path){const{data:t,error:r}=await ce.functions.invoke("get-cv-url",{body:{trainerProfileId:e.id}});return r||!(t!=null&&t.url)?null:t.url}return e.cv_url??null}const W8e={cni:"CNI / Passeport",kbis:"Kbis / Extrait RCS",casier_judiciaire:"Casier judiciaire (B3)",diploma:"Diplôme",other:"Autre document"};function G8e(e){const t=(e.status||"").toLowerCase();return e.expired||/expir/.test(t)?{label:"Expiré",cls:"bg-amber-100 text-amber-700 border-amber-300"}:/reject|refus|invalid|denied|declin/.test(t)?{label:"Rejeté",cls:"bg-red-100 text-red-700 border-red-300"}:e.confirmed_at||/confirm|valid|accept|approved|\bok\b|compliant/.test(t)?{label:"Accepté",cls:"bg-green-100 text-green-700 border-green-300"}:t===""||/missing|manquant/.test(t)?{label:"Manquant",cls:"bg-muted text-muted-foreground border-border"}:{label:"En attente",cls:"bg-blue-100 text-blue-700 border-blue-300"}}function K8e({trainerId:e,trainerName:t}){const[r,n]=w.useState([]),[a,i]=w.useState(!0),[o,l]=w.useState(""),[c,u]=w.useState(null),[d,f]=w.useState([]),[m,h]=w.useState(!1),x=async()=>{h(!0);try{const{data:S,error:P}=await ce.functions.invoke("certiskool-sync",{body:{trainerId:e}});if(P)throw P;const T=(S==null?void 0:S.autoVerified)??0;T>0?ae.success(`Synchro OK — ${T} document(s) validé(s) automatiquement`):ae.success("Synchro CertiSkool effectuée (aucun nouveau document confirmé)"),await Promise.all([p(),g()])}catch(S){console.error("Error syncing CertiSkool:",S),ae.error(S instanceof Error?`Synchro échouée : ${S.message}`:"Synchro CertiSkool échouée")}finally{h(!1)}};w.useEffect(()=>{g(),p()},[e]);const p=async()=>{try{const[S,P]=await Promise.all([Wu.from("trainer_profiles").select("certiskool_status, certiskool_percentage, certiskool_synced_at").eq("id",e).maybeSingle(),Wu.from("certiskool_documents").select("id, label, doc_type, status, expired, expiration_date, confirmed_at").eq("trainer_profile_id",e).order("label",{ascending:!0})]);S.data&&u(S.data),f(P.data||[])}catch(S){console.error("Error loading CertiSkool status:",S)}},g=async()=>{try{const{data:S,error:P}=await ce.from("trainer_documents").select("*").eq("trainer_profile_id",e).order("created_at",{ascending:!1});if(P)throw P;n(await cE(S||[]))}catch(S){console.error("Error loading documents:",S)}finally{i(!1)}},v=async S=>{try{const{error:P}=await Wu.from("trainer_documents").update({status:"verified",verified_at:new Date().toISOString(),verified_source:"admin",admin_comment:null}).eq("id",S);if(P)throw P;ae.success("Document vérifié"),g()}catch(P){console.error("Error verifying document:",P),ae.error("Erreur lors de la vérification")}},y=async S=>{try{const{error:P}=await ce.from("trainer_documents").update({status:"rejected",admin_comment:o||"Document non conforme"}).eq("id",S);if(P)throw P;ae.success("Document rejeté"),l(""),g()}catch(P){console.error("Error rejecting document:",P),ae.error("Erreur lors du rejet")}},b=S=>{switch(S){case"verified":return s.jsxs(Te,{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(Te,{className:"bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-300",children:[s.jsx(vs,{className:"w-3 h-3 mr-1"}),"Rejeté"]});default:return s.jsxs(Te,{className:"bg-amber-100 text-amber-700 dark:bg-amber-900 dark:text-amber-300",children:[s.jsx($r,{className:"w-3 h-3 mr-1"}),"En attente"]})}},N=()=>{const S=!!(c!=null&&c.certiskool_status);if(!S&&d.length===0)return null;const P=((c==null?void 0:c.certiskool_status)||"").toLowerCase(),T=/complian|conforme|complete/.test(P),R=/incomplet/.test(P),k=S?T?"bg-green-50 border-green-200 text-green-800 dark:bg-green-950/30 dark:text-green-300":R?"bg-amber-50 border-amber-200 text-amber-800 dark:bg-amber-950/30 dark:text-amber-300":"bg-muted border-border text-foreground":"bg-muted/40 border-border text-foreground";return s.jsxs("div",{className:`rounded-md border p-3 text-sm ${k}`,children:[S&&s.jsxs("div",{className:"flex items-center gap-2 font-medium",children:[s.jsx(wi,{className:"w-4 h-4"}),"Conformité CertiSkool : ",c.certiskool_status,c.certiskool_percentage!=null&&s.jsxs("span",{children:["· ",c.certiskool_percentage,"%"]})]}),s.jsxs("p",{className:"text-xs mt-1 opacity-80",children:["Statut renvoyé par CertiSkool (distinct de la vérification interne ci-dessous).",(c==null?void 0:c.certiskool_synced_at)&&` Dernière synchro : ${Dt(new Date(c.certiskool_synced_at),"d MMM yyyy 'à' HH:mm",{locale:br})}.`]}),d.length>0&&s.jsxs("div",{className:"mt-3 border-t pt-2",children:[s.jsx("p",{className:"text-xs font-medium mb-1.5",children:"Documents CertiSkool"}),s.jsx("ul",{className:"space-y-1",children:d.map(E=>{const q=G8e(E);return s.jsxs("li",{className:"flex items-center justify-between gap-2 text-xs",children:[s.jsx("span",{className:"truncate",children:E.label||E.doc_type||"Document"}),s.jsx(Te,{variant:"outline",className:`shrink-0 ${q.cls}`,children:q.label})]},E.id)})})]})]})},j=r.filter(S=>S.status==="pending").length;if(a||r.length===0)return null;const _=N();return s.jsxs(qn,{children:[s.jsx(Xo,{asChild:!0,children:s.jsxs(ne,{variant:"outline",size:"sm",className:"gap-2",children:[s.jsx(Kt,{className:"w-4 h-4"}),"Documents (",r.length,")",j>0&&s.jsx(Te,{variant:"destructive",className:"ml-1",children:j})]})}),s.jsxs($n,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[s.jsx(Un,{children:s.jsxs("div",{className:"flex items-center justify-between gap-3 pr-6",children:[s.jsxs(Vn,{children:["Documents de ",t]}),s.jsxs(ne,{variant:"outline",size:"sm",onClick:x,disabled:m,className:"shrink-0 gap-1.5",children:[s.jsx(Qs,{className:`w-3.5 h-3.5 ${m?"animate-spin":""}`}),m?"Synchro...":"Synchroniser CertiSkool"]})]})}),_&&s.jsx("div",{className:"mt-4",children:_}),s.jsx("div",{className:"space-y-4 mt-4",children:r.map(S=>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:W8e[S.document_type]||S.document_type}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:[S.document_name," • ",Dt(new Date(S.created_at),"d MMM yyyy",{locale:br})]}),S.status==="verified"&&S.verified_source==="certiskool"&&s.jsxs("p",{className:"text-xs text-green-700 dark:text-green-400 flex items-center gap-1 mt-1",children:[s.jsx(wi,{className:"w-3 h-3"}),"Validé automatiquement via CertiSkool"]})]}),b(S.status)]}),S.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(Li,{className:"w-4 h-4"}),S.admin_comment]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("a",{href:S.viewUrl??void 0,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-primary hover:underline flex items-center gap-1",children:[s.jsx(Kn,{className:"w-4 h-4"}),"Voir le document"]}),S.status==="pending"&&s.jsxs(s.Fragment,{children:[s.jsxs(ne,{size:"sm",onClick:()=>v(S.id),children:[s.jsx(Wr,{className:"w-4 h-4 mr-1"}),"Valider"]}),s.jsxs(Gu,{children:[s.jsx(th,{asChild:!0,children:s.jsxs(ne,{size:"sm",variant:"destructive",children:[s.jsx(vs,{className:"w-4 h-4 mr-1"}),"Rejeter"]})}),s.jsxs(Kc,{children:[s.jsxs(Xc,{children:[s.jsx(Zc,{children:"Rejeter ce document ?"}),s.jsx(Jc,{children:"Ajoutez un commentaire pour expliquer le rejet au formateur."})]}),s.jsx(Xe,{placeholder:"Raison du rejet (ex: Document illisible)",value:o,onChange:P=>l(P.target.value)}),s.jsxs(Yc,{children:[s.jsx(Ku,{onClick:()=>l(""),children:"Annuler"}),s.jsx(Qc,{onClick:()=>y(S.id),children:"Rejeter"})]})]})]})]})]})]},S.id))})]})]})}function gie({subjectType:e,subjectId:t,subjectName:r}){const[n,a]=w.useState(null),[i,o]=w.useState(0),[l,c]=w.useState(""),[u,d]=w.useState(!1),f=async()=>{const{data:p,error:g}=await Wu.from("admin_reviews").select("id, subject_type, subject_id, rating, comment, created_by, created_at").eq("subject_type",e).eq("subject_id",t).order("created_at",{ascending:!1});if(g){console.error("Error loading admin reviews:",g),a([]);return}a(p||[])};w.useEffect(()=>{a(null),f()},[e,t]);const m=async()=>{var p;if(!l.trim()){ae.error("Ajoutez un commentaire");return}d(!0);try{const{data:g}=await ce.auth.getUser(),{error:v}=await Wu.from("admin_reviews").insert({subject_type:e,subject_id:t,rating:i||null,comment:l.trim(),created_by:((p=g==null?void 0:g.user)==null?void 0:p.id)??null});if(v)throw v;ae.success("Avis interne enregistré"),o(0),c(""),await f()}catch(g){console.error(g),ae.error("Erreur lors de l'enregistrement")}finally{d(!1)}},h=async p=>{try{const{error:g}=await Wu.from("admin_reviews").delete().eq("id",p);if(g)throw g;a(v=>(v||[]).filter(y=>y.id!==p))}catch(g){console.error(g),ae.error("Erreur lors de la suppression")}},x=({value:p,onSelect:g})=>s.jsx("div",{className:"flex items-center gap-0.5",children:[1,2,3,4,5].map(v=>s.jsx("button",{type:"button",disabled:!g,onClick:()=>g==null?void 0:g(v),className:g?"cursor-pointer":"cursor-default","aria-label":`${v} étoile${v>1?"s":""}`,children:s.jsx(no,{className:`w-4 h-4 ${v<=p?"fill-amber-400 text-amber-400":"text-muted-foreground/40"}`})},v))});return s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"rounded-md border p-3 space-y-2 bg-muted/30",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("span",{className:"text-sm font-medium",children:["Avis interne",r?` — ${r}`:""]}),s.jsx(x,{value:i,onSelect:o})]}),s.jsx(gn,{placeholder:"Note interne (visible uniquement par les admins) : qualité, ponctualité, réserves…",value:l,onChange:p=>c(p.target.value),rows:2}),s.jsx("div",{className:"flex justify-end",children:s.jsxs(ne,{size:"sm",onClick:m,disabled:u,children:[u?s.jsx(it,{className:"w-4 h-4 mr-1 animate-spin"}):s.jsx(Pye,{className:"w-4 h-4 mr-1"}),"Enregistrer l'avis"]})})]}),n===null?s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(it,{className:"w-4 h-4 animate-spin"})," Chargement…"]}):n.length===0?s.jsx("p",{className:"text-xs text-muted-foreground",children:"Aucun avis interne pour l'instant."}):s.jsx("ul",{className:"space-y-2",children:n.map(p=>s.jsx("li",{className:"rounded-md border p-3 text-sm",children:s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[s.jsxs("div",{className:"space-y-1",children:[p.rating!=null&&s.jsx(x,{value:p.rating}),s.jsx("p",{className:"whitespace-pre-wrap",children:p.comment}),s.jsx("p",{className:"text-xs text-muted-foreground",children:Dt(new Date(p.created_at),"d MMM yyyy 'à' HH:mm",{locale:br})})]}),s.jsx(ne,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:()=>h(p.id),children:s.jsx(ri,{className:"w-4 h-4 text-muted-foreground"})})]})},p.id))})]})}function X8e(e){return s.jsxs(qn,{children:[s.jsx(Xo,{asChild:!0,children:s.jsxs(ne,{variant:"outline",size:"sm",children:[s.jsx(Fi,{className:"w-4 h-4 mr-2"}),"Avis interne"]})}),s.jsxs($n,{className:"max-w-lg max-h-[80vh] overflow-y-auto",children:[s.jsx(Un,{children:s.jsxs(Vn,{children:["Avis interne",e.subjectName?` — ${e.subjectName}`:""]})}),s.jsx(gie,{...e})]})]})}function vie({country:e,className:t}){const r=(e||"").toLowerCase().trim();return!e||r==="france"||r==="fr"?null:s.jsxs(Te,{variant:"outline",className:yt("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(ap,{className:"w-3 h-3 mr-1"}),e]})}const Y8e={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:Cye},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:Xj}};function u_({source:e,className:t}){const{label:r,className:n,Icon:a}=Y8e[e];return s.jsxs(Te,{variant:"outline",className:yt("text-xs",n,t),title:`Source : ${r}`,children:[s.jsx(a,{className:"w-3 h-3 mr-1"}),r]})}const Z8e={facture:"Facture",contrat:"Contrat",mission:"Mission",formateur:"Formateur",ecole:"École",pedagogie:"Pédagogie",communication:"Comm.",autre:"Autre"},J8e=e=>e.replace(/[%,()*]/g," ").replace(/\s+/g," ").trim();function b0({query:e,title:t="Documents Drive",category:r,fileTypes:n,defaultOpen:a=!1}){const[i,o]=w.useState(null),[l,c]=w.useState(a),u=(n||[]).join(",").toLowerCase();w.useEffect(()=>{if(!l)return;const f=J8e(e||"");if(f.length<3){o([]);return}let m=!1;return(async()=>{o(null);const h="id, file_name, folder_path, category, web_view_link, drive_modified_at",x=()=>{let N=ce.from("drive_documents").select(h).limit(80);return r&&(N=N.eq("category",r)),N},[p,g]=await Promise.all([x().ilike("folder_path",`%${f}%`),x().ilike("file_name",`%${f}%`)]),v=new Map;for(const N of[...p.data||[],...g.data||[]])v.set(N.id,N);let y=Array.from(v.values());const b=u?u.split(",").filter(Boolean):[];b.length&&(y=y.filter(N=>b.some(j=>N.file_name.toLowerCase().endsWith(`.${j}`)))),y.sort((N,j)=>(j.drive_modified_at||"").localeCompare(N.drive_modified_at||"")),m||o(y)})(),()=>{m=!0}},[e,r,u,l]);const d=(i==null?void 0:i.length)??0;return s.jsxs("div",{className:"border rounded-lg",children:[s.jsxs("button",{type:"button",onClick:()=>c(f=>!f),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(u_,{source:"drive"}),t,i&&s.jsx(Te,{variant:"secondary",className:"text-xs",children:d})]}),s.jsx(Qu,{className:`w-4 h-4 transition-transform ${l?"rotate-180":""}`})]}),l&&s.jsx("div",{className:"px-3 pb-3 space-y-1",children:i===null?s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground py-2",children:[s.jsx(it,{className:"w-4 h-4 animate-spin"})," Recherche dans le Drive…"]}):d===0?s.jsxs("p",{className:"text-xs text-muted-foreground py-2",children:["Aucun document Drive trouvé pour « ",e," »."]}):i.map(f=>s.jsxs("a",{href:f.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:f.folder_path?`${f.folder_path}/${f.file_name}`:f.file_name,children:[s.jsx(Kt,{className:"w-3.5 h-3.5 text-muted-foreground shrink-0"}),s.jsx("span",{className:"truncate flex-1",children:f.file_name}),s.jsx(Te,{variant:"outline",className:"text-[10px] shrink-0",children:Z8e[f.category]||f.category}),s.jsx(Kn,{className:"w-3 h-3 text-muted-foreground opacity-0 group-hover:opacity-100 shrink-0"})]},f.id))})]})}const jT=[{id:"cv_missing",label:"Demander le CV",icon:Kt,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:dye,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:Fye,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:LR,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:i6,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:Nye,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 Q8e({trainerId:e,trainerUserId:t,trainerName:r,trainerEmail:n}){const{user:a}=Br(),[i,o]=w.useState(null),l=async c=>{const u=jT.find(d=>d.id===c);if(u){o(c);try{const{error:d}=await ce.functions.invoke("send-trainer-reminder",{body:{trainerId:e,type:"custom",customSubject:u.subject,customMessage:u.message}});if(d)throw d;const{error:f}=await ce.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(p5,{children:[s.jsx(x5,{asChild:!0,children:s.jsxs(ne,{variant:"outline",size:"sm",disabled:i!==null,children:[i?s.jsx(it,{className:"w-4 h-4 mr-2 animate-spin"}):s.jsx(Fi,{className:"w-4 h-4 mr-2"}),"Envoyer message",s.jsx(Qu,{className:"w-4 h-4 ml-1"})]})}),s.jsx(Nw,{align:"end",className:"w-56",children:jT.map((c,u)=>{const d=c.icon;return s.jsxs("div",{children:[s.jsxs(Io,{onClick:()=>l(c.id),disabled:i!==null,className:"cursor-pointer",children:[s.jsx(d,{className:"w-4 h-4 mr-2"}),c.label]}),u<jT.length-1&&s.jsx(h4,{})]},c.id)})})]})}var eDe=[" ","Enter","ArrowUp","ArrowDown"],tDe=[" ","Enter"],w0="Select",[uE,dE,rDe]=Gj(w0),[w1]=ei(w0,[rDe,kp]),fE=kp(),[nDe,Op]=w1(w0),[sDe,aDe]=w1(w0),yie=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:x}=e,p=fE(t),[g,v]=w.useState(null),[y,b]=w.useState(null),[N,j]=w.useState(!1),_=q0(u),[S,P]=Zo({prop:n,defaultProp:a??!1,onChange:i,caller:w0}),[T,R]=Zo({prop:o,defaultProp:l,onChange:c,caller:w0}),k=w.useRef(null),E=g?x||!!g.closest("form"):!0,[q,O]=w.useState(new Set),L=Array.from(q).map(H=>H.props.value).join(";");return s.jsx(kC,{...p,children:s.jsxs(nDe,{required:h,scope:t,trigger:g,onTriggerChange:v,valueNode:y,onValueNodeChange:b,valueNodeHasChildren:N,onValueNodeHasChildrenChange:j,contentId:Za(),value:T,onValueChange:R,open:S,onOpenChange:P,dir:_,triggerPointerDownPosRef:k,disabled:m,children:[s.jsx(uE.Provider,{scope:t,children:s.jsx(sDe,{scope:e.__scopeSelect,onNativeOptionAdd:w.useCallback(H=>{O(V=>new Set(V).add(H))},[]),onNativeOptionRemove:w.useCallback(H=>{O(V=>{const z=new Set(V);return z.delete(H),z})},[]),children:r})}),E?s.jsxs(Uie,{"aria-hidden":!0,required:h,tabIndex:-1,name:d,autoComplete:f,value:T,onChange:H=>R(H.target.value),disabled:m,form:x,children:[T===void 0?s.jsx("option",{value:""}):null,Array.from(q)]},L):null]})})};yie.displayName=w0;var bie="SelectTrigger",wie=w.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:n=!1,...a}=e,i=fE(r),o=Op(bie,r),l=o.disabled||n,c=Pr(t,o.onTriggerChange),u=dE(r),d=w.useRef("touch"),[f,m,h]=Hie(p=>{const g=u().filter(b=>!b.disabled),v=g.find(b=>b.value===o.value),y=Wie(g,p,v);y!==void 0&&o.onValueChange(y.value)}),x=p=>{l||(o.onOpenChange(!0),h()),p&&(o.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return s.jsx(Zj,{asChild:!0,...i,children:s.jsx(Vt.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":Vie(o.value)?"":void 0,...a,ref:c,onClick:Tt(a.onClick,p=>{p.currentTarget.focus(),d.current!=="mouse"&&x(p)}),onPointerDown:Tt(a.onPointerDown,p=>{d.current=p.pointerType;const g=p.target;g.hasPointerCapture(p.pointerId)&&g.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(x(p),p.preventDefault())}),onKeyDown:Tt(a.onKeyDown,p=>{const g=f.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&m(p.key),!(g&&p.key===" ")&&eDe.includes(p.key)&&(x(),p.preventDefault())})})})});wie.displayName=bie;var jie="SelectValue",_ie=w.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:a,children:i,placeholder:o="",...l}=e,c=Op(jie,r),{onValueNodeHasChildrenChange:u}=c,d=i!==void 0,f=Pr(t,c.onValueNodeChange);return _a(()=>{u(d)},[u,d]),s.jsx(Vt.span,{...l,ref:f,style:{pointerEvents:"none"},children:Vie(c.value)?s.jsx(s.Fragment,{children:o}):i})});_ie.displayName=jie;var iDe="SelectIcon",Nie=w.forwardRef((e,t)=>{const{__scopeSelect:r,children:n,...a}=e;return s.jsx(Vt.span,{"aria-hidden":!0,...a,ref:t,children:n||"▼"})});Nie.displayName=iDe;var oDe="SelectPortal",Sie=e=>s.jsx(t1,{asChild:!0,...e});Sie.displayName=oDe;var j0="SelectContent",kie=w.forwardRef((e,t)=>{const r=Op(j0,e.__scopeSelect),[n,a]=w.useState();if(_a(()=>{a(new DocumentFragment)},[]),!r.open){const i=n;return i?Uc.createPortal(s.jsx(Cie,{scope:e.__scopeSelect,children:s.jsx(uE.Slot,{scope:e.__scopeSelect,children:s.jsx("div",{children:e.children})})}),i):null}return s.jsx(Eie,{...e,ref:t})});kie.displayName=j0;var Au=10,[Cie,Dp]=w1(j0),lDe="SelectContentImpl",cDe=np("SelectContent.RemoveScroll"),Eie=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:x,hideWhenDetached:p,avoidCollisions:g,...v}=e,y=Op(j0,r),[b,N]=w.useState(null),[j,_]=w.useState(null),S=Pr(t,te=>N(te)),[P,T]=w.useState(null),[R,k]=w.useState(null),E=dE(r),[q,O]=w.useState(!1),L=w.useRef(!1);w.useEffect(()=>{if(b)return FC(b)},[b]),RC();const H=w.useCallback(te=>{const[re,...J]=E().map(Q=>Q.ref.current),[ie]=J.slice(-1),be=document.activeElement;for(const Q of te)if(Q===be||(Q==null||Q.scrollIntoView({block:"nearest"}),Q===re&&j&&(j.scrollTop=0),Q===ie&&j&&(j.scrollTop=j.scrollHeight),Q==null||Q.focus(),document.activeElement!==be))return},[E,j]),V=w.useCallback(()=>H([P,b]),[H,P,b]);w.useEffect(()=>{q&&V()},[q,V]);const{onOpenChange:z,triggerPointerDownPosRef:M}=y;w.useEffect(()=>{if(b){let te={x:0,y:0};const re=ie=>{var be,Q;te={x:Math.abs(Math.round(ie.pageX)-(((be=M.current)==null?void 0:be.x)??0)),y:Math.abs(Math.round(ie.pageY)-(((Q=M.current)==null?void 0:Q.y)??0))}},J=ie=>{te.x<=10&&te.y<=10?ie.preventDefault():b.contains(ie.target)||z(!1),document.removeEventListener("pointermove",re),M.current=null};return M.current!==null&&(document.addEventListener("pointermove",re),document.addEventListener("pointerup",J,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",re),document.removeEventListener("pointerup",J,{capture:!0})}}},[b,z,M]),w.useEffect(()=>{const te=()=>z(!1);return window.addEventListener("blur",te),window.addEventListener("resize",te),()=>{window.removeEventListener("blur",te),window.removeEventListener("resize",te)}},[z]);const[B,K]=Hie(te=>{const re=E().filter(be=>!be.disabled),J=re.find(be=>be.ref.current===document.activeElement),ie=Wie(re,te,J);ie&&setTimeout(()=>ie.ref.current.focus())}),C=w.useCallback((te,re,J)=>{const ie=!L.current&&!J;(y.value!==void 0&&y.value===re||ie)&&(T(te),ie&&(L.current=!0))},[y.value]),A=w.useCallback(()=>b==null?void 0:b.focus(),[b]),I=w.useCallback((te,re,J)=>{const ie=!L.current&&!J;(y.value!==void 0&&y.value===re||ie)&&k(te)},[y.value]),U=n==="popper"?f8:Aie,Y=U===f8?{side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:h,sticky:x,hideWhenDetached:p,avoidCollisions:g}:{};return s.jsx(Cie,{scope:r,content:b,viewport:j,onViewportChange:_,itemRefCallback:C,selectedItem:P,onItemLeave:A,itemTextRefCallback:I,focusSelectedItem:V,selectedItemText:R,position:n,isPositioned:q,searchRef:B,children:s.jsx(t_,{as:cDe,allowPinchZoom:!0,children:s.jsx(e_,{asChild:!0,trapped:y.open,onMountAutoFocus:te=>{te.preventDefault()},onUnmountAutoFocus:Tt(a,te=>{var re;(re=y.trigger)==null||re.focus({preventScroll:!0}),te.preventDefault()}),children:s.jsx(B0,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:te=>te.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:s.jsx(U,{role:"listbox",id:y.contentId,"data-state":y.open?"open":"closed",dir:y.dir,onContextMenu:te=>te.preventDefault(),...v,...Y,onPlaced:()=>O(!0),ref:S,style:{display:"flex",flexDirection:"column",outline:"none",...v.style},onKeyDown:Tt(v.onKeyDown,te=>{const re=te.ctrlKey||te.altKey||te.metaKey;if(te.key==="Tab"&&te.preventDefault(),!re&&te.key.length===1&&K(te.key),["ArrowUp","ArrowDown","Home","End"].includes(te.key)){let ie=E().filter(be=>!be.disabled).map(be=>be.ref.current);if(["ArrowUp","End"].includes(te.key)&&(ie=ie.slice().reverse()),["ArrowUp","ArrowDown"].includes(te.key)){const be=te.target,Q=ie.indexOf(be);ie=ie.slice(Q+1)}setTimeout(()=>H(ie)),te.preventDefault()}})})})})})})});Eie.displayName=lDe;var uDe="SelectItemAlignedPosition",Aie=w.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:n,...a}=e,i=Op(j0,r),o=Dp(j0,r),[l,c]=w.useState(null),[u,d]=w.useState(null),f=Pr(t,S=>d(S)),m=dE(r),h=w.useRef(!1),x=w.useRef(!0),{viewport:p,selectedItem:g,selectedItemText:v,focusSelectedItem:y}=o,b=w.useCallback(()=>{if(i.trigger&&i.valueNode&&l&&u&&p&&g&&v){const S=i.trigger.getBoundingClientRect(),P=u.getBoundingClientRect(),T=i.valueNode.getBoundingClientRect(),R=v.getBoundingClientRect();if(i.dir!=="rtl"){const be=R.left-P.left,Q=T.left-be,Ve=S.left-Q,W=S.width+Ve,Z=Math.max(W,P.width),he=window.innerWidth-Au,se=Y6(Q,[Au,Math.max(Au,he-Z)]);l.style.minWidth=W+"px",l.style.left=se+"px"}else{const be=P.right-R.right,Q=window.innerWidth-T.right-be,Ve=window.innerWidth-S.right-Q,W=S.width+Ve,Z=Math.max(W,P.width),he=window.innerWidth-Au,se=Y6(Q,[Au,Math.max(Au,he-Z)]);l.style.minWidth=W+"px",l.style.right=se+"px"}const k=m(),E=window.innerHeight-Au*2,q=p.scrollHeight,O=window.getComputedStyle(u),L=parseInt(O.borderTopWidth,10),H=parseInt(O.paddingTop,10),V=parseInt(O.borderBottomWidth,10),z=parseInt(O.paddingBottom,10),M=L+H+q+z+V,B=Math.min(g.offsetHeight*5,M),K=window.getComputedStyle(p),C=parseInt(K.paddingTop,10),A=parseInt(K.paddingBottom,10),I=S.top+S.height/2-Au,U=E-I,Y=g.offsetHeight/2,te=g.offsetTop+Y,re=L+H+te,J=M-re;if(re<=I){const be=k.length>0&&g===k[k.length-1].ref.current;l.style.bottom="0px";const Q=u.clientHeight-p.offsetTop-p.offsetHeight,Ve=Math.max(U,Y+(be?A:0)+Q+V),W=re+Ve;l.style.height=W+"px"}else{const be=k.length>0&&g===k[0].ref.current;l.style.top="0px";const Ve=Math.max(I,L+p.offsetTop+(be?C:0)+Y)+J;l.style.height=Ve+"px",p.scrollTop=re-I+p.offsetTop}l.style.margin=`${Au}px 0`,l.style.minHeight=B+"px",l.style.maxHeight=E+"px",n==null||n(),requestAnimationFrame(()=>h.current=!0)}},[m,i.trigger,i.valueNode,l,u,p,g,v,i.dir,n]);_a(()=>b(),[b]);const[N,j]=w.useState();_a(()=>{u&&j(window.getComputedStyle(u).zIndex)},[u]);const _=w.useCallback(S=>{S&&x.current===!0&&(b(),y==null||y(),x.current=!1)},[b,y]);return s.jsx(fDe,{scope:r,contentWrapper:l,shouldExpandOnScrollRef:h,onScrollButtonChange:_,children:s.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:N},children:s.jsx(Vt.div,{...a,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});Aie.displayName=uDe;var dDe="SelectPopperPosition",f8=w.forwardRef((e,t)=>{const{__scopeSelect:r,align:n="start",collisionPadding:a=Au,...i}=e,o=fE(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)"}})});f8.displayName=dDe;var[fDe,sF]=w1(j0,{}),h8="SelectViewport",Tie=w.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:n,...a}=e,i=Dp(h8,r),o=sF(h8,r),l=Pr(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(uE.Slot,{scope:r,children:s.jsx(Vt.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:Tt(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 x=window.innerHeight-Au*2,p=parseFloat(f.style.minHeight),g=parseFloat(f.style.height),v=Math.max(p,g);if(v<x){const y=v+h,b=Math.min(x,y),N=y-b;f.style.height=b+"px",f.style.bottom==="0px"&&(d.scrollTop=N>0?N:0,f.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});Tie.displayName=h8;var Pie="SelectGroup",[hDe,mDe]=w1(Pie),pDe=w.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,a=Za();return s.jsx(hDe,{scope:r,id:a,children:s.jsx(Vt.div,{role:"group","aria-labelledby":a,...n,ref:t})})});pDe.displayName=Pie;var Oie="SelectLabel",Die=w.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,a=mDe(Oie,r);return s.jsx(Vt.div,{id:a.id,...n,ref:t})});Die.displayName=Oie;var j4="SelectItem",[xDe,Iie]=w1(j4),Rie=w.forwardRef((e,t)=>{const{__scopeSelect:r,value:n,disabled:a=!1,textValue:i,...o}=e,l=Op(j4,r),c=Dp(j4,r),u=l.value===n,[d,f]=w.useState(i??""),[m,h]=w.useState(!1),x=Pr(t,y=>{var b;return(b=c.itemRefCallback)==null?void 0:b.call(c,y,n,a)}),p=Za(),g=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(xDe,{scope:r,value:n,disabled:a,textId:p,isSelected:u,onItemTextChange:w.useCallback(y=>{f(b=>b||((y==null?void 0:y.textContent)??"").trim())},[]),children:s.jsx(uE.ItemSlot,{scope:r,value:n,disabled:a,textValue:d,children:s.jsx(Vt.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:x,onFocus:Tt(o.onFocus,()=>h(!0)),onBlur:Tt(o.onBlur,()=>h(!1)),onClick:Tt(o.onClick,()=>{g.current!=="mouse"&&v()}),onPointerUp:Tt(o.onPointerUp,()=>{g.current==="mouse"&&v()}),onPointerDown:Tt(o.onPointerDown,y=>{g.current=y.pointerType}),onPointerMove:Tt(o.onPointerMove,y=>{var b;g.current=y.pointerType,a?(b=c.onItemLeave)==null||b.call(c):g.current==="mouse"&&y.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Tt(o.onPointerLeave,y=>{var b;y.currentTarget===document.activeElement&&((b=c.onItemLeave)==null||b.call(c))}),onKeyDown:Tt(o.onKeyDown,y=>{var N;((N=c.searchRef)==null?void 0:N.current)!==""&&y.key===" "||(tDe.includes(y.key)&&v(),y.key===" "&&y.preventDefault())})})})})});Rie.displayName=j4;var iw="SelectItemText",Lie=w.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:a,...i}=e,o=Op(iw,r),l=Dp(iw,r),c=Iie(iw,r),u=aDe(iw,r),[d,f]=w.useState(null),m=Pr(t,v=>f(v),c.onItemTextChange,v=>{var y;return(y=l.itemTextRefCallback)==null?void 0:y.call(l,v,c.value,c.disabled)}),h=d==null?void 0:d.textContent,x=w.useMemo(()=>s.jsx("option",{value:c.value,disabled:c.disabled,children:h},c.value),[c.disabled,c.value,h]),{onNativeOptionAdd:p,onNativeOptionRemove:g}=u;return _a(()=>(p(x),()=>g(x)),[p,g,x]),s.jsxs(s.Fragment,{children:[s.jsx(Vt.span,{id:c.textId,...i,ref:m}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Uc.createPortal(i.children,o.valueNode):null]})});Lie.displayName=iw;var Fie="SelectItemIndicator",Mie=w.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return Iie(Fie,r).isSelected?s.jsx(Vt.span,{"aria-hidden":!0,...n,ref:t}):null});Mie.displayName=Fie;var m8="SelectScrollUpButton",$ie=w.forwardRef((e,t)=>{const r=Dp(m8,e.__scopeSelect),n=sF(m8,e.__scopeSelect),[a,i]=w.useState(!1),o=Pr(t,n.onScrollButtonChange);return _a(()=>{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(zie,{...e,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=r;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});$ie.displayName=m8;var p8="SelectScrollDownButton",Bie=w.forwardRef((e,t)=>{const r=Dp(p8,e.__scopeSelect),n=sF(p8,e.__scopeSelect),[a,i]=w.useState(!1),o=Pr(t,n.onScrollButtonChange);return _a(()=>{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(zie,{...e,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=r;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});Bie.displayName=p8;var zie=w.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:n,...a}=e,i=Dp("SelectScrollButton",r),o=w.useRef(null),l=dE(r),c=w.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return w.useEffect(()=>()=>c(),[c]),_a(()=>{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(Vt.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:Tt(a.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(n,50))}),onPointerMove:Tt(a.onPointerMove,()=>{var u;(u=i.onItemLeave)==null||u.call(i),o.current===null&&(o.current=window.setInterval(n,50))}),onPointerLeave:Tt(a.onPointerLeave,()=>{c()})})}),gDe="SelectSeparator",qie=w.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return s.jsx(Vt.div,{"aria-hidden":!0,...n,ref:t})});qie.displayName=gDe;var x8="SelectArrow",vDe=w.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,a=fE(r),i=Op(x8,r),o=Dp(x8,r);return i.open&&o.position==="popper"?s.jsx(EC,{...a,...n,ref:t}):null});vDe.displayName=x8;var yDe="SelectBubbleInput",Uie=w.forwardRef(({__scopeSelect:e,value:t,...r},n)=>{const a=w.useRef(null),i=Pr(n,a),o=QC(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(Vt.select,{...r,style:{...oQ,...r.style},ref:i,defaultValue:t})});Uie.displayName=yDe;function Vie(e){return e===""||e===void 0}function Hie(e){const t=ya(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 Wie(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=bDe(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 bDe(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var wDe=yie,Gie=wie,jDe=_ie,_De=Nie,NDe=Sie,Kie=kie,SDe=Tie,Xie=Die,Yie=Rie,kDe=Lie,CDe=Mie,Zie=$ie,Jie=Bie,Qie=qie;const Ar=wDe,Dr=jDe,kr=w.forwardRef(({className:e,children:t,...r},n)=>s.jsxs(Gie,{ref:n,className:yt("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(_De,{asChild:!0,children:s.jsx(Qu,{className:"h-4 w-4 opacity-50"})})]}));kr.displayName=Gie.displayName;const eoe=w.forwardRef(({className:e,...t},r)=>s.jsx(Zie,{ref:r,className:yt("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(OQ,{className:"h-4 w-4"})}));eoe.displayName=Zie.displayName;const toe=w.forwardRef(({className:e,...t},r)=>s.jsx(Jie,{ref:r,className:yt("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(Qu,{className:"h-4 w-4"})}));toe.displayName=Jie.displayName;const Cr=w.forwardRef(({className:e,children:t,position:r="popper",...n},a)=>s.jsx(NDe,{children:s.jsxs(Kie,{ref:a,className:yt("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(eoe,{}),s.jsx(SDe,{className:yt("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),s.jsx(toe,{})]})}));Cr.displayName=Kie.displayName;const EDe=w.forwardRef(({className:e,...t},r)=>s.jsx(Xie,{ref:r,className:yt("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));EDe.displayName=Xie.displayName;const ct=w.forwardRef(({className:e,children:t,...r},n)=>s.jsxs(Yie,{ref:n,className:yt("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(CDe,{children:s.jsx(Rn,{className:"h-4 w-4"})})}),s.jsx(kDe,{children:t})]}));ct.displayName=Yie.displayName;const ADe=w.forwardRef(({className:e,...t},r)=>s.jsx(Qie,{ref:r,className:yt("-mx-1 my-1 h-px bg-muted",e),...t}));ADe.displayName=Qie.displayName;var hE="Switch",[TDe]=ei(hE),[PDe,ODe]=TDe(hE),roe=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),x=Pr(t,b=>h(b)),p=w.useRef(!1),g=m?d||!!m.closest("form"):!0,[v,y]=Zo({prop:a,defaultProp:i??!1,onChange:u,caller:hE});return s.jsxs(PDe,{scope:r,checked:v,disabled:l,children:[s.jsx(Vt.button,{type:"button",role:"switch","aria-checked":v,"aria-required":o,"data-state":ioe(v),"data-disabled":l?"":void 0,disabled:l,value:c,...f,ref:x,onClick:Tt(e.onClick,b=>{y(N=>!N),g&&(p.current=b.isPropagationStopped(),p.current||b.stopPropagation())})}),g&&s.jsx(aoe,{control:m,bubbles:!p.current,name:n,value:c,checked:v,required:o,disabled:l,form:d,style:{transform:"translateX(-100%)"}})]})});roe.displayName=hE;var noe="SwitchThumb",soe=w.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,a=ODe(noe,r);return s.jsx(Vt.span,{"data-state":ioe(a.checked),"data-disabled":a.disabled?"":void 0,...n,ref:t})});soe.displayName=noe;var DDe="SwitchBubbleInput",aoe=w.forwardRef(({__scopeSwitch:e,control:t,checked:r,bubbles:n=!0,...a},i)=>{const o=w.useRef(null),l=Pr(o,i),c=QC(r),u=SC(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 x=new Event("click",{bubbles:n});h.call(d,r),d.dispatchEvent(x)}},[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}})});aoe.displayName=DDe;function ioe(e){return e?"checked":"unchecked"}var ooe=roe,IDe=soe;const jy=w.forwardRef(({className:e,...t},r)=>s.jsx(ooe,{className:yt("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(IDe,{className:yt("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")})}));jy.displayName=ooe.displayName;const aF=[{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"}],RDe=["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"],LDe={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"},FDe={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"},dv=e=>{if(e.startsWith("ETR:"))return`🌍 ${e.substring(4)}`;const t=aF.find(r=>r.code===e);return t?`${t.code} - ${t.name}`:e},loe=e=>e==="ETR"||e.startsWith("ETR:"),MDe=e=>loe(e)?null:LDe[e]||null,g8=e=>{const t=new Set;return e.forEach(r=>{const n=MDe(r);n&&t.add(n)}),Array.from(t)},coe=(e,t=3)=>{const r=new Set;return e.forEach(n=>{if(!loe(n)){const a=FDe[n];a&&r.add(a)}}),r.size>=t},gq=[{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 $De({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:b,error:N}=await ce.from("trainer_documents").select("*").eq("trainer_profile_id",e).order("created_at",{ascending:!1});if(N)throw N;n(await cE(b||[]))}catch(b){console.error("Error loading documents:",b)}finally{i(!1)}},x=b=>{var j;const N=(j=b.target.files)==null?void 0:j[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 b=d.name.split(".").pop()||"pdf",N=`${t}/documents/${c}-${Date.now()}.${b}`;console.log("[AdminTrainerDocuments] Uploading to path:",N);const{error:j}=await ce.storage.from("trainer-documents").upload(N,d);if(j){console.error("[AdminTrainerDocuments] Storage upload error:",j),ae.error(`Erreur storage: ${j.message}`),l(!1);return}const{error:_}=await ce.from("trainer_documents").insert({trainer_profile_id:e,document_type:c,document_name:d.name,document_path:N,status:"verified"});if(_){console.error("[AdminTrainerDocuments] DB insert error:",_),ae.error(`Erreur base de données: ${_.message}`),l(!1);return}ae.success("Document ajouté avec succès"),f(null),u(""),m.current&&(m.current.value=""),h()}catch(b){console.error("[AdminTrainerDocuments] Unexpected error:",b);const N=b instanceof Error?b.message:"Erreur inconnue";ae.error(`Erreur: ${N}`)}finally{l(!1)}},g=async b=>{try{const{error:N}=await ce.from("trainer_documents").delete().eq("id",b);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(b,N)=>{try{const{error:j}=await ce.from("trainer_documents").update({status:N}).eq("id",b);if(j)throw j;ae.success("Statut mis à jour"),h()}catch(j){console.error("Error updating status:",j),ae.error("Erreur lors de la mise à jour")}},y=b=>{var N;return((N=gq.find(j=>j.value===b))==null?void 0:N.label)||b};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(Kt,{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(Ar,{value:c,onValueChange:u,children:[s.jsx(kr,{className:"h-9",children:s.jsx(Dr,{placeholder:"Sélectionner..."})}),s.jsx(Cr,{children:gq.map(b=>s.jsx(ct,{value:b.value,children:b.label},b.value))})]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(We,{className:"text-xs",children:"Fichier (PDF, JPG, PNG)"}),s.jsx(Xe,{ref:m,type:"file",accept:".pdf,.jpg,.jpeg,.png",onChange:x,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(it,{className:"w-4 h-4 mr-2 animate-spin"}),"Envoi..."]}):s.jsxs(s.Fragment,{children:[s.jsx(lc,{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(b=>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(Kt,{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:y(b.document_type)}),s.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:[b.document_name," • ",Dt(new Date(b.created_at),"d MMM yyyy",{locale:br})]})]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsxs(Ar,{value:b.status,onValueChange:N=>v(b.id,N),children:[s.jsx(kr,{className:"w-[110px] h-8",children:s.jsx(Dr,{})}),s.jsxs(Cr,{children:[s.jsx(ct,{value:"pending",children:"En attente"}),s.jsx(ct,{value:"verified",children:"Vérifié"}),s.jsx(ct,{value:"rejected",children:"Rejeté"})]})]}),s.jsx("a",{href:b.viewUrl??void 0,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",title:"Voir le document",children:s.jsx(Kn,{className:"w-4 h-4"})}),s.jsx(ne,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>g(b.id),children:s.jsx(ri,{className:"w-4 h-4 text-destructive"})})]})]},b.id))}):s.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"Aucun document"})]})}function BDe({trainer:e,onUpdate:t}){var Yt;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),[x,p]=w.useState(null),g=w.useRef(null),v=w.useRef(null),[y,b]=w.useState(e.name),[N,j]=w.useState(e.email),[_,S]=w.useState(e.bio||""),[P,T]=w.useState(e.cv_url||""),[R,k]=w.useState(e.cv_path||null),[E,q]=w.useState(e.specialties),[O,L]=w.useState(""),[H,V]=w.useState(e.status),[z,M]=w.useState(e.is_visible),[B,K]=w.useState(!!e.manual_certified),[C,A]=w.useState(e.legal_form||""),[I,U]=w.useState(((Yt=e.capital_amount)==null?void 0:Yt.toString())||""),[Y,te]=w.useState(e.headquarters_address||""),[re,J]=w.useState(e.legal_representative_name||""),[ie,be]=w.useState(e.legal_representative_function||""),[Q,Ve]=w.useState(e.siret||""),[W,Z]=w.useState(e.activity_declaration_number||""),[he,se]=w.useState(e.preferred_modality||"both"),[oe,le]=w.useState(e.preferred_departments||[]),[Me,de]=w.useState(e.country||"France"),[me,Le]=w.useState(e.phone||""),[Ke,ve]=w.useState(e.linkedin_url||""),[_e,Ue]=w.useState(e.website_url||""),[Qe,st]=w.useState(e.english_level||""),[Fe,Ge]=w.useState(()=>{const ot=(e.preferred_departments||[]).find(fr=>fr.startsWith("ETR:"));return ot?ot.substring(4):""}),ht=async()=>{try{const{data:ot}=await ce.from("trainer_contracts").select("signed_contract_url").eq("trainer_id",e.id).maybeSingle();ot&&p(ot.signed_contract_url)}catch(ot){console.error("Error loading signed contract:",ot)}},ut=ot=>{n(ot),ot&&ht()},Mt=async ot=>{var Et;const fr=(Et=ot.target.files)==null?void 0:Et[0];if(fr){if(!fr.type.includes("pdf")){ae.error("Seuls les fichiers PDF sont acceptés");return}h(!0);try{const Ct=fr.name.split(".").pop(),hr=`${e.user_id}/signed-contracts/contrat-signe-${Date.now()}.${Ct}`,{error:Gt}=await ce.storage.from("trainer-files").upload(hr,fr,{upsert:!0});if(Gt)throw Gt;const{data:{publicUrl:Jt}}=ce.storage.from("trainer-files").getPublicUrl(hr),{error:mr}=await ce.from("trainer_contracts").update({signed_contract_url:Jt}).eq("trainer_id",e.id);if(mr)throw mr;p(Jt),ae.success("Contrat signé uploadé avec succès")}catch(Ct){console.error("Error uploading signed contract:",Ct),ae.error("Erreur lors de l'upload du contrat signé")}finally{h(!1),v.current&&(v.current.value="")}}},Wt=async ot=>{var Et;const fr=(Et=ot.target.files)==null?void 0:Et[0];if(fr){if(!fr.type.includes("pdf")){ae.error("Seuls les fichiers PDF sont acceptés");return}f(!0);try{const Ct=fr.name.split(".").pop(),hr=`${e.user_id}/cv-${Date.now()}.${Ct}`,{error:Gt}=await ce.storage.from("trainer-documents").upload(hr,fr,{upsert:!0});if(Gt)throw Gt;k(hr),T(""),ae.success("CV uploadé avec succès")}catch(Ct){console.error("Error uploading CV:",Ct),ae.error("Erreur lors de l'upload du CV")}finally{f(!1),g.current&&(g.current.value="")}}},zt=async()=>{i(!0);try{const{error:ot}=await ce.from("trainer_profiles").update({name:y,email:N,bio:_||null,cv_url:P||null,cv_path:R,specialties:E,status:H,is_visible:z,manual_certified:B,legal_form:C||null,capital_amount:I?parseFloat(I):null,headquarters_address:Y||null,legal_representative_name:re||null,legal_representative_function:ie||null,siret:Q||null,activity_declaration_number:W||null,preferred_modality:he,preferred_departments:oe,country:Me||null,phone:me||null,linkedin_url:Ke||null,website_url:_e||null,english_level:Qe||null}).eq("id",e.id);if(ot)throw ot;ae.success("Profil formateur mis à jour"),n(!1),t()}catch(ot){console.error("Error updating trainer:",ot),ae.error("Erreur lors de la mise à jour")}finally{i(!1)}},Lt=()=>{O.trim()&&!E.includes(O.trim())&&(q([...E,O.trim()]),L(""))},or=ot=>{q(E.filter(fr=>fr!==ot))};return s.jsxs(qn,{open:r,onOpenChange:ut,children:[s.jsx(Xo,{asChild:!0,children:s.jsxs(ne,{variant:"outline",size:"sm",children:[s.jsx(bC,{className:"h-4 w-4 mr-2"}),"Modifier"]})}),s.jsxs($n,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[s.jsx(Un,{children:s.jsxs(Vn,{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(Xe,{id:"name",value:y,onChange:ot=>b(ot.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"email",children:"Email"}),s.jsx(Xe,{id:"email",type:"email",value:N,onChange:ot=>j(ot.target.value)})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"bio",children:"Biographie"}),s.jsx(gn,{id:"bio",value:_,onChange:ot=>S(ot.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:g,type:"file",accept:".pdf",onChange:Wt,className:"hidden"}),s.jsx(ne,{type:"button",variant:"outline",onClick:()=>{var ot;return(ot=g.current)==null?void 0:ot.click()},disabled:d,className:"flex-1",children:d?s.jsxs(s.Fragment,{children:[s.jsx(it,{className:"h-4 w-4 mr-2 animate-spin"}),"Upload en cours..."]}):s.jsxs(s.Fragment,{children:[s.jsx(lc,{className:"h-4 w-4 mr-2"}),P||R?"Remplacer le CV":"Ajouter un CV"]})}),(P||R)&&s.jsxs("button",{type:"button",onClick:async()=>{const ot=await Kx({document_path:R,document_url:P||null});ot?window.open(ot,"_blank","noopener,noreferrer"):ae.error("CV indisponible")},className:"flex items-center gap-1 text-sm text-primary hover:underline",children:[s.jsx(Kt,{className:"h-4 w-4"}),"Voir",s.jsx(Kn,{className:"h-3 w-3"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{children:"Niveau d'anglais"}),s.jsxs(Ar,{value:Qe||"none",onValueChange:ot=>st(ot==="none"?"":ot),children:[s.jsx(kr,{children:s.jsx(Dr,{placeholder:"Non renseigné"})}),s.jsxs(Cr,{children:[s.jsx(ct,{value:"none",children:"Non renseigné"}),s.jsx(ct,{value:"basic",children:"Basique"}),s.jsx(ct,{value:"intermediate",children:"Intermédiaire"}),s.jsx(ct,{value:"advanced",children:"Avancé"}),s.jsx(ct,{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(Ar,{value:H,onValueChange:V,children:[s.jsx(kr,{children:s.jsx(Dr,{})}),s.jsxs(Cr,{children:[s.jsx(ct,{value:"pending",children:"En attente"}),s.jsx(ct,{value:"approved",children:"Approuvé"}),s.jsx(ct,{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(jy,{checked:z,onCheckedChange:M}),s.jsx("span",{className:"text-sm text-muted-foreground",children:z?"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(jy,{checked:B,onCheckedChange:K}),s.jsx("span",{className:"text-sm text-muted-foreground",children:B?"Activé":"Désactivé"}),B&&s.jsx(Te,{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:E.map(ot=>s.jsxs(Te,{variant:"secondary",className:"gap-1",children:[ot,s.jsx("button",{type:"button",onClick:()=>or(ot),className:"ml-1 hover:text-destructive",children:s.jsx($i,{className:"h-3 w-3"})})]},ot))}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Xe,{placeholder:"Ajouter une compétence...",value:O,onChange:ot=>L(ot.target.value),onKeyDown:ot=>ot.key==="Enter"&&(ot.preventDefault(),Lt())}),s.jsx(ne,{type:"button",variant:"outline",onClick:Lt,children:s.jsx(Qa,{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(Ar,{value:he,onValueChange:se,children:[s.jsx(kr,{children:s.jsx(Dr,{})}),s.jsxs(Cr,{children:[s.jsx(ct,{value:"physical",children:"Présentiel"}),s.jsx(ct,{value:"remote",children:"Distanciel"}),s.jsx(ct,{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(lp,{open:o,onOpenChange:l,children:[s.jsx(cp,{asChild:!0,children:s.jsxs(ne,{variant:"outline",role:"combobox","aria-expanded":o,className:"w-full justify-between",children:[oe.length===0?"France entière":`${oe.length} département(s)`,s.jsx(g2,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),s.jsx(vh,{className:"w-full p-0 z-[100]",align:"start",children:s.jsxs(dp,{children:[s.jsx(fp,{placeholder:"Rechercher...",value:c,onValueChange:u}),s.jsxs(hp,{className:"max-h-[200px]",children:[s.jsx(mp,{children:"Aucun résultat"}),s.jsx(rh,{children:aF.filter(ot=>ot.name.toLowerCase().includes(c.toLowerCase())||ot.code.includes(c)).map(ot=>s.jsxs(qu,{value:`${ot.code} ${ot.name}`,onSelect:()=>{le(fr=>fr.includes(ot.code)?fr.filter(Et=>Et!==ot.code):[...fr,ot.code])},children:[s.jsx(Rn,{className:yt("mr-2 h-4 w-4",oe.includes(ot.code)?"opacity-100":"opacity-0")}),ot.code," - ",ot.name]},ot.code))})]})]})})]}),oe.length>0&&s.jsxs("div",{className:"flex flex-wrap gap-1 mt-2",children:[oe.slice(0,5).map(ot=>s.jsxs(Te,{variant:"secondary",className:"text-xs gap-1",children:[ot,s.jsx("button",{type:"button",onClick:()=>le(fr=>fr.filter(Et=>Et!==ot)),children:s.jsx($i,{className:"h-3 w-3"})})]},ot)),oe.length>5&&s.jsxs(Te,{variant:"outline",className:"text-xs",children:["+",oe.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(Xe,{id:"legalForm",value:C,onChange:ot=>A(ot.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(Xe,{id:"capitalAmount",type:"number",value:I,onChange:ot=>U(ot.target.value)})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"headquartersAddress",children:"Adresse du siège social"}),s.jsx(Xe,{id:"headquartersAddress",value:Y,onChange:ot=>te(ot.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(Xe,{id:"legalRepresentativeName",value:re,onChange:ot=>J(ot.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"legalRepresentativeFunction",children:"Fonction"}),s.jsx(Xe,{id:"legalRepresentativeFunction",value:ie,onChange:ot=>be(ot.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(Xe,{id:"siret",value:Q,onChange:ot=>Ve(ot.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"activityDeclarationNumber",children:"N° déclaration d'activité"}),s.jsx(Xe,{id:"activityDeclarationNumber",value:W,onChange:ot=>Z(ot.target.value)})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"country",children:"Pays"}),s.jsx(Xe,{id:"country",value:Me,onChange:ot=>de(ot.target.value)})]})]}),s.jsx($De,{trainerId:e.id,trainerUserId:e.user_id}),s.jsx(Mu,{}),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(o6,{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:Mt,className:"hidden"}),s.jsx(ne,{type:"button",variant:"outline",onClick:()=>{var ot;return(ot=v.current)==null?void 0:ot.click()},disabled:m,className:"flex-1",children:m?s.jsxs(s.Fragment,{children:[s.jsx(it,{className:"h-4 w-4 mr-2 animate-spin"}),"Upload en cours..."]}):s.jsxs(s.Fragment,{children:[s.jsx(lc,{className:"h-4 w-4 mr-2"}),x?"Remplacer le contrat signé":"Uploader le contrat signé"]})}),x&&s.jsxs("a",{href:x,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-sm text-primary hover:underline",children:[s.jsx(Kt,{className:"h-4 w-4"}),"Voir",s.jsx(Kn,{className:"h-3 w-3"})]})]}),x&&s.jsx("p",{className:"text-xs text-muted-foreground",children:"✓ Un contrat signé a été uploadé pour ce formateur"})]})]}),s.jsxs(bl,{children:[s.jsx(ne,{variant:"outline",onClick:()=>n(!1),children:"Annuler"}),s.jsx(ne,{onClick:zt,disabled:a,children:a?s.jsxs(s.Fragment,{children:[s.jsx(it,{className:"h-4 w-4 mr-2 animate-spin"}),"Enregistrement..."]}):s.jsxs(s.Fragment,{children:[s.jsx(FQ,{className:"h-4 w-4 mr-2"}),"Enregistrer"]})})]})]})]})}function iS(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 uoe={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 iS=="function"&&iS;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(x){var p=n[u][1][x];return o(p||x)},h,h.exports,r,n,a,i)}return a[u].exports}for(var l=typeof iS=="function"&&iS,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,x,p,g=[],v=0,y=c.length,b=y,N=i.getTypeOf(c)!=="string";v<c.length;)b=y-v,f=N?(u=c[v++],d=v<y?c[v++]:0,v<y?c[v++]:0):(u=c.charCodeAt(v++),d=v<y?c.charCodeAt(v++):0,v<y?c.charCodeAt(v++):0),m=u>>2,h=(3&u)<<4|d>>4,x=1<b?(15&d)<<2|f>>6:64,p=2<b?63&f:64,g.push(l.charAt(m)+l.charAt(h)+l.charAt(x)+l.charAt(p));return g.join("")},a.decode=function(c){var u,d,f,m,h,x,p=0,g=0,v="data:";if(c.substr(0,v.length)===v)throw new Error("Invalid base64 input, it looks like a data url.");var y,b=3*(c=c.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(c.charAt(c.length-1)===l.charAt(64)&&b--,c.charAt(c.length-2)===l.charAt(64)&&b--,b%1!=0)throw new Error("Invalid base64 input, bad content length.");for(y=o.uint8array?new Uint8Array(0|b):new Array(0|b);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|(x=l.indexOf(c.charAt(p++))),y[g++]=u,h!==64&&(y[g++]=d),x!==64&&(y[g++]=f);return y}},{"./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,x){this.compressedSize=d,this.uncompressedSize=f,this.crc32=m,this.compression=h,this.compressedContent=x}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,x=m+f;u^=-1;for(var p=m;p<x;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,x=m+f;u^=-1;for(var p=m;p<x;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,x){var p,g="";for(p=0;p<x;p++)g+=String.fromCharCode(255&h),h>>>=8;return g}function o(h,x,p,g,v,y){var b,N,j=h.file,_=h.compression,S=y!==u.utf8encode,P=l.transformTo("string",y(j.name)),T=l.transformTo("string",u.utf8encode(j.name)),R=j.comment,k=l.transformTo("string",y(R)),E=l.transformTo("string",u.utf8encode(R)),q=T.length!==j.name.length,O=E.length!==R.length,L="",H="",V="",z=j.dir,M=j.date,B={crc32:0,compressedSize:0,uncompressedSize:0};x&&!p||(B.crc32=h.crc32,B.compressedSize=h.compressedSize,B.uncompressedSize=h.uncompressedSize);var K=0;x&&(K|=8),S||!q&&!O||(K|=2048);var C=0,A=0;z&&(C|=16),v==="UNIX"?(A=798,C|=function(U,Y){var te=U;return U||(te=Y?16893:33204),(65535&te)<<16}(j.unixPermissions,z)):(A=20,C|=function(U){return 63&(U||0)}(j.dosPermissions)),b=M.getUTCHours(),b<<=6,b|=M.getUTCMinutes(),b<<=5,b|=M.getUTCSeconds()/2,N=M.getUTCFullYear()-1980,N<<=4,N|=M.getUTCMonth()+1,N<<=5,N|=M.getUTCDate(),q&&(H=i(1,1)+i(d(P),4)+T,L+="up"+i(H.length,2)+H),O&&(V=i(1,1)+i(d(k),4)+E,L+="uc"+i(V.length,2)+V);var I="";return I+=`
\0`,I+=i(K,2),I+=_.magic,I+=i(b,2),I+=i(N,2),I+=i(B.crc32,4),I+=i(B.compressedSize,4),I+=i(B.uncompressedSize,4),I+=i(P.length,2),I+=i(L.length,2),{fileRecord:f.LOCAL_FILE_HEADER+I+P+L,dirRecord:f.CENTRAL_FILE_HEADER+i(A,2)+I+i(k.length,2)+"\0\0\0\0"+i(C,4)+i(g,4)+P+L+k}}var l=r("../utils"),c=r("../stream/GenericWorker"),u=r("../utf8"),d=r("../crc32"),f=r("../signature");function m(h,x,p,g){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=x,this.zipPlatform=p,this.encodeFileName=g,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 x=h.meta.percent||0,p=this.entriesCount,g=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?(x+100*(p-g-1))/p:100}}))},m.prototype.openedSource=function(h){this.currentSourceOffset=this.bytesWritten,this.currentFile=h.file.name;var x=this.streamFiles&&!h.file.dir;if(x){var p=o(h,x,!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 x=this.streamFiles&&!h.file.dir,p=o(h,x,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(p.dirRecord),x)this.push({data:function(g){return f.DATA_DESCRIPTOR+i(g.crc32,4)+i(g.compressedSize,4)+i(g.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,x=0;x<this.dirRecords.length;x++)this.push({data:this.dirRecords[x],meta:{percent:100}});var p=this.bytesWritten-h,g=function(v,y,b,N,j){var _=l.transformTo("string",j(N));return f.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(v,2)+i(v,2)+i(y,4)+i(b,4)+i(_.length,2)+_}(this.dirRecords.length,p,h,this.zipComment,this.encodeFileName);this.push({data:g,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 x=this;return h.on("data",function(p){x.processChunk(p)}),h.on("end",function(){x.closedSource(x.previous.streamInfo),x._sources.length?x.prepareNextSource():x.end()}),h.on("error",function(p){x.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 x=this._sources;if(!c.prototype.error.call(this,h))return!1;for(var p=0;p<x.length;p++)try{x[p].error(h)}catch{}return!0},m.prototype.lock=function(){c.prototype.lock.call(this);for(var h=this._sources,x=0;x<h.length;x++)h[x].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 x=function(y,b){var N=y||b,j=i[N];if(!j)throw new Error(N+" is not a valid compression method !");return j}(h.options.compression,c.compression),p=h.options.compressionOptions||c.compressionOptions||{},g=h.dir,v=h.date;h._compressWorker(x,p).withStreamInfo("file",{name:m,dir:g,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,x){var p=m.decompressed.getContentWorker().pipe(new u);p.on("error",function(g){x(g)}).on("end",function(){p.streamInfo.crc32!==m.decompressed.crc32?x(new Error("Corrupted zip : CRC32 mismatch")):h()}).resume()})}n.exports=function(m,h){var x=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 g=new c(h);return g.load(p),g}).then(function(p){var g=[o.Promise.resolve(p)],v=p.files;if(h.checkCRC32)for(var y=0;y<v.length;y++)g.push(f(v[y]));return o.Promise.all(g)}).then(function(p){for(var g=p.shift(),v=g.files,y=0;y<v.length;y++){var b=v[y],N=b.fileNameStr,j=i.resolve(b.fileNameStr);x.file(j,b.decompressed,{binary:!0,optimizedBinaryString:!0,date:b.date,dir:b.dir,comment:b.fileCommentStr.length?b.fileCommentStr:null,unixPermissions:b.unixPermissions,dosPermissions:b.dosPermissions,createFolders:h.createFolders}),b.dir||(x.file(j).unsafeOriginalName=N)}return g.zipComment.length&&(x.comment=g.zipComment),x})}},{"./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 P,T=l.getTypeOf(_),R=l.extend(S||{},d);R.date=R.date||new Date,R.compression!==null&&(R.compression=R.compression.toUpperCase()),typeof R.unixPermissions=="string"&&(R.unixPermissions=parseInt(R.unixPermissions,8)),R.unixPermissions&&16384&R.unixPermissions&&(R.dir=!0),R.dosPermissions&&16&R.dosPermissions&&(R.dir=!0),R.dir&&(j=v(j)),R.createFolders&&(P=g(j))&&y.call(this,P,!0);var k=T==="string"&&R.binary===!1&&R.base64===!1;S&&S.binary!==void 0||(R.binary=!k),(_ instanceof f&&_.uncompressedSize===0||R.dir||!_||_.length===0)&&(R.base64=!1,R.binary=!0,_="",R.compression="STORE",T="string");var E=null;E=_ instanceof f||_ instanceof c?_:x.isNode&&x.isStream(_)?new p(j,_):l.prepareContent(j,_,R.binary,R.optimizedBinaryString,R.base64);var q=new m(j,E,R);this.files[j]=q}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"),x=r("./nodejsUtils"),p=r("./nodejs/NodejsStreamInputAdapter"),g=function(j){j.slice(-1)==="/"&&(j=j.substring(0,j.length-1));var _=j.lastIndexOf("/");return 0<_?j.substring(0,_):""},v=function(j){return j.slice(-1)!=="/"&&(j+="/"),j},y=function(j,_){return _=_!==void 0?_:d.createFolders,j=v(j),this.files[j]||i.call(this,j,null,{dir:!0,createFolders:_}),this.files[j]};function b(j){return Object.prototype.toString.call(j)==="[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(j){var _,S,P;for(_ in this.files)P=this.files[_],(S=_.slice(this.root.length,_.length))&&_.slice(0,this.root.length)===this.root&&j(S,P)},filter:function(j){var _=[];return this.forEach(function(S,P){j(S,P)&&_.push(P)}),_},file:function(j,_,S){if(arguments.length!==1)return j=this.root+j,i.call(this,j,_,S),this;if(b(j)){var P=j;return this.filter(function(R,k){return!k.dir&&P.test(R)})}var T=this.files[this.root+j];return T&&!T.dir?T:null},folder:function(j){if(!j)return this;if(b(j))return this.filter(function(T,R){return R.dir&&j.test(T)});var _=this.root+j,S=y.call(this,_),P=this.clone();return P.root=S.name,P},remove:function(j){j=this.root+j;var _=this.files[j];if(_||(j.slice(-1)!=="/"&&(j+="/"),_=this.files[j]),_&&!_.dir)delete this.files[j];else for(var S=this.filter(function(T,R){return R.name.slice(0,j.length)===j}),P=0;P<S.length;P++)delete this.files[S[P].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(j){var _,S={};try{if((S=l.extend(j||{},{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 P=S.comment||this.comment||"";_=h.generateWorker(this,S,P)}catch(T){(_=new c("error")).error(T)}return new u(_,S.type||"string",S.mimeType)},generateAsync:function(j,_){return this.generateInternalStream(j).accumulate(_)},generateNodeStream:function(j,_){return(j=j||{}).type||(j.type="nodebuffer"),this.generateInternalStream(j).toNodejsStream(_)}};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(x,p){return new d.Promise(function(g,v){var y=[],b=x._internalType,N=x._outputType,j=x._mimeType;x.on("data",function(_,S){y.push(_),p&&p(S)}).on("error",function(_){y=[],v(_)}).on("end",function(){try{var _=function(S,P,T){switch(S){case"blob":return i.newBlob(i.transformTo("arraybuffer",P),T);case"base64":return c.encode(P);default:return i.transformTo(S,P)}}(N,function(S,P){var T,R=0,k=null,E=0;for(T=0;T<P.length;T++)E+=P[T].length;switch(S){case"string":return P.join("");case"array":return Array.prototype.concat.apply([],P);case"uint8array":for(k=new Uint8Array(E),T=0;T<P.length;T++)k.set(P[T],R),R+=P[T].length;return k;case"nodebuffer":return Buffer.concat(P);default:throw new Error("concat : unsupported type '"+S+"'")}}(b,y),j);g(_)}catch(S){v(S)}y=[]}).resume()})}function h(x,p,g){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=g,i.checkSupport(v),this._worker=x.pipe(new o(v)),x.lock()}catch(y){this._worker=new l("error"),this._worker.error(y)}}h.prototype={accumulate:function(x){return m(this,x)},on:function(x,p){var g=this;return x==="data"?this._worker.on(x,function(v){p.call(g,v.data,v.meta)}):this._worker.on(x,function(){i.delay(p,arguments,g)}),this},resume:function(){return i.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(x){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"},x)}},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(x){var p,g,v,y,b,N=x.length,j=0;for(y=0;y<N;y++)(64512&(g=x.charCodeAt(y)))==55296&&y+1<N&&(64512&(v=x.charCodeAt(y+1)))==56320&&(g=65536+(g-55296<<10)+(v-56320),y++),j+=g<128?1:g<2048?2:g<65536?3:4;for(p=o.uint8array?new Uint8Array(j):new Array(j),y=b=0;b<j;y++)(64512&(g=x.charCodeAt(y)))==55296&&y+1<N&&(64512&(v=x.charCodeAt(y+1)))==56320&&(g=65536+(g-55296<<10)+(v-56320),y++),g<128?p[b++]=g:(g<2048?p[b++]=192|g>>>6:(g<65536?p[b++]=224|g>>>12:(p[b++]=240|g>>>18,p[b++]=128|g>>>12&63),p[b++]=128|g>>>6&63),p[b++]=128|63&g);return p}(h)},a.utf8decode=function(h){return o.nodebuffer?i.transformTo("nodebuffer",h).toString("utf-8"):function(x){var p,g,v,y,b=x.length,N=new Array(2*b);for(p=g=0;p<b;)if((v=x[p++])<128)N[g++]=v;else if(4<(y=u[v]))N[g++]=65533,p+=y-1;else{for(v&=y===2?31:y===3?15:7;1<y&&p<b;)v=v<<6|63&x[p++],y--;1<y?N[g++]=65533:v<65536?N[g++]=v:(v-=65536,N[g++]=55296|v>>10&1023,N[g++]=56320|1023&v)}return N.length!==g&&(N.subarray?N=N.subarray(0,g):N.length=g),i.applyFromCharCode(N)}(h=i.transformTo(o.uint8array?"uint8array":"array",h))},i.inherits(f,c),f.prototype.processChunk=function(h){var x=i.transformTo(o.uint8array?"uint8array":"array",h.data);if(this.leftOver&&this.leftOver.length){if(o.uint8array){var p=x;(x=new Uint8Array(p.length+this.leftOver.length)).set(this.leftOver,0),x.set(p,this.leftOver.length)}else x=this.leftOver.concat(x);this.leftOver=null}var g=function(y,b){var N;for((b=b||y.length)>y.length&&(b=y.length),N=b-1;0<=N&&(192&y[N])==128;)N--;return N<0||N===0?b:N+u[y[N]]>b?N:b}(x),v=x;g!==x.length&&(o.uint8array?(v=x.subarray(0,g),this.leftOver=x.subarray(g,x.length)):(v=x.slice(0,g),this.leftOver=x.slice(g,x.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,g){for(var v=0;v<p.length;++v)g[v]=255&p.charCodeAt(v);return g}r("setimmediate"),a.newBlob=function(p,g){a.checkSupport("blob");try{return new Blob([p],{type:g})}catch{try{var v=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return v.append(p),v.getBlob(g)}catch{throw new Error("Bug : can't construct the Blob.")}}};var f={stringifyByChunk:function(p,g,v){var y=[],b=0,N=p.length;if(N<=v)return String.fromCharCode.apply(null,p);for(;b<N;)g==="array"||g==="nodebuffer"?y.push(String.fromCharCode.apply(null,p.slice(b,Math.min(b+v,N)))):y.push(String.fromCharCode.apply(null,p.subarray(b,Math.min(b+v,N)))),b+=v;return y.join("")},stringifyByChar:function(p){for(var g="",v=0;v<p.length;v++)g+=String.fromCharCode(p[v]);return g},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 g=65536,v=a.getTypeOf(p),y=!0;if(v==="uint8array"?y=f.applyCanBeUsed.uint8array:v==="nodebuffer"&&(y=f.applyCanBeUsed.nodebuffer),y)for(;1<g;)try{return f.stringifyByChunk(p,v,g)}catch{g=Math.floor(g/2)}return f.stringifyByChar(p)}function h(p,g){for(var v=0;v<p.length;v++)g[v]=p[v];return g}a.applyFromCharCode=m;var x={};x.string={string:u,array:function(p){return d(p,new Array(p.length))},arraybuffer:function(p){return x.string.uint8array(p).buffer},uint8array:function(p){return d(p,new Uint8Array(p.length))},nodebuffer:function(p){return d(p,l.allocBuffer(p.length))}},x.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)}},x.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))}},x.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)}},x.nodebuffer={string:m,array:function(p){return h(p,new Array(p.length))},arraybuffer:function(p){return x.nodebuffer.uint8array(p).buffer},uint8array:function(p){return h(p,new Uint8Array(p.length))},nodebuffer:u},a.transformTo=function(p,g){if(g=g||"",!p)return g;a.checkSupport(p);var v=a.getTypeOf(g);return x[v][p](g)},a.resolve=function(p){for(var g=p.split("/"),v=[],y=0;y<g.length;y++){var b=g[y];b==="."||b===""&&y!==0&&y!==g.length-1||(b===".."?v.pop():v.push(b))}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 g,v,y="";for(v=0;v<(p||"").length;v++)y+="\\x"+((g=p.charCodeAt(v))<16?"0":"")+g.toString(16).toUpperCase();return y},a.delay=function(p,g,v){setImmediate(function(){p.apply(v||null,g||[])})},a.inherits=function(p,g){function v(){}v.prototype=g.prototype,p.prototype=new v},a.extend=function(){var p,g,v={};for(p=0;p<arguments.length;p++)for(g in arguments[p])Object.prototype.hasOwnProperty.call(arguments[p],g)&&v[g]===void 0&&(v[g]=arguments[p][g]);return v},a.prepareContent=function(p,g,v,y,b){return c.Promise.resolve(g).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(P){j(P.target.result)},S.onerror=function(P){_(P.target.error)},S.readAsArrayBuffer(N)}):N}).then(function(N){var j=a.getTypeOf(N);return j?(j==="arraybuffer"?N=a.transformTo("uint8array",N):j==="string"&&(b?N=o.decode(N):v&&y!==!0&&(N=function(_){return d(_,i.uint8array?new Uint8Array(_.length):new Array(_.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 x=this.reader.readString(4)===m;return this.reader.setIndex(h),x},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,x=this.zip64EndOfCentralSize-44;0<x;)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 x=m-h;if(0<x)this.isSignature(m,l.CENTRAL_FILE_HEADER)||(this.reader.zero=x);else if(x<0)throw new Error("Corrupted zip: missing "+Math.abs(x)+" 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,x){this.options=h,this.loadOptions=x}m.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(h){var x,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((x=function(g){for(var v in d)if(Object.prototype.hasOwnProperty.call(d,v)&&d[v].magic===g)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,x,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 x=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(x),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 x,p,g,v=h.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});h.index+4<v;)x=h.readInt(2),p=h.readInt(2),g=h.readData(p),this.extraFields[x]={id:x,length:p,value:g};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 x=this.findExtraFieldUnicodePath();if(x!==null)this.fileNameStr=x;else{var p=o.transformTo(h,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(p)}var g=this.findExtraFieldUnicodeComment();if(g!==null)this.fileCommentStr=g;else{var v=o.transformTo(h,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(v)}}},findExtraFieldUnicodePath:function(){var h=this.extraFields[28789];if(h){var x=i(h.value);return x.readInt(1)!==1||c(this.fileName)!==x.readInt(4)?null:u.utf8decode(x.readData(h.length-5))}return null},findExtraFieldUnicodeComment:function(){var h=this.extraFields[25461];if(h){var x=i(h.value);return x.readInt(1)!==1||c(this.fileComment)!==x.readInt(4)?null:u.utf8decode(x.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(x,p,g){this.name=x,this.dir=g.dir,this.date=g.date,this.comment=g.comment,this.unixPermissions=g.unixPermissions,this.dosPermissions=g.dosPermissions,this._data=p,this._dataBinary=g.binary,this.options={compression:g.compression,compressionOptions:g.compressionOptions}}var o=r("./stream/StreamHelper"),l=r("./stream/DataWorker"),c=r("./utf8"),u=r("./compressedObject"),d=r("./stream/GenericWorker");i.prototype={internalStream:function(x){var p=null,g="string";try{if(!x)throw new Error("No output type specified.");var v=(g=x.toLowerCase())==="string"||g==="text";g!=="binarystring"&&g!=="text"||(g="string"),p=this._decompressWorker();var y=!this._dataBinary;y&&!v&&(p=p.pipe(new c.Utf8EncodeWorker)),!y&&v&&(p=p.pipe(new c.Utf8DecodeWorker))}catch(b){(p=new d("error")).error(b)}return new o(p,g,"")},async:function(x,p){return this.internalStream(x).accumulate(p)},nodeStream:function(x,p){return this.internalStream(x||"nodebuffer").toNodejsStream(p)},_compressWorker:function(x,p){if(this._data instanceof u&&this._data.compression.magic===x.magic)return this._data.getCompressedWorker();var g=this._decompressWorker();return this._dataBinary||(g=g.pipe(new c.Utf8EncodeWorker)),u.createWorkerFrom(g,x,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(x),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(){x(),p.onreadystatechange=null,p.parentNode.removeChild(p),p=null},i.document.documentElement.appendChild(p)}:function(){setTimeout(x,0)};else{var m=new i.MessageChannel;m.port1.onmessage=x,o=function(){m.port2.postMessage(0)}}var h=[];function x(){var p,g;l=!0;for(var v=h.length;v;){for(g=h,h=[],p=-1;++p<v;)g[p]();v=h.length}l=!1}n.exports=function(p){h.push(p)!==1||l||o()}}).call(this,typeof zc<"u"?zc: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,y,b){this.promise=v,typeof y=="function"&&(this.onFulfilled=y,this.callFulfilled=this.otherCallFulfilled),typeof b=="function"&&(this.onRejected=b,this.callRejected=this.otherCallRejected)}function h(v,y,b){i(function(){var N;try{N=y(b)}catch(j){return l.reject(v,j)}N===v?l.reject(v,new TypeError("Cannot resolve promise with itself")):l.resolve(v,N)})}function x(v){var y=v&&v.then;if(v&&(typeof v=="object"||typeof v=="function")&&typeof y=="function")return function(){y.apply(v,arguments)}}function p(v,y){var b=!1;function N(S){b||(b=!0,l.reject(v,S))}function j(S){b||(b=!0,l.resolve(v,S))}var _=g(function(){y(j,N)});_.status==="error"&&N(_.value)}function g(v,y){var b={};try{b.value=v(y),b.status="success"}catch(N){b.status="error",b.value=N}return b}(n.exports=f).prototype.finally=function(v){if(typeof v!="function")return this;var y=this.constructor;return this.then(function(b){return y.resolve(v()).then(function(){return b})},function(b){return y.resolve(v()).then(function(){throw b})})},f.prototype.catch=function(v){return this.then(null,v)},f.prototype.then=function(v,y){if(typeof v!="function"&&this.state===u||typeof y!="function"&&this.state===c)return this;var b=new this.constructor(o);return this.state!==d?h(b,this.state===u?v:y,this.outcome):this.queue.push(new m(b,v,y)),b},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,y){var b=g(x,y);if(b.status==="error")return l.reject(v,b.value);var N=b.value;if(N)p(v,N);else{v.state=u,v.outcome=y;for(var j=-1,_=v.queue.length;++j<_;)v.queue[j].callFulfilled(y)}return v},l.reject=function(v,y){v.state=c,v.outcome=y;for(var b=-1,N=v.queue.length;++b<N;)v.queue[b].callRejected(y);return v},f.resolve=function(v){return v instanceof this?v:l.resolve(new this(o),v)},f.reject=function(v){var y=new this(o);return l.reject(y,v)},f.all=function(v){var y=this;if(Object.prototype.toString.call(v)!=="[object Array]")return this.reject(new TypeError("must be an array"));var b=v.length,N=!1;if(!b)return this.resolve([]);for(var j=new Array(b),_=0,S=-1,P=new this(o);++S<b;)T(v[S],S);return P;function T(R,k){y.resolve(R).then(function(E){j[k]=E,++_!==b||N||(N=!0,l.resolve(P,j))},function(E){N||(N=!0,l.reject(P,E))})}},f.race=function(v){var y=this;if(Object.prototype.toString.call(v)!=="[object Array]")return this.reject(new TypeError("must be an array"));var b=v.length,N=!1;if(!b)return this.resolve([]);for(var j=-1,_=new this(o);++j<b;)S=v[j],y.resolve(S).then(function(P){N||(N=!0,l.resolve(_,P))},function(P){N||(N=!0,l.reject(_,P))});var S;return _}},{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,x=8;function p(v){if(!(this instanceof p))return new p(v);this.options=o.assign({level:m,method:x,chunkSize:16384,windowBits:15,memLevel:8,strategy:h,to:""},v||{});var y=this.options;y.raw&&0<y.windowBits?y.windowBits=-y.windowBits:y.gzip&&0<y.windowBits&&y.windowBits<16&&(y.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var b=i.deflateInit2(this.strm,y.level,y.method,y.windowBits,y.memLevel,y.strategy);if(b!==f)throw new Error(c[b]);if(y.header&&i.deflateSetHeader(this.strm,y.header),y.dictionary){var N;if(N=typeof y.dictionary=="string"?l.string2buf(y.dictionary):d.call(y.dictionary)==="[object ArrayBuffer]"?new Uint8Array(y.dictionary):y.dictionary,(b=i.deflateSetDictionary(this.strm,N))!==f)throw new Error(c[b]);this._dict_set=!0}}function g(v,y){var b=new p(y);if(b.push(v,!0),b.err)throw b.msg||c[b.err];return b.result}p.prototype.push=function(v,y){var b,N,j=this.strm,_=this.options.chunkSize;if(this.ended)return!1;N=y===~~y?y:y===!0?4:0,typeof v=="string"?j.input=l.string2buf(v):d.call(v)==="[object ArrayBuffer]"?j.input=new Uint8Array(v):j.input=v,j.next_in=0,j.avail_in=j.input.length;do{if(j.avail_out===0&&(j.output=new o.Buf8(_),j.next_out=0,j.avail_out=_),(b=i.deflate(j,N))!==1&&b!==f)return this.onEnd(b),!(this.ended=!0);j.avail_out!==0&&(j.avail_in!==0||N!==4&&N!==2)||(this.options.to==="string"?this.onData(l.buf2binstring(o.shrinkBuf(j.output,j.next_out))):this.onData(o.shrinkBuf(j.output,j.next_out)))}while((0<j.avail_in||j.avail_out===0)&&b!==1);return N===4?(b=i.deflateEnd(this.strm),this.onEnd(b),this.ended=!0,b===f):N!==2||(this.onEnd(f),!(j.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=g,a.deflateRaw=function(v,y){return(y=y||{}).raw=!0,g(v,y)},a.gzip=function(v,y){return(y=y||{}).gzip=!0,g(v,y)}},{"./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 g=this.options;g.raw&&0<=g.windowBits&&g.windowBits<16&&(g.windowBits=-g.windowBits,g.windowBits===0&&(g.windowBits=-15)),!(0<=g.windowBits&&g.windowBits<16)||p&&p.windowBits||(g.windowBits+=32),15<g.windowBits&&g.windowBits<48&&!(15&g.windowBits)&&(g.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,g.windowBits);if(v!==c.Z_OK)throw new Error(u[v]);this.header=new f,i.inflateGetHeader(this.strm,this.header)}function x(p,g){var v=new h(g);if(v.push(p,!0),v.err)throw v.msg||u[v.err];return v.result}h.prototype.push=function(p,g){var v,y,b,N,j,_,S=this.strm,P=this.options.chunkSize,T=this.options.dictionary,R=!1;if(this.ended)return!1;y=g===~~g?g:g===!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(P),S.next_out=0,S.avail_out=P),(v=i.inflate(S,c.Z_NO_FLUSH))===c.Z_NEED_DICT&&T&&(_=typeof T=="string"?l.string2buf(T):m.call(T)==="[object ArrayBuffer]"?new Uint8Array(T):T,v=i.inflateSetDictionary(this.strm,_)),v===c.Z_BUF_ERROR&&R===!0&&(v=c.Z_OK,R=!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||y!==c.Z_FINISH&&y!==c.Z_SYNC_FLUSH)||(this.options.to==="string"?(b=l.utf8border(S.output,S.next_out),N=S.next_out-b,j=l.buf2string(S.output,b),S.next_out=N,S.avail_out=P-N,N&&o.arraySet(S.output,S.output,b,N,0),this.onData(j)):this.onData(o.shrinkBuf(S.output,S.next_out)))),S.avail_in===0&&S.avail_out===0&&(R=!0)}while((0<S.avail_in||S.avail_out===0)&&v!==c.Z_STREAM_END);return v===c.Z_STREAM_END&&(y=c.Z_FINISH),y===c.Z_FINISH?(v=i.inflateEnd(this.strm),this.onEnd(v),this.ended=!0,v===c.Z_OK):y!==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=x,a.inflateRaw=function(p,g){return(g=g||{}).raw=!0,x(p,g)},a.ungzip=x},{"./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,x;for(u=f=0,d=c.length;u<d;u++)f+=c[u].length;for(x=new Uint8Array(f),u=m=0,d=c.length;u<d;u++)h=c[u],x.set(h,m),m+=h.length;return x}},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="",x=0;x<m;x++)h+=String.fromCharCode(f[x]);return h}c[254]=c[254]=1,a.string2buf=function(f){var m,h,x,p,g,v=f.length,y=0;for(p=0;p<v;p++)(64512&(h=f.charCodeAt(p)))==55296&&p+1<v&&(64512&(x=f.charCodeAt(p+1)))==56320&&(h=65536+(h-55296<<10)+(x-56320),p++),y+=h<128?1:h<2048?2:h<65536?3:4;for(m=new i.Buf8(y),p=g=0;g<y;p++)(64512&(h=f.charCodeAt(p)))==55296&&p+1<v&&(64512&(x=f.charCodeAt(p+1)))==56320&&(h=65536+(h-55296<<10)+(x-56320),p++),h<128?m[g++]=h:(h<2048?m[g++]=192|h>>>6:(h<65536?m[g++]=224|h>>>12:(m[g++]=240|h>>>18,m[g++]=128|h>>>12&63),m[g++]=128|h>>>6&63),m[g++]=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,x=m.length;h<x;h++)m[h]=f.charCodeAt(h);return m},a.buf2string=function(f,m){var h,x,p,g,v=m||f.length,y=new Array(2*v);for(h=x=0;h<v;)if((p=f[h++])<128)y[x++]=p;else if(4<(g=c[p]))y[x++]=65533,h+=g-1;else{for(p&=g===2?31:g===3?15:7;1<g&&h<v;)p=p<<6|63&f[h++],g--;1<g?y[x++]=65533:p<65536?y[x++]=p:(p-=65536,y[x++]=55296|p>>10&1023,y[x++]=56320|1023&p)}return d(y,x)},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,x=-2,p=-1,g=4,v=2,y=8,b=9,N=286,j=30,_=19,S=2*N+1,P=15,T=3,R=258,k=R+T+1,E=42,q=113,O=1,L=2,H=3,V=4;function z(W,Z){return W.msg=d[Z],Z}function M(W){return(W<<1)-(4<W?9:0)}function B(W){for(var Z=W.length;0<=--Z;)W[Z]=0}function K(W){var Z=W.state,he=Z.pending;he>W.avail_out&&(he=W.avail_out),he!==0&&(o.arraySet(W.output,Z.pending_buf,Z.pending_out,he,W.next_out),W.next_out+=he,Z.pending_out+=he,W.total_out+=he,W.avail_out-=he,Z.pending-=he,Z.pending===0&&(Z.pending_out=0))}function C(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 I(W,Z){W.pending_buf[W.pending++]=Z>>>8&255,W.pending_buf[W.pending++]=255&Z}function U(W,Z){var he,se,oe=W.max_chain_length,le=W.strstart,Me=W.prev_length,de=W.nice_match,me=W.strstart>W.w_size-k?W.strstart-(W.w_size-k):0,Le=W.window,Ke=W.w_mask,ve=W.prev,_e=W.strstart+R,Ue=Le[le+Me-1],Qe=Le[le+Me];W.prev_length>=W.good_match&&(oe>>=2),de>W.lookahead&&(de=W.lookahead);do if(Le[(he=Z)+Me]===Qe&&Le[he+Me-1]===Ue&&Le[he]===Le[le]&&Le[++he]===Le[le+1]){le+=2,he++;do;while(Le[++le]===Le[++he]&&Le[++le]===Le[++he]&&Le[++le]===Le[++he]&&Le[++le]===Le[++he]&&Le[++le]===Le[++he]&&Le[++le]===Le[++he]&&Le[++le]===Le[++he]&&Le[++le]===Le[++he]&&le<_e);if(se=R-(_e-le),le=_e-R,Me<se){if(W.match_start=Z,de<=(Me=se))break;Ue=Le[le+Me-1],Qe=Le[le+Me]}}while((Z=ve[Z&Ke])>me&&--oe!=0);return Me<=W.lookahead?Me:W.lookahead}function Y(W){var Z,he,se,oe,le,Me,de,me,Le,Ke,ve=W.w_size;do{if(oe=W.window_size-W.lookahead-W.strstart,W.strstart>=ve+(ve-k)){for(o.arraySet(W.window,W.window,ve,ve,0),W.match_start-=ve,W.strstart-=ve,W.block_start-=ve,Z=he=W.hash_size;se=W.head[--Z],W.head[Z]=ve<=se?se-ve:0,--he;);for(Z=he=ve;se=W.prev[--Z],W.prev[Z]=ve<=se?se-ve:0,--he;);oe+=ve}if(W.strm.avail_in===0)break;if(Me=W.strm,de=W.window,me=W.strstart+W.lookahead,Le=oe,Ke=void 0,Ke=Me.avail_in,Le<Ke&&(Ke=Le),he=Ke===0?0:(Me.avail_in-=Ke,o.arraySet(de,Me.input,Me.next_in,Ke,me),Me.state.wrap===1?Me.adler=c(Me.adler,de,Ke,me):Me.state.wrap===2&&(Me.adler=u(Me.adler,de,Ke,me)),Me.next_in+=Ke,Me.total_in+=Ke,Ke),W.lookahead+=he,W.lookahead+W.insert>=T)for(le=W.strstart-W.insert,W.ins_h=W.window[le],W.ins_h=(W.ins_h<<W.hash_shift^W.window[le+1])&W.hash_mask;W.insert&&(W.ins_h=(W.ins_h<<W.hash_shift^W.window[le+T-1])&W.hash_mask,W.prev[le&W.w_mask]=W.head[W.ins_h],W.head[W.ins_h]=le,le++,W.insert--,!(W.lookahead+W.insert<T)););}while(W.lookahead<k&&W.strm.avail_in!==0)}function te(W,Z){for(var he,se;;){if(W.lookahead<k){if(Y(W),W.lookahead<k&&Z===f)return O;if(W.lookahead===0)break}if(he=0,W.lookahead>=T&&(W.ins_h=(W.ins_h<<W.hash_shift^W.window[W.strstart+T-1])&W.hash_mask,he=W.prev[W.strstart&W.w_mask]=W.head[W.ins_h],W.head[W.ins_h]=W.strstart),he!==0&&W.strstart-he<=W.w_size-k&&(W.match_length=U(W,he)),W.match_length>=T)if(se=l._tr_tally(W,W.strstart-W.match_start,W.match_length-T),W.lookahead-=W.match_length,W.match_length<=W.max_lazy_match&&W.lookahead>=T){for(W.match_length--;W.strstart++,W.ins_h=(W.ins_h<<W.hash_shift^W.window[W.strstart+T-1])&W.hash_mask,he=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 se=l._tr_tally(W,0,W.window[W.strstart]),W.lookahead--,W.strstart++;if(se&&(C(W,!1),W.strm.avail_out===0))return O}return W.insert=W.strstart<T-1?W.strstart:T-1,Z===m?(C(W,!0),W.strm.avail_out===0?H:V):W.last_lit&&(C(W,!1),W.strm.avail_out===0)?O:L}function re(W,Z){for(var he,se,oe;;){if(W.lookahead<k){if(Y(W),W.lookahead<k&&Z===f)return O;if(W.lookahead===0)break}if(he=0,W.lookahead>=T&&(W.ins_h=(W.ins_h<<W.hash_shift^W.window[W.strstart+T-1])&W.hash_mask,he=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=T-1,he!==0&&W.prev_length<W.max_lazy_match&&W.strstart-he<=W.w_size-k&&(W.match_length=U(W,he),W.match_length<=5&&(W.strategy===1||W.match_length===T&&4096<W.strstart-W.match_start)&&(W.match_length=T-1)),W.prev_length>=T&&W.match_length<=W.prev_length){for(oe=W.strstart+W.lookahead-T,se=l._tr_tally(W,W.strstart-1-W.prev_match,W.prev_length-T),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+T-1])&W.hash_mask,he=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=T-1,W.strstart++,se&&(C(W,!1),W.strm.avail_out===0))return O}else if(W.match_available){if((se=l._tr_tally(W,0,W.window[W.strstart-1]))&&C(W,!1),W.strstart++,W.lookahead--,W.strm.avail_out===0)return O}else W.match_available=1,W.strstart++,W.lookahead--}return W.match_available&&(se=l._tr_tally(W,0,W.window[W.strstart-1]),W.match_available=0),W.insert=W.strstart<T-1?W.strstart:T-1,Z===m?(C(W,!0),W.strm.avail_out===0?H:V):W.last_lit&&(C(W,!1),W.strm.avail_out===0)?O:L}function J(W,Z,he,se,oe){this.good_length=W,this.max_lazy=Z,this.nice_length=he,this.max_chain=se,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=y,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*j+1)),this.bl_tree=new o.Buf16(2*(2*_+1)),B(this.dyn_ltree),B(this.dyn_dtree),B(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new o.Buf16(P+1),this.heap=new o.Buf16(2*N+1),B(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new o.Buf16(2*N+1),B(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 be(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?E:q,W.adler=Z.wrap===2?0:1,Z.last_flush=f,l._tr_init(Z),h):z(W,x)}function Q(W){var Z=be(W);return Z===h&&function(he){he.window_size=2*he.w_size,B(he.head),he.max_lazy_match=i[he.level].max_lazy,he.good_match=i[he.level].good_length,he.nice_match=i[he.level].nice_length,he.max_chain_length=i[he.level].max_chain,he.strstart=0,he.block_start=0,he.lookahead=0,he.insert=0,he.match_length=he.prev_length=T-1,he.match_available=0,he.ins_h=0}(W.state),Z}function Ve(W,Z,he,se,oe,le){if(!W)return x;var Me=1;if(Z===p&&(Z=6),se<0?(Me=0,se=-se):15<se&&(Me=2,se-=16),oe<1||b<oe||he!==y||se<8||15<se||Z<0||9<Z||le<0||g<le)return z(W,x);se===8&&(se=9);var de=new ie;return(W.state=de).strm=W,de.wrap=Me,de.gzhead=null,de.w_bits=se,de.w_size=1<<de.w_bits,de.w_mask=de.w_size-1,de.hash_bits=oe+7,de.hash_size=1<<de.hash_bits,de.hash_mask=de.hash_size-1,de.hash_shift=~~((de.hash_bits+T-1)/T),de.window=new o.Buf8(2*de.w_size),de.head=new o.Buf16(de.hash_size),de.prev=new o.Buf16(de.w_size),de.lit_bufsize=1<<oe+6,de.pending_buf_size=4*de.lit_bufsize,de.pending_buf=new o.Buf8(de.pending_buf_size),de.d_buf=1*de.lit_bufsize,de.l_buf=3*de.lit_bufsize,de.level=Z,de.strategy=le,de.method=he,Q(W)}i=[new J(0,0,0,0,function(W,Z){var he=65535;for(he>W.pending_buf_size-5&&(he=W.pending_buf_size-5);;){if(W.lookahead<=1){if(Y(W),W.lookahead===0&&Z===f)return O;if(W.lookahead===0)break}W.strstart+=W.lookahead,W.lookahead=0;var se=W.block_start+he;if((W.strstart===0||W.strstart>=se)&&(W.lookahead=W.strstart-se,W.strstart=se,C(W,!1),W.strm.avail_out===0)||W.strstart-W.block_start>=W.w_size-k&&(C(W,!1),W.strm.avail_out===0))return O}return W.insert=0,Z===m?(C(W,!0),W.strm.avail_out===0?H:V):(W.strstart>W.block_start&&(C(W,!1),W.strm.avail_out),O)}),new J(4,4,8,4,te),new J(4,5,16,8,te),new J(4,6,32,32,te),new J(4,4,16,16,re),new J(8,16,32,32,re),new J(8,16,128,128,re),new J(8,32,128,256,re),new J(32,128,258,1024,re),new J(32,258,258,4096,re)],a.deflateInit=function(W,Z){return Ve(W,Z,y,15,8,0)},a.deflateInit2=Ve,a.deflateReset=Q,a.deflateResetKeep=be,a.deflateSetHeader=function(W,Z){return W&&W.state?W.state.wrap!==2?x:(W.state.gzhead=Z,h):x},a.deflate=function(W,Z){var he,se,oe,le;if(!W||!W.state||5<Z||Z<0)return W?z(W,x):x;if(se=W.state,!W.output||!W.input&&W.avail_in!==0||se.status===666&&Z!==m)return z(W,W.avail_out===0?-5:x);if(se.strm=W,he=se.last_flush,se.last_flush=Z,se.status===E)if(se.wrap===2)W.adler=0,A(se,31),A(se,139),A(se,8),se.gzhead?(A(se,(se.gzhead.text?1:0)+(se.gzhead.hcrc?2:0)+(se.gzhead.extra?4:0)+(se.gzhead.name?8:0)+(se.gzhead.comment?16:0)),A(se,255&se.gzhead.time),A(se,se.gzhead.time>>8&255),A(se,se.gzhead.time>>16&255),A(se,se.gzhead.time>>24&255),A(se,se.level===9?2:2<=se.strategy||se.level<2?4:0),A(se,255&se.gzhead.os),se.gzhead.extra&&se.gzhead.extra.length&&(A(se,255&se.gzhead.extra.length),A(se,se.gzhead.extra.length>>8&255)),se.gzhead.hcrc&&(W.adler=u(W.adler,se.pending_buf,se.pending,0)),se.gzindex=0,se.status=69):(A(se,0),A(se,0),A(se,0),A(se,0),A(se,0),A(se,se.level===9?2:2<=se.strategy||se.level<2?4:0),A(se,3),se.status=q);else{var Me=y+(se.w_bits-8<<4)<<8;Me|=(2<=se.strategy||se.level<2?0:se.level<6?1:se.level===6?2:3)<<6,se.strstart!==0&&(Me|=32),Me+=31-Me%31,se.status=q,I(se,Me),se.strstart!==0&&(I(se,W.adler>>>16),I(se,65535&W.adler)),W.adler=1}if(se.status===69)if(se.gzhead.extra){for(oe=se.pending;se.gzindex<(65535&se.gzhead.extra.length)&&(se.pending!==se.pending_buf_size||(se.gzhead.hcrc&&se.pending>oe&&(W.adler=u(W.adler,se.pending_buf,se.pending-oe,oe)),K(W),oe=se.pending,se.pending!==se.pending_buf_size));)A(se,255&se.gzhead.extra[se.gzindex]),se.gzindex++;se.gzhead.hcrc&&se.pending>oe&&(W.adler=u(W.adler,se.pending_buf,se.pending-oe,oe)),se.gzindex===se.gzhead.extra.length&&(se.gzindex=0,se.status=73)}else se.status=73;if(se.status===73)if(se.gzhead.name){oe=se.pending;do{if(se.pending===se.pending_buf_size&&(se.gzhead.hcrc&&se.pending>oe&&(W.adler=u(W.adler,se.pending_buf,se.pending-oe,oe)),K(W),oe=se.pending,se.pending===se.pending_buf_size)){le=1;break}le=se.gzindex<se.gzhead.name.length?255&se.gzhead.name.charCodeAt(se.gzindex++):0,A(se,le)}while(le!==0);se.gzhead.hcrc&&se.pending>oe&&(W.adler=u(W.adler,se.pending_buf,se.pending-oe,oe)),le===0&&(se.gzindex=0,se.status=91)}else se.status=91;if(se.status===91)if(se.gzhead.comment){oe=se.pending;do{if(se.pending===se.pending_buf_size&&(se.gzhead.hcrc&&se.pending>oe&&(W.adler=u(W.adler,se.pending_buf,se.pending-oe,oe)),K(W),oe=se.pending,se.pending===se.pending_buf_size)){le=1;break}le=se.gzindex<se.gzhead.comment.length?255&se.gzhead.comment.charCodeAt(se.gzindex++):0,A(se,le)}while(le!==0);se.gzhead.hcrc&&se.pending>oe&&(W.adler=u(W.adler,se.pending_buf,se.pending-oe,oe)),le===0&&(se.status=103)}else se.status=103;if(se.status===103&&(se.gzhead.hcrc?(se.pending+2>se.pending_buf_size&&K(W),se.pending+2<=se.pending_buf_size&&(A(se,255&W.adler),A(se,W.adler>>8&255),W.adler=0,se.status=q)):se.status=q),se.pending!==0){if(K(W),W.avail_out===0)return se.last_flush=-1,h}else if(W.avail_in===0&&M(Z)<=M(he)&&Z!==m)return z(W,-5);if(se.status===666&&W.avail_in!==0)return z(W,-5);if(W.avail_in!==0||se.lookahead!==0||Z!==f&&se.status!==666){var de=se.strategy===2?function(me,Le){for(var Ke;;){if(me.lookahead===0&&(Y(me),me.lookahead===0)){if(Le===f)return O;break}if(me.match_length=0,Ke=l._tr_tally(me,0,me.window[me.strstart]),me.lookahead--,me.strstart++,Ke&&(C(me,!1),me.strm.avail_out===0))return O}return me.insert=0,Le===m?(C(me,!0),me.strm.avail_out===0?H:V):me.last_lit&&(C(me,!1),me.strm.avail_out===0)?O:L}(se,Z):se.strategy===3?function(me,Le){for(var Ke,ve,_e,Ue,Qe=me.window;;){if(me.lookahead<=R){if(Y(me),me.lookahead<=R&&Le===f)return O;if(me.lookahead===0)break}if(me.match_length=0,me.lookahead>=T&&0<me.strstart&&(ve=Qe[_e=me.strstart-1])===Qe[++_e]&&ve===Qe[++_e]&&ve===Qe[++_e]){Ue=me.strstart+R;do;while(ve===Qe[++_e]&&ve===Qe[++_e]&&ve===Qe[++_e]&&ve===Qe[++_e]&&ve===Qe[++_e]&&ve===Qe[++_e]&&ve===Qe[++_e]&&ve===Qe[++_e]&&_e<Ue);me.match_length=R-(Ue-_e),me.match_length>me.lookahead&&(me.match_length=me.lookahead)}if(me.match_length>=T?(Ke=l._tr_tally(me,1,me.match_length-T),me.lookahead-=me.match_length,me.strstart+=me.match_length,me.match_length=0):(Ke=l._tr_tally(me,0,me.window[me.strstart]),me.lookahead--,me.strstart++),Ke&&(C(me,!1),me.strm.avail_out===0))return O}return me.insert=0,Le===m?(C(me,!0),me.strm.avail_out===0?H:V):me.last_lit&&(C(me,!1),me.strm.avail_out===0)?O:L}(se,Z):i[se.level].func(se,Z);if(de!==H&&de!==V||(se.status=666),de===O||de===H)return W.avail_out===0&&(se.last_flush=-1),h;if(de===L&&(Z===1?l._tr_align(se):Z!==5&&(l._tr_stored_block(se,0,0,!1),Z===3&&(B(se.head),se.lookahead===0&&(se.strstart=0,se.block_start=0,se.insert=0))),K(W),W.avail_out===0))return se.last_flush=-1,h}return Z!==m?h:se.wrap<=0?1:(se.wrap===2?(A(se,255&W.adler),A(se,W.adler>>8&255),A(se,W.adler>>16&255),A(se,W.adler>>24&255),A(se,255&W.total_in),A(se,W.total_in>>8&255),A(se,W.total_in>>16&255),A(se,W.total_in>>24&255)):(I(se,W.adler>>>16),I(se,65535&W.adler)),K(W),0<se.wrap&&(se.wrap=-se.wrap),se.pending!==0?h:1)},a.deflateEnd=function(W){var Z;return W&&W.state?(Z=W.state.status)!==E&&Z!==69&&Z!==73&&Z!==91&&Z!==103&&Z!==q&&Z!==666?z(W,x):(W.state=null,Z===q?z(W,-3):h):x},a.deflateSetDictionary=function(W,Z){var he,se,oe,le,Me,de,me,Le,Ke=Z.length;if(!W||!W.state||(le=(he=W.state).wrap)===2||le===1&&he.status!==E||he.lookahead)return x;for(le===1&&(W.adler=c(W.adler,Z,Ke,0)),he.wrap=0,Ke>=he.w_size&&(le===0&&(B(he.head),he.strstart=0,he.block_start=0,he.insert=0),Le=new o.Buf8(he.w_size),o.arraySet(Le,Z,Ke-he.w_size,he.w_size,0),Z=Le,Ke=he.w_size),Me=W.avail_in,de=W.next_in,me=W.input,W.avail_in=Ke,W.next_in=0,W.input=Z,Y(he);he.lookahead>=T;){for(se=he.strstart,oe=he.lookahead-(T-1);he.ins_h=(he.ins_h<<he.hash_shift^he.window[se+T-1])&he.hash_mask,he.prev[se&he.w_mask]=he.head[he.ins_h],he.head[he.ins_h]=se,se++,--oe;);he.strstart=se,he.lookahead=T-1,Y(he)}return he.strstart+=he.lookahead,he.block_start=he.strstart,he.insert=he.lookahead,he.lookahead=0,he.match_length=he.prev_length=T-1,he.match_available=0,W.next_in=de,W.input=me,W.avail_in=Me,he.wrap=le,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,x,p,g,v,y,b,N,j,_,S,P,T,R,k,E,q,O,L;l=i.state,c=i.next_in,O=i.input,u=c+(i.avail_in-5),d=i.next_out,L=i.output,f=d-(o-i.avail_out),m=d+(i.avail_out-257),h=l.dmax,x=l.wsize,p=l.whave,g=l.wnext,v=l.window,y=l.hold,b=l.bits,N=l.lencode,j=l.distcode,_=(1<<l.lenbits)-1,S=(1<<l.distbits)-1;e:do{b<15&&(y+=O[c++]<<b,b+=8,y+=O[c++]<<b,b+=8),P=N[y&_];t:for(;;){if(y>>>=T=P>>>24,b-=T,(T=P>>>16&255)===0)L[d++]=65535&P;else{if(!(16&T)){if(!(64&T)){P=N[(65535&P)+(y&(1<<T)-1)];continue t}if(32&T){l.mode=12;break e}i.msg="invalid literal/length code",l.mode=30;break e}R=65535&P,(T&=15)&&(b<T&&(y+=O[c++]<<b,b+=8),R+=y&(1<<T)-1,y>>>=T,b-=T),b<15&&(y+=O[c++]<<b,b+=8,y+=O[c++]<<b,b+=8),P=j[y&S];r:for(;;){if(y>>>=T=P>>>24,b-=T,!(16&(T=P>>>16&255))){if(!(64&T)){P=j[(65535&P)+(y&(1<<T)-1)];continue r}i.msg="invalid distance code",l.mode=30;break e}if(k=65535&P,b<(T&=15)&&(y+=O[c++]<<b,(b+=8)<T&&(y+=O[c++]<<b,b+=8)),h<(k+=y&(1<<T)-1)){i.msg="invalid distance too far back",l.mode=30;break e}if(y>>>=T,b-=T,(T=d-f)<k){if(p<(T=k-T)&&l.sane){i.msg="invalid distance too far back",l.mode=30;break e}if(q=v,(E=0)===g){if(E+=x-T,T<R){for(R-=T;L[d++]=v[E++],--T;);E=d-k,q=L}}else if(g<T){if(E+=x+g-T,(T-=g)<R){for(R-=T;L[d++]=v[E++],--T;);if(E=0,g<R){for(R-=T=g;L[d++]=v[E++],--T;);E=d-k,q=L}}}else if(E+=g-T,T<R){for(R-=T;L[d++]=v[E++],--T;);E=d-k,q=L}for(;2<R;)L[d++]=q[E++],L[d++]=q[E++],L[d++]=q[E++],R-=3;R&&(L[d++]=q[E++],1<R&&(L[d++]=q[E++]))}else{for(E=d-k;L[d++]=L[E++],L[d++]=L[E++],L[d++]=L[E++],2<(R-=3););R&&(L[d++]=L[E++],1<R&&(L[d++]=L[E++]))}break}}break}}while(c<u&&d<m);c-=R=b>>3,y&=(1<<(b-=R<<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=y,l.bits=b}},{}],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,x=1,p=852,g=592;function v(E){return(E>>>24&255)+(E>>>8&65280)+((65280&E)<<8)+((255&E)<<24)}function y(){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 b(E){var q;return E&&E.state?(q=E.state,E.total_in=E.total_out=q.total=0,E.msg="",q.wrap&&(E.adler=1&q.wrap),q.mode=x,q.last=0,q.havedict=0,q.dmax=32768,q.head=null,q.hold=0,q.bits=0,q.lencode=q.lendyn=new i.Buf32(p),q.distcode=q.distdyn=new i.Buf32(g),q.sane=1,q.back=-1,m):h}function N(E){var q;return E&&E.state?((q=E.state).wsize=0,q.whave=0,q.wnext=0,b(E)):h}function j(E,q){var O,L;return E&&E.state?(L=E.state,q<0?(O=0,q=-q):(O=1+(q>>4),q<48&&(q&=15)),q&&(q<8||15<q)?h:(L.window!==null&&L.wbits!==q&&(L.window=null),L.wrap=O,L.wbits=q,N(E))):h}function _(E,q){var O,L;return E?(L=new y,(E.state=L).window=null,(O=j(E,q))!==m&&(E.state=null),O):h}var S,P,T=!0;function R(E){if(T){var q;for(S=new i.Buf32(512),P=new i.Buf32(32),q=0;q<144;)E.lens[q++]=8;for(;q<256;)E.lens[q++]=9;for(;q<280;)E.lens[q++]=7;for(;q<288;)E.lens[q++]=8;for(u(d,E.lens,0,288,S,0,E.work,{bits:9}),q=0;q<32;)E.lens[q++]=5;u(f,E.lens,0,32,P,0,E.work,{bits:5}),T=!1}E.lencode=S,E.lenbits=9,E.distcode=P,E.distbits=5}function k(E,q,O,L){var H,V=E.state;return V.window===null&&(V.wsize=1<<V.wbits,V.wnext=0,V.whave=0,V.window=new i.Buf8(V.wsize)),L>=V.wsize?(i.arraySet(V.window,q,O-V.wsize,V.wsize,0),V.wnext=0,V.whave=V.wsize):(L<(H=V.wsize-V.wnext)&&(H=L),i.arraySet(V.window,q,O-L,H,V.wnext),(L-=H)?(i.arraySet(V.window,q,O-L,L,0),V.wnext=L,V.whave=V.wsize):(V.wnext+=H,V.wnext===V.wsize&&(V.wnext=0),V.whave<V.wsize&&(V.whave+=H))),0}a.inflateReset=N,a.inflateReset2=j,a.inflateResetKeep=b,a.inflateInit=function(E){return _(E,15)},a.inflateInit2=_,a.inflate=function(E,q){var O,L,H,V,z,M,B,K,C,A,I,U,Y,te,re,J,ie,be,Q,Ve,W,Z,he,se,oe=0,le=new i.Buf8(4),Me=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!E||!E.state||!E.output||!E.input&&E.avail_in!==0)return h;(O=E.state).mode===12&&(O.mode=13),z=E.next_out,H=E.output,B=E.avail_out,V=E.next_in,L=E.input,M=E.avail_in,K=O.hold,C=O.bits,A=M,I=B,Z=m;e:for(;;)switch(O.mode){case x:if(O.wrap===0){O.mode=13;break}for(;C<16;){if(M===0)break e;M--,K+=L[V++]<<C,C+=8}if(2&O.wrap&&K===35615){le[O.check=0]=255&K,le[1]=K>>>8&255,O.check=l(O.check,le,2,0),C=K=0,O.mode=2;break}if(O.flags=0,O.head&&(O.head.done=!1),!(1&O.wrap)||(((255&K)<<8)+(K>>8))%31){E.msg="incorrect header check",O.mode=30;break}if((15&K)!=8){E.msg="unknown compression method",O.mode=30;break}if(C-=4,W=8+(15&(K>>>=4)),O.wbits===0)O.wbits=W;else if(W>O.wbits){E.msg="invalid window size",O.mode=30;break}O.dmax=1<<W,E.adler=O.check=1,O.mode=512&K?10:12,C=K=0;break;case 2:for(;C<16;){if(M===0)break e;M--,K+=L[V++]<<C,C+=8}if(O.flags=K,(255&O.flags)!=8){E.msg="unknown compression method",O.mode=30;break}if(57344&O.flags){E.msg="unknown header flags set",O.mode=30;break}O.head&&(O.head.text=K>>8&1),512&O.flags&&(le[0]=255&K,le[1]=K>>>8&255,O.check=l(O.check,le,2,0)),C=K=0,O.mode=3;case 3:for(;C<32;){if(M===0)break e;M--,K+=L[V++]<<C,C+=8}O.head&&(O.head.time=K),512&O.flags&&(le[0]=255&K,le[1]=K>>>8&255,le[2]=K>>>16&255,le[3]=K>>>24&255,O.check=l(O.check,le,4,0)),C=K=0,O.mode=4;case 4:for(;C<16;){if(M===0)break e;M--,K+=L[V++]<<C,C+=8}O.head&&(O.head.xflags=255&K,O.head.os=K>>8),512&O.flags&&(le[0]=255&K,le[1]=K>>>8&255,O.check=l(O.check,le,2,0)),C=K=0,O.mode=5;case 5:if(1024&O.flags){for(;C<16;){if(M===0)break e;M--,K+=L[V++]<<C,C+=8}O.length=K,O.head&&(O.head.extra_len=K),512&O.flags&&(le[0]=255&K,le[1]=K>>>8&255,O.check=l(O.check,le,2,0)),C=K=0}else O.head&&(O.head.extra=null);O.mode=6;case 6:if(1024&O.flags&&(M<(U=O.length)&&(U=M),U&&(O.head&&(W=O.head.extra_len-O.length,O.head.extra||(O.head.extra=new Array(O.head.extra_len)),i.arraySet(O.head.extra,L,V,U,W)),512&O.flags&&(O.check=l(O.check,L,U,V)),M-=U,V+=U,O.length-=U),O.length))break e;O.length=0,O.mode=7;case 7:if(2048&O.flags){if(M===0)break e;for(U=0;W=L[V+U++],O.head&&W&&O.length<65536&&(O.head.name+=String.fromCharCode(W)),W&&U<M;);if(512&O.flags&&(O.check=l(O.check,L,U,V)),M-=U,V+=U,W)break e}else O.head&&(O.head.name=null);O.length=0,O.mode=8;case 8:if(4096&O.flags){if(M===0)break e;for(U=0;W=L[V+U++],O.head&&W&&O.length<65536&&(O.head.comment+=String.fromCharCode(W)),W&&U<M;);if(512&O.flags&&(O.check=l(O.check,L,U,V)),M-=U,V+=U,W)break e}else O.head&&(O.head.comment=null);O.mode=9;case 9:if(512&O.flags){for(;C<16;){if(M===0)break e;M--,K+=L[V++]<<C,C+=8}if(K!==(65535&O.check)){E.msg="header crc mismatch",O.mode=30;break}C=K=0}O.head&&(O.head.hcrc=O.flags>>9&1,O.head.done=!0),E.adler=O.check=0,O.mode=12;break;case 10:for(;C<32;){if(M===0)break e;M--,K+=L[V++]<<C,C+=8}E.adler=O.check=v(K),C=K=0,O.mode=11;case 11:if(O.havedict===0)return E.next_out=z,E.avail_out=B,E.next_in=V,E.avail_in=M,O.hold=K,O.bits=C,2;E.adler=O.check=1,O.mode=12;case 12:if(q===5||q===6)break e;case 13:if(O.last){K>>>=7&C,C-=7&C,O.mode=27;break}for(;C<3;){if(M===0)break e;M--,K+=L[V++]<<C,C+=8}switch(O.last=1&K,C-=1,3&(K>>>=1)){case 0:O.mode=14;break;case 1:if(R(O),O.mode=20,q!==6)break;K>>>=2,C-=2;break e;case 2:O.mode=17;break;case 3:E.msg="invalid block type",O.mode=30}K>>>=2,C-=2;break;case 14:for(K>>>=7&C,C-=7&C;C<32;){if(M===0)break e;M--,K+=L[V++]<<C,C+=8}if((65535&K)!=(K>>>16^65535)){E.msg="invalid stored block lengths",O.mode=30;break}if(O.length=65535&K,C=K=0,O.mode=15,q===6)break e;case 15:O.mode=16;case 16:if(U=O.length){if(M<U&&(U=M),B<U&&(U=B),U===0)break e;i.arraySet(H,L,V,U,z),M-=U,V+=U,B-=U,z+=U,O.length-=U;break}O.mode=12;break;case 17:for(;C<14;){if(M===0)break e;M--,K+=L[V++]<<C,C+=8}if(O.nlen=257+(31&K),K>>>=5,C-=5,O.ndist=1+(31&K),K>>>=5,C-=5,O.ncode=4+(15&K),K>>>=4,C-=4,286<O.nlen||30<O.ndist){E.msg="too many length or distance symbols",O.mode=30;break}O.have=0,O.mode=18;case 18:for(;O.have<O.ncode;){for(;C<3;){if(M===0)break e;M--,K+=L[V++]<<C,C+=8}O.lens[Me[O.have++]]=7&K,K>>>=3,C-=3}for(;O.have<19;)O.lens[Me[O.have++]]=0;if(O.lencode=O.lendyn,O.lenbits=7,he={bits:O.lenbits},Z=u(0,O.lens,0,19,O.lencode,0,O.work,he),O.lenbits=he.bits,Z){E.msg="invalid code lengths set",O.mode=30;break}O.have=0,O.mode=19;case 19:for(;O.have<O.nlen+O.ndist;){for(;J=(oe=O.lencode[K&(1<<O.lenbits)-1])>>>16&255,ie=65535&oe,!((re=oe>>>24)<=C);){if(M===0)break e;M--,K+=L[V++]<<C,C+=8}if(ie<16)K>>>=re,C-=re,O.lens[O.have++]=ie;else{if(ie===16){for(se=re+2;C<se;){if(M===0)break e;M--,K+=L[V++]<<C,C+=8}if(K>>>=re,C-=re,O.have===0){E.msg="invalid bit length repeat",O.mode=30;break}W=O.lens[O.have-1],U=3+(3&K),K>>>=2,C-=2}else if(ie===17){for(se=re+3;C<se;){if(M===0)break e;M--,K+=L[V++]<<C,C+=8}C-=re,W=0,U=3+(7&(K>>>=re)),K>>>=3,C-=3}else{for(se=re+7;C<se;){if(M===0)break e;M--,K+=L[V++]<<C,C+=8}C-=re,W=0,U=11+(127&(K>>>=re)),K>>>=7,C-=7}if(O.have+U>O.nlen+O.ndist){E.msg="invalid bit length repeat",O.mode=30;break}for(;U--;)O.lens[O.have++]=W}}if(O.mode===30)break;if(O.lens[256]===0){E.msg="invalid code -- missing end-of-block",O.mode=30;break}if(O.lenbits=9,he={bits:O.lenbits},Z=u(d,O.lens,0,O.nlen,O.lencode,0,O.work,he),O.lenbits=he.bits,Z){E.msg="invalid literal/lengths set",O.mode=30;break}if(O.distbits=6,O.distcode=O.distdyn,he={bits:O.distbits},Z=u(f,O.lens,O.nlen,O.ndist,O.distcode,0,O.work,he),O.distbits=he.bits,Z){E.msg="invalid distances set",O.mode=30;break}if(O.mode=20,q===6)break e;case 20:O.mode=21;case 21:if(6<=M&&258<=B){E.next_out=z,E.avail_out=B,E.next_in=V,E.avail_in=M,O.hold=K,O.bits=C,c(E,I),z=E.next_out,H=E.output,B=E.avail_out,V=E.next_in,L=E.input,M=E.avail_in,K=O.hold,C=O.bits,O.mode===12&&(O.back=-1);break}for(O.back=0;J=(oe=O.lencode[K&(1<<O.lenbits)-1])>>>16&255,ie=65535&oe,!((re=oe>>>24)<=C);){if(M===0)break e;M--,K+=L[V++]<<C,C+=8}if(J&&!(240&J)){for(be=re,Q=J,Ve=ie;J=(oe=O.lencode[Ve+((K&(1<<be+Q)-1)>>be)])>>>16&255,ie=65535&oe,!(be+(re=oe>>>24)<=C);){if(M===0)break e;M--,K+=L[V++]<<C,C+=8}K>>>=be,C-=be,O.back+=be}if(K>>>=re,C-=re,O.back+=re,O.length=ie,J===0){O.mode=26;break}if(32&J){O.back=-1,O.mode=12;break}if(64&J){E.msg="invalid literal/length code",O.mode=30;break}O.extra=15&J,O.mode=22;case 22:if(O.extra){for(se=O.extra;C<se;){if(M===0)break e;M--,K+=L[V++]<<C,C+=8}O.length+=K&(1<<O.extra)-1,K>>>=O.extra,C-=O.extra,O.back+=O.extra}O.was=O.length,O.mode=23;case 23:for(;J=(oe=O.distcode[K&(1<<O.distbits)-1])>>>16&255,ie=65535&oe,!((re=oe>>>24)<=C);){if(M===0)break e;M--,K+=L[V++]<<C,C+=8}if(!(240&J)){for(be=re,Q=J,Ve=ie;J=(oe=O.distcode[Ve+((K&(1<<be+Q)-1)>>be)])>>>16&255,ie=65535&oe,!(be+(re=oe>>>24)<=C);){if(M===0)break e;M--,K+=L[V++]<<C,C+=8}K>>>=be,C-=be,O.back+=be}if(K>>>=re,C-=re,O.back+=re,64&J){E.msg="invalid distance code",O.mode=30;break}O.offset=ie,O.extra=15&J,O.mode=24;case 24:if(O.extra){for(se=O.extra;C<se;){if(M===0)break e;M--,K+=L[V++]<<C,C+=8}O.offset+=K&(1<<O.extra)-1,K>>>=O.extra,C-=O.extra,O.back+=O.extra}if(O.offset>O.dmax){E.msg="invalid distance too far back",O.mode=30;break}O.mode=25;case 25:if(B===0)break e;if(U=I-B,O.offset>U){if((U=O.offset-U)>O.whave&&O.sane){E.msg="invalid distance too far back",O.mode=30;break}Y=U>O.wnext?(U-=O.wnext,O.wsize-U):O.wnext-U,U>O.length&&(U=O.length),te=O.window}else te=H,Y=z-O.offset,U=O.length;for(B<U&&(U=B),B-=U,O.length-=U;H[z++]=te[Y++],--U;);O.length===0&&(O.mode=21);break;case 26:if(B===0)break e;H[z++]=O.length,B--,O.mode=21;break;case 27:if(O.wrap){for(;C<32;){if(M===0)break e;M--,K|=L[V++]<<C,C+=8}if(I-=B,E.total_out+=I,O.total+=I,I&&(E.adler=O.check=O.flags?l(O.check,H,I,z-I):o(O.check,H,I,z-I)),I=B,(O.flags?K:v(K))!==O.check){E.msg="incorrect data check",O.mode=30;break}C=K=0}O.mode=28;case 28:if(O.wrap&&O.flags){for(;C<32;){if(M===0)break e;M--,K+=L[V++]<<C,C+=8}if(K!==(4294967295&O.total)){E.msg="incorrect length check",O.mode=30;break}C=K=0}O.mode=29;case 29:Z=1;break e;case 30:Z=-3;break e;case 31:return-4;case 32:default:return h}return E.next_out=z,E.avail_out=B,E.next_in=V,E.avail_in=M,O.hold=K,O.bits=C,(O.wsize||I!==E.avail_out&&O.mode<30&&(O.mode<27||q!==4))&&k(E,E.output,E.next_out,I-E.avail_out)?(O.mode=31,-4):(A-=E.avail_in,I-=E.avail_out,E.total_in+=A,E.total_out+=I,O.total+=I,O.wrap&&I&&(E.adler=O.check=O.flags?l(O.check,H,I,E.next_out-I):o(O.check,H,I,E.next_out-I)),E.data_type=O.bits+(O.last?64:0)+(O.mode===12?128:0)+(O.mode===20||O.mode===15?256:0),(A==0&&I===0||q===4)&&Z===m&&(Z=-5),Z)},a.inflateEnd=function(E){if(!E||!E.state)return h;var q=E.state;return q.window&&(q.window=null),E.state=null,m},a.inflateGetHeader=function(E,q){var O;return E&&E.state&&2&(O=E.state).wrap?((O.head=q).done=!1,m):h},a.inflateSetDictionary=function(E,q){var O,L=q.length;return E&&E.state?(O=E.state).wrap!==0&&O.mode!==11?h:O.mode===11&&o(1,q,L,0)!==O.check?-3:k(E,q,L,L)?(O.mode=31,-4):(O.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,x,p,g,v){var y,b,N,j,_,S,P,T,R,k=v.bits,E=0,q=0,O=0,L=0,H=0,V=0,z=0,M=0,B=0,K=0,C=null,A=0,I=new i.Buf16(16),U=new i.Buf16(16),Y=null,te=0;for(E=0;E<=15;E++)I[E]=0;for(q=0;q<h;q++)I[f[m+q]]++;for(H=k,L=15;1<=L&&I[L]===0;L--);if(L<H&&(H=L),L===0)return x[p++]=20971520,x[p++]=20971520,v.bits=1,0;for(O=1;O<L&&I[O]===0;O++);for(H<O&&(H=O),E=M=1;E<=15;E++)if(M<<=1,(M-=I[E])<0)return-1;if(0<M&&(d===0||L!==1))return-1;for(U[1]=0,E=1;E<15;E++)U[E+1]=U[E]+I[E];for(q=0;q<h;q++)f[m+q]!==0&&(g[U[f[m+q]]++]=q);if(S=d===0?(C=Y=g,19):d===1?(C=o,A-=257,Y=l,te-=257,256):(C=c,Y=u,-1),E=O,_=p,z=q=K=0,N=-1,j=(B=1<<(V=H))-1,d===1&&852<B||d===2&&592<B)return 1;for(;;){for(P=E-z,R=g[q]<S?(T=0,g[q]):g[q]>S?(T=Y[te+g[q]],C[A+g[q]]):(T=96,0),y=1<<E-z,O=b=1<<V;x[_+(K>>z)+(b-=y)]=P<<24|T<<16|R|0,b!==0;);for(y=1<<E-1;K&y;)y>>=1;if(y!==0?(K&=y-1,K+=y):K=0,q++,--I[E]==0){if(E===L)break;E=f[m+g[q]]}if(H<E&&(K&j)!==N){for(z===0&&(z=H),_+=O,M=1<<(V=E-z);V+z<L&&!((M-=I[V+z])<=0);)V++,M<<=1;if(B+=1<<V,d===1&&852<B||d===2&&592<B)return 1;x[N=K&j]=H<<24|V<<16|_-p|0}}return K!==0&&(x[_+K]=E-z<<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 le=oe.length;0<=--le;)oe[le]=0}var u=0,d=29,f=256,m=f+1+d,h=30,x=19,p=2*m+1,g=15,v=16,y=7,b=256,N=16,j=17,_=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],P=[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],T=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],R=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],k=new Array(2*(m+2));c(k);var E=new Array(2*h);c(E);var q=new Array(512);c(q);var O=new Array(256);c(O);var L=new Array(d);c(L);var H,V,z,M=new Array(h);function B(oe,le,Me,de,me){this.static_tree=oe,this.extra_bits=le,this.extra_base=Me,this.elems=de,this.max_length=me,this.has_stree=oe&&oe.length}function K(oe,le){this.dyn_tree=oe,this.max_code=0,this.stat_desc=le}function C(oe){return oe<256?q[oe]:q[256+(oe>>>7)]}function A(oe,le){oe.pending_buf[oe.pending++]=255&le,oe.pending_buf[oe.pending++]=le>>>8&255}function I(oe,le,Me){oe.bi_valid>v-Me?(oe.bi_buf|=le<<oe.bi_valid&65535,A(oe,oe.bi_buf),oe.bi_buf=le>>v-oe.bi_valid,oe.bi_valid+=Me-v):(oe.bi_buf|=le<<oe.bi_valid&65535,oe.bi_valid+=Me)}function U(oe,le,Me){I(oe,Me[2*le],Me[2*le+1])}function Y(oe,le){for(var Me=0;Me|=1&oe,oe>>>=1,Me<<=1,0<--le;);return Me>>>1}function te(oe,le,Me){var de,me,Le=new Array(g+1),Ke=0;for(de=1;de<=g;de++)Le[de]=Ke=Ke+Me[de-1]<<1;for(me=0;me<=le;me++){var ve=oe[2*me+1];ve!==0&&(oe[2*me]=Y(Le[ve]++,ve))}}function re(oe){var le;for(le=0;le<m;le++)oe.dyn_ltree[2*le]=0;for(le=0;le<h;le++)oe.dyn_dtree[2*le]=0;for(le=0;le<x;le++)oe.bl_tree[2*le]=0;oe.dyn_ltree[2*b]=1,oe.opt_len=oe.static_len=0,oe.last_lit=oe.matches=0}function J(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,le,Me,de){var me=2*le,Le=2*Me;return oe[me]<oe[Le]||oe[me]===oe[Le]&&de[le]<=de[Me]}function be(oe,le,Me){for(var de=oe.heap[Me],me=Me<<1;me<=oe.heap_len&&(me<oe.heap_len&&ie(le,oe.heap[me+1],oe.heap[me],oe.depth)&&me++,!ie(le,de,oe.heap[me],oe.depth));)oe.heap[Me]=oe.heap[me],Me=me,me<<=1;oe.heap[Me]=de}function Q(oe,le,Me){var de,me,Le,Ke,ve=0;if(oe.last_lit!==0)for(;de=oe.pending_buf[oe.d_buf+2*ve]<<8|oe.pending_buf[oe.d_buf+2*ve+1],me=oe.pending_buf[oe.l_buf+ve],ve++,de===0?U(oe,me,le):(U(oe,(Le=O[me])+f+1,le),(Ke=S[Le])!==0&&I(oe,me-=L[Le],Ke),U(oe,Le=C(--de),Me),(Ke=P[Le])!==0&&I(oe,de-=M[Le],Ke)),ve<oe.last_lit;);U(oe,b,le)}function Ve(oe,le){var Me,de,me,Le=le.dyn_tree,Ke=le.stat_desc.static_tree,ve=le.stat_desc.has_stree,_e=le.stat_desc.elems,Ue=-1;for(oe.heap_len=0,oe.heap_max=p,Me=0;Me<_e;Me++)Le[2*Me]!==0?(oe.heap[++oe.heap_len]=Ue=Me,oe.depth[Me]=0):Le[2*Me+1]=0;for(;oe.heap_len<2;)Le[2*(me=oe.heap[++oe.heap_len]=Ue<2?++Ue:0)]=1,oe.depth[me]=0,oe.opt_len--,ve&&(oe.static_len-=Ke[2*me+1]);for(le.max_code=Ue,Me=oe.heap_len>>1;1<=Me;Me--)be(oe,Le,Me);for(me=_e;Me=oe.heap[1],oe.heap[1]=oe.heap[oe.heap_len--],be(oe,Le,1),de=oe.heap[1],oe.heap[--oe.heap_max]=Me,oe.heap[--oe.heap_max]=de,Le[2*me]=Le[2*Me]+Le[2*de],oe.depth[me]=(oe.depth[Me]>=oe.depth[de]?oe.depth[Me]:oe.depth[de])+1,Le[2*Me+1]=Le[2*de+1]=me,oe.heap[1]=me++,be(oe,Le,1),2<=oe.heap_len;);oe.heap[--oe.heap_max]=oe.heap[1],function(Qe,st){var Fe,Ge,ht,ut,Mt,Wt,zt=st.dyn_tree,Lt=st.max_code,or=st.stat_desc.static_tree,Yt=st.stat_desc.has_stree,ot=st.stat_desc.extra_bits,fr=st.stat_desc.extra_base,Et=st.stat_desc.max_length,Ct=0;for(ut=0;ut<=g;ut++)Qe.bl_count[ut]=0;for(zt[2*Qe.heap[Qe.heap_max]+1]=0,Fe=Qe.heap_max+1;Fe<p;Fe++)Et<(ut=zt[2*zt[2*(Ge=Qe.heap[Fe])+1]+1]+1)&&(ut=Et,Ct++),zt[2*Ge+1]=ut,Lt<Ge||(Qe.bl_count[ut]++,Mt=0,fr<=Ge&&(Mt=ot[Ge-fr]),Wt=zt[2*Ge],Qe.opt_len+=Wt*(ut+Mt),Yt&&(Qe.static_len+=Wt*(or[2*Ge+1]+Mt)));if(Ct!==0){do{for(ut=Et-1;Qe.bl_count[ut]===0;)ut--;Qe.bl_count[ut]--,Qe.bl_count[ut+1]+=2,Qe.bl_count[Et]--,Ct-=2}while(0<Ct);for(ut=Et;ut!==0;ut--)for(Ge=Qe.bl_count[ut];Ge!==0;)Lt<(ht=Qe.heap[--Fe])||(zt[2*ht+1]!==ut&&(Qe.opt_len+=(ut-zt[2*ht+1])*zt[2*ht],zt[2*ht+1]=ut),Ge--)}}(oe,le),te(Le,Ue,oe.bl_count)}function W(oe,le,Me){var de,me,Le=-1,Ke=le[1],ve=0,_e=7,Ue=4;for(Ke===0&&(_e=138,Ue=3),le[2*(Me+1)+1]=65535,de=0;de<=Me;de++)me=Ke,Ke=le[2*(de+1)+1],++ve<_e&&me===Ke||(ve<Ue?oe.bl_tree[2*me]+=ve:me!==0?(me!==Le&&oe.bl_tree[2*me]++,oe.bl_tree[2*N]++):ve<=10?oe.bl_tree[2*j]++:oe.bl_tree[2*_]++,Le=me,Ue=(ve=0)===Ke?(_e=138,3):me===Ke?(_e=6,3):(_e=7,4))}function Z(oe,le,Me){var de,me,Le=-1,Ke=le[1],ve=0,_e=7,Ue=4;for(Ke===0&&(_e=138,Ue=3),de=0;de<=Me;de++)if(me=Ke,Ke=le[2*(de+1)+1],!(++ve<_e&&me===Ke)){if(ve<Ue)for(;U(oe,me,oe.bl_tree),--ve!=0;);else me!==0?(me!==Le&&(U(oe,me,oe.bl_tree),ve--),U(oe,N,oe.bl_tree),I(oe,ve-3,2)):ve<=10?(U(oe,j,oe.bl_tree),I(oe,ve-3,3)):(U(oe,_,oe.bl_tree),I(oe,ve-11,7));Le=me,Ue=(ve=0)===Ke?(_e=138,3):me===Ke?(_e=6,3):(_e=7,4)}}c(M);var he=!1;function se(oe,le,Me,de){I(oe,(u<<1)+(de?1:0),3),function(me,Le,Ke,ve){J(me),A(me,Ke),A(me,~Ke),i.arraySet(me.pending_buf,me.window,Le,Ke,me.pending),me.pending+=Ke}(oe,le,Me)}a._tr_init=function(oe){he||(function(){var le,Me,de,me,Le,Ke=new Array(g+1);for(me=de=0;me<d-1;me++)for(L[me]=de,le=0;le<1<<S[me];le++)O[de++]=me;for(O[de-1]=me,me=Le=0;me<16;me++)for(M[me]=Le,le=0;le<1<<P[me];le++)q[Le++]=me;for(Le>>=7;me<h;me++)for(M[me]=Le<<7,le=0;le<1<<P[me]-7;le++)q[256+Le++]=me;for(Me=0;Me<=g;Me++)Ke[Me]=0;for(le=0;le<=143;)k[2*le+1]=8,le++,Ke[8]++;for(;le<=255;)k[2*le+1]=9,le++,Ke[9]++;for(;le<=279;)k[2*le+1]=7,le++,Ke[7]++;for(;le<=287;)k[2*le+1]=8,le++,Ke[8]++;for(te(k,m+1,Ke),le=0;le<h;le++)E[2*le+1]=5,E[2*le]=Y(le,5);H=new B(k,S,f+1,m,g),V=new B(E,P,0,h,g),z=new B(new Array(0),T,0,x,y)}(),he=!0),oe.l_desc=new K(oe.dyn_ltree,H),oe.d_desc=new K(oe.dyn_dtree,V),oe.bl_desc=new K(oe.bl_tree,z),oe.bi_buf=0,oe.bi_valid=0,re(oe)},a._tr_stored_block=se,a._tr_flush_block=function(oe,le,Me,de){var me,Le,Ke=0;0<oe.level?(oe.strm.data_type===2&&(oe.strm.data_type=function(ve){var _e,Ue=4093624447;for(_e=0;_e<=31;_e++,Ue>>>=1)if(1&Ue&&ve.dyn_ltree[2*_e]!==0)return o;if(ve.dyn_ltree[18]!==0||ve.dyn_ltree[20]!==0||ve.dyn_ltree[26]!==0)return l;for(_e=32;_e<f;_e++)if(ve.dyn_ltree[2*_e]!==0)return l;return o}(oe)),Ve(oe,oe.l_desc),Ve(oe,oe.d_desc),Ke=function(ve){var _e;for(W(ve,ve.dyn_ltree,ve.l_desc.max_code),W(ve,ve.dyn_dtree,ve.d_desc.max_code),Ve(ve,ve.bl_desc),_e=x-1;3<=_e&&ve.bl_tree[2*R[_e]+1]===0;_e--);return ve.opt_len+=3*(_e+1)+5+5+4,_e}(oe),me=oe.opt_len+3+7>>>3,(Le=oe.static_len+3+7>>>3)<=me&&(me=Le)):me=Le=Me+5,Me+4<=me&&le!==-1?se(oe,le,Me,de):oe.strategy===4||Le===me?(I(oe,2+(de?1:0),3),Q(oe,k,E)):(I(oe,4+(de?1:0),3),function(ve,_e,Ue,Qe){var st;for(I(ve,_e-257,5),I(ve,Ue-1,5),I(ve,Qe-4,4),st=0;st<Qe;st++)I(ve,ve.bl_tree[2*R[st]+1],3);Z(ve,ve.dyn_ltree,_e-1),Z(ve,ve.dyn_dtree,Ue-1)}(oe,oe.l_desc.max_code+1,oe.d_desc.max_code+1,Ke+1),Q(oe,oe.dyn_ltree,oe.dyn_dtree)),re(oe),de&&J(oe)},a._tr_tally=function(oe,le,Me){return oe.pending_buf[oe.d_buf+2*oe.last_lit]=le>>>8&255,oe.pending_buf[oe.d_buf+2*oe.last_lit+1]=255&le,oe.pending_buf[oe.l_buf+oe.last_lit]=255&Me,oe.last_lit++,le===0?oe.dyn_ltree[2*Me]++:(oe.matches++,le--,oe.dyn_ltree[2*(O[Me]+f+1)]++,oe.dyn_dtree[2*C(le)]++),oe.last_lit===oe.lit_bufsize-1},a._tr_align=function(oe){I(oe,2,3),U(oe,b,k),function(le){le.bi_valid===16?(A(le,le.bi_buf),le.bi_buf=0,le.bi_valid=0):8<=le.bi_valid&&(le.pending_buf[le.pending++]=255&le.bi_buf,le.bi_buf>>=8,le.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={},x=!1,p=o.document,g=Object.getPrototypeOf&&Object.getPrototypeOf(o);g=g&&g.setTimeout?g:o,c={}.toString.call(o.process)==="[object process]"?function(N){process.nextTick(function(){y(N)})}:function(){if(o.postMessage&&!o.importScripts){var N=!0,j=o.onmessage;return o.onmessage=function(){N=!1},o.postMessage("","*"),o.onmessage=j,N}}()?(f="setImmediate$"+Math.random()+"$",o.addEventListener?o.addEventListener("message",b,!1):o.attachEvent("onmessage",b),function(N){o.postMessage(f+N,"*")}):o.MessageChannel?((d=new MessageChannel).port1.onmessage=function(N){y(N.data)},function(N){d.port2.postMessage(N)}):p&&"onreadystatechange"in p.createElement("script")?(u=p.documentElement,function(N){var j=p.createElement("script");j.onreadystatechange=function(){y(N),j.onreadystatechange=null,u.removeChild(j),j=null},u.appendChild(j)}):function(N){setTimeout(y,0,N)},g.setImmediate=function(N){typeof N!="function"&&(N=new Function(""+N));for(var j=new Array(arguments.length-1),_=0;_<j.length;_++)j[_]=arguments[_+1];var S={callback:N,args:j};return h[m]=S,c(m),m++},g.clearImmediate=v}function v(N){delete h[N]}function y(N){if(x)setTimeout(y,0,N);else{var j=h[N];if(j){x=!0;try{(function(_){var S=_.callback,P=_.args;switch(P.length){case 0:S();break;case 1:S(P[0]);break;case 2:S(P[0],P[1]);break;case 3:S(P[0],P[1],P[2]);break;default:S.apply(l,P)}})(j)}finally{v(N),x=!1}}}}function b(N){N.source===o&&typeof N.data=="string"&&N.data.indexOf(f)===0&&y(+N.data.slice(f.length))}})(typeof self>"u"?i===void 0?this:i:self)}).call(this,typeof zc<"u"?zc:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(uoe);var zDe=uoe.exports;const qDe=Sn(zDe);function fv(e){return e.trim().replace(/\s+/g,"_").replace(/[^a-zA-Z0-9._-]/g,"-").replace(/-+/g,"-").replace(/^[-_.]+|[-_.]+$/g,"").slice(0,120)}function doe(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 vq(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 v8(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 foe(e){const t=new qDe;for(const n of e.files)t.file(n.pathInZip,n.content);const r=await t.generateAsync({type:"blob"});doe(r,`${e.zipBaseName}.zip`)}const tm=e=>e.cv_url||e.cv_path?"hascv":e.bio&&e.bio.trim()!==""||e.specialties&&e.specialties.length>0?"started":"empty",ax={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."}},b5=e=>/\+test/i.test(e)||/@(test|example)\./i.test(e),yq=e=>!e.photo_url&&!!e.email&&!b5(e.email)&&(e.status==="approved"||!!e.cv_url||!!e.cv_path);function UDe(){const e=Zt(),{isAdmin:t,loading:r}=Br(),[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,x]=w.useState(null),[p,g]=w.useState(!1),[v,y]=w.useState(null),[b,N]=w.useState(null);w.useEffect(()=>{!r&&!t&&e("/auth")},[t,r,e]),w.useEffect(()=>{t&&j()},[t]);const j=async()=>{try{const{data:I,error:U}=await ce.from("trainer_profiles").select("*").order("created_at",{ascending:!1});if(U)throw U;const Y=await Promise.all((I||[]).map(async te=>{const{data:re}=await ce.from("trainer_contracts").select("status, signed_at, created_at").eq("trainer_id",te.id).maybeSingle();return{...te,contract:re}}));o(Y)}catch(I){console.error("Error loading trainers:",I),ae.error("Erreur lors du chargement des formateurs")}finally{a(!1)}},_=async I=>{try{const U=I.pending_cv_path?{cv_path:I.pending_cv_path,cv_url:null}:{cv_url:I.pending_cv_url},{error:Y}=await ce.from("trainer_profiles").update({...U,pending_cv_url:null,pending_cv_path:null,pending_cv_filename:null,cv_analyzed:!1}).eq("id",I.id);if(Y)throw Y;ae.success("Nouveau CV approuvé et activé !"),j()}catch(U){console.error("Error approving CV change:",U),ae.error("Erreur lors de l'approbation du CV")}},S=async I=>{try{const{error:U}=await ce.from("trainer_profiles").update({pending_cv_url:null,pending_cv_path:null,pending_cv_filename:null}).eq("id",I);if(U)throw U;ae.success("Changement de CV rejeté"),j()}catch(U){console.error("Error rejecting CV change:",U),ae.error("Erreur lors du rejet du changement")}},P=async I=>{N(I.id);try{const{data:U,error:Y}=await ce.functions.invoke("remove-trainer",{body:{trainer_id:I.id}});if(Y||U!=null&&U.error)throw new Error((U==null?void 0:U.error)||(Y==null?void 0:Y.message));const te=U.removal==="deleted"?"profil supprimé":"profil désactivé (factures liées)",re=U.farewell_sent?"email d'adieu envoyé":"email d'adieu NON envoyé";ae.success(`${I.name} retiré : ${te}, blacklisté, ${re}.`),j()}catch(U){console.error("Error removing trainer:",U),ae.error(`Erreur lors de la suppression : ${U instanceof Error?U.message:"inconnue"}`)}finally{N(null)}},T=async(I,U)=>{var Y,te;try{const re={status:U};U==="approved"&&(re.is_visible=!0);const{error:J}=await ce.from("trainer_profiles").update(re).eq("id",I);if(J)throw J;if(U==="approved"){const ie=i.find(be=>be.id===I);if((ie!=null&&ie.cv_url||ie!=null&&ie.cv_path)&&!ie.cv_analyzed){ae.info("Analyse automatique du CV en cours...");try{const be=await y5(ie),{data:Q,error:Ve}=await ce.functions.invoke("analyze-cv",{body:{cvUrl:be}});if(Ve)throw Ve;if(Q!=null&&Q.specialties&&Q.specialties.length>0){const{error:W}=await ce.from("trainer_profiles").update({specialties:Q.specialties,cv_analyzed:!0}).eq("id",I);if(W)throw W;ae.success(`Formateur approuvé et ${Q.specialties.length} compétences extraites automatiquement !`)}else await ce.from("trainer_profiles").update({cv_analyzed:!0}).eq("id",I),ae.success("Formateur approuvé avec succès")}catch(be){console.error("Error analyzing CV:",be),await ce.from("trainer_profiles").update({cv_analyzed:!0}).eq("id",I),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:be,error:Q}=await ce.functions.invoke("create-trainer-contract",{body:{trainerId:I}});if(Q)throw Q;ae.success("Contrat généré automatiquement ! Le formateur peut maintenant le signer.")}catch(be){console.error("Error creating contract:",be),ae.warning("Le formateur est approuvé mais la génération du contrat a échoué. Réessayez plus tard.")}try{const{data:be,error:Q}=await ce.functions.invoke("certiskool-sync",{body:{trainerId:I,sendInvite:!0}});if(Q)throw Q;(te=(Y=be==null?void 0:be.results)==null?void 0:Y[0])!=null&&te.success&&ae.success("Formateur inscrit dans CertiSkool (invitation envoyée)")}catch(be){console.error("Error syncing CertiSkool:",be),ae.warning("Inscription CertiSkool échouée — relançable depuis la fiche Documents.")}}else ae.success("Formateur rejeté");j()}catch(re){console.error("Error updating trainer status:",re),ae.error("Erreur lors de la mise à jour")}},R=I=>I.split(" ").map(U=>U[0]).join("").toUpperCase().slice(0,2),k=async(I,U)=>{d(`${I}-${U}`);try{const{error:Y}=await ce.functions.invoke("send-trainer-reminder",{body:{trainerId:I,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)}},E=async I=>{m(I.id);try{const{error:U}=await ce.functions.invoke("send-trainer-reminder",{body:{trainerId:I.id,type:"complete_profile",cohort:tm(I)}});if(U)throw U;ae.success(`Email de relance envoyé à ${I.name}`)}catch(U){console.error("Error sending re-activation email:",U),ae.error(U.message||"Erreur lors de l'envoi")}finally{m(null)}},q=async I=>{const U=i.filter(re=>re.status==="pending"&&tm(re)===I&&re.email&&!b5(re.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;x(I);let Y=0,te=0;for(const re of U){try{const{error:J}=await ce.functions.invoke("send-trainer-reminder",{body:{trainerId:re.id,type:"complete_profile",cohort:I}});if(J)throw J;Y++}catch(J){console.error(`relance failed for ${re.email}`,J),te++}await new Promise(J=>setTimeout(J,400))}x(null),ae.success(`Relance terminée : ${Y} envoyé(s)${te?`, ${te} échec(s)`:""}`)},O=async()=>{const I=i.filter(yq);if(I.length===0){ae.info("Aucun formateur sans photo à relancer");return}if(!window.confirm(`Envoyer une demande de photo de profil à ${I.length} formateur(s) ?`))return;g(!0);let U=0,Y=0;for(const te of I){try{const{error:re}=await ce.functions.invoke("send-trainer-reminder",{body:{trainerId:te.id,type:"photo"}});if(re)throw re;U++}catch(re){console.error(`photo relance failed for ${te.email}`,re),Y++}await new Promise(re=>setTimeout(re,400))}g(!1),ae.success(`Relance photo terminée : ${U} envoyé(s)${Y?`, ${Y} échec(s)`:""}`)},L=async I=>{const U=await y5(I);U?window.open(U,"_blank","noopener,noreferrer"):ae.error("CV indisponible")},H=async I=>{var U,Y;y(I.id);try{const{data:te,error:re}=await ce.from("trainer_documents").select("document_name, document_type, document_url, document_path, status, created_at, updated_at").eq("trainer_profile_id",I.id).order("created_at",{ascending:!0});if(re)throw re;const J=fv(I.name||"formateur"),ie=new Date().toISOString().slice(0,10),be=`formateur_${J}_${ie}`,Q=[["id",I.id],["user_id",I.user_id],["name",I.name],["email",I.email],["status",I.status],["created_at",I.created_at],["is_visible",String(I.is_visible)],["manual_certified",String(!!I.manual_certified)],["view_count",String(I.view_count)],["country",I.country??""],["phone",I.phone??""],["english_level",I.english_level??""],["linkedin_url",I.linkedin_url??""],["website_url",I.website_url??""],["preferred_modality",I.preferred_modality??""],["preferred_departments",((U=I.preferred_departments)==null?void 0:U.join("; "))??""],["specialties",((Y=I.specialties)==null?void 0:Y.join("; "))??""],["bio",I.bio??""],["legal_form",I.legal_form??""],["capital_amount",I.capital_amount!=null?String(I.capital_amount):""],["headquarters_address",I.headquarters_address??""],["legal_representative_name",I.legal_representative_name??""],["legal_representative_function",I.legal_representative_function??""],["siret",I.siret??""],["activity_declaration_number",I.activity_declaration_number??""],["cv_url",I.cv_url??""],["pending_cv_url",I.pending_cv_url??""],["pending_cv_filename",I.pending_cv_filename??""]],Ve=["\uFEFF"+vq(["field","value"],Q.map(le=>[le[0],le[1]]))].join(""),W="\uFEFF"+vq(["document_type","document_name","status","document_url","created_at","updated_at"],(te??[]).map(le=>[le.document_type,le.document_name,le.status,le.document_url??le.document_path??"",le.created_at,le.updated_at])),Z=[{pathInZip:"profile.csv",content:Ve},{pathInZip:"documents.csv",content:W}],he=[],se=(le,Me="pdf")=>{try{const me=new URL(le).pathname.split("/").pop()||"",Ke=((me.includes(".")?me.split(".").pop():"")||"").toLowerCase().replace(/[^a-z0-9]/g,"");return Ke||Me}catch{return Me}},oe=async(le,Me)=>{try{const{blob:de}=await v8(le);Z.push({pathInZip:Me,content:de})}catch(de){he.push(`${Me} => ${le} (${(de==null?void 0:de.message)??"download failed"})`)}};if(I.cv_url||I.cv_path){const le=await y5(I);le&&await oe(le,`cv/cv_${J}.${se(I.cv_path||I.cv_url||le)}`)}if(I.pending_cv_url||I.pending_cv_path){const le=await Kx({document_path:I.pending_cv_path,document_url:I.pending_cv_url}),Me=fv(I.pending_cv_filename||`pending_cv_${J}.${se(I.pending_cv_path||I.pending_cv_url||"")}`);le&&await oe(le,`cv/${Me}`)}await Promise.all((te??[]).map(async(le,Me)=>{const de=fv(le.document_name||`${le.document_type}_${Me+1}`)||`${le.document_type}_${Me+1}`,me=`documents/${fv(le.document_type)||"document"}/${de}`,Le=await Kx({document_path:le.document_path,document_url:le.document_url});Le?await oe(Le,me):he.push(`${me} => fichier introuvable (accès refusé ou lien expiré)`)})),he.length&&Z.push({pathInZip:"_errors.txt",content:he.join(`
`)}),await foe({zipBaseName:be,files:Z}),ae.success("Export ZIP + CSV généré")}catch(te){console.error("Export trainer failed:",te),ae.error("Erreur lors de l'export")}finally{y(null)}},V=i.filter(I=>I.status==="pending"),z=i.filter(I=>I.status==="approved"),M=i.filter(I=>I.status==="rejected"),B=I=>V.filter(U=>tm(U)===I).length,K=I=>V.filter(U=>tm(U)===I&&U.email&&!b5(U.email)),C=i.filter(yq);if(r||n)return s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:s.jsx(it,{className:"h-8 w-8 animate-spin text-primary"})});const A=({trainer:I})=>s.jsx(je,{className:"hover:shadow-lg transition-all",children:s.jsx(Ee,{className:"p-6",children:s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsxs(bs,{className:"w-16 h-16",children:[I.photo_url?s.jsx(ji,{src:I.photo_url,alt:I.name}):null,s.jsx(ws,{className:"text-lg font-bold bg-primary text-primary-foreground",children:R(I.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:I.name}),s.jsx(u_,{source:"platform"}),s.jsx(vie,{country:I.country})]}),s.jsxs("div",{className:"flex items-center gap-3 text-sm text-muted-foreground mb-2",children:[s.jsxs("a",{href:`mailto:${I.email}`,className:"hover:text-primary transition-colors flex items-center gap-1",children:[s.jsx(_n,{className:"w-3 h-3"}),I.email]}),s.jsx("span",{className:"text-muted-foreground/50",children:"•"}),s.jsxs("span",{className:"text-xs",children:["Inscrit le ",new Date(I.created_at).toLocaleDateString("fr-FR",{day:"numeric",month:"short",year:"numeric"})," à ",new Date(I.created_at).toLocaleTimeString("fr-FR",{hour:"2-digit",minute:"2-digit"})]})]}),s.jsxs(qn,{children:[s.jsx(Xo,{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(es,{className:"w-3 h-3"})]})}),s.jsxs($n,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[s.jsx(Un,{children:s.jsxs(Vn,{className:"flex items-center gap-3",children:[s.jsxs(bs,{className:"w-10 h-10",children:[I.photo_url?s.jsx(ji,{src:I.photo_url,alt:I.name}):null,s.jsx(ws,{className:"bg-primary text-primary-foreground",children:R(I.name)})]}),I.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(Ko,{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:I.email})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-muted-foreground",children:"Statut :"}),s.jsx("p",{className:"font-medium",children:I.status==="approved"?"Approuvé":I.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:I.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:I.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(I.created_at).toLocaleDateString("fr-FR",{day:"numeric",month:"long",year:"numeric"})," à ",new Date(I.created_at).toLocaleTimeString("fr-FR",{hour:"2-digit",minute:"2-digit"})]})]})]})]}),s.jsx(Mu,{}),I.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:I.bio})]}),s.jsx(Mu,{})]}),s.jsxs("div",{children:[s.jsxs("h4",{className:"font-semibold text-sm text-muted-foreground mb-3",children:["Compétences (",I.specialties.length,")"]}),s.jsx("div",{className:"flex flex-wrap gap-2",children:I.specialties.length>0?I.specialties.map((U,Y)=>s.jsx(Te,{variant:"outline",children:U},Y)):s.jsx("span",{className:"text-sm text-muted-foreground italic",children:"Aucune compétence renseignée"})})]}),s.jsx(Mu,{}),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(Is,{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:I.preferred_modality==="presentiel"?"Présentiel":I.preferred_modality==="distanciel"?"Distanciel":I.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:I.preferred_departments&&I.preferred_departments.length>0?I.preferred_departments.join(", "):"France entière"})]})]})]}),s.jsx(Mu,{}),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(yr,{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:I.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:I.capital_amount?`${I.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:I.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:I.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:I.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:I.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:I.activity_declaration_number||s.jsx("span",{className:"text-muted-foreground italic font-sans",children:"Non renseigné"})})]})]})]}),s.jsx(Mu,{}),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(sp,{className:"w-4 h-4"}),"Documents"]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[I.cv_url||I.cv_path?s.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>L(I),children:[s.jsx(Kt,{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(Te,{variant:I.cv_analyzed?"default":"secondary",children:I.cv_analyzed?"CV analysé":"CV non analysé"})]}),s.jsx("div",{className:"mt-3",children:s.jsx(b0,{query:I.name,title:"Documents liés (Drive PedagoBridge)",defaultOpen:!0})})]})]})]})]})]}),s.jsxs("div",{className:"flex flex-col items-end gap-1",children:[s.jsx(Te,{variant:I.status==="approved"?"default":I.status==="pending"?"secondary":"destructive",children:I.status==="approved"?"Approuvé":I.status==="pending"?"En attente":"Rejeté"}),I.status==="pending"&&s.jsx(Te,{variant:"outline",className:`text-xs ${ax[tm(I)].className}`,title:ax[tm(I)].hint,children:ax[tm(I)].label}),I.status==="pending"&&b5(I.email)&&s.jsx(Te,{variant:"outline",className:"text-xs bg-red-100 text-red-700 border-red-300",children:"⚠ test/fake"}),!I.photo_url&&s.jsxs(Te,{variant:"outline",className:`text-xs ${I.status==="approved"?"bg-amber-100 text-amber-800 border-amber-300":"bg-sky-100 text-sky-700 border-sky-300"}`,title:I.status==="approved"?"Sans photo : ce formateur approuvé est MASQUÉ de la page publique des formateurs tant qu'il n'a pas de photo de profil.":"Ce formateur n'a pas encore de photo de profil",children:[s.jsx(i6,{className:"w-3 h-3 mr-1"}),I.status==="approved"?"Sans photo · masqué du public":"Sans photo"]})]})]}),I.bio&&s.jsx("p",{className:"text-sm text-muted-foreground mb-3 line-clamp-2",children:I.bio}),s.jsx("div",{className:"flex flex-wrap gap-2 mb-4",children:I.specialties.map((U,Y)=>s.jsx(Te,{variant:"outline",className:"text-xs",children:U},Y))}),I.status==="approved"&&s.jsxs(nt,{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(o6,{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 :"," ",I.contract?I.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(I.contract.signed_at).toLocaleDateString("fr-FR")]}):s.jsx("span",{className:"text-amber-600",children:"Non généré"})]}),s.jsx(Te,{variant:"outline",className:"text-xs bg-muted",children:"Optionnel"}),s.jsx(Kn,{className:"w-3 h-3 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"})]}),I.contract&&I.contract.status==="pending"&&s.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Créé le ",new Date(I.contract.created_at).toLocaleDateString("fr-FR")]})]}),s.jsx(Te,{variant:I.contract?I.contract.status==="pending"?"outline":"default":"secondary",className:I.contract?I.contract.status==="pending"?"border-blue-300 text-blue-700":"bg-green-100 text-green-700":"bg-amber-100 text-amber-700",children:I.contract?I.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']})]}),(I.pending_cv_url||I.pending_cv_path)&&I.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:async()=>{const U=await Kx({document_path:I.pending_cv_path,document_url:I.pending_cv_url});U?window.open(U,"_blank","noopener,noreferrer"):ae.error("CV indisponible")},variant:"outline",children:[s.jsx(Kt,{className:"w-4 h-4 mr-2"}),"Voir le nouveau CV"]}),s.jsxs(ne,{size:"sm",onClick:()=>_(I),className:"bg-green-600 hover:bg-green-700",children:[s.jsx(Zn,{className:"w-4 h-4 mr-2"}),"Approuver"]}),s.jsxs(ne,{size:"sm",variant:"destructive",onClick:()=>S(I.id),children:[s.jsx(vs,{className:"w-4 h-4 mr-2"}),"Rejeter"]})]})]}),s.jsxs("div",{className:"flex gap-2 flex-wrap",children:[(I.cv_url||I.cv_path)&&s.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>L(I),children:[s.jsx(Kt,{className:"w-4 h-4 mr-2"}),"Voir le CV actuel"]}),s.jsx(K8e,{trainerId:I.id,trainerName:I.name}),s.jsx(X8e,{subjectType:"trainer",subjectId:I.id,subjectName:I.name}),s.jsx(Q8e,{trainerId:I.id,trainerUserId:I.user_id,trainerName:I.name,trainerEmail:I.email}),s.jsx(BDe,{trainer:I,onUpdate:j}),s.jsxs(ne,{size:"sm",variant:"outline",onClick:()=>H(I),disabled:v===I.id,children:[v===I.id?s.jsx(it,{className:"w-4 h-4 mr-2 animate-spin"}):s.jsx(ro,{className:"w-4 h-4 mr-2"}),"Export (ZIP + CSV)"]}),I.status==="pending"&&s.jsxs(s.Fragment,{children:[s.jsxs(ne,{size:"sm",onClick:()=>T(I.id,"approved"),className:"bg-green-600 hover:bg-green-700",children:[s.jsx(Zn,{className:"w-4 h-4 mr-2"}),"Approuver"]}),tm(I)!=="hascv"&&s.jsxs(ne,{size:"sm",variant:"outline",onClick:()=>E(I),disabled:f===I.id,children:[f===I.id?s.jsx(it,{className:"w-4 h-4 mr-2 animate-spin"}):s.jsx(Js,{className:"w-4 h-4 mr-2"}),"Relancer (compléter)"]}),s.jsxs(ne,{size:"sm",variant:"destructive",onClick:()=>T(I.id,"rejected"),children:[s.jsx(vs,{className:"w-4 h-4 mr-2"}),"Rejeter"]})]}),I.status==="rejected"&&s.jsxs(ne,{size:"sm",onClick:()=>T(I.id,"approved"),children:[s.jsx(Zn,{className:"w-4 h-4 mr-2"}),"Approuver"]}),I.status==="approved"&&s.jsxs(s.Fragment,{children:[s.jsx(ne,{size:"sm",variant:"outline",onClick:()=>T(I.id,"pending"),children:"Mettre en attente"}),(!I.contract||I.contract.status==="pending")&&s.jsxs(ne,{size:"sm",variant:"outline",onClick:()=>k(I.id,"contract"),disabled:u===`${I.id}-contract`,children:[u===`${I.id}-contract`?s.jsx(it,{className:"w-4 h-4 mr-2 animate-spin"}):s.jsx(o6,{className:"w-4 h-4 mr-2"}),"Demander signature"]}),!I.photo_url&&s.jsxs(ne,{size:"sm",variant:"outline",onClick:()=>k(I.id,"photo"),disabled:u===`${I.id}-photo`,children:[u===`${I.id}-photo`?s.jsx(it,{className:"w-4 h-4 mr-2 animate-spin"}):s.jsx(i6,{className:"w-4 h-4 mr-2"}),"Demander une photo"]}),!I.is_visible&&s.jsxs(ne,{size:"sm",variant:"outline",onClick:()=>k(I.id,"visibility"),disabled:u===`${I.id}-visibility`,children:[u===`${I.id}-visibility`?s.jsx(it,{className:"w-4 h-4 mr-2 animate-spin"}):s.jsx(es,{className:"w-4 h-4 mr-2"}),"Demander visibilité"]})]}),s.jsxs(Gu,{children:[s.jsx(th,{asChild:!0,children:s.jsxs(ne,{size:"sm",variant:"destructive",disabled:b===I.id,children:[b===I.id?s.jsx(it,{className:"w-4 h-4 mr-2 animate-spin"}):s.jsx(ri,{className:"w-4 h-4 mr-2"}),"Supprimer"]})}),s.jsxs(Kc,{children:[s.jsxs(Xc,{children:[s.jsxs(Zc,{children:["Supprimer ",I.name," ?"]}),s.jsxs(Jc,{children:["Cette action : envoie un dernier email l'informant de son retrait de la plateforme, ",s.jsx("strong",{children:"blackliste son adresse"})," (",I.email,") — il ne recevra plus jamais d'email de notre part — puis supprime son profil et son compte. Irréversible."]})]}),s.jsxs(Yc,{children:[s.jsx(Ku,{children:"Annuler"}),s.jsx(Qc,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>P(I),children:"Supprimer définitivement"})]})]})]})]})]})]})})},I.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(ta,{items:[{label:"Formateurs"}]}),s.jsxs(je,{children:[s.jsx(mt,{children:s.jsx(gt,{className:"text-3xl",children:"Gestion des Formateurs"})}),s.jsx(Ee,{children:s.jsxs(uf,{value:l,onValueChange:c,children:[s.jsxs(fd,{className:"grid w-full grid-cols-4 mb-6",children:[s.jsxs(Mn,{value:"pending",children:["En attente (",V.length,")"]}),s.jsxs(Mn,{value:"approved",children:["Approuvés (",z.length,")"]}),s.jsxs(Mn,{value:"rejected",children:["Rejetés (",M.length,")"]}),s.jsxs(Mn,{value:"blacklist",children:[s.jsx(s6,{className:"w-4 h-4 mr-2"}),"Blacklist email"]})]}),s.jsxs(Os,{value:"pending",className:"space-y-4",children:[(V.length>0||C.length>0)&&s.jsx(je,{className:"border-primary/20 bg-primary/5",children:s.jsxs(Ee,{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(Te,{variant:"outline",className:`text-xs mb-2 ${ax.hascv.className}`,children:ax.hascv.label}),s.jsx("div",{className:"text-2xl font-bold",children:B("hascv")}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"À approuver individuellement ci-dessous."})]}),["started","empty"].map(I=>s.jsxs("div",{className:"rounded-lg border bg-background p-3",children:[s.jsx(Te,{variant:"outline",className:`text-xs mb-2 ${ax[I].className}`,children:ax[I].label}),s.jsx("div",{className:"text-2xl font-bold",children:K(I).length}),s.jsxs(ne,{size:"sm",className:"mt-2 w-full",onClick:()=>q(I),disabled:h!==null||K(I).length===0,children:[h===I?s.jsx(it,{className:"w-4 h-4 mr-2 animate-spin"}):s.jsx(Js,{className:"w-4 h-4 mr-2"}),"Relancer ces ",K(I).length]})]},I)),s.jsxs("div",{className:"rounded-lg border bg-background p-3",children:[s.jsx(Te,{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:C.length}),s.jsxs(ne,{size:"sm",className:"mt-2 w-full",onClick:O,disabled:p||C.length===0,children:[p?s.jsx(it,{className:"w-4 h-4 mr-2 animate-spin"}):s.jsx(Js,{className:"w-4 h-4 mr-2"}),"Demander une photo"]})]})]})]})}),V.length===0?s.jsx("p",{className:"text-center text-muted-foreground py-8",children:"Aucun formateur en attente"}):V.map(I=>s.jsx(A,{trainer:I},I.id))]}),s.jsx(Os,{value:"approved",className:"space-y-4",children:z.length===0?s.jsx("p",{className:"text-center text-muted-foreground py-8",children:"Aucun formateur approuvé"}):z.map(I=>s.jsx(A,{trainer:I},I.id))}),s.jsx(Os,{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(I=>s.jsx(A,{trainer:I},I.id))}),s.jsx(Os,{value:"blacklist",children:s.jsx(B8e,{})})]})})]})]})})}var Fr=function(){return Fr=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},Fr.apply(this,arguments)};function VDe(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 hoe(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 d_(e){return e.mode==="multiple"}function f_(e){return e.mode==="range"}function mE(e){return e.mode==="single"}var HDe={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 WDe(e,t){return Dt(e,"LLLL y",t)}function GDe(e,t){return Dt(e,"d",t)}function KDe(e,t){return Dt(e,"LLLL",t)}function XDe(e){return"".concat(e)}function YDe(e,t){return Dt(e,"cccccc",t)}function ZDe(e,t){return Dt(e,"yyyy",t)}var JDe=Object.freeze({__proto__:null,formatCaption:WDe,formatDay:GDe,formatMonthCaption:KDe,formatWeekNumber:XDe,formatWeekdayName:YDe,formatYearCaption:ZDe}),QDe=function(e,t,r){return Dt(e,"do MMMM (EEEE)",r)},eIe=function(){return"Month: "},tIe=function(){return"Go to next month"},rIe=function(){return"Go to previous month"},nIe=function(e,t){return Dt(e,"cccc",t)},sIe=function(e){return"Week n. ".concat(e)},aIe=function(){return"Year: "},iIe=Object.freeze({__proto__:null,labelDay:QDe,labelMonthDropdown:eIe,labelNext:tIe,labelPrevious:rIe,labelWeekNumber:sIe,labelWeekday:nIe,labelYearDropdown:aIe});function oIe(){var e="buttons",t=HDe,r=$L,n={},a={},i=1,o={},l=new Date;return{captionLayout:e,classNames:t,formatters:JDe,labels:iIe,locale:r,modifiersClassNames:n,modifiers:a,numberOfMonths:i,styles:o,today:l,mode:"default"}}function lIe(e){var t=e.fromYear,r=e.toYear,n=e.fromMonth,a=e.toMonth,i=e.fromDate,o=e.toDate;return n?i=_o(n):t&&(i=new Date(t,0,1)),a?o=l_(a):r&&(o=new Date(r,11,31)),{fromDate:i?x0(i):void 0,toDate:o?x0(o):void 0}}var moe=w.createContext(void 0);function cIe(e){var t,r=e.initialProps,n=oIe(),a=lIe(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;(mE(r)||d_(r)||f_(r))&&(c=r.onSelect);var u=Fr(Fr(Fr({},n),r),{captionLayout:l,classNames:Fr(Fr({},n.classNames),r.classNames),components:Fr({},r.components),formatters:Fr(Fr({},n.formatters),r.formatters),fromDate:i,labels:Fr(Fr({},n.labels),r.labels),mode:r.mode||n.mode,modifiers:Fr(Fr({},n.modifiers),r.modifiers),modifiersClassNames:Fr(Fr({},n.modifiersClassNames),r.modifiersClassNames),onSelect:c,styles:Fr(Fr({},n.styles),r.styles),toDate:o});return s.jsx(moe.Provider,{value:u,children:e.children})}function Ls(){var e=w.useContext(moe);if(!e)throw new Error("useDayPicker must be used within a DayPickerProvider.");return e}function poe(e){var t=Ls(),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 uIe(e){return s.jsx("svg",Fr({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 xoe(e){var t,r,n=e.onChange,a=e.value,i=e.children,o=e.caption,l=e.className,c=e.style,u=Ls(),d=(r=(t=u.components)===null||t===void 0?void 0:t.IconDropdown)!==null&&r!==void 0?r:uIe;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 dIe(e){var t,r=Ls(),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(mCe(n,a))for(var m=_o(n),h=n.getMonth();h<=a.getMonth();h++)f.push(hT(m,h));else for(var m=_o(new Date),h=0;h<=11;h++)f.push(hT(m,h));var x=function(g){var v=Number(g.target.value),y=hT(_o(e.displayMonth),v);e.onChange(y)},p=(t=u==null?void 0:u.Dropdown)!==null&&t!==void 0?t:xoe;return s.jsx(p,{name:"months","aria-label":d(),className:c.dropdown_month,style:i.dropdown_month,onChange:x,value:e.displayMonth.getMonth(),caption:l(e.displayMonth,{locale:o}),children:f.map(function(g){return s.jsx("option",{value:g.getMonth(),children:l(g,{locale:o})},g.getMonth())})})}function fIe(e){var t,r=e.displayMonth,n=Ls(),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(),x=i.getFullYear(),p=h;p<=x;p++)m.push(Ez(Yne(new Date),p));var g=function(y){var b=Ez(_o(r),Number(y.target.value));e.onChange(b)},v=(t=u==null?void 0:u.Dropdown)!==null&&t!==void 0?t:xoe;return s.jsx(v,{name:"years","aria-label":f(),className:c.dropdown_year,style:l.dropdown_year,onChange:g,value:r.getFullYear(),caption:d(r,{locale:o}),children:m.map(function(y){return s.jsx("option",{value:y.getFullYear(),children:d(y,{locale:o})},y.getFullYear())})})}function hIe(e,t){var r=w.useState(e),n=r[0],a=r[1],i=t===void 0?n:t;return[i,a]}function mIe(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&&yy(i,a)<0){var u=-1*(c-1);a=cc(i,u)}return o&&yy(a,o)<0&&(a=o),_o(a)}function pIe(){var e=Ls(),t=mIe(e),r=hIe(t,e.month),n=r[0],a=r[1],i=function(o){var l;if(!e.disableNavigation){var c=_o(o);a(c),(l=e.onMonthChange)===null||l===void 0||l.call(e,c)}};return[n,i]}function xIe(e,t){for(var r=t.reverseMonths,n=t.numberOfMonths,a=_o(e),i=_o(cc(a,n)),o=yy(i,a),l=[],c=0;c<o;c++){var u=cc(a,c);l.push(u)}return r&&(l=l.reverse()),l}function gIe(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=_o(e);if(!r)return cc(l,o);var c=yy(r,e);if(!(c<i))return cc(l,o)}}function vIe(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=_o(e);if(!r)return cc(l,-o);var c=yy(l,r);if(!(c<=0))return cc(l,-o)}}var goe=w.createContext(void 0);function yIe(e){var t=Ls(),r=pIe(),n=r[0],a=r[1],i=xIe(n,t),o=gIe(n,t),l=vIe(n,t),c=function(f){return i.some(function(m){return JC(f,m)})},u=function(f,m){c(f)||(m&&nse(f,m)?a(cc(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(goe.Provider,{value:d,children:e.children})}function h_(){var e=w.useContext(goe);if(!e)throw new Error("useNavigation must be used within a NavigationProvider");return e}function bq(e){var t,r=Ls(),n=r.classNames,a=r.styles,i=r.components,o=h_().goToMonth,l=function(d){o(cc(d,e.displayIndex?-e.displayIndex:0))},c=(t=i==null?void 0:i.CaptionLabel)!==null&&t!==void 0?t:poe,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(dIe,{onChange:l,displayMonth:e.displayMonth}),s.jsx(fIe,{onChange:l,displayMonth:e.displayMonth})]})}function bIe(e){return s.jsx("svg",Fr({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 wIe(e){return s.jsx("svg",Fr({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 _4=w.forwardRef(function(e,t){var r=Ls(),n=r.classNames,a=r.styles,i=[n.button_reset,n.button];e.className&&i.push(e.className);var o=i.join(" "),l=Fr(Fr({},a.button_reset),a.button);return e.style&&Object.assign(l,e.style),s.jsx("button",Fr({},e,{ref:t,type:"button",className:o,style:l}))});function jIe(e){var t,r,n=Ls(),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(" "),x=d(e.nextMonth,{locale:i}),p=[o.nav_button,o.nav_button_next].join(" "),g=(t=f==null?void 0:f.IconRight)!==null&&t!==void 0?t:wIe,v=(r=f==null?void 0:f.IconLeft)!==null&&r!==void 0?r:bIe;return s.jsxs("div",{className:o.nav,style:l.nav,children:[!e.hidePrevious&&s.jsx(_4,{name:"previous-month","aria-label":m,className:h,style:l.nav_button_previous,disabled:!e.previousMonth,onClick:e.onPreviousClick,children:a==="rtl"?s.jsx(g,{className:o.nav_icon,style:l.nav_icon}):s.jsx(v,{className:o.nav_icon,style:l.nav_icon})}),!e.hideNext&&s.jsx(_4,{name:"next-month","aria-label":x,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(g,{className:o.nav_icon,style:l.nav_icon})})]})}function wq(e){var t=Ls().numberOfMonths,r=h_(),n=r.previousMonth,a=r.nextMonth,i=r.goToMonth,o=r.displayMonths,l=o.findIndex(function(x){return JC(e.displayMonth,x)}),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(jIe,{displayMonth:e.displayMonth,hideNext:d,hidePrevious:f,nextMonth:a,previousMonth:n,onPreviousClick:m,onNextClick:h})}function _Ie(e){var t,r=Ls(),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:poe,u;return a?u=s.jsx(c,{id:e.id,displayMonth:e.displayMonth}):o==="dropdown"?u=s.jsx(bq,{displayMonth:e.displayMonth,id:e.id}):o==="dropdown-buttons"?u=s.jsxs(s.Fragment,{children:[s.jsx(bq,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id}),s.jsx(wq,{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(wq,{displayMonth:e.displayMonth,id:e.id})]}),s.jsx("div",{className:n.caption,style:i.caption,children:u})}function NIe(e){var t=Ls(),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 SIe(e,t,r){for(var n=r?p0(new Date):ad(new Date,{locale:e,weekStartsOn:t}),a=[],i=0;i<7;i++){var o=$o(n,i);a.push(o)}return a}function kIe(){var e=Ls(),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=SIe(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 CIe(){var e,t=Ls(),r=t.classNames,n=t.styles,a=t.components,i=(e=a==null?void 0:a.HeadRow)!==null&&e!==void 0?e:kIe;return s.jsx("thead",{style:n.head,className:r.head,children:s.jsx(i,{})})}function EIe(e){var t=Ls(),r=t.locale,n=t.formatters.formatDay;return s.jsx(s.Fragment,{children:n(e.date,{locale:r})})}var iF=w.createContext(void 0);function AIe(e){if(!d_(e.initialProps)){var t={selected:void 0,modifiers:{disabled:[]}};return s.jsx(iF.Provider,{value:t,children:e.children})}return s.jsx(TIe,{initialProps:e.initialProps,children:e.children})}function TIe(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 x=!!(d.selected&&a&&(n==null?void 0:n.length)===a);if(!x){var p=!!(!d.selected&&i&&(n==null?void 0:n.length)===i);if(!p){var g=n?hoe([],n):[];if(d.selected){var v=g.findIndex(function(y){return Uo(u,y)});g.splice(v,1)}else g.push(u);(h=t.onSelect)===null||h===void 0||h.call(t,g,u,d,f)}}},l={disabled:[]};n&&l.disabled.push(function(u){var d=i&&n.length>i-1,f=n.some(function(m){return Uo(m,u)});return!!(d&&!f)});var c={selected:n,onDayClick:o,modifiers:l};return s.jsx(iF.Provider,{value:c,children:r})}function oF(){var e=w.useContext(iF);if(!e)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return e}function PIe(e,t){var r=t||{},n=r.from,a=r.to;return n&&a?Uo(a,e)&&Uo(n,e)?void 0:Uo(a,e)?{from:a,to:void 0}:Uo(n,e)?void 0:J6(n,e)?{from:e,to:a}:{from:n,to:e}:a?J6(e,a)?{from:a,to:e}:{from:e,to:a}:n?nse(e,n)?{from:e,to:n}:{from:n,to:e}:{from:e,to:void 0}}var lF=w.createContext(void 0);function OIe(e){if(!f_(e.initialProps)){var t={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return s.jsx(lF.Provider,{value:t,children:e.children})}return s.jsx(DIe,{initialProps:e.initialProps,children:e.children})}function DIe(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,x,p){var g,v;(g=t.onDayClick)===null||g===void 0||g.call(t,h,x,p);var y=PIe(h,n);(v=t.onSelect)===null||v===void 0||v.call(t,y,h,x,p)},d={range_start:[],range_end:[],range_middle:[],disabled:[]};if(i?(d.range_start=[i],o?(d.range_end=[o],Uo(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:Hx(i,l-1),before:$o(i,l-1)}),i&&o&&d.disabled.push({after:i,before:$o(i,l-1)}),!i&&o&&d.disabled.push({after:Hx(o,l-1),before:$o(o,l-1)})),c){if(i&&!o&&(d.disabled.push({before:$o(i,-c+1)}),d.disabled.push({after:$o(i,c-1)})),i&&o){var f=Ud(o,i)+1,m=c-f;d.disabled.push({before:Hx(i,m)}),d.disabled.push({after:$o(o,m)})}!i&&o&&(d.disabled.push({before:$o(o,-c+1)}),d.disabled.push({after:$o(o,c-1)}))}return s.jsx(lF.Provider,{value:{selected:n,onDayClick:u,modifiers:d},children:r})}function cF(){var e=w.useContext(lF);if(!e)throw new Error("useSelectRange must be used within a SelectRangeProvider");return e}function w5(e){return Array.isArray(e)?hoe([],e):e!==void 0?[e]:[]}function IIe(e){var t={};return Object.entries(e).forEach(function(r){var n=r[0],a=r[1];t[n]=w5(a)}),t}var od;(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"})(od||(od={}));var RIe=od.Selected,If=od.Disabled,LIe=od.Hidden,FIe=od.Today,_T=od.RangeEnd,NT=od.RangeMiddle,ST=od.RangeStart,MIe=od.Outside;function $Ie(e,t,r){var n,a=(n={},n[RIe]=w5(e.selected),n[If]=w5(e.disabled),n[LIe]=w5(e.hidden),n[FIe]=[e.today],n[_T]=[],n[NT]=[],n[ST]=[],n[MIe]=[],n);return e.fromDate&&a[If].push({before:e.fromDate}),e.toDate&&a[If].push({after:e.toDate}),d_(e)?a[If]=a[If].concat(t.modifiers[If]):f_(e)&&(a[If]=a[If].concat(r.modifiers[If]),a[ST]=r.modifiers[ST],a[NT]=r.modifiers[NT],a[_T]=r.modifiers[_T]),a}var voe=w.createContext(void 0);function BIe(e){var t=Ls(),r=oF(),n=cF(),a=$Ie(t,r,n),i=IIe(t.modifiers),o=Fr(Fr({},a),i);return s.jsx(voe.Provider,{value:o,children:e.children})}function yoe(){var e=w.useContext(voe);if(!e)throw new Error("useModifiers must be used within a ModifiersProvider");return e}function zIe(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function qIe(e){return!!(e&&typeof e=="object"&&"from"in e)}function UIe(e){return!!(e&&typeof e=="object"&&"after"in e)}function VIe(e){return!!(e&&typeof e=="object"&&"before"in e)}function HIe(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function WIe(e,t){var r,n=t.from,a=t.to;if(n&&a){var i=Ud(a,n)<0;i&&(r=[a,n],n=r[0],a=r[1]);var o=Ud(e,n)>=0&&Ud(a,e)>=0;return o}return a?Uo(a,e):n?Uo(n,e):!1}function GIe(e){return ML(e)}function KIe(e){return Array.isArray(e)&&e.every(ML)}function XIe(e,t){return t.some(function(r){if(typeof r=="boolean")return r;if(GIe(r))return Uo(e,r);if(KIe(r))return r.includes(e);if(qIe(r))return WIe(e,r);if(HIe(r))return r.dayOfWeek.includes(e.getDay());if(zIe(r)){var n=Ud(r.before,e),a=Ud(r.after,e),i=n>0,o=a<0,l=J6(r.before,r.after);return l?o&&i:i||o}return UIe(r)?Ud(e,r.after)>0:VIe(r)?Ud(r.before,e)>0:typeof r=="function"?r(e):!1})}function uF(e,t,r){var n=Object.keys(t).reduce(function(i,o){var l=t[o];return XIe(e,l)&&i.push(o),i},[]),a={};return n.forEach(function(i){return a[i]=!0}),r&&!JC(e,r)&&(a.outside=!0),a}function YIe(e,t){for(var r=_o(e[0]),n=l_(e[e.length-1]),a,i,o=r;o<=n;){var l=uF(o,t),c=!l.disabled&&!l.hidden;if(!c){o=$o(o,1);continue}if(l.selected)return o;l.today&&!i&&(i=o),a||(a=o),o=$o(o,1)}return i||a}var ZIe=365;function boe(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:$o,week:Z6,month:cc,year:rke,startOfWeek:function(g){return a.ISOWeek?p0(g):ad(g,{locale:f,weekStartsOn:c})},endOfWeek:function(g){return a.ISOWeek?Zne(g):ZC(g,{locale:f,weekStartsOn:c})}},h=m[r](e,n==="after"?1:-1);n==="before"&&u?h=nke([u,h]):n==="after"&&d&&(h=ske([d,h]));var x=!0;if(i){var p=uF(h,i);x=!p.disabled&&!p.hidden}return x?h:l.count>ZIe?l.lastFocused:boe(h,{moveBy:r,direction:n,context:a,modifiers:i,retry:Fr(Fr({},l),{count:l.count+1})})}var woe=w.createContext(void 0);function JIe(e){var t=h_(),r=yoe(),n=w.useState(),a=n[0],i=n[1],o=w.useState(),l=o[0],c=o[1],u=YIe(t.displayMonths,r),d=a??(l&&t.isDateDisplayed(l))?l:u,f=function(){c(a),i(void 0)},m=function(g){i(g)},h=Ls(),x=function(g,v){if(a){var y=boe(a,{moveBy:g,direction:v,context:h,modifiers:r});Uo(a,y)||(t.goToDate(y,a),m(y))}},p={focusedDay:a,focusTarget:d,blur:f,focus:m,focusDayAfter:function(){return x("day","after")},focusDayBefore:function(){return x("day","before")},focusWeekAfter:function(){return x("week","after")},focusWeekBefore:function(){return x("week","before")},focusMonthBefore:function(){return x("month","before")},focusMonthAfter:function(){return x("month","after")},focusYearBefore:function(){return x("year","before")},focusYearAfter:function(){return x("year","after")},focusStartOfWeek:function(){return x("startOfWeek","before")},focusEndOfWeek:function(){return x("endOfWeek","after")}};return s.jsx(woe.Provider,{value:p,children:e.children})}function dF(){var e=w.useContext(woe);if(!e)throw new Error("useFocusContext must be used within a FocusProvider");return e}function QIe(e,t){var r=yoe(),n=uF(e,r,t);return n}var fF=w.createContext(void 0);function eRe(e){if(!mE(e.initialProps)){var t={selected:void 0};return s.jsx(fF.Provider,{value:t,children:e.children})}return s.jsx(tRe,{initialProps:e.initialProps,children:e.children})}function tRe(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(fF.Provider,{value:a,children:r})}function joe(){var e=w.useContext(fF);if(!e)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return e}function rRe(e,t){var r=Ls(),n=joe(),a=oF(),i=cF(),o=dF(),l=o.focusDayAfter,c=o.focusDayBefore,u=o.focusWeekAfter,d=o.focusWeekBefore,f=o.blur,m=o.focus,h=o.focusMonthBefore,x=o.focusMonthAfter,p=o.focusYearBefore,g=o.focusYearAfter,v=o.focusStartOfWeek,y=o.focusEndOfWeek,b=function(V){var z,M,B,K;mE(r)?(z=n.onDayClick)===null||z===void 0||z.call(n,e,t,V):d_(r)?(M=a.onDayClick)===null||M===void 0||M.call(a,e,t,V):f_(r)?(B=i.onDayClick)===null||B===void 0||B.call(i,e,t,V):(K=r.onDayClick)===null||K===void 0||K.call(r,e,t,V)},N=function(V){var z;m(e),(z=r.onDayFocus)===null||z===void 0||z.call(r,e,t,V)},j=function(V){var z;f(),(z=r.onDayBlur)===null||z===void 0||z.call(r,e,t,V)},_=function(V){var z;(z=r.onDayMouseEnter)===null||z===void 0||z.call(r,e,t,V)},S=function(V){var z;(z=r.onDayMouseLeave)===null||z===void 0||z.call(r,e,t,V)},P=function(V){var z;(z=r.onDayPointerEnter)===null||z===void 0||z.call(r,e,t,V)},T=function(V){var z;(z=r.onDayPointerLeave)===null||z===void 0||z.call(r,e,t,V)},R=function(V){var z;(z=r.onDayTouchCancel)===null||z===void 0||z.call(r,e,t,V)},k=function(V){var z;(z=r.onDayTouchEnd)===null||z===void 0||z.call(r,e,t,V)},E=function(V){var z;(z=r.onDayTouchMove)===null||z===void 0||z.call(r,e,t,V)},q=function(V){var z;(z=r.onDayTouchStart)===null||z===void 0||z.call(r,e,t,V)},O=function(V){var z;(z=r.onDayKeyUp)===null||z===void 0||z.call(r,e,t,V)},L=function(V){var z;switch(V.key){case"ArrowLeft":V.preventDefault(),V.stopPropagation(),r.dir==="rtl"?l():c();break;case"ArrowRight":V.preventDefault(),V.stopPropagation(),r.dir==="rtl"?c():l();break;case"ArrowDown":V.preventDefault(),V.stopPropagation(),u();break;case"ArrowUp":V.preventDefault(),V.stopPropagation(),d();break;case"PageUp":V.preventDefault(),V.stopPropagation(),V.shiftKey?p():h();break;case"PageDown":V.preventDefault(),V.stopPropagation(),V.shiftKey?g():x();break;case"Home":V.preventDefault(),V.stopPropagation(),v();break;case"End":V.preventDefault(),V.stopPropagation(),y();break}(z=r.onDayKeyDown)===null||z===void 0||z.call(r,e,t,V)},H={onClick:b,onFocus:N,onBlur:j,onKeyDown:L,onKeyUp:O,onMouseEnter:_,onMouseLeave:S,onPointerEnter:P,onPointerLeave:T,onTouchCancel:R,onTouchEnd:k,onTouchMove:E,onTouchStart:q};return H}function nRe(){var e=Ls(),t=joe(),r=oF(),n=cF(),a=mE(e)?t.selected:d_(e)?r.selected:f_(e)?n.selected:void 0;return a}function sRe(e){return Object.values(od).includes(e)}function aRe(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(sRe(n)){var i=e.classNames["day_".concat(n)];i&&r.push(i)}}),r}function iRe(e,t){var r=Fr({},e.styles.day);return Object.keys(t).forEach(function(n){var a;r=Fr(Fr({},r),(a=e.modifiersStyles)===null||a===void 0?void 0:a[n])}),r}function oRe(e,t,r){var n,a,i,o=Ls(),l=dF(),c=QIe(e,t),u=rRe(e,c),d=nRe(),f=!!(o.onDayClick||o.mode!=="default");w.useEffect(function(){var _;c.outside||l.focusedDay&&f&&Uo(l.focusedDay,e)&&((_=r.current)===null||_===void 0||_.focus())},[l.focusedDay,e,r,f,c.outside]);var m=aRe(o,c).join(" "),h=iRe(o,c),x=!!(c.outside&&!o.showOutsideDays||c.hidden),p=(i=(a=o.components)===null||a===void 0?void 0:a.DayContent)!==null&&i!==void 0?i:EIe,g=s.jsx(p,{date:e,displayMonth:t,activeModifiers:c}),v={style:h,className:m,children:g,role:"gridcell"},y=l.focusTarget&&Uo(l.focusTarget,e)&&!c.outside,b=l.focusedDay&&Uo(l.focusedDay,e),N=Fr(Fr(Fr({},v),(n={disabled:c.disabled,role:"gridcell"},n["aria-selected"]=c.selected,n.tabIndex=b||y?0:-1,n)),u),j={isButton:f,isHidden:x,activeModifiers:c,selectedDays:d,buttonProps:N,divProps:v};return j}function lRe(e){var t=w.useRef(null),r=oRe(e.date,e.displayMonth,t);return r.isHidden?s.jsx("div",{role:"gridcell"}):r.isButton?s.jsx(_4,Fr({name:"day",ref:t},r.buttonProps)):s.jsx("div",Fr({},r.divProps))}function cRe(e){var t=e.number,r=e.dates,n=Ls(),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(_4,{name:"week-number","aria-label":f,className:o.weeknumber,style:i.weeknumber,onClick:m,children:d})}function uRe(e){var t,r,n=Ls(),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:lRe,u=(r=l==null?void 0:l.WeekNumber)!==null&&r!==void 0?r:cRe,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})},dCe(f))})]})}function jq(e,t,r){for(var n=r!=null&&r.ISOWeek?Zne(t):ZC(t,r),a=r!=null&&r.ISOWeek?p0(e):ad(e,r),i=Ud(n,a),o=[],l=0;l<=i;l++)o.push($o(a,l));var c=o.reduce(function(u,d){var f=r!=null&&r.ISOWeek?Qne(d):tse(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 dRe(e,t){var r=jq(_o(e),l_(e),t);if(t!=null&&t.useFixedWeeks){var n=hCe(e,t);if(n<6){var a=r[r.length-1],i=a.dates[a.dates.length-1],o=Z6(i,6-n),l=jq(Z6(i,1),o,t);r.push.apply(r,l)}}return r}function fRe(e){var t,r,n,a=Ls(),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,x=dRe(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:CIe,g=(r=d==null?void 0:d.Row)!==null&&r!==void 0?r:uRe,v=(n=d==null?void 0:d.Footer)!==null&&n!==void 0?n:NIe;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:x.map(function(y){return s.jsx(g,{displayMonth:e.displayMonth,dates:y.dates,weekNumber:y.weekNumber},y.weekNumber)})}),s.jsx(v,{displayMonth:e.displayMonth})]})}function hRe(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var mRe=hRe()?w.useLayoutEffect:w.useEffect,kT=!1,pRe=0;function _q(){return"react-day-picker-".concat(++pRe)}function xRe(e){var t,r=e??(kT?_q():null),n=w.useState(r),a=n[0],i=n[1];return mRe(function(){a===null&&i(_q())},[]),w.useEffect(function(){kT===!1&&(kT=!0)},[]),(t=e??a)!==null&&t!==void 0?t:void 0}function gRe(e){var t,r,n=Ls(),a=n.dir,i=n.classNames,o=n.styles,l=n.components,c=h_().displayMonths,u=xRe(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,x=e.displayIndex===c.length-1,p=!h&&!x;a==="rtl"&&(t=[h,x],x=t[0],h=t[1]),h&&(f.push(i.caption_start),m=Fr(Fr({},m),o.caption_start)),x&&(f.push(i.caption_end),m=Fr(Fr({},m),o.caption_end)),p&&(f.push(i.caption_between),m=Fr(Fr({},m),o.caption_between));var g=(r=l==null?void 0:l.Caption)!==null&&r!==void 0?r:_Ie;return s.jsxs("div",{className:f.join(" "),style:m,children:[s.jsx(g,{id:u,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),s.jsx(fRe,{id:d,"aria-labelledby":u,displayMonth:e.displayMonth})]},e.displayIndex)}function vRe(e){var t=Ls(),r=t.classNames,n=t.styles;return s.jsx("div",{className:r.months,style:n.months,children:e.children})}function yRe(e){var t,r,n=e.initialProps,a=Ls(),i=dF(),o=h_(),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=Fr(Fr({},a.styles.root),a.style),m=Object.keys(n).filter(function(x){return x.startsWith("data-")}).reduce(function(x,p){var g;return Fr(Fr({},x),(g={},g[p]=n[p],g))},{}),h=(r=(t=n.components)===null||t===void 0?void 0:t.Months)!==null&&r!==void 0?r:vRe;return s.jsx("div",Fr({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(x,p){return s.jsx(gRe,{displayIndex:p,displayMonth:x},p)})})}))}function bRe(e){var t=e.children,r=VDe(e,["children"]);return s.jsx(cIe,{initialProps:r,children:s.jsx(yIe,{children:s.jsx(eRe,{initialProps:r,children:s.jsx(AIe,{initialProps:r,children:s.jsx(OIe,{initialProps:r,children:s.jsx(BIe,{children:s.jsx(JIe,{children:t})})})})})})})}function wRe(e){return s.jsx(bRe,Fr({},e,{children:s.jsx(yRe,{initialProps:e})}))}function _oe({className:e,classNames:t,showOutsideDays:r=!0,...n}){return s.jsx(wRe,{showOutsideDays:r,className:yt("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:yt(E2({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:yt(E2({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(vC,{className:"h-4 w-4"}),IconRight:({...a})=>s.jsx(nu,{className:"h-4 w-4"})},...n})}_oe.displayName="Calendar";function jRe(){const e=Zt(),{isAdmin:t,loading:r}=Br(),[n,a]=w.useState(!0),[i,o]=w.useState([]),[l,c]=w.useState([]),[u,d]=w.useState(!1),[f,m]=w.useState(""),[h,x]=w.useState(""),[p,g]=w.useState(""),[v,y]=w.useState(""),[b,N]=w.useState(""),[j,_]=w.useState("1500"),[S,P]=w.useState();w.useEffect(()=>{!r&&!t&&e("/auth")},[t,r,e]),w.useEffect(()=>{t&&(T(),R())},[t]);const T=async()=>{try{const{data:L,error:H}=await ce.from("editorial_calendar").select("*, blog_categories(name)").order("scheduled_date",{ascending:!0});if(H)throw H;o(L||[])}catch(L){console.error("Error loading calendar:",L),ae.error("Erreur lors du chargement du calendrier")}finally{a(!1)}},R=async()=>{try{const{data:L,error:H}=await ce.from("blog_categories").select("*").order("name");if(H)throw H;c(L||[])}catch(L){console.error("Error loading categories:",L)}},k=async()=>{if(!f.trim()||!h.trim()||!S){ae.error("Veuillez remplir tous les champs requis");return}try{const{error:L}=await ce.from("editorial_calendar").insert({title:f,topic:h,description:p||null,keywords:v?v.split(",").map(H=>H.trim()):null,category_id:b||null,target_word_count:parseInt(j),scheduled_date:Dt(S,"yyyy-MM-dd"),status:"planned"});if(L)throw L;ae.success("Entrée ajoutée au calendrier"),d(!1),q(),T()}catch(L){console.error("Error adding entry:",L),ae.error("Erreur lors de l'ajout")}},E=async L=>{if(confirm("Êtes-vous sûr de vouloir supprimer cette entrée ?"))try{const{error:H}=await ce.from("editorial_calendar").delete().eq("id",L);if(H)throw H;ae.success("Entrée supprimée"),T()}catch(H){console.error("Error deleting entry:",H),ae.error("Erreur lors de la suppression")}},q=()=>{m(""),x(""),g(""),y(""),N(""),_("1500"),P(void 0)};if(r||n)return s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:s.jsx(it,{className:"h-8 w-8 animate-spin text-primary"})});const O=L=>{switch(L){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(ta,{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(qn,{open:u,onOpenChange:d,children:[s.jsx(Xo,{asChild:!0,children:s.jsxs(ne,{children:[s.jsx(Qa,{className:"mr-2 h-4 w-4"}),"Planifier un article"]})}),s.jsxs($n,{className:"max-w-2xl",children:[s.jsxs(Un,{children:[s.jsx(Vn,{children:"Planifier un nouvel article"}),s.jsx(Sa,{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(Xe,{id:"title",value:f,onChange:L=>m(L.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:L=>x(L.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:L=>g(L.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(Xe,{id:"keywords",value:v,onChange:L=>y(L.target.value),placeholder:"formation, compétences, apprentissage"})]}),s.jsxs("div",{children:[s.jsx(We,{htmlFor:"category",children:"Catégorie"}),s.jsxs(Ar,{value:b,onValueChange:N,children:[s.jsx(kr,{children:s.jsx(Dr,{placeholder:"Sélectionner une catégorie"})}),s.jsx(Cr,{children:l.map(L=>s.jsx(ct,{value:L.id,children:L.name},L.id))})]})]}),s.jsxs("div",{children:[s.jsx(We,{htmlFor:"wordCount",children:"Nombre de mots cible"}),s.jsx(Xe,{id:"wordCount",type:"number",value:j,onChange:L=>_(L.target.value)})]}),s.jsxs("div",{children:[s.jsx(We,{children:"Date de publication *"}),s.jsxs(lp,{children:[s.jsx(cp,{asChild:!0,children:s.jsxs(ne,{variant:"outline",className:"w-full justify-start text-left font-normal",children:[s.jsx(Hs,{className:"mr-2 h-4 w-4"}),S?Dt(S,"PPP",{locale:br}):"Sélectionner une date"]})}),s.jsx(vh,{className:"w-auto p-0",children:s.jsx(_oe,{mode:"single",selected:S,onSelect:P,initialFocus:!0})})]})]}),s.jsxs(ne,{onClick:k,className:"w-full",children:[s.jsx(Qa,{className:"mr-2 h-4 w-4"}),"Ajouter au calendrier"]})]})]})]})})]}),s.jsxs("div",{className:"space-y-4",children:[i.map(L=>s.jsxs(je,{children:[s.jsx(mt,{children:s.jsx("div",{className:"flex items-start justify-between",children:s.jsxs("div",{className:"flex-1",children:[s.jsx(gt,{className:"mb-2",children:L.title}),s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[L.blog_categories&&s.jsx(Te,{variant:"secondary",children:L.blog_categories.name}),s.jsx(Te,{variant:O(L.status),children:L.status}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(Hs,{className:"h-4 w-4"}),Dt(new Date(L.scheduled_date),"d MMM yyyy",{locale:br})]})]})]})})}),s.jsxs(Ee,{children:[s.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:L.topic}),L.keywords&&s.jsx("div",{className:"flex flex-wrap gap-2 mb-4",children:L.keywords.map((H,V)=>s.jsx(Te,{variant:"outline",children:H},V))}),s.jsxs("div",{className:"flex gap-2",children:[L.post_id&&s.jsx(ne,{variant:"outline",size:"sm",onClick:()=>e(`/admin/blog/edit/${L.post_id}`),children:"Voir l'article"}),s.jsxs(ne,{variant:"destructive",size:"sm",onClick:()=>E(L.id),children:[s.jsx(ri,{className:"h-4 w-4 mr-2"}),"Supprimer"]})]})]})]},L.id)),i.length===0&&s.jsx(je,{children:s.jsx(Ee,{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 _Re(){const e=Zt(),{isAdmin:t,loading:r}=Br(),[n,a]=w.useState(!0),[i,o]=w.useState([]),[l,c]=w.useState([]),[u,d]=w.useState(!1),[f,m]=w.useState(!1),[h,x]=w.useState(""),[p,g]=w.useState(""),[v,y]=w.useState("now"),[b,N]=w.useState("all");w.useEffect(()=>{!r&&!t&&e("/auth")},[t,r,e]),w.useEffect(()=>{t&&j()},[t]);const j=async()=>{try{const[R,k]=await Promise.all([ce.from("newsletter_subscribers").select("*").order("subscribed_at",{ascending:!1}),ce.from("newsletter_sends").select("*, blog_posts(title, slug)").order("sent_at",{ascending:!1}).limit(10)]);if(R.error)throw R.error;if(k.error)throw k.error;o(R.data||[]),c(k.data||[])}catch(R){console.error("Error loading data:",R),ae.error("Erreur lors du chargement des données")}finally{a(!1)}},_=async R=>{if(confirm("Êtes-vous sûr de vouloir supprimer cet abonné ?"))try{const{error:k}=await ce.from("newsletter_subscribers").delete().eq("id",R);if(k)throw k;ae.success("Abonné supprimé"),j()}catch(k){console.error("Error deleting subscriber:",k),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 R=i.filter(k=>k.is_active&&k.confirmed);if(R.length===0){ae.error("Aucun abonné actif");return}d(!0);try{const{data:k,error:E}=await ce.functions.invoke("send-custom-newsletter",{body:{subject:h,content:p,scheduleTime:v==="now"?null:v,target_type:b}});if(E)throw E;v==="now"?ae.success(`Newsletter envoyée à ${k.successCount||R.length} abonnés !`):ae.success("Newsletter programmée avec succès !"),x(""),g(""),y("now"),j()}catch(k){console.error("Error sending newsletter:",k),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(it,{className:"h-8 w-8 animate-spin text-primary"})});const P=i.filter(R=>R.is_active&&R.confirmed).length,T=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(ta,{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(je,{children:[s.jsx(mt,{children:s.jsxs(gt,{className:"flex items-center gap-2 text-lg",children:[s.jsx(er,{className:"h-5 w-5"}),"Abonnés actifs"]})}),s.jsxs(Ee,{children:[s.jsx("div",{className:"text-4xl font-bold",children:P}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:["sur ",T," total"]})]})]}),s.jsxs(je,{children:[s.jsx(mt,{children:s.jsxs(gt,{className:"flex items-center gap-2 text-lg",children:[s.jsx(_n,{className:"h-5 w-5"}),"Newsletters envoyées"]})}),s.jsxs(Ee,{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(je,{children:[s.jsx(mt,{children:s.jsxs(gt,{className:"flex items-center gap-2 text-lg",children:[s.jsx($r,{className:"h-5 w-5"}),"Meilleur moment"]})}),s.jsxs(Ee,{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(je,{children:[s.jsxs(mt,{children:[s.jsx(gt,{children:"Composer une newsletter"}),s.jsx(Kr,{children:"Rédigez votre contenu et envoyez-le aux abonnés"})]}),s.jsxs(Ee,{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(We,{htmlFor:"subject",children:"Sujet de l'email *"}),s.jsx(Xe,{id:"subject",value:h,onChange:R=>x(R.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:R=>g(R.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(Ar,{value:b,onValueChange:N,children:[s.jsx(kr,{children:s.jsx(Dr,{placeholder:"Choisir l'audience"})}),s.jsxs(Cr,{children:[s.jsx(ct,{value:"all",children:"Tous les abonnés"}),s.jsx(ct,{value:"school",children:"Écoles uniquement"}),s.jsx(ct,{value:"trainer",children:"Formateurs uniquement"}),s.jsx(ct,{value:"general",children:"Visiteurs (inscription web)"})]})]})]}),s.jsxs("div",{children:[s.jsx(We,{htmlFor:"schedule",children:"Programmation"}),s.jsxs(Ar,{value:v,onValueChange:y,children:[s.jsx(kr,{children:s.jsx(Dr,{placeholder:"Choisir le moment d'envoi"})}),s.jsxs(Cr,{children:[s.jsx(ct,{value:"now",children:"Envoyer maintenant"}),s.jsx(ct,{value:"best",children:"Meilleur moment (Mardi 10h)"}),s.jsx(ct,{value:"morning",children:"Demain matin (9h)"}),s.jsx(ct,{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(es,{className:"mr-2 h-4 w-4"}),"Prévisualiser"]}),s.jsx(ne,{onClick:S,disabled:u||!h||!p||P===0,className:"flex-1",children:u?s.jsxs(s.Fragment,{children:[s.jsx(it,{className:"mr-2 h-4 w-4 animate-spin"}),"Envoi en cours..."]}):v==="now"?s.jsxs(s.Fragment,{children:[s.jsx(Js,{className:"mr-2 h-4 w-4"}),"Envoyer à ",P," abonnés"]}):s.jsxs(s.Fragment,{children:[s.jsx($r,{className:"mr-2 h-4 w-4"}),"Programmer l'envoi"]})})]})]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(je,{children:[s.jsx(mt,{children:s.jsx(gt,{className:"text-lg",children:"Abonnés récents"})}),s.jsx(Ee,{children:s.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[i.slice(0,10).map(R=>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:R.email}),s.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:Dt(new Date(R.subscribed_at),"d MMM",{locale:br})}),R.is_active&&R.confirmed?s.jsx(Te,{variant:"secondary",className:"text-xs",children:"Actif"}):s.jsx(Te,{variant:"outline",className:"text-xs",children:"Inactif"})]})]}),s.jsx(ne,{variant:"ghost",size:"icon",onClick:()=>_(R.id),children:s.jsx(ri,{className:"h-4 w-4 text-destructive"})})]},R.id)),i.length===0&&s.jsx("p",{className:"text-center text-muted-foreground py-4",children:"Aucun abonné"})]})})]}),s.jsxs(je,{children:[s.jsx(mt,{children:s.jsx(gt,{className:"text-lg",children:"Envois récents"})}),s.jsx(Ee,{children:s.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[l.map(R=>{var k;return s.jsxs("div",{className:"p-2 rounded border",children:[s.jsx("p",{className:"font-medium text-sm truncate",children:((k=R.blog_posts)==null?void 0:k.title)||"Newsletter manuelle"}),s.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground mt-1",children:[s.jsx("span",{children:Dt(new Date(R.sent_at),"d MMM HH:mm",{locale:br})}),s.jsxs("span",{className:"text-green-600",children:["✓ ",R.success_count]}),R.failed_count>0&&s.jsxs("span",{className:"text-red-600",children:["✗ ",R.failed_count]})]})]},R.id)}),l.length===0&&s.jsx("p",{className:"text-center text-muted-foreground py-4",children:"Aucun envoi"})]})})]})]})]}),s.jsx(qn,{open:f,onOpenChange:m,children:s.jsxs($n,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[s.jsxs(Un,{children:[s.jsx(Vn,{children:"Prévisualisation de la newsletter"}),s.jsx(Sa,{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 NRe="modulepreload",SRe=function(e){return"/"+e},Nq={},Zd=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=SRe(c),c in Nq)return;Nq[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":NRe,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 os(e){"@babel/helpers - typeof";return os=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},os(e)}var ld=Uint8Array,ec=Uint16Array,hF=Int32Array,mF=new ld([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]),pF=new ld([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]),Sq=new ld([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Noe=function(e,t){for(var r=new ec(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];for(var a=new hF(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}},Soe=Noe(mF,2),kRe=Soe.b,y8=Soe.r;kRe[28]=258,y8[258]=28;var CRe=Noe(pF,0),kq=CRe.r,b8=new ec(32768);for(var Us=0;Us<32768;++Us){var rm=(Us&43690)>>1|(Us&21845)<<1;rm=(rm&52428)>>2|(rm&13107)<<2,rm=(rm&61680)>>4|(rm&3855)<<4,b8[Us]=((rm&65280)>>8|(rm&255)<<8)>>1}var Sw=function(e,t,r){for(var n=e.length,a=0,i=new ec(t);a<n;++a)e[a]&&++i[e[a]-1];var o=new ec(t);for(a=1;a<t;++a)o[a]=o[a-1]+i[a-1]<<1;var l;if(r){l=new ec(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[b8[f]>>c]=u}else for(l=new ec(n),a=0;a<n;++a)e[a]&&(l[a]=b8[o[e[a]-1]++]>>15-e[a]);return l},_0=new ld(288);for(var Us=0;Us<144;++Us)_0[Us]=8;for(var Us=144;Us<256;++Us)_0[Us]=9;for(var Us=256;Us<280;++Us)_0[Us]=7;for(var Us=280;Us<288;++Us)_0[Us]=8;var N4=new ld(32);for(var Us=0;Us<32;++Us)N4[Us]=5;var ERe=Sw(_0,9,0),ARe=Sw(N4,5,0),koe=function(e){return(e+7)/8|0},TRe=function(e,t,r){return(r==null||r>e.length)&&(r=e.length),new ld(e.subarray(t,r))},Rf=function(e,t,r){r<<=t&7;var n=t/8|0;e[n]|=r,e[n+1]|=r>>8},Rb=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},CT=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:Eoe,l:0};if(a==1){var o=new ld(r[0].s+1);return o[r[0].s]=1,{t:o,l:1}}r.sort(function(j,_){return j.f-_.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 ec(m+1),x=w8(r[d-1],h,0);if(x>t){var n=0,p=0,g=x-t,v=1<<g;for(i.sort(function(_,S){return h[S.s]-h[_.s]||_.f-S.f});n<a;++n){var y=i[n].s;if(h[y]>t)p+=v-(1<<x-h[y]),h[y]=t;else break}for(p>>=g;p>0;){var b=i[n].s;h[b]<t?p-=1<<t-h[b]++-1:++n}for(;n>=0&&p;--n){var N=i[n].s;h[N]==t&&(--h[N],++p)}x=t}return{t:new ld(h),l:x}},w8=function(e,t,r){return e.s==-1?Math.max(w8(e.l,t,r+1),w8(e.r,t,r+1)):t[e.s]=r},Cq=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new ec(++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}},Lb=function(e,t){for(var r=0,n=0;n<t.length;++n)r+=e[n]*t[n];return r},Coe=function(e,t,r){var n=r.length,a=koe(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},Eq=function(e,t,r,n,a,i,o,l,c,u,d){Rf(t,d++,r),++a[256];for(var f=CT(a,15),m=f.t,h=f.l,x=CT(i,15),p=x.t,g=x.l,v=Cq(m),y=v.c,b=v.n,N=Cq(p),j=N.c,_=N.n,S=new ec(19),P=0;P<y.length;++P)++S[y[P]&31];for(var P=0;P<j.length;++P)++S[j[P]&31];for(var T=CT(S,7),R=T.t,k=T.l,E=19;E>4&&!R[Sq[E-1]];--E);var q=u+5<<3,O=Lb(a,_0)+Lb(i,N4)+o,L=Lb(a,m)+Lb(i,p)+o+14+3*E+Lb(S,R)+2*S[16]+3*S[17]+7*S[18];if(c>=0&&q<=O&&q<=L)return Coe(t,d,e.subarray(c,c+u));var H,V,z,M;if(Rf(t,d,1+(L<O)),d+=2,L<O){H=Sw(m,h,0),V=m,z=Sw(p,g,0),M=p;var B=Sw(R,k,0);Rf(t,d,b-257),Rf(t,d+5,_-1),Rf(t,d+10,E-4),d+=14;for(var P=0;P<E;++P)Rf(t,d+3*P,R[Sq[P]]);d+=3*E;for(var K=[y,j],C=0;C<2;++C)for(var A=K[C],P=0;P<A.length;++P){var I=A[P]&31;Rf(t,d,B[I]),d+=R[I],I>15&&(Rf(t,d,A[P]>>5&127),d+=A[P]>>12)}}else H=ERe,V=_0,z=ARe,M=N4;for(var P=0;P<l;++P){var U=n[P];if(U>255){var I=U>>18&31;Rb(t,d,H[I+257]),d+=V[I+257],I>7&&(Rf(t,d,U>>23&31),d+=mF[I]);var Y=U&31;Rb(t,d,z[Y]),d+=M[Y],Y>3&&(Rb(t,d,U>>5&8191),d+=pF[Y])}else Rb(t,d,H[U]),d+=V[U]}return Rb(t,d,H[256]),d+V[256]},PRe=new hF([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Eoe=new ld(0),ORe=function(e,t,r,n,a,i){var o=i.z||e.length,l=new ld(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=PRe[t-1],m=f>>13,h=f&8191,x=(1<<r)-1,p=i.p||new ec(32768),g=i.h||new ec(x+1),v=Math.ceil(r/3),y=2*v,b=function(W){return(e[W]^e[W+1]<<v^e[W+2]<<y)&x},N=new hF(25e3),j=new ec(288),_=new ec(32),S=0,P=0,T=i.i||0,R=0,k=i.w||0,E=0;T+2<o;++T){var q=b(T),O=T&32767,L=g[q];if(p[O]=L,g[q]=O,k<=T){var H=o-T;if((S>7e3||R>24576)&&(H>423||!u)){d=Eq(e,c,0,N,j,_,P,R,E,T-E,d),R=S=P=0,E=T;for(var V=0;V<286;++V)j[V]=0;for(var V=0;V<30;++V)_[V]=0}var z=2,M=0,B=h,K=O-L&32767;if(H>2&&q==b(T-K))for(var C=Math.min(m,H)-1,A=Math.min(32767,T),I=Math.min(258,H);K<=A&&--B&&O!=L;){if(e[T+z]==e[T+z-K]){for(var U=0;U<I&&e[T+U]==e[T+U-K];++U);if(U>z){if(z=U,M=K,U>C)break;for(var Y=Math.min(K,U-2),te=0,V=0;V<Y;++V){var re=T-K+V&32767,J=p[re],ie=re-J&32767;ie>te&&(te=ie,L=re)}}}O=L,L=p[O],K+=O-L&32767}if(M){N[R++]=268435456|y8[z]<<18|kq[M];var be=y8[z]&31,Q=kq[M]&31;P+=mF[be]+pF[Q],++j[257+be],++_[Q],k=T+z,++S}else N[R++]=e[T],++j[e[T]]}}for(T=Math.max(T,k);T<o;++T)N[R++]=e[T],++j[e[T]];d=Eq(e,c,u,N,j,_,P,R,E,T-E,d),u||(i.r=d&7|c[d/8|0]<<3,d-=7,i.h=g,i.p=p,i.i=T,i.w=k)}else{for(var T=i.w||0;T<o+u;T+=65535){var Ve=T+65535;Ve>=o&&(c[d/8|0]=u,Ve=o),d=Coe(c,d+1,e.subarray(T,Ve))}i.i=o}return TRe(l,0,n+koe(d)+a)},Aoe=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}}},DRe=function(e,t,r,n,a){if(!a&&(a={l:1},t.dictionary)){var i=t.dictionary.subarray(-32768),o=new ld(i.length+e.length);o.set(i),o.set(e,i.length),e=o,a.w=i.length}return ORe(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)},Toe=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8},IRe=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=Aoe();a.p(t.dictionary),Toe(e,2,a.d())}};function j8(e,t){t||(t={});var r=Aoe();r.p(e);var n=DRe(e,t,t.dictionary?6:2,4);return IRe(n,t),Toe(n,n.length-4,r.d()),n}var RRe=typeof TextDecoder<"u"&&new TextDecoder,LRe=0;try{RRe.decode(Eoe,{stream:!0}),LRe=1}catch{}function FRe(e){if(Array.isArray(e))return e}function MRe(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 Aq(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 $Re(e,t){if(e){if(typeof e=="string")return Aq(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)?Aq(e,t):void 0}}function BRe(){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 Tq(e,t){return FRe(e)||MRe(e,t)||$Re(e,t)||BRe()}function Pq(e,t="utf8"){return new TextDecoder(t).decode(e)}const zRe=new TextEncoder;function qRe(e){return zRe.encode(e)}const URe=1024*8,VRe=(()=>{const e=new Uint8Array(4),t=new Uint32Array(e.buffer);return!((t[0]=1)&e[0])})(),ET={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 xF{constructor(t=URe,r={}){Cn(this,"buffer");Cn(this,"byteLength");Cn(this,"byteOffset");Cn(this,"length");Cn(this,"offset");Cn(this,"lastWrittenByte");Cn(this,"littleEndian");Cn(this,"_data");Cn(this,"_mark");Cn(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 xF)&&(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=ET[r].BYTES_PER_ELEMENT*t,a=this.byteOffset+this.offset,i=this.buffer.slice(a,a+n);if(this.littleEndian===VRe&&r!=="uint8"&&r!=="int8"){const l=new Uint8Array(this.buffer.slice(a,a+n));l.reverse();const c=new ET[r](l.buffer);return this.offset+=n,c.reverse(),c}const o=new ET[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 Pq(this.readBytes(t))}decodeText(t=1,r="utf8"){return Pq(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(qRe(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 j1(e){let t=e.length;for(;--t>=0;)e[t]=0}const HRe=3,WRe=258,Poe=29,GRe=256,KRe=GRe+1+Poe,Ooe=30,XRe=512,YRe=new Array((KRe+2)*2);j1(YRe);const ZRe=new Array(Ooe*2);j1(ZRe);const JRe=new Array(XRe);j1(JRe);const QRe=new Array(WRe-HRe+1);j1(QRe);const eLe=new Array(Poe);j1(eLe);const tLe=new Array(Ooe);j1(tLe);const rLe=(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 _8=rLe;const nLe=()=>{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},sLe=new Uint32Array(nLe()),aLe=(e,t,r,n)=>{const a=sLe,i=n+r;e^=-1;for(let o=n;o<i;o++)e=e>>>8^a[(e^t[o])&255];return e^-1};var Sd=aLe,N8={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"},Doe={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 iLe=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var oLe=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)iLe(r,n)&&(e[n]=r[n])}}return e},lLe=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},Ioe={assign:oLe,flattenChunks:lLe};let Roe=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{Roe=!1}const I2=new Uint8Array(256);for(let e=0;e<256;e++)I2[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;I2[254]=I2[254]=1;var cLe=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 uLe=(e,t)=>{if(t<65534&&e.subarray&&Roe)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 dLe=(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=I2[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 uLe(i,a)},fLe=(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+I2[e[r]]>t?r:t},S8={string2buf:cLe,buf2string:dLe,utf8border:fLe};function hLe(){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 mLe=hLe;const oS=16209,pLe=16191;var xLe=function(t,r){let n,a,i,o,l,c,u,d,f,m,h,x,p,g,v,y,b,N,j,_,S,P,T,R;const k=t.state;n=t.next_in,T=t.input,a=n+(t.avail_in-5),i=t.next_out,R=t.output,o=i-(r-t.avail_out),l=i+(t.avail_out-257),c=k.dmax,u=k.wsize,d=k.whave,f=k.wnext,m=k.window,h=k.hold,x=k.bits,p=k.lencode,g=k.distcode,v=(1<<k.lenbits)-1,y=(1<<k.distbits)-1;e:do{x<15&&(h+=T[n++]<<x,x+=8,h+=T[n++]<<x,x+=8),b=p[h&v];t:for(;;){if(N=b>>>24,h>>>=N,x-=N,N=b>>>16&255,N===0)R[i++]=b&65535;else if(N&16){j=b&65535,N&=15,N&&(x<N&&(h+=T[n++]<<x,x+=8),j+=h&(1<<N)-1,h>>>=N,x-=N),x<15&&(h+=T[n++]<<x,x+=8,h+=T[n++]<<x,x+=8),b=g[h&y];r:for(;;){if(N=b>>>24,h>>>=N,x-=N,N=b>>>16&255,N&16){if(_=b&65535,N&=15,x<N&&(h+=T[n++]<<x,x+=8,x<N&&(h+=T[n++]<<x,x+=8)),_+=h&(1<<N)-1,_>c){t.msg="invalid distance too far back",k.mode=oS;break e}if(h>>>=N,x-=N,N=i-o,_>N){if(N=_-N,N>d&&k.sane){t.msg="invalid distance too far back",k.mode=oS;break e}if(S=0,P=m,f===0){if(S+=u-N,N<j){j-=N;do R[i++]=m[S++];while(--N);S=i-_,P=R}}else if(f<N){if(S+=u+f-N,N-=f,N<j){j-=N;do R[i++]=m[S++];while(--N);if(S=0,f<j){N=f,j-=N;do R[i++]=m[S++];while(--N);S=i-_,P=R}}}else if(S+=f-N,N<j){j-=N;do R[i++]=m[S++];while(--N);S=i-_,P=R}for(;j>2;)R[i++]=P[S++],R[i++]=P[S++],R[i++]=P[S++],j-=3;j&&(R[i++]=P[S++],j>1&&(R[i++]=P[S++]))}else{S=i-_;do R[i++]=R[S++],R[i++]=R[S++],R[i++]=R[S++],j-=3;while(j>2);j&&(R[i++]=R[S++],j>1&&(R[i++]=R[S++]))}}else if(N&64){t.msg="invalid distance code",k.mode=oS;break e}else{b=g[(b&65535)+(h&(1<<N)-1)];continue r}break}}else if(N&64)if(N&32){k.mode=pLe;break e}else{t.msg="invalid literal/length code",k.mode=oS;break e}else{b=p[(b&65535)+(h&(1<<N)-1)];continue t}break}}while(n<a&&i<l);j=x>>3,n-=j,x-=j<<3,h&=(1<<x)-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),k.hold=h,k.bits=x};const Tg=15,Oq=852,Dq=592,Iq=0,AT=1,Rq=2,gLe=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]),vLe=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]),yLe=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]),bLe=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]),wLe=(e,t,r,n,a,i,o,l)=>{const c=l.bits;let u=0,d=0,f=0,m=0,h=0,x=0,p=0,g=0,v=0,y=0,b,N,j,_,S,P=null,T;const R=new Uint16Array(Tg+1),k=new Uint16Array(Tg+1);let E=null,q,O,L;for(u=0;u<=Tg;u++)R[u]=0;for(d=0;d<n;d++)R[t[r+d]]++;for(h=c,m=Tg;m>=1&&R[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&&R[f]===0;f++);for(h<f&&(h=f),g=1,u=1;u<=Tg;u++)if(g<<=1,g-=R[u],g<0)return-1;if(g>0&&(e===Iq||m!==1))return-1;for(k[1]=0,u=1;u<Tg;u++)k[u+1]=k[u]+R[u];for(d=0;d<n;d++)t[r+d]!==0&&(o[k[t[r+d]]++]=d);if(e===Iq?(P=E=o,T=20):e===AT?(P=gLe,E=vLe,T=257):(P=yLe,E=bLe,T=0),y=0,d=0,u=f,S=i,x=h,p=0,j=-1,v=1<<h,_=v-1,e===AT&&v>Oq||e===Rq&&v>Dq)return 1;for(;;){q=u-p,o[d]+1<T?(O=0,L=o[d]):o[d]>=T?(O=E[o[d]-T],L=P[o[d]-T]):(O=96,L=0),b=1<<u-p,N=1<<x,f=N;do N-=b,a[S+(y>>p)+N]=q<<24|O<<16|L|0;while(N!==0);for(b=1<<u-1;y&b;)b>>=1;if(b!==0?(y&=b-1,y+=b):y=0,d++,--R[u]===0){if(u===m)break;u=t[r+o[d]]}if(u>h&&(y&_)!==j){for(p===0&&(p=h),S+=f,x=u-p,g=1<<x;x+p<m&&(g-=R[x+p],!(g<=0));)x++,g<<=1;if(v+=1<<x,e===AT&&v>Oq||e===Rq&&v>Dq)return 1;j=y&_,a[j]=h<<24|x<<16|S-i|0}}return y!==0&&(a[S+y]=u-p<<24|64<<16|0),l.bits=h,0};var kw=wLe;const jLe=0,Loe=1,Foe=2,{Z_FINISH:Lq,Z_BLOCK:_Le,Z_TREES:lS,Z_OK:N0,Z_STREAM_END:NLe,Z_NEED_DICT:SLe,Z_STREAM_ERROR:iu,Z_DATA_ERROR:Moe,Z_MEM_ERROR:$oe,Z_BUF_ERROR:kLe,Z_DEFLATED:Fq}=Doe,pE=16180,Mq=16181,$q=16182,Bq=16183,zq=16184,qq=16185,Uq=16186,Vq=16187,Hq=16188,Wq=16189,S4=16190,Lf=16191,TT=16192,Gq=16193,PT=16194,Kq=16195,Xq=16196,Yq=16197,Zq=16198,cS=16199,uS=16200,Jq=16201,Qq=16202,eU=16203,tU=16204,rU=16205,OT=16206,nU=16207,sU=16208,Ks=16209,Boe=16210,zoe=16211,CLe=852,ELe=592,ALe=15,TLe=ALe,aU=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function PLe(){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 K0=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<pE||t.mode>zoe?1:0},qoe=e=>{if(K0(e))return iu;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=pE,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(CLe),t.distcode=t.distdyn=new Int32Array(ELe),t.sane=1,t.back=-1,N0},Uoe=e=>{if(K0(e))return iu;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,qoe(e)},Voe=(e,t)=>{let r;if(K0(e))return iu;const n=e.state;return t<0?(r=0,t=-t):(r=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?iu:(n.window!==null&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,Uoe(e))},Hoe=(e,t)=>{if(!e)return iu;const r=new PLe;e.state=r,r.strm=e,r.window=null,r.mode=pE;const n=Voe(e,t);return n!==N0&&(e.state=null),n},OLe=e=>Hoe(e,TLe);let iU=!0,DT,IT;const DLe=e=>{if(iU){DT=new Int32Array(512),IT=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(kw(Loe,e.lens,0,288,DT,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;kw(Foe,e.lens,0,32,IT,0,e.work,{bits:5}),iU=!1}e.lencode=DT,e.lenbits=9,e.distcode=IT,e.distbits=5},Woe=(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},ILe=(e,t)=>{let r,n,a,i,o,l,c,u,d,f,m,h,x,p,g=0,v,y,b,N,j,_,S,P;const T=new Uint8Array(4);let R,k;const E=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(K0(e)||!e.output||!e.input&&e.avail_in!==0)return iu;r=e.state,r.mode===Lf&&(r.mode=TT),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,P=N0;e:for(;;)switch(r.mode){case pE:if(r.wrap===0){r.mode=TT;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,T[0]=u&255,T[1]=u>>>8&255,r.check=Sd(r.check,T,2,0),u=0,d=0,r.mode=Mq;break}if(r.head&&(r.head.done=!1),!(r.wrap&1)||(((u&255)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=Ks;break}if((u&15)!==Fq){e.msg="unknown compression method",r.mode=Ks;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=Ks;break}r.dmax=1<<r.wbits,r.flags=0,e.adler=r.check=1,r.mode=u&512?Wq:Lf,u=0,d=0;break;case Mq:for(;d<16;){if(l===0)break e;l--,u+=n[i++]<<d,d+=8}if(r.flags=u,(r.flags&255)!==Fq){e.msg="unknown compression method",r.mode=Ks;break}if(r.flags&57344){e.msg="unknown header flags set",r.mode=Ks;break}r.head&&(r.head.text=u>>8&1),r.flags&512&&r.wrap&4&&(T[0]=u&255,T[1]=u>>>8&255,r.check=Sd(r.check,T,2,0)),u=0,d=0,r.mode=$q;case $q: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&&(T[0]=u&255,T[1]=u>>>8&255,T[2]=u>>>16&255,T[3]=u>>>24&255,r.check=Sd(r.check,T,4,0)),u=0,d=0,r.mode=Bq;case Bq: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&&(T[0]=u&255,T[1]=u>>>8&255,r.check=Sd(r.check,T,2,0)),u=0,d=0,r.mode=zq;case zq: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&&(T[0]=u&255,T[1]=u>>>8&255,r.check=Sd(r.check,T,2,0)),u=0,d=0}else r.head&&(r.head.extra=null);r.mode=qq;case qq: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=Sd(r.check,n,h,i)),l-=h,i+=h,r.length-=h),r.length))break e;r.length=0,r.mode=Uq;case Uq: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=Sd(r.check,n,h,i)),l-=h,i+=h,S)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=Vq;case Vq: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=Sd(r.check,n,h,i)),l-=h,i+=h,S)break e}else r.head&&(r.head.comment=null);r.mode=Hq;case Hq: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=Ks;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=Lf;break;case Wq:for(;d<32;){if(l===0)break e;l--,u+=n[i++]<<d,d+=8}e.adler=r.check=aU(u),u=0,d=0,r.mode=S4;case S4: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,SLe;e.adler=r.check=1,r.mode=Lf;case Lf:if(t===_Le||t===lS)break e;case TT:if(r.last){u>>>=d&7,d-=d&7,r.mode=OT;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=Gq;break;case 1:if(DLe(r),r.mode=cS,t===lS){u>>>=2,d-=2;break e}break;case 2:r.mode=Xq;break;case 3:e.msg="invalid block type",r.mode=Ks}u>>>=2,d-=2;break;case Gq: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=Ks;break}if(r.length=u&65535,u=0,d=0,r.mode=PT,t===lS)break e;case PT:r.mode=Kq;case Kq: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=Lf;break;case Xq: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=Ks;break}r.have=0,r.mode=Yq;case Yq:for(;r.have<r.ncode;){for(;d<3;){if(l===0)break e;l--,u+=n[i++]<<d,d+=8}r.lens[E[r.have++]]=u&7,u>>>=3,d-=3}for(;r.have<19;)r.lens[E[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,R={bits:r.lenbits},P=kw(jLe,r.lens,0,19,r.lencode,0,r.work,R),r.lenbits=R.bits,P){e.msg="invalid code lengths set",r.mode=Ks;break}r.have=0,r.mode=Zq;case Zq:for(;r.have<r.nlen+r.ndist;){for(;g=r.lencode[u&(1<<r.lenbits)-1],v=g>>>24,y=g>>>16&255,b=g&65535,!(v<=d);){if(l===0)break e;l--,u+=n[i++]<<d,d+=8}if(b<16)u>>>=v,d-=v,r.lens[r.have++]=b;else{if(b===16){for(k=v+2;d<k;){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=Ks;break}S=r.lens[r.have-1],h=3+(u&3),u>>>=2,d-=2}else if(b===17){for(k=v+3;d<k;){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(k=v+7;d<k;){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=Ks;break}for(;h--;)r.lens[r.have++]=S}}if(r.mode===Ks)break;if(r.lens[256]===0){e.msg="invalid code -- missing end-of-block",r.mode=Ks;break}if(r.lenbits=9,R={bits:r.lenbits},P=kw(Loe,r.lens,0,r.nlen,r.lencode,0,r.work,R),r.lenbits=R.bits,P){e.msg="invalid literal/lengths set",r.mode=Ks;break}if(r.distbits=6,r.distcode=r.distdyn,R={bits:r.distbits},P=kw(Foe,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,R),r.distbits=R.bits,P){e.msg="invalid distances set",r.mode=Ks;break}if(r.mode=cS,t===lS)break e;case cS:r.mode=uS;case uS: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,xLe(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===Lf&&(r.back=-1);break}for(r.back=0;g=r.lencode[u&(1<<r.lenbits)-1],v=g>>>24,y=g>>>16&255,b=g&65535,!(v<=d);){if(l===0)break e;l--,u+=n[i++]<<d,d+=8}if(y&&!(y&240)){for(N=v,j=y,_=b;g=r.lencode[_+((u&(1<<N+j)-1)>>N)],v=g>>>24,y=g>>>16&255,b=g&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=b,y===0){r.mode=rU;break}if(y&32){r.back=-1,r.mode=Lf;break}if(y&64){e.msg="invalid literal/length code",r.mode=Ks;break}r.extra=y&15,r.mode=Jq;case Jq:if(r.extra){for(k=r.extra;d<k;){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=Qq;case Qq:for(;g=r.distcode[u&(1<<r.distbits)-1],v=g>>>24,y=g>>>16&255,b=g&65535,!(v<=d);){if(l===0)break e;l--,u+=n[i++]<<d,d+=8}if(!(y&240)){for(N=v,j=y,_=b;g=r.distcode[_+((u&(1<<N+j)-1)>>N)],v=g>>>24,y=g>>>16&255,b=g&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,y&64){e.msg="invalid distance code",r.mode=Ks;break}r.offset=b,r.extra=y&15,r.mode=eU;case eU:if(r.extra){for(k=r.extra;d<k;){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=Ks;break}r.mode=tU;case tU: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=Ks;break}h>r.wnext?(h-=r.wnext,x=r.wsize-h):x=r.wnext-h,h>r.length&&(h=r.length),p=r.window}else p=a,x=o-r.offset,h=r.length;h>c&&(h=c),c-=h,r.length-=h;do a[o++]=p[x++];while(--h);r.length===0&&(r.mode=uS);break;case rU:if(c===0)break e;a[o++]=r.length,c--,r.mode=uS;break;case OT: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?Sd(r.check,a,m,o-m):_8(r.check,a,m,o-m)),m=c,r.wrap&4&&(r.flags?u:aU(u))!==r.check){e.msg="incorrect data check",r.mode=Ks;break}u=0,d=0}r.mode=nU;case nU: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=Ks;break}u=0,d=0}r.mode=sU;case sU:P=NLe;break e;case Ks:P=Moe;break e;case Boe:return $oe;case zoe:default:return iu}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<Ks&&(r.mode<OT||t!==Lq))&&Woe(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?Sd(r.check,a,m,e.next_out-m):_8(r.check,a,m,e.next_out-m)),e.data_type=r.bits+(r.last?64:0)+(r.mode===Lf?128:0)+(r.mode===cS||r.mode===PT?256:0),(f===0&&m===0||t===Lq)&&P===N0&&(P=kLe),P},RLe=e=>{if(K0(e))return iu;let t=e.state;return t.window&&(t.window=null),e.state=null,N0},LLe=(e,t)=>{if(K0(e))return iu;const r=e.state;return r.wrap&2?(r.head=t,t.done=!1,N0):iu},FLe=(e,t)=>{const r=t.length;let n,a,i;return K0(e)||(n=e.state,n.wrap!==0&&n.mode!==S4)?iu:n.mode===S4&&(a=1,a=_8(a,t,r,0),a!==n.check)?Moe:(i=Woe(e,t,r,r),i?(n.mode=Boe,$oe):(n.havedict=1,N0))};var MLe=Uoe,$Le=Voe,BLe=qoe,zLe=OLe,qLe=Hoe,ULe=ILe,VLe=RLe,HLe=LLe,WLe=FLe,GLe="pako inflate (from Nodeca project)",Uf={inflateReset:MLe,inflateReset2:$Le,inflateResetKeep:BLe,inflateInit:zLe,inflateInit2:qLe,inflate:ULe,inflateEnd:VLe,inflateGetHeader:HLe,inflateSetDictionary:WLe,inflateInfo:GLe};function KLe(){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 XLe=KLe;const Goe=Object.prototype.toString,{Z_NO_FLUSH:YLe,Z_FINISH:ZLe,Z_OK:R2,Z_STREAM_END:RT,Z_NEED_DICT:LT,Z_STREAM_ERROR:JLe,Z_DATA_ERROR:oU,Z_MEM_ERROR:QLe}=Doe;function m_(e){this.options=Ioe.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 mLe,this.strm.avail_out=0;let r=Uf.inflateInit2(this.strm,t.windowBits);if(r!==R2)throw new Error(N8[r]);if(this.header=new XLe,Uf.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=S8.string2buf(t.dictionary):Goe.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=Uf.inflateSetDictionary(this.strm,t.dictionary),r!==R2)))throw new Error(N8[r])}m_.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?ZLe:YLe,Goe.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=Uf.inflate(r,o),i===LT&&a&&(i=Uf.inflateSetDictionary(r,a),i===R2?i=Uf.inflate(r,o):i===oU&&(i=LT));r.avail_in>0&&i===RT&&r.state.wrap>0&&e[r.next_in]!==0;)Uf.inflateReset(r),i=Uf.inflate(r,o);switch(i){case JLe:case oU:case LT:case QLe:return this.onEnd(i),this.ended=!0,!1}if(l=r.avail_out,r.next_out&&(r.avail_out===0||i===RT))if(this.options.to==="string"){let c=S8.utf8border(r.output,r.next_out),u=r.next_out-c,d=S8.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===R2&&l===0)){if(i===RT)return i=Uf.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,!0;if(r.avail_in===0)break}}return!0};m_.prototype.onData=function(e){this.chunks.push(e)};m_.prototype.onEnd=function(e){e===R2&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Ioe.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function eFe(e,t){const r=new m_(t);if(r.push(e),r.err)throw r.msg||N8[r.err];return r.result}var tFe=m_,rFe=eFe,nFe={Inflate:tFe,inflate:rFe};const{Inflate:sFe,inflate:aFe}=nFe;var lU=sFe,iFe=aFe;const Koe=[];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;Koe[e]=t}const cU=4294967295;function oFe(e,t,r){let n=e;for(let a=0;a<r;a++)n=Koe[(n^t[a])&255]^n>>>8;return n}function lFe(e,t){return(oFe(cU,e,t)^cU)>>>0}function uU(e,t,r){const n=e.readUint32(),a=lFe(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 Xoe(e,t,r){for(let n=0;n<r;n++)t[n]=e[n]}function Yoe(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 Zoe(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 Joe(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 Qoe(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]+cFe(t[i-a],r[i],r[i-a])&255}}function cFe(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 uFe(e,t,r,n,a,i){switch(e){case 0:Xoe(t,r,a);break;case 1:Yoe(t,r,a,i);break;case 2:Zoe(t,r,n,a);break;case 3:Joe(t,r,n,a,i);break;case 4:Qoe(t,r,n,a,i);break;default:throw new Error(`Unsupported filter: ${e}`)}}const dFe=new Uint16Array([255]),fFe=new Uint8Array(dFe.buffer),hFe=fFe[0]===255;function mFe(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 x=m*l,p=new Uint8Array(x);for(let g=0;g<h;g++){const v=t[u++],y=t.subarray(u,u+x);u+=x;const b=new Uint8Array(x);uFe(v,y,b,p,x,l),p.set(b);for(let N=0;N<m;N++){const j=f.x+N*f.xStep,_=f.y+g*f.yStep;if(!(j>=r||_>=n))for(let S=0;S<l;S++)c[(_*r+j)*l+S]=b[N*l+S]}}}if(i===16){const d=new Uint16Array(c.buffer);if(hFe)for(let f=0;f<d.length;f++)d[f]=pFe(d[f]);return d}else return c}function pFe(e){return(e&255)<<8|e>>8&255}const xFe=new Uint16Array([255]),gFe=new Uint8Array(xFe.buffer),vFe=gFe[0]===255,yFe=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=yFe,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:Xoe(f,m,l);break;case 1:Yoe(f,m,l,o);break;case 2:Zoe(f,m,u,l);break;case 3:Joe(f,m,u,l,o);break;case 4:Qoe(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(vFe)for(let x=0;x<h.length;x++)h[x]=bFe(h[x]);return h}else return c}function bFe(e){return(e&255)<<8|e>>8&255}const j5=Uint8Array.of(137,80,78,71,13,10,26,10);function fU(e){if(!wFe(e.readBytes(j5.length)))throw new Error("wrong PNG signature")}function wFe(e){if(e.length<j5.length)return!1;for(let t=0;t<j5.length;t++)if(e[t]!==j5[t])return!1;return!0}const jFe="tEXt",_Fe=0,ele=new TextDecoder("latin1");function NFe(e){if(kFe(e),e.length===0||e.length>79)throw new Error("keyword length must be between 1 and 79")}const SFe=/^[\u0000-\u00FF]*$/;function kFe(e){if(!SFe.test(e))throw new Error("invalid latin1 text")}function CFe(e,t,r){const n=tle(t);e[n]=EFe(t,r-n.length-1)}function tle(e){for(e.mark();e.readByte()!==_Fe;);const t=e.offset;e.reset();const r=ele.decode(e.readBytes(t-e.offset-1));return e.skip(1),NFe(r),r}function EFe(e,t){return ele.decode(e.readBytes(t))}const Fl={UNKNOWN:-1,GREYSCALE:0,TRUECOLOUR:2,INDEXED_COLOUR:3,GREYSCALE_ALPHA:4,TRUECOLOUR_ALPHA:6},FT={UNKNOWN:-1,DEFLATE:0},hU={UNKNOWN:-1,ADAPTIVE:0},MT={UNKNOWN:-1,NO_INTERLACE:0,ADAM7:1},dS={NONE:0,BACKGROUND:1,PREVIOUS:2},$T={SOURCE:0,OVER:1};class AFe extends xF{constructor(r,n={}){super(r);Cn(this,"_checkCrc");Cn(this,"_inflator");Cn(this,"_png");Cn(this,"_apng");Cn(this,"_end");Cn(this,"_hasPalette");Cn(this,"_palette");Cn(this,"_hasTransparency");Cn(this,"_transparency");Cn(this,"_compressionMethod");Cn(this,"_filterMethod");Cn(this,"_interlaceMethod");Cn(this,"_colorType");Cn(this,"_isAnimated");Cn(this,"_numberOfFrames");Cn(this,"_numberOfPlays");Cn(this,"_frames");Cn(this,"_writingDataChunks");const{checkCrc:a=!1}=n;this._checkCrc=a,this._inflator=new lU,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=FT.UNKNOWN,this._filterMethod=hU.UNKNOWN,this._interlaceMethod=MT.UNKNOWN,this._colorType=Fl.UNKNOWN,this._isAnimated=!1,this._numberOfFrames=1,this._numberOfPlays=0,this._frames=[],this._writingDataChunks=!1,this.setBigEndian()}decode(){for(fU(this);!this._end;){const r=this.readUint32(),n=this.readChars(4);this.decodeChunk(r,n)}return this.decodeImage(),this._png}decodeApng(){for(fU(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 jFe:CFe(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?uU(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?uU(this,r+4,n):this.skip(4)}decodeIHDR(){const r=this._png;r.width=this.readUint32(),r.height=this.readUint32(),r.depth=TFe(this.readUint8());const n=this.readUint8();this._colorType=n;let a;switch(n){case Fl.GREYSCALE:a=1;break;case Fl.TRUECOLOUR:a=3;break;case Fl.INDEXED_COLOUR:a=1;break;case Fl.GREYSCALE_ALPHA:a=2;break;case Fl.TRUECOLOUR_ALPHA:a=4;break;case Fl.UNKNOWN:default:throw new Error(`Unknown color type: ${n}`)}if(this._png.channels=a,this._compressionMethod=this.readUint8(),this._compressionMethod!==FT.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 Fl.GREYSCALE:case Fl.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 Fl.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 Fl.UNKNOWN:case Fl.GREYSCALE_ALPHA:case Fl.TRUECOLOUR_ALPHA:default:throw new Error(`tRNS chunk is not supported for color type ${this._colorType}`)}}decodeiCCP(r){const n=tle(this),a=this.readUint8();if(a!==FT.DEFLATE)throw new Error(`Unsupported iCCP compression method: ${a}`);const i=this.readBytes(r-n.length-2);this._png.iccEmbeddedProfile={name:n,profile:iFe(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 dS.NONE:break;case dS.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 dS.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 $T.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 $T.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!==hU.ADAPTIVE)throw new Error(`Filter method ${this._filterMethod} not supported`);if(this._interlaceMethod===MT.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===MT.ADAM7)this._png.data=mFe({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:dS.NONE,blendOp:$T.SOURCE,data:r}),this._inflator=new lU,this._writingDataChunks=!1}}function TFe(e){if(e!==1&&e!==2&&e!==4&&e!==8&&e!==16)throw new Error(`invalid bit depth: ${e}`);return e}var mU;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.METRE=1]="METRE"})(mU||(mU={}));function PFe(e,t){return new AFe(e,t).decode()}var zr=function(){return typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:this}();function BT(){zr.console&&typeof zr.console.log=="function"&&zr.console.log.apply(zr.console,arguments)}var gs={log:BT,warn:function(e){zr.console&&(typeof zr.console.warn=="function"?zr.console.warn.apply(zr.console,arguments):BT.call(null,arguments))},error:function(e){zr.console&&(typeof zr.console.error=="function"?zr.console.error.apply(zr.console,arguments):BT(e))}};function zT(e,t,r){var n=new XMLHttpRequest;n.open("GET",e),n.responseType="blob",n.onload=function(){hx(n.response,t,r)},n.onerror=function(){gs.error("could not download file")},n.send()}function pU(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function fS(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 hx=zr.saveAs||((typeof window>"u"?"undefined":os(window))!=="object"||window!==zr?function(){}:typeof HTMLAnchorElement<"u"&&"download"in HTMLAnchorElement.prototype?function(e,t,r){var n=zr.URL||zr.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?pU(a.href)?zT(e,t,r):fS(a,a.target="_blank"):fS(a)):(a.href=n.createObjectURL(e),setTimeout(function(){n.revokeObjectURL(a.href)},4e4),setTimeout(function(){fS(a)},0))}:"msSaveOrOpenBlob"in navigator?function(e,t,r){if(t=t||e.name||"download",typeof e=="string")if(pU(e))zT(e,t,r);else{var n=document.createElement("a");n.href=e,n.target="_blank",setTimeout(function(){fS(n)})}else navigator.msSaveOrOpenBlob(function(a,i){return i===void 0?i={autoBom:!1}:os(i)!=="object"&&(gs.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 zT(e,t,r);var a=e.type==="application/octet-stream",i=/constructor/i.test(zr.HTMLElement)||zr.safari,o=/CriOS\/[\d]+/.test(navigator.userAgent);if((o||a&&i)&&(typeof FileReader>"u"?"undefined":os(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=zr.URL||zr.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 rle(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 _5=zr.atob.bind(zr),xU=zr.btoa.bind(zr);/**
* @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 qT(e,t){var r=e[0],n=e[1],a=e[2],i=e[3];r=co(r,n,a,i,t[0],7,-680876936),i=co(i,r,n,a,t[1],12,-389564586),a=co(a,i,r,n,t[2],17,606105819),n=co(n,a,i,r,t[3],22,-1044525330),r=co(r,n,a,i,t[4],7,-176418897),i=co(i,r,n,a,t[5],12,1200080426),a=co(a,i,r,n,t[6],17,-1473231341),n=co(n,a,i,r,t[7],22,-45705983),r=co(r,n,a,i,t[8],7,1770035416),i=co(i,r,n,a,t[9],12,-1958414417),a=co(a,i,r,n,t[10],17,-42063),n=co(n,a,i,r,t[11],22,-1990404162),r=co(r,n,a,i,t[12],7,1804603682),i=co(i,r,n,a,t[13],12,-40341101),a=co(a,i,r,n,t[14],17,-1502002290),r=uo(r,n=co(n,a,i,r,t[15],22,1236535329),a,i,t[1],5,-165796510),i=uo(i,r,n,a,t[6],9,-1069501632),a=uo(a,i,r,n,t[11],14,643717713),n=uo(n,a,i,r,t[0],20,-373897302),r=uo(r,n,a,i,t[5],5,-701558691),i=uo(i,r,n,a,t[10],9,38016083),a=uo(a,i,r,n,t[15],14,-660478335),n=uo(n,a,i,r,t[4],20,-405537848),r=uo(r,n,a,i,t[9],5,568446438),i=uo(i,r,n,a,t[14],9,-1019803690),a=uo(a,i,r,n,t[3],14,-187363961),n=uo(n,a,i,r,t[8],20,1163531501),r=uo(r,n,a,i,t[13],5,-1444681467),i=uo(i,r,n,a,t[2],9,-51403784),a=uo(a,i,r,n,t[7],14,1735328473),r=fo(r,n=uo(n,a,i,r,t[12],20,-1926607734),a,i,t[5],4,-378558),i=fo(i,r,n,a,t[8],11,-2022574463),a=fo(a,i,r,n,t[11],16,1839030562),n=fo(n,a,i,r,t[14],23,-35309556),r=fo(r,n,a,i,t[1],4,-1530992060),i=fo(i,r,n,a,t[4],11,1272893353),a=fo(a,i,r,n,t[7],16,-155497632),n=fo(n,a,i,r,t[10],23,-1094730640),r=fo(r,n,a,i,t[13],4,681279174),i=fo(i,r,n,a,t[0],11,-358537222),a=fo(a,i,r,n,t[3],16,-722521979),n=fo(n,a,i,r,t[6],23,76029189),r=fo(r,n,a,i,t[9],4,-640364487),i=fo(i,r,n,a,t[12],11,-421815835),a=fo(a,i,r,n,t[15],16,530742520),r=ho(r,n=fo(n,a,i,r,t[2],23,-995338651),a,i,t[0],6,-198630844),i=ho(i,r,n,a,t[7],10,1126891415),a=ho(a,i,r,n,t[14],15,-1416354905),n=ho(n,a,i,r,t[5],21,-57434055),r=ho(r,n,a,i,t[12],6,1700485571),i=ho(i,r,n,a,t[3],10,-1894986606),a=ho(a,i,r,n,t[10],15,-1051523),n=ho(n,a,i,r,t[1],21,-2054922799),r=ho(r,n,a,i,t[8],6,1873313359),i=ho(i,r,n,a,t[15],10,-30611744),a=ho(a,i,r,n,t[6],15,-1560198380),n=ho(n,a,i,r,t[13],21,1309151649),r=ho(r,n,a,i,t[4],6,-145523070),i=ho(i,r,n,a,t[11],10,-1120210379),a=ho(a,i,r,n,t[2],15,718787259),n=ho(n,a,i,r,t[9],21,-343485551),e[0]=Rm(r,e[0]),e[1]=Rm(n,e[1]),e[2]=Rm(a,e[2]),e[3]=Rm(i,e[3])}function xE(e,t,r,n,a,i){return t=Rm(Rm(t,e),Rm(n,i)),Rm(t<<a|t>>>32-a,r)}function co(e,t,r,n,a,i,o){return xE(t&r|~t&n,e,t,a,i,o)}function uo(e,t,r,n,a,i,o){return xE(t&n|r&~n,e,t,a,i,o)}function fo(e,t,r,n,a,i,o){return xE(t^r^n,e,t,a,i,o)}function ho(e,t,r,n,a,i,o){return xE(r^(t|~n),e,t,a,i,o)}function nle(e){var t,r=e.length,n=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=e.length;t+=64)qT(n,OFe(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(qT(n,a),t=0;t<16;t++)a[t]=0;return a[14]=8*r,qT(n,a),n}function OFe(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 gU="0123456789abcdef".split("");function DFe(e){for(var t="",r=0;r<4;r++)t+=gU[e>>8*r+4&15]+gU[e>>8*r&15];return t}function IFe(e){return String.fromCharCode(255&e,(65280&e)>>8,(16711680&e)>>16,(4278190080&e)>>24)}function k8(e){return nle(e).map(IFe).join("")}var RFe=function(e){for(var t=0;t<e.length;t++)e[t]=DFe(e[t]);return e.join("")}(nle("hello"))!="5d41402abc4b2a76b9719d911017c592";function Rm(e,t){if(RFe){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 C8(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,x="";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],x+=String.fromCharCode(t.charCodeAt(c)^o);return x}/**
* @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 vU={print:4,modify:8,copy:16,"annot-forms":32};function Kg(e,t,r,n){this.v=1,this.r=2;var a=192;e.forEach(function(l){if(vU.perm!==void 0)throw new Error("Invalid permission: "+l);a+=vU[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=k8(i+this.O+this.lsbFirstWord(this.P)+this.hexToBytes(n)).substr(0,5),this.U=C8(this.encryptionKey,this.padding)}function Xg(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 yU(e){if(os(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){zr.console&&gs.error("jsPDF PubSub Error",l.message,l)}o[1]&&a.push(i)}a.length&&a.forEach(this.unsubscribe)}},this.getTopics=function(){return t}}function L2(e){if(!(this instanceof L2))return new L2(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 sle(e,t){this.gState=e,this.matrix=t,this.id="",this.objectNumber=-1}function xm(e,t,r,n,a){if(!(this instanceof xm))return new xm(e,t,r,n,a);this.type=e==="axial"?2:3,this.coords=t,this.colors=r,sle.call(this,n,a)}function Ax(e,t,r,n,a){if(!(this instanceof Ax))return new Ax(e,t,r,n,a);this.boundingBox=e,this.xStep=t,this.yStep=r,this.stream="",this.cloneIndex=0,sle.call(this,n,a)}function lr(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;os(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=yU;var x="1.3",p=h.__private__.getPdfVersion=function(){return x};h.__private__.setPdfVersion=function(G){x=G};var g={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 g};var v=h.__private__.getPageFormat=function(G){return g[G]};a=a||"a4";var y="compat",b="advanced",N=y;function j(){this.saveGraphicsState(),Z(new Xt(Fe,0,0,-Fe,0,Gp()*Fe).toString()+" cm"),this.setFontSize(this.getFontSize()/Fe),u="n",N=b}function _(){this.restoreGraphicsState(),u="S",N=y}var S=h.__private__.combineFontStyleAndFontWeight=function(G,ue){if(G=="bold"&&ue=="normal"||G=="bold"&&ue==400||G=="normal"&&ue=="italic"||G=="bold"&&ue=="italic")throw new Error("Invalid Combination of fontweight and fontstyle");return ue&&(G=ue==400||ue==="normal"?G==="italic"?"italic":"normal":ue!=700&&ue!=="bold"||G!=="normal"?(ue==700?"bold":ue)+""+G:"bold"),G};h.advancedAPI=function(G){var ue=N===y;return ue&&j.call(this),typeof G!="function"||(G(this),ue&&_.call(this)),this},h.compatAPI=function(G){var ue=N===b;return ue&&_.call(this),typeof G!="function"||(G(this),ue&&j.call(this)),this},h.isAdvancedAPI=function(){return N===b};var P,T=function(G){if(N!==b)throw new Error(G+" is only available in 'advanced' API mode. You need to call advancedAPI() first.")},R=h.roundToPrecision=h.__private__.roundToPrecision=function(G,ue){var Ie=t||ue;if(isNaN(G)||isNaN(Ie))throw new Error("Invalid argument passed to jsPDF.roundToPrecision");return G.toFixed(Ie).replace(/0+$/,"")};P=h.hpf=h.__private__.hpf=typeof c=="number"?function(G){if(isNaN(G))throw new Error("Invalid argument passed to jsPDF.hpf");return R(G,c)}:c==="smart"?function(G){if(isNaN(G))throw new Error("Invalid argument passed to jsPDF.hpf");return R(G,G>-1&&G<1?16:5)}:function(G){if(isNaN(G))throw new Error("Invalid argument passed to jsPDF.hpf");return R(G,16)};var k=h.f2=h.__private__.f2=function(G){if(isNaN(G))throw new Error("Invalid argument passed to jsPDF.f2");return R(G,2)},E=h.__private__.f3=function(G){if(isNaN(G))throw new Error("Invalid argument passed to jsPDF.f3");return R(G,3)},q=h.scale=h.__private__.scale=function(G){if(isNaN(G))throw new Error("Invalid argument passed to jsPDF.scale");return N===y?G*Fe:N===b?G:void 0},O=function(G){return q(function(ue){return N===y?Gp()-ue:N===b?ue:void 0}(G))};h.__private__.setPrecision=h.setPrecision=function(G){typeof parseInt(G,10)=="number"&&(t=parseInt(G,10))};var L,H="00000000000000000000000000000000",V=h.__private__.getFileId=function(){return H},z=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&&(si=new Kg(d.userPermissions,d.userPassword,d.ownerPassword,H)),H};h.setFileId=function(G){return z(G),this},h.getFileId=function(){return V()};var M=h.__private__.convertDateToPDFDate=function(G){var ue=G.getTimezoneOffset(),Ie=ue<0?"+":"-",ze=Math.floor(Math.abs(ue/60)),Je=Math.abs(ue%60),vt=[Ie,I(ze),"'",I(Je),"'"].join("");return["D:",G.getFullYear(),I(G.getMonth()+1),I(G.getDate()),I(G.getHours()),I(G.getMinutes()),I(G.getSeconds()),vt].join("")},B=h.__private__.convertPDFDateToDate=function(G){var ue=parseInt(G.substr(2,4),10),Ie=parseInt(G.substr(6,2),10)-1,ze=parseInt(G.substr(8,2),10),Je=parseInt(G.substr(10,2),10),vt=parseInt(G.substr(12,2),10),_t=parseInt(G.substr(14,2),10);return new Date(ue,Ie,ze,Je,vt,_t,0)},K=h.__private__.setCreationDate=function(G){var ue;if(G===void 0&&(G=new Date),G instanceof Date)ue=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");ue=G}return L=ue},C=h.__private__.getCreationDate=function(G){var ue=L;return G==="jsDate"&&(ue=B(L)),ue};h.setCreationDate=function(G){return K(G),this},h.getCreationDate=function(G){return C(G)};var A,I=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,te=[],re=[],J=0,ie=[],be=[],Q=!1,Ve=re;h.__private__.setCustomOutputDestination=function(G){Q=!0,Ve=G};var W=function(G){Q||(Ve=G)};h.__private__.resetCustomOutputDestination=function(){Q=!1,Ve=re};var Z=h.__private__.out=function(G){return G=G.toString(),J+=G.length+1,Ve.push(G),Ve},he=h.__private__.write=function(G){return Z(arguments.length===1?G.toString():Array.prototype.join.call(arguments," "))},se=h.__private__.getArrayBuffer=function(G){for(var ue=G.length,Ie=new ArrayBuffer(ue),ze=new Uint8Array(Ie);ue--;)ze[ue]=G.charCodeAt(ue);return Ie},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 le=e.fontSize||16;h.__private__.setFontSize=h.setFontSize=function(G){return le=N===b?G/Fe:G,this};var Me,de=h.__private__.getFontSize=h.getFontSize=function(){return N===y?le:le*Fe},me=e.R2L||!1;h.__private__.setR2L=h.setR2L=function(G){return me=G,this},h.__private__.getR2L=h.getR2L=function(){return me};var Le,Ke=h.__private__.setZoomMode=function(G){if(/^(?:\d+\.\d*|\d*\.\d+|\d+)%$/.test(G))Me=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.');Me=G}else Me=parseInt(G,10)};h.__private__.getZoomMode=function(){return Me};var ve,_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.');Le=G};h.__private__.getPageMode=function(){return Le};var Ue=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.');ve=G};h.__private__.getLayoutMode=function(){return ve},h.__private__.setDisplayMode=h.setDisplayMode=function(G,ue,Ie){return Ke(G),Ue(ue),_e(Ie),this};var Qe={title:"",subject:"",author:"",keywords:"",creator:""};h.__private__.getDocumentProperty=function(G){if(Object.keys(Qe).indexOf(G)===-1)throw new Error("Invalid argument passed to jsPDF.getDocumentProperty");return Qe[G]},h.__private__.getDocumentProperties=function(){return Qe},h.__private__.setDocumentProperties=h.setProperties=h.setDocumentProperties=function(G){for(var ue in Qe)Qe.hasOwnProperty(ue)&&G[ue]&&(Qe[ue]=G[ue]);return this},h.__private__.setDocumentProperty=function(G,ue){if(Object.keys(Qe).indexOf(G)===-1)throw new Error("Invalid arguments passed to jsPDF.setDocumentProperty");return Qe[G]=ue};var st,Fe,Ge,ht,ut,Mt={},Wt={},zt=[],Lt={},or={},Yt={},ot={},fr=null,Et=0,Ct=[],hr=new yU(h),Gt=e.hotfixes||[],Jt={},mr={},mn=[],Xt=function G(ue,Ie,ze,Je,vt,_t){if(!(this instanceof G))return new G(ue,Ie,ze,Je,vt,_t);isNaN(ue)&&(ue=1),isNaN(Ie)&&(Ie=0),isNaN(ze)&&(ze=0),isNaN(Je)&&(Je=1),isNaN(vt)&&(vt=0),isNaN(_t)&&(_t=0),this._matrix=[ue,Ie,ze,Je,vt,_t]};Object.defineProperty(Xt.prototype,"sx",{get:function(){return this._matrix[0]},set:function(G){this._matrix[0]=G}}),Object.defineProperty(Xt.prototype,"shy",{get:function(){return this._matrix[1]},set:function(G){this._matrix[1]=G}}),Object.defineProperty(Xt.prototype,"shx",{get:function(){return this._matrix[2]},set:function(G){this._matrix[2]=G}}),Object.defineProperty(Xt.prototype,"sy",{get:function(){return this._matrix[3]},set:function(G){this._matrix[3]=G}}),Object.defineProperty(Xt.prototype,"tx",{get:function(){return this._matrix[4]},set:function(G){this._matrix[4]=G}}),Object.defineProperty(Xt.prototype,"ty",{get:function(){return this._matrix[5]},set:function(G){this._matrix[5]=G}}),Object.defineProperty(Xt.prototype,"a",{get:function(){return this._matrix[0]},set:function(G){this._matrix[0]=G}}),Object.defineProperty(Xt.prototype,"b",{get:function(){return this._matrix[1]},set:function(G){this._matrix[1]=G}}),Object.defineProperty(Xt.prototype,"c",{get:function(){return this._matrix[2]},set:function(G){this._matrix[2]=G}}),Object.defineProperty(Xt.prototype,"d",{get:function(){return this._matrix[3]},set:function(G){this._matrix[3]=G}}),Object.defineProperty(Xt.prototype,"e",{get:function(){return this._matrix[4]},set:function(G){this._matrix[4]=G}}),Object.defineProperty(Xt.prototype,"f",{get:function(){return this._matrix[5]},set:function(G){this._matrix[5]=G}}),Object.defineProperty(Xt.prototype,"rotation",{get:function(){return Math.atan2(this.shx,this.sx)}}),Object.defineProperty(Xt.prototype,"scaleX",{get:function(){return this.decompose().scale.sx}}),Object.defineProperty(Xt.prototype,"scaleY",{get:function(){return this.decompose().scale.sy}}),Object.defineProperty(Xt.prototype,"isIdentity",{get:function(){return this.sx===1&&this.shy===0&&this.shx===0&&this.sy===1&&this.tx===0&&this.ty===0}}),Xt.prototype.join=function(G){return[this.sx,this.shy,this.shx,this.sy,this.tx,this.ty].map(P).join(G)},Xt.prototype.multiply=function(G){var ue=G.sx*this.sx+G.shy*this.shx,Ie=G.sx*this.shy+G.shy*this.sy,ze=G.shx*this.sx+G.sy*this.shx,Je=G.shx*this.shy+G.sy*this.sy,vt=G.tx*this.sx+G.ty*this.shx+this.tx,_t=G.tx*this.shy+G.ty*this.sy+this.ty;return new Xt(ue,Ie,ze,Je,vt,_t)},Xt.prototype.decompose=function(){var G=this.sx,ue=this.shy,Ie=this.shx,ze=this.sy,Je=this.tx,vt=this.ty,_t=Math.sqrt(G*G+ue*ue),ir=(G/=_t)*Ie+(ue/=_t)*ze;Ie-=G*ir,ze-=ue*ir;var xr=Math.sqrt(Ie*Ie+ze*ze);return ir/=xr,G*(ze/=xr)<ue*(Ie/=xr)&&(G=-G,ue=-ue,ir=-ir,_t=-_t),{scale:new Xt(_t,0,0,xr,0,0),translate:new Xt(1,0,0,1,Je,vt),rotate:new Xt(G,ue,-ue,G,0,0),skew:new Xt(1,0,ir,1,0,0)}},Xt.prototype.toString=function(G){return this.join(" ")},Xt.prototype.inversed=function(){var G=this.sx,ue=this.shy,Ie=this.shx,ze=this.sy,Je=this.tx,vt=this.ty,_t=1/(G*ze-ue*Ie),ir=ze*_t,xr=-ue*_t,Hr=-Ie*_t,nn=G*_t;return new Xt(ir,xr,Hr,nn,-ir*Je-Hr*vt,-xr*Je-nn*vt)},Xt.prototype.applyToPoint=function(G){var ue=G.x*this.sx+G.y*this.shx+this.tx,Ie=G.x*this.shy+G.y*this.sy+this.ty;return new wf(ue,Ie)},Xt.prototype.applyToRectangle=function(G){var ue=this.applyToPoint(G),Ie=this.applyToPoint(new wf(G.x+G.w,G.y+G.h));return new J1(ue.x,ue.y,Ie.x-ue.x,Ie.y-ue.y)},Xt.prototype.clone=function(){var G=this.sx,ue=this.shy,Ie=this.shx,ze=this.sy,Je=this.tx,vt=this.ty;return new Xt(G,ue,Ie,ze,Je,vt)},h.Matrix=Xt;var fn=h.matrixMult=function(G,ue){return ue.multiply(G)},Xn=new Xt(1,0,0,1,0,0);h.unitMatrix=h.identityMatrix=Xn;var rn=function(G,ue){if(!or[G]){var Ie=(ue instanceof xm?"Sh":"P")+(Object.keys(Lt).length+1).toString(10);ue.id=Ie,or[G]=Ie,Lt[Ie]=ue,hr.publish("addPattern",ue)}};h.ShadingPattern=xm,h.TilingPattern=Ax,h.addShadingPattern=function(G,ue){return T("addShadingPattern()"),rn(G,ue),this},h.beginTilingPattern=function(G){T("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,ue){T("endTilingPattern()"),ue.stream=be[A].join(`
`),rn(G,ue),hr.publish("endTilingPattern",ue),mn.pop().restore()};var wn,On=h.__private__.newObject=function(){var G=ts();return pe(G,!0),G},ts=h.__private__.newObjectDeferred=function(){return Y++,te[Y]=function(){return J},Y},pe=function(G,ue){return ue=typeof ue=="boolean"&&ue,te[G]=J,ue&&Z(G+" 0 obj"),G},Ae=h.__private__.newAdditionalObject=function(){var G={objId:ts(),content:""};return ie.push(G),G},Ne=ts(),ke=ts(),Pe=h.__private__.decodeColorString=function(G){var ue=G.split(" ");if(ue.length!==2||ue[1]!=="g"&&ue[1]!=="G")ue.length!==5||ue[4]!=="k"&&ue[4]!=="K"||(ue=[(1-ue[0])*(1-ue[3]),(1-ue[1])*(1-ue[3]),(1-ue[2])*(1-ue[3]),"r"]);else{var Ie=parseFloat(ue[0]);ue=[Ie,Ie,Ie,"r"]}for(var ze="#",Je=0;Je<3;Je++)ze+=("0"+Math.floor(255*parseFloat(ue[Je])).toString(16)).slice(-2);return ze},Re=h.__private__.encodeColorString=function(G){var ue;typeof G=="string"&&(G={ch1:G});var Ie=G.ch1,ze=G.ch2,Je=G.ch3,vt=G.ch4,_t=G.pdfColorType==="draw"?["G","RG","K"]:["g","rg","k"];if(typeof Ie=="string"&&Ie.charAt(0)!=="#"){var ir=new rle(Ie);if(ir.ok)Ie=ir.toHex();else if(!/^\d*\.?\d*$/.test(Ie))throw new Error('Invalid color "'+Ie+'" passed to jsPDF.encodeColorString.')}if(typeof Ie=="string"&&/^#[0-9A-Fa-f]{3}$/.test(Ie)&&(Ie="#"+Ie[1]+Ie[1]+Ie[2]+Ie[2]+Ie[3]+Ie[3]),typeof Ie=="string"&&/^#[0-9A-Fa-f]{6}$/.test(Ie)){var xr=parseInt(Ie.substr(1),16);Ie=xr>>16&255,ze=xr>>8&255,Je=255&xr}if(ze===void 0||vt===void 0&&Ie===ze&&ze===Je)ue=typeof Ie=="string"?Ie+" "+_t[0]:G.precision===2?k(Ie/255)+" "+_t[0]:E(Ie/255)+" "+_t[0];else if(vt===void 0||os(vt)==="object"){if(vt&&!isNaN(vt.a)&&vt.a===0)return["1.","1.","1.",_t[1]].join(" ");ue=typeof Ie=="string"?[Ie,ze,Je,_t[1]].join(" "):G.precision===2?[k(Ie/255),k(ze/255),k(Je/255),_t[1]].join(" "):[E(Ie/255),E(ze/255),E(Je/255),_t[1]].join(" ")}else ue=typeof Ie=="string"?[Ie,ze,Je,vt,_t[2]].join(" "):G.precision===2?[k(Ie),k(ze),k(Je),k(vt),_t[2]].join(" "):[E(Ie),E(ze),E(Je),E(vt),_t[2]].join(" ");return ue},Ce=h.__private__.getFilters=function(){return o},$e=h.__private__.putStream=function(G){var ue=(G=G||{}).data||"",Ie=G.filters||Ce(),ze=G.alreadyAppliedFilters||[],Je=G.addLength1||!1,vt=ue.length,_t=G.objectId,ir=function(ai){return ai};if(d!==null&&_t===void 0)throw new Error("ObjectId must be passed to putStream for file encryption");d!==null&&(ir=si.encryptor(_t,0));var xr={};Ie===!0&&(Ie=["FlateEncode"]);var Hr=G.additionalKeyValues||[],nn=(xr=lr.API.processDataByFilters!==void 0?lr.API.processDataByFilters(ue,Ie):{data:ue,reverseChain:[]}).reverseChain+(Array.isArray(ze)?ze.join(" "):ze.toString());if(xr.data.length!==0&&(Hr.push({key:"Length",value:xr.data.length}),Je===!0&&Hr.push({key:"Length1",value:vt})),nn.length!=0)if(nn.split("/").length-1==1)Hr.push({key:"Filter",value:nn});else{Hr.push({key:"Filter",value:"["+nn+"]"});for(var Dn=0;Dn<Hr.length;Dn+=1)if(Hr[Dn].key==="DecodeParms"){for(var ra=[],qa=0;qa<xr.reverseChain.split("/").length-1;qa+=1)ra.push("null");ra.push(Hr[Dn].value),Hr[Dn].value="["+ra.join(" ")+"]"}}Z("<<");for(var _s=0;_s<Hr.length;_s++)Z("/"+Hr[_s].key+" "+Hr[_s].value);Z(">>"),xr.data.length!==0&&(Z("stream"),Z(ir(xr.data)),Z("endstream"))},Be=h.__private__.putPage=function(G){var ue=G.number,Ie=G.data,ze=G.objId,Je=G.contentsObjId;pe(ze,!0),Z("<</Type /Page"),Z("/Parent "+G.rootDictionaryObjId+" 0 R"),Z("/Resources "+G.resourceDictionaryObjId+" 0 R"),Z("/MediaBox ["+parseFloat(P(G.mediaBox.bottomLeftX))+" "+parseFloat(P(G.mediaBox.bottomLeftY))+" "+P(G.mediaBox.topRightX)+" "+P(G.mediaBox.topRightY)+"]"),G.cropBox!==null&&Z("/CropBox ["+P(G.cropBox.bottomLeftX)+" "+P(G.cropBox.bottomLeftY)+" "+P(G.cropBox.topRightX)+" "+P(G.cropBox.topRightY)+"]"),G.bleedBox!==null&&Z("/BleedBox ["+P(G.bleedBox.bottomLeftX)+" "+P(G.bleedBox.bottomLeftY)+" "+P(G.bleedBox.topRightX)+" "+P(G.bleedBox.topRightY)+"]"),G.trimBox!==null&&Z("/TrimBox ["+P(G.trimBox.bottomLeftX)+" "+P(G.trimBox.bottomLeftY)+" "+P(G.trimBox.topRightX)+" "+P(G.trimBox.topRightY)+"]"),G.artBox!==null&&Z("/ArtBox ["+P(G.artBox.bottomLeftX)+" "+P(G.artBox.bottomLeftY)+" "+P(G.artBox.topRightX)+" "+P(G.artBox.topRightY)+"]"),typeof G.userUnit=="number"&&G.userUnit!==1&&Z("/UserUnit "+G.userUnit),hr.publish("putPage",{objId:ze,pageContext:Ct[ue],pageNumber:ue,page:Ie}),Z("/Contents "+Je+" 0 R"),Z(">>"),Z("endobj");var vt=Ie.join(`
`);return N===b&&(vt+=`
Q`),pe(Je,!0),$e({data:vt,filters:Ce(),objectId:Je}),Z("endobj"),ze},Ze=h.__private__.putPages=function(){var G,ue,Ie=[];for(G=1;G<=Et;G++)Ct[G].objId=ts(),Ct[G].contentsObjId=ts();for(G=1;G<=Et;G++)Ie.push(Be({number:G,data:be[G],objId:Ct[G].objId,contentsObjId:Ct[G].contentsObjId,mediaBox:Ct[G].mediaBox,cropBox:Ct[G].cropBox,bleedBox:Ct[G].bleedBox,trimBox:Ct[G].trimBox,artBox:Ct[G].artBox,userUnit:Ct[G].userUnit,rootDictionaryObjId:Ne,resourceDictionaryObjId:ke}));pe(Ne,!0),Z("<</Type /Pages");var ze="/Kids [";for(ue=0;ue<Et;ue++)ze+=Ie[ue]+" 0 R ";Z(ze+"]"),Z("/Count "+Et),Z(">>"),Z("endobj"),hr.publish("postPutPages")},et=function(G){hr.publish("putFont",{font:G,out:Z,newObject:On,putStream:$e}),G.isAlreadyPutted!==!0&&(G.objectNumber=On(),Z("<<"),Z("/Type /Font"),Z("/BaseFont /"+Xg(G.postScriptName)),Z("/Subtype /Type1"),typeof G.encoding=="string"&&Z("/Encoding /"+G.encoding),Z("/FirstChar 32"),Z("/LastChar 255"),Z(">>"),Z("endobj"))},wt=function(G){G.objectNumber=On();var ue=[];ue.push({key:"Type",value:"/XObject"}),ue.push({key:"Subtype",value:"/Form"}),ue.push({key:"BBox",value:"["+[P(G.x),P(G.y),P(G.x+G.width),P(G.y+G.height)].join(" ")+"]"}),ue.push({key:"Matrix",value:"["+G.matrix.toString()+"]"});var Ie=G.pages[1].join(`
`);$e({data:Ie,additionalKeyValues:ue,objectId:G.objectNumber}),Z("endobj")},Rt=function(G,ue){ue||(ue=21);var Ie=On(),ze=function(_t,ir){var xr,Hr=[],nn=1/(ir-1);for(xr=0;xr<1;xr+=nn)Hr.push(xr);if(Hr.push(1),_t[0].offset!=0){var Dn={offset:0,color:_t[0].color};_t.unshift(Dn)}if(_t[_t.length-1].offset!=1){var ra={offset:1,color:_t[_t.length-1].color};_t.push(ra)}for(var qa="",_s=0,ai=0;ai<Hr.length;ai++){for(xr=Hr[ai];xr>_t[_s+1].offset;)_s++;var Ua=_t[_s].offset,zi=(xr-Ua)/(_t[_s+1].offset-Ua),Nf=_t[_s].color,gu=_t[_s+1].color;qa+=U(Math.round((1-zi)*Nf[0]+zi*gu[0]).toString(16))+U(Math.round((1-zi)*Nf[1]+zi*gu[1]).toString(16))+U(Math.round((1-zi)*Nf[2]+zi*gu[2]).toString(16))}return qa.trim()}(G.colors,ue),Je=[];Je.push({key:"FunctionType",value:"0"}),Je.push({key:"Domain",value:"[0.0 1.0]"}),Je.push({key:"Size",value:"["+ue+"]"}),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]"}),$e({data:ze,additionalKeyValues:Je,alreadyAppliedFilters:["/ASCIIHexDecode"],objectId:Ie}),Z("endobj"),G.objectNumber=On(),Z("<< /ShadingType "+G.type),Z("/ColorSpace /DeviceRGB");var vt="/Coords ["+P(parseFloat(G.coords[0]))+" "+P(parseFloat(G.coords[1]))+" ";G.type===2?vt+=P(parseFloat(G.coords[2]))+" "+P(parseFloat(G.coords[3])):vt+=P(parseFloat(G.coords[2]))+" "+P(parseFloat(G.coords[3]))+" "+P(parseFloat(G.coords[4]))+" "+P(parseFloat(G.coords[5])),Z(vt+="]"),G.matrix&&Z("/Matrix ["+G.matrix.toString()+"]"),Z("/Function "+Ie+" 0 R"),Z("/Extend [true true]"),Z(">>"),Z("endobj")},qt=function(G,ue){var Ie=ts(),ze=On();ue.push({resourcesOid:Ie,objectOid:ze}),G.objectNumber=ze;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(P).join(" ")+"]"}),Je.push({key:"XStep",value:P(G.xStep)}),Je.push({key:"YStep",value:P(G.yStep)}),Je.push({key:"Resources",value:Ie+" 0 R"}),G.matrix&&Je.push({key:"Matrix",value:"["+G.matrix.toString()+"]"}),$e({data:G.stream,additionalKeyValues:Je,objectId:G.objectNumber}),Z("endobj")},Pt=function(G){for(var ue in G.objectNumber=On(),Z("<<"),G)switch(ue){case"opacity":Z("/ca "+k(G[ue]));break;case"stroke-opacity":Z("/CA "+k(G[ue]))}Z(">>"),Z("endobj")},Ht=function(G){pe(G.resourcesOid,!0),Z("<<"),Z("/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]"),function(){for(var ue in Z("/Font <<"),Mt)Mt.hasOwnProperty(ue)&&(f===!1||f===!0&&m.hasOwnProperty(ue))&&Z("/"+ue+" "+Mt[ue].objectNumber+" 0 R");Z(">>")}(),function(){if(Object.keys(Lt).length>0){for(var ue in Z("/Shading <<"),Lt)Lt.hasOwnProperty(ue)&&Lt[ue]instanceof xm&&Lt[ue].objectNumber>=0&&Z("/"+ue+" "+Lt[ue].objectNumber+" 0 R");hr.publish("putShadingPatternDict"),Z(">>")}}(),function(ue){if(Object.keys(Lt).length>0){for(var Ie in Z("/Pattern <<"),Lt)Lt.hasOwnProperty(Ie)&&Lt[Ie]instanceof h.TilingPattern&&Lt[Ie].objectNumber>=0&&Lt[Ie].objectNumber<ue&&Z("/"+Ie+" "+Lt[Ie].objectNumber+" 0 R");hr.publish("putTilingPatternDict"),Z(">>")}}(G.objectOid),function(){if(Object.keys(Yt).length>0){var ue;for(ue in Z("/ExtGState <<"),Yt)Yt.hasOwnProperty(ue)&&Yt[ue].objectNumber>=0&&Z("/"+ue+" "+Yt[ue].objectNumber+" 0 R");hr.publish("putGStateDict"),Z(">>")}}(),function(){for(var ue in Z("/XObject <<"),Jt)Jt.hasOwnProperty(ue)&&Jt[ue].objectNumber>=0&&Z("/"+ue+" "+Jt[ue].objectNumber+" 0 R");hr.publish("putXobjectDict"),Z(">>")}(),Z(">>"),Z("endobj")},Rr=function(G){Wt[G.fontName]=Wt[G.fontName]||{},Wt[G.fontName][G.fontStyle]=G.id},ds=function(G,ue,Ie,ze,Je){var vt={id:"F"+(Object.keys(Mt).length+1).toString(10),postScriptName:G,fontName:ue,fontStyle:Ie,encoding:ze,isStandardFont:Je||!1,metadata:{}};return hr.publish("addFont",{font:vt,instance:this}),Mt[vt.id]=vt,Rr(vt),vt.id},jn=h.__private__.pdfEscape=h.pdfEscape=function(G,ue){return function(Ie,ze){var Je,vt,_t,ir,xr,Hr,nn,Dn,ra;if(_t=(ze=ze||{}).sourceEncoding||"Unicode",xr=ze.outputEncoding,(ze.autoencode||xr)&&Mt[st].metadata&&Mt[st].metadata[_t]&&Mt[st].metadata[_t].encoding&&(ir=Mt[st].metadata[_t].encoding,!xr&&Mt[st].encoding&&(xr=Mt[st].encoding),!xr&&ir.codePages&&(xr=ir.codePages[0]),typeof xr=="string"&&(xr=ir[xr]),xr)){for(nn=!1,Hr=[],Je=0,vt=Ie.length;Je<vt;Je++)(Dn=xr[Ie.charCodeAt(Je)])?Hr.push(String.fromCharCode(Dn)):Hr.push(Ie[Je]),Hr[Je].charCodeAt(0)>>8&&(nn=!0);Ie=Hr.join("")}for(Je=Ie.length;nn===void 0&&Je!==0;)Ie.charCodeAt(Je-1)>>8&&(nn=!0),Je--;if(!nn)return Ie;for(Hr=ze.noBOM?[]:[254,255],Je=0,vt=Ie.length;Je<vt;Je++){if((ra=(Dn=Ie.charCodeAt(Je))>>8)>>8)throw new Error("Character at position "+Je+" of string '"+Ie+"' exceeds 16bits. Cannot be encoded into UCS-2 BE");Hr.push(ra),Hr.push(Dn-(ra<<8))}return String.fromCharCode.apply(void 0,Hr)}(G,ue).replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},da=h.__private__.beginPage=function(G){be[++Et]=[],Ct[Et]={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])}},vd(Et),W(be[A])},gd=function(G,ue){var Ie,ze,Je;switch(r=ue||r,typeof G=="string"&&(Ie=v(G.toLowerCase()),Array.isArray(Ie)&&(ze=Ie[0],Je=Ie[1])),Array.isArray(G)&&(ze=G[0]*Fe,Je=G[1]*Fe),isNaN(ze)&&(ze=a[0],Je=a[1]),(ze>14400||Je>14400)&&(gs.warn("A page in a PDF can not be wider or taller than 14400 userUnit. jsPDF limits the width/height to 14400"),ze=Math.min(14400,ze),Je=Math.min(14400,Je)),a=[ze,Je],r.substr(0,1)){case"l":Je>ze&&(a=[Je,ze]);break;case"p":ze>Je&&(a=[Je,ze])}da(a),Gr(K1),Z(fg),Y1!==0&&Z(Y1+" J"),Z1!==0&&Z(Z1+" j"),hr.publish("addPage",{pageNumber:Et})},pu=function(G){G>0&&G<=Et&&(be.splice(G,1),Ct.splice(G,1),Et--,A>Et&&(A=Et),this.setPage(A))},vd=function(G){G>0&&G<=Et&&(A=G)},mc=h.__private__.getNumberOfPages=h.getNumberOfPages=function(){return be.length-1},Ih=function(G,ue,Ie){var ze,Je=void 0;return Ie=Ie||{},G=G!==void 0?G:Mt[st].fontName,ue=ue!==void 0?ue:Mt[st].fontStyle,ze=G.toLowerCase(),Wt[ze]!==void 0&&Wt[ze][ue]!==void 0?Je=Wt[ze][ue]:Wt[G]!==void 0&&Wt[G][ue]!==void 0?Je=Wt[G][ue]:Ie.disableWarning===!1&&gs.warn("Unable to look up font label for font '"+G+"', '"+ue+"'. Refer to getFontList() for available fonts."),Je||Ie.noFallback||(Je=Wt.times[ue])==null&&(Je=Wt.times.normal),Je},Ba=h.__private__.putInfo=function(){var G=On(),ue=function(ze){return ze};for(var Ie in d!==null&&(ue=si.encryptor(G,0)),Z("<<"),Z("/Producer ("+jn(ue("jsPDF "+lr.version))+")"),Qe)Qe.hasOwnProperty(Ie)&&Qe[Ie]&&Z("/"+Ie.substr(0,1).toUpperCase()+Ie.substr(1)+" ("+jn(ue(Qe[Ie]))+")");Z("/CreationDate ("+jn(ue(L))+")"),Z(">>"),Z("endobj")},cg=h.__private__.putCatalog=function(G){var ue=(G=G||{}).rootDictionaryObjId||Ne;switch(On(),Z("<<"),Z("/Type /Catalog"),Z("/Pages "+ue+" 0 R"),Me||(Me="fullwidth"),Me){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 Ie=""+Me;Ie.substr(Ie.length-1)==="%"&&(Me=parseInt(Me)/100),typeof Me=="number"&&Z("/OpenAction [3 0 R /XYZ null null "+k(Me)+"]")}switch(ve||(ve="continuous"),ve){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")}Le&&Z("/PageMode /"+Le),hr.publish("putCatalog"),Z(">>"),Z("endobj")},RA=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 "+si.oid+" 0 R"),Z("/ID [ <"+H+"> <"+H+"> ]"),Z(">>")},za=h.__private__.putHeader=function(){Z("%PDF-"+x),Z("%ºß¬à")},B_=h.__private__.putXRef=function(){var G="0000000000";Z("xref"),Z("0 "+(Y+1)),Z("0000000000 65535 f ");for(var ue=1;ue<=Y;ue++)typeof te[ue]=="function"?Z((G+te[ue]()).slice(-10)+" 00000 n "):te[ue]!==void 0?Z((G+te[ue]).slice(-10)+" 00000 n "):Z("0000000000 00000 n ")},yd=h.__private__.buildDocument=function(){var G;Y=0,J=0,re=[],te=[],ie=[],Ne=ts(),ke=ts(),W(re),hr.publish("buildDocument"),za(),Ze(),function(){hr.publish("putAdditionalObjects");for(var Ie=0;Ie<ie.length;Ie++){var ze=ie[Ie];pe(ze.objId,!0),Z(ze.content),Z("endobj")}hr.publish("postPutAdditionalObjects")}(),G=[],function(){for(var Ie in Mt)Mt.hasOwnProperty(Ie)&&(f===!1||f===!0&&m.hasOwnProperty(Ie))&&et(Mt[Ie])}(),function(){var Ie;for(Ie in Yt)Yt.hasOwnProperty(Ie)&&Pt(Yt[Ie])}(),function(){for(var Ie in Jt)Jt.hasOwnProperty(Ie)&&wt(Jt[Ie])}(),function(Ie){var ze;for(ze in Lt)Lt.hasOwnProperty(ze)&&(Lt[ze]instanceof xm?Rt(Lt[ze]):Lt[ze]instanceof Ax&&qt(Lt[ze],Ie))}(G),hr.publish("putResources"),G.forEach(Ht),Ht({resourcesOid:ke,objectOid:Number.MAX_SAFE_INTEGER}),hr.publish("postPutResources"),d!==null&&(si.oid=On(),Z("<<"),Z("/Filter /Standard"),Z("/V "+si.v),Z("/R "+si.r),Z("/U <"+si.toHexString(si.U)+">"),Z("/O <"+si.toHexString(si.O)+">"),Z("/P "+si.P),Z(">>"),Z("endobj")),Ba(),cg();var ue=J;return B_(),RA(),Z("startxref"),Z(""+ue),Z("%%EOF"),W(be[A]),re.join(`
`)},ug=h.__private__.getBlob=function(G){return new Blob([se(G)],{type:"application/pdf"})},z_=h.output=h.__private__.output=(wn=function(G,ue){switch(typeof(ue=ue||{})=="string"?ue={filename:ue}:ue.filename=ue.filename||"generated.pdf",G){case void 0:return yd();case"save":h.save(ue.filename);break;case"arraybuffer":return se(yd());case"blob":return ug(yd());case"bloburi":case"bloburl":if(zr.URL!==void 0&&typeof zr.URL.createObjectURL=="function")return zr.URL&&zr.URL.createObjectURL(ug(yd()))||void 0;gs.warn("bloburl is not supported by your system, because URL.createObjectURL is not supported by your browser.");break;case"datauristring":case"dataurlstring":var Ie="",ze=yd();try{Ie=xU(ze)}catch{Ie=xU(unescape(encodeURIComponent(ze)))}return"data:application/pdf;filename="+ue.filename+";base64,"+Ie;case"pdfobjectnewwindow":if(Object.prototype.toString.call(zr)==="[object Window]"){var Je="https://cdnjs.cloudflare.com/ajax/libs/pdfobject/2.1.1/pdfobject.min.js",vt=' integrity="sha512-4ze/a9/4jqu+tX9dfOqJYSvyYd5M6qum/3HpCLr+/Jqf0whc37VUbkpNGHR7/8pSnCFw47T1fmIpwBV7UySh3g==" crossorigin="anonymous"';ue.pdfObjectUrl&&(Je=ue.pdfObjectUrl,vt="");var _t='<html><style>html, body { padding: 0; margin: 0; } iframe { width: 100%; height: 100%; border: 0;} </style><body><script src="'+Je+'"'+vt+'><\/script><script >PDFObject.embed("'+this.output("dataurlstring")+'", '+JSON.stringify(ue)+");<\/script></body></html>",ir=zr.open();return ir!==null&&ir.document.write(_t),ir}throw new Error("The option pdfobjectnewwindow just works in a browser-environment.");case"pdfjsnewwindow":if(Object.prototype.toString.call(zr)==="[object Window]"){var xr='<html><style>html, body { padding: 0; margin: 0; } iframe { width: 100%; height: 100%; border: 0;} </style><body><iframe id="pdfViewer" src="'+(ue.pdfJsUrl||"examples/PDF.js/web/viewer.html")+"?file=&downloadName="+ue.filename+'" width="500px" height="400px" /></body></html>',Hr=zr.open();if(Hr!==null){Hr.document.write(xr);var nn=this;Hr.document.documentElement.querySelector("#pdfViewer").onload=function(){Hr.document.title=ue.filename,Hr.document.documentElement.querySelector("#pdfViewer").contentWindow.PDFViewerApplication.open(nn.output("bloburl"))}}return Hr}throw new Error("The option pdfjsnewwindow just works in a browser-environment.");case"dataurlnewwindow":if(Object.prototype.toString.call(zr)!=="[object Window]")throw new Error("The option dataurlnewwindow just works in a browser-environment.");var Dn='<html><style>html, body { padding: 0; margin: 0; } iframe { width: 100%; height: 100%; border: 0;} </style><body><iframe src="'+this.output("datauristring",ue)+'"></iframe></body></html>',ra=zr.open();if(ra!==null&&(ra.document.write(Dn),ra.document.title=ue.filename),ra||typeof safari>"u")return ra;break;case"datauri":case"dataurl":return zr.document.location.href=this.output("datauristring",ue);default:return null}},wn.foo=function(){try{return wn.apply(this,arguments)}catch(Ie){var G=Ie.stack||"";~G.indexOf(" at ")&&(G=G.split(" at ")[1]);var ue="Error in function "+G.split(`
`)[0].split("<")[0]+": "+Ie.message;if(!zr.console)throw new Error(ue);zr.console.error(ue,Ie),zr.alert&&alert(ue)}},wn.foo.bar=wn,wn.foo),pc=function(G){return Array.isArray(Gt)===!0&&Gt.indexOf(G)>-1};switch(n){case"pt":Fe=1;break;case"mm":Fe=72/25.4;break;case"cm":Fe=72/2.54;break;case"in":Fe=72;break;case"px":Fe=pc("px_scaling")==1?.75:96/72;break;case"pc":case"em":Fe=12;break;case"ex":Fe=6;break;default:if(typeof n!="number")throw new Error("Invalid unit: "+n);Fe=n}var si=null;K(),z();var gf=h.__private__.getPageInfo=h.getPageInfo=function(G){if(isNaN(G)||G%1!=0)throw new Error("Invalid argument passed to jsPDF.getPageInfo");return{objId:Ct[G].objId,pageNumber:G,pageContext:Ct[G]}},q_=h.__private__.getPageInfoByObjId=function(G){if(isNaN(G)||G%1!=0)throw new Error("Invalid argument passed to jsPDF.getPageInfoByObjId");for(var ue in Ct)if(Ct[ue].objId===G)break;return gf(ue)},LA=h.__private__.getCurrentPageInfo=h.getCurrentPageInfo=function(){return{objId:Ct[A].objId,pageNumber:A,pageContext:Ct[A]}};h.addPage=function(){return gd.apply(this,arguments),this},h.setPage=function(){return vd.apply(this,arguments),W.call(this,be[A]),this},h.insertPage=function(G){return this.addPage(),this.movePage(A,G),this},h.movePage=function(G,ue){var Ie,ze;if(G>ue){Ie=be[G],ze=Ct[G];for(var Je=G;Je>ue;Je--)be[Je]=be[Je-1],Ct[Je]=Ct[Je-1];be[ue]=Ie,Ct[ue]=ze,this.setPage(ue)}else if(G<ue){Ie=be[G],ze=Ct[G];for(var vt=G;vt<ue;vt++)be[vt]=be[vt+1],Ct[vt]=Ct[vt+1];be[ue]=Ie,Ct[ue]=ze,this.setPage(ue)}return this},h.deletePage=function(){return pu.apply(this,arguments),this},h.__private__.text=h.text=function(G,ue,Ie,ze,Je){var vt,_t,ir,xr,Hr,nn,Dn,ra,qa,_s=(ze=ze||{}).scope||this;if(typeof G=="number"&&typeof ue=="number"&&(typeof Ie=="string"||Array.isArray(Ie))){var ai=Ie;Ie=ue,ue=G,G=ai}if(arguments[3]instanceof Xt==0?(ir=arguments[4],xr=arguments[5],os(Dn=arguments[3])==="object"&&Dn!==null||(typeof ir=="string"&&(xr=ir,ir=null),typeof Dn=="string"&&(xr=Dn,Dn=null),typeof Dn=="number"&&(ir=Dn,Dn=null),ze={flags:Dn,angle:ir,align:xr})):(T("The transform parameter of text() with a Matrix value"),qa=Je),isNaN(ue)||isNaN(Ie)||G==null)throw new Error("Invalid arguments passed to jsPDF.text");if(G.length===0)return _s;var Ua,zi="",Nf=typeof ze.lineHeightFactor=="number"?ze.lineHeightFactor:Vp,gu=_s.internal.scaleFactor;function Sf(Yn){return Yn=Yn.split(" ").join(Array(ze.TabLen||9).join(" ")),jn(Yn,Dn)}function tb(Yn){for(var ps,Ea=Yn.concat(),ii=[],Ef=Ea.length;Ef--;)typeof(ps=Ea.shift())=="string"?ii.push(ps):Array.isArray(Yn)&&(ps.length===1||ps[1]===void 0&&ps[2]===void 0)?ii.push(ps[0]):ii.push([ps[0],ps[1],ps[2]]);return ii}function mg(Yn,ps){var Ea;if(typeof Yn=="string")Ea=ps(Yn)[0];else if(Array.isArray(Yn)){for(var ii,Ef,db=Yn.concat(),gg=[],Q_=db.length;Q_--;)typeof(ii=db.shift())=="string"?gg.push(ps(ii)[0]):Array.isArray(ii)&&typeof ii[0]=="string"&&(Ef=ps(ii[0],ii[1],ii[2]),gg.push([Ef[0],Ef[1],Ef[2]]));Ea=gg}return Ea}var Rh=!1,Kp=!0;if(typeof G=="string")Rh=!0;else if(Array.isArray(G)){var Xp=G.concat();_t=[];for(var Lh,qi=Xp.length;qi--;)(typeof(Lh=Xp.shift())!="string"||Array.isArray(Lh)&&typeof Lh[0]!="string")&&(Kp=!1);Rh=Kp}if(Rh===!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 Yp=le/_s.internal.scaleFactor,Zp=Yp*(Nf-1);switch(ze.baseline){case"bottom":Ie-=Zp;break;case"top":Ie+=Yp-Zp;break;case"hanging":Ie+=Yp-2*Zp;break;case"middle":Ie+=Yp/2-Zp}if((nn=ze.maxWidth||0)>0&&(typeof G=="string"?G=_s.splitTextToSize(G,nn):Object.prototype.toString.call(G)==="[object Array]"&&(G=G.reduce(function(Yn,ps){return Yn.concat(_s.splitTextToSize(ps,nn))},[]))),vt={text:G,x:ue,y:Ie,options:ze,mutex:{pdfEscape:jn,activeFontKey:st,fonts:Mt,activeFontSize:le}},hr.publish("preProcessText",vt),G=vt.text,ir=(ze=vt.options).angle,qa instanceof Xt==0&&ir&&typeof ir=="number"){ir*=Math.PI/180,ze.rotationDirection===0&&(ir=-ir),N===b&&(ir=-ir);var rb=Math.cos(ir),nb=Math.sin(ir);qa=new Xt(rb,nb,-nb,rb,0,0)}else ir&&ir instanceof Xt&&(qa=ir);N!==b||qa||(qa=Xn),(Hr=ze.charSpace||bf)!==void 0&&(zi+=P(q(Hr))+` Tc
`,this.setCharSpace(this.getCharSpace()||0)),(ra=ze.horizontalScale)!==void 0&&(zi+=P(100*ra)+` Tz
`),ze.lang;var To=-1,kf=ze.renderingMode!==void 0?ze.renderingMode:ze.stroke,pg=_s.internal.getCurrentPageInfo().pageContext;switch(kf){case 0:case!1:case"fill":To=0;break;case 1:case!0:case"stroke":To=1;break;case 2:case"fillThenStroke":To=2;break;case 3:case"invisible":To=3;break;case 4:case"fillAndAddForClipping":To=4;break;case 5:case"strokeAndAddPathForClipping":To=5;break;case 6:case"fillThenStrokeAndAddToPathForClipping":To=6;break;case 7:case"addToPathForClipping":To=7}var Z_=pg.usedRenderingMode!==void 0?pg.usedRenderingMode:-1;To!==-1?zi+=To+` Tr
`:Z_!==-1&&(zi+=`0 Tr
`),To!==-1&&(pg.usedRenderingMode=To),xr=ze.align||"left";var xc,Jp=le*Nf,sb=_s.internal.pageSize.getWidth(),ab=Mt[st];Hr=ze.charSpace||bf,nn=ze.maxWidth||0,Dn=Object.assign({autoencode:!0,noBOM:!0},ze.flags);var Fh=[],Qp=function(Yn){return _s.getStringUnitWidth(Yn,{font:ab,charSpace:Hr,fontSize:le,doKerning:!1})*le/gu};if(Object.prototype.toString.call(G)==="[object Array]"){var Al;_t=tb(G),xr!=="left"&&(xc=_t.map(Qp));var Tl,Mh=0;if(xr==="right"){ue-=xc[0],G=[],qi=_t.length;for(var Cf=0;Cf<qi;Cf++)Cf===0?(Tl=vf(ue),Al=yf(Ie)):(Tl=q(Mh-xc[Cf]),Al=-Jp),G.push([_t[Cf],Tl,Al]),Mh=xc[Cf]}else if(xr==="center"){ue-=xc[0]/2,G=[],qi=_t.length;for(var $h=0;$h<qi;$h++)$h===0?(Tl=vf(ue),Al=yf(Ie)):(Tl=q((Mh-xc[$h])/2),Al=-Jp),G.push([_t[$h],Tl,Al]),Mh=xc[$h]}else if(xr==="left"){G=[],qi=_t.length;for(var ib=0;ib<qi;ib++)G.push(_t[ib])}else if(xr==="justify"&&ab.encoding==="Identity-H"){G=[],qi=_t.length,nn=nn!==0?nn:sb;for(var xg=0,Ca=0;Ca<qi;Ca++)if(Al=Ca===0?yf(Ie):-Jp,Tl=Ca===0?vf(ue):xg,Ca<qi-1){var J_=q((nn-xc[Ca])/(_t[Ca].split(" ").length-1)),wd=_t[Ca].split(" ");G.push([wd[0]+" ",Tl,Al]),xg=0;for(var jd=1;jd<wd.length;jd++){var ob=(Qp(wd[jd-1]+" "+wd[jd])-Qp(wd[jd]))*gu+J_;jd==wd.length-1?G.push([wd[jd],ob,0]):G.push([wd[jd]+" ",ob,0]),xg-=ob}}else G.push([_t[Ca],Tl,Al]);G.push(["",xg,0])}else{if(xr!=="justify")throw new Error('Unrecognized alignment option, use "left", "center", "right" or "justify".');for(G=[],qi=_t.length,nn=nn!==0?nn:sb,Ca=0;Ca<qi;Ca++){Al=Ca===0?yf(Ie):-Jp,Tl=Ca===0?vf(ue):0;var lb=_t[Ca].split(" ").length-1,cb=lb>0?(nn-xc[Ca])/lb:0;Ca<qi-1?Fh.push(P(q(cb))):Fh.push(0),G.push([_t[Ca],Tl,Al])}}}(typeof ze.R2L=="boolean"?ze.R2L:me)===!0&&(G=mg(G,function(Yn,ps,Ea){return[Yn.split("").reverse().join(""),ps,Ea]})),vt={text:G,x:ue,y:Ie,options:ze,mutex:{pdfEscape:jn,activeFontKey:st,fonts:Mt,activeFontSize:le}},hr.publish("postProcessText",vt),G=vt.text,Ua=vt.mutex.isHex||!1;var ub=Mt[st].encoding;ub!=="WinAnsiEncoding"&&ub!=="StandardEncoding"||(G=mg(G,function(Yn,ps,Ea){return[Sf(Yn),ps,Ea]})),_t=tb(G),G=[];for(var Bh,zh,qh,ex=Array.isArray(_t[0])?1:0,Uh="",tx=function(Yn,ps,Ea){var ii="";return Ea instanceof Xt?(Ea=typeof ze.angle=="number"?fn(Ea,new Xt(1,0,0,1,Yn,ps)):fn(new Xt(1,0,0,1,Yn,ps),Ea),N===b&&(Ea=fn(new Xt(1,0,0,-1,0,0),Ea)),ii=Ea.join(" ")+` Tm
`):ii=P(Yn)+" "+P(ps)+` Td
`,ii},gc=0;gc<_t.length;gc++){switch(Uh="",ex){case 1:qh=(Ua?"<":"(")+_t[gc][0]+(Ua?">":")"),Bh=parseFloat(_t[gc][1]),zh=parseFloat(_t[gc][2]);break;case 0:qh=(Ua?"<":"(")+_t[gc]+(Ua?">":")"),Bh=vf(ue),zh=yf(Ie)}Fh!==void 0&&Fh[gc]!==void 0&&(Uh=Fh[gc]+` Tw
`),gc===0?G.push(Uh+tx(Bh,zh,qa)+qh):ex===0?G.push(Uh+qh):ex===1&&G.push(Uh+tx(Bh,zh,qa)+qh)}G=ex===0?G.join(` Tj
T* `):G.join(` Tj
`),G+=` Tj
`;var _d=`BT
/`;return _d+=st+" "+le+` Tf
`,_d+=P(le*Nf)+` TL
`,_d+=Hp+`
`,_d+=zi,_d+=G,Z(_d+="ET"),m[st]=!0,_s};var FA=h.__private__.clip=h.clip=function(G){return Z(G==="evenodd"?"W*":"W"),this};h.clipEvenOdd=function(){return FA("evenodd")},h.__private__.discardPath=h.discardPath=function(){return Z("n"),this};var bd=h.__private__.isValidStyle=function(G){var ue=!1;return[void 0,null,"S","D","F","DF","FD","f","f*","B","B*","n"].indexOf(G)!==-1&&(ue=!0),ue};h.__private__.setDefaultPathOperation=h.setDefaultPathOperation=function(G){return bd(G)&&(u=G),this};var U_=h.__private__.getStyle=h.getStyle=function(G){var ue=u;switch(G){case"D":case"S":ue="S";break;case"F":ue="f";break;case"FD":case"DF":ue="B";break;case"f":case"f*":case"B":case"B*":ue=G}return ue},V_=h.close=function(){return Z("h"),this};h.stroke=function(){return Z("S"),this},h.fill=function(G){return dg("f",G),this},h.fillEvenOdd=function(G){return dg("f*",G),this},h.fillStroke=function(G){return dg("B",G),this},h.fillStrokeEvenOdd=function(G){return dg("B*",G),this};var dg=function(G,ue){os(ue)==="object"?$A(ue,G):Z(G)},Up=function(G){G===null||N===b&&G===void 0||(G=U_(G),Z(G))};function MA(G,ue,Ie,ze,Je){var vt=new Ax(ue||this.boundingBox,Ie||this.xStep,ze||this.yStep,this.gState,Je||this.matrix);vt.stream=this.stream;var _t=G+"$$"+this.cloneIndex+++"$$";return rn(_t,vt),vt}var $A=function(G,ue){var Ie=or[G.key],ze=Lt[Ie];if(ze instanceof xm)Z("q"),Z(BA(ue)),ze.gState&&h.setGState(ze.gState),Z(G.matrix.toString()+" cm"),Z("/"+Ie+" sh"),Z("Q");else if(ze instanceof Ax){var Je=new Xt(1,0,0,-1,0,Gp());G.matrix&&(Je=Je.multiply(G.matrix||Xn),Ie=MA.call(ze,G.key,G.boundingBox,G.xStep,G.yStep,Je).id),Z("q"),Z("/Pattern cs"),Z("/"+Ie+" scn"),ze.gState&&h.setGState(ze.gState),Z(ue),Z("Q")}},BA=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"}},G1=h.moveTo=function(G,ue){return Z(P(q(G))+" "+P(O(ue))+" m"),this},H_=h.lineTo=function(G,ue){return Z(P(q(G))+" "+P(O(ue))+" l"),this},xu=h.curveTo=function(G,ue,Ie,ze,Je,vt){return Z([P(q(G)),P(O(ue)),P(q(Ie)),P(O(ze)),P(q(Je)),P(O(vt)),"c"].join(" ")),this};h.__private__.line=h.line=function(G,ue,Ie,ze,Je){if(isNaN(G)||isNaN(ue)||isNaN(Ie)||isNaN(ze)||!bd(Je))throw new Error("Invalid arguments passed to jsPDF.line");return N===y?this.lines([[Ie-G,ze-ue]],G,ue,[1,1],Je||"S"):this.lines([[Ie-G,ze-ue]],G,ue,[1,1]).stroke()},h.__private__.lines=h.lines=function(G,ue,Ie,ze,Je,vt){var _t,ir,xr,Hr,nn,Dn,ra,qa,_s,ai,Ua,zi;if(typeof G=="number"&&(zi=Ie,Ie=ue,ue=G,G=zi),ze=ze||[1,1],vt=vt||!1,isNaN(ue)||isNaN(Ie)||!Array.isArray(G)||!Array.isArray(ze)||!bd(Je)||typeof vt!="boolean")throw new Error("Invalid arguments passed to jsPDF.lines");for(G1(ue,Ie),_t=ze[0],ir=ze[1],Hr=G.length,ai=ue,Ua=Ie,xr=0;xr<Hr;xr++)(nn=G[xr]).length===2?(ai=nn[0]*_t+ai,Ua=nn[1]*ir+Ua,H_(ai,Ua)):(Dn=nn[0]*_t+ai,ra=nn[1]*ir+Ua,qa=nn[2]*_t+ai,_s=nn[3]*ir+Ua,ai=nn[4]*_t+ai,Ua=nn[5]*ir+Ua,xu(Dn,ra,qa,_s,ai,Ua));return vt&&V_(),Up(Je),this},h.path=function(G){for(var ue=0;ue<G.length;ue++){var Ie=G[ue],ze=Ie.c;switch(Ie.op){case"m":G1(ze[0],ze[1]);break;case"l":H_(ze[0],ze[1]);break;case"c":xu.apply(this,ze);break;case"h":V_()}}return this},h.__private__.rect=h.rect=function(G,ue,Ie,ze,Je){if(isNaN(G)||isNaN(ue)||isNaN(Ie)||isNaN(ze)||!bd(Je))throw new Error("Invalid arguments passed to jsPDF.rect");return N===y&&(ze=-ze),Z([P(q(G)),P(O(ue)),P(q(Ie)),P(q(ze)),"re"].join(" ")),Up(Je),this},h.__private__.triangle=h.triangle=function(G,ue,Ie,ze,Je,vt,_t){if(isNaN(G)||isNaN(ue)||isNaN(Ie)||isNaN(ze)||isNaN(Je)||isNaN(vt)||!bd(_t))throw new Error("Invalid arguments passed to jsPDF.triangle");return this.lines([[Ie-G,ze-ue],[Je-Ie,vt-ze],[G-Je,ue-vt]],G,ue,[1,1],_t,!0),this},h.__private__.roundedRect=h.roundedRect=function(G,ue,Ie,ze,Je,vt,_t){if(isNaN(G)||isNaN(ue)||isNaN(Ie)||isNaN(ze)||isNaN(Je)||isNaN(vt)||!bd(_t))throw new Error("Invalid arguments passed to jsPDF.roundedRect");var ir=4/3*(Math.SQRT2-1);return Je=Math.min(Je,.5*Ie),vt=Math.min(vt,.5*ze),this.lines([[Ie-2*Je,0],[Je*ir,0,Je,vt-vt*ir,Je,vt],[0,ze-2*vt],[0,vt*ir,-Je*ir,vt,-Je,vt],[2*Je-Ie,0],[-Je*ir,0,-Je,-vt*ir,-Je,-vt],[0,2*vt-ze],[0,-vt*ir,Je*ir,-vt,Je,-vt]],G+Je,ue,[1,1],_t,!0),this},h.__private__.ellipse=h.ellipse=function(G,ue,Ie,ze,Je){if(isNaN(G)||isNaN(ue)||isNaN(Ie)||isNaN(ze)||!bd(Je))throw new Error("Invalid arguments passed to jsPDF.ellipse");var vt=4/3*(Math.SQRT2-1)*Ie,_t=4/3*(Math.SQRT2-1)*ze;return G1(G+Ie,ue),xu(G+Ie,ue-_t,G+vt,ue-ze,G,ue-ze),xu(G-vt,ue-ze,G-Ie,ue-_t,G-Ie,ue),xu(G-Ie,ue+_t,G-vt,ue+ze,G,ue+ze),xu(G+vt,ue+ze,G+Ie,ue+_t,G+Ie,ue),Up(Je),this},h.__private__.circle=h.circle=function(G,ue,Ie,ze){if(isNaN(G)||isNaN(ue)||isNaN(Ie)||!bd(ze))throw new Error("Invalid arguments passed to jsPDF.circle");return this.ellipse(G,ue,Ie,Ie,ze)},h.setFont=function(G,ue,Ie){return Ie&&(ue=S(ue,Ie)),st=Ih(G,ue,{disableWarning:!1}),this};var zA=h.__private__.getFont=h.getFont=function(){return Mt[Ih.apply(h,arguments)]};h.__private__.getFontList=h.getFontList=function(){var G,ue,Ie={};for(G in Wt)if(Wt.hasOwnProperty(G))for(ue in Ie[G]=[],Wt[G])Wt[G].hasOwnProperty(ue)&&Ie[G].push(ue);return Ie},h.addFont=function(G,ue,Ie,ze,Je){var vt=["StandardEncoding","MacRomanEncoding","Identity-H","WinAnsiEncoding"];return arguments[3]&&vt.indexOf(arguments[3])!==-1?Je=arguments[3]:arguments[3]&&vt.indexOf(arguments[3])==-1&&(Ie=S(Ie,ze)),ds.call(this,G,ue,Ie,Je=Je||"Identity-H")};var Vp,K1=e.lineWidth||.200025,qA=h.__private__.getLineWidth=h.getLineWidth=function(){return K1},Gr=h.__private__.setLineWidth=h.setLineWidth=function(G){return K1=G,Z(P(q(G))+" w"),this};h.__private__.setLineDash=lr.API.setLineDash=lr.API.setLineDashPattern=function(G,ue){if(G=G||[],ue=ue||0,isNaN(ue)||!Array.isArray(G))throw new Error("Invalid arguments passed to jsPDF.setLineDash");return G=G.map(function(Ie){return P(q(Ie))}).join(" "),ue=P(q(ue)),Z("["+G+"] "+ue+" d"),this};var UA=h.__private__.getLineHeight=h.getLineHeight=function(){return le*Vp};h.__private__.getLineHeight=h.getLineHeight=function(){return le*Vp};var VA=h.__private__.setLineHeightFactor=h.setLineHeightFactor=function(G){return typeof(G=G||1.15)=="number"&&(Vp=G),this},HA=h.__private__.getLineHeightFactor=h.getLineHeightFactor=function(){return Vp};VA(e.lineHeight);var vf=h.__private__.getHorizontalCoordinate=function(G){return q(G)},yf=h.__private__.getVerticalCoordinate=function(G){return N===b?G:Ct[A].mediaBox.topRightY-Ct[A].mediaBox.bottomLeftY-q(G)},WA=h.__private__.getHorizontalCoordinateString=h.getHorizontalCoordinateString=function(G){return P(vf(G))},GA=h.__private__.getVerticalCoordinateString=h.getVerticalCoordinateString=function(G){return P(yf(G))},fg=e.strokeColor||"0 G";h.__private__.getStrokeColor=h.getDrawColor=function(){return Pe(fg)},h.__private__.setStrokeColor=h.setDrawColor=function(G,ue,Ie,ze){return fg=Re({ch1:G,ch2:ue,ch3:Ie,ch4:ze,pdfColorType:"draw",precision:2}),Z(fg),this};var X1=e.fillColor||"0 g";h.__private__.getFillColor=h.getFillColor=function(){return Pe(X1)},h.__private__.setFillColor=h.setFillColor=function(G,ue,Ie,ze){return X1=Re({ch1:G,ch2:ue,ch3:Ie,ch4:ze,pdfColorType:"fill",precision:2}),Z(X1),this};var Hp=e.textColor||"0 g",KA=h.__private__.getTextColor=h.getTextColor=function(){return Pe(Hp)};h.__private__.setTextColor=h.setTextColor=function(G,ue,Ie,ze){return Hp=Re({ch1:G,ch2:ue,ch3:Ie,ch4:ze,pdfColorType:"text",precision:3}),this};var bf=e.charSpace,XA=h.__private__.getCharSpace=h.getCharSpace=function(){return parseFloat(bf||0)};h.__private__.setCharSpace=h.setCharSpace=function(G){if(isNaN(G))throw new Error("Invalid argument passed to jsPDF.setCharSpace");return bf=G,this};var Y1=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 ue=h.CapJoinStyles[G];if(ue===void 0)throw new Error("Line cap style of '"+G+"' is not recognized. See or extend .CapJoinStyles property for valid styles");return Y1=ue,Z(ue+" J"),this};var Z1=0;h.__private__.setLineJoin=h.setLineJoin=function(G){var ue=h.CapJoinStyles[G];if(ue===void 0)throw new Error("Line join style of '"+G+"' is not recognized. See or extend .CapJoinStyles property for valid styles");return Z1=ue,Z(ue+" 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(P(q(G))+" M"),this},h.GState=L2,h.setGState=function(G){(G=typeof G=="string"?Yt[ot[G]]:W_(null,G)).equals(fr)||(Z("/"+G.id+" gs"),fr=G)};var W_=function(G,ue){if(!G||!ot[G]){var Ie=!1;for(var ze in Yt)if(Yt.hasOwnProperty(ze)&&Yt[ze].equals(ue)){Ie=!0;break}if(Ie)ue=Yt[ze];else{var Je="GS"+(Object.keys(Yt).length+1).toString(10);Yt[Je]=ue,ue.id=Je}return G&&(ot[G]=ue.id),hr.publish("addGState",ue),ue}};h.addGState=function(G,ue){return W_(G,ue),this},h.saveGraphicsState=function(){return Z("q"),zt.push({key:st,size:le,color:Hp}),this},h.restoreGraphicsState=function(){Z("Q");var G=zt.pop();return st=G.key,le=G.size,Hp=G.color,fr=null,this},h.setCurrentTransformationMatrix=function(G){return Z(G.toString()+" cm"),this},h.comment=function(G){return Z("#"+G),this};var wf=function(G,ue){var Ie=G||0;Object.defineProperty(this,"x",{enumerable:!0,get:function(){return Ie},set:function(vt){isNaN(vt)||(Ie=parseFloat(vt))}});var ze=ue||0;Object.defineProperty(this,"y",{enumerable:!0,get:function(){return ze},set:function(vt){isNaN(vt)||(ze=parseFloat(vt))}});var Je="pt";return Object.defineProperty(this,"type",{enumerable:!0,get:function(){return Je},set:function(vt){Je=vt.toString()}}),this},J1=function(G,ue,Ie,ze){wf.call(this,G,ue),this.type="rect";var Je=Ie||0;Object.defineProperty(this,"w",{enumerable:!0,get:function(){return Je},set:function(_t){isNaN(_t)||(Je=parseFloat(_t))}});var vt=ze||0;return Object.defineProperty(this,"h",{enumerable:!0,get:function(){return vt},set:function(_t){isNaN(_t)||(vt=parseFloat(_t))}}),this},hg=function(){this.page=Et,this.currentPage=A,this.pages=be.slice(0),this.pagesContext=Ct.slice(0),this.x=Ge,this.y=ht,this.matrix=ut,this.width=eb(A),this.height=K_(A),this.outputDestination=Ve,this.id="",this.objectNumber=-1};hg.prototype.restore=function(){Et=this.page,A=this.currentPage,Ct=this.pagesContext,be=this.pages,Ge=this.x,ht=this.y,ut=this.matrix,G_(A,this.width),jf(A,this.height),Ve=this.outputDestination};var Q1=function(G,ue,Ie,ze,Je){mn.push(new hg),Et=A=0,be=[],Ge=G,ht=ue,ut=Je,da([Ie,ze])};for(var Wp in h.beginFormObject=function(G,ue,Ie,ze,Je){return Q1(G,ue,Ie,ze,Je),this},h.endFormObject=function(G){return function(ue){if(mr[ue])mn.pop().restore();else{var Ie=new hg,ze="Xo"+(Object.keys(Jt).length+1).toString(10);Ie.id=ze,mr[ue]=ze,Jt[ze]=Ie,hr.publish("addFormObject",Ie),mn.pop().restore()}}(G),this},h.doFormObject=function(G,ue){var Ie=Jt[mr[G]];return Z("q"),Z(ue.toString()+" cm"),Z("/"+Ie.id+" Do"),Z("Q"),this},h.getFormObject=function(G){var ue=Jt[mr[G]];return{x:ue.x,y:ue.y,width:ue.width,height:ue.height,matrix:ue.matrix}},h.save=function(G,ue){return G=G||"generated.pdf",(ue=ue||{}).returnPromise=ue.returnPromise||!1,ue.returnPromise===!1?(hx(ug(yd()),G),typeof hx.unload=="function"&&zr.setTimeout&&setTimeout(hx.unload,911),this):new Promise(function(Ie,ze){try{var Je=hx(ug(yd()),G);typeof hx.unload=="function"&&zr.setTimeout&&setTimeout(hx.unload,911),Ie(Je)}catch(vt){ze(vt.message)}})},lr.API)lr.API.hasOwnProperty(Wp)&&(Wp==="events"&&lr.API.events.length?function(G,ue){var Ie,ze,Je;for(Je=ue.length-1;Je!==-1;Je--)Ie=ue[Je][0],ze=ue[Je][1],G.subscribe.apply(G,[Ie].concat(typeof ze=="function"?[ze]:ze))}(hr,lr.API.events):h[Wp]=lr.API[Wp]);function eb(G){return Ct[G].mediaBox.topRightX-Ct[G].mediaBox.bottomLeftX}function G_(G,ue){Ct[G].mediaBox.topRightX=ue+Ct[G].mediaBox.bottomLeftX}function K_(G){return Ct[G].mediaBox.topRightY-Ct[G].mediaBox.bottomLeftY}function jf(G,ue){Ct[G].mediaBox.topRightY=ue+Ct[G].mediaBox.bottomLeftY}var _f=h.getPageWidth=function(G){return eb(G=G||A)/Fe},X_=h.setPageWidth=function(G,ue){G_(G,ue*Fe)},Gp=h.getPageHeight=function(G){return K_(G=G||A)/Fe},Y_=h.setPageHeight=function(G,ue){jf(G,ue*Fe)};return h.internal={pdfEscape:jn,getStyle:U_,getFont:zA,getFontSize:de,getCharSpace:XA,getTextColor:KA,getLineHeight:UA,getLineHeightFactor:HA,getLineWidth:qA,write:he,getHorizontalCoordinate:vf,getVerticalCoordinate:yf,getCoordinateString:WA,getVerticalCoordinateString:GA,collections:{},newObject:On,newAdditionalObject:Ae,newObjectDeferred:ts,newObjectDeferredBegin:pe,getFilters:Ce,putStream:$e,events:hr,scaleFactor:Fe,pageSize:{getWidth:function(){return _f(A)},setWidth:function(G){X_(A,G)},getHeight:function(){return Gp(A)},setHeight:function(G){Y_(A,G)}},encryptionOptions:d,encryption:si,getEncryptor:function(G){return d!==null?si.encryptor(G,0):function(ue){return ue}},output:z_,getNumberOfPages:mc,get pages(){return be},out:Z,f2:k,f3:E,getPageInfo:gf,getPageInfoByObjId:q_,getCurrentPageInfo:LA,getPDFVersion:p,Point:wf,Rectangle:J1,Matrix:Xt,hasHotfix:pc},Object.defineProperty(h.internal.pageSize,"width",{get:function(){return _f(A)},set:function(G){X_(A,G)},enumerable:!0,configurable:!0}),Object.defineProperty(h.internal.pageSize,"height",{get:function(){return Gp(A)},set:function(G){Y_(A,G)},enumerable:!0,configurable:!0}),(function(G){for(var ue=0,Ie=oe.length;ue<Ie;ue++){var ze=ds.call(this,G[ue][0],G[ue][1],G[ue][2],oe[ue][3],!0);f===!1&&(m[ze]=!0);var Je=G[ue][0].split("-");Rr({id:ze,fontName:Je[0],fontStyle:Je[1]||""})}hr.publish("addFonts",{fonts:Mt,dictionary:Wt})}).call(h,oe),st="F1",gd(a,r),hr.publish("initialized"),h}Kg.prototype.lsbFirstWord=function(e){return String.fromCharCode(255&e,e>>8&255,e>>16&255,e>>24&255)},Kg.prototype.toHexString=function(e){return e.split("").map(function(t){return("0"+(255&t.charCodeAt(0)).toString(16)).slice(-2)}).join("")},Kg.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("")},Kg.prototype.processOwnerPassword=function(e,t){return C8(k8(t).substr(0,5),e)},Kg.prototype.encryptor=function(e,t){var r=k8(this.encryptionKey+String.fromCharCode(255&e,e>>8&255,e>>16&255,255&t,t>>8&255)).substr(0,10);return function(n){return C8(r,n)}},L2.prototype.equals=function(e){var t,r="id,objectNumber,equals";if(!e||os(e)!==os(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},lr.API={events:[]},lr.version="3.0.4";var pa=lr.API,gF=1,X0=function(e){return e.replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},Pg=function(e){return e.replace(/\\\\/g,"\\").replace(/\\\(/g,"(").replace(/\\\)/g,")")},Xr=function(e){return e.toFixed(2)},nm=function(e){return e.toFixed(5)};pa.__acroform__={};var kl=function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e},bU=function(e){return e*gF},Ed=function(e){var t=new ile,r=ar.internal.getHeight(e)||0,n=ar.internal.getWidth(e)||0;return t.BBox=[0,0,Number(Xr(n)),Number(Xr(r))],t},LFe=pa.__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},FFe=pa.__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)},MFe=pa.__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},Ia=pa.__acroform__.getBitForPdf=function(e,t){if(isNaN(e)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.getBitForPdf");return MFe(e,t-1)},Ra=pa.__acroform__.setBitForPdf=function(e,t){if(isNaN(e)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.setBitForPdf");return LFe(e,t-1)},La=pa.__acroform__.clearBitForPdf=function(e,t){if(isNaN(e)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.clearBitForPdf");return FFe(e,t-1)},$Fe=pa.__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(Xr(c.lowerLeft_X)),Number(Xr(c.lowerLeft_Y)),Number(Xr(c.upperRight_X)),Number(Xr(c.upperRight_Y))]},BFe=function(e){if(e.appearanceStreamContent)return e.appearanceStreamContent;if(e.V||e.DV){var t=[],r=e._V||e.DV,n=E8(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+" "+Xr(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=Ed(e);return i.scope=e.scope,i.stream=t.join(`
`),i}},E8=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(k){return k.split(`
`)}):a.map(function(k){return[k]});var i=r,o=ar.internal.getHeight(e)||0;o=o<0?-o:o;var l=ar.internal.getWidth(e)||0;l=l<0?-l:l;var c=function(k,E,q){if(k+1<a.length){var O=E+" "+a[k+1][0];return hS(O,e,q).width<=l-4}return!1};i++;e:for(;i>0;){t="",i--;var u,d,f=hS("3",e,i).height,m=e.multiline?o-i:(o-f)/2,h=m+=2,x=0,p=0,g=0;if(i<=0){t=`(...) Tj
`,t+="% Width of Text: "+hS(t,e,i=12).width+", FieldWidth:"+l+`
`;break}for(var v="",y=0,b=0;b<a.length;b++)if(a.hasOwnProperty(b)){var N=!1;if(a[b].length!==1&&g!==a[b].length-1){if((f+2)*(y+2)+2>o)continue e;v+=a[b][g],N=!0,p=b,b--}else{v=(v+=a[b][g]+" ").substr(v.length-1)==" "?v.substr(0,v.length-1):v;var j=parseInt(b),_=c(j,v,i),S=b>=a.length-1;if(_&&!S){v+=" ",g=0;continue}if(_||S){if(S)p=j;else if(e.multiline&&(f+2)*(y+2)+2>o)continue e}else{if(!e.multiline||(f+2)*(y+2)+2>o)continue e;p=j}}for(var P="",T=x;T<=p;T++){var R=a[T];if(e.multiline){if(T===p){P+=R[g]+" ",g=(g+1)%R.length;continue}if(T===x){P+=R[R.length-1]+" ";continue}}P+=R[0]+" "}switch(P=P.substr(P.length-1)==" "?P.substr(0,P.length-1):P,d=hS(P,e,i).width,e.textAlign){case"right":u=l-d-2;break;case"center":u=(l-d)/2;break;default:u=2}t+=Xr(u)+" "+Xr(h)+` Td
`,t+="("+X0(P)+`) Tj
`,t+=-Xr(u)+` 0 Td
`,h=-(i+2),d=0,x=N?p:p+1,y++,v=""}break}return n.text=t,n.fontSize=i,n},hS=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}},zFe={fields:[],xForms:[],acroFormDictionaryRoot:null,printedOut:!1,internal:null,isInitialized:!1},qFe=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)},UFe=function(e,t){if(t.scope=e,e.internal!==void 0&&(e.internal.acroformPlugin===void 0||e.internal.acroformPlugin.isInitialized===!1)){if(hd.FieldNum=0,e.internal.acroformPlugin=JSON.parse(JSON.stringify(zFe)),e.internal.acroformPlugin.acroFormDictionaryRoot)throw new Error("Exception while creating AcroformDictionary");gF=e.internal.scaleFactor,e.internal.acroformPlugin.acroFormDictionaryRoot=new ole,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&&qFe(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=$Fe(l.Rect,a)),a.internal.newObjectDeferredBegin(l.objId,!0),l.DA=ar.createDefaultAppearanceStream(l),os(l)==="object"&&typeof l.getKeyValueListForStream=="function"&&(c=l.getKeyValueListForStream()),l.Rect=u,l.hasAppearanceStream&&!l.appearanceStreamContent){var d=BFe(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 x=h[o];typeof x=="function"&&(x=x.call(a,l)),f+="/"+o+" "+x+" ",a.internal.acroformPlugin.xForms.indexOf(x)>=0||a.internal.acroformPlugin.xForms.push(x)}}else typeof(x=h)=="function"&&(x=x.call(a,l)),f+="/"+o+" "+x,a.internal.acroformPlugin.xForms.indexOf(x)>=0||a.internal.acroformPlugin.xForms.push(x);f+=">>"}c.push({key:"AP",value:`<<
`+f+">>"})}a.internal.putStream({additionalKeyValues:c,objectId:l.objId}),a.internal.out("endobj")}i&&function(p,g){for(var v in p)if(p.hasOwnProperty(v)){var y=v,b=p[v];g.internal.newObjectDeferredBegin(b.objId,!0),os(b)==="object"&&typeof b.putStream=="function"&&b.putStream(),delete p[y]}}(a.internal.acroformPlugin.xForms,a)})(r,e)}),e.internal.acroformPlugin.isInitialized=!0}},ale=pa.__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+=" "),os(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+="("+X0(n(e[i].toString()))+")"):a+=e[i].toString()}return a+"]"}throw new Error("Invalid argument passed to jsPDF.__acroform__.arrayToPdfArray")},UT=function(e,t,r){var n=function(a){return a};return t!==void 0&&r&&(n=r.internal.getEncryptor(t)),(e=e||"").toString(),"("+X0(n(e))+")"},Vd=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})};Vd.prototype.toString=function(){return this.objId+" 0 R"},Vd.prototype.putStream=function(){var e=this.getKeyValueListForStream();this.scope.internal.putStream({data:this.stream,additionalKeyValues:e,objectId:this.objId}),this.scope.internal.out("endobj")},Vd.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:ale(a,this.objId,this.scope)}):a instanceof Vd?(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 ile=function(){Vd.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}})};kl(ile,Vd);var ole=function(){Vd.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)),"("+X0(r(e))+")"}},set:function(r){e=r}})};kl(ole,Vd);var hd=function e(){Vd.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!!Ia(t,3)},set:function(v){v?this.F=Ra(t,3):this.F=La(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 k4)return;i="FieldObject"+e.FieldNum++}var v=function(y){return y};return this.scope&&(v=this.scope.internal.getEncryptor(this.objId)),"("+X0(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/gF: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 k4||this instanceof Qm))return UT(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 mi==0?UT(m,this.objId,this.scope):m},set:function(v){v=v.toString(),m=this instanceof mi==0?v.substr(0,1)==="("?Pg(v.substr(1,v.length-2)):Pg(v):v}}),Object.defineProperty(this,"defaultValue",{enumerable:!0,configurable:!0,get:function(){return this instanceof mi==1?Pg(m.substr(1,m.length-1)):m},set:function(v){v=v.toString(),m=this instanceof mi==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 mi==0?UT(h,this.objId,this.scope):h},set:function(v){v=v.toString(),h=this instanceof mi==0?v.substr(0,1)==="("?Pg(v.substr(1,v.length-2)):Pg(v):v}}),Object.defineProperty(this,"value",{enumerable:!0,configurable:!0,get:function(){return this instanceof mi==1?Pg(h.substr(1,h.length-1)):h},set:function(v){v=v.toString(),h=this instanceof mi==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 x,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(x)return x},set:function(v){x=v}}),Object.defineProperty(this,"readOnly",{enumerable:!0,configurable:!0,get:function(){return!!Ia(this.Ff,1)},set:function(v){v?this.Ff=Ra(this.Ff,1):this.Ff=La(this.Ff,1)}}),Object.defineProperty(this,"required",{enumerable:!0,configurable:!0,get:function(){return!!Ia(this.Ff,2)},set:function(v){v?this.Ff=Ra(this.Ff,2):this.Ff=La(this.Ff,2)}}),Object.defineProperty(this,"noExport",{enumerable:!0,configurable:!0,get:function(){return!!Ia(this.Ff,3)},set:function(v){v?this.Ff=Ra(this.Ff,3):this.Ff=La(this.Ff,3)}});var g=null;Object.defineProperty(this,"Q",{enumerable:!0,configurable:!1,get:function(){if(g!==null)return g},set:function(v){if([0,1,2].indexOf(v)===-1)throw new Error('Invalid value "'+v+'" for attribute Q supplied.');g=v}}),Object.defineProperty(this,"textAlign",{get:function(){var v;switch(g){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:g=2;break;case"center":case 1:g=1;break;default:g=0}}})};kl(hd,Vd);var Xx=function(){hd.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 ale(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!!Ia(this.Ff,18)},set:function(r){r?this.Ff=Ra(this.Ff,18):this.Ff=La(this.Ff,18)}}),Object.defineProperty(this,"edit",{enumerable:!0,configurable:!0,get:function(){return!!Ia(this.Ff,19)},set:function(r){this.combo===!0&&(r?this.Ff=Ra(this.Ff,19):this.Ff=La(this.Ff,19))}}),Object.defineProperty(this,"sort",{enumerable:!0,configurable:!0,get:function(){return!!Ia(this.Ff,20)},set:function(r){r?(this.Ff=Ra(this.Ff,20),t.sort()):this.Ff=La(this.Ff,20)}}),Object.defineProperty(this,"multiSelect",{enumerable:!0,configurable:!0,get:function(){return!!Ia(this.Ff,22)},set:function(r){r?this.Ff=Ra(this.Ff,22):this.Ff=La(this.Ff,22)}}),Object.defineProperty(this,"doNotSpellCheck",{enumerable:!0,configurable:!0,get:function(){return!!Ia(this.Ff,23)},set:function(r){r?this.Ff=Ra(this.Ff,23):this.Ff=La(this.Ff,23)}}),Object.defineProperty(this,"commitOnSelChange",{enumerable:!0,configurable:!0,get:function(){return!!Ia(this.Ff,27)},set:function(r){r?this.Ff=Ra(this.Ff,27):this.Ff=La(this.Ff,27)}}),this.hasAppearanceStream=!1};kl(Xx,hd);var Yx=function(){Xx.call(this),this.fontName="helvetica",this.combo=!1};kl(Yx,Xx);var Zx=function(){Yx.call(this),this.combo=!0};kl(Zx,Yx);var Cw=function(){Zx.call(this),this.edit=!0};kl(Cw,Zx);var mi=function(){hd.call(this),this.FT="/Btn",Object.defineProperty(this,"noToggleToOff",{enumerable:!0,configurable:!0,get:function(){return!!Ia(this.Ff,15)},set:function(r){r?this.Ff=Ra(this.Ff,15):this.Ff=La(this.Ff,15)}}),Object.defineProperty(this,"radio",{enumerable:!0,configurable:!0,get:function(){return!!Ia(this.Ff,16)},set:function(r){r?this.Ff=Ra(this.Ff,16):this.Ff=La(this.Ff,16)}}),Object.defineProperty(this,"pushButton",{enumerable:!0,configurable:!0,get:function(){return!!Ia(this.Ff,17)},set:function(r){r?this.Ff=Ra(this.Ff,17):this.Ff=La(this.Ff,17)}}),Object.defineProperty(this,"radioIsUnison",{enumerable:!0,configurable:!0,get:function(){return!!Ia(this.Ff,26)},set:function(r){r?this.Ff=Ra(this.Ff,26):this.Ff=La(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+" ("+X0(r(t[n]))+")");return a.push(">>"),a.join(`
`)}},set:function(r){os(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}})};kl(mi,hd);var Ew=function(){mi.call(this),this.pushButton=!0};kl(Ew,mi);var Jx=function(){mi.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:[]}})};kl(Jx,mi);var k4=function(){var e,t;hd.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+" ("+X0(a(n[i]))+")");return o.push(">>"),o.join(`
`)},set:function(a){os(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=ar.RadioButton.Circle,this.appearanceStreamContent=this._AppearanceType.createAppearanceStream(this.optionName)};kl(k4,hd),Jx.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()}},Jx.prototype.createOption=function(e){var t=new k4;return t.Parent=this,t.optionName=e,this.Kids.push(t),VFe.call(this.scope,t),t};var Aw=function(){mi.call(this),this.fontName="zapfdingbats",this.caption="3",this.appearanceState="On",this.value="On",this.textAlign="center",this.appearanceStreamContent=ar.CheckBox.createAppearanceStream()};kl(Aw,mi);var Qm=function(){hd.call(this),this.FT="/Tx",Object.defineProperty(this,"multiline",{enumerable:!0,configurable:!0,get:function(){return!!Ia(this.Ff,13)},set:function(t){t?this.Ff=Ra(this.Ff,13):this.Ff=La(this.Ff,13)}}),Object.defineProperty(this,"fileSelect",{enumerable:!0,configurable:!0,get:function(){return!!Ia(this.Ff,21)},set:function(t){t?this.Ff=Ra(this.Ff,21):this.Ff=La(this.Ff,21)}}),Object.defineProperty(this,"doNotSpellCheck",{enumerable:!0,configurable:!0,get:function(){return!!Ia(this.Ff,23)},set:function(t){t?this.Ff=Ra(this.Ff,23):this.Ff=La(this.Ff,23)}}),Object.defineProperty(this,"doNotScroll",{enumerable:!0,configurable:!0,get:function(){return!!Ia(this.Ff,24)},set:function(t){t?this.Ff=Ra(this.Ff,24):this.Ff=La(this.Ff,24)}}),Object.defineProperty(this,"comb",{enumerable:!0,configurable:!0,get:function(){return!!Ia(this.Ff,25)},set:function(t){t?this.Ff=Ra(this.Ff,25):this.Ff=La(this.Ff,25)}}),Object.defineProperty(this,"richText",{enumerable:!0,configurable:!0,get:function(){return!!Ia(this.Ff,26)},set:function(t){t?this.Ff=Ra(this.Ff,26):this.Ff=La(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}})};kl(Qm,hd);var Tw=function(){Qm.call(this),Object.defineProperty(this,"password",{enumerable:!0,configurable:!0,get:function(){return!!Ia(this.Ff,14)},set:function(e){e?this.Ff=Ra(this.Ff,14):this.Ff=La(this.Ff,14)}}),this.password=!0};kl(Tw,Qm);var ar={CheckBox:{createAppearanceStream:function(){return{N:{On:ar.CheckBox.YesNormal},D:{On:ar.CheckBox.YesPushDown,Off:ar.CheckBox.OffPushDown}}},YesPushDown:function(e){var t=Ed(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=E8(e,e.caption);return r.push("0.749023 g"),r.push("0 0 "+Xr(ar.internal.getWidth(e))+" "+Xr(ar.internal.getHeight(e))+" re"),r.push("f"),r.push("BMC"),r.push("q"),r.push("0 0 1 rg"),r.push("/"+n+" "+Xr(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=Ed(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=ar.internal.getHeight(e),o=ar.internal.getWidth(e),l=E8(e,e.caption);return a.push("1 g"),a.push("0 0 "+Xr(o)+" "+Xr(i)+" re"),a.push("f"),a.push("q"),a.push("0 0 1 rg"),a.push("0 0 "+Xr(o-1)+" "+Xr(i-1)+" re"),a.push("W"),a.push("n"),a.push("0 g"),a.push("BT"),a.push("/"+r+" "+Xr(l.fontSize)+" Tf "+n),a.push(l.text),a.push("ET"),a.push("Q"),t.stream=a.join(`
`),t},OffPushDown:function(e){var t=Ed(e);t.scope=e.scope;var r=[];return r.push("0.749023 g"),r.push("0 0 "+Xr(ar.internal.getWidth(e))+" "+Xr(ar.internal.getHeight(e))+" re"),r.push("f"),t.stream=r.join(`
`),t}},RadioButton:{Circle:{createAppearanceStream:function(e){var t={D:{Off:ar.RadioButton.Circle.OffPushDown},N:{}};return t.N[e]=ar.RadioButton.Circle.YesNormal,t.D[e]=ar.RadioButton.Circle.YesPushDown,t},getCA:function(){return"l"},YesNormal:function(e){var t=Ed(e);t.scope=e.scope;var r=[],n=ar.internal.getWidth(e)<=ar.internal.getHeight(e)?ar.internal.getWidth(e)/4:ar.internal.getHeight(e)/4;n=Number((.9*n).toFixed(5));var a=ar.internal.Bezier_C,i=Number((n*a).toFixed(5));return r.push("q"),r.push("1 0 0 1 "+nm(ar.internal.getWidth(e)/2)+" "+nm(ar.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=Ed(e);t.scope=e.scope;var r=[],n=ar.internal.getWidth(e)<=ar.internal.getHeight(e)?ar.internal.getWidth(e)/4:ar.internal.getHeight(e)/4;n=Number((.9*n).toFixed(5));var a=Number((2*n).toFixed(5)),i=Number((a*ar.internal.Bezier_C).toFixed(5)),o=Number((n*ar.internal.Bezier_C).toFixed(5));return r.push("0.749023 g"),r.push("q"),r.push("1 0 0 1 "+nm(ar.internal.getWidth(e)/2)+" "+nm(ar.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 "+nm(ar.internal.getWidth(e)/2)+" "+nm(ar.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=Ed(e);t.scope=e.scope;var r=[],n=ar.internal.getWidth(e)<=ar.internal.getHeight(e)?ar.internal.getWidth(e)/4:ar.internal.getHeight(e)/4;n=Number((.9*n).toFixed(5));var a=Number((2*n).toFixed(5)),i=Number((a*ar.internal.Bezier_C).toFixed(5));return r.push("0.749023 g"),r.push("q"),r.push("1 0 0 1 "+nm(ar.internal.getWidth(e)/2)+" "+nm(ar.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:ar.RadioButton.Cross.OffPushDown},N:{}};return t.N[e]=ar.RadioButton.Cross.YesNormal,t.D[e]=ar.RadioButton.Cross.YesPushDown,t},getCA:function(){return"8"},YesNormal:function(e){var t=Ed(e);t.scope=e.scope;var r=[],n=ar.internal.calculateCross(e);return r.push("q"),r.push("1 1 "+Xr(ar.internal.getWidth(e)-2)+" "+Xr(ar.internal.getHeight(e)-2)+" re"),r.push("W"),r.push("n"),r.push(Xr(n.x1.x)+" "+Xr(n.x1.y)+" m"),r.push(Xr(n.x2.x)+" "+Xr(n.x2.y)+" l"),r.push(Xr(n.x4.x)+" "+Xr(n.x4.y)+" m"),r.push(Xr(n.x3.x)+" "+Xr(n.x3.y)+" l"),r.push("s"),r.push("Q"),t.stream=r.join(`
`),t},YesPushDown:function(e){var t=Ed(e);t.scope=e.scope;var r=ar.internal.calculateCross(e),n=[];return n.push("0.749023 g"),n.push("0 0 "+Xr(ar.internal.getWidth(e))+" "+Xr(ar.internal.getHeight(e))+" re"),n.push("f"),n.push("q"),n.push("1 1 "+Xr(ar.internal.getWidth(e)-2)+" "+Xr(ar.internal.getHeight(e)-2)+" re"),n.push("W"),n.push("n"),n.push(Xr(r.x1.x)+" "+Xr(r.x1.y)+" m"),n.push(Xr(r.x2.x)+" "+Xr(r.x2.y)+" l"),n.push(Xr(r.x4.x)+" "+Xr(r.x4.y)+" m"),n.push(Xr(r.x3.x)+" "+Xr(r.x3.y)+" l"),n.push("s"),n.push("Q"),t.stream=n.join(`
`),t},OffPushDown:function(e){var t=Ed(e);t.scope=e.scope;var r=[];return r.push("0.749023 g"),r.push("0 0 "+Xr(ar.internal.getWidth(e))+" "+Xr(ar.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}};ar.internal={Bezier_C:.551915024494,calculateCross:function(e){var t=ar.internal.getWidth(e),r=ar.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}}}},ar.internal.getWidth=function(e){var t=0;return os(e)==="object"&&(t=bU(e.Rect[2])),t},ar.internal.getHeight=function(e){var t=0;return os(e)==="object"&&(t=bU(e.Rect[3])),t};var VFe=pa.addField=function(e){if(UFe(this,e),!(e instanceof hd))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};pa.AcroFormChoiceField=Xx,pa.AcroFormListBox=Yx,pa.AcroFormComboBox=Zx,pa.AcroFormEditBox=Cw,pa.AcroFormButton=mi,pa.AcroFormPushButton=Ew,pa.AcroFormRadioButton=Jx,pa.AcroFormCheckBox=Aw,pa.AcroFormTextField=Qm,pa.AcroFormPasswordField=Tw,pa.AcroFormAppearance=ar,pa.AcroForm={ChoiceField:Xx,ListBox:Yx,ComboBox:Zx,EditBox:Cw,Button:mi,PushButton:Ew,RadioButton:Jx,CheckBox:Aw,TextField:Qm,PasswordField:Tw,Appearance:ar},lr.AcroForm={ChoiceField:Xx,ListBox:Yx,ComboBox:Zx,EditBox:Cw,Button:mi,PushButton:Ew,RadioButton:Jx,CheckBox:Aw,TextField:Qm,PasswordField:Tw,Appearance:ar};var HFe=lr.AcroForm;function lle(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(k,E){var q,O,L,H,V,z=r;if((E=E||r)==="RGBA"||k.data!==void 0&&k.data instanceof Uint8ClampedArray&&"height"in k&&"width"in k)return"RGBA";if(_(k))for(V in n)for(L=n[V],q=0;q<L.length;q+=1){for(H=!0,O=0;O<L[q].length;O+=1)if(L[q][O]!==void 0&&L[q][O]!==k[O]){H=!1;break}if(H===!0){z=V;break}}else for(V in n)for(L=n[V],q=0;q<L.length;q+=1){for(H=!0,O=0;O<L[q].length;O+=1)if(L[q][O]!==void 0&&L[q][O]!==k.charCodeAt(O)){H=!1;break}if(H===!0){z=V;break}}return z===r&&E!==r&&(z=E),z},i=function k(E){for(var q=this.internal.write,O=this.internal.putStream,L=(0,this.internal.getFilters)();L.indexOf("FlateEncode")!==-1;)L.splice(L.indexOf("FlateEncode"),1);E.objectId=this.internal.newObject();var H=[];if(H.push({key:"Type",value:"/XObject"}),H.push({key:"Subtype",value:"/Image"}),H.push({key:"Width",value:E.width}),H.push({key:"Height",value:E.height}),E.colorSpace===v.INDEXED?H.push({key:"ColorSpace",value:"[/Indexed /DeviceRGB "+(E.palette.length/3-1)+" "+("sMask"in E&&E.sMask!==void 0?E.objectId+2:E.objectId+1)+" 0 R]"}):(H.push({key:"ColorSpace",value:"/"+E.colorSpace}),E.colorSpace===v.DEVICE_CMYK&&H.push({key:"Decode",value:"[1 0 1 0 1 0 1 0]"})),H.push({key:"BitsPerComponent",value:E.bitsPerComponent}),"decodeParameters"in E&&E.decodeParameters!==void 0&&H.push({key:"DecodeParms",value:"<<"+E.decodeParameters+">>"}),"transparency"in E&&Array.isArray(E.transparency)&&E.transparency.length>0){for(var V="",z=0,M=E.transparency.length;z<M;z++)V+=E.transparency[z]+" "+E.transparency[z]+" ";H.push({key:"Mask",value:"["+V+"]"})}E.sMask!==void 0&&H.push({key:"SMask",value:E.objectId+1+" 0 R"});var B=E.filter!==void 0?["/"+E.filter]:void 0;if(O({data:E.data,additionalKeyValues:H,alreadyAppliedFilters:B,objectId:E.objectId}),q("endobj"),"sMask"in E&&E.sMask!==void 0){var K,C=(K=E.sMaskBitsPerComponent)!==null&&K!==void 0?K:E.bitsPerComponent,A={width:E.width,height:E.height,colorSpace:"DeviceGray",bitsPerComponent:C,data:E.sMask};"filter"in E&&(A.decodeParameters="/Predictor ".concat(E.predictor," /Colors 1 /BitsPerComponent ").concat(C," /Columns ").concat(E.width),A.filter=E.filter),k.call(this,A)}if(E.colorSpace===v.INDEXED){var I=this.internal.newObject();O({data:P(new Uint8Array(E.palette)),objectId:I}),q("endobj")}},o=function(){var k=this.internal.collections[t+"images"];for(var E in k)i.call(this,k[E])},l=function(){var k,E=this.internal.collections[t+"images"],q=this.internal.write;for(var O in E)q("/I"+(k=E[O]).index,k.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 k=this.internal.collections[t+"images"];return c.call(this),k},d=function(){return Object.keys(this.internal.collections[t+"images"]).length},f=function(k){return typeof e["process"+k.toUpperCase()]=="function"},m=function(k){return os(k)==="object"&&k.nodeType===1},h=function(k,E){if(k.nodeName==="IMG"&&k.hasAttribute("src")){var q=""+k.getAttribute("src");if(q.indexOf("data:image/")===0)return _5(unescape(q).split("base64,").pop());var O=e.loadFile(q,!0);if(O!==void 0)return O}if(k.nodeName==="CANVAS"){if(k.width===0||k.height===0)throw new Error("Given canvas must have data. Canvas width: "+k.width+", height: "+k.height);var L;switch(E){case"PNG":L="image/png";break;case"WEBP":L="image/webp";break;default:L="image/jpeg"}return _5(k.toDataURL(L,1).split("base64,").pop())}},x=function(k){var E=this.internal.collections[t+"images"];if(E){for(var q in E)if(k===E[q].alias)return E[q]}},p=function(k,E,q){return k||E||(k=-96,E=-96),k<0&&(k=-1*q.width*72/k/this.internal.scaleFactor),E<0&&(E=-1*q.height*72/E/this.internal.scaleFactor),k===0&&(k=E*q.width/q.height),E===0&&(E=k*q.height/q.width),[k,E]},g=function(k,E,q,O,L,H){var V=p.call(this,q,O,L),z=this.internal.getCoordinateString,M=this.internal.getVerticalCoordinateString,B=u.call(this);if(q=V[0],O=V[1],B[L.index]=L,H){H*=Math.PI/180;var K=Math.cos(H),C=Math.sin(H),A=function(U){return U.toFixed(4)},I=[A(K),A(C),A(-1*C),A(K),0,0,"cm"]}this.internal.write("q"),H?(this.internal.write([1,"0","0",1,z(k),M(E+O),"cm"].join(" ")),this.internal.write(I.join(" ")),this.internal.write([z(q),"0","0",z(O),"0","0","cm"].join(" "))):this.internal.write([z(q),"0","0",z(O),z(k),M(E+O),"cm"].join(" ")),this.isAdvancedAPI()&&this.internal.write([1,0,0,-1,0,0,"cm"].join(" ")),this.internal.write("/I"+L.index+" Do"),this.internal.write("Q")},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 y=e.image_compression={NONE:"NONE",FAST:"FAST",MEDIUM:"MEDIUM",SLOW:"SLOW"},b=e.__addimage__.sHashCode=function(k){var E,q,O=0;if(typeof k=="string")for(q=k.length,E=0;E<q;E++)O=(O<<5)-O+k.charCodeAt(E),O|=0;else if(_(k))for(q=k.byteLength/2,E=0;E<q;E++)O=(O<<5)-O+k[E],O|=0;return O},N=e.__addimage__.validateStringAsBase64=function(k){(k=k||"").toString().trim();var E=!0;return k.length===0&&(E=!1),k.length%4!=0&&(E=!1),/^[A-Za-z0-9+/]+$/.test(k.substr(0,k.length-2))===!1&&(E=!1),/^[A-Za-z0-9/][A-Za-z0-9+/]|[A-Za-z0-9+/]=|==$/.test(k.substr(-2))===!1&&(E=!1),E},j=e.__addimage__.extractImageFromDataUrl=function(k){if(k==null||!(k=k.trim()).startsWith("data:"))return null;var E=k.indexOf(",");return E<0?null:k.substring(0,E).trim().endsWith("base64")?k.substring(E+1):null};e.__addimage__.isArrayBuffer=function(k){return k instanceof ArrayBuffer};var _=e.__addimage__.isArrayBufferView=function(k){return k instanceof Int8Array||k instanceof Uint8Array||k instanceof Uint8ClampedArray||k instanceof Int16Array||k instanceof Uint16Array||k instanceof Int32Array||k instanceof Uint32Array||k instanceof Float32Array||k instanceof Float64Array},S=e.__addimage__.binaryStringToUint8Array=function(k){for(var E=k.length,q=new Uint8Array(E),O=0;O<E;O++)q[O]=k.charCodeAt(O);return q},P=e.__addimage__.arrayBufferToBinaryString=function(k){for(var E="",q=_(k)?k:new Uint8Array(k),O=0;O<q.length;O+=8192)E+=String.fromCharCode.apply(null,q.subarray(O,O+8192));return E};e.addImage=function(){var k,E,q,O,L,H,V,z,M;if(typeof arguments[1]=="number"?(E=r,q=arguments[1],O=arguments[2],L=arguments[3],H=arguments[4],V=arguments[5],z=arguments[6],M=arguments[7]):(E=arguments[1],q=arguments[2],O=arguments[3],L=arguments[4],H=arguments[5],V=arguments[6],z=arguments[7],M=arguments[8]),os(k=arguments[0])==="object"&&!m(k)&&"imageData"in k){var B=k;k=B.imageData,E=B.format||E||r,q=B.x||q||0,O=B.y||O||0,L=B.w||B.width||L,H=B.h||B.height||H,V=B.alias||V,z=B.compression||z,M=B.rotation||B.angle||M}var K=this.internal.getFilters();if(z===void 0&&K.indexOf("FlateEncode")!==-1&&(z="SLOW"),isNaN(q)||isNaN(O))throw new Error("Invalid coordinates passed to jsPDF.addImage");c.call(this);var C=T.call(this,k,E,V,z);return g.call(this,q,O,L,H,C,M),this};var T=function(k,E,q,O){var L,H,V;if(typeof k=="string"&&a(k)===r){k=unescape(k);var z=R(k,!1);(z!==""||(z=e.loadFile(k,!0))!==void 0)&&(k=z)}if(m(k)&&(k=h(k,E)),E=a(k,E),!f(E))throw new Error("addImage does not support files of type '"+E+"', please ensure that a plugin for '"+E+"' support is added.");if(((V=q)==null||V.length===0)&&(q=function(M){return typeof M=="string"||_(M)?b(M):_(M.data)?b(M.data):null}(k)),(L=x.call(this,q))||(k instanceof Uint8Array||E==="RGBA"||(H=k,k=S(k)),L=this["process"+E.toUpperCase()](k,d.call(this),q,function(M){return M&&typeof M=="string"&&(M=M.toUpperCase()),M in e.image_compression?M:y.NONE}(O),H)),!L)throw new Error("An unknown error occurred whilst processing the image.");return L},R=e.__addimage__.convertBase64ToBinaryString=function(k,E){E=typeof E!="boolean"||E;var q,O="";if(typeof k=="string"){var L;q=(L=j(k))!==null&&L!==void 0?L:k;try{O=_5(q)}catch(H){if(E)throw N(q)?new Error("atob-Error in jsPDF.convertBase64ToBinaryString "+H.message):new Error("Supplied Data is not a valid base64-String jsPDF.convertBase64ToBinaryString ")}}return O};e.getImageProperties=function(k){var E,q,O="";if(m(k)&&(k=h(k)),typeof k=="string"&&a(k)===r&&((O=R(k,!1))===""&&(O=e.loadFile(k)||""),k=O),q=a(k),!f(q))throw new Error("addImage does not support files of type '"+q+"', please ensure that a plugin for '"+q+"' support is added.");if(k instanceof Uint8Array||(k=S(k)),!(E=this["process"+q.toUpperCase()](k)))throw new Error("An unknown error occurred whilst processing the image");return E.fileType=q,E}})(lr.API),function(e){var t=function(r){if(r!==void 0&&r!="")return!0};lr.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,x=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(),g=this.internal.newAdditionalObject(),v=this.internal.getEncryptor(p.objId),y=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 "+g.objId+" 0 R",i+=" /P "+c.objId+" 0 R",i+=" /T ("+h(v(y))+") >>",p.content=i;var b=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 "+b,n.open&&(i+=" /Open true"),i+=" >>",g.content=i,this.internal.write(p.objId,"0 R",g.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(x(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 j=this.annotations._nameMap[n.options.name];n.options.pageNumber=j.page,n.options.top=j.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(x(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 _=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+" "+_+" "+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}}(lr.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 g=0,v=r,y="",b=0;for(g=0;g<p.length;g+=1)v[p.charCodeAt(g)]!==void 0?(b++,typeof(v=v[p.charCodeAt(g)])=="number"&&(y+=String.fromCharCode(v),v=r,b=0),g===p.length-1&&(v=r,y+=p.charAt(g-(b-1)),g-=b-1,b=0)):(v=r,y+=p.charAt(g-b),g-=b,b=0);return y};e.__arabicParser__.isArabicDiacritic=function(p){return p!==void 0&&n[p.charCodeAt(0)]!==void 0};var m=e.__arabicParser__.getCorrectForm=function(p,g,v){return o(p)?i(p)===!1?-1:!u(p)||!o(g)&&!o(v)||!o(v)&&l(g)||l(p)&&!o(g)||l(p)&&c(g)||l(p)&&l(g)?0:d(p)&&o(g)&&!l(g)&&o(v)&&u(v)?3:l(p)||!o(v)?1:2:-1},h=function(p){var g=0,v=0,y=0,b="",N="",j="",_=(p=p||"").split("\\s+"),S=[];for(g=0;g<_.length;g+=1){for(S.push(""),v=0;v<_[g].length;v+=1)b=_[g][v],N=_[g][v-1],j=_[g][v+1],o(b)?(y=m(b,N,j),S[g]+=y!==-1?String.fromCharCode(t[b.charCodeAt(0)][y]):b):S[g]+=b;S[g]=f(S[g])}return S.join(" ")},x=e.__arabicParser__.processArabic=e.processArabic=function(){var p,g=typeof arguments[0]=="string"?arguments[0]:arguments[0].text,v=[];if(Array.isArray(g)){var y=0;for(v=[],y=0;y<g.length;y+=1)Array.isArray(g[y])?v.push([h(g[y][0]),g[y][1],g[y][2]]):v.push([h(g[y])]);p=v}else p=h(g);return typeof arguments[0]=="string"?p:(arguments[0].text=p,arguments[0])};e.events.push(["preProcessText",x])}(lr.API),lr.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}])}(lr.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 x=arguments[6];return Object.defineProperty(this,"align",{enumerable:!0,get:function(){return x},set:function(p){x=p}}),this};i.prototype.clone=function(){return new i(this.x,this.y,this.width,this.height,this.text,this.lineNumber,this.align)},i.prototype.toArray=function(){return[this.x,this.y,this.width,this.height,this.text,this.lineNumber,this.align]},e.setHeaderFunction=function(c){return 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,x=0,p=0,g=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(b,N){return b.concat(g.splitTextToSize(N,v))},[])):c=Array.isArray(c)?c:[c];for(var y=0;y<c.length;y++)h<(p=this.getStringUnitWidth(c[y],{font:f})*d)&&(h=p);return h!==0&&(x=c.length),{w:h/=m,h:Math.max((x*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,x,p,g,v=[],y=[],b=[],N={},j={},_=[],S=[],P=(m=m||{}).autoSize||!1,T=m.printHeaders!==!1,R=m.css&&m.css["font-size"]!==void 0?16*m.css["font-size"]:m.fontSize||12,k=m.margins||Object.assign({width:this.getPageWidth()},t),E=typeof m.padding=="number"?m.padding:3,q=m.headerBackgroundColor||"#c8c8c8",O=m.headerTextColor||"#000";if(a.call(this),this.internal.__cell__.printHeaders=T,this.internal.__cell__.margins=k,this.internal.__cell__.table_font_size=R,this.internal.__cell__.padding=E,this.internal.__cell__.headerBackgroundColor=q,this.internal.__cell__.headerTextColor=O,this.setFontSize(R),f==null)y=v=Object.keys(d[0]),b=v.map(function(){return"left"});else if(Array.isArray(f)&&os(f[0])==="object")for(v=f.map(function(B){return B.name}),y=f.map(function(B){return B.prompt||B.name||""}),b=f.map(function(B){return B.align||"left"}),h=0;h<f.length;h+=1)j[f[h].name]=.7499990551181103*f[h].width;else Array.isArray(f)&&typeof f[0]=="string"&&(y=v=f,b=v.map(function(){return"left"}));if(P||Array.isArray(f)&&typeof f[0]=="string")for(h=0;h<v.length;h+=1){for(N[g=v[h]]=d.map(function(B){return B[g]}),this.setFont(void 0,"bold"),_.push(this.getTextDimensions(y[h],{fontSize:this.internal.__cell__.table_font_size,scaleFactor:this.internal.scaleFactor}).w),x=N[g],this.setFont(void 0,"normal"),p=0;p<x.length;p+=1)_.push(this.getTextDimensions(x[p],{fontSize:this.internal.__cell__.table_font_size,scaleFactor:this.internal.scaleFactor}).w);j[g]=Math.max.apply(null,_)+E+E,_=[]}if(T){var L={};for(h=0;h<v.length;h+=1)L[v[h]]={},L[v[h]].text=y[h],L[v[h]].align=b[h];var H=l.call(this,L,j);S=v.map(function(B){return new i(c,u,j[B],H,L[B].text,void 0,L[B].align)}),this.setTableHeaderRow(S),this.printHeaderRow(1,!1)}var V=f.reduce(function(B,K){return B[K.name]=K.align,B},{});for(h=0;h<d.length;h+=1){"rowStart"in m&&m.rowStart instanceof Function&&m.rowStart({row:h,data:d[h]},this);var z=l.call(this,d[h],j);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,j[v[p]],z,M,h+2,V[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 x=c[h];return this.splitTextToSize(x.hasOwnProperty("text")?x.text:x,u[h]-d-d)},this).map(function(h){return this.getLineHeightFactor()*h.length*f/m+d+d},this).reduce(function(h,x){return Math.max(h,x)},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 x=this.getTextColor();this.setTextColor(this.internal.__cell__.headerTextColor),this.setFillColor(this.internal.__cell__.headerBackgroundColor),o.call(this,d),this.setTextColor(x)}m.length>0&&this.setTableHeaderRow(m),this.setFont(void 0,"normal"),r=!1}}(lr.API);var cle={italic:["italic","oblique","normal"],oblique:["oblique","italic","normal"],normal:["normal","oblique","italic"]},ule=["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"],A8=lle(ule),dle=[100,200,300,400,500,600,700,800,900],WFe=lle(dle);function VT(e){var t=e.family.replace(/"|'/g,"").toLowerCase(),r=function(i){return cle[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 A8[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 wU(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 GFe={"sans-serif":"helvetica",fixed:"courier",monospace:"courier",terminal:"courier",cursive:"times",fantasy:"times",serif:"times"},jU={caption:"times",icon:"times",menu:"times","message-box":"times","small-caption":"times","status-bar":"times"};function _U(e){return[e.stretch,e.style,e.weight,e.family].join(" ")}function NU(e){return e.trimLeft()}function KFe(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 XFe(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 mS,SU,kU,Og,pS,CU,EU,AU,HT=["times"];function TU(e,t,r,n,a){var i=4,o=OU;switch(a){case lr.API.image_compression.FAST:i=1,o=PU;break;case lr.API.image_compression.MEDIUM:i=6,o=DU;break;case lr.API.image_compression.SLOW:i=9,o=IU}e=function(c,u,d,f){for(var m,h=c.length/u,x=new Uint8Array(c.length+h),p=[YFe,PU,OU,DU,IU],g=0;g<h;g+=1){var v=g*u,y=c.subarray(v,v+u);if(f)x.set(f(y,d,m),v+g);else{for(var b=p.length,N=[],j=0;j<b;j+=1)N[j]=p[j](y,d,m);var _=JFe(N.concat());x.set(N[_],v+g)}m=y}return x}(e,t,Math.ceil(r*n/8),o);var l=j8(e,{level:i});return lr.API.__addimage__.arrayBufferToBinaryString(l)}function YFe(e){var t=Array.apply([],e);return t.unshift(0),t}function PU(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 OU(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 DU(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 IU(e,t,r){var n=e.length,a=[];a[0]=4;for(var i=0;i<n;i+=1){var o=ZFe(e[i-t]||0,r&&r[i]||0,r&&r[i-t]||0);a[i+1]=e[i]-o+256&255}return a}function ZFe(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 JFe(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 WT(e,t,r){var n=t*r,a=Math.floor(n/8),i=16-(n-8*a+r),o=(1<<r)-1;return fle(e,a)>>i&o}function RU(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,fle(e,i)&~(l<<o)&65535|c)}function fle(e,t){return t+1<e.byteLength?e.getUint16(t,!1):e.getUint8(t)<<8}function QFe(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,x=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,x=e[t++]|e[t++]<<8,t++;else for(t+=12;;){if(!((k=e[t++])>=0))throw Error("Invalid block size");if(k===0)break;t+=k}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(!((k=e[t++])>=0))throw Error("Invalid block size");if(k===0)break;t+=k}break;default:throw new Error("Unknown graphic control label: 0x"+e[t-1].toString(16))}break;case 44:var g=e[t++]|e[t++]<<8,v=e[t++]|e[t++]<<8,y=e[t++]|e[t++]<<8,b=e[t++]|e[t++]<<8,N=e[t++],j=N>>6&1,_=1<<1+(7&N),S=l,P=c,T=!1;N>>7&&(T=!0,S=t,P=_,t+=3*_);var R=t;for(t++;;){var k;if(!((k=e[t++])>=0))throw Error("Invalid block size");if(k===0)break;t+=k}d.push({x:g,y:v,width:y,height:b,has_local_palette:T,palette_offset:S,palette_size:P,data_offset:R,data_length:t-R,transparent_index:m,interlaced:!!j,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 x},this.frameInfo=function(E){if(E<0||E>=d.length)throw new Error("Frame index out of range.");return d[E]},this.decodeAndBlitFrameBGRA=function(E,q){var O=this.frameInfo(E),L=O.width*O.height,H=new Uint8Array(L);LU(e,O.data_offset,H,L);var V=O.palette_offset,z=O.transparent_index;z===null&&(z=256);var M=O.width,B=r-M,K=M,C=4*(O.y*r+O.x),A=4*((O.y+O.height)*r+O.x),I=C,U=4*B;O.interlaced===!0&&(U+=4*r*7);for(var Y=8,te=0,re=H.length;te<re;++te){var J=H[te];if(K===0&&(K=M,(I+=U)>=A&&(U=4*B+4*r*(Y-1),I=C+(M+B)*(Y<<1),Y>>=1)),J===z)I+=4;else{var ie=e[V+3*J],be=e[V+3*J+1],Q=e[V+3*J+2];q[I++]=Q,q[I++]=be,q[I++]=ie,q[I++]=255}--K}},this.decodeAndBlitFrameRGBA=function(E,q){var O=this.frameInfo(E),L=O.width*O.height,H=new Uint8Array(L);LU(e,O.data_offset,H,L);var V=O.palette_offset,z=O.transparent_index;z===null&&(z=256);var M=O.width,B=r-M,K=M,C=4*(O.y*r+O.x),A=4*((O.y+O.height)*r+O.x),I=C,U=4*B;O.interlaced===!0&&(U+=4*r*7);for(var Y=8,te=0,re=H.length;te<re;++te){var J=H[te];if(K===0&&(K=M,(I+=U)>=A&&(U=4*B+4*r*(Y-1),I=C+(M+B)*(Y<<1),Y>>=1)),J===z)I+=4;else{var ie=e[V+3*J],be=e[V+3*J+1],Q=e[V+3*J+2];q[I++]=ie,q[I++]=be,q[I++]=Q,q[I++]=255}--K}}}function LU(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++],x=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 g=f&u;if(f>>=c,d-=c,g!==i){if(g===o)break;for(var v=g<l?g:p,y=0,b=v;b>i;)b=x[b]>>8,++y;var N=b;if(m+y+(v!==g?1:0)>n)return void gs.log("Warning, gif stream longer than expected.");r[m++]=N;var j=m+=y;for(v!==g&&(r[m++]=N),b=v;y--;)b=x[b],r[--j]=255&b,b>>=8;p!==null&&l<4096&&(x[l++]=p<<8|N,l>=u+1&&c<12&&(++c,u=u<<1|1)),p=g}else l=o+1,u=(1<<(c=a+1))-1,p=null}return m!==n&&gs.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 GT(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),x=new Array(64),p=[],g=0,v=7,y=new Array(64),b=new Array(64),N=new Array(64),j=new Array(256),_=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],P=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],T=[0,1,2,3,4,5,6,7,8,9,10,11],R=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],k=[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],E=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],q=[0,1,2,3,4,5,6,7,8,9,10,11],O=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],L=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];function H(C,A){for(var I=0,U=0,Y=new Array,te=1;te<=16;te++){for(var re=1;re<=C[te];re++)Y[A[U]]=[],Y[A[U]][0]=I,Y[A[U]][1]=te,U++,I++;I*=2}return Y}function V(C){for(var A=C[0],I=C[1]-1;I>=0;)A&1<<I&&(g|=1<<v),I--,--v<0&&(g==255?(z(255),z(0)):z(g),v=7,g=0)}function z(C){p.push(C)}function M(C){z(C>>8&255),z(255&C)}function B(C,A,I,U,Y){for(var te,re=Y[0],J=Y[240],ie=function(le,Me){var de,me,Le,Ke,ve,_e,Ue,Qe,st,Fe,Ge=0;for(st=0;st<8;++st){de=le[Ge],me=le[Ge+1],Le=le[Ge+2],Ke=le[Ge+3],ve=le[Ge+4],_e=le[Ge+5],Ue=le[Ge+6];var ht=de+(Qe=le[Ge+7]),ut=de-Qe,Mt=me+Ue,Wt=me-Ue,zt=Le+_e,Lt=Le-_e,or=Ke+ve,Yt=Ke-ve,ot=ht+or,fr=ht-or,Et=Mt+zt,Ct=Mt-zt;le[Ge]=ot+Et,le[Ge+4]=ot-Et;var hr=.707106781*(Ct+fr);le[Ge+2]=fr+hr,le[Ge+6]=fr-hr;var Gt=.382683433*((ot=Yt+Lt)-(Ct=Wt+ut)),Jt=.5411961*ot+Gt,mr=1.306562965*Ct+Gt,mn=.707106781*(Et=Lt+Wt),Xt=ut+mn,fn=ut-mn;le[Ge+5]=fn+Jt,le[Ge+3]=fn-Jt,le[Ge+1]=Xt+mr,le[Ge+7]=Xt-mr,Ge+=8}for(Ge=0,st=0;st<8;++st){de=le[Ge],me=le[Ge+8],Le=le[Ge+16],Ke=le[Ge+24],ve=le[Ge+32],_e=le[Ge+40],Ue=le[Ge+48];var Xn=de+(Qe=le[Ge+56]),rn=de-Qe,wn=me+Ue,On=me-Ue,ts=Le+_e,pe=Le-_e,Ae=Ke+ve,Ne=Ke-ve,ke=Xn+Ae,Pe=Xn-Ae,Re=wn+ts,Ce=wn-ts;le[Ge]=ke+Re,le[Ge+32]=ke-Re;var $e=.707106781*(Ce+Pe);le[Ge+16]=Pe+$e,le[Ge+48]=Pe-$e;var Be=.382683433*((ke=Ne+pe)-(Ce=On+rn)),Ze=.5411961*ke+Be,et=1.306562965*Ce+Be,wt=.707106781*(Re=pe+On),Rt=rn+wt,qt=rn-wt;le[Ge+40]=qt+Ze,le[Ge+24]=qt-Ze,le[Ge+8]=Rt+et,le[Ge+56]=Rt-et,Ge++}for(st=0;st<64;++st)Fe=le[st]*Me[st],h[st]=Fe>0?Fe+.5|0:Fe-.5|0;return h}(C,A),be=0;be<64;++be)x[S[be]]=ie[be];var Q=x[0]-I;I=x[0],Q==0?V(U[0]):(V(U[m[te=32767+Q]]),V(f[te]));for(var Ve=63;Ve>0&&x[Ve]==0;)Ve--;if(Ve==0)return V(re),I;for(var W,Z=1;Z<=Ve;){for(var he=Z;x[Z]==0&&Z<=Ve;)++Z;var se=Z-he;if(se>=16){W=se>>4;for(var oe=1;oe<=W;++oe)V(J);se&=15}te=32767+x[Z],V(Y[(se<<4)+m[te]]),V(f[te]),Z++}return Ve!=63&&V(re),I}function K(C){C=Math.min(Math.max(C,1),100),i!=C&&(function(A){for(var I=[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((I[U]*A+50)/100);Y=Math.min(Math.max(Y,1),255),l[S[U]]=Y}for(var te=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],re=0;re<64;re++){var J=o((te[re]*A+50)/100);J=Math.min(Math.max(J,1),255),c[S[re]]=J}for(var ie=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],be=0,Q=0;Q<8;Q++)for(var Ve=0;Ve<8;Ve++)u[be]=1/(l[S[be]]*ie[Q]*ie[Ve]*8),d[be]=1/(c[S[be]]*ie[Q]*ie[Ve]*8),be++}(C<50?Math.floor(5e3/C):Math.floor(200-2*C)),i=C)}this.encode=function(C,A){A&&K(A),p=new Array,g=0,v=7,M(65496),M(65504),M(16),z(74),z(70),z(73),z(70),z(0),z(1),z(1),z(0),M(1),M(1),z(0),z(0),function(){M(65499),M(132),z(0);for(var me=0;me<64;me++)z(l[me]);z(1);for(var Le=0;Le<64;Le++)z(c[Le])}(),function(me,Le){M(65472),M(17),z(8),M(Le),M(me),z(3),z(1),z(17),z(0),z(2),z(17),z(1),z(3),z(17),z(1)}(C.width,C.height),function(){M(65476),M(418),z(0);for(var me=0;me<16;me++)z(P[me+1]);for(var Le=0;Le<=11;Le++)z(T[Le]);z(16);for(var Ke=0;Ke<16;Ke++)z(R[Ke+1]);for(var ve=0;ve<=161;ve++)z(k[ve]);z(1);for(var _e=0;_e<16;_e++)z(E[_e+1]);for(var Ue=0;Ue<=11;Ue++)z(q[Ue]);z(17);for(var Qe=0;Qe<16;Qe++)z(O[Qe+1]);for(var st=0;st<=161;st++)z(L[st])}(),M(65498),M(12),z(3),z(1),z(0),z(2),z(17),z(3),z(17),z(0),z(63),z(0);var I=0,U=0,Y=0;g=0,v=7,this.encode.displayName="_encode_";for(var te,re,J,ie,be,Q,Ve,W,Z,he=C.data,se=C.width,oe=C.height,le=4*se,Me=0;Me<oe;){for(te=0;te<le;){for(be=le*Me+te,Ve=-1,W=0,Z=0;Z<64;Z++)Q=be+(W=Z>>3)*le+(Ve=4*(7&Z)),Me+W>=oe&&(Q-=le*(Me+1+W-oe)),te+Ve>=le&&(Q-=te+Ve-le+4),re=he[Q++],J=he[Q++],ie=he[Q++],y[Z]=(_[re]+_[J+256|0]+_[ie+512|0]>>16)-128,b[Z]=(_[re+768|0]+_[J+1024|0]+_[ie+1280|0]>>16)-128,N[Z]=(_[re+1280|0]+_[J+1536|0]+_[ie+1792|0]>>16)-128;I=B(y,u,I,t,n),U=B(b,d,U,r,a),Y=B(N,d,Y,r,a),te+=32}Me+=8}if(v>=0){var de=[];de[1]=v+1,de[0]=(1<<v+1)-1,V(de)}return M(65497),new Uint8Array(p)},e=e||50,function(){for(var C=String.fromCharCode,A=0;A<256;A++)j[A]=C(A)}(),t=H(P,T),r=H(E,q),n=H(R,k),a=H(O,L),function(){for(var C=1,A=2,I=1;I<=15;I++){for(var U=C;U<A;U++)m[32767+U]=I,f[32767+U]=[],f[32767+U][1]=I,f[32767+U][0]=U;for(var Y=-(A-1);Y<=-C;Y++)m[32767+Y]=I,f[32767+Y]=[],f[32767+Y][1]=I,f[32767+Y][0]=A-1+Y;C<<=1,A<<=1}}(),function(){for(var C=0;C<256;C++)_[C]=19595*C,_[C+256|0]=38470*C,_[C+512|0]=7471*C+32768,_[C+768|0]=-11059*C,_[C+1024|0]=-21709*C,_[C+1280|0]=32768*C+8421375,_[C+1536|0]=-27439*C,_[C+1792|0]=-5329*C}(),K(e)}/**
* @license
* Copyright (c) 2017 Aras Abbasi
*
* Licensed under the MIT License.
* http://opensource.org/licenses/mit-license
*/function _u(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 FU(e){function t(T){if(!T)throw Error("assert :P")}function r(T,R,k){for(var E=0;4>E;E++)if(T[R+E]!=k.charCodeAt(E))return!0;return!1}function n(T,R,k,E,q){for(var O=0;O<q;O++)T[R+O]=k[E+O]}function a(T,R,k,E){for(var q=0;q<E;q++)T[R+q]=k}function i(T){return new Int32Array(T)}function o(T,R){for(var k=[],E=0;E<T;E++)k.push(new R);return k}function l(T,R){var k=[];return function E(q,O,L){for(var H=L[O],V=0;V<H&&(q.push(L.length>O+1?[]:new R),!(L.length<O+1));V++)E(q[V],O+1,L)}(k,0,T),k}var c=function(){var T=this;function R(D,F){for(var X=1<<F-1>>>0;D&X;)X>>>=1;return X?(D&X-1)+X:D}function k(D,F,X,ee,fe){t(!(ee%X));do D[F+(ee-=X)]=fe;while(0<ee)}function E(D,F,X,ee,fe){if(t(2328>=fe),512>=fe)var xe=i(512);else if((xe=i(fe))==null)return 0;return function(ge,we,Se,Oe,He,at){var De,Ye,tt=we,ft=1<<Se,rt=i(16),xt=i(16);for(t(He!=0),t(Oe!=null),t(ge!=null),t(0<Se),Ye=0;Ye<He;++Ye){if(15<Oe[Ye])return 0;++rt[Oe[Ye]]}if(rt[0]==He)return 0;for(xt[1]=0,De=1;15>De;++De){if(rt[De]>1<<De)return 0;xt[De+1]=xt[De]+rt[De]}for(Ye=0;Ye<He;++Ye)De=Oe[Ye],0<Oe[Ye]&&(at[xt[De]++]=Ye);if(xt[15]==1)return(Oe=new q).g=0,Oe.value=at[0],k(ge,tt,1,ft,Oe),ft;var bt,At=-1,Nt=ft-1,gr=0,sr=1,an=1,ur=1<<Se;for(Ye=0,De=1,He=2;De<=Se;++De,He<<=1){if(sr+=an<<=1,0>(an-=rt[De]))return 0;for(;0<rt[De];--rt[De])(Oe=new q).g=De,Oe.value=at[Ye++],k(ge,tt+gr,He,ur,Oe),gr=R(gr,De)}for(De=Se+1,He=2;15>=De;++De,He<<=1){if(sr+=an<<=1,0>(an-=rt[De]))return 0;for(;0<rt[De];--rt[De]){if(Oe=new q,(gr&Nt)!=At){for(tt+=ur,bt=1<<(At=De)-Se;15>At&&!(0>=(bt-=rt[At]));)++At,bt<<=1;ft+=ur=1<<(bt=At-Se),ge[we+(At=gr&Nt)].g=bt+Se,ge[we+At].value=tt-we-At}Oe.g=De-Se,Oe.value=at[Ye++],k(ge,tt+(gr>>Se),He,ur,Oe),gr=R(gr,De)}}return sr!=2*xt[15]-1?0:ft}(D,F,X,ee,fe,xe)}function q(){this.value=this.g=0}function O(){this.value=this.g=0}function L(){this.G=o(5,q),this.H=i(5),this.jc=this.Qb=this.qb=this.nd=0,this.pd=o(Qp,O)}function H(D,F,X,ee){t(D!=null),t(F!=null),t(2147483648>ee),D.Ca=254,D.I=0,D.b=-8,D.Ka=0,D.oa=F,D.pa=X,D.Jd=F,D.Yc=X+ee,D.Zc=4<=ee?X+ee-4+1:X,re(D)}function V(D,F){for(var X=0;0<F--;)X|=ie(D,128)<<F;return X}function z(D,F){var X=V(D,F);return J(D)?-X:X}function M(D,F,X,ee){var fe,xe=0;for(t(D!=null),t(F!=null),t(4294967288>ee),D.Sb=ee,D.Ra=0,D.u=0,D.h=0,4<ee&&(ee=4),fe=0;fe<ee;++fe)xe+=F[X+fe]<<8*fe;D.Ra=xe,D.bb=ee,D.oa=F,D.pa=X}function B(D){for(;8<=D.u&&D.bb<D.Sb;)D.Ra>>>=8,D.Ra+=D.oa[D.pa+D.bb]<<Mh-8>>>0,++D.bb,D.u-=8;U(D)&&(D.h=1,D.u=0)}function K(D,F){if(t(0<=F),!D.h&&F<=Tl){var X=I(D)&Al[F];return D.u+=F,B(D),X}return D.h=1,D.u=0}function C(){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 I(D){return D.Ra>>>(D.u&Mh-1)>>>0}function U(D){return t(D.bb<=D.Sb),D.h||D.bb==D.Sb&&D.u>Mh}function Y(D,F){D.u=F,D.h=U(D)}function te(D){D.u>=Cf&&(t(D.u>=Cf),B(D))}function re(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 J(D){return V(D,1)}function ie(D,F){var X=D.Ca;0>D.b&&re(D);var ee=D.b,fe=X*F>>>8,xe=(D.I>>>ee>fe)+0;for(xe?(X-=fe,D.I-=fe+1<<ee>>>0):X=fe+1,ee=X,fe=0;256<=ee;)fe+=8,ee>>=8;return ee=7^fe+$h[ee],D.b-=ee,D.Ca=(X<<ee)-1,xe}function be(D,F,X){D[F+0]=X>>24&255,D[F+1]=X>>16&255,D[F+2]=X>>8&255,D[F+3]=255&X}function Q(D,F){return D[F+0]|D[F+1]<<8}function Ve(D,F){return Q(D,F)|D[F+2]<<16}function W(D,F){return Q(D,F)|Q(D,F+2)<<16}function Z(D,F){var X=1<<F;return t(D!=null),t(0<F),D.X=i(X),D.X==null?0:(D.Mb=32-F,D.Xa=F,1)}function he(D,F){t(D!=null),t(F!=null),t(D.Xa==F.Xa),n(F.X,0,D.X,0,1<<F.Xa)}function se(){this.X=[],this.Xa=this.Mb=0}function oe(D,F,X,ee){t(X!=null),t(ee!=null);var fe=X[0],xe=ee[0];return fe==0&&(fe=(D*xe+F/2)/F),xe==0&&(xe=(F*fe+D/2)/D),0>=fe||0>=xe?0:(X[0]=fe,ee[0]=xe,1)}function le(D,F){return D+(1<<F)-1>>>F}function Me(D,F){return((4278255360&D)+(4278255360&F)>>>0&4278255360)+((16711935&D)+(16711935&F)>>>0&16711935)>>>0}function de(D,F){T[F]=function(X,ee,fe,xe,ge,we,Se){var Oe;for(Oe=0;Oe<ge;++Oe){var He=T[D](we[Se+Oe-1],fe,xe+Oe);we[Se+Oe]=Me(X[ee+Oe],He)}}}function me(){this.ud=this.hd=this.jd=0}function Le(D,F){return((4278124286&(D^F))>>>1)+(D&F)>>>0}function Ke(D){return 0<=D&&256>D?D:0>D?0:255<D?255:void 0}function ve(D,F){return Ke(D+(D-F+.5>>1))}function _e(D,F,X){return Math.abs(F-X)-Math.abs(D-X)}function Ue(D,F,X,ee,fe,xe,ge){for(ee=xe[ge-1],X=0;X<fe;++X)xe[ge+X]=ee=Me(D[F+X],ee)}function Qe(D,F,X,ee,fe){var xe;for(xe=0;xe<X;++xe){var ge=D[F+xe],we=ge>>8&255,Se=16711935&(Se=(Se=16711935&ge)+((we<<16)+we));ee[fe+xe]=(4278255360&ge)+Se>>>0}}function st(D,F){F.jd=255&D,F.hd=D>>8&255,F.ud=D>>16&255}function Fe(D,F,X,ee,fe,xe){var ge;for(ge=0;ge<ee;++ge){var we=F[X+ge],Se=we>>>8,Oe=we,He=255&(He=(He=we>>>16)+((D.jd<<24>>24)*(Se<<24>>24)>>>5));Oe=255&(Oe=(Oe+=(D.hd<<24>>24)*(Se<<24>>24)>>>5)+((D.ud<<24>>24)*(He<<24>>24)>>>5)),fe[xe+ge]=(4278255360&we)+(He<<16)+Oe}}function Ge(D,F,X,ee,fe){T[F]=function(xe,ge,we,Se,Oe,He,at,De,Ye){for(Se=at;Se<De;++Se)for(at=0;at<Ye;++at)Oe[He++]=fe(we[ee(xe[ge++])])},T[D]=function(xe,ge,we,Se,Oe,He,at){var De=8>>xe.b,Ye=xe.Ea,tt=xe.K[0],ft=xe.w;if(8>De)for(xe=(1<<xe.b)-1,ft=(1<<De)-1;ge<we;++ge){var rt,xt=0;for(rt=0;rt<Ye;++rt)rt&xe||(xt=ee(Se[Oe++])),He[at++]=fe(tt[xt&ft]),xt>>=De}else T["VP8LMapColor"+X](Se,Oe,tt,ft,He,at,ge,we,Ye)}}function ht(D,F,X,ee,fe){for(X=F+X;F<X;){var xe=D[F++];ee[fe++]=xe>>16&255,ee[fe++]=xe>>8&255,ee[fe++]=255&xe}}function ut(D,F,X,ee,fe){for(X=F+X;F<X;){var xe=D[F++];ee[fe++]=xe>>16&255,ee[fe++]=xe>>8&255,ee[fe++]=255&xe,ee[fe++]=xe>>24&255}}function Mt(D,F,X,ee,fe){for(X=F+X;F<X;){var xe=(ge=D[F++])>>16&240|ge>>12&15,ge=240&ge|ge>>28&15;ee[fe++]=xe,ee[fe++]=ge}}function Wt(D,F,X,ee,fe){for(X=F+X;F<X;){var xe=(ge=D[F++])>>16&248|ge>>13&7,ge=ge>>5&224|ge>>3&31;ee[fe++]=xe,ee[fe++]=ge}}function zt(D,F,X,ee,fe){for(X=F+X;F<X;){var xe=D[F++];ee[fe++]=255&xe,ee[fe++]=xe>>8&255,ee[fe++]=xe>>16&255}}function Lt(D,F,X,ee,fe,xe){if(xe==0)for(X=F+X;F<X;)be(ee,((xe=D[F++])[0]>>24|xe[1]>>8&65280|xe[2]<<8&16711680|xe[3]<<24)>>>0),fe+=32;else n(ee,fe,D,F,X)}function or(D,F){T[F][0]=T[D+"0"],T[F][1]=T[D+"1"],T[F][2]=T[D+"2"],T[F][3]=T[D+"3"],T[F][4]=T[D+"4"],T[F][5]=T[D+"5"],T[F][6]=T[D+"6"],T[F][7]=T[D+"7"],T[F][8]=T[D+"8"],T[F][9]=T[D+"9"],T[F][10]=T[D+"10"],T[F][11]=T[D+"11"],T[F][12]=T[D+"12"],T[F][13]=T[D+"13"],T[F][14]=T[D+"0"],T[F][15]=T[D+"0"]}function Yt(D){return D==JA||D==QA||D==aN||D==e3}function ot(){this.eb=[],this.size=this.A=this.fb=0}function fr(){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 Et(){this.Rd=this.height=this.width=this.S=0,this.f={},this.f.RGBA=new ot,this.f.kb=new fr,this.sd=null}function Ct(){this.width=[0],this.height=[0],this.Pd=[0],this.Qd=[0],this.format=[0]}function hr(){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 Gt(D){return alert("todo:WebPSamplerProcessPlane"),D.T}function Jt(D,F){var X=D.T,ee=F.ba.f.RGBA,fe=ee.eb,xe=ee.fb+D.ka*ee.A,ge=yc[F.ba.S],we=D.y,Se=D.O,Oe=D.f,He=D.N,at=D.ea,De=D.W,Ye=F.cc,tt=F.dc,ft=F.Mc,rt=F.Nc,xt=D.ka,bt=D.ka+D.T,At=D.U,Nt=At+1>>1;for(xt==0?ge(we,Se,null,null,Oe,He,at,De,Oe,He,at,De,fe,xe,null,null,At):(ge(F.ec,F.fc,we,Se,Ye,tt,ft,rt,Oe,He,at,De,fe,xe-ee.A,fe,xe,At),++X);xt+2<bt;xt+=2)Ye=Oe,tt=He,ft=at,rt=De,He+=D.Rc,De+=D.Rc,xe+=2*ee.A,ge(we,(Se+=2*D.fa)-D.fa,we,Se,Ye,tt,ft,rt,Oe,He,at,De,fe,xe-ee.A,fe,xe,At);return Se+=D.fa,D.j+bt<D.o?(n(F.ec,F.fc,we,Se,At),n(F.cc,F.dc,Oe,He,Nt),n(F.Mc,F.Nc,at,De,Nt),X--):1&bt||ge(we,Se,null,null,Oe,He,at,De,Oe,He,at,De,fe,xe+ee.A,null,null,At),X}function mr(D,F,X){var ee=D.F,fe=[D.J];if(ee!=null){var xe=D.U,ge=F.ba.S,we=ge==sN||ge==aN;F=F.ba.f.RGBA;var Se=[0],Oe=D.ka;Se[0]=D.T,D.Kb&&(Oe==0?--Se[0]:(--Oe,fe[0]-=D.width),D.j+D.ka+D.T==D.o&&(Se[0]=D.o-D.j-Oe));var He=F.eb;Oe=F.fb+Oe*F.A,D=s$(ee,fe[0],D.width,xe,Se,He,Oe+(we?0:3),F.A),t(X==Se),D&&Yt(ge)&&fb(He,Oe,we,xe,Se,F.A)}return 0}function mn(D){var F=D.ma,X=F.ba.S,ee=11>X,fe=X==rN||X==nN||X==sN||X==ZA||X==12||Yt(X);if(F.memory=null,F.Ib=null,F.Jb=null,F.Nd=null,!sb(F.Oa,D,fe?11:12))return 0;if(fe&&Yt(X)&&tb(),D.da)alert("todo:use_scaling");else{if(ee){if(F.Ib=Gt,D.Kb){if(X=D.U+1>>1,F.memory=i(D.U+2*X),F.memory==null)return 0;F.ec=F.memory,F.fc=0,F.cc=F.ec,F.dc=F.fc+D.U,F.Mc=F.cc,F.Nc=F.dc+X,F.Ib=Jt,tb()}}else alert("todo:EmitYUV");fe&&(F.Jb=mr,ee&&gu())}if(ee&&!b$){for(D=0;256>D;++D)xxe[D]=89858*(D-128)+oN>>iN,yxe[D]=-22014*(D-128)+oN,vxe[D]=-45773*(D-128),gxe[D]=113618*(D-128)+oN>>iN;for(D=mb;D<n3;++D)F=76283*(D-16)+oN>>iN,bxe[D-mb]=Ba(F,255),wxe[D-mb]=Ba(F+8>>4,15);b$=1}return 1}function Xt(D){var F=D.ma,X=D.U,ee=D.T;return t(!(1&D.ka)),0>=X||0>=ee?0:(X=F.Ib(D,F),F.Jb!=null&&F.Jb(D,F,X),F.Dc+=X,1)}function fn(D){D.ma.memory=null}function Xn(D,F,X,ee){return K(D,8)!=47?0:(F[0]=K(D,14)+1,X[0]=K(D,14)+1,ee[0]=K(D,1),K(D,3)!=0?0:!D.h)}function rn(D,F){if(4>D)return D+1;var X=D-2>>1;return(2+(1&D)<<X)+K(F,X)+1}function wn(D,F){return 120<F?F-120:1<=(X=((X=rxe[F-1])>>4)*D+(8-(15&X)))?X:1;var X}function On(D,F,X){var ee=I(X),fe=D[F+=255&ee].g-8;return 0<fe&&(Y(X,X.u+8),ee=I(X),F+=D[F].value,F+=ee&(1<<fe)-1),Y(X,X.u+D[F].g),D[F].value}function ts(D,F,X){return X.g+=D.g,X.value+=D.value<<F>>>0,t(8>=X.g),D.g}function pe(D,F,X){var ee=D.xc;return t((F=ee==0?0:D.vc[D.md*(X>>ee)+(F>>ee)])<D.Wb),D.Ya[F]}function Ae(D,F,X,ee){var fe=D.ab,xe=D.c*F,ge=D.C;F=ge+F;var we=X,Se=ee;for(ee=D.Ta,X=D.Ua;0<fe--;){var Oe=D.gc[fe],He=ge,at=F,De=we,Ye=Se,tt=(Se=ee,we=X,Oe.Ea);switch(t(He<at),t(at<=Oe.nc),Oe.hc){case 2:Ca(De,Ye,(at-He)*tt,Se,we);break;case 0:var ft=He,rt=at,xt=Se,bt=we,At=(ur=Oe).Ea;ft==0&&(ib(De,Ye,null,null,1,xt,bt),Ue(De,Ye+1,0,0,At-1,xt,bt+1),Ye+=At,bt+=At,++ft);for(var Nt=1<<ur.b,gr=Nt-1,sr=le(At,ur.b),an=ur.K,ur=ur.w+(ft>>ur.b)*sr;ft<rt;){var kn=an,oi=ur,on=1;for(xg(De,Ye,xt,bt-At,1,xt,bt);on<At;){var dr=(on&~gr)+Nt;dr>At&&(dr=At),(0,lb[kn[oi++]>>8&15])(De,Ye+ +on,xt,bt+on-At,dr-on,xt,bt+on),on=dr}Ye+=At,bt+=At,++ft&gr||(ur+=sr)}at!=Oe.nc&&n(Se,we-tt,Se,we+(at-He-1)*tt,tt);break;case 1:for(tt=De,rt=Ye,At=(De=Oe.Ea)-(bt=De&~(xt=(Ye=1<<Oe.b)-1)),ft=le(De,Oe.b),Nt=Oe.K,Oe=Oe.w+(He>>Oe.b)*ft;He<at;){for(gr=Nt,sr=Oe,an=new me,ur=rt+bt,kn=rt+De;rt<ur;)st(gr[sr++],an),cb(an,tt,rt,Ye,Se,we),rt+=Ye,we+=Ye;rt<kn&&(st(gr[sr++],an),cb(an,tt,rt,At,Se,we),rt+=At,we+=At),++He&xt||(Oe+=ft)}break;case 3:if(De==Se&&Ye==we&&0<Oe.b){for(rt=Se,De=tt=we+(at-He)*tt-(bt=(at-He)*le(Oe.Ea,Oe.b)),Ye=Se,xt=we,ft=[],bt=(At=bt)-1;0<=bt;--bt)ft[bt]=Ye[xt+bt];for(bt=At-1;0<=bt;--bt)rt[De+bt]=ft[bt];J_(Oe,He,at,Se,tt,Se,we)}else J_(Oe,He,at,De,Ye,Se,we)}we=ee,Se=X}Se!=X&&n(ee,X,we,Se,xe)}function Ne(D,F){var X=D.V,ee=D.Ba+D.c*D.C,fe=F-D.C;if(t(F<=D.l.o),t(16>=fe),0<fe){var xe=D.l,ge=D.Ta,we=D.Ua,Se=xe.width;if(Ae(D,fe,X,ee),fe=we=[we],t((X=D.C)<(ee=F)),t(xe.v<xe.va),ee>xe.o&&(ee=xe.o),X<xe.j){var Oe=xe.j-X;X=xe.j,fe[0]+=Oe*Se}if(X>=ee?X=0:(fe[0]+=4*xe.v,xe.ka=X-xe.j,xe.U=xe.va-xe.v,xe.T=ee-X,X=1),X){if(we=we[0],11>(X=D.ca).S){var He=X.f.RGBA,at=(ee=X.S,fe=xe.U,xe=xe.T,Oe=He.eb,He.A),De=xe;for(He=He.fb+D.Ma*He.A;0<De--;){var Ye=ge,tt=we,ft=fe,rt=Oe,xt=He;switch(ee){case tN:ub(Ye,tt,ft,rt,xt);break;case rN:Bh(Ye,tt,ft,rt,xt);break;case JA:Bh(Ye,tt,ft,rt,xt),fb(rt,xt,0,ft,1,0);break;case d$:ex(Ye,tt,ft,rt,xt);break;case nN:Lt(Ye,tt,ft,rt,xt,1);break;case QA:Lt(Ye,tt,ft,rt,xt,1),fb(rt,xt,0,ft,1,0);break;case sN:Lt(Ye,tt,ft,rt,xt,0);break;case aN:Lt(Ye,tt,ft,rt,xt,0),fb(rt,xt,1,ft,1,0);break;case ZA:zh(Ye,tt,ft,rt,xt);break;case e3:zh(Ye,tt,ft,rt,xt),n$(rt,xt,ft,1,0);break;case f$:qh(Ye,tt,ft,rt,xt);break;default:t(0)}we+=Se,He+=at}D.Ma+=xe}else alert("todo:EmitRescaledRowsYUVA");t(D.Ma<=X.height)}}D.C=F,t(D.C<=D.i)}function ke(D){var F;if(0<D.ua)return 0;for(F=0;F<D.Wb;++F){var X=D.Ya[F].G,ee=D.Ya[F].H;if(0<X[1][ee[1]+0].g||0<X[2][ee[2]+0].g||0<X[3][ee[3]+0].g)return 0}return 1}function Pe(D,F,X,ee,fe,xe){if(D.Z!=0){var ge=D.qd,we=D.rd;for(t(Hh[D.Z]!=null);F<X;++F)Hh[D.Z](ge,we,ee,fe,ee,fe,xe),ge=ee,we=fe,fe+=xe;D.qd=ge,D.rd=we}}function Re(D,F){var X=D.l.ma,ee=X.Z==0||X.Z==1?D.l.j:D.C;if(ee=D.C<ee?ee:D.C,t(F<=D.l.o),F>ee){var fe=D.l.width,xe=X.ca,ge=X.tb+fe*ee,we=D.V,Se=D.Ba+D.c*ee,Oe=D.gc;t(D.ab==1),t(Oe[0].hc==3),jd(Oe[0],ee,F,we,Se,xe,ge),Pe(X,ee,F,xe,ge,fe)}D.C=D.Ma=F}function Ce(D,F,X,ee,fe,xe,ge){var we=D.$/ee,Se=D.$%ee,Oe=D.m,He=D.s,at=X+D.$,De=at;fe=X+ee*fe;var Ye=X+ee*xe,tt=280+He.ua,ft=D.Pb?we:16777216,rt=0<He.ua?He.Wa:null,xt=He.wc,bt=at<Ye?pe(He,Se,we):null;t(D.C<xe),t(Ye<=fe);var At=!1;e:for(;;){for(;At||at<Ye;){var Nt=0;if(we>=ft){var gr=at-X;t((ft=D).Pb),ft.wd=ft.m,ft.xd=gr,0<ft.s.ua&&he(ft.s.Wa,ft.s.vb),ft=we+sxe}if(Se&xt||(bt=pe(He,Se,we)),t(bt!=null),bt.Qb&&(F[at]=bt.qb,At=!0),!At)if(te(Oe),bt.jc){Nt=Oe,gr=F;var sr=at,an=bt.pd[I(Nt)&Qp-1];t(bt.jc),256>an.g?(Y(Nt,Nt.u+an.g),gr[sr]=an.value,Nt=0):(Y(Nt,Nt.u+an.g-256),t(256<=an.value),Nt=an.value),Nt==0&&(At=!0)}else Nt=On(bt.G[0],bt.H[0],Oe);if(Oe.h)break;if(At||256>Nt){if(!At)if(bt.nd)F[at]=(bt.qb|Nt<<8)>>>0;else{if(te(Oe),At=On(bt.G[1],bt.H[1],Oe),te(Oe),gr=On(bt.G[2],bt.H[2],Oe),sr=On(bt.G[3],bt.H[3],Oe),Oe.h)break;F[at]=(sr<<24|At<<16|Nt<<8|gr)>>>0}if(At=!1,++at,++Se>=ee&&(Se=0,++we,ge!=null&&we<=xe&&!(we%16)&&ge(D,we),rt!=null))for(;De<at;)Nt=F[De++],rt.X[(506832829*Nt&4294967295)>>>rt.Mb]=Nt}else if(280>Nt){if(Nt=rn(Nt-256,Oe),gr=On(bt.G[4],bt.H[4],Oe),te(Oe),gr=wn(ee,gr=rn(gr,Oe)),Oe.h)break;if(at-X<gr||fe-at<Nt)break e;for(sr=0;sr<Nt;++sr)F[at+sr]=F[at+sr-gr];for(at+=Nt,Se+=Nt;Se>=ee;)Se-=ee,++we,ge!=null&&we<=xe&&!(we%16)&&ge(D,we);if(t(at<=fe),Se&xt&&(bt=pe(He,Se,we)),rt!=null)for(;De<at;)Nt=F[De++],rt.X[(506832829*Nt&4294967295)>>>rt.Mb]=Nt}else{if(!(Nt<tt))break e;for(At=Nt-280,t(rt!=null);De<at;)Nt=F[De++],rt.X[(506832829*Nt&4294967295)>>>rt.Mb]=Nt;Nt=at,t(!(At>>>(gr=rt).Xa)),F[Nt]=gr.X[At],At=!0}At||t(Oe.h==U(Oe))}if(D.Pb&&Oe.h&&at<fe)t(D.m.h),D.a=5,D.m=D.wd,D.$=D.xd,0<D.s.ua&&he(D.s.vb,D.s.Wa);else{if(Oe.h)break e;ge!=null&&ge(D,we>xe?xe:we),D.a=0,D.$=at-X}return 1}return D.a=3,0}function $e(D){t(D!=null),D.vc=null,D.yc=null,D.Ya=null;var F=D.Wa;F!=null&&(F.X=null),D.vb=null,t(D!=null)}function Be(){var D=new Hr;return D==null?null:(D.a=0,D.xb=p$,or("Predictor","VP8LPredictors"),or("Predictor","VP8LPredictors_C"),or("PredictorAdd","VP8LPredictorsAdd"),or("PredictorAdd","VP8LPredictorsAdd_C"),Ca=Qe,cb=Fe,ub=ht,Bh=ut,zh=Mt,qh=Wt,ex=zt,T.VP8LMapColor32b=wd,T.VP8LMapColor8b=ob,D)}function Ze(D,F,X,ee,fe){var xe=1,ge=[D],we=[F],Se=ee.m,Oe=ee.s,He=null,at=0;e:for(;;){if(X)for(;xe&&K(Se,1);){var De=ge,Ye=we,tt=ee,ft=1,rt=tt.m,xt=tt.gc[tt.ab],bt=K(rt,2);if(tt.Oc&1<<bt)xe=0;else{switch(tt.Oc|=1<<bt,xt.hc=bt,xt.Ea=De[0],xt.nc=Ye[0],xt.K=[null],++tt.ab,t(4>=tt.ab),bt){case 0:case 1:xt.b=K(rt,3)+2,ft=Ze(le(xt.Ea,xt.b),le(xt.nc,xt.b),0,tt,xt.K),xt.K=xt.K[0];break;case 3:var At,Nt=K(rt,8)+1,gr=16<Nt?0:4<Nt?1:2<Nt?2:3;if(De[0]=le(xt.Ea,gr),xt.b=gr,At=ft=Ze(Nt,1,0,tt,xt.K)){var sr,an=Nt,ur=xt,kn=1<<(8>>ur.b),oi=i(kn);if(oi==null)At=0;else{var on=ur.K[0],dr=ur.w;for(oi[0]=ur.K[0][0],sr=1;sr<1*an;++sr)oi[sr]=Me(on[dr+sr],oi[sr-1]);for(;sr<4*kn;++sr)oi[sr]=0;ur.K[0]=null,ur.K[0]=oi,At=1}}ft=At;break;case 2:break;default:t(0)}xe=ft}}if(ge=ge[0],we=we[0],xe&&K(Se,1)&&!(xe=1<=(at=K(Se,4))&&11>=at)){ee.a=3;break e}var Ut;if(Ut=xe)t:{var Aa,Qr,Tn,Fs=ee,Ui=ge,Po=we,fa=at,io=X,Oo=Fs.m,li=Fs.s,In=[null],rs=1,ha=0,ns=nxe[fa];r:for(;;){if(io&&K(Oo,1)){var Vi=K(Oo,3)+2,yu=le(Ui,Vi),Ta=le(Po,Vi),sl=yu*Ta;if(!Ze(yu,Ta,0,Fs,In))break r;for(In=In[0],li.xc=Vi,Aa=0;Aa<sl;++Aa){var xs=In[Aa]>>8&65535;In[Aa]=xs,xs>=rs&&(rs=xs+1)}}if(Oo.h)break r;for(Qr=0;5>Qr;++Qr){var ci=h$[Qr];!Qr&&0<fa&&(ci+=1<<fa),ha<ci&&(ha=ci)}var Ol=o(rs*ns,q),Do=rs,Dl=o(Do,L);if(Dl==null)var Il=null;else t(65536>=Do),Il=Dl;var al=i(ha);if(Il==null||al==null||Ol==null){Fs.a=1;break r}var Rl=Ol;for(Aa=Tn=0;Aa<rs;++Aa){var Ns=Il[Aa],Ll=Ns.G,bu=Ns.H,rx=0,Tf=1,Hi=0;for(Qr=0;5>Qr;++Qr){ci=h$[Qr],Ll[Qr]=Rl,bu[Qr]=Tn,!Qr&&0<fa&&(ci+=1<<fa);s:{var cN,s3=ci,uN=Fs,pb=al,Nxe=Rl,Sxe=Tn,a3=0,Wh=uN.m,kxe=K(Wh,1);if(a(pb,0,0,s3),kxe){var Cxe=K(Wh,1)+1,Exe=K(Wh,1),_$=K(Wh,Exe==0?1:8);pb[_$]=1,Cxe==2&&(pb[_$=K(Wh,8)]=1);var dN=1}else{var N$=i(19),S$=K(Wh,4)+4;if(19<S$){uN.a=3;var fN=0;break s}for(cN=0;cN<S$;++cN)N$[txe[cN]]=K(Wh,3);var i3=void 0,xb=void 0,k$=uN,Axe=N$,hN=s3,C$=pb,o3=0,Gh=k$.m,E$=8,A$=o(128,q);n:for(;E(A$,0,7,Axe,19);){if(K(Gh,1)){var Txe=2+2*K(Gh,3);if((i3=2+K(Gh,Txe))>hN)break n}else i3=hN;for(xb=0;xb<hN&&i3--;){te(Gh);var T$=A$[0+(127&I(Gh))];Y(Gh,Gh.u+T$.g);var vg=T$.value;if(16>vg)C$[xb++]=vg,vg!=0&&(E$=vg);else{var Pxe=vg==16,P$=vg-16,Oxe=Qpe[P$],O$=K(Gh,Jpe[P$])+Oxe;if(xb+O$>hN)break n;for(var Dxe=Pxe?E$:0;0<O$--;)C$[xb++]=Dxe}}o3=1;break n}o3||(k$.a=3),dN=o3}(dN=dN&&!Wh.h)&&(a3=E(Nxe,Sxe,8,pb,s3)),dN&&a3!=0?fN=a3:(uN.a=3,fN=0)}if(fN==0)break r;if(Tf&&exe[Qr]==1&&(Tf=Rl[Tn].g==0),rx+=Rl[Tn].g,Tn+=fN,3>=Qr){var gb,l3=al[0];for(gb=1;gb<ci;++gb)al[gb]>l3&&(l3=al[gb]);Hi+=l3}}if(Ns.nd=Tf,Ns.Qb=0,Tf&&(Ns.qb=(Ll[3][bu[3]+0].value<<24|Ll[1][bu[1]+0].value<<16|Ll[2][bu[2]+0].value)>>>0,rx==0&&256>Ll[0][bu[0]+0].value&&(Ns.Qb=1,Ns.qb+=Ll[0][bu[0]+0].value<<8)),Ns.jc=!Ns.Qb&&6>Hi,Ns.jc){var mN,Pf=Ns;for(mN=0;mN<Qp;++mN){var Kh=mN,Xh=Pf.pd[Kh],pN=Pf.G[0][Pf.H[0]+Kh];256<=pN.value?(Xh.g=pN.g+256,Xh.value=pN.value):(Xh.g=0,Xh.value=0,Kh>>=ts(pN,8,Xh),Kh>>=ts(Pf.G[1][Pf.H[1]+Kh],16,Xh),Kh>>=ts(Pf.G[2][Pf.H[2]+Kh],0,Xh),ts(Pf.G[3][Pf.H[3]+Kh],24,Xh))}}}li.vc=In,li.Wb=rs,li.Ya=Il,li.yc=Ol,Ut=1;break t}Ut=0}if(!(xe=Ut)){ee.a=3;break e}if(0<at){if(Oe.ua=1<<at,!Z(Oe.Wa,at)){ee.a=1,xe=0;break e}}else Oe.ua=0;var c3=ee,D$=ge,Ixe=we,u3=c3.s,d3=u3.xc;if(c3.c=D$,c3.i=Ixe,u3.md=le(D$,d3),u3.wc=d3==0?-1:(1<<d3)-1,X){ee.xb=dxe;break e}if((He=i(ge*we))==null){ee.a=1,xe=0;break e}xe=(xe=Ce(ee,He,0,ge,we,we,null))&&!Se.h;break e}return xe?(fe!=null?fe[0]=He:(t(He==null),t(X)),ee.$=0,X||$e(Oe)):$e(Oe),xe}function et(D,F){var X=D.c*D.i,ee=X+F+16*F;return t(D.c<=F),D.V=i(ee),D.V==null?(D.Ta=null,D.Ua=0,D.a=1,0):(D.Ta=D.V,D.Ua=D.Ba+X+F,1)}function wt(D,F){var X=D.C,ee=F-X,fe=D.V,xe=D.Ba+D.c*X;for(t(F<=D.l.o);0<ee;){var ge=16<ee?16:ee,we=D.l.ma,Se=D.l.width,Oe=Se*ge,He=we.ca,at=we.tb+Se*X,De=D.Ta,Ye=D.Ua;Ae(D,ge,fe,xe),a$(De,Ye,He,at,Oe),Pe(we,X,X+ge,He,at,Se),ee-=ge,fe+=ge*D.c,X+=ge}t(X==F),D.C=D.Ma=F}function Rt(){this.ub=this.yd=this.td=this.Rb=0}function qt(){this.Kd=this.Ld=this.Ud=this.Td=this.i=this.c=0}function Pt(){this.Fb=this.Bb=this.Cb=0,this.Zb=i(4),this.Lb=i(4)}function Ht(){this.Yb=function(){var D=[];return function F(X,ee,fe){for(var xe=fe[ee],ge=0;ge<xe&&(X.push(fe.length>ee+1?[]:0),!(fe.length<ee+1));ge++)F(X[ge],ee+1,fe)}(D,0,[3,11]),D}()}function Rr(){this.jb=i(3),this.Wc=l([4,8],Ht),this.Xc=l([4,17],Ht)}function ds(){this.Pc=this.wb=this.Tb=this.zd=0,this.vd=new i(4),this.od=new i(4)}function jn(){this.ld=this.La=this.dd=this.tc=0}function da(){this.Na=this.la=0}function gd(){this.Sc=[0,0],this.Eb=[0,0],this.Qc=[0,0],this.ia=this.lc=0}function pu(){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 vd(){this.uc=this.M=this.Nb=0,this.wa=Array(new jn),this.Y=0,this.ya=Array(new pu),this.aa=0,this.l=new cg}function mc(){this.y=i(16),this.f=i(8),this.ea=i(8)}function Ih(){this.cb=this.a=0,this.sc="",this.m=new C,this.Od=new Rt,this.Kc=new qt,this.ed=new ds,this.Qa=new Pt,this.Ic=this.$c=this.Aa=0,this.D=new vd,this.Xb=this.Va=this.Hb=this.zb=this.yb=this.Ub=this.za=0,this.Jc=o(8,C),this.ia=0,this.pb=o(4,gd),this.Pa=new Rr,this.Bd=this.kc=0,this.Ac=[],this.Bc=0,this.zc=[0,0,0,0],this.Gd=Array(new mc),this.Hd=0,this.rb=Array(new da),this.sb=0,this.wa=Array(new jn),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 pu),this.L=this.aa=0,this.gd=l([4,2],jn),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 Ba(D,F){return 0>D?0:D>F?F:D}function cg(){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 RA(){var D=new Ih;return D!=null&&(D.a=0,D.sc="OK",D.cb=0,D.Xb=0,hb||(hb=ug)),D}function za(D,F,X){return D.a==0&&(D.a=F,D.sc=X,D.cb=0),0}function B_(D,F,X){return 3<=X&&D[F+0]==157&&D[F+1]==1&&D[F+2]==42}function yd(D,F){if(D==null)return 0;if(D.a=0,D.sc="OK",F==null)return za(D,2,"null VP8Io passed to VP8GetHeaders()");var X=F.data,ee=F.w,fe=F.ha;if(4>fe)return za(D,7,"Truncated header.");var xe=X[ee+0]|X[ee+1]<<8|X[ee+2]<<16,ge=D.Od;if(ge.Rb=!(1&xe),ge.td=xe>>1&7,ge.yd=xe>>4&1,ge.ub=xe>>5,3<ge.td)return za(D,3,"Incorrect keyframe parameters.");if(!ge.yd)return za(D,4,"Frame not displayable.");ee+=3,fe-=3;var we=D.Kc;if(ge.Rb){if(7>fe)return za(D,7,"cannot parse picture header");if(!B_(X,ee,fe))return za(D,3,"Bad code word");we.c=16383&(X[ee+4]<<8|X[ee+3]),we.Td=X[ee+4]>>6,we.i=16383&(X[ee+6]<<8|X[ee+5]),we.Ud=X[ee+6]>>6,ee+=7,fe-=7,D.za=we.c+15>>4,D.Ub=we.i+15>>4,F.width=we.c,F.height=we.i,F.Da=0,F.j=0,F.v=0,F.va=F.width,F.o=F.height,F.da=0,F.ib=F.width,F.hb=F.height,F.U=F.width,F.T=F.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(ge.ub>fe)return za(D,7,"bad partition length");H(xe=D.m,X,ee,ge.ub),ee+=ge.ub,fe-=ge.ub,ge.Rb&&(we.Ld=J(xe),we.Kd=J(xe)),we=D.Qa;var Se,Oe=D.Pa;if(t(xe!=null),t(we!=null),we.Cb=J(xe),we.Cb){if(we.Bb=J(xe),J(xe)){for(we.Fb=J(xe),Se=0;4>Se;++Se)we.Zb[Se]=J(xe)?z(xe,7):0;for(Se=0;4>Se;++Se)we.Lb[Se]=J(xe)?z(xe,6):0}if(we.Bb)for(Se=0;3>Se;++Se)Oe.jb[Se]=J(xe)?V(xe,8):255}else we.Bb=0;if(xe.Ka)return za(D,3,"cannot parse segment header");if((we=D.ed).zd=J(xe),we.Tb=V(xe,6),we.wb=V(xe,3),we.Pc=J(xe),we.Pc&&J(xe)){for(Oe=0;4>Oe;++Oe)J(xe)&&(we.vd[Oe]=z(xe,6));for(Oe=0;4>Oe;++Oe)J(xe)&&(we.od[Oe]=z(xe,6))}if(D.L=we.Tb==0?0:we.zd?1:2,xe.Ka)return za(D,3,"cannot parse filter header");var He=fe;if(fe=Se=ee,ee=Se+He,we=He,D.Xb=(1<<V(D.m,2))-1,He<3*(Oe=D.Xb))X=7;else{for(Se+=3*Oe,we-=3*Oe,He=0;He<Oe;++He){var at=X[fe+0]|X[fe+1]<<8|X[fe+2]<<16;at>we&&(at=we),H(D.Jc[+He],X,Se,at),Se+=at,we-=at,fe+=3}H(D.Jc[+Oe],X,Se,we),X=Se<ee?0:5}if(X!=0)return za(D,X,"cannot parse partitions");for(X=V(Se=D.m,7),fe=J(Se)?z(Se,4):0,ee=J(Se)?z(Se,4):0,we=J(Se)?z(Se,4):0,Oe=J(Se)?z(Se,4):0,Se=J(Se)?z(Se,4):0,He=D.Qa,at=0;4>at;++at){if(He.Cb){var De=He.Zb[at];He.Fb||(De+=X)}else{if(0<at){D.pb[at]=D.pb[0];continue}De=X}var Ye=D.pb[at];Ye.Sc[0]=t3[Ba(De+fe,127)],Ye.Sc[1]=r3[Ba(De+0,127)],Ye.Eb[0]=2*t3[Ba(De+ee,127)],Ye.Eb[1]=101581*r3[Ba(De+we,127)]>>16,8>Ye.Eb[1]&&(Ye.Eb[1]=8),Ye.Qc[0]=t3[Ba(De+Oe,117)],Ye.Qc[1]=r3[Ba(De+Se,127)],Ye.lc=De+Se}if(!ge.Rb)return za(D,4,"Not a key frame.");for(J(xe),ge=D.Pa,X=0;4>X;++X){for(fe=0;8>fe;++fe)for(ee=0;3>ee;++ee)for(we=0;11>we;++we)Oe=ie(xe,cxe[X][fe][ee][we])?V(xe,8):oxe[X][fe][ee][we],ge.Wc[X][fe].Yb[ee][we]=Oe;for(fe=0;17>fe;++fe)ge.Xc[X][fe]=ge.Wc[X][uxe[fe]]}return D.kc=J(xe),D.kc&&(D.Bd=V(xe,8)),D.cb=1}function ug(D,F,X,ee,fe,xe,ge){var we=F[fe].Yb[X];for(X=0;16>fe;++fe){if(!ie(D,we[X+0]))return fe;for(;!ie(D,we[X+1]);)if(we=F[++fe].Yb[0],X=0,fe==16)return 16;var Se=F[fe+1].Yb;if(ie(D,we[X+2])){var Oe=D,He=0;if(ie(Oe,(De=we)[(at=X)+3]))if(ie(Oe,De[at+6])){for(we=0,at=2*(He=ie(Oe,De[at+8]))+(De=ie(Oe,De[at+9+He])),He=0,De=axe[at];De[we];++we)He+=He+ie(Oe,De[we]);He+=3+(8<<at)}else ie(Oe,De[at+7])?(He=7+2*ie(Oe,165),He+=ie(Oe,145)):He=5+ie(Oe,159);else He=ie(Oe,De[at+4])?3+ie(Oe,De[at+5]):2;we=Se[2]}else He=1,we=Se[1];Se=ge+ixe[fe],0>(Oe=D).b&&re(Oe);var at,De=Oe.b,Ye=(at=Oe.Ca>>1)-(Oe.I>>De)>>31;--Oe.b,Oe.Ca+=Ye,Oe.Ca|=1,Oe.I-=(at+1&Ye)<<De,xe[Se]=((He^Ye)-Ye)*ee[(0<fe)+0]}return 16}function z_(D){var F=D.rb[D.sb-1];F.la=0,F.Na=0,a(D.zc,0,0,D.zc.length),D.ja=0}function pc(D,F,X,ee,fe){fe=D[F+X+32*ee]+(fe>>3),D[F+X+32*ee]=-256&fe?0>fe?0:255:fe}function si(D,F,X,ee,fe,xe){pc(D,F,0,X,ee+fe),pc(D,F,1,X,ee+xe),pc(D,F,2,X,ee-xe),pc(D,F,3,X,ee-fe)}function gf(D){return(20091*D>>16)+D}function q_(D,F,X,ee){var fe,xe=0,ge=i(16);for(fe=0;4>fe;++fe){var we=D[F+0]+D[F+8],Se=D[F+0]-D[F+8],Oe=(35468*D[F+4]>>16)-gf(D[F+12]),He=gf(D[F+4])+(35468*D[F+12]>>16);ge[xe+0]=we+He,ge[xe+1]=Se+Oe,ge[xe+2]=Se-Oe,ge[xe+3]=we-He,xe+=4,F++}for(fe=xe=0;4>fe;++fe)we=(D=ge[xe+0]+4)+ge[xe+8],Se=D-ge[xe+8],Oe=(35468*ge[xe+4]>>16)-gf(ge[xe+12]),pc(X,ee,0,0,we+(He=gf(ge[xe+4])+(35468*ge[xe+12]>>16))),pc(X,ee,1,0,Se+Oe),pc(X,ee,2,0,Se-Oe),pc(X,ee,3,0,we-He),xe++,ee+=32}function LA(D,F,X,ee){var fe=D[F+0]+4,xe=35468*D[F+4]>>16,ge=gf(D[F+4]),we=35468*D[F+1]>>16;si(X,ee,0,fe+ge,D=gf(D[F+1]),we),si(X,ee,1,fe+xe,D,we),si(X,ee,2,fe-xe,D,we),si(X,ee,3,fe-ge,D,we)}function FA(D,F,X,ee,fe){q_(D,F,X,ee),fe&&q_(D,F+16,X,ee+4)}function bd(D,F,X,ee){tx(D,F+0,X,ee,1),tx(D,F+32,X,ee+128,1)}function U_(D,F,X,ee){var fe;for(D=D[F+0]+4,fe=0;4>fe;++fe)for(F=0;4>F;++F)pc(X,ee,F,fe,D)}function V_(D,F,X,ee){D[F+0]&&Yn(D,F+0,X,ee),D[F+16]&&Yn(D,F+16,X,ee+4),D[F+32]&&Yn(D,F+32,X,ee+128),D[F+48]&&Yn(D,F+48,X,ee+128+4)}function dg(D,F,X,ee){var fe,xe=i(16);for(fe=0;4>fe;++fe){var ge=D[F+0+fe]+D[F+12+fe],we=D[F+4+fe]+D[F+8+fe],Se=D[F+4+fe]-D[F+8+fe],Oe=D[F+0+fe]-D[F+12+fe];xe[0+fe]=ge+we,xe[8+fe]=ge-we,xe[4+fe]=Oe+Se,xe[12+fe]=Oe-Se}for(fe=0;4>fe;++fe)ge=(D=xe[0+4*fe]+3)+xe[3+4*fe],we=xe[1+4*fe]+xe[2+4*fe],Se=xe[1+4*fe]-xe[2+4*fe],Oe=D-xe[3+4*fe],X[ee+0]=ge+we>>3,X[ee+16]=Oe+Se>>3,X[ee+32]=ge-we>>3,X[ee+48]=Oe-Se>>3,ee+=64}function Up(D,F,X){var ee,fe=F-32,xe=Pl,ge=255-D[fe-1];for(ee=0;ee<X;++ee){var we,Se=xe,Oe=ge+D[F-1];for(we=0;we<X;++we)D[F+we]=Se[Oe+D[fe+we]];F+=32}}function MA(D,F){Up(D,F,4)}function $A(D,F){Up(D,F,8)}function BA(D,F){Up(D,F,16)}function G1(D,F){var X;for(X=0;16>X;++X)n(D,F+32*X,D,F-32,16)}function H_(D,F){var X;for(X=16;0<X;--X)a(D,F,D[F-1],16),F+=32}function xu(D,F,X){var ee;for(ee=0;16>ee;++ee)a(F,X+32*ee,D,16)}function zA(D,F){var X,ee=16;for(X=0;16>X;++X)ee+=D[F-1+32*X]+D[F+X-32];xu(ee>>5,D,F)}function Vp(D,F){var X,ee=8;for(X=0;16>X;++X)ee+=D[F-1+32*X];xu(ee>>4,D,F)}function K1(D,F){var X,ee=8;for(X=0;16>X;++X)ee+=D[F+X-32];xu(ee>>4,D,F)}function qA(D,F){xu(128,D,F)}function Gr(D,F,X){return D+2*F+X+2>>2}function UA(D,F){var X,ee=F-32;for(ee=new Uint8Array([Gr(D[ee-1],D[ee+0],D[ee+1]),Gr(D[ee+0],D[ee+1],D[ee+2]),Gr(D[ee+1],D[ee+2],D[ee+3]),Gr(D[ee+2],D[ee+3],D[ee+4])]),X=0;4>X;++X)n(D,F+32*X,ee,0,ee.length)}function VA(D,F){var X=D[F-1],ee=D[F-1+32],fe=D[F-1+64],xe=D[F-1+96];be(D,F+0,16843009*Gr(D[F-1-32],X,ee)),be(D,F+32,16843009*Gr(X,ee,fe)),be(D,F+64,16843009*Gr(ee,fe,xe)),be(D,F+96,16843009*Gr(fe,xe,xe))}function HA(D,F){var X,ee=4;for(X=0;4>X;++X)ee+=D[F+X-32]+D[F-1+32*X];for(ee>>=3,X=0;4>X;++X)a(D,F+32*X,ee,4)}function vf(D,F){var X=D[F-1+0],ee=D[F-1+32],fe=D[F-1+64],xe=D[F-1-32],ge=D[F+0-32],we=D[F+1-32],Se=D[F+2-32],Oe=D[F+3-32];D[F+0+96]=Gr(ee,fe,D[F-1+96]),D[F+1+96]=D[F+0+64]=Gr(X,ee,fe),D[F+2+96]=D[F+1+64]=D[F+0+32]=Gr(xe,X,ee),D[F+3+96]=D[F+2+64]=D[F+1+32]=D[F+0+0]=Gr(ge,xe,X),D[F+3+64]=D[F+2+32]=D[F+1+0]=Gr(we,ge,xe),D[F+3+32]=D[F+2+0]=Gr(Se,we,ge),D[F+3+0]=Gr(Oe,Se,we)}function yf(D,F){var X=D[F+1-32],ee=D[F+2-32],fe=D[F+3-32],xe=D[F+4-32],ge=D[F+5-32],we=D[F+6-32],Se=D[F+7-32];D[F+0+0]=Gr(D[F+0-32],X,ee),D[F+1+0]=D[F+0+32]=Gr(X,ee,fe),D[F+2+0]=D[F+1+32]=D[F+0+64]=Gr(ee,fe,xe),D[F+3+0]=D[F+2+32]=D[F+1+64]=D[F+0+96]=Gr(fe,xe,ge),D[F+3+32]=D[F+2+64]=D[F+1+96]=Gr(xe,ge,we),D[F+3+64]=D[F+2+96]=Gr(ge,we,Se),D[F+3+96]=Gr(we,Se,Se)}function WA(D,F){var X=D[F-1+0],ee=D[F-1+32],fe=D[F-1+64],xe=D[F-1-32],ge=D[F+0-32],we=D[F+1-32],Se=D[F+2-32],Oe=D[F+3-32];D[F+0+0]=D[F+1+64]=xe+ge+1>>1,D[F+1+0]=D[F+2+64]=ge+we+1>>1,D[F+2+0]=D[F+3+64]=we+Se+1>>1,D[F+3+0]=Se+Oe+1>>1,D[F+0+96]=Gr(fe,ee,X),D[F+0+64]=Gr(ee,X,xe),D[F+0+32]=D[F+1+96]=Gr(X,xe,ge),D[F+1+32]=D[F+2+96]=Gr(xe,ge,we),D[F+2+32]=D[F+3+96]=Gr(ge,we,Se),D[F+3+32]=Gr(we,Se,Oe)}function GA(D,F){var X=D[F+0-32],ee=D[F+1-32],fe=D[F+2-32],xe=D[F+3-32],ge=D[F+4-32],we=D[F+5-32],Se=D[F+6-32],Oe=D[F+7-32];D[F+0+0]=X+ee+1>>1,D[F+1+0]=D[F+0+64]=ee+fe+1>>1,D[F+2+0]=D[F+1+64]=fe+xe+1>>1,D[F+3+0]=D[F+2+64]=xe+ge+1>>1,D[F+0+32]=Gr(X,ee,fe),D[F+1+32]=D[F+0+96]=Gr(ee,fe,xe),D[F+2+32]=D[F+1+96]=Gr(fe,xe,ge),D[F+3+32]=D[F+2+96]=Gr(xe,ge,we),D[F+3+64]=Gr(ge,we,Se),D[F+3+96]=Gr(we,Se,Oe)}function fg(D,F){var X=D[F-1+0],ee=D[F-1+32],fe=D[F-1+64],xe=D[F-1+96];D[F+0+0]=X+ee+1>>1,D[F+2+0]=D[F+0+32]=ee+fe+1>>1,D[F+2+32]=D[F+0+64]=fe+xe+1>>1,D[F+1+0]=Gr(X,ee,fe),D[F+3+0]=D[F+1+32]=Gr(ee,fe,xe),D[F+3+32]=D[F+1+64]=Gr(fe,xe,xe),D[F+3+64]=D[F+2+64]=D[F+0+96]=D[F+1+96]=D[F+2+96]=D[F+3+96]=xe}function X1(D,F){var X=D[F-1+0],ee=D[F-1+32],fe=D[F-1+64],xe=D[F-1+96],ge=D[F-1-32],we=D[F+0-32],Se=D[F+1-32],Oe=D[F+2-32];D[F+0+0]=D[F+2+32]=X+ge+1>>1,D[F+0+32]=D[F+2+64]=ee+X+1>>1,D[F+0+64]=D[F+2+96]=fe+ee+1>>1,D[F+0+96]=xe+fe+1>>1,D[F+3+0]=Gr(we,Se,Oe),D[F+2+0]=Gr(ge,we,Se),D[F+1+0]=D[F+3+32]=Gr(X,ge,we),D[F+1+32]=D[F+3+64]=Gr(ee,X,ge),D[F+1+64]=D[F+3+96]=Gr(fe,ee,X),D[F+1+96]=Gr(xe,fe,ee)}function Hp(D,F){var X;for(X=0;8>X;++X)n(D,F+32*X,D,F-32,8)}function KA(D,F){var X;for(X=0;8>X;++X)a(D,F,D[F-1],8),F+=32}function bf(D,F,X){var ee;for(ee=0;8>ee;++ee)a(F,X+32*ee,D,8)}function XA(D,F){var X,ee=8;for(X=0;8>X;++X)ee+=D[F+X-32]+D[F-1+32*X];bf(ee>>4,D,F)}function Y1(D,F){var X,ee=4;for(X=0;8>X;++X)ee+=D[F+X-32];bf(ee>>3,D,F)}function Z1(D,F){var X,ee=4;for(X=0;8>X;++X)ee+=D[F-1+32*X];bf(ee>>3,D,F)}function W_(D,F){bf(128,D,F)}function wf(D,F,X){var ee=D[F-X],fe=D[F+0],xe=3*(fe-ee)+YA[1020+D[F-2*X]-D[F+X]],ge=eN[112+(xe+4>>3)];D[F-X]=Pl[255+ee+eN[112+(xe+3>>3)]],D[F+0]=Pl[255+fe-ge]}function J1(D,F,X,ee){var fe=D[F+0],xe=D[F+X];return vc[255+D[F-2*X]-D[F-X]]>ee||vc[255+xe-fe]>ee}function hg(D,F,X,ee){return 4*vc[255+D[F-X]-D[F+0]]+vc[255+D[F-2*X]-D[F+X]]<=ee}function Q1(D,F,X,ee,fe){var xe=D[F-3*X],ge=D[F-2*X],we=D[F-X],Se=D[F+0],Oe=D[F+X],He=D[F+2*X],at=D[F+3*X];return 4*vc[255+we-Se]+vc[255+ge-Oe]>ee?0:vc[255+D[F-4*X]-xe]<=fe&&vc[255+xe-ge]<=fe&&vc[255+ge-we]<=fe&&vc[255+at-He]<=fe&&vc[255+He-Oe]<=fe&&vc[255+Oe-Se]<=fe}function Wp(D,F,X,ee){var fe=2*ee+1;for(ee=0;16>ee;++ee)hg(D,F+ee,X,fe)&&wf(D,F+ee,X)}function eb(D,F,X,ee){var fe=2*ee+1;for(ee=0;16>ee;++ee)hg(D,F+ee*X,1,fe)&&wf(D,F+ee*X,1)}function G_(D,F,X,ee){var fe;for(fe=3;0<fe;--fe)Wp(D,F+=4*X,X,ee)}function K_(D,F,X,ee){var fe;for(fe=3;0<fe;--fe)eb(D,F+=4,X,ee)}function jf(D,F,X,ee,fe,xe,ge,we){for(xe=2*xe+1;0<fe--;){if(Q1(D,F,X,xe,ge))if(J1(D,F,X,we))wf(D,F,X);else{var Se=D,Oe=F,He=X,at=Se[Oe-2*He],De=Se[Oe-He],Ye=Se[Oe+0],tt=Se[Oe+He],ft=Se[Oe+2*He],rt=27*(bt=YA[1020+3*(Ye-De)+YA[1020+at-tt]])+63>>7,xt=18*bt+63>>7,bt=9*bt+63>>7;Se[Oe-3*He]=Pl[255+Se[Oe-3*He]+bt],Se[Oe-2*He]=Pl[255+at+xt],Se[Oe-He]=Pl[255+De+rt],Se[Oe+0]=Pl[255+Ye-rt],Se[Oe+He]=Pl[255+tt-xt],Se[Oe+2*He]=Pl[255+ft-bt]}F+=ee}}function _f(D,F,X,ee,fe,xe,ge,we){for(xe=2*xe+1;0<fe--;){if(Q1(D,F,X,xe,ge))if(J1(D,F,X,we))wf(D,F,X);else{var Se=D,Oe=F,He=X,at=Se[Oe-He],De=Se[Oe+0],Ye=Se[Oe+He],tt=eN[112+(4+(ft=3*(De-at))>>3)],ft=eN[112+(ft+3>>3)],rt=tt+1>>1;Se[Oe-2*He]=Pl[255+Se[Oe-2*He]+rt],Se[Oe-He]=Pl[255+at+ft],Se[Oe+0]=Pl[255+De-tt],Se[Oe+He]=Pl[255+Ye-rt]}F+=ee}}function X_(D,F,X,ee,fe,xe){jf(D,F,X,1,16,ee,fe,xe)}function Gp(D,F,X,ee,fe,xe){jf(D,F,1,X,16,ee,fe,xe)}function Y_(D,F,X,ee,fe,xe){var ge;for(ge=3;0<ge;--ge)_f(D,F+=4*X,X,1,16,ee,fe,xe)}function G(D,F,X,ee,fe,xe){var ge;for(ge=3;0<ge;--ge)_f(D,F+=4,1,X,16,ee,fe,xe)}function ue(D,F,X,ee,fe,xe,ge,we){jf(D,F,fe,1,8,xe,ge,we),jf(X,ee,fe,1,8,xe,ge,we)}function Ie(D,F,X,ee,fe,xe,ge,we){jf(D,F,1,fe,8,xe,ge,we),jf(X,ee,1,fe,8,xe,ge,we)}function ze(D,F,X,ee,fe,xe,ge,we){_f(D,F+4*fe,fe,1,8,xe,ge,we),_f(X,ee+4*fe,fe,1,8,xe,ge,we)}function Je(D,F,X,ee,fe,xe,ge,we){_f(D,F+4,1,fe,8,xe,ge,we),_f(X,ee+4,1,fe,8,xe,ge,we)}function vt(){this.ba=new Et,this.ec=[],this.cc=[],this.Mc=[],this.Dc=this.Nc=this.dc=this.fc=0,this.Oa=new hr,this.memory=0,this.Ib="OutputFunc",this.Jb="OutputAlphaFunc",this.Nd="OutputRowFunc"}function _t(){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 ir(){this.nc=this.Ea=this.b=this.hc=0,this.K=[],this.w=0}function xr(){this.ua=0,this.Wa=new se,this.vb=new se,this.md=this.xc=this.wc=0,this.vc=[],this.Wb=0,this.Ya=new L,this.yc=new q}function Hr(){this.xb=this.a=0,this.l=new cg,this.ca=new Et,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 xr,this.ab=0,this.gc=o(4,ir),this.Oc=0}function nn(){this.Lc=this.Z=this.$a=this.i=this.c=0,this.l=new cg,this.ic=0,this.ca=[],this.tb=0,this.qd=null,this.rd=0}function Dn(D,F,X,ee,fe,xe,ge){for(D=D==null?0:D[F+0],F=0;F<ge;++F)fe[xe+F]=D+X[ee+F]&255,D=fe[xe+F]}function ra(D,F,X,ee,fe,xe,ge){var we;if(D==null)Dn(null,null,X,ee,fe,xe,ge);else for(we=0;we<ge;++we)fe[xe+we]=D[F+we]+X[ee+we]&255}function qa(D,F,X,ee,fe,xe,ge){if(D==null)Dn(null,null,X,ee,fe,xe,ge);else{var we,Se=D[F+0],Oe=Se,He=Se;for(we=0;we<ge;++we)Oe=He+(Se=D[F+we])-Oe,He=X[ee+we]+(-256&Oe?0>Oe?0:255:Oe)&255,Oe=Se,fe[xe+we]=He}}function _s(D,F,X,ee){var fe=F.width,xe=F.o;if(t(D!=null&&F!=null),0>X||0>=ee||X+ee>xe)return null;if(!D.Cc){if(D.ga==null){var ge;if(D.ga=new nn,(ge=D.ga==null)||(ge=F.width*F.o,t(D.Gb.length==0),D.Gb=i(ge),D.Uc=0,D.Gb==null?ge=0:(D.mb=D.Gb,D.nb=D.Uc,D.rc=null,ge=1),ge=!ge),!ge){ge=D.ga;var we=D.Fa,Se=D.P,Oe=D.qc,He=D.mb,at=D.nb,De=Se+1,Ye=Oe-1,tt=ge.l;if(t(we!=null&&He!=null&&F!=null),Hh[0]=null,Hh[1]=Dn,Hh[2]=ra,Hh[3]=qa,ge.ca=He,ge.tb=at,ge.c=F.width,ge.i=F.height,t(0<ge.c&&0<ge.i),1>=Oe)F=0;else if(ge.$a=3&we[Se+0],ge.Z=we[Se+0]>>2&3,ge.Lc=we[Se+0]>>4&3,Se=we[Se+0]>>6&3,0>ge.$a||1<ge.$a||4<=ge.Z||1<ge.Lc||Se)F=0;else if(tt.put=Xt,tt.ac=mn,tt.bc=fn,tt.ma=ge,tt.width=F.width,tt.height=F.height,tt.Da=F.Da,tt.v=F.v,tt.va=F.va,tt.j=F.j,tt.o=F.o,ge.$a)e:{t(ge.$a==1),F=Be();t:for(;;){if(F==null){F=0;break e}if(t(ge!=null),ge.mc=F,F.c=ge.c,F.i=ge.i,F.l=ge.l,F.l.ma=ge,F.l.width=ge.c,F.l.height=ge.i,F.a=0,M(F.m,we,De,Ye),!Ze(ge.c,ge.i,1,F,null)||(F.ab==1&&F.gc[0].hc==3&&ke(F.s)?(ge.ic=1,we=F.c*F.i,F.Ta=null,F.Ua=0,F.V=i(we),F.Ba=0,F.V==null?(F.a=1,F=0):F=1):(ge.ic=0,F=et(F,ge.c)),!F))break t;F=1;break e}ge.mc=null,F=0}else F=Ye>=ge.c*ge.i;ge=!F}if(ge)return null;D.ga.Lc!=1?D.Ga=0:ee=xe-X}t(D.ga!=null),t(X+ee<=xe);e:{if(F=(we=D.ga).c,xe=we.l.o,we.$a==0){if(De=D.rc,Ye=D.Vc,tt=D.Fa,Se=D.P+1+X*F,Oe=D.mb,He=D.nb+X*F,t(Se<=D.P+D.qc),we.Z!=0)for(t(Hh[we.Z]!=null),ge=0;ge<ee;++ge)Hh[we.Z](De,Ye,tt,Se,Oe,He,F),De=Oe,Ye=He,He+=F,Se+=F;else for(ge=0;ge<ee;++ge)n(Oe,He,tt,Se,F),De=Oe,Ye=He,He+=F,Se+=F;D.rc=De,D.Vc=Ye}else{if(t(we.mc!=null),F=X+ee,t((ge=we.mc)!=null),t(F<=ge.i),ge.C>=F)F=1;else if(we.ic||gu(),we.ic){we=ge.V,De=ge.Ba,Ye=ge.c;var ft=ge.i,rt=(tt=1,Se=ge.$/Ye,Oe=ge.$%Ye,He=ge.m,at=ge.s,ge.$),xt=Ye*ft,bt=Ye*F,At=at.wc,Nt=rt<bt?pe(at,Oe,Se):null;t(rt<=xt),t(F<=ft),t(ke(at));t:for(;;){for(;!He.h&&rt<bt;){if(Oe&At||(Nt=pe(at,Oe,Se)),t(Nt!=null),te(He),256>(ft=On(Nt.G[0],Nt.H[0],He)))we[De+rt]=ft,++rt,++Oe>=Ye&&(Oe=0,++Se<=F&&!(Se%16)&&Re(ge,Se));else{if(!(280>ft)){tt=0;break t}ft=rn(ft-256,He);var gr,sr=On(Nt.G[4],Nt.H[4],He);if(te(He),!(rt>=(sr=wn(Ye,sr=rn(sr,He)))&&xt-rt>=ft)){tt=0;break t}for(gr=0;gr<ft;++gr)we[De+rt+gr]=we[De+rt+gr-sr];for(rt+=ft,Oe+=ft;Oe>=Ye;)Oe-=Ye,++Se<=F&&!(Se%16)&&Re(ge,Se);rt<bt&&Oe&At&&(Nt=pe(at,Oe,Se))}t(He.h==U(He))}Re(ge,Se>F?F:Se);break t}!tt||He.h&&rt<xt?(tt=0,ge.a=He.h?5:3):ge.$=rt,F=tt}else F=Ce(ge,ge.V,ge.Ba,ge.c,ge.i,F,wt);if(!F){ee=0;break e}}X+ee>=xe&&(D.Cc=1),ee=1}if(!ee)return null;if(D.Cc&&((ee=D.ga)!=null&&(ee.mc=null),D.ga=null,0<D.Ga))return alert("todo:WebPDequantizeLevels"),null}return D.nb+X*fe}function ai(D,F,X,ee,fe,xe){for(;0<fe--;){var ge,we=D,Se=F+(X?1:0),Oe=D,He=F+(X?0:3);for(ge=0;ge<ee;++ge){var at=Oe[He+4*ge];at!=255&&(at*=32897,we[Se+4*ge+0]=we[Se+4*ge+0]*at>>23,we[Se+4*ge+1]=we[Se+4*ge+1]*at>>23,we[Se+4*ge+2]=we[Se+4*ge+2]*at>>23)}F+=xe}}function Ua(D,F,X,ee,fe){for(;0<ee--;){var xe;for(xe=0;xe<X;++xe){var ge=D[F+2*xe+0],we=15&(Oe=D[F+2*xe+1]),Se=4369*we,Oe=(240&Oe|Oe>>4)*Se>>16;D[F+2*xe+0]=(240&ge|ge>>4)*Se>>16&240|(15&ge|ge<<4)*Se>>16>>4&15,D[F+2*xe+1]=240&Oe|we}F+=fe}}function zi(D,F,X,ee,fe,xe,ge,we){var Se,Oe,He=255;for(Oe=0;Oe<fe;++Oe){for(Se=0;Se<ee;++Se){var at=D[F+Se];xe[ge+4*Se]=at,He&=at}F+=X,ge+=we}return He!=255}function Nf(D,F,X,ee,fe){var xe;for(xe=0;xe<fe;++xe)X[ee+xe]=D[F+xe]>>8}function gu(){fb=ai,n$=Ua,s$=zi,a$=Nf}function Sf(D,F,X){T[D]=function(ee,fe,xe,ge,we,Se,Oe,He,at,De,Ye,tt,ft,rt,xt,bt,At){var Nt,gr=At-1>>1,sr=we[Se+0]|Oe[He+0]<<16,an=at[De+0]|Ye[tt+0]<<16;t(ee!=null);var ur=3*sr+an+131074>>2;for(F(ee[fe+0],255&ur,ur>>16,ft,rt),xe!=null&&(ur=3*an+sr+131074>>2,F(xe[ge+0],255&ur,ur>>16,xt,bt)),Nt=1;Nt<=gr;++Nt){var kn=we[Se+Nt]|Oe[He+Nt]<<16,oi=at[De+Nt]|Ye[tt+Nt]<<16,on=sr+kn+an+oi+524296,dr=on+2*(kn+an)>>3;ur=dr+sr>>1,sr=(on=on+2*(sr+oi)>>3)+kn>>1,F(ee[fe+2*Nt-1],255&ur,ur>>16,ft,rt+(2*Nt-1)*X),F(ee[fe+2*Nt-0],255&sr,sr>>16,ft,rt+(2*Nt-0)*X),xe!=null&&(ur=on+an>>1,sr=dr+oi>>1,F(xe[ge+2*Nt-1],255&ur,ur>>16,xt,bt+(2*Nt-1)*X),F(xe[ge+2*Nt+0],255&sr,sr>>16,xt,bt+(2*Nt+0)*X)),sr=kn,an=oi}1&At||(ur=3*sr+an+131074>>2,F(ee[fe+At-1],255&ur,ur>>16,ft,rt+(At-1)*X),xe!=null&&(ur=3*an+sr+131074>>2,F(xe[ge+At-1],255&ur,ur>>16,xt,bt+(At-1)*X)))}}function tb(){yc[tN]=fxe,yc[rN]=x$,yc[d$]=hxe,yc[nN]=g$,yc[sN]=v$,yc[ZA]=y$,yc[f$]=mxe,yc[JA]=x$,yc[QA]=g$,yc[aN]=v$,yc[e3]=y$}function mg(D){return D&-16384?0>D?0:255:D>>pxe}function Rh(D,F){return mg((19077*D>>8)+(26149*F>>8)-14234)}function Kp(D,F,X){return mg((19077*D>>8)-(6419*F>>8)-(13320*X>>8)+8708)}function Xp(D,F){return mg((19077*D>>8)+(33050*F>>8)-17685)}function Lh(D,F,X,ee,fe){ee[fe+0]=Rh(D,X),ee[fe+1]=Kp(D,F,X),ee[fe+2]=Xp(D,F)}function qi(D,F,X,ee,fe){ee[fe+0]=Xp(D,F),ee[fe+1]=Kp(D,F,X),ee[fe+2]=Rh(D,X)}function Yp(D,F,X,ee,fe){var xe=Kp(D,F,X);F=xe<<3&224|Xp(D,F)>>3,ee[fe+0]=248&Rh(D,X)|xe>>5,ee[fe+1]=F}function Zp(D,F,X,ee,fe){var xe=240&Xp(D,F)|15;ee[fe+0]=240&Rh(D,X)|Kp(D,F,X)>>4,ee[fe+1]=xe}function rb(D,F,X,ee,fe){ee[fe+0]=255,Lh(D,F,X,ee,fe+1)}function nb(D,F,X,ee,fe){qi(D,F,X,ee,fe),ee[fe+3]=255}function To(D,F,X,ee,fe){Lh(D,F,X,ee,fe),ee[fe+3]=255}function kf(D,F,X){T[D]=function(ee,fe,xe,ge,we,Se,Oe,He,at){for(var De=He+(-2&at)*X;He!=De;)F(ee[fe+0],xe[ge+0],we[Se+0],Oe,He),F(ee[fe+1],xe[ge+0],we[Se+0],Oe,He+X),fe+=2,++ge,++Se,He+=2*X;1&at&&F(ee[fe+0],xe[ge+0],we[Se+0],Oe,He)}}function pg(D,F,X){return X==0?D==0?F==0?6:5:F==0?4:0:X}function Z_(D,F,X,ee,fe){switch(D>>>30){case 3:tx(F,X,ee,fe,0);break;case 2:gc(F,X,ee,fe);break;case 1:Yn(F,X,ee,fe)}}function xc(D,F){var X,ee,fe=F.M,xe=F.Nb,ge=D.oc,we=D.pc+40,Se=D.oc,Oe=D.pc+584,He=D.oc,at=D.pc+600;for(X=0;16>X;++X)ge[we+32*X-1]=129;for(X=0;8>X;++X)Se[Oe+32*X-1]=129,He[at+32*X-1]=129;for(0<fe?ge[we-1-32]=Se[Oe-1-32]=He[at-1-32]=129:(a(ge,we-32-1,127,21),a(Se,Oe-32-1,127,9),a(He,at-32-1,127,9)),ee=0;ee<D.za;++ee){var De=F.ya[F.aa+ee];if(0<ee){for(X=-1;16>X;++X)n(ge,we+32*X-4,ge,we+32*X+12,4);for(X=-1;8>X;++X)n(Se,Oe+32*X-4,Se,Oe+32*X+4,4),n(He,at+32*X-4,He,at+32*X+4,4)}var Ye=D.Gd,tt=D.Hd+ee,ft=De.ad,rt=De.Hc;if(0<fe&&(n(ge,we-32,Ye[tt].y,0,16),n(Se,Oe-32,Ye[tt].f,0,8),n(He,at-32,Ye[tt].ea,0,8)),De.Za){var xt=ge,bt=we-32+16;for(0<fe&&(ee>=D.za-1?a(xt,bt,Ye[tt].y[15],4):n(xt,bt,Ye[tt+1].y,0,4)),X=0;4>X;X++)xt[bt+128+X]=xt[bt+256+X]=xt[bt+384+X]=xt[bt+0+X];for(X=0;16>X;++X,rt<<=2)xt=ge,bt=we+w$[X],vu[De.Ob[X]](xt,bt),Z_(rt,ft,16*+X,xt,bt)}else if(xt=pg(ee,fe,De.Ob[0]),Vh[xt](ge,we),rt!=0)for(X=0;16>X;++X,rt<<=2)Z_(rt,ft,16*+X,ge,we+w$[X]);for(X=De.Gc,xt=pg(ee,fe,De.Dd),Af[xt](Se,Oe),Af[xt](He,at),rt=ft,xt=Se,bt=Oe,255&(De=0|X)&&(170&De?_d(rt,256,xt,bt):ps(rt,256,xt,bt)),De=He,rt=at,255&(X>>=8)&&(170&X?_d(ft,320,De,rt):ps(ft,320,De,rt)),fe<D.Ub-1&&(n(Ye[tt].y,0,ge,we+480,16),n(Ye[tt].f,0,Se,Oe+224,8),n(Ye[tt].ea,0,He,at+224,8)),X=8*xe*D.B,Ye=D.sa,tt=D.ta+16*ee+16*xe*D.R,ft=D.qa,De=D.ra+8*ee+X,rt=D.Ha,xt=D.Ia+8*ee+X,X=0;16>X;++X)n(Ye,tt+X*D.R,ge,we+32*X,16);for(X=0;8>X;++X)n(ft,De+X*D.B,Se,Oe+32*X,8),n(rt,xt+X*D.B,He,at+32*X,8)}}function Jp(D,F,X,ee,fe,xe,ge,we,Se){var Oe=[0],He=[0],at=0,De=Se!=null?Se.kd:0,Ye=Se??new _t;if(D==null||12>X)return 7;Ye.data=D,Ye.w=F,Ye.ha=X,F=[F],X=[X],Ye.gb=[Ye.gb];e:{var tt=F,ft=X,rt=Ye.gb;if(t(D!=null),t(ft!=null),t(rt!=null),rt[0]=0,12<=ft[0]&&!r(D,tt[0],"RIFF")){if(r(D,tt[0]+8,"WEBP")){rt=3;break e}var xt=W(D,tt[0]+4);if(12>xt||4294967286<xt){rt=3;break e}if(De&&xt>ft[0]-8){rt=7;break e}rt[0]=xt,tt[0]+=12,ft[0]-=12}rt=0}if(rt!=0)return rt;for(xt=0<Ye.gb[0],X=X[0];;){e:{var bt=D;ft=F,rt=X;var At=Oe,Nt=He,gr=tt=[0];if((ur=at=[at])[0]=0,8>rt[0])rt=7;else{if(!r(bt,ft[0],"VP8X")){if(W(bt,ft[0]+4)!=10){rt=3;break e}if(18>rt[0]){rt=7;break e}var sr=W(bt,ft[0]+8),an=1+Ve(bt,ft[0]+12);if(2147483648<=an*(bt=1+Ve(bt,ft[0]+15))){rt=3;break e}gr!=null&&(gr[0]=sr),At!=null&&(At[0]=an),Nt!=null&&(Nt[0]=bt),ft[0]+=18,rt[0]-=18,ur[0]=1}rt=0}}if(at=at[0],tt=tt[0],rt!=0)return rt;if(ft=!!(2&tt),!xt&&at)return 3;if(xe!=null&&(xe[0]=!!(16&tt)),ge!=null&&(ge[0]=ft),we!=null&&(we[0]=0),ge=Oe[0],tt=He[0],at&&ft&&Se==null){rt=0;break}if(4>X){rt=7;break}if(xt&&at||!xt&&!at&&!r(D,F[0],"ALPH")){X=[X],Ye.na=[Ye.na],Ye.P=[Ye.P],Ye.Sa=[Ye.Sa];e:{sr=D,rt=F,xt=X;var ur=Ye.gb;At=Ye.na,Nt=Ye.P,gr=Ye.Sa,an=22,t(sr!=null),t(xt!=null),bt=rt[0];var kn=xt[0];for(t(At!=null),t(gr!=null),At[0]=null,Nt[0]=null,gr[0]=0;;){if(rt[0]=bt,xt[0]=kn,8>kn){rt=7;break e}var oi=W(sr,bt+4);if(4294967286<oi){rt=3;break e}var on=8+oi+1&-2;if(an+=on,0<ur&&an>ur){rt=3;break e}if(!r(sr,bt,"VP8 ")||!r(sr,bt,"VP8L")){rt=0;break e}if(kn[0]<on){rt=7;break e}r(sr,bt,"ALPH")||(At[0]=sr,Nt[0]=bt+8,gr[0]=oi),bt+=on,kn-=on}}if(X=X[0],Ye.na=Ye.na[0],Ye.P=Ye.P[0],Ye.Sa=Ye.Sa[0],rt!=0)break}X=[X],Ye.Ja=[Ye.Ja],Ye.xa=[Ye.xa];e:if(ur=D,rt=F,xt=X,At=Ye.gb[0],Nt=Ye.Ja,gr=Ye.xa,sr=rt[0],bt=!r(ur,sr,"VP8 "),an=!r(ur,sr,"VP8L"),t(ur!=null),t(xt!=null),t(Nt!=null),t(gr!=null),8>xt[0])rt=7;else{if(bt||an){if(ur=W(ur,sr+4),12<=At&&ur>At-12){rt=3;break e}if(De&&ur>xt[0]-8){rt=7;break e}Nt[0]=ur,rt[0]+=8,xt[0]-=8,gr[0]=an}else gr[0]=5<=xt[0]&&ur[sr+0]==47&&!(ur[sr+4]>>5),Nt[0]=xt[0];rt=0}if(X=X[0],Ye.Ja=Ye.Ja[0],Ye.xa=Ye.xa[0],F=F[0],rt!=0)break;if(4294967286<Ye.Ja)return 3;if(we==null||ft||(we[0]=Ye.xa?2:1),ge=[ge],tt=[tt],Ye.xa){if(5>X){rt=7;break}we=ge,De=tt,ft=xe,D==null||5>X?D=0:5<=X&&D[F+0]==47&&!(D[F+4]>>5)?(xt=[0],ur=[0],At=[0],M(Nt=new A,D,F,X),Xn(Nt,xt,ur,At)?(we!=null&&(we[0]=xt[0]),De!=null&&(De[0]=ur[0]),ft!=null&&(ft[0]=At[0]),D=1):D=0):D=0}else{if(10>X){rt=7;break}we=tt,D==null||10>X||!B_(D,F+3,X-3)?D=0:(De=D[F+0]|D[F+1]<<8|D[F+2]<<16,ft=16383&(D[F+7]<<8|D[F+6]),D=16383&(D[F+9]<<8|D[F+8]),1&De||3<(De>>1&7)||!(De>>4&1)||De>>5>=Ye.Ja||!ft||!D?D=0:(ge&&(ge[0]=ft),we&&(we[0]=D),D=1))}if(!D||(ge=ge[0],tt=tt[0],at&&(Oe[0]!=ge||He[0]!=tt)))return 3;Se!=null&&(Se[0]=Ye,Se.offset=F-Se.w,t(4294967286>F-Se.w),t(Se.offset==Se.ha-X));break}return rt==0||rt==7&&at&&Se==null?(xe!=null&&(xe[0]|=Ye.na!=null&&0<Ye.na.length),ee!=null&&(ee[0]=ge),fe!=null&&(fe[0]=tt),0):rt}function sb(D,F,X){var ee=F.width,fe=F.height,xe=0,ge=0,we=ee,Se=fe;if(F.Da=D!=null&&0<D.Da,F.Da&&(we=D.cd,Se=D.bd,xe=D.v,ge=D.j,11>X||(xe&=-2,ge&=-2),0>xe||0>ge||0>=we||0>=Se||xe+we>ee||ge+Se>fe))return 0;if(F.v=xe,F.j=ge,F.va=xe+we,F.o=ge+Se,F.U=we,F.T=Se,F.da=D!=null&&0<D.da,F.da){if(!oe(we,Se,X=[D.ib],xe=[D.hb]))return 0;F.ib=X[0],F.hb=xe[0]}return F.ob=D!=null&&D.ob,F.Kb=D==null||!D.Sd,F.da&&(F.ob=F.ib<3*ee/4&&F.hb<3*fe/4,F.Kb=0),1}function ab(D){if(D==null)return 2;if(11>D.S){var F=D.f.RGBA;F.fb+=(D.height-1)*F.A,F.A=-F.A}else F=D.f.kb,D=D.height,F.O+=(D-1)*F.fa,F.fa=-F.fa,F.N+=(D-1>>1)*F.Ab,F.Ab=-F.Ab,F.W+=(D-1>>1)*F.Db,F.Db=-F.Db,F.F!=null&&(F.J+=(D-1)*F.lb,F.lb=-F.lb);return 0}function Fh(D,F,X,ee){if(ee==null||0>=D||0>=F)return 2;if(X!=null){if(X.Da){var fe=X.cd,xe=X.bd,ge=-2&X.v,we=-2&X.j;if(0>ge||0>we||0>=fe||0>=xe||ge+fe>D||we+xe>F)return 2;D=fe,F=xe}if(X.da){if(!oe(D,F,fe=[X.ib],xe=[X.hb]))return 2;D=fe[0],F=xe[0]}}ee.width=D,ee.height=F;e:{var Se=ee.width,Oe=ee.height;if(D=ee.S,0>=Se||0>=Oe||!(D>=tN&&13>D))D=2;else{if(0>=ee.Rd&&ee.sd==null){ge=xe=fe=F=0;var He=(we=Se*j$[D])*Oe;if(11>D||(xe=(Oe+1)/2*(F=(Se+1)/2),D==12&&(ge=(fe=Se)*Oe)),(Oe=i(He+2*xe+ge))==null){D=1;break e}ee.sd=Oe,11>D?((Se=ee.f.RGBA).eb=Oe,Se.fb=0,Se.A=we,Se.size=He):((Se=ee.f.kb).y=Oe,Se.O=0,Se.fa=we,Se.Fd=He,Se.f=Oe,Se.N=0+He,Se.Ab=F,Se.Cd=xe,Se.ea=Oe,Se.W=0+He+xe,Se.Db=F,Se.Ed=xe,D==12&&(Se.F=Oe,Se.J=0+He+2*xe),Se.Tc=ge,Se.lb=fe)}if(F=1,fe=ee.S,xe=ee.width,ge=ee.height,fe>=tN&&13>fe)if(11>fe)D=ee.f.RGBA,F&=(we=Math.abs(D.A))*(ge-1)+xe<=D.size,F&=we>=xe*j$[fe],F&=D.eb!=null;else{D=ee.f.kb,we=(xe+1)/2,He=(ge+1)/2,Se=Math.abs(D.fa),Oe=Math.abs(D.Ab);var at=Math.abs(D.Db),De=Math.abs(D.lb),Ye=De*(ge-1)+xe;F&=Se*(ge-1)+xe<=D.Fd,F&=Oe*(He-1)+we<=D.Cd,F=(F&=at*(He-1)+we<=D.Ed)&Se>=xe&Oe>=we&at>=we,F&=D.y!=null,F&=D.f!=null,F&=D.ea!=null,fe==12&&(F&=De>=xe,F&=Ye<=D.Tc,F&=D.F!=null)}else F=0;D=F?0:2}}return D!=0||X!=null&&X.fd&&(D=ab(ee)),D}var Qp=64,Al=[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],Tl=24,Mh=32,Cf=8,$h=[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];de("Predictor0","PredictorAdd0"),T.Predictor0=function(){return 4278190080},T.Predictor1=function(D){return D},T.Predictor2=function(D,F,X){return F[X+0]},T.Predictor3=function(D,F,X){return F[X+1]},T.Predictor4=function(D,F,X){return F[X-1]},T.Predictor5=function(D,F,X){return Le(Le(D,F[X+1]),F[X+0])},T.Predictor6=function(D,F,X){return Le(D,F[X-1])},T.Predictor7=function(D,F,X){return Le(D,F[X+0])},T.Predictor8=function(D,F,X){return Le(F[X-1],F[X+0])},T.Predictor9=function(D,F,X){return Le(F[X+0],F[X+1])},T.Predictor10=function(D,F,X){return Le(Le(D,F[X-1]),Le(F[X+0],F[X+1]))},T.Predictor11=function(D,F,X){var ee=F[X+0];return 0>=_e(ee>>24&255,D>>24&255,(F=F[X-1])>>24&255)+_e(ee>>16&255,D>>16&255,F>>16&255)+_e(ee>>8&255,D>>8&255,F>>8&255)+_e(255&ee,255&D,255&F)?ee:D},T.Predictor12=function(D,F,X){var ee=F[X+0];return(Ke((D>>24&255)+(ee>>24&255)-((F=F[X-1])>>24&255))<<24|Ke((D>>16&255)+(ee>>16&255)-(F>>16&255))<<16|Ke((D>>8&255)+(ee>>8&255)-(F>>8&255))<<8|Ke((255&D)+(255&ee)-(255&F)))>>>0},T.Predictor13=function(D,F,X){var ee=F[X-1];return(ve((D=Le(D,F[X+0]))>>24&255,ee>>24&255)<<24|ve(D>>16&255,ee>>16&255)<<16|ve(D>>8&255,ee>>8&255)<<8|ve(255&D,255&ee))>>>0};var ib=T.PredictorAdd0;T.PredictorAdd1=Ue,de("Predictor2","PredictorAdd2"),de("Predictor3","PredictorAdd3"),de("Predictor4","PredictorAdd4"),de("Predictor5","PredictorAdd5"),de("Predictor6","PredictorAdd6"),de("Predictor7","PredictorAdd7"),de("Predictor8","PredictorAdd8"),de("Predictor9","PredictorAdd9"),de("Predictor10","PredictorAdd10"),de("Predictor11","PredictorAdd11"),de("Predictor12","PredictorAdd12"),de("Predictor13","PredictorAdd13");var xg=T.PredictorAdd2;Ge("ColorIndexInverseTransform","MapARGB","32b",function(D){return D>>8&255},function(D){return D}),Ge("VP8LColorIndexInverseTransformAlpha","MapAlpha","8b",function(D){return D},function(D){return D>>8&255});var Ca,J_=T.ColorIndexInverseTransform,wd=T.MapARGB,jd=T.VP8LColorIndexInverseTransformAlpha,ob=T.MapAlpha,lb=T.VP8LPredictorsAdd=[];lb.length=16,(T.VP8LPredictors=[]).length=16,(T.VP8LPredictorsAdd_C=[]).length=16,(T.VP8LPredictors_C=[]).length=16;var cb,ub,Bh,zh,qh,ex,Uh,tx,gc,_d,Yn,ps,Ea,ii,Ef,db,gg,Q_,Z7,J7,Q7,e$,t$,r$,fb,n$,s$,a$,i$=i(511),o$=i(2041),l$=i(225),c$=i(767),u$=0,YA=o$,eN=l$,Pl=c$,vc=i$,tN=0,rN=1,d$=2,nN=3,sN=4,ZA=5,f$=6,JA=7,QA=8,aN=9,e3=10,Jpe=[2,3,7],Qpe=[3,3,11],h$=[280,256,256,256,40],exe=[0,1,1,1,0],txe=[17,18,0,1,2,3,4,5,16,6,7,8,9,10,11,12,13,14,15],rxe=[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],nxe=[2954,2956,2958,2962,2970,2986,3018,3082,3212,3468,3980,5004],sxe=8,t3=[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],r3=[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],hb=null,axe=[[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]],ixe=[0,1,4,8,5,2,3,6,9,12,13,10,7,11,14,15],m$=[-0,1,-1,2,-2,3,4,6,-3,5,-4,-5,-6,7,-7,8,-8,-9],oxe=[[[[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]]]],lxe=[[[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]]],cxe=[[[[255,255,255,255,255,255,255,255,255,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]]]],uxe=[0,1,2,3,6,4,5,6,6,6,6,6,6,6,6,7,0],Vh=[],vu=[],Af=[],dxe=1,p$=2,Hh=[],yc=[];Sf("UpsampleRgbLinePair",Lh,3),Sf("UpsampleBgrLinePair",qi,3),Sf("UpsampleRgbaLinePair",To,4),Sf("UpsampleBgraLinePair",nb,4),Sf("UpsampleArgbLinePair",rb,4),Sf("UpsampleRgba4444LinePair",Zp,2),Sf("UpsampleRgb565LinePair",Yp,2);var fxe=T.UpsampleRgbLinePair,hxe=T.UpsampleBgrLinePair,x$=T.UpsampleRgbaLinePair,g$=T.UpsampleBgraLinePair,v$=T.UpsampleArgbLinePair,y$=T.UpsampleRgba4444LinePair,mxe=T.UpsampleRgb565LinePair,iN=16,oN=1<<iN-1,mb=-227,n3=482,pxe=6,b$=0,xxe=i(256),gxe=i(256),vxe=i(256),yxe=i(256),bxe=i(n3-mb),wxe=i(n3-mb);kf("YuvToRgbRow",Lh,3),kf("YuvToBgrRow",qi,3),kf("YuvToRgbaRow",To,4),kf("YuvToBgraRow",nb,4),kf("YuvToArgbRow",rb,4),kf("YuvToRgba4444Row",Zp,2),kf("YuvToRgb565Row",Yp,2);var w$=[0,4,8,12,128,132,136,140,256,260,264,268,384,388,392,396],lN=[0,2,8],jxe=[8,7,6,4,4,2,2,2,1,1,1,1],_xe=1;this.WebPDecodeRGBA=function(D,F,X,ee,fe){var xe=rN,ge=new vt,we=new Et;ge.ba=we,we.S=xe,we.width=[we.width],we.height=[we.height];var Se=we.width,Oe=we.height,He=new Ct;if(He==null||D==null)var at=2;else t(He!=null),at=Jp(D,F,X,He.width,He.height,He.Pd,He.Qd,He.format,null);if(at!=0?Se=0:(Se!=null&&(Se[0]=He.width[0]),Oe!=null&&(Oe[0]=He.height[0]),Se=1),Se){we.width=we.width[0],we.height=we.height[0],ee!=null&&(ee[0]=we.width),fe!=null&&(fe[0]=we.height);e:{if(ee=new cg,(fe=new _t).data=D,fe.w=F,fe.ha=X,fe.kd=1,F=[0],t(fe!=null),((D=Jp(fe.data,fe.w,fe.ha,null,null,null,F,null,fe))==0||D==7)&&F[0]&&(D=4),(F=D)==0){if(t(ge!=null),ee.data=fe.data,ee.w=fe.w+fe.offset,ee.ha=fe.ha-fe.offset,ee.put=Xt,ee.ac=mn,ee.bc=fn,ee.ma=ge,fe.xa){if((D=Be())==null){ge=1;break e}if(function(De,Ye){var tt=[0],ft=[0],rt=[0];t:for(;;){if(De==null)return 0;if(Ye==null)return De.a=2,0;if(De.l=Ye,De.a=0,M(De.m,Ye.data,Ye.w,Ye.ha),!Xn(De.m,tt,ft,rt)){De.a=3;break t}if(De.xb=p$,Ye.width=tt[0],Ye.height=ft[0],!Ze(tt[0],ft[0],1,De,null))break t;return 1}return t(De.a!=0),0}(D,ee)){if(ee=(F=Fh(ee.width,ee.height,ge.Oa,ge.ba))==0){t:{ee=D;r:for(;;){if(ee==null){ee=0;break t}if(t(ee.s.yc!=null),t(ee.s.Ya!=null),t(0<ee.s.Wb),t((X=ee.l)!=null),t((fe=X.ma)!=null),ee.xb!=0){if(ee.ca=fe.ba,ee.tb=fe.tb,t(ee.ca!=null),!sb(fe.Oa,X,nN)){ee.a=2;break r}if(!et(ee,X.width)||X.da)break r;if((X.da||Yt(ee.ca.S))&&gu(),11>ee.ca.S||(alert("todo:WebPInitConvertARGBToYUV"),ee.ca.f.kb.F!=null&&gu()),ee.Pb&&0<ee.s.ua&&ee.s.vb.X==null&&!Z(ee.s.vb,ee.s.Wa.Xa)){ee.a=1;break r}ee.xb=0}if(!Ce(ee,ee.V,ee.Ba,ee.c,ee.i,X.o,Ne))break r;fe.Dc=ee.Ma,ee=1;break t}t(ee.a!=0),ee=0}ee=!ee}ee&&(F=D.a)}else F=D.a}else{if((D=new RA)==null){ge=1;break e}if(D.Fa=fe.na,D.P=fe.P,D.qc=fe.Sa,yd(D,ee)){if((F=Fh(ee.width,ee.height,ge.Oa,ge.ba))==0){if(D.Aa=0,X=ge.Oa,t((fe=D)!=null),X!=null){if(0<(Se=0>(Se=X.Md)?0:100<Se?255:255*Se/100)){for(Oe=He=0;4>Oe;++Oe)12>(at=fe.pb[Oe]).lc&&(at.ia=Se*jxe[0>at.lc?0:at.lc]>>3),He|=at.ia;He&&(alert("todo:VP8InitRandom"),fe.ia=1)}fe.Ga=X.Id,100<fe.Ga?fe.Ga=100:0>fe.Ga&&(fe.Ga=0)}(function(De,Ye){if(De==null)return 0;if(Ye==null)return za(De,2,"NULL VP8Io parameter in VP8Decode().");if(!De.cb&&!yd(De,Ye))return 0;if(t(De.cb),Ye.ac==null||Ye.ac(Ye)){Ye.ob&&(De.L=0);var tt=lN[De.L];if(De.L==2?(De.yb=0,De.zb=0):(De.yb=Ye.v-tt>>4,De.zb=Ye.j-tt>>4,0>De.yb&&(De.yb=0),0>De.zb&&(De.zb=0)),De.Va=Ye.o+15+tt>>4,De.Hb=Ye.va+15+tt>>4,De.Hb>De.za&&(De.Hb=De.za),De.Va>De.Ub&&(De.Va=De.Ub),0<De.L){var ft=De.ed;for(tt=0;4>tt;++tt){var rt;if(De.Qa.Cb){var xt=De.Qa.Lb[tt];De.Qa.Fb||(xt+=ft.Tb)}else xt=ft.Tb;for(rt=0;1>=rt;++rt){var bt=De.gd[tt][rt],At=xt;if(ft.Pc&&(At+=ft.vd[0],rt&&(At+=ft.od[0])),0<(At=0>At?0:63<At?63:At)){var Nt=At;0<ft.wb&&(Nt=4<ft.wb?Nt>>2:Nt>>1)>9-ft.wb&&(Nt=9-ft.wb),1>Nt&&(Nt=1),bt.dd=Nt,bt.tc=2*At+Nt,bt.ld=40<=At?2:15<=At?1:0}else bt.tc=0;bt.La=rt}}}tt=0}else za(De,6,"Frame setup failed"),tt=De.a;if(tt=tt==0){if(tt){De.$c=0,0<De.Aa||(De.Ic=_xe);t:{tt=De.Ic,ft=4*(Nt=De.za);var gr=32*Nt,sr=Nt+1,an=0<De.L?Nt*(0<De.Aa?2:1):0,ur=(De.Aa==2?2:1)*Nt;if((bt=ft+832+(rt=3*(16*tt+lN[De.L])/2*gr)+(xt=De.Fa!=null&&0<De.Fa.length?De.Kc.c*De.Kc.i:0))!=bt)tt=0;else{if(bt>De.Vb){if(De.Vb=0,De.Ec=i(bt),De.Fc=0,De.Ec==null){tt=za(De,1,"no memory during frame initialization.");break t}De.Vb=bt}bt=De.Ec,At=De.Fc,De.Ac=bt,De.Bc=At,At+=ft,De.Gd=o(gr,mc),De.Hd=0,De.rb=o(sr+1,da),De.sb=1,De.wa=an?o(an,jn):null,De.Y=0,De.D.Nb=0,De.D.wa=De.wa,De.D.Y=De.Y,0<De.Aa&&(De.D.Y+=Nt),t(!0),De.oc=bt,De.pc=At,At+=832,De.ya=o(ur,pu),De.aa=0,De.D.ya=De.ya,De.D.aa=De.aa,De.Aa==2&&(De.D.aa+=Nt),De.R=16*Nt,De.B=8*Nt,Nt=(gr=lN[De.L])*De.R,gr=gr/2*De.B,De.sa=bt,De.ta=At+Nt,De.qa=De.sa,De.ra=De.ta+16*tt*De.R+gr,De.Ha=De.qa,De.Ia=De.ra+8*tt*De.B+gr,De.$c=0,At+=rt,De.mb=xt?bt:null,De.nb=xt?At:null,t(At+xt<=De.Fc+De.Vb),z_(De),a(De.Ac,De.Bc,0,ft),tt=1}}if(tt){if(Ye.ka=0,Ye.y=De.sa,Ye.O=De.ta,Ye.f=De.qa,Ye.N=De.ra,Ye.ea=De.Ha,Ye.Vd=De.Ia,Ye.fa=De.R,Ye.Rc=De.B,Ye.F=null,Ye.J=0,!u$){for(tt=-255;255>=tt;++tt)i$[255+tt]=0>tt?-tt:tt;for(tt=-1020;1020>=tt;++tt)o$[1020+tt]=-128>tt?-128:127<tt?127:tt;for(tt=-112;112>=tt;++tt)l$[112+tt]=-16>tt?-16:15<tt?15:tt;for(tt=-255;510>=tt;++tt)c$[255+tt]=0>tt?0:255<tt?255:tt;u$=1}Uh=dg,tx=FA,_d=bd,Yn=U_,ps=V_,gc=LA,Ea=X_,ii=Gp,Ef=ue,db=Ie,gg=Y_,Q_=G,Z7=ze,J7=Je,Q7=Wp,e$=eb,t$=G_,r$=K_,vu[0]=HA,vu[1]=MA,vu[2]=UA,vu[3]=VA,vu[4]=vf,vu[5]=WA,vu[6]=yf,vu[7]=GA,vu[8]=X1,vu[9]=fg,Vh[0]=zA,Vh[1]=BA,Vh[2]=G1,Vh[3]=H_,Vh[4]=Vp,Vh[5]=K1,Vh[6]=qA,Af[0]=XA,Af[1]=$A,Af[2]=Hp,Af[3]=KA,Af[4]=Z1,Af[5]=Y1,Af[6]=W_,tt=1}else tt=0}tt&&(tt=function(kn,oi){for(kn.M=0;kn.M<kn.Va;++kn.M){var on,dr=kn.Jc[kn.M&kn.Xb],Ut=kn.m,Aa=kn;for(on=0;on<Aa.za;++on){var Qr=Ut,Tn=Aa,Fs=Tn.Ac,Ui=Tn.Bc+4*on,Po=Tn.zc,fa=Tn.ya[Tn.aa+on];if(Tn.Qa.Bb?fa.$b=ie(Qr,Tn.Pa.jb[0])?2+ie(Qr,Tn.Pa.jb[2]):ie(Qr,Tn.Pa.jb[1]):fa.$b=0,Tn.kc&&(fa.Ad=ie(Qr,Tn.Bd)),fa.Za=!ie(Qr,145)+0,fa.Za){var io=fa.Ob,Oo=0;for(Tn=0;4>Tn;++Tn){var li,In=Po[0+Tn];for(li=0;4>li;++li){In=lxe[Fs[Ui+li]][In];for(var rs=m$[ie(Qr,In[0])];0<rs;)rs=m$[2*rs+ie(Qr,In[rs])];In=-rs,Fs[Ui+li]=In}n(io,Oo,Fs,Ui,4),Oo+=4,Po[0+Tn]=In}}else In=ie(Qr,156)?ie(Qr,128)?1:3:ie(Qr,163)?2:0,fa.Ob[0]=In,a(Fs,Ui,In,4),a(Po,0,In,4);fa.Dd=ie(Qr,142)?ie(Qr,114)?ie(Qr,183)?1:3:2:0}if(Aa.m.Ka)return za(kn,7,"Premature end-of-partition0 encountered.");for(;kn.ja<kn.za;++kn.ja){if(Aa=dr,Qr=(Ut=kn).rb[Ut.sb-1],Fs=Ut.rb[Ut.sb+Ut.ja],on=Ut.ya[Ut.aa+Ut.ja],Ui=Ut.kc?on.Ad:0)Qr.la=Fs.la=0,on.Za||(Qr.Na=Fs.Na=0),on.Hc=0,on.Gc=0,on.ia=0;else{var ha,ns;if(Qr=Fs,Fs=Aa,Ui=Ut.Pa.Xc,Po=Ut.ya[Ut.aa+Ut.ja],fa=Ut.pb[Po.$b],Tn=Po.ad,io=0,Oo=Ut.rb[Ut.sb-1],In=li=0,a(Tn,io,0,384),Po.Za)var Vi=0,yu=Ui[3];else{rs=i(16);var Ta=Qr.Na+Oo.Na;if(Ta=hb(Fs,Ui[1],Ta,fa.Eb,0,rs,0),Qr.Na=Oo.Na=(0<Ta)+0,1<Ta)Uh(rs,0,Tn,io);else{var sl=rs[0]+3>>3;for(rs=0;256>rs;rs+=16)Tn[io+rs]=sl}Vi=1,yu=Ui[0]}var xs=15&Qr.la,ci=15&Oo.la;for(rs=0;4>rs;++rs){var Ol=1&ci;for(sl=ns=0;4>sl;++sl)xs=xs>>1|(Ol=(Ta=hb(Fs,yu,Ta=Ol+(1&xs),fa.Sc,Vi,Tn,io))>Vi)<<7,ns=ns<<2|(3<Ta?3:1<Ta?2:Tn[io+0]!=0),io+=16;xs>>=4,ci=ci>>1|Ol<<7,li=(li<<8|ns)>>>0}for(yu=xs,Vi=ci>>4,ha=0;4>ha;ha+=2){for(ns=0,xs=Qr.la>>4+ha,ci=Oo.la>>4+ha,rs=0;2>rs;++rs){for(Ol=1&ci,sl=0;2>sl;++sl)Ta=Ol+(1&xs),xs=xs>>1|(Ol=0<(Ta=hb(Fs,Ui[2],Ta,fa.Qc,0,Tn,io)))<<3,ns=ns<<2|(3<Ta?3:1<Ta?2:Tn[io+0]!=0),io+=16;xs>>=2,ci=ci>>1|Ol<<5}In|=ns<<4*ha,yu|=xs<<4<<ha,Vi|=(240&ci)<<ha}Qr.la=yu,Oo.la=Vi,Po.Hc=li,Po.Gc=In,Po.ia=43690&In?0:fa.ia,Ui=!(li|In)}if(0<Ut.L&&(Ut.wa[Ut.Y+Ut.ja]=Ut.gd[on.$b][on.Za],Ut.wa[Ut.Y+Ut.ja].La|=!Ui),Aa.Ka)return za(kn,7,"Premature end-of-file encountered.")}if(z_(kn),Ut=oi,Aa=1,on=(dr=kn).D,Qr=0<dr.L&&dr.M>=dr.zb&&dr.M<=dr.Va,dr.Aa==0)t:{if(on.M=dr.M,on.uc=Qr,xc(dr,on),Aa=1,on=(ns=dr.D).Nb,Qr=(In=lN[dr.L])*dr.R,Fs=In/2*dr.B,rs=16*on*dr.R,sl=8*on*dr.B,Ui=dr.sa,Po=dr.ta-Qr+rs,fa=dr.qa,Tn=dr.ra-Fs+sl,io=dr.Ha,Oo=dr.Ia-Fs+sl,ci=(xs=ns.M)==0,li=xs>=dr.Va-1,dr.Aa==2&&xc(dr,ns),ns.uc)for(Ol=(Ta=dr).D.M,t(Ta.D.uc),ns=Ta.yb;ns<Ta.Hb;++ns){Vi=ns,yu=Ol;var Do=(Dl=(Hi=Ta).D).Nb;ha=Hi.R;var Dl=Dl.wa[Dl.Y+Vi],Il=Hi.sa,al=Hi.ta+16*Do*ha+16*Vi,Rl=Dl.dd,Ns=Dl.tc;if(Ns!=0)if(t(3<=Ns),Hi.L==1)0<Vi&&e$(Il,al,ha,Ns+4),Dl.La&&r$(Il,al,ha,Ns),0<yu&&Q7(Il,al,ha,Ns+4),Dl.La&&t$(Il,al,ha,Ns);else{var Ll=Hi.B,bu=Hi.qa,rx=Hi.ra+8*Do*Ll+8*Vi,Tf=Hi.Ha,Hi=Hi.Ia+8*Do*Ll+8*Vi;Do=Dl.ld,0<Vi&&(ii(Il,al,ha,Ns+4,Rl,Do),db(bu,rx,Tf,Hi,Ll,Ns+4,Rl,Do)),Dl.La&&(Q_(Il,al,ha,Ns,Rl,Do),J7(bu,rx,Tf,Hi,Ll,Ns,Rl,Do)),0<yu&&(Ea(Il,al,ha,Ns+4,Rl,Do),Ef(bu,rx,Tf,Hi,Ll,Ns+4,Rl,Do)),Dl.La&&(gg(Il,al,ha,Ns,Rl,Do),Z7(bu,rx,Tf,Hi,Ll,Ns,Rl,Do))}}if(dr.ia&&alert("todo:DitherRow"),Ut.put!=null){if(ns=16*xs,xs=16*(xs+1),ci?(Ut.y=dr.sa,Ut.O=dr.ta+rs,Ut.f=dr.qa,Ut.N=dr.ra+sl,Ut.ea=dr.Ha,Ut.W=dr.Ia+sl):(ns-=In,Ut.y=Ui,Ut.O=Po,Ut.f=fa,Ut.N=Tn,Ut.ea=io,Ut.W=Oo),li||(xs-=In),xs>Ut.o&&(xs=Ut.o),Ut.F=null,Ut.J=null,dr.Fa!=null&&0<dr.Fa.length&&ns<xs&&(Ut.J=_s(dr,Ut,ns,xs-ns),Ut.F=dr.mb,Ut.F==null&&Ut.F.length==0)){Aa=za(dr,3,"Could not decode alpha data.");break t}ns<Ut.j&&(In=Ut.j-ns,ns=Ut.j,t(!(1&In)),Ut.O+=dr.R*In,Ut.N+=dr.B*(In>>1),Ut.W+=dr.B*(In>>1),Ut.F!=null&&(Ut.J+=Ut.width*In)),ns<xs&&(Ut.O+=Ut.v,Ut.N+=Ut.v>>1,Ut.W+=Ut.v>>1,Ut.F!=null&&(Ut.J+=Ut.v),Ut.ka=ns-Ut.j,Ut.U=Ut.va-Ut.v,Ut.T=xs-ns,Aa=Ut.put(Ut))}on+1!=dr.Ic||li||(n(dr.sa,dr.ta-Qr,Ui,Po+16*dr.R,Qr),n(dr.qa,dr.ra-Fs,fa,Tn+8*dr.B,Fs),n(dr.Ha,dr.Ia-Fs,io,Oo+8*dr.B,Fs))}if(!Aa)return za(kn,6,"Output aborted.")}return 1}(De,Ye)),Ye.bc!=null&&Ye.bc(Ye),tt&=1}return tt?(De.cb=0,tt):0})(D,ee)||(F=D.a)}}else F=D.a}F==0&&ge.Oa!=null&&ge.Oa.fd&&(F=ab(ge.ba))}ge=F}xe=ge!=0?null:11>xe?we.f.RGBA.eb:we.f.kb.y}else xe=null;return xe};var j$=[3,4,3,4,4,2,2,4,4,4,2,1,1]};function u(T,R){for(var k="",E=0;E<4;E++)k+=String.fromCharCode(T[R++]);return k}function d(T,R){return T[R+0]|T[R+1]<<8}function f(T,R){return(T[R+0]|T[R+1]<<8|T[R+2]<<16)>>>0}function m(T,R){return(T[R+0]|T[R+1]<<8|T[R+2]<<16|T[R+3]<<24)>>>0}new c;var h=[0],x=[0],p=[],g=new c,v=e,y=function(T,R){var k={},E=0,q=!1,O=0,L=0;if(k.frames=[],!function(C,A){for(var I=0;I<4;I++)if(C[A+I]!="RIFF".charCodeAt(I))return!0;return!1}(T,R)){for(m(T,R+=4),R+=8;R<T.length;){var H=u(T,R),V=m(T,R+=4);R+=4;var z=V+(1&V);switch(H){case"VP8 ":case"VP8L":k.frames[E]===void 0&&(k.frames[E]={}),(K=k.frames[E]).src_off=q?L:R-8,K.src_size=O+V+8,E++,q&&(q=!1,O=0,L=0);break;case"VP8X":(K=k.header={}).feature_flags=T[R];var M=R+4;K.canvas_width=1+f(T,M),M+=3,K.canvas_height=1+f(T,M),M+=3;break;case"ALPH":q=!0,O=z+8,L=R-8;break;case"ANIM":(K=k.header).bgcolor=m(T,R),M=R+4,K.loop_count=d(T,M),M+=2;break;case"ANMF":var B,K;(K=k.frames[E]={}).offset_x=2*f(T,R),R+=3,K.offset_y=2*f(T,R),R+=3,K.width=1+f(T,R),R+=3,K.height=1+f(T,R),R+=3,K.duration=f(T,R),R+=3,B=T[R++],K.dispose=1&B,K.blend=B>>1&1}H!="ANMF"&&(R+=z)}return k}}(v,0);y.response=v,y.rgbaoutput=!0,y.dataurl=!1;var b=y.header?y.header:null,N=y.frames?y.frames:null;if(b){b.loop_counter=b.loop_count,h=[b.canvas_height],x=[b.canvas_width];for(var j=0;j<N.length&&N[j].blend!=0;j++);}var _=N[0],S=g.WebPDecodeRGBA(v,_.src_off,_.src_size,x,h);_.rgba=S,_.imgwidth=x[0],_.imgheight=h[0];for(var P=0;P<x[0]*h[0]*4;P++)p[P]=S[P];return this.width=x,this.height=h,this.data=p,this}(function(e){var t,r,n,a,i,o,l,c,u,d=function(C){return C=C||{},this.isStrokeTransparent=C.isStrokeTransparent||!1,this.strokeOpacity=C.strokeOpacity||1,this.strokeStyle=C.strokeStyle||"#000000",this.fillStyle=C.fillStyle||"#000000",this.isFillTransparent=C.isFillTransparent||!1,this.fillOpacity=C.fillOpacity||1,this.font=C.font||"10px sans-serif",this.textBaseline=C.textBaseline||"alphabetic",this.textAlign=C.textAlign||"left",this.lineWidth=C.lineWidth||1,this.lineJoin=C.lineJoin||"miter",this.lineCap=C.lineCap||"butt",this.path=C.path||[],this.transform=C.transform!==void 0?C.transform.clone():new c,this.globalCompositeOperation=C.globalCompositeOperation||"normal",this.globalAlpha=C.globalAlpha||1,this.clip_path=C.clip_path||[],this.currentPoint=C.currentPoint||new o,this.miterLimit=C.miterLimit||10,this.lastPoint=C.lastPoint||new o,this.lineDashOffset=C.lineDashOffset||0,this.lineDash=C.lineDash||[],this.margin=C.margin||[0,0,0,0],this.prevPageLastElemOffset=C.prevPageLastElemOffset||0,this.ignoreClearRect=typeof C.ignoreClearRect!="boolean"||C.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(C){Object.defineProperty(this,"canvas",{get:function(){return{parentNode:!1,style:!1}}});var A=C;Object.defineProperty(this,"pdf",{get:function(){return A}});var I=!1;Object.defineProperty(this,"pageWrapXEnabled",{get:function(){return I},set:function(Z){I=!!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 te=0;Object.defineProperty(this,"posY",{get:function(){return te},set:function(Z){isNaN(Z)||(te=Z)}}),Object.defineProperty(this,"margin",{get:function(){return u.margin},set:function(Z){var he;typeof Z=="number"?he=[Z,Z,Z,Z]:((he=new Array(4))[0]=Z[0],he[1]=Z.length>=2?Z[1]:he[0],he[2]=Z.length>=3?Z[2]:he[0],he[3]=Z.length>=4?Z[3]:he[1]),u.margin=he}});var re=!1;Object.defineProperty(this,"autoPaging",{get:function(){return re},set:function(Z){re=Z}});var J=0;Object.defineProperty(this,"lastBreak",{get:function(){return J},set:function(Z){J=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 be=[];Object.defineProperty(this,"ctxStack",{get:function(){return be},set:function(Z){be=Z}}),Object.defineProperty(this,"fillStyle",{get:function(){return this.ctx.fillStyle},set:function(Z){var he;he=m(Z),this.ctx.fillStyle=he.style,this.ctx.isFillTransparent=he.a===0,this.ctx.fillOpacity=he.a,this.pdf.setFillColor(he.r,he.g,he.b,{a:he.a}),this.pdf.setTextColor(he.r,he.g,he.b,{a:he.a})}}),Object.defineProperty(this,"strokeStyle",{get:function(){return this.ctx.strokeStyle},set:function(Z){var he=m(Z);this.ctx.strokeStyle=he.style,this.ctx.isStrokeTransparent=he.a===0,this.ctx.strokeOpacity=he.a,he.a===0?this.pdf.setDrawColor(255,255,255):(he.a,this.pdf.setDrawColor(he.r,he.g,he.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 Q=null,Ve=null,W=null;Object.defineProperty(this,"fontFaces",{get:function(){return W},set:function(Z){Q=null,Ve=null,W=Z}}),Object.defineProperty(this,"font",{get:function(){return this.ctx.font},set:function(Z){var he;if(this.ctx.font=Z,(he=/^\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 se=he[1];he[2];var oe=he[3],le=he[4];he[5];var Me=he[6],de=/^([.\d]+)((?:%|in|[cem]m|ex|p[ctx]))$/i.exec(le)[2];le=Math.floor(de==="px"?parseFloat(le)*this.pdf.internal.scaleFactor:de==="em"?parseFloat(le)*this.pdf.getFontSize():parseFloat(le)*this.pdf.internal.scaleFactor),this.pdf.setFontSize(le);var me=function(Ge){var ht,ut,Mt=[],Wt=Ge.trim();if(Wt==="")return HT;if(Wt in jU)return[jU[Wt]];for(;Wt!=="";){switch(ut=null,ht=(Wt=NU(Wt)).charAt(0)){case'"':case"'":ut=KFe(Wt.substring(1),ht);break;default:ut=XFe(Wt)}if(ut===null||(Mt.push(ut[0]),(Wt=NU(ut[1]))!==""&&Wt.charAt(0)!==","))return HT;Wt=Wt.replace(/^,/,"")}return Mt}(Me);if(this.fontFaces){var Le=function(Ge,ht){var ut=Ge.getFontList(),Mt=JSON.stringify(ut);if(Q===null||Ve!==Mt){var Wt=function(zt){var Lt=[];return Object.keys(zt).forEach(function(or){zt[or].forEach(function(Yt){var ot=null;switch(Yt){case"bold":ot={family:or,weight:"bold"};break;case"italic":ot={family:or,style:"italic"};break;case"bolditalic":ot={family:or,weight:"bold",style:"italic"};break;case"":case"normal":ot={family:or}}ot!==null&&(ot.ref={name:or,style:Yt},Lt.push(ot))})}),Lt}(ut);Q=function(zt){for(var Lt={},or=0;or<zt.length;++or){var Yt=VT(zt[or]),ot=Yt.family,fr=Yt.stretch,Et=Yt.style,Ct=Yt.weight;Lt[ot]=Lt[ot]||{},Lt[ot][fr]=Lt[ot][fr]||{},Lt[ot][fr][Et]=Lt[ot][fr][Et]||{},Lt[ot][fr][Et][Ct]=Yt}return Lt}(Wt.concat(ht)),Ve=Mt}return Q}(this.pdf,this.fontFaces),Ke=me.map(function(Ge){return{family:Ge,stretch:"normal",weight:oe,style:se}}),ve=function(Ge,ht,ut){for(var Mt=(ut=ut||{}).defaultFontFamily||"times",Wt=Object.assign({},GFe,ut.genericFontFamilies||{}),zt=null,Lt=null,or=0;or<ht.length;++or)if(Wt[(zt=VT(ht[or])).family]&&(zt.family=Wt[zt.family]),Ge.hasOwnProperty(zt.family)){Lt=Ge[zt.family];break}if(!(Lt=Lt||Ge[Mt]))throw new Error("Could not find a font-family for the rule '"+_U(zt)+"' and default family '"+Mt+"'.");if(Lt=function(Yt,ot){if(ot[Yt])return ot[Yt];var fr=A8[Yt],Et=fr<=A8.normal?-1:1,Ct=wU(ot,ule,fr,Et);if(!Ct)throw new Error("Could not find a matching font-stretch value for "+Yt);return Ct}(zt.stretch,Lt),Lt=function(Yt,ot){if(ot[Yt])return ot[Yt];for(var fr=cle[Yt],Et=0;Et<fr.length;++Et)if(ot[fr[Et]])return ot[fr[Et]];throw new Error("Could not find a matching font-style for "+Yt)}(zt.style,Lt),!(Lt=function(Yt,ot){if(ot[Yt])return ot[Yt];if(Yt===400&&ot[500])return ot[500];if(Yt===500&&ot[400])return ot[400];var fr=WFe[Yt],Et=wU(ot,dle,fr,Yt<400?-1:1);if(!Et)throw new Error("Could not find a matching font-weight for value "+Yt);return Et}(zt.weight,Lt)))throw new Error("Failed to resolve a font for the rule '"+_U(zt)+"'.");return Lt}(Le,Ke);this.pdf.setFont(ve.ref.name,ve.ref.style)}else{var _e="";(oe==="bold"||parseInt(oe,10)>=700||se==="bold")&&(_e="bold"),se==="italic"&&(_e+="italic"),_e.length===0&&(_e="normal");for(var Ue="",Qe={arial:"Helvetica",Arial:"Helvetica",verdana:"Helvetica",Verdana:"Helvetica",helvetica:"Helvetica",Helvetica:"Helvetica","sans-serif":"Helvetica",fixed:"Courier",monospace:"Courier",terminal:"Courier",cursive:"Times",fantasy:"Times",serif:"Times"},st=0;st<me.length;st++){if(this.pdf.internal.getFont(me[st],_e,{noFallback:!0,disableWarning:!0})!==void 0){Ue=me[st];break}if(_e==="bolditalic"&&this.pdf.internal.getFont(me[st],"bold",{noFallback:!0,disableWarning:!0})!==void 0)Ue=me[st],_e="bold";else if(this.pdf.internal.getFont(me[st],"normal",{noFallback:!0,disableWarning:!0})!==void 0){Ue=me[st],_e="normal";break}}if(Ue===""){for(var Fe=0;Fe<me.length;Fe++)if(Qe[me[Fe]]){Ue=Qe[me[Fe]];break}}Ue=Ue===""?"Times":Ue,this.pdf.setFont(Ue,_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(C){this.lineDash=C},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(C,A){if(isNaN(C)||isNaN(A))throw gs.error("jsPDF.context2d.moveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.moveTo");var I=this.ctx.transform.applyToPoint(new o(C,A));this.path.push({type:"mt",x:I.x,y:I.y}),this.ctx.lastPoint=new o(C,A)},f.prototype.closePath=function(){var C=new o(0,0),A=0;for(A=this.path.length-1;A!==-1;A--)if(this.path[A].type==="begin"&&os(this.path[A+1])==="object"&&typeof this.path[A+1].x=="number"){C=new o(this.path[A+1].x,this.path[A+1].y);break}this.path.push({type:"close"}),this.ctx.lastPoint=new o(C.x,C.y)},f.prototype.lineTo=function(C,A){if(isNaN(C)||isNaN(A))throw gs.error("jsPDF.context2d.lineTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.lineTo");var I=this.ctx.transform.applyToPoint(new o(C,A));this.path.push({type:"lt",x:I.x,y:I.y}),this.ctx.lastPoint=new o(I.x,I.y)},f.prototype.clip=function(){this.ctx.clip_path=JSON.parse(JSON.stringify(this.path)),N.call(this,null,!0)},f.prototype.quadraticCurveTo=function(C,A,I,U){if(isNaN(I)||isNaN(U)||isNaN(C)||isNaN(A))throw gs.error("jsPDF.context2d.quadraticCurveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.quadraticCurveTo");var Y=this.ctx.transform.applyToPoint(new o(I,U)),te=this.ctx.transform.applyToPoint(new o(C,A));this.path.push({type:"qct",x1:te.x,y1:te.y,x:Y.x,y:Y.y}),this.ctx.lastPoint=new o(Y.x,Y.y)},f.prototype.bezierCurveTo=function(C,A,I,U,Y,te){if(isNaN(Y)||isNaN(te)||isNaN(C)||isNaN(A)||isNaN(I)||isNaN(U))throw gs.error("jsPDF.context2d.bezierCurveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.bezierCurveTo");var re=this.ctx.transform.applyToPoint(new o(Y,te)),J=this.ctx.transform.applyToPoint(new o(C,A)),ie=this.ctx.transform.applyToPoint(new o(I,U));this.path.push({type:"bct",x1:J.x,y1:J.y,x2:ie.x,y2:ie.y,x:re.x,y:re.y}),this.ctx.lastPoint=new o(re.x,re.y)},f.prototype.arc=function(C,A,I,U,Y,te){if(isNaN(C)||isNaN(A)||isNaN(I)||isNaN(U)||isNaN(Y))throw gs.error("jsPDF.context2d.arc: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.arc");if(te=!!te,!this.ctx.transform.isIdentity){var re=this.ctx.transform.applyToPoint(new o(C,A));C=re.x,A=re.y;var J=this.ctx.transform.applyToPoint(new o(0,I)),ie=this.ctx.transform.applyToPoint(new o(0,0));I=Math.sqrt(Math.pow(J.x-ie.x,2)+Math.pow(J.y-ie.y,2))}Math.abs(Y-U)>=2*Math.PI&&(U=0,Y=2*Math.PI),this.path.push({type:"arc",x:C,y:A,radius:I,startAngle:U,endAngle:Y,counterclockwise:te})},f.prototype.arcTo=function(C,A,I,U,Y){throw new Error("arcTo not implemented.")},f.prototype.rect=function(C,A,I,U){if(isNaN(C)||isNaN(A)||isNaN(I)||isNaN(U))throw gs.error("jsPDF.context2d.rect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.rect");this.moveTo(C,A),this.lineTo(C+I,A),this.lineTo(C+I,A+U),this.lineTo(C,A+U),this.lineTo(C,A),this.lineTo(C+I,A),this.lineTo(C,A)},f.prototype.fillRect=function(C,A,I,U){if(isNaN(C)||isNaN(A)||isNaN(I)||isNaN(U))throw gs.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(C,A,I,U),this.fill(),Y.hasOwnProperty("lineCap")&&(this.lineCap=Y.lineCap),Y.hasOwnProperty("lineJoin")&&(this.lineJoin=Y.lineJoin)}},f.prototype.strokeRect=function(C,A,I,U){if(isNaN(C)||isNaN(A)||isNaN(I)||isNaN(U))throw gs.error("jsPDF.context2d.strokeRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.strokeRect");x.call(this)||(this.beginPath(),this.rect(C,A,I,U),this.stroke())},f.prototype.clearRect=function(C,A,I,U){if(isNaN(C)||isNaN(A)||isNaN(I)||isNaN(U))throw gs.error("jsPDF.context2d.clearRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.clearRect");this.ignoreClearRect||(this.fillStyle="#ffffff",this.fillRect(C,A,I,U))},f.prototype.save=function(C){C=typeof C!="boolean"||C;for(var A=this.pdf.internal.getCurrentPageInfo().pageNumber,I=0;I<this.pdf.internal.getNumberOfPages();I++)this.pdf.setPage(I+1),this.pdf.internal.out("q");if(this.pdf.setPage(A),C){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(C){C=typeof C!="boolean"||C;for(var A=this.pdf.internal.getCurrentPageInfo().pageNumber,I=0;I<this.pdf.internal.getNumberOfPages();I++)this.pdf.setPage(I+1),this.pdf.internal.out("Q");this.pdf.setPage(A),C&&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(C){var A,I,U,Y;if(C.isCanvasGradient===!0&&(C=C.getColor()),!C)return{r:0,g:0,b:0,a:0,style:C};if(/transparent|rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*0+\s*\)/.test(C))A=0,I=0,U=0,Y=0;else{var te=/rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/.exec(C);if(te!==null)A=parseInt(te[1]),I=parseInt(te[2]),U=parseInt(te[3]),Y=1;else if((te=/rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.]+)\s*\)/.exec(C))!==null)A=parseInt(te[1]),I=parseInt(te[2]),U=parseInt(te[3]),Y=parseFloat(te[4]);else{if(Y=1,typeof C=="string"&&C.charAt(0)!=="#"){var re=new rle(C);C=re.ok?re.toHex():"#000000"}C.length===4?(A=C.substring(1,2),A+=A,I=C.substring(2,3),I+=I,U=C.substring(3,4),U+=U):(A=C.substring(1,3),I=C.substring(3,5),U=C.substring(5,7)),A=parseInt(A,16),I=parseInt(I,16),U=parseInt(U,16)}}return{r:A,g:I,b:U,a:Y,style:C}},h=function(){return this.ctx.isFillTransparent||this.globalAlpha==0},x=function(){return!!(this.ctx.isStrokeTransparent||this.globalAlpha==0)};f.prototype.fillText=function(C,A,I,U){if(isNaN(A)||isNaN(I)||typeof C!="string")throw gs.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=z(this.ctx.transform.rotation),te=this.ctx.transform.scaleX;E.call(this,{text:C,x:A,y:I,scale:te,angle:Y,align:this.textAlign,maxWidth:U})}},f.prototype.strokeText=function(C,A,I,U){if(isNaN(A)||isNaN(I)||typeof C!="string")throw gs.error("jsPDF.context2d.strokeText: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.strokeText");if(!x.call(this)){U=isNaN(U)?void 0:U;var Y=z(this.ctx.transform.rotation),te=this.ctx.transform.scaleX;E.call(this,{text:C,x:A,y:I,scale:te,renderingMode:"stroke",angle:Y,align:this.textAlign,maxWidth:U})}},f.prototype.measureText=function(C){if(typeof C!="string")throw gs.error("jsPDF.context2d.measureText: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.measureText");var A=this.pdf,I=this.pdf.internal.scaleFactor,U=A.internal.getFontSize(),Y=A.getStringUnitWidth(C)*U/A.internal.scaleFactor;return new function(te){var re=(te=te||{}).width||0;return Object.defineProperty(this,"width",{get:function(){return re}}),this}({width:Y*=Math.round(96*I/72*1e4)/1e4})},f.prototype.scale=function(C,A){if(isNaN(C)||isNaN(A))throw gs.error("jsPDF.context2d.scale: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.scale");var I=new c(C,0,0,A,0,0);this.ctx.transform=this.ctx.transform.multiply(I)},f.prototype.rotate=function(C){if(isNaN(C))throw gs.error("jsPDF.context2d.rotate: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.rotate");var A=new c(Math.cos(C),Math.sin(C),-Math.sin(C),Math.cos(C),0,0);this.ctx.transform=this.ctx.transform.multiply(A)},f.prototype.translate=function(C,A){if(isNaN(C)||isNaN(A))throw gs.error("jsPDF.context2d.translate: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.translate");var I=new c(1,0,0,1,C,A);this.ctx.transform=this.ctx.transform.multiply(I)},f.prototype.transform=function(C,A,I,U,Y,te){if(isNaN(C)||isNaN(A)||isNaN(I)||isNaN(U)||isNaN(Y)||isNaN(te))throw gs.error("jsPDF.context2d.transform: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.transform");var re=new c(C,A,I,U,Y,te);this.ctx.transform=this.ctx.transform.multiply(re)},f.prototype.setTransform=function(C,A,I,U,Y,te){C=isNaN(C)?1:C,A=isNaN(A)?0:A,I=isNaN(I)?0:I,U=isNaN(U)?1:U,Y=isNaN(Y)?0:Y,te=isNaN(te)?0:te,this.ctx.transform=new c(C,A,I,U,Y,te)};var p=function(){return this.margin[0]>0||this.margin[1]>0||this.margin[2]>0||this.margin[3]>0};f.prototype.drawImage=function(C,A,I,U,Y,te,re,J,ie){var be=this.pdf.getImageProperties(C),Q=1,Ve=1,W=1,Z=1;U!==void 0&&J!==void 0&&(W=J/U,Z=ie/Y,Q=be.width/U*J/U,Ve=be.height/Y*ie/Y),te===void 0&&(te=A,re=I,A=0,I=0),U!==void 0&&J===void 0&&(J=U,ie=Y),U===void 0&&J===void 0&&(J=be.width,ie=be.height);var he=this.ctx.transform.decompose(),se=z(he.rotate.shx),oe=new c,le=(oe=(oe=(oe=oe.multiply(he.translate)).multiply(he.skew)).multiply(he.scale)).applyToRectangle(new l(te-A*W,re-I*Z,U*Q,Y*Ve));if(this.autoPaging){for(var Me,de=g.call(this,le),me=[],Le=0;Le<de.length;Le+=1)me.indexOf(de[Le])===-1&&me.push(de[Le]);b(me);for(var Ke=me[0],ve=me[me.length-1],_e=Ke;_e<ve+1;_e++){this.pdf.setPage(_e);var Ue=this.pdf.internal.pageSize.width-this.margin[3]-this.margin[1],Qe=_e===1?this.posY+this.margin[0]:this.margin[0],st=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],Fe=this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2],Ge=_e===1?0:st+(_e-2)*Fe;if(this.ctx.clip_path.length!==0){var ht=this.path;Me=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=y(Me,this.posX+this.margin[3],-Ge+Qe+this.ctx.prevPageLastElemOffset),j.call(this,"fill",!0),this.path=ht}var ut=JSON.parse(JSON.stringify(le));ut=y([ut],this.posX+this.margin[3],-Ge+Qe+this.ctx.prevPageLastElemOffset)[0];var Mt=(_e>Ke||_e<ve)&&p.call(this);Mt&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],Ue,Fe,null).clip().discardPath()),this.pdf.addImage(C,"JPEG",ut.x,ut.y,ut.w,ut.h,null,null,se),Mt&&this.pdf.restoreGraphicsState()}}else this.pdf.addImage(C,"JPEG",le.x,le.y,le.w,le.h,null,null,se)};var g=function(C,A,I){var U=[];A=A||this.pdf.internal.pageSize.width,I=I||this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2];var Y=this.posY+this.ctx.prevPageLastElemOffset;switch(C.type){default:case"mt":case"lt":U.push(Math.floor((C.y+Y)/I)+1);break;case"arc":U.push(Math.floor((C.y+Y-C.radius)/I)+1),U.push(Math.floor((C.y+Y+C.radius)/I)+1);break;case"qct":var te=M(this.ctx.lastPoint.x,this.ctx.lastPoint.y,C.x1,C.y1,C.x,C.y);U.push(Math.floor((te.y+Y)/I)+1),U.push(Math.floor((te.y+te.h+Y)/I)+1);break;case"bct":var re=B(this.ctx.lastPoint.x,this.ctx.lastPoint.y,C.x1,C.y1,C.x2,C.y2,C.x,C.y);U.push(Math.floor((re.y+Y)/I)+1),U.push(Math.floor((re.y+re.h+Y)/I)+1);break;case"rect":U.push(Math.floor((C.y+Y)/I)+1),U.push(Math.floor((C.y+C.h+Y)/I)+1)}for(var J=0;J<U.length;J+=1)for(;this.pdf.internal.getNumberOfPages()<U[J];)v.call(this);return U},v=function(){var C=this.fillStyle,A=this.strokeStyle,I=this.font,U=this.lineCap,Y=this.lineWidth,te=this.lineJoin;this.pdf.addPage(),this.fillStyle=C,this.strokeStyle=A,this.font=I,this.lineCap=U,this.lineWidth=Y,this.lineJoin=te},y=function(C,A,I){for(var U=0;U<C.length;U++)switch(C[U].type){case"bct":C[U].x2+=A,C[U].y2+=I;case"qct":C[U].x1+=A,C[U].y1+=I;default:C[U].x+=A,C[U].y+=I}return C},b=function(C){return C.sort(function(A,I){return A-I})},N=function(C,A){var I=this.fillStyle,U=this.strokeStyle,Y=this.lineCap,te=this.lineWidth,re=Math.abs(te*this.ctx.transform.scaleX),J=this.lineJoin;if(this.autoPaging){for(var ie,be,Q=JSON.parse(JSON.stringify(this.path)),Ve=JSON.parse(JSON.stringify(this.path)),W=[],Z=0;Z<Ve.length;Z++)if(Ve[Z].x!==void 0)for(var he=g.call(this,Ve[Z]),se=0;se<he.length;se+=1)W.indexOf(he[se])===-1&&W.push(he[se]);for(var oe=0;oe<W.length;oe++)for(;this.pdf.internal.getNumberOfPages()<W[oe];)v.call(this);b(W);for(var le=W[0],Me=W[W.length-1],de=le;de<Me+1;de++){this.pdf.setPage(de),this.fillStyle=I,this.strokeStyle=U,this.lineCap=Y,this.lineWidth=re,this.lineJoin=J;var me=this.pdf.internal.pageSize.width-this.margin[3]-this.margin[1],Le=de===1?this.posY+this.margin[0]:this.margin[0],Ke=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],ve=this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2],_e=de===1?0:Ke+(de-2)*ve;if(this.ctx.clip_path.length!==0){var Ue=this.path;ie=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=y(ie,this.posX+this.margin[3],-_e+Le+this.ctx.prevPageLastElemOffset),j.call(this,C,!0),this.path=Ue}if(be=JSON.parse(JSON.stringify(Q)),this.path=y(be,this.posX+this.margin[3],-_e+Le+this.ctx.prevPageLastElemOffset),A===!1||de===0){var Qe=(de>le||de<Me)&&p.call(this);Qe&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],me,ve,null).clip().discardPath()),j.call(this,C,A),Qe&&this.pdf.restoreGraphicsState()}this.lineWidth=te}this.path=Q}else this.lineWidth=re,j.call(this,C,A),this.lineWidth=te},j=function(C,A){if((C!=="stroke"||A||!x.call(this))&&(C==="stroke"||A||!h.call(this))){for(var I,U,Y=[],te=this.path,re=0;re<te.length;re++){var J=te[re];switch(J.type){case"begin":Y.push({begin:!0});break;case"close":Y.push({close:!0});break;case"mt":Y.push({start:J,deltas:[],abs:[]});break;case"lt":var ie=Y.length;if(te[re-1]&&!isNaN(te[re-1].x)&&(I=[J.x-te[re-1].x,J.y-te[re-1].y],ie>0)){for(;ie>=0;ie--)if(Y[ie-1].close!==!0&&Y[ie-1].begin!==!0){Y[ie-1].deltas.push(I),Y[ie-1].abs.push(J);break}}break;case"bct":I=[J.x1-te[re-1].x,J.y1-te[re-1].y,J.x2-te[re-1].x,J.y2-te[re-1].y,J.x-te[re-1].x,J.y-te[re-1].y],Y[Y.length-1].deltas.push(I);break;case"qct":var be=te[re-1].x+2/3*(J.x1-te[re-1].x),Q=te[re-1].y+2/3*(J.y1-te[re-1].y),Ve=J.x+2/3*(J.x1-J.x),W=J.y+2/3*(J.y1-J.y),Z=J.x,he=J.y;I=[be-te[re-1].x,Q-te[re-1].y,Ve-te[re-1].x,W-te[re-1].y,Z-te[re-1].x,he-te[re-1].y],Y[Y.length-1].deltas.push(I);break;case"arc":Y.push({deltas:[],abs:[],arc:!0}),Array.isArray(Y[Y.length-1].abs)&&Y[Y.length-1].abs.push(J)}}U=A?null:C==="stroke"?"stroke":"fill";for(var se=!1,oe=0;oe<Y.length;oe++)if(Y[oe].arc)for(var le=Y[oe].abs,Me=0;Me<le.length;Me++){var de=le[Me];de.type==="arc"?P.call(this,de.x,de.y,de.radius,de.startAngle,de.endAngle,de.counterclockwise,void 0,A,!se):q.call(this,de.x,de.y),se=!0}else if(Y[oe].close===!0)this.pdf.internal.out("h"),se=!1;else if(Y[oe].begin!==!0){var me=Y[oe].start.x,Le=Y[oe].start.y;O.call(this,Y[oe].deltas,me,Le),se=!0}U&&T.call(this,U),A&&R.call(this)}},_=function(C){var A=this.pdf.internal.getFontSize()/this.pdf.internal.scaleFactor,I=A*(this.pdf.internal.getLineHeightFactor()-1);switch(this.ctx.textBaseline){case"bottom":return C-I;case"top":return C+A-I;case"hanging":return C+A-2*I;case"middle":return C+A/2-I;default:return C}},S=function(C){return C+this.pdf.internal.getFontSize()/this.pdf.internal.scaleFactor*(this.pdf.internal.getLineHeightFactor()-1)};f.prototype.createLinearGradient=function(){var C=function(){};return C.colorStops=[],C.addColorStop=function(A,I){this.colorStops.push([A,I])},C.getColor=function(){return this.colorStops.length===0?"#000000":this.colorStops[0][1]},C.isCanvasGradient=!0,C},f.prototype.createPattern=function(){return this.createLinearGradient()},f.prototype.createRadialGradient=function(){return this.createLinearGradient()};var P=function(C,A,I,U,Y,te,re,J,ie){for(var be=H.call(this,I,U,Y,te),Q=0;Q<be.length;Q++){var Ve=be[Q];Q===0&&(ie?k.call(this,Ve.x1+C,Ve.y1+A):q.call(this,Ve.x1+C,Ve.y1+A)),L.call(this,C,A,Ve.x2,Ve.y2,Ve.x3,Ve.y3,Ve.x4,Ve.y4)}J?R.call(this):T.call(this,re)},T=function(C){switch(C){case"stroke":this.pdf.internal.out("S");break;case"fill":this.pdf.internal.out("f")}},R=function(){this.pdf.clip(),this.pdf.discardPath()},k=function(C,A){this.pdf.internal.out(r(C)+" "+n(A)+" m")},E=function(C){var A;switch(C.align){case"right":case"end":A="right";break;case"center":A="center";break;default:A="left"}var I,U,Y,te=this.pdf.getTextDimensions(C.text),re=_.call(this,C.y),J=S.call(this,re)-te.h,ie=this.ctx.transform.applyToPoint(new o(C.x,re));if(this.autoPaging){var be=this.ctx.transform.decompose(),Q=new c;Q=(Q=(Q=Q.multiply(be.translate)).multiply(be.skew)).multiply(be.scale);for(var Ve=this.ctx.transform.applyToRectangle(new l(C.x,re,te.w,te.h)),W=Q.applyToRectangle(new l(C.x,J,te.w,te.h)),Z=g.call(this,W),he=[],se=0;se<Z.length;se+=1)he.indexOf(Z[se])===-1&&he.push(Z[se]);b(he);for(var oe=he[0],le=he[he.length-1],Me=oe;Me<le+1;Me++){this.pdf.setPage(Me);var de=Me===1?this.posY+this.margin[0]:this.margin[0],me=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],Le=this.pdf.internal.pageSize.height-this.margin[2],Ke=Le-this.margin[0],ve=this.pdf.internal.pageSize.width-this.margin[1],_e=ve-this.margin[3],Ue=Me===1?0:me+(Me-2)*Ke;if(this.ctx.clip_path.length!==0){var Qe=this.path;I=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=y(I,this.posX+this.margin[3],-1*Ue+de),j.call(this,"fill",!0),this.path=Qe}var st=y([JSON.parse(JSON.stringify(W))],this.posX+this.margin[3],-Ue+de+this.ctx.prevPageLastElemOffset)[0];C.scale>=.01&&(U=this.pdf.internal.getFontSize(),this.pdf.setFontSize(U*C.scale),Y=this.lineWidth,this.lineWidth=Y*C.scale);var Fe=this.autoPaging!=="text";if(Fe||st.y+st.h<=Le){if(Fe||st.y>=de&&st.x<=ve){var Ge=Fe?C.text:this.pdf.splitTextToSize(C.text,C.maxWidth||ve-st.x)[0],ht=y([JSON.parse(JSON.stringify(Ve))],this.posX+this.margin[3],-Ue+de+this.ctx.prevPageLastElemOffset)[0],ut=Fe&&(Me>oe||Me<le)&&p.call(this);ut&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],_e,Ke,null).clip().discardPath()),this.pdf.text(Ge,ht.x,ht.y,{angle:C.angle,align:A,renderingMode:C.renderingMode}),ut&&this.pdf.restoreGraphicsState()}}else st.y<Le&&(this.ctx.prevPageLastElemOffset+=Le-st.y);C.scale>=.01&&(this.pdf.setFontSize(U),this.lineWidth=Y)}}else C.scale>=.01&&(U=this.pdf.internal.getFontSize(),this.pdf.setFontSize(U*C.scale),Y=this.lineWidth,this.lineWidth=Y*C.scale),this.pdf.text(C.text,ie.x+this.posX,ie.y+this.posY,{angle:C.angle,align:A,renderingMode:C.renderingMode,maxWidth:C.maxWidth}),C.scale>=.01&&(this.pdf.setFontSize(U),this.lineWidth=Y)},q=function(C,A,I,U){I=I||0,U=U||0,this.pdf.internal.out(r(C+I)+" "+n(A+U)+" l")},O=function(C,A,I){return this.pdf.lines(C,A,I,null,null)},L=function(C,A,I,U,Y,te,re,J){this.pdf.internal.out([t(a(I+C)),t(i(U+A)),t(a(Y+C)),t(i(te+A)),t(a(re+C)),t(i(J+A)),"c"].join(" "))},H=function(C,A,I,U){for(var Y=2*Math.PI,te=Math.PI/2;A>I;)A-=Y;var re=Math.abs(I-A);re<Y&&U&&(re=Y-re);for(var J=[],ie=U?-1:1,be=A;re>1e-5;){var Q=be+ie*Math.min(re,te);J.push(V.call(this,C,be,Q)),re-=Math.abs(Q-be),be=Q}return J},V=function(C,A,I){var U=(I-A)/2,Y=C*Math.cos(U),te=C*Math.sin(U),re=Y,J=-te,ie=re*re+J*J,be=ie+re*Y+J*te,Q=4/3*(Math.sqrt(2*ie*be)-be)/(re*te-J*Y),Ve=re-Q*J,W=J+Q*re,Z=Ve,he=-W,se=U+A,oe=Math.cos(se),le=Math.sin(se);return{x1:C*Math.cos(A),y1:C*Math.sin(A),x2:Ve*oe-W*le,y2:Ve*le+W*oe,x3:Z*oe-he*le,y3:Z*le+he*oe,x4:C*Math.cos(I),y4:C*Math.sin(I)}},z=function(C){return 180*C/Math.PI},M=function(C,A,I,U,Y,te){var re=C+.5*(I-C),J=A+.5*(U-A),ie=Y+.5*(I-Y),be=te+.5*(U-te),Q=Math.min(C,Y,re,ie),Ve=Math.max(C,Y,re,ie),W=Math.min(A,te,J,be),Z=Math.max(A,te,J,be);return new l(Q,W,Ve-Q,Z-W)},B=function(C,A,I,U,Y,te,re,J){var ie,be,Q,Ve,W,Z,he,se,oe,le,Me,de,me,Le,Ke=I-C,ve=U-A,_e=Y-I,Ue=te-U,Qe=re-Y,st=J-te;for(be=0;be<41;be++)oe=(he=(Q=C+(ie=be/40)*Ke)+ie*((W=I+ie*_e)-Q))+ie*(W+ie*(Y+ie*Qe-W)-he),le=(se=(Ve=A+ie*ve)+ie*((Z=U+ie*Ue)-Ve))+ie*(Z+ie*(te+ie*st-Z)-se),be==0?(Me=oe,de=le,me=oe,Le=le):(Me=Math.min(Me,oe),de=Math.min(de,le),me=Math.max(me,oe),Le=Math.max(Le,le));return new l(Math.round(Me),Math.round(de),Math.round(me-Me),Math.round(Le-de))},K=function(){if(this.prevLineDash||this.ctx.lineDash.length||this.ctx.lineDashOffset){var C,A,I=(C=this.ctx.lineDash,A=this.ctx.lineDashOffset,JSON.stringify({lineDash:C,lineDashOffset:A}));this.prevLineDash!==I&&(this.pdf.setLineDash(this.ctx.lineDash,this.ctx.lineDashOffset),this.prevLineDash=I)}}})(lr.API),function(e){var t=function(o){var l,c,u,d,f,m,h,x,p,g;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-(g=f%85))/85)-(p=f%85))/85)-(x=f%85))/85)-(h=f%85))/85)%85,c.push(m+33,h+33,x+33,p+33,g+33)):c.push(122);return function(v,y){for(var b=y;b>0;b--)v.pop()}(c,l.length),String.fromCharCode.apply(String,c)+"~>"},r=function(o){var l,c,u,d,f,m=String,h="length",x=255,p="charCodeAt",g="slice",v="replace";for(o[g](-2),o=o[g](0,-2)[v](/\s/g,"")[v]("z","!!!!!"),u=[],d=0,f=(o+=l="uuuuu"[g](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(x&c>>24,x&c>>16,x&c>>8,x&c);return function(y,b){for(var N=b;N>0;N--)y.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=j8(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(" ")}}}(lr.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(x){var p=x.length,g=[],v=String.fromCharCode;for(m=0;m<p;m+=1)g.push(v(255&x.charCodeAt(m)));return g.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}(lr.API),function(e){function t(){return(zr.html2canvas?Promise.resolve(zr.html2canvas):Zd(()=>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(zr.DOMPurify?Promise.resolve(zr.DOMPurify):Zd(()=>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=os(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 x=d[h],p=x.src.find(function(g){return g.format==="truetype"});p&&u.addFont(p.url,x.ref.name,x.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||lr.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,lr.getPageSize=function(l,c,u){if(os(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 x,p=0,g=0;if(h.hasOwnProperty(m))p=h[m][1]/f,g=h[m][0]/f;else try{p=u[1],g=u[0]}catch{throw new Error("Invalid format: "+u)}if(l==="p"||l==="portrait")l="p",g>p&&(x=g,g=p,p=x);else{if(l!=="l"&&l!=="landscape")throw"Invalid orientation: "+l;l="l",p>g&&(x=g,g=p,p=x)}return{width:g,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(VT):null;var u=new o(c);return c.worker?u:u.from(l).doCallback()}}(lr.API),lr.API.addJS=function(e){return kU=e,this.internal.events.subscribe("postPutResources",function(){mS=this.internal.newObject(),this.internal.out("<<"),this.internal.out("/Names [(EmbeddedJS) "+(mS+1)+" 0 R]"),this.internal.out(">>"),this.internal.out("endobj"),SU=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(){mS!==void 0&&SU!==void 0&&this.internal.out("/Names <</JavaScript "+mS+" 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}}])}(lr.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),x=f.length,p={width:0,height:0,numcomponents:1},g=4;g<x;g+=2){if(g+=h,t.indexOf(f.charCodeAt(g+1))!==-1){m=256*f.charCodeAt(g+5)+f.charCodeAt(g+6),p={width:256*f.charCodeAt(g+7)+f.charCodeAt(g+8),height:m,numcomponents:f.charCodeAt(g+9)};break}h=256*f.charCodeAt(g+2)+f.charCodeAt(g+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}}(lr.API),lr.API.processPNG=function(e,t,r,n){if(this.__addimage__.isArrayBuffer(e)&&(e=new Uint8Array(e)),this.__addimage__.isArrayBufferView(e)){var a,i=PFe(e,{checkCrc:!0}),o=i.width,l=i.height,c=i.channels,u=i.palette,d=i.depth;a=u&&c===1?function(P){for(var T=P.width,R=P.height,k=P.data,E=P.palette,q=P.depth,O=!1,L=[],H=[],V=void 0,z=!1,M=0,B=0;B<E.length;B++){var K=Tq(E[B],4),C=K[0],A=K[1],I=K[2],U=K[3];L.push(C,A,I),U!=null&&(U===0?(M++,H.length<1&&H.push(B)):U<255&&(z=!0))}if(z||M>1){O=!0,H=void 0;var Y=T*R;V=new Uint8Array(Y);for(var te=new DataView(k.buffer),re=0;re<Y;re++){var J=WT(te,re,q),ie=Tq(E[J],4)[3];V[re]=ie}}else M===0&&(H=void 0);return{colorSpace:"Indexed",colorsPerPixel:1,sMaskBitsPerComponent:O?8:void 0,colorBytes:k,alphaBytes:V,needSMask:O,palette:L,mask:H}}(i):c===2||c===4?function(P){for(var T=P.data,R=P.width,k=P.height,E=P.channels,q=P.depth,O=E===2?"DeviceGray":"DeviceRGB",L=E-1,H=R*k,V=L,z=H*V,M=1*H,B=Math.ceil(z*q/8),K=Math.ceil(M*q/8),C=new Uint8Array(B),A=new Uint8Array(K),I=new DataView(T.buffer),U=new DataView(C.buffer),Y=new DataView(A.buffer),te=!1,re=0;re<H;re++){for(var J=re*E,ie=0;ie<V;ie++)RU(U,WT(I,J+ie,q),re*V+ie,q);var be=WT(I,J+V,q);be<(1<<q)-1&&(te=!0),RU(Y,be,1*re,q)}return{colorSpace:O,colorsPerPixel:L,sMaskBitsPerComponent:te?q:void 0,colorBytes:C,alphaBytes:A,needSMask:te}}(i):function(P){var T=P.data,R=P.channels===1?"DeviceGray":"DeviceRGB";return{colorSpace:R,colorsPerPixel:R==="DeviceGray"?1:3,colorBytes:T instanceof Uint16Array?function(k){for(var E=k.length,q=new Uint8Array(2*E),O=new DataView(q.buffer,q.byteOffset,q.byteLength),L=0;L<E;L++)O.setUint16(2*L,k[L],!1);return q}(T):T,needSMask:!1}}(i);var f,m,h,x=a,p=x.colorSpace,g=x.colorsPerPixel,v=x.sMaskBitsPerComponent,y=x.colorBytes,b=x.alphaBytes,N=x.needSMask,j=x.palette,_=x.mask,S=null;return n!==lr.API.image_compression.NONE&&typeof j8=="function"?(S=function(P){var T;switch(P){case lr.API.image_compression.FAST:T=11;break;case lr.API.image_compression.MEDIUM:T=13;break;case lr.API.image_compression.SLOW:T=14;break;default:T=12}return T}(n),f=this.decode.FLATE_DECODE,m="/Predictor ".concat(S," /Colors ").concat(g," /BitsPerComponent ").concat(d," /Columns ").concat(o),e=TU(y,Math.ceil(o*g*d/8),g,d,n),N&&(h=TU(b,Math.ceil(o*v/8),1,v,n))):(f=void 0,m=void 0,e=y,N&&(h=b)),(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:_,palette:j,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 QFe(t),o=i.width,l=i.height,c=[];i.decodeAndBlitFrameRGBA(0,c);var u={data:c,width:o,height:l},d=new GT(100).encode(u,100);return e.processJPEG.call(this,d,r,n,a)},e.processGIF87A=e.processGIF89A}(lr.API),_u.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)},_u.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){gs.log("bit decode error:"+r)}},_u.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)}},_u.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)}},_u.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)}},_u.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}},_u.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}},_u.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}},_u.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}},_u.prototype.getData=function(){return this.data},function(e){e.processBMP=function(t,r,n,a){var i=new _u(t,!1),o=i.width,l=i.height,c={data:i.getData(),width:o,height:l},u=new GT(100).encode(c,100);return e.processJPEG.call(this,u,r,n,a)}}(lr.API),FU.prototype.getData=function(){return this.data},function(e){e.processWEBP=function(t,r,n,a){var i=new FU(t),o=i.width,l=i.height,c={data:i.getData(),width:o,height:l},u=new GT(100).encode(c,100);return e.processJPEG.call(this,u,r,n,a)}}(lr.API),lr.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 x=this.__addimage__.arrayBufferToBinaryString(i);return{alpha:this.__addimage__.arrayBufferToBinaryString(o),data:x,index:t,alias:r,colorSpace:"DeviceRGB",bitsPerComponent:8,width:e.width,height:e.height}},lr.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},Og=lr.API,pS=Og.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,x=0,p=l[0]||c,g=[];for(r=0;r<h;r++)n=e.charCodeAt(r),typeof a.metadata.widthOfString=="function"?g.push((a.metadata.widthOfGlyph(a.metadata.characterToGlyph(n))+o*(1e3/i)||0)/1e3):(m=f&&os(u[n])==="object"&&!isNaN(parseInt(u[n][x],10))?u[n][x]/d:0,g.push((l[n]||p)/c+m)),x=n;return g},CU=Og.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 Og.processArabic&&(e=Og.processArabic(e)),typeof n.metadata.widthOfString=="function"?n.metadata.widthOfString(e,r,a)/r:pS.apply(this,arguments).reduce(function(i,o){return i+o},0)},EU=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},AU=function(e,t,r){r||(r={});var n,a,i,o,l,c,u,d=[],f=[d],m=r.textIndent||0,h=0,x=0,p=e.split(" "),g=pS.apply(this,[" ",r])[0];if(c=r.lineIndent===-1?p[0].length+2:r.lineIndent||0){var v=Array(c).join(" "),y=[];p.map(function(N){(N=N.split(/\s*\n/)).length>1?y=y.concat(N.map(function(j,_){return(_&&j.length?`
`:"")+j})):y.push(N[0])}),p=y,c=CU.apply(this,[v,r])}for(i=0,o=p.length;i<o;i++){var b=0;if(n=p[i],c&&n[0]==`
`&&(n=n.substr(1),b=1),m+h+(x=(a=pS.apply(this,[n,r])).reduce(function(N,j){return N+j},0))>t||b){if(x>t){for(l=EU.apply(this,[n,a,t-(m+h),t]),d.push(l.shift()),d=[l.pop()];l.length;)f.push([l.shift()]);x=a.slice(n.length-(d[0]?d[0].length:0)).reduce(function(N,j){return N+j},0)}else d=[n];f.push(d),m=x+c,h=g}else d.push(n),m+=h+x,h=g}return u=c?function(N,j){return(j?v:"")+N.join(" ")}:function(N){return N.join(" ")},f.map(u)},Og.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(AU.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,x,p,g,v=["{"];for(var y in m){if(h=m[y],isNaN(parseInt(y,10))?x="'"+y+"'":(y=parseInt(y,10),x=(x=o(y).slice(2)).slice(0,-1)+a[x.slice(-1)]),typeof h=="number")h<0?(p=o(h).slice(3),g="-"):(p=o(h).slice(2),g=""),p=g+p.slice(0,-1)+a[p.slice(-1)];else{if(os(h)!=="object")throw new Error("Don't know what to do with value type "+os(h)+".");p=l(h)}v.push(x+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,x,p,g,v={},y=1,b=v,N=[],j="",_="",S=m.length-1,P=1;P<S;P+=1)(g=m[P])=="'"?h?(p=h.join(""),h=void 0):h=[]:h?h.push(g):g=="{"?(N.push([b,p]),b={},p=void 0):g=="}"?((x=N.pop())[0][x[1]]=b,p=void 0,b=x[0]):g=="-"?y=-1:p===void 0?n.hasOwnProperty(g)?(j+=n[g],p=parseInt(j,16)*y,y=1,j=""):j+=g:n.hasOwnProperty(g)?(_+=n[g],b[p]=parseInt(_,16)*y,y=1,p=void 0,_=""):_+=g;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,x=f.Unicode[h.postScriptName];x&&(h.metadata.Unicode={},h.metadata.Unicode.widths=x.widths,h.metadata.Unicode.kerning=x.kerning);var p=d.Unicode[h.postScriptName];p&&(h.metadata.Unicode.encoding=p,h.encoding=p.codePages[0])}])}(lr.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(_5(l)),o.metadata=e.API.TTFFont.open(l),o.metadata.Unicode=o.metadata.Unicode||{encoding:{},kerning:{},widths:[]},o.metadata.glyIdsUsed=[0]})(a,n)}}])}(lr),lr.API.addSvgAsImage=function(e,t,r,n,a,i,o,l){if(isNaN(t)||isNaN(r))throw gs.error("jsPDF.addSvgAsImage: Invalid coordinates",arguments),new Error("Invalid coordinates passed to jsPDF.addSvgAsImage");if(isNaN(n)||isNaN(a))throw gs.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(zr.canvg?Promise.resolve(zr.canvg):Zd(()=>import("./index.es-D56GYSus.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)})},lr.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},lr.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(x,p){var g,v=!1;for(g=0;g<x.length;g+=1)x[g]===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(os(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 x,p=[];for(x in r)r[x].explicitSet===!0&&(r[x].type==="name"?p.push("/"+x+" /"+r[x].value):p.push("/"+x+" "+r[x].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}}(lr.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,x){return h-x})).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="",x=0;x<m.length;x++)h+=String.fromCharCode(m[x]);var p=u();d({data:h,addLength1:!0,objectId:p}),c("endobj");var g=u();d({data:n(l.metadata.toUnicode),addLength1:!0,objectId:g}),c("endobj");var v=u();c("<<"),c("/Type /FontDescriptor"),c("/FontName /"+Xg(l.fontName)),c("/FontFile2 "+p+" 0 R"),c("/FontBBox "+e.API.PDFObject.convert(l.metadata.bbox)),c("/Flags "+l.metadata.flags),c("/StemV "+l.metadata.stemV),c("/ItalicAngle "+l.metadata.italicAngle),c("/Ascent "+l.metadata.ascender),c("/Descent "+l.metadata.decender),c("/CapHeight "+l.metadata.capHeight),c(">>"),c("endobj");var y=u();c("<<"),c("/Type /Font"),c("/BaseFont /"+Xg(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 "+g+" 0 R"),c("/BaseFont /"+Xg(l.fontName)),c("/Encoding /"+l.encoding),c("/DescendantFonts ["+y+" 0 R]"),c(">>"),c("endobj"),l.isAlreadyPutted=!0}})(i)}]),t.events.push(["putFont",function(i){(function(o){var l=o.font,c=o.out,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 x=u();d({data:m,addLength1:!0,objectId:x}),c("endobj");var p=u();d({data:n(l.metadata.toUnicode),addLength1:!0,objectId:p}),c("endobj");var g=u();c("<<"),c("/Descent "+l.metadata.decender),c("/CapHeight "+l.metadata.capHeight),c("/StemV "+l.metadata.stemV),c("/Type /FontDescriptor"),c("/FontFile2 "+x+" 0 R"),c("/Flags 96"),c("/FontBBox "+e.API.PDFObject.convert(l.metadata.bbox)),c("/FontName /"+Xg(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/"+Xg(l.fontName)+"/FontDescriptor "+g+" 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,x=f.fonts,p=h,g="",v=0,y="",b=x[p].encoding;if(x[p].encoding!=="Identity-H")return{text:l,x:c,y:u,options:d,mutex:f};for(y=l,p=h,Array.isArray(l)&&(y=l[0]),v=0;v<y.length;v+=1)x[p].metadata.hasOwnProperty("cmap")&&(o=x[p].metadata.cmap.unicode.codeMap[y[v].charCodeAt(0)]),o||y[v].charCodeAt(0)<256&&x[p].metadata.hasOwnProperty("Unicode")?g+=y[v]:g+="";var N="";return parseInt(p.slice(1))<14||b==="WinAnsiEncoding"?N=m(g,p).split("").map(function(j){return j.charCodeAt(0).toString(16)}).join(""):b==="Identity-H"&&(N=r(g,x[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}])}(lr),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}}(lr.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]],x={L:0,R:1,EN:2,AN:3,N:4,B:5,S:6},p={0:0,5:1,6:2,7:3,32:4,251:5,254:6,255:7},g=["(",")","(","<",">","<","[","]","[","{","}","{","«","»","«","‹","›","‹","⁅","⁆","⁅","⁽","⁾","⁽","₍","₎","₍","≤","≥","≤","〈","〉","〈","﹙","﹚","﹙","﹛","﹜","﹛","﹝","﹞","﹝","﹤","﹥","﹤"],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)$/),y=!1,b=0;this.__bidiEngine__={};var N=function(k){var E=k.charCodeAt(),q=E>>8,O=p[q];return O!==void 0?f[256*O+(255&E)]:q===252||q===253?"AL":v.test(q)?"L":q===8?"R":"N"},j=function(k){for(var E,q=0;q<k.length;q++){if((E=N(k.charAt(q)))==="L")return!1;if(E==="R")return!0}return!1},_=function(k,E,q,O){var L,H,V,z,M=E[O];switch(M){case"L":case"R":case"LRE":case"RLE":case"LRO":case"RLO":case"PDF":y=!1;break;case"N":case"AN":break;case"EN":y&&(M="AN");break;case"AL":y=!0,M="R";break;case"WS":case"BN":M="N";break;case"CS":O<1||O+1>=E.length||(L=q[O-1])!=="EN"&&L!=="AN"||(H=E[O+1])!=="EN"&&H!=="AN"?M="N":y&&(H="AN"),M=H===L?H:"N";break;case"ES":M=(L=O>0?q[O-1]:"B")==="EN"&&O+1<E.length&&E[O+1]==="EN"?"EN":"N";break;case"ET":if(O>0&&q[O-1]==="EN"){M="EN";break}if(y){M="N";break}for(V=O+1,z=E.length;V<z&&E[V]==="ET";)V++;M=V<z&&E[V]==="EN"?"EN":"N";break;case"NSM":if(o&&!l){for(z=E.length,V=O+1;V<z&&E[V]==="NSM";)V++;if(V<z){var B=k[O],K=B>=1425&&B<=2303||B===64286;if(L=E[V],K&&(L==="R"||L==="AL")){M="R";break}}}M=O<1||(L=E[O-1])==="B"?"N":q[O-1];break;case"B":y=!1,a=!0,M=b;break;case"S":i=!0,M="N"}return M},S=function(k,E,q){var O=k.split("");return q&&P(O,q,{hiLevel:b}),O.reverse(),E&&E.reverse(),O.join("")},P=function(k,E,q){var O,L,H,V,z,M=-1,B=k.length,K=0,C=[],A=b?h:m,I=[];for(y=!1,a=!1,i=!1,L=0;L<B;L++)I[L]=N(k[L]);for(H=0;H<B;H++){if(z=K,C[H]=_(k,I,C,H),O=240&(K=A[z][x[C[H]]]),K&=15,E[H]=V=A[K][5],O>0)if(O===16){for(L=M;L<H;L++)E[L]=1;M=-1}else M=-1;if(A[K][6])M===-1&&(M=H);else if(M>-1){for(L=M;L<H;L++)E[L]=V;M=-1}I[H]==="B"&&(E[H]=0),q.hiLevel|=V}i&&function(U,Y,te){for(var re=0;re<te;re++)if(U[re]==="S"){Y[re]=b;for(var J=re-1;J>=0&&U[J]==="WS";J--)Y[J]=b}}(I,E,B)},T=function(k,E,q,O,L){if(!(L.hiLevel<k)){if(k===1&&b===1&&!a)return E.reverse(),void(q&&q.reverse());for(var H,V,z,M,B=E.length,K=0;K<B;){if(O[K]>=k){for(z=K+1;z<B&&O[z]>=k;)z++;for(M=K,V=z-1;M<V;M++,V--)H=E[M],E[M]=E[V],E[V]=H,q&&(H=q[M],q[M]=q[V],q[V]=H);K=z}K++}}},R=function(k,E,q){var O=k.split(""),L={hiLevel:b};return q||(q=[]),P(O,q,L),function(H,V,z){if(z.hiLevel!==0&&d)for(var M,B=0;B<H.length;B++)V[B]===1&&(M=g.indexOf(H[B]))>=0&&(H[B]=g[M+1])}(O,q,L),T(2,O,E,q,L),T(1,O,E,q,L),O.join("")};return this.__bidiEngine__.doBidiReorder=function(k,E,q){if(function(L,H){if(H)for(var V=0;V<L.length;V++)H[V]=V;l===void 0&&(l=j(L)),u===void 0&&(u=j(L))}(k,E),o||!c||u)if(o&&c&&l^u)b=l?1:0,k=S(k,E,q);else if(!o&&c&&u)b=l?1:0,k=R(k,E,q),k=S(k,E);else if(!o||l||c||u){if(o&&!c&&l^u)k=S(k,E),l?(b=0,k=R(k,E,q)):(b=1,k=R(k,E,q),k=S(k,E));else if(o&&l&&!c&&u)b=1,k=R(k,E,q),k=S(k,E);else if(!o&&!c&&l^u){var O=d;l?(b=1,k=R(k,E,q),b=0,d=!1,k=R(k,E,q),d=O):(b=0,k=R(k,E,q),k=S(k,E),b=1,d=!1,k=R(k,E,q),d=O,k=S(k,E))}}else b=0,k=R(k,E,q);else b=l?1:0,k=R(k,E,q);return k},this.__bidiEngine__.setOptions=function(k){k&&(o=k.isInputVisual,c=k.isOutputVisual,l=k.isInputRtl,u=k.isOutputRtl,d=k.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})}])}(lr),lr.API.TTFFont=function(){function e(t){var r;if(this.rawData=t,r=this.contents=new pp(t),this.contents.pos=4,r.readString(4)==="ttcf")throw new Error("TTCF not supported.");r.pos=0,this.parse(),this.subset=new mMe(this),this.registerTTF()}return e.open=function(t){return new e(t)},e.prototype.parse=function(){return this.directory=new eMe(this.contents),this.head=new rMe(this),this.name=new oMe(this),this.cmap=new hle(this),this.toUnicode={},this.hhea=new nMe(this),this.maxp=new lMe(this),this.hmtx=new cMe(this),this.post=new aMe(this),this.os2=new sMe(this),this.loca=new hMe(this),this.glyf=new uMe(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 md,pp=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}(),eMe=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,x,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 pp).writeInt(this.scalarType),a.writeShort(h),a.writeShort(f),a.writeShort(o),a.writeShort(d),i=16*h,u=a.pos+i,l=null,x=[],r)for(m=r[p],a.writeString(p),a.writeInt(e(m)),a.writeInt(u),a.writeInt(m.length),x=x.concat(m),p==="head"&&(l=u),u+=m.length;u%4;)x.push(0),u++;return a.write(x),n=2981146554-e(a.data),a.pos=l+8,a.writeUInt32(n),a.data},e=function(r){var n,a,i,o;for(r=mle.call(r);r.length%4;)r.push(0);for(i=new pp(r),a=0,n=0,o=r.length;n<o;n=n+=4)a+=i.readUInt32();return 4294967295&a},t}(),tMe={}.hasOwnProperty,df=function(e,t){for(var r in t)tMe.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};md=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 rMe=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return df(e,md),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 pp).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}(),MU=function(){function e(t,r){var n,a,i,o,l,c,u,d,f,m,h,x,p,g,v,y,b;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,j;for(j=[],c=N=0;0<=m?N<m:N>m;c=0<=m?++N:--N)j.push(t.readUInt16());return j}(),t.pos+=2,p=function(){var N,j;for(j=[],c=N=0;0<=m?N<m:N>m;c=0<=m?++N:--N)j.push(t.readUInt16());return j}(),u=function(){var N,j;for(j=[],c=N=0;0<=m?N<m:N>m;c=0<=m?++N:--N)j.push(t.readUInt16());return j}(),d=function(){var N,j;for(j=[],c=N=0;0<=m?N<m:N>m;c=0<=m?++N:--N)j.push(t.readUInt16());return j}(),a=(this.length-t.pos+this.offset)/2,l=function(){var N,j;for(j=[],c=N=0;0<=a?N<a:N>a;c=0<=a?++N:--N)j.push(t.readUInt16());return j}(),c=v=0,b=i.length;v<b;c=++v)for(g=i[c],n=y=x=p[c];x<=g?y<=g:y>=g;n=x<=g?++y:--y)d[c]===0?o=n+u[c]:(o=l[d[c]/2+(n-x)-(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,x,p,g,v,y,b,N,j,_,S,P,T,R,k,E,q,O,L,H,V,z,M,B,K,C,A,I,U,Y,te,re,J,ie,be,Q;switch(O=new pp,o=Object.keys(t).sort(function(Ve,W){return Ve-W}),r){case"macroman":for(p=0,g=function(){var Ve=[];for(x=0;x<256;++x)Ve.push(0);return Ve}(),y={0:0},i={},L=0,M=o.length;L<M;L++)y[J=t[a=o[L]]]==null&&(y[J]=++p),i[a]={old:t[a],new:y[t[a]]},g[a]=y[t[a]];return O.writeUInt16(1),O.writeUInt16(0),O.writeUInt32(12),O.writeUInt16(0),O.writeUInt16(262),O.writeUInt16(0),O.write(g),{charMap:i,subtable:O.data,maxGlyphID:p+1};case"unicode":for(E=[],f=[],b=0,y={},n={},v=u=null,H=0,B=o.length;H<B;H++)y[j=t[a=o[H]]]==null&&(y[j]=++b),n[a]={old:j,new:y[j]},l=y[j]-a,v!=null&&l===u||(v&&f.push(v),E.push(a),u=l),v=a;for(v&&f.push(v),f.push(65535),E.push(65535),R=2*(T=E.length),P=2*Math.pow(Math.log(T)/Math.LN2,2),m=Math.log(P/2)/Math.LN2,S=2*T-P,c=[],_=[],h=[],x=V=0,K=E.length;V<K;x=++V){if(k=E[x],d=f[x],k===65535){c.push(0),_.push(0);break}if(k-(q=n[k].new)>=32768)for(c.push(0),_.push(2*(h.length+T-x)),a=z=k;k<=d?z<=d:z>=d;a=k<=d?++z:--z)h.push(n[a].new);else c.push(q-k),_.push(0)}for(O.writeUInt16(3),O.writeUInt16(1),O.writeUInt32(12),O.writeUInt16(4),O.writeUInt16(16+8*T+2*h.length),O.writeUInt16(0),O.writeUInt16(R),O.writeUInt16(P),O.writeUInt16(m),O.writeUInt16(S),te=0,C=f.length;te<C;te++)a=f[te],O.writeUInt16(a);for(O.writeUInt16(0),re=0,A=E.length;re<A;re++)a=E[re],O.writeUInt16(a);for(ie=0,I=c.length;ie<I;ie++)l=c[ie],O.writeUInt16(l);for(be=0,U=_.length;be<U;be++)N=_[be],O.writeUInt16(N);for(Q=0,Y=h.length;Q<Y;Q++)p=h[Q],O.writeUInt16(p);return{charMap:n,subtable:O.data,maxGlyphID:b+1}}},e}(),hle=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return df(e,md),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 MU(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=MU.encode(t,r),(a=new pp).writeUInt16(0),a.writeUInt16(1),n.table=a.data.concat(n.subtable),n},e}(),nMe=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return df(e,md),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}(),sMe=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return df(e,md),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}(),aMe=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return df(e,md),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}(),iMe=function(e,t){this.raw=e,this.length=e.length,this.platformID=t.platformID,this.encodingID=t.encodingID,this.languageID=t.languageID},oMe=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return df(e,md),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 iMe(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}(),lMe=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return df(e,md),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}(),cMe=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return df(e,md),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}(),mle=[].slice,uMe=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return df(e,md),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 pp(r.read(a))).readShort(),u=l.readShort(),f=l.readShort(),c=l.readShort(),d=l.readShort(),this.cache[t]=o===-1?new fMe(l,u,f,c,d):new dMe(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}(),dMe=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}(),fMe=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 pp(mle.call(this.raw.data)),t=0,n=this.glyphIDs.length;t<n;++t)r.pos=this.glyphOffsets[t];return r.data},e}(),hMe=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return df(e,md),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}(),mMe=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,x,p,g,v;for(a in n=hle.encode(this.generateCmap(),"unicode"),o=this.glyphsFor(t),h={0:0},v=n.charMap)h[(c=v[a]).old]=c.new;for(x in m=n.maxGlyphID,o)x in h||(h[x]=m++);return d=function(y){var b,N;for(b in N={},y)N[y[b]]=b;return N}(h),f=Object.keys(d).sort(function(y,b){return y-b}),p=function(){var y,b,N;for(N=[],y=0,b=f.length;y<b;y++)l=f[y],N.push(d[l]);return N}(),i=this.font.glyf.encode(o,p,h),u=this.font.loca.encode(i.offsets,p),g={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&&(g["OS/2"]=this.font.os2.raw()),this.font.directory.encode(g)},e}();lr.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 F2=Object.freeze(Object.defineProperty({__proto__:null,AcroForm:HFe,AcroFormAppearance:ar,AcroFormButton:mi,AcroFormCheckBox:Aw,AcroFormChoiceField:Xx,AcroFormComboBox:Zx,AcroFormEditBox:Cw,AcroFormListBox:Yx,AcroFormPasswordField:Tw,AcroFormPushButton:Ew,AcroFormRadioButton:Jx,AcroFormTextField:Qm,GState:L2,ShadingPattern:xm,TilingPattern:Ax,default:lr,jsPDF:lr},Symbol.toStringTag,{value:"Module"}));function pMe(){const{isAdmin:e}=Br(),t=Zt(),[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),x=w.useRef(null),[p,g]=w.useState(!1),[v,y]=w.useState("all"),[b,N]=w.useState(!1),[j,_]=w.useState(!1);w.useEffect(()=>{if(!e){t("/");return}S()},[e,t]),w.useEffect(()=>{if(!d)return;const V=setTimeout(()=>{const z=x.current;if(!z)return;const M=z.getContext("2d");if(!M)return;z.width=500,z.height=150,M.fillStyle="#ffffff",M.fillRect(0,0,z.width,z.height),M.strokeStyle="#000000",M.lineWidth=2,M.lineCap="round",M.lineJoin="round";let B=!1;const K=U=>{const Y=z.getBoundingClientRect(),te=z.width/Y.width,re=z.height/Y.height,J=(U.clientX-Y.left)*te,ie=(U.clientY-Y.top)*re;return{x:J,y:ie}},C=U=>{U.preventDefault(),z.setPointerCapture(U.pointerId),B=!0;const{x:Y,y:te}=K(U);M.beginPath(),M.moveTo(Y,te),g(!0)},A=U=>{if(!B)return;U.preventDefault();const{x:Y,y:te}=K(U);M.lineTo(Y,te),M.stroke()},I=U=>{if(B){U.preventDefault(),B=!1;try{z.releasePointerCapture(U.pointerId)}catch{}M.closePath()}};z.style.touchAction="none",z.addEventListener("pointerdown",C),z.addEventListener("pointermove",A),z.addEventListener("pointerup",I),z.addEventListener("pointerleave",I),z._cleanupSignature=()=>{z.removeEventListener("pointerdown",C),z.removeEventListener("pointermove",A),z.removeEventListener("pointerup",I),z.removeEventListener("pointerleave",I)}},100);return()=>{clearTimeout(V);const z=x.current;z&&z._cleanupSignature&&z._cleanupSignature()}},[d]);const S=async()=>{l(!0);try{const{data:V,error:z}=await ce.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(z)throw z;const{data:M,error:B}=await ce.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(B)throw B;n(V||[]),i(M||[])}catch(V){console.error("Error loading contracts:",V),ae.error("Erreur lors du chargement des contrats")}finally{l(!1)}},P=()=>{const V=x.current;if(!V)return;const z=V.getContext("2d");z&&(z.fillStyle="#ffffff",z.fillRect(0,0,V.width,V.height),g(!1))},T=async()=>{const V=x.current;if(!(!V||!d))try{if(!p){ae.error("Veuillez signer avant de valider");return}h(!0);const z=V.toDataURL("image/png"),{error:M}=await ce.from("trainer_contracts").update({counter_signature_data:z,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(z){console.error("Error counter-signing:",z),ae.error("Erreur lors de la contre-signature")}finally{h(!1)}},R=async V=>{try{const z=new lr,M=z.internal.pageSize.getWidth(),B=z.internal.pageSize.getHeight(),K=15;let C=K;const A=V.contract_data.trainerName||"XXXXXX",I=V.contract_data,U=(Z=30)=>{C>B-Z&&(z.addPage(),C=K)},Y=(Z,he=0)=>{z.setFont("helvetica","normal"),z.setFontSize(9);const se=z.splitTextToSize(Z,M-2*K-he);U(se.length*4+5),z.text(se,K+he,C),C+=se.length*4+3},te=(Z,he=5)=>{Z.forEach((se,oe)=>{const le=`${oe+1}. ${se}`,Me=z.splitTextToSize(le,M-2*K-he);U(Me.length*4+2),z.text(Me,K+he,C),C+=Me.length*4+1}),C+=2},re=(Z,he=5)=>{Z.forEach(se=>{const oe=`• ${se}`,le=z.splitTextToSize(oe,M-2*K-he);U(le.length*4+2),z.text(le,K+he,C),C+=le.length*4+1}),C+=2};z.setFillColor(30,64,175),z.rect(0,0,M,35,"F"),z.setTextColor(255,255,255),z.setFontSize(18),z.setFont("helvetica","bold"),z.text("CONTRAT DE PRESTATION DE SERVICES",M/2,20,{align:"center"}),z.setFontSize(11),z.text("PedagoBridge - Qalam Software",M/2,28,{align:"center"}),C=50,z.setTextColor(0,0,0),z.setFontSize(9);const J=V.counter_signed?"CERTIFIÉ":V.status==="signed"?"EN ATTENTE CONTRE-SIGNATURE":"EN ATTENTE",ie=V.counter_signed?[34,197,94]:V.status==="signed"?[245,158,11]:[156,163,175];z.setFillColor(ie[0],ie[1],ie[2]),z.setTextColor(255,255,255),z.roundedRect(K,C,50,7,2,2,"F"),z.text(J,K+25,C+5,{align:"center"}),C+=15,z.setTextColor(0,0,0),Y("Entre les soussignés :"),C+=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"),C+=2,Y("Et"),C+=2;let be=`${A}, ${I.legalForm||"[forme juridique à préciser, ou Nom et Prénom pour un indépendant]"}, `;be+=I.capitalAmount?`au capital de ${I.capitalAmount} euros, `:"[au capital de ___ euros (si société)], ",be+=`dont le siège social est situé ${I.headquartersAddress||"[adresse complète, ou adresse personnelle pour un indépendant]"}, `,be+=`représentée par ${I.legalRepresentativeName||"[Nom et fonction, ou lui-même pour un indépendant]"}`,I.legalRepresentativeFunction&&(be+=`, en qualité de ${I.legalRepresentativeFunction}`),be+=`, ci‑après dénommée « ${A} »,`,Y(be),C+=2,Y("Ci‑après dénommées individuellement la « Partie » ou collectivement les « Parties »."),C+=5,U(40),z.setFont("helvetica","bold"),z.setFontSize(10),z.text("Article 1 – Objet",K,C),C+=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),z.setFont("helvetica","bold"),z.setFontSize(10),z.text("Article 2 – Missions de Qalam",K,C),C+=6,te(["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),z.setFont("helvetica","bold"),z.setFontSize(10),z.text(`Article 3 – Obligations de ${A}`,K,C),C+=6,Y(`${A} s'engage à :`),te(["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),z.setFont("helvetica","bold"),z.setFontSize(10),z.text("Article 4 – Rémunération et modalités de paiement",K,C),C+=6,z.setFont("helvetica","bold"),z.setFontSize(9),z.text("4.1 Répartition",K,C),C+=5,Y("Sauf accord écrit spécifique, la rémunération globale d'une mission est répartie ainsi :"),re([`70 % pour ${A} ;`,"30 % pour Qalam ;"]),Y("Toute dérogation doit faire l'objet d'un accord écrit signé des deux Parties."),C+=3,z.setFont("helvetica","bold"),z.setFontSize(9),z.text("4.2 Facturation de Qalam",K,C),C+=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.`),C+=3,z.setFont("helvetica","bold"),z.setFontSize(9),z.text("4.3 Paiement des formateurs",K,C),C+=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.`),C+=3,z.setFont("helvetica","bold"),z.setFontSize(9),z.text("4.4 Bon de commande",K,C),C+=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),z.setFont("helvetica","bold"),z.setFontSize(10),z.text("Article 5 – Durée et résiliation",K,C),C+=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),z.setFont("helvetica","bold"),z.setFontSize(10),z.text("Article 6 – Confidentialité",K,C),C+=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),z.setFont("helvetica","bold"),z.setFontSize(10),z.text("Article 7 – Clause de non-contournement",K,C),C+=6,z.setFont("helvetica","bold"),z.setFontSize(9),z.text(`7.1 Interdiction de contournement par ${A}`,K,C),C+=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."),C+=3,z.setFont("helvetica","bold"),z.setFontSize(9),z.text("7.2 Obligations concernant les formateurs",K,C),C+=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.`),C+=3,z.setFont("helvetica","bold"),z.setFontSize(9),z.text("7.3 Sanction",K,C),C+=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),z.setFont("helvetica","bold"),z.setFontSize(10),z.text("Article 8 – Indépendance des Parties",K,C),C+=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),z.setFont("helvetica","bold"),z.setFontSize(10),z.text("Article 9 – Déclarations sur l'honneur et conformité légale",K,C),C+=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),z.setFont("helvetica","bold"),z.setFontSize(10),z.text("Article 10 – Protection des données personnelles",K,C),C+=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),z.setFont("helvetica","bold"),z.setFontSize(10),z.text("Article 11 – Responsabilités",K,C),C+=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),z.setFont("helvetica","bold"),z.setFontSize(10),z.text("Article 12 – Règlement des différends",K,C),C+=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),z.setFont("helvetica","bold"),z.setFontSize(10),z.text("Article 13 – Droit applicable",K,C),C+=6,Y("Le présent contrat est régi par le droit français."),U(80),C+=10,Y(`Fait à Paris, le ${Dt(new Date(V.created_at),"d MMMM yyyy",{locale:br})}, en deux exemplaires originaux.`),C+=10;const Q=(M-2*K)/2;z.setFont("helvetica","bold"),z.setFontSize(9),z.text("Pour Qalam Software SASU",K,C),z.text(`Pour ${A}`,K+Q,C),C+=5,z.setFont("helvetica","normal"),z.text("Ayoub Mekouar – Président",K,C);const Ve=I.legalRepresentativeName||"[Nom]",W=I.legalRepresentativeFunction||"[Fonction]";z.text(`${Ve} – ${W}`,K+Q,C),C+=10,V.counter_signature_data&&(z.addImage(V.counter_signature_data,"PNG",K,C,50,18),V.counter_signed_at&&(z.setFontSize(7),z.setTextColor(100,100,100),z.text(`Signé le ${Dt(new Date(V.counter_signed_at),"dd/MM/yyyy")}`,K,C+22))),V.signature_data&&(z.addImage(V.signature_data,"PNG",K+Q,C,50,18),V.signed_at&&(z.setFontSize(7),z.setTextColor(100,100,100),z.text(`Signé le ${Dt(new Date(V.signed_at),"dd/MM/yyyy")}`,K+Q,C+22))),z.save(`contrat_prestation_services_${A.replace(/\s/g,"_")}_${Dt(new Date,"yyyy-MM-dd")}.pdf`),ae.success("Contrat téléchargé en PDF")}catch(z){console.error("Error generating PDF:",z),ae.error("Erreur lors de la génération du PDF")}},k=V=>V.counter_signed?s.jsxs(Te,{className:"bg-green-500",children:[s.jsx(Jo,{className:"w-3 h-3 mr-1"}),"Certifié"]}):V.status==="signed"?s.jsxs(Te,{className:"bg-amber-500",children:[s.jsx($r,{className:"w-3 h-3 mr-1"}),"À contre-signer"]}):s.jsxs(Te,{variant:"secondary",children:[s.jsx($r,{className:"w-3 h-3 mr-1"}),"En attente"]}),E=r.filter(V=>V.status==="signed"&&!V.counter_signed).length,q=r.filter(V=>V.counter_signed).length,O=r.filter(V=>V.status==="pending").length,L=r.filter(V=>{const z=new Date;return z.setFullYear(z.getFullYear()-1),new Date(V.created_at)<z}),H=r.filter(V=>{if(v==="all")return!0;if(v==="pending")return V.status==="pending";if(v==="signed")return V.status==="signed"&&!V.counter_signed;if(v==="affiliated")return V.counter_signed;if(v==="expired"){const z=new Date;return z.setFullYear(z.getFullYear()-1),new Date(V.created_at)<z}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(it,{className:"h-8 w-8 animate-spin text-primary"})}):s.jsxs(s.Fragment,{children:[s.jsx(nr,{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(ta,{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(Kt,{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:()=>_(!0),disabled:b,children:[b?s.jsx(it,{className:"h-4 w-4 mr-2 animate-spin"}):s.jsx(Qs,{className:"h-4 w-4 mr-2"}),"Régénérer les contrats"]})})]}),s.jsx(qn,{open:j,onOpenChange:_,children:s.jsxs($n,{children:[s.jsxs(Un,{children:[s.jsx(Vn,{children:"Régénérer les contrats"}),s.jsx(Sa,{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()=>{_(!1),N(!0);try{const{data:V,error:z}=await ce.functions.invoke("regenerate-contracts",{body:{resetSignatures:!1}});if(z)throw z;ae.success(`${V.updated} contrats mis à jour sur ${V.total}`),S()}catch(V){console.error("Error regenerating contracts:",V),ae.error("Erreur lors de la régénération")}finally{N(!1)}},disabled:b,children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(Qs,{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(Gu,{children:[s.jsx(th,{asChild:!0,children:s.jsx(ne,{variant:"outline",className:"w-full justify-start h-auto p-4 border-destructive hover:bg-destructive/10",disabled:b,children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(ri,{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(Kc,{children:[s.jsxs(Xc,{children:[s.jsxs(Zc,{className:"flex items-center gap-2",children:[s.jsx(td,{className:"h-5 w-5 text-destructive"}),"Confirmer la réinitialisation"]}),s.jsxs(Jc,{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(Yc,{children:[s.jsx(Ku,{children:"Annuler"}),s.jsx(Qc,{className:"bg-destructive hover:bg-destructive/90",onClick:async()=>{_(!1),N(!0);try{const{data:V,error:z}=await ce.functions.invoke("regenerate-contracts",{body:{resetSignatures:!0}});if(z)throw z;ae.success(`${V.updated} contrats réinitialisés sur ${V.total}`),S()}catch(V){console.error("Error resetting contracts:",V),ae.error("Erreur lors de la réinitialisation")}finally{N(!1)}},children:"Réinitialiser tous les contrats"})]})]})]})]}),s.jsx(bl,{children:s.jsx(ne,{variant:"ghost",onClick:()=>_(!1),children:"Annuler"})})]})}),s.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4 mb-8",children:[s.jsx(nt,{to:"/admin/trainers",className:"block",children:s.jsx(je,{className:"hover:shadow-md transition-shadow cursor-pointer group",children:s.jsx(Ee,{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:q})]}),s.jsx(Jo,{className:"h-8 w-8 text-green-500 opacity-80 group-hover:opacity-100 transition-opacity"})]})})})}),s.jsx(je,{className:E>0?"ring-2 ring-amber-400":"",children:s.jsx(Ee,{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:E})]}),s.jsx(t9,{className:"h-8 w-8 text-amber-500 opacity-80"})]})})}),s.jsx(nt,{to:"/admin/trainers",className:"block",children:s.jsx(je,{className:"hover:shadow-md transition-shadow cursor-pointer group",children:s.jsx(Ee,{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(er,{className:"h-8 w-8 text-primary opacity-80 group-hover:opacity-100 transition-opacity"})]})})})}),s.jsx(je,{className:O>0?"hover:shadow-md transition-shadow cursor-pointer":"",onClick:()=>O>0&&y("pending"),children:s.jsx(Ee,{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:O})]}),s.jsx($r,{className:"h-8 w-8 text-gray-500 opacity-80"})]})})}),L.length>0&&s.jsx(je,{className:"ring-2 ring-red-400 hover:shadow-md transition-shadow cursor-pointer",onClick:()=>y("expired"),children:s.jsx(Ee,{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:L.length})]}),s.jsx($r,{className:"h-8 w-8 text-red-500 opacity-80"})]})})}),s.jsx(nt,{to:"/admin/training-requests",className:"block",children:s.jsx(je,{className:"hover:shadow-md transition-shadow cursor-pointer group",children:s.jsx(Ee,{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(yr,{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:()=>y("all"),children:["Tous (",r.length,")"]}),s.jsxs(ne,{variant:v==="pending"?"default":"outline",size:"sm",onClick:()=>y("pending"),children:["En attente (",O,")"]}),s.jsxs(ne,{variant:v==="signed"?"default":"outline",size:"sm",onClick:()=>y("signed"),children:["À contre-signer (",E,")"]}),s.jsxs(ne,{variant:v==="affiliated"?"default":"outline",size:"sm",onClick:()=>y("affiliated"),children:["Certifiés (",q,")"]}),L.length>0&&s.jsxs(ne,{variant:v==="expired"?"default":"outline",size:"sm",onClick:()=>y("expired"),children:["Expirés (",L.length,")"]})]}),s.jsxs(uf,{value:c,onValueChange:u,children:[s.jsxs(fd,{className:"mb-6",children:[s.jsxs(Mn,{value:"trainer",children:["Contrats Formateurs (",r.length,")"]}),s.jsxs(Mn,{value:"service",children:["Contrats Prestation (",a.length,")"]})]}),s.jsx(Os,{value:"trainer",children:H.length===0?s.jsx(je,{children:s.jsxs(Ee,{className:"py-12 text-center",children:[s.jsx(Kt,{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(V=>{var M;const z=(()=>{const B=new Date;return B.setFullYear(B.getFullYear()-1),new Date(V.created_at)<B})();return s.jsx(je,{className:`hover:shadow-md transition-shadow ${z?"ring-2 ring-red-400 bg-red-50/50 dark:bg-red-950/20":V.status==="signed"&&!V.counter_signed?"ring-2 ring-amber-400 bg-amber-50/50 dark:bg-amber-950/20":""}`,children:s.jsxs(Ee,{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(nt,{to:"/admin/trainers",className:"text-lg font-semibold hover:text-primary transition-colors flex items-center gap-1",children:[V.contract_data.trainerName,s.jsx(Kn,{className:"w-3 h-3 opacity-50"})]}),k(V),z&&s.jsx(Te,{variant:"destructive",children:"Expiré"})]}),s.jsxs("a",{href:`mailto:${V.contract_data.trainerEmail}`,className:"text-sm text-muted-foreground hover:text-primary transition-colors flex items-center gap-1 mb-2",children:[s.jsx(_n,{className:"w-3 h-3"}),V.contract_data.trainerEmail]}),s.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:(M=V.contract_data.specialties)==null?void 0:M.slice(0,3).map((B,K)=>s.jsx(Te,{variant:"outline",className:"text-xs",children:B},K))}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:["Créé le ",Dt(new Date(V.created_at),"dd MMM yyyy",{locale:br}),V.signed_at&&` • Signé le ${Dt(new Date(V.signed_at),"dd MMM yyyy",{locale:br})}`,V.counter_signed_at&&` • Contre-signé le ${Dt(new Date(V.counter_signed_at),"dd MMM yyyy",{locale:br})}`]})]}),s.jsxs("div",{className:"flex gap-2",children:[V.status==="signed"&&!V.counter_signed&&s.jsxs(ne,{onClick:()=>f(V),children:[s.jsx(t9,{className:"mr-2 h-4 w-4"}),"Contre-signer"]}),s.jsxs(ne,{variant:"outline",onClick:()=>R(V),children:[s.jsx(ro,{className:"mr-2 h-4 w-4"}),"Télécharger PDF"]})]})]}),s.jsx("div",{className:"mt-4",children:s.jsx(b0,{query:V.contract_data.trainerName,title:"Documents Drive (formateur)"})}),(V.signature_data||V.counter_signature_data)&&s.jsxs("div",{className:"mt-4 pt-4 border-t flex flex-wrap gap-6",children:[V.signature_data&&s.jsxs("div",{children:[s.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Signature formateur:"}),s.jsx("img",{src:V.signature_data,alt:"Signature formateur",className:"h-12 border rounded"})]}),V.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:V.counter_signature_data,alt:"Contre-signature",className:"h-12 border rounded"})]})]})]})},V.id)})})}),s.jsx(Os,{value:"service",children:a.length===0?s.jsx(je,{children:s.jsxs(Ee,{className:"py-12 text-center",children:[s.jsx(Kt,{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(V=>{var z,M,B,K,C,A,I,U,Y,te;return s.jsx(je,{className:"hover:shadow-md transition-shadow",children:s.jsxs(Ee,{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(nt,{to:`/training-offers/${(z=V.school_request)==null?void 0:z.id}`,className:"text-lg font-semibold hover:text-primary transition-colors flex items-center gap-1",children:[(M=V.school_request)==null?void 0:M.school_name,s.jsx(Kn,{className:"w-3 h-3 opacity-50"})]}),s.jsx(Te,{className:V.status==="active"?"bg-green-500":"",children:V.status})]}),s.jsxs("p",{className:"text-sm text-muted-foreground mb-1",children:["Formateur: ",s.jsx(nt,{to:"/admin/trainers",className:"hover:text-primary transition-colors",children:(K=(B=V.trainer_application)==null?void 0:B.trainer)==null?void 0:K.name})]}),s.jsxs("p",{className:"text-sm text-muted-foreground mb-1",children:["Contact école: ",(C=V.school_request)==null?void 0:C.contact_name," (",s.jsx("a",{href:`mailto:${(A=V.school_request)==null?void 0:A.contact_email}`,className:"hover:text-primary transition-colors",children:(I=V.school_request)==null?void 0:I.contact_email}),")"]}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:["Créé le ",Dt(new Date(V.created_at),"dd MMM yyyy",{locale:br})]})]})}),s.jsx("div",{className:"mt-4",children:s.jsx(b0,{query:((Y=(U=V.trainer_application)==null?void 0:U.trainer)==null?void 0:Y.name)||((te=V.school_request)==null?void 0:te.school_name)||"",title:"Documents Drive"})})]})},V.id)})})})]}),s.jsx(qn,{open:!!d,onOpenChange:()=>f(null),children:s.jsxs($n,{className:"max-w-2xl",children:[s.jsx(Un,{children:s.jsx(Vn,{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?Dt(new Date(d.signed_at),"dd MMMM yyyy à HH:mm",{locale:br}):"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:x,className:"cursor-crosshair block",style:{width:"500px",height:"150px"}})})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsx(ne,{variant:"outline",onClick:P,children:"Effacer"}),s.jsxs(ne,{onClick:T,disabled:m,children:[m?s.jsx(it,{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 ple({fileName:e,title:t="Classeur Drive",initialSheet:r,sheetPattern:n,defaultOpen:a=!1}){const[i,o]=w.useState(a),[l,c]=w.useState(null),[u,d]=w.useState(!1),[f,m]=w.useState(""),[h,x]=w.useState(""),p=w.useRef(0),g=async N=>{var S;const j=++p.current,_=()=>j!==p.current;d(!0),m("");try{const{data:P,error:T}=await ce.functions.invoke("read-drive-spreadsheet",{body:{fileName:e,sheet:N||r||void 0,sheetPattern:n}});if(T){let R=T.message;try{const k=await((S=T.context)==null?void 0:S.json());k!=null&&k.error&&(R=k.error)}catch{}throw new Error(R)}if(P!=null&&P.error)throw new Error(P.error);if(_())return;c(P)}catch(P){if(_())return;console.error("DriveSpreadsheetPanel:",P),m(P instanceof Error?P.message:"Erreur de lecture du classeur")}finally{_()||d(!1)}};w.useEffect(()=>{i&&!l&&!u&&g()},[i]);const v=(l==null?void 0:l.rows[0])||[],y=w.useMemo(()=>((l==null?void 0:l.rows)||[]).reduce((N,j)=>Math.max(N,j.length),0),[l]),b=w.useMemo(()=>{const N=((l==null?void 0:l.rows)||[]).slice(1),j=h.trim().toLowerCase();return j?N.filter(_=>_.some(S=>(S||"").toLowerCase().includes(j))):N},[l,h]);return s.jsxs("div",{className:"border rounded-lg",children:[s.jsxs("button",{type:"button",onClick:()=>o(N=>!N),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(ph,{className:"w-4 h-4 text-emerald-600"}),t,l&&s.jsxs(Te,{variant:"secondary",className:"text-xs",children:[Math.max(l.totalRows-1,0)," ligne(s)"]})]}),s.jsx(Qu,{className:`w-4 h-4 transition-transform ${i?"rotate-180":""}`})]}),i&&s.jsx("div",{className:"px-3 pb-3 space-y-2",children:u?s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground py-3",children:[s.jsx(it,{className:"w-4 h-4 animate-spin"})," Lecture du classeur Drive…"]}):f?s.jsxs("div",{className:"text-sm text-red-600 bg-red-50 border border-red-200 rounded p-2 flex items-center justify-between gap-2",children:[s.jsx("span",{children:f}),s.jsx(ne,{variant:"outline",size:"sm",onClick:()=>g(),children:"Réessayer"})]}):l?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs(Ar,{value:l.sheet,onValueChange:N=>void g(N),children:[s.jsx(kr,{className:"h-8 w-[260px] text-xs",children:s.jsx(Dr,{placeholder:"Feuille"})}),s.jsx(Cr,{children:l.sheetNames.map(N=>s.jsx(ct,{value:N,className:"text-xs",children:N},N))})]}),s.jsxs("div",{className:"relative flex-1 min-w-[180px]",children:[s.jsx(Rs,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),s.jsx(Xe,{className:"h-8 pl-8 text-xs",placeholder:"Filtrer (formateur, école, statut…)",value:h,onChange:N=>x(N.target.value)})]}),s.jsx(ne,{variant:"ghost",size:"sm",className:"h-8",onClick:()=>g(l.sheet),title:"Rafraîchir depuis Drive",children:s.jsx(Qs,{className:"w-3.5 h-3.5"})}),l.webViewLink&&s.jsxs("a",{href:l.webViewLink,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-xs text-primary hover:underline",children:["Ouvrir dans Drive ",s.jsx(Kn,{className:"w-3 h-3"})]})]}),s.jsx("div",{className:"border rounded-md overflow-auto max-h-[420px]",children:s.jsxs("table",{className:"text-xs w-full",children:[s.jsx("thead",{className:"bg-muted/60 sticky top-0",children:s.jsx("tr",{children:Array.from({length:y}).map((N,j)=>s.jsx("th",{className:"px-2 py-1.5 text-left font-medium whitespace-nowrap max-w-[220px] truncate",children:v[j]||""},j))})}),s.jsx("tbody",{children:b.length===0?s.jsx("tr",{children:s.jsxs("td",{colSpan:Math.max(y,1),className:"px-2 py-3 text-muted-foreground text-center",children:["Aucune ligne",h?` pour « ${h} »`:"","."]})}):b.map((N,j)=>s.jsx("tr",{className:"border-t hover:bg-muted/30",children:Array.from({length:y}).map((_,S)=>s.jsx("td",{className:"px-2 py-1 whitespace-nowrap max-w-[220px] truncate",title:N[S]||"",children:N[S]||""},S))},j))})]})}),s.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[b.length," ligne(s) affichée(s)",l.truncated&&` — classeur tronqué aux ${l.rows.length} premières lignes`," · ","source : ",l.fileName]})]}):null})]})}function xMe(){const[e,t]=w.useState(null),[r,n]=w.useState(!0),[a,i]=w.useState(""),[o,l]=w.useState(""),[c,u]=w.useState(new Set),[d,f]=w.useState(null),[m,h]=w.useState(""),[x,p]=w.useState(!1),g=async()=>{var P;n(!0),i("");try{const{data:T,error:R}=await ce.functions.invoke("mission-trainers-audit",{body:{}});if(R){let k=R.message;try{const E=await((P=R.context)==null?void 0:P.json());E!=null&&E.error&&(k=E.error)}catch{}throw new Error(k)}if(T!=null&&T.error)throw new Error(T.error);t(T)}catch(T){console.error("MissionTrainersPanel:",T),i(T instanceof Error?T.message:"Erreur de chargement")}finally{n(!1)}};w.useEffect(()=>{g()},[]);const v=async P=>{if(P.profile){l(P.key);try{const{error:T}=await ce.from("trainer_profiles").update({manual_certified:!0}).eq("id",P.profile.id);if(T)throw T;ae.success(`${P.name} est maintenant Certifié PedagoBridge`),t(R=>R&&{...R,trainers:R.trainers.map(k=>k.key===P.key&&k.profile?{...k,profile:{...k.profile,manual_certified:!0,certified:!0}}:k)})}catch(T){console.error("certify:",T),ae.error("Erreur lors de la certification")}finally{l("")}}},y=P=>{f(P),h(P.email||"")},b=async()=>{if(d){p(!0);try{const{data:P,error:T}=await ce.functions.invoke("mission-trainers-audit",{body:{action:"invite",name:d.name,email:m.trim()}});if(T)throw T;if(P!=null&&P.error||(P==null?void 0:P.success)===!1)throw new Error((P==null?void 0:P.error)||"Envoi impossible");ae.success(`Invitation envoyée à ${m.trim()}`),u(R=>new Set(R).add(d.key)),f(null)}catch(P){console.error("invite:",P),ae.error(P instanceof Error?P.message:"Erreur lors de l'envoi")}finally{p(!1)}}},N=((e==null?void 0:e.trainers)||[]).filter(P=>P.missionsValidated>0),j=N.filter(P=>!P.contract).length,_=N.filter(P=>P.profile&&!P.profile.certified).length,S=N.filter(P=>!P.profile).length;return s.jsxs(je,{className:"mb-6",children:[s.jsxs(mt,{className:"pb-3",children:[s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[s.jsxs("div",{children:[s.jsxs(gt,{className:"text-lg flex items-center gap-2",children:[s.jsx(lu,{className:"h-5 w-5 text-primary"}),"Formateurs missionnés (classeur Drive)"]}),s.jsx(Kr,{children:"Mission réalisée → contrat signé archivé sur le Drive → badge Certifié PedagoBridge"})]}),s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>void g(),disabled:r,title:"Recharger depuis Drive",children:s.jsx(Qs,{className:`w-4 h-4 ${r?"animate-spin":""}`})})]}),!r&&N.length>0&&s.jsxs("div",{className:"flex flex-wrap gap-2 pt-1",children:[s.jsxs(Te,{variant:"secondary",children:[N.length," formateur(s)"]}),j>0&&s.jsxs(Te,{variant:"destructive",children:[j," contrat(s) manquant(s) sur Drive"]}),_>0&&s.jsxs(Te,{className:"bg-amber-500",children:[_," badge(s) à attribuer"]}),S>0&&s.jsxs(Te,{variant:"outline",children:[S," sans profil plateforme"]})]})]}),s.jsxs(Ee,{children:[r?s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground py-3",children:[s.jsx(it,{className:"w-4 h-4 animate-spin"})," Analyse du classeur de suivi…"]}):a?s.jsxs("div",{className:"text-sm text-red-600 bg-red-50 border border-red-200 rounded p-2 flex items-center justify-between gap-2",children:[s.jsx("span",{children:a}),s.jsx(ne,{variant:"outline",size:"sm",onClick:()=>void g(),children:"Réessayer"})]}):N.length===0?s.jsx("p",{className:"text-sm text-muted-foreground",children:"Aucun formateur avec mission validée dans les onglets missions."}):s.jsx("div",{className:"border rounded-md overflow-x-auto",children:s.jsxs("table",{className:"text-sm w-full",children:[s.jsx("thead",{className:"bg-muted/60",children:s.jsxs("tr",{children:[s.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Formateur"}),s.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Missions"}),s.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"École(s)"}),s.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Contrat signé (Drive)"}),s.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Badge Certifié"})]})}),s.jsx("tbody",{children:N.map(P=>s.jsxs("tr",{className:"border-t align-top",children:[s.jsxs("td",{className:"px-3 py-2 whitespace-nowrap",children:[P.profile?s.jsxs(nt,{to:`/trainers/${P.profile.id}`,className:"font-medium hover:text-primary transition-colors inline-flex items-center gap-1",children:[P.name,s.jsx(Kn,{className:"w-3 h-3 opacity-50"})]}):s.jsx("span",{className:"font-medium",children:P.name}),P.email&&s.jsx("div",{className:"text-xs text-muted-foreground",children:P.email})]}),s.jsxs("td",{className:"px-3 py-2 whitespace-nowrap",children:[s.jsxs(Te,{variant:"secondary",children:[P.missionsValidated," validée(s)"]}),P.missionsTotal>P.missionsValidated&&s.jsxs("span",{className:"text-xs text-muted-foreground ml-1",children:["/ ",P.missionsTotal]})]}),s.jsx("td",{className:"px-3 py-2 max-w-[180px] truncate",title:P.schools.join(", "),children:P.schools.join(", ")||"—"}),s.jsx("td",{className:"px-3 py-2",children:P.contract?P.contract.webViewLink?s.jsxs("a",{href:P.contract.webViewLink,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-green-700 hover:underline",title:`${P.contract.folderPath}/${P.contract.fileName}`,children:[s.jsx(JB,{className:"w-4 h-4"})," Sur Drive",s.jsx(Kn,{className:"w-3 h-3 opacity-50"})]}):s.jsxs("span",{className:"inline-flex items-center gap-1 text-green-700",title:`${P.contract.folderPath}/${P.contract.fileName}`,children:[s.jsx(JB,{className:"w-4 h-4"})," Sur Drive"]}):s.jsxs("span",{className:"inline-flex items-center gap-1 text-red-600 font-medium",children:[s.jsx(bye,{className:"w-4 h-4"})," Manquant"]})}),s.jsx("td",{className:"px-3 py-2 whitespace-nowrap",children:P.profile?P.profile.certified?s.jsx(id,{size:"sm"}):s.jsxs(ne,{size:"sm",variant:"outline",className:"h-7",onClick:()=>void v(P),disabled:o===P.key,title:P.contract?"Attribuer le badge Certifié PedagoBridge":"Attention : contrat signé introuvable sur Drive",children:[o===P.key?s.jsx(it,{className:"w-3.5 h-3.5 animate-spin"}):s.jsx(wi,{className:"w-3.5 h-3.5 mr-1"}),"Certifier"]}):c.has(P.key)?s.jsxs(Te,{variant:"secondary",children:[s.jsx(_n,{className:"w-3 h-3 mr-1"}),"Invité"]}):s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground",children:[s.jsx(Uye,{className:"w-3.5 h-3.5"})," Aucun profil"]}),s.jsxs(ne,{size:"sm",variant:"outline",className:"h-7",onClick:()=>y(P),children:[s.jsx(_n,{className:"w-3.5 h-3.5 mr-1"})," Inviter"]})]})})]},P.key))})]})}),(e==null?void 0:e.webViewLink)&&!r&&!a&&s.jsxs("p",{className:"text-[11px] text-muted-foreground mt-2",children:["Source : ",s.jsx("a",{href:e.webViewLink,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:e.fileName})," · onglets analysés : ",e.missionTabs.join(", ")]})]}),s.jsx(qn,{open:!!d,onOpenChange:P=>!P&&f(null),children:s.jsxs($n,{className:"max-w-md",children:[s.jsxs(Un,{children:[s.jsxs(Vn,{children:["Inviter ",d==null?void 0:d.name]}),s.jsx(Sa,{children:"Ce formateur a réalisé une mission mais n'a pas de profil plateforme. L'email l'invite à créer son profil pour recevoir son badge Certifié PedagoBridge."})]}),s.jsx(Xe,{type:"email",placeholder:"email@exemple.com",value:m,onChange:P=>h(P.target.value)}),!(d!=null&&d.email)&&s.jsx("p",{className:"text-xs text-amber-600",children:"Email introuvable dans le classeur — saisissez-le manuellement."}),s.jsxs(bl,{children:[s.jsx(ne,{variant:"ghost",onClick:()=>f(null),children:"Annuler"}),s.jsxs(ne,{onClick:()=>void b(),disabled:x||!/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(m.trim()),children:[x?s.jsx(it,{className:"w-4 h-4 mr-2 animate-spin"}):s.jsx(_n,{className:"w-4 h-4 mr-2"}),"Envoyer l'invitation"]})]})]})})]})}function gMe(){const{isAdmin:e}=Br(),t=Zt(),[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:x,error:p}=await ce.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 g=[];for(const v of x||[]){const{data:y}=await ce.from("trainer_profiles").select("id, name, email, manual_certified").eq("id",v.trainer_id).single(),{data:b}=await ce.from("school_requests").select("id, school_name, description, status, contact_email").eq("id",v.school_request_id).single();let N=!!(y!=null&&y.manual_certified);if(y&&!N){const{data:j}=await ce.from("trainer_contracts").select("id, counter_signed").eq("trainer_id",y.id).eq("counter_signed",!0).maybeSingle();N=!!j}y&&b&&g.push({id:v.id,status:v.status,created_at:v.created_at,message:v.message,rejection_reason:v.rejection_reason,trainer:{...y,is_affiliated:N},school_request:b})}n(g)}catch(x){console.error("Error loading missions:",x),ae.error("Erreur lors du chargement des missions")}finally{i(!1)}},f=x=>{switch(x){case"accepted":return s.jsxs(Te,{className:"bg-green-500",children:[s.jsx(Wr,{className:"w-3 h-3 mr-1"}),"Acceptée"]});case"rejected":return s.jsxs(Te,{variant:"destructive",children:[s.jsx(vs,{className:"w-3 h-3 mr-1"}),"Refusée"]});case"pending":default:return s.jsxs(Te,{variant:"secondary",children:[s.jsx($r,{className:"w-3 h-3 mr-1"}),"En attente"]})}},m=r.filter(x=>!(o!=="all"&&x.status!==o||c==="affiliated"&&!x.trainer.is_affiliated||c==="non-affiliated"&&x.trainer.is_affiliated)),h={total:r.length,pending:r.filter(x=>x.status==="pending").length,accepted:r.filter(x=>x.status==="accepted").length,rejected:r.filter(x=>x.status==="rejected").length,affiliated:r.filter(x=>x.trainer.is_affiliated).length,pendingSchoolAction:r.filter(x=>x.status==="pending"&&x.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(it,{className:"h-8 w-8 animate-spin text-primary"})}):s.jsxs(s.Fragment,{children:[s.jsx(nr,{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(ta,{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(Qn,{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"})]}),s.jsx(xMe,{}),s.jsx("div",{className:"mb-6",children:s.jsx(ple,{fileName:"Suivi _Base_Formateurs_PedagoBridge",title:"Suivi Base Formateurs — missions & facturation (Drive)",sheetPattern:"mission"})}),h.pendingSchoolAction>0&&s.jsx(je,{className:"mb-6 border-amber-400 bg-amber-50 dark:bg-amber-950/20",children:s.jsx(Ee,{className:"py-4",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Li,{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(je,{children:s.jsx(Ee,{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(je,{className:h.pending>0?"ring-1 ring-amber-400":"",children:s.jsx(Ee,{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(je,{children:s.jsx(Ee,{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(je,{children:s.jsx(Ee,{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(je,{children:s.jsx(Ee,{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(je,{className:h.pendingSchoolAction>0?"ring-2 ring-amber-500 bg-amber-50 dark:bg-amber-950/20":"",children:s.jsx(Ee,{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(Ar,{value:o,onValueChange:l,children:[s.jsx(kr,{className:"w-40",children:s.jsx(Dr,{})}),s.jsxs(Cr,{children:[s.jsx(ct,{value:"all",children:"Tous"}),s.jsx(ct,{value:"pending",children:"En attente"}),s.jsx(ct,{value:"accepted",children:"Acceptées"}),s.jsx(ct,{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(Ar,{value:c,onValueChange:u,children:[s.jsx(kr,{className:"w-40",children:s.jsx(Dr,{})}),s.jsxs(Cr,{children:[s.jsx(ct,{value:"all",children:"Tous"}),s.jsx(ct,{value:"affiliated",children:"Certifiés"}),s.jsx(ct,{value:"non-affiliated",children:"Non certifiés"})]})]})]})]}),m.length===0?s.jsx(je,{children:s.jsxs(Ee,{className:"py-12 text-center",children:[s.jsx(Qn,{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(x=>s.jsx(je,{className:`hover:shadow-md transition-shadow ${x.status==="pending"?"border-l-4 border-l-amber-400":x.status==="accepted"?"border-l-4 border-l-green-500":""}`,children:s.jsxs(Ee,{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(er,{className:"h-5 w-5 text-primary"}),s.jsxs(nt,{to:`/trainers/${x.trainer.id}`,className:"font-semibold hover:text-primary transition-colors flex items-center gap-1",children:[x.trainer.name,s.jsx(Kn,{className:"w-3 h-3 opacity-50"})]}),x.trainer.is_affiliated&&s.jsx(id,{size:"sm"}),f(x.status)]}),s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-2",children:[s.jsx(yr,{className:"h-4 w-4"}),s.jsx(nt,{to:"/admin/training-requests",className:"hover:text-primary transition-colors",children:x.school_request.school_name}),s.jsx(Te,{variant:"outline",className:"text-xs",children:x.school_request.status})]}),s.jsx("p",{className:"text-sm text-muted-foreground line-clamp-1 mb-2",children:x.school_request.description}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:["Postulé le ",Dt(new Date(x.created_at),"dd MMM yyyy à HH:mm",{locale:br})]}),x.status==="rejected"&&x.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:"})," ",x.rejection_reason]})]}),s.jsx("div",{className:"flex gap-2",children:s.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>t(`/training-offers/${x.school_request.id}`),children:[s.jsx(es,{className:"mr-2 h-4 w-4"}),"Voir l'offre"]})})]}),s.jsxs("div",{className:"mt-4 space-y-2",children:[s.jsx(b0,{query:x.trainer.name,category:"mission",fileTypes:["xlsx","xls","csv"],title:"Fichier de suivi (Excel)",defaultOpen:!0}),s.jsx(b0,{query:x.trainer.name,title:"Documents Drive (formateur)"})]})]})},x.id))})]})]})}const Zi=ce,vMe=["Reconversion","Salariés","Alternants","Étudiants","Particuliers"],yMe=["Action de formation","Bilan de compétences","VAE","Apprentissage"],Yg=["Entreprise","OPCO","CPF","France Travail","Particulier","Public","Autre OF"];function xle(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 Dd={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"}},KT=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 bMe(){const e=Zt(),{isAdmin:t,loading:r}=Br(),[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:y}]=await Promise.all([Zi.from("trainer_interventions").select("*").order("starts_at",{ascending:!1}).limit(2e3),ce.from("trainer_profiles").select("id, name")]);o(v||[]);const b={};(y||[]).forEach(N=>{b[N.id]=N.name}),c(b)}catch(v){console.error(v)}finally{a(!1)}},x=w.useMemo(()=>{var b;const v=new Set,y={};for(const N of i)N.status==="annule"||!N.starts_at||(y[b=N.trainer_profile_id]||(y[b]=[])).push(N);for(const N of Object.values(y)){const j=[...N].sort((_,S)=>new Date(_.starts_at).getTime()-new Date(S.starts_at).getTime());for(let _=0;_<j.length;_++)for(let S=_+1;S<j.length;S++){const P=new Date(j[_].starts_at).getTime(),T=new Date(j[S].starts_at).getTime();if(T>=KT(j[_]))break;T<KT(j[_])&&P<KT(j[S])&&(v.add(j[_].id),v.add(j[S].id))}}return v},[i]),p=w.useMemo(()=>{const v=f.trim().toLowerCase();return i.filter(y=>u==="all"||y.trainer_profile_id===u).filter(y=>v?[l[y.trainer_profile_id],y.subject,y.client_name,y.cursus].filter(Boolean).some(b=>b.toLowerCase().includes(v)):!0).map(y=>({...y,trainerName:l[y.trainer_profile_id]||"—",conflict:x.has(y.id)}))},[i,u,f,l,x]),g=w.useMemo(()=>Object.entries(l).filter(([v])=>i.some(y=>y.trainer_profile_id===v)).sort((v,y)=>v[1].localeCompare(y[1])),[l,i]);return r||n?s.jsx("div",{className:"min-h-screen flex items-center justify-center",children:s.jsx(it,{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(ta,{items:[{label:"Planning global"}]}),s.jsxs(je,{children:[s.jsx(mt,{children:s.jsxs(gt,{className:"text-3xl flex items-center gap-3",children:["Planning global",x.size>0&&s.jsxs(Te,{variant:"outline",className:"bg-red-100 text-red-700 border-red-300 text-sm",children:[s.jsx(td,{className:"h-3.5 w-3.5 mr-1"}),x.size/2," conflit(s) potentiel(s)"]})]})}),s.jsxs(Ee,{children:[s.jsxs("div",{className:"flex flex-wrap gap-3 mb-4",children:[s.jsx(Xe,{placeholder:"Rechercher (formateur, école, matière)…",value:f,onChange:v=>m(v.target.value),className:"max-w-xs"}),s.jsxs(Ar,{value:u,onValueChange:d,children:[s.jsx(kr,{className:"w-64",children:s.jsx(Dr,{placeholder:"Formateur"})}),s.jsxs(Cr,{children:[s.jsx(ct,{value:"all",children:"Tous les formateurs"}),g.map(([v,y])=>s.jsx(ct,{value:v,children:y},v))]})]}),s.jsxs(Te,{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?Dt(ml(v.starts_at),"EEE d MMM",{locale:br}):"—"}),s.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[s.jsx($r,{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(Is,{className:"w-3 h-3"}),v.city]}),v.nb_stagiaires!=null&&s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(er,{className:"w-3 h-3"}),v.nb_stagiaires]})]})]}),v.conflict&&s.jsxs(Te,{variant:"outline",className:"bg-red-100 text-red-700 border-red-300",children:[s.jsx(td,{className:"h-3 w-3 mr-1"}),"Conflit"]}),s.jsx(Te,{variant:"outline",className:Dd[v.status].className,children:Dd[v.status].label})]},v.id))})]})]})]})})}function $U(){return s.jsxs(s.Fragment,{children:[s.jsx(nr,{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.jsx("p",{className:"mt-2 ml-6 text-sm",children:"La mesure d'audience est réalisée en interne, sans outil tiers : aucune donnée de navigation n'est partagée avec un service d'analytics externe."})]}),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(nt,{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:"Mémorisation de votre choix de consentement"})]})]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Cookies de mesure d'audience"})," (déposés uniquement après votre acceptation)",s.jsxs("ul",{className:"list-disc list-inside ml-6 mt-2 space-y-1",children:[s.jsxs("li",{children:[s.jsx("code",{children:"pb_vid"})," — identifiant de visiteur anonyme, durée 13 mois. Permet de distinguer un nouveau visiteur d'un visiteur récurrent."]}),s.jsxs("li",{children:[s.jsx("code",{children:"pb_vn"})," — nombre de visites, durée 13 mois."]}),s.jsxs("li",{children:[s.jsx("code",{children:"pb_sid"})," — identifiant de visite, expire après 30 minutes d'inactivité."]})]}),s.jsx("p",{className:"mt-2 ml-6 text-sm",children:"Aucun outil de mesure tiers n'est utilisé : ces données restent sur nos propres serveurs, en France, et ne sont transmises à personne."})]})]}),s.jsx("h3",{className:"text-xl font-semibold mb-3",children:"9.2 Données d'usage collectées"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Avec votre consentement, nous mesurons la façon dont le site est utilisé afin d'améliorer la mise en relation entre écoles et formateurs. Cela inclut les pages consultées, les recherches et filtres utilisés, ainsi que les interactions avec les coordonnées publiques d'un formateur (survol, sélection, copie et clic sur son nom, son e-mail ou ses liens professionnels). Ces mesures sont rattachées à un identifiant anonyme, jamais revendues, et ne servent pas à de la publicité ciblée."}),s.jsx("h3",{className:"text-xl font-semibold mb-3",children:"9.3 Gestion des cookies"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Si vous refusez, aucun cookie de mesure n'est déposé et aucune de ces interactions n'est enregistrée ; seule une mesure de fréquentation anonyme, sans identifiant persistant, est conservée. Le refus ne limite en rien l'accès au site. Vous pouvez modifier votre choix à 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 la clé "pedagobridge_cookie_consent" du stockage local de votre navigateur, ce qui fait réapparaître la bannière'})]}),s.jsxs("p",{className:"text-muted-foreground mt-4",children:["Retirer votre consentement supprime immédiatement les cookies ",s.jsx("code",{children:"pb_vid"}),", ",s.jsx("code",{children:"pb_vn"})," et ",s.jsx("code",{children:"pb_sid"}),"."]})]}),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, et la mesure d'audience est réalisée sur nos propres serveurs. Certains de nos prestataires (Stripe) 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(nt,{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 wMe(){return s.jsxs(s.Fragment,{children:[s.jsx(nr,{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(nt,{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(nt,{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 jMe(){const e=Zt(),[t]=Jj(),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,x]=w.useState(!1),[p,g]=w.useState(!1),[v,y]=w.useState(!1);w.useEffect(()=>{b()},[r]);const b=async()=>{if(!r){a(!1);return}try{const{data:j,error:_}=await ce.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(j),a(!1)}catch(j){console.error("Error validating token:",j),a(!1)}},N=async j=>{if(j.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}y(!0);try{const{data:_,error:S}=await ce.auth.signUp({email:i.email,password:l,options:{emailRedirectTo:`${window.location.origin}/`,data:{name:f.trim()}}});if(S)throw S;if(!_.user)throw new Error("Erreur lors de la création du compte");const{error:P}=await ce.from("trainer_invitations").update({used:!0,used_at:new Date().toISOString()}).eq("token",r);P&&console.error("Error updating invitation:",P);const{error:T}=await ce.from("user_roles").insert({user_id:_.user.id,role:"trainer"});T&&console.error("Error assigning role:",T);const{error:R}=await ce.from("trainer_profiles").insert({user_id:_.user.id,email:i.email,name:f.trim(),status:"pending"});R?console.error("Error creating profile:",R):dn.trackSignup("trainer",{via:"invitation"});try{await ce.functions.invoke("notify-trainer-signup",{body:{trainerName:f.trim(),trainerEmail:i.email}})}catch(k){console.error("Error sending notification email:",k)}ae.success("Compte créé avec succès ! Vous pouvez maintenant vous connecter."),e("/auth")}catch(_){console.error("Error during signup:",_),ae.error(_.message||"Erreur lors de la création du compte")}finally{y(!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(it,{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(je,{className:"max-w-md w-full",children:[s.jsxs(mt,{className:"text-center",children:[s.jsx(vs,{className:"h-12 w-12 text-destructive mx-auto mb-4"}),s.jsx(gt,{children:"Invitation invalide"}),s.jsx(Kr,{children:"Cette invitation n'existe pas ou a expiré. Veuillez contacter un administrateur pour obtenir une nouvelle invitation."})]}),s.jsx(Ee,{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(je,{children:[s.jsxs(mt,{className:"text-center",children:[s.jsx(Zn,{className:"h-12 w-12 text-primary mx-auto mb-4"}),s.jsx(gt,{className:"text-2xl",children:"Créez votre compte formateur"}),s.jsxs(Kr,{children:["Invitation pour : ",s.jsx("strong",{children:i.email})]})]}),s.jsxs(Ee,{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(Xe,{id:"name",type:"text",placeholder:"Votre nom",value:f,onChange:j=>m(j.target.value),required:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"password",children:"Mot de passe"}),s.jsx(Xe,{id:"password",type:"password",placeholder:"Minimum 6 caractères",value:l,onChange:j=>c(j.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(Xe,{id:"confirmPassword",type:"password",placeholder:"Confirmez votre mot de passe",value:u,onChange:j=>d(j.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(Yo,{id:"terms",checked:h,onCheckedChange:j=>x(j===!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(Yo,{id:"privacy",checked:p,onCheckedChange:j=>g(j===!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(it,{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 _Me(){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 gE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function _1(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function vF(e){return"nodeType"in e}function nl(e){var t,r;return e?_1(e)?e:vF(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function yF(e){const{Document:t}=nl(e);return e instanceof t}function p_(e){return _1(e)?!1:e instanceof nl(e).HTMLElement}function gle(e){return e instanceof nl(e).SVGElement}function N1(e){return e?_1(e)?e.document:vF(e)?yF(e)?e:p_(e)||gle(e)?e.ownerDocument:document:document:document}const cd=gE?w.useLayoutEffect:w.useEffect;function vE(e){const t=w.useRef(e);return cd(()=>{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 NMe(){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 M2(e,t){t===void 0&&(t=[e]);const r=w.useRef(e);return cd(()=>{r.current!==e&&(r.current=e)},t),r}function x_(e,t){const r=w.useRef();return w.useMemo(()=>{const n=e(r.current);return r.current=n,n},[...t])}function C4(e){const t=vE(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 E4(e){const t=w.useRef();return w.useEffect(()=>{t.current=e},[e]),t.current}let XT={};function g_(e,t){return w.useMemo(()=>{if(t)return t;const r=XT[e]==null?0:XT[e]+1;return XT[e]=r,e+"-"+r},[e,t])}function vle(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 Rv=vle(1),$2=vle(-1);function SMe(e){return"clientX"in e&&"clientY"in e}function yE(e){if(!e)return!1;const{KeyboardEvent:t}=nl(e.target);return t&&e instanceof t}function kMe(e){if(!e)return!1;const{TouchEvent:t}=nl(e.target);return t&&e instanceof t}function A4(e){if(kMe(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 SMe(e)?{x:e.clientX,y:e.clientY}:null}const xp=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[xp.Translate.toString(e),xp.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),BU="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function CMe(e){return e.matches(BU)?e:e.querySelector(BU)}const EMe={display:"none"};function AMe(e){let{id:t,value:r}=e;return ye.createElement("div",{id:t,style:EMe},r)}function TMe(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 ye.createElement("div",{id:t,style:a,role:"status","aria-live":n,"aria-atomic":!0},r)}function PMe(){const[e,t]=w.useState("");return{announce:w.useCallback(n=>{n!=null&&t(n)},[]),announcement:e}}const yle=w.createContext(null);function OMe(e){const t=w.useContext(yle);w.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function DMe(){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 IMe={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.
`},RMe={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 LMe(e){let{announcements:t=RMe,container:r,hiddenTextDescribedById:n,screenReaderInstructions:a=IMe}=e;const{announce:i,announcement:o}=PMe(),l=g_("DndLiveRegion"),[c,u]=w.useState(!1);if(w.useEffect(()=>{u(!0)},[]),OMe(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=ye.createElement(ye.Fragment,null,ye.createElement(AMe,{id:n,value:a.draggable}),ye.createElement(TMe,{id:l,announcement:o}));return r?Uc.createPortal(d,r):d}var pi;(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"})(pi||(pi={}));function T4(){}function T8(e,t){return w.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function ble(){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 ud=Object.freeze({x:0,y:0});function wle(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function FMe(e,t){const r=A4(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 jle(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function MMe(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function zU(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 _le(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function qU(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 $Me=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const a=qU(t,t.left,t.top),i=[];for(const o of n){const{id:l}=o,c=r.get(l);if(c){const u=wle(qU(c),a);i.push({id:l,data:{droppableContainer:o,value:u}})}}return i.sort(jle)},BMe=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const a=zU(t),i=[];for(const o of n){const{id:l}=o,c=r.get(l);if(c){const u=zU(c),d=a.reduce((m,h,x)=>m+wle(u[x],h),0),f=Number((d/4).toFixed(4));i.push({id:l,data:{droppableContainer:o,value:f}})}}return i.sort(jle)};function zMe(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 qMe=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=zMe(l,t);c>0&&a.push({id:o,data:{droppableContainer:i,value:c}})}}return a.sort(MMe)};function UMe(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function Nle(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ud}function VMe(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 HMe=VMe(1);function Sle(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 WMe(e,t,r){const n=Sle(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 GMe={ignoreTransform:!1};function S1(e,t){t===void 0&&(t=GMe);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:d}=nl(e).getComputedStyle(e);u&&(r=WMe(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 UU(e){return S1(e,{ignoreTransform:!0})}function KMe(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function XMe(e,t){return t===void 0&&(t=nl(e).getComputedStyle(e)),t.position==="fixed"}function YMe(e,t){t===void 0&&(t=nl(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 bE(e,t){const r=[];function n(a){if(t!=null&&r.length>=t||!a)return r;if(yF(a)&&a.scrollingElement!=null&&!r.includes(a.scrollingElement))return r.push(a.scrollingElement),r;if(!p_(a)||gle(a)||r.includes(a))return r;const i=nl(e).getComputedStyle(a);return a!==e&&YMe(a,i)&&r.push(a),XMe(a,i)?r:n(a.parentNode)}return e?n(e):r}function kle(e){const[t]=bE(e,1);return t??null}function YT(e){return!gE||!e?null:_1(e)?e:vF(e)?yF(e)||e===N1(e).scrollingElement?window:p_(e)?e:null:null}function Cle(e){return _1(e)?e.scrollX:e.scrollLeft}function Ele(e){return _1(e)?e.scrollY:e.scrollTop}function P8(e){return{x:Cle(e),y:Ele(e)}}var Ai;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Ai||(Ai={}));function Ale(e){return!gE||!e?!1:e===document.scrollingElement}function Tle(e){const t={x:0,y:0},r=Ale(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 ZMe={x:.2,y:.2};function JMe(e,t,r,n,a){let{top:i,left:o,right:l,bottom:c}=r;n===void 0&&(n=10),a===void 0&&(a=ZMe);const{isTop:u,isBottom:d,isLeft:f,isRight:m}=Tle(e),h={x:0,y:0},x={x:0,y:0},p={height:t.height*a.y,width:t.width*a.x};return!u&&i<=t.top+p.height?(h.y=Ai.Backward,x.y=n*Math.abs((t.top+p.height-i)/p.height)):!d&&c>=t.bottom-p.height&&(h.y=Ai.Forward,x.y=n*Math.abs((t.bottom-p.height-c)/p.height)),!m&&l>=t.right-p.width?(h.x=Ai.Forward,x.x=n*Math.abs((t.right-p.width-l)/p.width)):!f&&o<=t.left+p.width&&(h.x=Ai.Backward,x.x=n*Math.abs((t.left+p.width-o)/p.width)),{direction:h,speed:x}}function QMe(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 Ple(e){return e.reduce((t,r)=>Rv(t,P8(r)),ud)}function e7e(e){return e.reduce((t,r)=>t+Cle(r),0)}function t7e(e){return e.reduce((t,r)=>t+Ele(r),0)}function Ole(e,t){if(t===void 0&&(t=S1),!e)return;const{top:r,left:n,bottom:a,right:i}=t(e);kle(e)&&(a<=0||i<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const r7e=[["x",["left","right"],e7e],["y",["top","bottom"],t7e]];class bF{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=bE(r),a=Ple(n);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,o,l]of r7e)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 Pw{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 n7e(e){const{EventTarget:t}=nl(e);return e instanceof t?e:N1(e)}function ZT(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 Ic;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Ic||(Ic={}));function VU(e){e.preventDefault()}function s7e(e){e.stopPropagation()}var An;(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"})(An||(An={}));const Dle={start:[An.Space,An.Enter],cancel:[An.Esc],end:[An.Space,An.Enter,An.Tab]},a7e=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case An.Right:return{...r,x:r.x+25};case An.Left:return{...r,x:r.x-25};case An.Down:return{...r,y:r.y+25};case An.Up:return{...r,y:r.y-25}}};class wF{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 Pw(N1(r)),this.windowListeners=new Pw(nl(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Ic.Resize,this.handleCancel),this.windowListeners.add(Ic.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Ic.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,n=t.node.current;n&&Ole(n),r(ud)}handleKeyDown(t){if(yE(t)){const{active:r,context:n,options:a}=this.props,{keyboardCodes:i=Dle,coordinateGetter:o=a7e,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}:ud;this.referenceCoordinates||(this.referenceCoordinates=d);const f=o(t,{active:r,context:n.current,currentCoordinates:d});if(f){const m=$2(f,d),h={x:0,y:0},{scrollableAncestors:x}=n.current;for(const p of x){const g=t.code,{isTop:v,isRight:y,isLeft:b,isBottom:N,maxScroll:j,minScroll:_}=Tle(p),S=QMe(p),P={x:Math.min(g===An.Right?S.right-S.width/2:S.right,Math.max(g===An.Right?S.left:S.left+S.width/2,f.x)),y:Math.min(g===An.Down?S.bottom-S.height/2:S.bottom,Math.max(g===An.Down?S.top:S.top+S.height/2,f.y))},T=g===An.Right&&!y||g===An.Left&&!b,R=g===An.Down&&!N||g===An.Up&&!v;if(T&&P.x!==f.x){const k=p.scrollLeft+m.x,E=g===An.Right&&k<=j.x||g===An.Left&&k>=_.x;if(E&&!m.y){p.scrollTo({left:k,behavior:l});return}E?h.x=p.scrollLeft-k:h.x=g===An.Right?p.scrollLeft-j.x:p.scrollLeft-_.x,h.x&&p.scrollBy({left:-h.x,behavior:l});break}else if(R&&P.y!==f.y){const k=p.scrollTop+m.y,E=g===An.Down&&k<=j.y||g===An.Up&&k>=_.y;if(E&&!m.x){p.scrollTo({top:k,behavior:l});return}E?h.y=p.scrollTop-k:h.y=g===An.Down?p.scrollTop-j.y:p.scrollTop-_.y,h.y&&p.scrollBy({top:-h.y,behavior:l});break}}this.handleMove(t,Rv($2(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()}}wF.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=Dle,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 HU(e){return!!(e&&"distance"in e)}function WU(e){return!!(e&&"delay"in e)}class jF{constructor(t,r,n){var a;n===void 0&&(n=n7e(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=N1(o),this.documentListeners=new Pw(this.document),this.listeners=new Pw(n),this.windowListeners=new Pw(nl(o)),this.initialCoordinates=(a=A4(i))!=null?a:ud,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(Ic.Resize,this.handleCancel),this.windowListeners.add(Ic.DragStart,VU),this.windowListeners.add(Ic.VisibilityChange,this.handleCancel),this.windowListeners.add(Ic.ContextMenu,VU),this.documentListeners.add(Ic.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(WU(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(HU(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(Ic.Click,s7e,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Ic.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=A4(t))!=null?r:ud,u=$2(a,c);if(!n&&l){if(HU(l)){if(l.tolerance!=null&&ZT(u,l.tolerance))return this.handleCancel();if(ZT(u,l.distance))return this.handleStart()}if(WU(l)&&ZT(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===An.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const i7e={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class wE extends jF{constructor(t){const{event:r}=t,n=N1(r.target);super(t,i7e,n)}}wE.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 o7e={move:{name:"mousemove"},end:{name:"mouseup"}};var O8;(function(e){e[e.RightClick=2]="RightClick"})(O8||(O8={}));class l7e extends jF{constructor(t){super(t,o7e,N1(t.event.target))}}l7e.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===O8.RightClick?!1:(n==null||n({event:r}),!0)}}];const JT={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class c7e extends jF{constructor(t){super(t,JT)}static setup(){return window.addEventListener(JT.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(JT.move.name,t)};function t(){}}}c7e.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 Ow;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Ow||(Ow={}));var P4;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(P4||(P4={}));function u7e(e){let{acceleration:t,activator:r=Ow.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=f7e({delta:f,disabled:!i}),[x,p]=NMe(),g=w.useRef({x:0,y:0}),v=w.useRef({x:0,y:0}),y=w.useMemo(()=>{switch(r){case Ow.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Ow.DraggableRect:return a}},[r,a,c]),b=w.useRef(null),N=w.useCallback(()=>{const _=b.current;if(!_)return;const S=g.current.x*v.current.x,P=g.current.y*v.current.y;_.scrollBy(S,P)},[]),j=w.useMemo(()=>l===P4.TreeOrder?[...u].reverse():u,[l,u]);w.useEffect(()=>{if(!i||!u.length||!y){p();return}for(const _ of j){if((n==null?void 0:n(_))===!1)continue;const S=u.indexOf(_),P=d[S];if(!P)continue;const{direction:T,speed:R}=JMe(_,P,y,t,m);for(const k of["x","y"])h[k][T[k]]||(R[k]=0,T[k]=0);if(R.x>0||R.y>0){p(),b.current=_,x(N,o),g.current=R,v.current=T;return}}g.current={x:0,y:0},v.current={x:0,y:0},p()},[t,N,n,p,i,o,JSON.stringify(y),JSON.stringify(h),x,u,j,d,JSON.stringify(m)])}const d7e={x:{[Ai.Backward]:!1,[Ai.Forward]:!1},y:{[Ai.Backward]:!1,[Ai.Forward]:!1}};function f7e(e){let{delta:t,disabled:r}=e;const n=E4(t);return x_(a=>{if(r||!n||!a)return d7e;const i={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[Ai.Backward]:a.x[Ai.Backward]||i.x===-1,[Ai.Forward]:a.x[Ai.Forward]||i.x===1},y:{[Ai.Backward]:a.y[Ai.Backward]||i.y===-1,[Ai.Forward]:a.y[Ai.Forward]||i.y===1}}},[r,t,n])}function h7e(e,t){const r=t!=null?e.get(t):void 0,n=r?r.node.current:null;return x_(a=>{var i;return t==null?null:(i=n??a)!=null?i:null},[n,t])}function m7e(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 B2;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(B2||(B2={}));var D8;(function(e){e.Optimized="optimized"})(D8||(D8={}));const GU=new Map;function p7e(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=g(),m=M2(f),h=w.useCallback(function(v){v===void 0&&(v=[]),!m.current&&o(y=>y===null?v:y.concat(v.filter(b=>!y.includes(b))))},[m]),x=w.useRef(null),p=x_(v=>{if(f&&!r)return GU;if(!v||v===GU||d.current!==e||i!=null){const y=new Map;for(let b of e){if(!b)continue;if(i&&i.length>0&&!i.includes(b.id)&&b.rect.current){y.set(b.id,b.rect.current);continue}const N=b.node.current,j=N?new bF(c(N),N):null;b.rect.current=j,j&&y.set(b.id,j)}return y}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"||x.current!==null||(x.current=setTimeout(()=>{h(),x.current=null},l))},[l,f,h,...n]),{droppableRects:p,measureDroppableContainers:h,measuringScheduled:i!=null};function g(){switch(u){case B2.Always:return!1;case B2.BeforeDragging:return r;default:return!r}}}function _F(e,t){return x_(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function x7e(e,t){return _F(e,t)}function g7e(e){let{callback:t,disabled:r}=e;const n=vE(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 jE(e){let{callback:t,disabled:r}=e;const n=vE(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 v7e(e){return new bF(S1(e),e)}function KU(e,t,r){t===void 0&&(t=v7e);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=g7e({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=jE({callback:i});return cd(()=>{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 y7e(e){const t=_F(e);return Nle(e,t)}const XU=[];function b7e(e){const t=w.useRef(e),r=x_(n=>e?n&&n!==XU&&e&&t.current&&e.parentNode===t.current.parentNode?n:bE(e):XU,[e]);return w.useEffect(()=>{t.current=e},[e]),r}function w7e(e){const[t,r]=w.useState(null),n=w.useRef(e),a=w.useCallback(i=>{const o=YT(i.target);o&&r(l=>l?(l.set(o,P8(o)),new Map(l)):null)},[]);return w.useEffect(()=>{const i=n.current;if(e!==i){o(i);const l=e.map(c=>{const u=YT(c);return u?(u.addEventListener("scroll",a,{passive:!0}),[u,P8(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=YT(c);u==null||u.removeEventListener("scroll",a)})}},[a,e]),w.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,o)=>Rv(i,o),ud):Ple(e):ud,[e,t])}function YU(e,t){t===void 0&&(t=[]);const r=w.useRef(null);return w.useEffect(()=>{r.current=null},t),w.useEffect(()=>{const n=e!==ud;n&&!r.current&&(r.current=e),!n&&r.current&&(r.current=null)},[e]),r.current?$2(e,r.current):ud}function j7e(e){w.useEffect(()=>{if(!gE)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 _7e(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 Ile(e){return w.useMemo(()=>e?KMe(e):null,[e])}const ZU=[];function N7e(e,t){t===void 0&&(t=S1);const[r]=e,n=Ile(r?nl(r):null),[a,i]=w.useState(ZU);function o(){i(()=>e.length?e.map(c=>Ale(c)?n:new bF(t(c),c)):ZU)}const l=jE({callback:o});return cd(()=>{l==null||l.disconnect(),o(),e.forEach(c=>l==null?void 0:l.observe(c))},[e]),a}function Rle(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return p_(t)?t:e}function S7e(e){let{measure:t}=e;const[r,n]=w.useState(null),a=w.useCallback(u=>{for(const{target:d}of u)if(p_(d)){n(f=>{const m=t(d);return f?{...f,width:m.width,height:m.height}:m});break}},[t]),i=jE({callback:a}),o=w.useCallback(u=>{const d=Rle(u);i==null||i.disconnect(),d&&(i==null||i.observe(d)),n(d?t(d):null)},[t,i]),[l,c]=C4(o);return w.useMemo(()=>({nodeRef:l,rect:r,setRef:c}),[r,l,c])}const k7e=[{sensor:wE,options:{}},{sensor:wF,options:{}}],C7e={current:{}},N5={draggable:{measure:UU},droppable:{measure:UU,strategy:B2.WhileDragging,frequency:D8.Optimized},dragOverlay:{measure:S1}};class Dw 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 E7e={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Dw,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:T4},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:N5,measureDroppableContainers:T4,windowRect:null,measuringScheduled:!1},Lle={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:T4,draggableNodes:new Map,over:null,measureDroppableContainers:T4},v_=w.createContext(Lle),Fle=w.createContext(E7e);function A7e(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Dw}}}function T7e(e,t){switch(t.type){case pi.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case pi.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 pi.DragEnd:case pi.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case pi.RegisterDroppable:{const{element:r}=t,{id:n}=r,a=new Dw(e.droppable.containers);return a.set(n,r),{...e,droppable:{...e.droppable,containers:a}}}case pi.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 Dw(e.droppable.containers);return o.set(r,{...i,disabled:a}),{...e,droppable:{...e.droppable,containers:o}}}case pi.UnregisterDroppable:{const{id:r,key:n}=t,a=e.droppable.containers.get(r);if(!a||n!==a.key)return e;const i=new Dw(e.droppable.containers);return i.delete(r),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function P7e(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:a}=w.useContext(v_),i=E4(n),o=E4(r==null?void 0:r.id);return w.useEffect(()=>{if(!t&&!n&&i&&o!=null){if(!yE(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=CMe(d);if(f){f.focus();break}}})}},[n,t,a,o,i]),null}function Mle(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((a,i)=>i({transform:a,...n}),r):r}function O7e(e){return w.useMemo(()=>({draggable:{...N5.draggable,...e==null?void 0:e.draggable},droppable:{...N5.droppable,...e==null?void 0:e.droppable},dragOverlay:{...N5.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 D7e(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;cd(()=>{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=Nle(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=kle(u);m&&m.scrollBy({top:f.y,left:f.x})}},[t,o,l,n,r])}const _E=w.createContext({...ud,scaleX:1,scaleY:1});var dm;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(dm||(dm={}));const $le=w.memo(function(t){var r,n,a,i;let{id:o,accessibility:l,autoScroll:c=!0,children:u,sensors:d=k7e,collisionDetection:f=qMe,measuring:m,modifiers:h,...x}=t;const p=w.useReducer(T7e,void 0,A7e),[g,v]=p,[y,b]=DMe(),[N,j]=w.useState(dm.Uninitialized),_=N===dm.Initialized,{draggable:{active:S,nodes:P,translate:T},droppable:{containers:R}}=g,k=S!=null?P.get(S):null,E=w.useRef({initial:null,translated:null}),q=w.useMemo(()=>{var Et;return S!=null?{id:S,data:(Et=k==null?void 0:k.data)!=null?Et:C7e,rect:E}:null},[S,k]),O=w.useRef(null),[L,H]=w.useState(null),[V,z]=w.useState(null),M=M2(x,Object.values(x)),B=g_("DndDescribedBy",o),K=w.useMemo(()=>R.getEnabled(),[R]),C=O7e(m),{droppableRects:A,measureDroppableContainers:I,measuringScheduled:U}=p7e(K,{dragging:_,dependencies:[T.x,T.y],config:C.droppable}),Y=h7e(P,S),te=w.useMemo(()=>V?A4(V):null,[V]),re=fr(),J=x7e(Y,C.draggable.measure);D7e({activeNode:S!=null?P.get(S):null,config:re.layoutShiftCompensation,initialRect:J,measure:C.draggable.measure});const ie=KU(Y,C.draggable.measure,J),be=KU(Y?Y.parentElement:null),Q=w.useRef({activatorEvent:null,active:null,activeNode:Y,collisionRect:null,collisions:null,droppableRects:A,draggableNodes:P,draggingNode:null,draggingNodeRect:null,droppableContainers:R,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ve=R.getNodeFor((r=Q.current.over)==null?void 0:r.id),W=S7e({measure:C.dragOverlay.measure}),Z=(n=W.nodeRef.current)!=null?n:Y,he=_?(a=W.rect)!=null?a:ie:null,se=!!(W.nodeRef.current&&W.rect),oe=y7e(se?null:ie),le=Ile(Z?nl(Z):null),Me=b7e(_?Ve??Y:null),de=N7e(Me),me=Mle(h,{transform:{x:T.x-oe.x,y:T.y-oe.y,scaleX:1,scaleY:1},activatorEvent:V,active:q,activeNodeRect:ie,containerNodeRect:be,draggingNodeRect:he,over:Q.current.over,overlayNodeRect:W.rect,scrollableAncestors:Me,scrollableAncestorRects:de,windowRect:le}),Le=te?Rv(te,T):null,Ke=w7e(Me),ve=YU(Ke),_e=YU(Ke,[ie]),Ue=Rv(me,ve),Qe=he?HMe(he,me):null,st=q&&Qe?f({active:q,collisionRect:Qe,droppableRects:A,droppableContainers:K,pointerCoordinates:Le}):null,Fe=_le(st,"id"),[Ge,ht]=w.useState(null),ut=se?me:Rv(me,_e),Mt=UMe(ut,(i=Ge==null?void 0:Ge.rect)!=null?i:null,ie),Wt=w.useRef(null),zt=w.useCallback((Et,Ct)=>{let{sensor:hr,options:Gt}=Ct;if(O.current==null)return;const Jt=P.get(O.current);if(!Jt)return;const mr=Et.nativeEvent,mn=new hr({active:O.current,activeNode:Jt,event:mr,options:Gt,context:Q,onAbort(fn){if(!P.get(fn))return;const{onDragAbort:rn}=M.current,wn={id:fn};rn==null||rn(wn),y({type:"onDragAbort",event:wn})},onPending(fn,Xn,rn,wn){if(!P.get(fn))return;const{onDragPending:ts}=M.current,pe={id:fn,constraint:Xn,initialCoordinates:rn,offset:wn};ts==null||ts(pe),y({type:"onDragPending",event:pe})},onStart(fn){const Xn=O.current;if(Xn==null)return;const rn=P.get(Xn);if(!rn)return;const{onDragStart:wn}=M.current,On={activatorEvent:mr,active:{id:Xn,data:rn.data,rect:E}};Uc.unstable_batchedUpdates(()=>{wn==null||wn(On),j(dm.Initializing),v({type:pi.DragStart,initialCoordinates:fn,active:Xn}),y({type:"onDragStart",event:On}),H(Wt.current),z(mr)})},onMove(fn){v({type:pi.DragMove,coordinates:fn})},onEnd:Xt(pi.DragEnd),onCancel:Xt(pi.DragCancel)});Wt.current=mn;function Xt(fn){return async function(){const{active:rn,collisions:wn,over:On,scrollAdjustedTranslate:ts}=Q.current;let pe=null;if(rn&&ts){const{cancelDrop:Ae}=M.current;pe={activatorEvent:mr,active:rn,collisions:wn,delta:ts,over:On},fn===pi.DragEnd&&typeof Ae=="function"&&await Promise.resolve(Ae(pe))&&(fn=pi.DragCancel)}O.current=null,Uc.unstable_batchedUpdates(()=>{v({type:fn}),j(dm.Uninitialized),ht(null),H(null),z(null),Wt.current=null;const Ae=fn===pi.DragEnd?"onDragEnd":"onDragCancel";if(pe){const Ne=M.current[Ae];Ne==null||Ne(pe),y({type:Ae,event:pe})}})}}},[P]),Lt=w.useCallback((Et,Ct)=>(hr,Gt)=>{const Jt=hr.nativeEvent,mr=P.get(Gt);if(O.current!==null||!mr||Jt.dndKit||Jt.defaultPrevented)return;const mn={active:mr};Et(hr,Ct.options,mn)===!0&&(Jt.dndKit={capturedBy:Ct.sensor},O.current=Gt,zt(hr,Ct))},[P,zt]),or=m7e(d,Lt);j7e(d),cd(()=>{ie&&N===dm.Initializing&&j(dm.Initialized)},[ie,N]),w.useEffect(()=>{const{onDragMove:Et}=M.current,{active:Ct,activatorEvent:hr,collisions:Gt,over:Jt}=Q.current;if(!Ct||!hr)return;const mr={active:Ct,activatorEvent:hr,collisions:Gt,delta:{x:Ue.x,y:Ue.y},over:Jt};Uc.unstable_batchedUpdates(()=>{Et==null||Et(mr),y({type:"onDragMove",event:mr})})},[Ue.x,Ue.y]),w.useEffect(()=>{const{active:Et,activatorEvent:Ct,collisions:hr,droppableContainers:Gt,scrollAdjustedTranslate:Jt}=Q.current;if(!Et||O.current==null||!Ct||!Jt)return;const{onDragOver:mr}=M.current,mn=Gt.get(Fe),Xt=mn&&mn.rect.current?{id:mn.id,rect:mn.rect.current,data:mn.data,disabled:mn.disabled}:null,fn={active:Et,activatorEvent:Ct,collisions:hr,delta:{x:Jt.x,y:Jt.y},over:Xt};Uc.unstable_batchedUpdates(()=>{ht(Xt),mr==null||mr(fn),y({type:"onDragOver",event:fn})})},[Fe]),cd(()=>{Q.current={activatorEvent:V,active:q,activeNode:Y,collisionRect:Qe,collisions:st,droppableRects:A,draggableNodes:P,draggingNode:Z,draggingNodeRect:he,droppableContainers:R,over:Ge,scrollableAncestors:Me,scrollAdjustedTranslate:Ue},E.current={initial:he,translated:Qe}},[q,Y,st,Qe,P,Z,he,A,R,Ge,Me,Ue]),u7e({...re,delta:T,draggingRect:Qe,pointerCoordinates:Le,scrollableAncestors:Me,scrollableAncestorRects:de});const Yt=w.useMemo(()=>({active:q,activeNode:Y,activeNodeRect:ie,activatorEvent:V,collisions:st,containerNodeRect:be,dragOverlay:W,draggableNodes:P,droppableContainers:R,droppableRects:A,over:Ge,measureDroppableContainers:I,scrollableAncestors:Me,scrollableAncestorRects:de,measuringConfiguration:C,measuringScheduled:U,windowRect:le}),[q,Y,ie,V,st,be,W,P,R,A,Ge,I,Me,de,C,U,le]),ot=w.useMemo(()=>({activatorEvent:V,activators:or,active:q,activeNodeRect:ie,ariaDescribedById:{draggable:B},dispatch:v,draggableNodes:P,over:Ge,measureDroppableContainers:I}),[V,or,q,ie,v,B,P,Ge,I]);return ye.createElement(yle.Provider,{value:b},ye.createElement(v_.Provider,{value:ot},ye.createElement(Fle.Provider,{value:Yt},ye.createElement(_E.Provider,{value:Mt},u)),ye.createElement(P7e,{disabled:(l==null?void 0:l.restoreFocus)===!1})),ye.createElement(LMe,{...l,hiddenTextDescribedById:B}));function fr(){const Et=(L==null?void 0:L.autoScrollEnabled)===!1,Ct=typeof c=="object"?c.enabled===!1:c===!1,hr=_&&!Et&&!Ct;return typeof c=="object"?{...c,enabled:hr}:{enabled:hr}}}),I7e=w.createContext(null),JU="button",R7e="Draggable";function Ble(e){let{id:t,data:r,disabled:n=!1,attributes:a}=e;const i=g_(R7e),{activators:o,activatorEvent:l,active:c,activeNodeRect:u,ariaDescribedById:d,draggableNodes:f,over:m}=w.useContext(v_),{role:h=JU,roleDescription:x="draggable",tabIndex:p=0}=a??{},g=(c==null?void 0:c.id)===t,v=w.useContext(g?_E:I7e),[y,b]=C4(),[N,j]=C4(),_=_7e(o,t),S=M2(r);cd(()=>(f.set(t,{id:t,key:i,node:y,activatorNode:N,data:S}),()=>{const T=f.get(t);T&&T.key===i&&f.delete(t)}),[f,t]);const P=w.useMemo(()=>({role:h,tabIndex:p,"aria-disabled":n,"aria-pressed":g&&h===JU?!0:void 0,"aria-roledescription":x,"aria-describedby":d.draggable}),[n,h,p,g,x,d.draggable]);return{active:c,activatorEvent:l,activeNodeRect:u,attributes:P,isDragging:g,listeners:n?void 0:_,node:y,over:m,setNodeRef:b,setActivatorNodeRef:j,transform:v}}function zle(){return w.useContext(Fle)}const L7e="Droppable",F7e={timeout:25};function qle(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:a}=e;const i=g_(L7e),{active:o,dispatch:l,over:c,measureDroppableContainers:u}=w.useContext(v_),d=w.useRef({disabled:r}),f=w.useRef(!1),m=w.useRef(null),h=w.useRef(null),{disabled:x,updateMeasurementsFor:p,timeout:g}={...F7e,...a},v=M2(p??n),y=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},g)},[g]),b=jE({callback:y,disabled:x||!o}),N=w.useCallback((P,T)=>{b&&(T&&(b.unobserve(T),f.current=!1),P&&b.observe(P))},[b]),[j,_]=C4(N),S=M2(t);return w.useEffect(()=>{!b||!j.current||(b.disconnect(),f.current=!1,b.observe(j.current))},[j,b]),w.useEffect(()=>(l({type:pi.RegisterDroppable,element:{id:n,key:i,disabled:r,node:j,rect:m,data:S}}),()=>l({type:pi.UnregisterDroppable,key:i,id:n})),[n]),w.useEffect(()=>{r!==d.current.disabled&&(l({type:pi.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:j,over:c,setNodeRef:_}}function M7e(e){let{animation:t,children:r}=e;const[n,a]=w.useState(null),[i,o]=w.useState(null),l=E4(r);return!r&&!n&&l&&a(l),cd(()=>{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]),ye.createElement(ye.Fragment,null,r,n?w.cloneElement(n,{ref:o}):null)}const $7e={x:0,y:0,scaleX:1,scaleY:1};function B7e(e){let{children:t}=e;return ye.createElement(v_.Provider,{value:Lle},ye.createElement(_E.Provider,{value:$7e},t))}const z7e={position:"fixed",touchAction:"none"},q7e=e=>yE(e)?"transform 250ms ease":void 0,U7e=w.forwardRef((e,t)=>{let{as:r,activatorEvent:n,adjustScale:a,children:i,className:o,rect:l,style:c,transform:u,transition:d=q7e}=e;if(!l)return null;const f=a?u:{...u,scaleX:1,scaleY:1},m={...z7e,width:l.width,height:l.height,top:l.top,left:l.left,transform:xp.Transform.toString(f),transformOrigin:a&&n?FMe(n,l):void 0,transition:typeof d=="function"?d(n):d,...c};return ye.createElement(r,{className:o,style:m,ref:t},i)}),V7e=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)}},H7e=e=>{let{transform:{initial:t,final:r}}=e;return[{transform:xp.Transform.toString(t)},{transform:xp.Transform.toString(r)}]},W7e={duration:250,easing:"ease",keyframes:H7e,sideEffects:V7e({styles:{active:{opacity:"0"}}})};function G7e(e){let{config:t,draggableNodes:r,droppableContainers:n,measuringConfiguration:a}=e;return vE((i,o)=>{if(t===null)return;const l=r.get(i);if(!l)return;const c=l.node.current;if(!c)return;const u=Rle(o);if(!u)return;const{transform:d}=nl(o).getComputedStyle(o),f=Sle(d);if(!f)return;const m=typeof t=="function"?t:K7e(t);return Ole(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 K7e(e){const{duration:t,easing:r,sideEffects:n,keyframes:a}={...W7e,...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}}),[x]=h,p=h[h.length-1];if(JSON.stringify(x)===JSON.stringify(p))return;const g=n==null?void 0:n({active:o,dragOverlay:l,...u}),v=l.node.animate(h,{duration:t,easing:r,fill:"forwards"});return new Promise(y=>{v.onfinish=()=>{g==null||g(),y()}})}}let QU=0;function X7e(e){return w.useMemo(()=>{if(e!=null)return QU++,QU},[e])}const Y7e=ye.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:x,droppableContainers:p,dragOverlay:g,over:v,measuringConfiguration:y,scrollableAncestors:b,scrollableAncestorRects:N,windowRect:j}=zle(),_=w.useContext(_E),S=X7e(f==null?void 0:f.id),P=Mle(o,{activatorEvent:d,active:f,activeNodeRect:m,containerNodeRect:h,draggingNodeRect:g.rect,over:v,overlayNodeRect:g.rect,scrollableAncestors:b,scrollableAncestorRects:N,transform:_,windowRect:j}),T=_F(m),R=G7e({config:n,draggableNodes:x,droppableContainers:p,measuringConfiguration:y}),k=T?g.setRef:void 0;return ye.createElement(B7e,null,ye.createElement(M7e,{animation:R},f&&S?ye.createElement(U7e,{key:S,id:f.id,ref:k,as:l,activatorEvent:d,adjustScale:t,className:c,transition:i,rect:T,style:{zIndex:u,...a},transform:P},r):null))});function NF(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function Z7e(e,t){return e.reduce((r,n,a)=>{const i=t.get(n);return i&&(r[a]=i),r},Array(e.length))}function xS(e){return e!==null&&e>=0}function J7e(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 Q7e(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Ule=e=>{let{rects:t,activeIndex:r,overIndex:n,index:a}=e;const i=NF(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}},gS={scaleX:1,scaleY:1},e$e=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,...gS}:null}const c=t$e(i,a,r);return a>r&&a<=o?{x:0,y:-l.height-c,...gS}:a<r&&a>=o?{x:0,y:l.height+c,...gS}:{x:0,y:0,...gS}};function t$e(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 Vle="Sortable",Hle=ye.createContext({activeIndex:-1,containerId:Vle,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Ule,disabled:{draggable:!1,droppable:!1}});function r$e(e){let{children:t,id:r,items:n,strategy:a=Ule,disabled:i=!1}=e;const{active:o,dragOverlay:l,droppableRects:c,over:u,measureDroppableContainers:d}=zle(),f=g_(Vle,r),m=l.rect!==null,h=w.useMemo(()=>n.map(_=>typeof _=="object"&&"id"in _?_.id:_),[n]),x=o!=null,p=o?h.indexOf(o.id):-1,g=u?h.indexOf(u.id):-1,v=w.useRef(h),y=!J7e(h,v.current),b=g!==-1&&p===-1||y,N=Q7e(i);cd(()=>{y&&x&&d(h)},[y,h,x,d]),w.useEffect(()=>{v.current=h},[h]);const j=w.useMemo(()=>({activeIndex:p,containerId:f,disabled:N,disableTransforms:b,items:h,overIndex:g,useDragOverlay:m,sortedRects:Z7e(h,c),strategy:a}),[p,f,N.draggable,N.droppable,b,h,g,c,m,a]);return ye.createElement(Hle.Provider,{value:j},t)}const n$e=e=>{let{id:t,items:r,activeIndex:n,overIndex:a}=e;return NF(r,n,a).indexOf(t)},s$e=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},a$e={duration:200,easing:"ease"},Wle="transform",i$e=xp.Transition.toString({property:Wle,duration:0,easing:"linear"}),o$e={roleDescription:"sortable"};function l$e(e){let{disabled:t,index:r,node:n,rect:a}=e;const[i,o]=w.useState(null),l=w.useRef(r);return cd(()=>{if(!t&&r!==l.current&&n.current){const c=a.current;if(c){const u=S1(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 c$e(e){let{animateLayoutChanges:t=s$e,attributes:r,disabled:n,data:a,getNewIndex:i=n$e,id:o,strategy:l,resizeObserverConfig:c,transition:u=a$e}=e;const{items:d,containerId:f,activeIndex:m,disabled:h,disableTransforms:x,sortedRects:p,overIndex:g,useDragOverlay:v,strategy:y}=w.useContext(Hle),b=u$e(n,h),N=d.indexOf(o),j=w.useMemo(()=>({sortable:{containerId:f,index:N,items:d},...a}),[f,a,N,d]),_=w.useMemo(()=>d.slice(d.indexOf(o)),[d,o]),{rect:S,node:P,isOver:T,setNodeRef:R}=qle({id:o,data:j,disabled:b.droppable,resizeObserverConfig:{updateMeasurementsFor:_,...c}}),{active:k,activatorEvent:E,activeNodeRect:q,attributes:O,setNodeRef:L,listeners:H,isDragging:V,over:z,setActivatorNodeRef:M,transform:B}=Ble({id:o,data:j,attributes:{...o$e,...r},disabled:b.draggable}),K=_Me(R,L),C=!!k,A=C&&!x&&xS(m)&&xS(g),I=!v&&V,U=I&&A?B:null,te=A?U??(l??y)({rects:p,activeNodeRect:q,activeIndex:m,overIndex:g,index:N}):null,re=xS(m)&&xS(g)?i({id:o,items:d,activeIndex:m,overIndex:g}):N,J=k==null?void 0:k.id,ie=w.useRef({activeId:J,items:d,newIndex:re,containerId:f}),be=d!==ie.current.items,Q=t({active:k,containerId:f,isDragging:V,isSorting:C,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}),Ve=l$e({disabled:!Q,index:N,node:P,rect:S});return w.useEffect(()=>{C&&ie.current.newIndex!==re&&(ie.current.newIndex=re),f!==ie.current.containerId&&(ie.current.containerId=f),d!==ie.current.items&&(ie.current.items=d)},[C,re,f,d]),w.useEffect(()=>{if(J===ie.current.activeId)return;if(J!=null&&ie.current.activeId==null){ie.current.activeId=J;return}const Z=setTimeout(()=>{ie.current.activeId=J},50);return()=>clearTimeout(Z)},[J]),{active:k,activeIndex:m,attributes:O,data:j,rect:S,index:N,newIndex:re,items:d,isOver:T,isSorting:C,isDragging:V,listeners:H,node:P,overIndex:g,over:z,setNodeRef:K,setActivatorNodeRef:M,setDroppableNodeRef:R,setDraggableNodeRef:L,transform:Ve??te,transition:W()};function W(){if(Ve||be&&ie.current.newIndex===N)return i$e;if(!(I&&!yE(E)||!u)&&(C||Q))return xp.Transition.toString({...u,property:Wle})}}function u$e(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 O4(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 d$e=[An.Down,An.Right,An.Up,An.Left],f$e=(e,t)=>{let{context:{active:r,collisionRect:n,droppableRects:a,droppableContainers:i,over:o,scrollableAncestors:l}}=t;if(d$e.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 An.Down:n.top<m.top&&c.push(f);break;case An.Up:n.top>m.top&&c.push(f);break;case An.Left:n.left>m.left&&c.push(f);break;case An.Right:n.left<m.left&&c.push(f);break}});const u=BMe({collisionRect:n,droppableRects:a,droppableContainers:c});let d=_le(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,x=m==null?void 0:m.node.current;if(x&&h&&f&&m){const g=bE(x).some((_,S)=>l[S]!==_),v=Gle(f,m),y=h$e(f,m),b=g||!v?{x:0,y:0}:{x:y?n.width-h.width:0,y:y?n.height-h.height:0},N={x:h.left,y:h.top};return b.x&&b.y?N:$2(N,b)}}}};function Gle(e,t){return!O4(e)||!O4(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function h$e(e,t){return!O4(e)||!O4(t)||!Gle(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}var NE="Collapsible",[m$e,Kle]=ei(NE),[p$e,SF]=m$e(NE),Xle=w.forwardRef((e,t)=>{const{__scopeCollapsible:r,open:n,defaultOpen:a,disabled:i,onOpenChange:o,...l}=e,[c,u]=Zo({prop:n,defaultProp:a??!1,onChange:o,caller:NE});return s.jsx(p$e,{scope:r,disabled:i,contentId:Za(),open:c,onOpenToggle:w.useCallback(()=>u(d=>!d),[u]),children:s.jsx(Vt.div,{"data-state":AF(c),"data-disabled":i?"":void 0,...l,ref:t})})});Xle.displayName=NE;var Yle="CollapsibleTrigger",kF=w.forwardRef((e,t)=>{const{__scopeCollapsible:r,...n}=e,a=SF(Yle,r);return s.jsx(Vt.button,{type:"button","aria-controls":a.contentId,"aria-expanded":a.open||!1,"data-state":AF(a.open),"data-disabled":a.disabled?"":void 0,disabled:a.disabled,...n,ref:t,onClick:Tt(e.onClick,a.onOpenToggle)})});kF.displayName=Yle;var CF="CollapsibleContent",EF=w.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=SF(CF,e.__scopeCollapsible);return s.jsx(ti,{present:r||a.open,children:({present:i})=>s.jsx(x$e,{...n,ref:t,present:i})})});EF.displayName=CF;var x$e=w.forwardRef((e,t)=>{const{__scopeCollapsible:r,present:n,children:a,...i}=e,o=SF(CF,r),[l,c]=w.useState(n),u=w.useRef(null),d=Pr(t,u),f=w.useRef(0),m=f.current,h=w.useRef(0),x=h.current,p=o.open||l,g=w.useRef(p),v=w.useRef(void 0);return w.useEffect(()=>{const y=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(y)},[]),_a(()=>{const y=u.current;if(y){v.current=v.current||{transitionDuration:y.style.transitionDuration,animationName:y.style.animationName},y.style.transitionDuration="0s",y.style.animationName="none";const b=y.getBoundingClientRect();f.current=b.height,h.current=b.width,g.current||(y.style.transitionDuration=v.current.transitionDuration,y.style.animationName=v.current.animationName),c(n)}},[o.open,n]),s.jsx(Vt.div,{"data-state":AF(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":x?`${x}px`:void 0,...e.style},children:p&&a})});function AF(e){return e?"open":"closed"}var Zle=Xle,g$e=kF,v$e=EF;const y$e=Zle,b$e=kF,w$e=EF;function j$e({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",x=t==="approved"?{icon:s.jsx(Rn,{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($i,{className:"h-4 w-4 text-destructive"}),text:"Profil refusé",color:"text-destructive",bg:"bg-destructive/10"}:f?{icon:s.jsx(Li,{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(Li,{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(z0,{children:s.jsxs(Kf,{children:[s.jsx(Xf,{children:s.jsx(dy,{className:"h-4 w-4 text-muted-foreground"})}),s.jsx(qd,{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:yt("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:yt("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:yt("flex items-center gap-2 p-3 rounded-lg",x.bg),children:[x.icon,s.jsx("span",{className:yt("text-sm font-medium",x.color),children:x.text})]}),s.jsxs(y$e,{open:n,onOpenChange:a,children:[s.jsx(b$e,{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(OQ,{className:"h-4 w-4"}):s.jsx(Qu,{className:"h-4 w-4"})]})}),s.jsxs(w$e,{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(eV,{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(eV,{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:yt("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:yt("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 eV({field:e,onClick:t}){return s.jsx(z0,{children:s.jsxs(Kf,{children:[s.jsx(Xf,{asChild:!0,children:s.jsxs("button",{onClick:t,className:yt("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(Rn,{className:"h-3 w-3 text-white"})}):s.jsx("div",{className:yt("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($i,{className:"h-3 w-3 text-white"})}),s.jsx("span",{className:yt("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(qd,{side:"right",className:"max-w-[200px]",children:s.jsx("p",{className:"text-sm",children:e.hint})})]})})}const tV=[{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 _$e({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),[h,x]=w.useState(null),[p,g]=w.useState(!1);w.useEffect(()=>{N()},[e]);const v=R=>{var L,H;const k=R.document_name||T(R.document_type),E=/\.[a-z0-9]{2,5}$/i.test(k),q=((H=(L=R.document_path)==null?void 0:L.split(".").pop())==null?void 0:H.toLowerCase())||"pdf",O=fv(`${R.document_type}_${k}`)||R.document_type;return E?O:`${O}.${q}`},y=async R=>{x(R.id);try{const k=await Kx(R);if(!k)throw new Error("Lien indisponible");const{blob:E}=await v8(k);doe(E,v(R))}catch(k){console.error("Error downloading document:",k),ae.error("Impossible de télécharger ce document")}finally{x(null)}},b=async()=>{if(n.length!==0){g(!0);try{const R=[],k=[];for(const q of n)try{const O=await Kx(q);if(!O)throw new Error("lien indisponible");const{blob:L}=await v8(O);R.push({pathInZip:v(q),content:L})}catch(O){k.push(`${q.document_name} (${O instanceof Error?O.message:"échec"})`)}if(R.length===0){ae.error("Aucun document n'a pu être téléchargé");return}k.length&&R.push({pathInZip:"_erreurs.txt",content:k.join(`
`)});const E=new Date().toISOString().slice(0,10);await foe({zipBaseName:`mes_documents_${fv(t||"formateur")}_${E}`,files:R}),k.length?ae.warning(`${R.length-1} document(s) exporté(s), ${k.length} en échec`):ae.success(`${R.length} document(s) exporté(s)`)}catch(R){console.error("Error zipping documents:",R),ae.error("Erreur lors de la création du ZIP")}finally{g(!1)}}},N=async()=>{try{const{data:R,error:k}=await ce.from("trainer_documents").select("*").eq("trainer_profile_id",e).order("created_at",{ascending:!1});if(k)throw k;a(await cE(R||[]))}catch(R){console.error("Error loading documents:",R)}finally{o(!1)}},j=R=>{var E;const k=(E=R.target.files)==null?void 0:E[0];if(k){if(k.size>10*1024*1024){ae.error("Le fichier ne doit pas dépasser 10 Mo");return}m(k)}},_=async()=>{if(!f||!u){ae.error("Veuillez sélectionner un type de document et un fichier");return}c(!0);try{const{data:{user:R}}=await ce.auth.getUser();if(!R){ae.error("Vous devez être connecté pour uploader des documents"),c(!1);return}console.log("[TrainerDocumentsSection] Upload attempt:",{userId:R.id,trainerId:e,selectedType:u,fileName:f.name});const{data:k,error:E}=await ce.from("trainer_profiles").select("id, user_id").eq("id",e).single();if(E||!k){console.error("[TrainerDocumentsSection] Profile check failed:",E),ae.error("Profil formateur introuvable"),c(!1);return}if(k.user_id!==R.id){console.error("[TrainerDocumentsSection] User mismatch:",{profileUserId:k.user_id,currentUserId:R.id}),ae.error("Vous ne pouvez pas uploader des documents pour ce profil"),c(!1);return}const q=f.name.split(".").pop()||"pdf",O=`${R.id}/documents/${u}-${Date.now()}.${q}`,{error:L}=await ce.storage.from("trainer-documents").upload(O,f);if(L){console.error("[TrainerDocumentsSection] Storage upload error:",L),ae.error(`Erreur storage: ${L.message}`),c(!1);return}const H={trainer_profile_id:e,document_type:u,document_name:f.name,document_path:O,status:"pending"};console.log("[TrainerDocumentsSection] Inserting to trainer_documents:",H);const{error:V}=await ce.from("trainer_documents").insert(H);if(V){console.error("[TrainerDocumentsSection] DB insert error:",V),ae.error(`Erreur base de données: ${V.message}`),c(!1);return}if(console.log("[TrainerDocumentsSection] DB insert success"),t&&r)try{await ce.functions.invoke("notify-document-upload",{body:{trainerName:t,trainerEmail:r,documentType:u,documentName:f.name}})}catch(z){console.error("Error notifying admin:",z)}dn.trackDocumentUpload(u),ae.success("Document uploadé avec succès !"),m(null),d(""),N()}catch(R){console.error("[TrainerDocumentsSection] Unexpected error:",R);const k=R instanceof Error?R.message:"Erreur inconnue";ae.error(`Erreur: ${k}`)}finally{c(!1)}},S=async R=>{try{const{error:k}=await ce.from("trainer_documents").delete().eq("id",R);if(k)throw k;ae.success("Document supprimé"),N()}catch(k){console.error("Error deleting document:",k),ae.error("Erreur lors de la suppression")}},P=R=>{switch(R){case"verified":return s.jsxs(Te,{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(Te,{className:"bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-300",children:[s.jsx(vs,{className:"w-3 h-3 mr-1"}),"Rejeté"]});default:return s.jsxs(Te,{className:"bg-amber-100 text-amber-700 dark:bg-amber-900 dark:text-amber-300",children:[s.jsx($r,{className:"w-3 h-3 mr-1"}),"En attente"]})}},T=R=>{var k;return((k=tV.find(E=>E.value===R))==null?void 0:k.label)||R};return i?s.jsx("div",{className:"animate-pulse h-48 bg-muted rounded-lg"}):s.jsxs(je,{children:[s.jsx(mt,{children:s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3",children:[s.jsxs("div",{children:[s.jsxs(gt,{className:"flex items-center gap-2",children:[s.jsx(Kt,{className:"w-5 h-5"}),"Documents administratifs"]}),s.jsx(Kr,{children:"Uploadez vos documents officiels pour validation"})]}),n.length>0&&s.jsxs(ne,{variant:"outline",size:"sm",onClick:b,disabled:p,className:"shrink-0",children:[p?s.jsx(it,{className:"w-4 h-4 mr-2 animate-spin"}):s.jsx(AQ,{className:"w-4 h-4 mr-2"}),p?"Préparation...":`Tout télécharger (${n.length})`]})]})}),s.jsxs(Ee,{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(Ar,{value:u,onValueChange:d,children:[s.jsx(kr,{children:s.jsx(Dr,{placeholder:"Sélectionner..."})}),s.jsx(Cr,{children:tV.map(R=>s.jsx(ct,{value:R.value,children:R.label},R.value))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{children:"Fichier (PDF, JPG, PNG - max 10Mo)"}),s.jsx(Xe,{type:"file",accept:".pdf,.jpg,.jpeg,.png",onChange:j})]})]}),f&&s.jsxs("p",{className:"text-sm text-muted-foreground",children:["Fichier sélectionné : ",f.name]}),s.jsx(ne,{onClick:_,disabled:!f||!u||l,children:l?s.jsx(s.Fragment,{children:"Envoi en cours..."}):s.jsxs(s.Fragment,{children:[s.jsx(lc,{className:"w-4 h-4 mr-2"}),"Envoyer le document"]})})]}),n.length>0?s.jsx("div",{className:"space-y-3",children:n.map(R=>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(Kt,{className:"w-8 h-8 text-muted-foreground"}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium",children:T(R.document_type)}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:[R.document_name," • ",Dt(new Date(R.created_at),"d MMM yyyy",{locale:br})]}),R.admin_comment&&s.jsxs("p",{className:"text-sm text-red-600 mt-1 flex items-center gap-1",children:[s.jsx(Li,{className:"w-3 h-3"}),R.admin_comment]})]})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[P(R.status),s.jsx("a",{href:R.viewUrl??void 0,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-primary hover:underline",children:"Voir"}),s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>y(R),disabled:h===R.id,title:"Télécharger ce document",children:h===R.id?s.jsx(it,{className:"w-4 h-4 animate-spin"}):s.jsx(ro,{className:"w-4 h-4"})}),R.status==="pending"&&s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>S(R.id),children:s.jsx(ri,{className:"w-4 h-4 text-destructive"})})]})]},R.id))}):s.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"Aucun document uploadé"})]})]})}function N$e({trainerProfileId:e,trainerName:t,trainerEmail:r,trainerPhone:n}){const{user:a}=Br(),[i,o]=w.useState(!1),[l,c]=w.useState(null),[u,d]=w.useState(!0),[f,m]=w.useState(n||""),[h,x]=w.useState("");w.useEffect(()=>{p()},[e]);const p=async()=>{try{const{data:v,error:y}=await ce.from("nda_assistance_requests").select("*").eq("trainer_profile_id",e).order("created_at",{ascending:!1}).limit(1).maybeSingle();if(y)throw y;c(v)}catch(v){console.error("Error checking NDA request:",v)}finally{d(!1)}},g=async()=>{if(!a){ae.error("Vous devez être connecté");return}o(!0);try{const{error:v}=await ce.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:y}=await ce.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}});y&&console.error("Error creating admin notification:",y);const{error:b}=await ce.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"}});b&&console.error("Error sending email:",b),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(je,{children:s.jsx(Ee,{className:"p-6 flex items-center justify-center",children:s.jsx(it,{className:"h-5 w-5 animate-spin text-muted-foreground"})})}):l?s.jsxs(je,{className:"border-primary/20 bg-primary/5",children:[s.jsx(mt,{className:"pb-3",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Kt,{className:"h-5 w-5 text-primary"}),s.jsx(gt,{className:"text-lg",children:"Assistance NDA"})]})}),s.jsx(Ee,{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($r,{className:"h-4 w-4 text-amber-500"}),s.jsx(Te,{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(it,{className:"h-4 w-4 text-blue-500 animate-spin"}),s.jsx(Te,{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(Te,{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(je,{className:"border-primary/20 bg-gradient-to-br from-primary/5 to-transparent",children:[s.jsxs(mt,{className:"pb-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Kt,{className:"h-5 w-5 text-primary"}),s.jsx(gt,{className:"text-lg",children:"Obtenez votre NDA gratuitement"})]}),s.jsx(Kr,{children:"Grâce à l'assistance PedagoBridge, obtenez votre numéro de déclaration d'activité facilement."})]}),s.jsxs(Ee,{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(Xe,{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=>x(v.target.value),placeholder:"Questions ou précisions supplémentaires...",rows:3})]}),s.jsx(ne,{onClick:g,disabled:i,className:"w-full",children:i?s.jsxs(s.Fragment,{children:[s.jsx(it,{className:"mr-2 h-4 w-4 animate-spin"}),"Envoi en cours..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Js,{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 S$e=r1("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"}}),Iw=w.forwardRef(({className:e,variant:t,...r},n)=>s.jsx("div",{ref:n,role:"alert",className:yt(S$e({variant:t}),e),...r}));Iw.displayName="Alert";const S5=w.forwardRef(({className:e,...t},r)=>s.jsx("h5",{ref:r,className:yt("mb-1 font-medium leading-none tracking-tight",e),...t}));S5.displayName="AlertTitle";const Rw=w.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:yt("text-sm [&_p]:leading-relaxed",e),...t}));Rw.displayName="AlertDescription";function k$e({id:e,specialty:t,index:r,onRemove:n}){const{attributes:a,listeners:i,setNodeRef:o,transform:l,transition:c,isDragging:u}=c$e({id:e}),d={transform:xp.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(_ye,{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($i,{className:"h-4 w-4"})})]})}function C$e(){const e=Zt(),{user:t,isTrainer:r,isAdmin:n,loading:a}=Br(),[i,o]=w.useState(!0),[l,c]=w.useState(!1),[u,d]=w.useState(null),[f,m]=w.useState(0),[h,x]=w.useState(""),[p,g]=w.useState(""),[v,y]=w.useState([]),[b,N]=w.useState([]),[j,_]=w.useState(""),[S,P]=w.useState(!1),[T,R]=w.useState(null),[k,E]=w.useState(null),[q,O]=w.useState(null),[L,H]=w.useState(!1),[V,z]=w.useState(!1),[M,B]=w.useState(!1),[K,C]=w.useState(null),[A,I]=w.useState(""),[U,Y]=w.useState(""),[te,re]=w.useState(""),[J,ie]=w.useState(""),[be,Q]=w.useState(""),[Ve,W]=w.useState(""),[Z,he]=w.useState(""),[se,oe]=w.useState(""),[le,Me]=w.useState("France"),[de,me]=w.useState(""),[Le,Ke]=w.useState(""),[ve,_e]=w.useState(""),[Ue,Qe]=w.useState("both"),[st,Fe]=w.useState([]),[Ge,ht]=w.useState(""),[ut,Mt]=w.useState(""),[Wt,zt]=w.useState(!1),[Lt,or]=w.useState("");w.useEffect(()=>{a||(t?!r&&!n?(ae.error("Accès réservé aux formateurs"),e("/")):(Yt(),fr()):e("/auth"))},[t,r,n,a,e]);const Yt=async()=>{var Ce;try{const{data:$e,error:Be}=await ce.from("trainer_profiles").select("*").eq("user_id",t==null?void 0:t.id).single();if(Be&&Be.code!=="PGRST116")throw Be;if($e){if(d($e),$e.referral_code){const{count:et}=await ce.from("trainer_profiles").select("id",{count:"exact",head:!0}).eq("referred_by_code",$e.referral_code);m(et||0)}x($e.name||""),g($e.bio||""),y($e.specialties||[]),E($e.photo_url),H($e.is_visible||!1),I($e.legal_form||""),Y(((Ce=$e.capital_amount)==null?void 0:Ce.toString())||""),re($e.headquarters_address||""),ie($e.legal_representative_name||""),Q($e.legal_representative_function||""),W($e.siret||""),he($e.activity_declaration_number||""),oe($e.activity_declaration_region||""),Me($e.country||"France"),me($e.phone||""),Ke($e.linkedin_url||""),_e($e.website_url||""),Qe($e.preferred_modality||"both"),Fe($e.preferred_departments||[]),ht($e.preferred_tjm!=null?String($e.preferred_tjm):"");const Ze=($e.preferred_departments||[]).find(et=>et.startsWith("ETR:"));Ze&&or(Ze.substring(4)),$e.specialties&&$e.specialties.length>0&&ot($e.specialties)}}catch($e){console.error("Error loading profile:",$e),ae.error("Erreur lors du chargement du profil")}finally{o(!1)}},ot=async Ce=>{for(const $e of Ce)try{const{data:Be}=await ce.from("referenced_specialties").select("id").eq("name",$e).maybeSingle();Be||await ce.from("referenced_specialties").insert({name:$e,usage_count:1})}catch(Be){console.error(`Error syncing specialty ${$e}:`,Be)}await fr()},fr=async()=>{try{const{data:Ce,error:$e}=await ce.from("referenced_specialties").select("name").order("usage_count",{ascending:!1});if($e)throw $e;Ce&&N(Ce.map(Be=>Be.name))}catch(Ce){console.error("Error loading specialties:",Ce)}},Et=async()=>{z(!0);try{const{data:Ce,error:$e}=await ce.functions.invoke("verify-trainer-email",{body:{}});if($e)throw $e;Ce!=null&&Ce.alreadyVerified?ae.success("Votre email est déjà vérifié"):ae.success("Email de vérification envoyé ! Consultez votre boîte mail.")}catch(Ce){console.error("Email verification error:",Ce),ae.error("Erreur lors de l'envoi de l'email de vérification")}finally{z(!1)}},Ct=Ce=>{var Be;const $e=(Be=Ce.target.files)==null?void 0:Be[0];if($e){if($e.size>5*1024*1024){ae.error("La photo ne doit pas dépasser 5 Mo");return}R($e),E(URL.createObjectURL($e))}},hr=async Ce=>{var Be;const $e=(Be=Ce.target.files)==null?void 0:Be[0];if($e){if($e.size>10*1024*1024){ae.error("Le CV ne doit pas dépasser 10 Mo");return}O($e),ae.success("CV sélectionné")}},Gt=async()=>{const Ce=j.trim();if(!Ce||v.includes(Ce)){P(!1),_("");return}y($e=>[...$e,Ce]),_(""),P(!1);try{const{data:$e}=await ce.from("referenced_specialties").select("id, usage_count").eq("name",Ce).maybeSingle();$e?await ce.from("referenced_specialties").update({usage_count:$e.usage_count+1}).eq("id",$e.id):await ce.from("referenced_specialties").insert({name:Ce,usage_count:1}),await fr()}catch($e){console.error("Error updating referenced specialties:",$e)}},Jt=Ce=>{y($e=>$e.filter(Be=>Be!==Ce))},mr=w.useRef(0),mn=w.useRef(0),Xt=w.useCallback(async()=>{if(!(!t||!h.trim()||v.length===0)&&!(Date.now()<mn.current)&&!(typeof navigator<"u"&&!navigator.onLine)){B(!0);try{const{error:Ce}=await ce.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,cv_path:u==null?void 0:u.cv_path,pending_cv_url:u==null?void 0:u.pending_cv_url,pending_cv_path:u==null?void 0:u.pending_cv_path,pending_cv_filename:u==null?void 0:u.pending_cv_filename,status:(u==null?void 0:u.status)||"pending",is_visible:L,legal_form:A.trim()||null,capital_amount:U?parseFloat(U):null,headquarters_address:te.trim()||null,legal_representative_name:J.trim()||null,legal_representative_function:be.trim()||null,siret:Ve.trim()||null,activity_declaration_number:Z.trim()||null,activity_declaration_region:se.trim()||null,country:le.trim()||"France",preferred_modality:Ue,preferred_departments:st,preferred_tjm:Ge?parseInt(Ge,10):null},{onConflict:"user_id"});if(Ce)throw Ce;mr.current=0,mn.current=0,C(new Date)}catch(Ce){mr.current+=1,mn.current=Date.now()+Math.min(12e4,5e3*2**(mr.current-1)),mr.current===1&&console.error("Auto-save error:",Ce)}finally{B(!1)}}},[t,h,p,v,u,L,A,U,te,J,be,Ve,Z,se,le,Ue,st,Ge]);w.useEffect(()=>{const Ce=setTimeout(()=>{Xt()},2e3);return()=>clearTimeout(Ce)},[h,p,v,L,Xt]);const fn=ble(T8(wE),T8(wF,{coordinateGetter:f$e})),Xn=Ce=>{const{active:$e,over:Be}=Ce;Be&&$e.id!==Be.id&&y(Ze=>{const et=Ze.indexOf($e.id),wt=Ze.indexOf(Be.id);return NF(Ze,et,wt)})},rn=w.useRef(null),wn=w.useRef(null),On=w.useRef(null),ts=w.useRef(null),pe=w.useRef(null),Ae=w.useCallback(()=>{const Ce=!!(u!=null&&u.photo_url||T),$e=!!h.trim(),Be=!!(p.trim()&&p.trim().length>=50),Ze=v.length>0,et=!!(u!=null&&u.cv_url||u!=null&&u.cv_path||q);return[{id:"name",label:"Nom complet",isComplete:$e,isRequired:!0,hint:"Votre nom tel qu'il apparaîtra sur votre profil public"},{id:"photo",label:"Photo de profil",isComplete:Ce,isRequired:!0,hint:"Une photo professionnelle augmente vos chances d'être contacté"},{id:"bio",label:"Bio / Présentation (min. 50 caractères)",isComplete:Be,isRequired:!0,hint:`${p.length}/50 caractères minimum`},{id:"specialties",label:"Au moins une spécialité",isComplete:Ze,isRequired:!0,hint:"Vos domaines d'expertise"},{id:"cv",label:"CV (PDF)",isComplete:et,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,u==null?void 0:u.cv_path,T,q]),Ne=Ce=>{const Be={photo:rn,name:wn,bio:On,specialties:ts,cv:pe}[Ce];Be!=null&&Be.current&&(Be.current.scrollIntoView({behavior:"smooth",block:"center"}),Be.current.classList.add("ring-2","ring-primary","ring-offset-2"),setTimeout(()=>{var Ze;(Ze=Be.current)==null||Ze.classList.remove("ring-2","ring-primary","ring-offset-2")},2e3))},ke=()=>{const Ce=Ae(),$e=Ce.filter(Be=>Be.isComplete).length;return Math.round($e/Ce.length*100)},Pe=async(Ce,$e,Be)=>{const{data:Ze,error:et}=await ce.storage.from($e).upload(Be,Ce,{upsert:!0});if(et)throw et;const{data:{publicUrl:wt}}=ce.storage.from($e).getPublicUrl(Ze.path);return wt},Re=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 Ce=u==null?void 0:u.photo_url,$e=u==null?void 0:u.cv_url,Be=u==null?void 0:u.cv_path,Ze=u==null?void 0:u.pending_cv_url,et=u==null?void 0:u.pending_cv_path,wt=u==null?void 0:u.pending_cv_filename;if(T){const qt=`${t==null?void 0:t.id}/photo-${Date.now()}.${T.name.split(".").pop()}`;Ce=await Pe(T,"trainer-files",qt)}if(q){const qt=`${t==null?void 0:t.id}/cv-${Date.now()}.pdf`,{error:Pt}=await ce.storage.from("trainer-documents").upload(qt,q,{upsert:!0});if(Pt)throw Pt;(u==null?void 0:u.status)==="approved"?(et=qt,Ze=null,wt=q.name,ae.success("CV uploadé ! En attente de validation par un administrateur.")):(Be=qt,$e=null,ae.success("CV uploadé avec succès !"))}const{error:Rt}=await ce.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:Ce,cv_url:$e,cv_path:Be,pending_cv_url:Ze,pending_cv_path:et,pending_cv_filename:wt,status:(u==null?void 0:u.status)||"pending",is_visible:L,legal_form:A.trim()||null,capital_amount:U?parseFloat(U):null,headquarters_address:te.trim()||null,legal_representative_name:J.trim()||null,legal_representative_function:be.trim()||null,siret:Ve.trim()||null,activity_declaration_number:Z.trim()||null,activity_declaration_region:se.trim()||null,country:le.trim()||"France",phone:de.trim()||null,linkedin_url:Le.trim()||null,website_url:ve.trim()||null,preferred_modality:Ue,preferred_departments:st,preferred_tjm:Ge?parseInt(Ge,10):null},{onConflict:"user_id"});if(Rt)throw Rt;dn.trackProfileUpdate(u==null?void 0:u.id,{specialties:v.length,hasBio:!!(p!=null&&p.trim()),hasPhoto:!!(u!=null&&u.photo_url||T)}),ae.success("Profil enregistré avec succès !"),await Yt()}catch(Ce){console.error("Error saving profile:",Ce),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(it,{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(Hn,{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(Kt,{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(ed,{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(Kt,{className:"h-4 w-4 text-primary shrink-0"})]}),s.jsxs(je,{children:[s.jsx(mt,{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(gt,{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(it,{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(Kr,{className:"mt-2",children:"Les modifications sont enregistrées automatiquement"})]}),(ke()<100||(u==null?void 0:u.status)!=="approved")&&s.jsx(j$e,{fields:Ae(),status:(u==null?void 0:u.status)||"pending",onFieldClick:Ne}),(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(es,{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(Rn,{className:"h-5 w-5 text-green-600"}):s.jsx(dy,{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:Et,disabled:V,children:V?s.jsx(it,{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:[L?s.jsx(es,{className:"h-5 w-5 text-green-600"}):s.jsx(yC,{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:L?"Votre profil est visible sur le site":"Votre profil est masqué du site public"})]})]}),s.jsx(jy,{checked:L,onCheckedChange:H,"aria-label":"Visibilité du profil"})]}),s.jsxs(Iw,{className:"bg-gradient-to-r from-primary/5 to-secondary/5 border-primary/20",children:[s.jsx(ed,{className:"h-4 w-4"}),s.jsxs(Rw,{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:"Spécialités précises"})," : nommez-les exactement comme les écoles les recherchent — la précision prime sur la quantité"]}),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)"]})]}),s.jsx(nt,{to:"/guide-formateur",className:"inline-flex items-center gap-1 text-xs font-semibold text-primary hover:underline",children:"Lire le guide complet : apparaître en haut des résultats →"})]})]}),(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(IQ,{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(Xe,{readOnly:!0,value:`${window.location.origin}/trainer-register?ref=${u.referral_code}`,className:"text-xs",onFocus:Ce=>Ce.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(uy,{className:"h-4 w-4 mr-1"})," Copier"]})]})]})]})}),s.jsxs(Ee,{className:"space-y-6",children:[s.jsxs("div",{ref:pe,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(lc,{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)||(u==null?void 0:u.cv_path))&&!q&&s.jsxs("p",{className:"text-sm text-green-600 flex items-center gap-2",children:[s.jsx(Rn,{className:"h-4 w-4"}),"CV déjà téléchargé"]}),s.jsx(Xe,{id:"cv",type:"file",accept:".pdf",onChange:hr}),q&&s.jsxs("p",{className:"text-sm text-primary flex items-center gap-2",children:[s.jsx(Rn,{className:"h-4 w-4"}),"Nouveau CV sélectionné : ",q.name]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Format PDF uniquement - Maximum 10 Mo"})]})]}),s.jsxs("div",{ref:rn,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(bs,{className:"h-20 w-20",children:[s.jsx(ji,{src:k||void 0}),s.jsx(ws,{className:"text-2xl",children:h.split(" ").map(Ce=>Ce[0]).join("").toUpperCase().slice(0,2)})]}),s.jsxs("div",{children:[s.jsx(Xe,{id:"photo",type:"file",accept:"image/*",onChange:Ct,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(lc,{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:wn,className:"space-y-2 transition-all rounded-lg p-2 -m-2",children:[s.jsx(We,{htmlFor:"name",children:"Nom complet *"}),s.jsx(Xe,{id:"name",value:h,onChange:Ce=>x(Ce.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(Xe,{id:"phone",type:"tel",value:de,onChange:Ce=>me(Ce.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 Be;if(!Le.trim()){ae.error("Entrez d'abord votre URL LinkedIn");return}const{data:{session:Ce}}=await ce.auth.getSession(),$e=ae.loading("Extraction du profil LinkedIn...");try{const Ze=await fetch("https://pedagobridge.com/functions/v1/extract-profile-from-linkedin",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Ce==null?void 0:Ce.access_token}`,apikey:void 0},body:JSON.stringify({mode:"url",linkedin_url:Le,profile_type:"trainer"})}),et=await Ze.json();if(!Ze.ok)throw new Error(et.error);const wt=et.profile;wt.bio&&g(wt.bio),wt.website&&_e(wt.website),wt.phone&&me(wt.phone),(Be=wt.specialties)!=null&&Be.length&&y(Rt=>[...new Set([...Rt,...wt.specialties])]),ae.success("Profil LinkedIn importé !",{id:$e})}catch(Ze){ae.error(Ze.message||"Erreur extraction",{id:$e})}},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(Xe,{id:"linkedinUrl",type:"url",value:Le,onChange:Ce=>Ke(Ce.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(Xe,{id:"websiteUrl",type:"url",value:ve,onChange:Ce=>_e(Ce.target.value),placeholder:"https://..."})]})]})]}),s.jsxs("div",{ref:On,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:Ce=>g(Ce.target.value),placeholder:"Présentez votre expérience et vos compétences...",rows:5}),s.jsxs("p",{className:yt("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:ts,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(lp,{open:S,onOpenChange:P,children:[s.jsx(cp,{asChild:!0,children:s.jsxs(ne,{variant:"outline",role:"combobox","aria-expanded":S,className:"w-full justify-between",children:[j||"Rechercher ou ajouter une compétence...",s.jsx(g2,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),s.jsx(vh,{className:"w-full p-0 z-[100] bg-background border border-border shadow-lg",align:"start",children:s.jsxs(dp,{children:[s.jsx(fp,{placeholder:"Rechercher ou taper une nouvelle compétence...",value:j,onValueChange:_}),s.jsxs(hp,{children:[s.jsx(mp,{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"}),j.trim()&&s.jsxs(ne,{size:"sm",variant:"outline",onClick:Gt,className:"w-full",children:[s.jsx(Qa,{className:"mr-2 h-4 w-4"}),'Ajouter "',j.trim(),'"']})]})}),s.jsx(rh,{heading:"Compétences référencées",children:b.filter(Ce=>!v.includes(Ce)).map(Ce=>s.jsxs(qu,{value:Ce,onSelect:$e=>{v.includes($e)||(y(Be=>[...Be,$e]),_(""),P(!1),(async()=>{try{const{data:Be}=await ce.from("referenced_specialties").select("id, usage_count").eq("name",$e).maybeSingle();Be&&await ce.from("referenced_specialties").update({usage_count:Be.usage_count+1}).eq("id",Be.id)}catch(Be){console.error("Error updating specialty count:",Be)}})())},children:[s.jsx(Rn,{className:yt("mr-2 h-4 w-4",v.includes(Ce)?"opacity-100":"opacity-0")}),Ce]},Ce))}),j.trim()&&!b.includes(j.trim())&&s.jsx(rh,{children:s.jsxs(qu,{onSelect:()=>Gt(),children:[s.jsx(Qa,{className:"mr-2 h-4 w-4"}),'Ajouter "',j.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($le,{sensors:fn,collisionDetection:$Me,onDragEnd:Xn,children:s.jsx(r$e,{items:v,strategy:e$e,children:s.jsx("div",{className:"space-y-2",children:v.map((Ce,$e)=>s.jsx(k$e,{id:Ce,specialty:Ce,index:$e,onRemove:Jt},Ce))})})})]})]})]}),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:Ge,onChange:Ce=>ht(Ce.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:Ue==="physical",onChange:Ce=>Qe(Ce.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:Ue==="remote",onChange:Ce=>Qe(Ce.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:Ue==="both",onChange:Ce=>Qe(Ce.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(lp,{open:Wt,onOpenChange:zt,children:[s.jsx(cp,{asChild:!0,children:s.jsxs(ne,{variant:"outline",role:"combobox","aria-expanded":Wt,className:"w-full justify-between",children:[st.length===0?"France entière (cliquez pour sélectionner des départements)":`${st.length} département(s) sélectionné(s)`,s.jsx(g2,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),s.jsx(vh,{className:"w-full p-0 z-[100] bg-background border border-border shadow-lg max-h-[300px]",align:"start",children:s.jsxs(dp,{children:[s.jsx(fp,{placeholder:"Rechercher un département...",value:ut,onValueChange:Mt}),s.jsxs(hp,{className:"max-h-[250px] overflow-y-auto",children:[s.jsx(mp,{children:"Aucun département trouvé"}),s.jsx(rh,{children:aF.filter(Ce=>Ce.name.toLowerCase().includes(ut.toLowerCase())||Ce.code.includes(ut)).map(Ce=>s.jsxs(qu,{value:`${Ce.code} ${Ce.name}`,onSelect:()=>{Ce.code==="ETR"?(zt(!1),st.some($e=>$e.startsWith("ETR:"))||or("")):Fe($e=>$e.includes(Ce.code)?$e.filter(Be=>Be!==Ce.code):[...$e,Ce.code])},children:[s.jsx(Rn,{className:yt("mr-2 h-4 w-4",Ce.code==="ETR"?st.some($e=>$e.startsWith("ETR:"))?"opacity-100":"opacity-0":st.includes(Ce.code)?"opacity-100":"opacity-0")}),Ce.code==="ETR"?Ce.name:`${Ce.code} - ${Ce.name}`]},Ce.code))})]})]})})]}),st.length>0&&s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"flex flex-wrap gap-2",children:st.map(Ce=>s.jsxs(Te,{variant:"secondary",className:"gap-1",children:[dv(Ce),s.jsx("button",{type:"button",onClick:()=>{Fe(st.filter($e=>$e!==Ce)),Ce.startsWith("ETR:")&&or("")},className:"ml-1 hover:text-destructive",children:s.jsx($i,{className:"h-3 w-3"})})]},Ce))}),s.jsx(ne,{type:"button",variant:"ghost",size:"sm",onClick:()=>{Fe([]),or("")},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:Lt,onChange:Ce=>{const $e=Ce.target.value;if(or($e),$e){const Be=st.filter(Ze=>!Ze.startsWith("ETR:"));Fe([...Be,`ETR:${$e}`])}else Fe(st.filter(Be=>!Be.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 --"}),RDe.map(Ce=>s.jsx("option",{value:Ce,children:Ce},Ce))]})}),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(Xe,{id:"legalForm",value:A,onChange:Ce=>I(Ce.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(Xe,{id:"capitalAmount",type:"number",value:U,onChange:Ce=>Y(Ce.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(Xe,{id:"headquartersAddress",value:te,onChange:Ce=>re(Ce.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(Xe,{id:"country",value:le,onChange:Ce=>Me(Ce.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(Xe,{id:"legalRepresentativeName",value:J,onChange:Ce=>ie(Ce.target.value),placeholder:"Nom du représentant"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"legalRepresentativeFunction",children:"Fonction"}),s.jsx(Xe,{id:"legalRepresentativeFunction",value:be,onChange:Ce=>Q(Ce.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(Xe,{id:"siret",value:Ve,onChange:Ce=>W(Ce.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(Xe,{id:"activityDeclarationNumber",value:Z,onChange:Ce=>he(Ce.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(Xe,{id:"activityDeclarationRegion",value:se,onChange:Ce=>oe(Ce.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(_$e,{trainerId:u.id,trainerName:u.name,trainerEmail:u.email}),(u==null?void 0:u.id)&&!Z&&s.jsx(N$e,{trainerProfileId:u.id,trainerName:u.name,trainerEmail:u.email,trainerPhone:de}),s.jsx("div",{className:"flex gap-4",children:s.jsx(ne,{onClick:Re,disabled:l,className:"flex-1",children:l?s.jsxs(s.Fragment,{children:[s.jsx(it,{className:"mr-2 h-4 w-4 animate-spin"}),"Enregistrement..."]}):"Enregistrer"})})]})]})]})})}function E$e(){const{user:e,isTrainer:t}=Br(),r=Zt(),[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 ce.from("trainer_profiles").select("id").eq("user_id",e.id).single();if(!d){a([]),o(!1);return}const{data:f,error:m}=await ce.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 x of f||[]){const{data:p}=await ce.from("school_requests").select("id, school_name, description, contact_email, start_date, end_date, subject_areas, status").eq("id",x.school_request_id).single();p&&h.push({id:x.id,message:x.message,status:x.status,created_at:x.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(Te,{className:"bg-green-500",children:[s.jsx(Wr,{className:"w-3 h-3 mr-1"}),"Acceptée"]});case"rejected":return s.jsxs(Te,{variant:"destructive",children:[s.jsx(vs,{className:"w-3 h-3 mr-1"}),"Refusée"]});case"pending":default:return s.jsxs(Te,{variant:"secondary",children:[s.jsx($r,{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(it,{className:"h-8 w-8 animate-spin text-primary"})}):s.jsxs(s.Fragment,{children:[s.jsx(nr,{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(Hn,{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(Qn,{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(je,{children:s.jsx(Ee,{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(Qn,{className:"h-8 w-8 text-primary opacity-80"})]})})}),s.jsx(je,{children:s.jsx(Ee,{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($r,{className:"h-8 w-8 text-yellow-500 opacity-80"})]})})}),s.jsx(je,{children:s.jsx(Ee,{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(je,{children:s.jsx(Ee,{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(vs,{className:"h-8 w-8 text-red-500 opacity-80"})]})})})]}),n.length===0?s.jsx(je,{children:s.jsxs(Ee,{className:"py-12 text-center",children:[s.jsx(Qn,{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(je,{className:"hover:shadow-md transition-shadow",children:s.jsx(Ee,{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(yr,{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(Te,{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(Hs,{className:"h-4 w-4"}),"Postulé le ",Dt(new Date(d.created_at),"dd MMM yyyy",{locale:br})]}),d.school_request.start_date&&s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx($r,{className:"h-4 w-4"}),"Début: ",Dt(new Date(d.school_request.start_date),"dd MMM yyyy",{locale:br})]})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[d.school_request.subject_areas.slice(0,3).map((f,m)=>s.jsx(Te,{variant:"outline",className:"text-xs",children:f},m)),d.school_request.subject_areas.length>3&&s.jsxs(Te,{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(es,{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(_n,{className:"mr-2 h-4 w-4"}),"Contacter"]})]})]})})},d.id))})]})]})}function A$e(){const{user:e,isTrainer:t}=Br(),r=Zt(),[n,a]=w.useState([]),[i,o]=w.useState(null),[l,c]=w.useState([]),[u,d]=w.useState(""),[f,m]=w.useState(!0),[h,x]=w.useState(!1),p=w.useRef(null);w.useEffect(()=>{if(!e){r("/auth");return}if(!t){r("/");return}g()},[e,t,r]),w.useEffect(()=>{var b;(b=p.current)==null||b.scrollIntoView({behavior:"smooth"})},[l]);const g=async()=>{var b,N;if(e){m(!0);try{const{data:j,error:_}=await ce.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 S=new Map;for(const P of j||[]){const T=P.sender_id===e.id?P.recipient_id:P.sender_id,R=`${P.school_request_id}-${T}`;if(!S.has(R))S.set(R,{id:R,school_request_id:P.school_request_id,other_user_id:T,other_user_name:((b=P.school_requests)==null?void 0:b.school_name)||"École",last_message:P.content,last_message_at:P.created_at,unread_count:P.recipient_id===e.id&&!P.is_read?1:0,offer_title:((N=P.school_requests)==null?void 0:N.school_name)||"Offre"});else if(P.recipient_id===e.id&&!P.is_read){const k=S.get(R);k.unread_count++}}a(Array.from(S.values()))}catch(j){console.error("Error loading conversations:",j),ae.error("Erreur lors du chargement des messages")}finally{m(!1)}}},v=async b=>{if(e)try{const{data:N,error:j}=await ce.from("offer_messages").select("*").eq("school_request_id",b.school_request_id).or(`sender_id.eq.${b.other_user_id},recipient_id.eq.${b.other_user_id}`).order("created_at",{ascending:!0});if(j)throw j;c(N||[]),await ce.from("offer_messages").update({is_read:!0}).eq("school_request_id",b.school_request_id).eq("recipient_id",e.id).eq("sender_id",b.other_user_id),a(_=>_.map(S=>S.id===b.id?{...S,unread_count:0}:S))}catch(N){console.error("Error loading messages:",N)}},y=async()=>{if(!(!e||!i||!u.trim())){x(!0);try{const{error:b}=await ce.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(b)throw b;d(""),await v(i)}catch(b){console.error("Error sending message:",b),ae.error("Erreur lors de l'envoi du message")}finally{x(!1)}}};return f?s.jsxs(ba,{children:[s.jsx(nr,{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(it,{className:"h-8 w-8 animate-spin text-primary"})})]}):s.jsxs(ba,{children:[s.jsx(nr,{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(Hn,{className:"h-4 w-4 mr-2"}),"Retour"]}),s.jsxs("h1",{className:"text-2xl font-bold flex items-center gap-2",children:[s.jsx(Fi,{className:"h-6 w-6"}),"Messages"]})]}),s.jsxs("div",{className:"grid md:grid-cols-3 gap-6 h-[600px]",children:[s.jsxs(je,{className:"md:col-span-1",children:[s.jsx(mt,{className:"pb-3",children:s.jsx(gt,{className:"text-lg",children:"Conversations"})}),s.jsx(Ee,{className:"p-0",children:s.jsx(su,{className:"h-[500px]",children:n.length===0?s.jsxs("div",{className:"p-6 text-center text-muted-foreground",children:[s.jsx(Fi,{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(b=>s.jsx("button",{onClick:()=>{o(b),v(b)},className:`w-full p-4 text-left hover:bg-muted/50 transition-colors ${(i==null?void 0:i.id)===b.id?"bg-muted":""}`,children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(bs,{className:"h-10 w-10",children:s.jsx(ws,{children:s.jsx(yr,{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:b.offer_title}),b.unread_count>0&&s.jsx(Te,{variant:"destructive",className:"ml-2",children:b.unread_count})]}),s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:b.last_message}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:Dt(new Date(b.last_message_at),"dd MMM HH:mm",{locale:br})})]})]})},b.id))})})})]}),s.jsx(je,{className:"md:col-span-2 flex flex-col",children:i?s.jsxs(s.Fragment,{children:[s.jsx(mt,{className:"pb-3 border-b",children:s.jsxs(gt,{className:"text-lg flex items-center gap-2",children:[s.jsx(yr,{className:"h-5 w-5"}),i.offer_title]})}),s.jsxs(Ee,{className:"flex-1 flex flex-col p-0",children:[s.jsx(su,{className:"flex-1 p-4",children:s.jsxs("div",{className:"space-y-4",children:[l.map(b=>s.jsx("div",{className:`flex ${b.sender_id===(e==null?void 0:e.id)?"justify-end":"justify-start"}`,children:s.jsxs("div",{className:`max-w-[70%] rounded-lg p-3 ${b.sender_id===(e==null?void 0:e.id)?"bg-primary text-primary-foreground":"bg-muted"}`,children:[s.jsx("p",{className:"text-sm",children:b.content}),s.jsxs("div",{className:"flex items-center justify-end gap-1 mt-1",children:[s.jsx("span",{className:"text-xs opacity-70",children:Dt(new Date(b.created_at),"HH:mm",{locale:br})}),b.sender_id===(e==null?void 0:e.id)&&(b.is_read?s.jsx(PQ,{className:"h-3 w-3 opacity-70"}):s.jsx(Rn,{className:"h-3 w-3 opacity-70"}))]})]})},b.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:b=>d(b.target.value),className:"min-h-[60px] resize-none",onKeyDown:b=>{b.key==="Enter"&&!b.shiftKey&&(b.preventDefault(),y())}}),s.jsx(ne,{onClick:y,disabled:!u.trim()||h,size:"icon",className:"h-auto",children:h?s.jsx(it,{className:"h-4 w-4 animate-spin"}):s.jsx(Js,{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(Fi,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),s.jsx("p",{children:"Sélectionnez une conversation"})]})})})]})]})]})}const T$e=[{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 rV(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 nV(e){const t=(e||"").toLowerCase();return/distan|visio|à distance|a distance/.test(t)?"distanciel":/pr[ée]sent/.test(t)?"presentiel":""}function sV(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 Jle=()=>({include:!0,date:"",start:"",end:"",half_day:"",client_name:"",subject:"",cursus:"",nb_stagiaires:"",mode:"",notes:""});function aV(e){return(e||"").trim().toLowerCase().startsWith("exemple")}const P$e=9e4,O$e=[[1,/^janv/i],[2,/^f[ée]vr/i],[3,/^mars/i],[4,/^avr/i],[5,/^mai$/i],[6,/^juin/i],[7,/^juil/i],[8,/^ao[uû]t/i],[9,/^sept/i],[10,/^oct/i],[11,/^nov/i],[12,/^d[ée]c/i]],D$e=e=>{const t=(e??"").toString().trim();for(const[r,n]of O$e)if(n.test(t))return r;return 0},Dg=e=>(e??"").toString().replace(/\s+/g," ").trim(),I$e=(e,t)=>new Date(e,t,0).getDate();function R$e(e){let t=-1,r=[];for(let x=0;x<Math.min(e.length,12);x++){const p=[];if((e[x]||[]).forEach((g,v)=>{const y=D$e(g);y&&p.push({m:y,col:v})}),p.length>=6){t=x,r=p;break}}if(t<0)return null;const n=[...r].sort((x,p)=>x.col-p.col);let a=1/0;for(let x=1;x<n.length;x++)a=Math.min(a,n[x].col-n[x-1].col);(!isFinite(a)||a<3)&&(a=6);let i=0;for(let x=0;x<=t&&!i;x++)for(const p of e[x]||[]){const g=Dg(p).match(/\b(20\d{2})\b/);if(g){i=Number(g[1]);break}}i||(i=new Date().getFullYear());let o=2,l=4;const c=e[t+1]||[],u=n[0].col;for(let x=0;x<a;x++){const p=Dg(c[u+x]).toLowerCase();/matin/.test(p)?o=x:/apr[eè]s|midi/.test(p)&&(l=x)}const d=[],f=[];for(let x=o;x<l;x++)d.push(x);for(let x=l;x<a;x++)f.push(x);const m=x=>(x.split(/\r?\n/).map(Dg).filter(Boolean)[0]||"").replace(/^["']+|["']+$/g,"").trim(),h=[];for(let x=t+2;x<e.length;x++){const p=(e[x]||[]).map(v=>(v??"").toString());let g=!1;for(const{m:v,col:y}of n){const b=parseInt(Dg(p[y]),10);if(!(b>=1&&b<=31)||b>I$e(i,v))continue;g=!0;const N=d.map(P=>Dg(p[y+P])).filter(Boolean).join(" · "),j=f.map(P=>Dg(p[y+P])).filter(Boolean).join(" · "),_=`${i}-${String(v).padStart(2,"0")}-${String(b).padStart(2,"0")}`,S=(P,T)=>({...Jle(),date:_,half_day:P,subject:m(T),notes:T});N&&N===j?h.push(S("journee",N)):(N&&h.push(S("matin",N)),j&&h.push(S("apres-midi",j)))}if(!g&&h.length&&x>t+2+31)break}return h.length?h:null}function L$e({trainerId:e,open:t,onOpenChange:r,onImported:n}){const[a,i]=w.useState(!1),[o,l]=w.useState("idle"),[c,u]=w.useState(0),[d,f]=w.useState(""),[m,h]=w.useState([]),[x,p]=w.useState(!1),[g,v]=w.useState(""),y=w.useRef(0);w.useEffect(()=>{if(!a)return;const k=Date.now(),E=window.setInterval(()=>u(Math.round((Date.now()-k)/1e3)),500);return()=>window.clearInterval(E)},[a]);const b=()=>{h([]),f(""),v("")},N=()=>{y.current++,i(!1),l("idle"),r(!1),b()};function j(k){for(let E=0;E<Math.min(k.length,8);E++){const q=k[E].map(V=>(V??"").toString()),O={};q.forEach((V,z)=>{for(const M of T$e)if(M.re.test(V)&&O[M.key]===void 0){O[M.key]=z;break}});const L=O.date!==void 0,H=O.client_name!==void 0||O.subject!==void 0;if(L&&H){const V=[];for(let z=E+1;z<k.length;z++){const M=k[z].map(C=>(C??"").toString().trim());if(M.every(C=>C===""))continue;const B=C=>O[C]!==void 0?M[O[C]]??"":"",K=rV(B("date"));K&&V.push({include:!0,date:K,start:B("start"),end:B("end"),half_day:sV(B("half_day")),client_name:B("client_name"),subject:B("subject"),cursus:B("cursus"),nb_stagiaires:B("nb_stagiaires").replace(/[^\d]/g,""),mode:nV(B("mode")),notes:B("notes")})}return V.length?V:null}}return null}const _=async k=>{var O;const E=++y.current,q=()=>E!==y.current;i(!0),l("reading"),u(0),b();try{const L=await Zd(()=>Promise.resolve().then(()=>Ype),void 0),H=await k.arrayBuffer(),V=L.read(H,{type:"array"});let z=[];for(const Y of V.SheetNames){const te=L.utils.sheet_to_json(V.Sheets[Y],{header:1,raw:!1,defval:""});if(te.some(re=>re.some(J=>(J??"").toString().trim()!==""))){z=te;break}}if(q())return;if(!z.length){v("Fichier vide ou illisible. Vérifiez qu'il contient bien des données."),ae.error("Fichier vide ou illisible");return}const M=(O=j(z))==null?void 0:O.filter(Y=>!aV(Y.client_name));if(M&&M.length){if(q())return;h(M),f("tabular"),ae.success(`${M.length} ligne(s) détectée(s) (tableau structuré)`);return}const B=R$e(z);if(B){if(q())return;h(B),f("grid"),ae.success(`${B.length} séance(s) détectée(s) (planning annuel) — vérifiez avant import`);return}l("ai"),ae.info("Format libre détecté — extraction par IA en cours…");const K=ce.functions.invoke("parse-planning-excel",{body:{rows:z,year:new Date().getFullYear()}}),C=new Promise((Y,te)=>setTimeout(()=>te(new Error("__timeout__")),P$e)),{data:A,error:I}=await Promise.race([K,C]);if(q())return;if(I||A!=null&&A.error)throw new Error((A==null?void 0:A.error)||(I==null?void 0:I.message));const U=(A==null?void 0:A.interventions)||[];if(!U.length){v("Aucune intervention détectée par l'IA. Vérifiez que le fichier contient bien un planning, utilisez le « Modèle Excel » fourni, ou saisissez les séances directement dans le calendrier."),ae.error("Aucune intervention détectée.");return}h(U.map(Y=>({...Jle(),date:rV(String(Y.date??"")),start:String(Y.start_time??""),end:String(Y.end_time??""),half_day:sV(String(Y.half_day??"")),client_name:String(Y.client_name??""),subject:String(Y.subject??""),cursus:String(Y.cursus??""),nb_stagiaires:Y.nb_stagiaires!=null?String(Y.nb_stagiaires):"",mode:nV(String(Y.mode??"")),notes:String(Y.notes??"")})).filter(Y=>!aV(Y.client_name))),f("ai"),ae.success(`${U.length} intervention(s) extraite(s) par IA — vérifiez avant import`)}catch(L){if(q())return;console.error(L);const H=L instanceof Error?L.message:"inconnue",V=H==="__timeout__"?"l'extraction IA a expiré (fichier trop volumineux). Utilisez le « Modèle Excel » fourni.":H;v(`Échec de l'analyse du fichier : ${V}`),ae.error(`Erreur d'import : ${V}`)}finally{q()||(i(!1),l("idle"))}},S=(k,E)=>h(q=>q.map((O,L)=>L===k?{...O,...E}:O)),P=(k,E)=>{const[q,O,L]=k.split("-").map(Number),[H,V]=(E||"00:00").split(":").map(Number);return new Date(q,(O||1)-1,L||1,H||0,V||0,0).toISOString()},T=async()=>{const k=m.filter(E=>E.include&&E.date);if(!k.length){ae.error("Aucune ligne valide à importer");return}p(!0);try{const E=k.map(O=>{const L=P(O.date,O.start||"00:00"),H=O.end?P(O.date,O.end):null;let V=O.start&&O.end?xle(L,H,0):null;return V==null&&O.half_day&&(V=O.half_day==="journee"?7:3.5),{trainer_profile_id:e,starts_at:L,ends_at:H,half_day:O.half_day||null,hours:V,client_name:O.client_name.trim()||null,subject:O.subject.trim()||null,cursus:O.cursus.trim()||null,nb_stagiaires:O.nb_stagiaires?parseInt(O.nb_stagiaires,10):null,mode:O.mode||null,notes:O.notes.trim()||null,status:"realise",source:"excel"}}),{error:q}=await Zi.from("trainer_interventions").insert(E);if(q)throw q;ae.success(`${E.length} intervention(s) importée(s) !`),n(),r(!1),b()}catch(E){console.error(E),ae.error("Erreur lors de l'import en base")}finally{p(!1)}},R=m.filter(k=>k.include&&k.date).length;return s.jsx(qn,{open:t,onOpenChange:k=>{k||N()},children:s.jsxs($n,{className:"max-w-4xl max-h-[88vh] overflow-y-auto",children:[s.jsxs(Un,{children:[s.jsx(Vn,{children:"Importer un planning Excel"}),s.jsx(Sa,{children:"Déposez votre fichier (.xlsx / .csv). Les tableaux structurés et les plannings annuels (mois en colonnes, jours en lignes) sont lus directement ; les formats libres passent par une extraction IA. Vous validez tout avant l'import."})]}),g&&m.length===0&&s.jsx("div",{className:"rounded-md border border-red-300 bg-red-50 text-red-700 text-sm p-3",children:g}),m.length===0?a?s.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 border-2 border-dashed rounded-lg py-12",children:[s.jsx(it,{className:"h-8 w-8 animate-spin text-primary"}),s.jsx("span",{className:"text-sm font-medium",children:o==="ai"?"Extraction par IA en cours…":"Lecture du fichier…"}),s.jsx("span",{className:"text-xs text-muted-foreground text-center max-w-sm",children:o==="ai"?`Analyse de votre planning par l'IA — ${c}s écoulées (les gros fichiers peuvent prendre 30 à 60s).`:"Un instant, nous lisons votre fichier…"}),s.jsx(ne,{variant:"ghost",size:"sm",onClick:N,children:"Annuler"})]}):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:[s.jsx(mye,{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",onChange:k=>{var q;const E=(q=k.target.files)==null?void 0:q[0];E&&_(E)}})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[d==="ai"?s.jsxs(Te,{variant:"outline",className:"bg-purple-100 text-purple-700 border-purple-300",children:[s.jsx(Mi,{className:"w-3 h-3 mr-1"})," Extraction IA"]}):d==="grid"?s.jsxs(Te,{variant:"outline",className:"bg-green-100 text-green-700 border-green-300",children:[s.jsx(ph,{className:"w-3 h-3 mr-1"})," Planning annuel"]}):s.jsxs(Te,{variant:"outline",className:"bg-blue-100 text-blue-700 border-blue-300",children:[s.jsx(ph,{className:"w-3 h-3 mr-1"})," Tableau structuré"]}),s.jsxs("span",{className:"text-muted-foreground",children:[R," / ",m.length," ligne(s) sélectionnée(s)"]}),s.jsx(ne,{variant:"ghost",size:"sm",className:"ml-auto",onClick:b,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:m.map((k,E)=>s.jsxs("tr",{className:`border-t ${k.include?"":"opacity-40"} ${k.date?"":"bg-red-50"}`,children:[s.jsx("td",{className:"p-1 text-center",children:s.jsx(Yo,{checked:k.include,onCheckedChange:q=>S(E,{include:!!q})})}),s.jsx("td",{className:"p-1",children:s.jsx(Xe,{className:"h-8",type:"date",value:k.date,onChange:q=>S(E,{date:q.target.value})})}),s.jsx("td",{className:"p-1",children:s.jsx(Xe,{className:"h-8",value:k.client_name,onChange:q=>S(E,{client_name:q.target.value})})}),s.jsx("td",{className:"p-1",children:s.jsx(Xe,{className:"h-8",value:k.subject,onChange:q=>S(E,{subject:q.target.value})})}),s.jsx("td",{className:"p-1",children:s.jsx(Xe,{className:"h-8",value:k.cursus,onChange:q=>S(E,{cursus:q.target.value})})}),s.jsx("td",{className:"p-1",children:s.jsx(Xe,{className:"h-8",value:k.nb_stagiaires,onChange:q=>S(E,{nb_stagiaires:q.target.value})})}),s.jsx("td",{className:"p-1 text-xs text-muted-foreground",children:k.half_day||(k.start?`${k.start}-${k.end}`:"")})]},E))})]})}),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(bl,{className:"mt-2",children:[s.jsx(ne,{variant:"outline",onClick:N,children:"Annuler"}),m.length>0&&s.jsxs(ne,{onClick:T,disabled:x||R===0,children:[x?s.jsx(it,{className:"w-4 h-4 mr-2 animate-spin"}):null,"Importer ",R," intervention(s)"]})]})]})})}const iV={netypareo:"Netypareo (iCal)",google:"Google Agenda",ical:"Autre iCal / Outlook"};function F$e({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(""),[x,p]=w.useState(""),[g,v]=w.useState(!1);w.useEffect(()=>{t&&y()},[t]);const y=async()=>{l(!0);const{data:_}=await Zi.from("calendar_sync_sources").select("*").eq("trainer_profile_id",e).order("created_at",{ascending:!0});i(_||[]),l(!1)},b=async()=>{if(!x.trim()){ae.error("URL iCal requise");return}if(!/^https?:\/\//i.test(x.trim())){ae.error("URL invalide (doit commencer par http)");return}v(!0);try{const{error:_}=await Zi.from("calendar_sync_sources").insert({trainer_profile_id:e,kind:d,label:m.trim()||null,ics_url:x.trim(),active:!0});if(_)throw _;h(""),p(""),ae.success("Source ajoutée"),await y()}catch(_){console.error(_),ae.error("Erreur lors de l'ajout")}finally{v(!1)}},N=async _=>{const{error:S}=await Zi.from("calendar_sync_sources").delete().eq("id",_);if(S){ae.error("Erreur");return}ae.success("Source supprimée"),await y()},j=async()=>{u(!0);try{const{data:_,error:S}=await ce.functions.invoke("sync-calendar-feeds",{body:{}});if(S||_!=null&&_.error)throw new Error((_==null?void 0:_.error)||(S==null?void 0:S.message));ae.success(`Synchronisation terminée — ${_.imported} intervention(s) importée(s)`),await y(),n()}catch(_){console.error(_),ae.error(`Erreur de synchronisation : ${_ instanceof Error?_.message:"inconnue"}`)}finally{u(!1)}};return s.jsx(qn,{open:t,onOpenChange:r,children:s.jsxs($n,{className:"max-w-lg",children:[s.jsxs(Un,{children:[s.jsx(Vn,{children:"Synchroniser un calendrier"}),s.jsxs(Sa,{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(it,{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(_=>s.jsxs("div",{className:"flex items-center gap-2 border rounded-md p-2",children:[s.jsx(u5,{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:[_.label||iV[_.kind]||_.kind,s.jsx(Te,{variant:"outline",className:"ml-2 text-[10px]",children:iV[_.kind]||_.kind})]}),s.jsx("div",{className:"text-xs text-muted-foreground truncate",children:_.last_status?_.last_status:"jamais synchronisé"})]}),s.jsx(ne,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>N(_.id),children:s.jsx(ri,{className:"h-4 w-4"})})]},_.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(Ar,{value:d,onValueChange:f,children:[s.jsx(kr,{className:"h-9",children:s.jsx(Dr,{})}),s.jsxs(Cr,{children:[s.jsx(ct,{value:"netypareo",children:"Netypareo"}),s.jsx(ct,{value:"google",children:"Google Agenda"}),s.jsx(ct,{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(Xe,{className:"h-9",value:m,onChange:_=>h(_.target.value),placeholder:"ex: The School"})]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(We,{className:"text-xs",children:"URL iCal"}),s.jsx(Xe,{className:"h-9",value:x,onChange:_=>p(_.target.value),placeholder:"https://netypareo.monecole.fr/ical.php?token=…"})]}),s.jsxs(ne,{variant:"outline",className:"w-full",onClick:b,disabled:g,children:[g?s.jsx(it,{className:"h-4 w-4 mr-2 animate-spin"}):s.jsx(Qa,{className:"h-4 w-4 mr-2"}),"Ajouter la source"]})]}),s.jsxs(ne,{onClick:j,disabled:c||a.length===0,className:"w-full",children:[c?s.jsx(it,{className:"h-4 w-4 mr-2 animate-spin"}):s.jsx(Qs,{className:"h-4 w-4 mr-2"}),"Synchroniser maintenant"]})]})})}function M$e({items:e,trainerName:t,open:r,onOpenChange:n}){const a=new Date,[i,o]=w.useState(Dt(new Date(a.getFullYear(),a.getMonth(),1),"yyyy-MM-dd")),[l,c]=w.useState(Dt(new Date(a.getFullYear(),a.getMonth()+1,0),"yyyy-MM-dd")),[u,d]=w.useState(""),[f,m]=w.useState(""),[h,x]=w.useState(!1),p=w.useMemo(()=>{const N=new Date(`${i}T00:00:00`).getTime(),j=new Date(`${l}T23:59:59`).getTime();return e.filter(_=>_.status!=="annule"&&_.starts_at).filter(_=>{const S=new Date(_.starts_at).getTime();return S>=N&&S<=j}).filter(_=>!u.trim()||(_.client_name||"").toLowerCase().includes(u.trim().toLowerCase())).sort((_,S)=>new Date(_.starts_at).getTime()-new Date(S.starts_at).getTime())},[e,i,l,u]),g=w.useMemo(()=>Math.round(p.reduce((N,j)=>N+(j.hours??0),0)*100)/100,[p]),v=w.useMemo(()=>{if(f)return Number(f)||0;const N=p.map(j=>j.tjm).filter(j=>j!=null&&j>0);return N.length?N[0]:0},[f,p]),y=Math.round(v/7*g*100)/100,b=async()=>{if(p.length===0){ae.error("Aucune intervention sur la période");return}if(v<=0){ae.error("Renseignez un TJM");return}x(!0);try{const{jsPDF:N}=await Zd(async()=>{const{jsPDF:S}=await Promise.resolve().then(()=>F2);return{jsPDF:S}},void 0),j=new N;let _=16;j.setFontSize(16),j.setFont("helvetica","bold"),j.text("FACTURE (projet)",14,_),_+=8,j.setFontSize(10),j.setFont("helvetica","normal"),j.text(`Émetteur : ${t}`,14,_),_+=5,j.text(`Destinataire : ${u||"—"}`,14,_),_+=5,j.text(`Période : ${Dt(ml(i),"d MMM yyyy",{locale:br})} → ${Dt(ml(l),"d MMM yyyy",{locale:br})}`,14,_),_+=5,j.text(`Date d'émission : ${Dt(new Date,"d MMMM yyyy",{locale:br})}`,14,_),_+=8,j.setFont("helvetica","bold"),j.text("Date",14,_),j.text("Prestation",40,_),j.text("Heures",170,_,{align:"right"}),_+=2,j.setLineWidth(.2),j.line(14,_,196,_),_+=5,j.setFont("helvetica","normal"),j.setFontSize(9);for(const S of p){_>270&&(j.addPage(),_=16);const P=Dt(ml(S.starts_at),"dd/MM/yy"),T=`${S.subject||""}${S.client_name?` — ${S.client_name}`:""}${S.cursus?` (${S.cursus})`:""}`.slice(0,80);j.text(P,14,_),j.text(T,40,_),j.text(String(S.hours??0),196,_,{align:"right"}),_+=5}_+=2,j.line(14,_,196,_),_+=6,j.setFontSize(10),j.setFont("helvetica","bold"),j.text(`Total heures : ${g} h`,14,_),_+=6,j.text(`TJM : ${v} € — base TJM/7 × heures`,14,_),_+=6,j.setFontSize(12),j.text(`MONTANT HT : ${y.toLocaleString("fr-FR")} €`,14,_),_+=8,j.setFontSize(8),j.setFont("helvetica","italic"),j.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{x(!1)}};return s.jsx(qn,{open:r,onOpenChange:n,children:s.jsxs($n,{className:"max-w-lg",children:[s.jsxs(Un,{children:[s.jsx(Vn,{children:"Générer ma facture"}),s.jsx(Sa,{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(Xe,{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(Xe,{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(Xe,{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(Xe,{type:"number",min:"0",value:f,onChange:N=>m(N.target.value),placeholder:v?String(v):"ex: 600"})]})]}),s.jsx(Mu,{}),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:[g," h"]})]}),s.jsxs("div",{className:"flex justify-between font-semibold",children:[s.jsx("span",{children:"Montant HT estimé"}),s.jsxs("span",{children:[y.toLocaleString("fr-FR")," €"]})]})]}),s.jsxs(bl,{children:[s.jsx(ne,{variant:"outline",onClick:()=>n(!1),children:"Fermer"}),s.jsxs(ne,{onClick:b,disabled:h||p.length===0,children:[h?s.jsx(it,{className:"h-4 w-4 mr-2 animate-spin"}):s.jsx(ro,{className:"h-4 w-4 mr-2"}),"Télécharger la facture"]})]})]})})}const oV=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:""}),$$e={matin:3.5,"apres-midi":3.5,journee:7},bc="__none__";function B$e(e){const t=e.starts_at?ml(e.starts_at):new Date;return{date:Dt(t,"yyyy-MM-dd"),start:e.starts_at&&Dt(ml(e.starts_at),"HH:mm")!=="00:00"?Dt(ml(e.starts_at),"HH:mm"):"",end:e.ends_at?Dt(ml(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 D4(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 vS(e,t){if(!e)return null;const r=ml(e),[n,a,i]=t.split("-").map(Number);return new Date(n,(a||1)-1,i||1,r.getHours(),r.getMinutes(),0).toISOString()}const lV="planning-help-dismissed";function z$e(e,t){const r=D4(e.date,e.start||"00:00"),n=e.end?D4(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=xle(r,n,a)),i==null&&e.half_day&&(i=$$e[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 q$e(){const{user:e,isTrainer:t,loading:r}=Br(),n=Zt(),[a,i]=w.useState(null),[o,l]=w.useState(""),[c,u]=w.useState([]),[d,f]=w.useState(!0),[m,h]=w.useState(()=>_o(new Date)),[x,p]=w.useState("month"),[g,v]=w.useState(""),[y,b]=w.useState("all"),[N,j]=w.useState(!1),[_,S]=w.useState(!1),[P,T]=w.useState(!1),[R,k]=w.useState(!1),[E,q]=w.useState(null),[O,L]=w.useState(oV(Dt(new Date,"yyyy-MM-dd"))),[H,V]=w.useState(!1),[z,M]=w.useState(null),[B,K]=w.useState(()=>typeof window>"u"||localStorage.getItem(lV)!=="1"),C=w.useRef(!1),A=ble(T8(wE,{activationConstraint:{distance:8}}));w.useEffect(()=>{const de=Le=>{(Le.altKey||Le.key==="Alt")&&(C.current=!0)},me=Le=>{Le.key==="Alt"&&(C.current=!1)};return window.addEventListener("keydown",de),window.addEventListener("keyup",me),()=>{window.removeEventListener("keydown",de),window.removeEventListener("keyup",me)}},[]),w.useEffect(()=>{if(!r){if(!e){n("/auth");return}if(!t){n("/");return}I()}},[e,t,r]);const I=async()=>{if(e){f(!0);try{const{data:de}=await ce.from("trainer_profiles").select("id, name").eq("user_id",e.id).single();if(!de){ae.error("Profil formateur introuvable"),f(!1);return}i(de.id),l(de.name||""),await U(de.id)}catch(de){console.error(de),ae.error("Erreur lors du chargement du planning")}finally{f(!1)}}},U=async de=>{const{data:me,error:Le}=await Zi.from("trainer_interventions").select("*").eq("trainer_profile_id",de).order("starts_at",{ascending:!0});if(Le){console.error(Le),ae.error("Impossible de charger les interventions");return}u(me||[])},Y=w.useMemo(()=>{const de=g.trim().toLowerCase();return c.filter(me=>y!=="all"&&me.status!==y?!1:de?[me.client_name,me.subject,me.cursus,me.city].filter(Boolean).some(Le=>Le.toLowerCase().includes(de)):!0)},[c,g,y]),te=w.useMemo(()=>{const de=new Map;for(const me of Y){if(!me.starts_at)continue;const Le=Dt(ml(me.starts_at),"yyyy-MM-dd");(de.get(Le)??de.set(Le,[]).get(Le)).push(me)}return de},[Y]),re=w.useMemo(()=>{const de=ad(_o(m),{weekStartsOn:1}),me=ZC(l_(m),{weekStartsOn:1});return hke({start:de,end:me})},[m]),J=de=>{q(null),L(oV(Dt(de??new Date,"yyyy-MM-dd"))),j(!0)},ie=de=>{q(de),L(B$e(de)),j(!0)},be=async()=>{if(a){if(!O.date){ae.error("La date est obligatoire");return}V(!0);try{const de=z$e(O,a);if(E){const{error:me}=await Zi.from("trainer_interventions").update(de).eq("id",E.id);if(me)throw me;ae.success("Intervention mise à jour")}else{const{error:me}=await Zi.from("trainer_interventions").insert({...de,created_by:e==null?void 0:e.id,source:"manual"});if(me)throw me;dn.trackFeatureUse("planning","intervention_added"),ae.success("Intervention ajoutée")}j(!1),await U(a)}catch(de){console.error(de),ae.error("Erreur lors de l'enregistrement")}finally{V(!1)}}},Q=async de=>{if(a)try{const me={...de,series_id:de.series_id??de.id,created_by:e==null?void 0:e.id};delete me.id,delete me.created_at,delete me.updated_at;const{error:Le}=await Zi.from("trainer_interventions").insert(me);if(Le)throw Le;ae.success("Intervention dupliquée — modifiez la date du doublon"),await U(a)}catch(me){console.error(me),ae.error("Erreur lors de la duplication")}},Ve=()=>{K(!1);try{localStorage.setItem(lV,"1")}catch{}},W=async(de,me)=>{if(a)try{const Le={...de,series_id:de.series_id??de.id,created_by:e==null?void 0:e.id,starts_at:vS(de.starts_at,me)??D4(me,"00:00"),ends_at:vS(de.ends_at,me)};delete Le.id,delete Le.created_at,delete Le.updated_at;const{error:Ke}=await Zi.from("trainer_interventions").insert(Le);if(Ke)throw Ke;ae.success(`Séance dupliquée au ${Dt(ml(Le.starts_at),"d MMM",{locale:br})}`),await U(a)}catch(Le){console.error(Le),ae.error("Erreur lors de la duplication")}},Z=async(de,me)=>{if(a)try{const Le={starts_at:vS(de.starts_at,me)??D4(me,"00:00"),ends_at:vS(de.ends_at,me)},{error:Ke}=await Zi.from("trainer_interventions").update(Le).eq("id",de.id);if(Ke)throw Ke;ae.success(`Séance déplacée au ${Dt(ml(Le.starts_at),"d MMM",{locale:br})}`),await U(a)}catch(Le){console.error(Le),ae.error("Erreur lors du déplacement")}},he=de=>{M(c.find(Le=>Le.id===de.active.id)??null);const me=de.activatorEvent;me&&typeof me.altKey=="boolean"&&(C.current=me.altKey)},se=de=>{M(null);const{active:me,over:Le}=de;if(!Le)return;const Ke=c.find(_e=>_e.id===me.id);if(!Ke)return;const ve=String(Le.id);Ke.starts_at&&Dt(ml(Ke.starts_at),"yyyy-MM-dd")===ve||(C.current?Z(Ke,ve):W(Ke,ve))},oe=async de=>{if(a)try{const{error:me}=await Zi.from("trainer_interventions").delete().eq("id",de.id);if(me)throw me;ae.success("Intervention supprimée"),j(!1),await U(a)}catch(me){console.error(me),ae.error("Erreur lors de la suppression")}},le=async()=>{try{const de=await Zd(()=>Promise.resolve().then(()=>Ype),void 0),me=new Date().getFullYear(),Le=["Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre"],Ke=["Dim","Lun","Mar","Mer","Jeu","Ven","Sam"],ve=6,_e=Le.length*ve,Ue=zt=>Array(zt).fill(""),Qe=[],st=Ue(_e);st[0]=me,Qe.push(st);const Fe=Ue(_e);Le.forEach((zt,Lt)=>{Fe[Lt*ve]=zt}),Qe.push(Fe);const Ge=Ue(_e);Le.forEach((zt,Lt)=>{Ge[Lt*ve+2]="matin",Ge[Lt*ve+4]="apres-midi"}),Qe.push(Ge);for(let zt=1;zt<=31;zt++){const Lt=Ue(_e);Le.forEach((or,Yt)=>{const ot=new Date(me,Yt+1,0).getDate();zt<=ot&&(Lt[Yt*ve]=zt,Lt[Yt*ve+1]=Ke[new Date(me,Yt,zt).getDay()])}),Qe.push(Lt)}const ht=de.utils.aoa_to_sheet(Qe);ht["!cols"]=Array.from({length:_e},(zt,Lt)=>{const or=Lt%ve;return or===0?{wch:4}:or===1?{wch:5}:or===2||or===4?{wch:26}:{wch:3}});const ut=[["MODÈLE PLANNING FORMATEUR — PedagoBridge"],[""],["Comment remplir ce planning"],["• Chaque mois occupe un bloc de colonnes ; les jours sont en lignes (1 à 31)."],["• Pour chaque jour, écrivez votre intervention dans la colonne « matin » et/ou « apres-midi »."],["• Dans la cellule : la matière / le module (et si besoin l'école, le groupe, une note)."],["• Laissez vide les demi-journées sans intervention."],[""],["À l'import, PedagoBridge détecte automatiquement l'année, les mois et les demi-journées,"],["puis propose la liste des séances à vérifier avant de les ajouter à votre calendrier."],[""],["Astuce : vous pouvez aussi importer directement votre propre planning annuel."]],Mt=de.utils.aoa_to_sheet(ut);Mt["!cols"]=[{wch:90}];const Wt=de.utils.book_new();de.utils.book_append_sheet(Wt,ht,"Planning"),de.utils.book_append_sheet(Wt,Mt,"Aide"),de.writeFile(Wt,`PedagoBridge - Modele Planning ${me}.xlsx`)}catch(de){console.error(de),ae.error("Erreur lors de la génération du modèle")}},Me=de=>de.hours!=null?`${de.hours}h`:de.half_day?de.half_day:"";return r||d?s.jsx("div",{className:"min-h-screen flex items-center justify-center",children:s.jsx(it,{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:le,children:[s.jsx(ro,{className:"w-4 h-4 mr-2"}),"Modèle Excel"]}),s.jsxs(ne,{variant:"outline",onClick:()=>S(!0),disabled:!a,children:[s.jsx(lc,{className:"w-4 h-4 mr-2"}),"Importer Excel"]}),s.jsxs(ne,{variant:"outline",onClick:()=>T(!0),disabled:!a,children:[s.jsx(Qs,{className:"w-4 h-4 mr-2"}),"Synchroniser"]}),s.jsxs(ne,{variant:"outline",onClick:()=>k(!0),disabled:!a,children:[s.jsx(BR,{className:"w-4 h-4 mr-2"}),"Ma facture"]}),s.jsxs(ne,{onClick:()=>J(),children:[s.jsx(Qa,{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(Xe,{placeholder:"Rechercher (école, matière, groupe, ville)…",value:g,onChange:de=>v(de.target.value),className:"max-w-xs"}),s.jsxs(Ar,{value:y,onValueChange:b,children:[s.jsx(kr,{className:"w-44",children:s.jsx(Dr,{placeholder:"Statut"})}),s.jsxs(Cr,{children:[s.jsx(ct,{value:"all",children:"Tous les statuts"}),Object.keys(Dd).map(de=>s.jsx(ct,{value:de,children:Dd[de].label},de))]})]}),s.jsxs(Te,{variant:"outline",className:"ml-auto",children:[Y.length," intervention",Y.length>1?"s":""]})]}),B?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:Ve,className:"absolute top-2 right-2 text-muted-foreground hover:text-foreground",title:"Masquer l'aide",children:s.jsx($i,{className:"w-4 h-4"})}),s.jsxs("div",{className:"flex items-start gap-2 pr-6",children:[s.jsx(dy,{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(gx,{className:"w-3.5 h-3.5"})," Aide : comment utiliser le calendrier"]}),s.jsxs(uf,{value:x,onValueChange:p,children:[s.jsxs(fd,{className:"mb-4",children:[s.jsxs(Mn,{value:"month",children:[s.jsx(Hs,{className:"w-4 h-4 mr-2"}),"Mois"]}),s.jsxs(Mn,{value:"list",children:[s.jsx(Eye,{className:"w-4 h-4 mr-2"}),"Liste"]})]}),s.jsxs(Os,{value:"month",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>h(TCe(m)),children:s.jsx(vC,{className:"w-4 h-4"})}),s.jsx("h2",{className:"text-lg font-semibold capitalize",children:Dt(m,"MMMM yyyy",{locale:br})}),s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>h(cc(m,1)),children:s.jsx(nu,{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(de=>s.jsx("div",{children:de},de))}),s.jsxs($le,{sensors:A,onDragStart:he,onDragEnd:se,children:[s.jsx("div",{className:"grid grid-cols-7 gap-1",children:re.map(de=>{const me=Dt(de,"yyyy-MM-dd"),Le=te.get(me)??[],Ke=JC(de,m),ve=Uo(de,new Date);return s.jsxs(V$e,{id:me,className:`min-h-[92px] rounded-md border p-1 flex flex-col gap-1 ${Ke?"bg-card":"bg-muted/40"} ${ve?"ring-1 ring-primary":""}`,children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:`text-xs ${Ke?"":"text-muted-foreground"}`,children:Dt(de,"d")}),s.jsx("button",{type:"button",onClick:()=>J(de),className:"text-muted-foreground hover:text-primary",title:"Ajouter",children:s.jsx(Qa,{className:"w-3 h-3"})})]}),s.jsxs("div",{className:"flex flex-col gap-1 overflow-hidden",children:[Le.slice(0,4).map(_e=>s.jsx(U$e,{i:_e,onOpen:ie},_e.id)),Le.length>4&&s.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["+",Le.length-4," autre(s)"]})]})]},me)})}),s.jsx(Y7e,{dropAnimation:null,children:z?s.jsxs("div",{className:`text-[11px] leading-tight rounded px-1.5 py-1 border shadow-md ${Dd[z.status].className}`,children:[s.jsx("span",{className:"font-medium",children:z.client_name||"—"}),z.subject?s.jsxs("span",{className:"opacity-80",children:[" · ",z.subject]}):null]}):null})]})]}),s.jsx(Os,{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(de=>s.jsx(je,{className:"hover:shadow-sm transition-shadow",children:s.jsxs(Ee,{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:de.starts_at?Dt(ml(de.starts_at),"EEE d MMM",{locale:br}):"—"}),s.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[s.jsx($r,{className:"w-3 h-3"})," ",Me(de)]})]}),s.jsxs("div",{className:"flex-1 min-w-[180px]",children:[s.jsx("div",{className:"font-semibold",children:de.subject||"—"}),s.jsxs("div",{className:"text-sm text-muted-foreground flex flex-wrap items-center gap-x-3",children:[s.jsx("span",{children:de.client_name||"—"}),de.cursus&&s.jsxs("span",{children:["· ",de.cursus]}),de.city&&s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(Is,{className:"w-3 h-3"}),de.city]}),de.nb_stagiaires!=null&&s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(er,{className:"w-3 h-3"}),de.nb_stagiaires]})]})]}),s.jsx(Te,{variant:"outline",className:Dd[de.status].className,children:Dd[de.status].label}),s.jsxs("div",{className:"flex gap-1",children:[s.jsx(ne,{size:"icon",variant:"ghost",onClick:()=>Q(de),title:"Dupliquer",children:s.jsx(uy,{className:"w-4 h-4"})}),s.jsx(ne,{size:"sm",variant:"outline",onClick:()=>ie(de),children:"Modifier"})]})]})},de.id))})})]})]}),s.jsx(qn,{open:N,onOpenChange:j,children:s.jsxs($n,{className:"max-w-2xl max-h-[88vh] overflow-y-auto",children:[s.jsxs(Un,{children:[s.jsx(Vn,{children:E?"Modifier l'intervention":"Nouvelle intervention"}),s.jsx(Sa,{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(Pa,{label:"Date *",children:s.jsx(Xe,{type:"date",value:O.date,onChange:de=>L({...O,date:de.target.value})})}),s.jsx(Pa,{label:"Demi-journée",children:s.jsxs(Ar,{value:O.half_day||bc,onValueChange:de=>L({...O,half_day:de===bc?"":de}),children:[s.jsx(kr,{children:s.jsx(Dr,{placeholder:"—"})}),s.jsxs(Cr,{children:[s.jsx(ct,{value:bc,children:"—"}),s.jsx(ct,{value:"matin",children:"Matin"}),s.jsx(ct,{value:"apres-midi",children:"Après-midi"}),s.jsx(ct,{value:"journee",children:"Journée"})]})]})}),s.jsx(Pa,{label:"Heure début",children:s.jsx(Xe,{type:"time",value:O.start,onChange:de=>L({...O,start:de.target.value})})}),s.jsx(Pa,{label:"Heure fin",children:s.jsx(Xe,{type:"time",value:O.end,onChange:de=>L({...O,end:de.target.value})})}),s.jsx(Pa,{label:"Pause (min)",children:s.jsx(Xe,{type:"number",min:"0",value:O.break_minutes,onChange:de=>L({...O,break_minutes:de.target.value})})}),s.jsx(Pa,{label:"Heures (sinon calculé)",children:s.jsx(Xe,{type:"number",min:"0",step:"0.5",placeholder:"auto",value:O.hours,onChange:de=>L({...O,hours:de.target.value})})}),s.jsx(Pa,{label:"École / Client",children:s.jsx(Xe,{value:O.client_name,onChange:de=>L({...O,client_name:de.target.value}),placeholder:"The School"})}),s.jsx(Pa,{label:"Matière / Module",children:s.jsx(Xe,{value:O.subject,onChange:de=>L({...O,subject:de.target.value}),placeholder:"Matière / module enseigné"})}),s.jsx(Pa,{label:"Intitulé / Cursus / Groupe",children:s.jsx(Xe,{value:O.cursus,onChange:de=>L({...O,cursus:de.target.value}),placeholder:"Groupe / promo"})}),s.jsx(Pa,{label:"Nombre de stagiaires",children:s.jsx(Xe,{type:"number",min:"0",value:O.nb_stagiaires,onChange:de=>L({...O,nb_stagiaires:de.target.value})})}),s.jsx(Pa,{label:"Mode",children:s.jsxs(Ar,{value:O.mode||bc,onValueChange:de=>L({...O,mode:de===bc?"":de}),children:[s.jsx(kr,{children:s.jsx(Dr,{placeholder:"—"})}),s.jsxs(Cr,{children:[s.jsx(ct,{value:bc,children:"—"}),s.jsx(ct,{value:"presentiel",children:"Présentiel"}),s.jsx(ct,{value:"distanciel",children:"Distanciel"})]})]})}),s.jsx(Pa,{label:"Statut",children:s.jsxs(Ar,{value:O.status,onValueChange:de=>L({...O,status:de}),children:[s.jsx(kr,{children:s.jsx(Dr,{})}),s.jsx(Cr,{children:Object.keys(Dd).map(de=>s.jsx(ct,{value:de,children:Dd[de].label},de))})]})}),s.jsx(Pa,{label:"Type d'action (BPF)",children:s.jsxs(Ar,{value:O.action_type||bc,onValueChange:de=>L({...O,action_type:de===bc?"":de}),children:[s.jsx(kr,{children:s.jsx(Dr,{placeholder:"—"})}),s.jsxs(Cr,{children:[s.jsx(ct,{value:bc,children:"—"}),yMe.map(de=>s.jsx(ct,{value:de,children:de},de))]})]})}),s.jsx(Pa,{label:"Financeur (BPF)",children:s.jsxs(Ar,{value:O.funder||bc,onValueChange:de=>L({...O,funder:de===bc?"":de}),children:[s.jsx(kr,{children:s.jsx(Dr,{placeholder:"—"})}),s.jsxs(Cr,{children:[s.jsx(ct,{value:bc,children:"—"}),Yg.map(de=>s.jsx(ct,{value:de,children:de},de))]})]})}),s.jsx(Pa,{label:"Ville",children:s.jsx(Xe,{value:O.city,onChange:de=>L({...O,city:de.target.value})})}),s.jsx(Pa,{label:"Adresse",children:s.jsx(Xe,{value:O.address,onChange:de=>L({...O,address:de.target.value})})}),s.jsx(Pa,{label:"Responsable",children:s.jsx(Xe,{value:O.responsable_name,onChange:de=>L({...O,responsable_name:de.target.value})})}),s.jsx(Pa,{label:"Contact responsable",children:s.jsx(Xe,{value:O.responsable_contact,onChange:de=>L({...O,responsable_contact:de.target.value})})}),s.jsx(Pa,{label:"TJM formateur (€)",children:s.jsx(Xe,{type:"number",min:"0",value:O.tjm,onChange:de=>L({...O,tjm:de.target.value})})}),s.jsx(Pa,{label:"Tarif horaire école (€)",children:s.jsx(Xe,{type:"number",min:"0",value:O.hourly_rate_school,onChange:de=>L({...O,hourly_rate_school:de.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:vMe.map(de=>{const me=O.student_types.includes(de);return s.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[s.jsx(Yo,{checked:me,onCheckedChange:Le=>L({...O,student_types:Le?[...O.student_types,de]:O.student_types.filter(Ke=>Ke!==de)})}),de]},de)})})]}),s.jsx(Pa,{label:"Notes",children:s.jsx(gn,{value:O.notes,onChange:de=>L({...O,notes:de.target.value}),rows:2})}),s.jsxs(bl,{className:"mt-4 flex-wrap gap-2",children:[E&&s.jsxs(s.Fragment,{children:[s.jsxs(ne,{variant:"outline",onClick:()=>Q(E),children:[s.jsx(uy,{className:"w-4 h-4 mr-2"})," Dupliquer"]}),s.jsxs(Gu,{children:[s.jsx(th,{asChild:!0,children:s.jsxs(ne,{variant:"destructive",children:[s.jsx(ri,{className:"w-4 h-4 mr-2"})," Supprimer"]})}),s.jsxs(Kc,{children:[s.jsxs(Xc,{children:[s.jsx(Zc,{children:"Supprimer cette intervention ?"}),s.jsx(Jc,{children:"Action irréversible."})]}),s.jsxs(Yc,{children:[s.jsx(Ku,{children:"Annuler"}),s.jsx(Qc,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>oe(E),children:"Supprimer"})]})]})]})]}),s.jsxs(ne,{className:"ml-auto",onClick:be,disabled:H,children:[H?s.jsx(it,{className:"w-4 h-4 mr-2 animate-spin"}):null,E?"Enregistrer":"Ajouter"]})]})]})}),a&&s.jsx(L$e,{trainerId:a,open:_,onOpenChange:S,onImported:()=>U(a)}),a&&s.jsx(F$e,{trainerId:a,open:P,onOpenChange:T,onSynced:()=>U(a)}),s.jsx(M$e,{items:c,trainerName:o,open:R,onOpenChange:k})]})}function U$e({i:e,onOpen:t}){const{attributes:r,listeners:n,setNodeRef:a,isDragging:i}=Ble({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 ${Dd[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 V$e({id:e,className:t,children:r}){const{setNodeRef:n,isOver:a}=qle({id:e});return s.jsx("div",{ref:n,className:`${t??""} ${a?"ring-2 ring-primary bg-primary/10":""}`,children:r})}function Pa({label:e,children:t}){return s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(We,{className:"text-sm",children:e}),t]})}const cV=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}),QT=[{key:"identite",label:"Identité (A/B)",icon:yr},{key:"pedago",label:"Pédagogique (E/F)",icon:Na},{key:"produits",label:"Produits (C)",icon:s1},{key:"charges",label:"Charges (D)",icon:BR},{key:"recap",label:"Récapitulatif",icon:sp}],kd=e=>`${Math.round(e).toLocaleString("fr-FR")} €`;function H$e(){const{user:e,isTrainer:t,loading:r}=Br(),n=Zt(),[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),[x,p]=w.useState([]),[g,v]=w.useState(cV(new Date().getFullYear()-1)),[y,b]=w.useState({}),[N,j]=w.useState(""),[_,S]=w.useState({remuneration:"",soustraitance:"",achats:"",autres:""}),[P,T]=w.useState(null);w.useEffect(()=>{if(!r){if(!e){n("/auth");return}if(!t){n("/");return}R()}},[e,t,r]),w.useEffect(()=>{a&&k(a,m)},[m,a]);const R=async()=>{if(e){l(!0);try{const{data:B}=await ce.from("trainer_profiles").select("id").eq("user_id",e.id).single();if(!B){ae.error("Profil formateur introuvable"),l(!1);return}i(B.id);const{data:K}=await Zi.from("trainer_of_profiles").select("*").eq("trainer_profile_id",B.id).maybeSingle();K&&v({...cV(m),...K}),await k(B.id,m)}catch(B){console.error(B),ae.error("Erreur lors du chargement")}finally{l(!1)}}},k=async(B,K)=>{var Y,te,re,J;const{data:C}=await Zi.from("trainer_interventions").select("*").eq("trainer_profile_id",B).gte("starts_at",`${K}-01-01`).lte("starts_at",`${K}-12-31T23:59:59`),A=(C||[]).filter(ie=>ie.status!=="annule");p(A);const{data:I}=await Zi.from("bpf_declarations").select("manual").eq("trainer_profile_id",B).eq("year",K).maybeSingle(),U=(I==null?void 0:I.manual)??{};b(U.funders??{}),j(U.trainee_count!=null?String(U.trainee_count):""),S({remuneration:((Y=U.charges)==null?void 0:Y.remuneration)??"",soustraitance:((te=U.charges)==null?void 0:te.soustraitance)??"",achats:((re=U.charges)==null?void 0:re.achats)??"",autres:((J=U.charges)==null?void 0:J.autres)??""})},E=w.useMemo(()=>{let B=0,K=0,C=0;const A={},I={};for(const U of x){const Y=U.hours??0;B+=Y;const te=Y*(U.nb_stagiaires??0);K+=te,U.mode==="distanciel"&&(C+=Y);const re=U.action_type||"Non précisé";A[re]=A[re]||{hours:0,hs:0},A[re].hours+=Y,A[re].hs+=te;const J=Y*(U.hourly_rate_school??0);if(J>0){const ie=U.funder||"Non précisé";I[ie]=(I[ie]||0)+J}}return{sessions:x.length,totalHours:Math.round(B*100)/100,heuresStagiaires:Math.round(K),distancielHours:Math.round(C*100)/100,byAction:A,revenueByFunder:I}},[x]),q=B=>{const K=y[B];return K!=null&&K!==""?Number(K)||0:Math.round(E.revenueByFunder[B]||0)},O=w.useMemo(()=>Yg.reduce((B,K)=>B+q(K),0),[y,E]),L=(Number(_.remuneration)||0)+(Number(_.soustraitance)||0)+(Number(_.achats)||0)+(Number(_.autres)||0),H=async(B="draft")=>{if(a){u(!0);try{await Zi.from("trainer_of_profiles").upsert({trainer_profile_id:a,...g},{onConflict:"trainer_profile_id"});const K={funders:y,trainee_count:N?parseInt(N,10):null,charges:_},C={...E,totalProduits:O,totalCharges:L,produitsByFunder:Object.fromEntries(Yg.map(I=>[I,q(I)]))},{error:A}=await Zi.from("bpf_declarations").upsert({trainer_profile_id:a,year:m,status:B,manual:K,computed:C},{onConflict:"trainer_profile_id,year"});if(A)throw A;dn.trackFeatureUse("bpf","saved",{year:m,status:B}),ae.success("BPF enregistré")}catch(K){console.error(K),ae.error("Erreur lors de l'enregistrement")}finally{u(!1)}}},V=(B,K)=>{navigator.clipboard.writeText(K).then(()=>{T(B),setTimeout(()=>T(null),1500)})},z=async()=>{try{const{jsPDF:B}=await Zd(async()=>{const{jsPDF:I}=await Promise.resolve().then(()=>F2);return{jsPDF:I}},void 0),K=new B;let C=14;const A=(I,U=10,Y=!1)=>{K.setFontSize(U),K.setFont("helvetica",Y?"bold":"normal"),K.text(I,14,C),C+=U<12?6:8};A("Bilan Pédagogique et Financier — Récapitulatif",14,!0),A(`Exercice ${m} — ${g.raison_sociale||"(raison sociale)"}`,11),C+=2,A("Cadre A/B — Identité",12,!0),A(`SIRET : ${g.siret||"—"} N° NDA : ${g.nda||"—"}`),A(`Adresse : ${g.adresse||"—"} ${g.code_postal} ${g.ville}`),A(`Exercice : ${g.exercice_start} → ${g.exercice_end} Distanciel : ${g.distanciel?"Oui":"Non"}`),C+=2,A("Cadre C — Produits",12,!0),Yg.forEach(I=>q(I)>0&&A(`${I} : ${kd(q(I))}`)),A(`TOTAL produits : ${kd(O)}`,10,!0),C+=2,A("Cadre D — Charges",12,!0),A(`Rémunération formateurs : ${kd(Number(_.remuneration)||0)}`),A(`Sous-traitance : ${kd(Number(_.soustraitance)||0)}`),A(`Achats : ${kd(Number(_.achats)||0)}`),A(`Autres : ${kd(Number(_.autres)||0)}`),A(`TOTAL charges : ${kd(L)}`,10,!0),C+=2,A("Cadre E — Formateurs & heures dispensées",12,!0),A(`Formateurs : 1 (vous) Heures dispensées : ${E.totalHours} h`),C+=2,A("Cadre F — Stagiaires & heures-stagiaires",12,!0),A(`Heures-stagiaires : ${E.heuresStagiaires} Sessions : ${E.sessions}`),A(`Stagiaires (déclarés) : ${N||"—"} Dont distanciel : ${E.distancielHours} h`),Object.entries(E.byAction).forEach(([I,U])=>A(` ${I} : ${U.hours} h / ${Math.round(U.hs)} h-stagiaires`)),C+=4,K.setFontSize(8),K.setFont("helvetica","italic"),K.text("Valeurs à reporter sur Mon Activité Formation (saisie manuelle, écran par écran).",14,C),K.save(`BPF_${m}_${(g.raison_sociale||"formateur").replace(/[^a-z0-9]/gi,"_")}.pdf`)}catch(B){console.error(B),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(it,{className:"h-8 w-8 animate-spin text-primary"})});const M=({id:B,label:K,value:C})=>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:C}),s.jsx(ne,{size:"icon",variant:"ghost",className:"h-7 w-7",onClick:()=>V(B,C),children:P===B?s.jsx(Rn,{className:"h-3.5 w-3.5 text-green-600"}):s.jsx(uy,{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(Ar,{value:String(m),onValueChange:B=>h(Number(B)),children:[s.jsx(kr,{className:"w-28",children:s.jsx(Dr,{})}),s.jsx(Cr,{children:[0,1,2].map(B=>{const K=new Date().getFullYear()-B;return s.jsx(ct,{value:String(K),children:K},K)})})]})]})]}),s.jsx(je,{className:"mb-6 border-amber-200 bg-amber-50",children:s.jsxs(Ee,{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:QT.map((B,K)=>{const C=B.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(C,{className:"h-4 w-4"})," ",B.label]},B.key)})}),d===0&&s.jsxs(je,{children:[s.jsxs(mt,{children:[s.jsx(gt,{children:"Identité de l'organisme (cadres A/B)"}),s.jsx(Kr,{children:"Vos informations d'organisme de formation déclaré."})]}),s.jsxs(Ee,{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(Yo,{checked:g.is_of,onCheckedChange:B=>v({...g,is_of:!!B})}),"Je suis un organisme de formation déclaré (avec NDA)"]}),s.jsx(wc,{label:"Raison sociale",children:s.jsx(Xe,{value:g.raison_sociale,onChange:B=>v({...g,raison_sociale:B.target.value})})}),s.jsx(wc,{label:"SIRET",children:s.jsx(Xe,{value:g.siret,onChange:B=>v({...g,siret:B.target.value})})}),s.jsx(wc,{label:"N° de déclaration d'activité (NDA)",children:s.jsx(Xe,{value:g.nda,onChange:B=>v({...g,nda:B.target.value})})}),s.jsx(wc,{label:"Ville",children:s.jsx(Xe,{value:g.ville,onChange:B=>v({...g,ville:B.target.value})})}),s.jsx(wc,{label:"Adresse",children:s.jsx(Xe,{value:g.adresse,onChange:B=>v({...g,adresse:B.target.value})})}),s.jsx(wc,{label:"Code postal",children:s.jsx(Xe,{value:g.code_postal,onChange:B=>v({...g,code_postal:B.target.value})})}),s.jsx(wc,{label:"Exercice — début",children:s.jsx(Xe,{type:"date",value:g.exercice_start,onChange:B=>v({...g,exercice_start:B.target.value})})}),s.jsx(wc,{label:"Exercice — fin",children:s.jsx(Xe,{type:"date",value:g.exercice_end,onChange:B=>v({...g,exercice_end:B.target.value})})}),s.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[s.jsx(Yo,{checked:g.franchise_tva,onCheckedChange:B=>v({...g,franchise_tva:!!B})}),"Franchise en base de TVA"]}),s.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[s.jsx(Yo,{checked:g.distanciel,onCheckedChange:B=>v({...g,distanciel:!!B})}),"Activité en distanciel"]})]})]}),d===1&&s.jsxs(je,{children:[s.jsxs(mt,{children:[s.jsx(gt,{children:"Données pédagogiques (cadres E & F)"}),s.jsxs(Kr,{children:["Calculées depuis votre planning ",m," (",E.sessions," séances)."]})]}),s.jsxs(Ee,{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[s.jsx(yS,{label:"Heures dispensées",value:`${E.totalHours} h`}),s.jsx(yS,{label:"Heures-stagiaires",value:String(E.heuresStagiaires)}),s.jsx(yS,{label:"Séances",value:String(E.sessions)}),s.jsx(yS,{label:"Dont distanciel",value:`${E.distancielHours} h`})]}),s.jsxs("div",{children:[s.jsx(We,{className:"text-sm",children:"Nombre de stagiaires (à déclarer)"}),s.jsx(Xe,{className:"max-w-xs mt-1",type:"number",min:"0",value:N,onChange:B=>j(B.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(Mu,{}),s.jsxs("div",{children:[s.jsx(We,{className:"text-sm mb-2 block",children:"Par type d'action"}),Object.entries(E.byAction).map(([B,K])=>s.jsxs("div",{className:"flex justify-between text-sm py-1 border-b last:border-0",children:[s.jsx("span",{children:B}),s.jsxs("span",{className:"text-muted-foreground",children:[K.hours," h · ",Math.round(K.hs)," h-stagiaires"]})]},B))]})]})]}),d===2&&s.jsxs(je,{children:[s.jsxs(mt,{children:[s.jsx(gt,{children:"Produits par financeur (cadre C)"}),s.jsx(Kr,{children:"Préremplis (heures × tarif horaire école) ; ajustez ou complétez à la main."})]}),s.jsxs(Ee,{className:"space-y-2",children:[Yg.map(B=>s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsx("span",{className:"text-sm",children:B}),s.jsxs("div",{className:"flex items-center gap-2",children:[E.revenueByFunder[B]>0&&s.jsxs("span",{className:"text-xs text-muted-foreground",children:["calculé ",kd(E.revenueByFunder[B])]}),s.jsx(Xe,{type:"number",min:"0",className:"w-36",value:y[B]??(E.revenueByFunder[B]?String(Math.round(E.revenueByFunder[B])):""),onChange:K=>b({...y,[B]:K.target.value})})]})]},B)),s.jsx(Mu,{}),s.jsxs("div",{className:"flex justify-between font-semibold pt-1",children:[s.jsx("span",{children:"Total produits"}),s.jsx("span",{children:kd(O)})]})]})]}),d===3&&s.jsxs(je,{children:[s.jsxs(mt,{children:[s.jsx(gt,{children:"Charges (cadre D)"}),s.jsx(Kr,{children:"Saisie manuelle."})]}),s.jsxs(Ee,{className:"grid sm:grid-cols-2 gap-4",children:[s.jsx(wc,{label:"Rémunération des formateurs (€)",children:s.jsx(Xe,{type:"number",value:_.remuneration,onChange:B=>S({..._,remuneration:B.target.value})})}),s.jsx(wc,{label:"Sous-traitance (€)",children:s.jsx(Xe,{type:"number",value:_.soustraitance,onChange:B=>S({..._,soustraitance:B.target.value})})}),s.jsx(wc,{label:"Achats / fournitures (€)",children:s.jsx(Xe,{type:"number",value:_.achats,onChange:B=>S({..._,achats:B.target.value})})}),s.jsx(wc,{label:"Autres charges (€)",children:s.jsx(Xe,{type:"number",value:_.autres,onChange:B=>S({..._,autres:B.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:kd(L)})]})]})]}),d===4&&s.jsxs(je,{children:[s.jsxs(mt,{children:[s.jsx(gt,{children:"Récapitulatif — à reporter sur Mon Activité Formation"}),s.jsx(Kr,{children:"Copiez chaque valeur dans l'écran correspondant du portail MAF."})]}),s.jsxs(Ee,{className:"space-y-5",children:[s.jsxs("section",{children:[s.jsx(Te,{variant:"outline",className:"mb-2",children:"Cadre C — Produits"}),Yg.filter(B=>q(B)>0).map(B=>s.jsx(M,{id:`c-${B}`,label:B,value:String(q(B))},B)),s.jsx(M,{id:"c-total",label:"Total produits",value:String(O)})]}),s.jsxs("section",{children:[s.jsx(Te,{variant:"outline",className:"mb-2",children:"Cadre E/F — Pédagogique"}),s.jsx(M,{id:"hours",label:"Heures dispensées",value:String(E.totalHours)}),s.jsx(M,{id:"hs",label:"Heures-stagiaires",value:String(E.heuresStagiaires)}),s.jsx(M,{id:"trainees",label:"Nombre de stagiaires",value:N||"—"}),s.jsx(M,{id:"dist",label:"Heures distanciel",value:String(E.distancielHours)})]}),s.jsxs("section",{children:[s.jsx(Te,{variant:"outline",className:"mb-2",children:"Cadre D — Charges"}),s.jsx(M,{id:"charges",label:"Total charges",value:String(L)})]}),s.jsxs("div",{className:"flex gap-2 pt-2",children:[s.jsxs(ne,{onClick:z,variant:"outline",children:[s.jsx(ro,{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(it,{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(vC,{className:"h-4 w-4 mr-1"}),"Précédent"]}),s.jsxs(ne,{variant:"ghost",onClick:()=>H("draft"),disabled:c,children:[c?s.jsx(it,{className:"h-4 w-4 mr-2 animate-spin"}):null,"Enregistrer le brouillon"]}),s.jsxs(ne,{onClick:()=>f(Math.min(QT.length-1,d+1)),disabled:d===QT.length-1,children:["Suivant",s.jsx(nu,{className:"h-4 w-4 ml-1"})]})]})]})})}function wc({label:e,children:t}){return s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(We,{className:"text-sm",children:e}),t]})}function yS({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 W$e="mailto:contact@qalamsoftware.com?subject=",G$e=[{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:`${W$e}Demande sur-mesure`}}];function K$e(){const{user:e}=Br(),t=Zt(),[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 ce.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(Te,{variant:"outline",className:"mb-3",children:[s.jsx(mh,{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:G$e.map(i=>s.jsxs(je,{className:i.highlight?"border-primary shadow-lg relative":"",children:[i.highlight&&s.jsx(Te,{className:"absolute -top-3 left-1/2 -translate-x-1/2",children:"Populaire"}),s.jsxs(mt,{children:[s.jsx(gt,{children:i.name}),s.jsxs(Kr,{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(Ee,{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(Rn,{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(nt,{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(_n,{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(it,{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(nt,{to:"/feedback",className:"text-primary hover:underline",children:"Envoyez-nous un retour"}),"."]})]})})}const eP="mailto:contact@qalamsoftware.com?subject=",X$e=[{icon:$R,title:"Envoyez-nous vos recommandations",desc:"Une idée pour améliorer la plateforme ? Dites-nous tout.",href:`${eP}Recommandation PedagoBridge`,label:"Proposer une idée"},{icon:lye,title:"Signalez un bug",desc:"Quelque chose ne fonctionne pas comme prévu ? Signalez-le.",href:`${eP}Signalement de bug`,label:"Signaler un bug"},{icon:Tye,title:"Demandez-nous quelque chose",desc:"Une question, une demande particulière ? Écrivez-nous.",href:`${eP}Demande PedagoBridge`,label:"Poser une question"}];function Y$e(){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:X$e.map(e=>{const t=e.icon;return s.jsx(je,{className:"hover:shadow-md transition-shadow",children:s.jsxs(mt,{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(gt,{className:"text-lg",children:e.title}),s.jsx(Kr,{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(Kn,{className:"h-4 w-4 mr-2"}),"Visiter pedagobridge.com"]})})})]})})}const tP=10,Z$e=59;function Qle(){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 ce.auth.getUser();if(!d){i(!0),n(!1);return}const{data:f}=await ce.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:x}=await ce.from("school_requests").select("id",{count:"exact"}).eq("user_id",d.id).in("status",["pending","approved"]);if(x)throw x;const p=(h==null?void 0:h.length)||0;t(p),i(p<tP)}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:tP,pricePerPublication:Z$e,remainingFree:o?1/0:Math.max(0,tP-e),isAffiliated:o}}function ece({publicationCount:e,pricePerPublication:t}){const r=()=>{window.location.href=`mailto:contact@qalamsoftware.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(je,{className:"border-destructive/50 bg-destructive/5",children:[s.jsxs(mt,{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Li,{className:"h-6 w-6 text-destructive"}),s.jsx(gt,{className:"text-destructive",children:"Paiement requis"})]}),s.jsx(Kr,{children:"Vous avez atteint la limite de 2 publications gratuites"})]}),s.jsxs(Ee,{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(_n,{className:"mr-2 h-4 w-4"}),"Contacter pour payer"]}),s.jsxs(ne,{variant:"outline",className:"flex-1",disabled:!0,children:[s.jsx(gye,{className:"mr-2 h-4 w-4"}),"Paiement en ligne (bientôt)"]})]})]})]})}const J$e=G0({schoolName:yn().min(2,"doit contenir au moins 2 caractères"),contactName:yn().min(2,"doit contenir au moins 2 caractères"),contactEmail:yn().email("doit être un email valide"),additionalNotes:yn().optional(),city:yn().optional(),address:yn().optional(),contactPhone:yn().optional(),contactPosition:yn().optional()}),Q$e={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"},eBe=["Syllabus","Description du besoin","Planning","Cahier des charges","Autre"];function tBe(){const e=Zt(),{user:t,isSchool:r}=Br(),[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:x}=Qle(),[p,g]=w.useState(!1),[v,y]=w.useState(null),[b,N]=w.useState(null),[j,_]=w.useState(null),[S,P]=w.useState("school"),[T,R]=w.useState(""),[k,E]=w.useState(""),[q,O]=w.useState(""),[L,H]=w.useState(""),[V,z]=w.useState(""),[M,B]=w.useState(""),[K,C]=w.useState(""),[A,I]=w.useState([]),[U,Y]=w.useState(""),[te,re]=w.useState(""),[J,ie]=w.useState([]),[be,Q]=w.useState(""),[Ve,W]=w.useState(null),[Z,he]=w.useState(!1);w.useEffect(()=>{const Fe=new URLSearchParams(window.location.search),Ge=Fe.get("from_trainer"),ht=Fe.get("trainer_name"),ut=Fe.get("type"),Mt=Fe.get("source");(ut==="company"||ut==="school")&&P(ut),Mt&&_(Mt),Ge&&(y(Ge),ht&&N(decodeURIComponent(ht))),(Ge||ut||Mt)&&window.history.replaceState({},"","/training-request")},[]),w.useEffect(()=>{(async()=>{if(!(!t||!r))try{const{data:Ge,error:ht}=await ce.from("school_profiles").select("*").eq("user_id",t.id).single();if(ht||!Ge)return;he(Ge.can_auto_publish||!1),Ge.name&&R(Ge.name),Ge.address&&O(Ge.address),Ge.contact_name&&H(Ge.contact_name),Ge.contact_email&&z(Ge.contact_email),Ge.contact_phone&&B(Ge.contact_phone),!Ge.contact_email&&t.email&&z(t.email)}catch(Ge){console.error("Error fetching school profile:",Ge)}})()},[t,r]),w.useEffect(()=>{if(new URLSearchParams(window.location.search).get("source")==="linkedin"){const Ge=sessionStorage.getItem("linkedInOfferData");if(Ge)try{const ht=JSON.parse(Ge);if(ht.school_name&&R(ht.school_name),ht.city&&E(ht.city),ht.description&&re(ht.description),ht.contact_name&&H(ht.contact_name),ht.contact_email&&z(ht.contact_email),ht.subject_areas&&Array.isArray(ht.subject_areas)){const ut=ht.subject_areas.map((Mt,Wt)=>({id:`imported-${Wt}-${Date.now()}`,name:Mt,expanded:!0,startDate:Wt===0?ht.start_date:void 0,endDate:Wt===0?ht.end_date:void 0,durationHours:Wt===0&&ht.duration_hours?ht.duration_hours.toString():void 0,modality:ht.modality||"presentiel",visibility:"public",documents:[]}));I(ut)}g(!0),sessionStorage.removeItem("linkedInOfferData"),ae.success("Données LinkedIn importées !",{duration:3e3})}catch(ht){console.error("Error parsing LinkedIn data:",ht)}window.history.replaceState({},"","/training-request")}},[]);const se=()=>({schoolName:T,contactName:L,contactEmail:V,additionalNotes:te,city:k,address:q,contactPhone:M,contactPosition:K}),{getFieldError:oe,validateAll:le,handleBlur:Me,clearFieldError:de}=YL({schema:J$e,fieldLabels:Q$e}),me=Fe=>{Me(Fe,se()[Fe],se())},Le=()=>{if(U.trim()&&!A.some(Fe=>Fe.name===U.trim())){const Fe=A[A.length-1],Ge={id:`need-${Date.now()}`,name:U.trim(),expanded:!0,modality:(Fe==null?void 0:Fe.modality)||"presentiel",visibility:(Fe==null?void 0:Fe.visibility)||"public",documents:[]};I([...A,Ge]),Y("")}},Ke=Fe=>{I(A.filter(Ge=>Ge.id!==Fe))},ve=(Fe,Ge)=>{I(A.map(ht=>ht.id===Fe?{...ht,...Ge}:ht))},_e=Fe=>{I(A.map(Ge=>Ge.id===Fe?{...Ge,expanded:!Ge.expanded}:Ge))},Ue=(Fe,Ge)=>{I(A.map(ht=>ht.id===Fe?{...ht,documents:[...ht.documents,Ge]}:ht))},Qe=(Fe,Ge)=>{I(A.map(ht=>ht.id===Fe?{...ht,documents:ht.documents.filter((ut,Mt)=>Mt!==Ge)}:ht))},st=async Fe=>{if(Fe.preventDefault(),!le(se())){ae.error("Veuillez corriger les champs en erreur");return}let Ge=[...A];if(U.trim()&&!A.some(ht=>ht.name===U.trim())&&Ge.push({id:`need-${Date.now()}`,name:U.trim(),expanded:!1,documents:[]}),Ge.length===0){ae.error("Ajoutez au moins un besoin en formation");return}for(const ht of Ge)if(!ht.startDate||!ht.endDate||!ht.durationHours){ae.error(`Veuillez compléter les détails obligatoires pour "${ht.name}" (dates et durée)`);return}a(!0);try{const ht=[];for(const Et of Ge)for(const Ct of Et.documents)if(Ct.file){const hr=`${Date.now()}-${Ct.file.name}`,{data:Gt,error:Jt}=await ce.storage.from("school-attachments").upload(hr,Ct.file);if(Jt)throw Jt;const{data:{publicUrl:mr}}=ce.storage.from("school-attachments").getPublicUrl(Gt.path);ht.push({type:Ct.type,name:Ct.name,url:mr,needName:Et.name})}for(const Et of J)if(Et.file){const Ct=`${Date.now()}-${Et.file.name}`,{data:hr,error:Gt}=await ce.storage.from("school-attachments").upload(Ct,Et.file);if(Gt)throw Gt;const{data:{publicUrl:Jt}}=ce.storage.from("school-attachments").getPublicUrl(hr.path);ht.push({type:Et.type,name:Et.name,url:Jt})}const ut=Ge[0],Mt=(ut==null?void 0:ut.startDate)||null,Wt=(ut==null?void 0:ut.endDate)||null,zt=ut!=null&&ut.durationHours?parseInt(ut.durationHours):null,Lt=ut!=null&&ut.tjmOffered?parseFloat(ut.tjmOffered):null,or=(ut==null?void 0:ut.modality)||"presentiel",Yt=(ut==null?void 0:ut.visibility)||"public",ot=v?`Demande initiée depuis le profil du formateur: ${b||v}`:null,{error:fr}=await ce.from("school_requests").insert({school_name:T.trim(),city:k.trim()||null,address:q.trim()||null,modality:or,contact_name:L.trim(),contact_email:V.trim(),contact_phone:M.trim()||null,contact_position:K.trim()||null,training_needs:Ge.map(Et=>Et.name),subject_areas:Ge.map(Et=>Et.name),start_date:Mt,end_date:Wt,duration_hours:zt,num_trainers:1,tjm_offered:Lt,description:te.trim()||`Besoins en formation : ${Ge.map(Et=>Et.name).join(", ")}`,documents:ht,status:r&&t&&Z?"approved":"pending",user_id:r&&t?t.id:null,notes:ot,visibility:Yt,source:j??(S==="company"?"entreprise":null)});if(fr)throw fr;r&&t&&Z?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 ce.functions.invoke("notify-school-request",{body:{schoolName:T.trim(),contactName:L.trim(),contactEmail:V.trim(),contactPhone:M.trim()||void 0,contactPosition:K.trim()||void 0,trainingNeeds:Ge.map(Et=>Et.name),startDate:Mt||void 0,endDate:Wt||void 0,durationHours:zt||void 0,description:te.trim()||void 0}})}catch(Et){console.error("Error sending notification email:",Et)}dn.trackOfferCreated(void 0,{autoPublished:!!(r&&t&&Z),loggedIn:!!t}),c(V.trim()),o(!0),ae.success("Demande envoyée avec succès !")}catch(ht){console.error("Error submitting request:",ht),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(je,{className:"w-full max-w-md text-center",children:s.jsxs(Ee,{className:"pt-12 pb-8",children:[s.jsx(Zn,{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(rd,{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(rd,{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(it,{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(nr,{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(Hn,{className:"mr-2 h-4 w-4"}),"Retour à l'accueil"]}),h>0&&d>0&&s.jsx(je,{className:"mb-6 border-primary/20 bg-primary/5",children:s.jsx(Ee,{className:"py-4",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Li,{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 ",x,". Au-delà, chaque publication coûte ",m,"€."]})]})})}),!u&&s.jsx("div",{className:"mb-6",children:s.jsx(ece,{publicationCount:d,pricePerPublication:m})}),s.jsxs(je,{className:u?"":"opacity-50 pointer-events-none",children:[s.jsx(mt,{children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx(gt,{className:"text-3xl",children:"Demande de Formation"}),s.jsx(Kr,{children:"Décrivez vos besoins en formation et nous vous contacterons rapidement"})]}),p&&s.jsxs(Te,{variant:"secondary",className:"flex items-center gap-1 bg-[#0077B5]/10 text-[#0077B5] border-[#0077B5]/20",children:[s.jsx(Bu,{className:"h-3 w-3"}),"Importé depuis LinkedIn"]})]})}),s.jsx(Ee,{children:s.jsxs("form",{onSubmit:st,className:"space-y-6",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsx(We,{children:"Type d'organisation *"}),s.jsxs(Wx,{value:S,onValueChange:Fe=>P(Fe),className:"flex gap-4",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(qo,{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(qo,{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:S==="school"?"Informations de l'établissement":"Informations de l'entreprise"}),s.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[s.jsx(Yi,{id:"schoolName",label:S==="school"?"Nom de l'établissement":"Nom de l'entreprise",value:T,onChange:Fe=>{R(Fe.target.value),de("schoolName")},onFieldBlur:()=>me("schoolName"),placeholder:S==="school"?"Lycée Victor Hugo":"Société ABC",required:!0,error:oe("schoolName")}),s.jsx(Yi,{id:"city",label:"Ville",value:k,onChange:Fe=>{E(Fe.target.value),de("city")},onFieldBlur:()=>me("city"),placeholder:"Paris, Lyon, Marseille...",error:oe("city")})]}),s.jsx(Yi,{id:"address",label:"Adresse de l'établissement",value:q,onChange:Fe=>{O(Fe.target.value),de("address")},onFieldBlur:()=>me("address"),placeholder:"123 rue de l'École, 75001 Paris",error:oe("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(Yi,{id:"contactName",label:"Nom du contact",value:L,onChange:Fe=>{H(Fe.target.value),de("contactName")},onFieldBlur:()=>me("contactName"),placeholder:"Jean Dupont",required:!0,error:oe("contactName")}),s.jsx(Yi,{id:"contactPosition",label:"Poste",value:K,onChange:Fe=>C(Fe.target.value),placeholder:S==="school"?"Directeur pédagogique":"Responsable RH / Formation"})]}),s.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[s.jsx(Yi,{id:"contactEmail",type:"email",label:"Email",value:V,onChange:Fe=>{z(Fe.target.value),de("contactEmail")},onFieldBlur:()=>me("contactEmail"),placeholder:"jean.dupont@lycee.fr",required:!0,error:oe("contactEmail")}),s.jsx(Yi,{id:"contactPhone",type:"tel",label:"Téléphone",value:M,onChange:Fe=>B(Fe.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:S==="school"?"Besoins en formation *":"Objectifs de formation *"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:S==="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(Xe,{value:U,onChange:Fe=>Y(Fe.target.value),onKeyPress:Fe=>{Fe.key==="Enter"&&(Fe.preventDefault(),Le())},placeholder:S==="school"?"Ex: Formation en mathématiques appliquées":"Ex: Leadership et management d'équipe"}),s.jsxs(ne,{type:"button",onClick:Le,variant:"secondary",className:"shrink-0",children:[s.jsx(Qa,{className:"h-4 w-4 mr-1"}),"Ajouter"]})]}),A.length>0&&s.jsx("div",{className:"space-y-3",children:A.map(Fe=>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:Fe.name}),!Fe.expanded&&(Fe.startDate||Fe.durationHours||Fe.modality)&&s.jsxs("div",{className:"flex flex-wrap gap-2 mt-1",children:[Fe.startDate&&Fe.endDate&&s.jsxs(Te,{variant:"outline",className:"text-xs font-normal",children:[new Date(Fe.startDate).toLocaleDateString("fr-FR",{day:"numeric",month:"short"})," - ",new Date(Fe.endDate).toLocaleDateString("fr-FR",{day:"numeric",month:"short",year:"numeric"})]}),Fe.durationHours&&s.jsxs(Te,{variant:"outline",className:"text-xs font-normal",children:[Fe.durationHours,"h"]}),Fe.modality&&s.jsx(Te,{variant:"secondary",className:"text-xs font-normal",children:Fe.modality==="presentiel"?"Présentiel":Fe.modality==="distanciel"?"Distanciel":"Hybride"}),Fe.tjmOffered&&s.jsxs(Te,{variant:"outline",className:"text-xs font-normal",children:[Fe.tjmOffered,"€/jour"]}),Fe.visibility==="platform_only"&&s.jsx(Te,{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:()=>_e(Fe.id),className:"h-8 px-2",children:[s.jsx(Qa,{className:`h-4 w-4 transition-transform ${Fe.expanded?"rotate-45":""}`}),s.jsx("span",{className:"ml-1 text-xs",children:"Détails"}),s.jsx(Qu,{className:`ml-1 h-3 w-3 transition-transform ${Fe.expanded?"rotate-180":""}`})]}),s.jsx(ne,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>Ke(Fe.id),children:s.jsx($i,{className:"h-4 w-4 text-destructive"})})]})]}),Fe.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(Wx,{value:Fe.modality||"presentiel",onValueChange:Ge=>ve(Fe.id,{modality:Ge}),className:"flex flex-wrap gap-3",children:[s.jsxs("div",{className:"flex items-center space-x-1",children:[s.jsx(qo,{value:"presentiel",id:`modality-presentiel-${Fe.id}`,className:"h-3 w-3"}),s.jsx(We,{htmlFor:`modality-presentiel-${Fe.id}`,className:"cursor-pointer font-normal text-xs",children:"Présentiel"})]}),s.jsxs("div",{className:"flex items-center space-x-1",children:[s.jsx(qo,{value:"distanciel",id:`modality-distanciel-${Fe.id}`,className:"h-3 w-3"}),s.jsx(We,{htmlFor:`modality-distanciel-${Fe.id}`,className:"cursor-pointer font-normal text-xs",children:"Distanciel"})]}),s.jsxs("div",{className:"flex items-center space-x-1",children:[s.jsx(qo,{value:"hybride",id:`modality-hybride-${Fe.id}`,className:"h-3 w-3"}),s.jsx(We,{htmlFor:`modality-hybride-${Fe.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(Wx,{value:Fe.visibility||"public",onValueChange:Ge=>ve(Fe.id,{visibility:Ge}),className:"flex flex-wrap gap-3",children:[s.jsxs("div",{className:"flex items-center space-x-1",children:[s.jsx(qo,{value:"public",id:`visibility-public-${Fe.id}`,className:"h-3 w-3"}),s.jsx(We,{htmlFor:`visibility-public-${Fe.id}`,className:"cursor-pointer font-normal text-xs",children:"Publique"})]}),s.jsxs("div",{className:"flex items-center space-x-1",children:[s.jsx(qo,{value:"platform_only",id:`visibility-platform-${Fe.id}`,className:"h-3 w-3"}),s.jsx(We,{htmlFor:`visibility-platform-${Fe.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(Xe,{type:"date",value:Fe.startDate||"",onChange:Ge=>ve(Fe.id,{startDate:Ge.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(Xe,{type:"date",value:Fe.endDate||"",onChange:Ge=>ve(Fe.id,{endDate:Ge.target.value}),min:Fe.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(Xe,{type:"number",min:"1",value:Fe.durationHours||"",onChange:Ge=>ve(Fe.id,{durationHours:Ge.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(Xe,{type:"number",min:"0",step:"10",value:Fe.tjmOffered||"",onChange:Ge=>ve(Fe.id,{tjmOffered:Ge.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(Ar,{value:be,onValueChange:Q,children:[s.jsx(kr,{className:"bg-background h-9 flex-1",children:s.jsx(Dr,{placeholder:"Type"})}),s.jsx(Cr,{className:"bg-popover z-50",children:eBe.map(Ge=>s.jsx(ct,{value:Ge,children:Ge},Ge))})]}),s.jsx(Xe,{type:"file",onChange:Ge=>{var ut;const ht=(ut=Ge.target.files)==null?void 0:ut[0];if(ht&&be){if(ht.size>10*1024*1024){ae.error("Le fichier ne doit pas dépasser 10 Mo");return}Ue(Fe.id,{type:be,name:ht.name,url:"",file:ht}),Q(""),Ge.target.value=""}else be||ae.error("Sélectionnez d'abord un type de document")},accept:".pdf,.doc,.docx,.xls,.xlsx,.txt",className:"h-9 flex-1"})]}),Fe.documents.length>0&&s.jsx("div",{className:"space-y-1",children:Fe.documents.map((Ge,ht)=>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(Kt,{className:"h-4 w-4 text-muted-foreground"}),s.jsxs("span",{children:[Ge.type,": ",Ge.name]})]}),s.jsx(ne,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>Qe(Fe.id,ht),children:s.jsx($i,{className:"h-3 w-3"})})]},ht))})]})]})]},Fe.id))})]}),s.jsx(sE,{id:"additionalNotes",label:"Autre chose à nous dire ?",value:te,onChange:Fe=>{re(Fe.target.value),de("additionalNotes")},onFieldBlur:()=>me("additionalNotes"),placeholder:"Informations complémentaires, contraintes particulières, questions...",rows:4,error:oe("additionalNotes")}),s.jsx(ne,{type:"submit",className:"w-full",size:"lg",disabled:n,children:n?s.jsxs(s.Fragment,{children:[s.jsx(it,{className:"mr-2 h-5 w-5 animate-spin"}),"Envoi en cours..."]}):"Envoyer la demande"})]})})]})]})]})}function rBe(e,t){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const nBe=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,sBe=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,aBe={};function uV(e,t){return(aBe.jsx?sBe:nBe).test(e)}const iBe=/[ \t\n\f\r]/g;function oBe(e){return typeof e=="object"?e.type==="text"?dV(e.value):!1:dV(e)}function dV(e){return e.replace(iBe,"")===""}class y_{constructor(t,r,n){this.normal=r,this.property=t,n&&(this.space=n)}}y_.prototype.normal={};y_.prototype.property={};y_.prototype.space=void 0;function tce(e,t){const r={},n={};for(const a of e)Object.assign(r,a.property),Object.assign(n,a.normal);return new y_(r,n,t)}function I8(e){return e.toLowerCase()}class Cl{constructor(t,r){this.attribute=r,this.property=t}}Cl.prototype.attribute="";Cl.prototype.booleanish=!1;Cl.prototype.boolean=!1;Cl.prototype.commaOrSpaceSeparated=!1;Cl.prototype.commaSeparated=!1;Cl.prototype.defined=!1;Cl.prototype.mustUseProperty=!1;Cl.prototype.number=!1;Cl.prototype.overloadedBoolean=!1;Cl.prototype.property="";Cl.prototype.spaceSeparated=!1;Cl.prototype.space=void 0;let lBe=0;const cn=Y0(),Ha=Y0(),R8=Y0(),It=Y0(),ks=Y0(),Lv=Y0(),Ml=Y0();function Y0(){return 2**++lBe}const L8=Object.freeze(Object.defineProperty({__proto__:null,boolean:cn,booleanish:Ha,commaOrSpaceSeparated:Ml,commaSeparated:Lv,number:It,overloadedBoolean:R8,spaceSeparated:ks},Symbol.toStringTag,{value:"Module"})),rP=Object.keys(L8);class TF extends Cl{constructor(t,r,n,a){let i=-1;if(super(t,r),fV(this,"space",a),typeof n=="number")for(;++i<rP.length;){const o=rP[i];fV(this,rP[i],(n&L8[o])===L8[o])}}}TF.prototype.defined=!0;function fV(e,t,r){r&&(e[t]=r)}function k1(e){const t={},r={};for(const[n,a]of Object.entries(e.properties)){const i=new TF(n,e.transform(e.attributes||{},n),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(n)&&(i.mustUseProperty=!0),t[n]=i,r[I8(n)]=n,r[I8(i.attribute)]=n}return new y_(t,r,e.space)}const rce=k1({properties:{ariaActiveDescendant:null,ariaAtomic:Ha,ariaAutoComplete:null,ariaBusy:Ha,ariaChecked:Ha,ariaColCount:It,ariaColIndex:It,ariaColSpan:It,ariaControls:ks,ariaCurrent:null,ariaDescribedBy:ks,ariaDetails:null,ariaDisabled:Ha,ariaDropEffect:ks,ariaErrorMessage:null,ariaExpanded:Ha,ariaFlowTo:ks,ariaGrabbed:Ha,ariaHasPopup:null,ariaHidden:Ha,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ks,ariaLevel:It,ariaLive:null,ariaModal:Ha,ariaMultiLine:Ha,ariaMultiSelectable:Ha,ariaOrientation:null,ariaOwns:ks,ariaPlaceholder:null,ariaPosInSet:It,ariaPressed:Ha,ariaReadOnly:Ha,ariaRelevant:null,ariaRequired:Ha,ariaRoleDescription:ks,ariaRowCount:It,ariaRowIndex:It,ariaRowSpan:It,ariaSelected:Ha,ariaSetSize:It,ariaSort:null,ariaValueMax:It,ariaValueMin:It,ariaValueNow:It,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function nce(e,t){return t in e?e[t]:t}function sce(e,t){return nce(e,t.toLowerCase())}const cBe=k1({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Lv,acceptCharset:ks,accessKey:ks,action:null,allow:null,allowFullScreen:cn,allowPaymentRequest:cn,allowUserMedia:cn,alt:null,as:null,async:cn,autoCapitalize:null,autoComplete:ks,autoFocus:cn,autoPlay:cn,blocking:ks,capture:null,charSet:null,checked:cn,cite:null,className:ks,cols:It,colSpan:null,content:null,contentEditable:Ha,controls:cn,controlsList:ks,coords:It|Lv,crossOrigin:null,data:null,dateTime:null,decoding:null,default:cn,defer:cn,dir:null,dirName:null,disabled:cn,download:R8,draggable:Ha,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:cn,formTarget:null,headers:ks,height:It,hidden:R8,high:It,href:null,hrefLang:null,htmlFor:ks,httpEquiv:ks,id:null,imageSizes:null,imageSrcSet:null,inert:cn,inputMode:null,integrity:null,is:null,isMap:cn,itemId:null,itemProp:ks,itemRef:ks,itemScope:cn,itemType:ks,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:cn,low:It,manifest:null,max:null,maxLength:It,media:null,method:null,min:null,minLength:It,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:It,pattern:null,ping:ks,placeholder:null,playsInline:cn,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:cn,referrerPolicy:null,rel:ks,required:cn,reversed:cn,rows:It,rowSpan:It,sandbox:ks,scope:null,scoped:cn,seamless:cn,selected:cn,shadowRootClonable:cn,shadowRootDelegatesFocus:cn,shadowRootMode:null,shape:null,size:It,sizes:null,slot:null,span:It,spellCheck:Ha,src:null,srcDoc:null,srcLang:null,srcSet:null,start:It,step:null,style:null,tabIndex:It,target:null,title:null,translate:null,type:null,typeMustMatch:cn,useMap:null,value:Ha,width:It,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ks,axis:null,background:null,bgColor:null,border:It,borderColor:null,bottomMargin:It,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:It,leftMargin:It,link:null,longDesc:null,lowSrc:null,marginHeight:It,marginWidth:It,noResize:cn,noHref:cn,noShade:cn,noWrap:cn,object:null,profile:null,prompt:null,rev:null,rightMargin:It,rules:null,scheme:null,scrolling:Ha,standby:null,summary:null,text:null,topMargin:It,valueType:null,version:null,vAlign:null,vLink:null,vSpace:It,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:cn,disableRemotePlayback:cn,prefix:null,property:null,results:It,security:null,unselectable:null},space:"html",transform:sce}),uBe=k1({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:Ml,accentHeight:It,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:It,amplitude:It,arabicForm:null,ascent:It,attributeName:null,attributeType:null,azimuth:It,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:It,by:null,calcMode:null,capHeight:It,className:ks,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:It,diffuseConstant:It,direction:null,display:null,dur:null,divisor:It,dominantBaseline:null,download:cn,dx:null,dy:null,edgeMode:null,editable:null,elevation:It,enableBackground:null,end:null,event:null,exponent:It,externalResourcesRequired:null,fill:null,fillOpacity:It,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:Lv,g2:Lv,glyphName:Lv,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:It,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:It,horizOriginX:It,horizOriginY:It,id:null,ideographic:It,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:It,k:It,k1:It,k2:It,k3:It,k4:It,kernelMatrix:Ml,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:It,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:It,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:It,overlineThickness:It,paintOrder:null,panose1:null,path:null,pathLength:It,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ks,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:It,pointsAtY:It,pointsAtZ:It,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ml,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ml,rev:Ml,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ml,requiredFeatures:Ml,requiredFonts:Ml,requiredFormats:Ml,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:It,specularExponent:It,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:It,strikethroughThickness:It,string:null,stroke:null,strokeDashArray:Ml,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:It,strokeOpacity:It,strokeWidth:null,style:null,surfaceScale:It,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ml,tabIndex:It,tableValues:null,target:null,targetX:It,targetY:It,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ml,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:It,underlineThickness:It,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:It,values:null,vAlphabetic:It,vMathematical:It,vectorEffect:null,vHanging:It,vIdeographic:It,version:null,vertAdvY:It,vertOriginX:It,vertOriginY:It,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:It,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:nce}),ace=k1({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()}}),ice=k1({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:sce}),oce=k1({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),dBe={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"},fBe=/[A-Z]/g,hV=/-[a-z]/g,hBe=/^data[-\w.:]+$/i;function mBe(e,t){const r=I8(t);let n=t,a=Cl;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&hBe.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(hV,xBe);n="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!hV.test(i)){let o=i.replace(fBe,pBe);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}a=TF}return new a(n,t)}function pBe(e){return"-"+e.toLowerCase()}function xBe(e){return e.charAt(1).toUpperCase()}const gBe=tce([rce,cBe,ace,ice,oce],"html"),PF=tce([rce,uBe,ace,ice,oce],"svg");function vBe(e){return e.join(" ").trim()}var OF={},mV=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,yBe=/\n/g,bBe=/^\s*/,wBe=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,jBe=/^:\s*/,_Be=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,NBe=/^[;\s]*/,SBe=/^\s+|\s+$/g,kBe=`
`,pV="/",xV="*",wx="",CBe="comment",EBe="declaration";function ABe(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(x){var p=x.match(yBe);p&&(r+=p.length);var g=x.lastIndexOf(kBe);n=~g?x.length-g:n+x.length}function i(){var x={line:r,column:n};return function(p){return p.position=new o(x),u(),p}}function o(x){this.start=x,this.end={line:r,column:n},this.source=t.source}o.prototype.content=e;function l(x){var p=new Error(t.source+":"+r+":"+n+": "+x);if(p.reason=x,p.filename=t.source,p.line=r,p.column=n,p.source=e,!t.silent)throw p}function c(x){var p=x.exec(e);if(p){var g=p[0];return a(g),e=e.slice(g.length),p}}function u(){c(bBe)}function d(x){var p;for(x=x||[];p=f();)p!==!1&&x.push(p);return x}function f(){var x=i();if(!(pV!=e.charAt(0)||xV!=e.charAt(1))){for(var p=2;wx!=e.charAt(p)&&(xV!=e.charAt(p)||pV!=e.charAt(p+1));)++p;if(p+=2,wx===e.charAt(p-1))return l("End of comment missing");var g=e.slice(2,p-2);return n+=2,a(g),e=e.slice(p),n+=2,x({type:CBe,comment:g})}}function m(){var x=i(),p=c(wBe);if(p){if(f(),!c(jBe))return l("property missing ':'");var g=c(_Be),v=x({type:EBe,property:gV(p[0].replace(mV,wx)),value:g?gV(g[0].replace(mV,wx)):wx});return c(NBe),v}}function h(){var x=[];d(x);for(var p;p=m();)p!==!1&&(x.push(p),d(x));return x}return u(),h()}function gV(e){return e?e.replace(SBe,wx):wx}var TBe=ABe,PBe=zc&&zc.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(OF,"__esModule",{value:!0});OF.default=DBe;const OBe=PBe(TBe);function DBe(e,t){let r=null;if(!e||typeof e!="string")return r;const n=(0,OBe.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 SE={};Object.defineProperty(SE,"__esModule",{value:!0});SE.camelCase=void 0;var IBe=/^--[a-zA-Z0-9_-]+$/,RBe=/-([a-z])/g,LBe=/^[^-]+$/,FBe=/^-(webkit|moz|ms|o|khtml)-/,MBe=/^-(ms)-/,$Be=function(e){return!e||LBe.test(e)||IBe.test(e)},BBe=function(e,t){return t.toUpperCase()},vV=function(e,t){return"".concat(t,"-")},zBe=function(e,t){return t===void 0&&(t={}),$Be(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(MBe,vV):e=e.replace(FBe,vV),e.replace(RBe,BBe))};SE.camelCase=zBe;var qBe=zc&&zc.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},UBe=qBe(OF),VBe=SE;function F8(e,t){var r={};return!e||typeof e!="string"||(0,UBe.default)(e,function(n,a){n&&a&&(r[(0,VBe.camelCase)(n,t)]=a)}),r}F8.default=F8;var HBe=F8;const WBe=Sn(HBe),lce=cce("end"),DF=cce("start");function cce(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 GBe(e){const t=DF(e),r=lce(e);if(t&&r)return{start:t,end:r}}function Lw(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?yV(e.position):"start"in e||"end"in e?yV(e):"line"in e||"column"in e?M8(e):""}function M8(e){return bV(e&&e.line)+":"+bV(e&&e.column)}function yV(e){return M8(e&&e.start)+"-"+M8(e&&e.end)}function bV(e){return e&&typeof e=="number"?e:1}class Eo 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=Lw(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}}Eo.prototype.file="";Eo.prototype.name="";Eo.prototype.reason="";Eo.prototype.message="";Eo.prototype.stack="";Eo.prototype.column=void 0;Eo.prototype.line=void 0;Eo.prototype.ancestors=void 0;Eo.prototype.cause=void 0;Eo.prototype.fatal=void 0;Eo.prototype.place=void 0;Eo.prototype.ruleId=void 0;Eo.prototype.source=void 0;const IF={}.hasOwnProperty,KBe=new Map,XBe=/[A-Z]/g,YBe=new Set(["table","tbody","thead","tfoot","tr"]),ZBe=new Set(["td","th"]),uce="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function JBe(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=i9e(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=a9e(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"?PF:gBe,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=dce(a,e,void 0);return i&&typeof i!="string"?i:a.create(e,a.Fragment,{children:i||void 0},void 0)}function dce(e,t,r){if(t.type==="element")return QBe(e,t,r);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return e9e(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return r9e(e,t,r);if(t.type==="mdxjsEsm")return t9e(e,t);if(t.type==="root")return n9e(e,t,r);if(t.type==="text")return s9e(e,t)}function QBe(e,t,r){const n=e.schema;let a=n;t.tagName.toLowerCase()==="svg"&&n.space==="html"&&(a=PF,e.schema=a),e.ancestors.push(t);const i=hce(e,t.tagName,!1),o=o9e(e,t);let l=LF(e,t);return YBe.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!oBe(c):!0})),fce(e,o,i,t),RF(o,l),e.ancestors.pop(),e.schema=n,e.create(t,i,o,r)}function e9e(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)}z2(e,t.position)}function t9e(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);z2(e,t.position)}function r9e(e,t,r){const n=e.schema;let a=n;t.name==="svg"&&n.space==="html"&&(a=PF,e.schema=a),e.ancestors.push(t);const i=t.name===null?e.Fragment:hce(e,t.name,!0),o=l9e(e,t),l=LF(e,t);return fce(e,o,i,t),RF(o,l),e.ancestors.pop(),e.schema=n,e.create(t,i,o,r)}function n9e(e,t,r){const n={};return RF(n,LF(e,t)),e.create(t,e.Fragment,n,r)}function s9e(e,t){return t.value}function fce(e,t,r,n){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(t.node=n)}function RF(e,t){if(t.length>0){const r=t.length>1?t:t[0];r&&(e.children=r)}}function a9e(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 i9e(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 o9e(e,t){const r={};let n,a;for(a in t.properties)if(a!=="children"&&IF.call(t.properties,a)){const i=c9e(e,a,t.properties[a]);if(i){const[o,l]=i;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&ZBe.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 l9e(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 z2(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 z2(e,t.position);else i=n.value===null?!0:n.value;r[a]=i}return r}function LF(e,t){const r=[];let n=-1;const a=e.passKeys?new Map:KBe;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=dce(e,i,o);l!==void 0&&r.push(l)}return r}function c9e(e,t,r){const n=mBe(e.schema,t);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=n.commaSeparated?rBe(r):vBe(r)),n.property==="style"){let a=typeof r=="object"?r:u9e(e,String(r));return e.stylePropertyNameCase==="css"&&(a=d9e(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&n.space?dBe[n.property]||n.property:n.attribute,r]}}function u9e(e,t){try{return WBe(t,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const n=r,a=new Eo("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=uce+"#cannot-parse-style-attribute",a}}function hce(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=uV(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=uV(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(n.type==="Literal"){const a=n.value;return IF.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(n);z2(e)}function z2(e,t){const r=new Eo("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=uce+"#cannot-handle-mdx-estrees-without-createevaluater",r}function d9e(e){const t={};let r;for(r in e)IF.call(e,r)&&(t[f9e(r)]=e[r]);return t}function f9e(e){let t=e.replace(XBe,h9e);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function h9e(e){return"-"+e.toLowerCase()}const nP={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"]},m9e={};function p9e(e,t){const r=m9e,n=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,a=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return mce(e,n,a)}function mce(e,t,r){if(x9e(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 wV(e.children,t,r)}return Array.isArray(e)?wV(e,t,r):""}function wV(e,t,r){const n=[];let a=-1;for(;++a<e.length;)n[a]=mce(e[a],t,r);return n.join("")}function x9e(e){return!!(e&&typeof e=="object")}const jV=document.createElement("i");function FF(e){const t="&"+e+";";jV.innerHTML=t;const r=jV.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===t?!1:r}function rf(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 Fc(e,t){return e.length>0?(rf(e,e.length,0,t),e):t}const _V={}.hasOwnProperty;function g9e(e){const t={};let r=-1;for(;++r<e.length;)v9e(t,e[r]);return t}function v9e(e,t){let r;for(r in t){const a=(_V.call(e,r)?e[r]:void 0)||(e[r]={}),i=t[r];let o;if(i)for(o in i){_V.call(a,o)||(a[o]=[]);const l=i[o];y9e(a[o],Array.isArray(l)?l:l?[l]:[])}}}function y9e(e,t){let r=-1;const n=[];for(;++r<t.length;)(t[r].add==="after"?e:n).push(t[r]);rf(e,0,0,n)}function pce(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 Fv(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Bd=Ip(/[A-Za-z]/),tc=Ip(/[\dA-Za-z]/),b9e=Ip(/[#-'*+\--9=?A-Z^-~]/);function $8(e){return e!==null&&(e<32||e===127)}const B8=Ip(/\d/),w9e=Ip(/[\dA-Fa-f]/),j9e=Ip(/[!-/:-@[-`{-~]/);function Ur(e){return e!==null&&e<-2}function wl(e){return e!==null&&(e<0||e===32)}function Gn(e){return e===-2||e===-1||e===32}const _9e=Ip(new RegExp("\\p{P}|\\p{S}","u")),N9e=Ip(/\s/);function Ip(e){return t;function t(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function C1(e){const t=[];let r=-1,n=0,a=0;for(;++r<e.length;){const i=e.charCodeAt(r);let o="";if(i===37&&tc(e.charCodeAt(r+1))&&tc(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 Ts(e,t,r,n){const a=n?n-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(c){return Gn(c)?(e.enter(r),l(c)):t(c)}function l(c){return Gn(c)&&i++<a?(e.consume(c),l):(e.exit(r),t(c))}}const S9e={tokenize:k9e};function k9e(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"),Ts(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 Ur(l)?(e.consume(l),e.exit("chunkText"),i):(e.consume(l),o)}}const C9e={tokenize:E9e},NV={tokenize:A9e};function E9e(e){const t=this,r=[];let n=0,a,i,o;return l;function l(b){if(n<r.length){const N=r[n];return t.containerState=N[1],e.attempt(N[0].continuation,c,u)(b)}return u(b)}function c(b){if(n++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&y();const N=t.events.length;let j=N,_;for(;j--;)if(t.events[j][0]==="exit"&&t.events[j][1].type==="chunkFlow"){_=t.events[j][1].end;break}v(n);let S=N;for(;S<t.events.length;)t.events[S][1].end={..._},S++;return rf(t.events,j+1,0,t.events.slice(N)),t.events.length=S,u(b)}return l(b)}function u(b){if(n===r.length){if(!a)return m(b);if(a.currentConstruct&&a.currentConstruct.concrete)return x(b);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(NV,d,f)(b)}function d(b){return a&&y(),v(n),m(b)}function f(b){return t.parser.lazy[t.now().line]=n!==r.length,o=t.now().offset,x(b)}function m(b){return t.containerState={},e.attempt(NV,h,x)(b)}function h(b){return n++,r.push([t.currentConstruct,t.containerState]),m(b)}function x(b){if(b===null){a&&y(),v(0),e.consume(b);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:i}),p(b)}function p(b){if(b===null){g(e.exit("chunkFlow"),!0),v(0),e.consume(b);return}return Ur(b)?(e.consume(b),g(e.exit("chunkFlow")),n=0,t.interrupt=void 0,l):(e.consume(b),p)}function g(b,N){const j=t.sliceStream(b);if(N&&j.push(null),b.previous=i,i&&(i.next=b),i=b,a.defineSkip(b.start),a.write(j),t.parser.lazy[b.start.line]){let _=a.events.length;for(;_--;)if(a.events[_][1].start.offset<o&&(!a.events[_][1].end||a.events[_][1].end.offset>o))return;const S=t.events.length;let P=S,T,R;for(;P--;)if(t.events[P][0]==="exit"&&t.events[P][1].type==="chunkFlow"){if(T){R=t.events[P][1].end;break}T=!0}for(v(n),_=S;_<t.events.length;)t.events[_][1].end={...R},_++;rf(t.events,P+1,0,t.events.slice(S)),t.events.length=_}}function v(b){let N=r.length;for(;N-- >b;){const j=r[N];t.containerState=j[1],j[0].exit.call(t,e)}r.length=b}function y(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function A9e(e,t,r){return Ts(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function SV(e){if(e===null||wl(e)||N9e(e))return 1;if(_9e(e))return 2}function MF(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 z8={name:"attention",resolveAll:T9e,tokenize:P9e};function T9e(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};kV(f,-c),kV(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=Fc(u,[["enter",e[n][1],t],["exit",e[n][1],t]])),u=Fc(u,[["enter",a,t],["enter",o,t],["exit",o,t],["enter",i,t]]),u=Fc(u,MF(t.parser.constructs.insideSpan.null,e.slice(n+1,r),t)),u=Fc(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=Fc(u,[["enter",e[r][1],t],["exit",e[r][1],t]])):d=0,rf(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 P9e(e,t){const r=this.parser.constructs.attentionMarkers.null,n=this.previous,a=SV(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=SV(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 kV(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const O9e={name:"autolink",tokenize:D9e};function D9e(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 Bd(h)?(e.consume(h),o):h===64?r(h):u(h)}function o(h){return h===43||h===45||h===46||tc(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||tc(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||$8(h)?r(h):(e.consume(h),c)}function u(h){return h===64?(e.consume(h),d):b9e(h)?(e.consume(h),u):r(h)}function d(h){return tc(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||tc(h))&&n++<63){const x=h===45?m:f;return e.consume(h),x}return r(h)}}const kE={partial:!0,tokenize:I9e};function I9e(e,t,r){return n;function n(i){return Gn(i)?Ts(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||Ur(i)?t(i):r(i)}}const xce={continuation:{tokenize:L9e},exit:F9e,name:"blockQuote",tokenize:R9e};function R9e(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 Gn(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function L9e(e,t,r){const n=this;return a;function a(o){return Gn(o)?Ts(e,i,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return e.attempt(xce,t,r)(o)}}function F9e(e){e.exit("blockQuote")}const gce={name:"characterEscape",tokenize:M9e};function M9e(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 j9e(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):r(i)}}const vce={name:"characterReference",tokenize:$9e};function $9e(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=tc,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=w9e,d):(e.enter("characterReferenceValue"),i=7,o=B8,d(f))}function d(f){if(f===59&&a){const m=e.exit("characterReferenceValue");return o===tc&&!FF(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 CV={partial:!0,tokenize:z9e},EV={concrete:!0,name:"codeFenced",tokenize:B9e};function B9e(e,t,r){const n=this,a={partial:!0,tokenize:j};let i=0,o=0,l;return c;function c(_){return u(_)}function u(_){const S=n.events[n.events.length-1];return i=S&&S[1].type==="linePrefix"?S[2].sliceSerialize(S[1],!0).length:0,l=_,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(_)}function d(_){return _===l?(o++,e.consume(_),d):o<3?r(_):(e.exit("codeFencedFenceSequence"),Gn(_)?Ts(e,f,"whitespace")(_):f(_))}function f(_){return _===null||Ur(_)?(e.exit("codeFencedFence"),n.interrupt?t(_):e.check(CV,p,N)(_)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),m(_))}function m(_){return _===null||Ur(_)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(_)):Gn(_)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ts(e,h,"whitespace")(_)):_===96&&_===l?r(_):(e.consume(_),m)}function h(_){return _===null||Ur(_)?f(_):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),x(_))}function x(_){return _===null||Ur(_)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(_)):_===96&&_===l?r(_):(e.consume(_),x)}function p(_){return e.attempt(a,N,g)(_)}function g(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),v}function v(_){return i>0&&Gn(_)?Ts(e,y,"linePrefix",i+1)(_):y(_)}function y(_){return _===null||Ur(_)?e.check(CV,p,N)(_):(e.enter("codeFlowValue"),b(_))}function b(_){return _===null||Ur(_)?(e.exit("codeFlowValue"),y(_)):(e.consume(_),b)}function N(_){return e.exit("codeFenced"),t(_)}function j(_,S,P){let T=0;return R;function R(L){return _.enter("lineEnding"),_.consume(L),_.exit("lineEnding"),k}function k(L){return _.enter("codeFencedFence"),Gn(L)?Ts(_,E,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):E(L)}function E(L){return L===l?(_.enter("codeFencedFenceSequence"),q(L)):P(L)}function q(L){return L===l?(T++,_.consume(L),q):T>=o?(_.exit("codeFencedFenceSequence"),Gn(L)?Ts(_,O,"whitespace")(L):O(L)):P(L)}function O(L){return L===null||Ur(L)?(_.exit("codeFencedFence"),S(L)):P(L)}}}function z9e(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 sP={name:"codeIndented",tokenize:U9e},q9e={partial:!0,tokenize:V9e};function U9e(e,t,r){const n=this;return a;function a(u){return e.enter("codeIndented"),Ts(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):Ur(u)?e.attempt(q9e,o,c)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||Ur(u)?(e.exit("codeFlowValue"),o(u)):(e.consume(u),l)}function c(u){return e.exit("codeIndented"),t(u)}}function V9e(e,t,r){const n=this;return a;function a(o){return n.parser.lazy[n.now().line]?r(o):Ur(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a):Ts(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):Ur(o)?a(o):r(o)}}const H9e={name:"codeText",previous:G9e,resolve:W9e,tokenize:K9e};function W9e(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 G9e(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function K9e(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)):Ur(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||Ur(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 X9e{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&&Fb(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),Fb(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Fb(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);Fb(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Fb(this.left,r.reverse())}}}function Fb(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 yce(e){const t={};let r=-1,n,a,i,o,l,c,u;const d=new X9e(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,Y9e(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 rf(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function Y9e(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,x=0,p=0;const g=[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,g.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):g.pop(),m=g.length;m--;){const v=l.slice(g[m],g[m+1]),y=i.pop();c.push([y,y+v.length-1]),e.splice(y,2,v)}for(c.reverse(),m=-1;++m<c.length;)u[x+c[m][0]]=x+c[m][1],x+=c[m][1]-c[m][0]-1;return u}const Z9e={resolve:Q9e,tokenize:eze},J9e={partial:!0,tokenize:tze};function Q9e(e){return yce(e),e}function eze(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):Ur(l)?e.check(J9e,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 tze(e,t,r){const n=this;return a;function a(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Ts(e,i,"linePrefix")}function i(o){if(o===null||Ur(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 bce(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||$8(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||Ur(v)?r(v):(e.consume(v),v===92?x:h)}function x(v){return v===60||v===62||v===92?(e.consume(v),h):h(v)}function p(v){return!d&&(v===null||v===41||wl(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||$8(v)?r(v):(e.consume(v),v===92?g:p)}function g(v){return v===40||v===41||v===92?(e.consume(v),p):p(v)}}function wce(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):Ur(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||Ur(h)||l++>999?(e.exit("chunkString"),d(h)):(e.consume(h),c||(c=!Gn(h)),h===92?m:f)}function m(h){return h===91||h===92||h===93?(e.consume(h),l++,f):f(h)}}function jce(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):Ur(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),Ts(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(m))}function d(m){return m===o||m===null||Ur(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 Fw(e,t){let r;return n;function n(a){return Ur(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),r=!0,n):Gn(a)?Ts(e,n,r?"linePrefix":"lineSuffix")(a):t(a)}}const rze={name:"definition",tokenize:sze},nze={partial:!0,tokenize:aze};function sze(e,t,r){const n=this;let a;return i;function i(h){return e.enter("definition"),o(h)}function o(h){return wce.call(n,e,l,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function l(h){return a=Fv(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 wl(h)?Fw(e,u)(h):u(h)}function u(h){return bce(e,d,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function d(h){return e.attempt(nze,f,f)(h)}function f(h){return Gn(h)?Ts(e,m,"whitespace")(h):m(h)}function m(h){return h===null||Ur(h)?(e.exit("definition"),n.parser.defined.push(a),t(h)):r(h)}}function aze(e,t,r){return n;function n(l){return wl(l)?Fw(e,a)(l):r(l)}function a(l){return jce(e,i,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return Gn(l)?Ts(e,o,"whitespace")(l):o(l)}function o(l){return l===null||Ur(l)?t(l):r(l)}}const ize={name:"hardBreakEscape",tokenize:oze};function oze(e,t,r){return n;function n(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return Ur(i)?(e.exit("hardBreakEscape"),t(i)):r(i)}}const lze={name:"headingAtx",resolve:cze,tokenize:uze};function cze(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"},rf(e,n,r-n+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function uze(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||wl(d)?(e.exit("atxHeadingSequence"),l(d)):r(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||Ur(d)?(e.exit("atxHeading"),t(d)):Gn(d)?Ts(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||wl(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),u)}}const dze=["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"],AV=["pre","script","style","textarea"],fze={concrete:!0,name:"htmlFlow",resolveTo:pze,tokenize:xze},hze={partial:!0,tokenize:vze},mze={partial:!0,tokenize:gze};function pze(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 xze(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:B):Bd(A)?(e.consume(A),o=String.fromCharCode(A),g):r(A)}function m(A){return A===45?(e.consume(A),a=2,h):A===91?(e.consume(A),a=5,l=0,x):Bd(A)?(e.consume(A),a=4,n.interrupt?t:B):r(A)}function h(A){return A===45?(e.consume(A),n.interrupt?t:B):r(A)}function x(A){const I="CDATA[";return A===I.charCodeAt(l++)?(e.consume(A),l===I.length?n.interrupt?t:E:x):r(A)}function p(A){return Bd(A)?(e.consume(A),o=String.fromCharCode(A),g):r(A)}function g(A){if(A===null||A===47||A===62||wl(A)){const I=A===47,U=o.toLowerCase();return!I&&!i&&AV.includes(U)?(a=1,n.interrupt?t(A):E(A)):dze.includes(o.toLowerCase())?(a=6,I?(e.consume(A),v):n.interrupt?t(A):E(A)):(a=7,n.interrupt&&!n.parser.lazy[n.now().line]?r(A):i?y(A):b(A))}return A===45||tc(A)?(e.consume(A),o+=String.fromCharCode(A),g):r(A)}function v(A){return A===62?(e.consume(A),n.interrupt?t:E):r(A)}function y(A){return Gn(A)?(e.consume(A),y):R(A)}function b(A){return A===47?(e.consume(A),R):A===58||A===95||Bd(A)?(e.consume(A),N):Gn(A)?(e.consume(A),b):R(A)}function N(A){return A===45||A===46||A===58||A===95||tc(A)?(e.consume(A),N):j(A)}function j(A){return A===61?(e.consume(A),_):Gn(A)?(e.consume(A),j):b(A)}function _(A){return A===null||A===60||A===61||A===62||A===96?r(A):A===34||A===39?(e.consume(A),c=A,S):Gn(A)?(e.consume(A),_):P(A)}function S(A){return A===c?(e.consume(A),c=null,T):A===null||Ur(A)?r(A):(e.consume(A),S)}function P(A){return A===null||A===34||A===39||A===47||A===60||A===61||A===62||A===96||wl(A)?j(A):(e.consume(A),P)}function T(A){return A===47||A===62||Gn(A)?b(A):r(A)}function R(A){return A===62?(e.consume(A),k):r(A)}function k(A){return A===null||Ur(A)?E(A):Gn(A)?(e.consume(A),k):r(A)}function E(A){return A===45&&a===2?(e.consume(A),H):A===60&&a===1?(e.consume(A),V):A===62&&a===4?(e.consume(A),K):A===63&&a===3?(e.consume(A),B):A===93&&a===5?(e.consume(A),M):Ur(A)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(hze,C,q)(A)):A===null||Ur(A)?(e.exit("htmlFlowData"),q(A)):(e.consume(A),E)}function q(A){return e.check(mze,O,C)(A)}function O(A){return e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),L}function L(A){return A===null||Ur(A)?q(A):(e.enter("htmlFlowData"),E(A))}function H(A){return A===45?(e.consume(A),B):E(A)}function V(A){return A===47?(e.consume(A),o="",z):E(A)}function z(A){if(A===62){const I=o.toLowerCase();return AV.includes(I)?(e.consume(A),K):E(A)}return Bd(A)&&o.length<8?(e.consume(A),o+=String.fromCharCode(A),z):E(A)}function M(A){return A===93?(e.consume(A),B):E(A)}function B(A){return A===62?(e.consume(A),K):A===45&&a===2?(e.consume(A),B):E(A)}function K(A){return A===null||Ur(A)?(e.exit("htmlFlowData"),C(A)):(e.consume(A),K)}function C(A){return e.exit("htmlFlow"),t(A)}}function gze(e,t,r){const n=this;return a;function a(o){return Ur(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 vze(e,t,r){return n;function n(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(kE,t,r)}}const yze={name:"htmlText",tokenize:bze};function bze(e,t,r){const n=this;let a,i,o;return l;function l(B){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(B),c}function c(B){return B===33?(e.consume(B),u):B===47?(e.consume(B),j):B===63?(e.consume(B),b):Bd(B)?(e.consume(B),P):r(B)}function u(B){return B===45?(e.consume(B),d):B===91?(e.consume(B),i=0,x):Bd(B)?(e.consume(B),y):r(B)}function d(B){return B===45?(e.consume(B),h):r(B)}function f(B){return B===null?r(B):B===45?(e.consume(B),m):Ur(B)?(o=f,V(B)):(e.consume(B),f)}function m(B){return B===45?(e.consume(B),h):f(B)}function h(B){return B===62?H(B):B===45?m(B):f(B)}function x(B){const K="CDATA[";return B===K.charCodeAt(i++)?(e.consume(B),i===K.length?p:x):r(B)}function p(B){return B===null?r(B):B===93?(e.consume(B),g):Ur(B)?(o=p,V(B)):(e.consume(B),p)}function g(B){return B===93?(e.consume(B),v):p(B)}function v(B){return B===62?H(B):B===93?(e.consume(B),v):p(B)}function y(B){return B===null||B===62?H(B):Ur(B)?(o=y,V(B)):(e.consume(B),y)}function b(B){return B===null?r(B):B===63?(e.consume(B),N):Ur(B)?(o=b,V(B)):(e.consume(B),b)}function N(B){return B===62?H(B):b(B)}function j(B){return Bd(B)?(e.consume(B),_):r(B)}function _(B){return B===45||tc(B)?(e.consume(B),_):S(B)}function S(B){return Ur(B)?(o=S,V(B)):Gn(B)?(e.consume(B),S):H(B)}function P(B){return B===45||tc(B)?(e.consume(B),P):B===47||B===62||wl(B)?T(B):r(B)}function T(B){return B===47?(e.consume(B),H):B===58||B===95||Bd(B)?(e.consume(B),R):Ur(B)?(o=T,V(B)):Gn(B)?(e.consume(B),T):H(B)}function R(B){return B===45||B===46||B===58||B===95||tc(B)?(e.consume(B),R):k(B)}function k(B){return B===61?(e.consume(B),E):Ur(B)?(o=k,V(B)):Gn(B)?(e.consume(B),k):T(B)}function E(B){return B===null||B===60||B===61||B===62||B===96?r(B):B===34||B===39?(e.consume(B),a=B,q):Ur(B)?(o=E,V(B)):Gn(B)?(e.consume(B),E):(e.consume(B),O)}function q(B){return B===a?(e.consume(B),a=void 0,L):B===null?r(B):Ur(B)?(o=q,V(B)):(e.consume(B),q)}function O(B){return B===null||B===34||B===39||B===60||B===61||B===96?r(B):B===47||B===62||wl(B)?T(B):(e.consume(B),O)}function L(B){return B===47||B===62||wl(B)?T(B):r(B)}function H(B){return B===62?(e.consume(B),e.exit("htmlTextData"),e.exit("htmlText"),t):r(B)}function V(B){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),z}function z(B){return Gn(B)?Ts(e,M,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):M(B)}function M(B){return e.enter("htmlTextData"),o(B)}}const $F={name:"labelEnd",resolveAll:Nze,resolveTo:Sze,tokenize:kze},wze={tokenize:Cze},jze={tokenize:Eze},_ze={tokenize:Aze};function Nze(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&&rf(e,0,e.length,r),e}function Sze(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=Fc(l,e.slice(i+1,i+n+3)),l=Fc(l,[["enter",d,t]]),l=Fc(l,MF(t.parser.constructs.insideSpan.null,e.slice(i+n+4,o-3),t)),l=Fc(l,[["exit",d,t],e[o-2],e[o-1],["exit",u,t]]),l=Fc(l,e.slice(o+1)),l=Fc(l,[["exit",c,t]]),rf(e,i,e.length,l),e}function kze(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(Fv(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(wze,d,o?d:f)(m):m===91?e.attempt(jze,d,o?u:f)(m):o?d(m):f(m)}function u(m){return e.attempt(_ze,d,f)(m)}function d(m){return t(m)}function f(m){return i._balanced=!0,r(m)}}function Cze(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 wl(f)?Fw(e,i)(f):i(f)}function i(f){return f===41?d(f):bce(e,o,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function o(f){return wl(f)?Fw(e,c)(f):d(f)}function l(f){return r(f)}function c(f){return f===34||f===39||f===40?jce(e,u,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):d(f)}function u(f){return wl(f)?Fw(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 Eze(e,t,r){const n=this;return a;function a(l){return wce.call(n,e,i,o,"reference","referenceMarker","referenceString")(l)}function i(l){return n.parser.defined.includes(Fv(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?t(l):r(l)}function o(l){return r(l)}}function Aze(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 Tze={name:"labelStartImage",resolveAll:$F.resolveAll,tokenize:Pze};function Pze(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 Oze={name:"labelStartLink",resolveAll:$F.resolveAll,tokenize:Dze};function Dze(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 aP={name:"lineEnding",tokenize:Ize};function Ize(e,t){return r;function r(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),Ts(e,t,"linePrefix")}}const k5={name:"thematicBreak",tokenize:Rze};function Rze(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||Ur(u))?(e.exit("thematicBreak"),t(u)):r(u)}function c(u){return u===a?(e.consume(u),n++,c):(e.exit("thematicBreakSequence"),Gn(u)?Ts(e,l,"whitespace")(u):l(u))}}const ol={continuation:{tokenize:$ze},exit:zze,name:"list",tokenize:Mze},Lze={partial:!0,tokenize:qze},Fze={partial:!0,tokenize:Bze};function Mze(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 x=n.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(x==="listUnordered"?!n.containerState.marker||h===n.containerState.marker:B8(h)){if(n.containerState.type||(n.containerState.type=x,e.enter(x,{_container:!0})),x==="listUnordered")return e.enter("listItemPrefix"),h===42||h===45?e.check(k5,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 B8(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(kE,n.interrupt?r:d,e.attempt(Lze,m,f))}function d(h){return n.containerState.initialBlankLine=!0,i++,m(h)}function f(h){return Gn(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 $ze(e,t,r){const n=this;return n.containerState._closeFlow=void 0,e.check(kE,a,i);function a(l){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,Ts(e,t,"listItemIndent",n.containerState.size+1)(l)}function i(l){return n.containerState.furtherBlankLines||!Gn(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(Fze,t,o)(l))}function o(l){return n.containerState._closeFlow=!0,n.interrupt=void 0,Ts(e,e.attempt(ol,t,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function Bze(e,t,r){const n=this;return Ts(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 zze(e){e.exit(this.containerState.type)}function qze(e,t,r){const n=this;return Ts(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!Gn(i)&&o&&o[1].type==="listItemPrefixWhitespace"?t(i):r(i)}}const TV={name:"setextUnderline",resolveTo:Uze,tokenize:Vze};function Uze(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 Vze(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"),Gn(u)?Ts(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||Ur(u)?(e.exit("setextHeadingLine"),t(u)):r(u)}}const Hze={tokenize:Wze};function Wze(e){const t=this,r=e.attempt(kE,n,e.attempt(this.parser.constructs.flowInitial,a,Ts(e,e.attempt(this.parser.constructs.flow,a,e.attempt(Z9e,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 Gze={resolveAll:Nce()},Kze=_ce("string"),Xze=_ce("text");function _ce(e){return{resolveAll:Nce(e==="text"?Yze: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 Nce(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 Yze(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 Zze={42:ol,43:ol,45:ol,48:ol,49:ol,50:ol,51:ol,52:ol,53:ol,54:ol,55:ol,56:ol,57:ol,62:xce},Jze={91:rze},Qze={[-2]:sP,[-1]:sP,32:sP},eqe={35:lze,42:k5,45:[TV,k5],60:fze,61:TV,95:k5,96:EV,126:EV},tqe={38:vce,92:gce},rqe={[-5]:aP,[-4]:aP,[-3]:aP,33:Tze,38:vce,42:z8,60:[O9e,yze],91:Oze,92:[ize,gce],93:$F,95:z8,96:H9e},nqe={null:[z8,Gze]},sqe={null:[42,95]},aqe={null:[]},iqe=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:sqe,contentInitial:Jze,disable:aqe,document:Zze,flow:eqe,flowInitial:Qze,insideSpan:nqe,string:tqe,text:rqe},Symbol.toStringTag,{value:"Module"}));function oqe(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(j),check:S(_),consume:y,enter:b,exit:N,interrupt:S(_,{interrupt:!0})},u={code:null,containerState:{},defineSkip:p,events:[],now:x,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(k){return o=Fc(o,k),g(),o[o.length-1]!==null?[]:(P(t,0),u.events=MF(i,u.events,u),u.events)}function m(k,E){return cqe(h(k),E)}function h(k){return lqe(o,k)}function x(){const{_bufferIndex:k,_index:E,line:q,column:O,offset:L}=n;return{_bufferIndex:k,_index:E,line:q,column:O,offset:L}}function p(k){a[k.line]=k.column,R()}function g(){let k;for(;n._index<o.length;){const E=o[n._index];if(typeof E=="string")for(k=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===k&&n._bufferIndex<E.length;)v(E.charCodeAt(n._bufferIndex));else v(E)}}function v(k){d=d(k)}function y(k){Ur(k)?(n.line++,n.column=1,n.offset+=k===-3?2:1,R()):k!==-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=k}function b(k,E){const q=E||{};return q.type=k,q.start=x(),u.events.push(["enter",q,u]),l.push(q),q}function N(k){const E=l.pop();return E.end=x(),u.events.push(["exit",E,u]),E}function j(k,E){P(k,E.from)}function _(k,E){E.restore()}function S(k,E){return q;function q(O,L,H){let V,z,M,B;return Array.isArray(O)?C(O):"tokenize"in O?C([O]):K(O);function K(Y){return te;function te(re){const J=re!==null&&Y[re],ie=re!==null&&Y.null,be=[...Array.isArray(J)?J:J?[J]:[],...Array.isArray(ie)?ie:ie?[ie]:[]];return C(be)(re)}}function C(Y){return V=Y,z=0,Y.length===0?H:A(Y[z])}function A(Y){return te;function te(re){return B=T(),M=Y,Y.partial||(u.currentConstruct=Y),Y.name&&u.parser.constructs.disable.null.includes(Y.name)?U():Y.tokenize.call(E?Object.assign(Object.create(u),E):u,c,I,U)(re)}}function I(Y){return k(M,B),L}function U(Y){return B.restore(),++z<V.length?A(V[z]):H}}}function P(k,E){k.resolveAll&&!i.includes(k)&&i.push(k),k.resolve&&rf(u.events,E,u.events.length-E,k.resolve(u.events.slice(E),u)),k.resolveTo&&(u.events=k.resolveTo(u.events,u))}function T(){const k=x(),E=u.previous,q=u.currentConstruct,O=u.events.length,L=Array.from(l);return{from:O,restore:H};function H(){n=k,u.previous=E,u.currentConstruct=q,u.events.length=O,l=L,R()}}function R(){n.line in a&&n.column<2&&(n.column=a[n.line],n.offset+=a[n.line]-1)}}function lqe(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 cqe(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 uqe(e){const n={constructs:g9e([iqe,...(e||{}).extensions||[]]),content:a(S9e),defined:[],document:a(C9e),flow:a(Hze),lazy:{},string:a(Kze),text:a(Xze)};return n;function a(i){return o;function o(l){return oqe(n,i,l)}}}function dqe(e){for(;!yce(e););return e}const PV=/[\0\t\n\r]/g;function fqe(){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(PV.lastIndex=f,u=PV.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 hqe=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function mqe(e){return e.replace(hqe,pqe)}function pqe(e,t,r){if(t)return t;if(r.charCodeAt(0)===35){const a=r.charCodeAt(1),i=a===120||a===88;return pce(r.slice(i?2:1),i?16:10)}return FF(r)||e}const Sce={}.hasOwnProperty;function xqe(e,t,r){return typeof t!="string"&&(r=t,t=void 0),gqe(r)(dqe(uqe(r).document().write(fqe()(e,t,!0))))}function gqe(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(le),autolinkProtocol:T,autolinkEmail:T,atxHeading:i(Z),blockQuote:i(ie),characterEscape:T,characterReference:T,codeFenced:i(be),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(be,o),codeText:i(Q,o),codeTextData:T,data:T,codeFlowValue:T,definition:i(Ve),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(W),hardBreakEscape:i(he),hardBreakTrailing:i(he),htmlFlow:i(se,o),htmlFlowData:T,htmlText:i(se,o),htmlTextData:T,image:i(oe),label:o,link:i(le),listItem:i(de),listItemValue:m,listOrdered:i(Me,f),listUnordered:i(Me),paragraph:i(me),reference:A,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(Z),strong:i(Le),thematicBreak:i(ve)},exit:{atxHeading:c(),atxHeadingSequence:j,autolink:c(),autolinkEmail:J,autolinkProtocol:re,blockQuote:c(),characterEscapeValue:R,characterReferenceMarkerHexadecimal:U,characterReferenceMarkerNumeric:U,characterReferenceValue:Y,characterReference:te,codeFenced:c(g),codeFencedFence:p,codeFencedFenceInfo:h,codeFencedFenceMeta:x,codeFlowValue:R,codeIndented:c(v),codeText:c(L),codeTextData:R,data:R,definition:c(),definitionDestinationString:N,definitionLabelString:y,definitionTitleString:b,emphasis:c(),hardBreakEscape:c(E),hardBreakTrailing:c(E),htmlFlow:c(q),htmlFlowData:R,htmlText:c(O),htmlTextData:R,image:c(V),label:M,labelText:z,lineEnding:k,link:c(H),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:I,resourceDestinationString:B,resourceTitleString:K,resource:C,setextHeading:c(P),setextHeadingLineSequence:S,setextHeadingText:_,strong:c(),thematicBreak:c()}};kce(t,(e||{}).mdastExtensions||[]);const r={};return n;function n(_e){let Ue={type:"root",children:[]};const Qe={stack:[Ue],tokenStack:[],config:t,enter:l,exit:u,buffer:o,resume:d,data:r},st=[];let Fe=-1;for(;++Fe<_e.length;)if(_e[Fe][1].type==="listOrdered"||_e[Fe][1].type==="listUnordered")if(_e[Fe][0]==="enter")st.push(Fe);else{const Ge=st.pop();Fe=a(_e,Ge,Fe)}for(Fe=-1;++Fe<_e.length;){const Ge=t[_e[Fe][0]];Sce.call(Ge,_e[Fe][1].type)&&Ge[_e[Fe][1].type].call(Object.assign({sliceSerialize:_e[Fe][2].sliceSerialize},Qe),_e[Fe][1])}if(Qe.tokenStack.length>0){const Ge=Qe.tokenStack[Qe.tokenStack.length-1];(Ge[1]||OV).call(Qe,void 0,Ge[0])}for(Ue.position={start:sm(_e.length>0?_e[0][1].start:{line:1,column:1,offset:0}),end:sm(_e.length>0?_e[_e.length-2][1].end:{line:1,column:1,offset:0})},Fe=-1;++Fe<t.transforms.length;)Ue=t.transforms[Fe](Ue)||Ue;return Ue}function a(_e,Ue,Qe){let st=Ue-1,Fe=-1,Ge=!1,ht,ut,Mt,Wt;for(;++st<=Qe;){const zt=_e[st];switch(zt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{zt[0]==="enter"?Fe++:Fe--,Wt=void 0;break}case"lineEndingBlank":{zt[0]==="enter"&&(ht&&!Wt&&!Fe&&!Mt&&(Mt=st),Wt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Wt=void 0}if(!Fe&&zt[0]==="enter"&&zt[1].type==="listItemPrefix"||Fe===-1&&zt[0]==="exit"&&(zt[1].type==="listUnordered"||zt[1].type==="listOrdered")){if(ht){let Lt=st;for(ut=void 0;Lt--;){const or=_e[Lt];if(or[1].type==="lineEnding"||or[1].type==="lineEndingBlank"){if(or[0]==="exit")continue;ut&&(_e[ut][1].type="lineEndingBlank",Ge=!0),or[1].type="lineEnding",ut=Lt}else if(!(or[1].type==="linePrefix"||or[1].type==="blockQuotePrefix"||or[1].type==="blockQuotePrefixWhitespace"||or[1].type==="blockQuoteMarker"||or[1].type==="listItemIndent"))break}Mt&&(!ut||Mt<ut)&&(ht._spread=!0),ht.end=Object.assign({},ut?_e[ut][1].start:zt[1].end),_e.splice(ut||st,0,["exit",ht,zt[2]]),st++,Qe++}if(zt[1].type==="listItemPrefix"){const Lt={type:"listItem",_spread:!1,start:Object.assign({},zt[1].start),end:void 0};ht=Lt,_e.splice(st,0,["enter",Lt,zt[2]]),st++,Qe++,Mt=void 0,Wt=!0}}}return _e[Ue][1]._spread=Ge,Qe}function i(_e,Ue){return Qe;function Qe(st){l.call(this,_e(st),st),Ue&&Ue.call(this,st)}}function o(){this.stack.push({type:"fragment",children:[]})}function l(_e,Ue,Qe){this.stack[this.stack.length-1].children.push(_e),this.stack.push(_e),this.tokenStack.push([Ue,Qe||void 0]),_e.position={start:sm(Ue.start),end:void 0}}function c(_e){return Ue;function Ue(Qe){_e&&_e.call(this,Qe),u.call(this,Qe)}}function u(_e,Ue){const Qe=this.stack.pop(),st=this.tokenStack.pop();if(st)st[0].type!==_e.type&&(Ue?Ue.call(this,_e,st[0]):(st[1]||OV).call(this,_e,st[0]));else throw new Error("Cannot close `"+_e.type+"` ("+Lw({start:_e.start,end:_e.end})+"): it’s not open");Qe.position.end=sm(_e.end)}function d(){return p9e(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function m(_e){if(this.data.expectingFirstListItemValue){const Ue=this.stack[this.stack.length-2];Ue.start=Number.parseInt(this.sliceSerialize(_e),10),this.data.expectingFirstListItemValue=void 0}}function h(){const _e=this.resume(),Ue=this.stack[this.stack.length-1];Ue.lang=_e}function x(){const _e=this.resume(),Ue=this.stack[this.stack.length-1];Ue.meta=_e}function p(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){const _e=this.resume(),Ue=this.stack[this.stack.length-1];Ue.value=_e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function v(){const _e=this.resume(),Ue=this.stack[this.stack.length-1];Ue.value=_e.replace(/(\r?\n|\r)$/g,"")}function y(_e){const Ue=this.resume(),Qe=this.stack[this.stack.length-1];Qe.label=Ue,Qe.identifier=Fv(this.sliceSerialize(_e)).toLowerCase()}function b(){const _e=this.resume(),Ue=this.stack[this.stack.length-1];Ue.title=_e}function N(){const _e=this.resume(),Ue=this.stack[this.stack.length-1];Ue.url=_e}function j(_e){const Ue=this.stack[this.stack.length-1];if(!Ue.depth){const Qe=this.sliceSerialize(_e).length;Ue.depth=Qe}}function _(){this.data.setextHeadingSlurpLineEnding=!0}function S(_e){const Ue=this.stack[this.stack.length-1];Ue.depth=this.sliceSerialize(_e).codePointAt(0)===61?1:2}function P(){this.data.setextHeadingSlurpLineEnding=void 0}function T(_e){const Qe=this.stack[this.stack.length-1].children;let st=Qe[Qe.length-1];(!st||st.type!=="text")&&(st=Ke(),st.position={start:sm(_e.start),end:void 0},Qe.push(st)),this.stack.push(st)}function R(_e){const Ue=this.stack.pop();Ue.value+=this.sliceSerialize(_e),Ue.position.end=sm(_e.end)}function k(_e){const Ue=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Qe=Ue.children[Ue.children.length-1];Qe.position.end=sm(_e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Ue.type)&&(T.call(this,_e),R.call(this,_e))}function E(){this.data.atHardBreak=!0}function q(){const _e=this.resume(),Ue=this.stack[this.stack.length-1];Ue.value=_e}function O(){const _e=this.resume(),Ue=this.stack[this.stack.length-1];Ue.value=_e}function L(){const _e=this.resume(),Ue=this.stack[this.stack.length-1];Ue.value=_e}function H(){const _e=this.stack[this.stack.length-1];if(this.data.inReference){const Ue=this.data.referenceType||"shortcut";_e.type+="Reference",_e.referenceType=Ue,delete _e.url,delete _e.title}else delete _e.identifier,delete _e.label;this.data.referenceType=void 0}function V(){const _e=this.stack[this.stack.length-1];if(this.data.inReference){const Ue=this.data.referenceType||"shortcut";_e.type+="Reference",_e.referenceType=Ue,delete _e.url,delete _e.title}else delete _e.identifier,delete _e.label;this.data.referenceType=void 0}function z(_e){const Ue=this.sliceSerialize(_e),Qe=this.stack[this.stack.length-2];Qe.label=mqe(Ue),Qe.identifier=Fv(Ue).toLowerCase()}function M(){const _e=this.stack[this.stack.length-1],Ue=this.resume(),Qe=this.stack[this.stack.length-1];if(this.data.inReference=!0,Qe.type==="link"){const st=_e.children;Qe.children=st}else Qe.alt=Ue}function B(){const _e=this.resume(),Ue=this.stack[this.stack.length-1];Ue.url=_e}function K(){const _e=this.resume(),Ue=this.stack[this.stack.length-1];Ue.title=_e}function C(){this.data.inReference=void 0}function A(){this.data.referenceType="collapsed"}function I(_e){const Ue=this.resume(),Qe=this.stack[this.stack.length-1];Qe.label=Ue,Qe.identifier=Fv(this.sliceSerialize(_e)).toLowerCase(),this.data.referenceType="full"}function U(_e){this.data.characterReferenceType=_e.type}function Y(_e){const Ue=this.sliceSerialize(_e),Qe=this.data.characterReferenceType;let st;Qe?(st=pce(Ue,Qe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):st=FF(Ue);const Fe=this.stack[this.stack.length-1];Fe.value+=st}function te(_e){const Ue=this.stack.pop();Ue.position.end=sm(_e.end)}function re(_e){R.call(this,_e);const Ue=this.stack[this.stack.length-1];Ue.url=this.sliceSerialize(_e)}function J(_e){R.call(this,_e);const Ue=this.stack[this.stack.length-1];Ue.url="mailto:"+this.sliceSerialize(_e)}function ie(){return{type:"blockquote",children:[]}}function be(){return{type:"code",lang:null,meta:null,value:""}}function Q(){return{type:"inlineCode",value:""}}function Ve(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function W(){return{type:"emphasis",children:[]}}function Z(){return{type:"heading",depth:0,children:[]}}function he(){return{type:"break"}}function se(){return{type:"html",value:""}}function oe(){return{type:"image",title:null,url:"",alt:null}}function le(){return{type:"link",title:null,url:"",children:[]}}function Me(_e){return{type:"list",ordered:_e.type==="listOrdered",start:null,spread:_e._spread,children:[]}}function de(_e){return{type:"listItem",spread:_e._spread,checked:null,children:[]}}function me(){return{type:"paragraph",children:[]}}function Le(){return{type:"strong",children:[]}}function Ke(){return{type:"text",value:""}}function ve(){return{type:"thematicBreak"}}}function sm(e){return{line:e.line,column:e.column,offset:e.offset}}function kce(e,t){let r=-1;for(;++r<t.length;){const n=t[r];Array.isArray(n)?kce(e,n):vqe(e,n)}}function vqe(e,t){let r;for(r in t)if(Sce.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 OV(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Lw({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Lw({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Lw({start:t.start,end:t.end})+") is still open")}function yqe(e){const t=this;t.parser=r;function r(n){return xqe(n,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function bqe(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 wqe(e,t){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,r),[e.applyData(t,r),{type:"text",value:`
`}]}function jqe(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 _qe(e,t){const r={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Nqe(e,t){const r={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Sqe(e,t){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=String(t.identifier).toUpperCase(),a=C1(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 kqe(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 Cqe(e,t){if(e.options.allowDangerousHtml){const r={type:"raw",value:t.value};return e.patch(t,r),e.applyData(t,r)}}function Cce(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 Eqe(e,t){const r=String(t.identifier).toUpperCase(),n=e.definitionById.get(r);if(!n)return Cce(e,t);const a={src:C1(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 Aqe(e,t){const r={src:C1(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 Tqe(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 Pqe(e,t){const r=String(t.identifier).toUpperCase(),n=e.definitionById.get(r);if(!n)return Cce(e,t);const a={href:C1(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 Oqe(e,t){const r={href:C1(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 Dqe(e,t,r){const n=e.all(t),a=r?Iqe(r):Ece(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 Iqe(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=Ece(r[n])}return t}function Ece(e){const t=e.spread;return t??e.children.length>1}function Rqe(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 Lqe(e,t){const r={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Fqe(e,t){const r={type:"root",children:e.wrap(e.all(t))};return e.patch(t,r),e.applyData(t,r)}function Mqe(e,t){const r={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function $qe(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=lce(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 Bqe(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 x={type:"element",tagName:i,properties:m,children:[]};f&&(x.children=e.all(f),e.patch(f,x),x=e.applyData(f,x)),u.push(x)}const d={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,d),e.applyData(t,d)}function zqe(e,t){const r={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}const DV=9,IV=32;function qqe(e){const t=String(e),r=/\r?\n|\r/g;let n=r.exec(t),a=0;const i=[];for(;n;)i.push(RV(t.slice(a,n.index),a>0,!0),n[0]),a=n.index+n[0].length,n=r.exec(t);return i.push(RV(t.slice(a),a>0,!1)),i.join("")}function RV(e,t,r){let n=0,a=e.length;if(t){let i=e.codePointAt(n);for(;i===DV||i===IV;)n++,i=e.codePointAt(n)}if(r){let i=e.codePointAt(a-1);for(;i===DV||i===IV;)a--,i=e.codePointAt(a-1)}return a>n?e.slice(n,a):""}function Uqe(e,t){const r={type:"text",value:qqe(String(t.value))};return e.patch(t,r),e.applyData(t,r)}function Vqe(e,t){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,r),e.applyData(t,r)}const Hqe={blockquote:bqe,break:wqe,code:jqe,delete:_qe,emphasis:Nqe,footnoteReference:Sqe,heading:kqe,html:Cqe,imageReference:Eqe,image:Aqe,inlineCode:Tqe,linkReference:Pqe,link:Oqe,listItem:Dqe,list:Rqe,paragraph:Lqe,root:Fqe,strong:Mqe,table:$qe,tableCell:zqe,tableRow:Bqe,text:Uqe,thematicBreak:Vqe,toml:bS,yaml:bS,definition:bS,footnoteDefinition:bS};function bS(){}const Ace=-1,CE=0,Mw=1,I4=2,BF=3,zF=4,qF=5,UF=6,Tce=7,Pce=8,LV=typeof self=="object"?self:globalThis,Wqe=(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 CE:case Ace:return r(o,a);case Mw:{const l=r([],a);for(const c of o)l.push(n(c));return l}case I4:{const l=r({},a);for(const[c,u]of o)l[n(c)]=n(u);return l}case BF:return r(new Date(o),a);case zF:{const{source:l,flags:c}=o;return r(new RegExp(l,c),a)}case qF:{const l=r(new Map,a);for(const[c,u]of o)l.set(n(c),n(u));return l}case UF:{const l=r(new Set,a);for(const c of o)l.add(n(c));return l}case Tce:{const{name:l,message:c}=o;return r(new LV[l](c),a)}case Pce: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 LV[i](o),a)};return n},FV=e=>Wqe(new Map,e)(0),Ig="",{toString:Gqe}={},{keys:Kqe}=Object,Mb=e=>{const t=typeof e;if(t!=="object"||!e)return[CE,t];const r=Gqe.call(e).slice(8,-1);switch(r){case"Array":return[Mw,Ig];case"Object":return[I4,Ig];case"Date":return[BF,Ig];case"RegExp":return[zF,Ig];case"Map":return[qF,Ig];case"Set":return[UF,Ig];case"DataView":return[Mw,r]}return r.includes("Array")?[Mw,r]:r.includes("Error")?[Tce,r]:[I4,r]},wS=([e,t])=>e===CE&&(t==="function"||t==="symbol"),Xqe=(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]=Mb(o);switch(l){case CE:{let d=o;switch(c){case"bigint":l=Pce,d=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return a([Ace],o)}return a([l,d],o)}case Mw:{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 I4:{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 Kqe(o))(e||!wS(Mb(o[m])))&&d.push([i(m),i(o[m])]);return f}case BF:return a([l,o.toISOString()],o);case zF:{const{source:d,flags:f}=o;return a([l,{source:d,flags:f}],o)}case qF:{const d=[],f=a([l,d],o);for(const[m,h]of o)(e||!(wS(Mb(m))||wS(Mb(h))))&&d.push([i(m),i(h)]);return f}case UF:{const d=[],f=a([l,d],o);for(const m of o)(e||!wS(Mb(m)))&&d.push(i(m));return f}}const{message:u}=o;return a([l,{name:c,message:u}],o)};return i},MV=(e,{json:t,lossy:r}={})=>{const n=[];return Xqe(!(t||r),!!t,new Map,n)(e),n},R4=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?FV(MV(e,t)):structuredClone(e):(e,t)=>FV(MV(e,t));function Yqe(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 Zqe(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function Jqe(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||Yqe,n=e.options.footnoteBackLabel||Zqe,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=C1(f.toLowerCase());let h=0;const x=[],p=e.footnoteCounts.get(f);for(;p!==void 0&&++h<=p;){x.length>0&&x.push({type:"text",value:" "});let y=typeof r=="string"?r:r(c,h);typeof y=="string"&&(y={type:"text",value:y}),x.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(y)?y:[y]})}const g=d[d.length-1];if(g&&g.type==="element"&&g.tagName==="p"){const y=g.children[g.children.length-1];y&&y.type==="text"?y.value+=" ":g.children.push({type:"text",value:" "}),g.children.push(...x)}else d.push(...x);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:{...R4(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 Oce=function(e){if(e==null)return rUe;if(typeof e=="function")return EE(e);if(typeof e=="object")return Array.isArray(e)?Qqe(e):eUe(e);if(typeof e=="string")return tUe(e);throw new Error("Expected function, string, or object as test")};function Qqe(e){const t=[];let r=-1;for(;++r<e.length;)t[r]=Oce(e[r]);return EE(n);function n(...a){let i=-1;for(;++i<t.length;)if(t[i].apply(this,a))return!0;return!1}}function eUe(e){const t=e;return EE(r);function r(n){const a=n;let i;for(i in e)if(a[i]!==t[i])return!1;return!0}}function tUe(e){return EE(t);function t(r){return r&&r.type===e}}function EE(e){return t;function t(r,n,a){return!!(nUe(r)&&e.call(this,r,typeof n=="number"?n:void 0,a||void 0))}}function rUe(){return!0}function nUe(e){return e!==null&&typeof e=="object"&&"type"in e}const Dce=[],sUe=!0,$V=!1,aUe="skip";function iUe(e,t,r,n){let a;typeof t=="function"&&typeof r!="function"?(n=r,r=t):a=t;const i=Oce(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=Dce,x,p,g;if((!t||i(c,u,d[d.length-1]||void 0))&&(h=oUe(r(c,d)),h[0]===$V))return h;if("children"in c&&c.children){const v=c;if(v.children&&h[0]!==aUe)for(p=(n?v.children.length:-1)+o,g=d.concat(v);p>-1&&p<v.children.length;){const y=v.children[p];if(x=l(y,p,g)(),x[0]===$V)return x;p=typeof x[1]=="number"?x[1]:p+o}}return h}}}function oUe(e){return Array.isArray(e)?e:typeof e=="number"?[sUe,e]:e==null?Dce:[e]}function Ice(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),iUe(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 q8={}.hasOwnProperty,lUe={};function cUe(e,t){const r=t||lUe,n=new Map,a=new Map,i=new Map,o={...Hqe,...r.handlers},l={all:u,applyData:dUe,definitionById:n,footnoteById:a,footnoteCounts:i,footnoteOrder:[],handlers:o,one:c,options:r,patch:uUe,wrap:hUe};return Ice(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(q8.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,...g}=d,v=R4(g);return v.children=l.all(d),v}return R4(d)}return(l.options.unknownHandler||fUe)(l,d,f)}function u(d){const f=[];if("children"in d){const m=d.children;let h=-1;for(;++h<m.length;){const x=l.one(m[h],d);if(x){if(h&&m[h-1].type==="break"&&(!Array.isArray(x)&&x.type==="text"&&(x.value=BV(x.value)),!Array.isArray(x)&&x.type==="element")){const p=x.children[0];p&&p.type==="text"&&(p.value=BV(p.value))}Array.isArray(x)?f.push(...x):f.push(x)}}}return f}}function uUe(e,t){e.position&&(t.position=GBe(e))}function dUe(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,R4(i)),"children"in r&&r.children&&a!==null&&a!==void 0&&(r.children=a)}return r}function fUe(e,t){const r=t.data||{},n="value"in t&&!(q8.call(r,"hProperties")||q8.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 hUe(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 BV(e){let t=0,r=e.charCodeAt(t);for(;r===9||r===32;)t++,r=e.charCodeAt(t);return e.slice(t)}function zV(e,t){const r=cUe(e,t),n=r.one(e,void 0),a=Jqe(r),i=Array.isArray(n)?{type:"root",children:n}:n||{type:"root",children:[]};return a&&i.children.push({type:"text",value:`
`},a),i}function mUe(e,t){return e&&"run"in e?async function(r,n){const a=zV(r,{file:n,...t});await e.run(a,n)}:function(r,n){return zV(r,{file:n,...e||t})}}function qV(e){if(e)throw e}var C5=Object.prototype.hasOwnProperty,Rce=Object.prototype.toString,UV=Object.defineProperty,VV=Object.getOwnPropertyDescriptor,HV=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Rce.call(t)==="[object Array]"},WV=function(t){if(!t||Rce.call(t)!=="[object Object]")return!1;var r=C5.call(t,"constructor"),n=t.constructor&&t.constructor.prototype&&C5.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!r&&!n)return!1;var a;for(a in t);return typeof a>"u"||C5.call(t,a)},GV=function(t,r){UV&&r.name==="__proto__"?UV(t,r.name,{enumerable:!0,configurable:!0,value:r.newValue,writable:!0}):t[r.name]=r.newValue},KV=function(t,r){if(r==="__proto__")if(C5.call(t,r)){if(VV)return VV(t,r).value}else return;return t[r]},pUe=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=KV(l,r),a=KV(t,r),l!==a&&(d&&a&&(WV(a)||(i=HV(a)))?(i?(i=!1,o=n&&HV(n)?n:[]):o=n&&WV(n)?n:{},GV(l,{name:r,newValue:e(d,o,a)})):typeof a<"u"&&GV(l,{name:r,newValue:a}));return l};const iP=Sn(pUe);function U8(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 xUe(){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?gUe(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 gUe(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 Od={basename:vUe,dirname:yUe,extname:bUe,join:wUe,sep:"/"};function vUe(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');b_(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 yUe(e){if(b_(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 bUe(e){b_(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 wUe(...e){let t=-1,r;for(;++t<e.length;)b_(e[t]),e[t]&&(r=r===void 0?e[t]:r+"/"+e[t]);return r===void 0?".":jUe(r)}function jUe(e){b_(e);const t=e.codePointAt(0)===47;let r=_Ue(e,!t);return r.length===0&&!t&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),t?"/"+r:r}function _Ue(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 b_(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const NUe={cwd:SUe};function SUe(){return"/"}function V8(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function kUe(e){if(typeof e=="string")e=new URL(e);else if(!V8(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 CUe(e)}function CUe(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 oP=["history","path","basename","stem","extname","dirname"];class Lce{constructor(t){let r;t?V8(t)?r={path:t}:typeof t=="string"||EUe(t)?r={value:t}:r=t:r={},this.cwd="cwd"in r?"":NUe.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<oP.length;){const i=oP[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)oP.includes(a)||(this[a]=r[a])}get basename(){return typeof this.path=="string"?Od.basename(this.path):void 0}set basename(t){cP(t,"basename"),lP(t,"basename"),this.path=Od.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Od.dirname(this.path):void 0}set dirname(t){XV(this.basename,"dirname"),this.path=Od.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Od.extname(this.path):void 0}set extname(t){if(lP(t,"extname"),XV(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=Od.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){V8(t)&&(t=kUe(t)),cP(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Od.basename(this.path,this.extname):void 0}set stem(t){cP(t,"stem"),lP(t,"stem"),this.path=Od.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 Eo(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 lP(e,t){if(e&&e.includes(Od.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Od.sep+"`")}function cP(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function XV(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function EUe(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const AUe=function(e){const n=this.constructor.prototype,a=n[e],i=function(){return a.apply(i,arguments)};return Object.setPrototypeOf(i,n),i},TUe={}.hasOwnProperty;class VF extends AUe{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=xUe()}copy(){const t=new VF;let r=-1;for(;++r<this.attachers.length;){const n=this.attachers[r];t.use(...n)}return t.data(iP(!0,{},this.namespace)),t}data(t,r){return typeof t=="string"?arguments.length===2?(fP("data",this.frozen),this.namespace[t]=r,this):TUe.call(this.namespace,t)&&this.namespace[t]||void 0:t?(fP("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=jS(t),n=this.parser||this.Parser;return uP("parse",n),n(String(r),r)}process(t,r){const n=this;return this.freeze(),uP("process",this.parser||this.Parser),dP("process",this.compiler||this.Compiler),r?a(void 0,r):new Promise(a);function a(i,o){const l=jS(t),c=n.parse(l);n.run(c,l,function(d,f,m){if(d||!f||!m)return u(d);const h=f,x=n.stringify(h,m);DUe(x)?m.value=x:m.result=x,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(),uP("processSync",this.parser||this.Parser),dP("processSync",this.compiler||this.Compiler),this.process(t,a),ZV("processSync","process",r),n;function a(i,o){r=!0,qV(i),n=o}}run(t,r,n){YV(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=jS(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),ZV("runSync","run",n),a;function i(o,l){qV(o),a=l,n=!0}}stringify(t,r){this.freeze();const n=jS(r),a=this.compiler||this.Compiler;return dP("stringify",a),YV(t),a(t,n)}use(t,...r){const n=this.attachers,a=this.namespace;if(fP("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=iP(!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,...x]=d;const p=n[m][1];U8(p)&&U8(h)&&(h=iP(!0,p,h)),n[m]=[u,h,...x]}}}}const PUe=new VF().freeze();function uP(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function dP(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function fP(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 YV(e){if(!U8(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function ZV(e,t,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function jS(e){return OUe(e)?e:new Lce(e)}function OUe(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function DUe(e){return typeof e=="string"||IUe(e)}function IUe(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const RUe="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",JV=[],QV={allowDangerousHtml:!0},LUe=/^(https?|ircs?|mailto|xmpp)$/i,FUe=[{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 HF(e){const t=MUe(e),r=$Ue(e);return BUe(t.runSync(t.parse(r),r),e)}function MUe(e){const t=e.rehypePlugins||JV,r=e.remarkPlugins||JV,n=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...QV}:QV;return PUe().use(yqe).use(r).use(mUe,n).use(t)}function $Ue(e){const t=e.children||"",r=new Lce;return typeof t=="string"&&(r.value=t),r}function BUe(e,t){const r=t.allowedElements,n=t.allowElement,a=t.components,i=t.disallowedElements,o=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||zUe;for(const d of FUe)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+RUe+d.id,void 0);return Ice(e,u),JBe(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 nP)if(Object.hasOwn(nP,h)&&Object.hasOwn(d.properties,h)){const x=d.properties[h],p=nP[h];(p===null||p.includes(d.tagName))&&(d.properties[h]=c(String(x||""),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 zUe(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||LUe.test(e.slice(0,t))?e:""}const $b=10;function qUe({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 UUe(){const e=Zt(),[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/$b),x=w.useCallback(async()=>{a(!0);try{let _=ce.from("blog_posts").select("id",{count:"exact",head:!0}).eq("status","published");i&&(_=_.eq("category_id",i));const{count:S}=await _;m(S||0);const P=(u-1)*$b,T=P+$b-1;let R=ce.from("blog_posts").select("*, blog_categories(name, slug)").eq("status","published").order("published_at",{ascending:!1}).range(P,T);i&&(R=R.eq("category_id",i));const{data:k,error:E}=await R;if(E)throw E;r(k||[])}catch(_){console.error("Error loading posts:",_)}finally{a(!1)}},[u,i]),p=async()=>{try{const{data:_,error:S}=await ce.from("blog_categories").select("*").order("name");if(S)throw S;c(_||[])}catch(_){console.error("Error loading categories:",_)}};w.useEffect(()=>{p()},[]),w.useEffect(()=>{x()},[x]);const g=_=>{o(_),d(1)},v=async _=>{const{data:S}=await ce.from("blog_posts").select("view_count").eq("id",_).single();S&&await ce.from("blog_posts").update({view_count:(S.view_count||0)+1}).eq("id",_)},y=_=>{v(_.id),e(`/blog/${_.slug}`)},b=_=>{d(_),window.scrollTo({top:0,behavior:"smooth"})},N=f===0?0:(u-1)*$b+1,j=Math.min(u*$b,f);return s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx(nr,{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:()=>g(null),size:"sm",children:"Tous les articles"}),l.map(_=>s.jsx(ne,{variant:i===_.id?"default":"outline",onClick:()=>g(_.id),size:"sm",children:_.name},_.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,"-",j]})," 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((_,S)=>s.jsxs(je,{className:"overflow-hidden",children:[s.jsx(Yr,{className:"h-48 w-full"}),s.jsxs(mt,{children:[s.jsx(Yr,{className:"h-4 w-20 mb-2"}),s.jsx(Yr,{className:"h-6 w-full"})]}),s.jsxs(Ee,{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(_=>s.jsxs(je,{className:"hover:shadow-xl transition-all duration-300 cursor-pointer group",onClick:()=>y(_),children:[_.featured_image&&s.jsx(qUe,{src:_.featured_image,alt:_.title,className:"w-full h-48 object-cover group-hover:scale-105 transition-transform duration-300"}),s.jsxs(mt,{children:[s.jsx("div",{className:"flex items-center gap-2 mb-2",children:_.blog_categories&&s.jsx(Te,{variant:"secondary",children:_.blog_categories.name})}),s.jsx(gt,{className:"group-hover:text-primary transition-colors line-clamp-2",children:_.title})]}),s.jsxs(Ee,{children:[s.jsx("div",{className:"text-muted-foreground mb-4 line-clamp-3 prose prose-sm max-w-none",children:s.jsx(HF,{children:_.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(Hs,{className:"h-4 w-4"}),Dt(new Date(_.published_at),"d MMMM yyyy",{locale:br})]}),s.jsxs(ne,{variant:"ghost",size:"sm",className:"group-hover:text-primary",children:["Lire ",s.jsx(Zr,{className:"ml-1 h-4 w-4"})]})]})]})]},_.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:()=>b(u-1),disabled:u===1,className:"gap-1",children:[s.jsx(vC,{className:"h-4 w-4"}),"Précédent"]}),s.jsx("div",{className:"flex items-center gap-1 mx-4",children:Array.from({length:h},(_,S)=>S+1).map(_=>{const S=_===1||_===h||Math.abs(_-u)<=1;return _===2&&u>3||_===h-1&&u<h-2?s.jsx("span",{className:"px-2 text-muted-foreground",children:"..."},_):S?s.jsx(ne,{variant:u===_?"default":"outline",size:"sm",onClick:()=>b(_),className:"w-10",children:_},_):null})}),s.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>b(u+1),disabled:u===h,className:"gap-1",children:["Suivant",s.jsx(nu,{className:"h-4 w-4"})]})]})]}),s.jsx("div",{className:"max-w-2xl mx-auto mt-16",children:s.jsx(iae,{})})]})})]})}function Rp({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(nt,{to:"/",className:"hover:text-primary transition-colors flex items-center gap-1","aria-label":"Retour à l'accueil",children:[s.jsx(MR,{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(nu,{className:"h-4 w-4"}),a?s.jsx("span",{className:"text-foreground font-medium","aria-current":"page",children:r.name}):s.jsx(nt,{to:r.url,className:"hover:text-primary transition-colors",children:r.name})]},r.url)})]})}function VUe({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(([x])=>{x.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 HUe(){const{slug:e}=so(),t=Zt(),[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 ce.from("blog_posts").select(`
*,
blog_categories(name, slug),
blog_post_tags(blog_tags(name, slug))
`).eq("slug",e).eq("status","published").maybeSingle();if(c)throw c;if(!l)return;n(l),await ce.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(it,{className:"h-8 w-8 animate-spin text-primary"})}):r?s.jsxs(s.Fragment,{children:[s.jsx(nr,{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(JL,{headline:r.title,description:r.excerpt,image:r.featured_image||void 0,publishedTime:r.published_at,url:`/blog/${r.slug}`}),s.jsx(ms,{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(Rp,{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(Hn,{className:"mr-2 h-4 w-4"}),"Retour au blog"]}),r.blog_categories&&s.jsx(Te,{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(Hs,{className:"h-4 w-4"}),Dt(new Date(r.published_at),"d MMMM yyyy",{locale:br})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(es,{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(VUe,{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(HF,{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(Te,{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(Hn,{className:"mr-2 h-4 w-4"}),"Retour au blog"]})]})})}function WUe(){const e=Zt(),{isAdmin:t,loading:r}=Br(),[n,a]=w.useState(!0),[i,o]=w.useState([]),[l,c]=w.useState([]),[u,d]=w.useState(!1),[f,m]=w.useState(!1),[h,x]=w.useState(""),[p,g]=w.useState(""),[v,y]=w.useState(""),[b,N]=w.useState("1500"),[j,_]=w.useState(!1),[S,P]=w.useState(!0),[T,R]=w.useState(null);w.useEffect(()=>{!r&&!t&&e("/auth")},[t,r,e]),w.useEffect(()=>{t&&(O(),L(),k())},[t]);const k=async()=>{try{const{data:A,error:I}=await ce.from("app_settings").select("value").eq("key","linkedin_credentials").single();!I&&(A!=null&&A.value)&&A.value.access_token&&_(!0)}catch(A){console.error("Error checking LinkedIn connection:",A)}finally{P(!1)}},E=async()=>{try{const I=await(await fetch("https://pedagobridge.com/functions/v1/linkedin-oauth?action=authorize")).json();if(I.authUrl){window.open(I.authUrl,"_blank","width=600,height=700");const U=setInterval(async()=>{await k(),j&&clearInterval(U)},3e3);setTimeout(()=>clearInterval(U),3e5)}}catch(A){console.error("Error connecting LinkedIn:",A),ae.error("Erreur lors de la connexion LinkedIn")}},q=async A=>{R(A.id);try{const{data:I}=await ce.auth.getSession(),U=I==null?void 0:I.session;if(!U){ae.error("Session expirée");return}const Y=`${window.location.origin}/blog/${A.slug}`,te=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})}),re=await te.json();if(!te.ok){if(te.status===401)_(!1),ae.error("Token LinkedIn expiré. Veuillez reconnecter votre compte.");else throw new Error(re.error||"Erreur LinkedIn");return}ae.success("Article publié sur LinkedIn !"),O()}catch(I){console.error("Error publishing to LinkedIn:",I),ae.error("Erreur lors de la publication sur LinkedIn")}finally{R(null)}},O=async()=>{try{const{data:A,error:I}=await ce.from("blog_posts").select("*, blog_categories(name)").order("created_at",{ascending:!1});if(I)throw I;o(A||[])}catch(A){console.error("Error loading posts:",A),ae.error("Erreur lors du chargement des articles")}finally{a(!1)}},L=async()=>{try{const{data:A,error:I}=await ce.from("blog_categories").select("*").order("name");if(I)throw I;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 ce.auth.getSession(),I=A==null?void 0:A.session;if(!I){ae.error("Session expirée");return}const U=await fetch("https://pedagobridge.com/functions/v1/generate-blog-post",{method:"POST",headers:{Authorization:`Bearer ${I.access_token}`,"Content-Type":"application/json"},body:JSON.stringify({topic:h,keywords:p.split(",").map(te=>te.trim()),categoryId:v||void 0,targetWordCount:parseInt(b)})});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),x(""),g(""),y(""),N("1500"),O()}catch(A){console.error("Error generating post:",A),ae.error("Erreur lors de la génération de l'article")}finally{m(!1)}},V=async A=>{if(confirm("Êtes-vous sûr de vouloir supprimer cet article ?"))try{const{error:I}=await ce.from("blog_posts").delete().eq("id",A);if(I)throw I;ae.success("Article supprimé"),O()}catch(I){console.error("Error deleting post:",I),ae.error("Erreur lors de la suppression")}},z=async A=>{try{const{error:I}=await ce.from("blog_posts").update({status:"published",published_at:new Date().toISOString(),updated_at:new Date().toISOString()}).eq("id",A);if(I)throw I;ae.success("Article publié !"),O()}catch(I){console.error("Error publishing post:",I),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(it,{className:"h-8 w-8 animate-spin text-primary"})});const M=i.filter(A=>A.status==="draft"),B=i.filter(A=>A.status==="scheduled"),K=i.filter(A=>A.status==="published"),C=({post:A})=>s.jsxs(je,{children:[s.jsx(mt,{children:s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx(gt,{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(Te,{variant:"secondary",children:A.blog_categories.name}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(Hs,{className:"h-4 w-4"}),Dt(new Date(A.created_at),"d MMM yyyy",{locale:br})]})]})]}),s.jsx(Te,{variant:A.status==="published"?"default":A.status==="scheduled"?"secondary":"outline",children:A.status})]})}),s.jsx(Ee,{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(es,{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(MQ,{className:"h-4 w-4 mr-2"}),"Modifier"]}),A.status==="draft"&&s.jsxs(ne,{variant:"default",size:"sm",onClick:()=>z(A.id),children:[s.jsx(Wr,{className:"h-4 w-4 mr-2"}),"Publier"]}),A.status==="published"&&j&&!A.linkedin_post_id&&s.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>q(A),disabled:T===A.id,className:"text-[#0077B5] border-[#0077B5] hover:bg-[#0077B5] hover:text-white",children:[T===A.id?s.jsx(it,{className:"h-4 w-4 mr-2 animate-spin"}):s.jsx(Bu,{className:"h-4 w-4 mr-2"}),"LinkedIn"]}),A.linkedin_post_id&&s.jsxs(Te,{variant:"secondary",className:"flex items-center gap-1",children:[s.jsx(Bu,{className:"h-3 w-3"}),"Publié"]}),s.jsxs(ne,{variant:"destructive",size:"sm",onClick:()=>V(A.id),children:[s.jsx(ri,{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(ta,{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&&(j?s.jsxs(Te,{variant:"secondary",className:"flex items-center gap-1",children:[s.jsx(Bu,{className:"h-4 w-4"}),"LinkedIn connecté"]}):s.jsxs(ne,{variant:"outline",onClick:E,className:"text-[#0077B5] border-[#0077B5] hover:bg-[#0077B5] hover:text-white",children:[s.jsx(Bu,{className:"mr-2 h-4 w-4"}),"Connecter LinkedIn"]})),s.jsxs(qn,{open:u,onOpenChange:d,children:[s.jsx(Xo,{asChild:!0,children:s.jsxs(ne,{children:[s.jsx(Mi,{className:"mr-2 h-4 w-4"}),"Générer un article avec IA"]})}),s.jsxs($n,{children:[s.jsxs(Un,{children:[s.jsx(Vn,{children:"Générer un article avec IA"}),s.jsx(Sa,{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(Xe,{id:"topic",value:h,onChange:A=>x(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(Xe,{id:"keywords",value:p,onChange:A=>g(A.target.value),placeholder:"formation, compétences, apprentissage"})]}),s.jsxs("div",{children:[s.jsx(We,{htmlFor:"category",children:"Catégorie"}),s.jsxs(Ar,{value:v,onValueChange:y,children:[s.jsx(kr,{children:s.jsx(Dr,{placeholder:"Sélectionner une catégorie"})}),s.jsx(Cr,{children:l.map(A=>s.jsx(ct,{value:A.id,children:A.name},A.id))})]})]}),s.jsxs("div",{children:[s.jsx(We,{htmlFor:"wordCount",children:"Nombre de mots cible"}),s.jsx(Xe,{id:"wordCount",type:"number",value:b,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(it,{className:"mr-2 h-4 w-4 animate-spin"}),"Génération en cours..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Mi,{className:"mr-2 h-4 w-4"}),"Générer l'article"]})})]})]})]})]})]}),s.jsxs(uf,{defaultValue:"all",className:"space-y-6",children:[s.jsxs(fd,{children:[s.jsxs(Mn,{value:"all",children:["Tous (",i.length,")"]}),s.jsxs(Mn,{value:"published",children:["Publiés (",K.length,")"]}),s.jsxs(Mn,{value:"scheduled",children:["Programmés (",B.length,")"]}),s.jsxs(Mn,{value:"draft",children:["Brouillons (",M.length,")"]})]}),s.jsx(Os,{value:"all",className:"space-y-4",children:i.map(A=>s.jsx(C,{post:A},A.id))}),s.jsx(Os,{value:"published",className:"space-y-4",children:K.map(A=>s.jsx(C,{post:A},A.id))}),s.jsx(Os,{value:"scheduled",className:"space-y-4",children:B.map(A=>s.jsx(C,{post:A},A.id))}),s.jsx(Os,{value:"draft",className:"space-y-4",children:M.map(A=>s.jsx(C,{post:A},A.id))})]})]})})}function GUe(){const{id:e}=so(),t=Zt(),{isAdmin:r,loading:n}=Br(),[a,i]=w.useState(!0),[o,l]=w.useState(!1),[c,u]=w.useState([]),[d,f]=w.useState(""),[m,h]=w.useState(""),[x,p]=w.useState(""),[g,v]=w.useState(""),[y,b]=w.useState("draft"),[N,j]=w.useState(""),[_,S]=w.useState(""),[P,T]=w.useState("");w.useEffect(()=>{!n&&!r&&t("/auth")},[r,n,t]),w.useEffect(()=>{r&&e&&(R(),k())},[r,e]);const R=async()=>{try{const{data:L,error:H}=await ce.from("blog_posts").select("*").eq("id",e).single();if(H)throw H;f(L.title),h(L.slug),p(L.content),v(L.excerpt||""),b(L.status),j(L.category_id||""),S(L.meta_title||""),T(L.meta_description||"")}catch(L){console.error("Error loading post:",L),ae.error("Erreur lors du chargement de l'article")}finally{i(!1)}},k=async()=>{try{const{data:L,error:H}=await ce.from("blog_categories").select("*").order("name");if(H)throw H;u(L||[])}catch(L){console.error("Error loading categories:",L)}},E=L=>L.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,""),q=L=>{f(L),(!m||m===E(d))&&h(E(L))},O=async()=>{if(!d.trim()||!x.trim()){ae.error("Le titre et le contenu sont requis");return}l(!0);try{const L={title:d,slug:m,content:x,excerpt:g,status:y,category_id:N||null,meta_title:_,meta_description:P,updated_at:new Date().toISOString()};if(y==="published"){const{data:V}=await ce.from("blog_posts").select("published_at").eq("id",e).single();V!=null&&V.published_at||(L.published_at=new Date().toISOString())}const{error:H}=await ce.from("blog_posts").update(L).eq("id",e);if(H)throw H;ae.success("Article enregistré avec succès"),t("/admin/blog")}catch(L){console.error("Error saving post:",L),ae.error(L.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(it,{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(Hn,{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(es,{className:"mr-2 h-4 w-4"}),"Aperçu"]}),s.jsx(ne,{onClick:O,disabled:o,children:o?s.jsxs(s.Fragment,{children:[s.jsx(it,{className:"mr-2 h-4 w-4 animate-spin"}),"Enregistrement..."]}):s.jsxs(s.Fragment,{children:[s.jsx(FQ,{className:"mr-2 h-4 w-4"}),"Enregistrer"]})})]})]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(je,{children:[s.jsx(mt,{children:s.jsx(gt,{children:"Contenu principal"})}),s.jsxs(Ee,{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(We,{htmlFor:"title",children:"Titre *"}),s.jsx(Xe,{id:"title",value:d,onChange:L=>q(L.target.value),placeholder:"Titre de l'article"})]}),s.jsxs("div",{children:[s.jsx(We,{htmlFor:"slug",children:"URL (slug) *"}),s.jsx(Xe,{id:"slug",value:m,onChange:L=>h(L.target.value),placeholder:"url-de-l-article"})]}),s.jsxs("div",{children:[s.jsx(We,{htmlFor:"excerpt",children:"Extrait"}),s.jsx(gn,{id:"excerpt",value:g,onChange:L=>v(L.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:x,onChange:L=>p(L.target.value),placeholder:"Contenu de l'article en Markdown...",rows:15,className:"font-mono"})]})]})]}),s.jsxs(je,{children:[s.jsx(mt,{children:s.jsx(gt,{children:"Paramètres de publication"})}),s.jsxs(Ee,{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(We,{htmlFor:"status",children:"Statut *"}),s.jsxs(Ar,{value:y,onValueChange:b,children:[s.jsx(kr,{children:s.jsx(Dr,{})}),s.jsxs(Cr,{children:[s.jsx(ct,{value:"draft",children:"Brouillon"}),s.jsx(ct,{value:"published",children:"Publié"}),s.jsx(ct,{value:"scheduled",children:"Programmé"})]})]})]}),s.jsxs("div",{children:[s.jsx(We,{htmlFor:"category",children:"Catégorie"}),s.jsxs(Ar,{value:N,onValueChange:j,children:[s.jsx(kr,{children:s.jsx(Dr,{placeholder:"Sélectionner une catégorie"})}),s.jsx(Cr,{children:c.map(L=>s.jsx(ct,{value:L.id,children:L.name},L.id))})]})]})]})]}),s.jsxs(je,{children:[s.jsx(mt,{children:s.jsx(gt,{children:"SEO"})}),s.jsxs(Ee,{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(We,{htmlFor:"metaTitle",children:"Meta titre"}),s.jsx(Xe,{id:"metaTitle",value:_,onChange:L=>S(L.target.value),placeholder:"Titre pour les moteurs de recherche"}),s.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[_.length,"/60 caractères"]})]}),s.jsxs("div",{children:[s.jsx(We,{htmlFor:"metaDescription",children:"Meta description"}),s.jsx(gn,{id:"metaDescription",value:P,onChange:L=>T(L.target.value),placeholder:"Description pour les moteurs de recherche",rows:3}),s.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[P.length,"/160 caractères"]})]})]})]})]})]})})}function KUe(){const e=Zt(),{user:t,isTrainer:r,loading:n}=Br(),[a,i]=w.useState(!0),[o,l]=w.useState(null),[c,u]=w.useState([]),d=w.useRef(null),[f,m]=w.useState(!1),[h,x]=w.useState(!1),[p,g]=w.useState(!1),[v,y]=w.useState(!1);w.useEffect(()=>{const k=d.current;if(!k)return;const E=k.getContext("2d");E&&(E.fillStyle="#ffffff",E.fillRect(0,0,k.width,k.height),E.strokeStyle="#1f2937",E.lineWidth=2,E.lineCap="round",E.lineJoin="round")},[o]);const b=k=>{const E=d.current;if(!E)return{x:0,y:0};const q=E.getBoundingClientRect();return{x:(k.clientX-q.left)*(E.width/q.width),y:(k.clientY-q.top)*(E.height/q.height)}},N=k=>{var L;const E=(L=d.current)==null?void 0:L.getContext("2d");if(!E)return;m(!0);const{x:q,y:O}=b(k);E.beginPath(),E.moveTo(q,O)},j=k=>{var L;if(!f)return;const E=(L=d.current)==null?void 0:L.getContext("2d");if(!E)return;const{x:q,y:O}=b(k);E.lineTo(q,O),E.stroke(),x(!0)},_=()=>{const k=d.current,E=k==null?void 0:k.getContext("2d");!E||!k||(E.fillStyle="#ffffff",E.fillRect(0,0,k.width,k.height),x(!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){y(!0);try{const k=d.current.toDataURL("image/png"),{error:E}=await ce.from("trainer_contracts").update({status:"signed",signature_data:k,signed_at:new Date().toISOString()}).eq("id",o.id);if(E)throw E;l(q=>q&&{...q,status:"signed",signature_data:k}),dn.trackContractStep("signed"),ae.success("Contrat signé ! L'équipe PedagoBridge va contre-signer sous 48h. Vous serez notifié.")}catch(k){console.error(k),ae.error("Erreur lors de la signature")}finally{y(!1)}}};w.useEffect(()=>{!n&&!r&&e("/auth")},[r,n,e]),w.useEffect(()=>{r&&t&&P()},[r,t]);const P=async()=>{try{if(!t)return;const{data:k}=await ce.from("trainer_profiles").select("id").eq("user_id",t.id).single();if(!k){ae.error("Profil formateur non trouvé");return}const{data:E,error:q}=await ce.from("trainer_contracts").select("*").eq("trainer_id",k.id).maybeSingle();if(q)throw q;l(E),E&&(dn.trackContractStep("viewed",{status:E.status}),T(E.contract_data))}catch(k){console.error("Error loading contract:",k),ae.error("Erreur lors du chargement du contrat")}finally{i(!1)}},T=k=>{const E=[];k.legalForm||E.push("Forme juridique"),k.capitalAmount||E.push("Montant du capital"),k.headquartersAddress||E.push("Adresse du siège social"),k.legalRepresentativeName||E.push("Nom du représentant légal"),k.legalRepresentativeFunction||E.push("Fonction du représentant légal"),k.siret||E.push("Numéro SIRET"),u(E)},R=async()=>{if(o)try{const k=new lr,E=k.internal.pageSize.getWidth(),q=k.internal.pageSize.getHeight(),O=15,L=E-O*2;let H=O;const V=(Y=8)=>{H+Y>q-O&&(k.addPage(),H=O)},z=(Y,te={})=>{const{bold:re=!1,size:J=9,indent:ie=0,lineGap:be=4}=te;k.setFontSize(J),k.setFont("helvetica",re?"bold":"normal"),k.splitTextToSize(Y,L-ie).forEach(Ve=>{V(J*.5+be),k.text(Ve,O+ie,H),H+=J*.35+be}),H+=1},M=(Y,te,re)=>{V(14),H+=3,k.setFontSize(10),k.setFont("helvetica","bold"),k.text(`Article ${Y} : ${te}`,O,H),H+=6,re(),H+=2},B=(Y,te=5)=>{k.setFontSize(9),k.setFont("helvetica","normal");const re=k.splitTextToSize(Y,L-te-4);V(re.length*5),k.text("•",O+te,H),re.forEach((J,ie)=>{k.text(J,O+te+4,H),ie<re.length-1&&(H+=4.5)}),H+=5},K=o.contract_data;k.setFillColor(30,64,175),k.rect(0,0,E,32,"F"),k.setTextColor(255,255,255),k.setFontSize(16),k.setFont("helvetica","bold"),k.text("CONTRAT DE SOUS-TRAITANCE",E/2,16,{align:"center"}),k.setFontSize(10),k.text("PedagoBridge — Qalam Software",E/2,25,{align:"center"}),k.setTextColor(0,0,0),H=40;const C=o.signed_contract_url?"CONTRAT SIGNÉ":"EN ATTENTE DE SIGNATURE",A=o.signed_contract_url?[34,197,94]:[245,158,11];k.setFillColor(A[0],A[1],A[2]),k.setTextColor(255,255,255),k.roundedRect(O,H,75,7,1.5,1.5,"F"),k.setFontSize(8),k.text(C,O+37.5,H+4.8,{align:"center"}),k.setTextColor(0,0,0),H+=13,z("ENTRE LES SOUSSIGNÉS :",{bold:!0,size:11}),H+=2,z("Qalam Software",{bold:!0,size:10,indent:4}),z("40 rue Alexandre Dumas 75011 Paris",{indent:4}),z("SIRET : 91318083200010",{indent:4}),z("NDA : 11756723075 (Préfecture Île-de-France)",{indent:4}),z("Fondateur du collectif PedagoBridge",{indent:4}),z("Ci-après désigné comme « le Donneur d'Ordre ».",{indent:4}),H+=3,z("ET",{bold:!0,size:10}),H+=2,z(`${K.legalForm||K.trainerName} (Le Sous-Traitant)`,{bold:!0,size:10,indent:4}),K.headquartersAddress&&z(`Adresse : ${K.headquartersAddress}`,{indent:4}),K.siret&&z(`SIRET : ${K.siret}`,{indent:4}),K.activityDeclarationNumber&&z(`NDA : ${K.activityDeclarationNumber} (${K.activityDeclarationRegion||""})`,{indent:4}),K.legalRepresentativeName&&z(`Représenté(e) par : ${K.legalRepresentativeName}${K.legalRepresentativeFunction?", "+K.legalRepresentativeFunction:""}`,{indent:4}),z("Désigné(e) ci-après comme « le Formateur » ou « le Sous-traitant ».",{indent:4}),H+=4,z("Il est convenu ce qui suit :",{bold:!0}),H+=4,M(1,"Nature du contrat",()=>{z("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",()=>{z("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",()=>{z("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",()=>{z("Le Donneur d'Ordre s'engage à :"),B("Fournir au Sous-Traitant toutes les informations nécessaires à la réalisation des formations."),B("Émettre des bons de commande pour chaque formation spécifique, précisant les conditions de réalisation et de rémunération."),B("Assurer le paiement des prestations réalisées conformément aux bons de commande."),B("Assurer la conformité pédagogique et la qualité des prestations."),B("Gérer les plannings et la logistique des missions."),B("Collaborer avec le sous-traitant pour assurer la conformité légale des actions de formation."),B("Garantir la validité de son NDA en soumettant le Bilan Pédagogique et Financier conformément à la législation en vigueur."),B("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",()=>{z("Le Sous-Traitant s'engage à :"),B("Réaliser les formations conformément aux exigences du Donneur d'Ordre et aux standards de qualité en vigueur."),B("Communiquer les besoins matériels et logistiques en amont de chaque formation."),B("Assurer la confidentialité des informations partagées dans le cadre des formations."),B("Respecter les dispositions relatives à la qualité et à l'évaluation des formations."),B("Mettre en copie Qalam Software (contact-pedagobridge@qalamsoftware.com) de tout échange e-mail avec le client final."),B("Être à jour de ses déclarations fiscales et des dispositions prévues par la législation pour exercer son activité."),B("Communiquer tout document administratif nécessaire à la réalisation de la mission."),H+=2,z("Documents requis :",{bold:!0}),B("Auto Entrepreneur : Avis de Situation SIRENE, Attestation de Vigilance"),B("Société sans employés : Kbis, Attestation sur l'honneur de régularité fiscale"),B("Société avec employés : Kbis, Attestation de régularité fiscale"),H+=2,z("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",()=>{z("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",()=>{z("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,z("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,z("3. Résiliation amiable : Les parties peuvent convenir d'une résiliation amiable par écrit à tout moment.",{indent:2}),H+=1,z("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",()=>{z("Modalités financières :",{bold:!0}),B("La rémunération du Sous-Traitant pour chaque formation sera spécifiée dans le bon de commande correspondant."),B("Les factures doivent être transmises avant le 5 du mois suivant les prestations réalisées."),K.activityDeclarationNumber&&B(`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 ».`),B("Les paiements seront effectués 5 jours après réception par Qalam du paiement du client final."),H+=2,z("Paiement lié aux financements CPF :",{bold:!0}),B("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."),B("En cas de non-passage à la certification par le bénéficiaire sans motif valable, aucun paiement ne pourra être garanti."),H+=2,z("Remboursement des frais professionnels :",{bold:!0}),B("Frais de déplacement : Remboursés sur présentation des justificatifs, sous réserve d'une validation préalable."),B("Repas : Remboursés à hauteur de 25 € maximum par repas, uniquement dans le cadre de formations Qalam Software."),B("Hébergement : Remboursés dans la limite de 100 € par nuitée (sur présentation des justificatifs).")}),M(9,"Pénalités de retard",()=>{z("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",()=>{z("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",()=>{B("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."),B("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."),B("Une charte RGPD pourra être annexée au contrat, et le Sous-Traitant devra la signer pour formaliser son engagement."),B("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",()=>{z("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,z("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,z("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",()=>{B("Les parties conviennent que ce contrat ne crée aucun lien de subordination entre le Donneur d'Ordre et le Sous-Traitant."),B("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."),B("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."),B("Le Sous-Traitant s'engage à respecter les obligations légales et déontologiques qui en découlent.")}),M(14,"Communication et collaboration interne",()=>{z("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,z("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",()=>{z("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",()=>{z("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,z("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,z("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,z("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,z("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",()=>{z("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,z("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",()=>{z("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.")}),V(40),H+=6,k.setDrawColor(200,200,200),k.line(O,H,E-O,H),H+=8;const I=new Date(o.created_at).toLocaleDateString("fr-FR",{day:"numeric",month:"long",year:"numeric"});z(`Fait à Paris, le ${I}, en deux exemplaires originaux.`),H+=8;const U=E/2+5;k.setFontSize(9),k.setFont("helvetica","bold"),k.text("Signature du Donneur d'Ordre :",O,H),k.text("Signature du Sous-Traitant :",U,H),H+=5,k.setFont("helvetica","normal"),k.text("Président de Qalam Software",O,H),k.text(`${K.legalRepresentativeFunction||"[Fonction]"} — ${K.legalForm||"[Raison sociale]"}`,U,H),H+=5,k.text("Mekouar Ayoub",O,H),k.text(K.legalRepresentativeName||K.trainerName,U,H),H+=15,k.setDrawColor(100,100,100),k.line(O,H,O+70,H),k.line(U,H,U+70,H),k.save(`contrat_sous_traitance_${K.trainerName.replace(/\s/g,"_")}_${Dt(new Date,"yyyy-MM-dd")}.pdf`),ae.success("Contrat complet téléchargé en PDF")}catch(k){console.error("Error generating PDF:",k),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(it,{className:"h-8 w-8 animate-spin text-primary"})}):o?s.jsxs(s.Fragment,{children:[s.jsx(nr,{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(Rn,{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($r,{className:"h-5 w-5"}),s.jsx("span",{className:"font-semibold",children:"En attente de signature"})]}),s.jsxs(ne,{onClick:R,variant:"outline",size:"sm",children:[s.jsx(ro,{className:"h-4 w-4 mr-2"}),"Télécharger le PDF"]})]})]}),o.signed_contract_url&&s.jsxs(Iw,{className:"bg-green-50 border-green-200 dark:bg-green-950/20 dark:border-green-900",children:[s.jsx(Kt,{className:"h-4 w-4 text-green-600"}),s.jsx(S5,{className:"text-green-800 dark:text-green-200",children:"Contrat signé disponible"}),s.jsxs(Rw,{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(Kt,{className:"h-4 w-4"}),"Voir le contrat signé",s.jsx(Kn,{className:"h-3 w-3"})]})]})]}),c.length>0&&!o.signed_contract_url&&s.jsxs(Iw,{variant:"destructive",children:[s.jsx(Li,{className:"h-4 w-4"}),s.jsx(S5,{children:"Informations juridiques incomplètes"}),s.jsxs(Rw,{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((k,E)=>s.jsx("li",{children:k},E))}),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(ed,{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(lu,{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(Rn,{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(no,{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(ed,{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(je,{className:"border-primary/30",children:[s.jsx(mt,{children:s.jsx(gt,{className:"text-lg",children:"Signer le contrat en ligne"})}),s.jsxs(Ee,{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:j,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:_,children:"Effacer"})]}),s.jsxs("div",{className:"flex items-start gap-3 pt-2",children:[s.jsx(Yo,{id:"accept-contract",checked:p,onCheckedChange:k=>g(k===!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(it,{className:"mr-2 h-4 w-4 animate-spin"}),"Signature en cours..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Rn,{className:"mr-2 h-4 w-4"}),"Signer le contrat"]})})]})]}),o.status==="signed"&&!o.signed_contract_url&&s.jsxs(Iw,{className:"border-amber-200 bg-amber-50 dark:bg-amber-950/20",children:[s.jsx($r,{className:"h-4 w-4 text-amber-600"}),s.jsx(S5,{className:"text-amber-800 dark:text-amber-200",children:"Contrat signé — contre-signature en attente"}),s.jsx(Rw,{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(je,{children:[s.jsx(mt,{children:s.jsx(gt,{children:"Contrat de Sous-Traitance"})}),s.jsx(Ee,{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(je,{children:[s.jsx(mt,{children:s.jsx(gt,{children:"Aucun contrat disponible"})}),s.jsxs(Ee,{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 XUe(){const[e,t]=w.useState(!1);return{applyToOffer:async(a,i)=>{t(!0);try{const{data:{user:o}}=await ce.auth.getUser();if(!o)return ae.error("Vous devez être connecté pour postuler"),{success:!1,error:"Not authenticated"};const{data:l,error:c}=await ce.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 ce.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 ce.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 ce.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 dn.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 ce.auth.getUser();if(!i)return!1;const{data:o}=await ce.from("trainer_profiles").select("id").eq("user_id",i.id).maybeSingle();if(!o)return!1;const{data:l}=await ce.from("trainer_applications").select("id").eq("trainer_id",o.id).eq("school_request_id",a).maybeSingle();return!!l}catch{return!1}},applying:e}}function H8({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}=XUe(),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(qn,{open:o,onOpenChange:l,children:[s.jsx(Xo,{asChild:!0,children:s.jsxs(ne,{disabled:a,children:[s.jsx(Js,{className:"mr-2 h-4 w-4"}),"Postuler"]})}),s.jsxs($n,{className:"sm:max-w-[500px]",children:[s.jsxs(Un,{children:[s.jsx(Vn,{children:"Postuler à cette offre"}),s.jsxs(Sa,{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(bl,{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(it,{className:"mr-2 h-4 w-4 animate-spin"}),"Envoi..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Js,{className:"mr-2 h-4 w-4"}),"Envoyer ma candidature"]})})]})]})]})}function YUe(){const e=Zt(),{user:t,isTrainer:r}=Br(),[n,a]=w.useState(!0),[i,o]=w.useState([]),[l,c]=w.useState([]),[u,d]=w.useState(new Set),[f,m]=w.useState([]),[h,x]=w.useState(0),[p,g]=w.useState(""),[v,y]=w.useState("all"),[b,N]=w.useState("all"),[j,_]=w.useState("all"),[S,P]=w.useState("relevance"),[T,R]=w.useState({});w.useEffect(()=>{V(),t&&r&&(L(),H())},[t,r]),w.useEffect(()=>{B()},[i,p,v,b,j,S,f]);const k=w.useRef(0);k.current=l.length,w.useEffect(()=>{if(!p.trim())return;const re=setTimeout(()=>{dn.trackSearch(p,{domain:v,city:b,modality:j},k.current,"offers")},900);return()=>clearTimeout(re)},[p]);const E=w.useRef(!1);w.useEffect(()=>{if(!E.current){E.current=!0;return}dn.trackFilterUsed("domain",v,k.current,"offers")},[v]);const q=w.useRef(!1);w.useEffect(()=>{if(!q.current){q.current=!0;return}dn.trackFilterUsed("city",b,k.current,"offers")},[b]);const O=w.useRef(!1);w.useEffect(()=>{if(!O.current){O.current=!0;return}dn.trackFilterUsed("modality",j,k.current,"offers")},[j]);const L=async()=>{try{const{data:re}=await ce.from("trainer_profiles").select("id").eq("user_id",t==null?void 0:t.id).maybeSingle();if(!re)return;const{data:J}=await ce.from("trainer_applications").select("school_request_id").eq("trainer_id",re.id);J&&d(new Set(J.map(ie=>ie.school_request_id)))}catch(re){console.error("Error loading applied offers:",re)}},H=async()=>{try{const{data:re}=await ce.from("trainer_profiles").select("specialties").eq("user_id",t==null?void 0:t.id).maybeSingle();re!=null&&re.specialties&&m(re.specialties)}catch(re){console.error("Error loading trainer specialties:",re)}},V=async()=>{try{const{data:re,error:J}=await ce.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(J)throw J;const ie=new Date;ie.setHours(0,0,0,0);const be=[];let Q=0;(re||[]).forEach(W=>{if(!W.end_date)be.push(W);else{const Z=new Date(W.end_date);Z.setHours(23,59,59,999),Z>=ie?be.push(W):Q++}}),o(be),x(Q);const Ve={};be.forEach(W=>{Ve[W.id]=W.view_count||0}),R(Ve)}catch(re){console.error("Error loading offers:",re),ae.error("Erreur lors du chargement des offres")}finally{a(!1)}},z=re=>{if(f.length===0)return 0;const J=re.subject_areas.map(Q=>Q.toLowerCase()),ie=f.map(Q=>Q.toLowerCase());let be=0;for(const Q of ie)for(const Ve of J)(Ve.includes(Q)||Q.includes(Ve))&&be++;return be},M=re=>!re.is_sponsored||!re.sponsored_until?!1:new Date(re.sponsored_until)>new Date,B=()=>{let re=[...i];if(p.trim()){const J=p.toLowerCase();re=re.filter(ie=>ie.school_name.toLowerCase().includes(J)||ie.description.toLowerCase().includes(J)||ie.subject_areas.some(be=>be.toLowerCase().includes(J))||ie.training_needs&&ie.training_needs.some(be=>be.toLowerCase().includes(J)))}switch(v!=="all"&&(re=re.filter(J=>J.subject_areas.includes(v))),b!=="all"&&(re=re.filter(J=>{var ie;return((ie=J.city)==null?void 0:ie.toLowerCase())===b.toLowerCase()})),j!=="all"&&(re=re.filter(J=>J.modality===j)),S){case"relevance":re.sort((J,ie)=>{const be=M(J)?1:0,Q=M(ie)?1:0;if(Q!==be)return Q-be;const Ve=z(J),W=z(ie);return W!==Ve?W-Ve:new Date(ie.created_at).getTime()-new Date(J.created_at).getTime()});break;case"recent":re.sort((J,ie)=>{const be=M(J)?1:0,Q=M(ie)?1:0;return Q!==be?Q-be:new Date(ie.created_at).getTime()-new Date(J.created_at).getTime()});break;case"views":re.sort((J,ie)=>{const be=M(J)?1:0,Q=M(ie)?1:0;return Q!==be?Q-be:(T[ie.id]||0)-(T[J.id]||0)});break}c(re)},K=["Informatique","Santé & Sécurité au Travail","Management","Pédagogie","Ressources Humaines","Technique & Industrie","Marketing & Communication","Finance & Comptabilité","Langues","Développement Personnel"],C=()=>{const re={};i.forEach(ie=>{ie.subject_areas.forEach(be=>{re[be]=(re[be]||0)+1})});const J=new Set([...K]);return i.forEach(ie=>{ie.subject_areas.forEach(be=>J.add(be))}),Array.from(J).map(ie=>({name:ie,count:re[ie]||0})).sort((ie,be)=>be.count!==ie.count?be.count-ie.count:ie.name.localeCompare(be.name))},A=()=>{const re={};return i.forEach(J=>{J.city&&(re[J.city]=(re[J.city]||0)+1)}),Object.entries(re).map(([J,ie])=>({name:J,count:ie})).sort((J,ie)=>ie.count-J.count)},I=re=>{const J=new Date(re.created_at);return Math.floor((new Date().getTime()-J.getTime())/(1e3*60*60*24))<=7},U=re=>{if(!re.start_date)return!1;const J=new Date(re.start_date),ie=new Date,be=Math.floor((J.getTime()-ie.getTime())/(1e3*60*60*24));return be>=0&&be<=14},Y=re=>{if(!re.start_date)return null;const J=new Date(re.start_date),ie=new Date;return Math.floor((J.getTime()-ie.getTime())/(1e3*60*60*24))},te=re=>re?new Date(re).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(it,{className:"h-8 w-8 animate-spin text-primary"})}):s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx(nr,{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(Qa,{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(je,{className:"mb-4 md:mb-8",children:s.jsx(Ee,{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(Rs,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),s.jsx(Xe,{placeholder:"Mots clés",value:p,onChange:re=>g(re.target.value),className:"pl-10"})]})}),s.jsxs("div",{className:"hidden lg:flex gap-4",children:[s.jsxs(Ar,{value:v,onValueChange:y,children:[s.jsx(kr,{className:"w-64",children:s.jsx(Dr,{placeholder:"Domaine d'expertise"})}),s.jsxs(Cr,{className:"max-h-80",children:[s.jsxs(ct,{value:"all",children:["Tous les domaines (",i.length,")"]}),C().map(({name:re,count:J})=>s.jsxs(ct,{value:re,children:[re," ",J>0&&s.jsxs("span",{className:"text-muted-foreground",children:["(",J,")"]})]},re))]})]}),s.jsxs(Ar,{value:b,onValueChange:N,children:[s.jsx(kr,{className:"w-48",children:s.jsx(Dr,{placeholder:"Ville"})}),s.jsxs(Cr,{className:"max-h-80",children:[s.jsx(ct,{value:"all",children:"Toutes les villes"}),A().map(({name:re,count:J})=>s.jsxs(ct,{value:re,children:[re," (",J,")"]},re))]})]}),s.jsxs(Ar,{value:j,onValueChange:_,children:[s.jsx(kr,{className:"w-48",children:s.jsx(Dr,{placeholder:"Modalité"})}),s.jsxs(Cr,{children:[s.jsx(ct,{value:"all",children:"Toutes modalités"}),s.jsx(ct,{value:"presentiel",children:"Présentiel"}),s.jsx(ct,{value:"distanciel",children:"Distanciel"}),s.jsx(ct,{value:"hybride",children:"Hybride"})]})]}),s.jsxs(Ar,{value:S,onValueChange:re=>P(re),children:[s.jsxs(kr,{className:"w-48",children:[s.jsx(n6,{className:"h-4 w-4 mr-2"}),s.jsx(Dr,{placeholder:"Trier par"})]}),s.jsxs(Cr,{children:[s.jsx(ct,{value:"relevance",children:s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx(Mi,{className:"h-4 w-4"}),"Pertinence"]})}),s.jsx(ct,{value:"recent",children:"Plus récentes"}),s.jsx(ct,{value:"views",children:"Plus consultées"})]})]})]}),s.jsxs(wL,{children:[s.jsx(jL,{asChild:!0,children:s.jsxs(ne,{variant:"outline",className:"lg:hidden w-full",children:[s.jsx(zye,{className:"mr-2 h-4 w-4"}),"Filtres avancés"]})}),s.jsxs(qC,{children:[s.jsxs(UC,{children:[s.jsx(VC,{children:"Filtres"}),s.jsx(_re,{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:()=>{g(""),y("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(Te,{variant:"secondary",className:"text-muted-foreground",children:[s.jsx($r,{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(re=>s.jsx(je,{className:`hover:shadow-lg transition-all cursor-pointer group ${M(re)?"ring-2 ring-amber-400 bg-amber-50/50 dark:bg-amber-950/20":""}`,onClick:()=>e(`/training-offers/${re.id}`),children:s.jsxs(Ee,{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:[M(re)&&s.jsxs(Te,{className:"bg-amber-500 hover:bg-amber-600 text-white",children:[s.jsx(kv,{className:"h-3 w-3 mr-1"}),"Sponsorisée"]}),I(re)&&s.jsxs(Te,{className:"bg-green-500 hover:bg-green-600 text-white",children:[s.jsx(Mi,{className:"h-3 w-3 mr-1"}),"Nouvelle"]}),U(re)&&s.jsxs(Te,{className:"bg-orange-500 hover:bg-orange-600 text-white",children:[s.jsx(wye,{className:"h-3 w-3 mr-1"}),Y(re)===0?"Aujourd'hui":`Dans ${Y(re)}j`]}),re.visibility==="public"?s.jsxs(Te,{variant:"outline",className:"border-blue-500 text-blue-600",children:[s.jsx(ap,{className:"h-3 w-3 mr-1"}),"Publique"]}):s.jsxs(Te,{variant:"outline",className:"border-purple-500 text-purple-600",children:[s.jsx(er,{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:[re.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(es,{className:"h-4 w-4"}),s.jsx("span",{children:T[re.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(Is,{className:"h-4 w-4 shrink-0"}),s.jsx("span",{className:"line-clamp-1",children:re.city?`${re.city} - ${re.school_name}`:re.school_name})]}),s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(Hs,{className:"h-4 w-4 shrink-0"}),s.jsxs("span",{children:["Le ",te(re.start_date)]})]})]}),s.jsxs("div",{className:"flex flex-wrap gap-2 mb-4",children:[s.jsx(Te,{variant:"secondary",className:"text-xs",children:re.modality==="distanciel"?"Distanciel":re.modality==="hybride"?"Hybride":"Présentiel"}),re.duration_hours&&s.jsxs(Te,{variant:"secondary",className:"text-xs",children:[re.duration_hours,"h"]})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[re.subject_areas.slice(0,3).map((J,ie)=>s.jsx(Te,{variant:"outline",className:"text-xs bg-primary/10 text-primary border-primary/20",children:J},ie)),re.subject_areas.length>3&&s.jsxs(Te,{variant:"outline",className:"text-xs",children:["+",re.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:J=>J.stopPropagation(),className:"flex-1",children:s.jsx(H8,{offerId:re.id,offerTitle:re.description,schoolName:re.school_name,hasApplied:u.has(re.id),onSuccess:()=>d(J=>new Set([...J,re.id]))})}),s.jsx(ne,{size:"sm",className:"flex-1",onClick:J=>{J.stopPropagation(),e(`/training-offers/${re.id}`)},children:"Voir l'offre"})]})]})},re.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:()=>{g(""),y("all"),N("all")},children:"Réinitialiser les filtres"})]})]})]})}function ZUe({offerId:e,offerTitle:t}){const r=Zt(),[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:x,error:p}=await ce.functions.invoke("recommend-trainers",{body:{offerId:e}});if(p)throw p;if(x.error)throw new Error(x.error);a(x.recommendations||[]),c(!0)}catch(x){console.error("Error loading recommendations:",x),d(x instanceof Error?x.message:"Erreur lors du chargement"),ae.error("Erreur lors du chargement des recommandations")}finally{o(!1)}},m=x=>x>=80?"text-green-600 bg-green-100 dark:bg-green-900/30":x>=60?"text-blue-600 bg-blue-100 dark:bg-blue-900/30":x>=40?"text-orange-600 bg-orange-100 dark:bg-orange-900/30":"text-muted-foreground bg-muted",h=x=>x>=80?"Excellent match":x>=60?"Bon match":x>=40?"Match potentiel":"Match faible";return s.jsxs(je,{className:"border-primary/20 bg-gradient-to-br from-primary/5 to-transparent",children:[s.jsxs(mt,{children:[s.jsxs(gt,{className:"flex items-center gap-2 text-lg",children:[s.jsx(Mi,{className:"h-5 w-5 text-primary"}),"Formateurs Recommandés",s.jsxs(Te,{variant:"secondary",className:"ml-2",children:[s.jsx(wi,{className:"h-3 w-3 mr-1"}),"Certifiés PedagoBridge"]})]}),s.jsx(Kr,{children:"Recommandations IA basées sur le matching CV/offre pour les formateurs qui ont signé le contrat PedagoBridge"})]}),s.jsxs(Ee,{children:[!l&&!i&&s.jsxs("div",{className:"text-center py-6",children:[s.jsx(Mi,{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(Mi,{className:"mr-2 h-4 w-4"}),"Générer les recommandations"]})]}),i&&s.jsxs("div",{className:"text-center py-8",children:[s.jsx(it,{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(Qs,{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(Ko,{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(Qs,{className:"mr-2 h-4 w-4"}),"Actualiser"]})}),n.map((x,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(bs,{className:"h-14 w-14",children:[s.jsx(ji,{src:x.trainer.photo_url||void 0,alt:x.trainer.name}),s.jsx(ws,{className:"bg-primary/10",children:x.trainer.name.split(" ").map(g=>g[0]).join("").toUpperCase()})]}),p===0&&s.jsx("div",{className:"absolute -top-1 -right-1 bg-amber-500 rounded-full p-1",children:s.jsx(lu,{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:[x.trainer.name,s.jsxs(Te,{variant:"outline",className:"text-xs",children:[s.jsx(wi,{className:"h-3 w-3 mr-1"}),"Certifié"]})]}),s.jsxs("div",{className:"flex flex-wrap gap-1 mt-1",children:[x.trainer.specialties.slice(0,3).map((g,v)=>s.jsx(Te,{variant:"secondary",className:"text-xs",children:g},v)),x.trainer.specialties.length>3&&s.jsxs(Te,{variant:"outline",className:"text-xs",children:["+",x.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(x.score)}`,children:[s.jsx(no,{className:"h-4 w-4"}),x.score,"%"]})]}),s.jsx("p",{className:"text-sm text-muted-foreground mt-2 line-clamp-2",children:x.reason}),s.jsxs("div",{className:"flex items-center gap-3 mt-3",children:[s.jsxs(ne,{size:"sm",variant:"outline",onClick:()=>r(`/trainers/${x.trainer.id}`),children:[s.jsx(es,{className:"mr-1.5 h-3.5 w-3.5"}),"Voir le profil"]}),s.jsx("span",{className:"text-xs text-muted-foreground",children:h(x.score)})]})]})]},x.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(wi,{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 JUe(){const{id:e}=so(),t=Zt(),{user:r,isTrainer:n,isSchool:a}=Br(),[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&&x())},[e,r,n]);const h=async()=>{try{const{data:y,error:b}=await ce.from("school_requests").select("*, city, address, modality, user_id").eq("id",e).maybeSingle();if(b)throw b;if(!y){t("/training-offers");return}c(y),await ce.rpc("increment_offer_view",{offer_id:y.id}),dn.trackOfferView(y.id,y.description),r&&y.user_id===r.id&&m(!0)}catch(y){console.error("Error loading offer:",y),ae.error("Erreur lors du chargement de l'offre"),t("/training-offers")}finally{o(!1)}},x=async()=>{try{const{data:y}=await ce.from("trainer_profiles").select("id").eq("user_id",r==null?void 0:r.id).single();if(!y)return;const{data:b}=await ce.from("trainer_applications").select("id").eq("trainer_id",y.id).eq("school_request_id",e).single();d(!!b)}catch{d(!1)}},p=y=>y?new Date(y).toLocaleDateString("fr-FR",{day:"numeric",month:"long",year:"numeric"}):"À définir",g=()=>{r?ae.info("Seuls les comptes formateur peuvent postuler aux offres"):(ae.info("Créez votre compte formateur pour postuler à cette offre"),t("/trainer-register"))};if(i)return s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:s.jsx(it,{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=y=>{switch(y){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(nr,{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(l6e,{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(ms,{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(Hn,{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(Is,{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(Hs,{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($r,{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($ye,{className:"h-4 w-4"})}),s.jsx(ne,{variant:"outline",size:"icon",children:s.jsx(oye,{className:"h-4 w-4"})}),n?s.jsx(H8,{offerId:l.id,offerTitle:l.description,schoolName:l.school_name,hasApplied:u,onSuccess:()=>d(!0)}):s.jsx(ne,{onClick:g,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(je,{children:s.jsxs(Ee,{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(Na,{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(Te,{children:l.modality==="distanciel"?"Distanciel":l.modality==="hybride"?"Hybride":"Présentiel"}),l.duration_hours&&s.jsxs(Te,{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(Is,{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(Te,{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(Hs,{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(Hs,{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(Hs,{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($r,{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(er,{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(je,{children:s.jsxs(Ee,{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(je,{children:s.jsxs(Ee,{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((y,b)=>s.jsx(Te,{variant:"outline",className:"text-sm bg-primary/10 text-primary border-primary/20",children:y},b))})]})}),l.training_needs&&l.training_needs.length>0&&s.jsx(je,{children:s.jsxs(Ee,{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((y,b)=>s.jsx(Te,{variant:"secondary",className:"text-sm",children:y},b))})]})}),s.jsx(je,{children:s.jsxs(Ee,{className:"p-6",children:[s.jsxs("h2",{className:"text-xl font-bold mb-4 flex items-center gap-2",children:[s.jsx(Sp,{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(ZUe,{offerId:l.id,offerTitle:l.description})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsx(je,{className:"sticky top-4",children:s.jsxs(Ee,{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(Mu,{}),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(H8,{offerId:l.id,offerTitle:l.description,schoolName:l.school_name,hasApplied:u,onSuccess:()=>d(!0)})}):s.jsx(ne,{className:"w-full mt-4",onClick:g,children:"Postuler à l'offre"})]})]})}),l.estimated_budget&&s.jsx(je,{children:s.jsxs(Ee,{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})]})})]})]})})]})}const eH={"formation-entreprise":{label:"Entreprise · Formation",className:"bg-indigo-100 text-indigo-800 border-indigo-300 dark:bg-indigo-950 dark:text-indigo-200"},"conduite-changement":{label:"Entreprise · Conduite du changement",className:"bg-purple-100 text-purple-800 border-purple-300 dark:bg-purple-950 dark:text-purple-200"},entreprise:{label:"Entreprise",className:"bg-blue-100 text-blue-800 border-blue-300 dark:bg-blue-950 dark:text-blue-200"}};function QUe(){const e=Zt(),{isAdmin:t,loading:r}=Br(),[n,a]=w.useState(!0),[i,o]=w.useState([]),[l,c]=w.useState("pending"),[u,d]=w.useState(!1),[f,m]=w.useState("all");w.useEffect(()=>{!r&&!t&&e("/auth")},[t,r,e]),w.useEffect(()=>{t&&(h(),x())},[t]);const h=async()=>{try{const{data:k,error:E}=await ce.from("school_requests").select("*").order("created_at",{ascending:!1});if(E)throw E;const{data:q,error:O}=await ce.from("trainer_applications").select(`
id,
trainer_id,
status,
created_at,
school_request_id,
trainer_profiles (
id,
name,
email,
specialties
)
`);O&&console.error("Error loading applications:",O);const L=(q||[]).reduce((V,z)=>(V[z.school_request_id]||(V[z.school_request_id]=[]),V[z.school_request_id].push(z),V),{}),H=(k||[]).map(V=>({...V,documents:Array.isArray(V.documents)?V.documents:null,applications:L[V.id]||[]}));o(H)}catch(k){console.error("Error loading requests:",k),ae.error("Erreur lors du chargement des demandes")}finally{a(!1)}},x=()=>{const k=localStorage.getItem("autoApproveTrainingRequests");k&&d(k==="true")},p=k=>{d(k),localStorage.setItem("autoApproveTrainingRequests",String(k)),ae.success(k?"Approbation automatique activée":"Approbation automatique désactivée")},g=async(k,E)=>{try{const q=i.find(L=>L.id===k),{error:O}=await ce.from("school_requests").update({status:E}).eq("id",k);if(O)throw O;if(ae.success(E==="approved"?"Demande approuvée et publiée !":E==="rejected"?"Demande rejetée":"Demande archivée"),E==="approved"&&q){if(q.user_id)try{await ce.from("notifications").insert({user_id:q.user_id,title:"Offre approuvée",message:`Votre offre de formation "${q.school_name}" a été approuvée et est maintenant visible par les formateurs.`,type:"success",link:"/school/dashboard",metadata:{school_request_id:k}})}catch(L){console.error("Failed to create notification:",L)}try{const{error:L}=await ce.functions.invoke("notify-offer-approved",{body:{schoolName:q.school_name,contactName:q.contact_name,contactEmail:q.contact_email,offerId:k,subjectAreas:q.subject_areas,startDate:q.start_date,endDate:q.end_date}});L?console.error("Error sending approval email:",L):ae.success("Email d'approbation envoyé à l'école")}catch(L){console.error("Failed to send approval email:",L)}try{const{data:L,error:H}=await ce.functions.invoke("publish-offer-to-linkedin",{body:{schoolName:q.school_name,offerId:k,subjectAreas:q.subject_areas,description:q.description}});H?console.error("LinkedIn publish error:",H):(L==null?void 0:L.posted)>0?ae.success(`Offre publiée sur LinkedIn (${L.posted} compte(s))`):L!=null&&L.message&&console.warn("LinkedIn publish:",L.message)}catch(L){console.error("Failed to publish to LinkedIn:",L)}}if(E==="rejected"&&(q!=null&&q.user_id))try{await ce.from("notifications").insert({user_id:q.user_id,title:"Offre non publiée",message:`Votre offre de formation "${q.school_name}" n'a pas été publiée. Contactez-nous pour plus d'informations.`,type:"warning",link:"/school/dashboard",metadata:{school_request_id:k}})}catch(L){console.error("Failed to create notification:",L)}if(E==="approved")try{const{error:L}=await ce.functions.invoke("send-recommendations-email",{body:{offerId:k}});L?console.error("Error sending recommendation email:",L):ae.success("Email de recommandations envoyé à l'école")}catch(L){console.error("Failed to send recommendation email:",L)}h()}catch(q){console.error("Error updating request status:",q),ae.error("Erreur lors de la mise à jour")}},v=async k=>{try{const{error:E}=await ce.from("school_requests").delete().eq("id",k);if(E)throw E;ae.success("Demande supprimée"),h()}catch(E){console.error("Error deleting request:",E),ae.error("Erreur lors de la suppression")}},y=k=>k?new Date(k).toLocaleDateString("fr-FR",{day:"numeric",month:"long",year:"numeric"}):"Non définie",b=k=>{if(!k)return!1;const E=new Date(k),q=new Date;return q.setDate(q.getDate()-3),E<q},N=k=>f==="all"?!0:f==="direct"?!k.source:f==="entreprise-all"?!!k.source:k.source===f,j=i.filter(N),_=i.filter(k=>!!k.source).length,S=j.filter(k=>k.status==="pending"),P=j.filter(k=>k.status==="approved"&&!b(k.end_date)),T=j.filter(k=>k.status==="rejected"||k.status==="archived"||k.status==="approved"&&b(k.end_date));if(r||n)return s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:s.jsx(it,{className:"h-8 w-8 animate-spin text-primary"})});const R=({request:k})=>{var q,O;const E=b(k.end_date);return s.jsx(je,{className:`hover:shadow-lg transition-all ${E?"opacity-60":""}`,children:s.jsxs(Ee,{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(yr,{className:"h-5 w-5 text-primary"}),s.jsxs(nt,{to:"/admin/schools",className:"text-xl font-bold hover:text-primary transition-colors flex items-center gap-1",children:[k.school_name,s.jsx(Kn,{className:"w-4 h-4 opacity-50"})]}),k.source&&s.jsx(Te,{variant:"outline",className:`text-xs ${((q=eH[k.source])==null?void 0:q.className)??""}`,children:((O=eH[k.source])==null?void 0:O.label)??k.source})]}),s.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-4",children:k.description})]}),s.jsxs("div",{className:"flex flex-col items-end gap-2",children:[s.jsx(Te,{variant:k.status==="approved"?"default":k.status==="pending"?"secondary":"destructive",children:k.status==="approved"?E?"Expirée":"Publiée":k.status==="pending"?"En attente":k.status==="archived"?"Archivée":"Rejetée"}),E&&k.status==="approved"&&s.jsx(Te,{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(Dye,{className:"h-4 w-4"}),s.jsx("span",{children:k.view_count||0})]}),s.jsxs("div",{className:"flex items-center gap-1",title:"Nombre de candidatures",children:[s.jsx(fy,{className:"h-4 w-4"}),s.jsx("span",{children:k.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(er,{className:"h-4 w-4 text-muted-foreground"}),s.jsxs("span",{className:"text-sm",children:[k.contact_name,k.contact_position&&` - ${k.contact_position}`]})]}),s.jsxs("a",{href:`mailto:${k.contact_email}`,className:"flex items-center gap-2 hover:text-primary transition-colors",children:[s.jsx(_n,{className:"h-4 w-4 text-muted-foreground"}),s.jsx("span",{className:"text-sm",children:k.contact_email})]}),k.contact_phone&&s.jsxs("a",{href:`tel:${k.contact_phone}`,className:"flex items-center gap-2 hover:text-primary transition-colors",children:[s.jsx(a1,{className:"h-4 w-4 text-muted-foreground"}),s.jsx("span",{className:"text-sm",children:k.contact_phone})]}),k.city&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Is,{className:"h-4 w-4 text-muted-foreground"}),s.jsx("span",{className:"text-sm",children:k.city})]}),k.duration_hours&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx($r,{className:"h-4 w-4 text-muted-foreground"}),s.jsxs("span",{className:"text-sm",children:[k.duration_hours,"h de formation"]})]}),k.tjm_offered&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(s1,{className:"h-4 w-4 text-muted-foreground"}),s.jsxs("span",{className:"text-sm",children:[k.tjm_offered,"€/jour (TJM)"]})]}),k.modality&&s.jsx("div",{className:"flex items-center gap-2",children:s.jsx(Te,{variant:"outline",className:"text-xs capitalize",children:k.modality==="presentiel"?"Présentiel":k.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(Hs,{className:"h-4 w-4 text-muted-foreground"}),s.jsxs("span",{children:["Début: ",y(k.start_date)]})]}),s.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[s.jsx(Hs,{className:"h-4 w-4 text-muted-foreground"}),s.jsxs("span",{children:["Fin: ",y(k.end_date)]})]})]}),s.jsx("div",{className:"flex flex-wrap gap-2 mb-4",children:k.subject_areas.map((L,H)=>s.jsx(Te,{variant:"outline",className:"text-xs",children:L},H))}),(k.estimated_budget||k.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: ",k.estimated_budget||k.budget_range]})}),k.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(Kt,{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:k.notes})]})}),k.documents&&k.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(Kt,{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 (",k.documents.length,")"]})]}),s.jsx("div",{className:"space-y-2",children:k.documents.map((L,H)=>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(Te,{variant:"outline",className:"text-xs",children:L.type}),s.jsx("span",{className:"text-sm truncate max-w-[200px]",children:L.name})]}),s.jsx(ne,{variant:"ghost",size:"sm",asChild:!0,children:s.jsx("a",{href:L.url,target:"_blank",rel:"noopener noreferrer",children:s.jsx(ro,{className:"h-4 w-4"})})})]},H))})]}),k.applications&&k.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(fy,{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 (",k.applications.length,")"]})]}),s.jsx("div",{className:"space-y-2",children:k.applications.map(L=>{var H,V;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:((H=L.trainer_profiles)==null?void 0:H.name)||"Formateur"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:(V=L.trainer_profiles)==null?void 0:V.email})]}),s.jsx(Te,{variant:L.status==="accepted"?"default":L.status==="rejected"?"destructive":"secondary",className:"text-xs",children:L.status==="accepted"?"Acceptée":L.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(L.created_at).toLocaleDateString("fr-FR")}),s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>{var z;return e(`/trainer/${(z=L.trainer_profiles)==null?void 0:z.id}`)},children:s.jsx(es,{className:"h-4 w-4"})})]})]},L.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/${k.id}`),children:[s.jsx(es,{className:"w-4 h-4 mr-2"}),"Voir l'offre"]}),k.status==="pending"&&s.jsxs(s.Fragment,{children:[s.jsxs(ne,{size:"sm",onClick:()=>g(k.id,"approved"),className:"bg-green-600 hover:bg-green-700",children:[s.jsx(Zn,{className:"w-4 h-4 mr-2"}),"Approuver"]}),s.jsxs(ne,{size:"sm",variant:"destructive",onClick:()=>g(k.id,"rejected"),children:[s.jsx(vs,{className:"w-4 h-4 mr-2"}),"Rejeter"]})]}),k.status==="approved"&&!E&&s.jsx(ne,{size:"sm",variant:"outline",onClick:()=>g(k.id,"archived"),children:"Archiver"}),(k.status==="rejected"||E)&&s.jsxs(Gu,{children:[s.jsx(th,{asChild:!0,children:s.jsxs(ne,{size:"sm",variant:"destructive",children:[s.jsx(ri,{className:"w-4 h-4 mr-2"}),"Supprimer"]})}),s.jsxs(Kc,{children:[s.jsxs(Xc,{children:[s.jsx(Zc,{children:"Confirmer la suppression"}),s.jsxs(Jc,{children:["Cette action est irréversible. La demande de ",k.school_name," sera définitivement supprimée."]})]}),s.jsxs(Yc,{children:[s.jsx(Ku,{children:"Annuler"}),s.jsx(Qc,{onClick:()=>v(k.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(ta,{items:[{label:"Offres de Formation"}]}),s.jsxs(je,{children:[s.jsxs(mt,{children:[s.jsxs("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between gap-4",children:[s.jsx(gt,{className:"text-3xl",children:"Gestion des Offres de Formation"}),s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-3",children:[s.jsxs(Ar,{value:f,onValueChange:m,children:[s.jsx(kr,{className:"w-[260px]",children:s.jsx(Dr,{placeholder:"Filtrer par source"})}),s.jsxs(Cr,{children:[s.jsx(ct,{value:"all",children:"Toutes les sources"}),s.jsxs(ct,{value:"entreprise-all",children:["Entreprises (",_,")"]}),s.jsx(ct,{value:"formation-entreprise",children:"— Formation en entreprise"}),s.jsx(ct,{value:"conduite-changement",children:"— Conduite du changement"}),s.jsx(ct,{value:"entreprise",children:"— Entreprise (générique)"}),s.jsx(ct,{value:"direct",children:"Direct / École"})]})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(jy,{id:"auto-approve",checked:u,onCheckedChange:p}),s.jsx(We,{htmlFor:"auto-approve",className:"text-sm whitespace-nowrap",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(Ee,{children:s.jsxs(uf,{value:l,onValueChange:c,children:[s.jsxs(fd,{className:"grid w-full grid-cols-3 mb-6",children:[s.jsxs(Mn,{value:"pending",children:["En attente (",S.length,")"]}),s.jsxs(Mn,{value:"approved",children:["Publiées (",P.length,")"]}),s.jsxs(Mn,{value:"archived",children:["Archivées (",T.length,")"]})]}),s.jsx(Os,{value:"pending",className:"space-y-4",children:S.length===0?s.jsx("p",{className:"text-center text-muted-foreground py-8",children:"Aucune demande en attente"}):S.map(k=>s.jsx(R,{request:k},k.id))}),s.jsx(Os,{value:"approved",className:"space-y-4",children:P.length===0?s.jsx("p",{className:"text-center text-muted-foreground py-8",children:"Aucune offre publiée"}):P.map(k=>s.jsx(R,{request:k},k.id))}),s.jsx(Os,{value:"archived",className:"space-y-4",children:T.length===0?s.jsx("p",{className:"text-center text-muted-foreground py-8",children:"Aucune demande archivée"}):T.map(k=>s.jsx(R,{request:k},k.id))})]})})]})]})})}var eVe=Array.isArray,El=eVe,tVe=typeof zc=="object"&&zc&&zc.Object===Object&&zc,Fce=tVe,rVe=Fce,nVe=typeof self=="object"&&self&&self.Object===Object&&self,sVe=rVe||nVe||Function("return this")(),ff=sVe,aVe=ff,iVe=aVe.Symbol,w_=iVe,tH=w_,Mce=Object.prototype,oVe=Mce.hasOwnProperty,lVe=Mce.toString,Bb=tH?tH.toStringTag:void 0;function cVe(e){var t=oVe.call(e,Bb),r=e[Bb];try{e[Bb]=void 0;var n=!0}catch{}var a=lVe.call(e);return n&&(t?e[Bb]=r:delete e[Bb]),a}var uVe=cVe,dVe=Object.prototype,fVe=dVe.toString;function hVe(e){return fVe.call(e)}var mVe=hVe,rH=w_,pVe=uVe,xVe=mVe,gVe="[object Null]",vVe="[object Undefined]",nH=rH?rH.toStringTag:void 0;function yVe(e){return e==null?e===void 0?vVe:gVe:nH&&nH in Object(e)?pVe(e):xVe(e)}var Eh=yVe;function bVe(e){return e!=null&&typeof e=="object"}var Ah=bVe,wVe=Eh,jVe=Ah,_Ve="[object Symbol]";function NVe(e){return typeof e=="symbol"||jVe(e)&&wVe(e)==_Ve}var E1=NVe,SVe=El,kVe=E1,CVe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,EVe=/^\w*$/;function AVe(e,t){if(SVe(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||kVe(e)?!0:EVe.test(e)||!CVe.test(e)||t!=null&&e in Object(t)}var WF=AVe;function TVe(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Lp=TVe;const A1=Sn(Lp);var PVe=Eh,OVe=Lp,DVe="[object AsyncFunction]",IVe="[object Function]",RVe="[object GeneratorFunction]",LVe="[object Proxy]";function FVe(e){if(!OVe(e))return!1;var t=PVe(e);return t==IVe||t==RVe||t==DVe||t==LVe}var GF=FVe;const qr=Sn(GF);var MVe=ff,$Ve=MVe["__core-js_shared__"],BVe=$Ve,hP=BVe,sH=function(){var e=/[^.]+$/.exec(hP&&hP.keys&&hP.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function zVe(e){return!!sH&&sH in e}var qVe=zVe,UVe=Function.prototype,VVe=UVe.toString;function HVe(e){if(e!=null){try{return VVe.call(e)}catch{}try{return e+""}catch{}}return""}var $ce=HVe,WVe=GF,GVe=qVe,KVe=Lp,XVe=$ce,YVe=/[\\^$.*+?()[\]{}|]/g,ZVe=/^\[object .+?Constructor\]$/,JVe=Function.prototype,QVe=Object.prototype,eHe=JVe.toString,tHe=QVe.hasOwnProperty,rHe=RegExp("^"+eHe.call(tHe).replace(YVe,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function nHe(e){if(!KVe(e)||GVe(e))return!1;var t=WVe(e)?rHe:ZVe;return t.test(XVe(e))}var sHe=nHe;function aHe(e,t){return e==null?void 0:e[t]}var iHe=aHe,oHe=sHe,lHe=iHe;function cHe(e,t){var r=lHe(e,t);return oHe(r)?r:void 0}var Z0=cHe,uHe=Z0,dHe=uHe(Object,"create"),AE=dHe,aH=AE;function fHe(){this.__data__=aH?aH(null):{},this.size=0}var hHe=fHe;function mHe(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var pHe=mHe,xHe=AE,gHe="__lodash_hash_undefined__",vHe=Object.prototype,yHe=vHe.hasOwnProperty;function bHe(e){var t=this.__data__;if(xHe){var r=t[e];return r===gHe?void 0:r}return yHe.call(t,e)?t[e]:void 0}var wHe=bHe,jHe=AE,_He=Object.prototype,NHe=_He.hasOwnProperty;function SHe(e){var t=this.__data__;return jHe?t[e]!==void 0:NHe.call(t,e)}var kHe=SHe,CHe=AE,EHe="__lodash_hash_undefined__";function AHe(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=CHe&&t===void 0?EHe:t,this}var THe=AHe,PHe=hHe,OHe=pHe,DHe=wHe,IHe=kHe,RHe=THe;function T1(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])}}T1.prototype.clear=PHe;T1.prototype.delete=OHe;T1.prototype.get=DHe;T1.prototype.has=IHe;T1.prototype.set=RHe;var LHe=T1;function FHe(){this.__data__=[],this.size=0}var MHe=FHe;function $He(e,t){return e===t||e!==e&&t!==t}var KF=$He,BHe=KF;function zHe(e,t){for(var r=e.length;r--;)if(BHe(e[r][0],t))return r;return-1}var TE=zHe,qHe=TE,UHe=Array.prototype,VHe=UHe.splice;function HHe(e){var t=this.__data__,r=qHe(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():VHe.call(t,r,1),--this.size,!0}var WHe=HHe,GHe=TE;function KHe(e){var t=this.__data__,r=GHe(t,e);return r<0?void 0:t[r][1]}var XHe=KHe,YHe=TE;function ZHe(e){return YHe(this.__data__,e)>-1}var JHe=ZHe,QHe=TE;function eWe(e,t){var r=this.__data__,n=QHe(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}var tWe=eWe,rWe=MHe,nWe=WHe,sWe=XHe,aWe=JHe,iWe=tWe;function P1(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])}}P1.prototype.clear=rWe;P1.prototype.delete=nWe;P1.prototype.get=sWe;P1.prototype.has=aWe;P1.prototype.set=iWe;var PE=P1,oWe=Z0,lWe=ff,cWe=oWe(lWe,"Map"),XF=cWe,iH=LHe,uWe=PE,dWe=XF;function fWe(){this.size=0,this.__data__={hash:new iH,map:new(dWe||uWe),string:new iH}}var hWe=fWe;function mWe(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var pWe=mWe,xWe=pWe;function gWe(e,t){var r=e.__data__;return xWe(t)?r[typeof t=="string"?"string":"hash"]:r.map}var OE=gWe,vWe=OE;function yWe(e){var t=vWe(this,e).delete(e);return this.size-=t?1:0,t}var bWe=yWe,wWe=OE;function jWe(e){return wWe(this,e).get(e)}var _We=jWe,NWe=OE;function SWe(e){return NWe(this,e).has(e)}var kWe=SWe,CWe=OE;function EWe(e,t){var r=CWe(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}var AWe=EWe,TWe=hWe,PWe=bWe,OWe=_We,DWe=kWe,IWe=AWe;function O1(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])}}O1.prototype.clear=TWe;O1.prototype.delete=PWe;O1.prototype.get=OWe;O1.prototype.has=DWe;O1.prototype.set=IWe;var YF=O1,Bce=YF,RWe="Expected a function";function ZF(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(RWe);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(ZF.Cache||Bce),r}ZF.Cache=Bce;var zce=ZF;const LWe=Sn(zce);var FWe=zce,MWe=500;function $We(e){var t=FWe(e,function(n){return r.size===MWe&&r.clear(),n}),r=t.cache;return t}var BWe=$We,zWe=BWe,qWe=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,UWe=/\\(\\)?/g,VWe=zWe(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(qWe,function(r,n,a,i){t.push(a?i.replace(UWe,"$1"):n||r)}),t}),HWe=VWe;function WWe(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 JF=WWe,oH=w_,GWe=JF,KWe=El,XWe=E1,lH=oH?oH.prototype:void 0,cH=lH?lH.toString:void 0;function qce(e){if(typeof e=="string")return e;if(KWe(e))return GWe(e,qce)+"";if(XWe(e))return cH?cH.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var YWe=qce,ZWe=YWe;function JWe(e){return e==null?"":ZWe(e)}var Uce=JWe,QWe=El,eGe=WF,tGe=HWe,rGe=Uce;function nGe(e,t){return QWe(e)?e:eGe(e,t)?[e]:tGe(rGe(e))}var Vce=nGe,sGe=E1;function aGe(e){if(typeof e=="string"||sGe(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var DE=aGe,iGe=Vce,oGe=DE;function lGe(e,t){t=iGe(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[oGe(t[r++])];return r&&r==n?e:void 0}var QF=lGe,cGe=QF;function uGe(e,t,r){var n=e==null?void 0:cGe(e,t);return n===void 0?r:n}var Hce=uGe;const sc=Sn(Hce);function dGe(e){return e==null}var fGe=dGe;const Jr=Sn(fGe);var hGe=Eh,mGe=El,pGe=Ah,xGe="[object String]";function gGe(e){return typeof e=="string"||!mGe(e)&&pGe(e)&&hGe(e)==xGe}var vGe=gGe;const S0=Sn(vGe);var Wce={exports:{}},us={};/**
* @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 eM=Symbol.for("react.element"),tM=Symbol.for("react.portal"),IE=Symbol.for("react.fragment"),RE=Symbol.for("react.strict_mode"),LE=Symbol.for("react.profiler"),FE=Symbol.for("react.provider"),ME=Symbol.for("react.context"),yGe=Symbol.for("react.server_context"),$E=Symbol.for("react.forward_ref"),BE=Symbol.for("react.suspense"),zE=Symbol.for("react.suspense_list"),qE=Symbol.for("react.memo"),UE=Symbol.for("react.lazy"),bGe=Symbol.for("react.offscreen"),Gce;Gce=Symbol.for("react.module.reference");function fu(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case eM:switch(e=e.type,e){case IE:case LE:case RE:case BE:case zE:return e;default:switch(e=e&&e.$$typeof,e){case yGe:case ME:case $E:case UE:case qE:case FE:return e;default:return t}}case tM:return t}}}us.ContextConsumer=ME;us.ContextProvider=FE;us.Element=eM;us.ForwardRef=$E;us.Fragment=IE;us.Lazy=UE;us.Memo=qE;us.Portal=tM;us.Profiler=LE;us.StrictMode=RE;us.Suspense=BE;us.SuspenseList=zE;us.isAsyncMode=function(){return!1};us.isConcurrentMode=function(){return!1};us.isContextConsumer=function(e){return fu(e)===ME};us.isContextProvider=function(e){return fu(e)===FE};us.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===eM};us.isForwardRef=function(e){return fu(e)===$E};us.isFragment=function(e){return fu(e)===IE};us.isLazy=function(e){return fu(e)===UE};us.isMemo=function(e){return fu(e)===qE};us.isPortal=function(e){return fu(e)===tM};us.isProfiler=function(e){return fu(e)===LE};us.isStrictMode=function(e){return fu(e)===RE};us.isSuspense=function(e){return fu(e)===BE};us.isSuspenseList=function(e){return fu(e)===zE};us.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===IE||e===LE||e===RE||e===BE||e===zE||e===bGe||typeof e=="object"&&e!==null&&(e.$$typeof===UE||e.$$typeof===qE||e.$$typeof===FE||e.$$typeof===ME||e.$$typeof===$E||e.$$typeof===Gce||e.getModuleId!==void 0)};us.typeOf=fu;Wce.exports=us;var wGe=Wce.exports,jGe=Eh,_Ge=Ah,NGe="[object Number]";function SGe(e){return typeof e=="number"||_Ge(e)&&jGe(e)==NGe}var Kce=SGe;const kGe=Sn(Kce);var CGe=Kce;function EGe(e){return CGe(e)&&e!=+e}var AGe=EGe;const j_=Sn(AGe);var Vo=function(t){return t===0?0:t>0?1:-1},Tx=function(t){return S0(t)&&t.indexOf("%")===t.length-1},Ft=function(t){return kGe(t)&&!j_(t)},TGe=function(t){return Jr(t)},bi=function(t){return Ft(t)||S0(t)},PGe=0,D1=function(t){var r=++PGe;return"".concat(t||"").concat(r)},Ho=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(!Ft(t)&&!S0(t))return n;var i;if(Tx(t)){var o=t.indexOf("%");i=r*parseFloat(t.slice(0,o))/100}else i=+t;return j_(i)&&(i=n),a&&i>r&&(i=r),i},gm=function(t){if(!t)return null;var r=Object.keys(t);return r&&r.length?t[r[0]]:null},OGe=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},Hl=function(t,r){return Ft(t)&&Ft(r)?function(n){return t+n*(r-t)}:function(){return r}};function L4(e,t,r){return!e||!e.length?null:e.find(function(n){return n&&(typeof t=="function"?t(n):sc(n,t))===r})}var DGe=function(t,r){return Ft(t)&&Ft(r)?t-r:S0(t)&&S0(r)?t.localeCompare(r):t instanceof Date&&r instanceof Date?t.getTime()-r.getTime():String(t).localeCompare(String(r))};function Mv(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 W8(e){"@babel/helpers - typeof";return W8=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},W8(e)}var IGe=["viewBox","children"],RGe=["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"],uH=["points","pathLength"],mP={svg:IGe,polygon:uH,polyline:uH},rM=["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"],F4=function(t,r){if(!t||typeof t=="function"||typeof t=="boolean")return null;var n=t;if(w.isValidElement(t)&&(n=t.props),!A1(n))return null;var a={};return Object.keys(n).forEach(function(i){rM.includes(i)&&(a[i]=r||function(o){return n[i](n,o)})}),a},LGe=function(t,r,n){return function(a){return t(r,n,a),null}},k0=function(t,r,n){if(!A1(t)||W8(t)!=="object")return null;var a=null;return Object.keys(t).forEach(function(i){var o=t[i];rM.includes(i)&&typeof o=="function"&&(a||(a={}),a[i]=LGe(o,r,n))}),a},FGe=["children"],MGe=["children"];function dH(e,t){if(e==null)return{};var r=$Ge(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 $Ge(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 G8(e){"@babel/helpers - typeof";return G8=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},G8(e)}var fH={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"},nh=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},hH=null,pP=null,nM=function e(t){if(t===hH&&Array.isArray(pP))return pP;var r=[];return w.Children.forEach(t,function(n){Jr(n)||(wGe.isFragment(n)?r=r.concat(e(n.props.children)):r.push(n))}),pP=r,hH=t,r};function ac(e,t){var r=[],n=[];return Array.isArray(t)?n=t.map(function(a){return nh(a)}):n=[nh(t)],nM(e).forEach(function(a){var i=sc(a,"type.displayName")||sc(a,"type.name");n.indexOf(i)!==-1&&r.push(a)}),r}function ql(e,t){var r=ac(e,t);return r&&r[0]}var mH=function(t){if(!t||!t.props)return!1;var r=t.props,n=r.width,a=r.height;return!(!Ft(n)||n<=0||!Ft(a)||a<=0)},BGe=["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"],zGe=function(t){return t&&t.type&&S0(t.type)&&BGe.indexOf(t.type)>=0},qGe=function(t){return t&&G8(t)==="object"&&"clipDot"in t},UGe=function(t,r,n,a){var i,o=(i=mP==null?void 0:mP[a])!==null&&i!==void 0?i:[];return r.startsWith("data-")||!qr(t)&&(a&&o.includes(r)||RGe.includes(r))||n&&rM.includes(r)},Er=function(t,r,n){if(!t||typeof t=="function"||typeof t=="boolean")return null;var a=t;if(w.isValidElement(t)&&(a=t.props),!A1(a))return null;var i={};return Object.keys(a).forEach(function(o){var l;UGe((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 pH(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(!pH(i,o))return!1}return!0},pH=function(t,r){if(Jr(t)&&Jr(r))return!0;if(!Jr(t)&&!Jr(r)){var n=t.props||{},a=n.children,i=dH(n,FGe),o=r.props||{},l=o.children,c=dH(o,MGe);return a&&l?Mv(i,c)&&K8(a,l):!a&&!l?Mv(i,c):!1}return!1},xH=function(t,r){var n=[],a={};return nM(t).forEach(function(i,o){if(zGe(i))n.push(i);else if(i){var l=nh(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},VGe=function(t){var r=t&&t.type;return r&&fH[r]?fH[r]:null},HGe=function(t,r){return nM(r).indexOf(t)},WGe=["children","width","height","viewBox","className","style","title","desc"];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 GGe(e,t){if(e==null)return{};var r=KGe(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 KGe(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 Y8(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=GGe(e,WGe),d=a||{width:r,height:n,x:0,y:0},f=tn("recharts-surface",i);return ye.createElement("svg",X8({},Er(u,!0,"svg"),{className:f,width:r,height:n,style:o,viewBox:"".concat(d.x," ").concat(d.y," ").concat(d.width," ").concat(d.height)}),ye.createElement("title",null,l),ye.createElement("desc",null,c),t)}var XGe=["children","className"];function Z8(){return Z8=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},Z8.apply(this,arguments)}function YGe(e,t){if(e==null)return{};var r=ZGe(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 ZGe(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 zn=ye.forwardRef(function(e,t){var r=e.children,n=e.className,a=YGe(e,XGe),i=tn("recharts-layer",n);return ye.createElement("g",Z8({className:i},Er(a,!0),{ref:t}),r)}),Xu=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 JGe(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 QGe=JGe,eKe=QGe;function tKe(e,t,r){var n=e.length;return r=r===void 0?n:r,!t&&r>=n?e:eKe(e,t,r)}var rKe=tKe,nKe="\\ud800-\\udfff",sKe="\\u0300-\\u036f",aKe="\\ufe20-\\ufe2f",iKe="\\u20d0-\\u20ff",oKe=sKe+aKe+iKe,lKe="\\ufe0e\\ufe0f",cKe="\\u200d",uKe=RegExp("["+cKe+nKe+oKe+lKe+"]");function dKe(e){return uKe.test(e)}var Xce=dKe;function fKe(e){return e.split("")}var hKe=fKe,Yce="\\ud800-\\udfff",mKe="\\u0300-\\u036f",pKe="\\ufe20-\\ufe2f",xKe="\\u20d0-\\u20ff",gKe=mKe+pKe+xKe,vKe="\\ufe0e\\ufe0f",yKe="["+Yce+"]",J8="["+gKe+"]",Q8="\\ud83c[\\udffb-\\udfff]",bKe="(?:"+J8+"|"+Q8+")",Zce="[^"+Yce+"]",Jce="(?:\\ud83c[\\udde6-\\uddff]){2}",Qce="[\\ud800-\\udbff][\\udc00-\\udfff]",wKe="\\u200d",eue=bKe+"?",tue="["+vKe+"]?",jKe="(?:"+wKe+"(?:"+[Zce,Jce,Qce].join("|")+")"+tue+eue+")*",_Ke=tue+eue+jKe,NKe="(?:"+[Zce+J8+"?",J8,Jce,Qce,yKe].join("|")+")",SKe=RegExp(Q8+"(?="+Q8+")|"+NKe+_Ke,"g");function kKe(e){return e.match(SKe)||[]}var CKe=kKe,EKe=hKe,AKe=Xce,TKe=CKe;function PKe(e){return AKe(e)?TKe(e):EKe(e)}var OKe=PKe,DKe=rKe,IKe=Xce,RKe=OKe,LKe=Uce;function FKe(e){return function(t){t=LKe(t);var r=IKe(t)?RKe(t):void 0,n=r?r[0]:t.charAt(0),a=r?DKe(r,1).join(""):t.slice(1);return n[e]()+a}}var MKe=FKe,$Ke=MKe,BKe=$Ke("toUpperCase"),zKe=BKe;const VE=Sn(zKe);function Es(e){return function(){return e}}const rue=Math.cos,M4=Math.sin,pd=Math.sqrt,$4=Math.PI,HE=2*$4,eD=Math.PI,tD=2*eD,mx=1e-6,qKe=tD-mx;function nue(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=arguments[t]+e[t]}function UKe(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return nue;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 VKe{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?nue:UKe(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>mx)if(!(Math.abs(f*c-u*d)>mx)||!i)this._append`L${this._x1=t},${this._y1=r}`;else{let h=n-o,x=a-l,p=c*c+u*u,g=h*h+x*x,v=Math.sqrt(p),y=Math.sqrt(m),b=i*Math.tan((eD-Math.acos((p+m-g)/(2*v*y)))/2),N=b/y,j=b/v;Math.abs(N-1)>mx&&this._append`L${t+N*d},${r+N*f}`,this._append`A${i},${i},0,0,${+(f*h>d*x)},${this._x1=t+j*c},${this._y1=r+j*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)>mx||Math.abs(this._y1-d)>mx)&&this._append`L${u},${d}`,n&&(m<0&&(m=m%tD+tD),m>qKe?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>mx&&this._append`A${n},${n},0,${+(m>=eD)},${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 sM(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 VKe(t)}function aM(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function sue(e){this._context=e}sue.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 WE(e){return new sue(e)}function aue(e){return e[0]}function iue(e){return e[1]}function oue(e,t){var r=Es(!0),n=null,a=WE,i=null,o=sM(l);e=typeof e=="function"?e:e===void 0?aue:Es(e),t=typeof t=="function"?t:t===void 0?iue:Es(t);function l(c){var u,d=(c=aM(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:Es(+c),l):e},l.y=function(c){return arguments.length?(t=typeof c=="function"?c:Es(+c),l):t},l.defined=function(c){return arguments.length?(r=typeof c=="function"?c:Es(!!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 _S(e,t,r){var n=null,a=Es(!0),i=null,o=WE,l=null,c=sM(u);e=typeof e=="function"?e:e===void 0?aue:Es(+e),t=typeof t=="function"?t:Es(t===void 0?0:+t),r=typeof r=="function"?r:r===void 0?iue:Es(+r);function u(f){var m,h,x,p=(f=aM(f)).length,g,v=!1,y,b=new Array(p),N=new Array(p);for(i==null&&(l=o(y=c())),m=0;m<=p;++m){if(!(m<p&&a(g=f[m],m,f))===v)if(v=!v)h=m,l.areaStart(),l.lineStart();else{for(l.lineEnd(),l.lineStart(),x=m-1;x>=h;--x)l.point(b[x],N[x]);l.lineEnd(),l.areaEnd()}v&&(b[m]=+e(g,m,f),N[m]=+t(g,m,f),l.point(n?+n(g,m,f):b[m],r?+r(g,m,f):N[m]))}if(y)return l=null,y+""||null}function d(){return oue().defined(a).curve(o).context(i)}return u.x=function(f){return arguments.length?(e=typeof f=="function"?f:Es(+f),n=null,u):e},u.x0=function(f){return arguments.length?(e=typeof f=="function"?f:Es(+f),u):e},u.x1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:Es(+f),u):n},u.y=function(f){return arguments.length?(t=typeof f=="function"?f:Es(+f),r=null,u):t},u.y0=function(f){return arguments.length?(t=typeof f=="function"?f:Es(+f),u):t},u.y1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:Es(+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:Es(!!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 lue{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 HKe(e){return new lue(e,!0)}function WKe(e){return new lue(e,!1)}const iM={draw(e,t){const r=pd(t/$4);e.moveTo(r,0),e.arc(0,0,r,0,HE)}},GKe={draw(e,t){const r=pd(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()}},cue=pd(1/3),KKe=cue*2,XKe={draw(e,t){const r=pd(t/KKe),n=r*cue;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}},YKe={draw(e,t){const r=pd(t),n=-r/2;e.rect(n,n,r,r)}},ZKe=.8908130915292852,uue=M4($4/10)/M4(7*$4/10),JKe=M4(HE/10)*uue,QKe=-rue(HE/10)*uue,eXe={draw(e,t){const r=pd(t*ZKe),n=JKe*r,a=QKe*r;e.moveTo(0,-r),e.lineTo(n,a);for(let i=1;i<5;++i){const o=HE*i/5,l=rue(o),c=M4(o);e.lineTo(c*r,-l*r),e.lineTo(l*n-c*a,c*n+l*a)}e.closePath()}},xP=pd(3),tXe={draw(e,t){const r=-pd(t/(xP*3));e.moveTo(0,r*2),e.lineTo(-xP*r,-r),e.lineTo(xP*r,-r),e.closePath()}},jc=-.5,_c=pd(3)/2,rD=1/pd(12),rXe=(rD/2+1)*3,nXe={draw(e,t){const r=pd(t/rXe),n=r/2,a=r*rD,i=n,o=r*rD+r,l=-i,c=o;e.moveTo(n,a),e.lineTo(i,o),e.lineTo(l,c),e.lineTo(jc*n-_c*a,_c*n+jc*a),e.lineTo(jc*i-_c*o,_c*i+jc*o),e.lineTo(jc*l-_c*c,_c*l+jc*c),e.lineTo(jc*n+_c*a,jc*a-_c*n),e.lineTo(jc*i+_c*o,jc*o-_c*i),e.lineTo(jc*l+_c*c,jc*c-_c*l),e.closePath()}};function sXe(e,t){let r=null,n=sM(a);e=typeof e=="function"?e:Es(e||iM),t=typeof t=="function"?t:Es(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:Es(i),a):e},a.size=function(i){return arguments.length?(t=typeof i=="function"?i:Es(+i),a):t},a.context=function(i){return arguments.length?(r=i??null,a):r},a}function B4(){}function z4(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 due(e){this._context=e}due.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:z4(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:z4(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function aXe(e){return new due(e)}function fue(e){this._context=e}fue.prototype={areaStart:B4,areaEnd:B4,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:z4(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function iXe(e){return new fue(e)}function hue(e){this._context=e}hue.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:z4(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function oXe(e){return new hue(e)}function mue(e){this._context=e}mue.prototype={areaStart:B4,areaEnd:B4,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 lXe(e){return new mue(e)}function gH(e){return e<0?-1:1}function vH(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(gH(i)+gH(o))*Math.min(Math.abs(i),Math.abs(o),.5*Math.abs(l))||0}function yH(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function gP(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 q4(e){this._context=e}q4.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:gP(this,this._t0,yH(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,gP(this,yH(this,r=vH(this,e,t)),r);break;default:gP(this,this._t0,r=vH(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function pue(e){this._context=new xue(e)}(pue.prototype=Object.create(q4.prototype)).point=function(e,t){q4.prototype.point.call(this,t,e)};function xue(e){this._context=e}xue.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 cXe(e){return new q4(e)}function uXe(e){return new pue(e)}function gue(e){this._context=e}gue.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=bH(e),a=bH(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 bH(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 dXe(e){return new gue(e)}function GE(e,t){this._context=e,this._t=t}GE.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 fXe(e){return new GE(e,.5)}function hXe(e){return new GE(e,0)}function mXe(e){return new GE(e,1)}function _y(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 nD(e){for(var t=e.length,r=new Array(t);--t>=0;)r[t]=t;return r}function pXe(e,t){return e[t]}function xXe(e){const t=[];return t.key=e,t}function gXe(){var e=Es([]),t=nD,r=_y,n=pXe;function a(i){var o=Array.from(e.apply(this,arguments),xXe),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=aM(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:Es(Array.from(i)),a):e},a.value=function(i){return arguments.length?(n=typeof i=="function"?i:Es(+i),a):n},a.order=function(i){return arguments.length?(t=i==null?nD:typeof i=="function"?i:Es(Array.from(i)),a):t},a.offset=function(i){return arguments.length?(r=i??_y,a):r},a}function vXe(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}_y(e,t)}}function yXe(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}_y(e,t)}}function bXe(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,x=0;x<l;++x){var p=e[t[x]],g=p[n][1]||0,v=p[n-1][1]||0;h+=g-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,_y(e,t)}}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)}var wXe=["type","size","sizeType"];function sD(){return sD=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},sD.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 jH(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){jXe(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 jXe(e,t,r){return t=_Xe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _Xe(e){var t=NXe(e,"string");return q2(t)=="symbol"?t:t+""}function NXe(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)}function SXe(e,t){if(e==null)return{};var r=kXe(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 kXe(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 vue={symbolCircle:iM,symbolCross:GKe,symbolDiamond:XKe,symbolSquare:YKe,symbolStar:eXe,symbolTriangle:tXe,symbolWye:nXe},CXe=Math.PI/180,EXe=function(t){var r="symbol".concat(VE(t));return vue[r]||iM},AXe=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*CXe;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}},TXe=function(t,r){vue["symbol".concat(VE(t))]=r},oM=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=SXe(t,wXe),u=jH(jH({},c),{},{type:n,size:i,sizeType:l}),d=function(){var g=EXe(n),v=sXe().type(g).size(AXe(i,l,n));return v()},f=u.className,m=u.cx,h=u.cy,x=Er(u,!0);return m===+m&&h===+h&&i===+i?ye.createElement("path",sD({},x,{className:tn("recharts-symbols",f),transform:"translate(".concat(m,", ").concat(h,")"),d:d()})):null};oM.registerSymbol=TXe;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 aD(){return aD=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},aD.apply(this,arguments)}function _H(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 PXe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?_H(Object(r),!0).forEach(function(n){U2(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_H(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function OXe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function DXe(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,bue(n.key),n)}}function IXe(e,t,r){return t&&DXe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function RXe(e,t,r){return t=U4(t),LXe(e,yue()?Reflect.construct(t,r||[],U4(e).constructor):t.apply(e,r))}function LXe(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 FXe(e)}function FXe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function yue(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(yue=function(){return!!e})()}function U4(e){return U4=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},U4(e)}function MXe(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 U2(e,t,r){return t=bue(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function bue(e){var t=$Xe(e,"string");return Ny(t)=="symbol"?t:t+""}function $Xe(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 Nc=32,lM=function(e){function t(){return OXe(this,t),RXe(this,t,arguments)}return MXe(t,e),IXe(t,[{key:"renderIcon",value:function(n){var a=this.props.inactiveColor,i=Nc/2,o=Nc/6,l=Nc/3,c=n.inactive?a:n.color;if(n.type==="plainline")return ye.createElement("line",{strokeWidth:4,fill:"none",stroke:c,strokeDasharray:n.payload.strokeDasharray,x1:0,y1:i,x2:Nc,y2:i,className:"recharts-legend-icon"});if(n.type==="line")return ye.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(Nc,"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 ye.createElement("path",{stroke:"none",fill:c,d:"M0,".concat(Nc/8,"h").concat(Nc,"v").concat(Nc*3/4,"h").concat(-Nc,"z"),className:"recharts-legend-icon"});if(ye.isValidElement(n.legendIcon)){var u=PXe({},n);return delete u.legendIcon,ye.cloneElement(n.legendIcon,u)}return ye.createElement(oM,{fill:c,cx:i,cy:i,size:Nc,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:Nc,height:Nc},f={display:l==="horizontal"?"inline-block":"block",marginRight:10},m={display:"inline-block",verticalAlign:"middle",marginRight:4};return i.map(function(h,x){var p=h.formatter||c,g=tn(U2(U2({"recharts-legend-item":!0},"legend-item-".concat(x),!0),"inactive",h.inactive));if(h.type==="none")return null;var v=qr(h.value)?null:h.value;Xu(!qr(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 y=h.inactive?u:h.color;return ye.createElement("li",aD({className:g,style:f,key:"legend-item-".concat(x)},k0(n.props,h,x)),ye.createElement(Y8,{width:o,height:o,viewBox:d,style:m},n.renderIcon(h)),ye.createElement("span",{className:"recharts-legend-item-text",style:{color:y}},p?p(v,h,x):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 ye.createElement("ul",{className:"recharts-default-legend",style:l},this.renderItems())}}])}(w.PureComponent);U2(lM,"displayName","Legend");U2(lM,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var BXe=PE;function zXe(){this.__data__=new BXe,this.size=0}var qXe=zXe;function UXe(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var VXe=UXe;function HXe(e){return this.__data__.get(e)}var WXe=HXe;function GXe(e){return this.__data__.has(e)}var KXe=GXe,XXe=PE,YXe=XF,ZXe=YF,JXe=200;function QXe(e,t){var r=this.__data__;if(r instanceof XXe){var n=r.__data__;if(!YXe||n.length<JXe-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new ZXe(n)}return r.set(e,t),this.size=r.size,this}var eYe=QXe,tYe=PE,rYe=qXe,nYe=VXe,sYe=WXe,aYe=KXe,iYe=eYe;function I1(e){var t=this.__data__=new tYe(e);this.size=t.size}I1.prototype.clear=rYe;I1.prototype.delete=nYe;I1.prototype.get=sYe;I1.prototype.has=aYe;I1.prototype.set=iYe;var wue=I1,oYe="__lodash_hash_undefined__";function lYe(e){return this.__data__.set(e,oYe),this}var cYe=lYe;function uYe(e){return this.__data__.has(e)}var dYe=uYe,fYe=YF,hYe=cYe,mYe=dYe;function V4(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new fYe;++t<r;)this.add(e[t])}V4.prototype.add=V4.prototype.push=hYe;V4.prototype.has=mYe;var jue=V4;function pYe(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 _ue=pYe;function xYe(e,t){return e.has(t)}var Nue=xYe,gYe=jue,vYe=_ue,yYe=Nue,bYe=1,wYe=2;function jYe(e,t,r,n,a,i){var o=r&bYe,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&wYe?new gYe:void 0;for(i.set(e,t),i.set(t,e);++f<l;){var x=e[f],p=t[f];if(n)var g=o?n(p,x,f,t,e,i):n(x,p,f,e,t,i);if(g!==void 0){if(g)continue;m=!1;break}if(h){if(!vYe(t,function(v,y){if(!yYe(h,y)&&(x===v||a(x,v,r,n,i)))return h.push(y)})){m=!1;break}}else if(!(x===p||a(x,p,r,n,i))){m=!1;break}}return i.delete(e),i.delete(t),m}var Sue=jYe,_Ye=ff,NYe=_Ye.Uint8Array,SYe=NYe;function kYe(e){var t=-1,r=Array(e.size);return e.forEach(function(n,a){r[++t]=[a,n]}),r}var CYe=kYe;function EYe(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var cM=EYe,NH=w_,SH=SYe,AYe=KF,TYe=Sue,PYe=CYe,OYe=cM,DYe=1,IYe=2,RYe="[object Boolean]",LYe="[object Date]",FYe="[object Error]",MYe="[object Map]",$Ye="[object Number]",BYe="[object RegExp]",zYe="[object Set]",qYe="[object String]",UYe="[object Symbol]",VYe="[object ArrayBuffer]",HYe="[object DataView]",kH=NH?NH.prototype:void 0,vP=kH?kH.valueOf:void 0;function WYe(e,t,r,n,a,i,o){switch(r){case HYe:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case VYe:return!(e.byteLength!=t.byteLength||!i(new SH(e),new SH(t)));case RYe:case LYe:case $Ye:return AYe(+e,+t);case FYe:return e.name==t.name&&e.message==t.message;case BYe:case qYe:return e==t+"";case MYe:var l=PYe;case zYe:var c=n&DYe;if(l||(l=OYe),e.size!=t.size&&!c)return!1;var u=o.get(e);if(u)return u==t;n|=IYe,o.set(e,t);var d=TYe(l(e),l(t),n,a,i,o);return o.delete(e),d;case UYe:if(vP)return vP.call(e)==vP.call(t)}return!1}var GYe=WYe;function KYe(e,t){for(var r=-1,n=t.length,a=e.length;++r<n;)e[a+r]=t[r];return e}var kue=KYe,XYe=kue,YYe=El;function ZYe(e,t,r){var n=t(e);return YYe(e)?n:XYe(n,r(e))}var JYe=ZYe;function QYe(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 eZe=QYe;function tZe(){return[]}var rZe=tZe,nZe=eZe,sZe=rZe,aZe=Object.prototype,iZe=aZe.propertyIsEnumerable,CH=Object.getOwnPropertySymbols,oZe=CH?function(e){return e==null?[]:(e=Object(e),nZe(CH(e),function(t){return iZe.call(e,t)}))}:sZe,lZe=oZe;function cZe(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var uZe=cZe,dZe=Eh,fZe=Ah,hZe="[object Arguments]";function mZe(e){return fZe(e)&&dZe(e)==hZe}var pZe=mZe,EH=pZe,xZe=Ah,Cue=Object.prototype,gZe=Cue.hasOwnProperty,vZe=Cue.propertyIsEnumerable,yZe=EH(function(){return arguments}())?EH:function(e){return xZe(e)&&gZe.call(e,"callee")&&!vZe.call(e,"callee")},uM=yZe,H4={exports:{}};function bZe(){return!1}var wZe=bZe;H4.exports;(function(e,t){var r=ff,n=wZe,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})(H4,H4.exports);var Eue=H4.exports,jZe=9007199254740991,_Ze=/^(?:0|[1-9]\d*)$/;function NZe(e,t){var r=typeof e;return t=t??jZe,!!t&&(r=="number"||r!="symbol"&&_Ze.test(e))&&e>-1&&e%1==0&&e<t}var dM=NZe,SZe=9007199254740991;function kZe(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=SZe}var fM=kZe,CZe=Eh,EZe=fM,AZe=Ah,TZe="[object Arguments]",PZe="[object Array]",OZe="[object Boolean]",DZe="[object Date]",IZe="[object Error]",RZe="[object Function]",LZe="[object Map]",FZe="[object Number]",MZe="[object Object]",$Ze="[object RegExp]",BZe="[object Set]",zZe="[object String]",qZe="[object WeakMap]",UZe="[object ArrayBuffer]",VZe="[object DataView]",HZe="[object Float32Array]",WZe="[object Float64Array]",GZe="[object Int8Array]",KZe="[object Int16Array]",XZe="[object Int32Array]",YZe="[object Uint8Array]",ZZe="[object Uint8ClampedArray]",JZe="[object Uint16Array]",QZe="[object Uint32Array]",Bs={};Bs[HZe]=Bs[WZe]=Bs[GZe]=Bs[KZe]=Bs[XZe]=Bs[YZe]=Bs[ZZe]=Bs[JZe]=Bs[QZe]=!0;Bs[TZe]=Bs[PZe]=Bs[UZe]=Bs[OZe]=Bs[VZe]=Bs[DZe]=Bs[IZe]=Bs[RZe]=Bs[LZe]=Bs[FZe]=Bs[MZe]=Bs[$Ze]=Bs[BZe]=Bs[zZe]=Bs[qZe]=!1;function eJe(e){return AZe(e)&&EZe(e.length)&&!!Bs[CZe(e)]}var tJe=eJe;function rJe(e){return function(t){return e(t)}}var Aue=rJe,W4={exports:{}};W4.exports;(function(e,t){var r=Fce,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})(W4,W4.exports);var nJe=W4.exports,sJe=tJe,aJe=Aue,AH=nJe,TH=AH&&AH.isTypedArray,iJe=TH?aJe(TH):sJe,Tue=iJe,oJe=uZe,lJe=uM,cJe=El,uJe=Eue,dJe=dM,fJe=Tue,hJe=Object.prototype,mJe=hJe.hasOwnProperty;function pJe(e,t){var r=cJe(e),n=!r&&lJe(e),a=!r&&!n&&uJe(e),i=!r&&!n&&!a&&fJe(e),o=r||n||a||i,l=o?oJe(e.length,String):[],c=l.length;for(var u in e)(t||mJe.call(e,u))&&!(o&&(u=="length"||a&&(u=="offset"||u=="parent")||i&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||dJe(u,c)))&&l.push(u);return l}var xJe=pJe,gJe=Object.prototype;function vJe(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||gJe;return e===r}var yJe=vJe;function bJe(e,t){return function(r){return e(t(r))}}var Pue=bJe,wJe=Pue,jJe=wJe(Object.keys,Object),_Je=jJe,NJe=yJe,SJe=_Je,kJe=Object.prototype,CJe=kJe.hasOwnProperty;function EJe(e){if(!NJe(e))return SJe(e);var t=[];for(var r in Object(e))CJe.call(e,r)&&r!="constructor"&&t.push(r);return t}var AJe=EJe,TJe=GF,PJe=fM;function OJe(e){return e!=null&&PJe(e.length)&&!TJe(e)}var __=OJe,DJe=xJe,IJe=AJe,RJe=__;function LJe(e){return RJe(e)?DJe(e):IJe(e)}var KE=LJe,FJe=JYe,MJe=lZe,$Je=KE;function BJe(e){return FJe(e,$Je,MJe)}var zJe=BJe,PH=zJe,qJe=1,UJe=Object.prototype,VJe=UJe.hasOwnProperty;function HJe(e,t,r,n,a,i){var o=r&qJe,l=PH(e),c=l.length,u=PH(t),d=u.length;if(c!=d&&!o)return!1;for(var f=c;f--;){var m=l[f];if(!(o?m in t:VJe.call(t,m)))return!1}var h=i.get(e),x=i.get(t);if(h&&x)return h==t&&x==e;var p=!0;i.set(e,t),i.set(t,e);for(var g=o;++f<c;){m=l[f];var v=e[m],y=t[m];if(n)var b=o?n(y,v,m,t,e,i):n(v,y,m,e,t,i);if(!(b===void 0?v===y||a(v,y,r,n,i):b)){p=!1;break}g||(g=m=="constructor")}if(p&&!g){var N=e.constructor,j=t.constructor;N!=j&&"constructor"in e&&"constructor"in t&&!(typeof N=="function"&&N instanceof N&&typeof j=="function"&&j instanceof j)&&(p=!1)}return i.delete(e),i.delete(t),p}var WJe=HJe,GJe=Z0,KJe=ff,XJe=GJe(KJe,"DataView"),YJe=XJe,ZJe=Z0,JJe=ff,QJe=ZJe(JJe,"Promise"),eQe=QJe,tQe=Z0,rQe=ff,nQe=tQe(rQe,"Set"),Oue=nQe,sQe=Z0,aQe=ff,iQe=sQe(aQe,"WeakMap"),oQe=iQe,oD=YJe,lD=XF,cD=eQe,uD=Oue,dD=oQe,Due=Eh,R1=$ce,OH="[object Map]",lQe="[object Object]",DH="[object Promise]",IH="[object Set]",RH="[object WeakMap]",LH="[object DataView]",cQe=R1(oD),uQe=R1(lD),dQe=R1(cD),fQe=R1(uD),hQe=R1(dD),px=Due;(oD&&px(new oD(new ArrayBuffer(1)))!=LH||lD&&px(new lD)!=OH||cD&&px(cD.resolve())!=DH||uD&&px(new uD)!=IH||dD&&px(new dD)!=RH)&&(px=function(e){var t=Due(e),r=t==lQe?e.constructor:void 0,n=r?R1(r):"";if(n)switch(n){case cQe:return LH;case uQe:return OH;case dQe:return DH;case fQe:return IH;case hQe:return RH}return t});var mQe=px,yP=wue,pQe=Sue,xQe=GYe,gQe=WJe,FH=mQe,MH=El,$H=Eue,vQe=Tue,yQe=1,BH="[object Arguments]",zH="[object Array]",NS="[object Object]",bQe=Object.prototype,qH=bQe.hasOwnProperty;function wQe(e,t,r,n,a,i){var o=MH(e),l=MH(t),c=o?zH:FH(e),u=l?zH:FH(t);c=c==BH?NS:c,u=u==BH?NS:u;var d=c==NS,f=u==NS,m=c==u;if(m&&$H(e)){if(!$H(t))return!1;o=!0,d=!1}if(m&&!d)return i||(i=new yP),o||vQe(e)?pQe(e,t,r,n,a,i):xQe(e,t,c,r,n,a,i);if(!(r&yQe)){var h=d&&qH.call(e,"__wrapped__"),x=f&&qH.call(t,"__wrapped__");if(h||x){var p=h?e.value():e,g=x?t.value():t;return i||(i=new yP),a(p,g,r,n,i)}}return m?(i||(i=new yP),gQe(e,t,r,n,a,i)):!1}var jQe=wQe,_Qe=jQe,UH=Ah;function Iue(e,t,r,n,a){return e===t?!0:e==null||t==null||!UH(e)&&!UH(t)?e!==e&&t!==t:_Qe(e,t,r,n,Iue,a)}var hM=Iue,NQe=wue,SQe=hM,kQe=1,CQe=2;function EQe(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 NQe;if(n)var m=n(u,d,c,e,t,f);if(!(m===void 0?SQe(d,u,kQe|CQe,n,f):m))return!1}}return!0}var AQe=EQe,TQe=Lp;function PQe(e){return e===e&&!TQe(e)}var Rue=PQe,OQe=Rue,DQe=KE;function IQe(e){for(var t=DQe(e),r=t.length;r--;){var n=t[r],a=e[n];t[r]=[n,a,OQe(a)]}return t}var RQe=IQe;function LQe(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}var Lue=LQe,FQe=AQe,MQe=RQe,$Qe=Lue;function BQe(e){var t=MQe(e);return t.length==1&&t[0][2]?$Qe(t[0][0],t[0][1]):function(r){return r===e||FQe(r,e,t)}}var zQe=BQe;function qQe(e,t){return e!=null&&t in Object(e)}var UQe=qQe,VQe=Vce,HQe=uM,WQe=El,GQe=dM,KQe=fM,XQe=DE;function YQe(e,t,r){t=VQe(t,e);for(var n=-1,a=t.length,i=!1;++n<a;){var o=XQe(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&&KQe(a)&&GQe(o,a)&&(WQe(e)||HQe(e)))}var ZQe=YQe,JQe=UQe,QQe=ZQe;function eet(e,t){return e!=null&&QQe(e,t,JQe)}var tet=eet,ret=hM,net=Hce,set=tet,aet=WF,iet=Rue,oet=Lue,cet=DE,uet=1,det=2;function fet(e,t){return aet(e)&&iet(t)?oet(cet(e),t):function(r){var n=net(r,e);return n===void 0&&n===t?set(r,e):ret(t,n,uet|det)}}var het=fet;function met(e){return e}var L1=met;function pet(e){return function(t){return t==null?void 0:t[e]}}var xet=pet,get=QF;function vet(e){return function(t){return get(t,e)}}var yet=vet,bet=xet,wet=yet,jet=WF,_et=DE;function Net(e){return jet(e)?bet(_et(e)):wet(e)}var ket=Net,Cet=zQe,Eet=het,Aet=L1,Tet=El,Pet=ket;function Oet(e){return typeof e=="function"?e:e==null?Aet:typeof e=="object"?Tet(e)?Eet(e[0],e[1]):Cet(e):Pet(e)}var hf=Oet;function Det(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 Fue=Det;function Iet(e){return e!==e}var Ret=Iet;function Let(e,t,r){for(var n=r-1,a=e.length;++n<a;)if(e[n]===t)return n;return-1}var Fet=Let,Met=Fue,$et=Ret,Bet=Fet;function zet(e,t,r){return t===t?Bet(e,t,r):Met(e,$et,r)}var qet=zet,Uet=qet;function Vet(e,t){var r=e==null?0:e.length;return!!r&&Uet(e,t,0)>-1}var Het=Vet;function Wet(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 Get=Wet;function Ket(){}var Xet=Ket,bP=Oue,Yet=Xet,Zet=cM,Jet=1/0,Qet=bP&&1/Zet(new bP([,-0]))[1]==Jet?function(e){return new bP(e)}:Yet,ett=Qet,ttt=jue,rtt=Het,ntt=Get,stt=Nue,att=ett,itt=cM,ott=200;function ltt(e,t,r){var n=-1,a=rtt,i=e.length,o=!0,l=[],c=l;if(r)o=!1,a=ntt;else if(i>=ott){var u=t?null:att(e);if(u)return itt(u);o=!1,a=stt,c=new ttt}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 ctt=ltt,utt=hf,dtt=ctt;function ftt(e,t){return e&&e.length?dtt(e,utt(t)):[]}var htt=ftt;const VH=Sn(htt);function Mue(e,t,r){return t===!0?VH(e,r):qr(t)?VH(e,t):e}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)}var mtt=["ref"];function HH(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?HH(Object(r),!0).forEach(function(n){XE(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):HH(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ptt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function WH(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,Bue(n.key),n)}}function xtt(e,t,r){return t&&WH(e.prototype,t),r&&WH(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function gtt(e,t,r){return t=G4(t),vtt(e,$ue()?Reflect.construct(t,r||[],G4(e).constructor):t.apply(e,r))}function vtt(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 ytt(e)}function ytt(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function $ue(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return($ue=function(){return!!e})()}function G4(e){return G4=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},G4(e)}function btt(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 XE(e,t,r){return t=Bue(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Bue(e){var t=wtt(e,"string");return Sy(t)=="symbol"?t:t+""}function wtt(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)}function jtt(e,t){if(e==null)return{};var r=_tt(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 _tt(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 Ntt(e){return e.value}function Stt(e,t){if(ye.isValidElement(e))return ye.cloneElement(e,t);if(typeof e=="function")return ye.createElement(e,t);t.ref;var r=jtt(t,mtt);return ye.createElement(lM,r)}var GH=1,Qx=function(e){function t(){var r;ptt(this,t);for(var n=arguments.length,a=new Array(n),i=0;i<n;i++)a[i]=arguments[i];return r=gtt(this,t,[].concat(a)),XE(r,"lastBoundingBox",{width:-1,height:-1}),r}return btt(t,e),xtt(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)>GH||Math.abs(a.height-this.lastBoundingBox.height)>GH)&&(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?Ff({},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 x=this.getBBoxSnapshot();m={top:((d||0)-x.height)/2}}else m=l==="bottom"?{bottom:c&&c.bottom||0}:{top:c&&c.top||0};return Ff(Ff({},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=Ff(Ff({position:"absolute",width:o||"auto",height:l||"auto"},this.getDefaultPosition(c)),c);return ye.createElement("div",{className:"recharts-legend-wrapper",style:f,ref:function(h){n.wrapperNode=h}},Stt(i,Ff(Ff({},this.props),{},{payload:Mue(d,u,Ntt)})))}}],[{key:"getWithHeight",value:function(n,a){var i=Ff(Ff({},this.defaultProps),n.props),o=i.layout;return o==="vertical"&&Ft(n.props.height)?{height:n.props.height}:o==="horizontal"?{width:n.props.width||a}:null}}])}(w.PureComponent);XE(Qx,"displayName","Legend");XE(Qx,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var KH=w_,ktt=uM,Ctt=El,XH=KH?KH.isConcatSpreadable:void 0;function Ett(e){return Ctt(e)||ktt(e)||!!(XH&&e&&e[XH])}var Att=Ett,Ttt=kue,Ptt=Att;function zue(e,t,r,n,a){var i=-1,o=e.length;for(r||(r=Ptt),a||(a=[]);++i<o;){var l=e[i];t>0&&r(l)?t>1?zue(l,t-1,r,n,a):Ttt(a,l):n||(a[a.length]=l)}return a}var que=zue;function Ott(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 Dtt=Ott,Itt=Dtt,Rtt=Itt(),Ltt=Rtt,Ftt=Ltt,Mtt=KE;function $tt(e,t){return e&&Ftt(e,t,Mtt)}var Uue=$tt,Btt=__;function ztt(e,t){return function(r,n){if(r==null)return r;if(!Btt(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 qtt=ztt,Utt=Uue,Vtt=qtt,Htt=Vtt(Utt),mM=Htt,Wtt=mM,Gtt=__;function Ktt(e,t){var r=-1,n=Gtt(e)?Array(e.length):[];return Wtt(e,function(a,i,o){n[++r]=t(a,i,o)}),n}var Vue=Ktt;function Xtt(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}var Ytt=Xtt,YH=E1;function Ztt(e,t){if(e!==t){var r=e!==void 0,n=e===null,a=e===e,i=YH(e),o=t!==void 0,l=t===null,c=t===t,u=YH(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 Jtt=Ztt,Qtt=Jtt;function ert(e,t,r){for(var n=-1,a=e.criteria,i=t.criteria,o=a.length,l=r.length;++n<o;){var c=Qtt(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 trt=ert,wP=JF,rrt=QF,nrt=hf,srt=Vue,art=Ytt,irt=Aue,ort=trt,lrt=L1,crt=El;function urt(e,t,r){t.length?t=wP(t,function(i){return crt(i)?function(o){return rrt(o,i.length===1?i[0]:i)}:i}):t=[lrt];var n=-1;t=wP(t,irt(nrt));var a=srt(e,function(i,o,l){var c=wP(t,function(u){return u(i)});return{criteria:c,index:++n,value:i}});return art(a,function(i,o){return ort(i,o,r)})}var drt=urt;function frt(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 hrt=frt,mrt=hrt,ZH=Math.max;function prt(e,t,r){return t=ZH(t===void 0?e.length-1:t,0),function(){for(var n=arguments,a=-1,i=ZH(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),mrt(e,this,l)}}var xrt=prt;function grt(e){return function(){return e}}var vrt=grt,yrt=Z0,brt=function(){try{var e=yrt(Object,"defineProperty");return e({},"",{}),e}catch{}}(),Hue=brt,wrt=vrt,JH=Hue,jrt=L1,_rt=JH?function(e,t){return JH(e,"toString",{configurable:!0,enumerable:!1,value:wrt(t),writable:!0})}:jrt,Nrt=_rt,Srt=800,krt=16,Crt=Date.now;function Ert(e){var t=0,r=0;return function(){var n=Crt(),a=krt-(n-r);if(r=n,a>0){if(++t>=Srt)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var Art=Ert,Trt=Nrt,Prt=Art,Ort=Prt(Trt),Drt=Ort,Irt=L1,Rrt=xrt,Lrt=Drt;function Frt(e,t){return Lrt(Rrt(e,t,Irt),e+"")}var Mrt=Frt,$rt=KF,Brt=__,zrt=dM,qrt=Lp;function Urt(e,t,r){if(!qrt(r))return!1;var n=typeof t;return(n=="number"?Brt(r)&&zrt(t,r.length):n=="string"&&t in r)?$rt(r[t],e):!1}var YE=Urt,Vrt=que,Hrt=drt,Wrt=Mrt,QH=YE,Grt=Wrt(function(e,t){if(e==null)return[];var r=t.length;return r>1&&QH(e,t[0],t[1])?t=[]:r>2&&QH(t[0],t[1],t[2])&&(t=[t[0]]),Hrt(e,Vrt(t,1),[])}),Krt=Grt;const pM=Sn(Krt);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 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)}function Xrt(e,t){return Qrt(e)||Jrt(e,t)||Zrt(e,t)||Yrt()}function Yrt(){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 Zrt(e,t){if(e){if(typeof e=="string")return eW(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 eW(e,t)}}function eW(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 Jrt(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 Qrt(e){if(Array.isArray(e))return 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 jP(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){ent(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 ent(e,t,r){return t=tnt(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function tnt(e){var t=rnt(e,"string");return V2(t)=="symbol"?t:t+""}function rnt(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 nnt(e){return Array.isArray(e)&&bi(e[0])&&bi(e[1])?e.join(" ~ "):e}var snt=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,x=t.labelClassName,p=t.label,g=t.labelFormatter,v=t.accessibilityLayer,y=v===void 0?!1:v,b=function(){if(d&&d.length){var E={padding:0,margin:0},q=(m?pM(d,m):d).map(function(O,L){if(O.type==="none")return null;var H=jP({display:"block",paddingTop:4,paddingBottom:4,color:O.color||"#000"},l),V=O.formatter||f||nnt,z=O.value,M=O.name,B=z,K=M;if(V&&B!=null&&K!=null){var C=V(z,M,O,L,d);if(Array.isArray(C)){var A=Xrt(C,2);B=A[0],K=A[1]}else B=C}return ye.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(L),style:H},bi(K)?ye.createElement("span",{className:"recharts-tooltip-item-name"},K):null,bi(K)?ye.createElement("span",{className:"recharts-tooltip-item-separator"},n):null,ye.createElement("span",{className:"recharts-tooltip-item-value"},B),ye.createElement("span",{className:"recharts-tooltip-item-unit"},O.unit||""))});return ye.createElement("ul",{className:"recharts-tooltip-item-list",style:E},q)}return null},N=jP({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},i),j=jP({margin:0},u),_=!Jr(p),S=_?p:"",P=tn("recharts-default-tooltip",h),T=tn("recharts-tooltip-label",x);_&&g&&d!==void 0&&d!==null&&(S=g(p,d));var R=y?{role:"status","aria-live":"assertive"}:{};return ye.createElement("div",hD({className:P,style:N},R),ye.createElement("p",{className:T,style:j},ye.isValidElement(S)?S:"".concat(S)),b())};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)}function SS(e,t,r){return t=ant(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ant(e){var t=int(e,"string");return H2(t)=="symbol"?t:t+""}function int(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)}var zb="recharts-tooltip-wrapper",ont={visibility:"hidden"};function lnt(e){var t=e.coordinate,r=e.translateX,n=e.translateY;return tn(zb,SS(SS(SS(SS({},"".concat(zb,"-right"),Ft(r)&&t&&Ft(t.x)&&r>=t.x),"".concat(zb,"-left"),Ft(r)&&t&&Ft(t.x)&&r<t.x),"".concat(zb,"-bottom"),Ft(n)&&t&&Ft(t.y)&&n>=t.y),"".concat(zb,"-top"),Ft(n)&&t&&Ft(t.y)&&n<t.y))}function rW(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&&Ft(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 x=f+l,p=c[n]+u;return x>p?Math.max(d,c[n]):Math.max(f,c[n])}function cnt(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 unt(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=rW({allowEscapeViewBox:t,coordinate:r,key:"x",offsetTopLeft:n,position:a,reverseDirection:i,tooltipDimension:o.width,viewBox:c,viewBoxDimension:c.width}),f=rW({allowEscapeViewBox:t,coordinate:r,key:"y",offsetTopLeft:n,position:a,reverseDirection:i,tooltipDimension:o.height,viewBox:c,viewBoxDimension:c.height}),u=cnt({translateX:d,translateY:f,useTranslate3d:l})):u=ont,{cssProperties:u,cssClasses:lnt({translateX:d,translateY:f,coordinate:r})}}function ky(e){"@babel/helpers - typeof";return ky=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},ky(e)}function nW(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 sW(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?nW(Object(r),!0).forEach(function(n){pD(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):nW(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function dnt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function fnt(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,Gue(n.key),n)}}function hnt(e,t,r){return t&&fnt(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function mnt(e,t,r){return t=K4(t),pnt(e,Wue()?Reflect.construct(t,r||[],K4(e).constructor):t.apply(e,r))}function pnt(e,t){if(t&&(ky(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return xnt(e)}function xnt(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Wue(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Wue=function(){return!!e})()}function K4(e){return K4=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},K4(e)}function gnt(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&&mD(e,t)}function mD(e,t){return mD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},mD(e,t)}function pD(e,t,r){return t=Gue(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Gue(e){var t=vnt(e,"string");return ky(t)=="symbol"?t:t+""}function vnt(e,t){if(ky(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(ky(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var aW=1,ynt=function(e){function t(){var r;dnt(this,t);for(var n=arguments.length,a=new Array(n),i=0;i<n;i++)a[i]=arguments[i];return r=mnt(this,t,[].concat(a)),pD(r,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0},lastBoundingBox:{width:-1,height:-1}}),pD(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 gnt(t,e),hnt(t,[{key:"updateBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var n=this.wrapperNode.getBoundingClientRect();(Math.abs(n.width-this.state.lastBoundingBox.width)>aW||Math.abs(n.height-this.state.lastBoundingBox.height)>aW)&&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,x=a.position,p=a.reverseDirection,g=a.useTranslate3d,v=a.viewBox,y=a.wrapperStyle,b=unt({allowEscapeViewBox:o,coordinate:d,offsetTopLeft:h,position:x,reverseDirection:p,tooltipBox:this.state.lastBoundingBox,useTranslate3d:g,viewBox:v}),N=b.cssClasses,j=b.cssProperties,_=sW(sW({transition:m&&i?"transform ".concat(l,"ms ").concat(c):void 0},j),{},{pointerEvents:"none",visibility:!this.state.dismissed&&i&&f?"visible":"hidden",position:"absolute",top:0,left:0},y);return ye.createElement("div",{tabIndex:-1,className:N,style:_,ref:function(P){n.wrapperNode=P}},u)}}])}(w.PureComponent),bnt=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},J0={isSsr:bnt()};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 iW(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 oW(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?iW(Object(r),!0).forEach(function(n){xM(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):iW(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function wnt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function jnt(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,Xue(n.key),n)}}function _nt(e,t,r){return t&&jnt(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Nnt(e,t,r){return t=X4(t),Snt(e,Kue()?Reflect.construct(t,r||[],X4(e).constructor):t.apply(e,r))}function Snt(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 knt(e)}function knt(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Kue(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Kue=function(){return!!e})()}function X4(e){return X4=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},X4(e)}function Cnt(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&&xD(e,t)}function xD(e,t){return xD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},xD(e,t)}function xM(e,t,r){return t=Xue(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Xue(e){var t=Ent(e,"string");return Cy(t)=="symbol"?t:t+""}function Ent(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)}function Ant(e){return e.dataKey}function Tnt(e,t){return ye.isValidElement(e)?ye.cloneElement(e,t):typeof e=="function"?ye.createElement(e,t):ye.createElement(snt,t)}var Ul=function(e){function t(){return wnt(this,t),Nnt(this,t,arguments)}return Cnt(t,e),_nt(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,x=a.payload,p=a.payloadUniqBy,g=a.position,v=a.reverseDirection,y=a.useTranslate3d,b=a.viewBox,N=a.wrapperStyle,j=x??[];f&&j.length&&(j=Mue(x.filter(function(S){return S.value!=null&&(S.hide!==!0||n.props.includeHidden)}),p,Ant));var _=j.length>0;return ye.createElement(ynt,{allowEscapeViewBox:o,animationDuration:l,animationEasing:c,isAnimationActive:m,active:i,coordinate:d,hasPayload:_,offset:h,position:g,reverseDirection:v,useTranslate3d:y,viewBox:b,wrapperStyle:N},Tnt(u,oW(oW({},this.props),{},{payload:j})))}}])}(w.PureComponent);xM(Ul,"displayName","Tooltip");xM(Ul,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!J0.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 Pnt=ff,Ont=function(){return Pnt.Date.now()},Dnt=Ont,Int=/\s/;function Rnt(e){for(var t=e.length;t--&&Int.test(e.charAt(t)););return t}var Lnt=Rnt,Fnt=Lnt,Mnt=/^\s+/;function $nt(e){return e&&e.slice(0,Fnt(e)+1).replace(Mnt,"")}var Bnt=$nt,znt=Bnt,lW=Lp,qnt=E1,cW=NaN,Unt=/^[-+]0x[0-9a-f]+$/i,Vnt=/^0b[01]+$/i,Hnt=/^0o[0-7]+$/i,Wnt=parseInt;function Gnt(e){if(typeof e=="number")return e;if(qnt(e))return cW;if(lW(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=lW(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=znt(e);var r=Vnt.test(e);return r||Hnt.test(e)?Wnt(e.slice(2),r?2:8):Unt.test(e)?cW:+e}var Yue=Gnt,Knt=Lp,_P=Dnt,uW=Yue,Xnt="Expected a function",Ynt=Math.max,Znt=Math.min;function Jnt(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(Xnt);t=uW(t)||0,Knt(r)&&(d=!!r.leading,f="maxWait"in r,i=f?Ynt(uW(r.maxWait)||0,t):i,m="trailing"in r?!!r.trailing:m);function h(_){var S=n,P=a;return n=a=void 0,u=_,o=e.apply(P,S),o}function x(_){return u=_,l=setTimeout(v,t),d?h(_):o}function p(_){var S=_-c,P=_-u,T=t-S;return f?Znt(T,i-P):T}function g(_){var S=_-c,P=_-u;return c===void 0||S>=t||S<0||f&&P>=i}function v(){var _=_P();if(g(_))return y(_);l=setTimeout(v,p(_))}function y(_){return l=void 0,m&&n?h(_):(n=a=void 0,o)}function b(){l!==void 0&&clearTimeout(l),u=0,n=c=a=l=void 0}function N(){return l===void 0?o:y(_P())}function j(){var _=_P(),S=g(_);if(n=arguments,a=this,c=_,S){if(l===void 0)return x(c);if(f)return clearTimeout(l),l=setTimeout(v,t),h(c)}return l===void 0&&(l=setTimeout(v,t)),o}return j.cancel=b,j.flush=N,j}var Qnt=Jnt,est=Qnt,tst=Lp,rst="Expected a function";function nst(e,t,r){var n=!0,a=!0;if(typeof e!="function")throw new TypeError(rst);return tst(r)&&(n="leading"in r?!!r.leading:n,a="trailing"in r?!!r.trailing:a),est(e,t,{leading:n,maxWait:t,trailing:a})}var sst=nst;const Zue=Sn(sst);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 dW(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 kS(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?dW(Object(r),!0).forEach(function(n){ast(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):dW(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ast(e,t,r){return t=ist(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ist(e){var t=ost(e,"string");return W2(t)=="symbol"?t:t+""}function ost(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 lst(e,t){return fst(e)||dst(e,t)||ust(e,t)||cst()}function cst(){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 ust(e,t){if(e){if(typeof e=="string")return fW(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 fW(e,t)}}function fW(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 dst(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 fst(e){if(Array.isArray(e))return e}var Y4=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,x=e.debounce,p=x===void 0?0:x,g=e.id,v=e.className,y=e.onResize,b=e.style,N=b===void 0?{}:b,j=w.useRef(null),_=w.useRef();_.current=y,w.useImperativeHandle(t,function(){return Object.defineProperty(j.current,"current",{get:function(){return console.warn("The usage of ref.current.current is deprecated and will no longer be supported."),j.current},configurable:!0})});var S=w.useState({containerWidth:a.width,containerHeight:a.height}),P=lst(S,2),T=P[0],R=P[1],k=w.useCallback(function(q,O){R(function(L){var H=Math.round(q),V=Math.round(O);return L.containerWidth===H&&L.containerHeight===V?L:{containerWidth:H,containerHeight:V}})},[]);w.useEffect(function(){var q=function(M){var B,K=M[0].contentRect,C=K.width,A=K.height;k(C,A),(B=_.current)===null||B===void 0||B.call(_,C,A)};p>0&&(q=Zue(q,p,{trailing:!0,leading:!1}));var O=new ResizeObserver(q),L=j.current.getBoundingClientRect(),H=L.width,V=L.height;return k(H,V),O.observe(j.current),function(){O.disconnect()}},[k,p]);var E=w.useMemo(function(){var q=T.containerWidth,O=T.containerHeight;if(q<0||O<0)return null;Xu(Tx(o)||Tx(c),`The width(%s) and height(%s) are both fixed numbers,
maybe you don't need to use a ResponsiveContainer.`,o,c),Xu(!r||r>0,"The aspect(%s) must be greater than zero.",r);var L=Tx(o)?q:o,H=Tx(c)?O:c;r&&r>0&&(L?H=L/r:H&&(L=H*r),m&&H>m&&(H=m)),Xu(L>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.`,L,H,o,c,d,f,r);var V=!Array.isArray(h)&&nh(h.type).endsWith("Chart");return ye.Children.map(h,function(z){return ye.isValidElement(z)?w.cloneElement(z,kS({width:L,height:H},V?{style:kS({height:"100%",width:"100%",maxHeight:H,maxWidth:L},z.props.style)}:{})):z})},[r,h,c,m,f,d,T,o]);return ye.createElement("div",{id:g?"".concat(g):void 0,className:tn("recharts-responsive-container",v),style:kS(kS({},N),{},{width:o,height:c,minWidth:d,minHeight:f,maxHeight:m}),ref:j},E)}),N_=function(t){return null};N_.displayName="Cell";function G2(e){"@babel/helpers - typeof";return G2=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},G2(e)}function hW(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 gD(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?hW(Object(r),!0).forEach(function(n){hst(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):hW(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function hst(e,t,r){return t=mst(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function mst(e){var t=pst(e,"string");return G2(t)=="symbol"?t:t+""}function pst(e,t){if(G2(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(G2(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Rg={widthCache:{},cacheCount:0},xst=2e3,gst={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},mW="recharts_measurement_span";function vst(e){var t=gD({},e);return Object.keys(t).forEach(function(r){t[r]||delete t[r]}),t}var $w=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||J0.isSsr)return{width:0,height:0};var n=vst(r),a=JSON.stringify({text:t,copyStyle:n});if(Rg.widthCache[a])return Rg.widthCache[a];try{var i=document.getElementById(mW);i||(i=document.createElement("span"),i.setAttribute("id",mW),i.setAttribute("aria-hidden","true"),document.body.appendChild(i));var o=gD(gD({},gst),n);Object.assign(i.style,o),i.textContent="".concat(t);var l=i.getBoundingClientRect(),c={width:l.width,height:l.height};return Rg.widthCache[a]=c,++Rg.cacheCount>xst&&(Rg.cacheCount=0,Rg.widthCache={}),c}catch{return{width:0,height:0}}},yst=function(t){return{top:t.top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft}};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)}function Z4(e,t){return _st(e)||jst(e,t)||wst(e,t)||bst()}function bst(){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 wst(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 jst(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 _st(e){if(Array.isArray(e))return e}function Nst(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function xW(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,kst(n.key),n)}}function Sst(e,t,r){return t&&xW(e.prototype,t),r&&xW(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function kst(e){var t=Cst(e,"string");return K2(t)=="symbol"?t:t+""}function Cst(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 String(e)}var gW=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,vW=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,Est=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,Ast=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,Jue={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},Tst=Object.keys(Jue),hv="NaN";function Pst(e,t){return e*Jue[t]}var CS=function(){function e(t,r){Nst(this,e),this.num=t,this.unit=r,this.num=t,this.unit=r,Number.isNaN(t)&&(this.unit=""),r!==""&&!Est.test(r)&&(this.num=NaN,this.unit=""),Tst.includes(r)&&(this.num=Pst(t,r),this.unit="px")}return Sst(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=Ast.exec(r))!==null&&n!==void 0?n:[],i=Z4(a,3),o=i[1],l=i[2];return new e(parseFloat(o),l??"")}}])}();function Que(e){if(e.includes(hv))return hv;for(var t=e;t.includes("*")||t.includes("/");){var r,n=(r=gW.exec(t))!==null&&r!==void 0?r:[],a=Z4(n,4),i=a[1],o=a[2],l=a[3],c=CS.parse(i??""),u=CS.parse(l??""),d=o==="*"?c.multiply(u):c.divide(u);if(d.isNaN())return hv;t=t.replace(gW,d.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var f,m=(f=vW.exec(t))!==null&&f!==void 0?f:[],h=Z4(m,4),x=h[1],p=h[2],g=h[3],v=CS.parse(x??""),y=CS.parse(g??""),b=p==="+"?v.add(y):v.subtract(y);if(b.isNaN())return hv;t=t.replace(vW,b.toString())}return t}var yW=/\(([^()]*)\)/;function Ost(e){for(var t=e;t.includes("(");){var r=yW.exec(t),n=Z4(r,2),a=n[1];t=t.replace(yW,Que(a))}return t}function Dst(e){var t=e.replace(/\s+/g,"");return t=Ost(t),t=Que(t),t}function Ist(e){try{return Dst(e)}catch{return hv}}function NP(e){var t=Ist(e.slice(5,-1));return t===hv?"":t}var Rst=["x","y","lineHeight","capHeight","scaleToFit","textAnchor","verticalAnchor","fill"],Lst=["dx","dy","angle","className","breakAll"];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 bW(e,t){if(e==null)return{};var r=Fst(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 Fst(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 wW(e,t){return zst(e)||Bst(e,t)||$st(e,t)||Mst()}function Mst(){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 $st(e,t){if(e){if(typeof e=="string")return jW(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 jW(e,t)}}function jW(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 Bst(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 zst(e){if(Array.isArray(e))return e}var ede=/[ \f\n\r\t\v\u2028\u2029]+/,tde=function(t){var r=t.children,n=t.breakAll,a=t.style;try{var i=[];Jr(r)||(n?i=r.toString().split(""):i=r.toString().split(ede));var o=i.map(function(c){return{word:c,width:$w(c,a).width}}),l=n?0:$w(" ",a).width;return{wordsWithComputedWidth:o,spaceWidth:l}}catch{return null}},qst=function(t,r,n,a,i){var o=t.maxLines,l=t.children,c=t.style,u=t.breakAll,d=Ft(o),f=l,m=function(){var L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return L.reduce(function(H,V){var z=V.word,M=V.width,B=H[H.length-1];if(B&&(a==null||i||B.width+M+n<Number(a)))B.words.push(z),B.width+=M+n;else{var K={words:[z],width:M};H.push(K)}return H},[])},h=m(r),x=function(L){return L.reduce(function(H,V){return H.width>V.width?H:V})};if(!d)return h;for(var p="…",g=function(L){var H=f.slice(0,L),V=tde({breakAll:u,style:c,children:H+p}).wordsWithComputedWidth,z=m(V),M=z.length>o||x(z).width>Number(a);return[M,z]},v=0,y=f.length-1,b=0,N;v<=y&&b<=f.length-1;){var j=Math.floor((v+y)/2),_=j-1,S=g(_),P=wW(S,2),T=P[0],R=P[1],k=g(j),E=wW(k,1),q=E[0];if(!T&&!q&&(v=j+1),T&&q&&(y=j-1),!T&&q){N=R;break}b++}return N||h},_W=function(t){var r=Jr(t)?[]:t.toString().split(ede);return[{words:r}]},Ust=function(t){var r=t.width,n=t.scaleToFit,a=t.children,i=t.style,o=t.breakAll,l=t.maxLines;if((r||n)&&!J0.isSsr){var c,u,d=tde({breakAll:o,children:a,style:i});if(d){var f=d.wordsWithComputedWidth,m=d.spaceWidth;c=f,u=m}else return _W(a);return qst({breakAll:o,children:a,maxLines:l,style:i},c,u,r,n)}return _W(a)},NW="#808080",C0=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,x=t.verticalAnchor,p=x===void 0?"end":x,g=t.fill,v=g===void 0?NW:g,y=bW(t,Rst),b=w.useMemo(function(){return Ust({breakAll:y.breakAll,children:y.children,maxLines:y.maxLines,scaleToFit:f,style:y.style,width:y.width})},[y.breakAll,y.children,y.maxLines,f,y.style,y.width]),N=y.dx,j=y.dy,_=y.angle,S=y.className,P=y.breakAll,T=bW(y,Lst);if(!bi(n)||!bi(i))return null;var R=n+(Ft(N)?N:0),k=i+(Ft(j)?j:0),E;switch(p){case"start":E=NP("calc(".concat(u,")"));break;case"middle":E=NP("calc(".concat((b.length-1)/2," * -").concat(l," + (").concat(u," / 2))"));break;default:E=NP("calc(".concat(b.length-1," * -").concat(l,")"));break}var q=[];if(f){var O=b[0].width,L=y.width;q.push("scale(".concat((Ft(L)?L/O:1)/O,")"))}return _&&q.push("rotate(".concat(_,", ").concat(R,", ").concat(k,")")),q.length&&(T.transform=q.join(" ")),ye.createElement("text",vD({},Er(T,!0),{x:R,y:k,className:tn("recharts-text",S),textAnchor:h,fill:v.includes("url")?NW:v}),b.map(function(H,V){var z=H.words.join(P?"":" ");return ye.createElement("tspan",{x:R,dy:V===0?E:l,key:"".concat(z,"-").concat(V)},z)}))};function ep(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Vst(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function gM(e){let t,r,n;e.length!==2?(t=ep,r=(l,c)=>ep(e(l),c),n=(l,c)=>e(l)-c):(t=e===ep||e===Vst?e:Hst,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 Hst(){return 0}function rde(e){return e===null?NaN:+e}function*Wst(e,t){for(let r of e)r!=null&&(r=+r)>=r&&(yield r)}const Gst=gM(ep),S_=Gst.right;gM(rde).center;class SW extends Map{constructor(t,r=Yst){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(kW(this,t))}has(t){return super.has(kW(this,t))}set(t,r){return super.set(Kst(this,t),r)}delete(t){return super.delete(Xst(this,t))}}function kW({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):r}function Kst({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function Xst({_intern:e,_key:t},r){const n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function Yst(e){return e!==null&&typeof e=="object"?e.valueOf():e}function Zst(e=ep){if(e===ep)return nde;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 nde(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}const Jst=Math.sqrt(50),Qst=Math.sqrt(10),eat=Math.sqrt(2);function J4(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>=Jst?10:i>=Qst?5:i>=eat?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?J4(e,t,r*2):[l,c,u]}function yD(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?J4(t,e,r):J4(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 bD(e,t,r){return t=+t,e=+e,r=+r,J4(e,t,r)[2]}function wD(e,t,r){t=+t,e=+e,r=+r;const n=t<e,a=n?bD(t,e,r):bD(e,t,r);return(n?-1:1)*(a<0?1/-a:a)}function CW(e,t){let r;for(const n of e)n!=null&&(r<n||r===void 0&&n>=n)&&(r=n);return r}function EW(e,t){let r;for(const n of e)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);return r}function sde(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?nde:Zst(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)),x=Math.min(n,Math.floor(t+(c-u)*f/c+m));sde(e,t,h,x,a)}const i=e[t];let o=r,l=n;for(qb(e,r,t),a(e[n],i)>0&&qb(e,r,n);o<l;){for(qb(e,o,l),++o,--l;a(e[o],i)<0;)++o;for(;a(e[l],i)>0;)--l}a(e[r],i)===0?qb(e,r,l):(++l,qb(e,l,n)),l<=t&&(r=l+1),t<=l&&(n=l-1)}return e}function qb(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function tat(e,t,r){if(e=Float64Array.from(Wst(e)),!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return EW(e);if(t>=1)return CW(e);var n,a=(n-1)*t,i=Math.floor(a),o=CW(sde(e,i).subarray(0,i+1)),l=EW(e.subarray(i+1));return o+(l-o)*(a-i)}}function rat(e,t,r=rde){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 nat(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 hu(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function Th(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 jD=Symbol("implicit");function vM(){var e=new SW,t=[],r=[],n=jD;function a(i){let o=e.get(i);if(o===void 0){if(n!==jD)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 SW;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 vM(t,r).unknown(n)},hu.apply(a,arguments),a}function X2(){var e=vM().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,x=h?a:n,p=h?n:a;i=(p-x)/Math.max(1,m-c+u*2),l&&(i=Math.floor(i)),x+=(p-x-i*(m-c))*d,o=i*(1-c),l&&(x=Math.round(x),o=Math.round(o));var g=nat(m).map(function(v){return x+i*v});return r(h?g.reverse():g)}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 X2(t(),[n,a]).round(l).paddingInner(c).paddingOuter(u).align(d)},hu.apply(f(),arguments)}function ade(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return ade(t())},e}function Bw(){return ade(X2.apply(null,arguments).paddingInner(1))}function yM(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function ide(e,t){var r=Object.create(e.prototype);for(var n in t)r[n]=t[n];return r}function k_(){}var Y2=.7,Q4=1/Y2,$v="\\s*([+-]?\\d+)\\s*",Z2="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Jd="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",sat=/^#([0-9a-f]{3,8})$/,aat=new RegExp(`^rgb\\(${$v},${$v},${$v}\\)$`),iat=new RegExp(`^rgb\\(${Jd},${Jd},${Jd}\\)$`),oat=new RegExp(`^rgba\\(${$v},${$v},${$v},${Z2}\\)$`),lat=new RegExp(`^rgba\\(${Jd},${Jd},${Jd},${Z2}\\)$`),cat=new RegExp(`^hsl\\(${Z2},${Jd},${Jd}\\)$`),uat=new RegExp(`^hsla\\(${Z2},${Jd},${Jd},${Z2}\\)$`),AW={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};yM(k_,J2,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:TW,formatHex:TW,formatHex8:dat,formatHsl:fat,formatRgb:PW,toString:PW});function TW(){return this.rgb().formatHex()}function dat(){return this.rgb().formatHex8()}function fat(){return ode(this).formatHsl()}function PW(){return this.rgb().formatRgb()}function J2(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=sat.exec(e))?(r=t[1].length,t=parseInt(t[1],16),r===6?OW(t):r===3?new xl(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?ES(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?ES(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=aat.exec(e))?new xl(t[1],t[2],t[3],1):(t=iat.exec(e))?new xl(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=oat.exec(e))?ES(t[1],t[2],t[3],t[4]):(t=lat.exec(e))?ES(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=cat.exec(e))?RW(t[1],t[2]/100,t[3]/100,1):(t=uat.exec(e))?RW(t[1],t[2]/100,t[3]/100,t[4]):AW.hasOwnProperty(e)?OW(AW[e]):e==="transparent"?new xl(NaN,NaN,NaN,0):null}function OW(e){return new xl(e>>16&255,e>>8&255,e&255,1)}function ES(e,t,r,n){return n<=0&&(e=t=r=NaN),new xl(e,t,r,n)}function hat(e){return e instanceof k_||(e=J2(e)),e?(e=e.rgb(),new xl(e.r,e.g,e.b,e.opacity)):new xl}function _D(e,t,r,n){return arguments.length===1?hat(e):new xl(e,t,r,n??1)}function xl(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}yM(xl,_D,ide(k_,{brighter(e){return e=e==null?Q4:Math.pow(Q4,e),new xl(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Y2:Math.pow(Y2,e),new xl(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new xl(e0(this.r),e0(this.g),e0(this.b),ek(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:DW,formatHex:DW,formatHex8:mat,formatRgb:IW,toString:IW}));function DW(){return`#${Px(this.r)}${Px(this.g)}${Px(this.b)}`}function mat(){return`#${Px(this.r)}${Px(this.g)}${Px(this.b)}${Px((isNaN(this.opacity)?1:this.opacity)*255)}`}function IW(){const e=ek(this.opacity);return`${e===1?"rgb(":"rgba("}${e0(this.r)}, ${e0(this.g)}, ${e0(this.b)}${e===1?")":`, ${e})`}`}function ek(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function e0(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Px(e){return e=e0(e),(e<16?"0":"")+e.toString(16)}function RW(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new $u(e,t,r,n)}function ode(e){if(e instanceof $u)return new $u(e.h,e.s,e.l,e.opacity);if(e instanceof k_||(e=J2(e)),!e)return new $u;if(e instanceof $u)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 $u(o,l,c,e.opacity)}function pat(e,t,r,n){return arguments.length===1?ode(e):new $u(e,t,r,n??1)}function $u(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}yM($u,pat,ide(k_,{brighter(e){return e=e==null?Q4:Math.pow(Q4,e),new $u(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Y2:Math.pow(Y2,e),new $u(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 xl(SP(e>=240?e-240:e+120,a,n),SP(e,a,n),SP(e<120?e+240:e-120,a,n),this.opacity)},clamp(){return new $u(LW(this.h),AS(this.s),AS(this.l),ek(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=ek(this.opacity);return`${e===1?"hsl(":"hsla("}${LW(this.h)}, ${AS(this.s)*100}%, ${AS(this.l)*100}%${e===1?")":`, ${e})`}`}}));function LW(e){return e=(e||0)%360,e<0?e+360:e}function AS(e){return Math.max(0,Math.min(1,e||0))}function SP(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 bM=e=>()=>e;function xat(e,t){return function(r){return e+r*t}}function gat(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 vat(e){return(e=+e)==1?lde:function(t,r){return r-t?gat(t,r,e):bM(isNaN(t)?r:t)}}function lde(e,t){var r=t-e;return r?xat(e,r):bM(isNaN(e)?t:e)}const FW=function e(t){var r=vat(t);function n(a,i){var o=r((a=_D(a)).r,(i=_D(i)).r),l=r(a.g,i.g),c=r(a.b,i.b),u=lde(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 yat(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 bat(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function wat(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]=F1(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 jat(e,t){var r=new Date;return e=+e,t=+t,function(n){return r.setTime(e*(1-n)+t*n),r}}function tk(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}function _at(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]=F1(e[a],t[a]):n[a]=t[a];return function(i){for(a in r)n[a]=r[a](i);return n}}var ND=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,kP=new RegExp(ND.source,"g");function Nat(e){return function(){return e}}function Sat(e){return function(t){return e(t)+""}}function kat(e,t){var r=ND.lastIndex=kP.lastIndex=0,n,a,i,o=-1,l=[],c=[];for(e=e+"",t=t+"";(n=ND.exec(e))&&(a=kP.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:tk(n,a)})),r=kP.lastIndex;return r<t.length&&(i=t.slice(r),l[o]?l[o]+=i:l[++o]=i),l.length<2?c[0]?Sat(c[0].x):Nat(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 F1(e,t){var r=typeof t,n;return t==null||r==="boolean"?bM(t):(r==="number"?tk:r==="string"?(n=J2(t))?(t=n,FW):kat:t instanceof J2?FW:t instanceof Date?jat:bat(t)?yat:Array.isArray(t)?wat:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?_at:tk)(e,t)}function wM(e,t){return e=+e,t=+t,function(r){return Math.round(e*(1-r)+t*r)}}function Cat(e,t){t===void 0&&(t=e,e=F1);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 Eat(e){return function(){return e}}function rk(e){return+e}var MW=[0,1];function Wo(e){return e}function SD(e,t){return(t-=e=+e)?function(r){return(r-e)/t}:Eat(isNaN(t)?NaN:.5)}function Aat(e,t){var r;return e>t&&(r=e,e=t,t=r),function(n){return Math.max(e,Math.min(t,n))}}function Tat(e,t,r){var n=e[0],a=e[1],i=t[0],o=t[1];return a<n?(n=SD(a,n),i=r(o,i)):(n=SD(n,a),i=r(i,o)),function(l){return i(n(l))}}function Pat(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]=SD(e[o],e[o+1]),i[o]=r(t[o],t[o+1]);return function(l){var c=S_(e,l,1,n)-1;return i[c](a[c](l))}}function C_(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function ZE(){var e=MW,t=MW,r=F1,n,a,i,o=Wo,l,c,u;function d(){var m=Math.min(e.length,t.length);return o!==Wo&&(o=Aat(e[0],e[m-1])),l=m>2?Pat:Tat,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),tk)))(m)))},f.domain=function(m){return arguments.length?(e=Array.from(m,rk),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=wM,d()},f.clamp=function(m){return arguments.length?(o=m?!0:Wo,d()):o!==Wo},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 jM(){return ZE()(Wo,Wo)}function Oat(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function nk(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 Ey(e){return e=nk(Math.abs(e)),e?e[1]:NaN}function Dat(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 Iat(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var Rat=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Q2(e){if(!(t=Rat.exec(e)))throw new Error("invalid format: "+e);var t;return new _M({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]})}Q2.prototype=_M.prototype;function _M(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+""}_M.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 Lat(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 cde;function Fat(e,t){var r=nk(e,t);if(!r)return e+"";var n=r[0],a=r[1],i=a-(cde=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")+nk(e,Math.max(0,t+i-1))[0]}function $W(e,t){var r=nk(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 BW={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:Oat,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)=>$W(e*100,t),r:$W,s:Fat,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function zW(e){return e}var qW=Array.prototype.map,UW=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Mat(e){var t=e.grouping===void 0||e.thousands===void 0?zW:Dat(qW.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?zW:Iat(qW.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=Q2(f);var m=f.fill,h=f.align,x=f.sign,p=f.symbol,g=f.zero,v=f.width,y=f.comma,b=f.precision,N=f.trim,j=f.type;j==="n"?(y=!0,j="g"):BW[j]||(b===void 0&&(b=12),N=!0,j="g"),(g||m==="0"&&h==="=")&&(g=!0,m="0",h="=");var _=p==="$"?r:p==="#"&&/[boxX]/.test(j)?"0"+j.toLowerCase():"",S=p==="$"?n:/[%p]/.test(j)?o:"",P=BW[j],T=/[defgprs%]/.test(j);b=b===void 0?6:/[gprs]/.test(j)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b));function R(k){var E=_,q=S,O,L,H;if(j==="c")q=P(k)+q,k="";else{k=+k;var V=k<0||1/k<0;if(k=isNaN(k)?c:P(Math.abs(k),b),N&&(k=Lat(k)),V&&+k==0&&x!=="+"&&(V=!1),E=(V?x==="("?x:l:x==="-"||x==="("?"":x)+E,q=(j==="s"?UW[8+cde/3]:"")+q+(V&&x==="("?")":""),T){for(O=-1,L=k.length;++O<L;)if(H=k.charCodeAt(O),48>H||H>57){q=(H===46?a+k.slice(O+1):k.slice(O))+q,k=k.slice(0,O);break}}}y&&!g&&(k=t(k,1/0));var z=E.length+k.length+q.length,M=z<v?new Array(v-z+1).join(m):"";switch(y&&g&&(k=t(M+k,M.length?v-q.length:1/0),M=""),h){case"<":k=E+k+q+M;break;case"=":k=E+M+k+q;break;case"^":k=M.slice(0,z=M.length>>1)+E+k+q+M.slice(z);break;default:k=M+E+k+q;break}return i(k)}return R.toString=function(){return f+""},R}function d(f,m){var h=u((f=Q2(f),f.type="f",f)),x=Math.max(-8,Math.min(8,Math.floor(Ey(m)/3)))*3,p=Math.pow(10,-x),g=UW[8+x/3];return function(v){return h(p*v)+g}}return{format:u,formatPrefix:d}}var TS,NM,ude;$at({thousands:",",grouping:[3],currency:["$",""]});function $at(e){return TS=Mat(e),NM=TS.format,ude=TS.formatPrefix,TS}function Bat(e){return Math.max(0,-Ey(Math.abs(e)))}function zat(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Ey(t)/3)))*3-Ey(Math.abs(e)))}function qat(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Ey(t)-Ey(e))+1}function dde(e,t,r,n){var a=wD(e,t,r),i;switch(n=Q2(n??",f"),n.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(i=zat(a,o))&&(n.precision=i),ude(n,o)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(i=qat(a,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=i-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(i=Bat(a))&&(n.precision=i-(n.type==="%")*2);break}}return NM(n)}function Fp(e){var t=e.domain;return e.ticks=function(r){var n=t();return yD(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var a=t();return dde(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=bD(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 sk(){var e=jM();return e.copy=function(){return C_(e,sk())},hu.apply(e,arguments),Fp(e)}function fde(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,rk),r):e.slice()},r.unknown=function(n){return arguments.length?(t=n,r):t},r.copy=function(){return fde(e).unknown(t)},e=arguments.length?Array.from(e,rk):[0,1],Fp(r)}function hde(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 VW(e){return Math.log(e)}function HW(e){return Math.exp(e)}function Uat(e){return-Math.log(-e)}function Vat(e){return-Math.exp(-e)}function Hat(e){return isFinite(e)?+("1e"+e):e<0?0:e}function Wat(e){return e===10?Hat:e===Math.E?Math.exp:t=>Math.pow(e,t)}function Gat(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 WW(e){return(t,r)=>-e(-t,r)}function SM(e){const t=e(VW,HW),r=t.domain;let n=10,a,i;function o(){return a=Gat(n),i=Wat(n),r()[0]<0?(a=WW(a),i=WW(i),e(Uat,Vat)):e(VW,HW),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),x,p;const g=l==null?10:+l;let v=[];if(!(n%1)&&h-m<g){if(m=Math.floor(m),h=Math.ceil(h),u>0){for(;m<=h;++m)for(x=1;x<n;++x)if(p=m<0?x/i(-m):x*i(m),!(p<u)){if(p>d)break;v.push(p)}}else for(;m<=h;++m)for(x=n-1;x>=1;--x)if(p=m>0?x/i(-m):x*i(m),!(p<u)){if(p>d)break;v.push(p)}v.length*2<g&&(v=yD(u,d,g))}else v=yD(m,h,Math.min(h-m,g)).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=Q2(c)).precision==null&&(c.trim=!0),c=NM(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(hde(r(),{floor:l=>i(Math.floor(a(l))),ceil:l=>i(Math.ceil(a(l)))})),t}function mde(){const e=SM(ZE()).domain([1,10]);return e.copy=()=>C_(e,mde()).base(e.base()),hu.apply(e,arguments),e}function GW(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function KW(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function kM(e){var t=1,r=e(GW(t),KW(t));return r.constant=function(n){return arguments.length?e(GW(t=+n),KW(t)):t},Fp(r)}function pde(){var e=kM(ZE());return e.copy=function(){return C_(e,pde()).constant(e.constant())},hu.apply(e,arguments)}function XW(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function Kat(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function Xat(e){return e<0?-e*e:e*e}function CM(e){var t=e(Wo,Wo),r=1;function n(){return r===1?e(Wo,Wo):r===.5?e(Kat,Xat):e(XW(r),XW(1/r))}return t.exponent=function(a){return arguments.length?(r=+a,n()):r},Fp(t)}function EM(){var e=CM(ZE());return e.copy=function(){return C_(e,EM()).exponent(e.exponent())},hu.apply(e,arguments),e}function Yat(){return EM.apply(null,arguments).exponent(.5)}function YW(e){return Math.sign(e)*e*e}function Zat(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function xde(){var e=jM(),t=[0,1],r=!1,n;function a(i){var o=Zat(e(i));return isNaN(o)?n:r?Math.round(o):o}return a.invert=function(i){return e.invert(YW(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,rk)).map(YW)),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 xde(e.domain(),t).round(r).clamp(e.clamp()).unknown(n)},hu.apply(a,arguments),Fp(a)}function gde(){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]=rat(e,o/l);return i}function i(o){return o==null||isNaN(o=+o)?n:t[S_(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(ep),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 gde().domain(e).range(t).unknown(n)},hu.apply(i,arguments)}function vde(){var e=0,t=1,r=1,n=[.5],a=[0,1],i;function o(c){return c!=null&&c<=c?a[S_(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 vde().domain([e,t]).range(a).unknown(i)},hu.apply(Fp(o),arguments)}function yde(){var e=[.5],t=[0,1],r,n=1;function a(i){return i!=null&&i<=i?t[S_(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 yde().domain(e).range(t).unknown(r)},hu.apply(a,arguments)}const CP=new Date,EP=new Date;function Si(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=>Si(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)=>(CP.setTime(+i),EP.setTime(+o),e(CP),e(EP),Math.floor(r(CP,EP))),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 ak=Si(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);ak.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Si(t=>{t.setTime(Math.floor(t/e)*e)},(t,r)=>{t.setTime(+t+r*e)},(t,r)=>(r-t)/e):ak);ak.range;const Yf=1e3,Vc=Yf*60,Zf=Vc*60,yh=Zf*24,AM=yh*7,ZW=yh*30,AP=yh*365,Ox=Si(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*Yf)},(e,t)=>(t-e)/Yf,e=>e.getUTCSeconds());Ox.range;const TM=Si(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Yf)},(e,t)=>{e.setTime(+e+t*Vc)},(e,t)=>(t-e)/Vc,e=>e.getMinutes());TM.range;const PM=Si(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*Vc)},(e,t)=>(t-e)/Vc,e=>e.getUTCMinutes());PM.range;const OM=Si(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Yf-e.getMinutes()*Vc)},(e,t)=>{e.setTime(+e+t*Zf)},(e,t)=>(t-e)/Zf,e=>e.getHours());OM.range;const DM=Si(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*Zf)},(e,t)=>(t-e)/Zf,e=>e.getUTCHours());DM.range;const E_=Si(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Vc)/yh,e=>e.getDate()-1);E_.range;const JE=Si(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/yh,e=>e.getUTCDate()-1);JE.range;const bde=Si(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/yh,e=>Math.floor(e/yh));bde.range;function Q0(e){return Si(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())*Vc)/AM)}const QE=Q0(0),ik=Q0(1),Jat=Q0(2),Qat=Q0(3),Ay=Q0(4),eit=Q0(5),tit=Q0(6);QE.range;ik.range;Jat.range;Qat.range;Ay.range;eit.range;tit.range;function eg(e){return Si(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)/AM)}const eA=eg(0),ok=eg(1),rit=eg(2),nit=eg(3),Ty=eg(4),sit=eg(5),ait=eg(6);eA.range;ok.range;rit.range;nit.range;Ty.range;sit.range;ait.range;const IM=Si(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());IM.range;const RM=Si(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());RM.range;const bh=Si(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());bh.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Si(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)});bh.range;const wh=Si(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());wh.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Si(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)});wh.range;function wde(e,t,r,n,a,i){const o=[[Ox,1,Yf],[Ox,5,5*Yf],[Ox,15,15*Yf],[Ox,30,30*Yf],[i,1,Vc],[i,5,5*Vc],[i,15,15*Vc],[i,30,30*Vc],[a,1,Zf],[a,3,3*Zf],[a,6,6*Zf],[a,12,12*Zf],[n,1,yh],[n,2,2*yh],[r,1,AM],[t,1,ZW],[t,3,3*ZW],[e,1,AP]];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),x=h?h.range(u,+d+1):[];return m?x.reverse():x}function c(u,d,f){const m=Math.abs(d-u)/f,h=gM(([,,g])=>g).right(o,m);if(h===o.length)return e.every(wD(u/AP,d/AP,f));if(h===0)return ak.every(Math.max(wD(u,d,f),1));const[x,p]=o[m/o[h-1][2]<o[h][2]/m?h-1:h];return x.every(p)}return[l,c]}const[iit,oit]=wde(wh,RM,eA,bde,DM,PM),[lit,cit]=wde(bh,IM,QE,E_,OM,TM);function TP(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 PP(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 Ub(e,t,r){return{y:e,m:t,d:r,H:0,M:0,S:0,L:0}}function uit(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=Vb(a),d=Hb(a),f=Vb(i),m=Hb(i),h=Vb(o),x=Hb(o),p=Vb(l),g=Hb(l),v=Vb(c),y=Hb(c),b={a:V,A:z,b:M,B,c:null,d:nG,e:nG,f:Dit,g:Uit,G:Hit,H:Tit,I:Pit,j:Oit,L:jde,m:Iit,M:Rit,p:K,q:C,Q:iG,s:oG,S:Lit,u:Fit,U:Mit,V:$it,w:Bit,W:zit,x:null,X:null,y:qit,Y:Vit,Z:Wit,"%":aG},N={a:A,A:I,b:U,B:Y,c:null,d:sG,e:sG,f:Yit,g:iot,G:lot,H:Git,I:Kit,j:Xit,L:Nde,m:Zit,M:Jit,p:te,q:re,Q:iG,s:oG,S:Qit,u:eot,U:tot,V:rot,w:not,W:sot,x:null,X:null,y:aot,Y:oot,Z:cot,"%":aG},j={a:R,A:k,b:E,B:q,c:O,d:tG,e:tG,f:kit,g:eG,G:QW,H:rG,I:rG,j:jit,L:Sit,m:wit,M:_it,p:T,q:bit,Q:Eit,s:Ait,S:Nit,u:pit,U:xit,V:git,w:mit,W:vit,x:L,X:H,y:eG,Y:QW,Z:yit,"%":Cit};b.x=_(r,b),b.X=_(n,b),b.c=_(t,b),N.x=_(r,N),N.X=_(n,N),N.c=_(t,N);function _(J,ie){return function(be){var Q=[],Ve=-1,W=0,Z=J.length,he,se,oe;for(be instanceof Date||(be=new Date(+be));++Ve<Z;)J.charCodeAt(Ve)===37&&(Q.push(J.slice(W,Ve)),(se=JW[he=J.charAt(++Ve)])!=null?he=J.charAt(++Ve):se=he==="e"?" ":"0",(oe=ie[he])&&(he=oe(be,se)),Q.push(he),W=Ve+1);return Q.push(J.slice(W,Ve)),Q.join("")}}function S(J,ie){return function(be){var Q=Ub(1900,void 0,1),Ve=P(Q,J,be+="",0),W,Z;if(Ve!=be.length)return null;if("Q"in Q)return new Date(Q.Q);if("s"in Q)return new Date(Q.s*1e3+("L"in Q?Q.L:0));if(ie&&!("Z"in Q)&&(Q.Z=0),"p"in Q&&(Q.H=Q.H%12+Q.p*12),Q.m===void 0&&(Q.m="q"in Q?Q.q:0),"V"in Q){if(Q.V<1||Q.V>53)return null;"w"in Q||(Q.w=1),"Z"in Q?(W=PP(Ub(Q.y,0,1)),Z=W.getUTCDay(),W=Z>4||Z===0?ok.ceil(W):ok(W),W=JE.offset(W,(Q.V-1)*7),Q.y=W.getUTCFullYear(),Q.m=W.getUTCMonth(),Q.d=W.getUTCDate()+(Q.w+6)%7):(W=TP(Ub(Q.y,0,1)),Z=W.getDay(),W=Z>4||Z===0?ik.ceil(W):ik(W),W=E_.offset(W,(Q.V-1)*7),Q.y=W.getFullYear(),Q.m=W.getMonth(),Q.d=W.getDate()+(Q.w+6)%7)}else("W"in Q||"U"in Q)&&("w"in Q||(Q.w="u"in Q?Q.u%7:"W"in Q?1:0),Z="Z"in Q?PP(Ub(Q.y,0,1)).getUTCDay():TP(Ub(Q.y,0,1)).getDay(),Q.m=0,Q.d="W"in Q?(Q.w+6)%7+Q.W*7-(Z+5)%7:Q.w+Q.U*7-(Z+6)%7);return"Z"in Q?(Q.H+=Q.Z/100|0,Q.M+=Q.Z%100,PP(Q)):TP(Q)}}function P(J,ie,be,Q){for(var Ve=0,W=ie.length,Z=be.length,he,se;Ve<W;){if(Q>=Z)return-1;if(he=ie.charCodeAt(Ve++),he===37){if(he=ie.charAt(Ve++),se=j[he in JW?ie.charAt(Ve++):he],!se||(Q=se(J,be,Q))<0)return-1}else if(he!=be.charCodeAt(Q++))return-1}return Q}function T(J,ie,be){var Q=u.exec(ie.slice(be));return Q?(J.p=d.get(Q[0].toLowerCase()),be+Q[0].length):-1}function R(J,ie,be){var Q=h.exec(ie.slice(be));return Q?(J.w=x.get(Q[0].toLowerCase()),be+Q[0].length):-1}function k(J,ie,be){var Q=f.exec(ie.slice(be));return Q?(J.w=m.get(Q[0].toLowerCase()),be+Q[0].length):-1}function E(J,ie,be){var Q=v.exec(ie.slice(be));return Q?(J.m=y.get(Q[0].toLowerCase()),be+Q[0].length):-1}function q(J,ie,be){var Q=p.exec(ie.slice(be));return Q?(J.m=g.get(Q[0].toLowerCase()),be+Q[0].length):-1}function O(J,ie,be){return P(J,t,ie,be)}function L(J,ie,be){return P(J,r,ie,be)}function H(J,ie,be){return P(J,n,ie,be)}function V(J){return o[J.getDay()]}function z(J){return i[J.getDay()]}function M(J){return c[J.getMonth()]}function B(J){return l[J.getMonth()]}function K(J){return a[+(J.getHours()>=12)]}function C(J){return 1+~~(J.getMonth()/3)}function A(J){return o[J.getUTCDay()]}function I(J){return i[J.getUTCDay()]}function U(J){return c[J.getUTCMonth()]}function Y(J){return l[J.getUTCMonth()]}function te(J){return a[+(J.getUTCHours()>=12)]}function re(J){return 1+~~(J.getUTCMonth()/3)}return{format:function(J){var ie=_(J+="",b);return ie.toString=function(){return J},ie},parse:function(J){var ie=S(J+="",!1);return ie.toString=function(){return J},ie},utcFormat:function(J){var ie=_(J+="",N);return ie.toString=function(){return J},ie},utcParse:function(J){var ie=S(J+="",!0);return ie.toString=function(){return J},ie}}}var JW={"-":"",_:" ",0:"0"},Bi=/^\s*\d+/,dit=/^%/,fit=/[\\^$*+?|[\]().{}]/g;function Wn(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 hit(e){return e.replace(fit,"\\$&")}function Vb(e){return new RegExp("^(?:"+e.map(hit).join("|")+")","i")}function Hb(e){return new Map(e.map((t,r)=>[t.toLowerCase(),r]))}function mit(e,t,r){var n=Bi.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function pit(e,t,r){var n=Bi.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function xit(e,t,r){var n=Bi.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function git(e,t,r){var n=Bi.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function vit(e,t,r){var n=Bi.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function QW(e,t,r){var n=Bi.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function eG(e,t,r){var n=Bi.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function yit(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 bit(e,t,r){var n=Bi.exec(t.slice(r,r+1));return n?(e.q=n[0]*3-3,r+n[0].length):-1}function wit(e,t,r){var n=Bi.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function tG(e,t,r){var n=Bi.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function jit(e,t,r){var n=Bi.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function rG(e,t,r){var n=Bi.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function _it(e,t,r){var n=Bi.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function Nit(e,t,r){var n=Bi.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function Sit(e,t,r){var n=Bi.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function kit(e,t,r){var n=Bi.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function Cit(e,t,r){var n=dit.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function Eit(e,t,r){var n=Bi.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function Ait(e,t,r){var n=Bi.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function nG(e,t){return Wn(e.getDate(),t,2)}function Tit(e,t){return Wn(e.getHours(),t,2)}function Pit(e,t){return Wn(e.getHours()%12||12,t,2)}function Oit(e,t){return Wn(1+E_.count(bh(e),e),t,3)}function jde(e,t){return Wn(e.getMilliseconds(),t,3)}function Dit(e,t){return jde(e,t)+"000"}function Iit(e,t){return Wn(e.getMonth()+1,t,2)}function Rit(e,t){return Wn(e.getMinutes(),t,2)}function Lit(e,t){return Wn(e.getSeconds(),t,2)}function Fit(e){var t=e.getDay();return t===0?7:t}function Mit(e,t){return Wn(QE.count(bh(e)-1,e),t,2)}function _de(e){var t=e.getDay();return t>=4||t===0?Ay(e):Ay.ceil(e)}function $it(e,t){return e=_de(e),Wn(Ay.count(bh(e),e)+(bh(e).getDay()===4),t,2)}function Bit(e){return e.getDay()}function zit(e,t){return Wn(ik.count(bh(e)-1,e),t,2)}function qit(e,t){return Wn(e.getFullYear()%100,t,2)}function Uit(e,t){return e=_de(e),Wn(e.getFullYear()%100,t,2)}function Vit(e,t){return Wn(e.getFullYear()%1e4,t,4)}function Hit(e,t){var r=e.getDay();return e=r>=4||r===0?Ay(e):Ay.ceil(e),Wn(e.getFullYear()%1e4,t,4)}function Wit(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Wn(t/60|0,"0",2)+Wn(t%60,"0",2)}function sG(e,t){return Wn(e.getUTCDate(),t,2)}function Git(e,t){return Wn(e.getUTCHours(),t,2)}function Kit(e,t){return Wn(e.getUTCHours()%12||12,t,2)}function Xit(e,t){return Wn(1+JE.count(wh(e),e),t,3)}function Nde(e,t){return Wn(e.getUTCMilliseconds(),t,3)}function Yit(e,t){return Nde(e,t)+"000"}function Zit(e,t){return Wn(e.getUTCMonth()+1,t,2)}function Jit(e,t){return Wn(e.getUTCMinutes(),t,2)}function Qit(e,t){return Wn(e.getUTCSeconds(),t,2)}function eot(e){var t=e.getUTCDay();return t===0?7:t}function tot(e,t){return Wn(eA.count(wh(e)-1,e),t,2)}function Sde(e){var t=e.getUTCDay();return t>=4||t===0?Ty(e):Ty.ceil(e)}function rot(e,t){return e=Sde(e),Wn(Ty.count(wh(e),e)+(wh(e).getUTCDay()===4),t,2)}function not(e){return e.getUTCDay()}function sot(e,t){return Wn(ok.count(wh(e)-1,e),t,2)}function aot(e,t){return Wn(e.getUTCFullYear()%100,t,2)}function iot(e,t){return e=Sde(e),Wn(e.getUTCFullYear()%100,t,2)}function oot(e,t){return Wn(e.getUTCFullYear()%1e4,t,4)}function lot(e,t){var r=e.getUTCDay();return e=r>=4||r===0?Ty(e):Ty.ceil(e),Wn(e.getUTCFullYear()%1e4,t,4)}function cot(){return"+0000"}function aG(){return"%"}function iG(e){return+e}function oG(e){return Math.floor(+e/1e3)}var Lg,kde,Cde;uot({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 uot(e){return Lg=uit(e),kde=Lg.format,Lg.parse,Cde=Lg.utcFormat,Lg.utcParse,Lg}function dot(e){return new Date(e)}function fot(e){return e instanceof Date?+e:+new Date(+e)}function LM(e,t,r,n,a,i,o,l,c,u){var d=jM(),f=d.invert,m=d.domain,h=u(".%L"),x=u(":%S"),p=u("%I:%M"),g=u("%I %p"),v=u("%a %d"),y=u("%b %d"),b=u("%B"),N=u("%Y");function j(_){return(c(_)<_?h:l(_)<_?x:o(_)<_?p:i(_)<_?g:n(_)<_?a(_)<_?v:y:r(_)<_?b:N)(_)}return d.invert=function(_){return new Date(f(_))},d.domain=function(_){return arguments.length?m(Array.from(_,fot)):m().map(dot)},d.ticks=function(_){var S=m();return e(S[0],S[S.length-1],_??10)},d.tickFormat=function(_,S){return S==null?j:u(S)},d.nice=function(_){var S=m();return(!_||typeof _.range!="function")&&(_=t(S[0],S[S.length-1],_??10)),_?m(hde(S,_)):d},d.copy=function(){return C_(d,LM(e,t,r,n,a,i,o,l,c,u))},d}function hot(){return hu.apply(LM(lit,cit,bh,IM,QE,E_,OM,TM,Ox,kde).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function mot(){return hu.apply(LM(iit,oit,wh,RM,eA,JE,DM,PM,Ox,Cde).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function tA(){var e=0,t=1,r,n,a,i,o=Wo,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,x;return arguments.length?([h,x]=m,o=f(h,x),u):[o(0),o(1)]}}return u.range=d(F1),u.rangeRound=d(wM),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 Mp(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function Ede(){var e=Fp(tA()(Wo));return e.copy=function(){return Mp(e,Ede())},Th.apply(e,arguments)}function Ade(){var e=SM(tA()).domain([1,10]);return e.copy=function(){return Mp(e,Ade()).base(e.base())},Th.apply(e,arguments)}function Tde(){var e=kM(tA());return e.copy=function(){return Mp(e,Tde()).constant(e.constant())},Th.apply(e,arguments)}function FM(){var e=CM(tA());return e.copy=function(){return Mp(e,FM()).exponent(e.exponent())},Th.apply(e,arguments)}function pot(){return FM.apply(null,arguments).exponent(.5)}function Pde(){var e=[],t=Wo;function r(n){if(n!=null&&!isNaN(n=+n))return t((S_(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(ep),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)=>tat(e,i/n))},r.copy=function(){return Pde(t).domain(e)},Th.apply(r,arguments)}function rA(){var e=0,t=.5,r=1,n=1,a,i,o,l,c,u=Wo,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 x(p){return function(g){var v,y,b;return arguments.length?([v,y,b]=g,u=Cat(p,[v,y,b]),h):[u(0),u(.5),u(1)]}}return h.range=x(F1),h.rangeRound=x(wM),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 Ode(){var e=Fp(rA()(Wo));return e.copy=function(){return Mp(e,Ode())},Th.apply(e,arguments)}function Dde(){var e=SM(rA()).domain([.1,1,10]);return e.copy=function(){return Mp(e,Dde()).base(e.base())},Th.apply(e,arguments)}function Ide(){var e=kM(rA());return e.copy=function(){return Mp(e,Ide()).constant(e.constant())},Th.apply(e,arguments)}function MM(){var e=CM(rA());return e.copy=function(){return Mp(e,MM()).exponent(e.exponent())},Th.apply(e,arguments)}function xot(){return MM.apply(null,arguments).exponent(.5)}const lG=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:X2,scaleDiverging:Ode,scaleDivergingLog:Dde,scaleDivergingPow:MM,scaleDivergingSqrt:xot,scaleDivergingSymlog:Ide,scaleIdentity:fde,scaleImplicit:jD,scaleLinear:sk,scaleLog:mde,scaleOrdinal:vM,scalePoint:Bw,scalePow:EM,scaleQuantile:gde,scaleQuantize:vde,scaleRadial:xde,scaleSequential:Ede,scaleSequentialLog:Ade,scaleSequentialPow:FM,scaleSequentialQuantile:Pde,scaleSequentialSqrt:pot,scaleSequentialSymlog:Tde,scaleSqrt:Yat,scaleSymlog:pde,scaleThreshold:yde,scaleTime:hot,scaleUtc:mot,tickFormat:dde},Symbol.toStringTag,{value:"Module"}));var got=E1;function vot(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&&!got(o):r(o,l)))var l=o,c=i}return c}var nA=vot;function yot(e,t){return e>t}var Rde=yot,bot=nA,wot=Rde,jot=L1;function _ot(e){return e&&e.length?bot(e,jot,wot):void 0}var Not=_ot;const sA=Sn(Not);function Sot(e,t){return e<t}var Lde=Sot,kot=nA,Cot=Lde,Eot=L1;function Aot(e){return e&&e.length?kot(e,Eot,Cot):void 0}var Tot=Aot;const aA=Sn(Tot);var Pot=JF,Oot=hf,Dot=Vue,Iot=El;function Rot(e,t){var r=Iot(e)?Pot:Dot;return r(e,Oot(t))}var Lot=Rot,Fot=que,Mot=Lot;function $ot(e,t){return Fot(Mot(e,t),1)}var Bot=$ot;const zot=Sn(Bot);var qot=hM;function Uot(e,t){return qot(e,t)}var Vot=Uot;const A_=Sn(Vot);var M1=1e9,Hot={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},BM,Zs=!0,ou="[DecimalError] ",t0=ou+"Invalid argument: ",$M=ou+"Exponent out of range: ",$1=Math.floor,xx=Math.pow,Wot=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Xl,ki=1e7,zs=7,Fde=9007199254740991,lk=$1(Fde/zs),rr={};rr.absoluteValue=rr.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e};rr.comparedTo=rr.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};rr.decimalPlaces=rr.dp=function(){var e=this,t=e.d.length-1,r=(t-e.e)*zs;if(t=e.d[t],t)for(;t%10==0;t/=10)r--;return r<0?0:r};rr.dividedBy=rr.div=function(e){return sh(this,new this.constructor(e))};rr.dividedToIntegerBy=rr.idiv=function(e){var t=this,r=t.constructor;return ys(sh(t,new r(e),0,1),r.precision)};rr.equals=rr.eq=function(e){return!this.cmp(e)};rr.exponent=function(){return Ja(this)};rr.greaterThan=rr.gt=function(e){return this.cmp(e)>0};rr.greaterThanOrEqualTo=rr.gte=function(e){return this.cmp(e)>=0};rr.isInteger=rr.isint=function(){return this.e>this.d.length-2};rr.isNegative=rr.isneg=function(){return this.s<0};rr.isPositive=rr.ispos=function(){return this.s>0};rr.isZero=function(){return this.s===0};rr.lessThan=rr.lt=function(e){return this.cmp(e)<0};rr.lessThanOrEqualTo=rr.lte=function(e){return this.cmp(e)<1};rr.logarithm=rr.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(Xl))throw Error(ou+"NaN");if(r.s<1)throw Error(ou+(r.s?"NaN":"-Infinity"));return r.eq(Xl)?new n(0):(Zs=!1,t=sh(ej(r,i),ej(e,i),i),Zs=!0,ys(t,a))};rr.minus=rr.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?Bde(t,e):Mde(t,(e.s=-e.s,e))};rr.modulo=rr.mod=function(e){var t,r=this,n=r.constructor,a=n.precision;if(e=new n(e),!e.s)throw Error(ou+"NaN");return r.s?(Zs=!1,t=sh(r,e,0,1).times(e),Zs=!0,r.minus(t)):ys(new n(r),a)};rr.naturalExponential=rr.exp=function(){return $de(this)};rr.naturalLogarithm=rr.ln=function(){return ej(this)};rr.negated=rr.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};rr.plus=rr.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?Mde(t,e):Bde(t,(e.s=-e.s,e))};rr.precision=rr.sd=function(e){var t,r,n,a=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(t0+e);if(t=Ja(a)+1,n=a.d.length-1,r=n*zs+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};rr.squareRoot=rr.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(ou+"NaN")}for(e=Ja(l),Zs=!1,a=Math.sqrt(+l),a==0||a==1/0?(t=Hd(l.d),(t.length+e)%2==0&&(t+="0"),a=Math.sqrt(t),e=$1((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(sh(l,i,o+2)).times(.5),Hd(i.d).slice(0,o)===(t=Hd(n.d)).slice(0,o)){if(t=t.slice(o-3,o+1),a==o&&t=="4999"){if(ys(i,r+1,0),i.times(i).eq(l)){n=i;break}}else if(t!="9999")break;o+=4}return Zs=!0,ys(n,r)};rr.times=rr.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%ki|0,t=l/ki|0;i[a]=(i[a]+t)%ki|0}for(;!i[--o];)i.pop();return t?++r:i.shift(),e.d=i,e.e=r,Zs?ys(e,f.precision):e};rr.toDecimalPlaces=rr.todp=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(nf(e,0,M1),t===void 0?t=n.rounding:nf(t,0,8),ys(r,e+Ja(r)+1,t))};rr.toExponential=function(e,t){var r,n=this,a=n.constructor;return e===void 0?r=E0(n,!0):(nf(e,0,M1),t===void 0?t=a.rounding:nf(t,0,8),n=ys(new a(n),e+1,t),r=E0(n,!0,e+1)),r};rr.toFixed=function(e,t){var r,n,a=this,i=a.constructor;return e===void 0?E0(a):(nf(e,0,M1),t===void 0?t=i.rounding:nf(t,0,8),n=ys(new i(a),e+Ja(a)+1,t),r=E0(n.abs(),!1,e+Ja(n)+1),a.isneg()&&!a.isZero()?"-"+r:r)};rr.toInteger=rr.toint=function(){var e=this,t=e.constructor;return ys(new t(e),Ja(e)+1,t.rounding)};rr.toNumber=function(){return+this};rr.toPower=rr.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(Xl);if(l=new c(l),!l.s){if(e.s<1)throw Error(ou+"Infinity");return l}if(l.eq(Xl))return l;if(n=c.precision,e.eq(Xl))return ys(l,n);if(t=e.e,r=e.d.length-1,o=t>=r,i=l.s,o){if((r=d<0?-d:d)<=Fde){for(a=new c(Xl),t=Math.ceil(n/zs+4),Zs=!1;r%2&&(a=a.times(l),uG(a.d,t)),r=$1(r/2),r!==0;)l=l.times(l),uG(l.d,t);return Zs=!0,e.s<0?new c(Xl).div(a):ys(a,n)}}else if(i<0)throw Error(ou+"NaN");return i=i<0&&e.d[Math.max(t,r)]&1?-1:1,l.s=1,Zs=!1,a=e.times(ej(l,n+u)),Zs=!0,a=$de(a),a.s=i,a};rr.toPrecision=function(e,t){var r,n,a=this,i=a.constructor;return e===void 0?(r=Ja(a),n=E0(a,r<=i.toExpNeg||r>=i.toExpPos)):(nf(e,1,M1),t===void 0?t=i.rounding:nf(t,0,8),a=ys(new i(a),e,t),r=Ja(a),n=E0(a,e<=r||r<=i.toExpNeg,e)),n};rr.toSignificantDigits=rr.tosd=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(nf(e,1,M1),t===void 0?t=n.rounding:nf(t,0,8)),ys(new n(r),e,t)};rr.toString=rr.valueOf=rr.val=rr.toJSON=rr[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=Ja(e),r=e.constructor;return E0(e,t<=r.toExpNeg||t>=r.toExpPos)};function Mde(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)),Zs?ys(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/zs),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)/ki|0,c[i]%=ki;for(r&&(c.unshift(r),++a),l=c.length;c[--l]==0;)c.pop();return t.d=c,t.e=a,Zs?ys(t,f):t}function nf(e,t,r){if(e!==~~e||e<t||e>r)throw Error(t0+e)}function Hd(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=zs-n.length,r&&(i+=fm(r)),i+=n;o=e[t],n=o+"",r=zs-n.length,r&&(i+=fm(r))}else if(o===0)return"0";for(;o%10===0;)o/=10;return i+o}var sh=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%ki|0,o=i/ki|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*ki+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,x,p,g,v,y,b,N,j,_,S,P,T=n.constructor,R=n.s==a.s?1:-1,k=n.d,E=a.d;if(!n.s)return new T(n);if(!a.s)throw Error(ou+"Division by zero");for(c=n.e-a.e,S=E.length,j=k.length,h=new T(R),x=h.d=[],u=0;E[u]==(k[u]||0);)++u;if(E[u]>(k[u]||0)&&--c,i==null?y=i=T.precision:o?y=i+(Ja(n)-Ja(a))+1:y=i,y<0)return new T(0);if(y=y/zs+2|0,u=0,S==1)for(d=0,E=E[0],y++;(u<j||d)&&y--;u++)b=d*ki+(k[u]||0),x[u]=b/E|0,d=b%E|0;else{for(d=ki/(E[0]+1)|0,d>1&&(E=e(E,d),k=e(k,d),S=E.length,j=k.length),N=S,p=k.slice(0,S),g=p.length;g<S;)p[g++]=0;P=E.slice(),P.unshift(0),_=E[0],E[1]>=ki/2&&++_;do d=0,l=t(E,p,S,g),l<0?(v=p[0],S!=g&&(v=v*ki+(p[1]||0)),d=v/_|0,d>1?(d>=ki&&(d=ki-1),f=e(E,d),m=f.length,g=p.length,l=t(f,p,m,g),l==1&&(d--,r(f,S<m?P:E,m))):(d==0&&(l=d=1),f=E.slice()),m=f.length,m<g&&f.unshift(0),r(p,f,g),l==-1&&(g=p.length,l=t(E,p,S,g),l<1&&(d++,r(p,S<g?P:E,g))),g=p.length):l===0&&(d++,p=[0]),x[u++]=d,l&&p[0]?p[g++]=k[N]||0:(p=[k[N]],g=1);while((N++<j||p[0]!==void 0)&&y--)}return x[0]||x.shift(),h.e=c,ys(h,o?i+Ja(h)+1:i)}}();function $de(e,t){var r,n,a,i,o,l,c=0,u=0,d=e.constructor,f=d.precision;if(Ja(e)>16)throw Error($M+Ja(e));if(!e.s)return new d(Xl);for(Zs=!1,l=f,o=new d(.03125);e.abs().gte(.1);)e=e.times(o),u+=5;for(n=Math.log(xx(2,u))/Math.LN10*2+5|0,l+=n,r=a=i=new d(Xl),d.precision=l;;){if(a=ys(a.times(e),l),r=r.times(++c),o=i.plus(sh(a,r,l)),Hd(o.d).slice(0,l)===Hd(i.d).slice(0,l)){for(;u--;)i=ys(i.times(i),l);return d.precision=f,t==null?(Zs=!0,ys(i,f)):i}i=o}}function Ja(e){for(var t=e.e*zs,r=e.d[0];r>=10;r/=10)t++;return t}function OP(e,t,r){if(t>e.LN10.sd())throw Zs=!0,r&&(e.precision=r),Error(ou+"LN10 precision limit exceeded");return ys(new e(e.LN10),t)}function fm(e){for(var t="";e--;)t+="0";return t}function ej(e,t){var r,n,a,i,o,l,c,u,d,f=1,m=10,h=e,x=h.d,p=h.constructor,g=p.precision;if(h.s<1)throw Error(ou+(h.s?"NaN":"-Infinity"));if(h.eq(Xl))return new p(0);if(t==null?(Zs=!1,u=g):u=t,h.eq(10))return t==null&&(Zs=!0),OP(p,u);if(u+=m,p.precision=u,r=Hd(x),n=r.charAt(0),i=Ja(h),Math.abs(i)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)h=h.times(e),r=Hd(h.d),n=r.charAt(0),f++;i=Ja(h),n>1?(h=new p("0."+r),i++):h=new p(n+"."+r.slice(1))}else return c=OP(p,u+2,g).times(i+""),h=ej(new p(n+"."+r.slice(1)),u-m).plus(c),p.precision=g,t==null?(Zs=!0,ys(h,g)):h;for(l=o=h=sh(h.minus(Xl),h.plus(Xl),u),d=ys(h.times(h),u),a=3;;){if(o=ys(o.times(d),u),c=l.plus(sh(o,new p(a),u)),Hd(c.d).slice(0,u)===Hd(l.d).slice(0,u))return l=l.times(2),i!==0&&(l=l.plus(OP(p,u+2,g).times(i+""))),l=sh(l,new p(f),u),p.precision=g,t==null?(Zs=!0,ys(l,g)):l;l=c,a+=2}}function cG(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=$1(r/zs),e.d=[],n=(r+1)%zs,r<0&&(n+=zs),n<a){for(n&&e.d.push(+t.slice(0,n)),a-=zs;n<a;)e.d.push(+t.slice(n,n+=zs));t=t.slice(n),n=zs-t.length}else n-=a;for(;n--;)t+="0";if(e.d.push(+t),Zs&&(e.e>lk||e.e<-lk))throw Error($M+r)}else e.s=0,e.e=0,e.d=[0];return e}function ys(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+=zs,a=t,u=f[d=0];else{if(d=Math.ceil((n+1)/zs),i=f.length,d>=i)return e;for(u=i=f[d],o=1;i>=10;i/=10)o++;n%=zs,a=n-zs+o}if(r!==void 0&&(i=xx(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/xx(10,o-a):0:f[d-1])%10&1||r==(e.s<0?8:7))),t<1||!f[0])return c?(i=Ja(e),f.length=1,t=t-i-1,f[0]=xx(10,(zs-t%zs)%zs),e.e=$1(-t/zs)||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=xx(10,zs-n),f[d]=a>0?(u/xx(10,o-a)%xx(10,a)|0)*i:0),c)for(;;)if(d==0){(f[0]+=i)==ki&&(f[0]=1,++e.e);break}else{if(f[d]+=i,f[d]!=ki)break;f[d--]=0,i=1}for(n=f.length;f[--n]===0;)f.pop();if(Zs&&(e.e>lk||e.e<-lk))throw Error($M+Ja(e));return e}function Bde(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),Zs?ys(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/zs),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]=ki-1;--c[i],c[a]+=ki}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,Zs?ys(t,h):t):new m(0)}function E0(e,t,r){var n,a=Ja(e),i=Hd(e.d),o=i.length;return t?(r&&(n=r-o)>0?i=i.charAt(0)+"."+i.slice(1)+fm(n):o>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(a<0?"e":"e+")+a):a<0?(i="0."+fm(-a-1)+i,r&&(n=r-o)>0&&(i+=fm(n))):a>=o?(i+=fm(a+1-o),r&&(n=r-a-1)>0&&(i=i+"."+fm(n))):((n=a+1)<o&&(i=i.slice(0,n)+"."+i.slice(n)),r&&(n=r-o)>0&&(a+1===o&&(i+="."),i+=fm(n))),e.s<0?"-"+i:i}function uG(e,t){if(e.length>t)return e.length=t,!0}function zde(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(t0+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 cG(o,i.toString())}else if(typeof i!="string")throw Error(t0+i);if(i.charCodeAt(0)===45?(i=i.slice(1),o.s=-1):o.s=1,Wot.test(i))cG(o,i);else throw Error(t0+i)}if(a.prototype=rr,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=zde,a.config=a.set=Got,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 Got(e){if(!e||typeof e!="object")throw Error(ou+"Object expected");var t,r,n,a=["precision",1,M1,"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($1(n)===n&&n>=a[t+1]&&n<=a[t+2])this[r]=n;else throw Error(t0+r+": "+n);if((n=e[r="LN10"])!==void 0)if(n==Math.LN10)this[r]=new this(n);else throw Error(t0+r+": "+n);return this}var BM=zde(Hot);Xl=new BM(1);const fs=BM;function Kot(e){return Jot(e)||Zot(e)||Yot(e)||Xot()}function Xot(){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 Yot(e,t){if(e){if(typeof e=="string")return kD(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 kD(e,t)}}function Zot(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function Jot(e){if(Array.isArray(e))return kD(e)}function kD(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 Qot=function(t){return t},qde={},Ude=function(t){return t===qde},dG=function(t){return function r(){return arguments.length===0||arguments.length===1&&Ude(arguments.length<=0?void 0:arguments[0])?r:t.apply(void 0,arguments)}},elt=function e(t,r){return t===1?r:dG(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!==qde}).length;return o>=t?r.apply(void 0,a):e(t-o,dG(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 Ude(f)?c.shift():f});return r.apply(void 0,Kot(d).concat(c))}))})},iA=function(t){return elt(t.length,t)},CD=function(t,r){for(var n=[],a=t;a<r;++a)n[a-t]=a;return n},tlt=iA(function(e,t){return Array.isArray(t)?t.map(e):Object.keys(t).map(function(r){return t[r]}).map(e)}),rlt=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];if(!r.length)return Qot;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))}},ED=function(t){return Array.isArray(t)?t.reverse():t.split("").reverse.join("")},Vde=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 nlt(e){var t;return e===0?t=1:t=Math.floor(new fs(e).abs().log(10).toNumber())+1,t}function slt(e,t,r){for(var n=new fs(e),a=0,i=[];n.lt(t)&&a<1e5;)i.push(n.toNumber()),n=n.add(r),a++;return i}var alt=iA(function(e,t,r){var n=+e,a=+t;return n+r*(a-n)}),ilt=iA(function(e,t,r){var n=t-+e;return n=n||1/0,(r-e)/n}),olt=iA(function(e,t,r){var n=t-+e;return n=n||1/0,Math.max(0,Math.min(1,(r-e)/n))});const oA={rangeStep:slt,getDigitCount:nlt,interpolateNumber:alt,uninterpolateNumber:ilt,uninterpolateTruncation:olt};function AD(e){return ult(e)||clt(e)||Hde(e)||llt()}function llt(){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 clt(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function ult(e){if(Array.isArray(e))return TD(e)}function tj(e,t){return hlt(e)||flt(e,t)||Hde(e,t)||dlt()}function dlt(){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 Hde(e,t){if(e){if(typeof e=="string")return TD(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 TD(e,t)}}function TD(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 flt(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 hlt(e){if(Array.isArray(e))return e}function Wde(e){var t=tj(e,2),r=t[0],n=t[1],a=r,i=n;return r>n&&(a=n,i=r),[a,i]}function Gde(e,t,r){if(e.lte(0))return new fs(0);var n=oA.getDigitCount(e.toNumber()),a=new fs(10).pow(n),i=e.div(a),o=n!==1?.05:.1,l=new fs(Math.ceil(i.div(o).toNumber())).add(r).mul(o),c=l.mul(a);return t?c:new fs(Math.ceil(c))}function mlt(e,t,r){var n=1,a=new fs(e);if(!a.isint()&&r){var i=Math.abs(e);i<1?(n=new fs(10).pow(oA.getDigitCount(e)-1),a=new fs(Math.floor(a.div(n).toNumber())).mul(n)):i>1&&(a=new fs(Math.floor(e)))}else e===0?a=new fs(Math.floor((t-1)/2)):r||(a=new fs(Math.floor(e)));var o=Math.floor((t-1)/2),l=rlt(tlt(function(c){return a.add(new fs(c-o).mul(n)).toNumber()}),CD);return l(0,t)}function Kde(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 fs(0),tickMin:new fs(0),tickMax:new fs(0)};var i=Gde(new fs(t).sub(e).div(r-1),n,a),o;e<=0&&t>=0?o=new fs(0):(o=new fs(e).add(t).div(2),o=o.sub(new fs(o).mod(i)));var l=Math.ceil(o.sub(e).div(i).toNumber()),c=Math.ceil(new fs(t).sub(o).div(i).toNumber()),u=l+c+1;return u>r?Kde(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 fs(l).mul(i)),tickMax:o.add(new fs(c).mul(i))})}function plt(e){var t=tj(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=Wde([r,n]),c=tj(l,2),u=c[0],d=c[1];if(u===-1/0||d===1/0){var f=d===1/0?[u].concat(AD(CD(0,a-1).map(function(){return 1/0}))):[].concat(AD(CD(0,a-1).map(function(){return-1/0})),[d]);return r>n?ED(f):f}if(u===d)return mlt(u,a,i);var m=Kde(u,d,o,i),h=m.step,x=m.tickMin,p=m.tickMax,g=oA.rangeStep(x,p.add(new fs(.1).mul(h)),h);return r>n?ED(g):g}function xlt(e,t){var r=tj(e,2),n=r[0],a=r[1],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Wde([n,a]),l=tj(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=Gde(new fs(u).sub(c).div(d-1),i,0),m=[].concat(AD(oA.rangeStep(new fs(c),new fs(u).sub(new fs(.99).mul(f)),f)),[u]);return n>a?ED(m):m}var glt=Vde(plt),vlt=Vde(xlt),ylt="Invariant failed";function A0(e,t){throw new Error(ylt)}var blt=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];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 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 wlt(e,t){return Slt(e)||Nlt(e,t)||_lt(e,t)||jlt()}function jlt(){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 _lt(e,t){if(e){if(typeof e=="string")return fG(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 fG(e,t)}}function fG(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 Nlt(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 Slt(e){if(Array.isArray(e))return e}function klt(e,t){if(e==null)return{};var r=Clt(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 Clt(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 Elt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Alt(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 Tlt(e,t,r){return t&&Alt(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Plt(e,t,r){return t=uk(t),Olt(e,Xde()?Reflect.construct(t,r||[],uk(e).constructor):t.apply(e,r))}function Olt(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 Dlt(e)}function Dlt(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Xde(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Xde=function(){return!!e})()}function uk(e){return uk=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},uk(e)}function Ilt(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 Yde(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=Rlt(e,"string");return Py(t)=="symbol"?t:t+""}function Rlt(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 T_=function(e){function t(){return Elt(this,t),Plt(this,t,arguments)}return Ilt(t,e),Tlt(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=klt(n,blt),h=Er(m,!1);this.props.direction==="x"&&d.type!=="number"&&A0();var x=c.map(function(p){var g=u(p,l),v=g.x,y=g.y,b=g.value,N=g.errorVal;if(!N)return null;var j=[],_,S;if(Array.isArray(N)){var P=wlt(N,2);_=P[0],S=P[1]}else _=S=N;if(i==="vertical"){var T=d.scale,R=y+a,k=R+o,E=R-o,q=T(b-_),O=T(b+S);j.push({x1:O,y1:k,x2:O,y2:E}),j.push({x1:q,y1:R,x2:O,y2:R}),j.push({x1:q,y1:k,x2:q,y2:E})}else if(i==="horizontal"){var L=f.scale,H=v+a,V=H-o,z=H+o,M=L(b-_),B=L(b+S);j.push({x1:V,y1:B,x2:z,y2:B}),j.push({x1:H,y1:M,x2:H,y2:B}),j.push({x1:V,y1:M,x2:z,y2:M})}return ye.createElement(zn,ck({className:"recharts-errorBar",key:"bar-".concat(j.map(function(K){return"".concat(K.x1,"-").concat(K.x2,"-").concat(K.y1,"-").concat(K.y2)}))},h),j.map(function(K){return ye.createElement("line",ck({},K,{key:"line-".concat(K.x1,"-").concat(K.x2,"-").concat(K.y1,"-").concat(K.y2)}))}))});return ye.createElement(zn,{className:"recharts-errorBars"},x)}}])}(ye.Component);Yde(T_,"defaultProps",{stroke:"black",strokeWidth:1.5,width:5,offset:0,layout:"horizontal"});Yde(T_,"displayName","ErrorBar");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 hG(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 ix(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?hG(Object(r),!0).forEach(function(n){Llt(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):hG(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Llt(e,t,r){return t=Flt(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Flt(e){var t=Mlt(e,"string");return rj(t)=="symbol"?t:t+""}function Mlt(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)}var Jde=function(t){var r=t.children,n=t.formattedGraphicalItems,a=t.legendWidth,i=t.legendContent,o=ql(r,Qx);if(!o)return null;var l=Qx.defaultProps,c=l!==void 0?ix(ix({},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,x=h.sectors||h.data||[];return d.concat(x.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?ix(ix({},m),f.props):{},x=h.dataKey,p=h.name,g=h.legendType,v=h.hide;return{inactive:v,dataKey:x,type:c.iconType||g||"square",color:zM(f),value:p||x,payload:h}}),ix(ix(ix({},c),Qx.getWithHeight(o,a)),{},{payload:u,item:o})};function nj(e){"@babel/helpers - typeof";return nj=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},nj(e)}function mG(e){return qlt(e)||zlt(e)||Blt(e)||$lt()}function $lt(){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 Blt(e,t){if(e){if(typeof e=="string")return OD(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 OD(e,t)}}function zlt(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function qlt(e){if(Array.isArray(e))return OD(e)}function OD(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 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 ga(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){Bv(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 Bv(e,t,r){return t=Ult(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ult(e){var t=Vlt(e,"string");return nj(t)=="symbol"?t:t+""}function Vlt(e,t){if(nj(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(nj(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function gi(e,t,r){return Jr(e)||Jr(t)?r:bi(t)?sc(e,t,r):qr(t)?t(e):r}function zw(e,t,r,n){var a=zot(e,function(l){return gi(l,t)});if(r==="number"){var i=a.filter(function(l){return Ft(l)||parseFloat(l)});return i.length?[aA(i),sA(i)]:[1/0,-1/0]}var o=n?a.filter(function(l){return!Jr(l)}):a;return o.map(function(l){return bi(l)||l instanceof Date?l:""})}var Hlt=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(Vo(f-d)!==Vo(m-f)){var x=[];if(Vo(m-f)===Vo(c[1]-c[0])){h=m;var p=f+c[1]-c[0];x[0]=Math.min(p,(p+d)/2),x[1]=Math.max(p,(p+d)/2)}else{h=d;var g=m+c[1]-c[0];x[0]=Math.min(f,(g+f)/2),x[1]=Math.max(f,(g+f)/2)}var v=[Math.min(f,(h+f)/2),Math.max(f,(h+f)/2)];if(t>v[0]&&t<=v[1]||t>=x[0]&&t<=x[1]){o=a[u].index;break}}else{var y=Math.min(d,m),b=Math.max(d,m);if(t>(y+f)/2&&t<=(b+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},zM=function(t){var r,n=t,a=n.type.displayName,i=(r=t.type)!==null&&r!==void 0&&r.defaultProps?ga(ga({},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},Wlt=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 x=d[f[m]],p=x.items,g=x.cateAxisId,v=p.filter(function(S){return nh(S.type).indexOf("Bar")>=0});if(v&&v.length){var y=v[0].type.defaultProps,b=y!==void 0?ga(ga({},y),v[0].props):v[0].props,N=b.barSize,j=b[g];o[j]||(o[j]=[]);var _=Jr(N)?r:N;o[j].push({item:v[0],stackList:v.slice(1),barSize:Jr(_)?void 0:Ho(_,n,0)})}}return o},Glt=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=Ho(r,a,0,!0),d,f=[];if(o[0].barSize===+o[0].barSize){var m=!1,h=a/c,x=o.reduce(function(N,j){return N+j.barSize||0},0);x+=(c-1)*u,x>=a&&(x-=(c-1)*u,u=0),x>=a&&h>0&&(m=!0,h*=.9,x=c*h);var p=(a-x)/2>>0,g={offset:p-u,size:0};d=o.reduce(function(N,j){var _={item:j.item,position:{offset:g.offset+g.size+u,size:m?h:j.barSize}},S=[].concat(mG(N),[_]);return g=S[S.length-1].position,j.stackList&&j.stackList.length&&j.stackList.forEach(function(P){S.push({item:P,position:g})}),S},f)}else{var v=Ho(n,a,0,!0);a-2*v-(c-1)*u<=0&&(u=0);var y=(a-2*v-(c-1)*u)/c;y>1&&(y>>=0);var b=l===+l?Math.min(y,l):y;d=o.reduce(function(N,j,_){var S=[].concat(mG(N),[{item:j.item,position:{offset:v+(y+u)*_+(y-b)/2,size:b}}]);return j.stackList&&j.stackList.length&&j.stackList.forEach(function(P){S.push({item:P,position:S[S.length-1].position})}),S},f)}return d},Klt=function(t,r,n,a){var i=n.children,o=n.width,l=n.margin,c=o-(l.left||0)-(l.right||0),u=Jde({children:i,legendWidth:c});if(u){var d=a||{},f=d.width,m=d.height,h=u.align,x=u.verticalAlign,p=u.layout;if((p==="vertical"||p==="horizontal"&&x==="middle")&&h!=="center"&&Ft(t[h]))return ga(ga({},t),{},Bv({},h,t[h]+(f||0)));if((p==="horizontal"||p==="vertical"&&h==="center")&&x!=="middle"&&Ft(t[x]))return ga(ga({},t),{},Bv({},x,t[x]+(m||0)))}return t},Xlt=function(t,r,n){return Jr(r)?!0:t==="horizontal"?r==="yAxis":t==="vertical"||n==="x"?r==="xAxis":n==="y"?r==="yAxis":!0},Qde=function(t,r,n,a,i){var o=r.props.children,l=ac(o,T_).filter(function(u){return Xlt(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=gi(d,n);if(Jr(f))return u;var m=Array.isArray(f)?[aA(f),sA(f)]:[f,f],h=c.reduce(function(x,p){var g=gi(d,p,0),v=m[0]-Math.abs(Array.isArray(g)?g[0]:g),y=m[1]+Math.abs(Array.isArray(g)?g[1]:g);return[Math.min(v,x[0]),Math.max(y,x[1])]},[1/0,-1/0]);return[Math.min(h[0],u[0]),Math.max(h[1],u[1])]},[1/0,-1/0])}return null},Ylt=function(t,r,n,a,i){var o=r.map(function(l){return Qde(t,l,n,i,a)}).filter(function(l){return!Jr(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},efe=function(t,r,n,a,i){var o=r.map(function(c){var u=c.props.dataKey;return n==="number"&&u&&Qde(t,c,u,a)||zw(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},[])},tfe=function(t,r){return t==="horizontal"&&r==="xAxis"||t==="vertical"&&r==="yAxis"||t==="centric"&&r==="angleAxis"||t==="radial"&&r==="radiusAxis"},rfe=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},Jf=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?Vo(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!j_(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}})},DP=new WeakMap,PS=function(t,r){if(typeof r!="function")return t;DP.has(t)||DP.set(t,new WeakMap);var n=DP.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},nfe=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:X2(),realScaleType:"band"}:o==="radial"&&l==="angleAxis"?{scale:sk(),realScaleType:"linear"}:i==="category"&&r&&(r.indexOf("LineChart")>=0||r.indexOf("AreaChart")>=0||r.indexOf("ComposedChart")>=0&&!n)?{scale:Bw(),realScaleType:"point"}:i==="category"?{scale:X2(),realScaleType:"band"}:{scale:sk(),realScaleType:"linear"};if(S0(a)){var c="scale".concat(VE(a));return{scale:(lG[c]||Bw)(),realScaleType:lG[c]?c:"point"}}return qr(a)?{scale:a}:{scale:Bw(),realScaleType:"point"}},xG=1e-4,sfe=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])-xG,o=Math.max(a[0],a[1])+xG,l=t(r[0]),c=t(r[n-1]);(l<i||l>o||c<i||c>o)&&t.domain([r[0],r[n-1]])}},Zlt=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},Jlt=function(t,r){if(!r||r.length!==2||!Ft(r[0])||!Ft(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(!Ft(t[0])||t[0]<n)&&(i[0]=n),(!Ft(t[1])||t[1]>a)&&(i[1]=a),i[0]>a&&(i[0]=a),i[1]<n&&(i[1]=n),i},Qlt=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=j_(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])}},ect=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=j_(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)}},tct={sign:Qlt,expand:vXe,none:_y,silhouette:yXe,wiggle:bXe,positive:ect},rct=function(t,r,n){var a=r.map(function(l){return l.props.dataKey}),i=tct[n],o=gXe().keys(a).value(function(l,c){return+gi(l,c,0)}).order(nD).offset(i);return o(t)},nct=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,x=(h=m.type)!==null&&h!==void 0&&h.defaultProps?ga(ga({},m.type.defaultProps),m.props):m.props,p=x.stackId,g=x.hide;if(g)return f;var v=x[n],y=f[v]||{hasStack:!1,stackGroups:{}};if(bi(p)){var b=y.stackGroups[p]||{numericAxisId:n,cateAxisId:a,items:[]};b.items.push(m),y.hasStack=!0,y.stackGroups[p]=b}else y.stackGroups[D1("_stackId_")]={numericAxisId:n,cateAxisId:a,items:[m]};return ga(ga({},f),{},Bv({},v,y))},c),d={};return Object.keys(u).reduce(function(f,m){var h=u[m];if(h.hasStack){var x={};h.stackGroups=Object.keys(h.stackGroups).reduce(function(p,g){var v=h.stackGroups[g];return ga(ga({},p),{},Bv({},g,{numericAxisId:n,cateAxisId:a,items:v.items,stackedData:rct(t,v.items,i)}))},x)}return ga(ga({},f),{},Bv({},m,h))},d)},afe=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=glt(u,i,l);return t.domain([aA(d),sA(d)]),{niceTicks:d}}if(i&&a==="number"){var f=t.domain(),m=vlt(f,i,l);return{niceTicks:m}}return null};function gG(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&&!Jr(a[t.dataKey])){var l=L4(r,"value",a[t.dataKey]);if(l)return l.coordinate+n/2}return r[i]?r[i].coordinate+n/2:null}var c=gi(a,Jr(o)?t.dataKey:o);return Jr(c)?null:t.scale(c)}var vG=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=gi(o,r.dataKey,r.domain[l]);return Jr(c)?null:r.scale(c)-i/2+a},sct=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]},act=function(t,r){var n,a=(n=t.type)!==null&&n!==void 0&&n.defaultProps?ga(ga({},t.type.defaultProps),t.props):t.props,i=a.stackId;if(bi(i)){var o=r[i];if(o){var l=o.items.indexOf(t);return l>=0?o.stackedData[l]:null}}return null},ict=function(t){return t.reduce(function(r,n){return[aA(n.concat([r[0]]).filter(Ft)),sA(n.concat([r[1]]).filter(Ft))]},[1/0,-1/0])},ife=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=ict(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})},yG=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,bG=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,DD=function(t,r,n){if(qr(t))return t(r,n);if(!Array.isArray(t))return r;var a=[];if(Ft(t[0]))a[0]=n?t[0]:Math.min(t[0],r[0]);else if(yG.test(t[0])){var i=+yG.exec(t[0])[1];a[0]=r[0]-i}else qr(t[0])?a[0]=t[0](r[0]):a[0]=r[0];if(Ft(t[1]))a[1]=n?t[1]:Math.max(t[1],r[1]);else if(bG.test(t[1])){var o=+bG.exec(t[1])[1];a[1]=r[1]+o}else qr(t[1])?a[1]=t[1](r[1]):a[1]=r[1];return a},dk=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=pM(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},wG=function(t,r,n){return!t||!t.length||A_(t,sc(n,"type.defaultProps.domain"))?r:t},ofe=function(t,r){var n=t.type.defaultProps?ga(ga({},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 ga(ga({},Er(t,!1)),{},{dataKey:a,unit:o,formatter:l,name:i||a,color:zM(t),value:gi(r,a),type:c,payload:r,chartType:u,hide:d})};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 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 zf(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){lfe(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 lfe(e,t,r){return t=oct(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function oct(e){var t=lct(e,"string");return sj(t)=="symbol"?t:t+""}function lct(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)}function cct(e,t){return hct(e)||fct(e,t)||dct(e,t)||uct()}function uct(){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 dct(e,t){if(e){if(typeof e=="string")return _G(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 _G(e,t)}}function _G(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 fct(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 hct(e){if(Array.isArray(e))return e}var fk=Math.PI/180,mct=function(t){return t*180/Math.PI},Ds=function(t,r,n,a){return{x:t+Math.cos(-fk*a)*n,y:r+Math.sin(-fk*a)*n}},cfe=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},pct=function(t,r,n,a,i){var o=t.width,l=t.height,c=t.startAngle,u=t.endAngle,d=Ho(t.cx,o,o/2),f=Ho(t.cy,l,l/2),m=cfe(o,l,n),h=Ho(t.innerRadius,m,0),x=Ho(t.outerRadius,m,m*.8),p=Object.keys(r);return p.reduce(function(g,v){var y=r[v],b=y.domain,N=y.reversed,j;if(Jr(y.range))a==="angleAxis"?j=[c,u]:a==="radiusAxis"&&(j=[h,x]),N&&(j=[j[1],j[0]]);else{j=y.range;var _=j,S=cct(_,2);c=S[0],u=S[1]}var P=nfe(y,i),T=P.realScaleType,R=P.scale;R.domain(b).range(j),sfe(R);var k=afe(R,zf(zf({},y),{},{realScaleType:T})),E=zf(zf(zf({},y),k),{},{range:j,radius:x,realScaleType:T,scale:R,cx:d,cy:f,innerRadius:h,outerRadius:x,startAngle:c,endAngle:u});return zf(zf({},g),{},lfe({},v,E))},{})},xct=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))},gct=function(t,r){var n=t.x,a=t.y,i=r.cx,o=r.cy,l=xct({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:mct(u),angleInRadian:u}},vct=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}},yct=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},NG=function(t,r){var n=t.x,a=t.y,i=gct({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=vct(r),f=d.startAngle,m=d.endAngle,h=l,x;if(f<=m){for(;h>m;)h-=360;for(;h<f;)h+=360;x=h>=f&&h<=m}else{for(;h>f;)h-=360;for(;h<m;)h+=360;x=h>=m&&h<=f}return x?zf(zf({},r),{},{radius:o,angle:yct(h,r)}):null},ufe=function(t){return!w.isValidElement(t)&&!qr(t)&&typeof t!="boolean"?t.className:""};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)}var bct=["offset"];function wct(e){return Sct(e)||Nct(e)||_ct(e)||jct()}function jct(){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 _ct(e,t){if(e){if(typeof e=="string")return ID(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 ID(e,t)}}function Nct(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Sct(e){if(Array.isArray(e))return ID(e)}function ID(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 kct(e,t){if(e==null)return{};var r=Cct(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 Cct(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 SG(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 di(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?SG(Object(r),!0).forEach(function(n){Ect(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):SG(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ect(e,t,r){return t=Act(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Act(e){var t=Tct(e,"string");return aj(t)=="symbol"?t:t+""}function Tct(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 ij(){return ij=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},ij.apply(this,arguments)}var Pct=function(t){var r=t.value,n=t.formatter,a=Jr(t.children)?r:t.children;return qr(n)?n(a):a},Oct=function(t,r){var n=Vo(r-t),a=Math.min(Math.abs(r-t),360);return n*a},Dct=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,x=c.endAngle,p=c.clockWise,g=(f+m)/2,v=Oct(h,x),y=v>=0?1:-1,b,N;a==="insideStart"?(b=h+y*o,N=p):a==="insideEnd"?(b=x-y*o,N=!p):a==="end"&&(b=x+y*o,N=p),N=v<=0?N:!N;var j=Ds(u,d,g,b),_=Ds(u,d,g,b+(N?1:-1)*359),S="M".concat(j.x,",").concat(j.y,`
A`).concat(g,",").concat(g,",0,1,").concat(N?0:1,`,
`).concat(_.x,",").concat(_.y),P=Jr(t.id)?D1("recharts-radial-line-"):t.id;return ye.createElement("text",ij({},n,{dominantBaseline:"central",className:tn("recharts-radial-bar-label",l)}),ye.createElement("defs",null,ye.createElement("path",{id:P,d:S})),ye.createElement("textPath",{xlinkHref:"#".concat(P)},r))},Ict=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=Ds(o,l,u+n,m),x=h.x,p=h.y;return{x,y:p,textAnchor:x>=o?"start":"end",verticalAnchor:"middle"}}if(a==="center")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"middle"};if(a==="centerTop")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"start"};if(a==="centerBottom")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"end"};var g=(c+u)/2,v=Ds(o,l,g,m),y=v.x,b=v.y;return{x:y,y:b,textAnchor:"middle",verticalAnchor:"middle"}},Rct=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",x=f>0?"start":"end",p=u>=0?1:-1,g=p*a,v=p>0?"end":"start",y=p>0?"start":"end";if(i==="top"){var b={x:l+u/2,y:c-f*a,textAnchor:"middle",verticalAnchor:h};return di(di({},b),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:x};return di(di({},N),n?{height:Math.max(n.y+n.height-(c+d),0),width:u}:{})}if(i==="left"){var j={x:l-g,y:c+d/2,textAnchor:v,verticalAnchor:"middle"};return di(di({},j),n?{width:Math.max(j.x-n.x,0),height:d}:{})}if(i==="right"){var _={x:l+u+g,y:c+d/2,textAnchor:y,verticalAnchor:"middle"};return di(di({},_),n?{width:Math.max(n.x+n.width-_.x,0),height:d}:{})}var S=n?{width:u,height:d}:{};return i==="insideLeft"?di({x:l+g,y:c+d/2,textAnchor:y,verticalAnchor:"middle"},S):i==="insideRight"?di({x:l+u-g,y:c+d/2,textAnchor:v,verticalAnchor:"middle"},S):i==="insideTop"?di({x:l+u/2,y:c+m,textAnchor:"middle",verticalAnchor:x},S):i==="insideBottom"?di({x:l+u/2,y:c+d-m,textAnchor:"middle",verticalAnchor:h},S):i==="insideTopLeft"?di({x:l+g,y:c+m,textAnchor:y,verticalAnchor:x},S):i==="insideTopRight"?di({x:l+u-g,y:c+m,textAnchor:v,verticalAnchor:x},S):i==="insideBottomLeft"?di({x:l+g,y:c+d-m,textAnchor:y,verticalAnchor:h},S):i==="insideBottomRight"?di({x:l+u-g,y:c+d-m,textAnchor:v,verticalAnchor:h},S):A1(i)&&(Ft(i.x)||Tx(i.x))&&(Ft(i.y)||Tx(i.y))?di({x:l+Ho(i.x,u),y:c+Ho(i.y,d),textAnchor:"end",verticalAnchor:"end"},S):di({x:l+u/2,y:c+d/2,textAnchor:"middle",verticalAnchor:"middle"},S)},Lct=function(t){return"cx"in t&&Ft(t.cx)};function Ti(e){var t=e.offset,r=t===void 0?5:t,n=kct(e,bct),a=di({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||Jr(l)&&Jr(c)&&!w.isValidElement(u)&&!qr(u))return null;if(w.isValidElement(u))return w.cloneElement(u,a);var h;if(qr(u)){if(h=w.createElement(u,a),w.isValidElement(h))return h}else h=Pct(a);var x=Lct(i),p=Er(a,!0);if(x&&(o==="insideStart"||o==="insideEnd"||o==="end"))return Dct(a,h,p);var g=x?Ict(a):Rct(a);return ye.createElement(C0,ij({className:tn("recharts-label",f)},p,g,{breakAll:m}),h)}Ti.displayName="Label";var dfe=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,x=t.left,p=t.width,g=t.height,v=t.clockWise,y=t.labelViewBox;if(y)return y;if(Ft(p)&&Ft(g)){if(Ft(f)&&Ft(m))return{x:f,y:m,width:p,height:g};if(Ft(h)&&Ft(x))return{x:h,y:x,width:p,height:g}}return Ft(f)&&Ft(m)?{x:f,y:m,width:0,height:0}:Ft(r)&&Ft(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:{}},Fct=function(t,r){return t?t===!0?ye.createElement(Ti,{key:"label-implicit",viewBox:r}):bi(t)?ye.createElement(Ti,{key:"label-implicit",viewBox:r,value:t}):w.isValidElement(t)?t.type===Ti?w.cloneElement(t,{key:"label-implicit",viewBox:r}):ye.createElement(Ti,{key:"label-implicit",content:t,viewBox:r}):qr(t)?ye.createElement(Ti,{key:"label-implicit",content:t,viewBox:r}):A1(t)?ye.createElement(Ti,ij({viewBox:r},t,{key:"label-implicit"})):null:null},Mct=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=dfe(t),o=ac(a,Ti).map(function(c,u){return w.cloneElement(c,{viewBox:r||i,key:"label-".concat(u)})});if(!n)return o;var l=Fct(t.label,r||i);return[l].concat(wct(o))};Ti.parseViewBox=dfe;Ti.renderCallByParent=Mct;function $ct(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var Bct=$ct;const zct=Sn(Bct);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)}var qct=["valueAccessor"],Uct=["data","dataKey","clockWise","id","textBreakAll"];function Vct(e){return Kct(e)||Gct(e)||Wct(e)||Hct()}function Hct(){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,t){if(e){if(typeof e=="string")return RD(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 RD(e,t)}}function Gct(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Kct(e){if(Array.isArray(e))return RD(e)}function RD(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 hk(){return hk=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},hk.apply(this,arguments)}function kG(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 CG(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?kG(Object(r),!0).forEach(function(n){Xct(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):kG(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Xct(e,t,r){return t=Yct(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Yct(e){var t=Zct(e,"string");return oj(t)=="symbol"?t:t+""}function Zct(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 EG(e,t){if(e==null)return{};var r=Jct(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 Jct(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 Qct=function(t){return Array.isArray(t.value)?zct(t.value):t.value};function ah(e){var t=e.valueAccessor,r=t===void 0?Qct:t,n=EG(e,qct),a=n.data,i=n.dataKey,o=n.clockWise,l=n.id,c=n.textBreakAll,u=EG(n,Uct);return!a||!a.length?null:ye.createElement(zn,{className:"recharts-label-list"},a.map(function(d,f){var m=Jr(i)?r(d,f):gi(d&&d.payload,i),h=Jr(l)?{}:{id:"".concat(l,"-").concat(f)};return ye.createElement(Ti,hk({},Er(d,!0),u,h,{parentViewBox:d.parentViewBox,value:m,textBreakAll:c,viewBox:Ti.parseViewBox(Jr(o)?d:CG(CG({},d),{},{clockWise:o})),key:"label-".concat(f),index:f}))}))}ah.displayName="LabelList";function eut(e,t){return e?e===!0?ye.createElement(ah,{key:"labelList-implicit",data:t}):ye.isValidElement(e)||qr(e)?ye.createElement(ah,{key:"labelList-implicit",data:t,content:e}):A1(e)?ye.createElement(ah,hk({data:t},e,{key:"labelList-implicit"})):null:null}function tut(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=ac(n,ah).map(function(o,l){return w.cloneElement(o,{data:t,key:"labelList-".concat(l)})});if(!r)return a;var i=eut(e.label,t);return[i].concat(Vct(a))}ah.renderCallByParent=tut;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 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 AG(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 TG(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?AG(Object(r),!0).forEach(function(n){rut(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):AG(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function rut(e,t,r){return t=nut(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function nut(e){var t=sut(e,"string");return lj(t)=="symbol"?t:t+""}function sut(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(t==="string"?String:Number)(e)}var aut=function(t,r){var n=Vo(r-t),a=Math.min(Math.abs(r-t),359.999);return n*a},OS=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)/fk,m=u?i:i+o*f,h=Ds(r,n,d,m),x=Ds(r,n,a,m),p=u?i-o*f:i,g=Ds(r,n,d*Math.cos(f*fk),p);return{center:h,circleTangency:x,lineTangency:g,theta:f}},ffe=function(t){var r=t.cx,n=t.cy,a=t.innerRadius,i=t.outerRadius,o=t.startAngle,l=t.endAngle,c=aut(o,l),u=o+c,d=Ds(r,n,i,o),f=Ds(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=Ds(r,n,a,o),x=Ds(r,n,a,u);m+="L ".concat(x.x,",").concat(x.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},iut=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=Vo(d-u),m=OS({cx:r,cy:n,radius:i,angle:u,sign:f,cornerRadius:o,cornerIsExternal:c}),h=m.circleTangency,x=m.lineTangency,p=m.theta,g=OS({cx:r,cy:n,radius:i,angle:d,sign:-f,cornerRadius:o,cornerIsExternal:c}),v=g.circleTangency,y=g.lineTangency,b=g.theta,N=c?Math.abs(u-d):Math.abs(u-d)-p-b;if(N<0)return l?"M ".concat(x.x,",").concat(x.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
`):ffe({cx:r,cy:n,innerRadius:a,outerRadius:i,startAngle:u,endAngle:d});var j="M ".concat(x.x,",").concat(x.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(y.x,",").concat(y.y,`
`);if(a>0){var _=OS({cx:r,cy:n,radius:a,angle:u,sign:f,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),S=_.circleTangency,P=_.lineTangency,T=_.theta,R=OS({cx:r,cy:n,radius:a,angle:d,sign:-f,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),k=R.circleTangency,E=R.lineTangency,q=R.theta,O=c?Math.abs(u-d):Math.abs(u-d)-T-q;if(O<0&&o===0)return"".concat(j,"L").concat(r,",").concat(n,"Z");j+="L".concat(E.x,",").concat(E.y,`
A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(k.x,",").concat(k.y,`
A`).concat(a,",").concat(a,",0,").concat(+(O>180),",").concat(+(f>0),",").concat(S.x,",").concat(S.y,`
A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(P.x,",").concat(P.y,"Z")}else j+="L".concat(r,",").concat(n,"Z");return j},out={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},hfe=function(t){var r=TG(TG({},out),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=tn("recharts-sector",m),x=o-i,p=Ho(l,x,0,!0),g;return p>0&&Math.abs(d-f)<360?g=iut({cx:n,cy:a,innerRadius:i,outerRadius:o,cornerRadius:Math.min(p,x/2),forceCornerRadius:c,cornerIsExternal:u,startAngle:d,endAngle:f}):g=ffe({cx:n,cy:a,innerRadius:i,outerRadius:o,startAngle:d,endAngle:f}),ye.createElement("path",LD({},Er(r,!0),{className:h,d:g,role:"img"}))};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 FD(){return FD=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},FD.apply(this,arguments)}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){lut(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 lut(e,t,r){return t=cut(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function cut(e){var t=uut(e,"string");return cj(t)=="symbol"?t:t+""}function uut(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)}var DG={curveBasisClosed:iXe,curveBasisOpen:oXe,curveBasis:aXe,curveBumpX:HKe,curveBumpY:WKe,curveLinearClosed:lXe,curveLinear:WE,curveMonotoneX:cXe,curveMonotoneY:uXe,curveNatural:dXe,curveStep:fXe,curveStepAfter:mXe,curveStepBefore:hXe},DS=function(t){return t.x===+t.x&&t.y===+t.y},Wb=function(t){return t.x},Gb=function(t){return t.y},dut=function(t,r){if(qr(t))return t;var n="curve".concat(VE(t));return(n==="curveMonotone"||n==="curveBump")&&r?DG["".concat(n).concat(r==="vertical"?"Y":"X")]:DG[n]||WE},fut=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=dut(n,l),f=u?i.filter(function(p){return DS(p)}):i,m;if(Array.isArray(o)){var h=u?o.filter(function(p){return DS(p)}):o,x=f.map(function(p,g){return OG(OG({},p),{},{base:h[g]})});return l==="vertical"?m=_S().y(Gb).x1(Wb).x0(function(p){return p.base.x}):m=_S().x(Wb).y1(Gb).y0(function(p){return p.base.y}),m.defined(DS).curve(d),m(x)}return l==="vertical"&&Ft(o)?m=_S().y(Gb).x1(Wb).x0(o):Ft(o)?m=_S().x(Wb).y1(Gb).y0(o):m=oue().x(Wb).y(Gb),m.defined(DS).curve(d),m(f)},mk=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?fut(t):a;return w.createElement("path",FD({},Er(t,!1),F4(t),{className:tn("recharts-curve",r),d:o,ref:i}))},hut=Object.getOwnPropertyNames,mut=Object.getOwnPropertySymbols,put=Object.prototype.hasOwnProperty;function IG(e,t){return function(n,a,i){return e(n,a,i)&&t(n,a,i)}}function IS(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 RG(e){return hut(e).concat(mut(e))}var xut=Object.hasOwn||function(e,t){return put.call(e,t)};function tg(e,t){return e===t||!e&&!t&&e!==e&&t!==t}var gut="__v",vut="__o",yut="_owner",LG=Object.getOwnPropertyDescriptor,FG=Object.keys;function but(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 wut(e,t){return tg(e.getTime(),t.getTime())}function jut(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function _ut(e,t){return e===t}function MG(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 Nut=tg;function Sut(e,t,r){var n=FG(e),a=n.length;if(FG(t).length!==a)return!1;for(;a-- >0;)if(!mfe(e,t,r,n[a]))return!1;return!0}function Kb(e,t,r){var n=RG(e),a=n.length;if(RG(t).length!==a)return!1;for(var i,o,l;a-- >0;)if(i=n[a],!mfe(e,t,r,i)||(o=LG(e,i),l=LG(t,i),(o||l)&&(!o||!l||o.configurable!==l.configurable||o.enumerable!==l.enumerable||o.writable!==l.writable)))return!1;return!0}function kut(e,t){return tg(e.valueOf(),t.valueOf())}function Cut(e,t){return e.source===t.source&&e.flags===t.flags}function $G(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 Eut(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 Aut(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 mfe(e,t,r,n){return(n===yut||n===vut||n===gut)&&(e.$$typeof||t.$$typeof)?!0:xut(t,n)&&r.equals(e[n],t[n],n,n,e,t,r)}var Tut="[object Arguments]",Put="[object Boolean]",Out="[object Date]",Dut="[object Error]",Iut="[object Map]",Rut="[object Number]",Lut="[object Object]",Fut="[object RegExp]",Mut="[object Set]",$ut="[object String]",But="[object URL]",zut=Array.isArray,BG=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,zG=Object.assign,qut=Object.prototype.toString.call.bind(Object.prototype.toString);function Uut(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(x,p,g){if(x===p)return!0;if(x==null||p==null)return!1;var v=typeof x;if(v!==typeof p)return!1;if(v!=="object")return v==="number"?o(x,p,g):v==="function"?a(x,p,g):!1;var y=x.constructor;if(y!==p.constructor)return!1;if(y===Object)return l(x,p,g);if(zut(x))return t(x,p,g);if(BG!=null&&BG(x))return f(x,p,g);if(y===Date)return r(x,p,g);if(y===RegExp)return u(x,p,g);if(y===Map)return i(x,p,g);if(y===Set)return d(x,p,g);var b=qut(x);return b===Out?r(x,p,g):b===Fut?u(x,p,g):b===Iut?i(x,p,g):b===Mut?d(x,p,g):b===Lut?typeof x.then!="function"&&typeof p.then!="function"&&l(x,p,g):b===But?m(x,p,g):b===Dut?n(x,p,g):b===Tut?l(x,p,g):b===Put||b===Rut||b===$ut?c(x,p,g):!1}}function Vut(e){var t=e.circular,r=e.createCustomConfig,n=e.strict,a={areArraysEqual:n?Kb:but,areDatesEqual:wut,areErrorsEqual:jut,areFunctionsEqual:_ut,areMapsEqual:n?IG(MG,Kb):MG,areNumbersEqual:Nut,areObjectsEqual:n?Kb:Sut,arePrimitiveWrappersEqual:kut,areRegExpsEqual:Cut,areSetsEqual:n?IG($G,Kb):$G,areTypedArraysEqual:n?Kb:Eut,areUrlsEqual:Aut};if(r&&(a=zG({},a,r(a))),t){var i=IS(a.areArraysEqual),o=IS(a.areMapsEqual),l=IS(a.areObjectsEqual),c=IS(a.areSetsEqual);a=zG({},a,{areArraysEqual:i,areMapsEqual:o,areObjectsEqual:l,areSetsEqual:c})}return a}function Hut(e){return function(t,r,n,a,i,o,l){return e(t,r,l)}}function Wut(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 Gut=$p();$p({strict:!0});$p({circular:!0});$p({circular:!0,strict:!0});$p({createInternalComparator:function(){return tg}});$p({strict:!0,createInternalComparator:function(){return tg}});$p({circular:!0,createInternalComparator:function(){return tg}});$p({circular:!0,createInternalComparator:function(){return tg},strict:!0});function $p(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=Vut(e),c=Uut(l),u=n?n(c):Hut(c);return Wut({circular:r,comparator:c,createState:a,equals:u,strict:o})}function Kut(e){typeof requestAnimationFrame<"u"&&requestAnimationFrame(e)}function qG(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):Kut(a)};requestAnimationFrame(n)}function MD(e){"@babel/helpers - typeof";return MD=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},MD(e)}function Xut(e){return Qut(e)||Jut(e)||Zut(e)||Yut()}function Yut(){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 Zut(e,t){if(e){if(typeof e=="string")return UG(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 UG(e,t)}}function UG(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 Jut(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Qut(e){if(Array.isArray(e))return e}function edt(){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=Xut(o),c=l[0],u=l.slice(1);if(typeof c=="number"){qG(a.bind(null,u),c);return}a(c),qG(a.bind(null,u));return}MD(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 uj(e){"@babel/helpers - typeof";return uj=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},uj(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 HG(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){pfe(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 pfe(e,t,r){return t=tdt(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function tdt(e){var t=rdt(e,"string");return uj(t)==="symbol"?t:String(t)}function rdt(e,t){if(uj(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(uj(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ndt=function(t,r){return[Object.keys(t),Object.keys(r)].reduce(function(n,a){return n.filter(function(i){return a.includes(i)})})},sdt=function(t){return t},adt=function(t){return t.replace(/([A-Z])/g,function(r){return"-".concat(r.toLowerCase())})},qw=function(t,r){return Object.keys(r).reduce(function(n,a){return HG(HG({},n),{},pfe({},a,t(a,r[a])))},{})},WG=function(t,r,n){return t.map(function(a){return"".concat(adt(a)," ").concat(r,"ms ").concat(n)}).join(",")};function idt(e,t){return cdt(e)||ldt(e,t)||xfe(e,t)||odt()}function odt(){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 ldt(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 cdt(e){if(Array.isArray(e))return e}function udt(e){return hdt(e)||fdt(e)||xfe(e)||ddt()}function ddt(){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 xfe(e,t){if(e){if(typeof e=="string")return $D(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 $D(e,t)}}function fdt(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function hdt(e){if(Array.isArray(e))return $D(e)}function $D(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 pk=1e-4,gfe=function(t,r){return[0,3*t,3*r-6*t,3*t-3*r+1]},vfe=function(t,r){return t.map(function(n,a){return n*Math.pow(r,a)}).reduce(function(n,a){return n+a})},GG=function(t,r){return function(n){var a=gfe(t,r);return vfe(a,n)}},mdt=function(t,r){return function(n){var a=gfe(t,r),i=[].concat(udt(a.map(function(o,l){return o*l}).slice(1)),[0]);return vfe(i,n)}},KG=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(g){return parseFloat(g)}),d=idt(u,4);a=d[0],i=d[1],o=d[2],l=d[3]}}}var f=GG(a,o),m=GG(i,l),h=mdt(a,o),x=function(v){return v>1?1:v<0?0:v},p=function(v){for(var y=v>1?1:v,b=y,N=0;N<8;++N){var j=f(b)-y,_=h(b);if(Math.abs(j-y)<pk||_<pk)return m(b);b=x(b-j/_)}return m(b)};return p.isStepper=!1,p},pdt=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,x=m*i,p=m+(h-x)*l/1e3,g=m*l/1e3+d;return Math.abs(g-f)<pk&&Math.abs(p)<pk?[f,0]:[g,p]};return c.isStepper=!0,c.dt=l,c},xdt=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 KG(a);case"spring":return pdt();default:if(a.split("(")[0]==="cubic-bezier")return KG(a)}return typeof a=="function"?a:null};function dj(e){"@babel/helpers - typeof";return dj=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},dj(e)}function XG(e){return ydt(e)||vdt(e)||yfe(e)||gdt()}function gdt(){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 vdt(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function ydt(e){if(Array.isArray(e))return zD(e)}function YG(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 Ki(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?YG(Object(r),!0).forEach(function(n){BD(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):YG(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function BD(e,t,r){return t=bdt(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function bdt(e){var t=wdt(e,"string");return dj(t)==="symbol"?t:String(t)}function wdt(e,t){if(dj(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(dj(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function jdt(e,t){return Sdt(e)||Ndt(e,t)||yfe(e,t)||_dt()}function _dt(){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 yfe(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 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 Ndt(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 Sdt(e){if(Array.isArray(e))return e}var xk=function(t,r,n){return t+(r-t)*n},qD=function(t){var r=t.from,n=t.to;return r!==n},kdt=function e(t,r,n){var a=qw(function(i,o){if(qD(o)){var l=t(o.from,o.to,o.velocity),c=jdt(l,2),u=c[0],d=c[1];return Ki(Ki({},o),{},{from:u,velocity:d})}return o},r);return n<1?qw(function(i,o){return qD(o)?Ki(Ki({},o),{},{velocity:xk(o.velocity,a[i].velocity,n),from:xk(o.from,a[i].from,n)}):o},r):e(t,a,n-1)};const Cdt=function(e,t,r,n,a){var i=ndt(e,t),o=i.reduce(function(g,v){return Ki(Ki({},g),{},BD({},v,[e[v],t[v]]))},{}),l=i.reduce(function(g,v){return Ki(Ki({},g),{},BD({},v,{from:e[v],velocity:0,to:t[v]}))},{}),c=-1,u,d,f=function(){return null},m=function(){return qw(function(v,y){return y.from},l)},h=function(){return!Object.values(l).filter(qD).length},x=function(v){u||(u=v);var y=v-u,b=y/r.dt;l=kdt(r,l,b),a(Ki(Ki(Ki({},e),t),m())),u=v,h()||(c=requestAnimationFrame(f))},p=function(v){d||(d=v);var y=(v-d)/n,b=qw(function(j,_){return xk.apply(void 0,XG(_).concat([r(y)]))},o);if(a(Ki(Ki(Ki({},e),t),b)),y<1)c=requestAnimationFrame(f);else{var N=qw(function(j,_){return xk.apply(void 0,XG(_).concat([r(1)]))},o);a(Ki(Ki(Ki({},e),t),N))}};return f=r.isStepper?x:p,function(){return requestAnimationFrame(f),function(){cancelAnimationFrame(c)}}};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)}var Edt=["children","begin","duration","attributeName","easing","isActive","steps","from","to","canBegin","onAnimationEnd","shouldReAnimate","onAnimationReStart"];function Adt(e,t){if(e==null)return{};var r=Tdt(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 Tdt(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 IP(e){return Idt(e)||Ddt(e)||Odt(e)||Pdt()}function Pdt(){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 Odt(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 Ddt(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Idt(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 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 Nu(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){ow(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 ow(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 Rdt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ldt(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 Fdt(e,t,r){return t&&Ldt(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function bfe(e){var t=Mdt(e,"string");return Oy(t)==="symbol"?t:String(t)}function Mdt(e,t){if(Oy(e)!=="object"||e===null)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(t==="string"?String:Number)(e)}function $dt(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&&VD(e,t)}function VD(e,t){return VD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},VD(e,t)}function Bdt(e){var t=zdt();return function(){var n=gk(e),a;if(t){var i=gk(this).constructor;a=Reflect.construct(n,arguments,i)}else a=n.apply(this,arguments);return HD(this,a)}}function HD(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 WD(e)}function WD(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function zdt(){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 gk(e){return gk=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},gk(e)}var sf=function(e){$dt(r,e);var t=Bdt(r);function r(n,a){var i;Rdt(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(WD(i)),i.changeStyle=i.changeStyle.bind(WD(i)),!l||h<=0)return i.state={style:{}},typeof m=="function"&&(i.state={style:d}),HD(i);if(f&&f.length)i.state={style:f[0].style};else if(u){if(typeof m=="function")return i.state={style:u},HD(i);i.state={style:c?ow({},c,u):u}}else i.state={style:{}};return i}return Fdt(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?ow({},c,d):d};this.state&&m&&(c&&m[c]!==d||!c&&m!==d)&&this.setState(h);return}if(!(Gut(a.to,d)&&a.canBegin&&a.isActive)){var x=!a.canBegin||!a.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var p=x||u?f:a.to;if(this.state&&m){var g={style:c?ow({},c,p):p};(c&&m[c]!==p||!c&&m!==p)&&this.setState(g)}this.runAnimation(Nu(Nu({},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=Cdt(o,l,xdt(u),c,this.changeStyle),x=function(){i.stopJSAnimation=h()};this.manager.start([m,d,x,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,g,v){if(v===0)return p;var y=g.duration,b=g.easing,N=b===void 0?"ease":b,j=g.style,_=g.properties,S=g.onAnimationEnd,P=v>0?o[v-1]:g,T=_||Object.keys(j);if(typeof N=="function"||N==="spring")return[].concat(IP(p),[i.runJSAnimation.bind(i,{from:P.style,to:j,duration:y,easing:N}),y]);var R=WG(T,y,N),k=Nu(Nu(Nu({},P.style),j),{},{transition:R});return[].concat(IP(p),[k,y,S]).filter(sdt)};return this.manager.start([c].concat(IP(o.reduce(h,[d,Math.max(m,l)])),[a.onAnimationEnd]))}},{key:"runAnimation",value:function(a){this.manager||(this.manager=edt());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,x=this.manager;if(this.unSubscribe=x.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?ow({},l,c):c,g=WG(Object.keys(p),o,u);x.start([d,i,Nu(Nu({},p),{},{transition:g}),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=Adt(a,Edt),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 x=h.props,p=x.style,g=p===void 0?{}:p,v=x.className,y=w.cloneElement(h,Nu(Nu({},c),{},{style:Nu(Nu({},g),d),className:v}));return y};return u===1?f(w.Children.only(i)):ye.createElement("div",null,w.Children.map(i,function(m){return f(m)}))}}]),r}(w.PureComponent);sf.displayName="Animate";sf.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};sf.propTypes={from:_r.oneOfType([_r.object,_r.string]),to:_r.oneOfType([_r.object,_r.string]),attributeName:_r.string,duration:_r.number,begin:_r.number,easing:_r.oneOfType([_r.string,_r.func]),steps:_r.arrayOf(_r.shape({duration:_r.number.isRequired,style:_r.object.isRequired,easing:_r.oneOfType([_r.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),_r.func]),properties:_r.arrayOf("string"),onAnimationEnd:_r.func})),children:_r.oneOfType([_r.node,_r.func]),isActive:_r.bool,canBegin:_r.bool,onAnimationEnd:_r.func,shouldReAnimate:_r.bool,onAnimationStart:_r.func,onAnimationReStart:_r.func};function fj(e){"@babel/helpers - typeof";return fj=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},fj(e)}function vk(){return vk=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},vk.apply(this,arguments)}function qdt(e,t){return Wdt(e)||Hdt(e,t)||Vdt(e,t)||Udt()}function Udt(){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 Vdt(e,t){if(e){if(typeof e=="string")return JG(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 JG(e,t)}}function JG(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 Hdt(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 Wdt(e){if(Array.isArray(e))return e}function QG(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 eK(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?QG(Object(r),!0).forEach(function(n){Gdt(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):QG(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Gdt(e,t,r){return t=Kdt(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Kdt(e){var t=Xdt(e,"string");return fj(t)=="symbol"?t:t+""}function Xdt(e,t){if(fj(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(fj(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var tK=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 x=Math.min(o,i);d="M ".concat(t,",").concat(r+l*x,`
A `).concat(x,",").concat(x,",0,0,").concat(u,",").concat(t+c*x,",").concat(r,`
L `).concat(t+n-c*x,",").concat(r,`
A `).concat(x,",").concat(x,",0,0,").concat(u,",").concat(t+n,",").concat(r+l*x,`
L `).concat(t+n,",").concat(r+a-l*x,`
A `).concat(x,",").concat(x,",0,0,").concat(u,",").concat(t+n-c*x,",").concat(r+a,`
L `).concat(t+c*x,",").concat(r+a,`
A `).concat(x,",").concat(x,",0,0,").concat(u,",").concat(t,",").concat(r+a-l*x," Z")}else d="M ".concat(t,",").concat(r," h ").concat(n," v ").concat(a," h ").concat(-n," Z");return d},Ydt=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},Zdt={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},qM=function(t){var r=eK(eK({},Zdt),t),n=w.useRef(),a=w.useState(-1),i=qdt(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,x=r.animationEasing,p=r.animationDuration,g=r.animationBegin,v=r.isAnimationActive,y=r.isUpdateAnimationActive;if(c!==+c||u!==+u||d!==+d||f!==+f||d===0||f===0)return null;var b=tn("recharts-rectangle",h);return y?ye.createElement(sf,{canBegin:o>0,from:{width:d,height:f,x:c,y:u},to:{width:d,height:f,x:c,y:u},duration:p,animationEasing:x,isActive:y},function(N){var j=N.width,_=N.height,S=N.x,P=N.y;return ye.createElement(sf,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:g,duration:p,isActive:v,easing:x},ye.createElement("path",vk({},Er(r,!0),{className:b,d:tK(S,P,j,_,m),ref:n})))}):ye.createElement("path",vk({},Er(r,!0),{className:b,d:tK(c,u,d,f,m)}))},Jdt=["points","className","baseLinePoints","connectNulls"];function mv(){return mv=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},mv.apply(this,arguments)}function Qdt(e,t){if(e==null)return{};var r=eft(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 eft(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 rK(e){return sft(e)||nft(e)||rft(e)||tft()}function tft(){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 rft(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 nft(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function sft(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 nK=function(t){return t&&t.x===+t.x&&t.y===+t.y},aft=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],r=[[]];return t.forEach(function(n){nK(n)?r[r.length-1].push(n):r[r.length-1].length>0&&r.push([])}),nK(t[0])&&r[r.length-1].push(t[0]),r[r.length-1].length<=0&&(r=r.slice(0,-1)),r},Uw=function(t,r){var n=aft(t);r&&(n=[n.reduce(function(i,o){return[].concat(rK(i),rK(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},ift=function(t,r,n){var a=Uw(t,n);return"".concat(a.slice(-1)==="Z"?a.slice(0,-1):a,"L").concat(Uw(r.reverse(),n).slice(1))},oft=function(t){var r=t.points,n=t.className,a=t.baseLinePoints,i=t.connectNulls,o=Qdt(t,Jdt);if(!r||!r.length)return null;var l=tn("recharts-polygon",n);if(a&&a.length){var c=o.stroke&&o.stroke!=="none",u=ift(r,a,i);return ye.createElement("g",{className:l},ye.createElement("path",mv({},Er(o,!0),{fill:u.slice(-1)==="Z"?o.fill:"none",stroke:"none",d:u})),c?ye.createElement("path",mv({},Er(o,!0),{fill:"none",d:Uw(r,i)})):null,c?ye.createElement("path",mv({},Er(o,!0),{fill:"none",d:Uw(a,i)})):null)}var d=Uw(r,i);return ye.createElement("path",mv({},Er(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 lA=function(t){var r=t.cx,n=t.cy,a=t.r,i=t.className,o=tn("recharts-dot",i);return r===+r&&n===+n&&a===+a?w.createElement("circle",KD({},Er(t,!1),F4(t),{className:o,cx:r,cy:n,r:a})):null};function hj(e){"@babel/helpers - typeof";return hj=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},hj(e)}var lft=["x","y","top","left","width","height","className"];function XD(){return XD=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},XD.apply(this,arguments)}function sK(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 cft(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?sK(Object(r),!0).forEach(function(n){uft(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):sK(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function uft(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=fft(e,"string");return hj(t)=="symbol"?t:t+""}function fft(e,t){if(hj(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(hj(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function hft(e,t){if(e==null)return{};var r=mft(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 mft(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 pft=function(t,r,n,a,i,o){return"M".concat(t,",").concat(i,"v").concat(a,"M").concat(o,",").concat(r,"h").concat(n)},xft=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,x=t.className,p=hft(t,lft),g=cft({x:n,y:i,top:l,left:u,width:f,height:h},p);return!Ft(n)||!Ft(i)||!Ft(f)||!Ft(h)||!Ft(l)||!Ft(u)?null:ye.createElement("path",XD({},Er(g,!0),{className:tn("recharts-cross",x),d:pft(n,i,f,h,l,u)}))},gft=nA,vft=Rde,yft=hf;function bft(e,t){return e&&e.length?gft(e,yft(t),vft):void 0}var wft=bft;const jft=Sn(wft);var _ft=nA,Nft=hf,Sft=Lde;function kft(e,t){return e&&e.length?_ft(e,Nft(t),Sft):void 0}var Cft=kft;const Eft=Sn(Cft);var Aft=["cx","cy","angle","ticks","axisLine"],Tft=["ticks","tick","angle","tickFormatter","stroke"];function Dy(e){"@babel/helpers - typeof";return Dy=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},Dy(e)}function Vw(){return Vw=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},Vw.apply(this,arguments)}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 ox(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){cA(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 iK(e,t){if(e==null)return{};var r=Pft(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 Pft(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 Oft(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,jfe(n.key),n)}}function Dft(e,t,r){return t&&oK(e.prototype,t),r&&oK(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ift(e,t,r){return t=yk(t),Rft(e,wfe()?Reflect.construct(t,r||[],yk(e).constructor):t.apply(e,r))}function Rft(e,t){if(t&&(Dy(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Lft(e)}function Lft(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function wfe(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(wfe=function(){return!!e})()}function yk(e){return yk=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},yk(e)}function Fft(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 cA(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=Mft(e,"string");return Dy(t)=="symbol"?t:t+""}function Mft(e,t){if(Dy(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Dy(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var uA=function(e){function t(){return Oft(this,t),Ift(this,t,arguments)}return Fft(t,e),Dft(t,[{key:"getTickValueCoord",value:function(n){var a=n.coordinate,i=this.props,o=i.angle,l=i.cx,c=i.cy;return Ds(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=jft(l,function(d){return d.coordinate||0}),u=Eft(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=iK(n,Aft),d=l.reduce(function(x,p){return[Math.min(x[0],p.coordinate),Math.max(x[1],p.coordinate)]},[1/0,-1/0]),f=Ds(a,i,d[0],o),m=Ds(a,i,d[1],o),h=ox(ox(ox({},Er(u,!1)),{},{fill:"none"},Er(c,!1)),{},{x1:f.x,y1:f.y,x2:m.x,y2:m.y});return ye.createElement("line",Vw({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=iK(a,Tft),f=this.getTickTextAnchor(),m=Er(d,!1),h=Er(o,!1),x=i.map(function(p,g){var v=n.getTickValueCoord(p),y=ox(ox(ox(ox({textAnchor:f,transform:"rotate(".concat(90-l,", ").concat(v.x,", ").concat(v.y,")")},m),{},{stroke:"none",fill:u},h),{},{index:g},v),{},{payload:p});return ye.createElement(zn,Vw({className:tn("recharts-polar-radius-axis-tick",ufe(o)),key:"tick-".concat(p.coordinate)},k0(n.props,p,g)),t.renderTickItem(o,y,c?c(p.value,g):p.value))});return ye.createElement(zn,{className:"recharts-polar-radius-axis-ticks"},x)}},{key:"render",value:function(){var n=this.props,a=n.ticks,i=n.axisLine,o=n.tick;return!a||!a.length?null:ye.createElement(zn,{className:tn("recharts-polar-radius-axis",this.props.className)},i&&this.renderAxisLine(),o&&this.renderTicks(),Ti.renderCallByParent(this.props,this.getViewBox()))}}],[{key:"renderTickItem",value:function(n,a,i){var o;return ye.isValidElement(n)?o=ye.cloneElement(n,a):qr(n)?o=n(a):o=ye.createElement(C0,Vw({},a,{className:"recharts-polar-radius-axis-tick-value"}),i),o}}])}(w.PureComponent);cA(uA,"displayName","PolarRadiusAxis");cA(uA,"axisType","radiusAxis");cA(uA,"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 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 jx(){return jx=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},jx.apply(this,arguments)}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 lx(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){dA(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 $ft(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function cK(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,Nfe(n.key),n)}}function Bft(e,t,r){return t&&cK(e.prototype,t),r&&cK(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function zft(e,t,r){return t=bk(t),qft(e,_fe()?Reflect.construct(t,r||[],bk(e).constructor):t.apply(e,r))}function qft(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 Uft(e)}function Uft(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _fe(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(_fe=function(){return!!e})()}function bk(e){return bk=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},bk(e)}function Vft(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&&ZD(e,t)}function ZD(e,t){return ZD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},ZD(e,t)}function dA(e,t,r){return t=Nfe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Nfe(e){var t=Hft(e,"string");return Iy(t)=="symbol"?t:t+""}function Hft(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(t==="string"?String:Number)(e)}var Wft=Math.PI/180,uK=1e-5,fA=function(e){function t(){return $ft(this,t),zft(this,t,arguments)}return Vft(t,e),Bft(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=Ds(i,o,l,n.coordinate),m=Ds(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*Wft),o;return i>uK?o=a==="outer"?"start":"end":i<-uK?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=lx(lx({},Er(this.props,!1)),{},{fill:"none"},Er(l,!1));if(c==="circle")return ye.createElement(lA,jx({className:"recharts-polar-angle-axis-line"},u,{cx:a,cy:i,r:o}));var d=this.props.ticks,f=d.map(function(m){return Ds(a,i,o,m.coordinate)});return ye.createElement(oft,jx({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=Er(this.props,!1),f=Er(o,!1),m=lx(lx({},d),{},{fill:"none"},Er(l,!1)),h=i.map(function(x,p){var g=n.getTickLineCoord(x),v=n.getTickTextAnchor(x),y=lx(lx(lx({textAnchor:v},d),{},{stroke:"none",fill:u},f),{},{index:p,payload:x,x:g.x2,y:g.y2});return ye.createElement(zn,jx({className:tn("recharts-polar-angle-axis-tick",ufe(o)),key:"tick-".concat(x.coordinate)},k0(n.props,x,p)),l&&ye.createElement("line",jx({className:"recharts-polar-angle-axis-tick-line"},m,g)),o&&t.renderTickItem(o,y,c?c(x.value,p):x.value))});return ye.createElement(zn,{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:ye.createElement(zn,{className:tn("recharts-polar-angle-axis",this.props.className)},o&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(n,a,i){var o;return ye.isValidElement(n)?o=ye.cloneElement(n,a):qr(n)?o=n(a):o=ye.createElement(C0,jx({},a,{className:"recharts-polar-angle-axis-tick-value"}),i),o}}])}(w.PureComponent);dA(fA,"displayName","PolarAngleAxis");dA(fA,"axisType","angleAxis");dA(fA,"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 Gft=Pue,Kft=Gft(Object.getPrototypeOf,Object),Xft=Kft,Yft=Eh,Zft=Xft,Jft=Ah,Qft="[object Object]",eht=Function.prototype,tht=Object.prototype,Sfe=eht.toString,rht=tht.hasOwnProperty,nht=Sfe.call(Object);function sht(e){if(!Jft(e)||Yft(e)!=Qft)return!1;var t=Zft(e);if(t===null)return!0;var r=rht.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&Sfe.call(r)==nht}var aht=sht;const iht=Sn(aht);var oht=Eh,lht=Ah,cht="[object Boolean]";function uht(e){return e===!0||e===!1||lht(e)&&oht(e)==cht}var dht=uht;const fht=Sn(dht);function mj(e){"@babel/helpers - typeof";return mj=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},mj(e)}function wk(){return wk=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},wk.apply(this,arguments)}function hht(e,t){return ght(e)||xht(e,t)||pht(e,t)||mht()}function mht(){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 pht(e,t){if(e){if(typeof e=="string")return dK(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 dK(e,t)}}function dK(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 xht(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 ght(e){if(Array.isArray(e))return e}function fK(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 hK(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?fK(Object(r),!0).forEach(function(n){vht(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fK(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function vht(e,t,r){return t=yht(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function yht(e){var t=bht(e,"string");return mj(t)=="symbol"?t:t+""}function bht(e,t){if(mj(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(mj(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var mK=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},wht={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},jht=function(t){var r=hK(hK({},wht),t),n=w.useRef(),a=w.useState(-1),i=hht(a,2),o=i[0],l=i[1];w.useEffect(function(){if(n.current&&n.current.getTotalLength)try{var b=n.current.getTotalLength();b&&l(b)}catch{}},[]);var c=r.x,u=r.y,d=r.upperWidth,f=r.lowerWidth,m=r.height,h=r.className,x=r.animationEasing,p=r.animationDuration,g=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 y=tn("recharts-trapezoid",h);return v?ye.createElement(sf,{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:x,isActive:v},function(b){var N=b.upperWidth,j=b.lowerWidth,_=b.height,S=b.x,P=b.y;return ye.createElement(sf,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:g,duration:p,easing:x},ye.createElement("path",wk({},Er(r,!0),{className:y,d:mK(S,P,N,j,_),ref:n})))}):ye.createElement("g",null,ye.createElement("path",wk({},Er(r,!0),{className:y,d:mK(c,u,d,f,m)})))},_ht=["option","shapeType","propTransformer","activeClassName","isActive"];function pj(e){"@babel/helpers - typeof";return pj=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},pj(e)}function Nht(e,t){if(e==null)return{};var r=Sht(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 Sht(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 pK(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 jk(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?pK(Object(r),!0).forEach(function(n){kht(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):pK(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function kht(e,t,r){return t=Cht(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Cht(e){var t=Eht(e,"string");return pj(t)=="symbol"?t:t+""}function Eht(e,t){if(pj(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(pj(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Aht(e,t){return jk(jk({},t),e)}function Tht(e,t){return e==="symbols"}function xK(e){var t=e.shapeType,r=e.elementProps;switch(t){case"rectangle":return ye.createElement(qM,r);case"trapezoid":return ye.createElement(jht,r);case"sector":return ye.createElement(hfe,r);case"symbols":if(Tht(t))return ye.createElement(oM,r);break;default:return null}}function Pht(e){return w.isValidElement(e)?e.props:e}function kfe(e){var t=e.option,r=e.shapeType,n=e.propTransformer,a=n===void 0?Aht:n,i=e.activeClassName,o=i===void 0?"recharts-active-shape":i,l=e.isActive,c=Nht(e,_ht),u;if(w.isValidElement(t))u=w.cloneElement(t,jk(jk({},c),Pht(t)));else if(qr(t))u=t(c);else if(iht(t)&&!fht(t)){var d=a(t,c);u=ye.createElement(xK,{shapeType:r,elementProps:d})}else{var f=c;u=ye.createElement(xK,{shapeType:r,elementProps:f})}return l?ye.createElement(zn,{className:o},u):u}function hA(e,t){return t!=null&&"trapezoids"in e.props}function mA(e,t){return t!=null&&"sectors"in e.props}function xj(e,t){return t!=null&&"points"in e.props}function Oht(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 Dht(e,t){var r=e.endAngle===t.endAngle,n=e.startAngle===t.startAngle;return r&&n}function Iht(e,t){var r=e.x===t.x,n=e.y===t.y,a=e.z===t.z;return r&&n&&a}function Rht(e,t){var r;return hA(e,t)?r=Oht:mA(e,t)?r=Dht:xj(e,t)&&(r=Iht),r}function Lht(e,t){var r;return hA(e,t)?r="trapezoids":mA(e,t)?r="sectors":xj(e,t)&&(r="points"),r}function Fht(e,t){if(hA(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(mA(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 xj(e,t)?t.payload:{}}function Mht(e){var t=e.activeTooltipItem,r=e.graphicalItem,n=e.itemData,a=Lht(r,t),i=Fht(r,t),o=n.filter(function(c,u){var d=A_(i,c),f=r.props[a].filter(function(x){var p=Rht(r,t);return p(x,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 E5;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 pv(){return pv=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},pv.apply(this,arguments)}function gK(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 Cs(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?gK(Object(r),!0).forEach(function(n){Bc(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):gK(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function $ht(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function vK(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,Efe(n.key),n)}}function Bht(e,t,r){return t&&vK(e.prototype,t),r&&vK(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function zht(e,t,r){return t=_k(t),qht(e,Cfe()?Reflect.construct(t,r||[],_k(e).constructor):t.apply(e,r))}function qht(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 Uht(e)}function Uht(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Cfe(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Cfe=function(){return!!e})()}function _k(e){return _k=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},_k(e)}function Vht(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 Bc(e,t,r){return t=Efe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Efe(e){var t=Hht(e,"string");return Ry(t)=="symbol"?t:t+""}function Hht(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)}var mf=function(e){function t(r){var n;return $ht(this,t),n=zht(this,t,[r]),Bc(n,"pieRef",null),Bc(n,"sectorRefs",[]),Bc(n,"id",D1("recharts-pie-")),Bc(n,"handleAnimationEnd",function(){var a=n.props.onAnimationEnd;n.setState({isAnimationFinished:!0}),qr(a)&&a()}),Bc(n,"handleAnimationStart",function(){var a=n.props.onAnimationStart;n.setState({isAnimationFinished:!1}),qr(a)&&a()}),n.state={isAnimationFinished:!r.isAnimationActive,prevIsAnimationActive:r.isAnimationActive,prevAnimationId:r.animationId,sectorToFocus:0},n}return Vht(t,e),Bht(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=Er(this.props,!1),f=Er(o,!1),m=Er(l,!1),h=o&&o.offsetRadius||20,x=n.map(function(p,g){var v=(p.startAngle+p.endAngle)/2,y=Ds(p.cx,p.cy,p.outerRadius+h,v),b=Cs(Cs(Cs(Cs({},d),p),{},{stroke:"none"},f),{},{index:g,textAnchor:t.getTextAnchor(y.x,p.cx)},y),N=Cs(Cs(Cs(Cs({},d),p),{},{fill:"none",stroke:p.fill},m),{},{index:g,points:[Ds(p.cx,p.cy,p.outerRadius,v),y]}),j=c;return Jr(c)&&Jr(u)?j="value":Jr(c)&&(j=u),ye.createElement(zn,{key:"label-".concat(p.startAngle,"-").concat(p.endAngle,"-").concat(p.midAngle,"-").concat(g)},l&&t.renderLabelLineItem(l,N,"line"),t.renderLabelItem(o,b,gi(p,j)))});return ye.createElement(zn,{className:"recharts-pie-labels"},x)}},{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,x=Cs(Cs({},u),{},{stroke:l?u.fill:u.stroke,tabIndex:-1});return ye.createElement(zn,pv({ref:function(g){g&&!a.sectorRefs.includes(g)&&a.sectorRefs.push(g)},tabIndex:-1,className:"recharts-pie-sector"},k0(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)}),ye.createElement(kfe,pv({option:h,isActive:f,shapeType:"sector"},x)))})}},{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 ye.createElement(sf,{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(x){var p=x.t,g=[],v=i&&i[0],y=v.startAngle;return i.forEach(function(b,N){var j=m&&m[N],_=N>0?sc(b,"paddingAngle",0):0;if(j){var S=Hl(j.endAngle-j.startAngle,b.endAngle-b.startAngle),P=Cs(Cs({},b),{},{startAngle:y+_,endAngle:y+S(p)+_});g.push(P),y=P.endAngle}else{var T=b.endAngle,R=b.startAngle,k=Hl(0,T-R),E=k(p),q=Cs(Cs({},b),{},{startAngle:y+_,endAngle:y+E+_});g.push(q),y=q.endAngle}}),ye.createElement(zn,null,n.renderSectorsStatically(g))})}},{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||!A_(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,x=this.state.isAnimationFinished;if(i||!o||!o.length||!Ft(u)||!Ft(d)||!Ft(f)||!Ft(m))return null;var p=tn("recharts-pie",l);return ye.createElement(zn,{tabIndex:this.props.rootTabIndex,className:p,ref:function(v){n.pieRef=v}},this.renderSectors(),c&&this.renderLabels(o),Ti.renderCallByParent(this.props,null,!1),(!h||x)&&ah.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(ye.isValidElement(n))return ye.cloneElement(n,a);if(qr(n))return n(a);var o=tn("recharts-pie-label-line",typeof n!="boolean"?n.className:"");return ye.createElement(mk,pv({},a,{key:i,type:"linear",className:o}))}},{key:"renderLabelItem",value:function(n,a,i){if(ye.isValidElement(n))return ye.cloneElement(n,a);var o=i;if(qr(n)&&(o=n(a),ye.isValidElement(o)))return o;var l=tn("recharts-pie-label-text",typeof n!="boolean"&&!qr(n)?n.className:"");return ye.createElement(C0,pv({},a,{alignmentBaseline:"middle",className:l}),o)}}])}(w.PureComponent);E5=mf;Bc(mf,"displayName","Pie");Bc(mf,"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:!J0.isSsr,animationBegin:400,animationDuration:1500,animationEasing:"ease",nameKey:"name",blendStroke:!1,rootTabIndex:0});Bc(mf,"parseDeltaAngle",function(e,t){var r=Vo(t-e),n=Math.min(Math.abs(t-e),360);return r*n});Bc(mf,"getRealPieData",function(e){var t=e.data,r=e.children,n=Er(e,!1),a=ac(r,N_);return t&&t.length?t.map(function(i,o){return Cs(Cs(Cs({payload:i},n),i),a&&a[o]&&a[o].props)}):a&&a.length?a.map(function(i){return Cs(Cs({},n),i.props)}):[]});Bc(mf,"parseCoordinateOfPie",function(e,t){var r=t.top,n=t.left,a=t.width,i=t.height,o=cfe(a,i),l=n+Ho(e.cx,a,a/2),c=r+Ho(e.cy,i,i/2),u=Ho(e.innerRadius,o,0),d=Ho(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}});Bc(mf,"getComposedData",function(e){var t=e.item,r=e.offset,n=t.type.defaultProps!==void 0?Cs(Cs({},t.type.defaultProps),t.props):t.props,a=E5.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),x=E5.parseCoordinateOfPie(n,r),p=E5.parseDeltaAngle(o,l),g=Math.abs(p),v=u;Jr(u)&&Jr(f)?(Xu(!1,`Use "dataKey" to specify the value of pie,
the props "valueKey" will be deprecated in 1.1.0`),v="value"):Jr(u)&&(Xu(!1,`Use "dataKey" to specify the value of pie,
the props "valueKey" will be deprecated in 1.1.0`),v=f);var y=a.filter(function(P){return gi(P,v,0)!==0}).length,b=(g>=360?y:y-1)*c,N=g-y*h-b,j=a.reduce(function(P,T){var R=gi(T,v,0);return P+(Ft(R)?R:0)},0),_;if(j>0){var S;_=a.map(function(P,T){var R=gi(P,v,0),k=gi(P,d,T),E=(Ft(R)?R:0)/j,q;T?q=S.endAngle+Vo(p)*c*(R!==0?1:0):q=o;var O=q+Vo(p)*((R!==0?h:0)+E*N),L=(q+O)/2,H=(x.innerRadius+x.outerRadius)/2,V=[{name:k,value:R,payload:P,dataKey:v,type:m}],z=Ds(x.cx,x.cy,H,L);return S=Cs(Cs(Cs({percent:E,cornerRadius:i,name:k,tooltipPayload:V,midAngle:L,middleRadius:H,tooltipPosition:z},P),x),{},{value:gi(P,v),startAngle:q,endAngle:O,payload:P,paddingAngle:Vo(p)*c}),S})}return Cs(Cs({},x),{},{sectors:_,data:a})});var Wht=Math.ceil,Ght=Math.max;function Kht(e,t,r,n){for(var a=-1,i=Ght(Wht((t-e)/(r||1)),0),o=Array(i);i--;)o[n?i:++a]=e,e+=r;return o}var Xht=Kht,Yht=Yue,yK=1/0,Zht=17976931348623157e292;function Jht(e){if(!e)return e===0?e:0;if(e=Yht(e),e===yK||e===-yK){var t=e<0?-1:1;return t*Zht}return e===e?e:0}var Afe=Jht,Qht=Xht,emt=YE,RP=Afe;function tmt(e){return function(t,r,n){return n&&typeof n!="number"&&emt(t,r,n)&&(r=n=void 0),t=RP(t),r===void 0?(r=t,t=0):r=RP(r),n=n===void 0?t<r?1:-1:RP(n),Qht(t,r,n,e)}}var rmt=tmt,nmt=rmt,smt=nmt(),amt=smt;const Nk=Sn(amt);function gj(e){"@babel/helpers - typeof";return gj=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},gj(e)}function bK(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 wK(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?bK(Object(r),!0).forEach(function(n){Tfe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):bK(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Tfe(e,t,r){return t=imt(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function imt(e){var t=omt(e,"string");return gj(t)=="symbol"?t:t+""}function omt(e,t){if(gj(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(gj(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var lmt=["Webkit","Moz","O","ms"],cmt=function(t,r){var n=t.replace(/(\w)/,function(i){return i.toUpperCase()}),a=lmt.reduce(function(i,o){return wK(wK({},i),{},Tfe({},o+n,r))},{});return a[t]=r,a};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 Sk(){return Sk=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},Sk.apply(this,arguments)}function jK(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 LP(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?jK(Object(r),!0).forEach(function(n){Bl(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):jK(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 _K(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,Ofe(n.key),n)}}function dmt(e,t,r){return t&&_K(e.prototype,t),r&&_K(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function fmt(e,t,r){return t=kk(t),hmt(e,Pfe()?Reflect.construct(t,r||[],kk(e).constructor):t.apply(e,r))}function hmt(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 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 Pfe(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Pfe=function(){return!!e})()}function kk(e){return kk=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},kk(e)}function pmt(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 Bl(e,t,r){return t=Ofe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ofe(e){var t=xmt(e,"string");return Ly(t)=="symbol"?t:t+""}function xmt(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 String(e)}var gmt=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=Bw().domain(Nk(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}},NK=function(t){return t.changedTouches&&!!t.changedTouches.length},Fy=function(e){function t(r){var n;return umt(this,t),n=fmt(this,t,[r]),Bl(n,"handleDrag",function(a){n.leaveTimer&&(clearTimeout(n.leaveTimer),n.leaveTimer=null),n.state.isTravellerMoving?n.handleTravellerMove(a):n.state.isSlideMoving&&n.handleSlideDrag(a)}),Bl(n,"handleTouchMove",function(a){a.changedTouches!=null&&a.changedTouches.length>0&&n.handleDrag(a.changedTouches[0])}),Bl(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()}),Bl(n,"handleLeaveWrapper",function(){(n.state.isTravellerMoving||n.state.isSlideMoving)&&(n.leaveTimer=window.setTimeout(n.handleDragEnd,n.props.leaveTimeOut))}),Bl(n,"handleEnterSlideOrTraveller",function(){n.setState({isTextActive:!0})}),Bl(n,"handleLeaveSlideOrTraveller",function(){n.setState({isTextActive:!1})}),Bl(n,"handleSlideDragStart",function(a){var i=NK(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 pmt(t,e),dmt(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),x=t.getIndexInRange(o,m);return{startIndex:h-h%c,endIndex:x===d?d:x-x%c}}},{key:"getTextOfTick",value:function(n){var a=this.props,i=a.data,o=a.tickFormatter,l=a.dataKey,c=gi(i[n],l,n);return qr(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,x=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 g=this.getIndex({startX:o+p,endX:l+p});(g.startIndex!==m||g.endIndex!==h)&&x&&x(g),this.setState({startX:o+p,endX:l+p,slideMoveStartX:n.pageX})}},{key:"handleTravellerDragStart",value:function(n,a){var i=NK(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,x=d.onChange,p=d.gap,g=d.data,v={startX:this.state.startX,endX:this.state.endX},y=n.pageX-i;y>0?y=Math.min(y,f+m-h-u):y<0&&(y=Math.max(y,f-u)),v[o]=u+y;var b=this.getIndex(v),N=b.startIndex,j=b.endIndex,_=function(){var P=g.length-1;return o==="startX"&&(l>c?N%p===0:j%p===0)||l<c&&j===P||o==="endX"&&(l>c?j%p===0:N%p===0)||l>c&&j===P};this.setState(Bl(Bl({},o,u+y),"brushMoveStartX",n.pageX),function(){x&&_()&&x(b)})}},{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(Bl({},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 ye.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?ye.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,x=c.data,p=c.startIndex,g=c.endIndex,v=Math.max(n,this.props.x),y=LP(LP({},Er(this.props,!1)),{},{x:v,y:u,width:d,height:f}),b=h||"Min value: ".concat((i=x[p])===null||i===void 0?void 0:i.name,", Max value: ").concat((o=x[g])===null||o===void 0?void 0:o.name);return ye.createElement(zn,{tabIndex:0,role:"slider","aria-label":b,"aria-valuenow":n,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[a],onTouchStart:this.travellerDragStartHandlers[a],onKeyDown:function(j){["ArrowLeft","ArrowRight"].includes(j.key)&&(j.preventDefault(),j.stopPropagation(),l.handleTravellerMoveKeyboard(j.key==="ArrowRight"?1:-1,a))},onFocus:function(){l.setState({isTravellerFocused:!0})},onBlur:function(){l.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},t.renderTraveller(m,y))}},{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 ye.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,x={pointerEvents:"none",fill:u};return ye.createElement(zn,{className:"recharts-brush-texts"},ye.createElement(C0,Sk({textAnchor:"end",verticalAnchor:"middle",x:Math.min(f,m)-h,y:o+l/2},x),this.getTextOfTick(a)),ye.createElement(C0,Sk({textAnchor:"start",verticalAnchor:"middle",x:Math.max(f,m)+c+h,y:o+l/2},x),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,x=m.endX,p=m.isTextActive,g=m.isSlideMoving,v=m.isTravellerMoving,y=m.isTravellerFocused;if(!a||!a.length||!Ft(l)||!Ft(c)||!Ft(u)||!Ft(d)||u<=0||d<=0)return null;var b=tn("recharts-brush",i),N=ye.Children.count(o)===1,j=cmt("userSelect","none");return ye.createElement(zn,{className:b,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:j},this.renderBackground(),N&&this.renderPanorama(),this.renderSlide(h,x),this.renderTravellerLayer(h,"startX"),this.renderTravellerLayer(x,"endX"),(p||g||v||y||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 ye.createElement(ye.Fragment,null,ye.createElement("rect",{x:a,y:i,width:o,height:l,fill:c,stroke:"none"}),ye.createElement("line",{x1:a+1,y1:u,x2:a+o-1,y2:u,fill:"none",stroke:"#fff"}),ye.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 ye.isValidElement(n)?i=ye.cloneElement(n,a):qr(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 LP({prevData:i,prevTravellerWidth:c,prevUpdateId:u,prevX:l,prevWidth:o},i&&i.length?gmt({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);Bl(Fy,"displayName","Brush");Bl(Fy,"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 vmt=mM;function ymt(e,t){var r;return vmt(e,function(n,a,i){return r=t(n,a,i),!r}),!!r}var bmt=ymt,wmt=_ue,jmt=hf,_mt=bmt,Nmt=El,Smt=YE;function kmt(e,t,r){var n=Nmt(e)?wmt:_mt;return r&&Smt(e,t,r)&&(t=void 0),n(e,jmt(t))}var Cmt=kmt;const Emt=Sn(Cmt);var Qd=function(t,r){var n=t.alwaysShow,a=t.ifOverflow;return n&&(a="extendDomain"),a===r},SK=Hue;function Amt(e,t,r){t=="__proto__"&&SK?SK(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}var Tmt=Amt,Pmt=Tmt,Omt=Uue,Dmt=hf;function Imt(e,t){var r={};return t=Dmt(t),Omt(e,function(n,a,i){Pmt(r,a,t(n,a,i))}),r}var Rmt=Imt;const Lmt=Sn(Rmt);function Fmt(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 Mmt=Fmt,$mt=mM;function Bmt(e,t){var r=!0;return $mt(e,function(n,a,i){return r=!!t(n,a,i),r}),r}var zmt=Bmt,qmt=Mmt,Umt=zmt,Vmt=hf,Hmt=El,Wmt=YE;function Gmt(e,t,r){var n=Hmt(e)?qmt:Umt;return r&&Wmt(e,t,r)&&(t=void 0),n(e,Vmt(t))}var Kmt=Gmt;const Dfe=Sn(Kmt);var Xmt=["x","y"];function vj(e){"@babel/helpers - typeof";return vj=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},vj(e)}function eI(){return eI=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},eI.apply(this,arguments)}function kK(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 Xb(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?kK(Object(r),!0).forEach(function(n){Ymt(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):kK(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ymt(e,t,r){return t=Zmt(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Zmt(e){var t=Jmt(e,"string");return vj(t)=="symbol"?t:t+""}function Jmt(e,t){if(vj(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(vj(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Qmt(e,t){if(e==null)return{};var r=ept(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 ept(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 tpt(e,t){var r=e.x,n=e.y,a=Qmt(e,Xmt),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 Xb(Xb(Xb(Xb(Xb({},t),a),o?{x:o}:{}),c?{y:c}:{}),{},{height:d,width:m,name:t.name,radius:t.radius})}function CK(e){return ye.createElement(kfe,eI({shapeType:"rectangle",propTransformer:tpt,activeClassName:"recharts-active-bar"},e))}var rpt=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=Ft(n)||TGe(n);return i?t(n,a):(i||A0(),r)}},npt=["value","background"],Ife;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)}function spt(e,t){if(e==null)return{};var r=apt(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 apt(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 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 EK(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 Wa(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?EK(Object(r),!0).forEach(function(n){Lm(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):EK(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ipt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function AK(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 opt(e,t,r){return t&&AK(e.prototype,t),r&&AK(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function lpt(e,t,r){return t=Ek(t),cpt(e,Rfe()?Reflect.construct(t,r||[],Ek(e).constructor):t.apply(e,r))}function cpt(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 upt(e)}function upt(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Rfe(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Rfe=function(){return!!e})()}function Ek(e){return Ek=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Ek(e)}function dpt(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&&tI(e,t)}function tI(e,t){return tI=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},tI(e,t)}function Lm(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=fpt(e,"string");return My(t)=="symbol"?t:t+""}function fpt(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)}var gp=function(e){function t(){var r;ipt(this,t);for(var n=arguments.length,a=new Array(n),i=0;i<n;i++)a[i]=arguments[i];return r=lpt(this,t,[].concat(a)),Lm(r,"state",{isAnimationFinished:!1}),Lm(r,"id",D1("recharts-bar-")),Lm(r,"handleAnimationEnd",function(){var o=r.props.onAnimationEnd;r.setState({isAnimationFinished:!0}),o&&o()}),Lm(r,"handleAnimationStart",function(){var o=r.props.onAnimationStart;r.setState({isAnimationFinished:!1}),o&&o()}),r}return dpt(t,e),opt(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=Er(this.props,!1);return n&&n.map(function(f,m){var h=m===c,x=h?u:o,p=Wa(Wa(Wa({},d),f),{},{isActive:h,option:x,index:m,dataKey:l,onAnimationStart:a.handleAnimationStart,onAnimationEnd:a.handleAnimationEnd});return ye.createElement(zn,Ck({className:"recharts-bar-rectangle"},k0(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)}),ye.createElement(CK,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 ye.createElement(sf,{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 x=h.t,p=i.map(function(g,v){var y=m&&m[v];if(y){var b=Hl(y.x,g.x),N=Hl(y.y,g.y),j=Hl(y.width,g.width),_=Hl(y.height,g.height);return Wa(Wa({},g),{},{x:b(x),y:N(x),width:j(x),height:_(x)})}if(o==="horizontal"){var S=Hl(0,g.height),P=S(x);return Wa(Wa({},g),{},{y:g.y+g.height-P,height:P})}var T=Hl(0,g.width),R=T(x);return Wa(Wa({},g),{},{width:R})});return ye.createElement(zn,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||!A_(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=Er(this.props.background,!1);return i.map(function(u,d){u.value;var f=u.background,m=spt(u,npt);if(!f)return null;var h=Wa(Wa(Wa(Wa(Wa({},m),{},{fill:"#eee"},f),c),k0(n.props,u,d)),{},{onAnimationStart:n.handleAnimationStart,onAnimationEnd:n.handleAnimationEnd,dataKey:o,index:d,className:"recharts-bar-background-rectangle"});return ye.createElement(CK,Ck({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=ac(d,T_);if(!f)return null;var m=u==="vertical"?o[0].height/2:o[0].width/2,h=function(g,v){var y=Array.isArray(g.value)?g.value[1]:g.value;return{x:g.x,y:g.y,value:y,errorVal:gi(g,v)}},x={clipPath:n?"url(#clipPath-".concat(a,")"):null};return ye.createElement(zn,x,f.map(function(p){return ye.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,x=n.background,p=n.id;if(a||!i||!i.length)return null;var g=this.state.isAnimationFinished,v=tn("recharts-bar",o),y=l&&l.allowDataOverflow,b=c&&c.allowDataOverflow,N=y||b,j=Jr(p)?this.id:p;return ye.createElement(zn,{className:v},y||b?ye.createElement("defs",null,ye.createElement("clipPath",{id:"clipPath-".concat(j)},ye.createElement("rect",{x:y?u:u-f/2,y:b?d:d-m/2,width:y?f:f*2,height:b?m:m*2}))):null,ye.createElement(zn,{className:"recharts-bar-rectangles",clipPath:N?"url(#clipPath-".concat(j,")"):null},x?this.renderBackground():null,this.renderRectangles()),this.renderErrorBar(N,j),(!h||g)&&ah.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);Ife=gp;Lm(gp,"displayName","Bar");Lm(gp,"defaultProps",{xAxisId:0,yAxisId:0,legendType:"rect",minPointSize:0,hide:!1,data:[],layout:"vertical",activeBar:!1,isAnimationActive:!J0.isSsr,animationBegin:0,animationDuration:400,animationEasing:"ease"});Lm(gp,"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=Zlt(n,r);if(!h)return null;var x=t.layout,p=r.type.defaultProps,g=p!==void 0?Wa(Wa({},p),r.props):r.props,v=g.dataKey,y=g.children,b=g.minPointSize,N=x==="horizontal"?o:i,j=u?N.scale.domain():null,_=sct({numericAxis:N}),S=ac(y,N_),P=f.map(function(T,R){var k,E,q,O,L,H;u?k=Jlt(u[d+R],j):(k=gi(T,v),Array.isArray(k)||(k=[_,k]));var V=rpt(b,Ife.defaultProps.minPointSize)(k[1],R);if(x==="horizontal"){var z,M=[o.scale(k[0]),o.scale(k[1])],B=M[0],K=M[1];E=vG({axis:i,ticks:l,bandSize:a,offset:h.offset,entry:T,index:R}),q=(z=K??B)!==null&&z!==void 0?z:void 0,O=h.size;var C=B-K;if(L=Number.isNaN(C)?0:C,H={x:E,y:o.y,width:O,height:o.height},Math.abs(V)>0&&Math.abs(L)<Math.abs(V)){var A=Vo(L||V)*(Math.abs(V)-Math.abs(L));q-=A,L+=A}}else{var I=[i.scale(k[0]),i.scale(k[1])],U=I[0],Y=I[1];if(E=U,q=vG({axis:o,ticks:c,bandSize:a,offset:h.offset,entry:T,index:R}),O=Y-U,L=h.size,H={x:i.x,y:q,width:i.width,height:L},Math.abs(V)>0&&Math.abs(O)<Math.abs(V)){var te=Vo(O||V)*(Math.abs(V)-Math.abs(O));O+=te}}return Wa(Wa(Wa({},T),{},{x:E,y:q,width:O,height:L,value:u?k:k[1],payload:T,background:H},S&&S[R]&&S[R].props),{},{tooltipPayload:[ofe(r,T)],tooltipPosition:{x:E+O/2,y:q+L/2}})});return Wa({data:P,layout:x},m)});function yj(e){"@babel/helpers - typeof";return yj=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},yj(e)}function hpt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function TK(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,Ffe(n.key),n)}}function mpt(e,t,r){return t&&TK(e.prototype,t),r&&TK(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function PK(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 Ru(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?PK(Object(r),!0).forEach(function(n){pA(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):PK(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function pA(e,t,r){return t=Ffe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ffe(e){var t=ppt(e,"string");return yj(t)=="symbol"?t:t+""}function ppt(e,t){if(yj(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(yj(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Mfe=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=!!ql(u,gp);return d.reduce(function(h,x){var p=r[x],g=p.orientation,v=p.domain,y=p.padding,b=y===void 0?{}:y,N=p.mirror,j=p.reversed,_="".concat(g).concat(N?"Mirror":""),S,P,T,R,k;if(p.type==="number"&&(p.padding==="gap"||p.padding==="no-gap")){var E=v[1]-v[0],q=1/0,O=p.categoricalDomain.sort(DGe);if(O.forEach(function(I,U){U>0&&(q=Math.min((I||0)-(O[U-1]||0),q))}),Number.isFinite(q)){var L=q/E,H=p.layout==="vertical"?n.height:n.width;if(p.padding==="gap"&&(S=L*H/2),p.padding==="no-gap"){var V=Ho(t.barCategoryGap,L*H),z=L*H/2;S=z-V-(z-V)/H*V}}}a==="xAxis"?P=[n.left+(b.left||0)+(S||0),n.left+n.width-(b.right||0)-(S||0)]:a==="yAxis"?P=c==="horizontal"?[n.top+n.height-(b.bottom||0),n.top+(b.top||0)]:[n.top+(b.top||0)+(S||0),n.top+n.height-(b.bottom||0)-(S||0)]:P=p.range,j&&(P=[P[1],P[0]]);var M=nfe(p,i,m),B=M.scale,K=M.realScaleType;B.domain(v).range(P),sfe(B);var C=afe(B,Ru(Ru({},p),{},{realScaleType:K}));a==="xAxis"?(k=g==="top"&&!N||g==="bottom"&&N,T=n.left,R=f[_]-k*p.height):a==="yAxis"&&(k=g==="left"&&!N||g==="right"&&N,T=f[_]-k*p.width,R=n.top);var A=Ru(Ru(Ru({},p),C),{},{realScaleType:K,x:T,y:R,scale:B,width:a==="xAxis"?n.width:p.width,height:a==="yAxis"?n.height:p.height});return A.bandSize=dk(A,C),!p.hide&&a==="xAxis"?f[_]+=(k?-1:1)*A.height:p.hide||(f[_]+=(k?-1:1)*A.width),Ru(Ru({},h),{},pA({},x,A))},{})},$fe=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)}},xpt=function(t){var r=t.x1,n=t.y1,a=t.x2,i=t.y2;return $fe({x:r,y:n},{x:a,y:i})},Bfe=function(){function e(t){hpt(this,e),this.scale=t}return mpt(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)}}])}();pA(Bfe,"EPS",1e-4);var UM=function(t){var r=Object.keys(t).reduce(function(n,a){return Ru(Ru({},n),{},pA({},a,Bfe.create(t[a])))},{});return Ru(Ru({},r),{},{apply:function(a){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=i.bandAware,l=i.position;return Lmt(a,function(c,u){return r[u].apply(c,{bandAware:o,position:l})})},isInRange:function(a){return Dfe(a,function(i,o){return r[o].isInRange(i)})}})};function gpt(e){return(e%180+180)%180}var vpt=function(t){var r=t.width,n=t.height,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,i=gpt(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)},ypt=hf,bpt=__,wpt=KE;function jpt(e){return function(t,r,n){var a=Object(t);if(!bpt(t)){var i=ypt(r);t=wpt(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 _pt=jpt,Npt=Afe;function Spt(e){var t=Npt(e),r=t%1;return t===t?r?t-r:t:0}var kpt=Spt,Cpt=Fue,Ept=hf,Apt=kpt,Tpt=Math.max;function Ppt(e,t,r){var n=e==null?0:e.length;if(!n)return-1;var a=r==null?0:Apt(r);return a<0&&(a=Tpt(n+a,0)),Cpt(e,Ept(t),a)}var Opt=Ppt,Dpt=_pt,Ipt=Opt,Rpt=Dpt(Ipt),Lpt=Rpt;const Fpt=Sn(Lpt);var Mpt=LWe(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("")}),VM=w.createContext(void 0),HM=w.createContext(void 0),zfe=w.createContext(void 0),qfe=w.createContext({}),Ufe=w.createContext(void 0),Vfe=w.createContext(0),Hfe=w.createContext(0),OK=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=Mpt(i);return ye.createElement(VM.Provider,{value:n},ye.createElement(HM.Provider,{value:a},ye.createElement(qfe.Provider,{value:i},ye.createElement(zfe.Provider,{value:d},ye.createElement(Ufe.Provider,{value:o},ye.createElement(Vfe.Provider,{value:u},ye.createElement(Hfe.Provider,{value:c},l)))))))},$pt=function(){return w.useContext(Ufe)},Wfe=function(t){var r=w.useContext(VM);r==null&&A0();var n=r[t];return n==null&&A0(),n},Bpt=function(){var t=w.useContext(VM);return gm(t)},zpt=function(){var t=w.useContext(HM),r=Fpt(t,function(n){return Dfe(n.domain,Number.isFinite)});return r||gm(t)},Gfe=function(t){var r=w.useContext(HM);r==null&&A0();var n=r[t];return n==null&&A0(),n},qpt=function(){var t=w.useContext(zfe);return t},Upt=function(){return w.useContext(qfe)},WM=function(){return w.useContext(Hfe)},GM=function(){return w.useContext(Vfe)};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 Vpt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Hpt(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 Wpt(e,t,r){return t&&Hpt(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Gpt(e,t,r){return t=Ak(t),Kpt(e,Kfe()?Reflect.construct(t,r||[],Ak(e).constructor):t.apply(e,r))}function Kpt(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 Xpt(e)}function Xpt(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Kfe(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Kfe=function(){return!!e})()}function Ak(e){return Ak=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Ak(e)}function Ypt(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&&rI(e,t)}function rI(e,t){return rI=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},rI(e,t)}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 IK(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){KM(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 KM(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 $y(t)=="symbol"?t:t+""}function Zpt(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 String(e)}function Jpt(e,t){return rxt(e)||txt(e,t)||ext(e,t)||Qpt()}function Qpt(){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 ext(e,t){if(e){if(typeof e=="string")return RK(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 RK(e,t)}}function RK(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 txt(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 rxt(e){if(Array.isArray(e))return e}function nI(){return nI=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},nI.apply(this,arguments)}var nxt=function(t,r){var n;return ye.isValidElement(t)?n=ye.cloneElement(t,r):qr(t)?n=t(r):n=ye.createElement("line",nI({},r,{className:"recharts-reference-line-line"})),n},sxt=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 x=u.y,p=t.y.apply(x,{position:o});if(Qd(u,"discard")&&!t.y.isInRange(p))return null;var g=[{x:d+m,y:p},{x:d,y:p}];return c==="left"?g.reverse():g}if(r){var v=u.x,y=t.x.apply(v,{position:o});if(Qd(u,"discard")&&!t.x.isInRange(y))return null;var b=[{x:y,y:f+h},{x:y,y:f}];return l==="top"?b.reverse():b}if(a){var N=u.segment,j=N.map(function(_){return t.apply(_,{position:o})});return Qd(u,"discard")&&Emt(j,function(_){return!t.isInRange(_)})?null:j}return null};function axt(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=$pt(),d=Wfe(a),f=Gfe(i),m=qpt();if(!u||!m)return null;Xu(c===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var h=UM({x:d.scale,y:f.scale}),x=bi(t),p=bi(r),g=n&&n.length===2,v=sxt(h,x,p,g,m,e.position,d.orientation,f.orientation,e);if(!v)return null;var y=Jpt(v,2),b=y[0],N=b.x,j=b.y,_=y[1],S=_.x,P=_.y,T=Qd(e,"hidden")?"url(#".concat(u,")"):void 0,R=IK(IK({clipPath:T},Er(e,!0)),{},{x1:N,y1:j,x2:S,y2:P});return ye.createElement(zn,{className:tn("recharts-reference-line",l)},nxt(o,R),Ti.renderCallByParent(e,xpt({x1:N,y1:j,x2:S,y2:P})))}var XM=function(e){function t(){return Vpt(this,t),Gpt(this,t,arguments)}return Ypt(t,e),Wpt(t,[{key:"render",value:function(){return ye.createElement(axt,this.props)}}])}(ye.Component);KM(XM,"displayName","ReferenceLine");KM(XM,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,fill:"none",stroke:"#ccc",fillOpacity:1,strokeWidth:1,position:"middle"});function sI(){return sI=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},sI.apply(this,arguments)}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 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 FK(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){xA(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 ixt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function oxt(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,Zfe(n.key),n)}}function lxt(e,t,r){return t&&oxt(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function cxt(e,t,r){return t=Tk(t),uxt(e,Yfe()?Reflect.construct(t,r||[],Tk(e).constructor):t.apply(e,r))}function uxt(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 dxt(e)}function dxt(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Yfe(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Yfe=function(){return!!e})()}function Tk(e){return Tk=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Tk(e)}function fxt(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&&aI(e,t)}function aI(e,t){return aI=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},aI(e,t)}function xA(e,t,r){return t=Zfe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Zfe(e){var t=hxt(e,"string");return By(t)=="symbol"?t:t+""}function hxt(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 mxt=function(t){var r=t.x,n=t.y,a=t.xAxis,i=t.yAxis,o=UM({x:a.scale,y:i.scale}),l=o.apply({x:r,y:n},{bandAware:!0});return Qd(t,"discard")&&!o.isInRange(l)?null:l},gA=function(e){function t(){return ixt(this,t),cxt(this,t,arguments)}return fxt(t,e),lxt(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=bi(a),d=bi(i);if(Xu(l===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.'),!u||!d)return null;var f=mxt(this.props);if(!f)return null;var m=f.x,h=f.y,x=this.props,p=x.shape,g=x.className,v=Qd(this.props,"hidden")?"url(#".concat(c,")"):void 0,y=FK(FK({clipPath:v},Er(this.props,!0)),{},{cx:m,cy:h});return ye.createElement(zn,{className:tn("recharts-reference-dot",g)},t.renderDot(p,y),Ti.renderCallByParent(this.props,{x:m-o,y:h-o,width:2*o,height:2*o}))}}])}(ye.Component);xA(gA,"displayName","ReferenceDot");xA(gA,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#fff",stroke:"#ccc",fillOpacity:1,strokeWidth:1});xA(gA,"renderDot",function(e,t){var r;return ye.isValidElement(e)?r=ye.cloneElement(e,t):qr(e)?r=e(t):r=ye.createElement(lA,sI({},t,{cx:t.cx,cy:t.cy,className:"recharts-reference-dot-dot"})),r});function iI(){return iI=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},iI.apply(this,arguments)}function zy(e){"@babel/helpers - typeof";return zy=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},zy(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 $K(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){vA(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 pxt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function xxt(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,Qfe(n.key),n)}}function gxt(e,t,r){return t&&xxt(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function vxt(e,t,r){return t=Pk(t),yxt(e,Jfe()?Reflect.construct(t,r||[],Pk(e).constructor):t.apply(e,r))}function yxt(e,t){if(t&&(zy(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return bxt(e)}function bxt(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Jfe(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Jfe=function(){return!!e})()}function Pk(e){return Pk=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Pk(e)}function wxt(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&&oI(e,t)}function oI(e,t){return oI=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},oI(e,t)}function vA(e,t,r){return t=Qfe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Qfe(e){var t=jxt(e,"string");return zy(t)=="symbol"?t:t+""}function jxt(e,t){if(zy(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(zy(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var _xt=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=UM({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},x={x:r?m.x.apply(l,{position:"end"}):m.x.rangeMax,y:a?m.y.apply(u,{position:"end"}):m.y.rangeMax};return Qd(i,"discard")&&(!m.isInRange(h)||!m.isInRange(x))?null:$fe(h,x)},yA=function(e){function t(){return pxt(this,t),vxt(this,t,arguments)}return wxt(t,e),gxt(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;Xu(u===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var f=bi(a),m=bi(i),h=bi(o),x=bi(l),p=this.props.shape;if(!f&&!m&&!h&&!x&&!p)return null;var g=_xt(f,m,h,x,this.props);if(!g&&!p)return null;var v=Qd(this.props,"hidden")?"url(#".concat(d,")"):void 0;return ye.createElement(zn,{className:tn("recharts-reference-area",c)},t.renderRect(p,$K($K({clipPath:v},Er(this.props,!0)),g)),Ti.renderCallByParent(this.props,g))}}])}(ye.Component);vA(yA,"displayName","ReferenceArea");vA(yA,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#ccc",fillOpacity:.5,stroke:"none",strokeWidth:1});vA(yA,"renderRect",function(e,t){var r;return ye.isValidElement(e)?r=ye.cloneElement(e,t):qr(e)?r=e(t):r=ye.createElement(qM,iI({},t,{className:"recharts-reference-area-rect"})),r});function ehe(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 Nxt(e,t,r){var n={width:e.width+t.width,height:e.height+t.height};return vpt(n,r)}function Sxt(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 Ok(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 kxt(e,t){return ehe(e,t+1)}function Cxt(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 x=n==null?void 0:n[c];if(x===void 0)return{v:ehe(n,u)};var p=c,g,v=function(){return g===void 0&&(g=r(x,p)),g},y=x.coordinate,b=c===0||Ok(e,y,v,d,l);b||(c=0,d=o,u+=1),b&&(d=y+e*(v()/2+a),c+=u)},m;u<=i.length;)if(m=f(),m)return m.v;return[]}function bj(e){"@babel/helpers - typeof";return bj=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},bj(e)}function BK(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 xo(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?BK(Object(r),!0).forEach(function(n){Ext(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):BK(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ext(e,t,r){return t=Axt(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Axt(e){var t=Txt(e,"string");return bj(t)=="symbol"?t:t+""}function Txt(e,t){if(bj(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(bj(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Pxt(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],x,p=function(){return x===void 0&&(x=r(h,m)),x};if(m===o-1){var g=e*(h.coordinate+e*p()/2-c);i[m]=h=xo(xo({},h),{},{tickCoord:g>0?h.coordinate-g*e:h.coordinate})}else i[m]=h=xo(xo({},h),{},{tickCoord:h.coordinate});var v=Ok(e,h.tickCoord,p,l,c);v&&(c=h.tickCoord-e*(p()/2+a),i[m]=xo(xo({},h),{},{isShow:!0}))},d=o-1;d>=0;d--)u(d);return i}function Oxt(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=xo(xo({},d),{},{tickCoord:m>0?d.coordinate-m*e:d.coordinate});var h=Ok(e,d.tickCoord,function(){return f},c,u);h&&(u=d.tickCoord-e*(f/2+a),o[l-1]=xo(xo({},d),{},{isShow:!0}))}for(var x=i?l-1:l,p=function(y){var b=o[y],N,j=function(){return N===void 0&&(N=r(b,y)),N};if(y===0){var _=e*(b.coordinate-e*j()/2-c);o[y]=b=xo(xo({},b),{},{tickCoord:_<0?b.coordinate-_*e:b.coordinate})}else o[y]=b=xo(xo({},b),{},{tickCoord:b.coordinate});var S=Ok(e,b.tickCoord,j,c,u);S&&(c=b.tickCoord+e*(j()/2+a),o[y]=xo(xo({},b),{},{isShow:!0}))},g=0;g<x;g++)p(g);return o}function YM(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(Ft(c)||J0.isSsr)return kxt(a,typeof c=="number"&&Ft(c)?c:0);var m=[],h=l==="top"||l==="bottom"?"width":"height",x=d&&h==="width"?$w(d,{fontSize:t,letterSpacing:r}):{width:0,height:0},p=function(b,N){var j=qr(u)?u(b.value,N):b.value;return h==="width"?Nxt($w(j,{fontSize:t,letterSpacing:r}),x,f):$w(j,{fontSize:t,letterSpacing:r})[h]},g=a.length>=2?Vo(a[1].coordinate-a[0].coordinate):1,v=Sxt(i,g,h);return c==="equidistantPreserveStart"?Cxt(g,v,p,a,o):(c==="preserveStart"||c==="preserveStartEnd"?m=Oxt(g,v,p,a,o,c==="preserveStartEnd"):m=Pxt(g,v,p,a,o),m.filter(function(y){return y.isShow}))}var Dxt=["viewBox"],Ixt=["viewBox"],Rxt=["ticks"];function qy(e){"@babel/helpers - typeof";return qy=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},qy(e)}function xv(){return xv=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},xv.apply(this,arguments)}function zK(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 ui(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?zK(Object(r),!0).forEach(function(n){ZM(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):zK(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function FP(e,t){if(e==null)return{};var r=Lxt(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 Lxt(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 Fxt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function qK(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,rhe(n.key),n)}}function Mxt(e,t,r){return t&&qK(e.prototype,t),r&&qK(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function $xt(e,t,r){return t=Dk(t),Bxt(e,the()?Reflect.construct(t,r||[],Dk(e).constructor):t.apply(e,r))}function Bxt(e,t){if(t&&(qy(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return zxt(e)}function zxt(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function the(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(the=function(){return!!e})()}function Dk(e){return Dk=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Dk(e)}function qxt(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&&lI(e,t)}function lI(e,t){return lI=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},lI(e,t)}function ZM(e,t,r){return t=rhe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function rhe(e){var t=Uxt(e,"string");return qy(t)=="symbol"?t:t+""}function Uxt(e,t){if(qy(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(qy(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var B1=function(e){function t(r){var n;return Fxt(this,t),n=$xt(this,t,[r]),n.state={fontSize:"",letterSpacing:""},n}return qxt(t,e),Mxt(t,[{key:"shouldComponentUpdate",value:function(n,a){var i=n.viewBox,o=FP(n,Dxt),l=this.props,c=l.viewBox,u=FP(l,Ixt);return!Mv(i,c)||!Mv(o,u)||!Mv(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,x,p,g,v,y,b=f?-1:1,N=n.tickSize||d,j=Ft(n.tickCoord)?n.tickCoord:n.coordinate;switch(u){case"top":h=x=n.coordinate,g=o+ +!f*c,p=g-b*N,y=p-b*m,v=j;break;case"left":p=g=n.coordinate,x=i+ +!f*l,h=x-b*N,v=h-b*m,y=j;break;case"right":p=g=n.coordinate,x=i+ +f*l,h=x+b*N,v=h+b*m,y=j;break;default:h=x=n.coordinate,g=o+ +f*c,p=g+b*N,y=p+b*m,v=j;break}return{line:{x1:h,y1:p,x2:x,y2:g},tick:{x:v,y}}}},{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=ui(ui(ui({},Er(this.props,!1)),Er(d,!1)),{},{fill:"none"});if(c==="top"||c==="bottom"){var m=+(c==="top"&&!u||c==="bottom"&&u);f=ui(ui({},f),{},{x1:a,y1:i+m*l,x2:a+o,y2:i+m*l})}else{var h=+(c==="left"&&!u||c==="right"&&u);f=ui(ui({},f),{},{x1:a+h*o,y1:i,x2:a+h*o,y2:i+l})}return ye.createElement("line",xv({},f,{className:tn("recharts-cartesian-axis-line",sc(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=YM(ui(ui({},this.props),{},{ticks:n}),a,i),x=this.getTickTextAnchor(),p=this.getTickVerticalAnchor(),g=Er(this.props,!1),v=Er(d,!1),y=ui(ui({},g),{},{fill:"none"},Er(c,!1)),b=h.map(function(N,j){var _=o.getTickLineCoord(N),S=_.line,P=_.tick,T=ui(ui(ui(ui({textAnchor:x,verticalAnchor:p},g),{},{stroke:"none",fill:u},v),P),{},{index:j,payload:N,visibleTicksCount:h.length,tickFormatter:f});return ye.createElement(zn,xv({className:"recharts-cartesian-axis-tick",key:"tick-".concat(N.value,"-").concat(N.coordinate,"-").concat(N.tickCoord)},k0(o.props,N,j)),c&&ye.createElement("line",xv({},y,S,{className:tn("recharts-cartesian-axis-tick-line",sc(c,"className"))})),d&&t.renderTickItem(d,T,"".concat(qr(f)?f(N.value,j):N.value).concat(m||"")))});return ye.createElement("g",{className:"recharts-cartesian-axis-ticks"},b)}},{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=FP(f,Rxt),x=m;return qr(c)&&(x=m&&m.length>0?c(this.props):c(h)),o<=0||l<=0||!x||!x.length?null:ye.createElement(zn,{className:tn("recharts-cartesian-axis",u),ref:function(g){n.layerReference=g}},i&&this.renderAxisLine(),this.renderTicks(x,this.state.fontSize,this.state.letterSpacing),Ti.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(n,a,i){var o,l=tn(a.className,"recharts-cartesian-axis-tick-value");return ye.isValidElement(n)?o=ye.cloneElement(n,ui(ui({},a),{},{className:l})):qr(n)?o=n(ui(ui({},a),{},{className:l})):o=ye.createElement(C0,xv({},a,{className:"recharts-cartesian-axis-tick-value"}),i),o}}])}(w.Component);ZM(B1,"displayName","CartesianAxis");ZM(B1,"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 Vxt=["x1","y1","x2","y2","key"],Hxt=["offset"];function T0(e){"@babel/helpers - typeof";return T0=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},T0(e)}function UK(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 bo(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?UK(Object(r),!0).forEach(function(n){Wxt(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):UK(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Wxt(e,t,r){return t=Gxt(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Gxt(e){var t=Kxt(e,"string");return T0(t)=="symbol"?t:t+""}function Kxt(e,t){if(T0(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(T0(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Dx(){return Dx=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},Dx.apply(this,arguments)}function VK(e,t){if(e==null)return{};var r=Xxt(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 Xxt(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 Yxt=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 ye.createElement("rect",{x:a,y:i,ry:c,width:o,height:l,stroke:"none",fill:r,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function nhe(e,t){var r;if(ye.isValidElement(e))r=ye.cloneElement(e,t);else if(qr(e))r=e(t);else{var n=t.x1,a=t.y1,i=t.x2,o=t.y2,l=t.key,c=VK(t,Vxt),u=Er(c,!1);u.offset;var d=VK(u,Hxt);r=ye.createElement("line",Dx({},d,{x1:n,y1:a,x2:i,y2:o,fill:"none",key:l}))}return r}function Zxt(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=bo(bo({},e),{},{x1:t,y1:l,x2:t+r,y2:l,key:"line-".concat(c),index:c});return nhe(a,u)});return ye.createElement("g",{className:"recharts-cartesian-grid-horizontal"},o)}function Jxt(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=bo(bo({},e),{},{x1:l,y1:t,x2:l,y2:t+r,key:"line-".concat(c),index:c});return nhe(a,u)});return ye.createElement("g",{className:"recharts-cartesian-grid-vertical"},o)}function Qxt(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 x=!d[h+1],p=x?a+o-m:d[h+1]-m;if(p<=0)return null;var g=h%t.length;return ye.createElement("rect",{key:"react-".concat(h),y:m,x:n,height:p,width:i,stroke:"none",fill:t[g],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return ye.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function e0t(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 x=!d[h+1],p=x?i+l-m:d[h+1]-m;if(p<=0)return null;var g=h%n.length;return ye.createElement("rect",{key:"react-".concat(h),x:m,y:o,width:p,height:c,stroke:"none",fill:n[g],fillOpacity:a,className:"recharts-cartesian-grid-bg"})});return ye.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var t0t=function(t,r){var n=t.xAxis,a=t.width,i=t.height,o=t.offset;return rfe(YM(bo(bo(bo({},B1.defaultProps),n),{},{ticks:Jf(n,!0),viewBox:{x:0,y:0,width:a,height:i}})),o.left,o.left+o.width,r)},r0t=function(t,r){var n=t.yAxis,a=t.width,i=t.height,o=t.offset;return rfe(YM(bo(bo(bo({},B1.defaultProps),n),{},{ticks:Jf(n,!0),viewBox:{x:0,y:0,width:a,height:i}})),o.top,o.top+o.height,r)},Fg={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function JM(e){var t,r,n,a,i,o,l=WM(),c=GM(),u=Upt(),d=bo(bo({},e),{},{stroke:(t=e.stroke)!==null&&t!==void 0?t:Fg.stroke,fill:(r=e.fill)!==null&&r!==void 0?r:Fg.fill,horizontal:(n=e.horizontal)!==null&&n!==void 0?n:Fg.horizontal,horizontalFill:(a=e.horizontalFill)!==null&&a!==void 0?a:Fg.horizontalFill,vertical:(i=e.vertical)!==null&&i!==void 0?i:Fg.vertical,verticalFill:(o=e.verticalFill)!==null&&o!==void 0?o:Fg.verticalFill,x:Ft(e.x)?e.x:u.left,y:Ft(e.y)?e.y:u.top,width:Ft(e.width)?e.width:u.width,height:Ft(e.height)?e.height:u.height}),f=d.x,m=d.y,h=d.width,x=d.height,p=d.syncWithTicks,g=d.horizontalValues,v=d.verticalValues,y=Bpt(),b=zpt();if(!Ft(h)||h<=0||!Ft(x)||x<=0||!Ft(f)||f!==+f||!Ft(m)||m!==+m)return null;var N=d.verticalCoordinatesGenerator||t0t,j=d.horizontalCoordinatesGenerator||r0t,_=d.horizontalPoints,S=d.verticalPoints;if((!_||!_.length)&&qr(j)){var P=g&&g.length,T=j({yAxis:b?bo(bo({},b),{},{ticks:P?g:b.ticks}):void 0,width:l,height:c,offset:u},P?!0:p);Xu(Array.isArray(T),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(T0(T),"]")),Array.isArray(T)&&(_=T)}if((!S||!S.length)&&qr(N)){var R=v&&v.length,k=N({xAxis:y?bo(bo({},y),{},{ticks:R?v:y.ticks}):void 0,width:l,height:c,offset:u},R?!0:p);Xu(Array.isArray(k),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(T0(k),"]")),Array.isArray(k)&&(S=k)}return ye.createElement("g",{className:"recharts-cartesian-grid"},ye.createElement(Yxt,{fill:d.fill,fillOpacity:d.fillOpacity,x:d.x,y:d.y,width:d.width,height:d.height,ry:d.ry}),ye.createElement(Zxt,Dx({},d,{offset:u,horizontalPoints:_,xAxis:y,yAxis:b})),ye.createElement(Jxt,Dx({},d,{offset:u,verticalPoints:S,xAxis:y,yAxis:b})),ye.createElement(Qxt,Dx({},d,{horizontalPoints:_})),ye.createElement(e0t,Dx({},d,{verticalPoints:S})))}JM.displayName="CartesianGrid";var n0t=["type","layout","connectNulls","ref"],s0t=["key"];function Uy(e){"@babel/helpers - typeof";return Uy=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},Uy(e)}function HK(e,t){if(e==null)return{};var r=a0t(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 a0t(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 Hw(){return Hw=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},Hw.apply(this,arguments)}function WK(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 $l(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?WK(Object(r),!0).forEach(function(n){Lu(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):WK(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Mg(e){return c0t(e)||l0t(e)||o0t(e)||i0t()}function i0t(){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 o0t(e,t){if(e){if(typeof e=="string")return cI(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 cI(e,t)}}function l0t(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function c0t(e){if(Array.isArray(e))return cI(e)}function cI(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 u0t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function GK(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,ahe(n.key),n)}}function d0t(e,t,r){return t&&GK(e.prototype,t),r&&GK(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function f0t(e,t,r){return t=Ik(t),h0t(e,she()?Reflect.construct(t,r||[],Ik(e).constructor):t.apply(e,r))}function h0t(e,t){if(t&&(Uy(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return m0t(e)}function m0t(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function she(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(she=function(){return!!e})()}function Ik(e){return Ik=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Ik(e)}function p0t(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&&uI(e,t)}function uI(e,t){return uI=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},uI(e,t)}function Lu(e,t,r){return t=ahe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ahe(e){var t=x0t(e,"string");return Uy(t)=="symbol"?t:t+""}function x0t(e,t){if(Uy(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Uy(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Vy=function(e){function t(){var r;u0t(this,t);for(var n=arguments.length,a=new Array(n),i=0;i<n;i++)a[i]=arguments[i];return r=f0t(this,t,[].concat(a)),Lu(r,"state",{isAnimationFinished:!0,totalLength:0}),Lu(r,"generateSimpleStrokeDasharray",function(o,l){return"".concat(l,"px ").concat(o-l,"px")}),Lu(r,"getStrokeDasharray",function(o,l,c){var u=c.reduce(function(v,y){return v+y});if(!u)return r.generateSimpleStrokeDasharray(l,o);for(var d=Math.floor(o/u),f=o%u,m=l-o,h=[],x=0,p=0;x<c.length;p+=c[x],++x)if(p+c[x]>f){h=[].concat(Mg(c.slice(0,x)),[f-p]);break}var g=h.length%2===0?[0,m]:[m];return[].concat(Mg(t.repeat(c,d)),Mg(h),g).map(function(v){return"".concat(v,"px")}).join(", ")}),Lu(r,"id",D1("recharts-line-")),Lu(r,"pathRef",function(o){r.mainCurve=o}),Lu(r,"handleAnimationEnd",function(){r.setState({isAnimationFinished:!0}),r.props.onAnimationEnd&&r.props.onAnimationEnd()}),Lu(r,"handleAnimationStart",function(){r.setState({isAnimationFinished:!1}),r.props.onAnimationStart&&r.props.onAnimationStart()}),r}return p0t(t,e),d0t(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=ac(d,T_);if(!f)return null;var m=function(p,g){return{x:p.x,y:p.y,value:p.value,errorVal:gi(p.payload,g)}},h={clipPath:n?"url(#clipPath-".concat(a,")"):null};return ye.createElement(zn,h,f.map(function(x){return ye.cloneElement(x,{key:"bar-".concat(x.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=Er(this.props,!1),m=Er(c,!0),h=u.map(function(p,g){var v=$l($l($l({key:"dot-".concat(g),r:3},f),m),{},{index:g,cx:p.x,cy:p.y,value:p.value,dataKey:d,payload:p.payload,points:u});return t.renderDotItem(c,v)}),x={clipPath:n?"url(#clipPath-".concat(a?"":"dots-").concat(i,")"):null};return ye.createElement(zn,Hw({className:"recharts-line-dots",key:"dots"},x),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=HK(l,n0t),m=$l($l($l({},Er(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 ye.createElement(mk,Hw({},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,x=o.animateNewValues,p=o.width,g=o.height,v=this.state,y=v.prevPoints,b=v.totalLength;return ye.createElement(sf,{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 j=N.t;if(y){var _=y.length/l.length,S=l.map(function(E,q){var O=Math.floor(q*_);if(y[O]){var L=y[O],H=Hl(L.x,E.x),V=Hl(L.y,E.y);return $l($l({},E),{},{x:H(j),y:V(j)})}if(x){var z=Hl(p*2,E.x),M=Hl(g/2,E.y);return $l($l({},E),{},{x:z(j),y:M(j)})}return $l($l({},E),{},{x:E.x,y:E.y})});return i.renderCurveStatically(S,n,a)}var P=Hl(0,b),T=P(j),R;if(c){var k="".concat(c).split(/[,\s]+/gim).map(function(E){return parseFloat(E)});R=i.getStrokeDasharray(T,b,k)}else R=i.generateSimpleStrokeDasharray(b,T);return i.renderCurveStatically(l,n,a,{strokeDasharray:R})})}},{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||!A_(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,x=a.height,p=a.isAnimationActive,g=a.id;if(i||!l||!l.length)return null;var v=this.state.isAnimationFinished,y=l.length===1,b=tn("recharts-line",c),N=u&&u.allowDataOverflow,j=d&&d.allowDataOverflow,_=N||j,S=Jr(g)?this.id:g,P=(n=Er(o,!1))!==null&&n!==void 0?n:{r:3,strokeWidth:2},T=P.r,R=T===void 0?3:T,k=P.strokeWidth,E=k===void 0?2:k,q=qGe(o)?o:{},O=q.clipDot,L=O===void 0?!0:O,H=R*2+E;return ye.createElement(zn,{className:b},N||j?ye.createElement("defs",null,ye.createElement("clipPath",{id:"clipPath-".concat(S)},ye.createElement("rect",{x:N?m:m-h/2,y:j?f:f-x/2,width:N?h:h*2,height:j?x:x*2})),!L&&ye.createElement("clipPath",{id:"clipPath-dots-".concat(S)},ye.createElement("rect",{x:m-H/2,y:f-H/2,width:h+H,height:x+H}))):null,!y&&this.renderCurve(_,S),this.renderErrorBar(_,S),(y||o)&&this.renderDots(_,L,S),(!p||v)&&ah.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(Mg(n),[0]):n,o=[],l=0;l<a;++l)o=[].concat(Mg(o),Mg(i));return o}},{key:"renderDotItem",value:function(n,a){var i;if(ye.isValidElement(n))i=ye.cloneElement(n,a);else if(qr(n))i=n(a);else{var o=a.key,l=HK(a,s0t),c=tn("recharts-line-dot",typeof n!="boolean"?n.className:"");i=ye.createElement(lA,Hw({key:o},l,{className:c}))}return i}}])}(w.PureComponent);Lu(Vy,"displayName","Line");Lu(Vy,"defaultProps",{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendType:"line",stroke:"#3182bd",strokeWidth:1,fill:"#fff",points:[],isAnimationActive:!J0.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",hide:!1,label:!1});Lu(Vy,"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 x=gi(m,o);return d==="horizontal"?{x:gG({axis:r,ticks:a,bandSize:l,entry:m,index:h}),y:Jr(x)?null:n.scale(x),value:x,payload:m}:{x:Jr(x)?null:r.scale(x),y:gG({axis:n,ticks:i,bandSize:l,entry:m,index:h}),value:x,payload:m}});return $l({points:f,layout:d},u)});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 g0t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function v0t(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,lhe(n.key),n)}}function y0t(e,t,r){return t&&v0t(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function b0t(e,t,r){return t=Rk(t),w0t(e,ihe()?Reflect.construct(t,r||[],Rk(e).constructor):t.apply(e,r))}function w0t(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 j0t(e)}function j0t(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ihe(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ihe=function(){return!!e})()}function Rk(e){return Rk=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Rk(e)}function _0t(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&&dI(e,t)}function dI(e,t){return dI=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},dI(e,t)}function ohe(e,t,r){return t=lhe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function lhe(e){var t=N0t(e,"string");return Hy(t)=="symbol"?t:t+""}function N0t(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)}function fI(){return fI=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},fI.apply(this,arguments)}function S0t(e){var t=e.xAxisId,r=WM(),n=GM(),a=Wfe(t);return a==null?null:w.createElement(B1,fI({},a,{className:tn("recharts-".concat(a.axisType," ").concat(a.axisType),a.className),viewBox:{x:0,y:0,width:r,height:n},ticksGenerator:function(o){return Jf(o,!0)}}))}var z1=function(e){function t(){return g0t(this,t),b0t(this,t,arguments)}return _0t(t,e),y0t(t,[{key:"render",value:function(){return w.createElement(S0t,this.props)}}])}(w.Component);ohe(z1,"displayName","XAxis");ohe(z1,"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 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)}function k0t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function C0t(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,dhe(n.key),n)}}function E0t(e,t,r){return t&&C0t(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function A0t(e,t,r){return t=Lk(t),T0t(e,che()?Reflect.construct(t,r||[],Lk(e).constructor):t.apply(e,r))}function T0t(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 P0t(e)}function P0t(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function che(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(che=function(){return!!e})()}function Lk(e){return Lk=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Lk(e)}function O0t(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&&hI(e,t)}function hI(e,t){return hI=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},hI(e,t)}function uhe(e,t,r){return t=dhe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function dhe(e){var t=D0t(e,"string");return Wy(t)=="symbol"?t:t+""}function D0t(e,t){if(Wy(e)!="object"||!e)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 String(e)}function mI(){return mI=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},mI.apply(this,arguments)}var I0t=function(t){var r=t.yAxisId,n=WM(),a=GM(),i=Gfe(r);return i==null?null:w.createElement(B1,mI({},i,{className:tn("recharts-".concat(i.axisType," ").concat(i.axisType),i.className),viewBox:{x:0,y:0,width:n,height:a},ticksGenerator:function(l){return Jf(l,!0)}}))},q1=function(e){function t(){return k0t(this,t),A0t(this,t,arguments)}return O0t(t,e),E0t(t,[{key:"render",value:function(){return w.createElement(I0t,this.props)}}])}(w.Component);uhe(q1,"displayName","YAxis");uhe(q1,"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 KK(e){return M0t(e)||F0t(e)||L0t(e)||R0t()}function R0t(){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 L0t(e,t){if(e){if(typeof e=="string")return pI(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 pI(e,t)}}function F0t(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function M0t(e){if(Array.isArray(e))return pI(e)}function pI(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 xI=function(t,r,n,a,i){var o=ac(t,XM),l=ac(t,gA),c=[].concat(KK(o),KK(l)),u=ac(t,yA),d="".concat(a,"Id"),f=a[0],m=r;if(c.length&&(m=c.reduce(function(p,g){if(g.props[d]===n&&Qd(g.props,"extendDomain")&&Ft(g.props[f])){var v=g.props[f];return[Math.min(p[0],v),Math.max(p[1],v)]}return p},m)),u.length){var h="".concat(f,"1"),x="".concat(f,"2");m=u.reduce(function(p,g){if(g.props[d]===n&&Qd(g.props,"extendDomain")&&Ft(g.props[h])&&Ft(g.props[x])){var v=g.props[h],y=g.props[x];return[Math.min(p[0],v,y),Math.max(p[1],v,y)]}return p},m)}return i&&i.length&&(m=i.reduce(function(p,g){return Ft(g)?[Math.min(p[0],g),Math.max(p[1],g)]:p},m)),m},fhe={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),x=r?r+u:u;return c._events[x]?c._events[x].fn?c._events[x]=[c._events[x],h]:c._events[x].push(h):(c._events[x]=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,x=new Array(h);m<h;m++)x[m]=f[m].fn;return x},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,x){var p=r?r+u:u;if(!this._events[p])return!1;var g=this._events[p],v=arguments.length,y,b;if(g.fn){switch(g.once&&this.removeListener(u,g.fn,void 0,!0),v){case 1:return g.fn.call(g.context),!0;case 2:return g.fn.call(g.context,d),!0;case 3:return g.fn.call(g.context,d,f),!0;case 4:return g.fn.call(g.context,d,f,m),!0;case 5:return g.fn.call(g.context,d,f,m,h),!0;case 6:return g.fn.call(g.context,d,f,m,h,x),!0}for(b=1,y=new Array(v-1);b<v;b++)y[b-1]=arguments[b];g.fn.apply(g.context,y)}else{var N=g.length,j;for(b=0;b<N;b++)switch(g[b].once&&this.removeListener(u,g[b].fn,void 0,!0),v){case 1:g[b].fn.call(g[b].context);break;case 2:g[b].fn.call(g[b].context,d);break;case 3:g[b].fn.call(g[b].context,d,f);break;case 4:g[b].fn.call(g[b].context,d,f,m);break;default:if(!y)for(j=1,y=new Array(v-1);j<v;j++)y[j-1]=arguments[j];g[b].fn.apply(g[b].context,y)}}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 x=this._events[h];if(x.fn)x.fn===d&&(!m||x.once)&&(!f||x.context===f)&&o(this,h);else{for(var p=0,g=[],v=x.length;p<v;p++)(x[p].fn!==d||m&&!x[p].once||f&&x[p].context!==f)&&g.push(x[p]);g.length?this._events[h]=g.length===1?g[0]:g: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})(fhe);var $0t=fhe.exports;const B0t=Sn($0t);var MP=new B0t,$P="recharts.syncMouseEvents";function wj(e){"@babel/helpers - typeof";return wj=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},wj(e)}function z0t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function q0t(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,hhe(n.key),n)}}function U0t(e,t,r){return t&&q0t(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function BP(e,t,r){return t=hhe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function hhe(e){var t=V0t(e,"string");return wj(t)=="symbol"?t:t+""}function V0t(e,t){if(wj(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(wj(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var H0t=function(){function e(){z0t(this,e),BP(this,"activeIndex",0),BP(this,"coordinateList",[]),BP(this,"layout","horizontal")}return U0t(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 W0t(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&&Ft(n)&&Ft(a))return!0}return!1}function G0t(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 mhe(e){var t=e.cx,r=e.cy,n=e.radius,a=e.startAngle,i=e.endAngle,o=Ds(t,r,n,a),l=Ds(t,r,n,i);return{points:[o,l],cx:t,cy:r,radius:n,startAngle:a,endAngle:i}}function K0t(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=Ds(l,c,u,f),h=Ds(l,c,d,f);n=m.x,a=m.y,i=h.x,o=h.y}else return mhe(t);return[{x:n,y:a},{x:i,y:o}]}function jj(e){"@babel/helpers - typeof";return jj=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},jj(e)}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 RS(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){X0t(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 X0t(e,t,r){return t=Y0t(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Y0t(e){var t=Z0t(e,"string");return jj(t)=="symbol"?t:t+""}function Z0t(e,t){if(jj(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(jj(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function J0t(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 x,p=mk;if(m==="ScatterChart")x=o,p=xft;else if(m==="BarChart")x=G0t(f,o,c,d),p=qM;else if(f==="radial"){var g=mhe(o),v=g.cx,y=g.cy,b=g.radius,N=g.startAngle,j=g.endAngle;x={cx:v,cy:y,startAngle:N,endAngle:j,innerRadius:b,outerRadius:b},p=hfe}else x={points:K0t(f,o,c)},p=mk;var _=RS(RS(RS(RS({stroke:"#ccc",pointerEvents:"none"},c),x),Er(h,!1)),{},{payload:l,payloadIndex:u,className:tn("recharts-tooltip-cursor",h.className)});return w.isValidElement(h)?w.cloneElement(h,_):w.createElement(p,_)}var Q0t=["item"],egt=["children","className","width","height","style","compact","title","desc"];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 gv(){return gv=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},gv.apply(this,arguments)}function YK(e,t){return ngt(e)||rgt(e,t)||xhe(e,t)||tgt()}function tgt(){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 rgt(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 ngt(e){if(Array.isArray(e))return e}function ZK(e,t){if(e==null)return{};var r=sgt(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 sgt(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 agt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function igt(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,ghe(n.key),n)}}function ogt(e,t,r){return t&&igt(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function lgt(e,t,r){return t=Fk(t),cgt(e,phe()?Reflect.construct(t,r||[],Fk(e).constructor):t.apply(e,r))}function cgt(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 ugt(e)}function ugt(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function phe(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(phe=function(){return!!e})()}function Fk(e){return Fk=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Fk(e)}function dgt(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&&gI(e,t)}function gI(e,t){return gI=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},gI(e,t)}function Ky(e){return mgt(e)||hgt(e)||xhe(e)||fgt()}function fgt(){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 xhe(e,t){if(e){if(typeof e=="string")return vI(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 vI(e,t)}}function hgt(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function mgt(e){if(Array.isArray(e))return vI(e)}function vI(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 JK(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 pt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?JK(Object(r),!0).forEach(function(n){Tr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):JK(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Tr(e,t,r){return t=ghe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ghe(e){var t=pgt(e,"string");return Gy(t)=="symbol"?t:t+""}function pgt(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(t==="string"?String:Number)(e)}var xgt={xAxis:["bottom","top"],yAxis:["left","right"]},ggt={width:"100%",height:"100%"},vhe={x:0,y:0};function LS(e){return e}var vgt=function(t,r){return r==="horizontal"?t.x:r==="vertical"?t.y:r==="centric"?t.angle:t.radius},ygt=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 pt(pt(pt({},a),Ds(a.cx,a.cy,l,o)),{},{angle:o,radius:l})}var c=i.coordinate,u=a.angle;return pt(pt(pt({},a),Ds(a.cx,a.cy,c,u)),{},{angle:u,radius:c})}return vhe},bA=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(Ky(l),Ky(u)):l},[]);return o.length>0?o:t&&t.length&&Ft(a)&&Ft(i)?t.slice(a,i+1):[]};function yhe(e){return e==="number"?[0,"auto"]:void 0}var yI=function(t,r,n,a){var i=t.graphicalItems,o=t.tooltipAxis,l=bA(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=L4(h,o.dataKey,a)}else m=f&&f[n]||l[n];return m?[].concat(Ky(c),[ofe(u,m)]):c},[])},QK=function(t,r,n,a){var i=a||{x:t.chartX,y:t.chartY},o=vgt(i,n),l=t.orderedTooltipTicks,c=t.tooltipAxis,u=t.tooltipTicks,d=Hlt(o,l,u,c);if(d>=0&&u){var f=u[d]&&u[d].value,m=yI(t,r,d,f),h=ygt(n,l,d,i);return{activeTooltipIndex:d,activeLabel:f,activePayload:m,activeCoordinate:h}}return null},bgt=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=tfe(d,i);return n.reduce(function(x,p){var g,v=p.type.defaultProps!==void 0?pt(pt({},p.type.defaultProps),p.props):p.props,y=v.type,b=v.dataKey,N=v.allowDataOverflow,j=v.allowDuplicatedCategory,_=v.scale,S=v.ticks,P=v.includeHidden,T=v[o];if(x[T])return x;var R=bA(t.data,{graphicalItems:a.filter(function(C){var A,I=o in C.props?C.props[o]:(A=C.type.defaultProps)===null||A===void 0?void 0:A[o];return I===T}),dataStartIndex:c,dataEndIndex:u}),k=R.length,E,q,O;W0t(v.domain,N,y)&&(E=DD(v.domain,null,N),h&&(y==="number"||_!=="auto")&&(O=zw(R,b,"category")));var L=yhe(y);if(!E||E.length===0){var H,V=(H=v.domain)!==null&&H!==void 0?H:L;if(b){if(E=zw(R,b,y),y==="category"&&h){var z=OGe(E);j&&z?(q=E,E=Nk(0,k)):j||(E=wG(V,E,p).reduce(function(C,A){return C.indexOf(A)>=0?C:[].concat(Ky(C),[A])},[]))}else if(y==="category")j?E=E.filter(function(C){return C!==""&&!Jr(C)}):E=wG(V,E,p).reduce(function(C,A){return C.indexOf(A)>=0||A===""||Jr(A)?C:[].concat(Ky(C),[A])},[]);else if(y==="number"){var M=Ylt(R,a.filter(function(C){var A,I,U=o in C.props?C.props[o]:(A=C.type.defaultProps)===null||A===void 0?void 0:A[o],Y="hide"in C.props?C.props.hide:(I=C.type.defaultProps)===null||I===void 0?void 0:I.hide;return U===T&&(P||!Y)}),b,i,d);M&&(E=M)}h&&(y==="number"||_!=="auto")&&(O=zw(R,b,"category"))}else h?E=Nk(0,k):l&&l[T]&&l[T].hasStack&&y==="number"?E=m==="expand"?[0,1]:ife(l[T].stackGroups,c,u):E=efe(R,a.filter(function(C){var A=o in C.props?C.props[o]:C.type.defaultProps[o],I="hide"in C.props?C.props.hide:C.type.defaultProps.hide;return A===T&&(P||!I)}),y,d,!0);if(y==="number")E=xI(f,E,T,i,S),V&&(E=DD(V,E,N));else if(y==="category"&&V){var B=V,K=E.every(function(C){return B.indexOf(C)>=0});K&&(E=B)}}return pt(pt({},x),{},Tr({},T,pt(pt({},v),{},{axisType:i,domain:E,categoricalDomain:O,duplicateDomain:q,originalDomain:(g=v.domain)!==null&&g!==void 0?g:L,isCategorical:h,layout:d})))},{})},wgt=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=bA(t.data,{graphicalItems:n,dataStartIndex:c,dataEndIndex:u}),h=m.length,x=tfe(d,i),p=-1;return n.reduce(function(g,v){var y=v.type.defaultProps!==void 0?pt(pt({},v.type.defaultProps),v.props):v.props,b=y[o],N=yhe("number");if(!g[b]){p++;var j;return x?j=Nk(0,h):l&&l[b]&&l[b].hasStack?(j=ife(l[b].stackGroups,c,u),j=xI(f,j,b,i)):(j=DD(N,efe(m,n.filter(function(_){var S,P,T=o in _.props?_.props[o]:(S=_.type.defaultProps)===null||S===void 0?void 0:S[o],R="hide"in _.props?_.props.hide:(P=_.type.defaultProps)===null||P===void 0?void 0:P.hide;return T===b&&!R}),"number",d),a.defaultProps.allowDataOverflow),j=xI(f,j,b,i)),pt(pt({},g),{},Tr({},b,pt(pt({axisType:i},a.defaultProps),{},{hide:!0,orientation:sc(xgt,"".concat(i,".").concat(p%2),null),domain:j,originalDomain:N,isCategorical:x,layout:d})))}return g},{})},jgt=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=ac(d,i),h={};return m&&m.length?h=bgt(t,{axes:m,graphicalItems:o,axisType:a,axisIdKey:f,stackGroups:l,dataStartIndex:c,dataEndIndex:u}):o&&o.length&&(h=wgt(t,{Axis:i,graphicalItems:o,axisType:a,axisIdKey:f,stackGroups:l,dataStartIndex:c,dataEndIndex:u})),h},_gt=function(t){var r=gm(t),n=Jf(r,!1,!0);return{tooltipTicks:n,orderedTooltipTicks:pM(n,function(a){return a.coordinate}),tooltipAxis:r,tooltipAxisBandSize:dk(r,n)}},eX=function(t){var r=t.children,n=t.defaultShowTooltip,a=ql(r,Fy),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}},Ngt=function(t){return!t||!t.length?!1:t.some(function(r){var n=nh(r&&r.type);return n&&n.indexOf("Bar")>=0})},tX=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"}},Sgt=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=ql(f,Fy),x=ql(f,Qx),p=Object.keys(c).reduce(function(j,_){var S=c[_],P=S.orientation;return!S.mirror&&!S.hide?pt(pt({},j),{},Tr({},P,j[P]+S.width)):j},{left:m.left||0,right:m.right||0}),g=Object.keys(o).reduce(function(j,_){var S=o[_],P=S.orientation;return!S.mirror&&!S.hide?pt(pt({},j),{},Tr({},P,sc(j,"".concat(P))+S.height)):j},{top:m.top||0,bottom:m.bottom||0}),v=pt(pt({},g),p),y=v.bottom;h&&(v.bottom+=h.props.height||Fy.defaultProps.height),x&&r&&(v=Klt(v,a,n,r));var b=u-v.left-v.right,N=d-v.top-v.bottom;return pt(pt({brushBottom:y},v),{},{width:Math.max(b,0),height:Math.max(N,0)})},kgt=function(t,r){if(r==="xAxis")return t[r].width;if(r==="yAxis")return t[r].height},QM=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,y){var b=y.graphicalItems,N=y.stackGroups,j=y.offset,_=y.updateId,S=y.dataStartIndex,P=y.dataEndIndex,T=v.barSize,R=v.layout,k=v.barGap,E=v.barCategoryGap,q=v.maxBarSize,O=tX(R),L=O.numericAxisName,H=O.cateAxisName,V=Ngt(b),z=[];return b.forEach(function(M,B){var K=bA(v.data,{graphicalItems:[M],dataStartIndex:S,dataEndIndex:P}),C=M.type.defaultProps!==void 0?pt(pt({},M.type.defaultProps),M.props):M.props,A=C.dataKey,I=C.maxBarSize,U=C["".concat(L,"Id")],Y=C["".concat(H,"Id")],te={},re=c.reduce(function(de,me){var Le=y["".concat(me.axisType,"Map")],Ke=C["".concat(me.axisType,"Id")];Le&&Le[Ke]||me.axisType==="zAxis"||A0();var ve=Le[Ke];return pt(pt({},de),{},Tr(Tr({},me.axisType,ve),"".concat(me.axisType,"Ticks"),Jf(ve)))},te),J=re[H],ie=re["".concat(H,"Ticks")],be=N&&N[U]&&N[U].hasStack&&act(M,N[U].stackGroups),Q=nh(M.type).indexOf("Bar")>=0,Ve=dk(J,ie),W=[],Z=V&&Wlt({barSize:T,stackGroups:N,totalSize:kgt(re,H)});if(Q){var he,se,oe=Jr(I)?q:I,le=(he=(se=dk(J,ie,!0))!==null&&se!==void 0?se:oe)!==null&&he!==void 0?he:0;W=Glt({barGap:k,barCategoryGap:E,bandSize:le!==Ve?le:Ve,sizeList:Z[Y],maxBarSize:oe}),le!==Ve&&(W=W.map(function(de){return pt(pt({},de),{},{position:pt(pt({},de.position),{},{offset:de.position.offset-le/2})})}))}var Me=M&&M.type&&M.type.getComposedData;Me&&z.push({props:pt(pt({},Me(pt(pt({},re),{},{displayedData:K,props:v,dataKey:A,item:M,bandSize:Ve,barPosition:W,offset:j,stackedData:be,layout:R,dataStartIndex:S,dataEndIndex:P}))),{},Tr(Tr(Tr({key:M.key||"item-".concat(B)},L,re[L]),H,re[H]),"animationId",_)),childIndex:HGe(M,v.children),item:M})}),z},h=function(v,y){var b=v.props,N=v.dataStartIndex,j=v.dataEndIndex,_=v.updateId;if(!mH({props:b}))return null;var S=b.children,P=b.layout,T=b.stackOffset,R=b.data,k=b.reverseStackOrder,E=tX(P),q=E.numericAxisName,O=E.cateAxisName,L=ac(S,n),H=nct(R,L,"".concat(q,"Id"),"".concat(O,"Id"),T,k),V=c.reduce(function(C,A){var I="".concat(A.axisType,"Map");return pt(pt({},C),{},Tr({},I,jgt(b,pt(pt({},A),{},{graphicalItems:L,stackGroups:A.axisType===q&&H,dataStartIndex:N,dataEndIndex:j}))))},{}),z=Sgt(pt(pt({},V),{},{props:b,graphicalItems:L}),y==null?void 0:y.legendBBox);Object.keys(V).forEach(function(C){V[C]=d(b,V[C],z,C.replace("Map",""),r)});var M=V["".concat(O,"Map")],B=_gt(M),K=m(b,pt(pt({},V),{},{dataStartIndex:N,dataEndIndex:j,updateId:_,graphicalItems:L,stackGroups:H,offset:z}));return pt(pt({formattedGraphicalItems:K,graphicalItems:L,offset:z,stackGroups:H},B),V)},x=function(g){function v(y){var b,N,j;return agt(this,v),j=lgt(this,v,[y]),Tr(j,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),Tr(j,"accessibilityManager",new H0t),Tr(j,"handleLegendBBoxUpdate",function(_){if(_){var S=j.state,P=S.dataStartIndex,T=S.dataEndIndex,R=S.updateId;j.setState(pt({legendBBox:_},h({props:j.props,dataStartIndex:P,dataEndIndex:T,updateId:R},pt(pt({},j.state),{},{legendBBox:_}))))}}),Tr(j,"handleReceiveSyncEvent",function(_,S,P){if(j.props.syncId===_){if(P===j.eventEmitterSymbol&&typeof j.props.syncMethod!="function")return;j.applySyncEvent(S)}}),Tr(j,"handleBrushChange",function(_){var S=_.startIndex,P=_.endIndex;if(S!==j.state.dataStartIndex||P!==j.state.dataEndIndex){var T=j.state.updateId;j.setState(function(){return pt({dataStartIndex:S,dataEndIndex:P},h({props:j.props,dataStartIndex:S,dataEndIndex:P,updateId:T},j.state))}),j.triggerSyncEvent({dataStartIndex:S,dataEndIndex:P})}}),Tr(j,"handleMouseEnter",function(_){var S=j.getMouseInfo(_);if(S){var P=pt(pt({},S),{},{isTooltipActive:!0});j.setState(P),j.triggerSyncEvent(P);var T=j.props.onMouseEnter;qr(T)&&T(P,_)}}),Tr(j,"triggeredAfterMouseMove",function(_){var S=j.getMouseInfo(_),P=S?pt(pt({},S),{},{isTooltipActive:!0}):{isTooltipActive:!1};j.setState(P),j.triggerSyncEvent(P);var T=j.props.onMouseMove;qr(T)&&T(P,_)}),Tr(j,"handleItemMouseEnter",function(_){j.setState(function(){return{isTooltipActive:!0,activeItem:_,activePayload:_.tooltipPayload,activeCoordinate:_.tooltipPosition||{x:_.cx,y:_.cy}}})}),Tr(j,"handleItemMouseLeave",function(){j.setState(function(){return{isTooltipActive:!1}})}),Tr(j,"handleMouseMove",function(_){_.persist(),j.throttleTriggeredAfterMouseMove(_)}),Tr(j,"handleMouseLeave",function(_){j.throttleTriggeredAfterMouseMove.cancel();var S={isTooltipActive:!1};j.setState(S),j.triggerSyncEvent(S);var P=j.props.onMouseLeave;qr(P)&&P(S,_)}),Tr(j,"handleOuterEvent",function(_){var S=VGe(_),P=sc(j.props,"".concat(S));if(S&&qr(P)){var T,R;/.*touch.*/i.test(S)?R=j.getMouseInfo(_.changedTouches[0]):R=j.getMouseInfo(_),P((T=R)!==null&&T!==void 0?T:{},_)}}),Tr(j,"handleClick",function(_){var S=j.getMouseInfo(_);if(S){var P=pt(pt({},S),{},{isTooltipActive:!0});j.setState(P),j.triggerSyncEvent(P);var T=j.props.onClick;qr(T)&&T(P,_)}}),Tr(j,"handleMouseDown",function(_){var S=j.props.onMouseDown;if(qr(S)){var P=j.getMouseInfo(_);S(P,_)}}),Tr(j,"handleMouseUp",function(_){var S=j.props.onMouseUp;if(qr(S)){var P=j.getMouseInfo(_);S(P,_)}}),Tr(j,"handleTouchMove",function(_){_.changedTouches!=null&&_.changedTouches.length>0&&j.throttleTriggeredAfterMouseMove(_.changedTouches[0])}),Tr(j,"handleTouchStart",function(_){_.changedTouches!=null&&_.changedTouches.length>0&&j.handleMouseDown(_.changedTouches[0])}),Tr(j,"handleTouchEnd",function(_){_.changedTouches!=null&&_.changedTouches.length>0&&j.handleMouseUp(_.changedTouches[0])}),Tr(j,"handleDoubleClick",function(_){var S=j.props.onDoubleClick;if(qr(S)){var P=j.getMouseInfo(_);S(P,_)}}),Tr(j,"handleContextMenu",function(_){var S=j.props.onContextMenu;if(qr(S)){var P=j.getMouseInfo(_);S(P,_)}}),Tr(j,"triggerSyncEvent",function(_){j.props.syncId!==void 0&&MP.emit($P,j.props.syncId,_,j.eventEmitterSymbol)}),Tr(j,"applySyncEvent",function(_){var S=j.props,P=S.layout,T=S.syncMethod,R=j.state.updateId,k=_.dataStartIndex,E=_.dataEndIndex;if(_.dataStartIndex!==void 0||_.dataEndIndex!==void 0)j.setState(pt({dataStartIndex:k,dataEndIndex:E},h({props:j.props,dataStartIndex:k,dataEndIndex:E,updateId:R},j.state)));else if(_.activeTooltipIndex!==void 0){var q=_.chartX,O=_.chartY,L=_.activeTooltipIndex,H=j.state,V=H.offset,z=H.tooltipTicks;if(!V)return;if(typeof T=="function")L=T(z,_);else if(T==="value"){L=-1;for(var M=0;M<z.length;M++)if(z[M].value===_.activeLabel){L=M;break}}var B=pt(pt({},V),{},{x:V.left,y:V.top}),K=Math.min(q,B.x+B.width),C=Math.min(O,B.y+B.height),A=z[L]&&z[L].value,I=yI(j.state,j.props.data,L),U=z[L]?{x:P==="horizontal"?z[L].coordinate:K,y:P==="horizontal"?C:z[L].coordinate}:vhe;j.setState(pt(pt({},_),{},{activeLabel:A,activeCoordinate:U,activePayload:I,activeTooltipIndex:L}))}else j.setState(_)}),Tr(j,"renderCursor",function(_){var S,P=j.state,T=P.isTooltipActive,R=P.activeCoordinate,k=P.activePayload,E=P.offset,q=P.activeTooltipIndex,O=P.tooltipAxisBandSize,L=j.getTooltipEventType(),H=(S=_.props.active)!==null&&S!==void 0?S:T,V=j.props.layout,z=_.key||"_recharts-cursor";return ye.createElement(J0t,{key:z,activeCoordinate:R,activePayload:k,activeTooltipIndex:q,chartName:r,element:_,isActive:H,layout:V,offset:E,tooltipAxisBandSize:O,tooltipEventType:L})}),Tr(j,"renderPolarAxis",function(_,S,P){var T=sc(_,"type.axisType"),R=sc(j.state,"".concat(T,"Map")),k=_.type.defaultProps,E=k!==void 0?pt(pt({},k),_.props):_.props,q=R&&R[E["".concat(T,"Id")]];return w.cloneElement(_,pt(pt({},q),{},{className:tn(T,q.className),key:_.key||"".concat(S,"-").concat(P),ticks:Jf(q,!0)}))}),Tr(j,"renderPolarGrid",function(_){var S=_.props,P=S.radialLines,T=S.polarAngles,R=S.polarRadius,k=j.state,E=k.radiusAxisMap,q=k.angleAxisMap,O=gm(E),L=gm(q),H=L.cx,V=L.cy,z=L.innerRadius,M=L.outerRadius;return w.cloneElement(_,{polarAngles:Array.isArray(T)?T:Jf(L,!0).map(function(B){return B.coordinate}),polarRadius:Array.isArray(R)?R:Jf(O,!0).map(function(B){return B.coordinate}),cx:H,cy:V,innerRadius:z,outerRadius:M,key:_.key||"polar-grid",radialLines:P})}),Tr(j,"renderLegend",function(){var _=j.state.formattedGraphicalItems,S=j.props,P=S.children,T=S.width,R=S.height,k=j.props.margin||{},E=T-(k.left||0)-(k.right||0),q=Jde({children:P,formattedGraphicalItems:_,legendWidth:E,legendContent:u});if(!q)return null;var O=q.item,L=ZK(q,Q0t);return w.cloneElement(O,pt(pt({},L),{},{chartWidth:T,chartHeight:R,margin:k,onBBoxUpdate:j.handleLegendBBoxUpdate}))}),Tr(j,"renderTooltip",function(){var _,S=j.props,P=S.children,T=S.accessibilityLayer,R=ql(P,Ul);if(!R)return null;var k=j.state,E=k.isTooltipActive,q=k.activeCoordinate,O=k.activePayload,L=k.activeLabel,H=k.offset,V=(_=R.props.active)!==null&&_!==void 0?_:E;return w.cloneElement(R,{viewBox:pt(pt({},H),{},{x:H.left,y:H.top}),active:V,label:L,payload:V?O:[],coordinate:q,accessibilityLayer:T})}),Tr(j,"renderBrush",function(_){var S=j.props,P=S.margin,T=S.data,R=j.state,k=R.offset,E=R.dataStartIndex,q=R.dataEndIndex,O=R.updateId;return w.cloneElement(_,{key:_.key||"_recharts-brush",onChange:PS(j.handleBrushChange,_.props.onChange),data:T,x:Ft(_.props.x)?_.props.x:k.left,y:Ft(_.props.y)?_.props.y:k.top+k.height+k.brushBottom-(P.bottom||0),width:Ft(_.props.width)?_.props.width:k.width,startIndex:E,endIndex:q,updateId:"brush-".concat(O)})}),Tr(j,"renderReferenceElement",function(_,S,P){if(!_)return null;var T=j,R=T.clipPathId,k=j.state,E=k.xAxisMap,q=k.yAxisMap,O=k.offset,L=_.type.defaultProps||{},H=_.props,V=H.xAxisId,z=V===void 0?L.xAxisId:V,M=H.yAxisId,B=M===void 0?L.yAxisId:M;return w.cloneElement(_,{key:_.key||"".concat(S,"-").concat(P),xAxis:E[z],yAxis:q[B],viewBox:{x:O.left,y:O.top,width:O.width,height:O.height},clipPathId:R})}),Tr(j,"renderActivePoints",function(_){var S=_.item,P=_.activePoint,T=_.basePoint,R=_.childIndex,k=_.isRange,E=[],q=S.props.key,O=S.item.type.defaultProps!==void 0?pt(pt({},S.item.type.defaultProps),S.item.props):S.item.props,L=O.activeDot,H=O.dataKey,V=pt(pt({index:R,dataKey:H,cx:P.x,cy:P.y,r:4,fill:zM(S.item),strokeWidth:2,stroke:"#fff",payload:P.payload,value:P.value},Er(L,!1)),F4(L));return E.push(v.renderActiveDot(L,V,"".concat(q,"-activePoint-").concat(R))),T?E.push(v.renderActiveDot(L,pt(pt({},V),{},{cx:T.x,cy:T.y}),"".concat(q,"-basePoint-").concat(R))):k&&E.push(null),E}),Tr(j,"renderGraphicChild",function(_,S,P){var T=j.filterFormatItem(_,S,P);if(!T)return null;var R=j.getTooltipEventType(),k=j.state,E=k.isTooltipActive,q=k.tooltipAxis,O=k.activeTooltipIndex,L=k.activeLabel,H=j.props.children,V=ql(H,Ul),z=T.props,M=z.points,B=z.isRange,K=z.baseLine,C=T.item.type.defaultProps!==void 0?pt(pt({},T.item.type.defaultProps),T.item.props):T.item.props,A=C.activeDot,I=C.hide,U=C.activeBar,Y=C.activeShape,te=!!(!I&&E&&V&&(A||U||Y)),re={};R!=="axis"&&V&&V.props.trigger==="click"?re={onClick:PS(j.handleItemMouseEnter,_.props.onClick)}:R!=="axis"&&(re={onMouseLeave:PS(j.handleItemMouseLeave,_.props.onMouseLeave),onMouseEnter:PS(j.handleItemMouseEnter,_.props.onMouseEnter)});var J=w.cloneElement(_,pt(pt({},T.props),re));function ie(me){return typeof q.dataKey=="function"?q.dataKey(me.payload):null}if(te)if(O>=0){var be,Q;if(q.dataKey&&!q.allowDuplicatedCategory){var Ve=typeof q.dataKey=="function"?ie:"payload.".concat(q.dataKey.toString());be=L4(M,Ve,L),Q=B&&K&&L4(K,Ve,L)}else be=M==null?void 0:M[O],Q=B&&K&&K[O];if(Y||U){var W=_.props.activeIndex!==void 0?_.props.activeIndex:O;return[w.cloneElement(_,pt(pt(pt({},T.props),re),{},{activeIndex:W})),null,null]}if(!Jr(be))return[J].concat(Ky(j.renderActivePoints({item:T,activePoint:be,basePoint:Q,childIndex:O,isRange:B})))}else{var Z,he=(Z=j.getItemByXY(j.state.activeCoordinate))!==null&&Z!==void 0?Z:{graphicalItem:J},se=he.graphicalItem,oe=se.item,le=oe===void 0?_:oe,Me=se.childIndex,de=pt(pt(pt({},T.props),re),{},{activeIndex:Me});return[w.cloneElement(le,de),null,null]}return B?[J,null,null]:[J,null]}),Tr(j,"renderCustomized",function(_,S,P){return w.cloneElement(_,pt(pt({key:"recharts-customized-".concat(P)},j.props),j.state))}),Tr(j,"renderMap",{CartesianGrid:{handler:LS,once:!0},ReferenceArea:{handler:j.renderReferenceElement},ReferenceLine:{handler:LS},ReferenceDot:{handler:j.renderReferenceElement},XAxis:{handler:LS},YAxis:{handler:LS},Brush:{handler:j.renderBrush,once:!0},Bar:{handler:j.renderGraphicChild},Line:{handler:j.renderGraphicChild},Area:{handler:j.renderGraphicChild},Radar:{handler:j.renderGraphicChild},RadialBar:{handler:j.renderGraphicChild},Scatter:{handler:j.renderGraphicChild},Pie:{handler:j.renderGraphicChild},Funnel:{handler:j.renderGraphicChild},Tooltip:{handler:j.renderCursor,once:!0},PolarGrid:{handler:j.renderPolarGrid,once:!0},PolarAngleAxis:{handler:j.renderPolarAxis},PolarRadiusAxis:{handler:j.renderPolarAxis},Customized:{handler:j.renderCustomized}}),j.clipPathId="".concat((b=y.id)!==null&&b!==void 0?b:D1("recharts"),"-clip"),j.throttleTriggeredAfterMouseMove=Zue(j.triggeredAfterMouseMove,(N=y.throttleDelay)!==null&&N!==void 0?N:1e3/60),j.state={},j}return dgt(v,g),ogt(v,[{key:"componentDidMount",value:function(){var b,N;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(b=this.props.margin.left)!==null&&b!==void 0?b: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 b=this.props,N=b.children,j=b.data,_=b.height,S=b.layout,P=ql(N,Ul);if(P){var T=P.props.defaultIndex;if(!(typeof T!="number"||T<0||T>this.state.tooltipTicks.length-1)){var R=this.state.tooltipTicks[T]&&this.state.tooltipTicks[T].value,k=yI(this.state,j,T,R),E=this.state.tooltipTicks[T].coordinate,q=(this.state.offset.top+_)/2,O=S==="horizontal",L=O?{x:E,y:q}:{y:E,x:q},H=this.state.formattedGraphicalItems.find(function(z){var M=z.item;return M.type.name==="Scatter"});H&&(L=pt(pt({},L),H.props.points[T].tooltipPosition),k=H.props.points[T].tooltipPayload);var V={activeTooltipIndex:T,isTooltipActive:!0,activeLabel:R,activePayload:k,activeCoordinate:L};this.setState(V),this.renderCursor(P),this.accessibilityManager.setIndex(T)}}}},{key:"getSnapshotBeforeUpdate",value:function(b,N){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==N.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==b.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==b.margin){var j,_;this.accessibilityManager.setDetails({offset:{left:(j=this.props.margin.left)!==null&&j!==void 0?j:0,top:(_=this.props.margin.top)!==null&&_!==void 0?_:0}})}return null}},{key:"componentDidUpdate",value:function(b){K8([ql(b.children,Ul)],[ql(this.props.children,Ul)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var b=ql(this.props.children,Ul);if(b&&typeof b.props.shared=="boolean"){var N=b.props.shared?"axis":"item";return l.indexOf(N)>=0?N:i}return i}},{key:"getMouseInfo",value:function(b){if(!this.container)return null;var N=this.container,j=N.getBoundingClientRect(),_=yst(j),S={chartX:Math.round(b.pageX-_.left),chartY:Math.round(b.pageY-_.top)},P=j.width/N.offsetWidth||1,T=this.inRange(S.chartX,S.chartY,P);if(!T)return null;var R=this.state,k=R.xAxisMap,E=R.yAxisMap,q=this.getTooltipEventType(),O=QK(this.state,this.props.data,this.props.layout,T);if(q!=="axis"&&k&&E){var L=gm(k).scale,H=gm(E).scale,V=L&&L.invert?L.invert(S.chartX):null,z=H&&H.invert?H.invert(S.chartY):null;return pt(pt({},S),{},{xValue:V,yValue:z},O)}return O?pt(pt({},S),O):null}},{key:"inRange",value:function(b,N){var j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,_=this.props.layout,S=b/j,P=N/j;if(_==="horizontal"||_==="vertical"){var T=this.state.offset,R=S>=T.left&&S<=T.left+T.width&&P>=T.top&&P<=T.top+T.height;return R?{x:S,y:P}:null}var k=this.state,E=k.angleAxisMap,q=k.radiusAxisMap;if(E&&q){var O=gm(E);return NG({x:S,y:P},O)}return null}},{key:"parseEventsOfWrapper",value:function(){var b=this.props.children,N=this.getTooltipEventType(),j=ql(b,Ul),_={};j&&N==="axis"&&(j.props.trigger==="click"?_={onClick:this.handleClick}:_={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=F4(this.props,this.handleOuterEvent);return pt(pt({},S),_)}},{key:"addListener",value:function(){MP.on($P,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){MP.removeListener($P,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(b,N,j){for(var _=this.state.formattedGraphicalItems,S=0,P=_.length;S<P;S++){var T=_[S];if(T.item===b||T.props.key===b.key||N===nh(T.item.type)&&j===T.childIndex)return T}return null}},{key:"renderClipPath",value:function(){var b=this.clipPathId,N=this.state.offset,j=N.left,_=N.top,S=N.height,P=N.width;return ye.createElement("defs",null,ye.createElement("clipPath",{id:b},ye.createElement("rect",{x:j,y:_,height:S,width:P})))}},{key:"getXScales",value:function(){var b=this.state.xAxisMap;return b?Object.entries(b).reduce(function(N,j){var _=YK(j,2),S=_[0],P=_[1];return pt(pt({},N),{},Tr({},S,P.scale))},{}):null}},{key:"getYScales",value:function(){var b=this.state.yAxisMap;return b?Object.entries(b).reduce(function(N,j){var _=YK(j,2),S=_[0],P=_[1];return pt(pt({},N),{},Tr({},S,P.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(b){var N;return(N=this.state.xAxisMap)===null||N===void 0||(N=N[b])===null||N===void 0?void 0:N.scale}},{key:"getYScaleByAxisId",value:function(b){var N;return(N=this.state.yAxisMap)===null||N===void 0||(N=N[b])===null||N===void 0?void 0:N.scale}},{key:"getItemByXY",value:function(b){var N=this.state,j=N.formattedGraphicalItems,_=N.activeItem;if(j&&j.length)for(var S=0,P=j.length;S<P;S++){var T=j[S],R=T.props,k=T.item,E=k.type.defaultProps!==void 0?pt(pt({},k.type.defaultProps),k.props):k.props,q=nh(k.type);if(q==="Bar"){var O=(R.data||[]).find(function(z){return Ydt(b,z)});if(O)return{graphicalItem:T,payload:O}}else if(q==="RadialBar"){var L=(R.data||[]).find(function(z){return NG(b,z)});if(L)return{graphicalItem:T,payload:L}}else if(hA(T,_)||mA(T,_)||xj(T,_)){var H=Mht({graphicalItem:T,activeTooltipItem:_,itemData:E.data}),V=E.activeIndex===void 0?H:E.activeIndex;return{graphicalItem:pt(pt({},T),{},{childIndex:V}),payload:xj(T,_)?E.data[H]:T.props.data[H]}}}return null}},{key:"render",value:function(){var b=this;if(!mH(this))return null;var N=this.props,j=N.children,_=N.className,S=N.width,P=N.height,T=N.style,R=N.compact,k=N.title,E=N.desc,q=ZK(N,egt),O=Er(q,!1);if(R)return ye.createElement(OK,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},ye.createElement(Y8,gv({},O,{width:S,height:P,title:k,desc:E}),this.renderClipPath(),xH(j,this.renderMap)));if(this.props.accessibilityLayer){var L,H;O.tabIndex=(L=this.props.tabIndex)!==null&&L!==void 0?L:0,O.role=(H=this.props.role)!==null&&H!==void 0?H:"application",O.onKeyDown=function(z){b.accessibilityManager.keyboardEvent(z)},O.onFocus=function(){b.accessibilityManager.focus()}}var V=this.parseEventsOfWrapper();return ye.createElement(OK,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},ye.createElement("div",gv({className:tn("recharts-wrapper",_),style:pt({position:"relative",cursor:"default",width:S,height:P},T)},V,{ref:function(M){b.container=M}}),ye.createElement(Y8,gv({},O,{width:S,height:P,title:k,desc:E,style:ggt}),this.renderClipPath(),xH(j,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])}(w.Component);Tr(x,"displayName",r),Tr(x,"defaultProps",pt({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},f)),Tr(x,"getDerivedStateFromProps",function(g,v){var y=g.dataKey,b=g.data,N=g.children,j=g.width,_=g.height,S=g.layout,P=g.stackOffset,T=g.margin,R=v.dataStartIndex,k=v.dataEndIndex;if(v.updateId===void 0){var E=eX(g);return pt(pt(pt({},E),{},{updateId:0},h(pt(pt({props:g},E),{},{updateId:0}),v)),{},{prevDataKey:y,prevData:b,prevWidth:j,prevHeight:_,prevLayout:S,prevStackOffset:P,prevMargin:T,prevChildren:N})}if(y!==v.prevDataKey||b!==v.prevData||j!==v.prevWidth||_!==v.prevHeight||S!==v.prevLayout||P!==v.prevStackOffset||!Mv(T,v.prevMargin)){var q=eX(g),O={chartX:v.chartX,chartY:v.chartY,isTooltipActive:v.isTooltipActive},L=pt(pt({},QK(v,b,S)),{},{updateId:v.updateId+1}),H=pt(pt(pt({},q),O),L);return pt(pt(pt({},H),h(pt({props:g},H),v)),{},{prevDataKey:y,prevData:b,prevWidth:j,prevHeight:_,prevLayout:S,prevStackOffset:P,prevMargin:T,prevChildren:N})}if(!K8(N,v.prevChildren)){var V,z,M,B,K=ql(N,Fy),C=K&&(V=(z=K.props)===null||z===void 0?void 0:z.startIndex)!==null&&V!==void 0?V:R,A=K&&(M=(B=K.props)===null||B===void 0?void 0:B.endIndex)!==null&&M!==void 0?M:k,I=C!==R||A!==k,U=!Jr(b),Y=U&&!I?v.updateId:v.updateId+1;return pt(pt({updateId:Y},h(pt(pt({props:g},v),{},{updateId:Y,dataStartIndex:C,dataEndIndex:A}),v)),{},{prevChildren:N,dataStartIndex:C,dataEndIndex:A})}return null}),Tr(x,"renderActiveDot",function(g,v,y){var b;return w.isValidElement(g)?b=w.cloneElement(g,v):qr(g)?b=g(v):b=ye.createElement(lA,v),ye.createElement(zn,{className:"recharts-active-dot",key:y},b)});var p=w.forwardRef(function(v,y){return ye.createElement(x,gv({},v,{ref:y}))});return p.displayName=x.displayName,p},Cgt=QM({chartName:"LineChart",GraphicalChild:Vy,axisComponents:[{axisType:"xAxis",AxisComp:z1},{axisType:"yAxis",AxisComp:q1}],formatAxisMap:Mfe}),Egt=QM({chartName:"BarChart",GraphicalChild:gp,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:z1},{axisType:"yAxis",AxisComp:q1}],formatAxisMap:Mfe}),bhe=QM({chartName:"PieChart",GraphicalChild:mf,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:fA},{axisType:"radiusAxis",AxisComp:uA}],formatAxisMap:pct,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}});function Agt(){const{isAdmin:e}=Br(),t=Zt(),[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 ce.from("email_logs").select("*").order("created_at",{ascending:!1}).limit(500);if(h)throw h;n(m||[]);const x=(m==null?void 0:m.reduce((b,N)=>b+(N.recipients_count||1),0))||0,p=(m==null?void 0:m.reduce((b,N)=>b+(N.success?N.recipients_count||1:0),0))||0,g=x-p,v=x>0?p/x*100:0;i({totalSent:x,totalSuccess:p,totalFailed:g,deliveryRate:v,totalCampaigns:(m==null?void 0:m.length)||0});const y=Array.from({length:30},(b,N)=>{const j=Hx(new Date,29-N);return{date:Dt(j,"dd/MM",{locale:br}),fullDate:j,sent:0,success:0,failed:0}});m==null||m.forEach(b=>{const N=new Date(b.created_at),j=y.findIndex(_=>N>=x0(_.fullDate)&&N<=Xne(_.fullDate));if(j!==-1){const _=b.recipients_count||1;y[j].sent+=_,b.success?y[j].success+=_:y[j].failed+=_}}),u(y)}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(ba,{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(Qs,{className:"h-8 w-8 animate-spin text-primary"})})})}):s.jsx(ba,{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(Qs,{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(je,{children:s.jsx(Ee,{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(Js,{className:"h-8 w-8 text-primary opacity-80"})]})})}),s.jsx(je,{children:s.jsx(Ee,{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(_n,{className:"h-8 w-8 text-blue-500 opacity-80"})]})})}),s.jsx(je,{children:s.jsx(Ee,{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(je,{children:s.jsx(Ee,{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(vs,{className:"h-8 w-8 text-destructive opacity-80"})]})})}),s.jsx(je,{children:s.jsx(Ee,{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(ed,{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(je,{className:"lg:col-span-2",children:[s.jsxs(mt,{children:[s.jsxs(gt,{className:"flex items-center gap-2",children:[s.jsx(n1,{className:"h-5 w-5"}),"Évolution sur 30 jours"]}),s.jsx(Kr,{children:"Nombre d'emails envoyés par jour"})]}),s.jsx(Ee,{children:s.jsx("div",{className:"h-[300px]",children:s.jsx(Y4,{width:"100%",height:"100%",children:s.jsxs(Egt,{data:c,children:[s.jsx(JM,{strokeDasharray:"3 3",className:"stroke-muted"}),s.jsx(z1,{dataKey:"date",tick:{fontSize:12},tickLine:!1}),s.jsx(q1,{tick:{fontSize:12},tickLine:!1}),s.jsx(Ul,{contentStyle:{backgroundColor:"hsl(var(--background))",border:"1px solid hsl(var(--border))",borderRadius:"8px"}}),s.jsx(gp,{dataKey:"success",name:"Délivrés",fill:"hsl(var(--chart-2))",radius:[4,4,0,0]}),s.jsx(gp,{dataKey:"failed",name:"Échoués",fill:"hsl(var(--destructive))",radius:[4,4,0,0]})]})})})})]}),s.jsxs(je,{children:[s.jsxs(mt,{children:[s.jsx(gt,{children:"Répartition globale"}),s.jsx(Kr,{children:"Délivrés vs Échoués"})]}),s.jsx(Ee,{children:s.jsx("div",{className:"h-[300px]",children:f.length>0?s.jsx(Y4,{width:"100%",height:"100%",children:s.jsxs(bhe,{children:[s.jsx(mf,{data:f,cx:"50%",cy:"50%",innerRadius:60,outerRadius:100,paddingAngle:5,dataKey:"value",children:f.map((m,h)=>s.jsx(N_,{fill:m.color},`cell-${h}`))}),s.jsx(Ul,{contentStyle:{backgroundColor:"hsl(var(--background))",border:"1px solid hsl(var(--border))",borderRadius:"8px"},formatter:m=>[m.toLocaleString(),""]}),s.jsx(Qx,{})]})}):s.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:"Aucune donnée disponible"})})})]})]}),s.jsxs(je,{children:[s.jsxs(mt,{children:[s.jsxs(gt,{className:"flex items-center gap-2",children:[s.jsx(Hs,{className:"h-5 w-5"}),"Historique des envois"]}),s.jsx(Kr,{children:"Derniers emails envoyés (toutes sources)"})]}),s.jsx(Ee,{children:r.length===0?s.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:[s.jsx(_n,{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:Dt(new Date(m.created_at),"dd MMM yyyy à HH:mm",{locale:br})}),s.jsx("td",{className:"py-3 px-4 text-center",children:m.success?s.jsx(Te,{className:"bg-green-500 hover:bg-green-600",children:"Délivré"}):s.jsx(Te,{variant:"destructive",title:m.error||"",children:"Échoué"})})]},m.id))})]})})})]})]})})}const jh=w.forwardRef(({className:e,...t},r)=>s.jsx("div",{className:"relative w-full overflow-auto",children:s.jsx("table",{ref:r,className:yt("w-full caption-bottom text-sm",e),...t})}));jh.displayName="Table";const _h=w.forwardRef(({className:e,...t},r)=>s.jsx("thead",{ref:r,className:yt("[&_tr]:border-b",e),...t}));_h.displayName="TableHeader";const Nh=w.forwardRef(({className:e,...t},r)=>s.jsx("tbody",{ref:r,className:yt("[&_tr:last-child]:border-0",e),...t}));Nh.displayName="TableBody";const Tgt=w.forwardRef(({className:e,...t},r)=>s.jsx("tfoot",{ref:r,className:yt("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));Tgt.displayName="TableFooter";const Fa=w.forwardRef(({className:e,...t},r)=>s.jsx("tr",{ref:r,className:yt("border-b transition-colors data-[state=selected]:bg-muted hover:bg-muted/50",e),...t}));Fa.displayName="TableRow";const vr=w.forwardRef(({className:e,...t},r)=>s.jsx("th",{ref:r,className:yt("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));vr.displayName="TableHead";const cr=w.forwardRef(({className:e,...t},r)=>s.jsx("td",{ref:r,className:yt("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));cr.displayName="TableCell";const Pgt=w.forwardRef(({className:e,...t},r)=>s.jsx("caption",{ref:r,className:yt("mt-4 text-sm text-muted-foreground",e),...t}));Pgt.displayName="TableCaption";function Ogt(){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),[x,p]=w.useState({info:0,warning:0,error:0,total:0}),[g,v]=w.useState([]);w.useEffect(()=>{b()},[o,c]),w.useEffect(()=>{y()},[]);const y=async()=>{try{const{data:T,error:R}=await ce.from("app_logs").select("user_email").not("user_email","is",null);if(R)throw R;const k={};T==null||T.forEach(q=>{q.user_email&&(k[q.user_email]=(k[q.user_email]||0)+1)});const E=Object.entries(k).map(([q,O])=>({email:q,count:O})).sort((q,O)=>O.count-q.count);v(E)}catch(T){console.error("Error loading unique users:",T)}},b=async()=>{n(!0);try{let T=ce.from("app_logs").select("*").order("created_at",{ascending:!1}).limit(500);o!=="all"&&(T=T.eq("level",o)),c!=="all"&&(c==="anonymous"?T=T.is("user_email",null):T=T.eq("user_email",c));const{data:R,error:k}=await T;if(k)throw k;const E=(R||[]).map(O=>({...O,level:O.level,context:O.context}));t(E);const{data:q}=await ce.from("app_logs").select("level");if(q){const O=q.filter(V=>V.level==="info").length,L=q.filter(V=>V.level==="warning").length,H=q.filter(V=>V.level==="error").length;p({info:O,warning:L,error:H,total:q.length})}}catch(T){console.error("Error loading logs:",T),ae.error("Erreur lors du chargement des logs")}finally{n(!1)}},N=async T=>{if(confirm("Êtes-vous sûr de vouloir supprimer tous les logs ?"))try{let R=ce.from("app_logs").delete();T||(R=R.neq("id","00000000-0000-0000-0000-000000000000"));const{error:k}=await R;if(k)throw k;ae.success("Logs supprimés"),b()}catch(R){console.error("Error clearing logs:",R),ae.error("Erreur lors de la suppression")}},j=async()=>{if(confirm("Supprimer tous les logs de plus de 30 jours ?")){i(!0);try{const{data:T,error:R}=await ce.functions.invoke("purge-old-logs");if(R)throw R;ae.success(T.message||"Logs purgés avec succès"),b()}catch(T){console.error("Error purging old logs:",T),ae.error("Erreur lors de la purge")}finally{i(!1)}}},_=T=>{switch(T){case"error":return s.jsxs(Te,{variant:"destructive",className:"gap-1",children:[s.jsx(Li,{className:"h-3 w-3"}),"Error"]});case"warning":return s.jsxs(Te,{className:"bg-yellow-500 gap-1",children:[s.jsx(td,{className:"h-3 w-3"}),"Warning"]});default:return s.jsxs(Te,{variant:"secondary",className:"gap-1",children:[s.jsx(dy,{className:"h-3 w-3"}),"Info"]})}},S=e.filter(T=>{var E,q,O,L;if(!d)return!0;const R=d.toLowerCase(),k=((E=T.context)==null?void 0:E.sessionId)||"";return T.message.toLowerCase().includes(R)||((q=T.user_email)==null?void 0:q.toLowerCase().includes(R))||((O=T.page_url)==null?void 0:O.toLowerCase().includes(R))||k.toLowerCase().includes(R)||((L=T.ip_address)==null?void 0:L.toLowerCase().includes(R))||JSON.stringify(T.context).toLowerCase().includes(R)}),P=T=>{var k;const R=(k=T.context)==null?void 0:k.sessionId;return R?R.substring(0,8)+"...":"-"};return s.jsxs("div",{className:"container mx-auto px-4 py-8",children:[s.jsx(ta,{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(Kt,{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:()=>b(),children:[s.jsx(Qs,{className:"mr-2 h-4 w-4"}),"Rafraîchir"]}),s.jsxs(ne,{variant:"outline",onClick:j,disabled:a,children:[a?s.jsx(it,{className:"mr-2 h-4 w-4 animate-spin"}):s.jsx($r,{className:"mr-2 h-4 w-4"}),"Purger +30j"]}),s.jsxs(ne,{variant:"destructive",onClick:()=>N(),children:[s.jsx(ri,{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(je,{children:s.jsx(Ee,{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:x.total})]}),s.jsx(Kt,{className:"h-8 w-8 text-muted-foreground opacity-50"})]})})}),s.jsx(je,{className:"cursor-pointer hover:bg-muted/50",onClick:()=>l("info"),children:s.jsx(Ee,{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:x.info})]}),s.jsx(dy,{className:"h-8 w-8 text-blue-500 opacity-50"})]})})}),s.jsx(je,{className:"cursor-pointer hover:bg-muted/50",onClick:()=>l("warning"),children:s.jsx(Ee,{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:x.warning})]}),s.jsx(td,{className:"h-8 w-8 text-yellow-500 opacity-50"})]})})}),s.jsx(je,{className:"cursor-pointer hover:bg-muted/50",onClick:()=>l("error"),children:s.jsx(Ee,{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:x.error})]}),s.jsx(Li,{className:"h-8 w-8 text-red-500 opacity-50"})]})})})]}),s.jsx(je,{className:"mb-6",children:s.jsx(Ee,{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(Rs,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),s.jsx(Xe,{placeholder:"Rechercher dans les logs...",value:d,onChange:T=>f(T.target.value),className:"pl-10"})]})}),s.jsxs(Ar,{value:o,onValueChange:l,children:[s.jsx(kr,{className:"w-[180px]",children:s.jsx(Dr,{placeholder:"Filtrer par niveau"})}),s.jsxs(Cr,{children:[s.jsx(ct,{value:"all",children:"Tous les niveaux"}),s.jsx(ct,{value:"info",children:"Info"}),s.jsx(ct,{value:"warning",children:"Warning"}),s.jsx(ct,{value:"error",children:"Error"})]})]}),s.jsxs(Ar,{value:c,onValueChange:u,children:[s.jsxs(kr,{className:"w-[250px]",children:[s.jsx(Ko,{className:"mr-2 h-4 w-4"}),s.jsx(Dr,{placeholder:"Filtrer par utilisateur"})]}),s.jsxs(Cr,{children:[s.jsx(ct,{value:"all",children:"Tous les utilisateurs"}),s.jsx(ct,{value:"anonymous",children:"Anonymes uniquement"}),g.map(T=>s.jsx(ct,{value:T.email,children:s.jsxs("span",{className:"flex items-center justify-between gap-2",children:[s.jsx("span",{className:"truncate max-w-[180px]",children:T.email}),s.jsx(Te,{variant:"secondary",className:"text-xs",children:T.count})]})},T.email))]})]}),(o!=="all"||c!=="all")&&s.jsx(ne,{variant:"ghost",onClick:()=>{l("all"),u("all")},children:"Réinitialiser"})]})})}),s.jsxs(je,{children:[s.jsxs(mt,{children:[s.jsx(gt,{children:"Logs récents"}),s.jsxs(Kr,{children:[S.length," log",S.length>1?"s":""," affiché",S.length>1?"s":""]})]}),s.jsx(Ee,{children:r?s.jsx("div",{className:"flex justify-center py-12",children:s.jsx(it,{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(jh,{children:[s.jsx(_h,{children:s.jsxs(Fa,{children:[s.jsx(vr,{className:"w-[100px]",children:"Niveau"}),s.jsx(vr,{children:"Message"}),s.jsx(vr,{className:"w-[120px]",children:"Session ID"}),s.jsx(vr,{className:"w-[150px]",children:"Utilisateur"}),s.jsx(vr,{className:"w-[120px]",children:"IP"}),s.jsx(vr,{className:"w-[180px]",children:"Date"}),s.jsx(vr,{className:"w-[80px]",children:"Actions"})]})}),s.jsx(Nh,{children:S.map(T=>{var R;return s.jsxs(Fa,{children:[s.jsx(cr,{children:_(T.level)}),s.jsx(cr,{className:"max-w-[300px] truncate",children:T.message}),s.jsx(cr,{className:"text-xs font-mono text-muted-foreground",children:P(T)}),s.jsx(cr,{className:"text-sm text-muted-foreground truncate max-w-[150px]",children:T.user_email||"Anonyme"}),s.jsx(cr,{className:"text-xs text-muted-foreground",children:T.ip_address||"-"}),s.jsx(cr,{className:"text-sm text-muted-foreground",children:Dt(new Date(T.created_at),"dd MMM yyyy HH:mm",{locale:br})}),s.jsx(cr,{children:s.jsxs(qn,{children:[s.jsx(Xo,{asChild:!0,children:s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>h(T),children:s.jsx(es,{className:"h-4 w-4"})})}),s.jsxs($n,{className:"max-w-2xl",children:[s.jsx(Un,{children:s.jsxs(Vn,{className:"flex items-center gap-2",children:[_(T.level),"Détails du log"]})}),s.jsx(su,{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:T.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:Dt(new Date(T.created_at),"dd MMMM yyyy à HH:mm:ss",{locale:br})})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Utilisateur"}),s.jsx("p",{className:"mt-1",children:T.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:T.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:((R=T.context)==null?void 0:R.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:T.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:T.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(T.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:T.user_agent||"-"})]})]})})]})]})})]},T.id)})})]})})})]})]})}const rX=["hsl(var(--primary))","hsl(var(--secondary))","#10b981","#f59e0b","#ef4444"],nX={page_view:s.jsx(es,{className:"h-4 w-4 text-blue-500"}),profile_view:s.jsx(er,{className:"h-4 w-4 text-purple-500"}),offer_view:s.jsx(yr,{className:"h-4 w-4 text-orange-500"}),application_sent:s.jsx(Kt,{className:"h-4 w-4 text-green-500"}),search:s.jsx(Rs,{className:"h-4 w-4 text-yellow-500"}),cv_download:s.jsx(ro,{className:"h-4 w-4 text-cyan-500"}),signup:s.jsx(er,{className:"h-4 w-4 text-emerald-500"}),login:s.jsx(kb,{className:"h-4 w-4 text-indigo-500"}),social_link_click:s.jsx(kb,{className:"h-4 w-4 text-blue-600"}),email_click:s.jsx(kb,{className:"h-4 w-4 text-red-500"}),name_copy:s.jsx(kb,{className:"h-4 w-4 text-gray-500"}),name_copied:s.jsx(kb,{className:"h-4 w-4 text-gray-500"})};function Dgt(){const{user:e,isAdmin:t}=Br(),r=Zt(),[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,x]=w.useState([]),[p,g]=w.useState(new Map),[v,y]=w.useState(new Map),[b,N]=w.useState(""),[j,_]=w.useState("views"),[S,P]=w.useState([]),[T,R]=w.useState(""),[k,E]=w.useState("views"),[q,O]=w.useState("all"),[L,H]=w.useState([]),[V,z]=w.useState(new Set),[M,B]=w.useState("");w.useEffect(()=>{if(!e||!t){r("/auth");return}K()},[e,t,r]);const K=async()=>{a(!0),await Promise.all([C(),A(),I(),U(),Y(),re(),te()]),a(!1)},C=async()=>{try{const[W,Z,he]=await Promise.all([ce.from("trainer_profiles").select("id, view_count, status",{count:"exact"}),ce.from("school_requests").select("id, view_count, status, is_filled, application_count",{count:"exact"}),ce.from("trainer_applications").select("id",{count:"exact"})]),se=W.data||[],oe=Z.data||[];c({totalTrainers:W.count||0,totalOffers:Z.count||0,totalViews:se.reduce((le,Me)=>le+(Me.view_count||0),0)+oe.reduce((le,Me)=>le+(Me.view_count||0),0),totalApplications:he.count||0,filledOffers:oe.filter(le=>le.is_filled).length,activeOffers:oe.filter(le=>le.status==="approved"&&!le.is_filled).length})}catch(W){console.error("Error loading stats:",W)}},A=async()=>{try{const W=Array.from({length:30},(se,oe)=>{const le=Hx(new Date,29-oe);return Dt(le,"yyyy-MM-dd")}),{data:Z}=await ce.from("analytics_events").select("event_type, created_at").gte("created_at",Hx(new Date,30).toISOString()),he=W.map(se=>{const oe=(Z==null?void 0:Z.filter(le=>Dt(new Date(le.created_at),"yyyy-MM-dd")===se))||[];return{date:Dt(new Date(se),"dd/MM",{locale:br}),views:oe.filter(le=>["profile_view","offer_view","page_view"].includes(le.event_type)).length,applications:oe.filter(le=>le.event_type==="application_sent").length,signups:oe.filter(le=>le.event_type==="signup").length}});d(he)}catch(W){console.error("Error loading daily stats:",W)}},I=async()=>{try{const{data:W}=await ce.from("analytics_events").select("event_type").gte("created_at",Hx(new Date,30).toISOString()),Z={};W==null||W.forEach(se=>{Z[se.event_type]=(Z[se.event_type]||0)+1});const he={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(([se,oe])=>({name:he[se]||se,value:oe})).sort((se,oe)=>oe.value-se.value).slice(0,5))}catch(W){console.error("Error loading events by type:",W)}},U=async()=>{try{const{data:W}=await ce.from("trainer_profiles").select("id, name, email, specialties, view_count, status, created_at").order("view_count",{ascending:!1});x(W||[]);const Z=new Map;W==null||W.forEach(he=>Z.set(he.id,he.name)),y(Z)}catch(W){console.error("Error loading trainers:",W)}},Y=async()=>{try{const{data:W}=await ce.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});P(W||[])}catch(W){console.error("Error loading offers:",W)}},te=async()=>{try{const{data:W}=await ce.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(he=>{const se=he.trainer_profile_id;if(!se)return;const oe=Z.get(se)||{profileViews:0,cvViews:0,contacts:0,linkClicks:0,nameCopies:0};he.event_type==="profile_view"?oe.profileViews++:he.event_type==="cv_download"?oe.cvViews++:he.event_type==="contact_click"?oe.contacts++:he.event_type==="social_link_click"?oe.linkClicks++:he.event_type==="name_copied"&&oe.nameCopies++,Z.set(se,oe)}),g(Z)}catch(W){console.error("Error loading trainer engagement:",W)}},re=async()=>{try{let W=[],Z=0;const he=1e3;let se=!0;for(;se;){const{data:me,error:Le}=await ce.from("analytics_events").select("*").order("created_at",{ascending:!0}).range(Z*he,(Z+1)*he-1);if(Le)throw Le;me&&me.length>0?(W=[...W,...me],Z++,se=me.length===he):se=!1}if(W.length===0){H([]);return}const oe=[...new Set(W.filter(me=>me.user_id).map(me=>me.user_id))],le=new Map;if(oe.length>0){const{data:me}=await ce.from("trainer_profiles").select("user_id, name, email").in("user_id",oe);me==null||me.forEach(ve=>{le.set(ve.user_id,`${ve.name} (${ve.email})`)});const Le=oe.filter(ve=>!le.has(ve));if(Le.length>0){const{data:ve}=await ce.from("school_profiles").select("user_id, name, contact_email").in("user_id",Le);ve==null||ve.forEach(_e=>{le.set(_e.user_id,`${_e.name} (${_e.contact_email||"école"})`)})}const Ke=oe.filter(ve=>!le.has(ve));if(Ke.length>0){const{data:ve}=await ce.from("user_roles").select("user_id, role").in("user_id",Ke);Ke.forEach(_e=>{const Ue=ve==null?void 0:ve.some(st=>st.user_id===_e&&st.role==="admin"),Qe=_e.substring(0,8);le.set(_e,Ue?`Admin (${Qe}...)`:`User (${Qe}...)`)})}}const Me=new Map;W.forEach(me=>{const Le=me.metadata,ve=(Le==null?void 0:Le.session_id)||`legacy-${me.id}`;Me.has(ve)||Me.set(ve,{userId:me.user_id,userEmail:me.user_id&&le.get(me.user_id)||null,sessionId:ve,sessionStart:me.created_at,events:[]}),Me.get(ve).events.push({eventType:me.event_type,eventName:me.event_name,createdAt:me.created_at,metadata:Le})});const de=Array.from(Me.values()).sort((me,Le)=>new Date(Le.sessionStart).getTime()-new Date(me.sessionStart).getTime());H(de)}catch(W){console.error("Error loading user journeys:",W)}},J=W=>{const Z=new Set(V);Z.has(W)?Z.delete(W):Z.add(W),z(Z)},ie=()=>{if(!M)return L;const W=M.toLowerCase();return L.filter(Z=>{var he;return((he=Z.userEmail)==null?void 0:he.toLowerCase().includes(W))||Z.events.some(se=>se.eventName.toLowerCase().includes(W)||se.eventType.toLowerCase().includes(W))})},be=W=>{const Z=W.metadata,he=Z==null?void 0:Z.trainer_profile_id,se=he?v.get(he):null,oe=String((Z==null?void 0:Z.trainerName)||se||"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}},Q=()=>{let W=[...h];if(b){const Z=b.toLowerCase();W=W.filter(he=>he.name.toLowerCase().includes(Z)||he.email.toLowerCase().includes(Z)||he.specialties.some(se=>se.toLowerCase().includes(Z)))}switch(j){case"views":W.sort((Z,he)=>(he.view_count||0)-(Z.view_count||0));break;case"recent":W.sort((Z,he)=>new Date(he.created_at).getTime()-new Date(Z.created_at).getTime());break;case"name":W.sort((Z,he)=>Z.name.localeCompare(he.name));break}return W},Ve=()=>{let W=[...S];if(T){const Z=T.toLowerCase();W=W.filter(he=>he.school_name.toLowerCase().includes(Z)||he.description.toLowerCase().includes(Z)||he.subject_areas.some(se=>se.toLowerCase().includes(Z)))}switch(q!=="all"&&(q==="filled"?W=W.filter(Z=>Z.is_filled):q==="active"?W=W.filter(Z=>Z.status==="approved"&&!Z.is_filled):W=W.filter(Z=>Z.status===q)),k){case"views":W.sort((Z,he)=>(he.view_count||0)-(Z.view_count||0));break;case"applications":W.sort((Z,he)=>(he.application_count||0)-(Z.application_count||0));break;case"recent":W.sort((Z,he)=>new Date(he.created_at).getTime()-new Date(Z.created_at).getTime());break}return W};return n?s.jsx(ba,{children:s.jsx("div",{className:"container mx-auto px-4 py-8 flex justify-center items-center min-h-[400px]",children:s.jsx(it,{className:"h-8 w-8 animate-spin text-primary"})})}):s.jsx(ba,{children:s.jsxs("div",{className:"container mx-auto px-4 py-8",children:[s.jsx(ta,{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(n1,{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(LN,{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(je,{children:s.jsx(Ee,{className:"pt-6",children:s.jsxs("div",{className:"flex flex-col",children:[s.jsx(er,{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(je,{children:s.jsx(Ee,{className:"pt-6",children:s.jsxs("div",{className:"flex flex-col",children:[s.jsx(yr,{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(je,{children:s.jsx(Ee,{className:"pt-6",children:s.jsxs("div",{className:"flex flex-col",children:[s.jsx(LN,{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(je,{children:s.jsx(Ee,{className:"pt-6",children:s.jsxs("div",{className:"flex flex-col",children:[s.jsx(es,{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(je,{children:s.jsx(Ee,{className:"pt-6",children:s.jsxs("div",{className:"flex flex-col",children:[s.jsx(Kt,{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(je,{children:s.jsx(Ee,{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(uf,{value:i,onValueChange:o,children:[s.jsxs(fd,{className:"mb-6",children:[s.jsx(Mn,{value:"overview",children:"Vue d'ensemble"}),s.jsxs(Mn,{value:"journeys",children:[s.jsx(q3,{className:"h-4 w-4 mr-1"}),"Parcours"]}),s.jsx(Mn,{value:"trainers",children:"Formateurs"}),s.jsx(Mn,{value:"offers",children:"Offres"})]}),s.jsx(Os,{value:"overview",children:s.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[s.jsxs(je,{className:"md:col-span-2",children:[s.jsx(mt,{children:s.jsxs(gt,{className:"flex items-center gap-2",children:[s.jsx(ed,{className:"h-5 w-5"}),"Activité des 30 derniers jours"]})}),s.jsx(Ee,{children:s.jsx("div",{className:"h-[300px]",children:s.jsx(Y4,{width:"100%",height:"100%",children:s.jsxs(Cgt,{data:u,children:[s.jsx(JM,{strokeDasharray:"3 3",className:"stroke-muted"}),s.jsx(z1,{dataKey:"date",className:"text-xs"}),s.jsx(q1,{className:"text-xs"}),s.jsx(Ul,{}),s.jsx(Vy,{type:"monotone",dataKey:"views",stroke:"hsl(var(--primary))",name:"Vues",strokeWidth:2}),s.jsx(Vy,{type:"monotone",dataKey:"applications",stroke:"#10b981",name:"Candidatures",strokeWidth:2})]})})})})]}),s.jsxs(je,{children:[s.jsxs(mt,{children:[s.jsx(gt,{children:"Types d'événements"}),s.jsx(Kr,{children:"Répartition sur 30 jours"})]}),s.jsx(Ee,{children:s.jsx("div",{className:"h-[250px]",children:s.jsx(Y4,{width:"100%",height:"100%",children:s.jsxs(bhe,{children:[s.jsx(mf,{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(N_,{fill:rX[Z%rX.length]},`cell-${Z}`))}),s.jsx(Ul,{})]})})})})]}),s.jsxs(je,{children:[s.jsxs(mt,{children:[s.jsx(gt,{children:"Top 5 Formateurs"}),s.jsx(Kr,{children:"Par nombre de vues"})]}),s.jsx(Ee,{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(Te,{variant:"secondary",children:[s.jsx(es,{className:"h-3 w-3 mr-1"}),W.view_count||0]})]},W.id))})})]})]})}),s.jsx(Os,{value:"journeys",children:s.jsxs(je,{children:[s.jsxs(mt,{children:[s.jsxs(gt,{className:"flex items-center gap-2",children:[s.jsx(q3,{className:"h-5 w-5"}),"Parcours Utilisateurs"]}),s.jsx(Kr,{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(Rs,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),s.jsx(Xe,{placeholder:"Rechercher par email, page ou événement...",value:M,onChange:W=>B(W.target.value),className:"pl-10"})]})})]}),s.jsx(Ee,{children:ie().length===0?s.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:[s.jsx(q3,{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 he=`${W.userId}-${W.sessionStart}`,se=V.has(he),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:()=>J(he),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:[se?s.jsx(Qu,{className:"h-4 w-4 text-muted-foreground"}):s.jsx(nu,{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(Te,{variant:"outline",className:"text-xs",children:W.userEmail||"Utilisateur connecté"})}):s.jsx(Te,{variant:"secondary",className:"text-xs",children:"Visiteur anonyme"})}),s.jsx("span",{className:"text-xs text-muted-foreground",children:Dt(new Date(W.sessionStart),"dd/MM/yyyy HH:mm",{locale:br})})]}),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((le,Me)=>s.jsx("span",{title:le.eventType,children:nX[le.eventType]||s.jsx(LN,{className:"h-4 w-4"})},Me)),W.events.length>4&&s.jsxs("span",{className:"text-xs text-muted-foreground",children:["+",W.events.length-4]})]})]}),se&&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((le,Me)=>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:[nX[le.eventType]||s.jsx(LN,{className:"h-4 w-4"}),s.jsx("span",{className:"font-medium text-sm truncate",children:be(le)})]}),s.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[s.jsx($r,{className:"h-3 w-3 text-muted-foreground"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:Dt(new Date(le.createdAt),"HH:mm:ss",{locale:br})}),s.jsx(Te,{variant:"outline",className:"text-xs",children:le.eventType})]})]})]},Me))})]})})]},Z)})})})]})}),s.jsx(Os,{value:"trainers",children:s.jsxs(je,{children:[s.jsxs(mt,{children:[s.jsxs(gt,{className:"flex items-center gap-2",children:[s.jsx(er,{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(Rs,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),s.jsx(Xe,{placeholder:"Rechercher par nom, email ou spécialité...",value:b,onChange:W=>N(W.target.value),className:"pl-10"})]}),s.jsxs(Ar,{value:j,onValueChange:W=>_(W),children:[s.jsxs(kr,{className:"w-48",children:[s.jsx(n6,{className:"h-4 w-4 mr-2"}),s.jsx(Dr,{})]}),s.jsxs(Cr,{children:[s.jsx(ct,{value:"views",children:"Par vues"}),s.jsx(ct,{value:"recent",children:"Plus récents"}),s.jsx(ct,{value:"name",children:"Par nom"})]})]})]})]}),s.jsx(Ee,{children:s.jsxs(jh,{children:[s.jsx(_h,{children:s.jsxs(Fa,{children:[s.jsx(vr,{children:"Nom"}),s.jsx(vr,{children:"Email"}),s.jsx(vr,{children:"Spécialités"}),s.jsx(vr,{children:"Statut"}),s.jsx(vr,{className:"text-right",children:"Vues"}),s.jsx(vr,{className:"text-right",title:"Vues de la fiche profil",children:"Profil"}),s.jsx(vr,{className:"text-right",title:"CV consultés",children:"CV"}),s.jsx(vr,{className:"text-right",title:"Liens (LinkedIn/site/email) cliqués",children:"Liens"}),s.jsx(vr,{className:"text-right",title:"Clics 'Contacter pour une formation'",children:"Contacts"})]})}),s.jsx(Nh,{children:Q().map(W=>{const Z=p.get(W.id);return s.jsxs(Fa,{children:[s.jsx(cr,{className:"font-medium",children:W.name}),s.jsx(cr,{children:W.email}),s.jsx(cr,{children:s.jsxs("div",{className:"flex flex-wrap gap-1",children:[W.specialties.slice(0,2).map((he,se)=>s.jsx(Te,{variant:"outline",className:"text-xs",children:he},se)),W.specialties.length>2&&s.jsxs(Te,{variant:"outline",className:"text-xs",children:["+",W.specialties.length-2]})]})}),s.jsx(cr,{children:W.status==="approved"?s.jsx(Te,{variant:"default",children:"Validé"}):s.jsx(nt,{to:"/admin/trainers",className:"hover:opacity-80 transition-opacity",children:s.jsx(Te,{variant:"secondary",className:"cursor-pointer hover:bg-secondary/80",children:"En attente"})})}),s.jsx(cr,{className:"text-right font-bold",children:W.view_count||0}),s.jsx(cr,{className:"text-right",children:(Z==null?void 0:Z.profileViews)||0}),s.jsx(cr,{className:"text-right",children:(Z==null?void 0:Z.cvViews)||0}),s.jsx(cr,{className:"text-right",children:(Z==null?void 0:Z.linkClicks)||0}),s.jsx(cr,{className:"text-right font-medium",children:(Z==null?void 0:Z.contacts)||0})]},W.id)})})]})})]})}),s.jsx(Os,{value:"offers",children:s.jsxs(je,{children:[s.jsxs(mt,{children:[s.jsxs(gt,{className:"flex items-center gap-2",children:[s.jsx(yr,{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(Rs,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),s.jsx(Xe,{placeholder:"Rechercher par établissement, description ou domaine...",value:T,onChange:W=>R(W.target.value),className:"pl-10"})]}),s.jsxs(Ar,{value:q,onValueChange:O,children:[s.jsx(kr,{className:"w-40",children:s.jsx(Dr,{placeholder:"Statut"})}),s.jsxs(Cr,{children:[s.jsx(ct,{value:"all",children:"Tous"}),s.jsx(ct,{value:"active",children:"Actives"}),s.jsx(ct,{value:"filled",children:"Pourvues"}),s.jsx(ct,{value:"pending",children:"En attente"}),s.jsx(ct,{value:"archived",children:"Archivées"})]})]}),s.jsxs(Ar,{value:k,onValueChange:W=>E(W),children:[s.jsxs(kr,{className:"w-48",children:[s.jsx(n6,{className:"h-4 w-4 mr-2"}),s.jsx(Dr,{})]}),s.jsxs(Cr,{children:[s.jsx(ct,{value:"views",children:"Par vues"}),s.jsx(ct,{value:"applications",children:"Par candidatures"}),s.jsx(ct,{value:"recent",children:"Plus récentes"})]})]})]})]}),s.jsx(Ee,{children:s.jsxs(jh,{children:[s.jsx(_h,{children:s.jsxs(Fa,{children:[s.jsx(vr,{children:"Établissement"}),s.jsx(vr,{children:"Domaines"}),s.jsx(vr,{children:"Statut"}),s.jsx(vr,{className:"text-right",children:"Vues"}),s.jsx(vr,{className:"text-right",children:"Candidatures"})]})}),s.jsx(Nh,{children:Ve().map(W=>s.jsxs(Fa,{children:[s.jsx(cr,{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(cr,{children:s.jsxs("div",{className:"flex flex-wrap gap-1",children:[W.subject_areas.slice(0,2).map((Z,he)=>s.jsx(Te,{variant:"outline",className:"text-xs",children:Z},he)),W.subject_areas.length>2&&s.jsxs(Te,{variant:"outline",className:"text-xs",children:["+",W.subject_areas.length-2]})]})}),s.jsx(cr,{children:W.is_filled?s.jsx(Te,{className:"bg-green-500",children:"Pourvue"}):W.status==="approved"?s.jsx(Te,{children:"Active"}):s.jsx(Te,{variant:"secondary",children:W.status})}),s.jsx(cr,{className:"text-right font-bold",children:W.view_count||0}),s.jsx(cr,{className:"text-right font-bold",children:W.application_count||0})]},W.id))})]})})]})})]})]})})}function Igt(){const e=Zt(),{isAdmin:t,loading:r}=Br(),[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,x]=w.useState(null),[p,g]=w.useState(null);w.useEffect(()=>{!r&&!t&&e("/auth")},[t,r,e]),w.useEffect(()=>{t&&v()},[t]);const v=async()=>{try{const[H,V]=await Promise.all([ce.from("school_profiles").select("*").order("created_at",{ascending:!1}),ce.from("school_requests").select("user_id")]);if(H.error)throw H.error;o(H.data||[]),m(new Set((V.data||[]).map(z=>z.user_id).filter(Boolean)))}catch(H){console.error("Error loading schools:",H),ae.error("Erreur lors du chargement des établissements")}finally{a(!1)}},y=async H=>{const V=H.contact_email;if(!V){ae.error("Aucun email de contact pour cet établissement");return}x(H.id);try{const{data:z,error:M}=await ce.functions.invoke("send-school-nudge",{body:{to:V,schoolName:H.name,contactName:null}});if(M||!(z!=null&&z.success))throw M||new Error("Échec");ae.success(`Relance envoyée à ${H.name}`)}catch(z){console.error("Error nudging school:",z),ae.error("Erreur lors de l'envoi de la relance")}finally{x(null)}},b=async(H,V)=>{try{const{error:z}=await ce.from("school_profiles").update({is_verified:V}).eq("id",H);if(z)throw z;if(ae.success(V?"Établissement vérifié !":"Vérification retirée"),V)try{await ce.functions.invoke("notify-school-verified",{body:{schoolId:H}}),ae.info("Email de confirmation envoyé à l'établissement")}catch(M){console.error("Error sending verification email:",M),ae.error("L'école n'a pas pu être notifiée par email")}v()}catch(z){console.error("Error updating verification:",z),ae.error("Erreur lors de la mise à jour")}},N=async H=>{const V=window.prompt("Motif du refus (optionnel — il pourra être communiqué à l'établissement) :","");if(V!==null)try{const{error:z}=await ce.from("school_profiles").update({is_rejected:!0,is_verified:!1,rejection_reason:V.trim()||null,rejected_at:new Date().toISOString()}).eq("id",H);if(z)throw z;ae.success("Établissement refusé"),v()}catch(z){console.error("Error rejecting school:",z),ae.error("Erreur lors du refus")}},j=async H=>{try{const{error:V}=await ce.from("school_profiles").update({is_rejected:!1,rejection_reason:null,rejected_at:null}).eq("id",H);if(V)throw V;ae.success("Établissement remis en attente"),v()}catch(V){console.error("Error restoring school:",V),ae.error("Erreur lors de la restauration")}},_=async H=>{if(window.confirm(`Supprimer définitivement l'établissement « ${H.name} » ?
Action irréversible. Pour seulement le masquer, utilisez plutôt « Refuser ».`)){g(H.id);try{const{data:V,error:z}=await ce.from("school_profiles").delete().eq("id",H.id).select("id");if(z)throw z;if(!V||V.length===0){ae.error("Suppression impossible (permissions ou données liées). Utilisez « Refuser ».");return}ae.success("Établissement supprimé"),v()}catch(V){console.error("Error deleting school:",V),ae.error("Erreur : l'établissement a peut-être des offres/contrats liés. Utilisez « Refuser ».")}finally{g(null)}}},S=async(H,V)=>{try{const{error:z}=await Wu.from("school_profiles").update({is_featured:V}).eq("id",H);if(z)throw z;ae.success(V?"Établissement mis en avant":"Retiré de la mise en avant"),v()}catch(z){console.error("Error updating featured:",z),ae.error("Erreur lors de la mise à jour")}},P=async(H,V)=>{try{const{error:z}=await ce.from("school_profiles").update({can_auto_publish:V}).eq("id",H);if(z)throw z;ae.success(V?"Auto-publication activée !":"Auto-publication désactivée"),v()}catch(z){console.error("Error updating auto-publish:",z),ae.error("Erreur lors de la mise à jour")}},T=async(H,V)=>{if(V){if(!V.type.startsWith("image/")){ae.error("Veuillez sélectionner une image");return}if(V.size>2*1024*1024){ae.error("L'image ne doit pas dépasser 2 Mo");return}d(H);try{const z=V.name.split(".").pop(),M=`school-logos/${H}-${Date.now()}.${z}`,{error:B}=await ce.storage.from("trainer-files").upload(M,V,{upsert:!0});if(B)throw B;const{data:K}=ce.storage.from("trainer-files").getPublicUrl(M),{error:C}=await ce.from("school_profiles").update({logo_url:K.publicUrl}).eq("id",H);if(C)throw C;ae.success("Logo mis à jour avec succès !"),v()}catch(z){console.error("Error uploading logo:",z),ae.error("Erreur lors de l'upload du logo")}finally{d(null)}}},R=H=>H.split(" ").map(V=>V[0]).join("").toUpperCase().slice(0,2),k=i.filter(H=>!H.is_verified&&!H.is_rejected),E=i.filter(H=>H.is_verified),q=i.filter(H=>H.is_rejected&&!H.is_verified),O=i.filter(H=>!H.is_rejected&&!f.has(H.user_id));if(r||n)return s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:s.jsx(it,{className:"h-8 w-8 animate-spin text-primary"})});const L=({school:H})=>s.jsx(je,{className:"hover:shadow-lg transition-all",children:s.jsx(Ee,{className:"p-6",children:s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsxs(bs,{className:"w-16 h-16",children:[H.logo_url?s.jsx(ji,{src:H.logo_url,alt:H.name,className:"object-contain"}):null,s.jsx(ws,{className:"text-lg font-bold bg-primary text-primary-foreground",children:R(H.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(yr,{className:"w-5 h-5 text-muted-foreground"}),H.name]}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:["Inscrit le ",new Date(H.created_at).toLocaleDateString("fr-FR")]})]}),s.jsx(Te,{variant:H.is_verified?"default":H.is_rejected?"destructive":"secondary",children:H.is_verified?"Vérifié":H.is_rejected?"Refusé":"Non vérifié"})]}),H.is_rejected&&H.rejection_reason&&s.jsxs("p",{className:"text-sm text-destructive mb-3",children:["Motif du refus : ",H.rejection_reason]}),H.description&&s.jsx("p",{className:"text-sm text-muted-foreground mb-3 line-clamp-2",children:H.description}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2 mb-4 text-sm",children:[H.contact_email&&s.jsxs("a",{href:`mailto:${H.contact_email}`,className:"flex items-center gap-2 text-muted-foreground hover:text-primary transition-colors",children:[s.jsx(_n,{className:"w-4 h-4"}),s.jsx("span",{children:H.contact_email})]}),H.contact_phone&&s.jsxs("a",{href:`tel:${H.contact_phone}`,className:"flex items-center gap-2 text-muted-foreground hover:text-primary transition-colors",children:[s.jsx(a1,{className:"w-4 h-4"}),s.jsx("span",{children:H.contact_phone})]}),H.website_url&&s.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[s.jsx(ap,{className:"w-4 h-4"}),s.jsx("a",{href:H.website_url,target:"_blank",rel:"noopener noreferrer",className:"hover:text-primary truncate",children:H.website_url})]}),H.address&&s.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[s.jsx(Is,{className:"w-4 h-4"}),s.jsx("span",{className:"truncate",children:H.address})]})]}),s.jsxs("div",{className:"flex flex-wrap gap-3 mb-4",children:[s.jsxs(nt,{to:`/admin/school/${H.id}`,className:"flex items-center gap-2 text-sm text-primary hover:underline",children:[s.jsx(yr,{className:"w-4 h-4"}),"Voir le profil complet",s.jsx(Kn,{className:"w-3 h-3"})]}),s.jsxs(nt,{to:"/admin/training-requests",className:"flex items-center gap-2 text-sm text-primary hover:underline",children:[s.jsx(Qn,{className:"w-4 h-4"}),"Voir les offres",s.jsx(Kn,{className:"w-3 h-3"})]}),H.is_verified&&s.jsxs("a",{href:`/ecoles/${H.id}`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 text-sm text-primary hover:underline",children:[s.jsx(ap,{className:"w-4 h-4"}),"Fiche publique",s.jsx(Kn,{className:"w-3 h-3"})]})]}),s.jsx("div",{className:"mb-4",children:s.jsx(b0,{query:H.name,title:"Documents Drive (établissement)"})}),s.jsx("div",{className:"mb-4",children:s.jsx(gie,{subjectType:"school",subjectId:H.id,subjectName:H.name})}),s.jsxs("div",{className:"mb-4 p-3 bg-muted/50 border rounded-md",children:[s.jsx(We,{htmlFor:`logo-${H.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(Xe,{id:`logo-${H.id}`,type:"file",accept:"image/*",disabled:u===H.id,onChange:V=>{var M;const z=(M=V.target.files)==null?void 0:M[0];z&&T(H.id,z)},className:"flex-1"}),u===H.id&&s.jsx(it,{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:[H.is_verified?s.jsxs(ne,{size:"sm",variant:"outline",onClick:()=>b(H.id,!1),children:[s.jsx(vs,{className:"w-4 h-4 mr-2"}),"Retirer la vérification"]}):s.jsxs(ne,{size:"sm",onClick:()=>b(H.id,!0),className:"bg-green-600 hover:bg-green-700",children:[s.jsx(Zn,{className:"w-4 h-4 mr-2"}),"Vérifier"]}),!H.is_verified&&(H.is_rejected?s.jsxs(ne,{size:"sm",variant:"outline",onClick:()=>j(H.id),children:[s.jsx(Zn,{className:"w-4 h-4 mr-2"}),"Remettre en attente"]}):s.jsxs(ne,{size:"sm",variant:"destructive",onClick:()=>N(H.id),children:[s.jsx(vs,{className:"w-4 h-4 mr-2"}),"Refuser"]})),s.jsx(ne,{size:"sm",variant:H.can_auto_publish?"default":"outline",onClick:()=>P(H.id,!H.can_auto_publish),children:H.can_auto_publish?"✓ Auto-publication activée":"Activer auto-publication"}),s.jsxs(ne,{size:"sm",variant:H.is_featured?"default":"outline",className:H.is_featured?"bg-amber-500 hover:bg-amber-600":"",onClick:()=>S(H.id,!H.is_featured),children:[s.jsx(no,{className:`w-4 h-4 mr-2 ${H.is_featured?"fill-white":""}`}),H.is_featured?"Mis en avant":"Mettre en avant"]}),s.jsxs(ne,{size:"sm",variant:"outline",className:"ml-auto text-destructive border-destructive/40 hover:bg-destructive/10 hover:text-destructive",disabled:p===H.id,onClick:()=>_(H),children:[p===H.id?s.jsx(it,{className:"w-4 h-4 mr-2 animate-spin"}):s.jsx(ri,{className:"w-4 h-4 mr-2"}),"Supprimer"]})]})]})]})})},H.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(ta,{items:[{label:"Établissements"}]}),O.length>0&&s.jsxs(je,{className:"mb-6 border-amber-300 bg-amber-50/60",children:[s.jsxs(mt,{className:"pb-3",children:[s.jsxs(gt,{className:"text-lg flex items-center gap-2 text-amber-800",children:[s.jsx(Qn,{className:"w-5 h-5"}),"À relancer : ",O.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(Ee,{children:s.jsx("div",{className:"space-y-2",children:O.map(H=>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:H.name}),s.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:[H.contact_email||"Aucun email de contact"," · inscrit le"," ",new Date(H.created_at).toLocaleDateString("fr-FR")]})]}),s.jsxs(ne,{size:"sm",variant:"outline",disabled:!H.contact_email||h===H.id,onClick:()=>y(H),children:[h===H.id?s.jsx(it,{className:"w-4 h-4 mr-2 animate-spin"}):s.jsx(_n,{className:"w-4 h-4 mr-2"}),"Relancer"]})]},H.id))})})]}),s.jsxs(je,{children:[s.jsxs(mt,{children:[s.jsx(gt,{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(Ee,{children:s.jsxs(uf,{value:l,onValueChange:c,children:[s.jsxs(fd,{className:"grid w-full grid-cols-3 mb-6",children:[s.jsxs(Mn,{value:"pending",children:["Non vérifiés (",k.length,")"]}),s.jsxs(Mn,{value:"verified",children:["Vérifiés (",E.length,")"]}),s.jsxs(Mn,{value:"rejected",children:["Refusés (",q.length,")"]})]}),s.jsx(Os,{value:"pending",className:"space-y-4",children:k.length===0?s.jsx("p",{className:"text-center text-muted-foreground py-8",children:"Aucun établissement en attente de vérification"}):k.map(H=>s.jsx(L,{school:H},H.id))}),s.jsx(Os,{value:"verified",className:"space-y-4",children:E.length===0?s.jsx("p",{className:"text-center text-muted-foreground py-8",children:"Aucun établissement vérifié"}):E.map(H=>s.jsx(L,{school:H},H.id))}),s.jsx(Os,{value:"rejected",className:"space-y-4",children:q.length===0?s.jsx("p",{className:"text-center text-muted-foreground py-8",children:"Aucun établissement refusé"}):q.map(H=>s.jsx(L,{school:H},H.id))})]})})]})]})})}function Rgt(){const e=Zt(),{id:t}=so(),{isAdmin:r,loading:n}=Br(),[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:x,error:p}=await ce.from("school_profiles").select("*").eq("id",t).single();if(p)throw p;l(x);const{data:g,error:v}=await ce.from("school_requests").select("*").eq("user_id",x.user_id).order("created_at",{ascending:!1});if(v)throw v;u(g||[])}catch(x){console.error("Error loading school data:",x),ae.error("Erreur lors du chargement du profil")}finally{i(!1)}},f=x=>x.split(" ").map(p=>p[0]).join("").toUpperCase().slice(0,2),m=x=>{switch(x){case"approved":return s.jsxs(Te,{className:"bg-green-500",children:[s.jsx(Zn,{className:"w-3 h-3 mr-1"}),"Approuvée"]});case"pending":return s.jsx(Te,{variant:"secondary",children:"En attente"});case"rejected":return s.jsxs(Te,{variant:"destructive",children:[s.jsx(vs,{className:"w-3 h-3 mr-1"}),"Rejetée"]});case"archived":return s.jsx(Te,{variant:"outline",children:"Archivée"});default:return s.jsx(Te,{variant:"outline",children:x})}};if(n||a)return s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:s.jsx(it,{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(Hn,{className:"w-4 h-4 mr-2"}),"Retour"]})]})});const h={totalOffers:c.length,approvedOffers:c.filter(x=>x.status==="approved").length,totalViews:c.reduce((x,p)=>x+(p.view_count||0),0),totalApplications:c.reduce((x,p)=>x+(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(ta,{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(Hn,{className:"w-4 h-4 mr-2"}),"Retour"]})}),s.jsx(je,{className:"mb-6",children:s.jsx(Ee,{className:"p-6",children:s.jsxs("div",{className:"flex items-start gap-6",children:[s.jsxs(bs,{className:"w-24 h-24",children:[o.logo_url?s.jsx(ji,{src:o.logo_url,alt:o.name,className:"object-contain"}):null,s.jsx(ws,{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(Te,{variant:o.is_verified?"default":"secondary",children:o.is_verified?"✓ Vérifié":"Non vérifié"}),o.can_auto_publish&&s.jsx(Te,{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(_n,{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(a1,{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(ap,{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(Is,{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(je,{children:s.jsx(Ee,{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(Qn,{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(je,{children:s.jsx(Ee,{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(Zn,{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(je,{children:s.jsx(Ee,{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(es,{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(je,{children:s.jsx(Ee,{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(er,{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(je,{children:[s.jsx(mt,{children:s.jsxs(gt,{className:"flex items-center gap-2",children:[s.jsx(Qn,{className:"h-5 w-5"}),"Offres de formation (",c.length,")"]})}),s.jsx(Ee,{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(x=>s.jsx(je,{className:"hover:shadow-md transition-all",children:s.jsx(Ee,{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:x.school_name}),m(x.status),x.is_sponsored&&s.jsx(Te,{variant:"default",className:"bg-yellow-600",children:"Sponsorisée"})]}),s.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3",children:x.description}),s.jsx("div",{className:"flex flex-wrap gap-2 mb-3",children:x.subject_areas.map((p,g)=>s.jsx(Te,{variant:"outline",children:p},g))}),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(Hs,{className:"w-4 h-4"}),new Date(x.created_at).toLocaleDateString("fr-FR")]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(es,{className:"w-4 h-4"}),x.view_count||0," vues"]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(er,{className:"w-4 h-4"}),x.application_count||0," candidatures"]})]})]}),s.jsx(nt,{to:`/training-offers/${x.id}`,children:s.jsx(ne,{variant:"outline",size:"sm",children:"Voir l'offre"})})]})})},x.id))})})]})]})})}function Lgt(){const{data:e,isLoading:t}=la({queryKey:["admin-school-reviews"],queryFn:async()=>{const{data:r,error:n}=await ce.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(nr,{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(je,{children:s.jsx(Ee,{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(je,{children:[s.jsx(mt,{children:s.jsxs("div",{className:"flex justify-between items-start",children:[s.jsxs("div",{children:[s.jsx(gt,{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(no,{className:`w-5 h-5 ${l<=r.rating?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},l))})]})}),s.jsx(Ee,{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:Dt(new Date(r.created_at),"d MMMM yyyy 'à' HH:mm",{locale:br})})]})})]},r.id)})})]})]})}function Fgt(){var N,j;const{isAdmin:e}=Br(),t=Zt(),[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}x()},[e,t]);const x=async()=>{i(!0);try{const{data:_,error:S}=await ce.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(_||[])}catch(_){console.error("Error loading invoices:",_),ae.error("Erreur lors du chargement des factures")}finally{i(!1)}},p=async(_,S)=>{try{const P={status:S};S==="sent"?(P.issued_at=new Date().toISOString(),P.due_at=new Date(Date.now()+30*24*60*60*1e3).toISOString()):S==="paid"&&(P.paid_at=new Date().toISOString());const{error:T}=await ce.from("invoices").update(P).eq("id",_);if(T)throw T;n(R=>R.map(k=>k.id===_?{...k,...P}:k)),ae.success("Statut mis à jour")}catch(P){console.error("Error updating invoice:",P),ae.error("Erreur lors de la mise à jour")}},g=async _=>{h(_);try{const{data:S,error:P}=await ce.functions.invoke("sync-invoice-tiime",{body:{invoiceId:_}});if(P)throw P;if(S!=null&&S.success)ae.success("Facture synchronisée avec Tiime"),x();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=_=>{switch(_){case"paid":return s.jsxs(Te,{className:"bg-green-500",children:[s.jsx(Wr,{className:"w-3 h-3 mr-1"}),"Payée"]});case"sent":return s.jsxs(Te,{className:"bg-blue-500",children:[s.jsx(Js,{className:"w-3 h-3 mr-1"}),"Envoyée"]});case"overdue":return s.jsxs(Te,{variant:"destructive",children:[s.jsx(Li,{className:"w-3 h-3 mr-1"}),"En retard"]});case"draft":default:return s.jsxs(Te,{variant:"secondary",children:[s.jsx($r,{className:"w-3 h-3 mr-1"}),"Brouillon"]})}},y=r.filter(_=>{var T;const S=_.invoice_number.toLowerCase().includes(o.toLowerCase())||_.client_name.toLowerCase().includes(o.toLowerCase())||((T=_.trainer_profile)==null?void 0:T.name.toLowerCase().includes(o.toLowerCase())),P=c==="all"||_.status===c;return S&&P}),b={total:r.length,draft:r.filter(_=>_.status==="draft").length,sent:r.filter(_=>_.status==="sent").length,paid:r.filter(_=>_.status==="paid").length,totalAmount:r.filter(_=>_.status!=="draft").reduce((_,S)=>_+S.amount_ttc,0),paidAmount:r.filter(_=>_.status==="paid").reduce((_,S)=>_+S.amount_ttc,0)};return a?s.jsx(ba,{children:s.jsx("div",{className:"container mx-auto px-4 py-8 flex justify-center items-center min-h-[400px]",children:s.jsx(it,{className:"h-8 w-8 animate-spin text-primary"})})}):s.jsx(ba,{children:s.jsxs("div",{className:"container mx-auto px-4 py-8",children:[s.jsx(ta,{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(Kt,{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(je,{children:s.jsx(Ee,{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:b.total})]}),s.jsx(Kt,{className:"h-8 w-8 text-primary opacity-80"})]})})}),s.jsx(je,{children:s.jsx(Ee,{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:b.draft})]}),s.jsx($r,{className:"h-8 w-8 text-yellow-500 opacity-80"})]})})}),s.jsx(je,{children:s.jsx(Ee,{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:[b.totalAmount.toFixed(2),"€"]})]}),s.jsx(s1,{className:"h-8 w-8 text-blue-500 opacity-80"})]})})}),s.jsx(je,{children:s.jsx(Ee,{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:[b.paidAmount.toFixed(2),"€"]})]}),s.jsx(Wr,{className:"h-8 w-8 text-green-500 opacity-80"})]})})})]}),s.jsx("div",{className:"mb-6",children:s.jsx(ple,{fileName:"Suivi _Base_Formateurs_PedagoBridge",title:"Suivi Base Formateurs (Drive)"})}),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(Rs,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),s.jsx(Xe,{placeholder:"Rechercher par numéro, client ou formateur...",value:o,onChange:_=>l(_.target.value),className:"pl-10"})]}),s.jsxs(Ar,{value:c,onValueChange:u,children:[s.jsx(kr,{className:"w-48",children:s.jsx(Dr,{placeholder:"Statut"})}),s.jsxs(Cr,{children:[s.jsx(ct,{value:"all",children:"Tous les statuts"}),s.jsx(ct,{value:"draft",children:"Brouillons"}),s.jsx(ct,{value:"sent",children:"Envoyées"}),s.jsx(ct,{value:"paid",children:"Payées"})]})]}),s.jsxs(ne,{variant:"outline",onClick:x,children:[s.jsx(Qs,{className:"h-4 w-4 mr-2"}),"Actualiser"]})]}),y.length===0?s.jsx(je,{children:s.jsxs(Ee,{className:"py-12 text-center",children:[s.jsx(Kt,{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(je,{children:s.jsxs(jh,{children:[s.jsx(_h,{children:s.jsxs(Fa,{children:[s.jsx(vr,{children:"N° Facture"}),s.jsx(vr,{children:"Client"}),s.jsx(vr,{children:"Formateur"}),s.jsx(vr,{className:"text-right",children:"Montant TTC"}),s.jsx(vr,{children:"Statut"}),s.jsx(vr,{children:"Tiime"}),s.jsx(vr,{className:"text-right",children:"Actions"})]})}),s.jsx(Nh,{children:y.map(_=>{var S,P;return s.jsxs(Fa,{children:[s.jsx(cr,{className:"font-medium",children:_.invoice_number}),s.jsx(cr,{children:s.jsxs("div",{children:[s.jsx("p",{className:"font-medium",children:_.client_name}),s.jsxs("a",{href:`mailto:${_.client_email}`,className:"text-sm text-muted-foreground hover:text-primary transition-colors flex items-center gap-1",children:[s.jsx(_n,{className:"w-3 h-3"}),_.client_email]})]})}),s.jsx(cr,{children:s.jsxs(nt,{to:"/admin/trainers",className:"hover:text-primary transition-colors flex items-center gap-1",children:[((S=_.trainer_profile)==null?void 0:S.name)||"-",((P=_.trainer_profile)==null?void 0:P.name)&&s.jsx(Kn,{className:"w-3 h-3 opacity-50"})]})}),s.jsxs(cr,{className:"text-right font-bold",children:[_.amount_ttc.toFixed(2),"€"]}),s.jsx(cr,{children:v(_.status)}),s.jsx(cr,{children:_.tiime_invoice_id?s.jsxs(Te,{variant:"outline",className:"bg-green-50 text-green-700",children:[s.jsx(Wr,{className:"w-3 h-3 mr-1"}),"Sync"]}):_.tiime_sync_error?s.jsxs(Te,{variant:"outline",className:"bg-red-50 text-red-700",children:[s.jsx(Li,{className:"w-3 h-3 mr-1"}),"Erreur"]}):s.jsx(Te,{variant:"outline",children:"Non sync"})}),s.jsx(cr,{className:"text-right",children:s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>f(_),children:"Voir"}),!_.tiime_invoice_id&&s.jsx(ne,{variant:"outline",size:"sm",onClick:()=>g(_.id),disabled:m===_.id,children:m===_.id?s.jsx(it,{className:"h-4 w-4 animate-spin"}):s.jsxs(s.Fragment,{children:[s.jsx(Kn,{className:"h-4 w-4 mr-1"}),"Tiime"]})})]})})]},_.id)})})]})}),s.jsx(qn,{open:!!d,onOpenChange:()=>f(null),children:s.jsxs($n,{className:"max-w-2xl",children:[s.jsxs(Un,{children:[s.jsxs(Vn,{children:["Facture ",d==null?void 0:d.invoice_number]}),s.jsx(Sa,{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(a6,{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(Ko,{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:Dt(new Date(d.issued_at),"dd MMM yyyy",{locale:br})})]}),d.due_at&&s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Échéance"}),s.jsx("p",{children:Dt(new Date(d.due_at),"dd MMM yyyy",{locale:br})})]})]}),s.jsx(b0,{query:((j=d.trainer_profile)==null?void 0:j.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(Li,{className:"h-4 w-4 inline mr-1"}),"Erreur Tiime: ",d.tiime_sync_error]})})]}),s.jsxs(bl,{children:[(d==null?void 0:d.status)==="draft"&&s.jsxs(ne,{onClick:()=>{p(d.id,"sent"),f(null)},children:[s.jsx(Js,{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"]})]})]})})]})})}const Mgt=700,sX=new Set,aX=e=>sX.has(e)?!1:(sX.add(e),!0);function lw({trainerId:e,trainerName:t,field:r,surface:n="profile"}){let a;const i={trainerName:t,field:r,surface:n};return{onMouseEnter:()=>{a=setTimeout(()=>{aX(`${e}:${r}:hover`)&&dn.trackContactInteraction("hover",e,i)},Mgt)},onMouseLeave:()=>{a&&clearTimeout(a)},onMouseUp:o=>{var u;const l=(u=window.getSelection)==null?void 0:u.call(window),c=(l==null?void 0:l.toString().trim())||"";c.length<3||o.currentTarget.contains((l==null?void 0:l.anchorNode)??null)&&aX(`${e}:${r}:select`)&&dn.trackContactInteraction("select",e,{...i,chars:c.length})},onCopy:o=>{var c,u;const l=((u=(c=window.getSelection)==null?void 0:c.call(window))==null?void 0:u.toString().trim())||"";dn.trackContactInteraction("copy",e,{...i,chars:l.length})}}}function iX(){var O;const e=Zt(),[t]=Jj(),[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"),[x,p]=w.useState("all"),[g,v]=w.useState(!1),[y,b]=w.useState(!1),N=async L=>{try{await ce.rpc("increment_trainer_view",{trainer_id:L})}catch(H){console.error("Error incrementing view count:",H)}},j=(L,H,V,z)=>{dn.trackSocialLinkClick(L,H,V),window.open(z,"_blank","noopener,noreferrer")},_=async(L,H)=>{try{await navigator.clipboard.writeText(H),dn.trackNameCopied(L,H),ae.success("Nom copié dans le presse-papier")}catch{ae.error("Erreur lors de la copie")}};w.useEffect(()=>{(async()=>{var H;try{const[V,z]=await Promise.all([ce.rpc("get_public_trainer_profiles"),ce.from("trainer_contracts").select("trainer_id").eq("counter_signed",!0)]);if(V.error)throw V.error;const M=new Set(((H=z.data)==null?void 0:H.map(K=>K.trainer_id))||[]);l(M);const B=Zm(V.data||[],M);n(B),i(B)}catch(V){console.error("Error fetching trainers:",V)}finally{u(!1)}})()},[]),w.useEffect(()=>{let L=[...r];if(d){const V=d.toLowerCase();L=L.filter(z=>{var M;return z.name.toLowerCase().includes(V)||((M=z.bio)==null?void 0:M.toLowerCase().includes(V))||z.specialties.some(B=>B.toLowerCase().includes(V))})}if(m&&m!=="all"){const V=m.toLowerCase();L=L.filter(z=>z.specialties.some(M=>{const B=M.toLowerCase();return B===V||B.includes(V)||V.includes(B)}))}x&&x!=="all"&&(L=L.filter(V=>{var z;return(z=V.preferred_departments)==null?void 0:z.includes(x)}));const H=d.trim()||(m!=="all"?m:"");i(Zm(L,o,H))},[d,m,x,r,o]);const S=w.useRef(0);S.current=a.length,w.useEffect(()=>{if(!d.trim())return;const L=setTimeout(()=>{dn.trackSearch(d,{specialty:m,department:x},S.current,"trainers")},900);return()=>clearTimeout(L)},[d]);const P=w.useRef(!1);w.useEffect(()=>{if(!P.current){P.current=!0;return}dn.trackFilterUsed("specialty",m,S.current,"trainers")},[m]);const T=w.useRef(!1);w.useEffect(()=>{if(!T.current){T.current=!0;return}dn.trackFilterUsed("department",x,S.current,"trainers")},[x]);const R=()=>{const L=new Set;return r.forEach(H=>{H.specialties.forEach(V=>L.add(V))}),Array.from(L).sort()},k=()=>{const L=new Set;return r.forEach(H=>{var V;(V=H.preferred_departments)==null||V.forEach(z=>L.add(z))}),Array.from(L).sort()},E=L=>L.split(" ").map(H=>H[0]).join("").toUpperCase().slice(0,2),q=()=>{f(""),h("all"),p("all")};return s.jsxs(s.Fragment,{children:[s.jsx(nr,{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(er,{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(Rs,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),s.jsx(Xe,{placeholder:"Rechercher par nom, compétence...",value:d,onChange:L=>f(L.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(lp,{open:g,onOpenChange:v,children:[s.jsx(cp,{asChild:!0,children:s.jsxs(ne,{variant:"outline",role:"combobox","aria-expanded":g,className:"w-full md:w-[220px] justify-between text-xs sm:text-sm",children:[s.jsx(RR,{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(g2,{className:"ml-1 sm:ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),s.jsx(vh,{className:"w-[250px] p-0",align:"start",children:s.jsxs(dp,{children:[s.jsx(fp,{placeholder:"Rechercher une spécialité..."}),s.jsxs(hp,{children:[s.jsx(mp,{children:"Aucune spécialité trouvée"}),s.jsxs(rh,{children:[s.jsxs(qu,{value:"all",onSelect:()=>{h("all"),v(!1)},children:[s.jsx(Rn,{className:yt("mr-2 h-4 w-4",m==="all"?"opacity-100":"opacity-0")}),"Toutes les spécialités"]}),R().map(L=>s.jsxs(qu,{value:L,onSelect:()=>{h(L),v(!1)},children:[s.jsx(Rn,{className:yt("mr-2 h-4 w-4",m===L?"opacity-100":"opacity-0")}),L]},L))]})]})]})})]}),s.jsxs(lp,{open:y,onOpenChange:b,children:[s.jsx(cp,{asChild:!0,children:s.jsxs(ne,{variant:"outline",role:"combobox","aria-expanded":y,className:"w-full md:w-[200px] justify-between text-xs sm:text-sm",children:[s.jsx(Is,{className:"h-4 w-4 mr-1 sm:mr-2 shrink-0"}),s.jsx("span",{className:"truncate",children:x==="all"?"Département":((O=dv(x))==null?void 0:O.slice(0,10))+"..."}),s.jsx(g2,{className:"ml-1 sm:ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),s.jsx(vh,{className:"w-[280px] p-0",align:"start",children:s.jsxs(dp,{children:[s.jsx(fp,{placeholder:"Rechercher un département..."}),s.jsxs(hp,{children:[s.jsx(mp,{children:"Aucun département trouvé"}),s.jsxs(rh,{children:[s.jsxs(qu,{value:"all",onSelect:()=>{p("all"),b(!1)},children:[s.jsx(Rn,{className:yt("mr-2 h-4 w-4",x==="all"?"opacity-100":"opacity-0")}),"Tous les départements"]}),k().map(L=>s.jsxs(qu,{value:`${L} ${dv(L)}`,onSelect:()=>{p(L),b(!1)},children:[s.jsx(Rn,{className:yt("mr-2 h-4 w-4",x===L?"opacity-100":"opacity-0")}),L," - ",dv(L)]},L))]})]})]})})]}),(d||m!=="all"||x!=="all")&&s.jsx(ne,{variant:"ghost",onClick:q,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(it,{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(er,{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:q,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(z0,{children:a.map(L=>s.jsx(je,{className:"hover:shadow-lg transition-all duration-300 border-border/50 group overflow-hidden",children:s.jsx(Ee,{className:"p-4 sm:p-6",children:s.jsxs("div",{className:"flex flex-col items-center text-center",children:[s.jsxs(bs,{className:"w-20 h-20 sm:w-24 sm:h-24 mb-3 sm:mb-4 ring-4 ring-background shadow-lg",children:[L.photo_url?s.jsx(ji,{src:L.photo_url,alt:L.name}):null,s.jsx(ws,{className:"text-2xl font-bold bg-primary text-primary-foreground",children:E(L.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",...lw({trainerId:L.id,trainerName:L.name,field:"name",surface:"listing"}),children:L.name}),s.jsxs(Kf,{children:[s.jsx(Xf,{asChild:!0,children:s.jsx(ne,{variant:"ghost",size:"icon",className:"h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity",onClick:H=>{H.stopPropagation(),_(L.id,L.name)},children:s.jsx(uy,{className:"h-3 w-3"})})}),s.jsx(qd,{children:"Copier le nom"})]})]}),L.isAffiliated&&s.jsx(id,{size:"sm"}),s.jsx(vie,{country:L.country}),s.jsx(wse,{level:L.english_level||null})]}),(L.linkedin_url||L.website_url||L.email)&&s.jsxs("div",{className:"flex gap-2 mb-3",children:[L.email&&s.jsx("span",{...lw({trainerId:L.id,trainerName:L.name,field:"email",surface:"listing"}),children:s.jsxs(Kf,{children:[s.jsx(Xf,{asChild:!0,children:s.jsx(ne,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:H=>{H.stopPropagation(),dn.trackSocialLinkClick(L.id,"email",L.name),window.location.href=`mailto:${L.email}`},children:s.jsx(_n,{className:"h-4 w-4 text-muted-foreground"})})}),s.jsx(qd,{children:L.email})]})}),L.linkedin_url&&s.jsx("span",{...lw({trainerId:L.id,trainerName:L.name,field:"linkedin",surface:"listing"}),children:s.jsxs(Kf,{children:[s.jsx(Xf,{asChild:!0,children:s.jsx(ne,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:H=>{H.stopPropagation(),j(L.id,"linkedin",L.name,L.linkedin_url)},children:s.jsx(Bu,{className:"h-4 w-4 text-[#0077B5]"})})}),s.jsx(qd,{children:"LinkedIn"})]})}),L.website_url&&s.jsx("span",{...lw({trainerId:L.id,trainerName:L.name,field:"website",surface:"listing"}),children:s.jsxs(Kf,{children:[s.jsx(Xf,{asChild:!0,children:s.jsx(ne,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:H=>{H.stopPropagation(),j(L.id,"website",L.name,L.website_url)},children:s.jsx(ap,{className:"h-4 w-4 text-primary"})})}),s.jsx(qd,{children:"Site web"})]})})]}),L.preferred_departments&&L.preferred_departments.length>0&&s.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground mb-3",children:[s.jsx(Is,{className:"h-3 w-3"}),s.jsxs("span",{children:[L.preferred_departments.slice(0,3).map(H=>dv(H)||H).join(", "),L.preferred_departments.length>3&&` +${L.preferred_departments.length-3}`]})]}),L.bio&&s.jsx("p",{className:"text-muted-foreground mb-4 text-sm line-clamp-3",children:L.bio}),s.jsxs("div",{className:"flex flex-wrap gap-2 justify-center mb-4",children:[L.specialties.slice(0,4).map((H,V)=>s.jsx(Te,{variant:"secondary",className:"text-xs",children:H},V)),L.specialties.length>4&&s.jsxs(Te,{variant:"outline",className:"text-xs",children:["+",L.specialties.length-4]})]}),s.jsx(ne,{variant:"outline",className:"w-full",onClick:()=>{N(L.id),e(`/trainers/${L.id}`)},children:"Voir le profil"})]})})},L.id))})})]})})})]})}function $gt({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(z0,{children:s.jsxs(Kf,{children:[s.jsx(Xf,{asChild:!0,children:s.jsxs(Te,{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(wi,{className:`${r[e]} mr-1`}),"NDA Vérifié"]})}),s.jsx(qd,{children:s.jsx("p",{children:"Numéro de déclaration d'activité vérifié par PedagoBridge"})})]})})}function zP(){const{id:e}=so(),t=Zt(),{user:r}=Br(),[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,x,p;if(!e){d(!0),c(!1);return}try{const[g,v,y]=await Promise.all([Wu.rpc("get_trainer_public_profile",{p_id:e}),ce.from("trainer_contracts").select("trainer_id").eq("counter_signed",!0),ce.from("trainer_documents").select("trainer_profile_id").eq("document_type","nda_proof").eq("status","verified")]);if(g.error)throw g.error;const b=new Set(((h=v.data)==null?void 0:h.map(_=>_.trainer_id))||[]),N=new Set(((x=y.data)==null?void 0:x.map(_=>_.trainer_profile_id))||[]),j=(p=g.data)==null?void 0:p.find(_=>_.id===e);j?(a({...j,isAffiliated:b.has(j.id)||!!j.manual_certified,hasVerifiedNDA:N.has(j.id)}),dn.trackProfileView(j.id,j.name)):d(!0)}catch(g){console.error("Error fetching trainer:",g),d(!0)}finally{c(!1)}})()},[e]),w.useEffect(()=>{let m=!1;return n&&r&&(n.cv_path||n.cv_url)?y5(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(it,{className:"h-8 w-8 animate-spin text-primary"})})})}):u||!n?s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx(nr,{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(Hn,{className:"h-4 w-4 mr-2"}),"Retour aux formateurs"]})]})})]}):s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx(nr,{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(b1,{name:n.name,description:n.bio||void 0,image:n.photo_url||void 0,knowsAbout:n.specialties,url:`/trainer/${e}`}),s.jsx(ms,{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(Hn,{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(je,{className:"overflow-hidden",children:s.jsx(Ee,{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(bs,{className:"w-32 h-32 ring-4 ring-background shadow-lg",children:[n.photo_url?s.jsx(ji,{src:n.photo_url,alt:n.name}):null,s.jsx(ws,{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",...lw({trainerId:n.id,trainerName:n.name,field:"name",surface:"profile"}),children:n.name}),n.isAffiliated&&s.jsx(id,{size:"lg"}),n.hasVerifiedNDA&&s.jsx($gt,{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(Te,{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:()=>dn.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(Kt,{className:"w-4 h-4 mr-2"}),"Voir le CV",s.jsx(Kn,{className:"w-3 h-3 ml-2"})]}),s.jsxs(ne,{onClick:()=>{dn.trackContactClick(n.id,n.name),t(`/training-request?from_trainer=${n.id}&trainer_name=${encodeURIComponent(n.name)}`)},children:[s.jsx(_n,{className:"h-4 w-4 mr-2"}),"Contacter pour une formation"]})]})]})]})})}),s.jsx(je,{className:"mt-6",children:s.jsx(Ee,{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 Bgt(){return s.jsxs(je,{className:"border-amber-200 bg-gradient-to-br from-amber-50/50 to-background dark:from-amber-950/20",children:[s.jsxs(mt,{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(kv,{className:"h-6 w-6 text-amber-500"}),s.jsx(gt,{className:"text-lg",children:"Boostez la visibilité de vos offres"})]}),s.jsx(Kr,{children:"Sponsorisez vos offres pour les mettre en avant auprès des formateurs"})]}),s.jsxs(Ee,{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(kv,{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(ed,{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(es,{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(Sp,{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(Mi,{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(Zn,{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(Qs,{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 zgt(){const{user:e}=Br(),[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 ce.from("school_requests").select("id").eq("user_id",e.id);if(!h||h.length===0){r([]),a(!1);return}const x=h.map(y=>y.id),{data:p,error:g}=await ce.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",x).order("created_at",{ascending:!1});if(g)throw g;const v=[];for(const y of p||[]){const{data:b}=await ce.from("trainer_applications").select("id, trainer_id").eq("id",y.trainer_application_id).single();if(!b)continue;const{data:N}=await ce.from("trainer_profiles").select("id, name, email").eq("id",b.trainer_id).single(),{data:j}=await ce.from("school_requests").select("id, school_name, description, training_needs").eq("id",y.school_request_id).single();N&&j&&v.push({...y,school_contract_url:y.school_contract_url||null,contract_data:y.contract_data,trainer_application:{id:b.id,trainer:N},school_request:j})}r(v)}catch(h){console.error("Error loading contracts:",h),ae.error("Erreur lors du chargement des contrats")}finally{a(!1)}}},d=(h,x)=>h==="signed"&&x?s.jsxs(Te,{className:"bg-green-500",children:[s.jsx(Wr,{className:"w-3 h-3 mr-1"}),"Signé"]}):h==="signed"?s.jsxs(Te,{className:"bg-blue-500",children:[s.jsx($r,{className:"w-3 h-3 mr-1"}),"En attente signature"]}):s.jsxs(Te,{variant:"secondary",children:[s.jsx($r,{className:"w-3 h-3 mr-1"}),"Brouillon"]}),f=async(h,x)=>{if(e){if(x.type!=="application/pdf"){ae.error("Seuls les fichiers PDF sont acceptés");return}if(x.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()}_${x.name}`,{data:g,error:v}=await ce.storage.from("school-attachments").upload(p,x,{upsert:!0});if(v)throw v;const{data:y}=ce.storage.from("school-attachments").getPublicUrl(p),{error:b}=await ce.from("service_contracts").update({school_contract_url:y.publicUrl}).eq("id",h);if(b)throw b;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 x=document.createElement("input");x.type="file",x.accept=".pdf",x.onchange=p=>{var v;const g=(v=p.target.files)==null?void 0:v[0];g&&f(h,g)},x.click()};return n?s.jsx("div",{className:"flex justify-center items-center py-12",children:s.jsx(it,{className:"h-8 w-8 animate-spin text-primary"})}):t.length===0?s.jsx(je,{children:s.jsxs(Ee,{className:"py-12 text-center",children:[s.jsx(Kt,{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(je,{className:"hover:shadow-md transition-shadow",children:s.jsx(Ee,{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(id,{}),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(yr,{className:"h-4 w-4"}),h.school_request.school_name]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(Hs,{className:"h-4 w-4"}),Dt(new Date(h.created_at),"d MMM yyyy",{locale:br})]})]}),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(ro,{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(it,{className:"h-4 w-4 mr-1 animate-spin"}):s.jsx(lc,{className:"h-4 w-4 mr-1"}),"Ajouter contrat"]}),s.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>o(h),children:[s.jsx(es,{className:"h-4 w-4 mr-1"}),"Voir"]})]})]})})},h.id))}),s.jsx(qn,{open:!!i,onOpenChange:()=>o(null),children:s.jsxs($n,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[s.jsxs(Un,{children:[s.jsx(Vn,{children:"Contrat de prestation"}),s.jsxs(Sa,{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:Dt(new Date(i.created_at),"d MMMM yyyy",{locale:br})})]})]}),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(Kn,{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(it,{className:"h-4 w-4 mr-1 animate-spin"}):s.jsx(lc,{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 ",Dt(new Date(i.signed_by_school_at),"d MMMM yyyy à HH:mm",{locale:br})]})]})]})]})})]})}function qgt({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&&x()},[r]),w.useEffect(()=>{const y=b=>{var N,j;((N=b.data)==null?void 0:N.type)==="linkedin-connected"&&((j=b.data)!=null&&j.success)&&(x(),ae.success("LinkedIn connecté avec succès !"))};return window.addEventListener("message",y),()=>window.removeEventListener("message",y)},[]);const x=async()=>{h(!0);try{const{data:y}=await ce.auth.getSession(),b=y==null?void 0:y.session;if(!b)return;const j=await(await fetch("https://pedagobridge.com/functions/v1/user-linkedin-oauth?action=status",{headers:{Authorization:`Bearer ${b.access_token}`}})).json();u(j.connected),f(j.profile)}catch(y){console.error("Error checking LinkedIn connection:",y)}finally{h(!1)}},p=async()=>{try{const{data:y}=await ce.auth.getSession(),b=y==null?void 0:y.session;if(!b){ae.error("Veuillez vous connecter");return}const j=await(await fetch("https://pedagobridge.com/functions/v1/user-linkedin-oauth?action=authorize",{headers:{Authorization:`Bearer ${b.access_token}`}})).json();j.authUrl&&window.open(j.authUrl,"_blank","width=600,height=700")}catch(y){console.error("Error connecting LinkedIn:",y),ae.error("Erreur lors de la connexion LinkedIn")}},g=async()=>{try{const{data:y}=await ce.auth.getSession(),b=y==null?void 0:y.session;if(!b)return;await fetch("https://pedagobridge.com/functions/v1/user-linkedin-oauth?action=disconnect",{method:"POST",headers:{Authorization:`Bearer ${b.access_token}`}}),u(!1),f(null),ae.success("LinkedIn déconnecté")}catch(y){console.error("Error disconnecting LinkedIn:",y)}},v=async()=>{if(!a.trim()){ae.error("Veuillez coller le texte du post LinkedIn");return}l(!0);try{const{data:y}=await ce.auth.getSession(),b=y==null?void 0:y.session;if(!b){ae.error("Session expirée");return}const N=await fetch("https://pedagobridge.com/functions/v1/extract-offer-from-linkedin",{method:"POST",headers:{Authorization:`Bearer ${b.access_token}`,"Content-Type":"application/json"},body:JSON.stringify({postText:a})});if(!N.ok){const _=await N.json();throw new Error(_.error||"Erreur lors de l'extraction")}const j=await N.json();j.offer?(e(j.offer),n(!1),i(""),ae.success("Informations extraites avec succès !")):ae.error("Impossible d'extraire les informations du post")}catch(y){console.error("Error extracting offer:",y),ae.error(y instanceof Error?y.message:"Erreur lors de l'extraction")}finally{l(!1)}};return s.jsxs(qn,{open:r,onOpenChange:n,children:[s.jsx(Xo,{asChild:!0,children:t||s.jsxs(ne,{variant:"outline",className:"gap-2",children:[s.jsx(Bu,{className:"h-4 w-4 text-[#0077B5]"}),"Importer depuis LinkedIn"]})}),s.jsxs($n,{className:"sm:max-w-lg",children:[s.jsxs(Un,{children:[s.jsxs(Vn,{className:"flex items-center gap-2",children:[s.jsx(Bu,{className:"h-5 w-5 text-[#0077B5]"}),"Importer depuis LinkedIn"]}),s.jsx(Sa,{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(it,{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(fy,{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(Te,{variant:"secondary",className:"text-xs",children:"LinkedIn connecté"})]})]}):s.jsxs(s.Fragment,{children:[s.jsx(Bu,{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?g: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:y=>i(y.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(it,{className:"mr-2 h-4 w-4 animate-spin"}),"Analyse en cours..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Mi,{className:"mr-2 h-4 w-4"}),"Extraire les informations"]})})]})]})]})}function Ugt({hasProfile:e,hasOffers:t,hasApplications:r}){const n=Zt(),a=[{done:e,icon:yr,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:Kt,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:er,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(je,{className:"border-primary/20 bg-gradient-to-br from-primary/5 to-transparent mb-6",children:[s.jsxs(mt,{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(Mi,{className:"h-5 w-5 text-primary"}),s.jsx(gt,{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(Ee,{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(DR,{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(Zr,{className:"ml-1 h-3 w-3"})]})]},l)})})]})}function oX(){const{user:e,isSchool:t}=Br(),r=Zt(),[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,x]=w.useState(null),[p,g]=w.useState(!1),[v,y]=w.useState(null),{canPublish:b,publicationCount:N,remainingFree:j,pricePerPublication:_,freeLimit:S}=Qle();w.useEffect(()=>{if(!e){r("/auth?role=school");return}P()},[e,r]);const P=async()=>{if(e){o(!0);try{const{data:A}=await ce.from("school_profiles").select("*").eq("user_id",e.id).single();y(A);const{data:I,error:U}=await ce.from("school_requests").select("*").eq("user_id",e.id).order("created_at",{ascending:!1});if(U)throw U;const{data:Y,error:te}=await ce.from("school_requests").select("*").is("user_id",null).eq("contact_email",e.email).order("created_at",{ascending:!1});if(te)throw te;const J=[...I||[],...Y||[]].filter((he,se,oe)=>se===oe.findIndex(le=>le.id===he.id));a(J);const ie=new Date;ie.setHours(0,0,0,0);const be=J.length||0,Q=J.filter(he=>{if(he.status!=="approved"||he.is_filled)return!1;if(!he.end_date)return!0;const se=new Date(he.end_date);return se.setHours(23,59,59,999),se>=ie}).length||0,Ve=J.filter(he=>he.status==="pending").length||0,W=J.reduce((he,se)=>he+(se.view_count||0),0)||0,{count:Z}=await ce.from("offer_messages").select("*",{count:"exact",head:!0}).eq("recipient_id",e.id).eq("is_read",!1);c({totalOffers:be,activeOffers:Q,totalViews:W,pendingOffers:Ve,unreadMessages:Z||0})}catch(A){console.error("Error loading data:",A),ae.error("Erreur lors du chargement des données")}finally{o(!1)}}},T=async A=>{try{const{error:I}=await ce.from("school_requests").update({user_id:e==null?void 0:e.id}).eq("id",A).is("user_id",null);if(I)throw I;ae.success("Offre associée à votre compte !"),P()}catch(I){console.error("Error claiming offer:",I),ae.error("Erreur lors de l'association de l'offre")}},R=async A=>{try{const{error:I}=await ce.from("school_requests").delete().eq("id",A).eq("user_id",e==null?void 0:e.id);if(I)throw I;ae.success("Annonce supprimée"),P()}catch(I){console.error("Error deleting request:",I),ae.error("Erreur lors de la suppression")}},k=async A=>{try{const{error:I}=await ce.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(I)throw I;dn.trackOfferFilled(A),ae.success("Offre marquée comme pourvue"),P()}catch(I){console.error("Error marking as filled:",I),ae.error("Erreur lors de la mise à jour")}},E=async A=>{try{const{error:I}=await ce.from("school_requests").update({status:"archived"}).eq("id",A).eq("user_id",e==null?void 0:e.id);if(I)throw I;ae.success("Offre archivée avec succès"),P()}catch(I){console.error("Error archiving offer:",I),ae.error("Erreur lors de l'archivage")}},q=async A=>{if(e)try{const{data:I,error:U}=await ce.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."),P()}catch(I){console.error("Error duplicating offer:",I),ae.error("Erreur lors de la duplication de l'offre")}},O=()=>{try{const A=["École","Description","Domaines","Date début","Date fin","Statut","Vues","Candidatures","Pourvue","Sponsorisée","Date création"],I=C.map(J=>[J.school_name,J.description.replace(/"/g,'""').replace(/\n/g," "),J.subject_areas.join("; "),J.start_date?Dt(new Date(J.start_date),"dd/MM/yyyy"):"",J.end_date?Dt(new Date(J.end_date),"dd/MM/yyyy"):"",J.status,J.view_count||0,J.application_count||0,J.is_filled?"Oui":"Non",V(J)?"Oui":"Non",Dt(new Date(J.created_at),"dd/MM/yyyy HH:mm",{locale:br})]),U=[A.map(J=>`"${J}"`).join(","),...I.map(J=>J.map(ie=>`"${ie}"`).join(","))].join(`
`),Y=new Blob(["\uFEFF"+U],{type:"text/csv;charset=utf-8;"}),te=document.createElement("a"),re=URL.createObjectURL(Y);te.setAttribute("href",re),te.setAttribute("download",`offres_${u}_${Dt(new Date,"yyyy-MM-dd")}.csv`),te.style.visibility="hidden",document.body.appendChild(te),te.click(),document.body.removeChild(te),ae.success("Export CSV réussi !")}catch(A){console.error("Error exporting to CSV:",A),ae.error("Erreur lors de l'export CSV")}},L=()=>{try{const A=new lr,I=A.internal.pageSize.getWidth(),U=A.internal.pageSize.getHeight(),Y=15;let te=Y;A.setFontSize(18),A.setFont("helvetica","bold"),A.text("Mes Offres de Formation",Y,te),te+=10,A.setFontSize(10),A.setFont("helvetica","normal");const re={active:"Actives",pending:"En attente",history:"Historique"};A.text(`${re[u]||u} - Exporté le ${Dt(new Date,"dd/MM/yyyy à HH:mm",{locale:br})}`,Y,te),te+=15,C.forEach((J,ie)=>{te>U-50&&(A.addPage(),te=Y),A.setFontSize(12),A.setFont("helvetica","bold"),A.text(`${ie+1}. ${J.school_name}`,Y,te),te+=7,A.setFontSize(9),A.setFont("helvetica","normal");const be=`Statut: ${J.status}${J.is_filled?" (Pourvue)":""}${V(J)?" (Sponsorisée)":""}`;A.text(be,Y+5,te),te+=5;const Q=J.description.substring(0,150)+(J.description.length>150?"...":""),Ve=A.splitTextToSize(Q,I-Y*2-5);if(A.text(Ve,Y+5,te),te+=Ve.length*5,J.subject_areas.length>0&&(A.text(`Domaines: ${J.subject_areas.slice(0,3).join(", ")}${J.subject_areas.length>3?"...":""}`,Y+5,te),te+=5),J.start_date){const W=`Période: ${Dt(new Date(J.start_date),"dd/MM/yyyy")}${J.end_date?` - ${Dt(new Date(J.end_date),"dd/MM/yyyy")}`:""}`;A.text(W,Y+5,te),te+=5}A.text(`Vues: ${J.view_count||0} | Candidatures: ${J.application_count||0}`,Y+5,te),te+=10}),A.save(`offres_${u}_${Dt(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:I,error:U}=await ce.functions.invoke("sponsor-offer",{body:{offerId:A}});if(U)throw U;I!=null&&I.url&&window.open(I.url,"_blank")}catch(I){console.error("Error sponsoring offer:",I),ae.error("Erreur lors de la création du paiement")}};w.useEffect(()=>{const I=new URLSearchParams(window.location.search).get("sponsored");I&&(ce.functions.invoke("verify-sponsorship",{body:{offerId:I}}).then(({error:U})=>{U||(ae.success("Votre offre est maintenant sponsorisée pour 30 jours !"),P())}),window.history.replaceState({},"","/school/dashboard"))},[]);const V=A=>!A.is_sponsored||!A.sponsored_until?!1:new Date(A.sponsored_until)>new Date,z=A=>{if(!A.end_date)return!1;const I=new Date;I.setHours(0,0,0,0);const U=new Date(A.end_date);return U.setHours(23,59,59,999),U<I},M=async A=>{if(h){g(!0);try{if(!n.find(U=>U.id===A))throw new Error("Offre cible non trouvée");await ce.from("school_requests").update({status:"archived",is_sponsored:!1,sponsored_at:null,sponsored_until:null}).eq("id",h.id),await ce.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),x(null),P()}catch(I){console.error("Error swapping sponsorship:",I),ae.error("Erreur lors du transfert du sponsoring")}finally{g(!1)}}},B=()=>n.filter(A=>A.status==="approved"&&!A.is_filled&&!V(A)&&A.id!==(h==null?void 0:h.id)),K=A=>{if(A.is_filled)return s.jsxs(Te,{className:"bg-green-600",children:[s.jsx(Wr,{className:"w-3 h-3 mr-1"}),"Pourvue"]});switch(A.status){case"approved":return s.jsxs(Te,{className:"bg-green-500",children:[s.jsx(Wr,{className:"w-3 h-3 mr-1"}),"Publiée"]});case"pending":return s.jsxs(Te,{variant:"secondary",children:[s.jsx($r,{className:"w-3 h-3 mr-1"}),"En attente"]});case"rejected":return s.jsxs(Te,{variant:"destructive",children:[s.jsx(vs,{className:"w-3 h-3 mr-1"}),"Refusée"]});case"archived":return s.jsx(Te,{variant:"outline",children:"Archivée"});default:return s.jsx(Te,{variant:"outline",children:A.status})}},C=n.filter(A=>{const I=z(A);return u==="active"?A.status==="approved"&&!A.is_filled&&!I:u==="pending"?A.status==="pending":u==="history"?["rejected","archived"].includes(A.status)||A.is_filled||A.status==="approved"&&I:!0});return i?s.jsx(ba,{children:s.jsx("div",{className:"container mx-auto px-4 py-8 flex justify-center items-center min-h-[400px]",children:s.jsx(it,{className:"h-8 w-8 animate-spin text-primary"})})}):s.jsxs(ba,{children:[s.jsx(nr,{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(yr,{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(er,{className:"mr-2 h-4 w-4"}),"Candidatures"]}),s.jsxs(ne,{variant:"outline",onClick:()=>r("/school/messages"),children:[s.jsx(Fi,{className:"mr-2 h-4 w-4"}),"Messages",l.unreadMessages>0&&s.jsx(Te,{variant:"destructive",className:"ml-2",children:l.unreadMessages})]}),s.jsx(qgt,{onImport:A=>{sessionStorage.setItem("linkedInOfferData",JSON.stringify(A)),r("/training-request?source=linkedin")}}),s.jsxs(ne,{onClick:()=>r("/training-request"),disabled:!b,children:[s.jsx(Qa,{className:"mr-2 h-4 w-4"}),"Nouvelle offre"]})]})]}),!b&&s.jsx("div",{className:"mb-6",children:s.jsx(ece,{publicationCount:N,pricePerPublication:_})}),b&&j>0&&N>0&&s.jsx(je,{className:"mb-6 border-primary/20 bg-primary/5",children:s.jsx(Ee,{className:"py-4",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Li,{className:"h-5 w-5 text-primary"}),s.jsxs("p",{className:"text-sm",children:[s.jsxs("span",{className:"font-medium",children:[j," publication",j>1?"s":""," gratuite",j>1?"s":""," restante",j>1?"s":""]})," ","sur ",S,". Au-delà, chaque publication coûte ",_,"€."]})]})})}),s.jsx(Ugt,{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(je,{className:"mb-6 border-primary/20",children:[s.jsxs(mt,{className:"flex flex-row items-center justify-between",children:[s.jsxs(gt,{className:"flex items-center gap-2",children:[s.jsx(yr,{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(Ee,{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(u5,{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(Te,{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($r,{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(je,{children:s.jsx(Ee,{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(je,{children:s.jsx(Ee,{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($r,{className:"h-8 w-8 text-yellow-500 opacity-80"})]})})}),s.jsx(je,{children:s.jsx(Ee,{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(es,{className:"h-8 w-8 text-primary opacity-80"})]})})}),s.jsx(je,{children:s.jsx(Ee,{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(Fi,{className:"h-8 w-8 text-blue-500 opacity-80"})]})})})]}),s.jsx("div",{className:"mb-8",children:s.jsx(Bgt,{})}),s.jsxs(je,{children:[s.jsx(mt,{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(gt,{className:"flex items-center gap-2",children:[s.jsx(n1,{className:"h-5 w-5"}),"Mes Offres de Formation"]}),s.jsx(Kr,{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:O,disabled:C.length===0,children:[s.jsx(ro,{className:"h-4 w-4 mr-2"}),"Export CSV"]}),s.jsxs(ne,{variant:"outline",size:"sm",onClick:L,disabled:C.length===0,children:[s.jsx(Kt,{className:"h-4 w-4 mr-2"}),"Export PDF"]})]})]})}),s.jsx(Ee,{children:s.jsxs(uf,{value:u,onValueChange:d,children:[s.jsxs(fd,{className:"mb-6",children:[s.jsxs(Mn,{value:"active",children:["Actives (",n.filter(A=>A.status==="approved"&&!A.is_filled&&!z(A)).length,")"]}),s.jsxs(Mn,{value:"pending",children:["En attente (",n.filter(A=>A.status==="pending").length,")"]}),s.jsxs(Mn,{value:"history",children:["Historique (",n.filter(A=>["rejected","archived"].includes(A.status)||A.is_filled||A.status==="approved"&&z(A)).length,")"]}),s.jsxs(Mn,{value:"contracts",children:[s.jsx(Kt,{className:"h-4 w-4 mr-1"}),"Contrats"]})]}),s.jsx(Os,{value:u,children:C.length===0?s.jsxs("div",{className:"text-center py-12",children:[s.jsx(yr,{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(Qa,{className:"mr-2 h-4 w-4"}),"Créer une offre"]})]}):s.jsx("div",{className:"space-y-4",children:C.map(A=>s.jsx(je,{className:`hover:shadow-md transition-shadow ${V(A)?"ring-2 ring-amber-400 bg-amber-50/50 dark:bg-amber-950/20":""}`,children:s.jsx(Ee,{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(Te,{variant:"outline",className:"border-blue-300 text-blue-600 bg-blue-50 dark:bg-blue-950/30",children:[s.jsx(u5,{className:"w-3 h-3 mr-1"}),"Non associée"]}),z(A)&&A.status==="approved"&&!A.is_filled&&s.jsxs(Te,{variant:"destructive",className:"bg-red-500",children:[s.jsx($r,{className:"w-3 h-3 mr-1"}),"Expirée"]}),V(A)&&s.jsxs(Te,{className:"bg-amber-500 text-white",title:`Expire le ${Dt(new Date(A.sponsored_until),"dd MMM yyyy",{locale:br})}`,children:[s.jsx(kv,{className:"w-3 h-3 mr-1"}),"Sponsorisée jusqu'au ",Dt(new Date(A.sponsored_until),"dd/MM",{locale:br})]})]}),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(Hs,{className:"h-4 w-4"}),Dt(new Date(A.start_date),"dd MMM yyyy",{locale:br}),A.end_date&&` - ${Dt(new Date(A.end_date),"dd MMM yyyy",{locale:br})}`]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(es,{className:"h-4 w-4"}),A.view_count||0," vues"]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(er,{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((I,U)=>s.jsx(Te,{variant:"outline",className:"text-xs",children:I},U)),A.subject_areas.length>3&&s.jsxs(Te,{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:()=>T(A.id),children:[s.jsx(u5,{className:"h-4 w-4 mr-1"}),"Associer à mon compte"]}),A.status==="approved"&&!A.is_filled&&!V(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(kv,{className:"h-4 w-4 mr-1"}),"Sponsoriser (49€)"]}),A.status==="approved"&&!A.is_filled&&V(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(kv,{className:"h-4 w-4 mr-1"}),"Prolonger (49€)"]}),A.status==="approved"&&!A.is_filled&&s.jsxs(Gu,{children:[s.jsx(th,{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(Kc,{children:[s.jsxs(Xc,{children:[s.jsx(Zc,{children:"Marquer comme pourvue ?"}),s.jsx(Jc,{children:"Cette offre sera archivée et marquée comme pourvue. Confirmez-vous avoir trouvé un formateur ?"})]}),s.jsxs(Yc,{children:[s.jsx(Ku,{children:"Annuler"}),s.jsx(Qc,{onClick:()=>k(A.id),children:"Confirmer"})]})]})]}),A.status==="approved"&&!A.is_filled&&V(A)&&s.jsxs(ne,{variant:"outline",size:"sm",className:"text-amber-600 border-amber-300",onClick:()=>{x(A),m(!0)},children:[s.jsx(Qs,{className:"h-4 w-4 mr-1"}),"Transférer"]}),A.status==="approved"&&!A.is_filled&&V(A)&&s.jsxs(Gu,{children:[s.jsx(th,{asChild:!0,children:s.jsxs(ne,{variant:"outline",size:"sm",children:[s.jsx(AQ,{className:"h-4 w-4 mr-1"}),"Archiver"]})}),s.jsxs(Kc,{children:[s.jsxs(Xc,{children:[s.jsx(Zc,{children:"Archiver cette offre sponsorisée ?"}),s.jsx(Jc,{children:"Cette offre sponsorisée sera archivée. Vous pouvez transférer le sponsoring à une autre offre avant d'archiver."})]}),s.jsxs(Yc,{children:[s.jsx(Ku,{children:"Annuler"}),s.jsx(Qc,{onClick:()=>E(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(MQ,{className:"h-4 w-4"})}),s.jsx(ne,{variant:"outline",size:"sm",onClick:()=>q(A),title:"Dupliquer cette offre",children:s.jsx(uy,{className:"h-4 w-4"})}),s.jsxs(Gu,{children:[s.jsx(th,{asChild:!0,children:s.jsx(ne,{variant:"outline",size:"sm",className:"text-destructive",children:s.jsx(ri,{className:"h-4 w-4"})})}),s.jsxs(Kc,{children:[s.jsxs(Xc,{children:[s.jsx(Zc,{children:"Supprimer cette offre ?"}),s.jsx(Jc,{children:"Cette action est irréversible. L'offre sera définitivement supprimée."})]}),s.jsxs(Yc,{children:[s.jsx(Ku,{children:"Annuler"}),s.jsx(Qc,{onClick:()=>R(A.id),children:"Supprimer"})]})]})]})]})]})})},A.id))})}),s.jsx(Os,{value:"contracts",children:s.jsx(zgt,{})})]})})]}),s.jsx(qn,{open:f,onOpenChange:m,children:s.jsxs($n,{children:[s.jsxs(Un,{children:[s.jsx(Vn,{children:"Transférer le sponsoring"}),s.jsx(Sa,{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:B().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."}):B().map(A=>s.jsx(je,{className:"cursor-pointer hover:border-primary transition-colors",onClick:()=>M(A.id),children:s.jsx(Ee,{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(it,{className:"h-4 w-4 animate-spin"}):s.jsx(Qs,{className:"h-4 w-4 text-muted-foreground"})]})})},A.id))})]})})]})]})}function Vgt(){const{user:e}=Br(),t=Zt(),[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:g,error:v}=await ce.from("school_profiles").select("*").eq("user_id",e.id).single();if(v)throw v;u(g),f({name:g.name||"",description:g.description||"",website_url:g.website_url||"",contact_name:g.contact_name||"",contact_email:g.contact_email||"",contact_phone:g.contact_phone||"",address:g.address||""})}catch(g){console.error("Error loading profile:",g),ae.error("Erreur lors du chargement du profil")}finally{n(!1)}},h=async g=>{if(!(!g||!c)){if(!g.type.startsWith("image/")){ae.error("Veuillez sélectionner une image");return}if(g.size>2*1024*1024){ae.error("L'image ne doit pas dépasser 2 Mo");return}l(!0);try{const v=g.name.split(".").pop(),y=`school-logos/${c.id}-${Date.now()}.${v}`,{error:b}=await ce.storage.from("trainer-files").upload(y,g,{upsert:!0});if(b)throw b;const{data:N}=ce.storage.from("trainer-files").getPublicUrl(y),{error:j}=await ce.from("school_profiles").update({logo_url:N.publicUrl}).eq("id",c.id);if(j)throw j;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)}}},x=async g=>{if(g.preventDefault(),!!c){i(!0);try{const{error:v}=await ce.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=g=>g.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(it,{className:"h-8 w-8 animate-spin text-primary"})}):c?s.jsxs(s.Fragment,{children:[s.jsx(nr,{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(Hn,{className:"w-4 h-4 mr-2"}),"Retour au tableau de bord"]})}),s.jsxs(je,{children:[s.jsxs(mt,{children:[s.jsxs(gt,{className:"text-3xl flex items-center gap-3",children:[s.jsx(yr,{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(Ee,{children:s.jsxs("form",{onSubmit:x,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(bs,{className:"w-32 h-32",children:[c.logo_url?s.jsx(ji,{src:c.logo_url,alt:c.name,className:"object-contain"}):null,s.jsx(ws,{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(lc,{className:"w-4 h-4"}),o?"Upload en cours...":"Changer le logo"]})}),s.jsx(Xe,{id:"logo-upload",type:"file",accept:"image/*",disabled:o,onChange:g=>{var y;const v=(y=g.target.files)==null?void 0:y[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(Xe,{id:"name",value:d.name,onChange:g=>f({...d,name:g.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:g=>f({...d,description:g.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(Xe,{id:"contact_name",value:d.contact_name,onChange:g=>f({...d,contact_name:g.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(Xe,{id:"contact_email",type:"email",value:d.contact_email,onChange:g=>f({...d,contact_email:g.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(Xe,{id:"contact_phone",type:"tel",value:d.contact_phone,onChange:g=>f({...d,contact_phone:g.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(Xe,{id:"website_url",type:"url",value:d.website_url,onChange:g=>f({...d,website_url:g.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:g=>f({...d,address:g.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(it,{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 Hgt(){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 ce.auth.getUser();if(!u){t(!1),n(!1);return}const{data:d,error:f}=await ce.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 ce.auth.getUser();if(!d)throw new Error("User not authenticated");const{error:f}=await ce.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 Wgt=`
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 Ggt({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 y=v.getContext("2d");y&&(y.fillStyle="#ffffff",y.fillRect(0,0,v.width,v.height),y.strokeStyle="#1f2937",y.lineWidth=2,y.lineCap="round",y.lineJoin="round")},[]);const f=v=>{const y=r.current;if(!y)return{x:0,y:0};const b=y.getBoundingClientRect(),N=y.width/b.width,j=y.height/b.height;return{x:(v.clientX-b.left)*N,y:(v.clientY-b.top)*j}},m=v=>{const y=r.current,b=y==null?void 0:y.getContext("2d");if(!b)return;a(!0);const{x:N,y:j}=f(v);b.beginPath(),b.moveTo(N,j)},h=v=>{if(!n)return;const y=r.current,b=y==null?void 0:y.getContext("2d");if(!b)return;const{x:N,y:j}=f(v);b.lineTo(N,j),b.stroke(),c(!0)},x=()=>{a(!1)},p=()=>{const v=r.current,y=v==null?void 0:v.getContext("2d");!y||!v||(y.fillStyle="#ffffff",y.fillRect(0,0,v.width,v.height),c(!1))},g=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 y=v.toDataURL("image/png");(await e(y)).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(je,{className:"max-w-4xl mx-auto",children:[s.jsxs(mt,{children:[s.jsxs(gt,{className:"flex items-center gap-2",children:[s.jsx(Jo,{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(Ee,{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(td,{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(Kt,{className:"h-4 w-4"}),s.jsx("span",{className:"font-medium text-sm",children:"Contenu du NDA"})]}),s.jsx(su,{className:"h-64 p-4",children:s.jsx("pre",{className:"whitespace-pre-wrap text-sm font-sans",children:Wgt})})]}),s.jsxs("div",{className:"flex items-start space-x-2",children:[s.jsx(Yo,{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:x,onPointerLeave:x})}),s.jsx(ne,{variant:"outline",size:"sm",onClick:p,type:"button",children:"Effacer la signature"})]}),s.jsx(ne,{onClick:g,disabled:!i||!l||u||t,className:"w-full",children:u?"Signature en cours...":"Signer le NDA"})]})]})}function whe({children:e}){const{hasSignedNDA:t,loading:r,signNDA:n}=Hgt();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(Ggt,{onSign:n,loading:r})})}function Kgt(){const{user:e}=Br(),t=Zt(),[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),x=w.useRef(null);w.useEffect(()=>{if(!e){t("/auth?role=school");return}p()},[e,t]),w.useEffect(()=>{var b;(b=x.current)==null||b.scrollIntoView({behavior:"smooth"})},[o]);const p=async()=>{var b;if(e){f(!0);try{const{data:N,error:j}=await ce.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 _=new Map;for(const S of N||[]){const P=S.sender_id===e.id?S.recipient_id:S.sender_id,T=`${S.school_request_id}-${P}`;if(!_.has(T))_.set(T,{id:T,school_request_id:S.school_request_id,other_user_id:P,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:((b=S.school_requests)==null?void 0:b.school_name)||"Offre"});else if(S.recipient_id===e.id&&!S.is_read){const R=_.get(T);R.unread_count++}}n(Array.from(_.values()))}catch(N){console.error("Error loading conversations:",N),ae.error("Erreur lors du chargement des messages")}finally{f(!1)}}},g=async b=>{if(e)try{const{data:N,error:j}=await ce.from("offer_messages").select("*").eq("school_request_id",b.school_request_id).or(`sender_id.eq.${b.other_user_id},recipient_id.eq.${b.other_user_id}`).order("created_at",{ascending:!0});if(j)throw j;l(N||[]),await ce.from("offer_messages").update({is_read:!0}).eq("school_request_id",b.school_request_id).eq("recipient_id",e.id).eq("sender_id",b.other_user_id),n(_=>_.map(S=>S.id===b.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:b}=await ce.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(b)throw b;u(""),await g(a)}catch(b){console.error("Error sending message:",b),ae.error("Erreur lors de l'envoi du message")}finally{h(!1)}}},y=b=>b.split(" ").map(N=>N[0]).join("").toUpperCase().slice(0,2);return d?s.jsx(ba,{children:s.jsx("div",{className:"container mx-auto px-4 py-8 flex justify-center items-center min-h-[400px]",children:s.jsx(it,{className:"h-8 w-8 animate-spin text-primary"})})}):s.jsx(ba,{children:s.jsx(whe,{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(Hn,{className:"h-4 w-4 mr-2"}),"Retour"]}),s.jsxs("h1",{className:"text-2xl font-bold flex items-center gap-2",children:[s.jsx(Fi,{className:"h-6 w-6"}),"Messages"]})]}),s.jsxs("div",{className:"grid md:grid-cols-3 gap-6 h-[600px]",children:[s.jsxs(je,{className:"md:col-span-1",children:[s.jsx(mt,{className:"pb-3",children:s.jsx(gt,{className:"text-lg",children:"Conversations"})}),s.jsx(Ee,{className:"p-0",children:s.jsx(su,{className:"h-[500px]",children:r.length===0?s.jsxs("div",{className:"p-6 text-center text-muted-foreground",children:[s.jsx(Fi,{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(b=>s.jsx("button",{onClick:()=>{i(b),g(b)},className:`w-full p-4 text-left hover:bg-muted/50 transition-colors ${(a==null?void 0:a.id)===b.id?"bg-muted":""}`,children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(bs,{className:"h-10 w-10",children:s.jsx(ws,{children:y(b.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:b.offer_title}),b.unread_count>0&&s.jsx(Te,{variant:"destructive",className:"ml-2",children:b.unread_count})]}),s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:b.last_message}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:Dt(new Date(b.last_message_at),"dd MMM HH:mm",{locale:br})})]})]})},b.id))})})})]}),s.jsx(je,{className:"md:col-span-2 flex flex-col",children:a?s.jsxs(s.Fragment,{children:[s.jsx(mt,{className:"pb-3 border-b",children:s.jsx(gt,{className:"text-lg",children:a.offer_title})}),s.jsxs(Ee,{className:"flex-1 flex flex-col p-0",children:[s.jsx(su,{className:"flex-1 p-4",children:s.jsxs("div",{className:"space-y-4",children:[o.map(b=>s.jsx("div",{className:`flex ${b.sender_id===(e==null?void 0:e.id)?"justify-end":"justify-start"}`,children:s.jsxs("div",{className:`max-w-[70%] rounded-lg p-3 ${b.sender_id===(e==null?void 0:e.id)?"bg-primary text-primary-foreground":"bg-muted"}`,children:[s.jsx("p",{className:"text-sm",children:b.content}),s.jsxs("div",{className:"flex items-center justify-end gap-1 mt-1",children:[s.jsx("span",{className:"text-xs opacity-70",children:Dt(new Date(b.created_at),"HH:mm",{locale:br})}),b.sender_id===(e==null?void 0:e.id)&&(b.is_read?s.jsx(PQ,{className:"h-3 w-3 opacity-70"}):s.jsx(Rn,{className:"h-3 w-3 opacity-70"}))]})]})},b.id)),s.jsx("div",{ref:x})]})}),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:b=>u(b.target.value),className:"min-h-[60px] resize-none",onKeyDown:b=>{b.key==="Enter"&&!b.shiftKey&&(b.preventDefault(),v())}}),s.jsx(ne,{onClick:v,disabled:!c.trim()||m,size:"icon",className:"h-auto",children:m?s.jsx(it,{className:"h-4 w-4 animate-spin"}):s.jsx(Js,{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(Fi,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),s.jsx("p",{children:"Sélectionnez une conversation"})]})})})]})]})})})}const Xgt=[{icon:er,text:"Accès à des centaines de formateurs experts vérifiés"},{icon:Wr,text:"Publication d'offres de formation gratuite et illimitée"},{icon:wi,text:"Formateurs certifiés, diplômes et références contrôlés"},{icon:$r,text:"Première candidature reçue en moyenne sous 24h"},{icon:wC,text:"Remplacement d'urgence sous 48h"}],Ygt=G0({name:yn().min(2,"Le nom doit contenir au moins 2 caractères"),email:yn().email("Email invalide"),password:yn().min(6,"Le mot de passe doit contenir au moins 6 caractères"),confirmPassword:yn(),website:yn().url("URL invalide").optional().or(zPe("")),description:yn().max(500,"Maximum 500 caractères").optional(),contactPhone:yn().optional(),address:yn().optional()}).refine(e=>e.password===e.confirmPassword,{message:"Les mots de passe ne correspondent pas",path:["confirmPassword"]}),Zgt={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 qP(){const e=Zt(),[t]=Jj(),[r,n]=w.useState(!1),[a,i]=w.useState(!1),[o,l]=w.useState(!1),[c,u]=w.useState({name:"",email:"",password:"",confirmPassword:"",website:"",description:"",contactPhone:"",address:""}),[d,f]=w.useState(!1),[m,h]=w.useState(!1);w.useEffect(()=>{const j=t.get("email");j&&u(_=>({..._,email:j}))},[t]);const{getFieldError:x,validateAll:p,handleBlur:g,clearFieldError:v}=YL({schema:Ygt,fieldLabels:Zgt}),y=j=>{const{name:_,value:S}=j.target;u(P=>({...P,[_]:S})),v(_)},b=j=>{g(j,c[j],c)},N=async j=>{if(j.preventDefault(),!d||!m){ae.error("Veuillez accepter les CGU et la politique de confidentialité");return}if(!p(c)){ae.error("Veuillez corriger les champs en erreur");return}n(!0);try{const{data:_,error:S}=await ce.auth.signUp({email:c.email,password:c.password,options:{emailRedirectTo:`${window.location.origin}/school/dashboard`}});if(S)throw S;if(!_.user)throw new Error("Erreur lors de la création du compte");const{error:P}=await ce.from("user_roles").insert({user_id:_.user.id,role:"school"});if(P)throw P;const{error:T}=await ce.from("school_profiles").insert({user_id:_.user.id,name:c.name,contact_email:c.email,website_url:c.website||null,description:c.description||null,contact_phone:c.contactPhone||null,address:c.address||null,is_verified:!1});if(T)throw T;dn.trackSignup("school");try{await ce.functions.invoke("notify-school-signup",{body:{schoolName:c.name,contactEmail:c.email,websiteUrl:c.website||void 0,contactPhone:c.contactPhone||void 0}})}catch(R){console.error("Error sending notification email:",R)}i(!0),l(!_.session),ae.success("Compte créé avec succès !"),ae.info("Votre établissement sera vérifié par notre équipe sous 48h",{duration:5e3}),_.session&&setTimeout(()=>{e("/school/dashboard")},2e3)}catch(_){console.error("Registration error:",_),_.message.includes("already registered")?ae.error("Cet email est déjà utilisé"):ae.error(_.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(je,{className:"w-full max-w-md text-center",children:s.jsxs(Ee,{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éé !"}),o?s.jsxs(s.Fragment,{children:[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:c.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.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:"Votre compte est actif"}),s.jsx("p",{children:"Vous allez être redirigé vers votre tableau de bord. Votre établissement sera vérifié par notre équipe sous 48h — vous recevrez un email dès que c'est fait."})]}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Vous pouvez dès maintenant publier votre première offre de formation."}),s.jsx(ne,{onClick:()=>e("/school/dashboard"),className:"w-full",children:"Accéder à mon tableau de bord"})]})]})})}):s.jsxs(s.Fragment,{children:[s.jsx(nr,{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(Hn,{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:Xgt.map(j=>{const _=j.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(_,{className:"h-4 w-4 text-primary"})}),s.jsx("span",{className:"text-sm",children:j.text})]},j.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(je,{children:[s.jsxs(mt,{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(yr,{className:"h-6 w-6 text-primary"})}),s.jsx(gt,{className:"text-2xl",children:"Créer un compte Établissement"}),s.jsx(Kr,{children:"Inscription gratuite — Accès immédiat à votre espace"})]}),s.jsx(Ee,{children:s.jsxs("form",{onSubmit:N,className:"space-y-4",children:[s.jsx(Yi,{id:"name",name:"name",label:"Nom de l'établissement",placeholder:"Ex: École Supérieure du Digital",value:c.name,onChange:y,onFieldBlur:()=>b("name"),required:!0,error:x("name")}),s.jsx(Yi,{id:"email",name:"email",type:"email",label:"Email professionnel",placeholder:"contact@etablissement.fr",value:c.email,onChange:y,onFieldBlur:()=>b("email"),required:!0,error:x("email")}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(Yi,{id:"password",name:"password",type:"password",label:"Mot de passe",placeholder:"••••••",value:c.password,onChange:y,onFieldBlur:()=>b("password"),required:!0,error:x("password")}),s.jsx(Yi,{id:"confirmPassword",name:"confirmPassword",type:"password",label:"Confirmer",placeholder:"••••••",value:c.confirmPassword,onChange:y,onFieldBlur:()=>b("confirmPassword"),required:!0,error:x("confirmPassword")})]}),s.jsx(Yi,{id:"website",name:"website",type:"url",label:"Site web",placeholder:"https://www.etablissement.fr",value:c.website,onChange:y,onFieldBlur:()=>b("website"),error:x("website")}),s.jsx(Yi,{id:"contactPhone",name:"contactPhone",type:"tel",label:"Téléphone",placeholder:"01 23 45 67 89",value:c.contactPhone,onChange:y,onFieldBlur:()=>b("contactPhone"),error:x("contactPhone")}),s.jsx(Yi,{id:"address",name:"address",label:"Adresse",placeholder:"123 rue de la Formation, 75001 Paris",value:c.address,onChange:y,onFieldBlur:()=>b("address"),error:x("address")}),s.jsx(sE,{id:"description",name:"description",label:"Description (optionnel)",placeholder:"Décrivez votre établissement en quelques mots...",value:c.description,onChange:y,onFieldBlur:()=>b("description"),rows:3,error:x("description")}),s.jsxs("div",{className:"space-y-3 pt-2",children:[s.jsxs("div",{className:"flex items-start space-x-2",children:[s.jsx(Yo,{id:"terms",checked:d,onCheckedChange:j=>f(j===!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(Yo,{id:"privacy",checked:m,onCheckedChange:j=>h(j===!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||!d||!m,children:r?s.jsxs(s.Fragment,{children:[s.jsx(it,{className:"mr-2 h-4 w-4 animate-spin"}),"Création du compte..."]}):s.jsxs(s.Fragment,{children:[s.jsx(yr,{className:"mr-2 h-4 w-4"}),"Créer mon compte"]})})]})})]})})]})]})})]})}function Jgt(){const{user:e}=Br(),t=Zt(),[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),[x,p]=w.useState(!1),[g,v]=w.useState(null),[y,b]=w.useState(""),[N,j]=w.useState([]),[_,S]=w.useState(!1);w.useEffect(()=>{if(!e){t("/auth?role=school");return}T(),P()},[e,t]);const P=async()=>{try{const{data:M,error:B}=await ce.from("rejection_reasons").select("reason").order("usage_count",{ascending:!1}).limit(20);if(B)throw B;j((M==null?void 0:M.map(K=>K.reason))||[])}catch(M){console.error("Error loading rejection suggestions:",M)}},T=async()=>{if(e){i(!0);try{const{data:M,error:B}=await ce.from("school_requests").select("id").eq("user_id",e.id);if(B)throw B;if(!M||M.length===0){n([]),i(!1);return}const K=M.map(U=>U.id),{data:C,error:A}=await ce.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 I=[];for(const U of C||[]){const{data:Y}=await ce.from("trainer_profiles").select("id, name, email, specialties, bio, photo_url, user_id, manual_certified").eq("id",U.trainer_id).single(),{data:te}=await ce.from("school_requests").select("id, school_name, description, tjm_offered").eq("id",U.school_request_id).single();let re=!!(Y!=null&&Y.manual_certified);if(Y&&!re){const{data:ie}=await ce.from("trainer_contracts").select("id, status").eq("trainer_id",Y.id).eq("status","signed").maybeSingle();re=!!ie}let J=!1;if(U.status==="accepted"){const{data:ie}=await ce.from("service_contracts").select("id").eq("trainer_application_id",U.id).maybeSingle();J=!!ie}Y&&te&&I.push({id:U.id,message:U.message,status:U.status,created_at:U.created_at,trainer:Y,school_request:te,is_affiliated:re,has_service_contract:J})}n(I)}catch(M){console.error("Error loading applications:",M),ae.error("Erreur lors du chargement des candidatures")}finally{i(!1)}}},R=async(M,B,K)=>{f(M);try{const C=r.find(U=>U.id===M),A={status:B};K&&(A.rejection_reason=K);const{error:I}=await ce.from("trainer_applications").update(A).eq("id",M);if(I)throw I;try{await ce.functions.invoke("notify-application-status",{body:{applicationId:M,newStatus:B,rejectionReason:K}})}catch(U){console.error("Error notifying trainer:",U)}B==="accepted"&&C&&await ce.from("school_requests").update({status:"archived",is_filled:!0,filled_at:new Date().toISOString()}).eq("id",C.school_request.id),B==="rejected"&&K&&await k(K),n(U=>U.map(Y=>Y.id===M?{...Y,status:B}:Y)),B==="accepted"?ae.success("Candidature acceptée ! L'offre a été archivée automatiquement."):ae.success(`Candidature ${B==="rejected"?"refusée":"mise à jour"}`),(o==null?void 0:o.id)===M&&l(U=>U?{...U,status:B}:null)}catch(C){console.error("Error updating application:",C),ae.error("Erreur lors de la mise à jour")}finally{f(null)}},k=async M=>{const B=M.trim();if(B)try{const K=B.toLowerCase().substring(0,30),{data:C}=await ce.from("rejection_reasons").select("id, usage_count, reason").ilike("reason",`${K}%`).maybeSingle();C?await ce.from("rejection_reasons").update({usage_count:C.usage_count+1}).eq("id",C.id):await ce.from("rejection_reasons").insert({reason:B,usage_count:1}),await P()}catch(K){console.error("Error saving rejection reason:",K)}},E=M=>{v(M),b(""),p(!0)},q=async()=>{g&&(await R(g.id,"rejected",y),p(!1),v(null),b(""))},O=async M=>{if(!M.is_affiliated){ae.error("Ce formateur n'est pas affilié");return}h(M.id);try{const{data:B,error:K}=await ce.functions.invoke("create-service-contract",{body:{applicationId:M.id}});if(K)throw K;ae.success("Contrat de prestation créé avec succès !"),T()}catch(B){console.error("Error creating service contract:",B),ae.error(B.message||"Erreur lors de la création du contrat")}finally{h(null)}},L=M=>{const B={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:Dt(new Date(M.created_at),"dd/MM/yyyy"),statut:M.status==="accepted"?"Accepté":M.status,affilie:M.is_affiliated?"Oui":"Non"},K=Object.entries(B).map(([U,Y])=>`${U};${Y}`).join(`
`),C=new Blob([K],{type:"text/csv;charset=utf-8"}),A=URL.createObjectURL(C),I=document.createElement("a");I.href=A,I.download=`facturation_${M.trainer.name.replace(/\s/g,"_")}_${Dt(new Date,"yyyy-MM-dd")}.csv`,I.click(),URL.revokeObjectURL(A),ae.success("Informations exportées")},H=M=>{switch(M){case"accepted":return s.jsxs(Te,{className:"bg-green-500",children:[s.jsx(Wr,{className:"w-3 h-3 mr-1"}),"Acceptée"]});case"rejected":return s.jsxs(Te,{variant:"destructive",children:[s.jsx(vs,{className:"w-3 h-3 mr-1"}),"Refusée"]});case"pending":default:return s.jsxs(Te,{variant:"secondary",children:[s.jsx($r,{className:"w-3 h-3 mr-1"}),"En attente"]})}},V=r.filter(M=>c==="all"?!0:M.status===c),z={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(ba,{children:s.jsx("div",{className:"container mx-auto px-4 py-8 flex justify-center items-center min-h-[400px]",children:s.jsx(it,{className:"h-8 w-8 animate-spin text-primary"})})}):s.jsxs(ba,{children:[s.jsx(nr,{title:"Candidatures Reçues",description:"Gérez les candidatures des formateurs à vos offres de formation.",noindex:!0}),s.jsx(whe,{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(Hn,{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(er,{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(je,{children:s.jsx(Ee,{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:z.total})]}),s.jsx(er,{className:"h-8 w-8 text-primary opacity-80"})]})})}),s.jsx(je,{children:s.jsx(Ee,{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:z.pending})]}),s.jsx($r,{className:"h-8 w-8 text-yellow-500 opacity-80"})]})})}),s.jsx(je,{children:s.jsx(Ee,{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:z.accepted})]}),s.jsx(Wr,{className:"h-8 w-8 text-green-500 opacity-80"})]})})}),s.jsx(je,{children:s.jsx(Ee,{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:z.rejected})]}),s.jsx(vs,{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(Ar,{value:c,onValueChange:u,children:[s.jsx(kr,{className:"w-48",children:s.jsx(Dr,{placeholder:"Tous les statuts"})}),s.jsxs(Cr,{children:[s.jsxs(ct,{value:"all",children:["Tous (",z.total,")"]}),s.jsxs(ct,{value:"pending",children:["En attente (",z.pending,")"]}),s.jsxs(ct,{value:"accepted",children:["Acceptées (",z.accepted,")"]}),s.jsxs(ct,{value:"rejected",children:["Refusées (",z.rejected,")"]})]})]})]}),V.length===0?s.jsx(je,{children:s.jsxs(Ee,{className:"py-12 text-center",children:[s.jsx(er,{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:V.map(M=>s.jsx(je,{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(Ee,{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(er,{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(id,{})]}),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(Qn,{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(Hs,{className:"h-4 w-4"}),s.jsxs("span",{children:["Postulé le ",Dt(new Date(M.created_at),"dd MMM yyyy à HH:mm",{locale:br})]})]}),s.jsxs("div",{className:"flex flex-wrap gap-2 mb-3",children:[M.trainer.specialties.slice(0,4).map((B,K)=>s.jsx(Te,{variant:"outline",className:"text-xs",children:B},K)),M.trainer.specialties.length>4&&s.jsxs(Te,{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(no,{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:()=>O(M),disabled:m===M.id,children:[m===M.id?s.jsx(it,{className:"h-4 w-4 animate-spin mr-2"}):s.jsx(Kt,{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(_n,{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(es,{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:()=>R(M.id,"accepted"),disabled:d===M.id,children:d===M.id?s.jsx(it,{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:()=>E(M),disabled:d===M.id,children:[s.jsx(vs,{className:"mr-2 h-4 w-4"}),"Refuser"]})]}),M.status==="accepted"&&s.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>L(M),children:[s.jsx(ro,{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(_n,{className:"mr-2 h-4 w-4"}),"Contacter"]})]})]})})},M.id))}),s.jsx(qn,{open:!!o,onOpenChange:()=>l(null),children:s.jsxs($n,{className:"max-w-2xl",children:[s.jsxs(Un,{children:[s.jsx(Vn,{children:"Profil du formateur"}),s.jsx(Sa,{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(er,{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(id,{})]}),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,B)=>s.jsx(Te,{variant:"secondary",children:M},B))})]}),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(Fi,{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:()=>{R(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:()=>{R(o.id,"rejected")},disabled:d===o.id,children:[s.jsx(vs,{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(_n,{className:"mr-2 h-4 w-4"}),"Contacter"]})]})]})]})}),s.jsx(qn,{open:x,onOpenChange:p,children:s.jsxs($n,{className:"max-w-md",children:[s.jsxs(Un,{children:[s.jsx(Vn,{children:"Refuser la candidature"}),s.jsx(Sa,{children:g&&s.jsxs(s.Fragment,{children:["Vous allez refuser la candidature de ",s.jsx("strong",{children:g.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(lp,{open:_,onOpenChange:S,children:[s.jsx(cp,{asChild:!0,children:s.jsx(Xe,{placeholder:"Expliquer la raison du refus...",value:y,onChange:M=>b(M.target.value),onClick:()=>S(!0)})}),N.length>0&&s.jsx(vh,{className:"p-0 w-[300px]",align:"start",children:s.jsxs(dp,{children:[s.jsx(fp,{placeholder:"Rechercher..."}),s.jsxs(hp,{children:[s.jsx(mp,{children:"Aucune suggestion"}),s.jsx(rh,{heading:"Suggestions",children:N.filter(M=>M.toLowerCase().includes(y.toLowerCase())).slice(0,8).map((M,B)=>s.jsx(qu,{onSelect:()=>{b(M),S(!1)},children:M},B))})]})]})})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Votre raison sera suggérée pour les prochains refus."})]})}),s.jsxs(bl,{className:"gap-2",children:[s.jsx(ne,{variant:"outline",onClick:()=>p(!1),children:"Annuler"}),s.jsxs(ne,{variant:"destructive",onClick:q,disabled:d!==null,children:[d?s.jsx(it,{className:"h-4 w-4 animate-spin mr-2"}):s.jsx(vs,{className:"h-4 w-4 mr-2"}),"Confirmer le refus"]})]})]})})]})})]})}const Qgt=["Syllabus","Description du besoin","Planning","Cahier des charges","Autre"];function evt(){const{id:e}=so(),t=Zt(),{user:r}=Br(),[n,a]=w.useState(!0),[i,o]=w.useState(!1),[l,c]=w.useState(!1),[u,d]=w.useState(""),[f,m]=w.useState(""),[h,x]=w.useState(""),[p,g]=w.useState("presentiel"),[v,y]=w.useState(""),[b,N]=w.useState(""),[j,_]=w.useState(""),[S,P]=w.useState(""),[T,R]=w.useState([]),[k,E]=w.useState(""),[q,O]=w.useState(""),[L,H]=w.useState(""),[V,z]=w.useState(""),[M,B]=w.useState(""),[K,C]=w.useState(""),[A,I]=w.useState(""),[U,Y]=w.useState([]),[te,re]=w.useState(""),[J,ie]=w.useState(null),[be,Q]=w.useState(""),[Ve,W]=w.useState("public");w.useEffect(()=>{if(!r||!e){t("/auth?role=school");return}Z()},[r,e,t]);const Z=async()=>{var me,Le;if(e)try{const{data:Ke,error:ve}=await ce.from("school_requests").select("*").eq("id",e).eq("user_id",r==null?void 0:r.id).single();if(ve)throw ve;if(!Ke){ae.error("Offre non trouvée"),t("/school/dashboard");return}if(Ke.status==="approved"){ae.error("Vous ne pouvez pas modifier une offre publiée"),t("/school/dashboard");return}if(d(Ke.school_name),m(Ke.city||""),x(Ke.address||""),g(Ke.modality||"presentiel"),y(Ke.contact_name),N(Ke.contact_email),_(Ke.contact_phone||""),P(Ke.contact_position||""),R(Ke.training_needs||[]),O(Ke.start_date||""),H(Ke.end_date||""),z(((me=Ke.duration_hours)==null?void 0:me.toString())||""),B(((Le=Ke.num_trainers)==null?void 0:Le.toString())||""),C(Ke.estimated_budget||""),I(Ke.description),Q(Ke.status),W(Ke.visibility||"public"),Ke.documents&&Array.isArray(Ke.documents)){const _e=Ke.documents.map(Ue=>({type:Ue.type||"",name:Ue.name||"",url:Ue.url||""}));Y(_e)}}catch(Ke){console.error("Error loading request:",Ke),ae.error("Erreur lors du chargement de l'offre"),t("/school/dashboard")}finally{a(!1)}},he=()=>{k.trim()&&!T.includes(k.trim())&&(R([...T,k.trim()]),E(""))},se=me=>{R(T.filter(Le=>Le!==me))},oe=me=>{var Ke;const Le=(Ke=me.target.files)==null?void 0:Ke[0];if(Le){if(Le.size>10*1024*1024){ae.error("Le fichier ne doit pas dépasser 10 Mo");return}ie(Le)}},le=()=>{if(!te){ae.error("Veuillez sélectionner un type de document");return}if(!J){ae.error("Veuillez sélectionner un fichier");return}Y([...U,{type:te,name:J.name,url:"",file:J}]),re(""),ie(null);const me=document.getElementById("doc-file-input");me&&(me.value="")},Me=me=>{Y(U.filter((Le,Ke)=>Ke!==me))},de=async me=>{if(me.preventDefault(),!u.trim()||!v.trim()||!b.trim()){ae.error("Veuillez remplir tous les champs obligatoires");return}if(q&&L){const Ke=new Date(q);if(new Date(L)<Ke){ae.error("La date de fin doit être après la date de début");return}}let Le=[...T];if(k.trim()&&!T.includes(k.trim())&&Le.push(k.trim()),Le.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 Ke=[];for(const _e of U)if(_e.file){const Ue=`${Date.now()}-${_e.file.name}`,{data:Qe,error:st}=await ce.storage.from("school-attachments").upload(Ue,_e.file);if(st)throw st;const{data:{publicUrl:Fe}}=ce.storage.from("school-attachments").getPublicUrl(Qe.path);Ke.push({type:_e.type,name:_e.name,url:Fe})}else _e.url&&Ke.push({type:_e.type,name:_e.name,url:_e.url});const{error:ve}=await ce.from("school_requests").update({school_name:u.trim(),city:f.trim()||null,address:h.trim()||null,modality:p,contact_name:v.trim(),contact_email:b.trim(),contact_phone:j.trim()||null,contact_position:S.trim()||null,training_needs:Le,start_date:q||null,end_date:L||null,duration_hours:V?parseInt(V):null,num_trainers:M?parseInt(M):null,estimated_budget:K.trim()||null,description:A.trim(),documents:Ke,subject_areas:Le,visibility:Ve,updated_at:new Date().toISOString()}).eq("id",e).eq("user_id",r==null?void 0:r.id);if(ve)throw ve;c(!0),ae.success("Offre mise à jour avec succès !")}catch(Ke){console.error("Error updating request:",Ke),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(it,{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(je,{className:"w-full max-w-md text-center",children:s.jsxs(Ee,{className:"pt-12 pb-8",children:[s.jsx(Zn,{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(nr,{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(Hn,{className:"mr-2 h-4 w-4"}),"Retour au tableau de bord"]}),be==="rejected"&&s.jsx(je,{className:"mb-6 border-destructive/50 bg-destructive/5",children:s.jsx(Ee,{className:"py-4",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(td,{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(je,{children:[s.jsxs(mt,{children:[s.jsx(gt,{className:"text-3xl",children:"Modifier l'offre"}),s.jsx(Kr,{children:"Modifiez les informations de votre demande de formation"})]}),s.jsx(Ee,{children:s.jsxs("form",{onSubmit:de,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(Xe,{id:"schoolName",value:u,onChange:me=>d(me.target.value),required:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"city",children:"Ville"}),s.jsx(Xe,{id:"city",value:f,onChange:me=>m(me.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(Xe,{id:"address",value:h,onChange:me=>x(me.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(Wx,{value:p,onValueChange:me=>g(me),className:"flex flex-wrap gap-4",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(qo,{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(qo,{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(qo,{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(Wx,{value:Ve,onValueChange:me=>W(me),className:"flex flex-col gap-3",children:[s.jsxs("div",{className:"flex items-start space-x-2",children:[s.jsx(qo,{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(qo,{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(Xe,{id:"contactName",value:v,onChange:me=>y(me.target.value),required:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"contactPosition",children:"Poste"}),s.jsx(Xe,{id:"contactPosition",value:S,onChange:me=>P(me.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(Xe,{id:"contactEmail",type:"email",value:b,onChange:me=>N(me.target.value),required:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"contactPhone",children:"Téléphone"}),s.jsx(Xe,{id:"contactPhone",type:"tel",value:j,onChange:me=>_(me.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(Xe,{value:k,onChange:me=>E(me.target.value),onKeyPress:me=>{me.key==="Enter"&&(me.preventDefault(),he())},placeholder:"Ex: Formation en développement web"}),s.jsx(ne,{type:"button",onClick:he,size:"icon",children:s.jsx(Qa,{className:"h-4 w-4"})})]}),T.length>0&&s.jsx("div",{className:"flex flex-wrap gap-2",children:T.map((me,Le)=>s.jsxs(Te,{variant:"secondary",className:"text-sm py-1.5",children:[me,s.jsx("button",{type:"button",onClick:()=>se(me),className:"ml-2 hover:text-destructive",children:s.jsx($i,{className:"h-3 w-3"})})]},Le))})]}),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(Xe,{id:"startDate",type:"date",value:q,onChange:me=>O(me.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"endDate",children:"Date de fin souhaitée"}),s.jsx(Xe,{id:"endDate",type:"date",value:L,onChange:me=>H(me.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(Xe,{id:"durationHours",type:"number",min:"1",value:V,onChange:me=>z(me.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"numTrainers",children:"Nombre de formateurs souhaités"}),s.jsx(Xe,{id:"numTrainers",type:"number",min:"1",value:M,onChange:me=>B(me.target.value)})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"estimatedBudget",children:"Budget estimé"}),s.jsx(Xe,{id:"estimatedBudget",value:K,onChange:me=>C(me.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:me=>I(me.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((me,Le)=>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(Kt,{className:"h-5 w-5 text-primary"}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium text-sm",children:me.name}),s.jsx("p",{className:"text-xs text-muted-foreground",children:me.type})]})]}),s.jsx(ne,{type:"button",variant:"ghost",size:"sm",onClick:()=>Me(Le),children:s.jsx($i,{className:"h-4 w-4"})})]},Le))}),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(Ar,{value:te,onValueChange:re,children:[s.jsx(kr,{children:s.jsx(Dr,{placeholder:"Sélectionner..."})}),s.jsx(Cr,{children:Qgt.map(me=>s.jsx(ct,{value:me,children:me},me))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{children:"Fichier"}),s.jsx(Xe,{id:"doc-file-input",type:"file",accept:".pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx",onChange:oe})]})]}),s.jsxs(ne,{type:"button",variant:"outline",onClick:le,children:[s.jsx(Qa,{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(it,{className:"mr-2 h-4 w-4 animate-spin"}),"Enregistrement..."]}):"Enregistrer les modifications"})]})]})})]})]})})]})}function tvt(){const e=Zt(),[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=g=>{const v=new URLSearchParams(window.location.hash.substring(1)),y=new URLSearchParams(window.location.search);return v.get(g)??y.get(g)},h=m("access_token"),x=m("refresh_token");m("type")==="recovery"&&h&&ce.auth.setSession({access_token:h,refresh_token:x||""}).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 ce.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(je,{className:"w-full max-w-md text-center",children:s.jsxs(Ee,{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(it,{className:"h-6 w-6 animate-spin mx-auto text-primary"})]})})}):s.jsxs(s.Fragment,{children:[s.jsx(nr,{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(Hn,{className:"mr-2 h-4 w-4"}),"Retour à la connexion"]}),s.jsxs(je,{children:[s.jsxs(mt,{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(Sye,{className:"h-6 w-6 text-primary"})}),s.jsx(gt,{className:"text-2xl",children:"Nouveau mot de passe"}),s.jsx(Kr,{children:"Choisissez un nouveau mot de passe pour votre compte"})]}),s.jsx(Ee,{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(Xe,{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(Xe,{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(it,{className:"mr-2 h-4 w-4 animate-spin"}),"Modification..."]}):"Modifier mon mot de passe"})]})})]})]})})]})}function rvt(){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 ce.from("trainer_profiles").select("specialties").eq("status","approved").eq("is_visible",!0);if(h)throw h;const x=new Map;m==null||m.forEach(g=>{var v;(v=g.specialties)==null||v.forEach(y=>{const b=y.trim();b&&x.set(b,(x.get(b)||0)+1)})});const p=Array.from(x.entries()).map(([g,v])=>({name:g,count:v,slug:encodeURIComponent(g.toLowerCase().replace(/\s+/g,"-"))})).sort((g,v)=>v.count-g.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 x=((p=h.name[0])==null?void 0:p.toUpperCase())||"#";return m[x]||(m[x]=[]),m[x].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(it,{className:"h-8 w-8 animate-spin text-primary"})}):s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx(nr,{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(ms,{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(Rs,{className:"absolute left-4 top-1/2 -translate-y-1/2 h-5 w-5 text-muted-foreground"}),s.jsx(Xe,{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(je,{children:[s.jsx(mt,{children:s.jsxs(gt,{className:"flex items-center gap-2",children:[s.jsx(ed,{className:"h-5 w-5 text-primary"}),"Compétences populaires"]})}),s.jsx(Ee,{children:s.jsx("div",{className:"flex flex-wrap gap-2",children:f.map((m,h)=>{const x=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(nt,{to:`/skills/${l(m.name)}`,className:"inline-block",children:s.jsxs(Te,{variant:h<5?"default":"secondary",className:`${x} 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(er,{className:"h-6 w-6 text-primary"}),"Toutes les compétences (A-Z)"]}),c.length===0?s.jsx(je,{children:s.jsx(Ee,{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(nt,{to:`/skills/${l(h.name)}`,className:"group",children:s.jsx(je,{className:"h-full hover:border-primary/50 hover:shadow-md transition-all",children:s.jsxs(Ee,{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(Te,{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 xd="Accordion",nvt=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[e7,svt,avt]=Gj(xd),[wA]=ei(xd,[avt,Kle]),t7=Kle(),jhe=ye.forwardRef((e,t)=>{const{type:r,...n}=e,a=n,i=n;return s.jsx(e7.Provider,{scope:e.__scopeAccordion,children:r==="multiple"?s.jsx(cvt,{...i,ref:t}):s.jsx(lvt,{...a,ref:t})})});jhe.displayName=xd;var[_he,ivt]=wA(xd),[Nhe,ovt]=wA(xd,{collapsible:!1}),lvt=ye.forwardRef((e,t)=>{const{value:r,defaultValue:n,onValueChange:a=()=>{},collapsible:i=!1,...o}=e,[l,c]=Zo({prop:r,defaultProp:n??"",onChange:a,caller:xd});return s.jsx(_he,{scope:e.__scopeAccordion,value:ye.useMemo(()=>l?[l]:[],[l]),onItemOpen:c,onItemClose:ye.useCallback(()=>i&&c(""),[i,c]),children:s.jsx(Nhe,{scope:e.__scopeAccordion,collapsible:i,children:s.jsx(She,{...o,ref:t})})})}),cvt=ye.forwardRef((e,t)=>{const{value:r,defaultValue:n,onValueChange:a=()=>{},...i}=e,[o,l]=Zo({prop:r,defaultProp:n??[],onChange:a,caller:xd}),c=ye.useCallback(d=>l((f=[])=>[...f,d]),[l]),u=ye.useCallback(d=>l((f=[])=>f.filter(m=>m!==d)),[l]);return s.jsx(_he,{scope:e.__scopeAccordion,value:o,onItemOpen:c,onItemClose:u,children:s.jsx(Nhe,{scope:e.__scopeAccordion,collapsible:!0,children:s.jsx(She,{...i,ref:t})})})}),[uvt,jA]=wA(xd),She=ye.forwardRef((e,t)=>{const{__scopeAccordion:r,disabled:n,dir:a,orientation:i="vertical",...o}=e,l=ye.useRef(null),c=Pr(l,t),u=svt(r),f=q0(a)==="ltr",m=Tt(e.onKeyDown,h=>{var P;if(!nvt.includes(h.key))return;const x=h.target,p=u().filter(T=>{var R;return!((R=T.ref.current)!=null&&R.disabled)}),g=p.findIndex(T=>T.ref.current===x),v=p.length;if(g===-1)return;h.preventDefault();let y=g;const b=0,N=v-1,j=()=>{y=g+1,y>N&&(y=b)},_=()=>{y=g-1,y<b&&(y=N)};switch(h.key){case"Home":y=b;break;case"End":y=N;break;case"ArrowRight":i==="horizontal"&&(f?j():_());break;case"ArrowDown":i==="vertical"&&j();break;case"ArrowLeft":i==="horizontal"&&(f?_():j());break;case"ArrowUp":i==="vertical"&&_();break}const S=y%v;(P=p[S].ref.current)==null||P.focus()});return s.jsx(uvt,{scope:r,disabled:n,direction:a,orientation:i,children:s.jsx(e7.Slot,{scope:r,children:s.jsx(Vt.div,{...o,"data-orientation":i,ref:c,onKeyDown:n?void 0:m})})})}),Mk="AccordionItem",[dvt,r7]=wA(Mk),khe=ye.forwardRef((e,t)=>{const{__scopeAccordion:r,value:n,...a}=e,i=jA(Mk,r),o=ivt(Mk,r),l=t7(r),c=Za(),u=n&&o.value.includes(n)||!1,d=i.disabled||e.disabled;return s.jsx(dvt,{scope:r,open:u,disabled:d,triggerId:c,children:s.jsx(Zle,{"data-orientation":i.orientation,"data-state":Ohe(u),...l,...a,ref:t,disabled:d,open:u,onOpenChange:f=>{f?o.onItemOpen(n):o.onItemClose(n)}})})});khe.displayName=Mk;var Che="AccordionHeader",Ehe=ye.forwardRef((e,t)=>{const{__scopeAccordion:r,...n}=e,a=jA(xd,r),i=r7(Che,r);return s.jsx(Vt.h3,{"data-orientation":a.orientation,"data-state":Ohe(i.open),"data-disabled":i.disabled?"":void 0,...n,ref:t})});Ehe.displayName=Che;var bI="AccordionTrigger",Ahe=ye.forwardRef((e,t)=>{const{__scopeAccordion:r,...n}=e,a=jA(xd,r),i=r7(bI,r),o=ovt(bI,r),l=t7(r);return s.jsx(e7.ItemSlot,{scope:r,children:s.jsx(g$e,{"aria-disabled":i.open&&!o.collapsible||void 0,"data-orientation":a.orientation,id:i.triggerId,...l,...n,ref:t})})});Ahe.displayName=bI;var The="AccordionContent",Phe=ye.forwardRef((e,t)=>{const{__scopeAccordion:r,...n}=e,a=jA(xd,r),i=r7(The,r),o=t7(r);return s.jsx(v$e,{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}})});Phe.displayName=The;function Ohe(e){return e?"open":"closed"}var fvt=jhe,hvt=khe,mvt=Ehe,Dhe=Ahe,Ihe=Phe;const n7=fvt,vm=w.forwardRef(({className:e,...t},r)=>s.jsx(hvt,{ref:r,className:yt("border-b",e),...t}));vm.displayName="AccordionItem";const ym=w.forwardRef(({className:e,children:t,...r},n)=>s.jsx(mvt,{className:"flex",children:s.jsxs(Dhe,{ref:n,className:yt("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(Qu,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));ym.displayName=Dhe.displayName;const bm=w.forwardRef(({className:e,children:t,...r},n)=>s.jsx(Ihe,{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:yt("pb-4 pt-0",e),children:t})}));bm.displayName=Ihe.displayName;const UP=10,pvt=[{icon:Jo,text:"Formateurs vérifiés",desc:"Profils validés par nos équipes"},{icon:$r,text:"Réponse sous 48h",desc:"Mise en relation rapide"},{icon:no,text:"Satisfaction garantie",desc:"Accompagnement personnalisé"}];function xvt(){const{skillName:e}=so(),t=Zt(),[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),x=decodeURIComponent(e||"").replace(/-/g," "),p=x.charAt(0).toUpperCase()+x.slice(1);w.useEffect(()=>{e&&(g(),dn.trackPageView(`Skill Landing - ${p}`,{skill:p,pageType:"skill_landing"}))},[e]);const g=async()=>{i(!0);try{const{data:S,error:P}=await ce.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, updated_at").eq("status","approved").eq("is_visible",!0);if(P)throw P;const T=(S||[]).filter(q=>{var O;return(O=q.specialties)==null?void 0:O.some(L=>L.toLowerCase().includes(x.toLowerCase())||x.toLowerCase().includes(L.toLowerCase()))}),{data:R}=await ce.from("trainer_contracts").select("trainer_id").eq("counter_signed",!0),k=new Set((R==null?void 0:R.map(q=>q.trainer_id))||[]);n(Zm(T,k,x));const E=new Set;T.forEach(q=>{var O;(O=q.specialties)==null||O.forEach(L=>{L.toLowerCase()!==x.toLowerCase()&&E.add(L)})}),u(Array.from(E).slice(0,12))}catch(S){console.error("Error loading trainers:",S)}finally{i(!1)}},v=S=>encodeURIComponent(S.toLowerCase().replace(/\s+/g,"-")),y=S=>S.split(" ").map(P=>P[0]).join("").toUpperCase().slice(0,2),b=async S=>{if(S.preventDefault(),!d.email||!d.company){ae.error("Veuillez remplir les champs obligatoires");return}h(!0);try{const{error:P}=await ce.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(P)throw P;dn.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(P){console.error("Error submitting lead:",P),ae.error("Erreur lors de l'envoi. Veuillez réessayer.")}finally{h(!1)}},N=o?r:r.slice(0,UP),j=r.length>UP,_=r.length<5;return a?s.jsx("div",{className:"min-h-screen flex items-center justify-center",children:s.jsx(it,{className:"h-8 w-8 animate-spin text-primary"})}):s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx(nr,{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(ms,{items:[{name:"Accueil",url:"/"},{name:"Compétences",url:"/skills"},{name:p,url:`/skills/${e}`}]}),r.slice(0,3).map(S=>s.jsx(b1,{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(Hn,{className:"mr-2 h-4 w-4"}),"Toutes les compétences"]}),s.jsxs("div",{className:"max-w-4xl",children:[s.jsxs(Te,{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(er,{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(Js,{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:pvt.map((S,P)=>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})]})]},P))})})}),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:[_&&s.jsxs(je,{className:"border-primary/50 bg-primary/5",id:"contact",children:[s.jsxs(mt,{children:[s.jsxs(gt,{className:"flex items-center gap-2",children:[s.jsx(yr,{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(Ee,{children:s.jsxs("form",{onSubmit:b,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(Xe,{id:"company",value:d.company,onChange:S=>f(P=>({...P,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(Xe,{id:"email",type:"email",value:d.email,onChange:S=>f(P=>({...P,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(Xe,{id:"phone",value:d.phone,onChange:S=>f(P=>({...P,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(P=>({...P,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(it,{className:"mr-2 h-4 w-4 animate-spin"}):s.jsx(Js,{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(Na,{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(je,{children:s.jsxs(Ee,{className:"py-12 text-center",children:[s.jsx(er,{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(je,{className:"hover:shadow-md transition-all group",children:s.jsx(Ee,{className:"p-6",children:s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsxs(bs,{className:"h-16 w-16 shrink-0",children:[S.photo_url&&s.jsx(ji,{src:S.photo_url,alt:S.name}),s.jsx(ws,{className:"text-lg font-bold bg-primary text-primary-foreground",children:y(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(id,{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((P,T)=>s.jsx(Te,{variant:P.toLowerCase().includes(x.toLowerCase())?"default":"secondary",className:"text-xs",children:P},T)),S.specialties.length>5&&s.jsxs(Te,{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(nu,{className:"ml-1 h-4 w-4"})]})]})]})})},S.id)),j&&!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-UP," 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(ao,{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(n7,{type:"single",collapsible:!0,className:"w-full",children:[s.jsxs(vm,{value:"faq-1",children:[s.jsxs(ym,{className:"text-left",children:["Comment trouver un formateur ",p," ?"]}),s.jsxs(bm,{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(vm,{value:"faq-2",children:[s.jsxs(ym,{className:"text-left",children:["Combien coûte un formateur ",p," ?"]}),s.jsx(bm,{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(vm,{value:"faq-3",children:[s.jsxs(ym,{className:"text-left",children:["Les formateurs ",p," sont-ils certifiés ?"]}),s.jsx(bm,{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(vm,{value:"faq-4",children:[s.jsxs(ym,{className:"text-left",children:["Comment se déroule une formation ",p," ?"]}),s.jsx(bm,{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(vm,{value:"faq-5",children:[s.jsx(ym,{className:"text-left",children:"Comment se déroule la mise en relation ?"}),s.jsx(bm,{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:[!_&&s.jsxs(je,{className:"sticky top-4",id:"contact",children:[s.jsx(mt,{children:s.jsxs(gt,{className:"text-lg",children:["Besoin d'un formateur ",p," ?"]})}),s.jsx(Ee,{children:s.jsxs("form",{onSubmit:b,className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"company-sidebar",children:"Entreprise *"}),s.jsx(Xe,{id:"company-sidebar",value:d.company,onChange:S=>f(P=>({...P,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(Xe,{id:"email-sidebar",type:"email",value:d.email,onChange:S=>f(P=>({...P,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(P=>({...P,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(it,{className:"mr-2 h-4 w-4 animate-spin"}):s.jsx(Js,{className:"mr-2 h-4 w-4"}),"Demander un devis"]})]})})]}),s.jsx(je,{className:"border-blue-200 bg-blue-50/50 dark:border-blue-900 dark:bg-blue-950/30",children:s.jsx(Ee,{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(Na,{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(je,{children:[s.jsx(mt,{children:s.jsx(gt,{className:"text-lg",children:"Compétences connexes"})}),s.jsx(Ee,{children:s.jsx("div",{className:"flex flex-wrap gap-2",children:c.map(S=>s.jsx(nt,{to:`/skills/${v(S)}`,children:s.jsx(Te,{variant:"outline",className:"cursor-pointer hover:bg-primary hover:text-primary-foreground transition-colors",children:S})},S))})})]}),s.jsx(je,{className:"bg-primary text-primary-foreground",children:s.jsxs(Ee,{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 gvt(){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 ce.from("trainer_profiles").select("preferred_departments, location_preference").eq("status","approved").eq("is_visible",!0);if(h)throw h;const x=new Map;let p=0;m==null||m.forEach(v=>{const y=v.preferred_departments||[];g8(y).forEach(N=>{x.set(N,(x.get(N)||0)+1)}),coe(y,3)&&p++}),p>0&&x.set("National",p);const g=Array.from(x.entries()).map(([v,y])=>({name:v,count:y,slug:encodeURIComponent(v.toLowerCase().replace(/\s+/g,"-"))})).sort((v,y)=>y.count-v.count);t(g)}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 x=((p=h.name[0])==null?void 0:p.toUpperCase())||"#";return m[x]||(m[x]=[]),m[x].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(it,{className:"h-8 w-8 animate-spin text-primary"})}):s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx(nr,{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(ms,{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(Rs,{className:"absolute left-4 top-1/2 -translate-y-1/2 h-5 w-5 text-muted-foreground"}),s.jsx(Xe,{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(je,{children:[s.jsx(mt,{children:s.jsxs(gt,{className:"flex items-center gap-2",children:[s.jsx(ed,{className:"h-5 w-5 text-primary"}),"Villes populaires"]})}),s.jsx(Ee,{children:s.jsx("div",{className:"flex flex-wrap gap-2",children:f.map((m,h)=>{const x=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(nt,{to:`/villes/${l(m.name)}`,className:"inline-block",children:s.jsxs(Te,{variant:h<5?"default":"secondary",className:`${x} hover:scale-105 transition-transform cursor-pointer`,children:[s.jsx(Is,{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(Is,{className:"h-6 w-6 text-primary"}),"Toutes les villes (A-Z)"]}),c.length===0?s.jsx(je,{children:s.jsx(Ee,{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(nt,{to:`/villes/${l(h.name)}`,className:"group",children:s.jsx(je,{className:"h-full hover:border-primary/50 hover:shadow-md transition-all",children:s.jsxs(Ee,{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(Is,{className:"h-4 w-4 text-muted-foreground"}),h.name]}),s.jsxs(Te,{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 VP=10,vvt=[{icon:Jo,text:"Formateurs vérifiés",desc:"Profils validés par nos équipes"},{icon:$r,text:"Réponse sous 48h",desc:"Mise en relation rapide"},{icon:no,text:"Satisfaction garantie",desc:"Accompagnement personnalisé"}];function yvt(){const{cityName:e}=so(),t=Zt(),[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:""}),[x,p]=w.useState(!1),g=decodeURIComponent(e||"").replace(/-/g," "),v=g.charAt(0).toUpperCase()+g.slice(1),y=v.toLowerCase()==="national";w.useEffect(()=>{e&&(b(),dn.trackPageView(`City Landing - ${v}`,{city:v,pageType:"city_landing"}))},[e]);const b=async()=>{i(!0);try{const{data:k,error:E}=await ce.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, updated_at").eq("status","approved").eq("is_visible",!0);if(E)throw E;const q=(k||[]).filter(B=>{const K=B.preferred_departments||[];return y?coe(K,3):g8(K).some(A=>A.toLowerCase()===g.toLowerCase())}),{data:O}=await ce.from("trainer_contracts").select("trainer_id").eq("counter_signed",!0),L=new Set((O==null?void 0:O.map(B=>B.trainer_id))||[]);n(Zm(q,L));const H=new Map;q.forEach(B=>{var K;(K=B.specialties)==null||K.forEach(C=>{H.set(C,(H.get(C)||0)+1)})});const V=Array.from(H.entries()).sort((B,K)=>K[1]-B[1]).slice(0,10).map(([B])=>B);u(V);const z=new Map;k==null||k.forEach(B=>{g8(B.preferred_departments||[]).forEach(C=>{C.toLowerCase()!==g.toLowerCase()&&z.set(C,(z.get(C)||0)+1)})});const M=Array.from(z.entries()).sort((B,K)=>K[1]-B[1]).slice(0,8).map(([B])=>B);f(M)}catch(k){console.error("Error loading trainers:",k)}finally{i(!1)}},N=k=>encodeURIComponent(k.toLowerCase().replace(/\s+/g,"-")),j=k=>k.split(" ").map(E=>E[0]).join("").toUpperCase().slice(0,2),_=async k=>{if(k.preventDefault(),!m.email||!m.company){ae.error("Veuillez remplir les champs obligatoires");return}p(!0);try{const{error:E}=await ce.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:y?null:v,status:"pending"});if(E)throw E;dn.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(E){console.error("Error submitting lead:",E),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 ${y?"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 ${y?"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."}],P=o?r:r.slice(0,VP),T=r.length>VP,R=r.length<5;return a?s.jsx("div",{className:"min-h-screen flex items-center justify-center",children:s.jsx(it,{className:"h-8 w-8 animate-spin text-primary"})}):s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx(nr,{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(ms,{items:[{name:"Accueil",url:"/"},{name:"Villes",url:"/villes"},{name:v,url:`/villes/${e}`}]}),s.jsx(ao,{items:S}),r.slice(0,3).map(k=>s.jsx(b1,{name:k.name,jobTitle:`Formateur à ${v}`,description:k.bio||`Expert formation à ${v}`,image:k.photo_url||void 0,url:`/trainers/${k.id}`},k.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(Hn,{className:"mr-2 h-4 w-4"}),"Toutes les villes"]}),s.jsxs("div",{className:"max-w-4xl",children:[s.jsxs(Te,{variant:"secondary",className:"mb-4",children:[s.jsx(Is,{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:y?"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(er,{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(Js,{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:vvt.map((k,E)=>s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"p-3 rounded-full bg-primary/10",children:s.jsx(k.icon,{className:"h-6 w-6 text-primary"})}),s.jsxs("div",{children:[s.jsx("p",{className:"font-semibold",children:k.text}),s.jsx("p",{className:"text-sm text-muted-foreground",children:k.desc})]})]},E))})})}),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:[R&&s.jsxs(je,{className:"border-primary/50 bg-primary/5",id:"contact",children:[s.jsxs(mt,{children:[s.jsxs(gt,{className:"flex items-center gap-2",children:[s.jsx(yr,{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(Ee,{children:s.jsxs("form",{onSubmit:_,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(Xe,{id:"company",value:m.company,onChange:k=>h(E=>({...E,company:k.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(Xe,{id:"email",type:"email",value:m.email,onChange:k=>h(E=>({...E,email:k.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(Xe,{id:"phone",value:m.phone,onChange:k=>h(E=>({...E,phone:k.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:k=>h(E=>({...E,message:k.target.value})),placeholder:"Décrivez votre projet de formation...",rows:3})]}),s.jsxs(ne,{type:"submit",className:"w-full",disabled:x,children:[x?s.jsx(it,{className:"mr-2 h-4 w-4 animate-spin"}):s.jsx(Js,{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(Na,{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(je,{children:s.jsxs(Ee,{className:"py-12 text-center",children:[s.jsx(Is,{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:[P.map(k=>s.jsx(je,{className:"hover:shadow-md transition-all group",children:s.jsx(Ee,{className:"p-6",children:s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsxs(bs,{className:"h-16 w-16 shrink-0",children:[k.photo_url&&s.jsx(ji,{src:k.photo_url,alt:k.name}),s.jsx(ws,{className:"text-lg font-bold bg-primary text-primary-foreground",children:j(k.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:k.name}),k.isAffiliated&&s.jsx(id,{size:"sm"})]}),k.bio&&s.jsx("p",{className:"text-muted-foreground text-sm mb-3 line-clamp-2",children:k.bio}),s.jsxs("div",{className:"flex flex-wrap gap-1.5 mb-4",children:[k.specialties.slice(0,5).map((E,q)=>s.jsx(nt,{to:`/skills/${N(E)}`,children:s.jsx(Te,{variant:"secondary",className:"text-xs cursor-pointer hover:bg-primary hover:text-primary-foreground",children:E})},q)),k.specialties.length>5&&s.jsxs(Te,{variant:"outline",className:"text-xs",children:["+",k.specialties.length-5]})]}),s.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>t(`/trainers/${k.id}`),children:["Voir le profil",s.jsx(nu,{className:"ml-1 h-4 w-4"})]})]})]})})},k.id)),T&&!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-VP," autres formateurs"]})})]})]}),s.jsx(QL,{}),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 ",y?"en France":`à ${v}`]}),s.jsx(n7,{type:"single",collapsible:!0,className:"w-full",children:S.map((k,E)=>s.jsxs(vm,{value:`faq-${E}`,children:[s.jsx(ym,{className:"text-left",children:k.question}),s.jsx(bm,{className:"text-muted-foreground",children:k.answer})]},E))})]})]}),s.jsxs("div",{className:"space-y-6",children:[!R&&s.jsxs(je,{className:"sticky top-4",id:"contact",children:[s.jsx(mt,{children:s.jsxs(gt,{className:"text-lg",children:["Besoin d'un formateur à ",v," ?"]})}),s.jsx(Ee,{children:s.jsxs("form",{onSubmit:_,className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"company-sidebar",children:"Entreprise *"}),s.jsx(Xe,{id:"company-sidebar",value:m.company,onChange:k=>h(E=>({...E,company:k.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(Xe,{id:"email-sidebar",type:"email",value:m.email,onChange:k=>h(E=>({...E,email:k.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:k=>h(E=>({...E,message:k.target.value})),placeholder:"Décrivez votre projet...",rows:3})]}),s.jsxs(ne,{type:"submit",className:"w-full",disabled:x,children:[x?s.jsx(it,{className:"mr-2 h-4 w-4 animate-spin"}):s.jsx(Js,{className:"mr-2 h-4 w-4"}),"Demander un devis"]})]})})]}),c.length>0&&s.jsxs(je,{children:[s.jsx(mt,{children:s.jsx(gt,{className:"text-lg",children:"Compétences populaires"})}),s.jsx(Ee,{children:s.jsx("div",{className:"flex flex-wrap gap-2",children:c.map(k=>s.jsx(nt,{to:`/skills/${N(k)}`,children:s.jsx(Te,{variant:"outline",className:"cursor-pointer hover:bg-primary hover:text-primary-foreground transition-colors",children:k})},k))})})]}),d.length>0&&s.jsxs(je,{children:[s.jsx(mt,{children:s.jsx(gt,{className:"text-lg",children:"Autres villes"})}),s.jsx(Ee,{children:s.jsx("div",{className:"flex flex-wrap gap-2",children:d.map(k=>s.jsx(nt,{to:`/villes/${N(k)}`,children:s.jsxs(Te,{variant:"outline",className:"cursor-pointer hover:bg-primary hover:text-primary-foreground transition-colors",children:[s.jsx(Is,{className:"mr-1 h-3 w-3"}),k]})},k))})})]}),s.jsx(je,{className:"bg-primary text-primary-foreground",children:s.jsxs(Ee,{className:"py-6",children:[s.jsxs("h3",{className:"font-bold text-lg mb-2",children:["Vous êtes formateur ",y?"":`à ${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 bvt=["Paris","Lyon","Marseille","Toulouse","Nice","Nantes","Strasbourg","Montpellier","Bordeaux","Lille","Rennes","Reims","Le Havre","Saint-Étienne","Toulon","Grenoble","Dijon","Angers","Nîmes","Villeurbanne"],wvt=()=>{var x;const{cityName:e,skillName:t}=so(),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}=la({queryKey:["trainers-city-skill",a,i],queryFn:async()=>{const{data:p,error:g}=await ce.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, updated_at").eq("status","approved").eq("is_visible",!0);if(g)throw g;const{data:v}=await ce.from("trainer_contracts").select("trainer_id").eq("counter_signed",!0),y=new Set((v==null?void 0:v.map(k=>k.trainer_id))||[]),b=i.toLowerCase(),N=(p||[]).filter(k=>k.specialties.some(E=>E.toLowerCase().includes(b)||b.includes(E.toLowerCase()))),j=[],_=[],S=[];N.forEach(k=>{const E=k.preferred_cities||[],q=a.toLowerCase(),O=E.some(V=>V.toLowerCase()===q),L=k.location_preference==="national",H=k.location_preference==="remote"||k.preferred_modality==="distanciel";O?j.push({...k,availabilityType:"local"}):L?_.push({...k,availabilityType:"travel"}):H&&S.push({...k,availabilityType:"remote"})});const P=Zm(j,y,i),T=Zm(_,y,i),R=Zm(S,y,i);return{local:P,travel:T,remote:R,total:P.length+T.length+R.length}},enabled:!!a&&!!i});w.useEffect(()=>{a&&i&&dn.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=(((x=o==null?void 0:o.local)==null?void 0:x.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(Te,{className:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-100",children:[s.jsx(yr,{className:"w-3 h-3 mr-1"}),"Basé à ",a]});case"travel":return s.jsxs(Te,{className:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-100",children:[s.jsx(Lye,{className:"w-3 h-3 mr-1"}),"Se déplace à ",a]});case"remote":return s.jsxs(Te,{className:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-100",children:[s.jsx(Oye,{className:"w-3 h-3 mr-1"}),"Disponible en distanciel"]})}};return s.jsxs(s.Fragment,{children:[s.jsx(nr,{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(ms,{items:f}),s.jsx(ao,{items:m}),u.slice(0,3).map(p=>s.jsx(b1,{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(Rp,{items:f}),s.jsxs("div",{className:"max-w-4xl mx-auto text-center mt-8",children:[s.jsxs(Te,{variant:"outline",className:"mb-4",children:[s.jsx(Is,{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(er,{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(yr,{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($r,{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(lu,{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(no,{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,g)=>s.jsx(je,{children:s.jsx(Ee,{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"})]})]})})},g))}):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(nt,{to:`/formateurs/${p.id}`,className:"block",children:s.jsx(je,{className:"h-full hover:shadow-lg transition-shadow",children:s.jsxs(Ee,{className:"p-4",children:[s.jsxs("div",{className:"flex gap-4",children:[s.jsxs(bs,{className:"h-16 w-16",children:[s.jsx(ji,{src:p.photo_url||void 0,alt:p.name}),s.jsx(ws,{className:"text-lg",children:p.name.split(" ").map(g=>g[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(id,{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((g,v)=>s.jsx(Te,{variant:"secondary",className:"text-xs",children:g},v)),p.specialties.length>3&&s.jsxs(Te,{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(nt,{to:`/skills/${encodeURIComponent(i.toLowerCase().replace(/\s+/g,"-"))}`,children:["Voir tous les formateurs ",i]})})})]}):s.jsx(je,{className:"bg-muted/50",children:s.jsxs(Ee,{className:"p-8 text-center",children:[s.jsx(er,{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(je,{className:"sticky top-24 border-primary/20",children:s.jsxs(Ee,{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(nt,{to:"/training-request",children:"Publier une offre gratuitement"})}),s.jsx(ne,{variant:"outline",asChild:!0,className:"w-full mb-3",children:s.jsx(nt,{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(nt,{to:"/trainer-register",children:"Rejoignez notre réseau"})})]})]})})})]})})}),s.jsx(QL,{}),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:bvt.filter(p=>p.toLowerCase()!==a.toLowerCase()).slice(0,10).map(p=>s.jsx(ne,{variant:"outline",size:"sm",asChild:!0,children:s.jsxs(nt,{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(n7,{type:"single",collapsible:!0,className:"w-full",children:m.map((p,g)=>s.jsxs(vm,{value:`faq-${g}`,children:[s.jsx(ym,{className:"text-left",children:p.question}),s.jsx(bm,{className:"text-muted-foreground",children:p.answer})]},g))})]})}),s.jsx(aE,{})]})},jvt=()=>{const{skillName:e}=so(),[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}=la({queryKey:["interview-questions",o],queryFn:async()=>{const{data:x,error:p}=await ce.from("skill_interview_questions").select("*").ilike("skill_tag",o).order("display_order",{ascending:!0});if(p)throw p;return x},enabled:!!o}),u=x=>{r(p=>{const g=new Set(p);return g.has(x)?g.delete(x):g.add(x),g})},d=async(x,p)=>{try{await navigator.clipboard.writeText(x),a(g=>new Set(g).add(p)),ae.success("Question copiée dans le presse-papier"),setTimeout(()=>{a(g=>{const v=new Set(g);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(je,{className:"border-primary/30 bg-gradient-to-br from-primary/5 to-primary/10 my-8",children:s.jsx(Ee,{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(Zn,{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(nt,{to:`/skills/${encodeURIComponent(o.toLowerCase().replace(/\s+/g,"-"))}`,children:["Voir les formateurs ",o," certifiés",s.jsx(Zr,{className:"ml-2 w-4 h-4 group-hover:translate-x-1 transition-transform"})]})})]})]})})});return s.jsxs(s.Fragment,{children:[s.jsx(nr,{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(ms,{items:f}),s.jsx(ao,{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(Rp,{items:f,className:"text-slate-400 mb-8"}),s.jsxs("div",{className:"max-w-4xl",children:[s.jsxs(Te,{variant:"outline",className:"mb-4 border-primary/50 text-primary bg-primary/10",children:[s.jsx(sp,{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(er,{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(lu,{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(Na,{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(Te,{variant:"outline",className:"bg-green-50 text-green-700 border-green-200",children:"Junior"}),s.jsx(Te,{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((x,p)=>s.jsx(je,{children:s.jsxs(Ee,{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((x,p)=>s.jsxs("div",{children:[p===3&&s.jsx(h,{}),s.jsxs(je,{className:"overflow-hidden hover:shadow-md transition-shadow",children:[s.jsx(mt,{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(gt,{className:"text-lg leading-relaxed",children:x.question_text}),s.jsx(Te,{variant:"outline",className:`mt-2 ${x.complexity_level==="Junior"?"bg-green-50 text-green-700 border-green-200":"bg-orange-50 text-orange-700 border-orange-200"}`,children:x.complexity_level})]})]}),s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>d(x.question_text,x.id),className:"flex-shrink-0",children:n.has(x.id)?s.jsx(Zn,{className:"w-4 h-4 text-green-600"}):s.jsx(hye,{className:"w-4 h-4"})})]})}),s.jsxs(Ee,{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($R,{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:x.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(x.id),className:"text-xs",children:t.has(x.id)?s.jsxs(s.Fragment,{children:[s.jsx(yC,{className:"w-3 h-3 mr-1"}),"Masquer"]}):s.jsxs(s.Fragment,{children:[s.jsx(es,{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(x.id)?"":"blur-sm select-none"}`,children:s.jsx("p",{className:"text-sm leading-relaxed",children:x.expected_answer})}),!t.has(x.id)&&s.jsx("div",{className:"absolute inset-0 flex items-center justify-center cursor-pointer",onClick:()=>u(x.id),children:s.jsxs(ne,{variant:"secondary",size:"sm",children:[s.jsx(es,{className:"w-4 h-4 mr-2"}),"Cliquer pour révéler"]})})]})]})]})]},x.id)),s.jsx(h,{})]}):s.jsx(je,{className:"bg-muted/50",children:s.jsxs(Ee,{className:"p-8 text-center",children:[s.jsx(sp,{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(nt,{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((x,p)=>s.jsx(je,{children:s.jsxs(Ee,{className:"p-6",children:[s.jsx("h3",{className:"font-semibold mb-2",children:x.question}),s.jsx("p",{className:"text-muted-foreground text-sm",children:x.answer})]})},p))})]})}),s.jsx(aE,{})]})},_vt=()=>{const[e,t]=w.useState(""),{data:r,isLoading:n}=la({queryKey:["interview-questions-skills"],queryFn:async()=>{const{data:l,error:c}=await ce.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(nr,{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(ms,{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(Rp,{items:i,className:"text-slate-400 mb-8"}),s.jsxs("div",{className:"max-w-4xl mx-auto text-center",children:[s.jsxs(Te,{variant:"outline",className:"mb-4 border-primary/50 text-primary bg-primary/10",children:[s.jsx(Ql,{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(Na,{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(sp,{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(er,{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(lu,{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(Jo,{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(sp,{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(Rs,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-muted-foreground"}),s.jsx(Xe,{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(je,{children:s.jsxs(Ee,{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(nt,{to:`/recruiter-tools/interview-questions/${o(l.skill_tag)}`,children:s.jsxs(je,{className:"h-full hover:shadow-lg transition-all hover:border-primary/50 group",children:[s.jsxs(mt,{className:"pb-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(gt,{className:"text-lg group-hover:text-primary transition-colors",children:l.skill_tag}),s.jsx(Zr,{className:"w-5 h-5 text-muted-foreground group-hover:text-primary group-hover:translate-x-1 transition-all"})]}),s.jsxs(Kr,{children:[l.count," questions techniques disponibles"]})]}),s.jsx(Ee,{children:s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Te,{variant:"secondary",className:"text-xs",children:"Junior"}),s.jsx(Te,{variant:"secondary",className:"text-xs",children:"Senior"}),s.jsx(Te,{variant:"outline",className:"text-xs",children:"Réponses incluses"})]})})]})},l.skill_tag))}):s.jsx(je,{className:"bg-muted/50",children:s.jsxs(Ee,{className:"p-8 text-center",children:[s.jsx(Rs,{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(je,{className:"mt-12 border-primary/30 bg-gradient-to-br from-primary/5 to-primary/10",children:s.jsx(Ee,{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(er,{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(nt,{to:"/trainers",children:["Voir les formateurs certifiés",s.jsx(Zr,{className:"ml-2 w-4 h-4"})]})})]})]})})})]})})}),s.jsx(aE,{})]})},Nvt=()=>{const{data:e,isLoading:t}=la({queryKey:["glossary-terms"],queryFn:async()=>{const{data:i,error:o}=await ce.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(nr,{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(ms,{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(Rp,{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(_l,{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(nt,{to:`/glossaire/${o.slug}`,children:s.jsx(je,{className:"hover:shadow-lg transition-all hover:border-primary/30",children:s.jsx(Ee,{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(Zr,{className:"w-5 h-5 text-muted-foreground flex-shrink-0 mt-1"})]})})})},o.id))})]},i))}):s.jsx(je,{className:"bg-muted/50",children:s.jsxs(Ee,{className:"p-12 text-center",children:[s.jsx(_l,{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."})]})})})})]})},Svt=()=>{const{slug:e}=so(),{data:t,isLoading:r}=la({queryKey:["glossary-term",e],queryFn:async()=>{const{data:o,error:l}=await ce.from("glossary_terms").select("*").eq("slug",e).single();if(l)throw l;return o},enabled:!!e}),{data:n,isLoading:a}=la({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 ce.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(nr,{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(ms,{items:i}),n==null?void 0:n.slice(0,3).map(o=>s.jsx(b1,{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(Rp,{items:i}),s.jsxs("div",{className:"max-w-4xl mx-auto mt-8",children:[s.jsxs(nt,{to:"/glossaire",className:"inline-flex items-center text-sm text-muted-foreground hover:text-primary mb-4",children:[s.jsx(Hn,{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(_l,{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(Te,{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(je,{children:s.jsxs(Ee,{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(er,{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(je,{children:s.jsx(Ee,{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(nt,{to:`/formateurs/${o.id}`,children:s.jsx(je,{className:"h-full hover:shadow-lg transition-shadow",children:s.jsxs(Ee,{className:"p-4",children:[s.jsxs("div",{className:"flex gap-4",children:[s.jsxs(bs,{className:"h-14 w-14",children:[s.jsx(ji,{src:o.photo_url||void 0,alt:o.name}),s.jsx(ws,{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(Te,{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(nt,{to:`/skills/${encodeURIComponent(t.related_skill_tag.toLowerCase().replace(/\s+/g,"-"))}`,children:["Voir tous les formateurs ",t.related_skill_tag,s.jsx(Zr,{className:"w-4 h-4 ml-2"})]})})})]}):s.jsx(je,{className:"bg-background",children:s.jsxs(Ee,{className:"p-8 text-center",children:[s.jsx(er,{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(nt,{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(je,{className:"bg-primary/5 border-primary/20",children:s.jsxs(Ee,{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(nt,{to:"/training-request",children:"Publier une offre"})}),s.jsx(ne,{variant:"outline",asChild:!0,children:s.jsx(nt,{to:"/#contact",children:"Nous contacter"})})]})]})})})})})]}):s.jsxs("div",{className:"container mx-auto px-4 py-16 text-center",children:[s.jsx(_l,{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(nt,{to:"/glossaire",children:[s.jsx(Hn,{className:"w-4 h-4 mr-2"}),"Retour au glossaire"]})})]})},kvt=()=>{const e=u1(),[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}=la({queryKey:["admin-glossary-terms"],queryFn:async()=>{const{data:y,error:b}=await ce.from("glossary_terms").select("*").order("term",{ascending:!0});if(b)throw b;return y}}),f=Mc({mutationFn:async y=>{if(y.id){const{error:b}=await ce.from("glossary_terms").update({term:y.term,slug:y.slug,definition:y.definition,related_skill_tag:y.related_skill_tag||null}).eq("id",y.id);if(b)throw b}else{const{error:b}=await ce.from("glossary_terms").insert({term:y.term,slug:y.slug,definition:y.definition,related_skill_tag:y.related_skill_tag||null});if(b)throw b}},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-glossary-terms"]}),ae.success(t?"Terme mis à jour":"Terme créé"),h()},onError:y=>{ae.error("Erreur: "+y.message)}}),m=Mc({mutationFn:async y=>{const{error:b}=await ce.from("glossary_terms").delete().eq("id",y);if(b)throw b},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-glossary-terms"]}),ae.success("Terme supprimé")},onError:y=>{ae.error("Erreur: "+y.message)}}),h=()=>{o({term:"",slug:"",definition:"",related_skill_tag:""}),r(null),a(!1)},x=y=>{r(y),o({term:y.term,slug:y.slug,definition:y.definition,related_skill_tag:y.related_skill_tag||""}),a(!0)},p=y=>{y.preventDefault(),f.mutate({...i,id:t==null?void 0:t.id})},g=y=>y.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""),v=async()=>{var y;c(!0);try{const{data:b,error:N}=await ce.functions.invoke("generate-glossary-terms",{body:{generateAll:!0}});if(N)throw N;ae.success(`${((y=b.generated)==null?void 0:y.length)||0} termes générés. ${b.remaining||0} restants.`),e.invalidateQueries({queryKey:["admin-glossary-terms"]})}catch(b){ae.error("Erreur: "+b.message)}finally{c(!1)}};return s.jsxs("div",{className:"container mx-auto py-8 px-4",children:[s.jsx(ta,{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(_l,{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(it,{className:"w-4 h-4 mr-2 animate-spin"}):s.jsx(v2,{className:"w-4 h-4 mr-2"}),"Générer depuis compétences"]}),s.jsxs(qn,{open:n,onOpenChange:a,children:[s.jsx(Xo,{asChild:!0,children:s.jsxs(ne,{onClick:()=>h(),children:[s.jsx(Qa,{className:"w-4 h-4 mr-2"}),"Ajouter un terme"]})}),s.jsxs($n,{className:"max-w-2xl",children:[s.jsx(Un,{children:s.jsx(Vn,{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(Xe,{value:i.term,onChange:y=>{o({...i,term:y.target.value,slug:g(y.target.value)})},placeholder:"Ex: Qualiopi",required:!0})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm font-medium",children:"Slug URL"}),s.jsx(Xe,{value:i.slug,onChange:y=>o({...i,slug:y.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(Xe,{value:i.related_skill_tag,onChange:y=>o({...i,related_skill_tag:y.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:y=>o({...i,definition:y.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(je,{children:[s.jsx(mt,{children:s.jsx(gt,{children:"Termes du glossaire"})}),s.jsx(Ee,{children:d?s.jsx("div",{className:"space-y-4",children:[...Array(5)].map((y,b)=>s.jsx(Yr,{className:"h-16 w-full"},b))}):u&&u.length>0?s.jsxs(jh,{children:[s.jsx(_h,{children:s.jsxs(Fa,{children:[s.jsx(vr,{children:"Terme"}),s.jsx(vr,{children:"Slug"}),s.jsx(vr,{children:"Compétence liée"}),s.jsx(vr,{children:"Créé le"}),s.jsx(vr,{className:"text-right",children:"Actions"})]})}),s.jsx(Nh,{children:u.map(y=>s.jsxs(Fa,{children:[s.jsx(cr,{className:"font-medium",children:y.term}),s.jsx(cr,{children:s.jsx("code",{className:"text-xs bg-muted px-2 py-1 rounded",children:y.slug})}),s.jsx(cr,{children:y.related_skill_tag?s.jsx(Te,{variant:"secondary",children:y.related_skill_tag}):s.jsx("span",{className:"text-muted-foreground",children:"-"})}),s.jsx(cr,{children:Dt(new Date(y.created_at),"dd MMM yyyy",{locale:br})}),s.jsx(cr,{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/${y.slug}`,target:"_blank",rel:"noopener noreferrer",children:s.jsx(Kn,{className:"w-4 h-4"})})}),s.jsx(ne,{variant:"ghost",size:"icon",onClick:()=>x(y),children:s.jsx(bC,{className:"w-4 h-4"})}),s.jsx(ne,{variant:"ghost",size:"icon",onClick:()=>{confirm(`Supprimer "${y.term}" ?`)&&m.mutate(y.id)},children:s.jsx(ri,{className:"w-4 h-4 text-destructive"})})]})})]},y.id))})]}):s.jsxs("div",{className:"text-center py-12",children:[s.jsx(_l,{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(v2,{className:"w-4 h-4 mr-2"}),"Générer depuis les compétences formateur"]})]})})]})]})},Cvt=()=>{const[e,t]=w.useState(""),{data:r,isLoading:n}=la({queryKey:["job-descriptions"],queryFn:async()=>{const{data:o,error:l}=await ce.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(nr,{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(ms,{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(Rp,{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(Qn,{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(Rs,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-muted-foreground"}),s.jsx(Xe,{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(nt,{to:`/metier/${o.slug}`,children:s.jsx(je,{className:"h-full hover:shadow-lg transition-all hover:border-primary/30 group",children:s.jsxs(Ee,{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(Qn,{className:"w-6 h-6 text-primary"})}),s.jsx(Zr,{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(Te,{variant:"secondary",className:"text-xs",children:l},c)),o.required_skills.length>3&&s.jsxs(Te,{variant:"outline",className:"text-xs",children:["+",o.required_skills.length-3]})]})]})})},o.id))}):s.jsx(je,{className:"bg-muted/50",children:s.jsxs(Ee,{className:"p-12 text-center",children:[s.jsx(Qn,{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."})]})})})})})]})},Evt=()=>{var o,l;const{slug:e}=so(),{data:t,isLoading:r}=la({queryKey:["job-description",e],queryFn:async()=>{const{data:c,error:u}=await ce.from("job_descriptions").select("*").eq("slug",e).single();if(u)throw u;return c},enabled:!!e}),{data:n}=la({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 ce.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(x=>x.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}=la({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 ce.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(x=>x.subject_areas.some(p=>p.toLowerCase().includes(h)||h.includes(p.toLowerCase()))||x.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(nr,{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(ms,{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(Rp,{items:i}),s.jsxs("div",{className:"max-w-4xl mx-auto mt-8",children:[s.jsxs(nt,{to:"/metiers",className:"inline-flex items-center text-sm text-muted-foreground hover:text-primary mb-4",children:[s.jsx(Hn,{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(Qn,{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(Te,{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(je,{children:s.jsxs(Ee,{className:"p-8",children:[s.jsxs("h2",{className:"text-xl font-semibold mb-4 flex items-center gap-2",children:[s.jsx(_l,{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(Na,{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(er,{className:"w-5 h-5"}),"Formateurs experts en ",c]}),s.jsxs(su,{className:"w-full whitespace-nowrap",children:[s.jsxs("div",{className:"flex gap-4 pb-4",children:[n[c].map(d=>s.jsx(nt,{to:`/formateurs/${d.id}`,className:"flex-shrink-0 w-64",children:s.jsx(je,{className:"h-full hover:shadow-lg transition-shadow",children:s.jsx(Ee,{className:"p-4",children:s.jsxs("div",{className:"flex gap-3",children:[s.jsxs(bs,{className:"h-12 w-12",children:[s.jsx(ji,{src:d.photo_url||void 0,alt:d.name}),s.jsx(ws,{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(nt,{to:`/skills/${encodeURIComponent(c.toLowerCase().replace(/\s+/g,"-"))}`,className:"flex-shrink-0",children:s.jsx(je,{className:"h-full flex items-center justify-center min-w-[150px] hover:border-primary transition-colors",children:s.jsxs(Ee,{className:"p-4 text-center",children:[s.jsx(Zr,{className:"w-6 h-6 mx-auto mb-2 text-primary"}),s.jsx("span",{className:"text-sm font-medium",children:"Voir tous"})]})})})]}),s.jsx(x4,{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(Qn,{className:"w-5 h-5"}),"Formations disponibles en ",c]}),s.jsxs(su,{className:"w-full whitespace-nowrap",children:[s.jsxs("div",{className:"flex gap-4 pb-4",children:[a[c].map(d=>s.jsx(nt,{to:`/training-offers/${d.id}`,className:"flex-shrink-0 w-72",children:s.jsx(je,{className:"h-full hover:shadow-lg transition-shadow",children:s.jsxs(Ee,{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(Te,{variant:"outline",className:"flex items-center gap-1",children:[s.jsx(Is,{className:"w-3 h-3"}),d.city]}),d.duration_hours&&s.jsxs(Te,{variant:"outline",className:"flex items-center gap-1",children:[s.jsx($r,{className:"w-3 h-3"}),d.duration_hours,"h"]})]})]})})},d.id)),s.jsx(nt,{to:"/training-offers",className:"flex-shrink-0",children:s.jsx(je,{className:"h-full flex items-center justify-center min-w-[150px] hover:border-primary transition-colors",children:s.jsxs(Ee,{className:"p-4 text-center",children:[s.jsx(Zr,{className:"w-6 h-6 mx-auto mb-2 text-primary"}),s.jsx("span",{className:"text-sm font-medium",children:"Voir toutes"})]})})})]}),s.jsx(x4,{orientation:"horizontal"})]})]}),(!(n!=null&&n[c])||n[c].length===0)&&(!(a!=null&&a[c])||a[c].length===0)&&s.jsx(je,{className:"bg-muted/50",children:s.jsxs(Ee,{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(nt,{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(je,{className:"bg-primary/5 border-primary/20",children:s.jsxs(Ee,{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(nt,{to:"/trainers",children:"Trouver un formateur"})}),s.jsx(ne,{variant:"outline",size:"lg",asChild:!0,children:s.jsx(nt,{to:"/training-request",children:"Publier une offre"})})]})]})})})})})]}):s.jsxs("div",{className:"container mx-auto px-4 py-16 text-center",children:[s.jsx(Qn,{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(nt,{to:"/metiers",children:[s.jsx(Hn,{className:"w-4 h-4 mr-2"}),"Retour aux métiers"]})})]})},Avt=()=>{const e=u1(),[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}=la({queryKey:["admin-job-descriptions"],queryFn:async()=>{const{data:_,error:S}=await ce.from("job_descriptions").select("*").order("title",{ascending:!0});if(S)throw S;return _}}),h=Mc({mutationFn:async _=>{if(_.id){const{error:S}=await ce.from("job_descriptions").update({title:_.title,slug:_.slug,description:_.description,required_skills:_.required_skills}).eq("id",_.id);if(S)throw S}else{const{error:S}=await ce.from("job_descriptions").insert({title:_.title,slug:_.slug,description:_.description,required_skills:_.required_skills});if(S)throw S}},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-job-descriptions"]}),ae.success(t?"Fiche mise à jour":"Fiche créée"),p()},onError:_=>{ae.error("Erreur: "+_.message)}}),x=Mc({mutationFn:async _=>{const{error:S}=await ce.from("job_descriptions").delete().eq("id",_);if(S)throw S},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-job-descriptions"]}),ae.success("Fiche supprimée")},onError:_=>{ae.error("Erreur: "+_.message)}}),p=()=>{o({title:"",slug:"",description:"",required_skills:[]}),c(""),r(null),a(!1)},g=_=>{r(_),o({title:_.title,slug:_.slug,description:_.description,required_skills:_.required_skills}),a(!0)},v=_=>{_.preventDefault(),h.mutate({...i,id:t==null?void 0:t.id})},y=_=>_.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""),b=()=>{l.trim()&&!i.required_skills.includes(l.trim())&&(o({...i,required_skills:[...i.required_skills,l.trim()]}),c(""))},N=_=>{o({...i,required_skills:i.required_skills.filter(S=>S!==_)})},j=async()=>{var _;d(!0);try{const{data:S,error:P}=await ce.functions.invoke("generate-job-descriptions",{body:{generateAll:!0}});if(P)throw P;ae.success(`${((_=S.generated)==null?void 0:_.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(ta,{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(Qn,{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:j,disabled:u,children:[u?s.jsx(it,{className:"w-4 h-4 mr-2 animate-spin"}):s.jsx(v2,{className:"w-4 h-4 mr-2"}),"Générer depuis formateurs"]}),s.jsxs(qn,{open:n,onOpenChange:a,children:[s.jsx(Xo,{asChild:!0,children:s.jsxs(ne,{onClick:()=>p(),children:[s.jsx(Qa,{className:"w-4 h-4 mr-2"}),"Ajouter une fiche"]})}),s.jsxs($n,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[s.jsx(Un,{children:s.jsx(Vn,{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(Xe,{value:i.title,onChange:_=>{o({...i,title:_.target.value,slug:y(_.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(Xe,{value:i.slug,onChange:_=>o({...i,slug:_.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(Xe,{value:l,onChange:_=>c(_.target.value),placeholder:"Ajouter une compétence...",onKeyDown:_=>{_.key==="Enter"&&(_.preventDefault(),b())}}),s.jsx(ne,{type:"button",variant:"outline",onClick:b,children:s.jsx(Qa,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:i.required_skills.map((_,S)=>s.jsxs(Te,{variant:"secondary",className:"flex items-center gap-1",children:[_,s.jsx("button",{type:"button",onClick:()=>N(_),className:"hover:text-destructive",children:s.jsx($i,{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:_=>o({...i,description:_.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(je,{children:[s.jsx(mt,{children:s.jsx(gt,{children:"Fiches métiers"})}),s.jsx(Ee,{children:m?s.jsx("div",{className:"space-y-4",children:[...Array(5)].map((_,S)=>s.jsx(Yr,{className:"h-16 w-full"},S))}):f&&f.length>0?s.jsxs(jh,{children:[s.jsx(_h,{children:s.jsxs(Fa,{children:[s.jsx(vr,{children:"Métier"}),s.jsx(vr,{children:"Compétences"}),s.jsx(vr,{children:"Créé le"}),s.jsx(vr,{className:"text-right",children:"Actions"})]})}),s.jsx(Nh,{children:f.map(_=>s.jsxs(Fa,{children:[s.jsx(cr,{children:s.jsxs("div",{children:[s.jsx("span",{className:"font-medium",children:_.title}),s.jsx("br",{}),s.jsx("code",{className:"text-xs text-muted-foreground",children:_.slug})]})}),s.jsx(cr,{children:s.jsxs("div",{className:"flex flex-wrap gap-1 max-w-xs",children:[_.required_skills.slice(0,3).map((S,P)=>s.jsx(Te,{variant:"secondary",className:"text-xs",children:S},P)),_.required_skills.length>3&&s.jsxs(Te,{variant:"outline",className:"text-xs",children:["+",_.required_skills.length-3]})]})}),s.jsx(cr,{children:Dt(new Date(_.created_at),"dd MMM yyyy",{locale:br})}),s.jsx(cr,{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/${_.slug}`,target:"_blank",rel:"noopener noreferrer",children:s.jsx(Kn,{className:"w-4 h-4"})})}),s.jsx(ne,{variant:"ghost",size:"icon",onClick:()=>g(_),children:s.jsx(bC,{className:"w-4 h-4"})}),s.jsx(ne,{variant:"ghost",size:"icon",onClick:()=>{confirm(`Supprimer "${_.title}" ?`)&&x.mutate(_.id)},children:s.jsx(ri,{className:"w-4 h-4 text-destructive"})})]})})]},_.id))})]}):s.jsxs("div",{className:"text-center py-12",children:[s.jsx(Qn,{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:j,disabled:u,children:[s.jsx(v2,{className:"w-4 h-4 mr-2"}),"Générer depuis les compétences formateur"]})]})})]})]})};var sa=(e=>(e.PENDING="PENDING",e.PROCESSING="PROCESSING",e.COMPLETED="COMPLETED",e.ERROR="ERROR",e.DOWNLOADING="DOWNLOADING",e.UPLOADING="UPLOADING",e))(sa||{});const Rhe=({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"})]})]})},lX=({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===sa.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(u_,{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(Tvt,{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===sa.COMPLETED?"Local Download":"—"})]},t.id)})})]})})]}),Tvt=({status:e,error:t})=>{switch(e){case sa.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 sa.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 sa.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 sa.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 sa.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 sa.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}},Lhe=({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(u_,{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))})]})},Pvt=e=>new Promise((t,r)=>{const n=new FileReader;n.onload=()=>t(n.result.split(",")[1]),n.onerror=r,n.readAsDataURL(e)});function Ovt(){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),[x,p]=w.useState(null),[g,v]=w.useState(null),[y,b]=w.useState(!1),[N,j]=w.useState({running:!1,result:null,error:null}),[_,S]=w.useState([]),[P,T]=w.useState(!1);w.useEffect(()=>{},[]);const R=async()=>{{alert("Configurez VITE_GOOGLE_CLIENT_ID et VITE_GOOGLE_API_KEY dans .env");return}},k=async()=>{j({running:!0,result:null,error:null});try{const{data:{session:M}}=await ce.auth.getSession(),B=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 B.json();if(!B.ok)throw new Error(K.error||"Échec de la synchronisation");j({running:!1,result:K,error:null})}catch(M){j({running:!1,result:null,error:M.message})}},E=w.useRef(null);w.useEffect(()=>{if(!(!m||!d))return E.current&&clearTimeout(E.current),E.current=setTimeout(()=>{d.saveConfig({lessonsText:r,sourceFolder:x,destFolder:g}).catch(console.error)},3e3),()=>{E.current&&clearTimeout(E.current)}},[r,x,g,m,d]);const q=M=>{const B=M.map((K,C)=>({id:`${Date.now()}-${C}`,file:K,fileName:K.name,status:sa.PENDING,uploadProgress:0}));t(K=>[...K,...B])},O=async()=>{if(!d||!x)return;const M=await d.listFiles(x.id);t(M.map(B=>({id:B.id,driveId:B.id,fileName:B.name,status:sa.PENDING,uploadProgress:0})))},L=async()=>{if(e.length===0||!r.trim())return;l(!0),u("results");const{data:{session:M}}=await ce.auth.getSession();for(const B of e)if(B.status!==sa.COMPLETED)try{let K;if(B.driveId&&d){t(te=>te.map(re=>re.id===B.id?{...re,status:sa.DOWNLOADING}:re));const Y=await d.downloadFile(B.driveId);K=new File([Y],B.fileName,{type:Y.type})}else if(B.file)K=B.file;else throw new Error("Fichier manquant");t(Y=>Y.map(te=>te.id===B.id?{...te,status:sa.PROCESSING}:te));const C=await Pvt(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:C,mimeType:K.type,fileName:B.fileName,fileSize:K.size,lessonsText:r,shouldAnonymize:a})});if(!A.ok)throw new Error(await A.text());const{result:I,matchId:U}=await A.json();if(I.matchId=U,g&&d){t(ie=>ie.map(be=>be.id===B.id?{...be,status:sa.UPLOADING}:be));const{jsPDF:Y}=await Zd(async()=>{const{jsPDF:ie}=await Promise.resolve().then(()=>F2);return{jsPDF:ie}},void 0),te=new Y;te.setFont("helvetica"),te.setFontSize(11);const re=te.splitTextToSize(I.anonymizedText,180);te.text(re,15,20);const J=te.output("blob");I.driveFileId=await d.uploadFile(`${I.candidateId}_MATCH_${I.matchScore}.pdf`,J,g.id)}t(Y=>Y.map(te=>te.id===B.id?{...te,status:sa.COMPLETED,result:I}:te))}catch(K){t(C=>C.map(A=>A.id===B.id?{...A,status:sa.ERROR,error:K.message}:A))}l(!1)},H=async()=>{T(!0);const{data:M}=await ce.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||[]),T(!1)};w.useEffect(()=>{c==="history"&&H()},[c]);const V=e.filter(M=>M.status===sa.COMPLETED).length,z=e.length>0&&r.trim()!=="";return s.jsxs(s.Fragment,{children:[s.jsx(nr,{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 ${y?"bg-amber-400 animate-pulse":"bg-green-500"}`}),y?"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:R,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"}),P?s.jsx("div",{className:"text-center py-20 text-slate-400",children:"Chargement..."}):_.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:_.map(M=>{var B;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:(B=M.result)==null?void 0:B.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:k,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:(x==null?void 0:x.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:(g==null?void 0:g.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:R,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&&x&&s.jsx("button",{onClick:O,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(Rhe,{onFilesSelected:q,disabled:o}),e.length>0&&s.jsx("div",{className:"mt-4",children:s.jsx(lX,{files:e})}),s.jsx("div",{className:"mt-auto pt-6 border-t border-slate-100",children:s.jsx("button",{onClick:L,disabled:!z||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:[V," / ",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(lX,{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===sa.COMPLETED).map(M=>s.jsx(Lhe,{file:M,onDownload:async(B,K)=>{const{jsPDF:C}=await Zd(async()=>{const{jsPDF:I}=await Promise.resolve().then(()=>F2);return{jsPDF:I}},void 0),A=new C;A.text(A.splitTextToSize(B,180),15,20),A.save(K)}},M.id))})]})]})]})]})}const cX=5,Dvt=1,Ivt=e=>new Promise((t,r)=>{const n=new FileReader;n.onload=()=>t(n.result.split(",")[1]),n.onerror=r,n.readAsDataURL(e)});function Rvt(){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 Lvt(){Zt();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),[x,p]=w.useState("free"),[g,v]=w.useState(0),[y]=w.useState(()=>Rvt());w.useEffect(()=>{ce.auth.getUser().then(({data:{user:S}})=>{h(S),S&&b(S.id)})},[]);const b=async S=>{const{count:P}=await ce.from("cv_matches").select("id",{count:"exact",head:!0}).eq("user_id",S),T=P??0;if(v(T),T>=cX){const{data:R}=await ce.from("matcher_credits").select("credits_total, credits_used").eq("user_id",S).single();((R==null?void 0:R.credits_total)??0)-((R==null?void 0:R.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:sa.PENDING,uploadProgress:0}),u(null),f(null))},j=async()=>{if(!(!(e!=null&&e.file)||!r.trim())){l(!0),f(null),dn.trackFeatureUse("matcher","run",{lessonsChars:r.trim().length});try{const S=await Ivt(e.file),{data:{session:P}}=await ce.auth.getSession(),T={"Content-Type":"application/json",apikey:void 0,"x-ip-fingerprint":y};P!=null&&P.access_token&&(T.Authorization=`Bearer ${P.access_token}`);const R=await fetch("https://pedagobridge.com/functions/v1/match-cv",{method:"POST",headers:T,body:JSON.stringify({fileBase64:S,mimeType:e.file.type,fileName:e.fileName,fileSize:e.file.size,lessonsText:r,shouldAnonymize:a})}),k=await R.json();if(!R.ok){if(k.error==="LIMIT_ANONYMOUS"){p("needs_account");return}if(k.error==="LIMIT_PAID"){p("needs_payment");return}throw new Error(k.error||"Erreur serveur")}u(k.result),t(E=>E&&{...E,status:sa.COMPLETED,result:k.result}),m&&b(m.id),m||v(1)}catch(S){f(S.message),t(P=>P&&{...P,status:sa.ERROR,error:S.message})}finally{l(!1)}}},_=m?Math.max(0,cX-g):Math.max(0,Dvt-g);return s.jsxs(s.Fragment,{children:[s.jsx(nr,{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&&g===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&&x==="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:[_," analyse",_>1?"s":""," gratuite",_>1?"s":""," restante",_>1?"s":""]})})]}),x==="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(nt,{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(nt,{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"})]})]})}),x==="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"})]})}),(x==="free"||x==="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(Rhe,{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:j,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(Lhe,{file:{...e,result:c,status:sa.COMPLETED},onDownload:async(S,P)=>{const{jsPDF:T}=await Zd(async()=>{const{jsPDF:k}=await Promise.resolve().then(()=>F2);return{jsPDF:k}},void 0),R=new T;R.text(R.splitTextToSize(S,180),15,20),R.save(P)}}),!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(nt,{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 $g="https://pedagobridge.com",HP=void 0,Fvt=["Management","Leadership","Digital","Vente","RH","Comptabilité","Anglais","Bureautique","Sécurité","Qualité","Droit","Finance","Communication","Marketing","Développement personnel","Informatique"],WP={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 Mvt(){var Ke;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),[x,p]=w.useState(null),[g,v]=w.useState(null),[y,b]=w.useState(!1),[N,j]=w.useState(null),_=w.useRef(null),[S,P]=w.useState([]),[T,R]=w.useState(!1),[k,E]=w.useState(new Set),[q,O]=w.useState("all"),[L,H]=w.useState("all"),[V,z]=w.useState("email"),[M,B]=w.useState(!1),[K,C]=w.useState([]),[A,I]=w.useState(""),[U,Y]=w.useState(!0),[te,re]=w.useState(!1),[J,ie]=w.useState(null);w.useEffect(()=>{ce.auth.getSession().then(({data:{session:ve}})=>n(ve)),Q(),oe()},[]),w.useEffect(()=>{e==="prospects"&&se(),e==="templates"&&oe()},[e,q,L]);const be=()=>({"Content-Type":"application/json",Authorization:`Bearer ${r==null?void 0:r.access_token}`,apikey:HP}),Q=async()=>{const{data:{session:ve}}=await ce.auth.getSession();if(ve)try{const Ue=await(await fetch(`${$g}/functions/v1/user-linkedin-oauth?action=status`,{headers:{Authorization:`Bearer ${ve.access_token}`,apikey:HP}})).json();re(Ue.connected),ie(Ue.profile)}catch{}},Ve=async()=>{const{data:{session:ve}}=await ce.auth.getSession();if(ve)try{const Ue=await(await fetch(`${$g}/functions/v1/user-linkedin-oauth?action=authorize`,{headers:{Authorization:`Bearer ${ve.access_token}`,apikey:HP}})).json();if(Ue.authUrl){const Qe=window.open(Ue.authUrl,"_blank","width=600,height=700"),st=Fe=>{var Ge,ht;((Ge=Fe.data)==null?void 0:Ge.type)==="linkedin-connected"&&((ht=Fe.data)!=null&&ht.success)&&(Q(),ae.success("LinkedIn connecté !"),window.removeEventListener("message",st))};window.addEventListener("message",st)}}catch{ae.error("Connexion LinkedIn échouée")}},W=async()=>{h(!0),p(null);try{const ve=await fetch(`${$g}/functions/v1/scan-linkedin-prospects`,{method:"POST",headers:be(),body:JSON.stringify({mode:"web_search",prospect_type:a,location:o,specialties:c,query:d||void 0,limit:20})}),_e=await ve.json();if(!ve.ok)throw new Error(_e.error);p(_e.prospects||[]),ae.success(`${_e.found} prospects trouvés et enregistrés`)}catch(ve){ae.error(ve.message)}finally{h(!1)}},Z=async()=>{h(!0);try{const ve=await fetch(`${$g}/functions/v1/scan-linkedin-prospects`,{method:"POST",headers:be(),body:JSON.stringify({mode:"api"})}),_e=await ve.json();if(!ve.ok)throw new Error(_e.error);ae.success(`${_e.found} profils connectés importés via API LinkedIn`),p(_e.prospects||[])}catch(ve){ae.error(ve.message)}finally{h(!1)}},he=async()=>{if(g){b(!0),j(null);try{const ve=await g.text(),_e=await fetch(`${$g}/functions/v1/import-linkedin-csv`,{method:"POST",headers:be(),body:JSON.stringify({csv:ve})}),Ue=await _e.json();if(!_e.ok)throw new Error(Ue.error);j(Ue),ae.success(`${Ue.imported} prospects importés`)}catch(ve){ae.error(ve.message)}finally{b(!1)}}},se=async()=>{R(!0);let ve=ce.from("linkedin_prospects").select("*").order("created_at",{ascending:!1}).limit(200);q!=="all"&&(ve=ve.eq("prospect_type",q)),L!=="all"&&(ve=ve.eq("status",L));const{data:_e}=await ve;P(_e||[]),R(!1)},oe=async()=>{const{data:ve}=await ce.from("linkedin_outreach_templates").select("*").order("name");C(ve||[])},le=ve=>{E(_e=>{const Ue=new Set(_e);return Ue.has(ve)?Ue.delete(ve):Ue.add(ve),Ue})},Me=()=>{k.size===S.length?E(new Set):E(new Set(S.map(ve=>ve.id)))},de=async()=>{var ve;if(k.size===0){ae.error("Sélectionnez au moins un prospect");return}B(!0);try{const{data:{session:_e}}=await ce.auth.getSession(),Ue=await fetch(`${$g}/functions/v1/send-linkedin-outreach`,{method:"POST",headers:be(),body:JSON.stringify({prospect_ids:Array.from(k),template_id:A||void 0,channel:V,linkedin_user_id:te?(ve=_e==null?void 0:_e.user)==null?void 0:ve.id:void 0,dry_run:U})}),Qe=await Ue.json();if(!Ue.ok)throw new Error(Qe.error);U?ae.info(`Prévisualisation : ${Qe.total} messages générés`):(ae.success(`${Qe.sent}/${Qe.total} messages envoyés`),se(),E(new Set))}catch(_e){ae.error(_e.message)}finally{B(!1)}},me=async(ve,_e)=>{await ce.from("linkedin_prospects").update({status:_e}).eq("id",ve),P(Ue=>Ue.map(Qe=>Qe.id===ve?{...Qe,status:_e}:Qe))},Le={total:S.length,schools:S.filter(ve=>ve.prospect_type==="school").length,trainers:S.filter(ve=>ve.prospect_type==="trainer").length,contacted:S.filter(ve=>ve.status==="contacted"||ve.status==="replied").length,interested:S.filter(ve=>ve.status==="interested").length,withEmail:S.filter(ve=>ve.email).length};return s.jsxs(s.Fragment,{children:[s.jsx(nr,{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:te?void 0:Ve,className:`flex items-center gap-2 px-4 py-2 rounded-xl text-sm font-bold transition-colors ${te?"bg-green-50 text-green-700 border border-green-200":"bg-[#0077B5] text-white hover:bg-[#005885]"}`,children:te?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"w-2 h-2 bg-green-500 rounded-full"}),(J==null?void 0:J.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 (${Le.total})`},{id:"templates",label:"Templates"}].map(ve=>s.jsx("button",{onClick:()=>t(ve.id),className:`px-5 py-2 text-sm font-bold rounded-xl transition-colors ${e===ve.id?"bg-indigo-600 text-white":"text-slate-500 hover:text-slate-900 hover:bg-slate-100"}`,children:ve.label},ve.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:Le.total},{label:"Écoles",value:Le.schools},{label:"Formateurs",value:Le.trainers},{label:"Contactés",value:Le.contacted},{label:"Intéressés",value:Le.interested}].map(ve=>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:ve.value}),s.jsx("p",{className:"text-xs text-slate-400 mt-1 uppercase tracking-wider",children:ve.label})]},ve.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(ve=>s.jsx("button",{onClick:()=>i(ve),className:`flex-1 py-2.5 text-xs font-bold rounded-xl border transition-colors ${a===ve?"bg-indigo-600 text-white border-indigo-600":"bg-white text-slate-600 border-slate-200"}`,children:ve==="school"?"Écoles / OF":"Formateurs"},ve))}),s.jsx("input",{value:o,onChange:ve=>l(ve.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:Fvt.slice(0,10).map(ve=>s.jsx("button",{onClick:()=>u(_e=>_e.includes(ve)?_e.filter(Ue=>Ue!==ve):[..._e,ve]),className:`px-3 py-1 text-xs font-bold rounded-full border transition-colors ${c.includes(ve)?"bg-indigo-600 text-white border-indigo-600":"bg-white text-slate-600 border-slate-200"}`,children:ve},ve))})]}),s.jsx("input",{value:d,onChange:ve=>f(ve.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)."}),!te&&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"}),x&&s.jsx("div",{className:"mt-4 space-y-2",children:x.slice(0,5).map((ve,_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:ve.name||ve.full_name}),s.jsx("span",{className:`px-2 py-0.5 rounded-full text-[10px] font-bold ${ve.type==="school"?"bg-blue-100 text-blue-700":"bg-green-100 text-green-700"}`,children:ve.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 ve;return(ve=_.current)==null?void 0:ve.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:_,type:"file",accept:".csv",className:"hidden",onChange:ve=>{var _e;(_e=ve.target.files)!=null&&_e[0]&&v(ve.target.files[0])}}),g?s.jsxs("div",{children:[s.jsx("p",{className:"font-bold text-slate-800",children:g.name}),s.jsxs("p",{className:"text-sm text-slate-400 mt-1",children:[(g.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:he,disabled:!g||y,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:y?"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:(Ke=N.preview)==null?void 0:Ke.map((ve,_e)=>s.jsxs("div",{className:"flex justify-between text-sm",children:[s.jsx("span",{className:"text-slate-700",children:ve.name}),s.jsxs("span",{className:`font-bold ${ve.type==="school"?"text-blue-600":"text-green-600"}`,children:[ve.type," (",ve.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:q,onChange:ve=>O(ve.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:L,onChange:ve=>H(ve.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(WP).map(([ve,_e])=>s.jsx("option",{value:ve,children:_e.label},ve))]}),s.jsx("div",{className:"ml-auto flex items-center gap-3",children:k.size>0&&s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"text-sm font-bold text-indigo-600",children:[k.size," sélectionné(s)"]}),s.jsxs("select",{value:A,onChange:ve=>I(ve.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(ve=>s.jsx("option",{value:ve.id,children:ve.name},ve.id))]}),s.jsxs("select",{value:V,onChange:ve=>z(ve.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"}),te&&s.jsx("option",{value:"linkedin_message",children:"LinkedIn message"}),te&&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:ve=>Y(ve.target.checked),className:"rounded"}),"Test"]}),s.jsx("button",{onClick:de,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:T?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:k.size===S.length&&S.length>0,onChange:Me,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(ve=>s.jsxs("tr",{className:`border-b hover:bg-slate-50 transition-colors ${k.has(ve.id)?"bg-indigo-50/30":""}`,children:[s.jsx("td",{className:"px-4 py-3",children:s.jsx("input",{type:"checkbox",checked:k.has(ve.id),onChange:()=>le(ve.id),className:"rounded"})}),s.jsxs("td",{className:"px-4 py-3",children:[s.jsx("div",{className:"font-bold text-slate-800",children:ve.full_name}),ve.title&&s.jsx("div",{className:"text-xs text-slate-400 truncate max-w-[200px]",children:ve.title}),ve.company_name&&s.jsx("div",{className:"text-xs text-indigo-600",children:ve.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 ${ve.prospect_type==="school"?"bg-blue-100 text-blue-700":ve.prospect_type==="trainer"?"bg-green-100 text-green-700":"bg-slate-100 text-slate-500"}`,children:ve.prospect_type==="school"?"École":ve.prospect_type==="trainer"?"Formateur":"?"})}),s.jsxs("td",{className:"px-4 py-3",children:[ve.email?s.jsx("a",{href:`mailto:${ve.email}`,className:"text-indigo-600 text-xs hover:underline",children:ve.email}):s.jsx("span",{className:"text-slate-300 text-xs",children:"—"}),ve.linkedin_url&&s.jsx("a",{href:ve.linkedin_url.startsWith("http")?ve.linkedin_url:`https://${ve.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 ${(ve.confidence_score||0)>70?"text-green-600":(ve.confidence_score||0)>40?"text-amber-600":"text-red-400"}`,children:[ve.confidence_score||0,"%"]})}),s.jsx("td",{className:"px-4 py-3",children:s.jsx("select",{value:ve.status,onChange:_e=>me(ve.id,_e.target.value),className:`text-xs font-bold px-2 py-1 rounded-lg border-0 cursor-pointer ${WP[ve.status].color}`,children:Object.entries(WP).map(([_e,Ue])=>s.jsx("option",{value:_e,children:Ue.label},_e))})}),s.jsx("td",{className:"px-4 py-3 text-xs text-slate-400",children:ve.source==="web_search"?"Web IA":ve.source==="csv_import"?"CSV":ve.source==="linkedin_api"?"API":ve.source}),s.jsx("td",{className:"px-4 py-3",children:s.jsx("button",{onClick:()=>{E(new Set([ve.id])),t("prospects")},className:"text-xs text-indigo-600 hover:underline",children:"Sélect."})})]},ve.id))})]})})]}),e==="templates"&&s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:K.map(ve=>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 ${ve.prospect_type==="school"?"bg-blue-100 text-blue-700":"bg-green-100 text-green-700"}`,children:ve.prospect_type==="school"?"École":"Formateur"}),s.jsx("span",{className:"text-[10px] font-black text-slate-400 uppercase",children:ve.channel}),ve.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:ve.name}),ve.subject&&s.jsxs("p",{className:"text-xs font-bold text-slate-500 mb-3",children:["Objet : ",ve.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:ve.body}),s.jsxs("p",{className:"text-[10px] text-slate-400 mt-3",children:["Variables : ","{{name}}"," ","{{company}}"," ","{{specialty}}"," ","{{trainer_count}}"]})]},ve.id))})]})]})]})}function $vt(){const{user:e,isAdmin:t,loading:r}=Br(),n=Zt(),[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),[x,p]=w.useState(null),[g,v]=w.useState([]),[y,b]=w.useState(""),[N,j]=w.useState(""),[_,S]=w.useState("");w.useEffect(()=>{!r&&(!e||!t)&&n("/auth")},[r,e,t,n]);const P=O=>{var V;const L=(V=O.target.files)==null?void 0:V[0];if(!L)return;l(L.type||"image/jpeg");const H=new FileReader;H.onload=()=>{const z=H.result;u(z),i(z.split(",")[1]||null)},H.readAsDataURL(L)},T=async(O,L)=>{var z;const{data:H,error:V}=await ce.functions.invoke("linkedin-lead-outreach",{body:O});if(V){let M=V.message;try{const B=await((z=V.context)==null?void 0:z.json());B!=null&&B.error&&(M=B.error)}catch{}throw new Error(M||L)}if(!(H!=null&&H.success))throw new Error((H==null?void 0:H.error)||L);return H},R=async()=>{if(!a){ae.error("Choisissez une capture LinkedIn");return}f(!0);try{const O=await T({imageBase64:a,mimeType:o,dryRun:!0},"Échec de l'analyse");p({specialty_keywords:[],...O.lead}),v(O.matched||[]),b(O.subject||""),j(O.html||""),ae.success("Analyse terminée — vérifiez les infos avant d'envoyer")}catch(O){ae.error(O.message||"Erreur d'analyse")}finally{f(!1)}},k=async O=>{if(x){if(O&&!_){ae.error("Indiquez un email pour le test");return}if(!O&&!x.contact_email){ae.error("Aucun email de contact détecté");return}h(!0);try{const L=await T({lead:x,subject:y,html:N,...O?{demoTo:_}:{}},"Échec de l'envoi");ae.success(`Email envoyé à ${L.sentTo}`)}catch(L){ae.error(L.message||"Erreur d'envoi")}finally{h(!1)}}},E=async()=>{if(x){f(!0);try{const O=await T({lead:x,dryRun:!0},"Échec de la régénération");v(O.matched||[]),b(O.subject||""),j(O.html||""),ae.success("Aperçu régénéré depuis les infos")}catch(O){ae.error(O.message||"Erreur")}finally{f(!1)}}},q=(O,L)=>p(H=>H&&{...H,[O]:L});return s.jsx(ba,{children:s.jsxs("div",{className:"container mx-auto px-4 py-8 max-w-3xl",children:[s.jsx(ta,{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(je,{className:"mb-6",children:[s.jsx(mt,{children:s.jsx(gt,{className:"text-lg",children:"1. Capture LinkedIn"})}),s.jsxs(Ee,{className:"space-y-4",children:[s.jsx(Xe,{type:"file",accept:"image/*",onChange:P}),c&&s.jsx("img",{src:c,alt:"aperçu",className:"max-h-64 rounded border"}),s.jsxs(ne,{onClick:R,disabled:d||!a,children:[d?s.jsx(it,{className:"h-4 w-4 mr-2 animate-spin"}):s.jsx(Rs,{className:"h-4 w-4 mr-2"}),"Analyser"]})]})]}),x&&s.jsxs(je,{children:[s.jsxs(mt,{children:[s.jsx(gt,{className:"text-lg",children:"2. Vérifier & envoyer"}),s.jsxs(Kr,{children:["Formateurs proposés : ",g.length?g.join(", "):"(aucun — ajustez les domaines)"]})]}),s.jsxs(Ee,{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(Xe,{value:x.contact_email||"",onChange:O=>q("contact_email",O.target.value)})]}),s.jsxs("div",{children:[s.jsx(We,{children:"Nom du contact"}),s.jsx(Xe,{value:x.contact_name||"",onChange:O=>q("contact_name",O.target.value)})]}),s.jsxs("div",{children:[s.jsx(We,{children:"Établissement"}),s.jsx(Xe,{value:x.organization||"",onChange:O=>q("organization",O.target.value)})]}),s.jsxs("div",{children:[s.jsx(We,{children:"Domaines (séparés par virgule)"}),s.jsx(Xe,{value:(x.specialty_keywords||[]).join(", "),onChange:O=>q("specialty_keywords",O.target.value.split(",").map(L=>L.trim()).filter(Boolean))})]})]}),s.jsxs("div",{children:[s.jsx(We,{children:"Besoin"}),s.jsx(gn,{value:x.need_summary||"",onChange:O=>q("need_summary",O.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:E,disabled:d,children:[d?s.jsx(it,{className:"h-4 w-4 mr-2 animate-spin"}):s.jsx(Rs,{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(Xe,{value:y,onChange:O=>b(O.target.value)})]}),s.jsxs("div",{children:[s.jsx(We,{children:"Corps du mail (HTML)"}),s.jsx(gn,{value:N,onChange:O=>j(O.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:()=>k(!1),disabled:m,children:[m?s.jsx(it,{className:"h-4 w-4 mr-2 animate-spin"}):s.jsx(Js,{className:"h-4 w-4 mr-2"}),"Envoyer au contact"]}),s.jsxs("div",{className:"flex gap-2 items-center",children:[s.jsx(Xe,{placeholder:"email test (démo)",value:_,onChange:O=>S(O.target.value),className:"w-56"}),s.jsx(ne,{variant:"outline",onClick:()=>k(!0),disabled:m,children:"Envoyer un test"})]})]})]})]})]})})}const Bvt=e=>{switch(e.toLowerCase()){case"pdf":return s.jsx(Kt,{className:"h-8 w-8 text-red-500"});case"excel":return s.jsx(ph,{className:"h-8 w-8 text-green-500"});case"word":return s.jsx(IR,{className:"h-8 w-8 text-blue-500"});default:return s.jsx(Kt,{className:"h-8 w-8 text-muted-foreground"})}},uX=e=>({"documents-legaux":"Documents Légaux",programmes:"Programmes",evaluation:"Évaluation","gestion-projet":"Gestion de Projet",commercial:"Commercial",general:"Général"})[e]||e,zvt=()=>{const[e,t]=w.useState(""),[r,n]=w.useState("all"),{data:a,isLoading:i}=la({queryKey:["resources"],queryFn:async()=>{const{data:c,error:u}=await ce.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(ba,{children:[s.jsx(nr,{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(Rs,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),s.jsx(Xe,{placeholder:"Rechercher une ressource...",value:e,onChange:c=>t(c.target.value),className:"pl-10"})]}),s.jsxs(Ar,{value:r,onValueChange:n,children:[s.jsxs(kr,{className:"w-full md:w-[200px]",children:[s.jsx(RR,{className:"h-4 w-4 mr-2"}),s.jsx(Dr,{placeholder:"Catégorie"})]}),s.jsxs(Cr,{children:[s.jsx(ct,{value:"all",children:"Toutes les catégories"}),o.map(c=>s.jsx(ct,{value:c,children:uX(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(je,{className:"animate-pulse",children:[s.jsxs(mt,{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(Ee,{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(Kt,{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(nt,{to:`/ressources/${c.slug}`,children:s.jsxs(je,{className:"h-full hover:shadow-lg transition-shadow cursor-pointer group",children:[s.jsxs(mt,{children:[s.jsxs("div",{className:"flex items-start justify-between",children:[Bvt(c.type),s.jsx(Te,{variant:"secondary",children:uX(c.category)})]}),s.jsx(gt,{className:"mt-4 group-hover:text-primary transition-colors",children:c.title})]}),s.jsxs(Ee,{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(Te,{variant:"outline",children:c.type}),s.jsxs("span",{className:"flex items-center text-muted-foreground",children:[s.jsx(ro,{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(nt,{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"})]})]})]})},dX=(e,t="lg")=>{const r=t==="lg"?"h-12 w-12":"h-6 w-6";switch(e.toLowerCase()){case"pdf":return s.jsx(Kt,{className:`${r} text-red-500`});case"excel":return s.jsx(ph,{className:`${r} text-green-500`});case"word":return s.jsx(IR,{className:`${r} text-blue-500`});default:return s.jsx(Kt,{className:`${r} text-muted-foreground`})}},qvt=e=>({"documents-legaux":"Documents Légaux",programmes:"Programmes",evaluation:"Évaluation","gestion-projet":"Gestion de Projet",commercial:"Commercial",general:"Général"})[e]||e,Uvt=()=>{const{slug:e}=so(),{data:t,isLoading:r}=la({queryKey:["resource",e],queryFn:async()=>{const{data:i,error:o}=await ce.from("resources").select("*").eq("slug",e).eq("is_published",!0).single();if(o)throw o;return i},enabled:!!e}),{data:n}=la({queryKey:["featured-trainers"],queryFn:async()=>{const{data:i,error:o}=await ce.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 ce.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(ba,{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(ba,{children:[s.jsx(nr,{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(nt,{to:"/ressources",className:"inline-flex items-center text-muted-foreground hover:text-primary mb-8",children:[s.jsx(Hn,{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:[dX(t.type),s.jsxs("div",{children:[s.jsx(Te,{variant:"secondary",className:"mb-2",children:qvt(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(HF,{children:t.content})}),s.jsx(je,{className:"mt-8 bg-primary/5 border-primary/20",children:s.jsxs(Ee,{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(nt,{to:"/formateurs",children:s.jsxs(ne,{variant:"outline",children:["Découvrir nos formateurs",s.jsx(Kn,{className:"h-4 w-4 ml-2"})]})})]})})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(je,{className:"sticky top-24",children:[s.jsxs(mt,{className:"text-center",children:[s.jsx("div",{className:"mx-auto mb-4",children:dX(t.type)}),s.jsx(gt,{children:t.title})]}),s.jsxs(Ee,{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-center gap-4 text-sm text-muted-foreground",children:[s.jsx(Te,{variant:"outline",children:t.type}),s.jsxs("span",{className:"flex items-center",children:[s.jsx(ro,{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(ro,{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(je,{children:[s.jsx(mt,{children:s.jsx(gt,{className:"text-lg",children:"Formateurs à la une"})}),s.jsxs(Ee,{className:"space-y-4",children:[n.map(i=>{var o;return s.jsxs(nt,{to:`/formateurs/${i.id}`,className:"flex items-center gap-3 p-2 rounded-lg hover:bg-muted transition-colors",children:[s.jsxs(bs,{children:[s.jsx(ji,{src:i.photo_url||void 0}),s.jsx(ws,{children:s.jsx(Ko,{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(nt,{to:"/formateurs",className:"block text-center text-sm text-primary hover:underline pt-2",children:"Voir tous les formateurs →"})]})]})]})]})]})]}):s.jsx(ba,{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(nt,{to:"/ressources",className:"text-primary hover:underline",children:"Retour aux ressources"})]})})},Vvt=e=>{switch(e.toLowerCase()){case"pdf":return s.jsx(Kt,{className:"h-4 w-4 text-red-500"});case"excel":return s.jsx(ph,{className:"h-4 w-4 text-green-500"});case"word":return s.jsx(IR,{className:"h-4 w-4 text-blue-500"});default:return s.jsx(Kt,{className:"h-4 w-4 text-muted-foreground"})}},fX=[{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"}],Hvt=["PDF","Word","Excel"],Wvt=()=>{const e=u1(),[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}=la({queryKey:["admin-resources"],queryFn:async()=>{const{data:j,error:_}=await ce.from("resources").select("*").order("created_at",{ascending:!1});if(_)throw _;return j}}),h=Mc({mutationFn:async j=>{const{error:_}=await ce.from("resources").insert([j]);if(_)throw _},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-resources"]}),ae.success("Ressource créée"),v()},onError:j=>{ae.error(`Erreur: ${j.message}`)}}),x=Mc({mutationFn:async({id:j,data:_})=>{const{error:S}=await ce.from("resources").update(_).eq("id",j);if(S)throw S},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-resources"]}),ae.success("Ressource mise à jour"),v()},onError:j=>{ae.error(`Erreur: ${j.message}`)}}),p=Mc({mutationFn:async j=>{const{error:_}=await ce.from("resources").delete().eq("id",j);if(_)throw _},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-resources"]}),ae.success("Ressource supprimée")},onError:j=>{ae.error(`Erreur: ${j.message}`)}}),g=async()=>{a(!0);try{const{data:j,error:_}=await ce.functions.invoke("generate-resources");if(_)throw _;j.generated>0?(ae.success(`${j.generated} ressources générées`),e.invalidateQueries({queryKey:["admin-resources"]})):ae.info("Toutes les ressources existent déjà")}catch(j){ae.error(`Erreur: ${j.message}`)}finally{a(!1)}},v=()=>{d({title:"",slug:"",type:"PDF",category:"general",download_url:"",content:"",meta_description:"",is_published:!1}),c(null),r(!1)},y=j=>{c(j),d({title:j.title,slug:j.slug,type:j.type,category:j.category,download_url:j.download_url||"",content:j.content,meta_description:j.meta_description||"",is_published:j.is_published}),r(!0)},b=()=>{if(!u.title||!u.slug||!u.content){ae.error("Veuillez remplir tous les champs obligatoires");return}l?x.mutate({id:l.id,data:u}):h.mutate(u)},N=j=>j.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:g,disabled:n,children:[n?s.jsx(it,{className:"h-4 w-4 mr-2 animate-spin"}):s.jsx(v2,{className:"h-4 w-4 mr-2"}),"Générer les ressources"]}),s.jsxs(qn,{open:t,onOpenChange:r,children:[s.jsx(Xo,{asChild:!0,children:s.jsxs(ne,{onClick:()=>v(),children:[s.jsx(Qa,{className:"h-4 w-4 mr-2"}),"Nouvelle ressource"]})}),s.jsxs($n,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[s.jsx(Un,{children:s.jsx(Vn,{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(Xe,{value:u.title,onChange:j=>{d({...u,title:j.target.value,slug:u.slug||N(j.target.value)})},placeholder:"Modèle de Convention..."})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{children:"Slug *"}),s.jsx(Xe,{value:u.slug,onChange:j=>d({...u,slug:j.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(Ar,{value:u.type,onValueChange:j=>d({...u,type:j}),children:[s.jsx(kr,{children:s.jsx(Dr,{})}),s.jsx(Cr,{children:Hvt.map(j=>s.jsx(ct,{value:j,children:j},j))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{children:"Catégorie"}),s.jsxs(Ar,{value:u.category,onValueChange:j=>d({...u,category:j}),children:[s.jsx(kr,{children:s.jsx(Dr,{})}),s.jsx(Cr,{children:fX.map(j=>s.jsx(ct,{value:j.value,children:j.label},j.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(Xe,{value:u.download_url,onChange:j=>d({...u,download_url:j.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(it,{className:"h-4 w-4 animate-spin"}):s.jsx(lc,{className:"h-4 w-4"})}),s.jsx("input",{id:"file-upload",type:"file",accept:".pdf,.doc,.docx,.xls,.xlsx",className:"hidden",onChange:async j=>{var S;const _=(S=j.target.files)==null?void 0:S[0];if(_){o(!0);try{const P=_.name.split(".").pop(),T=`${u.slug||"resource"}-${Date.now()}.${P}`,{data:R,error:k}=await ce.storage.from("resources").upload(T,_,{upsert:!0});if(k)throw k;const{data:E}=ce.storage.from("resources").getPublicUrl(R.path);d({...u,download_url:E.publicUrl}),ae.success("Fichier uploadé")}catch(P){ae.error(`Erreur upload: ${P.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(Xe,{value:u.meta_description,onChange:j=>d({...u,meta_description:j.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:j=>d({...u,content:j.target.value}),placeholder:"Contenu détaillé (Markdown supporté)",rows:10})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(jy,{id:"published",checked:u.is_published,onCheckedChange:j=>d({...u,is_published:j})}),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:b,disabled:h.isPending||x.isPending,children:[(h.isPending||x.isPending)&&s.jsx(it,{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(je,{children:[s.jsx(mt,{className:"pb-2",children:s.jsx(gt,{className:"text-sm text-muted-foreground",children:"Total ressources"})}),s.jsx(Ee,{children:s.jsx("p",{className:"text-2xl font-bold",children:(f==null?void 0:f.length)||0})})]}),s.jsxs(je,{children:[s.jsx(mt,{className:"pb-2",children:s.jsx(gt,{className:"text-sm text-muted-foreground",children:"Publiées"})}),s.jsx(Ee,{children:s.jsx("p",{className:"text-2xl font-bold",children:(f==null?void 0:f.filter(j=>j.is_published).length)||0})})]}),s.jsxs(je,{children:[s.jsx(mt,{className:"pb-2",children:s.jsx(gt,{className:"text-sm text-muted-foreground",children:"Total téléchargements"})}),s.jsx(Ee,{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(je,{children:s.jsx(Ee,{className:"p-0",children:s.jsxs(jh,{children:[s.jsx(_h,{children:s.jsxs(Fa,{children:[s.jsx(vr,{children:"Ressource"}),s.jsx(vr,{children:"Type"}),s.jsx(vr,{children:"Catégorie"}),s.jsx(vr,{children:"Téléchargements"}),s.jsx(vr,{children:"Statut"}),s.jsx(vr,{className:"text-right",children:"Actions"})]})}),s.jsx(Nh,{children:m?s.jsx(Fa,{children:s.jsx(cr,{colSpan:6,className:"text-center py-8",children:s.jsx(it,{className:"h-6 w-6 animate-spin mx-auto"})})}):(f==null?void 0:f.length)===0?s.jsx(Fa,{children:s.jsx(cr,{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(j=>{var _;return s.jsxs(Fa,{children:[s.jsx(cr,{children:s.jsxs("div",{className:"flex items-center gap-2",children:[Vvt(j.type),s.jsx("span",{className:"font-medium",children:j.title})]})}),s.jsx(cr,{children:s.jsx(Te,{variant:"outline",children:j.type})}),s.jsx(cr,{children:((_=fX.find(S=>S.value===j.category))==null?void 0:_.label)||j.category}),s.jsx(cr,{children:s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(ro,{className:"h-4 w-4"}),j.download_count]})}),s.jsx(cr,{children:s.jsx(Te,{variant:j.is_published?"default":"secondary",children:j.is_published?"Publié":"Brouillon"})}),s.jsx(cr,{className:"text-right",children:s.jsxs("div",{className:"flex justify-end gap-2",children:[j.is_published&&s.jsx(ne,{variant:"ghost",size:"sm",asChild:!0,children:s.jsx(nt,{to:`/ressources/${j.slug}`,target:"_blank",children:s.jsx(Kn,{className:"h-4 w-4"})})}),s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>y(j),children:s.jsx(bC,{className:"h-4 w-4"})}),s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>{confirm("Supprimer cette ressource ?")&&p.mutate(j.id)},children:s.jsx(ri,{className:"h-4 w-4 text-destructive"})})]})})]},j.id)})})]})})})]})};function Gvt(){const e=Zt(),{isAdmin:t,loading:r}=Br(),[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 ce.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 ce.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 ce.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(it,{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(ta,{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(je,{children:s.jsxs(Ee,{className:"py-12 text-center",children:[s.jsx(Fi,{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(je,{className:f.is_read?"opacity-75":"border-primary/50",children:[s.jsx(mt,{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(Ko,{className:"w-5 h-5 text-primary"})}),s.jsxs("div",{children:[s.jsxs(gt,{className:"text-lg flex items-center gap-2",children:[f.name,!f.is_read&&s.jsx(Te,{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(_n,{className:"w-3 h-3"}),f.email]}),f.phone&&s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(a1,{className:"w-3 h-3"}),f.phone]})]})]})]}),s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(Hs,{className:"w-4 h-4"}),Dt(new Date(f.created_at),"d MMM yyyy 'à' HH:mm",{locale:br})]})]})}),s.jsxs(Ee,{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(_n,{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(Gu,{children:[s.jsx(th,{asChild:!0,children:s.jsxs(ne,{variant:"ghost",size:"sm",className:"text-destructive",children:[s.jsx(ri,{className:"w-4 h-4 mr-2"}),"Supprimer"]})}),s.jsxs(Kc,{children:[s.jsxs(Xc,{children:[s.jsx(Zc,{children:"Supprimer ce message ?"}),s.jsx(Jc,{children:"Cette action est irréversible."})]}),s.jsxs(Yc,{children:[s.jsx(Ku,{children:"Annuler"}),s.jsx(Qc,{onClick:()=>u(f.id),children:"Supprimer"})]})]})]})]})]})]},f.id))})]})})}const Kvt={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 Xvt(){const e=Zt(),{isAdmin:t,loading:r}=Br(),[n,a]=w.useState(!0),[i,o]=w.useState([]),[l,c]=w.useState(""),[u,d]=w.useState("pending"),[f,m]=w.useState(null),[h,x]=w.useState(""),[p,g]=w.useState(null);w.useEffect(()=>{!r&&!t&&e("/auth")},[t,r,e]),w.useEffect(()=>{t&&v()},[t]);const v=async()=>{try{const{data:R,error:k}=await ce.from("trainer_documents").select(`
*,
trainer:trainer_profile_id (
id,
name,
email,
photo_url
)
`).order("created_at",{ascending:!1});if(k)throw k;o(await cE(R||[]))}catch(R){console.error("Error loading documents:",R),ae.error("Erreur lors du chargement des documents")}finally{a(!1)}},y=async R=>{g(R.id);try{const{error:k}=await Wu.from("trainer_documents").update({status:"verified",verified_at:new Date().toISOString(),verified_source:"admin",admin_comment:null}).eq("id",R.id);if(k)throw k;ae.success("Document vérifié avec succès"),v()}catch(k){console.error("Error verifying document:",k),ae.error("Erreur lors de la vérification")}finally{g(null)}},b=async()=>{if(f){g(f.id);try{const{error:R}=await ce.from("trainer_documents").update({status:"rejected",admin_comment:h||"Document non conforme"}).eq("id",f.id);if(R)throw R;ae.success("Document rejeté"),m(null),x(""),v()}catch(R){console.error("Error rejecting document:",R),ae.error("Erreur lors du rejet")}finally{g(null)}}},N=(R,k)=>{switch(R){case"verified":return k==="certiskool"?s.jsxs(Te,{className:"bg-green-600",children:[s.jsx(wi,{className:"w-3 h-3 mr-1"}),"Vérifié via CertiSkool"]}):s.jsxs(Te,{className:"bg-green-500",children:[s.jsx(Zn,{className:"w-3 h-3 mr-1"}),"Vérifié"]});case"rejected":return s.jsxs(Te,{variant:"destructive",children:[s.jsx(vs,{className:"w-3 h-3 mr-1"}),"Rejeté"]});default:return s.jsxs(Te,{variant:"secondary",children:[s.jsx($r,{className:"w-3 h-3 mr-1"}),"En attente"]})}},j=R=>R.split(" ").map(k=>k[0]).join("").toUpperCase().slice(0,2),_=i.filter(R=>{var E,q;const k=((q=(E=R.trainer)==null?void 0:E.name)==null?void 0:q.toLowerCase().includes(l.toLowerCase()))||R.document_name.toLowerCase().includes(l.toLowerCase())||R.document_type.toLowerCase().includes(l.toLowerCase());return u==="all"?k:k&&R.status===u}),S=i.filter(R=>R.status==="pending").length,P=i.filter(R=>R.status==="verified").length,T=i.filter(R=>R.status==="rejected").length;return r||n?s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:s.jsx(it,{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(ta,{items:[{label:"Documents Formateurs"}]}),s.jsxs(je,{children:[s.jsx(mt,{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(gt,{className:"flex items-center gap-2",children:[s.jsx(Kt,{className:"h-6 w-6 text-primary"}),"Gestion des Documents"]}),s.jsx(Kr,{children:"Vérifiez et validez les documents soumis par les formateurs"})]}),s.jsxs("div",{className:"relative",children:[s.jsx(Rs,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),s.jsx(Xe,{placeholder:"Rechercher...",value:l,onChange:R=>c(R.target.value),className:"pl-10 w-64"})]})]})}),s.jsxs(Ee,{children:[s.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-6",children:[s.jsx(je,{children:s.jsx(Ee,{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(je,{className:"border-amber-200 bg-amber-50 dark:bg-amber-950/20",children:s.jsx(Ee,{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(je,{className:"border-green-200 bg-green-50 dark:bg-green-950/20",children:s.jsx(Ee,{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:P})]})})}),s.jsx(je,{className:"border-red-200 bg-red-50 dark:bg-red-950/20",children:s.jsx(Ee,{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:T})]})})})]}),s.jsxs(uf,{value:u,onValueChange:d,children:[s.jsxs(fd,{className:"mb-4",children:[s.jsxs(Mn,{value:"pending",children:["En attente (",S,")"]}),s.jsxs(Mn,{value:"verified",children:["Vérifiés (",P,")"]}),s.jsxs(Mn,{value:"rejected",children:["Rejetés (",T,")"]}),s.jsxs(Mn,{value:"all",children:["Tous (",i.length,")"]})]}),s.jsx(Os,{value:u,children:_.length===0?s.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:[s.jsx(Kt,{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:_.map(R=>{var k,E,q,O;return s.jsx(je,{className:"hover:shadow-md transition-shadow",children:s.jsx(Ee,{className:"p-4",children:s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsxs(bs,{className:"h-12 w-12",children:[(k=R.trainer)!=null&&k.photo_url?s.jsx(ji,{src:R.trainer.photo_url}):null,s.jsx(ws,{className:"bg-primary text-primary-foreground",children:(E=R.trainer)!=null&&E.name?j(R.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:[((q=R.trainer)==null?void 0:q.name)||"Formateur inconnu",N(R.status,R.verified_source)]}),s.jsx("p",{className:"text-sm text-muted-foreground",children:(O=R.trainer)==null?void 0:O.email})]}),s.jsx("div",{className:"text-right text-sm text-muted-foreground",children:new Date(R.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(Kt,{className:"h-4 w-4 text-primary"}),s.jsx("span",{className:"font-medium",children:Kvt[R.document_type]||R.document_type})]}),s.jsx("p",{className:"text-sm text-muted-foreground",children:R.document_name}),R.expires_at&&s.jsxs("p",{className:"text-xs text-amber-600 mt-1",children:[s.jsx(td,{className:"h-3 w-3 inline mr-1"}),"Expire le ",new Date(R.expires_at).toLocaleDateString("fr-FR")]}),R.admin_comment&&R.status==="rejected"&&s.jsxs("p",{className:"text-sm text-red-600 mt-2",children:[s.jsx("strong",{children:"Motif :"})," ",R.admin_comment]})]}),s.jsxs("div",{className:"flex gap-2 mt-3 flex-wrap",children:[R.viewUrl?s.jsx(ne,{variant:"outline",size:"sm",asChild:!0,children:s.jsxs("a",{href:R.viewUrl,target:"_blank",rel:"noopener noreferrer",children:[s.jsx(es,{className:"h-4 w-4 mr-2"}),"Voir le document",s.jsx(Kn,{className:"h-3 w-3 ml-1"})]})}):s.jsxs(ne,{variant:"outline",size:"sm",disabled:!0,children:[s.jsx(td,{className:"h-4 w-4 mr-2"}),"Fichier indisponible"]}),R.status==="pending"&&s.jsxs(s.Fragment,{children:[s.jsxs(ne,{size:"sm",onClick:()=>y(R),disabled:p===R.id,className:"bg-green-600 hover:bg-green-700",children:[p===R.id?s.jsx(it,{className:"h-4 w-4 animate-spin mr-2"}):s.jsx(Zn,{className:"h-4 w-4 mr-2"}),"Valider"]}),s.jsxs(ne,{size:"sm",variant:"destructive",onClick:()=>m(R),disabled:p===R.id,children:[s.jsx(vs,{className:"h-4 w-4 mr-2"}),"Rejeter"]})]}),s.jsxs(ne,{variant:"ghost",size:"sm",onClick:()=>e("/admin/trainers"),children:[s.jsx(Ko,{className:"h-4 w-4 mr-2"}),"Voir le profil"]})]})]})]})})},R.id)})})})]})]})]})]}),s.jsx(Gu,{open:!!f,onOpenChange:()=>m(null),children:s.jsxs(Kc,{children:[s.jsxs(Xc,{children:[s.jsx(Zc,{children:"Rejeter ce document ?"}),s.jsx(Jc,{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:R=>x(R.target.value),rows:3})}),s.jsxs(Yc,{children:[s.jsx(Ku,{children:"Annuler"}),s.jsx(Qc,{onClick:b,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Confirmer le rejet"})]})]})})]})}const Bg={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"}},Yvt=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 Zvt(){const e=Zt(),{isAdmin:t,loading:r}=Br(),[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:y,error:b}=await ce.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(b)throw b;o(y||[])}catch(y){console.error("Error loading drive documents:",y),ae.error("Erreur lors du chargement des documents Drive")}finally{a(!1)}},x=async()=>{m(!0);try{const{data:{session:y}}=await ce.auth.getSession(),b=await fetch("https://pedagobridge.com/functions/v1/sync-drive-documents",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${y==null?void 0:y.access_token}`,apikey:void 0},body:JSON.stringify({})}),N=await b.json();if(!b.ok)throw new Error(N.error||"Échec de la synchronisation");ae.success(`Synchronisé : ${N.total_files} fichiers indexés`),await h()}catch(y){console.error("Drive sync failed:",y),ae.error(y.message||"Erreur lors de la synchronisation")}finally{m(!1)}},p=w.useMemo(()=>{const y={};for(const b of i)y[b.category]=(y[b.category]||0)+1;return y},[i]),g=w.useMemo(()=>{const y=l.toLowerCase().trim();return i.filter(b=>u!=="all"&&b.category!==u?!1:y?b.file_name.toLowerCase().includes(y)||(b.folder_path||"").toLowerCase().includes(y):!0)},[i,l,u]),v=w.useMemo(()=>Object.keys(Bg).filter(y=>p[y]>0),[p]);return r||n?s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:s.jsx(it,{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(ta,{items:[{label:"Documents Drive"}]}),s.jsxs(je,{children:[s.jsx(mt,{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(gt,{className:"flex items-center gap-2",children:[s.jsx(Xj,{className:"h-6 w-6 text-primary"}),"Documents Drive"]}),s.jsx(Kr,{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(Rs,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),s.jsx(Xe,{placeholder:"Rechercher un fichier ou dossier...",value:l,onChange:y=>c(y.target.value),className:"pl-10 w-64"})]}),s.jsxs(ne,{onClick:x,disabled:f,children:[f?s.jsx(it,{className:"h-4 w-4 mr-2 animate-spin"}):s.jsx(Qs,{className:"h-4 w-4 mr-2"}),"Synchroniser"]})]})]})}),s.jsxs(Ee,{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(y=>s.jsxs("button",{onClick:()=>d(y),className:`text-xs font-bold px-3 py-1.5 rounded-full border transition-colors ${u===y?Bg[y].className:"bg-background hover:bg-muted border-border"}`,children:[Bg[y].label," (",p[y],")"]},y))]}),i.length===0?s.jsxs("div",{className:"text-center py-16 text-muted-foreground",children:[s.jsx(LR,{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:x,disabled:f,children:[f?s.jsx(it,{className:"h-4 w-4 mr-2 animate-spin"}):s.jsx(Qs,{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:[g.map(y=>{var b,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(Kt,{className:"h-4 w-4 text-muted-foreground shrink-0"}),s.jsx("span",{className:"truncate font-medium",title:y.file_name,children:y.file_name}),s.jsx(u_,{source:"drive"})]})}),s.jsx("td",{className:"px-4 py-3",children:s.jsx(Te,{variant:"outline",className:`text-xs ${((b=Bg[y.category])==null?void 0:b.className)||Bg.autre.className}`,children:((N=Bg[y.category])==null?void 0:N.label)||y.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:y.folder_path||"",children:y.folder_path||"—"})}),s.jsx("td",{className:"px-4 py-3 hidden lg:table-cell text-muted-foreground whitespace-nowrap",children:Yvt(y.file_size)}),s.jsx("td",{className:"px-4 py-3 hidden lg:table-cell text-muted-foreground whitespace-nowrap",children:y.drive_modified_at?new Date(y.drive_modified_at).toLocaleDateString("fr-FR"):"—"}),s.jsx("td",{className:"px-4 py-3 text-right",children:y.web_view_link&&s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>window.open(y.web_view_link,"_blank","noopener,noreferrer"),children:s.jsx(Kn,{className:"h-4 w-4"})})})]},y.id)}),g.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."})})]})]})})]})]})]})})}const FS={imported:{label:"Importé",className:"bg-slate-100 text-slate-700 border-slate-300"},invited:{label:"Invité",className:"bg-amber-100 text-amber-700 border-amber-300"},claimed:{label:"A créé son compte",className:"bg-emerald-100 text-emerald-700 border-emerald-300"},ignored:{label:"Ignoré",className:"bg-muted text-muted-foreground border-border"}},Jvt=15;function Qvt(){const e=Zt(),{isAdmin:t,loading:r}=Br(),[n,a]=w.useState(!0),[i,o]=w.useState([]),[l,c]=w.useState(""),[u,d]=w.useState("active"),[f,m]=w.useState(!1),[h,x]=w.useState(!1),[p,g]=w.useState(null);w.useEffect(()=>{!r&&!t&&e("/auth")},[t,r,e]),w.useEffect(()=>{t&&v()},[t]);const v=async()=>{try{const{data:R,error:k}=await ce.from("off_platform_trainers").select("id, name, email, phone, specialties, city, domain, source_folder_path, cv_drive_file_id, cv_file_name, cv_web_view_link, drive_modified_at, doc_count, status, cv_analyzed, notes").order("cv_analyzed",{ascending:!0}).order("name",{ascending:!0,nullsFirst:!1}).limit(2e3);if(k)throw k;o(R||[])}catch(R){console.error("Error loading off-platform trainers:",R),ae.error("Erreur lors du chargement des formateurs hors plateforme")}finally{a(!1)}},y=async R=>{const{data:k,error:E}=await ce.functions.invoke("import-drive-trainers",{body:R});if(E)throw new Error(E.message);if(!(k!=null&&k.success))throw new Error((k==null?void 0:k.error)||"Échec");return k},b=async()=>{m(!0);try{const R=await y({mode:"import"});ae.success(`Import terminé : ${R.inserted} nouveau(x), ${R.updated} mis à jour (${R.total_candidates} CV au total)`),await v()}catch(R){ae.error(R.message||"Erreur lors de l'import")}finally{m(!1)}},N=async()=>{x(!0);const R=ae.loading("Analyse des CV en cours…");try{let k=1/0,E=0,q=0;for(;k>0&&q<200;){const O=await y({mode:"enrich",limit:Jvt});if(E+=O.processed,k=O.remaining,q++,ae.loading(`Analyse des CV… ${E} traités, ${k} restants`,{id:R}),O.processed===0)break}ae.success(`Analyse terminée : ${E} CV traités`,{id:R}),await v()}catch(k){ae.error(k.message||"Erreur lors de l'analyse",{id:R})}finally{x(!1)}},j=async(R,k)=>{const{error:E}=await ce.from("off_platform_trainers").update({status:k}).eq("id",R);if(E){ae.error("Échec de la mise à jour");return}o(q=>q.map(O=>O.id===R?{...O,status:k}:O))},_=async R=>{if(!R.email){ae.error("Aucun email — analysez d'abord le CV");return}g(R.id);try{const{data:k,error:E}=await ce.functions.invoke("invite-off-platform-trainer",{body:{id:R.id}});if(E)throw new Error(E.message);if(!(k!=null&&k.success))throw new Error((k==null?void 0:k.error)||"Échec de l'invitation");ae.success(`Invitation envoyée à ${k.sentTo}`),o(q=>q.map(O=>O.id===R.id?{...O,status:"invited"}:O))}catch(k){ae.error(k.message||"Erreur lors de l'invitation")}finally{g(null)}},S=w.useMemo(()=>{const R={imported:0,invited:0,claimed:0,ignored:0};for(const k of i)R[k.status]=(R[k.status]||0)+1;return R},[i]),P=w.useMemo(()=>i.filter(R=>R.cv_analyzed).length,[i]),T=w.useMemo(()=>{const R=l.toLowerCase().trim();return i.filter(k=>(u==="active"?k.status==="ignored":k.status!==u)?!1:R?(k.name||"").toLowerCase().includes(R)||(k.email||"").toLowerCase().includes(R)||(k.city||"").toLowerCase().includes(R)||(k.domain||"").toLowerCase().includes(R)||(k.specialties||[]).some(E=>E.toLowerCase().includes(R)):!0)},[i,l,u]);return r||n?s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:s.jsx(it,{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(ta,{items:[{label:"Formateurs hors plateforme"}]}),s.jsxs(je,{children:[s.jsx(mt,{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(gt,{className:"flex items-center gap-2",children:[s.jsx(Xj,{className:"h-6 w-6 text-primary"}),"Formateurs hors plateforme"]}),s.jsxs(Kr,{children:["Profils issus des CV du Drive, ",s.jsx("strong",{children:"jamais visibles publiquement"}),". Ils ne deviennent de vrais profils qu'après création de compte ou invitation."]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(ne,{variant:"outline",onClick:b,disabled:f||h,children:[f?s.jsx(it,{className:"h-4 w-4 mr-2 animate-spin"}):s.jsx(Qs,{className:"h-4 w-4 mr-2"}),"Importer depuis le Drive"]}),s.jsxs(ne,{onClick:N,disabled:h||f||i.length===0,children:[h?s.jsx(it,{className:"h-4 w-4 mr-2 animate-spin"}):s.jsx(Mi,{className:"h-4 w-4 mr-2"}),"Analyser les CV"]})]})]})}),s.jsxs(Ee,{children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-4",children:[s.jsxs("div",{className:"relative",children:[s.jsx(Rs,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),s.jsx(Xe,{placeholder:"Nom, ville, domaine, spécialité…",value:l,onChange:R=>c(R.target.value),className:"pl-10 w-72"})]}),s.jsxs("span",{className:"text-xs text-muted-foreground ml-auto",children:[P,"/",i.length," CV analysés"]})]}),s.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[s.jsxs("button",{onClick:()=>d("active"),className:`text-xs font-bold px-3 py-1.5 rounded-full border transition-colors ${u==="active"?"bg-primary text-primary-foreground border-primary":"bg-background hover:bg-muted border-border"}`,children:["Actifs (",i.length-S.ignored,")"]}),["imported","invited","claimed","ignored"].map(R=>s.jsxs("button",{onClick:()=>d(R),className:`text-xs font-bold px-3 py-1.5 rounded-full border transition-colors ${u===R?FS[R].className:"bg-background hover:bg-muted border-border"}`,children:[FS[R].label," (",S[R],")"]},R))]}),i.length===0?s.jsxs("div",{className:"text-center py-16 text-muted-foreground",children:[s.jsx(LR,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),s.jsx("p",{className:"mb-4",children:"Aucun formateur importé pour l'instant."}),s.jsxs(ne,{onClick:b,disabled:f,children:[f?s.jsx(it,{className:"h-4 w-4 mr-2 animate-spin"}):s.jsx(Qs,{className:"h-4 w-4 mr-2"}),"Importer depuis le Drive"]})]}):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:"Formateur"}),s.jsx("th",{className:"text-left font-semibold px-4 py-3 hidden md:table-cell",children:"Ville / Domaine"}),s.jsx("th",{className:"text-left font-semibold px-4 py-3 hidden lg:table-cell",children:"Spécialités"}),s.jsx("th",{className:"text-left font-semibold px-4 py-3",children:"Statut"}),s.jsx("th",{className:"px-4 py-3"})]})}),s.jsxs("tbody",{children:[T.map(R=>s.jsxs("tr",{className:"border-t hover:bg-muted/30 transition-colors align-top",children:[s.jsxs("td",{className:"px-4 py-3 max-w-[260px]",children:[s.jsxs("div",{className:"font-medium flex items-center gap-2",children:[R.name||s.jsx("span",{className:"italic text-muted-foreground",children:"Nom inconnu"}),!R.cv_analyzed&&s.jsx(Te,{variant:"outline",className:"text-[10px]",children:"non analysé"})]}),R.email&&s.jsx("div",{className:"text-xs text-muted-foreground truncate",title:R.email,children:R.email}),R.phone&&s.jsx("div",{className:"text-xs text-muted-foreground",children:R.phone})]}),s.jsxs("td",{className:"px-4 py-3 hidden md:table-cell text-muted-foreground",children:[s.jsx("div",{children:R.city||"—"}),s.jsx("div",{className:"text-xs",children:R.domain||""})]}),s.jsx("td",{className:"px-4 py-3 hidden lg:table-cell max-w-[280px]",children:s.jsxs("div",{className:"flex flex-wrap gap-1",children:[(R.specialties||[]).slice(0,4).map((k,E)=>s.jsx(Te,{variant:"secondary",className:"text-[10px] font-normal",children:k},E)),(R.specialties||[]).length>4&&s.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["+",R.specialties.length-4]})]})}),s.jsx("td",{className:"px-4 py-3",children:s.jsx(Te,{variant:"outline",className:`text-xs ${FS[R.status].className}`,children:FS[R.status].label})}),s.jsxs("td",{className:"px-4 py-3 text-right whitespace-nowrap",children:[R.cv_web_view_link&&s.jsx(ne,{variant:"ghost",size:"sm",title:"Voir le CV (Drive)",onClick:()=>window.open(R.cv_web_view_link,"_blank","noopener,noreferrer"),children:s.jsx(Kt,{className:"h-4 w-4"})}),R.email&&R.status!=="claimed"&&R.status!=="ignored"&&s.jsx(ne,{variant:"ghost",size:"sm",disabled:p===R.id,title:R.status==="invited"?"Relancer l'invitation":"Inviter à créer un compte",onClick:()=>_(R),children:p===R.id?s.jsx(it,{className:"h-4 w-4 animate-spin"}):s.jsx(_n,{className:"h-4 w-4"})}),R.status==="ignored"?s.jsx(ne,{variant:"ghost",size:"sm",title:"Réactiver",onClick:()=>j(R.id,"imported"),children:s.jsx(es,{className:"h-4 w-4"})}):s.jsx(ne,{variant:"ghost",size:"sm",title:"Ignorer",onClick:()=>j(R.id,"ignored"),children:s.jsx(yC,{className:"h-4 w-4"})})]})]},R.id)),T.length===0&&s.jsx("tr",{children:s.jsx("td",{colSpan:5,className:"text-center py-10 text-muted-foreground",children:"Aucun résultat pour ce filtre."})})]})]})})]})]})]})})}function eyt(){const e=Zt(),{user:t,isAdmin:r,loading:n}=Br(),[a,i]=w.useState(!0),[o,l]=w.useState([]),[c,u]=w.useState("all"),[d,f]=w.useState(null),[m,h]=w.useState(""),[x,p]=w.useState(!1);w.useEffect(()=>{n||(t?r?g():(ae.error("Accès réservé aux administrateurs"),e("/")):e("/auth"))},[t,r,n,e]);const g=async()=>{try{const{data:j,error:_}=await ce.from("nda_assistance_requests").select("*").order("created_at",{ascending:!1});if(_)throw _;l(j||[])}catch(j){console.error("Error loading NDA requests:",j),ae.error("Erreur lors du chargement des demandes")}finally{i(!1)}},v=async j=>{if(!(!d||!t)){p(!0);try{const{error:_}=await ce.from("nda_assistance_requests").update({status:j,admin_notes:m.trim()||null,processed_at:j!=="pending"?new Date().toISOString():null,processed_by:j!=="pending"?t.id:null}).eq("id",d.id);if(_)throw _;ae.success("Statut mis à jour"),f(null),h(""),await g()}catch(_){console.error("Error updating request:",_),ae.error("Erreur lors de la mise à jour")}finally{p(!1)}}},y=j=>{switch(j){case"pending":return s.jsxs(Te,{variant:"secondary",className:"bg-amber-100 text-amber-700",children:[s.jsx($r,{className:"h-3 w-3 mr-1"}),"En attente"]});case"in_progress":return s.jsxs(Te,{variant:"secondary",className:"bg-blue-100 text-blue-700",children:[s.jsx(QB,{className:"h-3 w-3 mr-1"}),"En cours"]});case"completed":return s.jsxs(Te,{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(Te,{variant:"secondary",className:"bg-red-100 text-red-700",children:[s.jsx(vs,{className:"h-3 w-3 mr-1"}),"Refusée"]});default:return s.jsx(Te,{variant:"outline",children:j})}},b=c==="all"?o:o.filter(j=>j.status===c),N=o.filter(j=>j.status==="pending").length;return n||a?s.jsx("div",{className:"min-h-screen flex items-center justify-center",children:s.jsx(it,{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(ta,{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(Hn,{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(Kt,{className:"h-8 w-8"}),"Demandes d'assistance NDA",N>0&&s.jsx(Te,{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(je,{className:"mb-6",children:s.jsx(Ee,{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx(We,{children:"Filtrer par statut :"}),s.jsxs(Ar,{value:c,onValueChange:u,children:[s.jsx(kr,{className:"w-48",children:s.jsx(Dr,{})}),s.jsxs(Cr,{children:[s.jsxs(ct,{value:"all",children:["Tous (",o.length,")"]}),s.jsxs(ct,{value:"pending",children:["En attente (",o.filter(j=>j.status==="pending").length,")"]}),s.jsxs(ct,{value:"in_progress",children:["En cours (",o.filter(j=>j.status==="in_progress").length,")"]}),s.jsxs(ct,{value:"completed",children:["Terminées (",o.filter(j=>j.status==="completed").length,")"]}),s.jsxs(ct,{value:"rejected",children:["Refusées (",o.filter(j=>j.status==="rejected").length,")"]})]})]})]})})}),b.length===0?s.jsx(je,{children:s.jsxs(Ee,{className:"p-12 text-center",children:[s.jsx(Kt,{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:b.map(j=>s.jsx(je,{className:"hover:shadow-md transition-shadow",children:s.jsx(Ee,{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:j.trainer_name}),y(j.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(_n,{className:"h-4 w-4"}),s.jsx("a",{href:`mailto:${j.trainer_email}`,className:"hover:underline",children:j.trainer_email})]}),j.phone&&s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(a1,{className:"h-4 w-4"}),s.jsx("a",{href:`tel:${j.phone}`,className:"hover:underline",children:j.phone})]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(Hs,{className:"h-4 w-4"}),new Date(j.created_at).toLocaleDateString("fr-FR")]})]}),j.message&&s.jsx("div",{className:"p-3 bg-muted rounded-md",children:s.jsx("p",{className:"text-sm",children:j.message})}),j.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:j.admin_notes})]})]}),s.jsxs("div",{className:"flex gap-2 ml-4",children:[s.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>e(`/trainer/${j.trainer_profile_id}`),children:[s.jsx(Ko,{className:"h-4 w-4 mr-1"}),"Profil"]}),s.jsx(ne,{size:"sm",onClick:()=>{f(j),h(j.admin_notes||"")},children:"Gérer"})]})]})})},j.id))}),s.jsx(qn,{open:!!d,onOpenChange:j=>!j&&f(null),children:s.jsxs($n,{children:[s.jsxs(Un,{children:[s.jsx(Vn,{children:"Gérer la demande"}),s.jsxs(Sa,{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:j=>h(j.target.value),placeholder:"Ajouter des notes sur cette demande...",rows:4})]})}),s.jsxs(bl,{className:"flex-col sm:flex-row gap-2",children:[s.jsxs(ne,{variant:"outline",onClick:()=>v("pending"),disabled:x||(d==null?void 0:d.status)==="pending",children:[s.jsx($r,{className:"h-4 w-4 mr-1"}),"En attente"]}),s.jsxs(ne,{variant:"outline",onClick:()=>v("in_progress"),disabled:x,className:"border-blue-500 text-blue-600 hover:bg-blue-50",children:[s.jsx(QB,{className:"h-4 w-4 mr-1"}),"En cours"]}),s.jsxs(ne,{variant:"outline",onClick:()=>v("rejected"),disabled:x,className:"border-red-500 text-red-600 hover:bg-red-50",children:[s.jsx(vs,{className:"h-4 w-4 mr-1"}),"Refuser"]}),s.jsxs(ne,{onClick:()=>v("completed"),disabled:x,className:"bg-green-600 hover:bg-green-700",children:[x?s.jsx(it,{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 _j={};_j.version="0.18.5";var ic=1200,P0=1252,tyt=[874,932,936,949,950,1250,1251,1252,1253,1254,1255,1256,1257,1258,1e4],s7={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},_A=function(e){tyt.indexOf(e)!=-1&&(P0=s7[0]=e)};function ryt(){_A(1252)}var Hc=function(e){ic=e,_A(e)};function NA(){Hc(1200),ryt()}function $k(e){for(var t=[],r=0,n=e.length;r<n;++r)t[r]=e.charCodeAt(r);return t}function nyt(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 Fhe(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 vv=function(e){var t=e.charCodeAt(0),r=e.charCodeAt(1);return t==255&&r==254?nyt(e.slice(2)):t==254&&r==255?Fhe(e.slice(2)):t==65279?e.slice(1):e},cw=function(t){return String.fromCharCode(t)},wI=function(t){return String.fromCharCode(t)},Pn;function syt(e){Pn=e,Hc=function(t){ic=t,_A(t)},vv=function(t){return t.charCodeAt(0)===255&&t.charCodeAt(1)===254?Pn.utils.decode(1200,$k(t.slice(2))):t},cw=function(r){return ic===1200?String.fromCharCode(r):Pn.utils.decode(ic,[r&255,r>>8])[0]},wI=function(r){return Pn.utils.decode(P0,[r])[0]},dme()}var Fm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function Nj(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+=Fm.charAt(i)+Fm.charAt(o)+Fm.charAt(l)+Fm.charAt(c);return t}function uc(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=Fm.indexOf(e.charAt(u++)),o=Fm.indexOf(e.charAt(u++)),r=i<<2|o>>4,t+=String.fromCharCode(r),l=Fm.indexOf(e.charAt(u++)),n=(o&15)<<4|l>>2,l!==64&&(t+=String.fromCharCode(n)),c=Fm.indexOf(e.charAt(u++)),a=(l&3)<<6|c,c!==64&&(t+=String.fromCharCode(a));return t}var pn=function(){return typeof Buffer<"u"&&typeof process<"u"&&typeof process.versions<"u"&&!!process.versions.node}(),Ph=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 vp(e){return pn?Buffer.alloc?Buffer.alloc(e):new Buffer(e):typeof Uint8Array<"u"?new Uint8Array(e):new Array(e)}function hX(e){return pn?Buffer.allocUnsafe?Buffer.allocUnsafe(e):new Buffer(e):typeof Uint8Array<"u"?new Uint8Array(e):new Array(e)}var Yl=function(t){return pn?Ph(t,"binary"):t.split("").map(function(r){return r.charCodeAt(0)&255})};function P_(e){if(typeof ArrayBuffer>"u")return Yl(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 Bp(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 ayt(e){if(typeof Uint8Array>"u")throw new Error("Unsupported");return new Uint8Array(e)}function a7(e){if(typeof ArrayBuffer>"u")throw new Error("Unsupported");if(e instanceof ArrayBuffer)return a7(new Uint8Array(e));for(var t=new Array(e.length),r=0;r<e.length;++r)t[r]=e[r];return t}var Di=pn?function(e){return Buffer.concat(e.map(function(t){return Buffer.isBuffer(t)?t:Ph(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 iyt(e){for(var t=[],r=0,n=e.length+250,a=vp(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=vp(65535),n=65530)}return t.push(a.slice(0,r)),Di(t)}var No=/\u0000/g,uw=/[\u0001-\u0006]/g;function zv(e){for(var t="",r=e.length-1;r>=0;)t+=e.charAt(r--);return t}function Uu(e,t){var r=""+e;return r.length>=t?r:va("0",t-r.length)+r}function i7(e,t){var r=""+e;return r.length>=t?r:va(" ",t-r.length)+r}function Bk(e,t){var r=""+e;return r.length>=t?r:r+va(" ",t-r.length)}function oyt(e,t){var r=""+Math.round(e);return r.length>=t?r:va("0",t-r.length)+r}function lyt(e,t){var r=""+e;return r.length>=t?r:va("0",t-r.length)+r}var mX=Math.pow(2,32);function zg(e,t){if(e>mX||e<-mX)return oyt(e,t);var r=Math.round(e);return lyt(r,t)}function zk(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 pX=[["Sun","Sunday"],["Mon","Monday"],["Tue","Tuesday"],["Wed","Wednesday"],["Thu","Thursday"],["Fri","Friday"],["Sat","Saturday"]],GP=[["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 cyt(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 Sr={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"秒 "'},xX={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},uyt={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 qk(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 Mm(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=xyt(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 Mhe=new Date(1899,11,31,0,0,0),dyt=Mhe.getTime(),fyt=new Date(1900,2,1,0,0,0);function $he(e,t){var r=e.getTime();return t?r-=1461*24*60*60*1e3:e>=fyt&&(r+=24*60*60*1e3),(r-(dyt+(e.getTimezoneOffset()-Mhe.getTimezoneOffset())*6e4))/(24*60*60*1e3)}function o7(e){return e.indexOf(".")==-1?e:e.replace(/(?:\.0*|(\.\d*[1-9])0+)$/,"$1")}function hyt(e){return e.indexOf("E")==-1?e:e.replace(/(?:\.0*|(\.\d*[1-9])0+)[Ee]/,"$1E").replace(/(E[+-])(\d)$/,"$10$2")}function myt(e){var t=e<0?12:11,r=o7(e.toFixed(12));return r.length<=t||(r=e.toPrecision(10),r.length<=t)?r:e.toExponential(5)}function pyt(e){var t=o7(e.toFixed(11));return t.length>(e<0?12:11)||t==="0"||t==="-0"?e.toPrecision(6):t}function Sj(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=myt(e):t===10?r=e.toFixed(10).substr(0,12):r=pyt(e),o7(hyt(r.toUpperCase()))}function O0(e,t){switch(typeof e){case"string":return e;case"boolean":return e?"TRUE":"FALSE";case"number":return(e|0)===e?e.toString(10):Sj(e);case"undefined":return"";case"object":if(e==null)return"";if(e instanceof Date)return dc(14,$he(e,t&&t.date1904),t)}throw new Error("unsupported value in General format: "+e)}function xyt(e,t){t[0]-=581;var r=e.getDay();return e<60&&(r=(r+6)%7),r}function gyt(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 GP[r.m-1][1];case 5:return GP[r.m-1][0];default:return GP[r.m-1][2]}break;case 100:switch(t.length){case 1:case 2:c=r.d,u=t.length;break;case 3:return pX[r.q][0];default:return pX[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")?Uu(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=Uu(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?Uu(c,u):"";return d}function $m(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 Bhe=/%/g;function vyt(e,t,r){var n=t.replace(Bhe,""),a=t.length-n.length;return ih(e,n,r*Math.pow(10,2*a))+va("%",a)}function yyt(e,t,r){for(var n=t.length-1;t.charCodeAt(n-1)===44;)--n;return ih(e,t.substr(0,n),r/Math.pow(10,3*(t.length-n)))}function zhe(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"-"+zhe(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 qhe=/# (\?+)( ?)\/( ?)(\d+)/;function byt(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?va(" ",e[1].length+1+e[4].length):i7(o,e[1].length)+e[2]+"/"+e[3]+Uu(l,e[4].length))}function wyt(e,t,r){return r+(t===0?"":""+t)+va(" ",e[1].length+2+e[4].length)}var Uhe=/^#*0*\.([0#]+)/,Vhe=/\).*[0#]/,Hhe=/\(###\) ###\\?-####/;function Bo(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 gX(e,t){var r=Math.pow(10,t);return""+Math.round(e*r)/r}function vX(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 jyt(e,t){return t<(""+Math.round((e-Math.floor(e))*Math.pow(10,t))).length?1:0}function _yt(e){return e<2147483647&&e>-2147483648?""+(e>=0?e|0:e-1|0):""+Math.floor(e)}function kc(e,t,r){if(e.charCodeAt(0)===40&&!t.match(Vhe)){var n=t.replace(/\( */,"").replace(/ \)/,"").replace(/\)/,"");return r>=0?kc("n",n,r):"("+kc("n",n,-r)+")"}if(t.charCodeAt(t.length-1)===44)return yyt(e,t,r);if(t.indexOf("%")!==-1)return vyt(e,t,r);if(t.indexOf("E")!==-1)return zhe(t,r);if(t.charCodeAt(0)===36)return"$"+kc(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+zg(c,t.length);if(t.match(/^[#?]+$/))return a=zg(r,0),a==="0"&&(a=""),a.length>t.length?a:Bo(t.substr(0,t.length-a.length))+a;if(i=t.match(qhe))return byt(i,c,u);if(t.match(/^#+0+$/))return u+zg(c,t.length-t.indexOf("0"));if(i=t.match(Uhe))return a=gX(r,i[1].length).replace(/^([^\.]+)$/,"$1."+Bo(i[1])).replace(/\.$/,"."+Bo(i[1])).replace(/\.(\d*)$/,function(x,p){return"."+p+va("0",Bo(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+gX(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+$m(zg(c,0));if(i=t.match(/^#,##0\.([#0]*0)$/))return r<0?"-"+kc(e,t,-r):$m(""+(Math.floor(r)+jyt(r,i[1].length)))+"."+Uu(vX(r,i[1].length),i[1].length);if(i=t.match(/^#,#*,#0/))return kc(e,t.replace(/^#,#*,/,""),r);if(i=t.match(/^([0#]+)(\\?-([0#]+))+$/))return a=zv(kc(e,t.replace(/[\\-]/g,""),r)),o=0,zv(zv(t.replace(/\\/g,"")).replace(/[0#]/g,function(x){return o<a.length?a.charAt(o++):x==="0"?"0":""}));if(t.match(Hhe))return a=kc(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=qk(c,Math.pow(10,o)-1,!1),a=""+u,d=ih("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=Bk(l[2],o),d.length<i[4].length&&(d=Bo(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=qk(c,Math.pow(10,o)-1,!0),u+(l[0]||(l[1]?"":"0"))+" "+(l[1]?i7(l[1],o)+i[2]+"/"+i[3]+Bk(l[2],o):va(" ",2*o+1+i[2].length+i[3].length));if(i=t.match(/^[#0?]+$/))return a=zg(r,0),t.length<=a.length?a:Bo(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 Bo(t.substr(0,f)+a+t.substr(t.length-m))}if(i=t.match(/^00,000\.([#0]*0)$/))return o=vX(r,i[1].length),r<0?"-"+kc(e,t,-r):$m(_yt(r)).replace(/^\d,\d{3}$/,"0$&").replace(/^\d*$/,function(x){return"00,"+(x.length<3?Uu(0,3-x.length):"")+x})+"."+Uu(o,i[1].length);switch(t){case"###,##0.00":return kc(e,"#,##0.00",r);case"###,###":case"##,###":case"#,###":var h=$m(zg(c,0));return h!=="0"?u+h:"";case"###,###.00":return kc(e,"###,##0.00",r).replace(/^0\./,".");case"#,###.00":return kc(e,"#,##0.00",r).replace(/^0\./,".")}throw new Error("unsupported format |"+t+"|")}function Nyt(e,t,r){for(var n=t.length-1;t.charCodeAt(n-1)===44;)--n;return ih(e,t.substr(0,n),r/Math.pow(10,3*(t.length-n)))}function Syt(e,t,r){var n=t.replace(Bhe,""),a=t.length-n.length;return ih(e,n,r*Math.pow(10,2*a))+va("%",a)}function Whe(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"-"+Whe(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 Ad(e,t,r){if(e.charCodeAt(0)===40&&!t.match(Vhe)){var n=t.replace(/\( */,"").replace(/ \)/,"").replace(/\)/,"");return r>=0?Ad("n",n,r):"("+Ad("n",n,-r)+")"}if(t.charCodeAt(t.length-1)===44)return Nyt(e,t,r);if(t.indexOf("%")!==-1)return Syt(e,t,r);if(t.indexOf("E")!==-1)return Whe(t,r);if(t.charCodeAt(0)===36)return"$"+Ad(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+Uu(c,t.length);if(t.match(/^[#?]+$/))return a=""+r,r===0&&(a=""),a.length>t.length?a:Bo(t.substr(0,t.length-a.length))+a;if(i=t.match(qhe))return wyt(i,c,u);if(t.match(/^#+0+$/))return u+Uu(c,t.length-t.indexOf("0"));if(i=t.match(Uhe))return a=(""+r).replace(/^([^\.]+)$/,"$1."+Bo(i[1])).replace(/\.$/,"."+Bo(i[1])),a=a.replace(/\.(\d*)$/,function(x,p){return"."+p+va("0",Bo(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+$m(""+c);if(i=t.match(/^#,##0\.([#0]*0)$/))return r<0?"-"+Ad(e,t,-r):$m(""+r)+"."+va("0",i[1].length);if(i=t.match(/^#,#*,#0/))return Ad(e,t.replace(/^#,#*,/,""),r);if(i=t.match(/^([0#]+)(\\?-([0#]+))+$/))return a=zv(Ad(e,t.replace(/[\\-]/g,""),r)),o=0,zv(zv(t.replace(/\\/g,"")).replace(/[0#]/g,function(x){return o<a.length?a.charAt(o++):x==="0"?"0":""}));if(t.match(Hhe))return a=Ad(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=qk(c,Math.pow(10,o)-1,!1),a=""+u,d=ih("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=Bk(l[2],o),d.length<i[4].length&&(d=Bo(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=qk(c,Math.pow(10,o)-1,!0),u+(l[0]||(l[1]?"":"0"))+" "+(l[1]?i7(l[1],o)+i[2]+"/"+i[3]+Bk(l[2],o):va(" ",2*o+1+i[2].length+i[3].length));if(i=t.match(/^[#0?]+$/))return a=""+r,t.length<=a.length?a:Bo(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 Bo(t.substr(0,f)+a+t.substr(t.length-m))}if(i=t.match(/^00,000\.([#0]*0)$/))return r<0?"-"+Ad(e,t,-r):$m(""+r).replace(/^\d,\d{3}$/,"0$&").replace(/^\d*$/,function(x){return"00,"+(x.length<3?Uu(0,3-x.length):"")+x})+"."+Uu(0,i[1].length);switch(t){case"###,###":case"##,###":case"#,###":var h=$m(""+c);return h!=="0"?u+h:"";default:if(t.match(/\.[0#?]*$/))return Ad(e,t.slice(0,t.lastIndexOf(".")),r)+Bo(t.slice(t.lastIndexOf(".")))}throw new Error("unsupported format |"+t+"|")}function ih(e,t,r){return(r|0)===r?Ad(e,t,r):kc(e,t,r)}function kyt(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 Ghe=/\[[HhMmSs\u0E0A\u0E19\u0E17]*\]/;function rg(e){for(var t=0,r="",n="";t<e.length;)switch(r=e.charAt(t)){case"G":zk(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(Ghe))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 Cyt(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(!zk(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),x=h==="("||h===")"?h:"t";a[a.length]={t:x,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=Mm(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=Mm(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=Mm(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(Ghe)){if(u==null&&(u=Mm(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]||"$",rg(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 g=0,v=0,y;for(o=a.length-1,c="t";o>=0;--o)switch(a[o].t){case"h":case"H":a[o].t=m,c="h",g<1&&(g=1);break;case"s":(y=a[o].v.match(/\.0+$/))&&(v=Math.max(v,y[0].length-1)),g<3&&(g=3);case"d":case"y":case"M":case"e":c=a[o].t;break;case"m":c==="s"&&(a[o].t="M",g<2&&(g=2));break;case"X":break;case"Z":g<1&&a[o].v.match(/[Hh]/)&&(g=1),g<2&&a[o].v.match(/[Mm]/)&&(g=2),g<3&&a[o].v.match(/[Ss]/)&&(g=3)}switch(g){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 b="",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=gyt(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;b+=a[o].v,o=N-1;break;case"G":a[o].t="t",a[o].v=O0(t,r);break}var j="",_,S;if(b.length>0){b.charCodeAt(0)==40?(_=t<0&&b.charCodeAt(0)===45?-t:t,S=ih("n",b,_)):(_=t<0&&n>1?-t:t,S=ih("n",b,_),_<0&&a[0]&&a[0].t=="t"&&(S=S.substr(1),a[0].v="-"+a[0].v)),N=S.length-1;var P=a.length;for(o=0;o<a.length;++o)if(a[o]!=null&&a[o].t!="t"&&a[o].v.indexOf(".")>-1){P=o;break}var T=a.length;if(P===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",T=o);N>=0&&T<a.length&&(a[T].v=S.substr(0,N+1)+a[T].v)}else if(P!==a.length&&S.indexOf("E")===-1){for(N=S.indexOf(".")-1,o=P;o>=0;--o)if(!(a[o]==null||"n?".indexOf(a[o].t)===-1)){for(d=a[o].v.indexOf(".")>-1&&o===P?a[o].v.indexOf(".")-1:a[o].v.length-1,j=a[o].v.substr(d+1);d>=0;--d)N>=0&&(a[o].v.charAt(d)==="0"||a[o].v.charAt(d)==="#")&&(j=S.charAt(N--)+j);a[o].v=j,a[o].t="t",T=o}for(N>=0&&T<a.length&&(a[T].v=S.substr(0,N+1)+a[T].v),N=S.indexOf(".")+1,o=P;o<a.length;++o)if(!(a[o]==null||"n?(".indexOf(a[o].t)===-1&&o!==P)){for(d=a[o].v.indexOf(".")>-1&&o===P?a[o].v.indexOf(".")+1:0,j=a[o].v.substr(0,d);d<a[o].v.length;++d)N<S.length&&(j+=S.charAt(N++));a[o].v=j,a[o].t="t",T=o}}}for(o=0;o<a.length;++o)a[o]!=null&&"n?".indexOf(a[o].t)>-1&&(_=n>1&&t<0&&o>0&&a[o-1].v==="-"?-t:t,a[o].v=ih(a[o].t,a[o].v,_),a[o].t="t");var R="";for(o=0;o!==a.length;++o)a[o]!=null&&(R+=a[o].v);return R}var yX=/\[(=|>[=]?|<[>=]?)(-?\d+(?:\.\d*)?)\]/;function bX(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 Eyt(e,t){var r=kyt(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(yX),l=r[1].match(yX);return bX(t,o)?[n,r[0]]:bX(t,l)?[n,r[1]]:[n,r[o!=null&&l!=null?2:1]]}return[n,i]}function dc(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:Sr)[e],n==null&&(n=r.table&&r.table[xX[e]]||Sr[xX[e]]),n==null&&(n=uyt[e]||"General");break}if(zk(n,0))return O0(t,r);t instanceof Date&&(t=$he(t,r.date1904));var a=Eyt(n,t);if(zk(a[1]))return O0(t,r);if(t===!0)t="TRUE";else if(t===!1)t="FALSE";else if(t===""||t==null)return"";return Cyt(a[1],t,r,a[0])}function ef(e,t){if(typeof t!="number"){t=+t||-1;for(var r=0;r<392;++r){if(Sr[r]==null){t<0&&(t=r);continue}if(Sr[r]==e){t=r;break}}t<0&&(t=391)}return Sr[t]=e,t}function O_(e){for(var t=0;t!=392;++t)e[t]!==void 0&&ef(e[t],t)}function U1(){Sr=cyt()}var l7={format:dc,load:ef,_table:Sr,load_table:O_,parse_date_code:Mm,is_date:rg,get_table:function(){return l7._table=Sr}},Ayt={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"},Khe=/[dD]+|[mM]+|[yYeE]+|[Hh]+|[Ss]+/g;function Tyt(e){var t=typeof e=="number"?Sr[e]:e;return t=t.replace(Khe,"(\\d+)"),new RegExp("^"+t+"$")}function Pyt(e,t,r){var n=-1,a=-1,i=-1,o=-1,l=-1,c=-1;(t.match(Khe)||[]).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 Oyt=function(){var e={};e.version="1.2.0";function t(){for(var S=0,P=new Array(256),T=0;T!=256;++T)S=T,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,P[T]=S;return typeof Int32Array<"u"?new Int32Array(P):P}var r=t();function n(S){var P=0,T=0,R=0,k=typeof Int32Array<"u"?new Int32Array(4096):new Array(4096);for(R=0;R!=256;++R)k[R]=S[R];for(R=0;R!=256;++R)for(T=S[R],P=256+R;P<4096;P+=256)T=k[P]=T>>>8^S[T&255];var E=[];for(R=1;R!=16;++R)E[R-1]=typeof Int32Array<"u"?k.subarray(R*256,R*256+256):k.slice(R*256,R*256+256);return E}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],x=a[9],p=a[10],g=a[11],v=a[12],y=a[13],b=a[14];function N(S,P){for(var T=P^-1,R=0,k=S.length;R<k;)T=T>>>8^r[(T^S.charCodeAt(R++))&255];return~T}function j(S,P){for(var T=P^-1,R=S.length-15,k=0;k<R;)T=b[S[k++]^T&255]^y[S[k++]^T>>8&255]^v[S[k++]^T>>16&255]^g[S[k++]^T>>>24]^p[S[k++]]^x[S[k++]]^h[S[k++]]^m[S[k++]]^f[S[k++]]^d[S[k++]]^u[S[k++]]^c[S[k++]]^l[S[k++]]^o[S[k++]]^i[S[k++]]^r[S[k++]];for(R+=15;k<R;)T=T>>>8^r[(T^S[k++])&255];return~T}function _(S,P){for(var T=P^-1,R=0,k=S.length,E=0,q=0;R<k;)E=S.charCodeAt(R++),E<128?T=T>>>8^r[(T^E)&255]:E<2048?(T=T>>>8^r[(T^(192|E>>6&31))&255],T=T>>>8^r[(T^(128|E&63))&255]):E>=55296&&E<57344?(E=(E&1023)+64,q=S.charCodeAt(R++)&1023,T=T>>>8^r[(T^(240|E>>8&7))&255],T=T>>>8^r[(T^(128|E>>2&63))&255],T=T>>>8^r[(T^(128|q>>6&15|(E&3)<<4))&255],T=T>>>8^r[(T^(128|q&63))&255]):(T=T>>>8^r[(T^(224|E>>12&15))&255],T=T>>>8^r[(T^(128|E>>6&63))&255],T=T>>>8^r[(T^(128|E&63))&255]);return~T}return e.table=r,e.bstr=N,e.buf=j,e.str=_,e}(),jr=function(){var t={};t.version="1.2.1";function r(pe,Ae){for(var Ne=pe.split("/"),ke=Ae.split("/"),Pe=0,Re=0,Ce=Math.min(Ne.length,ke.length);Pe<Ce;++Pe){if(Re=Ne[Pe].length-ke[Pe].length)return Re;if(Ne[Pe]!=ke[Pe])return Ne[Pe]<ke[Pe]?-1:1}return Ne.length-ke.length}function n(pe){if(pe.charAt(pe.length-1)=="/")return pe.slice(0,-1).indexOf("/")===-1?pe:n(pe.slice(0,-1));var Ae=pe.lastIndexOf("/");return Ae===-1?pe:pe.slice(0,Ae+1)}function a(pe){if(pe.charAt(pe.length-1)=="/")return a(pe.slice(0,-1));var Ae=pe.lastIndexOf("/");return Ae===-1?pe:pe.slice(Ae+1)}function i(pe,Ae){typeof Ae=="string"&&(Ae=new Date(Ae));var Ne=Ae.getHours();Ne=Ne<<6|Ae.getMinutes(),Ne=Ne<<5|Ae.getSeconds()>>>1,pe.write_shift(2,Ne);var ke=Ae.getFullYear()-1980;ke=ke<<4|Ae.getMonth()+1,ke=ke<<5|Ae.getDate(),pe.write_shift(2,ke)}function o(pe){var Ae=pe.read_shift(2)&65535,Ne=pe.read_shift(2)&65535,ke=new Date,Pe=Ne&31;Ne>>>=5;var Re=Ne&15;Ne>>>=4,ke.setMilliseconds(0),ke.setFullYear(Ne+1980),ke.setMonth(Re-1),ke.setDate(Pe);var Ce=Ae&31;Ae>>>=5;var $e=Ae&63;return Ae>>>=6,ke.setHours(Ae),ke.setMinutes($e),ke.setSeconds(Ce<<1),ke}function l(pe){Ji(pe,0);for(var Ae={},Ne=0;pe.l<=pe.length-4;){var ke=pe.read_shift(2),Pe=pe.read_shift(2),Re=pe.l+Pe,Ce={};switch(ke){case 21589:Ne=pe.read_shift(1),Ne&1&&(Ce.mtime=pe.read_shift(4)),Pe>5&&(Ne&2&&(Ce.atime=pe.read_shift(4)),Ne&4&&(Ce.ctime=pe.read_shift(4))),Ce.mtime&&(Ce.mt=new Date(Ce.mtime*1e3));break}pe.l=Re,Ae[ke]=Ce}return Ae}var c;function u(){return c||(c={})}function d(pe,Ae){if(pe[0]==80&&pe[1]==75)return ot(pe,Ae);if((pe[0]|32)==109&&(pe[1]|32)==105)return Xt(pe,Ae);if(pe.length<512)throw new Error("CFB file size "+pe.length+" < 512");var Ne=3,ke=512,Pe=0,Re=0,Ce=0,$e=0,Be=0,Ze=[],et=pe.slice(0,512);Ji(et,0);var wt=f(et);switch(Ne=wt[0],Ne){case 3:ke=512;break;case 4:ke=4096;break;case 0:if(wt[1]==0)return ot(pe,Ae);default:throw new Error("Major Version: Expected 3 or 4 saw "+Ne)}ke!==512&&(et=pe.slice(0,ke),Ji(et,28));var Rt=pe.slice(0,ke);m(et,Ne);var qt=et.read_shift(4,"i");if(Ne===3&&qt!==0)throw new Error("# Directory Sectors: Expected 0 saw "+qt);et.l+=4,Ce=et.read_shift(4,"i"),et.l+=4,et.chk("00100000","Mini Stream Cutoff Size: "),$e=et.read_shift(4,"i"),Pe=et.read_shift(4,"i"),Be=et.read_shift(4,"i"),Re=et.read_shift(4,"i");for(var Pt=-1,Ht=0;Ht<109&&(Pt=et.read_shift(4,"i"),!(Pt<0));++Ht)Ze[Ht]=Pt;var Rr=h(pe,ke);g(Be,Re,Rr,ke,Ze);var ds=y(Rr,Ce,Ze,ke);ds[Ce].name="!Directory",Pe>0&&$e!==q&&(ds[$e].name="!MiniFAT"),ds[Ze[0]].name="!FAT",ds.fat_addrs=Ze,ds.ssz=ke;var jn={},da=[],gd=[],pu=[];b(Ce,ds,Rr,da,Pe,jn,gd,$e),x(gd,pu,da),da.shift();var vd={FileIndex:gd,FullPaths:pu};return Ae&&Ae.raw&&(vd.raw={header:Rt,sectors:Rr}),vd}function f(pe){if(pe[pe.l]==80&&pe[pe.l+1]==75)return[0,0];pe.chk(O,"Header Signature: "),pe.l+=16;var Ae=pe.read_shift(2,"u");return[pe.read_shift(2,"u"),Ae]}function m(pe,Ae){var Ne=9;switch(pe.l+=2,Ne=pe.read_shift(2)){case 9:if(Ae!=3)throw new Error("Sector Shift: Expected 9 saw "+Ne);break;case 12:if(Ae!=4)throw new Error("Sector Shift: Expected 12 saw "+Ne);break;default:throw new Error("Sector Shift: Expected 9 or 12 saw "+Ne)}pe.chk("0600","Mini Sector Shift: "),pe.chk("000000000000","Reserved: ")}function h(pe,Ae){for(var Ne=Math.ceil(pe.length/Ae)-1,ke=[],Pe=1;Pe<Ne;++Pe)ke[Pe-1]=pe.slice(Pe*Ae,(Pe+1)*Ae);return ke[Ne-1]=pe.slice(Ne*Ae),ke}function x(pe,Ae,Ne){for(var ke=0,Pe=0,Re=0,Ce=0,$e=0,Be=Ne.length,Ze=[],et=[];ke<Be;++ke)Ze[ke]=et[ke]=ke,Ae[ke]=Ne[ke];for(;$e<et.length;++$e)ke=et[$e],Pe=pe[ke].L,Re=pe[ke].R,Ce=pe[ke].C,Ze[ke]===ke&&(Pe!==-1&&Ze[Pe]!==Pe&&(Ze[ke]=Ze[Pe]),Re!==-1&&Ze[Re]!==Re&&(Ze[ke]=Ze[Re])),Ce!==-1&&(Ze[Ce]=ke),Pe!==-1&&ke!=Ze[ke]&&(Ze[Pe]=Ze[ke],et.lastIndexOf(Pe)<$e&&et.push(Pe)),Re!==-1&&ke!=Ze[ke]&&(Ze[Re]=Ze[ke],et.lastIndexOf(Re)<$e&&et.push(Re));for(ke=1;ke<Be;++ke)Ze[ke]===ke&&(Re!==-1&&Ze[Re]!==Re?Ze[ke]=Ze[Re]:Pe!==-1&&Ze[Pe]!==Pe&&(Ze[ke]=Ze[Pe]));for(ke=1;ke<Be;++ke)if(pe[ke].type!==0){if($e=ke,$e!=Ze[$e])do $e=Ze[$e],Ae[ke]=Ae[$e]+"/"+Ae[ke];while($e!==0&&Ze[$e]!==-1&&$e!=Ze[$e]);Ze[ke]=-1}for(Ae[0]+="/",ke=1;ke<Be;++ke)pe[ke].type!==2&&(Ae[ke]+="/")}function p(pe,Ae,Ne){for(var ke=pe.start,Pe=pe.size,Re=[],Ce=ke;Ne&&Pe>0&&Ce>=0;)Re.push(Ae.slice(Ce*E,Ce*E+E)),Pe-=E,Ce=_x(Ne,Ce*4);return Re.length===0?dt(0):Di(Re).slice(0,pe.size)}function g(pe,Ae,Ne,ke,Pe){var Re=q;if(pe===q){if(Ae!==0)throw new Error("DIFAT chain shorter than expected")}else if(pe!==-1){var Ce=Ne[pe],$e=(ke>>>2)-1;if(!Ce)return;for(var Be=0;Be<$e&&(Re=_x(Ce,Be*4))!==q;++Be)Pe.push(Re);g(_x(Ce,ke-4),Ae-1,Ne,ke,Pe)}}function v(pe,Ae,Ne,ke,Pe){var Re=[],Ce=[];Pe||(Pe=[]);var $e=ke-1,Be=0,Ze=0;for(Be=Ae;Be>=0;){Pe[Be]=!0,Re[Re.length]=Be,Ce.push(pe[Be]);var et=Ne[Math.floor(Be*4/ke)];if(Ze=Be*4&$e,ke<4+Ze)throw new Error("FAT boundary crossed: "+Be+" 4 "+ke);if(!pe[et])break;Be=_x(pe[et],Ze)}return{nodes:Re,data:OX([Ce])}}function y(pe,Ae,Ne,ke){var Pe=pe.length,Re=[],Ce=[],$e=[],Be=[],Ze=ke-1,et=0,wt=0,Rt=0,qt=0;for(et=0;et<Pe;++et)if($e=[],Rt=et+Ae,Rt>=Pe&&(Rt-=Pe),!Ce[Rt]){Be=[];var Pt=[];for(wt=Rt;wt>=0;){Pt[wt]=!0,Ce[wt]=!0,$e[$e.length]=wt,Be.push(pe[wt]);var Ht=Ne[Math.floor(wt*4/ke)];if(qt=wt*4&Ze,ke<4+qt)throw new Error("FAT boundary crossed: "+wt+" 4 "+ke);if(!pe[Ht]||(wt=_x(pe[Ht],qt),Pt[wt]))break}Re[Rt]={nodes:$e,data:OX([Be])}}return Re}function b(pe,Ae,Ne,ke,Pe,Re,Ce,$e){for(var Be=0,Ze=ke.length?2:0,et=Ae[pe].data,wt=0,Rt=0,qt;wt<et.length;wt+=128){var Pt=et.slice(wt,wt+128);Ji(Pt,64),Rt=Pt.read_shift(2),qt=EA(Pt,0,Rt-Ze),ke.push(qt);var Ht={name:qt,type:Pt.read_shift(1),color:Pt.read_shift(1),L:Pt.read_shift(4,"i"),R:Pt.read_shift(4,"i"),C:Pt.read_shift(4,"i"),clsid:Pt.read_shift(16),state:Pt.read_shift(4,"i"),start:0,size:0},Rr=Pt.read_shift(2)+Pt.read_shift(2)+Pt.read_shift(2)+Pt.read_shift(2);Rr!==0&&(Ht.ct=N(Pt,Pt.l-8));var ds=Pt.read_shift(2)+Pt.read_shift(2)+Pt.read_shift(2)+Pt.read_shift(2);ds!==0&&(Ht.mt=N(Pt,Pt.l-8)),Ht.start=Pt.read_shift(4,"i"),Ht.size=Pt.read_shift(4,"i"),Ht.size<0&&Ht.start<0&&(Ht.size=Ht.type=0,Ht.start=q,Ht.name=""),Ht.type===5?(Be=Ht.start,Pe>0&&Be!==q&&(Ae[Be].name="!StreamData")):Ht.size>=4096?(Ht.storage="fat",Ae[Ht.start]===void 0&&(Ae[Ht.start]=v(Ne,Ht.start,Ae.fat_addrs,Ae.ssz)),Ae[Ht.start].name=Ht.name,Ht.content=Ae[Ht.start].data.slice(0,Ht.size)):(Ht.storage="minifat",Ht.size<0?Ht.size=0:Be!==q&&Ht.start!==q&&Ae[Be]&&(Ht.content=p(Ht,Ae[Be].data,(Ae[$e]||{}).data))),Ht.content&&Ji(Ht.content,0),Re[qt]=Ht,Ce.push(Ht)}}function N(pe,Ae){return new Date((Pi(pe,Ae+4)/1e7*Math.pow(2,32)+Pi(pe,Ae)/1e7-11644473600)*1e3)}function j(pe,Ae){return u(),d(c.readFileSync(pe),Ae)}function _(pe,Ae){var Ne=Ae&&Ae.type;switch(Ne||pn&&Buffer.isBuffer(pe)&&(Ne="buffer"),Ne||"base64"){case"file":return j(pe,Ae);case"base64":return d(Yl(uc(pe)),Ae);case"binary":return d(Yl(pe),Ae)}return d(pe,Ae)}function S(pe,Ae){var Ne=Ae||{},ke=Ne.root||"Root Entry";if(pe.FullPaths||(pe.FullPaths=[]),pe.FileIndex||(pe.FileIndex=[]),pe.FullPaths.length!==pe.FileIndex.length)throw new Error("inconsistent CFB structure");pe.FullPaths.length===0&&(pe.FullPaths[0]=ke+"/",pe.FileIndex[0]={name:ke,type:5}),Ne.CLSID&&(pe.FileIndex[0].clsid=Ne.CLSID),P(pe)}function P(pe){var Ae="Sh33tJ5";if(!jr.find(pe,"/"+Ae)){var Ne=dt(4);Ne[0]=55,Ne[1]=Ne[3]=50,Ne[2]=54,pe.FileIndex.push({name:Ae,type:2,content:Ne,size:4,L:69,R:69,C:69}),pe.FullPaths.push(pe.FullPaths[0]+Ae),T(pe)}}function T(pe,Ae){S(pe);for(var Ne=!1,ke=!1,Pe=pe.FullPaths.length-1;Pe>=0;--Pe){var Re=pe.FileIndex[Pe];switch(Re.type){case 0:ke?Ne=!0:(pe.FileIndex.pop(),pe.FullPaths.pop());break;case 1:case 2:case 5:ke=!0,isNaN(Re.R*Re.L*Re.C)&&(Ne=!0),Re.R>-1&&Re.L>-1&&Re.R==Re.L&&(Ne=!0);break;default:Ne=!0;break}}if(!(!Ne&&!Ae)){var Ce=new Date(1987,1,19),$e=0,Be=Object.create?Object.create(null):{},Ze=[];for(Pe=0;Pe<pe.FullPaths.length;++Pe)Be[pe.FullPaths[Pe]]=!0,pe.FileIndex[Pe].type!==0&&Ze.push([pe.FullPaths[Pe],pe.FileIndex[Pe]]);for(Pe=0;Pe<Ze.length;++Pe){var et=n(Ze[Pe][0]);ke=Be[et],ke||(Ze.push([et,{name:a(et).replace("/",""),type:1,clsid:H,ct:Ce,mt:Ce,content:null}]),Be[et]=!0)}for(Ze.sort(function(qt,Pt){return r(qt[0],Pt[0])}),pe.FullPaths=[],pe.FileIndex=[],Pe=0;Pe<Ze.length;++Pe)pe.FullPaths[Pe]=Ze[Pe][0],pe.FileIndex[Pe]=Ze[Pe][1];for(Pe=0;Pe<Ze.length;++Pe){var wt=pe.FileIndex[Pe],Rt=pe.FullPaths[Pe];if(wt.name=a(Rt).replace("/",""),wt.L=wt.R=wt.C=-(wt.color=1),wt.size=wt.content?wt.content.length:0,wt.start=0,wt.clsid=wt.clsid||H,Pe===0)wt.C=Ze.length>1?1:-1,wt.size=0,wt.type=5;else if(Rt.slice(-1)=="/"){for($e=Pe+1;$e<Ze.length&&n(pe.FullPaths[$e])!=Rt;++$e);for(wt.C=$e>=Ze.length?-1:$e,$e=Pe+1;$e<Ze.length&&n(pe.FullPaths[$e])!=n(Rt);++$e);wt.R=$e>=Ze.length?-1:$e,wt.type=1}else n(pe.FullPaths[Pe+1]||"")==n(Rt)&&(wt.R=Pe+1),wt.type=2}}}function R(pe,Ae){var Ne=Ae||{};if(Ne.fileType=="mad")return fn(pe,Ne);switch(T(pe),Ne.fileType){case"zip":return Et(pe,Ne)}var ke=function(qt){for(var Pt=0,Ht=0,Rr=0;Rr<qt.FileIndex.length;++Rr){var ds=qt.FileIndex[Rr];if(ds.content){var jn=ds.content.length;jn>0&&(jn<4096?Pt+=jn+63>>6:Ht+=jn+511>>9)}}for(var da=qt.FullPaths.length+3>>2,gd=Pt+7>>3,pu=Pt+127>>7,vd=gd+Ht+da+pu,mc=vd+127>>7,Ih=mc<=109?0:Math.ceil((mc-109)/127);vd+mc+Ih+127>>7>mc;)Ih=++mc<=109?0:Math.ceil((mc-109)/127);var Ba=[1,Ih,mc,pu,da,Ht,Pt,0];return qt.FileIndex[0].size=Pt<<6,Ba[7]=(qt.FileIndex[0].start=Ba[0]+Ba[1]+Ba[2]+Ba[3]+Ba[4]+Ba[5])+(Ba[6]+7>>3),Ba}(pe),Pe=dt(ke[7]<<9),Re=0,Ce=0;{for(Re=0;Re<8;++Re)Pe.write_shift(1,L[Re]);for(Re=0;Re<8;++Re)Pe.write_shift(2,0);for(Pe.write_shift(2,62),Pe.write_shift(2,3),Pe.write_shift(2,65534),Pe.write_shift(2,9),Pe.write_shift(2,6),Re=0;Re<3;++Re)Pe.write_shift(2,0);for(Pe.write_shift(4,0),Pe.write_shift(4,ke[2]),Pe.write_shift(4,ke[0]+ke[1]+ke[2]+ke[3]-1),Pe.write_shift(4,0),Pe.write_shift(4,4096),Pe.write_shift(4,ke[3]?ke[0]+ke[1]+ke[2]-1:q),Pe.write_shift(4,ke[3]),Pe.write_shift(-4,ke[1]?ke[0]-1:q),Pe.write_shift(4,ke[1]),Re=0;Re<109;++Re)Pe.write_shift(-4,Re<ke[2]?ke[1]+Re:-1)}if(ke[1])for(Ce=0;Ce<ke[1];++Ce){for(;Re<236+Ce*127;++Re)Pe.write_shift(-4,Re<ke[2]?ke[1]+Re:-1);Pe.write_shift(-4,Ce===ke[1]-1?q:Ce+1)}var $e=function(qt){for(Ce+=qt;Re<Ce-1;++Re)Pe.write_shift(-4,Re+1);qt&&(++Re,Pe.write_shift(-4,q))};for(Ce=Re=0,Ce+=ke[1];Re<Ce;++Re)Pe.write_shift(-4,V.DIFSECT);for(Ce+=ke[2];Re<Ce;++Re)Pe.write_shift(-4,V.FATSECT);$e(ke[3]),$e(ke[4]);for(var Be=0,Ze=0,et=pe.FileIndex[0];Be<pe.FileIndex.length;++Be)et=pe.FileIndex[Be],et.content&&(Ze=et.content.length,!(Ze<4096)&&(et.start=Ce,$e(Ze+511>>9)));for($e(ke[6]+7>>3);Pe.l&511;)Pe.write_shift(-4,V.ENDOFCHAIN);for(Ce=Re=0,Be=0;Be<pe.FileIndex.length;++Be)et=pe.FileIndex[Be],et.content&&(Ze=et.content.length,!(!Ze||Ze>=4096)&&(et.start=Ce,$e(Ze+63>>6)));for(;Pe.l&511;)Pe.write_shift(-4,V.ENDOFCHAIN);for(Re=0;Re<ke[4]<<2;++Re){var wt=pe.FullPaths[Re];if(!wt||wt.length===0){for(Be=0;Be<17;++Be)Pe.write_shift(4,0);for(Be=0;Be<3;++Be)Pe.write_shift(4,-1);for(Be=0;Be<12;++Be)Pe.write_shift(4,0);continue}et=pe.FileIndex[Re],Re===0&&(et.start=et.size?et.start-1:q);var Rt=Re===0&&Ne.root||et.name;if(Ze=2*(Rt.length+1),Pe.write_shift(64,Rt,"utf16le"),Pe.write_shift(2,Ze),Pe.write_shift(1,et.type),Pe.write_shift(1,et.color),Pe.write_shift(-4,et.L),Pe.write_shift(-4,et.R),Pe.write_shift(-4,et.C),et.clsid)Pe.write_shift(16,et.clsid,"hex");else for(Be=0;Be<4;++Be)Pe.write_shift(4,0);Pe.write_shift(4,et.state||0),Pe.write_shift(4,0),Pe.write_shift(4,0),Pe.write_shift(4,0),Pe.write_shift(4,0),Pe.write_shift(4,et.start),Pe.write_shift(4,et.size),Pe.write_shift(4,0)}for(Re=1;Re<pe.FileIndex.length;++Re)if(et=pe.FileIndex[Re],et.size>=4096)if(Pe.l=et.start+1<<9,pn&&Buffer.isBuffer(et.content))et.content.copy(Pe,Pe.l,0,et.size),Pe.l+=et.size+511&-512;else{for(Be=0;Be<et.size;++Be)Pe.write_shift(1,et.content[Be]);for(;Be&511;++Be)Pe.write_shift(1,0)}for(Re=1;Re<pe.FileIndex.length;++Re)if(et=pe.FileIndex[Re],et.size>0&&et.size<4096)if(pn&&Buffer.isBuffer(et.content))et.content.copy(Pe,Pe.l,0,et.size),Pe.l+=et.size+63&-64;else{for(Be=0;Be<et.size;++Be)Pe.write_shift(1,et.content[Be]);for(;Be&63;++Be)Pe.write_shift(1,0)}if(pn)Pe.l=Pe.length;else for(;Pe.l<Pe.length;)Pe.write_shift(1,0);return Pe}function k(pe,Ae){var Ne=pe.FullPaths.map(function(Be){return Be.toUpperCase()}),ke=Ne.map(function(Be){var Ze=Be.split("/");return Ze[Ze.length-(Be.slice(-1)=="/"?2:1)]}),Pe=!1;Ae.charCodeAt(0)===47?(Pe=!0,Ae=Ne[0].slice(0,-1)+Ae):Pe=Ae.indexOf("/")!==-1;var Re=Ae.toUpperCase(),Ce=Pe===!0?Ne.indexOf(Re):ke.indexOf(Re);if(Ce!==-1)return pe.FileIndex[Ce];var $e=!Re.match(uw);for(Re=Re.replace(No,""),$e&&(Re=Re.replace(uw,"!")),Ce=0;Ce<Ne.length;++Ce)if(($e?Ne[Ce].replace(uw,"!"):Ne[Ce]).replace(No,"")==Re||($e?ke[Ce].replace(uw,"!"):ke[Ce]).replace(No,"")==Re)return pe.FileIndex[Ce];return null}var E=64,q=-2,O="d0cf11e0a1b11ae1",L=[208,207,17,224,161,177,26,225],H="00000000000000000000000000000000",V={MAXREGSECT:-6,DIFSECT:-4,FATSECT:-3,ENDOFCHAIN:q,FREESECT:-1,HEADER_SIGNATURE:O,HEADER_MINOR_VERSION:"3e00",MAXREGSID:-6,NOSTREAM:-1,HEADER_CLSID:H,EntryTypes:["unknown","storage","stream","lockbytes","property","root"]};function z(pe,Ae,Ne){u();var ke=R(pe,Ne);c.writeFileSync(Ae,ke)}function M(pe){for(var Ae=new Array(pe.length),Ne=0;Ne<pe.length;++Ne)Ae[Ne]=String.fromCharCode(pe[Ne]);return Ae.join("")}function B(pe,Ae){var Ne=R(pe,Ae);switch(Ae&&Ae.type||"buffer"){case"file":return u(),c.writeFileSync(Ae.filename,Ne),Ne;case"binary":return typeof Ne=="string"?Ne:M(Ne);case"base64":return Nj(typeof Ne=="string"?Ne:M(Ne));case"buffer":if(pn)return Buffer.isBuffer(Ne)?Ne:Ph(Ne);case"array":return typeof Ne=="string"?Yl(Ne):Ne}return Ne}var K;function C(pe){try{var Ae=pe.InflateRaw,Ne=new Ae;if(Ne._processChunk(new Uint8Array([3,0]),Ne._finishFlushFlag),Ne.bytesRead)K=pe;else throw new Error("zlib does not expose bytesRead")}catch(ke){console.error("cannot use native zlib: "+(ke.message||ke))}}function A(pe,Ae){if(!K)return or(pe,Ae);var Ne=K.InflateRaw,ke=new Ne,Pe=ke._processChunk(pe.slice(pe.l),ke._finishFlushFlag);return pe.l+=ke.bytesRead,Pe}function I(pe){return K?K.deflateRawSync(pe):Fe(pe)}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],te=[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 re(pe){var Ae=(pe<<1|pe<<11)&139536|(pe<<5|pe<<15)&558144;return(Ae>>16|Ae>>8|Ae)&255}for(var J=typeof Uint8Array<"u",ie=J?new Uint8Array(256):[],be=0;be<256;++be)ie[be]=re(be);function Q(pe,Ae){var Ne=ie[pe&255];return Ae<=8?Ne>>>8-Ae:(Ne=Ne<<8|ie[pe>>8&255],Ae<=16?Ne>>>16-Ae:(Ne=Ne<<8|ie[pe>>16&255],Ne>>>24-Ae))}function Ve(pe,Ae){var Ne=Ae&7,ke=Ae>>>3;return(pe[ke]|(Ne<=6?0:pe[ke+1]<<8))>>>Ne&3}function W(pe,Ae){var Ne=Ae&7,ke=Ae>>>3;return(pe[ke]|(Ne<=5?0:pe[ke+1]<<8))>>>Ne&7}function Z(pe,Ae){var Ne=Ae&7,ke=Ae>>>3;return(pe[ke]|(Ne<=4?0:pe[ke+1]<<8))>>>Ne&15}function he(pe,Ae){var Ne=Ae&7,ke=Ae>>>3;return(pe[ke]|(Ne<=3?0:pe[ke+1]<<8))>>>Ne&31}function se(pe,Ae){var Ne=Ae&7,ke=Ae>>>3;return(pe[ke]|(Ne<=1?0:pe[ke+1]<<8))>>>Ne&127}function oe(pe,Ae,Ne){var ke=Ae&7,Pe=Ae>>>3,Re=(1<<Ne)-1,Ce=pe[Pe]>>>ke;return Ne<8-ke||(Ce|=pe[Pe+1]<<8-ke,Ne<16-ke)||(Ce|=pe[Pe+2]<<16-ke,Ne<24-ke)||(Ce|=pe[Pe+3]<<24-ke),Ce&Re}function le(pe,Ae,Ne){var ke=Ae&7,Pe=Ae>>>3;return ke<=5?pe[Pe]|=(Ne&7)<<ke:(pe[Pe]|=Ne<<ke&255,pe[Pe+1]=(Ne&7)>>8-ke),Ae+3}function Me(pe,Ae,Ne){var ke=Ae&7,Pe=Ae>>>3;return Ne=(Ne&1)<<ke,pe[Pe]|=Ne,Ae+1}function de(pe,Ae,Ne){var ke=Ae&7,Pe=Ae>>>3;return Ne<<=ke,pe[Pe]|=Ne&255,Ne>>>=8,pe[Pe+1]=Ne,Ae+8}function me(pe,Ae,Ne){var ke=Ae&7,Pe=Ae>>>3;return Ne<<=ke,pe[Pe]|=Ne&255,Ne>>>=8,pe[Pe+1]=Ne&255,pe[Pe+2]=Ne>>>8,Ae+16}function Le(pe,Ae){var Ne=pe.length,ke=2*Ne>Ae?2*Ne:Ae+5,Pe=0;if(Ne>=Ae)return pe;if(pn){var Re=hX(ke);if(pe.copy)pe.copy(Re);else for(;Pe<pe.length;++Pe)Re[Pe]=pe[Pe];return Re}else if(J){var Ce=new Uint8Array(ke);if(Ce.set)Ce.set(pe);else for(;Pe<Ne;++Pe)Ce[Pe]=pe[Pe];return Ce}return pe.length=ke,pe}function Ke(pe){for(var Ae=new Array(pe),Ne=0;Ne<pe;++Ne)Ae[Ne]=0;return Ae}function ve(pe,Ae,Ne){var ke=1,Pe=0,Re=0,Ce=0,$e=0,Be=pe.length,Ze=J?new Uint16Array(32):Ke(32);for(Re=0;Re<32;++Re)Ze[Re]=0;for(Re=Be;Re<Ne;++Re)pe[Re]=0;Be=pe.length;var et=J?new Uint16Array(Be):Ke(Be);for(Re=0;Re<Be;++Re)Ze[Pe=pe[Re]]++,ke<Pe&&(ke=Pe),et[Re]=0;for(Ze[0]=0,Re=1;Re<=ke;++Re)Ze[Re+16]=$e=$e+Ze[Re-1]<<1;for(Re=0;Re<Be;++Re)$e=pe[Re],$e!=0&&(et[Re]=Ze[$e+16]++);var wt=0;for(Re=0;Re<Be;++Re)if(wt=pe[Re],wt!=0)for($e=Q(et[Re],ke)>>ke-wt,Ce=(1<<ke+4-wt)-1;Ce>=0;--Ce)Ae[$e|Ce<<wt]=wt&15|Re<<4;return ke}var _e=J?new Uint16Array(512):Ke(512),Ue=J?new Uint16Array(32):Ke(32);if(!J){for(var Qe=0;Qe<512;++Qe)_e[Qe]=0;for(Qe=0;Qe<32;++Qe)Ue[Qe]=0}(function(){for(var pe=[],Ae=0;Ae<32;Ae++)pe.push(5);ve(pe,Ue,32);var Ne=[];for(Ae=0;Ae<=143;Ae++)Ne.push(8);for(;Ae<=255;Ae++)Ne.push(9);for(;Ae<=279;Ae++)Ne.push(7);for(;Ae<=287;Ae++)Ne.push(8);ve(Ne,_e,288)})();var st=function(){for(var Ae=J?new Uint8Array(32768):[],Ne=0,ke=0;Ne<te.length-1;++Ne)for(;ke<te[Ne+1];++ke)Ae[ke]=Ne;for(;ke<32768;++ke)Ae[ke]=29;var Pe=J?new Uint8Array(259):[];for(Ne=0,ke=0;Ne<Y.length-1;++Ne)for(;ke<Y[Ne+1];++ke)Pe[ke]=Ne;function Re($e,Be){for(var Ze=0;Ze<$e.length;){var et=Math.min(65535,$e.length-Ze),wt=Ze+et==$e.length;for(Be.write_shift(1,+wt),Be.write_shift(2,et),Be.write_shift(2,~et&65535);et-- >0;)Be[Be.l++]=$e[Ze++]}return Be.l}function Ce($e,Be){for(var Ze=0,et=0,wt=J?new Uint16Array(32768):[];et<$e.length;){var Rt=Math.min(65535,$e.length-et);if(Rt<10){for(Ze=le(Be,Ze,+(et+Rt==$e.length)),Ze&7&&(Ze+=8-(Ze&7)),Be.l=Ze/8|0,Be.write_shift(2,Rt),Be.write_shift(2,~Rt&65535);Rt-- >0;)Be[Be.l++]=$e[et++];Ze=Be.l*8;continue}Ze=le(Be,Ze,+(et+Rt==$e.length)+2);for(var qt=0;Rt-- >0;){var Pt=$e[et];qt=(qt<<5^Pt)&32767;var Ht=-1,Rr=0;if((Ht=wt[qt])&&(Ht|=et&-32768,Ht>et&&(Ht-=32768),Ht<et))for(;$e[Ht+Rr]==$e[et+Rr]&&Rr<250;)++Rr;if(Rr>2){Pt=Pe[Rr],Pt<=22?Ze=de(Be,Ze,ie[Pt+1]>>1)-1:(de(Be,Ze,3),Ze+=5,de(Be,Ze,ie[Pt-23]>>5),Ze+=3);var ds=Pt<8?0:Pt-4>>2;ds>0&&(me(Be,Ze,Rr-Y[Pt]),Ze+=ds),Pt=Ae[et-Ht],Ze=de(Be,Ze,ie[Pt]>>3),Ze-=3;var jn=Pt<4?0:Pt-2>>1;jn>0&&(me(Be,Ze,et-Ht-te[Pt]),Ze+=jn);for(var da=0;da<Rr;++da)wt[qt]=et&32767,qt=(qt<<5^$e[et])&32767,++et;Rt-=Rr-1}else Pt<=143?Pt=Pt+48:Ze=Me(Be,Ze,1),Ze=de(Be,Ze,ie[Pt]),wt[qt]=et&32767,++et}Ze=de(Be,Ze,0)-1}return Be.l=(Ze+7)/8|0,Be.l}return function(Be,Ze){return Be.length<8?Re(Be,Ze):Ce(Be,Ze)}}();function Fe(pe){var Ae=dt(50+Math.floor(pe.length*1.1)),Ne=st(pe,Ae);return Ae.slice(0,Ne)}var Ge=J?new Uint16Array(32768):Ke(32768),ht=J?new Uint16Array(32768):Ke(32768),ut=J?new Uint16Array(128):Ke(128),Mt=1,Wt=1;function zt(pe,Ae){var Ne=he(pe,Ae)+257;Ae+=5;var ke=he(pe,Ae)+1;Ae+=5;var Pe=Z(pe,Ae)+4;Ae+=4;for(var Re=0,Ce=J?new Uint8Array(19):Ke(19),$e=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],Be=1,Ze=J?new Uint8Array(8):Ke(8),et=J?new Uint8Array(8):Ke(8),wt=Ce.length,Rt=0;Rt<Pe;++Rt)Ce[U[Rt]]=Re=W(pe,Ae),Be<Re&&(Be=Re),Ze[Re]++,Ae+=3;var qt=0;for(Ze[0]=0,Rt=1;Rt<=Be;++Rt)et[Rt]=qt=qt+Ze[Rt-1]<<1;for(Rt=0;Rt<wt;++Rt)(qt=Ce[Rt])!=0&&($e[Rt]=et[qt]++);var Pt=0;for(Rt=0;Rt<wt;++Rt)if(Pt=Ce[Rt],Pt!=0){qt=ie[$e[Rt]]>>8-Pt;for(var Ht=(1<<7-Pt)-1;Ht>=0;--Ht)ut[qt|Ht<<Pt]=Pt&7|Rt<<3}var Rr=[];for(Be=1;Rr.length<Ne+ke;)switch(qt=ut[se(pe,Ae)],Ae+=qt&7,qt>>>=3){case 16:for(Re=3+Ve(pe,Ae),Ae+=2,qt=Rr[Rr.length-1];Re-- >0;)Rr.push(qt);break;case 17:for(Re=3+W(pe,Ae),Ae+=3;Re-- >0;)Rr.push(0);break;case 18:for(Re=11+se(pe,Ae),Ae+=7;Re-- >0;)Rr.push(0);break;default:Rr.push(qt),Be<qt&&(Be=qt);break}var ds=Rr.slice(0,Ne),jn=Rr.slice(Ne);for(Rt=Ne;Rt<286;++Rt)ds[Rt]=0;for(Rt=ke;Rt<30;++Rt)jn[Rt]=0;return Mt=ve(ds,Ge,286),Wt=ve(jn,ht,30),Ae}function Lt(pe,Ae){if(pe[0]==3&&!(pe[1]&3))return[vp(Ae),2];for(var Ne=0,ke=0,Pe=hX(Ae||1<<18),Re=0,Ce=Pe.length>>>0,$e=0,Be=0;!(ke&1);){if(ke=W(pe,Ne),Ne+=3,ke>>>1)ke>>1==1?($e=9,Be=5):(Ne=zt(pe,Ne),$e=Mt,Be=Wt);else{Ne&7&&(Ne+=8-(Ne&7));var Ze=pe[Ne>>>3]|pe[(Ne>>>3)+1]<<8;if(Ne+=32,Ze>0)for(!Ae&&Ce<Re+Ze&&(Pe=Le(Pe,Re+Ze),Ce=Pe.length);Ze-- >0;)Pe[Re++]=pe[Ne>>>3],Ne+=8;continue}for(;;){!Ae&&Ce<Re+32767&&(Pe=Le(Pe,Re+32767),Ce=Pe.length);var et=oe(pe,Ne,$e),wt=ke>>>1==1?_e[et]:Ge[et];if(Ne+=wt&15,wt>>>=4,!(wt>>>8&255))Pe[Re++]=wt;else{if(wt==256)break;wt-=257;var Rt=wt<8?0:wt-4>>2;Rt>5&&(Rt=0);var qt=Re+Y[wt];Rt>0&&(qt+=oe(pe,Ne,Rt),Ne+=Rt),et=oe(pe,Ne,Be),wt=ke>>>1==1?Ue[et]:ht[et],Ne+=wt&15,wt>>>=4;var Pt=wt<4?0:wt-2>>1,Ht=te[wt];for(Pt>0&&(Ht+=oe(pe,Ne,Pt),Ne+=Pt),!Ae&&Ce<qt&&(Pe=Le(Pe,qt+100),Ce=Pe.length);Re<qt;)Pe[Re]=Pe[Re-Ht],++Re}}}return Ae?[Pe,Ne+7>>>3]:[Pe.slice(0,Re),Ne+7>>>3]}function or(pe,Ae){var Ne=pe.slice(pe.l||0),ke=Lt(Ne,Ae);return pe.l+=ke[1],ke[0]}function Yt(pe,Ae){if(pe)typeof console<"u"&&console.error(Ae);else throw new Error(Ae)}function ot(pe,Ae){var Ne=pe;Ji(Ne,0);var ke=[],Pe=[],Re={FileIndex:ke,FullPaths:Pe};S(Re,{root:Ae.root});for(var Ce=Ne.length-4;(Ne[Ce]!=80||Ne[Ce+1]!=75||Ne[Ce+2]!=5||Ne[Ce+3]!=6)&&Ce>=0;)--Ce;Ne.l=Ce+4,Ne.l+=4;var $e=Ne.read_shift(2);Ne.l+=6;var Be=Ne.read_shift(4);for(Ne.l=Be,Ce=0;Ce<$e;++Ce){Ne.l+=20;var Ze=Ne.read_shift(4),et=Ne.read_shift(4),wt=Ne.read_shift(2),Rt=Ne.read_shift(2),qt=Ne.read_shift(2);Ne.l+=8;var Pt=Ne.read_shift(4),Ht=l(Ne.slice(Ne.l+wt,Ne.l+wt+Rt));Ne.l+=wt+Rt+qt;var Rr=Ne.l;Ne.l=Pt+4,fr(Ne,Ze,et,Re,Ht),Ne.l=Rr}return Re}function fr(pe,Ae,Ne,ke,Pe){pe.l+=2;var Re=pe.read_shift(2),Ce=pe.read_shift(2),$e=o(pe);if(Re&8257)throw new Error("Unsupported ZIP encryption");for(var Be=pe.read_shift(4),Ze=pe.read_shift(4),et=pe.read_shift(4),wt=pe.read_shift(2),Rt=pe.read_shift(2),qt="",Pt=0;Pt<wt;++Pt)qt+=String.fromCharCode(pe[pe.l++]);if(Rt){var Ht=l(pe.slice(pe.l,pe.l+Rt));(Ht[21589]||{}).mt&&($e=Ht[21589].mt),((Pe||{})[21589]||{}).mt&&($e=Pe[21589].mt)}pe.l+=Rt;var Rr=pe.slice(pe.l,pe.l+Ze);switch(Ce){case 8:Rr=A(pe,et);break;case 0:break;default:throw new Error("Unsupported ZIP Compression method "+Ce)}var ds=!1;Re&8&&(Be=pe.read_shift(4),Be==134695760&&(Be=pe.read_shift(4),ds=!0),Ze=pe.read_shift(4),et=pe.read_shift(4)),Ze!=Ae&&Yt(ds,"Bad compressed size: "+Ae+" != "+Ze),et!=Ne&&Yt(ds,"Bad uncompressed size: "+Ne+" != "+et),rn(ke,qt,Rr,{unsafe:!0,mt:$e})}function Et(pe,Ae){var Ne=Ae||{},ke=[],Pe=[],Re=dt(1),Ce=Ne.compression?8:0,$e=0,Be=0,Ze=0,et=0,wt=0,Rt=pe.FullPaths[0],qt=Rt,Pt=pe.FileIndex[0],Ht=[],Rr=0;for(Be=1;Be<pe.FullPaths.length;++Be)if(qt=pe.FullPaths[Be].slice(Rt.length),Pt=pe.FileIndex[Be],!(!Pt.size||!Pt.content||qt=="Sh33tJ5")){var ds=et,jn=dt(qt.length);for(Ze=0;Ze<qt.length;++Ze)jn.write_shift(1,qt.charCodeAt(Ze)&127);jn=jn.slice(0,jn.l),Ht[wt]=Oyt.buf(Pt.content,0);var da=Pt.content;Ce==8&&(da=I(da)),Re=dt(30),Re.write_shift(4,67324752),Re.write_shift(2,20),Re.write_shift(2,$e),Re.write_shift(2,Ce),Pt.mt?i(Re,Pt.mt):Re.write_shift(4,0),Re.write_shift(-4,Ht[wt]),Re.write_shift(4,da.length),Re.write_shift(4,Pt.content.length),Re.write_shift(2,jn.length),Re.write_shift(2,0),et+=Re.length,ke.push(Re),et+=jn.length,ke.push(jn),et+=da.length,ke.push(da),Re=dt(46),Re.write_shift(4,33639248),Re.write_shift(2,0),Re.write_shift(2,20),Re.write_shift(2,$e),Re.write_shift(2,Ce),Re.write_shift(4,0),Re.write_shift(-4,Ht[wt]),Re.write_shift(4,da.length),Re.write_shift(4,Pt.content.length),Re.write_shift(2,jn.length),Re.write_shift(2,0),Re.write_shift(2,0),Re.write_shift(2,0),Re.write_shift(2,0),Re.write_shift(4,0),Re.write_shift(4,ds),Rr+=Re.l,Pe.push(Re),Rr+=jn.length,Pe.push(jn),++wt}return Re=dt(22),Re.write_shift(4,101010256),Re.write_shift(2,0),Re.write_shift(2,0),Re.write_shift(2,wt),Re.write_shift(2,wt),Re.write_shift(4,Rr),Re.write_shift(4,et),Re.write_shift(2,0),Di([Di(ke),Di(Pe),Re])}var Ct={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 hr(pe,Ae){if(pe.ctype)return pe.ctype;var Ne=pe.name||"",ke=Ne.match(/\.([^\.]+)$/);return ke&&Ct[ke[1]]||Ae&&(ke=(Ne=Ae).match(/[\.\\]([^\.\\])+$/),ke&&Ct[ke[1]])?Ct[ke[1]]:"application/octet-stream"}function Gt(pe){for(var Ae=Nj(pe),Ne=[],ke=0;ke<Ae.length;ke+=76)Ne.push(Ae.slice(ke,ke+76));return Ne.join(`\r
`)+`\r
`}function Jt(pe){var Ae=pe.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7E-\xFF=]/g,function(Ze){var et=Ze.charCodeAt(0).toString(16).toUpperCase();return"="+(et.length==1?"0"+et:et)});Ae=Ae.replace(/ $/mg,"=20").replace(/\t$/mg,"=09"),Ae.charAt(0)==`
`&&(Ae="=0D"+Ae.slice(1)),Ae=Ae.replace(/\r(?!\n)/mg,"=0D").replace(/\n\n/mg,`
=0A`).replace(/([^\r\n])\n/mg,"$1=0A");for(var Ne=[],ke=Ae.split(`\r
`),Pe=0;Pe<ke.length;++Pe){var Re=ke[Pe];if(Re.length==0){Ne.push("");continue}for(var Ce=0;Ce<Re.length;){var $e=76,Be=Re.slice(Ce,Ce+$e);Be.charAt($e-1)=="="?$e--:Be.charAt($e-2)=="="?$e-=2:Be.charAt($e-3)=="="&&($e-=3),Be=Re.slice(Ce,Ce+$e),Ce+=$e,Ce<Re.length&&(Be+="="),Ne.push(Be)}}return Ne.join(`\r
`)}function mr(pe){for(var Ae=[],Ne=0;Ne<pe.length;++Ne){for(var ke=pe[Ne];Ne<=pe.length&&ke.charAt(ke.length-1)=="=";)ke=ke.slice(0,ke.length-1)+pe[++Ne];Ae.push(ke)}for(var Pe=0;Pe<Ae.length;++Pe)Ae[Pe]=Ae[Pe].replace(/[=][0-9A-Fa-f]{2}/g,function(Re){return String.fromCharCode(parseInt(Re.slice(1),16))});return Yl(Ae.join(`\r
`))}function mn(pe,Ae,Ne){for(var ke="",Pe="",Re="",Ce,$e=0;$e<10;++$e){var Be=Ae[$e];if(!Be||Be.match(/^\s*$/))break;var Ze=Be.match(/^(.*?):\s*([^\s].*)$/);if(Ze)switch(Ze[1].toLowerCase()){case"content-location":ke=Ze[2].trim();break;case"content-type":Re=Ze[2].trim();break;case"content-transfer-encoding":Pe=Ze[2].trim();break}}switch(++$e,Pe.toLowerCase()){case"base64":Ce=Yl(uc(Ae.slice($e).join("")));break;case"quoted-printable":Ce=mr(Ae.slice($e));break;default:throw new Error("Unsupported Content-Transfer-Encoding "+Pe)}var et=rn(pe,ke.slice(Ne.length),Ce,{unsafe:!0});Re&&(et.ctype=Re)}function Xt(pe,Ae){if(M(pe.slice(0,13)).toLowerCase()!="mime-version:")throw new Error("Unsupported MAD header");var Ne=Ae&&Ae.root||"",ke=(pn&&Buffer.isBuffer(pe)?pe.toString("binary"):M(pe)).split(`\r
`),Pe=0,Re="";for(Pe=0;Pe<ke.length;++Pe)if(Re=ke[Pe],!!/^Content-Location:/i.test(Re)&&(Re=Re.slice(Re.indexOf("file")),Ne||(Ne=Re.slice(0,Re.lastIndexOf("/")+1)),Re.slice(0,Ne.length)!=Ne))for(;Ne.length>0&&(Ne=Ne.slice(0,Ne.length-1),Ne=Ne.slice(0,Ne.lastIndexOf("/")+1),Re.slice(0,Ne.length)!=Ne););var Ce=(ke[1]||"").match(/boundary="(.*?)"/);if(!Ce)throw new Error("MAD cannot find boundary");var $e="--"+(Ce[1]||""),Be=[],Ze=[],et={FileIndex:Be,FullPaths:Ze};S(et);var wt,Rt=0;for(Pe=0;Pe<ke.length;++Pe){var qt=ke[Pe];qt!==$e&&qt!==$e+"--"||(Rt++&&mn(et,ke.slice(wt,Pe),Ne),wt=Pe)}return et}function fn(pe,Ae){var Ne=Ae||{},ke=Ne.boundary||"SheetJS";ke="------="+ke;for(var Pe=["MIME-Version: 1.0",'Content-Type: multipart/related; boundary="'+ke.slice(2)+'"',"","",""],Re=pe.FullPaths[0],Ce=Re,$e=pe.FileIndex[0],Be=1;Be<pe.FullPaths.length;++Be)if(Ce=pe.FullPaths[Be].slice(Re.length),$e=pe.FileIndex[Be],!(!$e.size||!$e.content||Ce=="Sh33tJ5")){Ce=Ce.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7E-\xFF]/g,function(Rr){return"_x"+Rr.charCodeAt(0).toString(16)+"_"}).replace(/[\u0080-\uFFFF]/g,function(Rr){return"_u"+Rr.charCodeAt(0).toString(16)+"_"});for(var Ze=$e.content,et=pn&&Buffer.isBuffer(Ze)?Ze.toString("binary"):M(Ze),wt=0,Rt=Math.min(1024,et.length),qt=0,Pt=0;Pt<=Rt;++Pt)(qt=et.charCodeAt(Pt))>=32&&qt<128&&++wt;var Ht=wt>=Rt*4/5;Pe.push(ke),Pe.push("Content-Location: "+(Ne.root||"file:///C:/SheetJS/")+Ce),Pe.push("Content-Transfer-Encoding: "+(Ht?"quoted-printable":"base64")),Pe.push("Content-Type: "+hr($e,Ce)),Pe.push(""),Pe.push(Ht?Jt(et):Gt(et))}return Pe.push(ke+`--\r
`),Pe.join(`\r
`)}function Xn(pe){var Ae={};return S(Ae,pe),Ae}function rn(pe,Ae,Ne,ke){var Pe=ke&&ke.unsafe;Pe||S(pe);var Re=!Pe&&jr.find(pe,Ae);if(!Re){var Ce=pe.FullPaths[0];Ae.slice(0,Ce.length)==Ce?Ce=Ae:(Ce.slice(-1)!="/"&&(Ce+="/"),Ce=(Ce+Ae).replace("//","/")),Re={name:a(Ae),type:2},pe.FileIndex.push(Re),pe.FullPaths.push(Ce),Pe||jr.utils.cfb_gc(pe)}return Re.content=Ne,Re.size=Ne?Ne.length:0,ke&&(ke.CLSID&&(Re.clsid=ke.CLSID),ke.mt&&(Re.mt=ke.mt),ke.ct&&(Re.ct=ke.ct)),Re}function wn(pe,Ae){S(pe);var Ne=jr.find(pe,Ae);if(Ne){for(var ke=0;ke<pe.FileIndex.length;++ke)if(pe.FileIndex[ke]==Ne)return pe.FileIndex.splice(ke,1),pe.FullPaths.splice(ke,1),!0}return!1}function On(pe,Ae,Ne){S(pe);var ke=jr.find(pe,Ae);if(ke){for(var Pe=0;Pe<pe.FileIndex.length;++Pe)if(pe.FileIndex[Pe]==ke)return pe.FileIndex[Pe].name=a(Ne),pe.FullPaths[Pe]=Ne,!0}return!1}function ts(pe){T(pe,!0)}return t.find=k,t.read=_,t.parse=d,t.write=B,t.writeFile=z,t.utils={cfb_new:Xn,cfb_add:rn,cfb_del:wn,cfb_mov:On,cfb_gc:ts,ReadShift:Ww,CheckField:fme,prep_blob:Ji,bconcat:Di,use_zlib:C,_deflateRaw:Fe,_inflateRaw:or,consts:V},t}();let Bm;function Dyt(e){Bm=e}function Iyt(e){return typeof e=="string"?P_(e):Array.isArray(e)?ayt(e):e}function D_(e,t,r){if(typeof Bm<"u"&&Bm.writeFileSync)return r?Bm.writeFileSync(e,t,r):Bm.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=P_(t);break;default:throw new Error("Unsupported encoding "+r)}return Deno.writeFileSync(e,t)}var n=r=="utf8"?Wd(t):t;if(typeof IE_SaveFile<"u")return IE_SaveFile(n,e);if(typeof Blob<"u"){var a=new Blob([Iyt(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=Bp(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 Ryt(e){if(typeof Bm<"u")return Bm.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 ka(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 wX(e,t){for(var r=[],n=ka(e),a=0;a!==n.length;++a)r[e[n[a]][t]]==null&&(r[e[n[a]][t]]=n[a]);return r}function SA(e){for(var t=[],r=ka(e),n=0;n!==r.length;++n)t[e[r[n]]]=r[n];return t}function kA(e){for(var t=[],r=ka(e),n=0;n!==r.length;++n)t[e[r[n]]]=parseInt(r[n],10);return t}function Lyt(e){for(var t=[],r=ka(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 Uk=new Date(1899,11,30,0,0,0);function _i(e,t){var r=e.getTime(),n=Uk.getTime()+(e.getTimezoneOffset()-Uk.getTimezoneOffset())*6e4;return(r-n)/(24*60*60*1e3)}var Xhe=new Date,Fyt=Uk.getTime()+(Xhe.getTimezoneOffset()-Uk.getTimezoneOffset())*6e4,jX=Xhe.getTimezoneOffset();function CA(e){var t=new Date;return t.setTime(e*24*60*60*1e3+Fyt),t.getTimezoneOffset()!==jX&&t.setTime(t.getTime()+(t.getTimezoneOffset()-jX)*6e4),t}function Myt(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 _X=new Date("2017-02-19T19:06:09.000Z"),Yhe=isNaN(_X.getFullYear())?new Date("2/19/17"):_X,$yt=Yhe.getFullYear()==2017;function Gs(e,t){var r=new Date(e);if($yt)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(Yhe.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 D0(e,t){if(pn&&Buffer.isBuffer(e)){if(t){if(e[0]==255&&e[1]==254)return Wd(e.slice(2).toString("utf16le"));if(e[1]==254&&e[2]==255)return Wd(Fhe(e.slice(2).toString("binary")))}return e.toString("binary")}if(typeof TextDecoder<"u")try{if(t){if(e[0]==255&&e[1]==254)return Wd(new TextDecoder("utf-16le").decode(e.slice(2)));if(e[0]==254&&e[1]==255)return Wd(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 js(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]=js(e[r]));return t}function va(e,t){for(var r="";r.length<t;)r+=e;return r}function Yu(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 Byt=["january","february","march","april","may","june","july","august","september","october","november","december"];function Xy(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&&Byt.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 zyt=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 Zhe(e){return e?e.content&&e.type?D0(e.content,!0):e.data?vv(e.data):e.asNodeBuffer&&pn?vv(e.asNodeBuffer().toString("binary")):e.asBinary?vv(e.asBinary()):e._data&&e._data.getContent?vv(D0(Array.prototype.slice.call(e._data.getContent(),0))):null:null}function Jhe(e){if(!e)return null;if(e.data)return $k(e.data);if(e.asNodeBuffer&&pn)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 qyt(e){return e&&e.name.slice(-4)===".bin"?Jhe(e):Zhe(e)}function Ac(e,t){for(var r=e.FullPaths||ka(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 c7(e,t){var r=Ac(e,t);if(r==null)throw new Error("Cannot find file "+t+" in zip");return r}function Ga(e,t,r){if(!r)return qyt(c7(e,t));if(!t)return null;try{return Ga(e,t)}catch{return null}}function Zl(e,t,r){if(!r)return Zhe(c7(e,t));if(!t)return null;try{return Zl(e,t)}catch{return null}}function Uyt(e,t,r){return Jhe(c7(e,t))}function NX(e){for(var t=e.FullPaths||ka(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 pn?n=Ph(r):n=iyt(r),jr.utils.cfb_add(e,t,n)}jr.utils.cfb_add(e,t,r)}else e.file(t,r)}function u7(){return jr.utils.cfb_new()}function Qhe(e,t){switch(t.type){case"base64":return jr.read(e,{type:"base64"});case"binary":return jr.read(e,{type:"binary"});case"buffer":case"array":return jr.read(e,{type:"buffer"})}throw new Error("Unrecognized type "+t.type)}function dw(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 $a=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
`,Vyt=/([^"\s?>\/]+)\s*=\s*((?:")([^"]*)(?:")|(?:')([^']*)(?:')|([^'">\s]+))/g,SX=/<[\/\?]?[a-zA-Z0-9:_-]+(?:\s+[^"\s?>\/]+\s*=\s*(?:"[^"]*"|'[^']*'|[^'">\s=]+))*\s*[\/\?]?>/mg,Hyt=/<[^>]*>/g,Ao=$a.match(SX)?SX:Hyt,Wyt=/<\w*:/,Gyt=/<(\/?)\w+:/;function Mr(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(Vyt),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 pf(e){return e.replace(Gyt,"<$1")}var eme={""":'"',"'":"'",">":">","<":"<","&":"&"},d7=SA(eme),Fn=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 eme[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))}}(),f7=/[&<>'"]/g,Kyt=/[\u0000-\u0008\u000b-\u001f]/g;function ls(e){var t=e+"";return t.replace(f7,function(r){return d7[r]}).replace(Kyt,function(r){return"_x"+("000"+r.charCodeAt(0).toString(16)).slice(-4)+"_"})}function kX(e){return ls(e).replace(/ /g,"_x0020_")}var tme=/[\u0000-\u001f]/g;function h7(e){var t=e+"";return t.replace(f7,function(r){return d7[r]}).replace(/\n/g,"<br/>").replace(tme,function(r){return"&#x"+("000"+r.charCodeAt(0).toString(16)).slice(-4)+";"})}function Xyt(e){var t=e+"";return t.replace(f7,function(r){return d7[r]}).replace(tme,function(r){return"&#x"+r.charCodeAt(0).toString(16).toUpperCase()+";"})}var CX=function(){var e=/&#(\d+);/g;function t(r,n){return String.fromCharCode(parseInt(n,10))}return function(n){return n.replace(e,t)}}();function Yyt(e){return e.replace(/(\r\n|[\r\n])/g," ")}function qs(e){switch(e){case 1:case!0:case"1":case"true":case"TRUE":return!0;default:return!1}}function KP(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 EX(e){var t=vp(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 AX(e){return Ph(e,"binary").toString("utf8")}var MS="foo bar bazâð£",hs=pn&&(AX(MS)==KP(MS)&&AX||EX(MS)==KP(MS)&&EX)||KP,Wd=pn?function(e){return Ph(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("")},kj=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||"")}}(),rme=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}}(),Zyt=function(){var e={};return function(r){return e[r]!==void 0?e[r]:e[r]=new RegExp("<(?:vt:)?"+r+">([\\s\\S]*?)</(?:vt:)?"+r+">","g")}}(),Jyt=/<\/?(?:vt:)?variant>/g,Qyt=/<(?:vt:)([^>]*)>([\s\S]*)</;function TX(e,t){var r=Mr(e),n=e.match(Zyt(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(Jyt,"").match(Qyt);o&&a.push({v:hs(o[2]),t:o[1]})}),a}var nme=/(^\s|\s$|\n)/;function Qi(e,t){return"<"+e+(t.match(nme)?' xml:space="preserve"':"")+">"+t+"</"+e+">"}function Cj(e){return ka(e).map(function(t){return" "+t+'="'+e[t]+'"'}).join("")}function $t(e,t,r){return"<"+e+(r!=null?Cj(r):"")+(t!=null?(t.match(nme)?' xml:space="preserve"':"")+">"+t+"</"+e:"/")+">"}function jI(e,t){try{return e.toISOString().replace(/\.\d*/,"")}catch(r){if(t)throw r}return""}function e1t(e,t){switch(typeof e){case"string":var r=$t("vt:lpwstr",ls(e));return r=r.replace(/"/g,"_x0022_"),r;case"number":return $t((e|0)==e?"vt:i4":"vt:r8",ls(String(e)));case"boolean":return $t("vt:bool",e?"true":"false")}if(e instanceof Date)return $t("vt:filetime",jI(e));throw new Error("Unable to serialize "+e)}function m7(e){if(pn&&Buffer.isBuffer(e))return e.toString("utf8");if(typeof e=="string")return e;if(typeof Uint8Array<"u"&&e instanceof Uint8Array)return hs(Bp(a7(e)));throw new Error("Bad input format: expected Buffer or string")}var Ej=/<(\/?)([^\s?><!\/:]*:|)([^\s?<>:\/]+)(?:[\s?:\/][^>]*)?>/mg,vi={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"},ng=["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"],Wl={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 t1t(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 r1t(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 PX=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},OX=pn?function(e){return e[0].length>0&&Buffer.isBuffer(e[0][0])?Buffer.concat(e[0].map(function(t){return Buffer.isBuffer(t)?t:Ph(t)})):PX(e)}:PX,DX=function(e,t,r){for(var n=[],a=t;a<r;a+=2)n.push(String.fromCharCode(Qf(e,a)));return n.join("").replace(No,"")},EA=pn?function(e,t,r){return Buffer.isBuffer(e)?e.toString("utf16le",t,r).replace(No,""):DX(e,t,r)}:DX,IX=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("")},sme=pn?function(e,t,r){return Buffer.isBuffer(e)?e.toString("hex",t,t+r):IX(e,t,r)}:IX,RX=function(e,t,r){for(var n=[],a=t;a<r;a++)n.push(String.fromCharCode(Zg(e,a)));return n.join("")},V1=pn?function(t,r,n){return Buffer.isBuffer(t)?t.toString("utf8",r,n):RX(t,r,n)}:RX,ame=function(e,t){var r=Pi(e,t);return r>0?V1(e,t+4,t+4+r-1):""},p7=ame,ime=function(e,t){var r=Pi(e,t);return r>0?V1(e,t+4,t+4+r-1):""},x7=ime,ome=function(e,t){var r=2*Pi(e,t);return r>0?V1(e,t+4,t+4+r-1):""},g7=ome,lme=function(t,r){var n=Pi(t,r);return n>0?EA(t,r+4,r+4+n):""},v7=lme,cme=function(e,t){var r=Pi(e,t);return r>0?V1(e,t+4,t+4+r):""},y7=cme,ume=function(e,t){return t1t(e,t)},Vk=ume,b7=function(t){return Array.isArray(t)||typeof Uint8Array<"u"&&t instanceof Uint8Array};pn&&(p7=function(t,r){if(!Buffer.isBuffer(t))return ame(t,r);var n=t.readUInt32LE(r);return n>0?t.toString("utf8",r+4,r+4+n-1):""},x7=function(t,r){if(!Buffer.isBuffer(t))return ime(t,r);var n=t.readUInt32LE(r);return n>0?t.toString("utf8",r+4,r+4+n-1):""},g7=function(t,r){if(!Buffer.isBuffer(t))return ome(t,r);var n=2*t.readUInt32LE(r);return t.toString("utf16le",r+4,r+4+n-1)},v7=function(t,r){if(!Buffer.isBuffer(t))return lme(t,r);var n=t.readUInt32LE(r);return t.toString("utf16le",r+4,r+4+n)},y7=function(t,r){if(!Buffer.isBuffer(t))return cme(t,r);var n=t.readUInt32LE(r);return t.toString("utf8",r+4,r+4+n)},Vk=function(t,r){return Buffer.isBuffer(t)?t.readDoubleLE(r):ume(t,r)},b7=function(t){return Buffer.isBuffer(t)||Array.isArray(t)||typeof Uint8Array<"u"&&t instanceof Uint8Array});function dme(){EA=function(e,t,r){return Pn.utils.decode(1200,e.slice(t,r)).replace(No,"")},V1=function(e,t,r){return Pn.utils.decode(65001,e.slice(t,r))},p7=function(e,t){var r=Pi(e,t);return r>0?Pn.utils.decode(P0,e.slice(t+4,t+4+r-1)):""},x7=function(e,t){var r=Pi(e,t);return r>0?Pn.utils.decode(ic,e.slice(t+4,t+4+r-1)):""},g7=function(e,t){var r=2*Pi(e,t);return r>0?Pn.utils.decode(1200,e.slice(t+4,t+4+r-1)):""},v7=function(e,t){var r=Pi(e,t);return r>0?Pn.utils.decode(1200,e.slice(t+4,t+4+r)):""},y7=function(e,t){var r=Pi(e,t);return r>0?Pn.utils.decode(65001,e.slice(t+4,t+4+r)):""}}typeof Pn<"u"&&dme();var Zg=function(e,t){return e[t]},Qf=function(e,t){return e[t+1]*256+e[t]},n1t=function(e,t){var r=e[t+1]*256+e[t];return r<32768?r:(65535-r+1)*-1},Pi=function(e,t){return e[t+3]*(1<<24)+(e[t+2]<<16)+(e[t+1]<<8)+e[t]},_x=function(e,t){return e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t]},s1t=function(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]};function Ww(e,t){var r="",n,a,i=[],o,l,c,u;switch(t){case"dbcs":if(u=this.l,pn&&Buffer.isBuffer(this))r=this.slice(this.l,this.l+2*e).toString("utf16le");else for(c=0;c<e;++c)r+=String.fromCharCode(Qf(this,u)),u+=2;e*=2;break;case"utf8":r=V1(this,this.l,this.l+e);break;case"utf16le":e*=2,r=EA(this,this.l,this.l+e);break;case"wstr":if(typeof Pn<"u")r=Pn.utils.decode(ic,this.slice(this.l,this.l+2*e));else return Ww.call(this,e,"dbcs");e=2*e;break;case"lpstr-ansi":r=p7(this,this.l),e=4+Pi(this,this.l);break;case"lpstr-cp":r=x7(this,this.l),e=4+Pi(this,this.l);break;case"lpwstr":r=g7(this,this.l),e=4+2*Pi(this,this.l);break;case"lpp4":e=4+Pi(this,this.l),r=v7(this,this.l),e&2&&(e+=2);break;case"8lpp4":e=4+Pi(this,this.l),r=y7(this,this.l),e&3&&(e+=4-(e&3));break;case"cstr":for(e=0,r="";(o=Zg(this,this.l+e++))!==0;)i.push(cw(o));r=i.join("");break;case"_wstr":for(e=0,r="";(o=Qf(this,this.l+e))!==0;)i.push(cw(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=Zg(this,u),this.l=u+1,l=Ww.call(this,e-c,o?"dbcs-cont":"sbcs-cont"),i.join("")+l;i.push(cw(Qf(this,u))),u+=2}r=i.join(""),e*=2;break;case"cpstr":if(typeof Pn<"u"){r=Pn.utils.decode(ic,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=Zg(this,u),this.l=u+1,l=Ww.call(this,e-c,o?"dbcs-cont":"sbcs-cont"),i.join("")+l;i.push(cw(Zg(this,u))),u+=1}r=i.join("");break;default:switch(e){case 1:return n=Zg(this,this.l),this.l++,n;case 2:return n=(t==="i"?n1t:Qf)(this,this.l),this.l+=2,n;case 4:case-4:return t==="i"||!(this[this.l+3]&128)?(n=(e>0?_x:s1t)(this,this.l),this.l+=4,n):(a=Pi(this,this.l),this.l+=4,a);case 8:case-8:if(t==="f")return e==8?a=Vk(this,this.l):a=Vk([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=sme(this,this.l,e);break}}return this.l+=e,r}var a1t=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},i1t=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},o1t=function(e,t,r){e[r]=t&255,e[r+1]=t>>>8&255};function l1t(e,t,r){var n=0,a=0;if(r==="dbcs"){for(a=0;a!=t.length;++a)o1t(this,t.charCodeAt(a),this.l+2*a);n=2*t.length}else if(r==="sbcs"){if(typeof Pn<"u"&&P0==874)for(a=0;a!=t.length;++a){var i=Pn.utils.encode(P0,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,a1t(this,t,this.l);break;case 8:if(n=8,r==="f"){r1t(this,t,this.l);break}case 16:break;case-4:n=4,i1t(this,t,this.l);break}return this.l+=n,this}function fme(e,t){var r=sme(this,this.l,e.length>>1);if(r!==e)throw new Error(t+"Expected "+e+" saw "+r);this.l+=e.length>>1}function Ji(e,t){e.l=t,e.read_shift=Ww,e.chk=fme,e.write_shift=l1t}function Co(e,t){e.l+=t}function dt(e){var t=vp(e);return Ji(t,0),t}function Oh(e,t,r){if(e){var n,a,i;Ji(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=Ij[l]||Ij[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 jl(){var e=[],t=pn?256:2048,r=function(u){var d=dt(u);return Ji(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(),Di(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 jt(e,t,r,n){var a=+t,i;if(!isNaN(a)){n||(n=Ij[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&&b7(r)&&e.push(r)}}function Gw(e,t,r){var n=js(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 LX(e,t,r){var n=js(e);return n.s=Gw(n.s,t.s,r),n.e=Gw(n.e,t.s,r),n}function Kw(e,t){if(e.cRel&&e.c<0)for(e=js(e);e.c<0;)e.c+=t>8?16384:256;if(e.rRel&&e.r<0)for(e=js(e);e.r<0;)e.r+=t>8?1048576:t>5?65536:16384;var r=Or(e);return!e.cRel&&e.cRel!=null&&(r=d1t(r)),!e.rRel&&e.rRel!=null&&(r=c1t(r)),r}function XP(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?"":"$")+Ws(e.s.c)+":"+(e.e.cRel?"":"$")+Ws(e.e.c):e.s.c==0&&!e.s.cRel&&e.e.c==(t.biff>=12?16383:255)&&!e.e.cRel?(e.s.rRel?"":"$")+wa(e.s.r)+":"+(e.e.rRel?"":"$")+wa(e.e.r):Kw(e.s,t.biff)+":"+Kw(e.e,t.biff)}function w7(e){return parseInt(u1t(e),10)-1}function wa(e){return""+(e+1)}function c1t(e){return e.replace(/([A-Z]|^)(\d+)$/,"$1$$$2")}function u1t(e){return e.replace(/\$(\d+)$/,"$1")}function j7(e){for(var t=f1t(e),r=0,n=0;n!==t.length;++n)r=26*r+t.charCodeAt(n)-64;return r-1}function Ws(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 d1t(e){return e.replace(/^([A-Z])/,"$$$1")}function f1t(e){return e.replace(/^\$([A-Z])/,"$1")}function h1t(e){return e.replace(/(\$?[A-Z]*)(\$?\d*)/,"$1,$2").split(",")}function ia(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 Or(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 Qo(e){var t=e.indexOf(":");return t==-1?{s:ia(e),e:ia(e)}:{s:ia(e.slice(0,t)),e:ia(e.slice(t+1))}}function sn(e,t){return typeof t>"u"||typeof t=="number"?sn(e.s,e.e):(typeof e!="string"&&(e=Or(e)),typeof t!="string"&&(t=Or(t)),e==t?e:e+":"+t)}function Nn(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 FX(e,t){var r=e.t=="d"&&t instanceof Date;if(e.z!=null)try{return e.w=dc(e.z,r?_i(t):t)}catch{}try{return e.w=dc((e.XF||{}).numFmtId||(r?14:0),r?_i(t):t)}catch{return""+t}}function af(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"?Dh[e.v]||e.v:t==null?FX(e,e.v):FX(e,t))}function zp(e,t){var r=t&&t.sheet?t.sheet:"Sheet1",n={};return n[r]=e,{SheetNames:[r],Sheets:n}}function hme(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"?ia(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=Nn(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]},x=o+f,p=l+m;if(u.s.r>x&&(u.s.r=x),u.s.c>p&&(u.s.c=p),u.e.r<x&&(u.e.r=x),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||Sr[14],n.cellDates?(h.t="d",h.w=dc(h.z,_i(h.v))):(h.t="n",h.v=_i(h.v),h.w=dc(h.z,h.v))):h.t="s";if(a)i[x]||(i[x]=[]),i[x][p]&&i[x][p].z&&(h.z=i[x][p].z),i[x][p]=h;else{var g=Or({c:p,r:x});i[g]&&i[g].z&&(h.z=i[g].z),i[g]=h}}}return u.s.c<1e7&&(i["!ref"]=sn(u)),i}function H1(e,t){return hme(null,e,t)}function m1t(e){return e.read_shift(4,"i")}function Zu(e,t){return t||(t=dt(4)),t.write_shift(4,e),t}function So(e){var t=e.read_shift(4);return t===0?"":e.read_shift(t,"dbcs")}function Ii(e,t){var r=!1;return t==null&&(r=!0,t=dt(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 p1t(e){return{ich:e.read_shift(2),ifnt:e.read_shift(2)}}function x1t(e,t){return t||(t=dt(4)),t.write_shift(2,0),t.write_shift(2,0),t}function _7(e,t){var r=e.l,n=e.read_shift(1),a=So(e),i=[],o={t:a,h:a};if(n&1){for(var l=e.read_shift(4),c=0;c!=l;++c)i.push(p1t(e));o.r=i}else o.r=[{ich:0,ifnt:0}];return e.l=r+t,o}function g1t(e,t){var r=!1;return t==null&&(r=!0,t=dt(15+4*e.t.length)),t.write_shift(1,0),Ii(e.t,t),r?t.slice(0,t.l):t}var v1t=_7;function y1t(e,t){var r=!1;return t==null&&(r=!0,t=dt(23+4*e.t.length)),t.write_shift(1,1),Ii(e.t,t),t.write_shift(4,1),x1t({},t),r?t.slice(0,t.l):t}function mu(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 sg(e,t){return t==null&&(t=dt(8)),t.write_shift(-4,e.c),t.write_shift(3,e.iStyleRef||e.s),t.write_shift(1,0),t}function ag(e){var t=e.read_shift(2);return t+=e.read_shift(1)<<16,e.l++,{c:-1,iStyleRef:t}}function ig(e,t){return t==null&&(t=dt(4)),t.write_shift(3,e.iStyleRef||e.s),t.write_shift(1,0),t}var b1t=So,mme=Ii;function N7(e){var t=e.read_shift(4);return t===0||t===4294967295?"":e.read_shift(t,"dbcs")}function Hk(e,t){var r=!1;return t==null&&(r=!0,t=dt(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 w1t=So,_I=N7,S7=Hk;function k7(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?Vk([0,0,0,0,t[0]&252,t[1],t[2],t[3]],0):_x(t,0)>>2;return r?a/100:a}function pme(e,t){t==null&&(t=dt(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 xme(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 j1t(e,t){return t||(t=dt(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 og=xme,W1=j1t;function jo(e){if(e.length-e.l<8)throw"XLS Xnum Buffer underflow";return e.read_shift(8,"f")}function I0(e,t){return(t||dt(8)).write_shift(8,e,"f")}function _1t(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=r0[a];u&&(t.rgb=Tj(u));break;case 2:t.rgb=Tj([o,l,c]);break;case 3:t.theme=a;break}return i!=0&&(t.tint=i>0?i/32767:i/32768),t}function Wk(e,t){if(t||(t=dt(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 N1t(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 S1t(e,t){t||(t=dt(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 gme(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 k1t(e){return gme(e,1)}function C1t(e){return gme(e,2)}var C7=2,dl=3,$S=11,MX=12,Gk=19,BS=64,E1t=65,A1t=71,T1t=4108,P1t=4126,Ci=80,vme=81,O1t=[Ci,vme],NI={1:{n:"CodePage",t:C7},2:{n:"Category",t:Ci},3:{n:"PresentationFormat",t:Ci},4:{n:"ByteCount",t:dl},5:{n:"LineCount",t:dl},6:{n:"ParagraphCount",t:dl},7:{n:"SlideCount",t:dl},8:{n:"NoteCount",t:dl},9:{n:"HiddenCount",t:dl},10:{n:"MultimediaClipCount",t:dl},11:{n:"ScaleCrop",t:$S},12:{n:"HeadingPairs",t:T1t},13:{n:"TitlesOfParts",t:P1t},14:{n:"Manager",t:Ci},15:{n:"Company",t:Ci},16:{n:"LinksUpToDate",t:$S},17:{n:"CharacterCount",t:dl},19:{n:"SharedDoc",t:$S},22:{n:"HyperlinksChanged",t:$S},23:{n:"AppVersion",t:dl,p:"version"},24:{n:"DigSig",t:E1t},26:{n:"ContentType",t:Ci},27:{n:"ContentStatus",t:Ci},28:{n:"Language",t:Ci},29:{n:"Version",t:Ci},255:{},2147483648:{n:"Locale",t:Gk},2147483651:{n:"Behavior",t:Gk},1919054434:{}},SI={1:{n:"CodePage",t:C7},2:{n:"Title",t:Ci},3:{n:"Subject",t:Ci},4:{n:"Author",t:Ci},5:{n:"Keywords",t:Ci},6:{n:"Comments",t:Ci},7:{n:"Template",t:Ci},8:{n:"LastAuthor",t:Ci},9:{n:"RevNumber",t:Ci},10:{n:"EditTime",t:BS},11:{n:"LastPrinted",t:BS},12:{n:"CreatedDate",t:BS},13:{n:"ModifiedDate",t:BS},14:{n:"PageCount",t:dl},15:{n:"WordCount",t:dl},16:{n:"CharCount",t:dl},17:{n:"Thumbnail",t:A1t},18:{n:"Application",t:Ci},19:{n:"DocSecurity",t:dl},255:{},2147483648:{n:"Locale",t:Gk},2147483651:{n:"Behavior",t:Gk},1919054434:{}},$X={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"},D1t=[null,"solid","mediumGray","darkGray","lightGray","darkHorizontal","darkVertical","darkDown","darkUp","darkGrid","darkTrellis","lightHorizontal","lightVertical","lightDown","lightUp","lightGrid","lightTrellis","gray125","gray0625"];function I1t(e){return e.map(function(t){return[t>>16&255,t>>8&255,t&255]})}var R1t=I1t([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]),r0=js(R1t),Dh={0:"#NULL!",7:"#DIV/0!",15:"#VALUE!",23:"#REF!",29:"#NAME?",36:"#NUM!",42:"#N/A",43:"#GETTING_DATA",255:"#WTF?"},yme={"#NULL!":0,"#DIV/0!":7,"#VALUE!":15,"#REF!":23,"#NAME?":29,"#NUM!":36,"#N/A":42,"#GETTING_DATA":43,"#WTF?":255},kI={"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"},zS={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 E7(){return{workbooks:[],sheets:[],charts:[],dialogs:[],macros:[],rels:[],strs:[],comments:[],threadedcomments:[],links:[],coreprops:[],extprops:[],custprops:[],themes:[],styles:[],calcchains:[],vba:[],drawings:[],metadata:[],people:[],TODO:[],xmlns:""}}function L1t(e){var t=E7();if(!e||!e.match)return t;var r={};if((e.match(Ao)||[]).forEach(function(n){var a=Mr(n);switch(a[0].replace(Wyt,"<")){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[kI[a.ContentType]]!==void 0&&t[kI[a.ContentType]].push(a.PartName);break}}),t.xmlns!==vi.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 bme(e,t){var r=Lyt(kI),n=[],a;n[n.length]=$a,n[n.length]=$t("Types",null,{xmlns:vi.CT,"xmlns:xsd":vi.xsd,"xmlns:xsi":vi.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 $t("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]=$t("Override",null,{PartName:(a[0]=="/"?"":"/")+a,ContentType:zS[c][t.bookType]||zS[c].xlsx}))},o=function(c){(e[c]||[]).forEach(function(u){n[n.length]=$t("Override",null,{PartName:(u[0]=="/"?"":"/")+u,ContentType:zS[c][t.bookType]||zS[c].xlsx})})},l=function(c){(e[c]||[]).forEach(function(u){n[n.length]=$t("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 xn={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 Aj(e){var t=e.lastIndexOf("/");return e.slice(0,t+1)+"_rels/"+e.slice(t+1)+".rels"}function Xw(e,t){var r={"!id":{}};if(!e)return r;t.charAt(0)!=="/"&&(t="/"+t);var n={};return(e.match(Ao)||[]).forEach(function(a){var i=Mr(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:dw(i.Target,t);r[l]=o,n[i.Id]=o}}),r["!id"]=n,r}function qv(e){var t=[$a,$t("Relationships",null,{xmlns:vi.RELS})];return ka(e["!id"]).forEach(function(r){t[t.length]=$t("Relationship",null,e["!id"][r])}),t.length>2&&(t[t.length]="</Relationships>",t[1]=t[1].replace("/>",">")),t.join("")}function is(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,[xn.HLINK,xn.XPATH,xn.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 F1t="application/vnd.oasis.opendocument.spreadsheet";function M1t(e,t){for(var r=m7(e),n,a;n=Ej.exec(r);)switch(n[3]){case"manifest":break;case"file-entry":if(a=Mr(n[0],!1),a.path=="/"&&a.type!==F1t)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 $1t(e){var t=[$a];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 BX(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 B1t(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 z1t(e){var t=[$a];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(BX(e[r][0],e[r][1])),t.push(B1t("",e[r][0]));return t.push(BX("","Document","pkg")),t.push("</rdf:RDF>"),t.join("")}function wme(){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 '+_j.version+"</meta:generator></office:meta></office:document-meta>"}var eu=[["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"]],q1t=function(){for(var e=new Array(eu.length),t=0;t<eu.length;++t){var r=eu[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 jme(e){var t={};e=hs(e);for(var r=0;r<eu.length;++r){var n=eu[r],a=e.match(q1t[r]);a!=null&&a.length>0&&(t[n[1]]=Fn(a[1])),n[2]==="date"&&t[n[1]]&&(t[n[1]]=Gs(t[n[1]]))}return t}function YP(e,t,r,n,a){a[e]!=null||t==null||t===""||(a[e]=t,t=ls(t),n[n.length]=r?$t(e,t,r):Qi(e,t))}function _me(e,t){var r=t||{},n=[$a,$t("cp:coreProperties",null,{"xmlns:cp":vi.CORE_PROPS,"xmlns:dc":vi.dc,"xmlns:dcterms":vi.dcterms,"xmlns:dcmitype":vi.dcmitype,"xmlns:xsi":vi.xsi})],a={};if(!e&&!r.Props)return n.join("");e&&(e.CreatedDate!=null&&YP("dcterms:created",typeof e.CreatedDate=="string"?e.CreatedDate:jI(e.CreatedDate,r.WTF),{"xsi:type":"dcterms:W3CDTF"},n,a),e.ModifiedDate!=null&&YP("dcterms:modified",typeof e.ModifiedDate=="string"?e.ModifiedDate:jI(e.ModifiedDate,r.WTF),{"xsi:type":"dcterms:W3CDTF"},n,a));for(var i=0;i!=eu.length;++i){var o=eu[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&&YP(o[0],l,null,n,a)}return n.length>2&&(n[n.length]="</cp:coreProperties>",n[1]=n[1].replace("/>",">")),n.join("")}var n0=[["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"]],Nme=["Worksheets","SheetNames","NamedRanges","DefinedNames","Chartsheets","ChartNames"];function Sme(e,t,r,n){var a=[];if(typeof e=="string")a=TX(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"?TX(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 U1t(e,t,r){var n={};return t||(t={}),e=hs(e),n0.forEach(function(a){var i=(e.match(kj(a[0]))||[])[1];switch(a[2]){case"string":i&&(t[a[1]]=Fn(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&&Sme(n.HeadingPairs,n.TitlesOfParts,t,r),t}function kme(e){var t=[],r=$t;return e||(e={}),e.Application="SheetJS",t[t.length]=$a,t[t.length]=$t("Properties",null,{xmlns:vi.EXT_PROPS,"xmlns:vt":vi.vt}),n0.forEach(function(n){if(e[n[1]]!==void 0){var a;switch(n[2]){case"string":a=ls(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>"+ls(n)+"</vt:lpstr>"}).join(""),{size:e.Worksheets,baseType:"lpstr"})),t.length>2&&(t[t.length]="</Properties>",t[1]=t[1].replace("/>",">")),t.join("")}var V1t=/<[^>]+>[^<]*/g;function H1t(e,t){var r={},n="",a=e.match(V1t);if(a)for(var i=0;i!=a.length;++i){var o=a[i],l=Mr(o);switch(l[0]){case"<?xml":break;case"<Properties":break;case"<property":n=Fn(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]=Fn(d);break;case"bool":r[n]=qs(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]=Gs(d);break;case"cy":case"error":r[n]=Fn(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 Cme(e){var t=[$a,$t("Properties",null,{xmlns:vi.CUST_PROPS,"xmlns:vt":vi.vt})];if(!e)return t.join("");var r=1;return ka(e).forEach(function(a){++r,t[t.length]=$t("property",e1t(e[a]),{fmtid:"{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",pid:r,name:ls(a)})}),t.length>2&&(t[t.length]="</Properties>",t[1]=t[1].replace("/>",">")),t.join("")}var CI={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"},ZP;function W1t(e,t,r){ZP||(ZP=SA(CI)),t=ZP[t]||t,e[t]=r}function G1t(e,t){var r=[];return ka(CI).map(function(n){for(var a=0;a<eu.length;++a)if(eu[a][1]==n)return eu[a];for(a=0;a<n0.length;++a)if(n0[a][1]==n)return n0[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(Qi(CI[n[1]]||n[1],a))}}),$t("DocumentProperties",r.join(""),{xmlns:Wl.o})}function K1t(e,t){var r=["Worksheets","SheetNames"],n="CustomDocumentProperties",a=[];return e&&ka(e).forEach(function(i){if(Object.prototype.hasOwnProperty.call(e,i)){for(var o=0;o<eu.length;++o)if(i==eu[o][1])return;for(o=0;o<n0.length;++o)if(i==n0[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($t(kX(i),l,{"dt:dt":c}))}}),t&&ka(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($t(kX(i),o,{"dt:dt":l}))}}),"<"+n+' xmlns="'+Wl.o+'">'+a.join("")+"</"+n+">"}function A7(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 X1t(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=dt(8);return o.write_shift(4,n),o.write_shift(4,a),o}function Eme(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 Ame(e,t,r){var n=e.read_shift(0,"lpwstr");return n}function Tme(e,t,r){return t===31?Ame(e):Eme(e,t,r)}function EI(e,t,r){return Tme(e,t,r===!1?0:4)}function Y1t(e,t){if(!t)throw new Error("VtUnalignedString must have positive length");return Tme(e,t,0)}function Z1t(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(No,""),e.l-a&2&&(e.l+=2)}return r}function J1t(e){for(var t=e.read_shift(4),r=[],n=0;n!=t;++n)r[n]=e.read_shift(0,"lpstr-cp").replace(No,"");return r}function Q1t(e){var t=e.l,r=Kk(e,vme);e[e.l]==0&&e[e.l+1]==0&&e.l-t&2&&(e.l+=2);var n=Kk(e,dl);return[r,n]}function ebt(e){for(var t=e.read_shift(4),r=[],n=0;n<t/2;++n)r.push(Q1t(e));return r}function zX(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(No,"").replace(uw,"!"),t===1200&&o%2&&(e.l+=2)}return e.l&3&&(e.l=e.l>>3<<2),n}function Pme(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 tbt(e){var t={};return t.Size=e.read_shift(4),e.l+=t.Size+3-(t.Size-1)%4,t}function Kk(e,t,r){var n=e.read_shift(2),a,i=r||{};if(e.l+=2,t!==MX&&n!==t&&O1t.indexOf(t)===-1&&!((t&65534)==4126&&(n&65534)==4126))throw new Error("Expected type "+t+" saw "+n);switch(t===MX?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 Eme(e,n,4).replace(No,"");case 31:return Ame(e);case 64:return A7(e);case 65:return Pme(e);case 71:return tbt(e);case 80:return EI(e,n,!i.raw).replace(No,"");case 81:return Y1t(e,n).replace(No,"");case 4108:return ebt(e);case 4126:case 4127:return n==4127?Z1t(e):J1t(e);default:throw new Error("TypedPropertyValue unrecognized type "+t+" "+n)}}function qX(e,t){var r=dt(4),n=dt(4);switch(r.write_shift(4,e==80?31:e),e){case 3:n.write_shift(-4,t);break;case 5:n=dt(8),n.write_shift(8,t,"f");break;case 11:n.write_shift(4,t?1:0);break;case 64:n=X1t(t);break;case 31:case 80:for(n=dt(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 Di([r,n])}function UX(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(y,b){return y[1]-b[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 x=t[i[o][0]];if(m[x.n]=Kk(e,x.t,{raw:!0}),x.p==="version"&&(m[x.n]=String(m[x.n]>>16)+"."+("0000"+String(m[x.n]&65535)).slice(-4)),x.n=="CodePage")switch(m[x.n]){case 0:m[x.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:Hc(l=m[x.n]>>>0&65535);break;default:throw new Error("Unsupported CodePage: "+m[x.n])}}else if(i[o][0]===1){if(l=m.CodePage=Kk(e,C7),Hc(l),c!==-1){var p=e.l;e.l=i[c][1],u=zX(e,l),e.l=p}}else if(i[o][0]===0){if(l===0){c=o,e.l=i[o+1][1];continue}u=zX(e,l)}else{var g=u[i[o][0]],v;switch(e[e.l]){case 65:e.l+=4,v=Pme(e);break;case 30:e.l+=4,v=EI(e,e[e.l-4]).replace(/\u0000+$/,"");break;case 31:e.l+=4,v=EI(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=Oa(e,4);break;case 64:e.l+=4,v=Gs(A7(e));break;default:throw new Error("unparsed value: "+e[e.l])}m[g]=v}}return e.l=r+n,m}var Ome=["CodePage","Thumbnail","_PID_LINKBASE","_PID_HLINKS","SystemIdentifier","FMTID"];function rbt(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 VX(e,t,r){var n=dt(8),a=[],i=[],o=8,l=0,c=dt(8),u=dt(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=dt(8),u.write_shift(4,0),a.unshift(u);var d=[dt(4)];for(d[0].write_shift(4,e.length),l=0;l<e.length;++l){var f=e[l][0];for(c=dt(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=Di(d),i.unshift(c),o+=8+c.length}for(l=0;l<e.length;++l)if(!(t&&!t[e[l][0]])&&!(Ome.indexOf(e[l][0])>-1||Nme.indexOf(e[l][0])>-1)&&e[l][1]!=null){var m=e[l][1],h=0;if(t){h=+t[e[l][0]];var x=r[h];if(x.p=="version"&&typeof m=="string"){var p=m.split(".");m=(+p[0]<<16)+(+p[1]||0)}c=qX(x.t,m)}else{var g=rbt(m);g==-1&&(g=31,m=String(m)),c=qX(g,m)}i.push(c),u=dt(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),Di([n].concat(a).concat(i))}function HX(e,t,r){var n=e.content;if(!n)return{};Ji(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!==jr.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=UX(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 x;try{x=UX(n,null)}catch{}for(h in x)m[h]=x[h];return m.FMTID=[i,o],m}function WX(e,t,r,n,a,i){var o=dt(a?68:48),l=[o];o.write_shift(2,65534),o.write_shift(2,0),o.write_shift(4,842412599),o.write_shift(16,jr.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=VX(e,r,n);if(l.push(c),a){var u=VX(a,null,null);o.write_shift(16,i,"hex"),o.write_shift(4,68+c.length),l.push(u)}return Di(l)}function am(e,t){return e.read_shift(t),null}function nbt(e,t){t||(t=dt(e));for(var r=0;r<e;++r)t.write_shift(1,0);return t}function sbt(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 Oa(e,t){return e.read_shift(t)===1}function zo(e,t){return t||(t=dt(2)),t.write_shift(2,+!!e),t}function Ka(e){return e.read_shift(2,"u")}function Pc(e,t){return t||(t=dt(2)),t.write_shift(2,e),t}function Dme(e,t){return sbt(e,t,Ka)}function abt(e){var t=e.read_shift(1),r=e.read_shift(1);return r===1?t:t===1}function Ime(e,t,r){return r||(r=dt(2)),r.write_shift(1,t=="e"?+e:+!!e),r.write_shift(1,t=="e"?1:0),r}function I_(e,t,r){var n=e.read_shift(r&&r.biff>=12?2:1),a="sbcs-cont",i=ic;if(r&&r.biff>=8&&(ic=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 ic=i,l}function ibt(e){var t=ic;ic=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),ic=t,u}function obt(e){var t=e.t||"",r=dt(3);r.write_shift(2,t.length),r.write_shift(1,1);var n=dt(2*t.length);n.write_shift(2*t.length,t,"utf16le");var a=[r,n];return Di(a)}function R0(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 R_(e,t,r){var n=e.read_shift(r&&r.biff==2?1:2);return n===0?(e.l++,""):R0(e,n,r)}function lg(e,t,r){if(r.biff>5)return R_(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 Rme(e,t,r){return r||(r=dt(3+2*e.length)),r.write_shift(2,e.length),r.write_shift(1,1),r.write_shift(31,e,"utf16le"),r}function lbt(e){var t=e.read_shift(1);e.l++;var r=e.read_shift(2);return e.l+=2,[t,r]}function cbt(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(No,"");return n&&(e.l+=24),a}function ubt(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(No,"");return r+o}function dbt(e,t){var r=e.read_shift(16);switch(r){case"e0c9ea79f9bace118c8200aa004ba90b":return cbt(e);case"0303000000000000c000000000000046":return ubt(e);default:throw new Error("Unsupported Moniker "+r)}}function qS(e){var t=e.read_shift(4),r=t>0?e.read_shift(t,"utf16le").replace(No,""):"";return r}function GX(e,t){t||(t=dt(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 fbt(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=qS(e,r-e.l)),a&128&&(o=qS(e,r-e.l)),(a&257)===257&&(l=qS(e,r-e.l)),(a&257)===1&&(c=dbt(e,r-e.l)),a&8&&(u=qS(e,r-e.l)),a&32&&(d=e.read_shift(16)),a&64&&(f=A7(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 hbt(e){var t=dt(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),GX(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&&GX(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 Lme(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 Fme(e,t){var r=Lme(e);return r[3]=0,r}function xf(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 L0(e,t,r,n){return n||(n=dt(6)),n.write_shift(2,e),n.write_shift(2,t),n.write_shift(2,r||0),n}function mbt(e){var t=e.read_shift(2),r=e.read_shift(2);return e.l+=8,{type:t,flags:r}}function pbt(e,t,r){return t===0?"":lg(e,t,r)}function xbt(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 Mme(e){var t=e.read_shift(2),r=k7(e);return[t,r]}function gbt(e,t,r){e.l+=4,t-=4;var n=e.l+t,a=I_(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 AA(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 $me(e,t){return t||(t=dt(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 Bme(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 vbt=Bme;function zme(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 ybt(e){var t={};return e.l+=4,e.l+=16,t.fSharedNote=e.read_shift(2),e.l+=4,t}function bbt(e){var t={};return e.l+=4,e.cf=e.read_shift(2),t}function mo(e){e.l+=2,e.l+=e.read_shift(2)}var wbt={0:mo,4:mo,5:mo,6:mo,7:bbt,8:mo,9:mo,10:mo,11:mo,12:mo,13:ybt,14:mo,15:mo,16:mo,17:mo,18:mo,19:mo,20:mo,21:zme};function jbt(e,t){for(var r=e.l+t,n=[];e.l<r;){var a=e.read_shift(2);e.l-=2;try{n.push(wbt[a](e,r-e.l))}catch{return e.l=r,n}}return e.l!=r&&(e.l=r),n}function US(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 T7(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=dt(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 _bt(e,t){return t===0||e.read_shift(2),1200}function Nbt(e,t,r){if(r.enc)return e.l+=t,"";var n=e.l,a=lg(e,0,r);return e.read_shift(t+n-e.l),a}function Sbt(e,t){var r=!t||t.biff==8,n=dt(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 kbt(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 Cbt(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=I_(e,0,r);return o.length===0&&(o="Sheet1"),{pos:n,hs:a,dt:i,name:o}}function Ebt(e,t){var r=!t||t.biff>=8?2:1,n=dt(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 Abt(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(ibt(e));return i.Count=n,i.Unique=a,i}function Tbt(e,t){var r=dt(8);r.write_shift(4,e.Count),r.write_shift(4,e.Unique);for(var n=[],a=0;a<e.length;++a)n[a]=obt(e[a]);var i=Di([r].concat(n));return i.parts=[r.length].concat(n.map(function(o){return o.length})),i}function Pbt(e,t){var r={};return r.dsst=e.read_shift(2),e.l+=t-2,r}function Obt(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 Dbt(e){var t=mbt(e);if(t.type!=2211)throw new Error("Invalid Future Record "+t.type);var r=e.read_shift(4);return r!==0}function Ibt(e){return e.read_shift(2),e.read_shift(4)}function KX(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 Rbt(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 Lbt(){var e=dt(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 Fbt(e,t,r){if(r&&r.biff>=2&&r.biff<5)return{};var n=e.read_shift(2);return{RTL:n&64}}function Mbt(e){var t=dt(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 $bt(){}function Bbt(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=I_(e,0,r),n}function zbt(e,t){var r=e.name||"Arial",n=t&&t.biff==5,a=n?15+r.length:16+2*r.length,i=dt(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 qbt(e){var t=xf(e);return t.isst=e.read_shift(4),t}function Ubt(e,t,r,n){var a=dt(10);return L0(e,t,n,a),a.write_shift(4,r),a}function Vbt(e,t,r){r.biffguess&&r.biff==2&&(r.biff=5);var n=e.l+t,a=xf(e);r.biff==2&&e.l++;var i=R_(e,n-e.l,r);return a.val=i,a}function Hbt(e,t,r,n,a){var i=!a||a.biff==8,o=dt(8+ +i+(1+i)*r.length);return L0(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 Wbt(e,t,r){var n=e.read_shift(2),a=lg(e,0,r);return[n,a]}function Gbt(e,t,r,n){var a=r&&r.biff==5;n||(n=dt(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 Kbt=lg;function XX(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 Xbt(e,t){var r=t.biff==8||!t.biff?4:2,n=dt(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 Ybt(e){var t=e.read_shift(2),r=e.read_shift(2),n=Mme(e);return{r:t,c:r,ixfe:n[0],rknum:n[1]}}function Zbt(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(Mme(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 Jbt(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 Qbt(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=D1t[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 ewt(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=Qbt(e,t,n.fStyle,r),n}function YX(e,t,r,n){var a=r&&r.biff==5;n||(n=dt(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 twt(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 rwt(e){var t=dt(8);return t.write_shift(4,0),t.write_shift(2,0),t.write_shift(2,0),t}function ZX(e,t,r){var n=xf(e);(r.biff==2||t==9)&&++e.l;var a=abt(e);return n.val=a,n.t=a===!0||a===!1?"b":"e",n}function nwt(e,t,r,n,a,i){var o=dt(8);return L0(e,t,n,o),Ime(r,i,o),o}function swt(e,t,r){r.biffguess&&r.biff==2&&(r.biff=5);var n=xf(e),a=jo(e);return n.val=a,n}function awt(e,t,r,n){var a=dt(14);return L0(e,t,n,a),I0(r,a),a}var JX=pbt;function iwt(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=R0(e,i),l=[];n>e.l;)l.push(R_(e));return[i,a,o,l]}function QX(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=gbt(e,t-2,r)),i.body=a||e.read_shift(t-2),typeof a=="string"&&(i.Name=a),i}var owt=["_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 eY(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=R0(e,o,r);a&32&&(u=owt[u.charCodeAt(0)]);var d=n-e.l;r&&r.biff==2&&--d;var f=n==e.l||l===0||!(d>0)?[]:jNt(e,d,r,l);return{chKey:i,Name:u,itab:c,rgce:f}}function qme(e,t,r){if(r.biff<8)return lwt(e,t,r);for(var n=[],a=e.l+t,i=e.read_shift(r.biff>8?4:2);i--!==0;)n.push(xbt(e,r.biff>8?12:6,r));if(e.l!=a)throw new Error("Bad ExternSheet: "+e.l+" != "+a);return n}function lwt(e,t,r){e[e.l+1]==3&&e[e.l]++;var n=I_(e,t,r);return n.charCodeAt(0)==3?n.slice(1):n}function cwt(e,t,r){if(r.biff<8){e.l+=t;return}var n=e.read_shift(2),a=e.read_shift(2),i=R0(e,n,r),o=R0(e,a,r);return[i,o]}function uwt(e,t,r){var n=Bme(e);e.l++;var a=e.read_shift(1);return t-=8,[_Nt(e,t,r),a,n]}function tY(e,t,r){var n=vbt(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,bNt(e,t,r)]}function dwt(e){var t=e.read_shift(4)!==0,r=e.read_shift(4)!==0,n=e.read_shift(4);return[t,r,n]}function fwt(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=lg(e,0,r);return r.biff<8&&e.read_shift(1),[{r:n,c:a},l,o,i]}}function hwt(e,t,r){return fwt(e,t,r)}function mwt(e,t){for(var r=[],n=e.read_shift(2);n--;)r.push(AA(e));return r}function pwt(e){var t=dt(2+e.length*8);t.write_shift(2,e.length);for(var r=0;r<e.length;++r)$me(e[r],t);return t}function xwt(e,t,r){if(r&&r.biff<8)return vwt(e,t,r);var n=zme(e),a=jbt(e,t-22,n[1]);return{cmo:n,ft:a}}var gwt={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 vwt(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((gwt[n]||Co)(e,t,r)),{cmo:[a,n,i],ft:o}}function ywt(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=lbt(e,6,r);var l=e.read_shift(2);e.read_shift(2),Ka(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=R0(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 bwt(e,t){var r=AA(e);e.l+=16;var n=fbt(e,t-24);return[r,n]}function wwt(e){var t=dt(24),r=ia(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 Di([t,hbt(e[1])])}function jwt(e,t){e.read_shift(2);var r=AA(e),n=e.read_shift((t-10)/2,"dbcs-cont");return n=n.replace(No,""),[r,n]}function _wt(e){var t=e[1].Tooltip,r=dt(10+2*(t.length+1));r.write_shift(2,2048);var n=ia(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 Nwt(e){var t=[0,0],r;return r=e.read_shift(2),t[0]=$X[r]||r,r=e.read_shift(2),t[1]=$X[r]||r,t}function Swt(e){return e||(e=dt(4)),e.write_shift(2,1),e.write_shift(2,1),e}function kwt(e){for(var t=e.read_shift(2),r=[];t-- >0;)r.push(Fme(e));return r}function Cwt(e){for(var t=e.read_shift(2),r=[];t-- >0;)r.push(Fme(e));return r}function Ewt(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 Ume(e,t,r){if(!r.cellStyles)return Co(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 Awt(e,t){var r=dt(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 Twt(e,t){var r={};return t<32||(e.l+=16,r.header=jo(e),r.footer=jo(e),e.l+=2),r}function Pwt(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 Owt(e){for(var t=dt(2*e),r=0;r<e;++r)t.write_shift(2,r+1);return t}var Dwt=xf,Iwt=Dme,Rwt=R_;function Lwt(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 Fwt(e,t,r){r.biffguess&&r.biff==5&&(r.biff=2);var n=xf(e);++e.l;var a=lg(e,t-7,r);return n.t="str",n.val=a,n}function Mwt(e){var t=xf(e);++e.l;var r=jo(e);return t.t="n",t.val=r,t}function $wt(e,t,r){var n=dt(15);return $_(n,e,t),n.write_shift(8,r,"f"),n}function Bwt(e){var t=xf(e);++e.l;var r=e.read_shift(2);return t.t="n",t.val=r,t}function zwt(e,t,r){var n=dt(9);return $_(n,e,t),n.write_shift(2,r),n}function qwt(e){var t=e.read_shift(1);return t===0?(e.l++,""):e.read_shift(t,"sbcs-cont")}function Uwt(e,t){e.l+=6,e.l+=2,e.l+=1,e.l+=3,e.l+=1,e.l+=t-13}function Vwt(e,t,r){var n=e.l+t,a=xf(e),i=e.read_shift(2),o=R0(e,i,r);return e.l=n,a.t="str",a.val=o,a}var Hwt=[2,3,48,49,131,139,140,245],AI=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=SA({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=vp(1);switch(c.type){case"base64":d=Yl(uc(l));break;case"binary":d=Yl(l);break;case"buffer":case"array":d=l;break}Ji(d,0);var f=d.read_shift(1),m=!!(f&136),h=!1,x=!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:x=!0;break;case 245:break;default:throw new Error("DBF Unsupported Version: "+f.toString(16))}var p=0,g=521;f==2&&(p=d.read_shift(2)),d.l+=3,f!=2&&(p=d.read_shift(4)),p>1048576&&(p=1e6),f!=2&&(g=d.read_shift(2));var v=d.read_shift(2),y=c.codepage||1252;f!=2&&(d.l+=16,d.read_shift(1),d[d.l]!==0&&(y=e[d[d.l]]),d.l+=1,d.l+=2),x&&(d.l+=36);for(var b=[],N={},j=Math.min(d.length,f==2?521:g-10-(h?264:0)),_=x?32:11;d.l<j&&d[d.l]!=13;)switch(N={},N.name=Pn.utils.decode(y,d.slice(d.l,d.l+_)).replace(/[\u0000\r\n].*$/g,""),d.l+=_,N.type=String.fromCharCode(d.read_shift(1)),f!=2&&!x&&(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&&b.push(N),f!=2&&(d.l+=x?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=g-1),d.read_shift(1)!==13)throw new Error("DBF Terminator not found "+d.l+" "+d[d.l]);d.l=g;var S=0,P=0;for(u[0]=[],P=0;P!=b.length;++P)u[0][P]=b[P].name;for(;p-- >0;){if(d[d.l]===42){d.l+=v;continue}for(++d.l,u[++S]=[],P=0,P=0;P!=b.length;++P){var T=d.slice(d.l,d.l+b[P].len);d.l+=b[P].len,Ji(T,0);var R=Pn.utils.decode(y,T);switch(b[P].type){case"C":R.trim().length&&(u[S][P]=R.replace(/\s+$/,""));break;case"D":R.length===8?u[S][P]=new Date(+R.slice(0,4),+R.slice(4,6)-1,+R.slice(6,8)):u[S][P]=R;break;case"F":u[S][P]=parseFloat(R.trim());break;case"+":case"I":u[S][P]=x?T.read_shift(-4,"i")^2147483648:T.read_shift(4,"i");break;case"L":switch(R.trim().toUpperCase()){case"Y":case"T":u[S][P]=!0;break;case"N":case"F":u[S][P]=!1;break;case"":case"?":break;default:throw new Error("DBF Unrecognized L:|"+R+"|")}break;case"M":if(!m)throw new Error("DBF Unexpected MEMO for type "+f.toString(16));u[S][P]="##MEMO##"+(x?parseInt(R.trim(),10):T.read_shift(4));break;case"N":R=R.replace(/\u0000/g,"").trim(),R&&R!="."&&(u[S][P]=+R||0);break;case"@":u[S][P]=new Date(T.read_shift(-8,"f")-621356832e5);break;case"T":u[S][P]=new Date((T.read_shift(4)-2440588)*864e5+T.read_shift(4));break;case"Y":u[S][P]=T.read_shift(4,"i")/1e4+T.read_shift(4,"i")/1e4*Math.pow(2,32);break;case"O":u[S][P]=-T.read_shift(-8,"f");break;case"B":if(h&&b[P].len==8){u[S][P]=T.read_shift(8,"f");break}case"G":case"P":T.l+=b[P].len;break;case"0":if(b[P].name==="_NullFlags")break;default:throw new Error("DBF Unsupported data type "+b[P].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=b,u}function n(l,c){var u=c||{};u.dateNF||(u.dateNF="yyyymmdd");var d=H1(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 zp(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&&Hc(+u.codepage),u.type=="string")throw new Error("Cannot write DBF to JS string");var d=jl(),f=Zk(l,{header:1,raw:!0,cellDates:!0}),m=f[0],h=f.slice(1),x=l["!cols"]||[],p=0,g=0,v=0,y=1;for(p=0;p<m.length;++p){if(((x[p]||{}).DBF||{}).name){m[p]=x[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(g=0;g<1024;++g)if(m.indexOf(m[p]+"_"+g)==-1){m[p]+="_"+g;break}}}}var b=Nn(l["!ref"]),N=[],j=[],_=[];for(p=0;p<=b.e.c-b.s.c;++p){var S="",P="",T=0,R=[];for(g=0;g<h.length;++g)h[g][p]!=null&&R.push(h[g][p]);if(R.length==0||m[p]==null){N[p]="?";continue}for(g=0;g<R.length;++g){switch(typeof R[g]){case"number":P="B";break;case"string":P="C";break;case"boolean":P="L";break;case"object":P=R[g]instanceof Date?"D":"C";break;default:P="C"}T=Math.max(T,String(R[g]).length),S=S&&S!=P?"C":P}T>250&&(T=250),P=((x[p]||{}).DBF||{}).type,P=="C"&&x[p].DBF.len>T&&(T=x[p].DBF.len),S=="B"&&P=="N"&&(S="N",_[p]=x[p].DBF.dec,T=x[p].DBF.len),j[p]=S=="C"||P=="N"?T:i[S]||0,y+=j[p],N[p]=S}var k=d.next(32);for(k.write_shift(4,318902576),k.write_shift(4,h.length),k.write_shift(2,296+32*v),k.write_shift(2,y),p=0;p<4;++p)k.write_shift(4,0);for(k.write_shift(4,0|(+t[P0]||3)<<8),p=0,g=0;p<m.length;++p)if(m[p]!=null){var E=d.next(32),q=(m[p].slice(-10)+"\0\0\0\0\0\0\0\0\0\0\0").slice(0,11);E.write_shift(1,q,"sbcs"),E.write_shift(1,N[p]=="?"?"C":N[p],"sbcs"),E.write_shift(4,g),E.write_shift(1,j[p]||i[N[p]]||0),E.write_shift(1,_[p]||0),E.write_shift(1,2),E.write_shift(4,0),E.write_shift(1,0),E.write_shift(4,0),E.write_shift(4,0),g+=j[p]||i[N[p]]||0}var O=d.next(264);for(O.write_shift(4,13),p=0;p<65;++p)O.write_shift(4,0);for(p=0;p<h.length;++p){var L=d.next(y);for(L.write_shift(1,0),g=0;g<m.length;++g)if(m[g]!=null)switch(N[g]){case"L":L.write_shift(1,h[p][g]==null?63:h[p][g]?84:70);break;case"B":L.write_shift(8,h[p][g]||0,"f");break;case"N":var H="0";for(typeof h[p][g]=="number"&&(H=h[p][g].toFixed(_[g]||0)),v=0;v<j[g]-H.length;++v)L.write_shift(1,32);L.write_shift(1,H,"sbcs");break;case"D":h[p][g]?(L.write_shift(4,("0000"+h[p][g].getFullYear()).slice(-4),"sbcs"),L.write_shift(2,("00"+(h[p][g].getMonth()+1)).slice(-2),"sbcs"),L.write_shift(2,("00"+h[p][g].getDate()).slice(-2),"sbcs")):L.write_shift(8,"00000000","sbcs");break;case"C":var V=String(h[p][g]!=null?h[p][g]:"").slice(0,j[g]);for(L.write_shift(1,V,"sbcs"),v=0;v<j[g]-V.length;++v)L.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}}(),Vme=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("+ka(e).join("|").replace(/\|\|\|/,"|\\||").replace(/([?()+])/g,"\\$1")+"|\\|)","gm"),r=function(m,h){var x=e[h];return typeof x=="number"?wI(x):x},n=function(m,h,x){var p=h.charCodeAt(0)-32<<4|x.charCodeAt(0)-48;return p==59?m:wI(p)};e["|"]=254;function a(m,h){switch(h.type){case"base64":return i(uc(m),h);case"binary":return i(m,h);case"buffer":return i(pn&&Buffer.isBuffer(m)?m.toString("binary"):Bp(m),h);case"array":return i(D0(m),h)}throw new Error("Unrecognized type "+h.type)}function i(m,h){var x=m.split(/[\n\r]+/),p=-1,g=-1,v=0,y=0,b=[],N=[],j=null,_={},S=[],P=[],T=[],R=0,k;for(+h.codepage>=0&&Hc(+h.codepage);v!==x.length;++v){R=0;var E=x[v].trim().replace(/\x1B([\x20-\x2F])([\x30-\x3F])/g,n).replace(t,r),q=E.replace(/;;/g,"\0").split(";").map(function(U){return U.replace(/\u0000/g,";")}),O=q[0],L;if(E.length>0)switch(O){case"ID":break;case"E":break;case"B":break;case"O":break;case"W":break;case"P":q[1].charAt(0)=="P"&&N.push(E.slice(3).replace(/;;/g,";"));break;case"C":var H=!1,V=!1,z=!1,M=!1,B=-1,K=-1;for(y=1;y<q.length;++y)switch(q[y].charAt(0)){case"A":break;case"X":g=parseInt(q[y].slice(1))-1,V=!0;break;case"Y":for(p=parseInt(q[y].slice(1))-1,V||(g=0),k=b.length;k<=p;++k)b[k]=[];break;case"K":L=q[y].slice(1),L.charAt(0)==='"'?L=L.slice(1,L.length-1):L==="TRUE"?L=!0:L==="FALSE"?L=!1:isNaN(Yu(L))?isNaN(Xy(L).getDate())||(L=Gs(L)):(L=Yu(L),j!==null&&rg(j)&&(L=CA(L))),typeof Pn<"u"&&typeof L=="string"&&(h||{}).type!="string"&&(h||{}).codepage&&(L=Pn.utils.decode(h.codepage,L)),H=!0;break;case"E":M=!0;var C=Uv(q[y].slice(1),{r:p,c:g});b[p][g]=[b[p][g],C];break;case"S":z=!0,b[p][g]=[b[p][g],"S5S"];break;case"G":break;case"R":B=parseInt(q[y].slice(1))-1;break;case"C":K=parseInt(q[y].slice(1))-1;break;default:if(h&&h.WTF)throw new Error("SYLK bad record "+E)}if(H&&(b[p][g]&&b[p][g].length==2?b[p][g][0]=L:b[p][g]=L,j=null),z){if(M)throw new Error("SYLK shared formula cannot have own formula");var A=B>-1&&b[B][K];if(!A||!A[1])throw new Error("SYLK shared formula cannot find base");b[p][g][1]=lpe(A[1],{r:p-B,c:g-K})}break;case"F":var I=0;for(y=1;y<q.length;++y)switch(q[y].charAt(0)){case"X":g=parseInt(q[y].slice(1))-1,++I;break;case"Y":for(p=parseInt(q[y].slice(1))-1,k=b.length;k<=p;++k)b[k]=[];break;case"M":R=parseInt(q[y].slice(1))/20;break;case"F":break;case"G":break;case"P":j=N[parseInt(q[y].slice(1))];break;case"S":break;case"D":break;case"N":break;case"W":for(T=q[y].slice(1).split(" "),k=parseInt(T[0],10);k<=parseInt(T[1],10);++k)R=parseInt(T[2],10),P[k-1]=R===0?{hidden:!0}:{wch:R},yp(P[k-1]);break;case"C":g=parseInt(q[y].slice(1))-1,P[g]||(P[g]={});break;case"R":p=parseInt(q[y].slice(1))-1,S[p]||(S[p]={}),R>0?(S[p].hpt=R,S[p].hpx=Zy(R)):R===0&&(S[p].hidden=!0);break;default:if(h&&h.WTF)throw new Error("SYLK bad record "+E)}I<1&&(j=null);break;default:if(h&&h.WTF)throw new Error("SYLK bad record "+E)}}return S.length>0&&(_["!rows"]=S),P.length>0&&(_["!cols"]=P),h&&h.sheetRows&&(b=b.slice(0,h.sheetRows)),[b,_]}function o(m,h){var x=a(m,h),p=x[0],g=x[1],v=H1(p,h);return ka(g).forEach(function(y){v[y]=g[y]}),v}function l(m,h){return zp(o(m,h),h)}function c(m,h,x,p){var g="C;Y"+(x+1)+";X"+(p+1)+";K";switch(m.t){case"n":g+=m.v||0,m.f&&!m.F&&(g+=";E"+L7(m.f,{r:x,c:p}));break;case"b":g+=m.v?"TRUE":"FALSE";break;case"e":g+=m.w||m.v;break;case"d":g+='"'+(m.w||m.v)+'"';break;case"s":g+='"'+m.v.replace(/"/g,"").replace(/;/g,";;")+'"';break}return g}function u(m,h){h.forEach(function(x,p){var g="F;W"+(p+1)+" "+(p+1)+" ";x.hidden?g+="0":(typeof x.width=="number"&&!x.wpx&&(x.wpx=Pj(x.width)),typeof x.wpx=="number"&&!x.wch&&(x.wch=Oj(x.wpx)),typeof x.wch=="number"&&(g+=Math.round(x.wch))),g.charAt(g.length-1)!=" "&&m.push(g)})}function d(m,h){h.forEach(function(x,p){var g="F;";x.hidden?g+="M0;":x.hpt?g+="M"+20*x.hpt+";":x.hpx&&(g+="M"+20*Dj(x.hpx)+";"),g.length>2&&m.push(g+"R"+(p+1))})}function f(m,h){var x=["ID;PWXL;N;E"],p=[],g=Nn(m["!ref"]),v,y=Array.isArray(m),b=`\r
`;x.push("P;PGeneral"),x.push("F;P0;DG0G8;M255"),m["!cols"]&&u(x,m["!cols"]),m["!rows"]&&d(x,m["!rows"]),x.push("B;Y"+(g.e.r-g.s.r+1)+";X"+(g.e.c-g.s.c+1)+";D"+[g.s.c,g.s.r,g.e.c,g.e.r].join(" "));for(var N=g.s.r;N<=g.e.r;++N)for(var j=g.s.c;j<=g.e.c;++j){var _=Or({r:N,c:j});v=y?(m[N]||[])[j]:m[_],!(!v||v.v==null&&(!v.f||v.F))&&p.push(c(v,m,N,j))}return x.join(b)+b+p.join(b)+b+"E"+b}return{to_workbook:l,to_sheet:o,from_sheet:f}}(),Hme=function(){function e(i,o){switch(o.type){case"base64":return t(uc(i),o);case"binary":return t(i,o);case"buffer":return t(pn&&Buffer.isBuffer(i)?i.toString("binary"):Bp(i),o);case"array":return t(D0(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],x=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(Yu(x))?isNaN(Xy(x).getDate())?f[c][u]=x:f[c][u]=Gs(x):f[c][u]=Yu(x),++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 H1(e(i,o),o)}function n(i,o){return zp(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=Nn(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 x=d.s.c;x<=d.e.c;++x){var p=Or({r:h,c:x});if(f=m?(c[h]||[])[x]:c[p],!f){o(u,1,0,"");continue}switch(f.t){case"n":var g=f.w;!g&&f.v!=null&&(g=f.v),g==null?f.f&&!f.F?o(u,1,0,"="+f.f):o(u,1,0,""):o(u,0,g,"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=dc(f.z||Sr[14],_i(Gs(f.v)))),o(u,0,f.w,"V");break;default:o(u,1,0,"")}}}o(u,-1,0,"EOD");var v=`\r
`,y=u.join(v);return y}}();return{to_workbook:n,to_sheet:r,from_sheet:a}}(),Wme=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(`
`),x=-1,p=-1,g=0,v=[];g!==h.length;++g){var y=h[g].trim().split(":");if(y[0]==="cell"){var b=ia(y[1]);if(v.length<=b.r)for(x=v.length;x<=b.r;++x)v[x]||(v[x]=[]);switch(x=b.r,p=b.c,y[2]){case"t":v[x][p]=e(y[3]);break;case"v":v[x][p]=+y[3];break;case"vtf":var N=y[y.length-1];case"vtc":switch(y[3]){case"nl":v[x][p]=!!+y[4];break;default:v[x][p]=+y[4];break}y[2]=="vtf"&&(v[x][p]=[v[x][p],N])}}}return m&&m.sheetRows&&(v=v.slice(0,m.sheetRows)),v}function n(f,m){return H1(r(f,m),m)}function a(f,m){return zp(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=[],x,p="",g=Qo(f["!ref"]),v=Array.isArray(f),y=g.s.r;y<=g.e.r;++y)for(var b=g.s.c;b<=g.e.c;++b)if(p=Or({r:y,c:b}),x=v?(f[y]||[])[b]:f[p],!(!x||x.v==null||x.t==="z")){switch(h=["cell",p,"t"],x.t){case"s":case"str":h.push(t(x.v));break;case"n":x.f?(h[2]="vtf",h[3]="n",h[4]=x.v,h[5]=t(x.f)):(h[2]="v",h[3]=x.v);break;case"b":h[2]="vt"+(x.f?"f":"c"),h[3]="nl",h[4]=x.v?"1":"0",h[5]=t(x.f||(x.v?"TRUE":"FALSE"));break;case"d":var N=_i(Gs(x.v));h[2]="vtc",h[3]="nd",h[4]=""+N,h[5]=x.w||dc(x.z||Sr[14],N);break;case"e":continue}m.push(h.join(":"))}return m.push("sheet:c:"+(g.e.c-g.s.c+1)+":r:"+(g.e.r-g.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}}(),Yy=function(){function e(d,f,m,h,x){x.raw?f[m][h]=d:d===""||(d==="TRUE"?f[m][h]=!0:d==="FALSE"?f[m][h]=!1:isNaN(Yu(d))?isNaN(Xy(d).getDate())?f[m][h]=d:f[m][h]=Gs(d):f[m][h]=Yu(d))}function t(d,f){var m=f||{},h=[];if(!d||d.length===0)return h;for(var x=d.split(/[\r\n]/),p=x.length-1;p>=0&&x[p].length===0;)--p;for(var g=10,v=0,y=0;y<=p;++y)v=x[y].indexOf(" "),v==-1?v=x[y].length:v++,g=Math.max(g,v);for(y=0;y<=p;++y){h[y]=[];var b=0;for(e(x[y].slice(0,g).trim(),h,y,b,m),b=1;b<=(x[y].length-g)/10+1;++b)e(x[y].slice(g+(b-1)*10,g+b*10).trim(),h,y,b,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,x=0;h<d.length;++h)(x=d.charCodeAt(h))==34?m=!m:!m&&x in r&&(f[x]=(f[x]||0)+1);x=[];for(h in f)Object.prototype.hasOwnProperty.call(f,h)&&x.push([f[h],h]);if(!x.length){f=n;for(h in f)Object.prototype.hasOwnProperty.call(f,h)&&x.push([f[h],h])}return x.sort(function(p,g){return p[0]-g[0]||n[p[1]]-n[g[1]]}),r[x.pop()[1]]||44}function i(d,f){var m=f||{},h="",x=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 g=0,v=0,y=0,b=0,N=0,j=h.charCodeAt(0),_=!1,S=0,P=d.charCodeAt(0);d=d.replace(/\r\n/mg,`
`);var T=m.dateNF!=null?Tyt(m.dateNF):null;function R(){var k=d.slice(b,N),E={};if(k.charAt(0)=='"'&&k.charAt(k.length-1)=='"'&&(k=k.slice(1,-1).replace(/""/g,'"')),k.length===0)E.t="z";else if(m.raw)E.t="s",E.v=k;else if(k.trim().length===0)E.t="s",E.v=k;else if(k.charCodeAt(0)==61)k.charCodeAt(1)==34&&k.charCodeAt(k.length-1)==34?(E.t="s",E.v=k.slice(2,-1).replace(/""/g,'"')):i_t(k)?(E.t="n",E.f=k.slice(1)):(E.t="s",E.v=k);else if(k=="TRUE")E.t="b",E.v=!0;else if(k=="FALSE")E.t="b",E.v=!1;else if(!isNaN(y=Yu(k)))E.t="n",m.cellText!==!1&&(E.w=k),E.v=y;else if(!isNaN(Xy(k).getDate())||T&&k.match(T)){E.z=m.dateNF||Sr[14];var q=0;T&&k.match(T)&&(k=Pyt(k,m.dateNF,k.match(T)||[]),q=1),m.cellDates?(E.t="d",E.v=Gs(k,q)):(E.t="n",E.v=_i(Gs(k,q))),m.cellText!==!1&&(E.w=dc(E.z,E.v instanceof Date?_i(E.v):E.v)),m.cellNF||delete E.z}else E.t="s",E.v=k;if(E.t=="z"||(m.dense?(x[g]||(x[g]=[]),x[g][v]=E):x[Or({c:v,r:g})]=E),b=N+1,P=d.charCodeAt(b),p.e.c<v&&(p.e.c=v),p.e.r<g&&(p.e.r=g),S==j)++v;else if(v=0,++g,m.sheetRows&&m.sheetRows<=g)return!0}e:for(;N<d.length;++N)switch(S=d.charCodeAt(N)){case 34:P===34&&(_=!_);break;case j:case 10:case 13:if(!_&&R())break e;break}return N-b>0&&R(),x["!ref"]=sn(p),x}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):H1(t(d,f),f)}function l(d,f){var m="",h=f.type=="string"?[0,0,0,0]:H7(d,f);switch(f.type){case"base64":m=uc(d);break;case"binary":m=d;break;case"buffer":f.codepage==65001?m=d.toString("utf8"):f.codepage&&typeof Pn<"u"?m=Pn.utils.decode(f.codepage,d):m=pn&&Buffer.isBuffer(d)?d.toString("binary"):Bp(d);break;case"array":m=D0(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=hs(m.slice(3)):f.type!="string"&&f.type!="buffer"&&f.codepage==65001?m=hs(m):f.type=="binary"&&typeof Pn<"u"&&f.codepage&&(m=Pn.utils.decode(f.codepage,Pn.utils.encode(28591,m))),m.slice(0,19)=="socialcalc:version:"?Wme.to_sheet(f.type=="string"?m:hs(m),f):o(m,f)}function c(d,f){return zp(l(d,f),f)}function u(d){for(var f=[],m=Nn(d["!ref"]),h,x=Array.isArray(d),p=m.s.r;p<=m.e.r;++p){for(var g=[],v=m.s.c;v<=m.e.c;++v){var y=Or({r:p,c:v});if(h=x?(d[p]||[])[v]:d[y],!h||h.v==null){g.push(" ");continue}for(var b=(h.w||(af(h),h.w)||"").slice(0,10);b.length<10;)b+=" ";g.push(b+(v===0?" ":""))}f.push(g.join(""))}return f.join(`
`)}return{to_workbook:c,to_sheet:l,from_sheet:u}}();function Wwt(e,t){var r=t||{},n=!!r.WTF;r.WTF=!0;try{var a=Vme.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 Yy.to_workbook(e,t)}}var s0=function(){function e(C,A,I){if(C){Ji(C,C.l||0);for(var U=I.Enum||B;C.l<C.length;){var Y=C.read_shift(2),te=U[Y]||U[65535],re=C.read_shift(2),J=C.l+re,ie=te.f&&te.f(C,re,I);if(C.l=J,A(ie,te,Y))return}}}function t(C,A){switch(A.type){case"base64":return r(Yl(uc(C)),A);case"binary":return r(Yl(C),A);case"buffer":case"array":return r(C,A)}throw"Unsupported type "+A.type}function r(C,A){if(!C)return C;var I=A||{},U=I.dense?[]:{},Y="Sheet1",te="",re=0,J={},ie=[],be=[],Q={s:{r:0,c:0},e:{r:0,c:0}},Ve=I.sheetRows||0;if(C[2]==0&&(C[3]==8||C[3]==9)&&C.length>=16&&C[14]==5&&C[15]===108)throw new Error("Unsupported Works 3 for Mac file");if(C[2]==2)I.Enum=B,e(C,function(se,oe,le){switch(le){case 0:I.vers=se,se>=4096&&(I.qpro=!0);break;case 6:Q=se;break;case 204:se&&(te=se);break;case 222:te=se;break;case 15:case 51:I.qpro||(se[1].v=se[1].v.slice(1));case 13:case 14:case 16:le==14&&(se[2]&112)==112&&(se[2]&15)>1&&(se[2]&15)<15&&(se[1].z=I.dateNF||Sr[14],I.cellDates&&(se[1].t="d",se[1].v=CA(se[1].v))),I.qpro&&se[3]>re&&(U["!ref"]=sn(Q),J[Y]=U,ie.push(Y),U=I.dense?[]:{},Q={s:{r:0,c:0},e:{r:0,c:0}},re=se[3],Y=te||"Sheet"+(re+1),te="");var Me=I.dense?(U[se[0].r]||[])[se[0].c]:U[Or(se[0])];if(Me){Me.t=se[1].t,Me.v=se[1].v,se[1].z!=null&&(Me.z=se[1].z),se[1].f!=null&&(Me.f=se[1].f);break}I.dense?(U[se[0].r]||(U[se[0].r]=[]),U[se[0].r][se[0].c]=se[1]):U[Or(se[0])]=se[1];break}},I);else if(C[2]==26||C[2]==14)I.Enum=K,C[2]==14&&(I.qpro=!0,C.l=0),e(C,function(se,oe,le){switch(le){case 204:Y=se;break;case 22:se[1].v=se[1].v.slice(1);case 23:case 24:case 25:case 37:case 39:case 40:if(se[3]>re&&(U["!ref"]=sn(Q),J[Y]=U,ie.push(Y),U=I.dense?[]:{},Q={s:{r:0,c:0},e:{r:0,c:0}},re=se[3],Y="Sheet"+(re+1)),Ve>0&&se[0].r>=Ve)break;I.dense?(U[se[0].r]||(U[se[0].r]=[]),U[se[0].r][se[0].c]=se[1]):U[Or(se[0])]=se[1],Q.e.c<se[0].c&&(Q.e.c=se[0].c),Q.e.r<se[0].r&&(Q.e.r=se[0].r);break;case 27:se[14e3]&&(be[se[14e3][0]]=se[14e3][1]);break;case 1537:be[se[0]]=se[1],se[0]==re&&(Y=se[1]);break}},I);else throw new Error("Unrecognized LOTUS BOF "+C[2]);if(U["!ref"]=sn(Q),J[te||Y]=U,ie.push(te||Y),!be.length)return{SheetNames:ie,Sheets:J};for(var W={},Z=[],he=0;he<be.length;++he)J[ie[he]]?(Z.push(be[he]||ie[he]),W[be[he]]=J[be[he]]||J[ie[he]]):(Z.push(be[he]),W[be[he]]={"!ref":"A1"});return{SheetNames:Z,Sheets:W}}function n(C,A){var I=A||{};if(+I.codepage>=0&&Hc(+I.codepage),I.type=="string")throw new Error("Cannot write WK1 to JS string");var U=jl(),Y=Nn(C["!ref"]),te=Array.isArray(C),re=[];Bt(U,0,i(1030)),Bt(U,6,c(Y));for(var J=Math.min(Y.e.r,8191),ie=Y.s.r;ie<=J;++ie)for(var be=wa(ie),Q=Y.s.c;Q<=Y.e.c;++Q){ie===Y.s.r&&(re[Q]=Ws(Q));var Ve=re[Q]+be,W=te?(C[ie]||[])[Q]:C[Ve];if(!(!W||W.t=="z"))if(W.t=="n")(W.v|0)==W.v&&W.v>=-32768&&W.v<=32767?Bt(U,13,h(ie,Q,W.v)):Bt(U,14,p(ie,Q,W.v));else{var Z=af(W);Bt(U,15,f(ie,Q,Z.slice(0,239)))}}return Bt(U,1),U.end()}function a(C,A){var I=A||{};if(+I.codepage>=0&&Hc(+I.codepage),I.type=="string")throw new Error("Cannot write WK3 to JS string");var U=jl();Bt(U,0,o(C));for(var Y=0,te=0;Y<C.SheetNames.length;++Y)(C.Sheets[C.SheetNames[Y]]||{})["!ref"]&&Bt(U,27,M(C.SheetNames[Y],te++));var re=0;for(Y=0;Y<C.SheetNames.length;++Y){var J=C.Sheets[C.SheetNames[Y]];if(!(!J||!J["!ref"])){for(var ie=Nn(J["!ref"]),be=Array.isArray(J),Q=[],Ve=Math.min(ie.e.r,8191),W=ie.s.r;W<=Ve;++W)for(var Z=wa(W),he=ie.s.c;he<=ie.e.c;++he){W===ie.s.r&&(Q[he]=Ws(he));var se=Q[he]+Z,oe=be?(J[W]||[])[he]:J[se];if(!(!oe||oe.t=="z"))if(oe.t=="n")Bt(U,23,R(W,he,re,oe.v));else{var le=af(oe);Bt(U,22,S(W,he,re,le.slice(0,239)))}}++re}}return Bt(U,1),U.end()}function i(C){var A=dt(2);return A.write_shift(2,C),A}function o(C){var A=dt(26);A.write_shift(2,4096),A.write_shift(2,4),A.write_shift(4,0);for(var I=0,U=0,Y=0,te=0;te<C.SheetNames.length;++te){var re=C.SheetNames[te],J=C.Sheets[re];if(!(!J||!J["!ref"])){++Y;var ie=Qo(J["!ref"]);I<ie.e.r&&(I=ie.e.r),U<ie.e.c&&(U=ie.e.c)}}return I>8191&&(I=8191),A.write_shift(2,I),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(C,A,I){var U={s:{c:0,r:0},e:{c:0,r:0}};return A==8&&I.qpro?(U.s.c=C.read_shift(1),C.l++,U.s.r=C.read_shift(2),U.e.c=C.read_shift(1),C.l++,U.e.r=C.read_shift(2),U):(U.s.c=C.read_shift(2),U.s.r=C.read_shift(2),A==12&&I.qpro&&(C.l+=2),U.e.c=C.read_shift(2),U.e.r=C.read_shift(2),A==12&&I.qpro&&(C.l+=2),U.s.c==65535&&(U.s.c=U.e.c=U.s.r=U.e.r=0),U)}function c(C){var A=dt(8);return A.write_shift(2,C.s.c),A.write_shift(2,C.s.r),A.write_shift(2,C.e.c),A.write_shift(2,C.e.r),A}function u(C,A,I){var U=[{c:0,r:0},{t:"n",v:0},0,0];return I.qpro&&I.vers!=20768?(U[0].c=C.read_shift(1),U[3]=C.read_shift(1),U[0].r=C.read_shift(2),C.l+=2):(U[2]=C.read_shift(1),U[0].c=C.read_shift(2),U[0].r=C.read_shift(2)),U}function d(C,A,I){var U=C.l+A,Y=u(C,A,I);if(Y[1].t="s",I.vers==20768){C.l++;var te=C.read_shift(1);return Y[1].v=C.read_shift(te,"utf8"),Y}return I.qpro&&C.l++,Y[1].v=C.read_shift(U-C.l,"cstr"),Y}function f(C,A,I){var U=dt(7+I.length);U.write_shift(1,255),U.write_shift(2,A),U.write_shift(2,C),U.write_shift(1,39);for(var Y=0;Y<U.length;++Y){var te=I.charCodeAt(Y);U.write_shift(1,te>=128?95:te)}return U.write_shift(1,0),U}function m(C,A,I){var U=u(C,A,I);return U[1].v=C.read_shift(2,"i"),U}function h(C,A,I){var U=dt(7);return U.write_shift(1,255),U.write_shift(2,A),U.write_shift(2,C),U.write_shift(2,I,"i"),U}function x(C,A,I){var U=u(C,A,I);return U[1].v=C.read_shift(8,"f"),U}function p(C,A,I){var U=dt(13);return U.write_shift(1,255),U.write_shift(2,A),U.write_shift(2,C),U.write_shift(8,I,"f"),U}function g(C,A,I){var U=C.l+A,Y=u(C,A,I);if(Y[1].v=C.read_shift(8,"f"),I.qpro)C.l=U;else{var te=C.read_shift(2);N(C.slice(C.l,C.l+te),Y),C.l+=te}return Y}function v(C,A,I){var U=A&32768;return A&=-32769,A=(U?C:0)+(A>=8192?A-16384:A),(U?"":"$")+(I?Ws(A):wa(A))}var y={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]},b=["","","","","","","","","","+","-","*","/","^","=","<>","<=",">=","<",">","","","","","&","","","","","","",""];function N(C,A){Ji(C,0);for(var I=[],U=0,Y="",te="",re="",J="";C.l<C.length;){var ie=C[C.l++];switch(ie){case 0:I.push(C.read_shift(8,"f"));break;case 1:te=v(A[0].c,C.read_shift(2),!0),Y=v(A[0].r,C.read_shift(2),!1),I.push(te+Y);break;case 2:{var be=v(A[0].c,C.read_shift(2),!0),Q=v(A[0].r,C.read_shift(2),!1);te=v(A[0].c,C.read_shift(2),!0),Y=v(A[0].r,C.read_shift(2),!1),I.push(be+Q+":"+te+Y)}break;case 3:if(C.l<C.length){console.error("WK1 premature formula end");return}break;case 4:I.push("("+I.pop()+")");break;case 5:I.push(C.read_shift(2));break;case 6:{for(var Ve="";ie=C[C.l++];)Ve+=String.fromCharCode(ie);I.push('"'+Ve.replace(/"/g,'""')+'"')}break;case 8:I.push("-"+I.pop());break;case 23:I.push("+"+I.pop());break;case 22:I.push("NOT("+I.pop()+")");break;case 20:case 21:J=I.pop(),re=I.pop(),I.push(["AND","OR"][ie-20]+"("+re+","+J+")");break;default:if(ie<32&&b[ie])J=I.pop(),re=I.pop(),I.push(re+b[ie]+J);else if(y[ie]){if(U=y[ie][1],U==69&&(U=C[C.l++]),U>I.length){console.error("WK1 bad formula parse 0x"+ie.toString(16)+":|"+I.join("|")+"|");return}var W=I.slice(-U);I.length-=U,I.push(y[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))}}I.length==1?A[1].f=""+I[0]:console.error("WK1 bad formula parse |"+I.join("|")+"|")}function j(C){var A=[{c:0,r:0},{t:"n",v:0},0];return A[0].r=C.read_shift(2),A[3]=C[C.l++],A[0].c=C[C.l++],A}function _(C,A){var I=j(C);return I[1].t="s",I[1].v=C.read_shift(A-4,"cstr"),I}function S(C,A,I,U){var Y=dt(6+U.length);Y.write_shift(2,C),Y.write_shift(1,I),Y.write_shift(1,A),Y.write_shift(1,39);for(var te=0;te<U.length;++te){var re=U.charCodeAt(te);Y.write_shift(1,re>=128?95:re)}return Y.write_shift(1,0),Y}function P(C,A){var I=j(C);I[1].v=C.read_shift(2);var U=I[1].v>>1;if(I[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 I[1].v=U,I}function T(C,A){var I=j(C),U=C.read_shift(4),Y=C.read_shift(4),te=C.read_shift(2);if(te==65535)return U===0&&Y===3221225472?(I[1].t="e",I[1].v=15):U===0&&Y===3489660928?(I[1].t="e",I[1].v=42):I[1].v=0,I;var re=te&32768;return te=(te&32767)-16446,I[1].v=(1-re*2)*(Y*Math.pow(2,te+32)+U*Math.pow(2,te)),I}function R(C,A,I,U){var Y=dt(14);if(Y.write_shift(2,C),Y.write_shift(1,I),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 te=0,re=0,J=0,ie=0;return U<0&&(te=1,U=-U),re=Math.log2(U)|0,U/=Math.pow(2,re-31),ie=U>>>0,ie&2147483648||(U/=2,++re,ie=U>>>0),U-=ie,ie|=2147483648,ie>>>=0,U*=Math.pow(2,32),J=U>>>0,Y.write_shift(4,J),Y.write_shift(4,ie),re+=16383+(te?32768:0),Y.write_shift(2,re),Y}function k(C,A){var I=T(C);return C.l+=A-14,I}function E(C,A){var I=j(C),U=C.read_shift(4);return I[1].v=U>>6,I}function q(C,A){var I=j(C),U=C.read_shift(8,"f");return I[1].v=U,I}function O(C,A){var I=q(C);return C.l+=A-10,I}function L(C,A){return C[C.l+A-1]==0?C.read_shift(A,"cstr"):""}function H(C,A){var I=C[C.l++];I>A-1&&(I=A-1);for(var U="";U.length<I;)U+=String.fromCharCode(C[C.l++]);return U}function V(C,A,I){if(!(!I.qpro||A<21)){var U=C.read_shift(1);C.l+=17,C.l+=1,C.l+=2;var Y=C.read_shift(A-21,"cstr");return[U,Y]}}function z(C,A){for(var I={},U=C.l+A;C.l<U;){var Y=C.read_shift(2);if(Y==14e3){for(I[Y]=[0,""],I[Y][0]=C.read_shift(2);C[C.l];)I[Y][1]+=String.fromCharCode(C[C.l]),C.l++;C.l++}}return I}function M(C,A){var I=dt(5+C.length);I.write_shift(2,14e3),I.write_shift(2,A);for(var U=0;U<C.length;++U){var Y=C.charCodeAt(U);I[I.l++]=Y>127?95:Y}return I[I.l++]=0,I}var B={0:{n:"BOF",f:Ka},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:x},15:{n:"LABEL",f:d},16:{n:"FORMULA",f:g},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:L},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:_},23:{n:"NUMBER17",f:T},24:{n:"NUMBER18",f:P},25:{n:"FORMULA19",f:k},26:{n:"FORMULA1A"},27:{n:"XFORMAT",f:z},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:E},38:{n:"??"},39:{n:"NUMBER27",f:q},40:{n:"FORMULA28",f:O},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:L},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:V},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 Gwt(e){var t={},r=e.match(Ao),n=0,a=!1;if(r)for(;n!=r.length;++n){var i=Mr(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=s7[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 Kwt=function(){var e=kj("t"),t=kj("rPr");function r(i){var o=i.match(e);if(!o)return{t:"s",v:""};var l={t:"s",v:Fn(o[1])},c=i.match(t);return c&&(l.s=Gwt(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})}}(),Xwt=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("")}}(),Ywt=/<(?:\w+:)?t[^>]*>([^<]*)<\/(?:\w+:)?t>/g,Zwt=/<(?:\w+:)?r>/,Jwt=/<(?:\w+:)?rPh.*?>([\s\S]*?)<\/(?:\w+:)?rPh>/g;function P7(e,t){var r=t?t.cellHTML:!0,n={};return e?(e.match(/^\s*<(?:\w+:)?t[^>]*>/)?(n.t=Fn(hs(e.slice(e.indexOf(">")+1).split(/<\/(?:\w+:)?t>/)[0]||"")),n.r=hs(e),r&&(n.h=h7(n.t))):e.match(Zwt)&&(n.r=hs(e),n.t=Fn(hs((e.replace(Jwt,"").match(Ywt)||[]).join("").replace(Ao,""))),r&&(n.h=Xwt(Kwt(n.r)))),n):{t:""}}var Qwt=/<(?:\w+:)?sst([^>]*)>([\s\S]*)<\/(?:\w+:)?sst>/,e2t=/<(?:\w+:)?(?:si|sstItem)>/g,t2t=/<\/(?:\w+:)?(?:si|sstItem)>/;function r2t(e,t){var r=[],n="";if(!e)return r;var a=e.match(Qwt);if(a){n=a[2].replace(e2t,"").split(t2t);for(var i=0;i!=n.length;++i){var o=P7(n[i].trim(),t);o!=null&&(r[r.length]=o)}a=Mr(a[1]),r.Count=a.count,r.Unique=a.uniqueCount}return r}var n2t=/^\s|\s$|[\t\n\r]/;function Gme(e,t){if(!t.bookSST)return"";var r=[$a];r[r.length]=$t("sst",null,{xmlns:ng[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(n2t)&&(i+=' xml:space="preserve"'),i+=">"+ls(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 s2t(e){return[e.read_shift(4),e.read_shift(4)]}function a2t(e,t){var r=[],n=!1;return Oh(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 i2t(e,t){return t||(t=dt(8)),t.write_shift(4,e.Count),t.write_shift(4,e.Unique),t}var o2t=g1t;function l2t(e){var t=jl();jt(t,159,i2t(e));for(var r=0;r<e.length;++r)jt(t,19,o2t(e[r]));return jt(t,160),t.end()}function Kme(e){if(typeof Pn<"u")return Pn.utils.encode(P0,e);for(var t=[],r=e.split(""),n=0;n<r.length;++n)t[n]=r[n].charCodeAt(0);return t}function oh(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 c2t(e){var t={};return t.id=e.read_shift(0,"lpp4"),t.R=oh(e,4),t.U=oh(e,4),t.W=oh(e,4),t}function u2t(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 d2t(e){var t=[];e.l+=4;for(var r=e.read_shift(4);r-- >0;)t.push(u2t(e));return t}function f2t(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 h2t(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=oh(e,4),t.U=oh(e,4),t.W=oh(e,4),t}function m2t(e){var t=h2t(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 Xme(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 Yme(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 p2t(e){var t=oh(e);switch(t.Minor){case 2:return[t.Minor,x2t(e)];case 3:return[t.Minor,g2t()];case 4:return[t.Minor,v2t(e)]}throw new Error("ECMA-376 Encrypted file unrecognized Version: "+t.Minor)}function x2t(e){var t=e.read_shift(4);if((t&63)!=36)throw new Error("EncryptionInfo mismatch");var r=e.read_shift(4),n=Xme(e,r),a=Yme(e,e.length-e.l);return{t:"Std",h:n,v:a}}function g2t(){throw new Error("File is password-protected: ECMA-376 Extensible")}function v2t(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(Ao,function(i){var o=Mr(i);switch(pf(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 y2t(e,t){var r={},n=r.EncryptionVersionInfo=oh(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=Xme(e,a),t-=a,r.EncryptionVerifier=Yme(e,t),r}function b2t(e){var t={},r=t.EncryptionVersionInfo=oh(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 O7(e){var t=0,r,n=Kme(e),a=n.length+1,i,o,l,c,u;for(r=vp(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 Zme=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=Kme(o),c=i(l),u=l.length,d=vp(16),f=0;f!=16;++f)d[f]=0;var m,h,x;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,x=15-l.length;x>0;)m=c>>8,d[u]=a(e[x],m),--u,--x,m=c&255,d[u]=a(l[u],m),--u,--x;return d}}(),w2t=function(e,t,r,n,a){a||(a=t),n||(n=Zme(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]},j2t=function(e){var t=0,r=Zme(e);return function(n){var a=w2t("",n,t,r);return t=a[1],a[0]}};function _2t(e,t,r,n){var a={key:Ka(e),verificationBytes:Ka(e)};return r.password&&(a.verifier=O7(r.password)),n.valid=a.verificationBytes===a.verifier,n.valid&&(n.insitu=j2t(r.password)),a}function N2t(e,t,r){var n=r||{};return n.Info=e.read_shift(2),e.l-=2,n.Info===1?n.Data=b2t(e):n.Data=y2t(e,t),n}function S2t(e,t,r){var n={Type:r.biff>=8?e.read_shift(2):0};return n.Type?N2t(e,t-2,n):_2t(e,r.biff>=8?t:t-2,r,n),n}var Jme=function(){function e(a,i){switch(i.type){case"base64":return t(uc(a),i);case"binary":return t(a,i);case"buffer":return t(pn&&Buffer.isBuffer(a)?a.toString("binary"):Bp(a),i);case"array":return t(D0(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,x,p=-1;x=m.exec(d);){switch(x[0]){case"\\cell":var g=d.slice(h,m.lastIndex-x[0].length);if(g[0]==" "&&(g=g.slice(1)),++p,g.length){var v={v:g,t:"s"};Array.isArray(l)?l[f][p]=v:l[Or({r:f,c:p})]=v}break}h=m.lastIndex}p>u.e.c&&(u.e.c=p)}),l["!ref"]=sn(u),l}function r(a,i){return zp(e(a,i),i)}function n(a){for(var i=["{\\rtf1\\ansi"],o=Nn(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=Or({r:u,c:d});l=c?(a[u]||[])[d]:a[f],!(!l||l.v==null&&(!l.f||l.F))&&(i.push(" "+(l.w||(af(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 k2t(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 Tj(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 C2t(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 E2t(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 Xk(e,t){if(t===0)return e;var r=C2t(k2t(e));return t<0?r[2]=r[2]*(1+t):r[2]=1-(1-r[2])*(1-t),Tj(E2t(r))}var Qme=6,A2t=15,T2t=1,wo=Qme;function Pj(e){return Math.floor((e+Math.round(128/wo)/256)*wo)}function Oj(e){return Math.floor((e-5)/wo*100+.5)/100}function Yk(e){return Math.round((e*wo+5)/wo*256)/256}function JP(e){return Yk(Oj(Pj(e)))}function D7(e){var t=Math.abs(e-JP(e)),r=wo;if(t>.005)for(wo=T2t;wo<A2t;++wo)Math.abs(e-JP(e))<=t&&(t=Math.abs(e-JP(e)),r=wo);wo=r}function yp(e){e.width?(e.wpx=Pj(e.width),e.wch=Oj(e.wpx),e.MDW=wo):e.wpx?(e.wch=Oj(e.wpx),e.width=Yk(e.wch),e.MDW=wo):typeof e.wch=="number"&&(e.width=Yk(e.wch),e.wpx=Pj(e.width),e.MDW=wo),e.customWidth&&delete e.customWidth}var P2t=96,epe=P2t;function Dj(e){return e*96/epe}function Zy(e){return e*epe/96}var O2t={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 D2t(e,t,r,n){t.Borders=[];var a={},i=!1;(e[0].match(Ao)||[]).forEach(function(o){var l=Mr(o);switch(pf(l[0])){case"<borders":case"<borders>":case"</borders>":break;case"<border":case"<border>":case"<border/>":a={},l.diagonalUp&&(a.diagonalUp=qs(l.diagonalUp)),l.diagonalDown&&(a.diagonalDown=qs(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 I2t(e,t,r,n){t.Fills=[];var a={},i=!1;(e[0].match(Ao)||[]).forEach(function(o){var l=Mr(o);switch(pf(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 R2t(e,t,r,n){t.Fonts=[];var a={},i=!1;(e[0].match(Ao)||[]).forEach(function(o){var l=Mr(o);switch(pf(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=hs(l.val));break;case"<name/>":case"</name>":break;case"<b":a.bold=l.val?qs(l.val):1;break;case"<b/>":a.bold=1;break;case"<i":a.italic=l.val?qs(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?qs(l.val):1;break;case"<strike/>":a.strike=1;break;case"<outline":a.outline=l.val?qs(l.val):1;break;case"<outline/>":a.outline=1;break;case"<shadow":a.shadow=l.val?qs(l.val):1;break;case"<shadow/>":a.shadow=1;break;case"<condense":a.condense=l.val?qs(l.val):1;break;case"<condense/>":a.condense=1;break;case"<extend":a.extend=l.val?qs(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=s7[parseInt(l.val,10)];break;case"<color":if(a.color||(a.color={}),l.auto&&(a.color.auto=qs(l.auto)),l.rgb)a.color.rgb=l.rgb.slice(-6);else if(l.indexed){a.color.index=parseInt(l.indexed,10);var c=r0[a.color.index];a.color.index==81&&(c=r0[1]),c||(c=r0[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=Xk(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 L2t(e,t,r){t.NumberFmt=[];for(var n=ka(Sr),a=0;a<n.length;++a)t.NumberFmt[n[a]]=Sr[n[a]];var i=e[0].match(Ao);if(i)for(a=0;a<i.length;++a){var o=Mr(i[a]);switch(pf(o[0])){case"<numFmts":case"</numFmts>":case"<numFmts/>":case"<numFmts>":break;case"<numFmt":{var l=Fn(hs(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}ef(l,c)}}break;case"</numFmt>":break;default:if(r.WTF)throw new Error("unrecognized "+o[0]+" in numFmts")}}}function F2t(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]=$t("numFmt",null,{numFmtId:n,formatCode:ls(e[n])}))}),t.length===1?"":(t[t.length]="</numFmts>",t[0]=$t("numFmts",null,{count:t.length-2}).replace("/>",">"),t.join(""))}var VS=["numFmtId","fillId","fontId","borderId","xfId"],HS=["applyAlignment","applyBorder","applyFill","applyFont","applyNumberFormat","applyProtection","pivotButton","quotePrefix"];function M2t(e,t,r){t.CellXf=[];var n,a=!1;(e[0].match(Ao)||[]).forEach(function(i){var o=Mr(i),l=0;switch(pf(o[0])){case"<cellXfs":case"<cellXfs>":case"<cellXfs/>":case"</cellXfs>":break;case"<xf":case"<xf/>":for(n=o,delete n[0],l=0;l<VS.length;++l)n[VS[l]]&&(n[VS[l]]=parseInt(n[VS[l]],10));for(l=0;l<HS.length;++l)n[HS[l]]&&(n[HS[l]]=qs(n[HS[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=qs(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 $2t(e){var t=[];return t[t.length]=$t("cellXfs",null),e.forEach(function(r){t[t.length]=$t("xf",null,r)}),t[t.length]="</cellXfs>",t.length===2?"":(t[0]=$t("cellXfs",null,{count:t.length-2}).replace("/>",">"),t.join(""))}var B2t=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))&&L2t(f,d,u),(f=l.match(a))&&R2t(f,d,c,u),(f=l.match(n))&&I2t(f,d,c,u),(f=l.match(i))&&D2t(f,d,c,u),(f=l.match(r))&&M2t(f,d,u),d}}();function tpe(e,t){var r=[$a,$t("styleSheet",null,{xmlns:ng[0],"xmlns:vt":vi.vt})],n;return e.SSF&&(n=F2t(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=$2t(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 z2t(e,t){var r=e.read_shift(2),n=So(e);return[r,n]}function q2t(e,t,r){r||(r=dt(6+4*t.length)),r.write_shift(2,e),Ii(t,r);var n=r.length>r.l?r.slice(0,r.l):r;return r.l==null&&(r.l=r.length),n}function U2t(e,t,r){var n={};n.sz=e.read_shift(2)/20;var a=N1t(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=_1t(e),e.read_shift(1)){case 1:n.scheme="major";break;case 2:n.scheme="minor";break}return n.name=So(e),n}function V2t(e,t){t||(t=dt(25+4*32)),t.write_shift(2,e.sz*20),S1t(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),Wk(e.color,t);var n=0;return n=2,t.write_shift(1,n),Ii(e.name,t),t.length>t.l?t.slice(0,t.l):t}var H2t=["none","solid","mediumGray","darkGray","lightGray","darkHorizontal","darkVertical","darkDown","darkUp","darkGrid","darkTrellis","lightHorizontal","lightVertical","lightDown","lightUp","lightGrid","lightTrellis","gray125","gray0625"],QP,W2t=Co;function rY(e,t){t||(t=dt(4*3+8*7+16*1)),QP||(QP=SA(H2t));var r=QP[e.patternType];r==null&&(r=40),t.write_shift(4,r);var n=0;if(r!=40)for(Wk({auto:1},t),Wk({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 G2t(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 rpe(e,t,r){r||(r=dt(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 Yb(e,t){return t||(t=dt(10)),t.write_shift(1,0),t.write_shift(1,0),t.write_shift(4,0),t.write_shift(4,0),t}var K2t=Co;function X2t(e,t){return t||(t=dt(51)),t.write_shift(1,0),Yb(null,t),Yb(null,t),Yb(null,t),Yb(null,t),Yb(null,t),t.length>t.l?t.slice(0,t.l):t}function Y2t(e,t){return t||(t=dt(12+4*10)),t.write_shift(4,e.xfId),t.write_shift(2,1),t.write_shift(1,0),t.write_shift(1,0),Hk(e.name||"",t),t.length>t.l?t.slice(0,t.l):t}function Z2t(e,t,r){var n=dt(2052);return n.write_shift(4,e),Hk(t,n),Hk(r,n),n.length>n.l?n.slice(0,n.l):n}function J2t(e,t,r){var n={};n.NumberFmt=[];for(var a in Sr)n.NumberFmt[a]=Sr[a];n.CellXf=[],n.Fonts=[];var i=[],o=!1;return Oh(e,function(c,u,d){switch(d){case 44:n.NumberFmt[c[0]]=c[1],ef(c[1],c[0]);break;case 43:n.Fonts.push(c),c.color.theme!=null&&t&&t.themeElements&&t.themeElements.clrScheme&&(c.color.rgb=Xk(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 Q2t(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&&(jt(e,615,Zu(r)),[[5,8],[23,26],[41,44],[50,392]].forEach(function(n){for(var a=n[0];a<=n[1];++a)t[a]!=null&&jt(e,44,q2t(a,t[a]))}),jt(e,616))}}function ejt(e){var t=1;jt(e,611,Zu(t)),jt(e,43,V2t({sz:12,color:{theme:1},name:"Calibri",family:2})),jt(e,612)}function tjt(e){var t=2;jt(e,603,Zu(t)),jt(e,45,rY({patternType:"none"})),jt(e,45,rY({patternType:"gray125"})),jt(e,604)}function rjt(e){var t=1;jt(e,613,Zu(t)),jt(e,46,X2t()),jt(e,614)}function njt(e){var t=1;jt(e,626,Zu(t)),jt(e,47,rpe({numFmtId:0},65535)),jt(e,627)}function sjt(e,t){jt(e,617,Zu(t.length)),t.forEach(function(r){jt(e,47,rpe(r,0))}),jt(e,618)}function ajt(e){var t=1;jt(e,619,Zu(t)),jt(e,48,Y2t({xfId:0,name:"Normal"})),jt(e,620)}function ijt(e){var t=0;jt(e,505,Zu(t)),jt(e,506)}function ojt(e){var t=0;jt(e,508,Z2t(t,"TableStyleMedium9","PivotStyleMedium4")),jt(e,509)}function ljt(e,t){var r=jl();return jt(r,278),Q2t(r,e.SSF),ejt(r),tjt(r),rjt(r),njt(r),sjt(r,t.cellXfs),ajt(r),ijt(r),ojt(r),jt(r,279),r.end()}var cjt=["</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 ujt(e,t,r){t.themeElements.clrScheme=[];var n={};(e[0].match(Ao)||[]).forEach(function(a){var i=Mr(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[cjt.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 djt(){}function fjt(){}var hjt=/<a:clrScheme([^>]*)>[\s\S]*<\/a:clrScheme>/,mjt=/<a:fontScheme([^>]*)>[\s\S]*<\/a:fontScheme>/,pjt=/<a:fmtScheme([^>]*)>[\s\S]*<\/a:fmtScheme>/;function xjt(e,t,r){t.themeElements={};var n;[["clrScheme",hjt,ujt],["fontScheme",mjt,djt],["fmtScheme",pjt,fjt]].forEach(function(a){if(!(n=e.match(a[1])))throw new Error(a[0]+" not found in themeElements");a[2](n,t,r)})}var gjt=/<a:themeElements([^>]*)>[\s\S]*<\/a:themeElements>/;function npe(e,t){(!e||e.length===0)&&(e=I7());var r,n={};if(!(r=e.match(gjt)))throw new Error("themeElements not found in theme");return xjt(r[0],n,t),n.raw=e,n}function I7(e,t){if(t&&t.themeXLSX)return t.themeXLSX;if(e&&typeof e.raw=="string")return e.raw;var r=[$a];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 vjt(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=Qhe(i,{type:"array"})}catch{return}var l=Zl(o,"theme/theme/theme1.xml",!0);if(l)return npe(l,r)}}function yjt(e){return e.read_shift(4)}function bjt(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=wjt(e,4);break;case 2:t.xclrValue=Lme(e);break;case 3:t.xclrValue=yjt(e);break;case 4:e.l+=4;break}return e.l+=8,t}function wjt(e,t){return Co(e,t)}function jjt(e,t){return Co(e,t)}function _jt(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]=bjt(e);break;case 6:n[1]=jjt(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 Njt(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(_jt(e,r-e.l));return{ixfe:n,ext:i}}function Sjt(e,t){t.forEach(function(r){switch(r[0]){}})}function kjt(e,t){return{flags:e.read_shift(4),version:e.read_shift(4),name:So(e)}}function Cjt(e){var t=dt(12+2*e.name.length);return t.write_shift(4,e.flags),t.write_shift(4,e.version),Ii(e.name,t),t.slice(0,t.l)}function Ejt(e){for(var t=[],r=e.read_shift(4);r-- >0;)t.push([e.read_shift(4),e.read_shift(4)]);return t}function Ajt(e){var t=dt(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 Tjt(e,t){var r=dt(8+2*t.length);return r.write_shift(4,e),Ii(t,r),r.slice(0,r.l)}function Pjt(e){return e.l+=4,e.read_shift(4)!=0}function Ojt(e,t){var r=dt(8);return r.write_shift(4,e),r.write_shift(4,1),r}function Djt(e,t,r){var n={Types:[],Cell:[],Value:[]},a=r||{},i=[],o=!1,l=2;return Oh(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 Ijt(){var e=jl();return jt(e,332),jt(e,334,Zu(1)),jt(e,335,Cjt({name:"XLDAPR",version:12e4,flags:3496657072})),jt(e,336),jt(e,339,Tjt(1,"XLDAPR")),jt(e,52),jt(e,35,Zu(514)),jt(e,4096,Zu(0)),jt(e,4097,Pc(1)),jt(e,36),jt(e,53),jt(e,340),jt(e,337,Ojt(1)),jt(e,51,Ajt([[1,0]])),jt(e,338),jt(e,333),e.end()}function Rjt(e,t,r){var n={Types:[],Cell:[],Value:[]};if(!e)return n;var a=!1,i=2,o;return e.replace(Ao,function(l){var c=Mr(l);switch(pf(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 spe(){var e=[$a];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 Ljt(e){var t=[];if(!e)return t;var r=1;return(e.match(Ao)||[]).forEach(function(n){var a=Mr(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 Fjt(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=Or(r);var n=e.read_shift(1);return n&2&&(t.l="1"),n&8&&(t.a="1"),t}function Mjt(e,t,r){var n=[];return Oh(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 $jt(e,t,r,n){if(!e)return e;var a=n||{},i=!1;Oh(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 Bjt(e,t){if(!e)return"??";var r=(e.match(/<c:chart [^>]*r:id="([^"]*)"/)||["",""])[1];return t["!id"][r].Target}var yv=1024;function ape(e,t){for(var r=[21600,21600],n=["m0,0l0",r[1],r[0],r[1],r[0],"0xe"].join(","),a=[$t("xml",null,{"xmlns:v":Wl.v,"xmlns:o":Wl.o,"xmlns:x":Wl.x,"xmlns:mv":Wl.mv}).replace(/\/>/,">"),$t("o:shapelayout",$t("o:idmap",null,{"v:ext":"edit",data:e}),{"v:ext":"edit"}),$t("v:shapetype",[$t("v:stroke",null,{joinstyle:"miter"}),$t("v:path",null,{gradientshapeok:"t","o:connecttype":"rect"})].join(""),{id:"_x0000_t202","o:spt":202,coordsize:r.join(","),path:n})];yv<e*1e3;)yv+=1e3;return t.forEach(function(i){var o=ia(i[0]),l={color2:"#BEFF82",type:"gradient"};l.type=="gradient"&&(l.angle="-180");var c=l.type=="gradient"?$t("o:fill",null,{type:"gradientUnscaled","v:ext":"view"}):null,u=$t("v:fill",c,l),d={on:"t",obscured:"t"};++yv,a=a.concat(["<v:shape"+Cj({id:"_x0000_s"+yv,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,$t("v:shadow",null,d),$t("v:path",null,{"o:connecttype":"none"}),'<v:textbox><div style="text-align:left"></div></v:textbox>','<x:ClientData ObjectType="Note">',"<x:MoveWithCells/>","<x:SizeWithCells/>",Qi("x:Anchor",[o.c+1,0,o.r+1,0,o.c+3,20,o.r+5,20].join(",")),Qi("x:AutoFill","False"),Qi("x:Row",String(o.r)),Qi("x:Column",String(o.c)),i[1].hidden?"":"<x:Visible/>","</x:ClientData>","</v:shape>"])}),a.push("</xml>"),a.join("")}function nY(e,t,r,n){var a=Array.isArray(e),i;t.forEach(function(o){var l=ia(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=Nn(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=sn(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 zjt(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=Mr(l[0]),u={author:c.authorId&&r[c.authorId]||"sheetjsghost",ref:c.ref,guid:c.guid},d=ia(c.ref);if(!(t.sheetRows&&t.sheetRows<=d.r)){var f=o.match(/<(?:\w+:)?text>([\s\S]*)<\/(?:\w+:)?text>/),m=!!f&&!!f[1]&&P7(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 ipe(e){var t=[$a,$t("comments",null,{xmlns:ng[0]})],r=[];return t.push("<authors>"),e.forEach(function(n){n[1].forEach(function(a){var i=ls(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(ls(c.a))),i.push(c.t||"")}),t.push('<comment ref="'+n[0]+'" authorId="'+a+'"><text>'),i.length<=1)t.push(Qi("t",ls(i[0]||"")));else{for(var o=`Comment:
`+i[0]+`
`,l=1;l<i.length;++l)o+=`Reply:
`+i[l]+`
`;t.push(Qi("t",ls(o)))}t.push("</text></comment>")}),t.push("</commentList>"),t.length>2&&(t[t.length]="</comments>",t[1]=t[1].replace("/>",">")),t.join("")}function qjt(e,t){var r=[],n=!1,a={},i=0;return e.replace(Ao,function(l,c){var u=Mr(l);switch(pf(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 Ujt(e,t,r){var n=[$a,$t("ThreadedComments",null,{xmlns:vi.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($t("threadedComment",Qi("text",o.t||""),c))})}),n.push("</ThreadedComments>"),n.join("")}function Vjt(e,t){var r=[],n=!1;return e.replace(Ao,function(i){var o=Mr(i);switch(pf(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 Hjt(e){var t=[$a,$t("personList",null,{xmlns:vi.TCMNT,"xmlns:x":ng[0]}).replace(/[\/]>/,">")];return e.forEach(function(r,n){t.push($t("person",null,{displayName:r,id:"{54EE7950-7262-4200-6969-"+("000000000000"+n).slice(-12)+"}",userId:r,providerId:"None"}))}),t.push("</personList>"),t.join("")}function Wjt(e){var t={};t.iauthor=e.read_shift(4);var r=og(e);return t.rfx=r.s,t.ref=Or(r.s),e.l+=16,t}function Gjt(e,t){return t==null&&(t=dt(36)),t.write_shift(4,e[1].iauthor),W1(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 Kjt=So;function Xjt(e){return Ii(e.slice(0,54))}function Yjt(e,t){var r=[],n=[],a={},i=!1;return Oh(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 Zjt(e){var t=jl(),r=[];return jt(t,628),jt(t,630),e.forEach(function(n){n[1].forEach(function(a){r.indexOf(a.a)>-1||(r.push(a.a.slice(0,54)),jt(t,632,Xjt(a.a)))})}),jt(t,631),jt(t,633),e.forEach(function(n){n[1].forEach(function(a){a.iauthor=r.indexOf(a.a);var i={s:ia(n[0]),e:ia(n[0])};jt(t,635,Gjt([i,a])),a.t&&a.t.length>0&&jt(t,637,y1t(a)),jt(t,636),delete a.iauthor})}),jt(t,634),jt(t,629),t.end()}var Jjt="application/vnd.ms-office.vbaProject";function Qjt(e){var t=jr.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*/,"");jr.utils.cfb_add(t,a,e.FileIndex[n].content)}}),jr.write(t)}function e_t(e,t){t.FullPaths.forEach(function(r,n){if(n!=0){var a=r.replace(/[^\/]*[\/]/,"/_VBA_PROJECT_CUR/");a.slice(-1)!=="/"&&jr.utils.cfb_add(e,a,t.FileIndex[n].content)}})}var ope=["xlsb","xlsm","xlam","biff8","xla"];function t_t(){return{"!type":"dialog"}}function r_t(){return{"!type":"dialog"}}function n_t(){return{"!type":"macro"}}function s_t(){return{"!type":"macro"}}var Uv=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?"":"$")+Ws(d)+(c?"":"$")+wa(u)}return function(a,i){return t=i,a.replace(e,r)}}(),R7=/(^|[^._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,L7=function(){return function(t,r){return t.replace(R7,function(n,a,i,o,l,c){var u=j7(o)-(i?0:r.c),d=w7(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 lpe(e,t){return e.replace(R7,function(r,n,a,i,o,l){return n+(a=="$"?a+i:Ws(j7(i)+t.c))+(o=="$"?o+l:wa(w7(l)+t.r))})}function a_t(e,t,r){var n=Qo(t),a=n.s,i=ia(r),o={r:i.r-a.r,c:i.c-a.c};return lpe(e,o)}function i_t(e){return e.length!=1}function sY(e){return e.replace(/_xlfn\./g,"")}function Va(e){e.l+=1}function bp(e,t){var r=e.read_shift(2);return[r&16383,r>>14&1,r>>15&1]}function cpe(e,t,r){var n=2;if(r){if(r.biff>=2&&r.biff<=5)return upe(e);r.biff==12&&(n=4)}var a=e.read_shift(n),i=e.read_shift(n),o=bp(e),l=bp(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 upe(e){var t=bp(e),r=bp(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 o_t(e,t,r){if(r.biff<8)return upe(e);var n=e.read_shift(r.biff==12?4:2),a=e.read_shift(r.biff==12?4:2),i=bp(e),o=bp(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 dpe(e,t,r){if(r&&r.biff>=2&&r.biff<=5)return l_t(e);var n=e.read_shift(r&&r.biff==12?4:2),a=bp(e);return{r:n,c:a[0],cRel:a[1],rRel:a[2]}}function l_t(e){var t=bp(e),r=e.read_shift(1);return{r:t[0],c:r,cRel:t[1],rRel:t[2]}}function c_t(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 u_t(e,t,r){var n=r&&r.biff?r.biff:8;if(n>=2&&n<=5)return d_t(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 d_t(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 f_t(e,t,r){var n=(e[e.l++]&96)>>5,a=cpe(e,r.biff>=2&&r.biff<=5?6:8,r);return[n,a]}function h_t(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=cpe(e,i,r);return[n,a,o]}function m_t(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 p_t(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 x_t(e,t,r){var n=(e[e.l++]&96)>>5,a=o_t(e,t-1,r);return[n,a]}function g_t(e,t,r){var n=(e[e.l++]&96)>>5;return e.l+=r.biff==2?6:r.biff==12?14:7,[n]}function aY(e){var t=e[e.l+1]&1,r=1;return e.l+=4,[t,r]}function v_t(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 y_t(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 b_t(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 w_t(e){var t=e[e.l+1]&255?1:0;return e.l+=2,[t,e.read_shift(2)]}function j_t(e,t,r){var n=e[e.l+1]&255?1:0;return e.l+=r&&r.biff==2?3:4,[n]}function fpe(e){var t=e.read_shift(1),r=e.read_shift(1);return[t,r]}function __t(e){return e.read_shift(2),fpe(e)}function N_t(e){return e.read_shift(2),fpe(e)}function S_t(e,t,r){var n=(e[e.l]&96)>>5;e.l+=1;var a=dpe(e,0,r);return[n,a]}function k_t(e,t,r){var n=(e[e.l]&96)>>5;e.l+=1;var a=u_t(e,0,r);return[n,a]}function C_t(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=dpe(e,0,r);return[n,a,i]}function E_t(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[PNt[a],ppe[a],n]}function A_t(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)]:T_t(e);return[a,(i[0]===0?ppe:TNt)[i[1]]]}function T_t(e){return[e[e.l+1]>>7,e.read_shift(2)&32767]}function P_t(e,t,r){e.l+=r&&r.biff==2?3:4}function O_t(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 D_t(e){return e.l++,Dh[e.read_shift(1)]}function I_t(e){return e.l++,e.read_shift(2)}function R_t(e){return e.l++,e.read_shift(1)!==0}function L_t(e){return e.l++,jo(e)}function F_t(e,t,r){return e.l++,I_(e,t-1,r)}function M_t(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]=Oa(e,1)?"TRUE":"FALSE",t!=12&&(e.l+=7);break;case 37:case 16:r[1]=Dh[e[e.l]],e.l+=t==12?4:8;break;case 0:e.l+=8;break;case 1:r[1]=jo(e);break;case 2:r[1]=lg(e,0,{biff:t>0&&t<8?2:t});break;default:throw new Error("Bad SerAr: "+r[0])}return r}function $_t(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?og:AA)(e));return a}function B_t(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]=M_t(e,r.biff);return o}function z_t(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 q_t(e,t,r){if(r.biff==5)return U_t(e);var n=e.read_shift(1)>>>5&3,a=e.read_shift(2),i=e.read_shift(4);return[n,a,i]}function U_t(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 V_t(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 H_t(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 W_t(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 G_t(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 K_t=Co,X_t=Co,Y_t=Co;function L_(e,t,r){return e.l+=2,[c_t(e)]}function F7(e){return e.l+=6,[]}var Z_t=L_,J_t=F7,Q_t=F7,eNt=L_;function hpe(e){return e.l+=2,[Ka(e),e.read_shift(2)&1]}var tNt=L_,rNt=hpe,nNt=F7,sNt=L_,aNt=L_,iNt=["Data","All","Headers","??","?Data2","??","?DataHeaders","??","Totals","??","??","??","?DataTotals","??","??","??","?Current"];function oNt(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=iNt[r>>2&31];return{ixti:t,coltype:r&3,rt:o,idx:n,c:a,C:i}}function lNt(e){return e.l+=2,[e.read_shift(4)]}function cNt(e,t,r){return e.l+=5,e.l+=2,e.l+=r.biff==2?1:4,["PTGSHEET"]}function uNt(e,t,r){return e.l+=r.biff==2?4:5,["PTGENDSHEET"]}function dNt(e){var t=e.read_shift(1)>>>5&3,r=e.read_shift(2);return[t,r]}function fNt(e){var t=e.read_shift(1)>>>5&3,r=e.read_shift(2);return[t,r]}function hNt(e){return e.l+=4,[0,0]}var iY={1:{n:"PtgExp",f:O_t},2:{n:"PtgTbl",f:Y_t},3:{n:"PtgAdd",f:Va},4:{n:"PtgSub",f:Va},5:{n:"PtgMul",f:Va},6:{n:"PtgDiv",f:Va},7:{n:"PtgPower",f:Va},8:{n:"PtgConcat",f:Va},9:{n:"PtgLt",f:Va},10:{n:"PtgLe",f:Va},11:{n:"PtgEq",f:Va},12:{n:"PtgGe",f:Va},13:{n:"PtgGt",f:Va},14:{n:"PtgNe",f:Va},15:{n:"PtgIsect",f:Va},16:{n:"PtgUnion",f:Va},17:{n:"PtgRange",f:Va},18:{n:"PtgUplus",f:Va},19:{n:"PtgUminus",f:Va},20:{n:"PtgPercent",f:Va},21:{n:"PtgParen",f:Va},22:{n:"PtgMissArg",f:Va},23:{n:"PtgStr",f:F_t},26:{n:"PtgSheet",f:cNt},27:{n:"PtgEndSheet",f:uNt},28:{n:"PtgErr",f:D_t},29:{n:"PtgBool",f:R_t},30:{n:"PtgInt",f:I_t},31:{n:"PtgNum",f:L_t},32:{n:"PtgArray",f:g_t},33:{n:"PtgFunc",f:E_t},34:{n:"PtgFuncVar",f:A_t},35:{n:"PtgName",f:z_t},36:{n:"PtgRef",f:S_t},37:{n:"PtgArea",f:f_t},38:{n:"PtgMemArea",f:V_t},39:{n:"PtgMemErr",f:K_t},40:{n:"PtgMemNoMem",f:X_t},41:{n:"PtgMemFunc",f:H_t},42:{n:"PtgRefErr",f:W_t},43:{n:"PtgAreaErr",f:m_t},44:{n:"PtgRefN",f:k_t},45:{n:"PtgAreaN",f:x_t},46:{n:"PtgMemAreaN",f:dNt},47:{n:"PtgMemNoMemN",f:fNt},57:{n:"PtgNameX",f:q_t},58:{n:"PtgRef3d",f:C_t},59:{n:"PtgArea3d",f:h_t},60:{n:"PtgRefErr3d",f:G_t},61:{n:"PtgAreaErr3d",f:p_t},255:{}},mNt={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},pNt={1:{n:"PtgElfLel",f:hpe},2:{n:"PtgElfRw",f:sNt},3:{n:"PtgElfCol",f:Z_t},6:{n:"PtgElfRwV",f:aNt},7:{n:"PtgElfColV",f:eNt},10:{n:"PtgElfRadical",f:tNt},11:{n:"PtgElfRadicalS",f:nNt},13:{n:"PtgElfColS",f:J_t},15:{n:"PtgElfColSV",f:Q_t},16:{n:"PtgElfRadicalLel",f:rNt},25:{n:"PtgList",f:oNt},29:{n:"PtgSxName",f:lNt},255:{}},xNt={0:{n:"PtgAttrNoop",f:hNt},1:{n:"PtgAttrSemi",f:j_t},2:{n:"PtgAttrIf",f:b_t},4:{n:"PtgAttrChoose",f:v_t},8:{n:"PtgAttrGoto",f:y_t},16:{n:"PtgAttrSum",f:P_t},32:{n:"PtgAttrBaxcel",f:aY},33:{n:"PtgAttrBaxcel",f:aY},64:{n:"PtgAttrSpace",f:__t},65:{n:"PtgAttrSpaceSemi",f:N_t},128:{n:"PtgAttrIfError",f:w_t},255:{}};function F_(e,t,r,n){if(n.biff<8)return Co(e,t);for(var a=e.l+t,i=[],o=0;o!==r.length;++o)switch(r[o][0]){case"PtgArray":r[o][1]=B_t(e,0,n),i.push(r[o][1]);break;case"PtgMemArea":r[o][2]=$_t(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(Co(e,t)),i}function M_(e,t,r){for(var n=e.l+t,a,i,o=[];n!=e.l;)t=n-e.l,i=e[e.l],a=iY[i]||iY[mNt[i]],(i===24||i===25)&&(a=(i===24?pNt:xNt)[e[e.l+1]]),!a||!a.f?Co(e,t):o.push([a.n,a.f(e,t,r)]);return o}function gNt(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 vNt={PtgAdd:"+",PtgConcat:"&",PtgDiv:"/",PtgEq:"=",PtgGe:">=",PtgGt:">",PtgLe:"<=",PtgLt:"<",PtgMul:"*",PtgNe:"<>",PtgPower:"^",PtgSub:"-"};function yNt(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 mpe(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 oY(e,t,r){var n=mpe(e,t,r);return n=="#REF"?n:yNt(n,r)}function vo(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,x="";if(!e[0]||!e[0][0])return"";for(var p=-1,g="",v=0,y=e[0].length;v<y;++v){var b=e[0][v];switch(b[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:g=va(" ",e[0][p][1][1]);break;case 1:g=va("\r",e[0][p][1][1]);break;default:if(g="",a.WTF)throw new Error("Unexpected PtgAttrSpaceType "+e[0][p][1][0])}u=u+g,p=-1}l.push(u+vNt[b[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=Gw(b[1][1],o,a),l.push(Kw(d,i));break;case"PtgRefN":d=r?Gw(b[1][1],r,a):b[1][1],l.push(Kw(d,i));break;case"PtgRef3d":f=b[1][1],d=Gw(b[1][2],o,a),x=oY(n,f,a),l.push(x+"!"+Kw(d,i));break;case"PtgFunc":case"PtgFuncVar":var N=b[1][0],j=b[1][1];N||(N=0),N&=127;var _=N==0?[]:l.slice(-N);l.length-=N,j==="User"&&(j=_.shift()),l.push(j+"("+_.join(",")+")");break;case"PtgBool":l.push(b[1]?"TRUE":"FALSE");break;case"PtgInt":l.push(b[1]);break;case"PtgNum":l.push(String(b[1]));break;case"PtgStr":l.push('"'+b[1].replace(/"/g,'""')+'"');break;case"PtgErr":l.push(b[1]);break;case"PtgAreaN":h=LX(b[1][1],r?{s:r}:o,a),l.push(XP(h,a));break;case"PtgArea":h=LX(b[1][1],o,a),l.push(XP(h,a));break;case"PtgArea3d":f=b[1][1],h=b[1][2],x=oY(n,f,a),l.push(x+"!"+XP(h,a));break;case"PtgAttrSum":l.push("SUM("+l.pop()+")");break;case"PtgAttrBaxcel":case"PtgAttrSemi":break;case"PtgName":m=b[1][2];var S=(n.names||[])[m-1]||(n[0]||[])[m],P=S?S.Name:"SH33TJSNAME"+String(m);P&&P.slice(0,6)=="_xlfn."&&!a.xlfn&&(P=P.slice(6)),l.push(P);break;case"PtgNameX":var T=b[1][1];m=b[1][2];var R;if(a.biff<=5)T<0&&(T=-T),n[T]&&(R=n[T][m]);else{var k="";if(((n[T]||[])[0]||[])[0]==14849||(((n[T]||[])[0]||[])[0]==1025?n[T][m]&&n[T][m].itab>0&&(k=n.SheetNames[n[T][m].itab-1]+"!"):k=n.SheetNames[m-1]+"!"),n[T]&&n[T][m])k+=n[T][m].Name;else if(n[0]&&n[0][m])k+=n[0][m].Name;else{var E=(mpe(n,T,a)||"").split(";;");E[m-1]?k=E[m-1]:k+="SH33TJSERRX"}l.push(k);break}R||(R={Name:"SH33TJSERRY"}),l.push(R.Name);break;case"PtgParen":var q="(",O=")";if(p>=0){switch(g="",e[0][p][1][0]){case 2:q=va(" ",e[0][p][1][1])+q;break;case 3:q=va("\r",e[0][p][1][1])+q;break;case 4:O=va(" ",e[0][p][1][1])+O;break;case 5:O=va("\r",e[0][p][1][1])+O;break;default:if(a.WTF)throw new Error("Unexpected PtgAttrSpaceType "+e[0][p][1][0])}p=-1}l.push(q+l.pop()+O);break;case"PtgRefErr":l.push("#REF!");break;case"PtgRefErr3d":l.push("#REF!");break;case"PtgExp":d={c:b[1][1],r:b[1][0]};var L={c:r.c,r:r.r};if(n.sharedf[Or(d)]){var H=n.sharedf[Or(d)];l.push(vo(H,o,L,n,a))}else{var V=!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(vo(u[1],o,L,n,a)),V=!0;break}V||l.push(b[1])}break;case"PtgArray":l.push("{"+gNt(b[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"+b[1].idx+"[#"+b[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(b));default:throw new Error("Unrecognized Formula Token: "+String(b))}var z=["PtgAttrSpace","PtgAttrSpaceSemi","PtgAttrGoto"];if(a.biff!=3&&p>=0&&z.indexOf(e[0][v][0])==-1){b=e[0][p];var M=!0;switch(b[1][0]){case 4:M=!1;case 0:g=va(" ",b[1][1]);break;case 5:M=!1;case 1:g=va("\r",b[1][1]);break;default:if(g="",a.WTF)throw new Error("Unexpected PtgAttrSpaceType "+b[1][0])}l.push((M?g:"")+l.pop()+(M?"":g)),p=-1}}if(l.length>1&&a.WTF)throw new Error("bad formula stack");return l[0]}function bNt(e,t,r){var n=e.l+t,a=r.biff==2?1:2,i,o=e.read_shift(a);if(o==65535)return[[],Co(e,t-2)];var l=M_(e,o,r);return t!==o+a&&(i=F_(e,t-o-a,l,r)),e.l=n,[l,i]}function wNt(e,t,r){var n=e.l+t,a=r.biff==2?1:2,i,o=e.read_shift(a);if(o==65535)return[[],Co(e,t-2)];var l=M_(e,o,r);return t!==o+a&&(i=F_(e,t-o-a,l,r)),e.l=n,[l,i]}function jNt(e,t,r,n){var a=e.l+t,i=M_(e,n,r),o;return a!==e.l&&(o=F_(e,a-e.l,i,r)),[i,o]}function _Nt(e,t,r){var n=e.l+t,a,i=e.read_shift(2),o=M_(e,i,r);return i==65535?[[],Co(e,t-2)]:(t!==i+2&&(a=F_(e,n-i-2,o,r)),[o,a])}function NNt(e){var t;if(Qf(e,e.l+6)!==65535)return[jo(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 SNt(e){if(e==null){var t=dt(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 I0(e);return I0(0)}function eO(e,t,r){var n=e.l+t,a=xf(e);r.biff==2&&++e.l;var i=NNt(e),o=e.read_shift(1);r.biff!=2&&(e.read_shift(1),r.biff>=5&&e.read_shift(4));var l=wNt(e,n-e.l,r);return{cell:a,val:i[0],formula:l,shared:o>>3&1,tt:i[1]}}function kNt(e,t,r,n,a){var i=L0(t,r,a),o=SNt(e.v),l=dt(6),c=33;l.write_shift(2,c),l.write_shift(4,0);for(var u=dt(e.bf.length),d=0;d<e.bf.length;++d)u[d]=e.bf[d];var f=Di([i,o,l,u]);return f}function TA(e,t,r){var n=e.read_shift(4),a=M_(e,n,r),i=e.read_shift(4),o=i>0?F_(e,i,a,r):null;return[a,o]}var CNt=TA,PA=TA,ENt=TA,ANt=TA,TNt={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"},ppe={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"},PNt={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 lY(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 ONt(e){var t="of:="+e.replace(R7,"$1[.$2$3$4$5]").replace(/\]:\[/g,":");return t.replace(/;/g,"|").replace(/,/g,";")}function tO(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 DNt(e){return e.replace(/\./,"!")}var Yw={},Vv={},Zw=typeof Map<"u";function M7(e,t,r){var n=0,a=e.length;if(r){if(Zw?r.has(t):Object.prototype.hasOwnProperty.call(r,t)){for(var i=Zw?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&&(Zw?(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 OA(e,t){var r={min:e+1,max:e+1},n=-1;return t.MDW&&(wo=t.MDW),t.width!=null?r.customWidth=1:t.wpx!=null?n=Oj(t.wpx):t.wch!=null&&(n=t.wch),n>-1?(r.width=Yk(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 a0(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 qp(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){ef(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 xpe(e,t,r,n,a,i){try{n.cellNF&&(e.z=Sr[t])}catch(l){if(n.WTF)throw l}if(!(e.t==="z"&&!n.cellStyles)){if(e.t==="d"&&typeof e.v=="string"&&(e.v=Gs(e.v)),(!n||n.cellText!==!1)&&e.t!=="z")try{if(Sr[t]==null&&ef(Ayt[t]||"General",t),e.t==="e")e.w=e.w||Dh[e.v];else if(t===0)if(e.t==="n")(e.v|0)===e.v?e.w=e.v.toString(10):e.w=Sj(e.v);else if(e.t==="d"){var o=_i(e.v);(o|0)===o?e.w=o.toString(10):e.w=Sj(o)}else{if(e.v===void 0)return"";e.w=O0(e.v,Vv)}else e.t==="d"?e.w=dc(t,_i(e.v),Vv):e.w=dc(t,e.v,Vv)}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=Xk(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=Xk(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 INt(e,t,r){if(e&&e["!ref"]){var n=Nn(e["!ref"]);if(n.e.c<n.s.c||n.e.r<n.s.r)throw new Error("Bad range ("+r+"): "+e["!ref"])}}function RNt(e,t){var r=Nn(t);r.s.r<=r.e.r&&r.s.c<=r.e.c&&r.s.r>=0&&r.s.c>=0&&(e["!ref"]=sn(r))}var LNt=/<(?:\w:)?mergeCell ref="[A-Z0-9:]+"\s*[\/]?>/g,FNt=/<(?:\w+:)?sheetData[^>]*>([\s\S]*)<\/(?:\w+:)?sheetData>/,MNt=/<(?:\w:)?hyperlink [^>]*>/mg,$Nt=/"(\w*:\w*)"/,BNt=/<(?:\w:)?col\b[^>]*[\/]?>/g,zNt=/<(?:\w:)?autoFilter[^>]*([\/]|>([\s\S]*)<\/(?:\w:)?autoFilter)>/g,qNt=/<(?:\w:)?pageMargins[^>]*\/>/g,gpe=/<(?:\w:)?sheetPr\b(?:[^>a-z][^>]*)?\/>/,UNt=/<(?:\w:)?sheetPr[^>]*(?:[\/]|>([\s\S]*)<\/(?:\w:)?sheetPr)>/,VNt=/<(?:\w:)?sheetViews[^>]*(?:[\/]|>([\s\S]*)<\/(?:\w:)?sheetViews)>/;function HNt(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(FNt);f?(u=e.slice(0,f.index),d=e.slice(f.index+f[0].length)):u=d=e;var m=u.match(gpe);m?$7(m[0],l,a,r):(m=u.match(UNt))&&GNt(m[0],m[1]||"",l,a,r);var h=(u.match(/<(?:\w*:)?dimension/)||{index:-1}).index;if(h>0){var x=u.slice(h,h+50).match($Nt);x&&RNt(l,x[1])}var p=u.match(VNt);p&&p[1]&&iSt(p[1],a);var g=[];if(t.cellStyles){var v=u.match(BNt);v&&tSt(g,v)}f&&cSt(f[1],l,t,c,i,o);var y=d.match(zNt);y&&(l["!autofilter"]=nSt(y[0]));var b=[],N=d.match(LNt);if(N)for(h=0;h!=N.length;++h)b[h]=Nn(N[h].slice(N[h].indexOf('"')+1));var j=d.match(MNt);j&&JNt(l,j,n);var _=d.match(qNt);if(_&&(l["!margins"]=QNt(Mr(_[0]))),!l["!ref"]&&c.e.c>=c.s.c&&c.e.r>=c.s.r&&(l["!ref"]=sn(c)),t.sheetRows>0&&l["!ref"]){var S=Nn(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"]=sn(S))}return g.length>0&&(l["!cols"]=g),b.length>0&&(l["!merges"]=b),l}function WNt(e){if(e.length===0)return"";for(var t='<mergeCells count="'+e.length+'">',r=0;r!=e.length;++r)t+='<mergeCell ref="'+sn(e[r])+'"/>';return t+"</mergeCells>"}function $7(e,t,r,n){var a=Mr(e);r.Sheets[n]||(r.Sheets[n]={}),a.codeName&&(r.Sheets[n].CodeName=Fn(hs(a.codeName)))}function GNt(e,t,r,n,a){$7(e.slice(0,e.indexOf(">")),r,n,a)}function KNt(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=Wd(ls(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||"")+$t("outlinePr",null,u)}!i&&!l||(a[a.length]=$t("sheetPr",l,o))}var XNt=["objects","scenarios","selectLockedCells","selectUnlockedCells"],YNt=["formatColumns","formatRows","formatCells","insertColumns","insertRows","insertHyperlinks","deleteColumns","deleteRows","sort","autoFilter","pivotTables"];function ZNt(e){var t={sheet:1};return XNt.forEach(function(r){e[r]!=null&&e[r]&&(t[r]="1")}),YNt.forEach(function(r){e[r]!=null&&!e[r]&&(t[r]="0")}),e.password&&(t.password=O7(e.password).toString(16).toUpperCase()),$t("sheetProtection",null,t)}function JNt(e,t,r){for(var n=Array.isArray(e),a=0;a!=t.length;++a){var i=Mr(hs(t[a]),!0);if(!i.ref)return;var o=((r||{})["!id"]||[])[i.id];o?(i.Target=o.Target,i.location&&(i.Target+="#"+Fn(i.location))):(i.Target="#"+Fn(i.location),o={Target:i.Target,TargetMode:"Internal"}),i.Rel=o,i.tooltip&&(i.Tooltip=i.tooltip,delete i.tooltip);for(var l=Nn(i.ref),c=l.s.r;c<=l.e.r;++c)for(var u=l.s.c;u<=l.e.c;++u){var d=Or({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 QNt(e){var t={};return["left","right","top","bottom","header","footer"].forEach(function(r){e[r]&&(t[r]=parseFloat(e[r]))}),t}function eSt(e){return a0(e),$t("pageMargins",null,e)}function tSt(e,t){for(var r=!1,n=0;n!=t.length;++n){var a=Mr(t[n],!0);a.hidden&&(a.hidden=qs(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)),yp(a);i<=o;)e[i++]=js(a)}}function rSt(e,t){for(var r=["<cols>"],n,a=0;a!=t.length;++a)(n=t[a])&&(r[r.length]=$t("col",null,OA(a,n)));return r[r.length]="</cols>",r.join("")}function nSt(e){var t={ref:(e.match(/ref="([^"]*)"/)||[])[1]};return t}function sSt(e,t,r,n){var a=typeof e.ref=="string"?e.ref:sn(e.ref);r.Workbook||(r.Workbook={Sheets:[]}),r.Workbook.Names||(r.Workbook.Names=[]);var i=r.Workbook.Names,o=Qo(a);o.s.r==o.e.r&&(o.e.r=Qo(t["!ref"]).e.r,a=sn(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}),$t("autoFilter",null,{ref:a})}var aSt=/<(?:\w:)?sheetView(?:[^>a-z][^>]*)?\/?>/;function iSt(e,t){t.Views||(t.Views=[{}]),(e.match(aSt)||[]).forEach(function(r,n){var a=Mr(r);t.Views[n]||(t.Views[n]={}),+a.zoomScale&&(t.Views[n].zoom=+a.zoomScale),qs(a.rightToLeft)&&(t.Views[n].RTL=!0)})}function oSt(e,t,r,n){var a={workbookViewId:"0"};return(((n||{}).Workbook||{}).Views||[])[0]&&(a.rightToLeft=n.Workbook.Views[0].RTL?"1":"0"),$t("sheetViews",$t("sheetView",null,a),{})}function lSt(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=Dh[e.v];break;case"d":n&&n.cellDates?a=Gs(e.v,-1).toISOString():(e=js(e),e.t="n",a=""+(e.v=_i(Gs(e.v)))),typeof e.z>"u"&&(e.z=Sr[14]);break;default:a=e.v;break}var l=Qi("v",ls(a)),c={r:t},u=qp(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=Qi("v",""+M7(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=$t("f",ls(e.f),d)+(e.v!=null?l:"")}return e.l&&r["!links"].push([t,e.l]),e.D&&(c.cm=1),$t("c",l,c)}var cSt=function(){var e=/<(?:\w+:)?c[ \/>]/,t=/<\/(?:\w+:)?row>/,r=/r=["']([^"']*)["']/,n=/<(?:\w+:)?is>([\S\s]*?)<\/(?:\w+:)?is>/,a=/ref=["']([^"']*)["']/,i=kj("v"),o=kj("f");return function(c,u,d,f,m,h){for(var x=0,p="",g=[],v=[],y=0,b=0,N=0,j="",_,S,P=0,T=0,R,k,E=0,q=0,O=Array.isArray(h.CellXf),L,H=[],V=[],z=Array.isArray(u),M=[],B={},K=!1,C=!!d.sheetStubs,A=c.split(t),I=0,U=A.length;I!=U;++I){p=A[I].trim();var Y=p.length;if(Y!==0){var te=0;e:for(x=0;x<Y;++x)switch(p[x]){case">":if(p[x-1]!="/"){++x;break e}if(d&&d.cellStyles){if(S=Mr(p.slice(te,x),!0),P=S.r!=null?parseInt(S.r,10):P+1,T=-1,d.sheetRows&&d.sheetRows<P)continue;B={},K=!1,S.ht&&(K=!0,B.hpt=parseFloat(S.ht),B.hpx=Zy(B.hpt)),S.hidden=="1"&&(K=!0,B.hidden=!0),S.outlineLevel!=null&&(K=!0,B.level=+S.outlineLevel),K&&(M[P-1]=B)}break;case"<":te=x;break}if(te>=x)break;if(S=Mr(p.slice(te,x),!0),P=S.r!=null?parseInt(S.r,10):P+1,T=-1,!(d.sheetRows&&d.sheetRows<P)){f.s.r>P-1&&(f.s.r=P-1),f.e.r<P-1&&(f.e.r=P-1),d&&d.cellStyles&&(B={},K=!1,S.ht&&(K=!0,B.hpt=parseFloat(S.ht),B.hpx=Zy(B.hpt)),S.hidden=="1"&&(K=!0,B.hidden=!0),S.outlineLevel!=null&&(K=!0,B.level=+S.outlineLevel),K&&(M[P-1]=B)),g=p.slice(x).split(e);for(var re=0;re!=g.length&&g[re].trim().charAt(0)=="<";++re);for(g=g.slice(re),x=0;x!=g.length;++x)if(p=g[x].trim(),p.length!==0){if(v=p.match(r),y=x,b=0,N=0,p="<c "+(p.slice(0,1)=="<"?">":"")+p,v!=null&&v.length===2){for(y=0,j=v[1],b=0;b!=j.length&&!((N=j.charCodeAt(b)-64)<1||N>26);++b)y=26*y+N;--y,T=y}else++T;for(b=0;b!=p.length&&p.charCodeAt(b)!==62;++b);if(++b,S=Mr(p.slice(0,b),!0),S.r||(S.r=Or({r:P-1,c:T})),j=p.slice(b),_={t:""},(v=j.match(i))!=null&&v[1]!==""&&(_.v=Fn(v[1])),d.cellFormula){if((v=j.match(o))!=null&&v[1]!==""){if(_.f=Fn(hs(v[1])).replace(/\r\n/g,`
`),d.xlfn||(_.f=sY(_.f)),v[0].indexOf('t="array"')>-1)_.F=(j.match(a)||[])[1],_.F.indexOf(":")>-1&&H.push([Nn(_.F),_.F]);else if(v[0].indexOf('t="shared"')>-1){k=Mr(v[0]);var J=Fn(hs(v[1]));d.xlfn||(J=sY(J)),V[parseInt(k.si,10)]=[k,J,S.r]}}else(v=j.match(/<f[^>]*\/>/))&&(k=Mr(v[0]),V[k.si]&&(_.f=a_t(V[k.si][1],V[k.si][2],S.r)));var ie=ia(S.r);for(b=0;b<H.length;++b)ie.r>=H[b][0].s.r&&ie.r<=H[b][0].e.r&&ie.c>=H[b][0].s.c&&ie.c<=H[b][0].e.c&&(_.F=H[b][1])}if(S.t==null&&_.v===void 0)if(_.f||_.F)_.v=0,_.t="n";else if(C)_.t="z";else continue;else _.t=S.t||"n";switch(f.s.c>T&&(f.s.c=T),f.e.c<T&&(f.e.c=T),_.t){case"n":if(_.v==""||_.v==null){if(!C)continue;_.t="z"}else _.v=parseFloat(_.v);break;case"s":if(typeof _.v>"u"){if(!C)continue;_.t="z"}else R=Yw[parseInt(_.v,10)],_.v=R.t,_.r=R.r,d.cellHTML&&(_.h=R.h);break;case"str":_.t="s",_.v=_.v!=null?hs(_.v):"",d.cellHTML&&(_.h=h7(_.v));break;case"inlineStr":v=j.match(n),_.t="s",v!=null&&(R=P7(v[1]))?(_.v=R.t,d.cellHTML&&(_.h=R.h)):_.v="";break;case"b":_.v=qs(_.v);break;case"d":d.cellDates?_.v=Gs(_.v,1):(_.v=_i(Gs(_.v,1)),_.t="n");break;case"e":(!d||d.cellText!==!1)&&(_.w=_.v),_.v=yme[_.v];break}if(E=q=0,L=null,O&&S.s!==void 0&&(L=h.CellXf[S.s],L!=null&&(L.numFmtId!=null&&(E=L.numFmtId),d.cellStyles&&L.fillId!=null&&(q=L.fillId))),xpe(_,E,q,d,m,h),d.cellDates&&O&&_.t=="n"&&rg(Sr[E])&&(_.t="d",_.v=CA(_.v)),S.cm&&d.xlmeta){var be=(d.xlmeta.Cell||[])[+S.cm-1];be&&be.type=="XLDAPR"&&(_.D=!0)}if(z){var Q=ia(S.r);u[Q.r]||(u[Q.r]=[]),u[Q.r][Q.c]=_}else u[S.r]=_}}}}M.length>0&&(u["!rows"]=M)}}();function uSt(e,t,r,n){var a=[],i=[],o=Nn(e["!ref"]),l="",c,u="",d=[],f=0,m=0,h=e["!rows"],x=Array.isArray(e),p={r:u},g,v=-1;for(m=o.s.c;m<=o.e.c;++m)d[m]=Ws(m);for(f=o.s.r;f<=o.e.r;++f){for(i=[],u=wa(f),m=o.s.c;m<=o.e.c;++m){c=d[m]+u;var y=x?(e[f]||[])[m]:e[c];y!==void 0&&(l=lSt(y,c,e,t))!=null&&i.push(l)}(i.length>0||h&&h[f])&&(p={r:u},h&&h[f]&&(g=h[f],g.hidden&&(p.hidden=1),v=-1,g.hpx?v=Dj(g.hpx):g.hpt&&(v=g.hpt),v>-1&&(p.ht=v,p.customHeight=1),g.level&&(p.outlineLevel=g.level)),a[a.length]=$t("row",i.join(""),p))}if(h)for(;f<h.length;++f)h&&h[f]&&(p={r:f+1},g=h[f],g.hidden&&(p.hidden=1),v=-1,g.hpx?v=Dj(g.hpx):g.hpt&&(v=g.hpt),v>-1&&(p.ht=v,p.customHeight=1),g.level&&(p.outlineLevel=g.level),a[a.length]=$t("row","",p));return a.join("")}function vpe(e,t,r,n){var a=[$a,$t("worksheet",null,{xmlns:ng[0],"xmlns:r":vi.r})],i=r.SheetNames[e],o=0,l="",c=r.Sheets[i];c==null&&(c={});var u=c["!ref"]||"A1",d=Nn(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=sn(d)}n||(n={}),c["!comments"]=[];var f=[];KNt(c,r,e,t,a),a[a.length]=$t("dimension",null,{ref:u}),a[a.length]=oSt(c,t,e,r),t.sheetFormat&&(a[a.length]=$t("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]=rSt(c,c["!cols"])),a[o=a.length]="<sheetData/>",c["!links"]=[],c["!ref"]!=null&&(l=uSt(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]=ZNt(c["!protect"])),c["!autofilter"]!=null&&(a[a.length]=sSt(c["!autofilter"],c,r,e)),c["!merges"]!=null&&c["!merges"].length>0&&(a[a.length]=WNt(c["!merges"]));var m=-1,h,x=-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)!="#"&&(x=is(n,-1,ls(p[1].Target).replace(/#.*$/,""),xn.HLINK),h["r:id"]="rId"+x),(m=p[1].Target.indexOf("#"))>-1&&(h.location=ls(p[1].Target.slice(m+1))),p[1].Tooltip&&(h.tooltip=ls(p[1].Tooltip)),a[a.length]=$t("hyperlink",null,h))}),a[a.length]="</hyperlinks>"),delete c["!links"],c["!margins"]!=null&&(a[a.length]=eSt(c["!margins"])),(!t||t.ignoreEC||t.ignoreEC==null)&&(a[a.length]=Qi("ignoredErrors",$t("ignoredError",null,{numberStoredAsText:1,sqref:u}))),f.length>0&&(x=is(n,-1,"../drawings/drawing"+(e+1)+".xml",xn.DRAW),a[a.length]=$t("drawing",null,{"r:id":"rId"+x}),c["!drawing"]=f),c["!comments"].length>0&&(x=is(n,-1,"../drawings/vmlDrawing"+(e+1)+".vml",xn.VML),a[a.length]=$t("legacyDrawing",null,{"r:id":"rId"+x}),c["!legacy"]=x),a.length>1&&(a[a.length]="</worksheet>",a[1]=a[1].replace("/>",">")),a.join("")}function dSt(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 fSt(e,t,r){var n=dt(145),a=(r["!rows"]||[])[e]||{};n.write_shift(4,e),n.write_shift(4,0);var i=320;a.hpx?i=Dj(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 x=Array.isArray(r)?(r[u.r]||[])[u.c]:r[Or(u)];x&&(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 hSt(e,t,r,n){var a=fSt(n,r,t);(a.length>17||(t["!rows"]||[])[n])&&jt(e,0,a)}var mSt=og,pSt=W1;function xSt(){}function gSt(e,t){var r={},n=e[e.l];return++e.l,r.above=!(n&64),r.left=!(n&128),e.l+=18,r.name=b1t(e),r}function vSt(e,t,r){r==null&&(r=dt(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 Wk({auto:1},r),r.write_shift(-4,-1),r.write_shift(-4,-1),mme(e,r),r.slice(0,r.l)}function ySt(e){var t=mu(e);return[t]}function bSt(e,t,r){return r==null&&(r=dt(8)),sg(t,r)}function wSt(e){var t=ag(e);return[t]}function jSt(e,t,r){return r==null&&(r=dt(4)),ig(t,r)}function _St(e){var t=mu(e),r=e.read_shift(1);return[t,r,"b"]}function NSt(e,t,r){return r==null&&(r=dt(9)),sg(t,r),r.write_shift(1,e.v?1:0),r}function SSt(e){var t=ag(e),r=e.read_shift(1);return[t,r,"b"]}function kSt(e,t,r){return r==null&&(r=dt(5)),ig(t,r),r.write_shift(1,e.v?1:0),r}function CSt(e){var t=mu(e),r=e.read_shift(1);return[t,r,"e"]}function ESt(e,t,r){return r==null&&(r=dt(9)),sg(t,r),r.write_shift(1,e.v),r}function ASt(e){var t=ag(e),r=e.read_shift(1);return[t,r,"e"]}function TSt(e,t,r){return r==null&&(r=dt(8)),ig(t,r),r.write_shift(1,e.v),r.write_shift(2,0),r.write_shift(1,0),r}function PSt(e){var t=mu(e),r=e.read_shift(4);return[t,r,"s"]}function OSt(e,t,r){return r==null&&(r=dt(12)),sg(t,r),r.write_shift(4,t.v),r}function DSt(e){var t=ag(e),r=e.read_shift(4);return[t,r,"s"]}function ISt(e,t,r){return r==null&&(r=dt(8)),ig(t,r),r.write_shift(4,t.v),r}function RSt(e){var t=mu(e),r=jo(e);return[t,r,"n"]}function LSt(e,t,r){return r==null&&(r=dt(16)),sg(t,r),I0(e.v,r),r}function ype(e){var t=ag(e),r=jo(e);return[t,r,"n"]}function FSt(e,t,r){return r==null&&(r=dt(12)),ig(t,r),I0(e.v,r),r}function MSt(e){var t=mu(e),r=k7(e);return[t,r,"n"]}function $St(e,t,r){return r==null&&(r=dt(12)),sg(t,r),pme(e.v,r),r}function BSt(e){var t=ag(e),r=k7(e);return[t,r,"n"]}function zSt(e,t,r){return r==null&&(r=dt(8)),ig(t,r),pme(e.v,r),r}function qSt(e){var t=mu(e),r=_7(e);return[t,r,"is"]}function USt(e){var t=mu(e),r=So(e);return[t,r,"str"]}function VSt(e,t,r){return r==null&&(r=dt(12+4*e.v.length)),sg(t,r),Ii(e.v,r),r.length>r.l?r.slice(0,r.l):r}function HSt(e){var t=ag(e),r=So(e);return[t,r,"str"]}function WSt(e,t,r){return r==null&&(r=dt(8+4*e.v.length)),ig(t,r),Ii(e.v,r),r.length>r.l?r.slice(0,r.l):r}function GSt(e,t,r){var n=e.l+t,a=mu(e);a.r=r["!row"];var i=e.read_shift(1),o=[a,i,"b"];if(r.cellFormula){e.l+=2;var l=PA(e,n-e.l,r);o[3]=vo(l,null,a,r.supbooks,r)}else e.l=n;return o}function KSt(e,t,r){var n=e.l+t,a=mu(e);a.r=r["!row"];var i=e.read_shift(1),o=[a,i,"e"];if(r.cellFormula){e.l+=2;var l=PA(e,n-e.l,r);o[3]=vo(l,null,a,r.supbooks,r)}else e.l=n;return o}function XSt(e,t,r){var n=e.l+t,a=mu(e);a.r=r["!row"];var i=jo(e),o=[a,i,"n"];if(r.cellFormula){e.l+=2;var l=PA(e,n-e.l,r);o[3]=vo(l,null,a,r.supbooks,r)}else e.l=n;return o}function YSt(e,t,r){var n=e.l+t,a=mu(e);a.r=r["!row"];var i=So(e),o=[a,i,"str"];if(r.cellFormula){e.l+=2;var l=PA(e,n-e.l,r);o[3]=vo(l,null,a,r.supbooks,r)}else e.l=n;return o}var ZSt=og,JSt=W1;function QSt(e,t){return t==null&&(t=dt(4)),t.write_shift(4,e),t}function e5t(e,t){var r=e.l+t,n=og(e),a=N7(e),i=So(e),o=So(e),l=So(e);e.l=r;var c={rfx:n,relId:a,loc:i,display:l};return o&&(c.Tooltip=o),c}function t5t(e,t){var r=dt(50+4*(e[1].Target.length+(e[1].Tooltip||"").length));W1({s:ia(e[0]),e:ia(e[0])},r),S7("rId"+t,r);var n=e[1].Target.indexOf("#"),a=n==-1?"":e[1].Target.slice(n+1);return Ii(a||"",r),Ii(e[1].Tooltip||"",r),Ii("",r),r.slice(0,r.l)}function r5t(){}function n5t(e,t,r){var n=e.l+t,a=xme(e),i=e.read_shift(1),o=[a];if(o[2]=i,r.cellFormula){var l=CNt(e,n-e.l,r);o[1]=l}else e.l=n;return o}function s5t(e,t,r){var n=e.l+t,a=og(e),i=[a];if(r.cellFormula){var o=ANt(e,n-e.l,r);i[1]=o,e.l=n}else e.l=n;return i}function a5t(e,t,r){r==null&&(r=dt(18));var n=OA(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 bpe=["left","right","top","bottom","header","footer"];function i5t(e){var t={};return bpe.forEach(function(r){t[r]=jo(e)}),t}function o5t(e,t){return t==null&&(t=dt(6*8)),a0(e),bpe.forEach(function(r){I0(e[r],t)}),t}function l5t(e){var t=e.read_shift(2);return e.l+=28,{RTL:t&32}}function c5t(e,t,r){r==null&&(r=dt(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 u5t(e){var t=dt(24);return t.write_shift(4,4),t.write_shift(4,1),W1(e,t),t}function d5t(e,t){return t==null&&(t=dt(16*4+2)),t.write_shift(2,e.password?O7(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 f5t(){}function h5t(){}function m5t(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,x,p,g,v,y,b,N,j,_=[];l.biff=12,l["!row"]=0;var S=0,P=!1,T=[],R={},k=l.supbooks||a.supbooks||[[]];if(k.sharedf=R,k.arrayf=T,k.SheetNames=a.SheetNames||a.Sheets.map(function(z){return z.name}),!l.supbooks&&(l.supbooks=k,a.Names))for(var E=0;E<a.Names.length;++E)k[0][E+1]=a.Names[E];var q=[],O=[],L=!1;Ij[16]={n:"BrtShortReal",f:ype};var H;if(Oh(e,function(M,B,K){if(!m)switch(K){case 148:u=M;break;case 0:h=M,l.sheetRows&&l.sheetRows<=h.r&&(m=!0),N=wa(g=h.r),l["!row"]=h.r,(M.hidden||M.hpt||M.level!=null)&&(M.hpt&&(M.hpx=Zy(M.hpt)),O[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(x={t:M[2]},M[2]){case"n":x.v=M[1];break;case"s":b=Yw[M[1]],x.v=b.t,x.r=b.r;break;case"b":x.v=!!M[1];break;case"e":x.v=M[1],l.cellText!==!1&&(x.w=Dh[x.v]);break;case"str":x.t="s",x.v=M[1];break;case"is":x.t="s",x.v=M[1].t;break}if((p=o.CellXf[M[0].iStyleRef])&&xpe(x,p.numFmtId,null,l,i,o),v=M[0].c==-1?v+1:M[0].c,l.dense?(c[g]||(c[g]=[]),c[g][v]=x):c[Ws(v)+N]=x,l.cellFormula){for(P=!1,S=0;S<T.length;++S){var C=T[S];h.r>=C[0].s.r&&h.r<=C[0].e.r&&v>=C[0].s.c&&v<=C[0].e.c&&(x.F=sn(C[0]),P=!0)}!P&&M.length>3&&(x.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&&x.t=="n"&&rg(Sr[p.numFmtId])){var A=Mm(x.v);A&&(x.t="d",x.v=new Date(A.y,A.m-1,A.d,A.H,A.M,A.S,A.u))}H&&(H.type=="XLDAPR"&&(x.D=!0),H=void 0);break;case 1:case 12:if(!l.sheetStubs||f)break;x={t:"z",v:void 0},v=M[0].c==-1?v+1:M[0].c,l.dense?(c[g]||(c[g]=[]),c[g][v]=x):c[Ws(v)+N]=x,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"&&(x.D=!0),H=void 0);break;case 176:_.push(M);break;case 49:H=((l.xlmeta||{}).Cell||[])[M-1];break;case 494:var I=n["!id"][M.relId];for(I?(M.Target=I.Target,M.loc&&(M.Target+="#"+M.loc),M.Rel=I):M.relId==""&&(M.Target="#"+M.loc),g=M.rfx.s.r;g<=M.rfx.e.r;++g)for(v=M.rfx.s.c;v<=M.rfx.e.c;++v)l.dense?(c[g]||(c[g]=[]),c[g][v]||(c[g][v]={t:"z",v:void 0}),c[g][v].l=M):(y=Or({c:v,r:g}),c[y]||(c[y]={t:"z",v:void 0}),c[y].l=M);break;case 426:if(!l.cellFormula)break;T.push(M),j=l.dense?c[g][v]:c[Ws(v)+N],j.f=vo(M[1],d,{r:h.r,c:v},k,l),j.F=sn(M[0]);break;case 427:if(!l.cellFormula)break;R[Or(M[0].s)]=M[1],j=l.dense?c[g][v]:c[Ws(v)+N],j.f=vo(M[1],d,{r:h.r,c:v},k,l);break;case 60:if(!l.cellStyles)break;for(;M.e>=M.s;)q[M.e--]={width:M.w/256,hidden:!!(M.flags&1),level:M.level},L||(L=!0,D7(M.w/256)),yp(q[M.e+1]);break;case 161:c["!autofilter"]={ref:sn(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(!B.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"]=sn(u||d)),l.sheetRows&&c["!ref"]){var V=Nn(c["!ref"]);l.sheetRows<=+V.e.r&&(V.e.r=l.sheetRows-1,V.e.r>d.e.r&&(V.e.r=d.e.r),V.e.r<V.s.r&&(V.s.r=V.e.r),V.e.c>d.e.c&&(V.e.c=d.e.c),V.e.c<V.s.c&&(V.s.c=V.e.c),c["!fullref"]=c["!ref"],c["!ref"]=sn(V))}return _.length>0&&(c["!merges"]=_),q.length>0&&(c["!cols"]=q),O.length>0&&(c["!rows"]=O),c}function p5t(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=js(t),t.z=t.z||Sr[14],t.v=_i(Gs(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=qp(a.cellXfs,t,a),t.l&&i["!links"].push([Or(c),t.l]),t.c&&i["!comments"].push([Or(c),t.c]),t.t){case"s":case"str":return a.bookSST?(l=M7(a.Strings,t.v,a.revStrings),c.t="s",c.v=l,o?jt(e,18,ISt(t,c)):jt(e,7,OSt(t,c))):(c.t="str",o?jt(e,17,WSt(t,c)):jt(e,6,VSt(t,c))),!0;case"n":return t.v==(t.v|0)&&t.v>-1e3&&t.v<1e3?o?jt(e,13,zSt(t,c)):jt(e,2,$St(t,c)):o?jt(e,16,FSt(t,c)):jt(e,5,LSt(t,c)),!0;case"b":return c.t="b",o?jt(e,15,kSt(t,c)):jt(e,4,NSt(t,c)),!0;case"e":return c.t="e",o?jt(e,14,TSt(t,c)):jt(e,3,ESt(t,c)),!0}return o?jt(e,12,jSt(t,c)):jt(e,1,bSt(t,c)),!0}function x5t(e,t,r,n){var a=Nn(t["!ref"]||"A1"),i,o="",l=[];jt(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=wa(d),hSt(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]=Ws(m)),i=l[m]+o;var h=c?(t[d]||[])[m]:t[i];if(!h){f=!1;continue}f=p5t(e,h,d,m,n,t,f)}}jt(e,146)}function g5t(e,t){!t||!t["!merges"]||(jt(e,177,QSt(t["!merges"].length)),t["!merges"].forEach(function(r){jt(e,176,JSt(r))}),jt(e,178))}function v5t(e,t){!t||!t["!cols"]||(jt(e,390),t["!cols"].forEach(function(r,n){r&&jt(e,60,a5t(n,r))}),jt(e,391))}function y5t(e,t){!t||!t["!ref"]||(jt(e,648),jt(e,649,u5t(Nn(t["!ref"]))),jt(e,650))}function b5t(e,t,r){t["!links"].forEach(function(n){if(n[1].Target){var a=is(r,-1,n[1].Target.replace(/#.*$/,""),xn.HLINK);jt(e,494,t5t(n,a))}}),delete t["!links"]}function w5t(e,t,r,n){if(t["!comments"].length>0){var a=is(n,-1,"../drawings/vmlDrawing"+(r+1)+".vml",xn.VML);jt(e,551,S7("rId"+a)),t["!legacy"]=a}}function j5t(e,t,r,n){if(t["!autofilter"]){var a=t["!autofilter"],i=typeof a.ref=="string"?a.ref:sn(a.ref);r.Workbook||(r.Workbook={Sheets:[]}),r.Workbook.Names||(r.Workbook.Names=[]);var o=r.Workbook.Names,l=Qo(i);l.s.r==l.e.r&&(l.e.r=Qo(t["!ref"]).e.r,i=sn(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}),jt(e,161,W1(Nn(i))),jt(e,162)}}function _5t(e,t,r){jt(e,133),jt(e,137,c5t(t,r)),jt(e,138),jt(e,134)}function N5t(e,t){t["!protect"]&&jt(e,535,d5t(t["!protect"]))}function S5t(e,t,r,n){var a=jl(),i=r.SheetNames[e],o=r.Sheets[i]||{},l=i;try{r&&r.Workbook&&(l=r.Workbook.Sheets[e].CodeName||l)}catch{}var c=Nn(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"]=[],jt(a,129),(r.vbaraw||o["!outline"])&&jt(a,147,vSt(l,o["!outline"])),jt(a,148,pSt(c)),_5t(a,o,r.Workbook),v5t(a,o),x5t(a,o,e,t),N5t(a,o),j5t(a,o,r,e),g5t(a,o),b5t(a,o,n),o["!margins"]&&jt(a,476,o5t(o["!margins"])),(!t||t.ignoreEC||t.ignoreEC==null)&&y5t(a,o),w5t(a,o,e,n),jt(a,130),a.end()}function k5t(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=Fn((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 C5t(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=k5t(f);d.s.r=d.s.c=0,d.e.c=l,u=Ws(l),m[0].forEach(function(h,x){o[u+wa(x)]={t:"n",v:h,z:m[1]},c=x}),d.e.r<c&&(d.e.r=c),++l}),l>0&&(o["!ref"]=sn(d)),o}function E5t(e,t,r,n,a){if(!e)return e;n||(n={"!id":{}});var i={"!type":"chart","!drawel":null,"!rel":""},o,l=e.match(gpe);return l&&$7(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 A5t(e,t){e.l+=10;var r=So(e);return{name:r}}function T5t(e,t,r,n,a){if(!e)return e;n||(n={"!id":{}});var i={"!type":"chart","!drawel":null,"!rel":""},o=!1;return Oh(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 B7=[["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"]],P5t=[["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"]],O5t=[],D5t=[["calcCompleted","true"],["calcMode","auto"],["calcOnSave","true"],["concurrentCalc","true"],["fullCalcOnLoad","false"],["fullPrecision","true"],["iterate","false"],["iterateCount","100"],["iterateDelta","0.001"],["refMode","A1"]];function cY(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]]=qs(n[i[0]]));break;case"int":typeof n[i[0]]=="string"&&(n[i[0]]=parseInt(n[i[0]],10));break}}}function uY(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]]=qs(e[n[0]]));break;case"int":typeof e[n[0]]=="string"&&(e[n[0]]=parseInt(e[n[0]],10));break}}}function wpe(e){uY(e.WBProps,B7),uY(e.CalcPr,D5t),cY(e.WBView,P5t),cY(e.Sheets,O5t),Vv.date1904=qs(e.WBProps.date1904)}function I5t(e){return!e.Workbook||!e.Workbook.WBProps?"false":qs(e.Workbook.WBProps.date1904)?"true":"false"}var R5t="][*?/\\".split("");function jpe(e,t){if(e.length>31)throw new Error("Sheet names cannot exceed 31 chars");var r=!0;return R5t.forEach(function(n){if(e.indexOf(n)!=-1)throw new Error("Sheet name cannot contain : \\ / ? * [ ]")}),r}function L5t(e,t,r){e.forEach(function(n,a){jpe(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 _pe(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||[];L5t(e.SheetNames,t,!!e.vbaraw);for(var r=0;r<e.SheetNames.length;++r)INt(e.Sheets[e.SheetNames[r]],e.SheetNames[r],r)}var F5t=/<\w+:workbook/;function M5t(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(Ao,function(c,u){var d=Mr(c);switch(pf(d[0])){case"<?xml":break;case"<workbook":c.match(F5t)&&(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/>":B7.forEach(function(f){if(d[f[0]]!=null)switch(f[2]){case"bool":r.WBProps[f[0]]=qs(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=hs(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=Fn(hs(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=hs(d.name),d.comment&&(i.Comment=d.comment),d.localSheetId&&(i.Sheet=+d.localSheetId),qs(d.hidden||"0")&&(i.Hidden=!0),o=u+c.length;break;case"</definedName>":i.Ref=Fn(hs(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}),ng.indexOf(r.xmlns)===-1)throw new Error("Unknown Namespace: "+r.xmlns);return wpe(r),r}function Npe(e){var t=[$a];t[t.length]=$t("workbook",null,{xmlns:ng[0],"xmlns:r":vi.r});var r=e.Workbook&&(e.Workbook.Names||[]).length>0,n={codeName:"ThisWorkbook"};e.Workbook&&e.Workbook.WBProps&&(B7.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]=$t("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:ls(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]=$t("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]=$t("definedName",ls(l.Ref),c))}),t[t.length]="</definedNames>"),t.length>2&&(t[t.length]="</workbook>",t[1]=t[1].replace("/>",">")),t.join("")}function $5t(e,t){var r={};return r.Hidden=e.read_shift(4),r.iTabID=e.read_shift(4),r.strRelID=_I(e),r.name=So(e),r}function B5t(e,t){return t||(t=dt(127)),t.write_shift(4,e.Hidden),t.write_shift(4,e.iTabID),S7(e.strRelID,t),Ii(e.name.slice(0,31),t),t.length>t.l?t.slice(0,t.l):t}function z5t(e,t){var r={},n=e.read_shift(4);r.defaultThemeVersion=e.read_shift(4);var a=t>8?So(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 q5t(e,t){t||(t=dt(72));var r=0;return e&&e.filterPrivacy&&(r|=8),t.write_shift(4,r),t.write_shift(4,0),mme(e&&e.CodeName||"ThisWorkbook",t),t.slice(0,t.l)}function U5t(e,t){var r={};return e.read_shift(4),r.ArchID=e.read_shift(4),e.l+=t-8,r}function V5t(e,t,r){var n=e.l+t;e.l+=4,e.l+=1;var a=e.read_shift(4),i=w1t(e),o=ENt(e,0,r),l=N7(e);e.l=n;var c={Name:i,Ptg:o};return a<268435455&&(c.Sheet=a),l&&(c.Comment=l),c}function H5t(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=[],Ij[16]={n:"BrtFRTArchID$",f:U5t},Oh(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=vo(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),wpe(r),r.Names=i,r.supbooks=o,r}function W5t(e,t){jt(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]};jt(e,156,B5t(a))}jt(e,144)}function G5t(e,t){t||(t=dt(127));for(var r=0;r!=4;++r)t.write_shift(4,0);return Ii("SheetJS",t),Ii(_j.version,t),Ii(_j.version,t),Ii("7262",t),t.length>t.l?t.slice(0,t.l):t}function K5t(e,t){t||(t=dt(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 X5t(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||(jt(e,135),jt(e,158,K5t(a)),jt(e,136))}}function Y5t(e,t){var r=jl();return jt(r,131),jt(r,128,G5t()),jt(r,153,q5t(e.Workbook&&e.Workbook.WBProps||null)),X5t(r,e),W5t(r,e),jt(r,132),r.end()}function Z5t(e,t,r){return t.slice(-4)===".bin"?H5t(e,r):M5t(e,r)}function J5t(e,t,r,n,a,i,o,l){return t.slice(-4)===".bin"?m5t(e,n,r,a,i,o,l):HNt(e,n,r,a,i,o,l)}function Q5t(e,t,r,n,a,i,o,l){return t.slice(-4)===".bin"?T5t(e,n,r,a,i):E5t(e,n,r,a,i)}function e4t(e,t,r,n,a,i,o,l){return t.slice(-4)===".bin"?n_t():s_t()}function t4t(e,t,r,n,a,i,o,l){return t.slice(-4)===".bin"?t_t():r_t()}function r4t(e,t,r,n){return t.slice(-4)===".bin"?J2t(e,r,n):B2t(e,r,n)}function n4t(e,t,r){return npe(e,r)}function s4t(e,t,r){return t.slice(-4)===".bin"?a2t(e,r):r2t(e,r)}function a4t(e,t,r){return t.slice(-4)===".bin"?Yjt(e,r):zjt(e,r)}function i4t(e,t,r){return t.slice(-4)===".bin"?Mjt(e):Ljt(e)}function o4t(e,t,r,n){return r.slice(-4)===".bin"?$jt(e,t,r,n):void 0}function l4t(e,t,r){return t.slice(-4)===".bin"?Djt(e,t,r):Rjt(e,t,r)}function c4t(e,t,r){return(t.slice(-4)===".bin"?Y5t:Npe)(e)}function u4t(e,t,r,n,a){return(t.slice(-4)===".bin"?S5t:vpe)(e,r,n,a)}function d4t(e,t,r){return(t.slice(-4)===".bin"?ljt:tpe)(e,r)}function f4t(e,t,r){return(t.slice(-4)===".bin"?l2t:Gme)(e,r)}function h4t(e,t,r){return(t.slice(-4)===".bin"?Zjt:ipe)(e)}function m4t(e){return(e.slice(-4)===".bin"?Ijt:spe)()}var Spe=/([\w:]+)=((?:")([^"]*)(?:")|(?:')([^']*)(?:'))/g,kpe=/([\w:]+)=((?:")(?:[^"]*)(?:")|(?:')(?:[^']*)(?:'))/;function Su(e,t){var r=e.split(/\s+/),n=[];if(n[0]=r[0],r.length===1)return n;var a=e.match(Spe),i,o,l,c;if(a)for(c=0;c!=a.length;++c)i=a[c].match(kpe),(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 p4t(e){var t=e.split(/\s+/),r={};if(t.length===1)return r;var n=e.match(Spe),a,i,o,l;if(n)for(l=0;l!=n.length;++l)a=n[l].match(kpe),(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 Jw;function x4t(e,t){var r=Jw[e]||Fn(e);return r==="General"?O0(t):dc(r,t)}function g4t(e,t,r,n){var a=n;switch((r[0].match(/dt:dt="([\w.]+)"/)||["",""])[1]){case"boolean":a=qs(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=Gs(n);break;case"i8":case"string":case"fixed":case"uuid":case"bin.base64":break;default:throw new Error("bad custprop:"+r[0])}e[Fn(t)]=a}function v4t(e,t,r){if(e.t!=="z"){if(!r||r.cellText!==!1)try{e.t==="e"?e.w=e.w||Dh[e.v]:t==="General"?e.t==="n"?(e.v|0)===e.v?e.w=e.v.toString(10):e.w=Sj(e.v):e.w=O0(e.v):e.w=x4t(t||"General",e.v)}catch(i){if(r.WTF)throw i}try{var n=Jw[t]||t||"General";if(r.cellNF&&(e.z=n),r.cellDates&&e.t=="n"&&rg(n)){var a=Mm(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 y4t(e,t,r){if(r.cellStyles&&t.Interior){var n=t.Interior;n.Pattern&&(n.patternType=O2t[n.Pattern]||n.Pattern)}e[t.ID]=t}function b4t(e,t,r,n,a,i,o,l,c,u){var d="General",f=n.StyleID,m={};u=u||{};var h=[],x=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=qs(e);break;case"String":n.t="s",n.r=CX(Fn(e)),n.v=e.indexOf("<")>-1?Fn(t||e).replace(/<.*?>/g,""):n.r;break;case"DateTime":e.slice(-1)!="Z"&&(e+="Z"),n.v=(Gs(e)-new Date(Date.UTC(1899,11,30)))/(24*60*60*1e3),n.v!==n.v?n.v=Fn(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=yme[e],u.cellText!==!1&&(n.w=e);break;default:e==""&&t==""?n.t="z":(n.t="s",n.v=CX(t||e));break}if(v4t(n,d,u),u.cellFormula!==!1)if(n.Formula){var p=Fn(n.Formula);p.charCodeAt(0)==61&&(p=p.slice(1)),n.f=Uv(p,a),delete n.Formula,n.ArrayRange=="RC"?n.F=Uv("RC:RC",a):n.ArrayRange&&(n.F=Uv(n.ArrayRange,a),c.push([Nn(n.F),n.F]))}else for(x=0;x<c.length;++x)a.r>=c[x][0].s.r&&a.r<=c[x][0].e.r&&a.c>=c[x][0].s.c&&a.c<=c[x][0].e.c&&(n.F=c[x][1]);u.cellStyles&&(h.forEach(function(g){!m.patternType&&g.patternType&&(m.patternType=g.patternType)}),n.s=m),n.StyleID!==void 0&&(n.ixfe=n.StyleID)}function w4t(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 rO(e,t){var r=t||{};U1();var n=vv(m7(e));(r.type=="binary"||r.type=="array"||r.type=="base64")&&(typeof Pn<"u"?n=Pn.utils.decode(65001,$k(n)):n=hs(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=js(r);return o.type="string",Yy.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 nkt(n,r);Jw={"General Number":"General","General Date":Sr[22],"Long Date":"dddd, mmmm dd, yyyy","Medium Date":Sr[15],"Short Date":Sr[14],"Long Time":Sr[19],"Medium Time":Sr[18],"Short Time":Sr[20],Currency:'"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',Fixed:Sr[2],Standard:Sr[4],Percent:Sr[10],Scientific:Sr[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="",x={},p={},g=Su('<Data ss:Type="String">'),v=0,y=0,b=0,N={s:{r:2e6,c:2e6},e:{r:0,c:0}},j={},_={},S="",P=0,T=[],R={},k={},E=0,q=[],O=[],L={},H=[],V,z=!1,M=[],B=[],K={},C=0,A=0,I={Sheets:[],WBProps:{date1904:!1}},U={};Ej.lastIndex=0,n=n.replace(/<!--([\s\S]*?)-->/mg,"");for(var Y="";l=Ej.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]==="/"?b4t(n.slice(v,l.index),S,g,c[c.length-1][0]=="comment"?L:x,{c:y,r:b},j,H[y],p,M,r):(S="",g=Su(l[0]),v=l.index+l[0].length);break;case"cell":if(l[1]==="/")if(O.length>0&&(x.c=O),(!r.sheetRows||r.sheetRows>b)&&x.v!==void 0&&(r.dense?(m[b]||(m[b]=[]),m[b][y]=x):m[Ws(y)+wa(b)]=x),x.HRef&&(x.l={Target:Fn(x.HRef)},x.HRefScreenTip&&(x.l.Tooltip=x.HRefScreenTip),delete x.HRef,delete x.HRefScreenTip),(x.MergeAcross||x.MergeDown)&&(C=y+(parseInt(x.MergeAcross,10)|0),A=b+(parseInt(x.MergeDown,10)|0),T.push({s:{c:y,r:b},e:{c:C,r:A}})),!r.sheetStubs)x.MergeAcross?y=C+1:++y;else if(x.MergeAcross||x.MergeDown){for(var te=y;te<=C;++te)for(var re=b;re<=A;++re)(te>y||re>b)&&(r.dense?(m[re]||(m[re]=[]),m[re][te]={t:"z"}):m[Ws(te)+wa(re)]={t:"z"});y=C+1}else++y;else x=p4t(l[0]),x.Index&&(y=+x.Index-1),y<N.s.c&&(N.s.c=y),y>N.e.c&&(N.e.c=y),l[0].slice(-2)==="/>"&&++y,O=[];break;case"row":l[1]==="/"||l[0].slice(-2)==="/>"?(b<N.s.r&&(N.s.r=b),b>N.e.r&&(N.e.r=b),l[0].slice(-2)==="/>"&&(p=Su(l[0]),p.Index&&(b=+p.Index-1)),y=0,++b):(p=Su(l[0]),p.Index&&(b=+p.Index-1),K={},(p.AutoFitHeight=="0"||p.Height)&&(K.hpx=parseInt(p.Height,10),K.hpt=Dj(K.hpx),B[b]=K),p.Hidden=="1"&&(K.hidden=!0,B[b]=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"]=sn(N),r.sheetRows&&r.sheetRows<=N.e.r&&(m["!fullref"]=m["!ref"],N.e.r=r.sheetRows-1,m["!ref"]=sn(N))),T.length&&(m["!merges"]=T),H.length>0&&(m["!cols"]=H),B.length>0&&(m["!rows"]=B),d[h]=m}else N={s:{r:2e6,c:2e6},e:{r:0,c:0}},b=y=0,c.push([l[3],!1]),u=Su(l[0]),h=Fn(u.Name),m=r.dense?[]:{},T=[],M=[],B=[],U={name:h,Hidden:0},I.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=[],z=!1}break;case"style":l[1]==="/"?y4t(j,_,r):_=Su(l[0]);break;case"numberformat":_.nf=Fn(Su(l[0]).Format||"General"),Jw[_.nf]&&(_.nf=Jw[_.nf]);for(var J=0;J!=392&&Sr[J]!=_.nf;++J);if(J==392){for(J=57;J!=392;++J)if(Sr[J]==null){ef(_.nf,J);break}}break;case"column":if(c[c.length-1][0]!=="table")break;if(V=Su(l[0]),V.Hidden&&(V.hidden=!0,delete V.Hidden),V.Width&&(V.wpx=parseInt(V.Width,10)),!z&&V.wpx>10){z=!0,wo=Qme;for(var ie=0;ie<H.length;++ie)H[ie]&&yp(H[ie])}z&&yp(V),H[V.Index-1||H.length]=V;for(var be=0;be<+V.Span;++be)H[H.length]=js(V);break;case"namedrange":if(l[1]==="/")break;I.Names||(I.Names=[]);var Q=Mr(l[0]),Ve={Name:Q.Name,Ref:Uv(Q.RefersTo.slice(1),{r:0,c:0})};I.Sheets.length>0&&(Ve.Sheet=I.Sheets.length-1),I.Names.push(Ve);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(P,l.index):P=l.index+l[0].length;break;case"interior":if(!r.cellStyles)break;_.Interior=Su(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]==="/"?W1t(R,Y,n.slice(E,l.index)):E=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("|"));w4t(L),O.push(L)}else c.push([l[3],!1]),u=Su(l[0]),L={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=Su(l[0]);m["!autofilter"]={ref:Uv(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 pY(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":I.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(E,l.index)){case"SheetHidden":U.Hidden=1;break;case"SheetVeryHidden":U.Hidden=2;break}else E=l.index+l[0].length;break;case"header":m["!margins"]||a0(m["!margins"]={},"xlml"),isNaN(+Mr(l[0]).Margin)||(m["!margins"].header=+Mr(l[0]).Margin);break;case"footer":m["!margins"]||a0(m["!margins"]={},"xlml"),isNaN(+Mr(l[0]).Margin)||(m["!margins"].footer=+Mr(l[0]).Margin);break;case"pagemargins":var he=Mr(l[0]);m["!margins"]||a0(m["!margins"]={},"xlml"),isNaN(+he.Top)||(m["!margins"].top=+he.Top),isNaN(+he.Left)||(m["!margins"].left=+he.Left),isNaN(+he.Right)||(m["!margins"].right=+he.Right),isNaN(+he.Bottom)||(m["!margins"].bottom=+he.Bottom);break;case"displayrighttoleft":I.Views||(I.Views=[]),I.Views[0]||(I.Views[0]={}),I.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]==="/"?g4t(k,Y,q,n.slice(E,l.index)):(q=l,E=l.index+l[0].length);break}if(r.WTF)throw"Unrecognized tag: "+l[3]+"|"+c.join("|")}var se={};return!r.bookSheets&&!r.bookProps&&(se.Sheets=d),se.SheetNames=f,se.Workbook=I,se.SSF=js(Sr),se.Props=R,se.Custprops=k,se}function TI(e,t){switch(U7(t=t||{}),t.type||"base64"){case"base64":return rO(uc(e),t);case"binary":case"buffer":case"file":return rO(e,t);case"array":return rO(Bp(e),t)}}function j4t(e,t){var r=[];return e.Props&&r.push(G1t(e.Props,t)),e.Custprops&&r.push(K1t(e.Props,e.Custprops)),r.join("")}function _4t(){return""}function N4t(e,t){var r=['<Style ss:ID="Default" ss:Name="Normal"><NumberFormat/></Style>'];return t.cellXfs.forEach(function(n,a){var i=[];i.push($t("NumberFormat",null,{"ss:Format":ls(Sr[n.numFmtId])}));var o={"ss:ID":"s"+(21+a)};r.push($t("Style",i.join(""),o))}),$t("Styles",r.join(""))}function Cpe(e){return $t("NamedRange",null,{"ss:Name":e.Name,"ss:RefersTo":"="+L7(e.Ref,{r:0,c:0})})}function S4t(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(Cpe(a)))}return $t("Names",r.join(""))}function k4t(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(Cpe(l)))}return i.join("")}function C4t(e,t,r,n){if(!e)return"";var a=[];if(e["!margins"]&&(a.push("<PageSetup>"),e["!margins"].header&&a.push($t("Header",null,{"x:Margin":e["!margins"].header})),e["!margins"].footer&&a.push($t("Footer",null,{"x:Margin":e["!margins"].footer})),a.push($t("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($t("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(Qi("ProtectContents","True")),e["!protect"].objects&&a.push(Qi("ProtectObjects","True")),e["!protect"].scenarios&&a.push(Qi("ProtectScenarios","True")),e["!protect"].selectLockedCells!=null&&!e["!protect"].selectLockedCells?a.push(Qi("EnableSelection","NoSelection")):e["!protect"].selectUnlockedCells!=null&&!e["!protect"].selectUnlockedCells&&a.push(Qi("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?"":$t("WorksheetOptions",a.join(""),{xmlns:Wl.x})}function E4t(e){return e.map(function(t){var r=Yyt(t.t||""),n=$t("ss:Data",r,{xmlns:"http://www.w3.org/TR/REC-html40"});return $t("Comment",n,{"ss:Author":t.a})}).join("")}function A4t(e,t,r,n,a,i,o){if(!e||e.v==null&&e.f==null)return"";var l={};if(e.f&&(l["ss:Formula"]="="+ls(L7(e.f,o))),e.F&&e.F.slice(0,t.length)==t){var c=ia(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"]=ls(e.l.Target),e.l.Tooltip&&(l["x:HRefScreenTip"]=ls(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=Dh[e.v];break;case"d":f="DateTime",m=new Date(e.v).toISOString(),e.z==null&&(e.z=e.z||Sr[14]);break;case"s":f="String",m=Xyt(e.v||"");break}var h=qp(n.cellXfs,e,n);l["ss:StyleID"]="s"+(21+h),l["ss:Index"]=o.c+1;var x=e.v!=null?m:"",p=e.t=="z"?"":'<Data ss:Type="'+f+'">'+x+"</Data>";return(e.c||[]).length>0&&(p+=E4t(e.c)),$t("Cell",p,l)}function T4t(e,t){var r='<Row ss:Index="'+(e+1)+'"';return t&&(t.hpt&&!t.hpx&&(t.hpx=Zy(t.hpt)),t.hpx&&(r+=' ss:AutoFitHeight="0" ss:Height="'+t.hpx+'"'),t.hidden&&(r+=' ss:Hidden="1"')),r+">"}function P4t(e,t,r,n){if(!e["!ref"])return"";var a=Nn(e["!ref"]),i=e["!merges"]||[],o=0,l=[];e["!cols"]&&e["!cols"].forEach(function(g,v){yp(g);var y=!!g.width,b=OA(v,g),N={"ss:Index":v+1};y&&(N["ss:Width"]=Pj(b.width)),g.hidden&&(N["ss:Hidden"]="1"),l.push($t("Column",null,N))});for(var c=Array.isArray(e),u=a.s.r;u<=a.e.r;++u){for(var d=[T4t(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},x=Or(h),p=c?(e[u]||[])[f]:e[x];d.push(A4t(p,x,e,t,r,n,h))}}d.push("</Row>"),d.length>2&&l.push(d.join(""))}return l.join("")}function O4t(e,t,r){var n=[],a=r.SheetNames[e],i=r.Sheets[a],o=i?k4t(i,t,e,r):"";return o.length>0&&n.push("<Names>"+o+"</Names>"),o=i?P4t(i,t,e,r):"",o.length>0&&n.push("<Table>"+o+"</Table>"),n.push(C4t(i,t,e,r)),n.join("")}function D4t(e,t){t||(t={}),e.SSF||(e.SSF=js(Sr)),e.SSF&&(U1(),O_(e.SSF),t.revssf=kA(e.SSF),t.revssf[e.SSF[65535]]=0,t.ssf=e.SSF,t.cellXfs=[],qp(t.cellXfs,{},{revssf:{General:0}}));var r=[];r.push(j4t(e,t)),r.push(_4t()),r.push(""),r.push("");for(var n=0;n<e.SheetNames.length;++n)r.push($t("Worksheet",O4t(n,t,e),{"ss:Name":ls(e.SheetNames[n])}));return r[2]=N4t(e,t),r[3]=S4t(e),$a+$t("Workbook",r.join(""),{xmlns:Wl.ss,"xmlns:o":Wl.o,"xmlns:x":Wl.x,"xmlns:ss":Wl.ss,"xmlns:dt":Wl.dt,"xmlns:html":Wl.html})}function I4t(e){var t={},r=e.content;if(r.l=28,t.AnsiUserType=r.read_shift(0,"lpstr-ansi"),t.AnsiClipboardFormat=k1t(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=C1t(r),n=r.read_shift(4),n==0||n>40))return t;r.l-=4,t.Reserved2=r.read_shift(0,"lpwstr")}var R4t=[60,1084,2066,2165,2175];function L4t(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=Qf(r,r.l),u=PI[c],d=0;u!=null&&R4t.indexOf(c)>-1;)i=Qf(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=PI[c=Qf(r,r.l)];var f=Di(o);Ji(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 Cd(e,t,r){if(e.t!=="z"&&e.XF){var n=0;try{n=e.z||e.XF.numFmtId||0,t.cellNF&&(e.z=Sr[n])}catch(i){if(t.WTF)throw i}if(!t||t.cellText!==!1)try{e.t==="e"?e.w=e.w||Dh[e.v]:n===0||n=="General"?e.t==="n"?(e.v|0)===e.v?e.w=e.v.toString(10):e.w=Sj(e.v):e.w=O0(e.v):e.w=dc(n,e.v,{date1904:!!r,dateNF:t&&t.dateNF})}catch(i){if(t.WTF)throw i}if(t.cellDates&&n&&e.t=="n"&&rg(Sr[n]||String(n))){var a=Mm(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 WS(e,t,r){return{v:e,ixfe:t,t:r}}function F4t(e,t){var r={opts:{}},n={},a=t.dense?[]:{},i={},o={},l=null,c=[],u="",d={},f,m="",h,x,p,g,v={},y=[],b,N,j=[],_=[],S={Sheets:[],WBProps:{date1904:!1},Views:[{}]},P={},T=function(Fe){return Fe<8?r0[Fe]:Fe<64&&_[Fe-8]||r0[Fe]},R=function(Fe,Ge,ht){var ut=Ge.XF.data;if(!(!ut||!ut.patternType||!ht||!ht.cellStyles)){Ge.s={},Ge.s.patternType=ut.patternType;var Mt;(Mt=Tj(T(ut.icvFore)))&&(Ge.s.fgColor={rgb:Mt}),(Mt=Tj(T(ut.icvBack)))&&(Ge.s.bgColor={rgb:Mt})}},k=function(Fe,Ge,ht){if(!(K>1)&&!(ht.sheetRows&&Fe.r>=ht.sheetRows)){if(ht.cellStyles&&Ge.XF&&Ge.XF.data&&R(Fe,Ge,ht),delete Ge.ixfe,delete Ge.XF,f=Fe,m=Or(Fe),(!o||!o.s||!o.e)&&(o={s:{r:0,c:0},e:{r:0,c:0}}),Fe.r<o.s.r&&(o.s.r=Fe.r),Fe.c<o.s.c&&(o.s.c=Fe.c),Fe.r+1>o.e.r&&(o.e.r=Fe.r+1),Fe.c+1>o.e.c&&(o.e.c=Fe.c+1),ht.cellFormula&&Ge.f){for(var ut=0;ut<y.length;++ut)if(!(y[ut][0].s.c>Fe.c||y[ut][0].s.r>Fe.r)&&!(y[ut][0].e.c<Fe.c||y[ut][0].e.r<Fe.r)){Ge.F=sn(y[ut][0]),(y[ut][0].s.c!=Fe.c||y[ut][0].s.r!=Fe.r)&&delete Ge.f,Ge.f&&(Ge.f=""+vo(y[ut][1],o,Fe,M,E));break}}ht.dense?(a[Fe.r]||(a[Fe.r]=[]),a[Fe.r][Fe.c]=Ge):a[m]=Ge}},E={enc:!1,sbcch:0,snames:[],sharedf:v,arrayf:y,rrtabid:[],lastuser:"",biff:8,codepage:0,winlocked:0,cellStyles:!!t&&!!t.cellStyles,WTF:!!t&&!!t.wtf};t.password&&(E.password=t.password);var q,O=[],L=[],H=[],V=[],z=!1,M=[];M.SheetNames=E.snames,M.sharedf=E.sharedf,M.arrayf=E.arrayf,M.names=[],M.XTI=[];var B=0,K=0,C=0,A=[],I=[],U;E.codepage=1200,Hc(1200);for(var Y=!1;e.l<e.length-1;){var te=e.l,re=e.read_shift(2);if(re===0&&B===10)break;var J=e.l===e.length?0:e.read_shift(2),ie=PI[re];if(ie&&ie.f){if(t.bookSheets&&B===133&&re!==133)break;if(B=re,ie.r===2||ie.r==12){var be=e.read_shift(2);if(J-=2,!E.enc&&be!==re&&((be&255)<<8|be>>8)!==re)throw new Error("rt mismatch: "+be+"!="+re);ie.r==12&&(e.l+=10,J-=10)}var Q={};if(re===10?Q=ie.f(e,J,E):Q=L4t(re,ie,e,J,E),K==0&&[9,521,1033,2057].indexOf(B)===-1)continue;switch(re){case 34:r.opts.Date1904=S.WBProps.date1904=Q;break;case 134:r.opts.WriteProtect=!0;break;case 47:if(E.enc||(e.l=0),E.enc=Q,!t.password)throw new Error("File is password-protected");if(Q.valid==null)throw new Error("Encryption scheme unsupported");if(!Q.valid)throw new Error("Password is incorrect");break;case 92:E.lastuser=Q;break;case 66:var Ve=Number(Q);switch(Ve){case 21010:Ve=1200;break;case 32768:Ve=1e4;break;case 32769:Ve=1252;break}Hc(E.codepage=Ve),Y=!0;break;case 317:E.rrtabid=Q;break;case 25:E.winlocked=Q;break;case 439:r.opts.RefreshAll=Q;break;case 12:r.opts.CalcCount=Q;break;case 16:r.opts.CalcDelta=Q;break;case 17:r.opts.CalcIter=Q;break;case 13:r.opts.CalcMode=Q;break;case 14:r.opts.CalcPrecision=Q;break;case 95:r.opts.CalcSaveRecalc=Q;break;case 15:E.CalcRefMode=Q;break;case 2211:r.opts.FullCalc=Q;break;case 129:Q.fDialog&&(a["!type"]="dialog"),Q.fBelow||((a["!outline"]||(a["!outline"]={})).above=!0),Q.fRight||((a["!outline"]||(a["!outline"]={})).left=!0);break;case 224:j.push(Q);break;case 430:M.push([Q]),M[M.length-1].XTI=[];break;case 35:case 547:M[M.length-1].push(Q);break;case 24:case 536:U={Name:Q.Name,Ref:vo(Q.rgce,o,null,M,E)},Q.itab>0&&(U.Sheet=Q.itab-1),M.names.push(U),M[0]||(M[0]=[],M[0].XTI=[]),M[M.length-1].push(Q),Q.Name=="_xlnm._FilterDatabase"&&Q.itab>0&&Q.rgce&&Q.rgce[0]&&Q.rgce[0][0]&&Q.rgce[0][0][0]=="PtgArea3d"&&(I[Q.itab-1]={ref:sn(Q.rgce[0][0][1][2])});break;case 22:E.ExternCount=Q;break;case 23:M.length==0&&(M[0]=[],M[0].XTI=[]),M[M.length-1].XTI=M[M.length-1].XTI.concat(Q),M.XTI=M.XTI.concat(Q);break;case 2196:if(E.biff<8)break;U!=null&&(U.Comment=Q[1]);break;case 18:a["!protect"]=Q;break;case 19:Q!==0&&E.WTF&&console.error("Password verifier: "+Q);break;case 133:i[Q.pos]=Q,E.snames.push(Q.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"]=sn(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"]=sn(o),o.e.r=W}o.e.r++,o.e.c++}O.length>0&&(a["!merges"]=O),L.length>0&&(a["!objects"]=L),H.length>0&&(a["!cols"]=H),V.length>0&&(a["!rows"]=V),S.Sheets.push(P)}u===""?d=a:n[u]=a,a=t.dense?[]:{}}break;case 9:case 521:case 1033:case 2057:{if(E.biff===8&&(E.biff={9:2,521:3,1033:4}[re]||{512:2,768:3,1024:4,1280:5,1536:8,2:2,7:2}[Q.BIFFVer]||8),E.biffguess=Q.BIFFVer==0,Q.BIFFVer==0&&Q.dt==4096&&(E.biff=5,Y=!0,Hc(E.codepage=28591)),E.biff==8&&Q.BIFFVer==0&&Q.dt==16&&(E.biff=2),K++)break;if(a=t.dense?[]:{},E.biff<8&&!Y&&(Y=!0,Hc(E.codepage=t.codepage||1252)),E.biff<5||Q.BIFFVer==0&&Q.dt==4096){u===""&&(u="Sheet1"),o={s:{r:0,c:0},e:{r:0,c:0}};var Z={pos:e.l-J,name:u};i[Z.pos]=Z,E.snames.push(u)}else u=(i[te]||{name:""}).name;Q.dt==32&&(a["!type"]="chart"),Q.dt==64&&(a["!type"]="macro"),O=[],L=[],E.arrayf=y=[],H=[],V=[],z=!1,P={Hidden:(i[te]||{hs:0}).hs,name:u}}break;case 515:case 3:case 2:a["!type"]=="chart"&&(t.dense?(a[Q.r]||[])[Q.c]:a[Or({c:Q.c,r:Q.r})])&&++Q.c,b={ixfe:Q.ixfe,XF:j[Q.ixfe]||{},v:Q.val,t:"n"},C>0&&(b.z=A[b.ixfe>>8&63]),Cd(b,t,r.opts.Date1904),k({c:Q.c,r:Q.r},b,t);break;case 5:case 517:b={ixfe:Q.ixfe,XF:j[Q.ixfe],v:Q.val,t:Q.t},C>0&&(b.z=A[b.ixfe>>8&63]),Cd(b,t,r.opts.Date1904),k({c:Q.c,r:Q.r},b,t);break;case 638:b={ixfe:Q.ixfe,XF:j[Q.ixfe],v:Q.rknum,t:"n"},C>0&&(b.z=A[b.ixfe>>8&63]),Cd(b,t,r.opts.Date1904),k({c:Q.c,r:Q.r},b,t);break;case 189:for(var he=Q.c;he<=Q.C;++he){var se=Q.rkrec[he-Q.c][0];b={ixfe:se,XF:j[se],v:Q.rkrec[he-Q.c][1],t:"n"},C>0&&(b.z=A[b.ixfe>>8&63]),Cd(b,t,r.opts.Date1904),k({c:he,r:Q.r},b,t)}break;case 6:case 518:case 1030:{if(Q.val=="String"){l=Q;break}if(b=WS(Q.val,Q.cell.ixfe,Q.tt),b.XF=j[b.ixfe],t.cellFormula){var oe=Q.formula;if(oe&&oe[0]&&oe[0][0]&&oe[0][0][0]=="PtgExp"){var le=oe[0][0][1][0],Me=oe[0][0][1][1],de=Or({r:le,c:Me});v[de]?b.f=""+vo(Q.formula,o,Q.cell,M,E):b.F=((t.dense?(a[le]||[])[Me]:a[de])||{}).F}else b.f=""+vo(Q.formula,o,Q.cell,M,E)}C>0&&(b.z=A[b.ixfe>>8&63]),Cd(b,t,r.opts.Date1904),k(Q.cell,b,t),l=Q}break;case 7:case 519:if(l)l.val=Q,b=WS(Q,l.cell.ixfe,"s"),b.XF=j[b.ixfe],t.cellFormula&&(b.f=""+vo(l.formula,o,l.cell,M,E)),C>0&&(b.z=A[b.ixfe>>8&63]),Cd(b,t,r.opts.Date1904),k(l.cell,b,t),l=null;else throw new Error("String record expects Formula");break;case 33:case 545:{y.push(Q);var me=Or(Q[0].s);if(h=t.dense?(a[Q[0].s.r]||[])[Q[0].s.c]:a[me],t.cellFormula&&h){if(!l||!me||!h)break;h.f=""+vo(Q[1],o,Q[0],M,E),h.F=sn(Q[0])}}break;case 1212:{if(!t.cellFormula)break;if(m){if(!l)break;v[Or(l.cell)]=Q[0],h=t.dense?(a[l.cell.r]||[])[l.cell.c]:a[Or(l.cell)],(h||{}).f=""+vo(Q[0],o,f,M,E)}}break;case 253:b=WS(c[Q.isst].t,Q.ixfe,"s"),c[Q.isst].h&&(b.h=c[Q.isst].h),b.XF=j[b.ixfe],C>0&&(b.z=A[b.ixfe>>8&63]),Cd(b,t,r.opts.Date1904),k({c:Q.c,r:Q.r},b,t);break;case 513:t.sheetStubs&&(b={ixfe:Q.ixfe,XF:j[Q.ixfe],t:"z"},C>0&&(b.z=A[b.ixfe>>8&63]),Cd(b,t,r.opts.Date1904),k({c:Q.c,r:Q.r},b,t));break;case 190:if(t.sheetStubs)for(var Le=Q.c;Le<=Q.C;++Le){var Ke=Q.ixfe[Le-Q.c];b={ixfe:Ke,XF:j[Ke],t:"z"},C>0&&(b.z=A[b.ixfe>>8&63]),Cd(b,t,r.opts.Date1904),k({c:Le,r:Q.r},b,t)}break;case 214:case 516:case 4:b=WS(Q.val,Q.ixfe,"s"),b.XF=j[b.ixfe],C>0&&(b.z=A[b.ixfe>>8&63]),Cd(b,t,r.opts.Date1904),k({c:Q.c,r:Q.r},b,t);break;case 0:case 512:K===1&&(o=Q);break;case 252:c=Q;break;case 1054:if(E.biff==4){A[C++]=Q[1];for(var ve=0;ve<C+163&&Sr[ve]!=Q[1];++ve);ve>=163&&ef(Q[1],C+163)}else ef(Q[1],Q[0]);break;case 30:{A[C++]=Q;for(var _e=0;_e<C+163&&Sr[_e]!=Q;++_e);_e>=163&&ef(Q,C+163)}break;case 229:O=O.concat(Q);break;case 93:L[Q.cmo[0]]=E.lastobj=Q;break;case 438:E.lastobj.TxO=Q;break;case 127:E.lastobj.ImData=Q;break;case 440:for(g=Q[0].s.r;g<=Q[0].e.r;++g)for(p=Q[0].s.c;p<=Q[0].e.c;++p)h=t.dense?(a[g]||[])[p]:a[Or({c:p,r:g})],h&&(h.l=Q[1]);break;case 2048:for(g=Q[0].s.r;g<=Q[0].e.r;++g)for(p=Q[0].s.c;p<=Q[0].e.c;++p)h=t.dense?(a[g]||[])[p]:a[Or({c:p,r:g})],h&&h.l&&(h.l.Tooltip=Q[1]);break;case 28:{if(E.biff<=5&&E.biff>=2)break;h=t.dense?(a[Q[0].r]||[])[Q[0].c]:a[Or(Q[0])];var Ue=L[Q[2]];h||(t.dense?(a[Q[0].r]||(a[Q[0].r]=[]),h=a[Q[0].r][Q[0].c]={t:"z"}):h=a[Or(Q[0])]={t:"z"},o.e.r=Math.max(o.e.r,Q[0].r),o.s.r=Math.min(o.s.r,Q[0].r),o.e.c=Math.max(o.e.c,Q[0].c),o.s.c=Math.min(o.s.c,Q[0].c)),h.c||(h.c=[]),x={a:Q[1],t:Ue.TxO.t},h.c.push(x)}break;case 2173:Sjt(j[Q.ixfe],Q.ext);break;case 125:{if(!E.cellStyles)break;for(;Q.e>=Q.s;)H[Q.e--]={width:Q.w/256,level:Q.level||0,hidden:!!(Q.flags&1)},z||(z=!0,D7(Q.w/256)),yp(H[Q.e+1])}break;case 520:{var Qe={};Q.level!=null&&(V[Q.r]=Qe,Qe.level=Q.level),Q.hidden&&(V[Q.r]=Qe,Qe.hidden=!0),Q.hpt&&(V[Q.r]=Qe,Qe.hpt=Q.hpt,Qe.hpx=Zy(Q.hpt))}break;case 38:case 39:case 40:case 41:a["!margins"]||a0(a["!margins"]={}),a["!margins"][{38:"left",39:"right",40:"top",41:"bottom"}[re]]=Q;break;case 161:a["!margins"]||a0(a["!margins"]={}),a["!margins"].header=Q.header,a["!margins"].footer=Q.footer;break;case 574:Q.RTL&&(S.Views[0].RTL=!0);break;case 146:_=Q;break;case 2198:q=Q;break;case 140:N=Q;break;case 442:u?P.CodeName=Q||P.name:S.WBProps.CodeName=Q||"ThisWorkbook";break}}else ie||console.error("Missing Info for XLS Record 0x"+re.toString(16)),e.l+=J}return r.SheetNames=ka(i).sort(function(st,Fe){return Number(st)-Number(Fe)}).map(function(st){return i[st].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&&I.forEach(function(st,Fe){r.Sheets[r.SheetNames[Fe]]["!autofilter"]=st}),r.Strings=c,r.SSF=js(Sr),E.enc&&(r.Encryption=E.enc),q&&(r.Themes=q),r.Metadata={},N!==void 0&&(r.Metadata.Country=N),M.names.length>0&&(S.Names=M.names),r.Workbook=S,r}var Qw={SI:"e0859ff2f94f6810ab9108002b27b3d9",DSI:"02d5cdd59c2e1b10939708002b2cf9ae",UDI:"05d5cdd59c2e1b10939708002b2cf9ae"};function M4t(e,t,r){var n=jr.find(e,"/!DocumentSummaryInformation");if(n&&n.size>0)try{var a=HX(n,NI,Qw.DSI);for(var i in a)t[i]=a[i]}catch(u){if(r.WTF)throw u}var o=jr.find(e,"/!SummaryInformation");if(o&&o.size>0)try{var l=HX(o,SI,Qw.SI);for(var c in l)t[c]==null&&(t[c]=l[c])}catch(u){if(r.WTF)throw u}t.HeadingPairs&&t.TitlesOfParts&&(Sme(t.HeadingPairs,t.TitlesOfParts,t,r),delete t.HeadingPairs,delete t.TitlesOfParts)}function $4t(e,t){var r=[],n=[],a=[],i=0,o,l=wX(NI,"n"),c=wX(SI,"n");if(e.Props)for(o=ka(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=ka(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)Ome.indexOf(a[i][0])>-1||Nme.indexOf(a[i][0])>-1||a[i][1]!=null&&u.push(a[i]);n.length&&jr.utils.cfb_add(t,"/SummaryInformation",WX(n,Qw.SI,c,SI)),(r.length||u.length)&&jr.utils.cfb_add(t,"/DocumentSummaryInformation",WX(r,Qw.DSI,l,NI,u.length?u:null,Qw.UDI))}function z7(e,t){t||(t={}),U7(t),NA(),t.codepage&&_A(t.codepage);var r,n;if(e.FullPaths){if(jr.find(e,"/encryption"))throw new Error("File is password-protected");r=jr.find(e,"!CompObj"),n=jr.find(e,"/Workbook")||jr.find(e,"/Book")}else{switch(t.type){case"base64":e=Yl(uc(e));break;case"binary":e=Yl(e);break;case"buffer":break;case"array":Array.isArray(e)||(e=Array.prototype.slice.call(e));break}Ji(e,0),n={content:e}}var a,i;if(r&&I4t(r),t.bookProps&&!t.bookSheets)a={};else{var o=pn?"buffer":"array";if(n&&n.content)a=F4t(n.content,t);else if((i=jr.find(e,"PerfectOffice_MAIN"))&&i.content)a=s0.to_workbook(i.content,(t.type=o,t));else if((i=jr.find(e,"NativeContent_MAIN"))&&i.content)a=s0.to_workbook(i.content,(t.type=o,t));else throw(i=jr.find(e,"MN0"))&&i.content?new Error("Unsupported Works 4 for Mac file"):new Error("Cannot find Workbook stream");t.bookVBA&&e.FullPaths&&jr.find(e,"/_VBA_PROJECT_CUR/VBA/dir")&&(a.vbaraw=Qjt(e))}var l={};return e.FullPaths&&M4t(e,l,t),a.Props=a.Custprops=l,t.bookFiles&&(a.cfb=e),a}function B4t(e,t){var r=t||{},n=jr.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 jr.utils.cfb_add(n,a,Epe(e,r)),r.biff==8&&(e.Props||e.Custprops)&&$4t(e,n),r.biff==8&&e.vbaraw&&e_t(n,jr.read(e.vbaraw,{type:typeof e.vbaraw=="string"?"binary":"buffer"})),n}var Ij={0:{f:dSt},1:{f:ySt},2:{f:MSt},3:{f:CSt},4:{f:_St},5:{f:RSt},6:{f:USt},7:{f:PSt},8:{f:YSt},9:{f:XSt},10:{f:GSt},11:{f:KSt},12:{f:wSt},13:{f:BSt},14:{f:ASt},15:{f:SSt},16:{f:ype},17:{f:HSt},18:{f:DSt},19:{f:_7},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:V5t},40:{},42:{},43:{f:U2t},44:{f:z2t},45:{f:W2t},46:{f:K2t},47:{f:G2t},48:{},49:{f:m1t},50:{},51:{f:Ejt},52:{T:1},53:{T:-1},54:{T:1},55:{T:-1},56:{T:1},57:{T:-1},58:{},59:{},60:{f:Ume},62:{f:qSt},63:{f:Fjt},64:{f:f5t},65:{},66:{},67:{},68:{},69:{},70:{},128:{},129:{T:1},130:{T:-1},131:{T:1,f:Co,p:0},132:{T:-1},133:{T:1},134:{T:-1},135:{T:1},136:{T:-1},137:{T:1,f:l5t},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:gSt},148:{f:mSt,p:16},151:{f:r5t},152:{},153:{f:z5t},154:{},155:{},156:{f:$5t},157:{},158:{},159:{T:1,f:s2t},160:{T:-1},161:{T:1,f:og},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:ZSt},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:kjt},336:{T:-1},337:{f:Pjt,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:_I},357:{},358:{},359:{},360:{T:1},361:{},362:{f:qme},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:n5t},427:{f:s5t},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:i5t},477:{},478:{},479:{T:1},480:{T:-1},481:{T:1},482:{T:-1},483:{T:1},484:{T:-1},485:{f:xSt},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:e5t},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:_I},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:Kjt},633:{T:1},634:{T:-1},635:{T:1,f:Wjt},636:{T:-1},637:{f:v1t},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:A5t},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:h5t},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:""}},PI={6:{f:eO},10:{f:am},12:{f:Ka},13:{f:Ka},14:{f:Oa},15:{f:Oa},16:{f:jo},17:{f:Oa},18:{f:Oa},19:{f:Ka},20:{f:JX},21:{f:JX},23:{f:qme},24:{f:eY},25:{f:Oa},26:{},27:{},28:{f:hwt},29:{},34:{f:Oa},35:{f:QX},38:{f:jo},39:{f:jo},40:{f:jo},41:{f:jo},42:{f:Oa},43:{f:Oa},47:{f:S2t},49:{f:Bbt},51:{f:Ka},60:{},61:{f:Rbt},64:{f:Oa},65:{f:$bt},66:{f:Ka},77:{},80:{},81:{},82:{},85:{f:Ka},89:{},90:{},91:{},92:{f:Nbt},93:{f:xwt},94:{},95:{f:Oa},96:{},97:{},99:{f:Oa},125:{f:Ume},128:{f:twt},129:{f:kbt},130:{f:Ka},131:{f:Oa},132:{f:Oa},133:{f:Cbt},134:{},140:{f:Nwt},141:{f:Ka},144:{},146:{f:Cwt},151:{},152:{},153:{},154:{},155:{},156:{f:Ka},157:{},158:{},160:{f:Iwt},161:{f:Twt},174:{},175:{},176:{},177:{},178:{},180:{},181:{},182:{},184:{},185:{},189:{f:Zbt},190:{f:Jbt},193:{f:am},197:{},198:{},199:{},200:{},201:{},202:{f:Oa},203:{},204:{},205:{},206:{},207:{},208:{},209:{},210:{},211:{},213:{},215:{},216:{},217:{},218:{f:Ka},220:{},221:{f:Oa},222:{},224:{f:ewt},225:{f:_bt},226:{f:am},227:{},229:{f:mwt},233:{},235:{},236:{},237:{},239:{},240:{},241:{},242:{},244:{},245:{},246:{},247:{},248:{},249:{},251:{},252:{f:Abt},253:{f:qbt},255:{f:Pbt},256:{},259:{},290:{},311:{},312:{},315:{},317:{f:Dme},318:{},319:{},320:{},330:{},331:{},333:{},334:{},335:{},336:{},337:{},338:{},339:{},340:{},351:{},352:{f:Oa},353:{f:am},401:{},402:{},403:{},404:{},405:{},406:{},407:{},408:{},425:{},426:{},427:{},428:{},429:{},430:{f:iwt},431:{f:Oa},432:{},433:{},434:{},437:{},438:{f:ywt},439:{f:Oa},440:{f:bwt},441:{},442:{f:R_},443:{},444:{f:Ka},445:{},446:{},448:{f:am},449:{f:Ibt,r:2},450:{f:am},512:{f:XX},513:{f:Dwt},515:{f:swt},516:{f:Vbt},517:{f:ZX},519:{f:Rwt},520:{f:Obt},523:{},545:{f:tY},549:{f:KX},566:{},574:{f:Fbt},638:{f:Ybt},659:{},1048:{},1054:{f:Wbt},1084:{},1212:{f:uwt},2048:{f:jwt},2049:{},2050:{},2051:{},2052:{},2053:{},2054:{},2055:{},2056:{},2057:{f:US},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:am},2152:{},2154:{},2155:{},2156:{},2161:{},2162:{},2164:{},2165:{},2166:{},2167:{},2168:{},2169:{},2170:{},2171:{},2172:{f:Ewt,r:12},2173:{f:Njt,r:12},2174:{},2175:{},2180:{},2181:{},2182:{},2183:{},2184:{},2185:{},2186:{},2187:{},2188:{f:Oa,r:12},2189:{},2190:{r:12},2191:{},2192:{},2194:{},2195:{},2196:{f:cwt,r:12},2197:{},2198:{f:vjt,r:12},2199:{},2200:{},2201:{},2202:{f:dwt,r:12},2203:{f:am},2204:{},2205:{},2206:{},2207:{},2211:{f:Dbt},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:Ka},4135:{},4146:{},4147:{},4148:{},4149:{},4154:{},4156:{},4157:{},4158:{},4159:{},4160:{},4161:{},4163:{},4164:{f:Pwt},4165:{},4166:{},4168:{},4170:{},4171:{},4174:{},4175:{},4176:{},4177:{},4187:{},4188:{f:kwt},4189:{},4191:{},4192:{},4193:{},4194:{},4195:{},4196:{},4197:{},4198:{},4199:{},4200:{},0:{f:XX},1:{},2:{f:Bwt},3:{f:Mwt},4:{f:Fwt},5:{f:ZX},7:{f:qwt},8:{},9:{f:US},11:{},22:{f:Ka},30:{f:Kbt},31:{},32:{},33:{f:tY},36:{},37:{f:KX},50:{f:Uwt},62:{},52:{},67:{},68:{f:Ka},69:{},86:{},126:{},127:{f:Lwt},135:{},136:{},137:{},145:{},148:{},149:{},150:{},169:{},171:{},188:{},191:{},192:{},194:{},195:{},214:{f:Vwt},223:{},234:{},354:{},421:{},518:{f:eO},521:{f:US},536:{f:eY},547:{f:QX},561:{},579:{},1030:{f:eO},1033:{f:US},1091:{},2157:{},2163:{},2177:{},2240:{},2241:{},2242:{},2243:{},2244:{},2245:{},2246:{},2247:{},2248:{},2249:{},2250:{},2251:{},2262:{r:12},29282:{}};function Bt(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&&b7(r)&&e.push(r)}}function z4t(e,t,r,n){var a=(r||[]).length||0;if(a<=8224)return Bt(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 $_(e,t,r){return e||(e=dt(7)),e.write_shift(2,t),e.write_shift(2,r),e.write_shift(2,0),e.write_shift(1,0),e}function q4t(e,t,r,n){var a=dt(9);return $_(a,e,t),Ime(r,n||"b",a),a}function U4t(e,t,r){var n=dt(8+2*r.length);return $_(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 V4t(e,t,r,n){if(t.v!=null)switch(t.t){case"d":case"n":var a=t.t=="d"?_i(Gs(t.v)):t.v;a==(a|0)&&a>=0&&a<65536?Bt(e,2,zwt(r,n,a)):Bt(e,3,$wt(r,n,a));return;case"b":case"e":Bt(e,5,q4t(r,n,t.v,t.t));return;case"s":case"str":Bt(e,4,U4t(r,n,(t.v||"").slice(0,255)));return}Bt(e,1,$_(null,r,n))}function H4t(e,t,r,n){var a=Array.isArray(t),i=Nn(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=sn(i)}for(var u=i.s.r;u<=i.e.r;++u){l=wa(u);for(var d=i.s.c;d<=i.e.c;++d){u===i.s.r&&(c[d]=Ws(d)),o=c[d]+l;var f=a?(t[u]||[])[d]:t[o];f&&V4t(e,f,u,d)}}}function W4t(e,t){for(var r=t||{},n=jl(),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 Bt(n,r.biff==4?1033:r.biff==3?521:9,T7(e,16,r)),H4t(n,e.Sheets[e.SheetNames[a]],a,r),Bt(n,10),n.end()}function G4t(e,t,r){Bt(e,49,zbt({sz:12,name:"Arial"},r))}function K4t(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&&Bt(e,1054,Gbt(a,t[a],r))})}function X4t(e,t){var r=dt(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),Bt(e,2151,r),r=dt(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),$me(Nn(t["!ref"]||"A1"),r),r.write_shift(4,4),Bt(e,2152,r)}function Y4t(e,t){for(var r=0;r<16;++r)Bt(e,224,YX({numFmtId:0,style:!0},0,t));t.cellXfs.forEach(function(n){Bt(e,224,YX(n,0,t))})}function Z4t(e,t){for(var r=0;r<t["!links"].length;++r){var n=t["!links"][r];Bt(e,440,wwt(n)),n[1].Tooltip&&Bt(e,2048,_wt(n))}delete t["!links"]}function J4t(e,t){if(t){var r=0;t.forEach(function(n,a){++r<=256&&n&&Bt(e,125,Awt(OA(a,n),a))})}}function Q4t(e,t,r,n,a){var i=16+qp(a.cellXfs,t,a);if(t.v==null&&!t.bf){Bt(e,513,L0(r,n,i));return}if(t.bf)Bt(e,6,kNt(t,r,n,a,i));else switch(t.t){case"d":case"n":var o=t.t=="d"?_i(Gs(t.v)):t.v;Bt(e,515,awt(r,n,o,i));break;case"b":case"e":Bt(e,517,nwt(r,n,t.v,i,a,t.t));break;case"s":case"str":if(a.bookSST){var l=M7(a.Strings,t.v,a.revStrings);Bt(e,253,Ubt(r,n,l,i))}else Bt(e,516,Hbt(r,n,(t.v||"").slice(0,255),i,a));break;default:Bt(e,513,L0(r,n,i))}}function ekt(e,t,r){var n=jl(),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=Nn(i["!ref"]||"A1"),x=u?65536:16384;if(h.e.c>255||h.e.r>=x){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,x-1)}Bt(n,2057,T7(r,16,t)),Bt(n,13,Pc(1)),Bt(n,12,Pc(100)),Bt(n,15,zo(!0)),Bt(n,17,zo(!1)),Bt(n,16,I0(.001)),Bt(n,95,zo(!0)),Bt(n,42,zo(!1)),Bt(n,43,zo(!1)),Bt(n,130,Pc(1)),Bt(n,128,rwt()),Bt(n,131,zo(!1)),Bt(n,132,zo(!1)),u&&J4t(n,i["!cols"]),Bt(n,512,Xbt(h,t)),u&&(i["!links"]=[]);for(var p=h.s.r;p<=h.e.r;++p){f=wa(p);for(var g=h.s.c;g<=h.e.c;++g){p===h.s.r&&(m[g]=Ws(g)),d=m[g]+f;var v=c?(i[p]||[])[g]:i[d];v&&(Q4t(n,v,p,g,t),u&&v.l&&i["!links"].push([d,v.l]))}}var y=l.CodeName||l.name||a;return u&&Bt(n,574,Mbt((o.Views||[])[0])),u&&(i["!merges"]||[]).length&&Bt(n,229,pwt(i["!merges"])),u&&Z4t(n,i),Bt(n,442,Rme(y)),u&&X4t(n,i),Bt(n,10),n.end()}function tkt(e,t,r){var n=jl(),a=(e||{}).Workbook||{},i=a.Sheets||[],o=a.WBProps||{},l=r.biff==8,c=r.biff==5;if(Bt(n,2057,T7(e,5,r)),r.bookType=="xla"&&Bt(n,135),Bt(n,225,l?Pc(1200):null),Bt(n,193,nbt(2)),c&&Bt(n,191),c&&Bt(n,192),Bt(n,226),Bt(n,92,Sbt("SheetJS",r)),Bt(n,66,Pc(l?1200:1252)),l&&Bt(n,353,Pc(0)),l&&Bt(n,448),Bt(n,317,Owt(e.SheetNames.length)),l&&e.vbaraw&&Bt(n,211),l&&e.vbaraw){var u=o.CodeName||"ThisWorkbook";Bt(n,442,Rme(u))}Bt(n,156,Pc(17)),Bt(n,25,zo(!1)),Bt(n,18,zo(!1)),Bt(n,19,Pc(0)),l&&Bt(n,431,zo(!1)),l&&Bt(n,444,Pc(0)),Bt(n,61,Lbt()),Bt(n,64,zo(!1)),Bt(n,141,Pc(0)),Bt(n,34,zo(I5t(e)=="true")),Bt(n,14,zo(!0)),l&&Bt(n,439,zo(!1)),Bt(n,218,Pc(0)),G4t(n,e,r),K4t(n,e.SSF,r),Y4t(n,r),l&&Bt(n,352,zo(!1));var d=n.end(),f=jl();l&&Bt(f,140,Swt()),l&&r.Strings&&z4t(f,252,Tbt(r.Strings)),Bt(f,10);var m=f.end(),h=jl(),x=0,p=0;for(p=0;p<e.SheetNames.length;++p)x+=(l?12:11)+(l?2:1)*e.SheetNames[p].length;var g=d.length+x+m.length;for(p=0;p<e.SheetNames.length;++p){var v=i[p]||{};Bt(h,133,Ebt({pos:g,hs:v.Hidden||0,dt:0,name:e.SheetNames[p]},r)),g+=t[p].length}var y=h.end();if(x!=y.length)throw new Error("BS8 "+x+" != "+y.length);var b=[];return d.length&&b.push(d),y.length&&b.push(y),m.length&&b.push(m),Di(b)}function rkt(e,t){var r=t||{},n=[];e&&!e.SSF&&(e.SSF=js(Sr)),e&&e.SSF&&(U1(),O_(e.SSF),r.revssf=kA(e.SSF),r.revssf[e.SSF[65535]]=0,r.ssf=e.SSF),r.Strings=[],r.Strings.Count=0,r.Strings.Unique=0,V7(r),r.cellXfs=[],qp(r.cellXfs,{},{revssf:{General:0}}),e.Props||(e.Props={});for(var a=0;a<e.SheetNames.length;++a)n[n.length]=ekt(a,r,e);return n.unshift(tkt(e,n,r)),Di(n)}function Epe(e,t){for(var r=0;r<=e.SheetNames.length;++r){var n=e.Sheets[e.SheetNames[r]];if(!(!n||!n["!ref"])){var a=Qo(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 rkt(e,t);case 4:case 3:case 2:return W4t(e,t)}throw new Error("invalid type "+i.bookType+" for BIFF")}function dY(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=zyt(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}},x=[];for(o=0;o<c.length;++o){var p=c[o].trim(),g=p.slice(0,3).toLowerCase();if(g=="<tr"){if(++u,r.sheetRows&&r.sheetRows<=u){--u;break}d=0;continue}if(!(g!="<td"&&g!="<th")){var v=p.split(/<\/t[dh]>/i);for(l=0;l<v.length;++l){var y=v[l].trim();if(y.match(/<t[dh]/i)){for(var b=y,N=0;b.charAt(0)=="<"&&(N=b.indexOf(">"))>-1;)b=b.slice(N+1);for(var j=0;j<x.length;++j){var _=x[j];_.s.c==d&&_.s.r<u&&u<=_.e.r&&(d=_.e.c+1,j=-1)}var S=Mr(y.slice(0,y.indexOf(">")));m=S.colspan?+S.colspan:1,((f=+S.rowspan)>1||m>1)&&x.push({s:{r:u,c:d},e:{r:u+(f||1)-1,c:d+m-1}});var P=S.t||S["data-t"]||"";if(!b.length){d+=m;continue}if(b=rme(b),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),!b.length){d+=m;continue}var T={t:"s",v:b};r.raw||!b.trim().length||P=="s"||(b==="TRUE"?T={t:"b",v:!0}:b==="FALSE"?T={t:"b",v:!1}:isNaN(Yu(b))?isNaN(Xy(b).getDate())||(T={t:"d",v:Gs(b)},r.cellDates||(T={t:"n",v:_i(T.v)}),T.z=r.dateNF||Sr[14]):T={t:"n",v:Yu(b)}),r.dense?(n[u]||(n[u]=[]),n[u][d]=T):n[Or({r:u,c:d})]=T,d+=m}}}}return n["!ref"]=sn(h),x.length&&(n["!merges"]=x),n}function Ape(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=Or({r,c:o}),f=n.dense?(e[r]||[])[o]:e[d],m=f&&f.v!=null&&(f.h||h7(f.w||(af(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($t("td",m,h))}}var x="<tr>";return x+i.join("")+"</tr>"}var Tpe='<html><head><meta charset="utf-8"/><title>SheetJS Table Export</title></head><body>',Ppe="</body></html>";function nkt(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 zp(dY(r[0],t),t);var n=X7();return r.forEach(function(a,i){Y7(n,dY(a,t),"Sheet"+(i+1))}),n}function Ope(e,t,r){var n=[];return n.join("")+"<table"+(r&&r.id?' id="'+r.id+'"':"")+">"}function Dpe(e,t){var r=t||{},n=r.header!=null?r.header:Tpe,a=r.footer!=null?r.footer:Ppe,i=[n],o=Qo(e["!ref"]);r.dense=Array.isArray(e),i.push(Ope(e,o,r));for(var l=o.s.r;l<=o.e.r;++l)i.push(Ape(e,o,l,r));return i.push("</table>"+a),i.join("")}function Ipe(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"?ia(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=Qo(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"]=[]),x=0,p=0,g=0,v=0,y=0,b=0;for(e["!cols"]||(e["!cols"]=[]);x<l.length&&p<c;++x){var N=l[x];if(fY(N)){if(n.display)continue;h[p]={hidden:!0}}var j=N.children;for(g=v=0;g<j.length;++g){var _=j[g];if(!(n.display&&fY(_))){var S=_.hasAttribute("data-v")?_.getAttribute("data-v"):_.hasAttribute("v")?_.getAttribute("v"):rme(_.innerHTML),P=_.getAttribute("data-z")||_.getAttribute("z");for(m=0;m<f.length;++m){var T=f[m];T.s.c==v+i&&T.s.r<p+a&&p+a<=T.e.r&&(v=T.e.c+1-i,m=-1)}b=+_.getAttribute("colspan")||1,((y=+_.getAttribute("rowspan")||1)>1||b>1)&&f.push({s:{r:p+a,c:v+i},e:{r:p+a+(y||1)-1,c:v+i+(b||1)-1}});var R={t:"s",v:S},k=_.getAttribute("data-t")||_.getAttribute("t")||"";S!=null&&(S.length==0?R.t=k||"z":n.raw||S.trim().length==0||k=="s"||(S==="TRUE"?R={t:"b",v:!0}:S==="FALSE"?R={t:"b",v:!1}:isNaN(Yu(S))?isNaN(Xy(S).getDate())||(R={t:"d",v:Gs(S)},n.cellDates||(R={t:"n",v:_i(R.v)}),R.z=n.dateNF||Sr[14]):R={t:"n",v:Yu(S)})),R.z===void 0&&P!=null&&(R.z=P);var E="",q=_.getElementsByTagName("A");if(q&&q.length)for(var O=0;O<q.length&&!(q[O].hasAttribute("href")&&(E=q[O].getAttribute("href"),E.charAt(0)!="#"));++O);E&&E.charAt(0)!="#"&&(R.l={Target:E}),n.dense?(e[p+a]||(e[p+a]=[]),e[p+a][v+i]=R):e[Or({c:v+i,r:p+a})]=R,u.e.c<v+i&&(u.e.c=v+i),v+=b}}++p}return f.length&&(e["!merges"]=(e["!merges"]||[]).concat(f)),u.e.r=Math.max(u.e.r,p-1+a),e["!ref"]=sn(u),p>=c&&(e["!fullref"]=sn((u.e.r=l.length-x+p-1+a,u))),e}function Rpe(e,t){var r=t||{},n=r.dense?[]:{};return Ipe(n,e,t)}function skt(e,t){return zp(Rpe(e,t),t)}function fY(e){var t="",r=akt(e);return r&&(t=r(e).getPropertyValue("display")),t||(t=e.style&&e.style.display),t==="none"}function akt(e){return e.ownerDocument.defaultView&&typeof e.ownerDocument.defaultView.getComputedStyle=="function"?e.ownerDocument.defaultView.getComputedStyle:typeof getComputedStyle=="function"?getComputedStyle:null}function ikt(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=Fn(t.replace(/<[^>]*>/g,""));return[r]}var hY={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 Lpe(e,t){var r=t||{},n=m7(e),a=[],i,o,l={name:""},c="",u=0,d,f,m={},h=[],x=r.dense?[]:{},p,g,v={value:""},y="",b=0,N=[],j=-1,_=-1,S={s:{r:1e6,c:1e7},e:{r:0,c:0}},P=0,T={},R=[],k={},E=0,q=0,O=[],L=1,H=1,V=[],z={Names:[]},M={},B=["",""],K=[],C={},A="",I=0,U=!1,Y=!1,te=0;for(Ej.lastIndex=0,n=n.replace(/<!--([\s\S]*?)-->/mg,"").replace(/<!DOCTYPE[^\[]*\[[^\]]*\]>/gm,"");p=Ej.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?x["!ref"]=sn(S):x["!ref"]="A1:A1",r.sheetRows>0&&r.sheetRows<=S.e.r&&(x["!fullref"]=x["!ref"],S.e.r=r.sheetRows-1,x["!ref"]=sn(S)),R.length&&(x["!merges"]=R),O.length&&(x["!rows"]=O),d.name=d.名称||d.name,typeof JSON<"u"&&JSON.stringify(d),h.push(d.name),m[d.name]=x,Y=!1):p[0].charAt(p[0].length-2)!=="/"&&(d=Mr(p[0],!1),j=_=-1,S.s.r=S.s.c=1e7,S.e.r=S.e.c=0,x=r.dense?[]:{},R=[],O=[],Y=!0);break;case"table-row-group":p[1]==="/"?--P:++P;break;case"table-row":case"行":if(p[1]==="/"){j+=L,L=1;break}if(f=Mr(p[0],!1),f.行号?j=f.行号-1:j==-1&&(j=0),L=+f["number-rows-repeated"]||1,L<10)for(te=0;te<L;++te)P>0&&(O[j+te]={level:P});_=-1;break;case"covered-table-cell":p[1]!=="/"&&++_,r.sheetStubs&&(r.dense?(x[j]||(x[j]=[]),x[j][_]={t:"z"}):x[Or({r:j,c:_})]={t:"z"}),y="",N=[];break;case"table-cell":case"数据":if(p[0].charAt(p[0].length-2)==="/")++_,v=Mr(p[0],!1),H=parseInt(v["number-columns-repeated"]||"1",10),g={t:"z",v:null},v.formula&&r.cellFormula!=!1&&(g.f=lY(Fn(v.formula))),(v.数据类型||v["value-type"])=="string"&&(g.t="s",g.v=Fn(v["string-value"]||""),r.dense?(x[j]||(x[j]=[]),x[j][_]=g):x[Or({r:j,c:_})]=g),_+=H-1;else if(p[1]!=="/"){++_,y="",b=0,N=[],H=1;var re=L?j+L-1:j;if(_>S.e.c&&(S.e.c=_),_<S.s.c&&(S.s.c=_),j<S.s.r&&(S.s.r=j),re>S.e.r&&(S.e.r=re),v=Mr(p[0],!1),K=[],C={},g={t:v.数据类型||v["value-type"],v:null},r.cellFormula)if(v.formula&&(v.formula=Fn(v.formula)),v["number-matrix-columns-spanned"]&&v["number-matrix-rows-spanned"]&&(E=parseInt(v["number-matrix-rows-spanned"],10)||0,q=parseInt(v["number-matrix-columns-spanned"],10)||0,k={s:{r:j,c:_},e:{r:j+E-1,c:_+q-1}},g.F=sn(k),V.push([k,g.F])),v.formula)g.f=lY(v.formula);else for(te=0;te<V.length;++te)j>=V[te][0].s.r&&j<=V[te][0].e.r&&_>=V[te][0].s.c&&_<=V[te][0].e.c&&(g.F=V[te][1]);switch((v["number-columns-spanned"]||v["number-rows-spanned"])&&(E=parseInt(v["number-rows-spanned"],10)||0,q=parseInt(v["number-columns-spanned"],10)||0,k={s:{r:j,c:_},e:{r:j+E-1,c:_+q-1}},R.push(k)),v["number-columns-repeated"]&&(H=parseInt(v["number-columns-repeated"],10)),g.t){case"boolean":g.t="b",g.v=qs(v["boolean-value"]);break;case"float":g.t="n",g.v=parseFloat(v.value);break;case"percentage":g.t="n",g.v=parseFloat(v.value);break;case"currency":g.t="n",g.v=parseFloat(v.value);break;case"date":g.t="d",g.v=Gs(v["date-value"]),r.cellDates||(g.t="n",g.v=_i(g.v)),g.z="m/d/yy";break;case"time":g.t="n",g.v=Myt(v["time-value"])/86400,r.cellDates&&(g.t="d",g.v=CA(g.v)),g.z="HH:MM:SS";break;case"number":g.t="n",g.v=parseFloat(v.数据数值);break;default:if(g.t==="string"||g.t==="text"||!g.t)g.t="s",v["string-value"]!=null&&(y=Fn(v["string-value"]),N=[]);else throw new Error("Unsupported value type "+g.t)}}else{if(U=!1,g.t==="s"&&(g.v=y||"",N.length&&(g.R=N),U=b==0),M.Target&&(g.l=M),K.length>0&&(g.c=K,K=[]),y&&r.cellText!==!1&&(g.w=y),U&&(g.t="z",delete g.v),(!U||r.sheetStubs)&&!(r.sheetRows&&r.sheetRows<=j))for(var J=0;J<L;++J){if(H=parseInt(v["number-columns-repeated"]||"1",10),r.dense)for(x[j+J]||(x[j+J]=[]),x[j+J][_]=J==0?g:js(g);--H>0;)x[j+J][_+H]=js(g);else for(x[Or({r:j+J,c:_})]=g;--H>0;)x[Or({r:j+J,c:_+H})]=js(g);S.e.c<=_&&(S.e.c=_)}H=parseInt(v["number-columns-repeated"]||"1",10),_+=H-1,H=0,g={},y="",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;C.t=y,N.length&&(C.R=N),C.a=A,K.push(C)}else p[0].charAt(p[0].length-2)!=="/"&&a.push([p[3],!1]);A="",I=0,y="",b=0,N=[];break;case"creator":p[1]==="/"?A=n.slice(I,p.index):I=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]);y="",b=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(T[l.name]=c,(i=a.pop())[0]!==p[3])throw"Bad state: "+i}else p[0].charAt(p[0].length-2)!=="/"&&(c="",l=Mr(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=Mr(p[0],!1),c+=hY[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=Mr(p[0],!1),c+=hY[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=Mr(p[0],!1),B=tO(o["cell-range-address"]);var ie={Name:o.name,Ref:B[0]+"!"+B[1]};Y&&(ie.Sheet=h.length),z.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 be=ikt(n.slice(b,p.index));y=(y.length>0?y+`
`:"")+be[0]}else Mr(p[0],!1),b=p.index+p[0].length;break;case"s":break;case"database-range":if(p[1]==="/")break;try{B=tO(Mr(p[0])["target-range-address"]),m[B[0]]["!autofilter"]={ref:B[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=Mr(p[0],!1),!M.href)break;M.Target=Fn(M.href),delete M.href,M.Target.charAt(0)=="#"&&M.Target.indexOf(".")>-1?(B=tO(M.Target.slice(1)),M.Target="#"+B[0]+"!"+B[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 Q={Sheets:m,SheetNames:h,Workbook:z};return r.bookSheets&&delete Q.Sheets,Q}function mY(e,t){t=t||{},Ac(e,"META-INF/manifest.xml")&&M1t(Ga(e,"META-INF/manifest.xml"),t);var r=Zl(e,"content.xml");if(!r)throw new Error("Missing content.xml in ODS / UOF file");var n=Lpe(hs(r),t);return Ac(e,"meta.xml")&&(n.Props=jme(Ga(e,"meta.xml"))),n}function pY(e,t){return Lpe(e,t)}var okt=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 "+Cj({"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 $a+t}}(),xY=function(){var e=function(i){return ls(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="'+ls(o.SheetNames[l])+`" table:style-name="ta1">
`);var u=0,d=0,f=Qo(i["!ref"]||"A1"),m=i["!merges"]||[],h=0,x=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="",g=i["!rows"]||[];for(u=0;u<f.s.r;++u)p=g[u]?' table:style-name="ro'+g[u].ods+'"':"",c.push(" <table:table-row"+p+`></table:table-row>
`);for(;u<=f.e.r;++u){for(p=g[u]?' table:style-name="ro'+g[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,y={},b="";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),y["table:number-columns-spanned"]=m[h].e.c-m[h].s.c+1,y["table:number-rows-spanned"]=m[h].e.r-m[h].s.r+1;break}if(v){c.push(r);continue}var N=Or({r:u,c:d}),j=x?(i[u]||[])[d]:i[N];if(j&&j.f&&(y["table:formula"]=ls(ONt(j.f)),j.F&&j.F.slice(0,N.length)==N)){var _=Qo(j.F);y["table:number-matrix-columns-spanned"]=_.e.c-_.s.c+1,y["table:number-matrix-rows-spanned"]=_.e.r-_.s.r+1}if(!j){c.push(t);continue}switch(j.t){case"b":b=j.v?"TRUE":"FALSE",y["office:value-type"]="boolean",y["office:boolean-value"]=j.v?"true":"false";break;case"n":b=j.w||String(j.v||0),y["office:value-type"]="float",y["office:value"]=j.v||0;break;case"s":case"str":b=j.v==null?"":j.v,y["office:value-type"]="string";break;case"d":b=j.w||Gs(j.v).toISOString(),y["office:value-type"]="date",y["office:date-value"]=Gs(j.v).toISOString(),y["table:style-name"]="ce1";break;default:c.push(t);continue}var S=e(b);if(j.l&&j.l.Target){var P=j.l.Target;P=P.charAt(0)=="#"?"#"+DNt(P.slice(1)):P,P.charAt(0)!="#"&&!P.match(/^\w+:/)&&(P="../"+P),S=$t("text:a",S,{"xlink:href":P.replace(/&/g,"&")})}c.push(" "+$t("table:table-cell",$t("text:p",S,{}),y)+`
`)}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;yp(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=[$a],u=Cj({"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=Cj({"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(wme().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 Fpe(e,t){if(t.bookType=="fods")return xY(e,t);var r=u7(),n="",a=[],i=[];return n="mimetype",un(r,n,"application/vnd.oasis.opendocument.spreadsheet"),n="content.xml",un(r,n,xY(e,t)),a.push([n,"text/xml"]),i.push([n,"ContentFile"]),n="styles.xml",un(r,n,okt(e,t)),a.push([n,"text/xml"]),i.push([n,"StylesFile"]),n="meta.xml",un(r,n,$a+wme()),a.push([n,"text/xml"]),i.push([n,"MetadataFile"]),n="manifest.rdf",un(r,n,z1t(i)),a.push([n,"application/rdf+xml"]),n="META-INF/manifest.xml",un(r,n,$1t(a)),r}/*! sheetjs (C) 2013-present SheetJS -- http://sheetjs.com */function F0(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function OI(e){return typeof TextDecoder<"u"?new TextDecoder().decode(e):hs(Bp(e))}function lkt(e){return typeof TextEncoder<"u"?new TextEncoder().encode(e):Yl(Wd(e))}function ckt(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 wp(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 gY(e){return e-=e>>1&1431655765,e=(e&858993459)+(e>>2&858993459),(e+(e>>4)&252645135)*16843009>>>24}function ukt(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 dkt(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 Rj(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 ss(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 ja(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 Bn(e){for(var t=[],r=[0];r[0]<e.length;){var n=r[0],a=Rj(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=Rj(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 Gi(e){var t=[];return e.forEach(function(r,n){r.forEach(function(a){a.data&&(t.push(ss(n*8+a.type)),a.type==2&&t.push(ss(a.data.length)),t.push(a.data))})}),wp(t)}function q7(e,t){return(e==null?void 0:e.map(function(r){return t(r.data)}))||[]}function Cc(e){for(var t,r=[],n=[0];n[0]<e.length;){var a=Rj(e,n),i=Bn(e.slice(n[0],n[0]+a));n[0]+=a;var o={id:ja(i[1][0].data),messages:[]};i[2].forEach(function(l){var c=Bn(l.data),u=ja(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=ja(i[3][0].data)>>>0>0),r.push(o)}return r}function qg(e){var t=[];return e.forEach(function(r){var n=[];n[1]=[{data:ss(r.id),type:0}],n[2]=[],r.merge!=null&&(n[3]=[{data:ss(+!!r.merge),type:0}]);var a=[];r.messages.forEach(function(o){a.push(o.data),o.meta[3]=[{type:0,data:ss(o.data.length)}],n[2].push({data:Gi(o.meta),type:2})});var i=Gi(n);t.push(ss(i.length)),t.push(i),a.forEach(function(o){return t.push(o)})}),wp(t)}function fkt(e,t){if(e!=0)throw new Error("Unexpected Snappy chunk type ".concat(e));for(var r=[0],n=Rj(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=[wp(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=wp(a);if(d.length!=n)throw new Error("Unexpected length: ".concat(d.length," != ").concat(n));return d}function Ec(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(fkt(n,e.slice(r,r+a))),r+=a}if(r!==e.length)throw new Error("data is not a valid framed stream!");return wp(t)}function Ug(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=ss(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 wp(t)}function hkt(e,t,r,n){var a=F0(e),i=a.getUint32(4,!0),o=(n>1?12:8)+gY(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+=gY(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 mkt(e,t,r){var n=F0(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=ukt(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 nO(e,t){var r=new Uint8Array(32),n=F0(r),a=12,i=0;switch(r[0]=5,e.t){case"n":r[1]=2,dkt(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 sO(e,t){var r=new Uint8Array(32),n=F0(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 pkt(e,t,r){switch(e[0]){case 0:case 1:case 2:case 3:return hkt(e,t,r,e[0]);case 5:return mkt(e,t,r);default:throw new Error("Unsupported payload version ".concat(e[0]))}}function go(e){var t=Bn(e);return Rj(t[1][0].data)}function vY(e,t){var r=Bn(t.data),n=ja(r[1][0].data),a=r[3],i=[];return(a||[]).forEach(function(o){var l=Bn(o.data),c=ja(l[1][0].data)>>>0;switch(n){case 1:i[c]=OI(l[3][0].data);break;case 8:{var u=e[go(l[9][0].data)][0],d=Bn(u.data),f=e[go(d[1][0].data)][0],m=ja(f.meta[1][0].data);if(m!=2001)throw new Error("2000 unexpected reference to ".concat(m));var h=Bn(f.data);i[c]=h[3].map(function(x){return OI(x.data)}).join("")}break}}),i}function xkt(e,t){var r,n,a,i,o,l,c,u,d,f,m,h,x,p,g=Bn(e),v=ja(g[1][0].data)>>>0,y=ja(g[2][0].data)>>>0,b=((n=(r=g[8])==null?void 0:r[0])==null?void 0:n.data)&&ja(g[8][0].data)>0||!1,N,j;if((i=(a=g[7])==null?void 0:a[0])!=null&&i.data&&t!=0)N=(l=(o=g[7])==null?void 0:o[0])==null?void 0:l.data,j=(u=(c=g[6])==null?void 0:c[0])==null?void 0:u.data;else if((f=(d=g[4])==null?void 0:d[0])!=null&&f.data&&t!=1)N=(h=(m=g[4])==null?void 0:m[0])==null?void 0:h.data,j=(p=(x=g[3])==null?void 0:x[0])==null?void 0:p.data;else throw"NUMBERS Tile missing ".concat(t," cell storage");for(var _=b?4:1,S=F0(N),P=[],T=0;T<N.length/2;++T){var R=S.getUint16(T*2,!0);R<65535&&P.push([T,R])}if(P.length!=y)throw"Expected ".concat(y," cells, found ").concat(P.length);var k=[];for(T=0;T<P.length-1;++T)k[P[T][0]]=j.subarray(P[T][1]*_,P[T+1][1]*_);return P.length>=1&&(k[P[P.length-1][0]]=j.subarray(P[P.length-1][1]*_)),{R:v,cells:k}}function gkt(e,t){var r,n=Bn(t.data),a=(r=n==null?void 0:n[7])!=null&&r[0]?ja(n[7][0].data)>>>0>0?1:0:-1,i=q7(n[5],function(o){return xkt(o,a)});return{nrows:ja(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 vkt(e,t,r){var n,a=Bn(t.data),i={s:{r:0,c:0},e:{r:0,c:0}};if(i.e.r=(ja(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=(ja(a[7][0].data)>>>0)-1,i.e.c<0)throw new Error("Invalid col varint ".concat(a[7][0].data));r["!ref"]=sn(i);var o=Bn(a[4][0].data),l=vY(e,e[go(o[4][0].data)][0]),c=(n=o[17])!=null&&n[0]?vY(e,e[go(o[17][0].data)][0]):[],u=Bn(o[3][0].data),d=0;u[1].forEach(function(f){var m=Bn(f.data),h=e[go(m[2][0].data)][0],x=ja(h.meta[1][0].data);if(x!=6002)throw new Error("6001 unexpected reference to ".concat(x));var p=gkt(e,h);p.data.forEach(function(g,v){g.forEach(function(y,b){var N=Or({r:d+v,c:b}),j=pkt(y,l,c);j&&(r[N]=j)})}),d+=p.nrows})}function ykt(e,t){var r=Bn(t.data),n={"!ref":"A1"},a=e[go(r[2][0].data)],i=ja(a[0].meta[1][0].data);if(i!=6001)throw new Error("6000 unexpected reference to ".concat(i));return vkt(e,a[0],n),n}function bkt(e,t){var r,n=Bn(t.data),a={name:(r=n[1])!=null&&r[0]?OI(n[1][0].data):"",sheets:[]},i=q7(n[2],go);return i.forEach(function(o){e[o].forEach(function(l){var c=ja(l.meta[1][0].data);c==6e3&&a.sheets.push(ykt(e,l))})}),a}function wkt(e,t){var r=X7(),n=Bn(t.data),a=q7(n[1],go);if(a.forEach(function(i){e[i].forEach(function(o){var l=ja(o.meta[1][0].data);if(l==2){var c=bkt(e,o);c.sheets.forEach(function(u,d){Y7(r,u,d==0?c.name:c.name+"_"+d,!0)})}})}),r.SheetNames.length==0)throw new Error("Empty NUMBERS file");return r}function aO(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=Ec(c.content)}catch(f){return console.log("?? "+c.content.length+" "+(f.message||f))}var d;try{d=Cc(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)&&ja(i[1][0].meta[1][0].data)==1&&i[1][0];if(l||o.forEach(function(c){i[c].forEach(function(u){var d=ja(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 wkt(i,l)}function jkt(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)&&ja(e[8][0].data)>0||!1;if(l)throw"Math only works with normal offsets";for(var c=0,u=F0(e[7][0].data),d=0,f=[],m=F0(e[4][0].data),h=0,x=[],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 g,v;switch(typeof t[p]){case"string":g=nO({t:"s",v:t[p]},r),v=sO({t:"s",v:t[p]},r);break;case"number":g=nO({t:"n",v:t[p]},r),v=sO({t:"n",v:t[p]},r);break;case"boolean":g=nO({t:"b",v:t[p]},r),v=sO({t:"b",v:t[p]},r);break;default:throw new Error("Unsupported value "+t[p])}f.push(g),d+=g.length,x.push(v),h+=v.length,++c}for(e[2][0].data=ss(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=wp(f),e[3][0].data=wp(x),c}function _kt(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=Qo(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(sn(n)));var i=Zk(r,{range:n,header:1}),o=["~Sh33tJ5~"];i.forEach(function(A){return A.forEach(function(I){typeof I=="string"&&o.push(I)})});var l={},c=[],u=jr.read(t.numbers,{type:"base64"});u.FileIndex.map(function(A,I){return[A,u.FullPaths[I]]}).forEach(function(A){var I=A[0],U=A[1];if(I.type==2&&I.name.match(/\.iwa/)){var Y=I.content,te=Ec(Y),re=Cc(te);re.forEach(function(J){c.push(J.id),l[J.id]={deps:[],location:U,type:ja(J.messages[0].meta[1][0].data)}})}}),c.sort(function(A,I){return A-I});var d=c.filter(function(A){return A>1}).map(function(A){return[A,ss(A)]});u.FileIndex.map(function(A,I){return[A,u.FullPaths[I]]}).forEach(function(A){var I=A[0];if(A[1],!!I.name.match(/\.iwa/)){var U=Cc(Ec(I.content));U.forEach(function(Y){Y.messages.forEach(function(te){d.forEach(function(re){Y.messages.some(function(J){return ja(J.meta[1][0].data)!=11006&&ckt(J.data,re[1])})&&l[re[0]].deps.push(Y.id)})})})}});for(var f=jr.find(u,l[1].location),m=Cc(Ec(f.content)),h,x=0;x<m.length;++x){var p=m[x];p.id==1&&(h=p)}var g=go(Bn(h.messages[0].data)[1][0].data);for(f=jr.find(u,l[g].location),m=Cc(Ec(f.content)),x=0;x<m.length;++x)p=m[x],p.id==g&&(h=p);for(g=go(Bn(h.messages[0].data)[2][0].data),f=jr.find(u,l[g].location),m=Cc(Ec(f.content)),x=0;x<m.length;++x)p=m[x],p.id==g&&(h=p);for(g=go(Bn(h.messages[0].data)[2][0].data),f=jr.find(u,l[g].location),m=Cc(Ec(f.content)),x=0;x<m.length;++x)p=m[x],p.id==g&&(h=p);var v=Bn(h.messages[0].data);{v[6][0].data=ss(n.e.r+1),v[7][0].data=ss(n.e.c+1);var y=go(v[46][0].data),b=jr.find(u,l[y].location),N=Cc(Ec(b.content));{for(var j=0;j<N.length&&N[j].id!=y;++j);if(N[j].id!=y)throw"Bad ColumnRowUIDMapArchive";var _=Bn(N[j].messages[0].data);_[1]=[],_[2]=[],_[3]=[];for(var S=0;S<=n.e.c;++S){var P=[];P[1]=P[2]=[{type:0,data:ss(S+420690)}],_[1].push({type:2,data:Gi(P)}),_[2].push({type:0,data:ss(S)}),_[3].push({type:0,data:ss(S)})}_[4]=[],_[5]=[],_[6]=[];for(var T=0;T<=n.e.r;++T)P=[],P[1]=P[2]=[{type:0,data:ss(T+726270)}],_[4].push({type:2,data:Gi(P)}),_[5].push({type:0,data:ss(T)}),_[6].push({type:0,data:ss(T)});N[j].messages[0].data=Gi(_)}b.content=Ug(qg(N)),b.size=b.content.length,delete v[46];var R=Bn(v[4][0].data);{R[7][0].data=ss(n.e.r+1);var k=Bn(R[1][0].data),E=go(k[2][0].data);b=jr.find(u,l[E].location),N=Cc(Ec(b.content));{if(N[0].id!=E)throw"Bad HeaderStorageBucket";var q=Bn(N[0].messages[0].data);for(T=0;T<i.length;++T){var O=Bn(q[2][0].data);O[1][0].data=ss(T),O[4][0].data=ss(i[T].length),q[2][T]={type:q[2][0].type,data:Gi(O)}}N[0].messages[0].data=Gi(q)}b.content=Ug(qg(N)),b.size=b.content.length;var L=go(R[2][0].data);b=jr.find(u,l[L].location),N=Cc(Ec(b.content));{if(N[0].id!=L)throw"Bad HeaderStorageBucket";for(q=Bn(N[0].messages[0].data),S=0;S<=n.e.c;++S)O=Bn(q[2][0].data),O[1][0].data=ss(S),O[4][0].data=ss(n.e.r+1),q[2][S]={type:q[2][0].type,data:Gi(O)};N[0].messages[0].data=Gi(q)}b.content=Ug(qg(N)),b.size=b.content.length;var H=go(R[4][0].data);(function(){for(var A=jr.find(u,l[H].location),I=Cc(Ec(A.content)),U,Y=0;Y<I.length;++Y){var te=I[Y];te.id==H&&(U=te)}var re=Bn(U.messages[0].data);{re[3]=[];var J=[];o.forEach(function(Q,Ve){J[1]=[{type:0,data:ss(Ve)}],J[2]=[{type:0,data:ss(1)}],J[3]=[{type:2,data:lkt(Q)}],re[3].push({type:2,data:Gi(J)})})}U.messages[0].data=Gi(re);var ie=qg(I),be=Ug(ie);A.content=be,A.size=A.content.length})();var V=Bn(R[3][0].data);{var z=V[1][0];delete V[2];var M=Bn(z.data);{var B=go(M[2][0].data);(function(){for(var A=jr.find(u,l[B].location),I=Cc(Ec(A.content)),U,Y=0;Y<I.length;++Y){var te=I[Y];te.id==B&&(U=te)}var re=Bn(U.messages[0].data);{delete re[6],delete V[7];var J=new Uint8Array(re[5][0].data);re[5]=[];for(var ie=0,be=0;be<=n.e.r;++be){var Q=Bn(J);ie+=jkt(Q,i[be],o),Q[1][0].data=ss(be),re[5].push({data:Gi(Q),type:2})}re[1]=[{type:0,data:ss(n.e.c+1)}],re[2]=[{type:0,data:ss(n.e.r+1)}],re[3]=[{type:0,data:ss(ie)}],re[4]=[{type:0,data:ss(n.e.r+1)}]}U.messages[0].data=Gi(re);var Ve=qg(I),W=Ug(Ve);A.content=W,A.size=A.content.length})()}z.data=Gi(M)}R[3][0].data=Gi(V)}v[4][0].data=Gi(R)}h.messages[0].data=Gi(v);var K=qg(m),C=Ug(K);return f.content=C,f.size=f.content.length,u}function Mpe(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 U7(e){Mpe([["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 V7(e){Mpe([["cellDates",!1],["bookSST",!1],["bookType","xlsx"],["compression",!1],["WTF",!1]])(e)}function Nkt(e){return xn.WS.indexOf(e)>-1?"sheet":e==xn.CS?"chart":e==xn.DS?"dialog":e==xn.MS?"macro":e&&e.length?e:"sheet"}function Skt(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,Nkt(e["!id"][n.id].Type)]})}catch{return null}return!e||e.length===0?null:e}function kkt(e,t,r,n,a,i,o,l,c,u,d,f){try{i[n]=Xw(Zl(e,r,!0),t);var m=Ga(e,t),h;switch(l){case"sheet":h=J5t(m,t,a,c,i[n],u,d,f);break;case"chart":if(h=Q5t(m,t,a,c,i[n],u,d,f),!h||!h["!drawel"])break;var x=dw(h["!drawel"].Target,t),p=Aj(x),g=Bjt(Zl(e,x,!0),Xw(Zl(e,p,!0),x)),v=dw(g,x),y=Aj(v);h=C5t(Zl(e,v,!0),v,c,Xw(Zl(e,y,!0),v),u,h);break;case"macro":h=e4t(m,t,a,c,i[n],u,d,f);break;case"dialog":h=t4t(m,t,a,c,i[n],u,d,f);break;default:throw new Error("Unrecognized sheet type "+l)}o[n]=h;var b=[];i&&i[n]&&ka(i[n]).forEach(function(N){var j="";if(i[n][N].Type==xn.CMNT){j=dw(i[n][N].Target,t);var _=a4t(Ga(e,j,!0),j,c);if(!_||!_.length)return;nY(h,_,!1)}i[n][N].Type==xn.TCMNT&&(j=dw(i[n][N].Target,t),b=b.concat(qjt(Ga(e,j,!0),c)))}),b&&b.length&&nY(h,b,!0,c.people||[])}catch(N){if(c.WTF)throw N}}function Sc(e){return e.charAt(0)=="/"?e.slice(1):e}function $pe(e,t){if(U1(),t=t||{},U7(t),Ac(e,"META-INF/manifest.xml")||Ac(e,"objectdata.xml"))return mY(e,t);if(Ac(e,"Index/Document.iwa")){if(typeof Uint8Array>"u")throw new Error("NUMBERS file parsing requires Uint8Array support");if(typeof aO<"u"){if(e.FileIndex)return aO(e);var r=jr.utils.cfb_new();return NX(e).forEach(function(O){un(r,O,Uyt(e,O))}),aO(r)}throw new Error("Unsupported NUMBERS file")}if(!Ac(e,"[Content_Types].xml"))throw Ac(e,"index.xml.gz")?new Error("Unsupported NUMBERS 08 file"):Ac(e,"index.xml")?new Error("Unsupported NUMBERS 09 file"):new Error("Unsupported ZIP file");var n=NX(e),a=L1t(Zl(e,"[Content_Types].xml")),i=!1,o,l;if(a.workbooks.length===0&&(l="xl/workbook.xml",Ga(e,l,!0)&&a.workbooks.push(l)),a.workbooks.length===0){if(l="xl/workbook.bin",!Ga(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(Yw=[],a.sst)try{Yw=s4t(Ga(e,Sc(a.sst)),a.sst,t)}catch(O){if(t.WTF)throw O}t.cellStyles&&a.themes.length&&(c=n4t(Zl(e,a.themes[0].replace(/^\//,""),!0)||"",a.themes[0],t)),a.style&&(u=r4t(Ga(e,Sc(a.style)),a.style,c,t))}a.links.map(function(O){try{var L=Xw(Zl(e,Aj(Sc(O))),O);return o4t(Ga(e,Sc(O)),L,O,t)}catch{}});var d=Z5t(Ga(e,Sc(a.workbooks[0])),a.workbooks[0],t),f={},m="";a.coreprops.length&&(m=Ga(e,Sc(a.coreprops[0]),!0),m&&(f=jme(m)),a.extprops.length!==0&&(m=Ga(e,Sc(a.extprops[0]),!0),m&&U1t(m,f,t)));var h={};(!t.bookSheets||t.bookProps)&&a.custprops.length!==0&&(m=Zl(e,Sc(a.custprops[0]),!0),m&&(h=H1t(m,t)));var x={};if((t.bookSheets||t.bookProps)&&(d.Sheets?o=d.Sheets.map(function(L){return L.name}):f.Worksheets&&f.SheetNames.length>0&&(o=f.SheetNames),t.bookProps&&(x.Props=f,x.Custprops=h),t.bookSheets&&typeof o<"u"&&(x.SheetNames=o),t.bookSheets?x.SheetNames:t.bookProps))return x;o={};var p={};t.bookDeps&&a.calcchain&&(p=i4t(Ga(e,Sc(a.calcchain)),a.calcchain));var g=0,v={},y,b;{var N=d.Sheets;f.Worksheets=N.length,f.SheetNames=[];for(var j=0;j!=N.length;++j)f.SheetNames[j]=N[j].name}var _=i?"bin":"xml",S=a.workbooks[0].lastIndexOf("/"),P=(a.workbooks[0].slice(0,S+1)+"_rels/"+a.workbooks[0].slice(S+1)+".rels").replace(/^\//,"");Ac(e,P)||(P="xl/_rels/workbook."+_+".rels");var T=Xw(Zl(e,P,!0),P.replace(/_rels.*/,"s5s"));(a.metadata||[]).length>=1&&(t.xlmeta=l4t(Ga(e,Sc(a.metadata[0])),a.metadata[0],t)),(a.people||[]).length>=1&&(t.people=Vjt(Ga(e,Sc(a.people[0])),t)),T&&(T=Skt(T,d.Sheets));var R=Ga(e,"xl/worksheets/sheet.xml",!0)?1:0;e:for(g=0;g!=f.Worksheets;++g){var k="sheet";if(T&&T[g]?(y="xl/"+T[g][1].replace(/[\/]?xl\//,""),Ac(e,y)||(y=T[g][1]),Ac(e,y)||(y=P.replace(/_rels\/.*$/,"")+T[g][1]),k=T[g][2]):(y="xl/worksheets/sheet"+(g+1-R)+"."+_,y=y.replace(/sheet0\./,"sheet.")),b=y.replace(/^(.*)(\/)([^\/]*)$/,"$1/_rels/$3.rels"),t&&t.sheets!=null)switch(typeof t.sheets){case"number":if(g!=t.sheets)continue e;break;case"string":if(f.SheetNames[g].toLowerCase()!=t.sheets.toLowerCase())continue e;break;default:if(Array.isArray&&Array.isArray(t.sheets)){for(var E=!1,q=0;q!=t.sheets.length;++q)typeof t.sheets[q]=="number"&&t.sheets[q]==g&&(E=1),typeof t.sheets[q]=="string"&&t.sheets[q].toLowerCase()==f.SheetNames[g].toLowerCase()&&(E=1);if(!E)continue e}}kkt(e,y,b,f.SheetNames[g],g,v,o,k,t,d,c,u)}return x={Directory:a,Workbook:d,Props:f,Custprops:h,Deps:p,Sheets:o,SheetNames:f.SheetNames,Strings:Yw,Styles:u,Themes:c,SSF:js(Sr)},t&&t.bookFiles&&(e.files?(x.keys=n,x.files=e.files):(x.keys=[],x.files={},e.FullPaths.forEach(function(O,L){O=O.replace(/^Root Entry[\/]/,""),x.keys.push(O),x.files[O]=e.FileIndex[L]}))),t&&t.bookVBA&&(a.vba.length>0?x.vbaraw=Ga(e,Sc(a.vba[0]),!0):a.defaults&&a.defaults.bin===Jjt&&(x.vbaraw=Ga(e,"xl/vbaProject.bin",!0))),x}function Ckt(e,t){var r=t||{},n="Workbook",a=jr.find(e,n);try{if(n="/!DataSpaces/Version",a=jr.find(e,n),!a||!a.content)throw new Error("ECMA-376 Encrypted file missing "+n);if(c2t(a.content),n="/!DataSpaces/DataSpaceMap",a=jr.find(e,n),!a||!a.content)throw new Error("ECMA-376 Encrypted file missing "+n);var i=d2t(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=jr.find(e,n),!a||!a.content)throw new Error("ECMA-376 Encrypted file missing "+n);var o=f2t(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=jr.find(e,n),!a||!a.content)throw new Error("ECMA-376 Encrypted file missing "+n);m2t(a.content)}catch{}if(n="/EncryptionInfo",a=jr.find(e,n),!a||!a.content)throw new Error("ECMA-376 Encrypted file missing "+n);var l=p2t(a.content);if(n="/EncryptedPackage",a=jr.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 Ekt(e,t){return t.bookType=="ods"?Fpe(e,t):t.bookType=="numbers"?_kt(e,t):t.bookType=="xlsb"?Akt(e,t):Bpe(e,t)}function Akt(e,t){yv=1024,e&&!e.SSF&&(e.SSF=js(Sr)),e&&e.SSF&&(U1(),O_(e.SSF),t.revssf=kA(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,Zw?t.revStrings=new Map:(t.revStrings={},t.revStrings.foo=[],delete t.revStrings.foo);var r=t.bookType=="xlsb"?"bin":"xml",n=ope.indexOf(t.bookType)>-1,a=E7();V7(t=t||{});var i=u7(),o="",l=0;if(t.cellXfs=[],qp(t.cellXfs,{},{revssf:{General:0}}),e.Props||(e.Props={}),o="docProps/core.xml",un(i,o,_me(e.Props,t)),a.coreprops.push(o),is(t.rels,2,o,xn.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,kme(e.Props)),a.extprops.push(o),is(t.rels,3,o,xn.EXT_PROPS),e.Custprops!==e.Props&&ka(e.Custprops||{}).length>0&&(o="docProps/custom.xml",un(i,o,Cme(e.Custprops)),a.custprops.push(o),is(t.rels,4,o,xn.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,u4t(l-1,o,t,e,d)),a.sheets.push(o),is(t.wbrels,-1,"worksheets/sheet"+l+"."+r,xn.WS[0])}if(f){var h=f["!comments"],x=!1,p="";h&&h.length>0&&(p="xl/comments"+l+"."+r,un(i,p,h4t(h,p)),a.comments.push(p),is(d,-1,"../comments"+l+"."+r,xn.CMNT),x=!0),f["!legacy"]&&x&&un(i,"xl/drawings/vmlDrawing"+l+".vml",ape(l,f["!comments"])),delete f["!comments"],delete f["!legacy"]}d["!id"].rId1&&un(i,Aj(o),qv(d))}return t.Strings!=null&&t.Strings.length>0&&(o="xl/sharedStrings."+r,un(i,o,f4t(t.Strings,o,t)),a.strs.push(o),is(t.wbrels,-1,"sharedStrings."+r,xn.SST)),o="xl/workbook."+r,un(i,o,c4t(e,o)),a.workbooks.push(o),is(t.rels,1,o,xn.WB),o="xl/theme/theme1.xml",un(i,o,I7(e.Themes,t)),a.themes.push(o),is(t.wbrels,-1,"theme/theme1.xml",xn.THEME),o="xl/styles."+r,un(i,o,d4t(e,o,t)),a.styles.push(o),is(t.wbrels,-1,"styles."+r,xn.STY),e.vbaraw&&n&&(o="xl/vbaProject.bin",un(i,o,e.vbaraw),a.vba.push(o),is(t.wbrels,-1,"vbaProject.bin",xn.VBA)),o="xl/metadata."+r,un(i,o,m4t(o)),a.metadata.push(o),is(t.wbrels,-1,"metadata."+r,xn.XLMETA),un(i,"[Content_Types].xml",bme(a,t)),un(i,"_rels/.rels",qv(t.rels)),un(i,"xl/_rels/workbook."+r+".rels",qv(t.wbrels)),delete t.revssf,delete t.ssf,i}function Bpe(e,t){yv=1024,e&&!e.SSF&&(e.SSF=js(Sr)),e&&e.SSF&&(U1(),O_(e.SSF),t.revssf=kA(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,Zw?t.revStrings=new Map:(t.revStrings={},t.revStrings.foo=[],delete t.revStrings.foo);var r="xml",n=ope.indexOf(t.bookType)>-1,a=E7();V7(t=t||{});var i=u7(),o="",l=0;if(t.cellXfs=[],qp(t.cellXfs,{},{revssf:{General:0}}),e.Props||(e.Props={}),o="docProps/core.xml",un(i,o,_me(e.Props,t)),a.coreprops.push(o),is(t.rels,2,o,xn.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,kme(e.Props)),a.extprops.push(o),is(t.rels,3,o,xn.EXT_PROPS),e.Custprops!==e.Props&&ka(e.Custprops||{}).length>0&&(o="docProps/custom.xml",un(i,o,Cme(e.Custprops)),a.custprops.push(o),is(t.rels,4,o,xn.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,vpe(l-1,t,e,f)),a.sheets.push(o),is(t.wbrels,-1,"worksheets/sheet"+l+"."+r,xn.WS[0])}if(m){var x=m["!comments"],p=!1,g="";if(x&&x.length>0){var v=!1;x.forEach(function(y){y[1].forEach(function(b){b.T==!0&&(v=!0)})}),v&&(g="xl/threadedComments/threadedComment"+l+"."+r,un(i,g,Ujt(x,d,t)),a.threadedcomments.push(g),is(f,-1,"../threadedComments/threadedComment"+l+"."+r,xn.TCMNT)),g="xl/comments"+l+"."+r,un(i,g,ipe(x)),a.comments.push(g),is(f,-1,"../comments"+l+"."+r,xn.CMNT),p=!0}m["!legacy"]&&p&&un(i,"xl/drawings/vmlDrawing"+l+".vml",ape(l,m["!comments"])),delete m["!comments"],delete m["!legacy"]}f["!id"].rId1&&un(i,Aj(o),qv(f))}return t.Strings!=null&&t.Strings.length>0&&(o="xl/sharedStrings."+r,un(i,o,Gme(t.Strings,t)),a.strs.push(o),is(t.wbrels,-1,"sharedStrings."+r,xn.SST)),o="xl/workbook."+r,un(i,o,Npe(e)),a.workbooks.push(o),is(t.rels,1,o,xn.WB),o="xl/theme/theme1.xml",un(i,o,I7(e.Themes,t)),a.themes.push(o),is(t.wbrels,-1,"theme/theme1.xml",xn.THEME),o="xl/styles."+r,un(i,o,tpe(e,t)),a.styles.push(o),is(t.wbrels,-1,"styles."+r,xn.STY),e.vbaraw&&n&&(o="xl/vbaProject.bin",un(i,o,e.vbaraw),a.vba.push(o),is(t.wbrels,-1,"vbaProject.bin",xn.VBA)),o="xl/metadata."+r,un(i,o,spe()),a.metadata.push(o),is(t.wbrels,-1,"metadata."+r,xn.XLMETA),d.length>1&&(o="xl/persons/person.xml",un(i,o,Hjt(d)),a.people.push(o),is(t.wbrels,-1,"persons/person.xml",xn.PEOPLE)),un(i,"[Content_Types].xml",bme(a,t)),un(i,"_rels/.rels",qv(t.rels)),un(i,"xl/_rels/workbook."+r+".rels",qv(t.wbrels)),delete t.revssf,delete t.ssf,i}function H7(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=uc(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 Tkt(e,t){return jr.find(e,"EncryptedPackage")?Ckt(e,t):z7(e,t)}function Pkt(e,t){var r,n=e,a=t||{};return a.type||(a.type=pn&&Buffer.isBuffer(e)?"buffer":"base64"),r=Qhe(n,a),$pe(r,a)}function zpe(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 TI(e.slice(r),t);default:break e}return Yy.to_workbook(e,t)}function Okt(e,t){var r="",n=H7(e,t);switch(t.type){case"base64":r=uc(e);break;case"binary":r=e;break;case"buffer":r=e.toString("binary");break;case"array":r=D0(e);break;default:throw new Error("Unrecognized type "+t.type)}return n[0]==239&&n[1]==187&&n[2]==191&&(r=hs(r)),t.type="binary",zpe(r,t)}function Dkt(e,t){var r=e;return t.type=="base64"&&(r=uc(r)),r=Pn.utils.decode(1200,r.slice(2),"str"),t.type="binary",zpe(r,t)}function Ikt(e){return e.match(/[^\x00-\x7F]/)?Wd(e):e}function iO(e,t,r,n){return n?(r.type="string",Yy.to_workbook(e,r)):Yy.to_workbook(t,r)}function Lj(e,t){NA();var r=t||{};if(typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer)return Lj(new Uint8Array(e),(r=js(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),Vv={},r.dateNF&&(Vv.dateNF=r.dateNF),r.type||(r.type=pn&&Buffer.isBuffer(e)?"buffer":"base64"),r.type=="file"&&(r.type=pn?"buffer":"binary",n=Ryt(e),typeof Uint8Array<"u"&&!pn&&(r.type="array")),r.type=="string"&&(i=!0,r.type="binary",r.codepage=65001,n=Ikt(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=js(r),r.type="array",Lj(a7(n),r)}switch((a=H7(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 Tkt(jr.read(n,r),r);break;case 9:if(a[1]<=8)return z7(n,r);break;case 60:return TI(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 Wwt(n,r);break;case 84:if(a[1]===65&&a[2]===66&&a[3]===76)return Hme.to_workbook(n,r);break;case 80:return a[1]===75&&a[2]<9&&a[3]<9?Pkt(n,r):iO(e,n,r,i);case 239:return a[3]===60?TI(n,r):iO(e,n,r,i);case 255:if(a[1]===254)return Dkt(n,r);if(a[1]===0&&a[2]===2&&a[3]===0)return s0.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 s0.to_workbook(n,r);break;case 3:case 131:case 139:case 140:return AI.to_workbook(n,r);case 123:if(a[1]===92&&a[2]===114&&a[3]===116)return Jme.to_workbook(n,r);break;case 10:case 13:case 32:return Okt(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 Hwt.indexOf(a[0])>-1&&a[2]<=12&&a[3]<=31?AI.to_workbook(n,r):iO(e,n,r,i)}function yY(e,t){var r=t||{};return r.type="file",Lj(e,r)}function qpe(e,t){switch(t.type){case"base64":case"binary":break;case"buffer":case"array":t.type="";break;case"file":return D_(t.file,jr.write(e,{type:pn?"buffer":""}));case"string":throw new Error("'string' output type invalid for '"+t.bookType+"' files");default:throw new Error("Unrecognized type "+t.type)}return jr.write(e,t)}function Rkt(e,t){var r=js(t||{}),n=Ekt(e,r);return Upe(n,r)}function Lkt(e,t){var r=js(t||{}),n=Bpe(e,r);return Upe(n,r)}function Upe(e,t){var r={},n=pn?"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?jr.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(P_(a))}return t.password&&typeof encrypt_agile<"u"?qpe(encrypt_agile(a,t.password),t):t.type==="file"?D_(t.file,a):t.type=="string"?hs(a):a}function Fkt(e,t){var r=t||{},n=B4t(e,r);return qpe(n,r)}function Td(e,t,r){r||(r="");var n=r+e;switch(t.type){case"base64":return Nj(Wd(n));case"binary":return Wd(n);case"string":return e;case"file":return D_(t.file,n,"utf8");case"buffer":return pn?Ph(n,"utf8"):typeof TextEncoder<"u"?new TextEncoder().encode(n):Td(n,{type:"binary"}).split("").map(function(a){return a.charCodeAt(0)})}throw new Error("Unrecognized type "+t.type)}function Mkt(e,t){switch(t.type){case"base64":return Nj(e);case"binary":return e;case"string":return e;case"file":return D_(t.file,e,"binary");case"buffer":return pn?Ph(e,"binary"):e.split("").map(function(r){return r.charCodeAt(0)})}throw new Error("Unrecognized type "+t.type)}function GS(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"?Nj(r):t.type=="string"?hs(r):r;case"file":return D_(t.file,e);case"buffer":return e;default:throw new Error("Unrecognized type "+t.type)}}function W7(e,t){NA(),_pe(e);var r=js(t||{});if(r.cellStyles&&(r.cellNF=!0,r.sheetStubs=!0),r.type=="array"){r.type="binary";var n=W7(e,r);return r.type="array",P_(n)}return Lkt(e,r)}function DA(e,t){NA(),_pe(e);var r=js(t||{});if(r.cellStyles&&(r.cellNF=!0,r.sheetStubs=!0),r.type=="array"){r.type="binary";var n=DA(e,r);return r.type="array",P_(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 Td(D4t(e,r),r);case"slk":case"sylk":return Td(Vme.from_sheet(e.Sheets[e.SheetNames[a]],r),r);case"htm":case"html":return Td(Dpe(e.Sheets[e.SheetNames[a]],r),r);case"txt":return Mkt(Wpe(e.Sheets[e.SheetNames[a]],r),r);case"csv":return Td(K7(e.Sheets[e.SheetNames[a]],r),r,"\uFEFF");case"dif":return Td(Hme.from_sheet(e.Sheets[e.SheetNames[a]],r),r);case"dbf":return GS(AI.from_sheet(e.Sheets[e.SheetNames[a]],r),r);case"prn":return Td(Yy.from_sheet(e.Sheets[e.SheetNames[a]],r),r);case"rtf":return Td(Jme.from_sheet(e.Sheets[e.SheetNames[a]],r),r);case"eth":return Td(Wme.from_sheet(e.Sheets[e.SheetNames[a]],r),r);case"fods":return Td(Fpe(e,r),r);case"wk1":return GS(s0.sheet_to_wk1(e.Sheets[e.SheetNames[a]],r),r);case"wk3":return GS(s0.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),GS(Epe(e,r),r);case"biff5":r.biff||(r.biff=5);case"biff8":case"xla":case"xls":return r.biff||(r.biff=8),Fkt(e,r);case"xlsx":case"xlsm":case"xlam":case"xlsb":case"numbers":case"ods":return Rkt(e,r);default:throw new Error("Unrecognized bookType |"+r.bookType+"|")}}function G7(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 bY(e,t,r){var n=r||{};return n.type="file",n.file=t,G7(n),DA(e,n)}function $kt(e,t,r){var n=r||{};return n.type="file",n.file=t,G7(n),W7(e,n)}function Bkt(e,t,r,n){var a=r||{};a.type="file",a.file=e,G7(a),a.type="buffer";var i=n;return i instanceof Function||(i=r),Bm.writeFile(e,DA(t,a),i)}function Vpe(e,t,r,n,a,i,o,l){var c=wa(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 x=o?e[r][h]:e[n[h]+c];if(x===void 0||x.t===void 0){if(u===void 0)continue;i[h]!=null&&(m[i[h]]=u);continue}var p=x.v;switch(x.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 "+x.t)}if(i[h]!=null){if(p==null)if(x.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&&(x.t!=="n"||x.t==="n"&&l.rawNumbers!==!1)?p:af(x,p,l);p!=null&&(f=!1)}}return{row:m,isempty:f}}function Zk(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=Nn(d);break;case"number":c=Nn(e["!ref"]),c.s.r=d;break;default:c=d}n>0&&(a=0);var f=wa(c.s.r),m=[],h=[],x=0,p=0,g=Array.isArray(e),v=c.s.r,y=0,b={};g&&!e[v]&&(e[v]=[]);var N=u.skipHidden&&e["!cols"]||[],j=u.skipHidden&&e["!rows"]||[];for(y=c.s.c;y<=c.e.c;++y)if(!(N[y]||{}).hidden)switch(m[y]=Ws(y),r=g?e[v][y]:e[m[y]+f],n){case 1:i[y]=y-c.s.c;break;case 2:i[y]=m[y];break;case 3:i[y]=u.header[y-c.s.c];break;default:if(r==null&&(r={w:"__EMPTY",t:"s"}),l=o=af(r,null,u),p=b[o]||0,!p)b[o]=1;else{do l=o+"_"+p++;while(b[l]);b[o]=p,b[l]=1}i[y]=l}for(v=c.s.r+a;v<=c.e.r;++v)if(!(j[v]||{}).hidden){var _=Vpe(e,c,v,m,n,i,g,u);(_.isempty===!1||(n===1?u.blankrows!==!1:u.blankrows))&&(h[x++]=_.row)}return h.length=x,h}var wY=/"/g;function Hpe(e,t,r,n,a,i,o,l){for(var c=!0,u=[],d="",f=wa(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:af(h,null,l));for(var x=0,p=0;x!==d.length;++x)if((p=d.charCodeAt(x))===a||p===i||p===34||l.forceQuotes){d='"'+d.replace(wY,'""')+'"';break}d=="ID"&&(d='"ID"')}else h.f!=null&&!h.F?(c=!1,d="="+h.f,d.indexOf(",")>=0&&(d='"'+d.replace(wY,'""')+'"')):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=Nn(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"]||[],x=a.s.c;x<=a.e.c;++x)(m[x]||{}).hidden||(f[x]=Ws(x));for(var p=0,g=a.s.r;g<=a.e.r;++g)(h[g]||{}).hidden||(d=Hpe(e,a,g,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 Wpe(e,t){t||(t={}),t.FS=" ",t.RS=`
`;var r=K7(e,t);if(typeof Pn>"u"||t.type=="string")return r;var n=Pn.utils.encode(1200,r,"str");return"ÿþ"+n}function zkt(e){var t="",r,n="";if(e==null||e["!ref"]==null)return[];var a=Nn(e["!ref"]),i="",o=[],l,c=[],u=Array.isArray(e);for(l=a.s.c;l<=a.e.c;++l)o[l]=Ws(l);for(var d=a.s.r;d<=a.e.r;++d)for(i=wa(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 Gpe(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"?ia(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=Nn(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,g){ka(p).forEach(function(v){(h=m.indexOf(v))==-1&&(m[h=m.length]=v);var y=p[v],b="z",N="",j=Or({c:l+h,r:o+g+a});u=Fj(i,j),y&&typeof y=="object"&&!(y instanceof Date)?i[j]=y:(typeof y=="number"?b="n":typeof y=="boolean"?b="b":typeof y=="string"?b="s":y instanceof Date?(b="d",n.cellDates||(b="n",y=_i(y)),N=n.dateNF||Sr[14]):y===null&&n.nullError&&(b="e",y=0),u?(u.t=b,u.v=y,delete u.w,delete u.R,N&&(u.z=N)):i[j]=u={t:b,v:y},N&&(u.z=N))})}),d.e.c=Math.max(d.e.c,l+m.length-1);var x=wa(o);if(a)for(h=0;h<m.length;++h)i[Ws(h+l)+x]={t:"s",v:m[h]};return i["!ref"]=sn(d),i}function qkt(e,t){return Gpe(null,e,t)}function Fj(e,t,r){if(typeof t=="string"){if(Array.isArray(e)){var n=ia(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"?Fj(e,Or(t)):Fj(e,Or({r:t,c:r||0}))}function Ukt(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 X7(){return{SheetNames:[],Sheets:{}}}function Y7(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(jpe(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 Vkt(e,t,r){e.Workbook||(e.Workbook={}),e.Workbook.Sheets||(e.Workbook.Sheets=[]);var n=Ukt(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 Hkt(e,t){return e.z=t,e}function Kpe(e,t,r){return t?(e.l={Target:t},r&&(e.l.Tooltip=r)):delete e.l,e}function Wkt(e,t,r){return Kpe(e,"#"+t,r)}function Gkt(e,t,r){e.c||(e.c=[]),e.c.push({t,a:r||"SheetJS"})}function Kkt(e,t,r,n){for(var a=typeof t!="string"?t:Nn(t),i=typeof t=="string"?t:sn(t),o=a.s.r;o<=a.e.r;++o)for(var l=a.s.c;l<=a.e.c;++l){var c=Fj(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 Xpe={encode_col:Ws,encode_row:wa,encode_cell:Or,encode_range:sn,decode_col:j7,decode_row:w7,split_cell:h1t,decode_cell:ia,decode_range:Qo,format_cell:af,sheet_add_aoa:hme,sheet_add_json:Gpe,sheet_add_dom:Ipe,aoa_to_sheet:H1,json_to_sheet:qkt,table_to_sheet:Rpe,table_to_book:skt,sheet_to_csv:K7,sheet_to_txt:Wpe,sheet_to_json:Zk,sheet_to_html:Dpe,sheet_to_formulae:zkt,sheet_to_row_object_array:Zk,sheet_get_cell:Fj,book_new:X7,book_append_sheet:Y7,book_set_sheet_visibility:Vkt,cell_set_number_format:Hkt,cell_set_hyperlink:Kpe,cell_set_internal_link:Wkt,cell_add_comment:Gkt,sheet_set_array_formula:Kkt,consts:{SHEET_VISIBLE:0,SHEET_HIDDEN:1,SHEET_VERY_HIDDEN:2}},IA;function Xkt(e){IA=e}function Ykt(e,t){var r=IA(),n=t??{};if(e==null||e["!ref"]==null)return r.push(null),r;var a=Nn(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"]||[],x=a.s.c;x<=a.e.c;++x)(m[x]||{}).hidden||(f[x]=Ws(x));var p=a.s.r,g=!1,v=0;return r._read=function(){if(!g)return g=!0,r.push("\uFEFF");for(;p<=a.e.r;)if(++p,!(h[p-1]||{}).hidden&&(d=Hpe(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 Zkt(e,t){var r=IA(),n=t||{},a=n.header!=null?n.header:Tpe,i=n.footer!=null?n.footer:Ppe;r.push(a);var o=Qo(e["!ref"]);n.dense=Array.isArray(e),r.push(Ope(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(Ape(e,o,l,n)),++l;break}},r}function Jkt(e,t){var r=IA({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=Nn(f);break;case"number":u=Nn(e["!ref"]),u.s.r=f;break;default:u=f}a>0&&(i=0);var m=wa(u.s.r),h=[],x=0,p=Array.isArray(e),g=u.s.r,v=0,y={};p&&!e[g]&&(e[g]=[]);var b=d.skipHidden&&e["!cols"]||[],N=d.skipHidden&&e["!rows"]||[];for(v=u.s.c;v<=u.e.c;++v)if(!(b[v]||{}).hidden)switch(h[v]=Ws(v),n=p?e[g][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=af(n,null,d),x=y[l]||0,!x)y[l]=1;else{do c=l+"_"+x++;while(y[c]);y[l]=x,y[c]=1}o[v]=c}return g=u.s.r+i,r._read=function(){for(;g<=u.e.r;)if(!(N[g-1]||{}).hidden){var j=Vpe(e,u,g,h,a,o,p,d);if(++g,j.isempty===!1||(a===1?d.blankrows!==!1:d.blankrows)){r.push(j.row);return}}return r.push(null)},r}var Qkt={to_json:Jkt,to_html:Zkt,to_csv:Ykt,set_readable:Xkt};const eCt=_j.version,Ype=Object.freeze(Object.defineProperty({__proto__:null,CFB:jr,SSF:l7,parse_xlscfb:z7,parse_zip:$pe,read:Lj,readFile:yY,readFileSync:yY,set_cptable:syt,set_fs:Dyt,stream:Qkt,utils:Xpe,version:eCt,write:DA,writeFile:bY,writeFileAsync:Bkt,writeFileSync:bY,writeFileXLSX:$kt,writeXLSX:W7},Symbol.toStringTag,{value:"Module"})),ku=({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(Xe,{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(Kn,{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:Dt(d,"dd/MM/yyyy",{locale:br})})}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:"-"})})},jY={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"}},Jk=[{key:"new",label:"Nouveau",cls:"bg-slate-100 text-slate-700 border-slate-300"},{key:"enriched",label:"Email trouvé",cls:"bg-cyan-100 text-cyan-700 border-cyan-300"},{key:"contacted",label:"Contacté",cls:"bg-blue-100 text-blue-700 border-blue-300"},{key:"replied",label:"A répondu",cls:"bg-violet-100 text-violet-700 border-violet-300"},{key:"interested",label:"Intéressé",cls:"bg-amber-100 text-amber-700 border-amber-300"},{key:"won",label:"Gagné",cls:"bg-emerald-100 text-emerald-700 border-emerald-300"},{key:"lost",label:"Perdu",cls:"bg-rose-100 text-rose-700 border-rose-300"},{key:"not_interested",label:"Pas intéressé",cls:"bg-muted text-muted-foreground border-border"},{key:"bounced",label:"Bounce",cls:"bg-red-100 text-red-700 border-red-300"}],tCt=Object.fromEntries(Jk.map(e=>[e.key,e.label])),rCt=Object.fromEntries(Jk.map(e=>[e.key,e.cls])),nCt=()=>{const e=u1(),t=w.useRef(null),[r,n]=w.useState([]),[a,i]=w.useState("all"),[o,l]=w.useState("all"),[c,u]=w.useState("all"),[d,f]=w.useState(!1),[m,h]=w.useState(!1),[x,p]=w.useState(!1),[g,v]=w.useState(""),[y,b]=w.useState(""),[N,j]=w.useState(""),[_,S]=w.useState({company_name:"",contact_name:"",contact_email:"",contact_phone:"",company_type:"school",city:"",sector:"",notes:"",position:"",offer_description:"",modality:"",offer_link:""}),{data:P=[],isLoading:T}=la({queryKey:["prospects",a,o,c],queryFn:async()=>{let C=ce.from("prospects").select("*").order("created_at",{ascending:!1}).limit(1e3);a!=="all"&&(C=C.eq("status",a)),o!=="all"&&(C=C.eq("pipeline_stage",o)),c!=="all"&&(C=C.eq("company_type",c));const{data:A,error:I}=await C;if(I)throw I;return A}}),{data:R=[]}=la({queryKey:["prospect-stage-counts",c],queryFn:async()=>{let C=ce.from("prospects").select("pipeline_stage");c!=="all"&&(C=C.eq("company_type",c));const{data:A,error:I}=await C;if(I)throw I;return A}}),k=R.reduce((C,A)=>{const I=A.pipeline_stage||"new";return C[I]=(C[I]||0)+1,C},{}),E=async C=>new Promise((A,I)=>{const U=new FileReader;U.onload=Y=>{var te;try{const re=(te=Y.target)==null?void 0:te.result,J=Lj(re,{type:"binary"}),ie=J.SheetNames[0],be=J.Sheets[ie],Q=Xpe.sheet_to_json(be,{header:1});if(Q.length<2){I(new Error("Le fichier est vide"));return}const Ve=Q[0].map(se=>String(se||"").toLowerCase().trim()),W=Q.slice(1),Z=se=>{if(!se)return null;if(!isNaN(Number(se))){const le=l7.parse_date_code(Number(se));if(le)return`${le.y}-${String(le.m).padStart(2,"0")}-${String(le.d).padStart(2,"0")}`}const oe=se.split("/");if(oe.length===3){const[le,Me,de]=oe;return`${de}-${Me.padStart(2,"0")}-${le.padStart(2,"0")}`}return null},he=W.filter(se=>se.some(oe=>oe)).map(se=>{const oe={company_type:"school"};return Ve.forEach((le,Me)=>{const de=se[Me]?String(se[Me]).trim():"";le.includes("ecole")||le.includes("école")?oe.company_name=de:le.includes("nom prenom")||le.includes("responsable")?oe.contact_name=de:le.includes("email")?oe.contact_email=de.replace(/mailto:/g,"").replace(/[\[\]<>]/g,"").split(",")[0].trim():le.includes("tel")?oe.contact_phone=de:le.includes("desc")&&le.includes("poste")?oe.position=de:le==="offres"||le.includes("offre")&&!le.includes("lien")&&!le.includes("date")&&!le.includes("lieu")?oe.offer_description=de:le.includes("lieu")?oe.city=de:le.includes("mode")?oe.modality=de:le.includes("lien")&&le.includes("offre")?oe.offer_link=de:le.includes("date")&&le.includes("offre")?oe.offer_date=de?Z(de):null:le.includes("invitation")&&le.includes("accept")?oe.linkedin_invitation_accepted=de.toLowerCase()==="oui"||de==="1":le.includes("linkedin")||le.includes("message")&&le.includes("linkedin")?oe.linkedin_message_sent=de.toLowerCase()==="oui"||de==="1":le.includes("mail envoyé")||le==="mail envoyé"?oe.email_sent=de.toLowerCase()==="oui"||de==="1":le.includes("date")&&le.includes("envoi")?oe.last_send_date=de?Z(de):null:(le.includes("remarque")||le.includes("note"))&&(oe.notes=de)}),oe}).filter(se=>se.company_name||se.contact_email);A(he)}catch(re){I(re)}},U.onerror=()=>I(new Error("Erreur de lecture du fichier")),U.readAsBinaryString(C)}),q=Mc({mutationFn:async C=>{const A=await E(C);if(A.length===0)throw new Error("Aucun prospect valide trouvé");const I=crypto.randomUUID(),{error:U}=await ce.from("prospects").insert(A.map(Y=>({...Y,source:"import",import_batch_id:I})));if(U)throw U;return A.length},onSuccess:C=>{ae.success(`${C} prospects importés avec succès`),e.invalidateQueries({queryKey:["prospects"]})},onError:C=>{ae.error(C.message||"Erreur lors de l'import")}}),O=Mc({mutationFn:async C=>{const{data:A,error:I}=await ce.functions.invoke("extract-offer-from-linkedin",{body:{postText:C}});if(I)throw I;return A.offer},onSuccess:C=>{S({company_name:C.school_name||"",contact_name:C.contact_name||"",contact_email:C.contact_email||"",contact_phone:"",company_type:"school",city:C.city||"",sector:"",notes:"",position:"",offer_description:C.description||"",modality:C.modality||"",offer_link:""}),p(!1),h(!0),j(""),ae.success("Données extraites du post LinkedIn")},onError:C=>{ae.error(C.message||"Erreur lors de l'extraction")}}),L=Mc({mutationFn:async C=>{const{error:A}=await ce.from("prospects").insert({...C,source:"manual"});if(A)throw A},onSuccess:()=>{ae.success("Prospect ajouté"),e.invalidateQueries({queryKey:["prospects"]}),h(!1),S({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")}}),H=Mc({mutationFn:async({id:C,updates:A})=>{const{error:I}=await ce.from("prospects").update({...A,updated_at:new Date().toISOString()}).eq("id",C);if(I)throw I},onSuccess:()=>{e.invalidateQueries({queryKey:["prospects"]})}}),V=Mc({mutationFn:async({prospectIds:C,subject:A,content:I})=>{const{data:U,error:Y}=await ce.functions.invoke("send-prospection-emails",{body:{prospectIds:C,subject:A,content:I}});if(Y)throw Y;return U},onSuccess:C=>{ae.success(`${C.successCount} emails envoyés avec succès`),e.invalidateQueries({queryKey:["prospects"]}),f(!1),n([]),v(""),b("")},onError:()=>{ae.error("Erreur lors de l'envoi des emails")}}),z=C=>{var I;const A=(I=C.target.files)==null?void 0:I[0];A&&q.mutate(A),t.current&&(t.current.value="")},M=()=>{r.length===P.length?n([]):n(P.map(C=>C.id))},B=C=>{n(A=>A.includes(C)?A.filter(I=>I!==C):[...A,C])},K={total:P.length,schools:P.filter(C=>C.company_type==="school").length,enterprises:P.filter(C=>C.company_type==="enterprise").length,contacted:P.filter(C=>C.status==="contacted"||C.email_sent||C.linkedin_message_sent).length};return s.jsxs("div",{className:"container mx-auto py-8 px-4",children:[s.jsx(ta,{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:z}),s.jsxs(ne,{variant:"outline",onClick:()=>{var C;return(C=t.current)==null?void 0:C.click()},disabled:q.isPending,children:[s.jsx(lc,{className:"h-4 w-4 mr-2"}),"Import Excel"]}),s.jsxs(qn,{open:x,onOpenChange:p,children:[s.jsx(Xo,{asChild:!0,children:s.jsxs(ne,{variant:"outline",children:[s.jsx(Bu,{className:"h-4 w-4 mr-2"}),"Import LinkedIn"]})}),s.jsxs($n,{className:"max-w-2xl",children:[s.jsxs(Un,{children:[s.jsx(Vn,{children:"Importer depuis LinkedIn"}),s.jsx(Sa,{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:N,onChange:C=>j(C.target.value),className:"min-h-[200px]"})}),s.jsx(bl,{children:s.jsx(ne,{onClick:()=>O.mutate(N),disabled:!N.trim()||O.isPending,children:O.isPending?"Extraction...":"Extraire les infos"})})]})]}),s.jsxs(qn,{open:m,onOpenChange:h,children:[s.jsx(Xo,{asChild:!0,children:s.jsxs(ne,{children:[s.jsx(Qa,{className:"h-4 w-4 mr-2"}),"Ajouter"]})}),s.jsxs($n,{className:"max-w-2xl",children:[s.jsx(Un,{children:s.jsx(Vn,{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(Xe,{placeholder:"Nom de l'école/entreprise *",value:_.company_name,onChange:C=>S(A=>({...A,company_name:C.target.value}))}),s.jsxs(Ar,{value:_.company_type,onValueChange:C=>S(A=>({...A,company_type:C})),children:[s.jsx(kr,{children:s.jsx(Dr,{})}),s.jsxs(Cr,{children:[s.jsx(ct,{value:"school",children:"École"}),s.jsx(ct,{value:"enterprise",children:"Entreprise"})]})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(Xe,{placeholder:"Nom du contact",value:_.contact_name,onChange:C=>S(A=>({...A,contact_name:C.target.value}))}),s.jsx(Xe,{placeholder:"Poste/Fonction",value:_.position,onChange:C=>S(A=>({...A,position:C.target.value}))})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(Xe,{type:"email",placeholder:"Email",value:_.contact_email,onChange:C=>S(A=>({...A,contact_email:C.target.value}))}),s.jsx(Xe,{placeholder:"Téléphone",value:_.contact_phone,onChange:C=>S(A=>({...A,contact_phone:C.target.value}))})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(Xe,{placeholder:"Ville",value:_.city,onChange:C=>S(A=>({...A,city:C.target.value}))}),s.jsx(Xe,{placeholder:"Modalité (présentiel, distanciel...)",value:_.modality,onChange:C=>S(A=>({...A,modality:C.target.value}))})]}),s.jsx(Xe,{placeholder:"Lien de l'offre",value:_.offer_link,onChange:C=>S(A=>({...A,offer_link:C.target.value}))}),s.jsx(gn,{placeholder:"Description de l'offre",value:_.offer_description,onChange:C=>S(A=>({...A,offer_description:C.target.value})),className:"min-h-[100px]"}),s.jsx(gn,{placeholder:"Notes/Remarques",value:_.notes,onChange:C=>S(A=>({...A,notes:C.target.value}))})]}),s.jsx(bl,{children:s.jsx(ne,{onClick:()=>L.mutate(_),disabled:!_.company_name||L.isPending,children:"Ajouter"})})]})]})]})]}),s.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-6",children:[s.jsx(je,{children:s.jsx(Ee,{className:"pt-6",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(yr,{className:"h-5 w-5 text-primary"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl font-bold",children:K.total}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Total"})]})]})})}),s.jsx(je,{children:s.jsx(Ee,{className:"pt-6",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ph,{className:"h-5 w-5 text-blue-500"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl font-bold",children:K.schools}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Écoles"})]})]})})}),s.jsx(je,{children:s.jsx(Ee,{className:"pt-6",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(yr,{className:"h-5 w-5 text-green-500"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl font-bold",children:K.enterprises}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Entreprises"})]})]})})}),s.jsx(je,{children:s.jsx(Ee,{className:"pt-6",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(_n,{className:"h-5 w-5 text-orange-500"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl font-bold",children:K.contacted}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Contactés"})]})]})})})]}),s.jsx(je,{className:"mb-6",children:s.jsxs(Ee,{className:"pt-6",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx("h3",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:"Pipeline commercial"}),o!=="all"&&s.jsx("button",{onClick:()=>l("all"),className:"text-xs text-primary hover:underline",children:"Réinitialiser le filtre"})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsxs("button",{onClick:()=>l("all"),className:`text-xs font-bold px-3 py-1.5 rounded-full border transition-colors ${o==="all"?"bg-primary text-primary-foreground border-primary":"bg-background hover:bg-muted border-border"}`,children:["Tous (",R.length,")"]}),Jk.map(C=>s.jsxs("button",{onClick:()=>l(C.key),className:`text-xs font-bold px-3 py-1.5 rounded-full border transition-colors ${o===C.key?C.cls:"bg-background hover:bg-muted border-border"}`,children:[C.label," (",k[C.key]||0,")"]},C.key))]})]})}),s.jsx(je,{className:"mb-6",children:s.jsx(Ee,{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(RR,{className:"h-4 w-4 text-muted-foreground"}),s.jsxs(Ar,{value:a,onValueChange:i,children:[s.jsx(kr,{className:"w-[150px]",children:s.jsx(Dr,{placeholder:"Statut"})}),s.jsxs(Cr,{children:[s.jsx(ct,{value:"all",children:"Tous les statuts"}),s.jsx(ct,{value:"new",children:"Nouveau"}),s.jsx(ct,{value:"contacted",children:"Contacté"}),s.jsx(ct,{value:"interested",children:"Intéressé"}),s.jsx(ct,{value:"converted",children:"Converti"}),s.jsx(ct,{value:"not_interested",children:"Pas intéressé"})]})]}),s.jsxs(Ar,{value:c,onValueChange:u,children:[s.jsx(kr,{className:"w-[150px]",children:s.jsx(Dr,{placeholder:"Type"})}),s.jsxs(Cr,{children:[s.jsx(ct,{value:"all",children:"Tous les types"}),s.jsx(ct,{value:"school",children:"Écoles"}),s.jsx(ct,{value:"enterprise",children:"Entreprises"})]})]})]}),r.length>0&&s.jsxs(qn,{open:d,onOpenChange:f,children:[s.jsx(Xo,{asChild:!0,children:s.jsxs(ne,{children:[s.jsx(Js,{className:"h-4 w-4 mr-2"}),"Envoyer email (",r.length,")"]})}),s.jsxs($n,{className:"max-w-2xl",children:[s.jsxs(Un,{children:[s.jsx(Vn,{children:"Envoyer un email"}),s.jsxs(Sa,{children:["Cet email sera envoyé à ",r.length," prospect(s)"]})]}),s.jsxs("div",{className:"grid gap-4 py-4",children:[s.jsx(Xe,{placeholder:"Sujet de l'email",value:g,onChange:C=>v(C.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:y,onChange:C=>b(C.target.value),className:"min-h-[200px]"})]}),s.jsx(bl,{children:s.jsx(ne,{onClick:()=>V.mutate({prospectIds:r,subject:g,content:y}),disabled:!g||!y||V.isPending,children:V.isPending?"Envoi en cours...":"Envoyer"})})]})]})]})})}),s.jsx(je,{children:s.jsx(Ee,{className:"p-0 overflow-x-auto",children:s.jsxs(jh,{children:[s.jsx(_h,{children:s.jsxs(Fa,{children:[s.jsx(vr,{className:"w-10",children:s.jsx(Yo,{checked:r.length===P.length&&P.length>0,onCheckedChange:M})}),s.jsx(vr,{className:"min-w-[180px]",children:"École"}),s.jsx(vr,{className:"min-w-[150px]",children:"Contact"}),s.jsx(vr,{className:"min-w-[100px]",children:"Poste"}),s.jsx(vr,{className:"min-w-[200px]",children:"Offre"}),s.jsx(vr,{className:"min-w-[100px]",children:"Lieu"}),s.jsx(vr,{className:"min-w-[80px]",children:"Mode"}),s.jsx(vr,{className:"min-w-[80px]",children:"Lien"}),s.jsx(vr,{className:"min-w-[150px]",children:"Remarques"}),s.jsx(vr,{className:"min-w-[100px]",children:"Statut"}),s.jsx(vr,{className:"min-w-[130px]",children:"Pipeline"}),s.jsx(vr,{className:"text-center w-16",children:s.jsx(Bu,{className:"h-4 w-4 inline"})}),s.jsx(vr,{className:"text-center w-16",children:s.jsx(_n,{className:"h-4 w-4 inline"})}),s.jsxs(vr,{className:"w-20",children:[s.jsx(Hs,{className:"h-4 w-4 inline"})," Envoi"]})]})}),s.jsx(Nh,{children:T?s.jsx(Fa,{children:s.jsx(cr,{colSpan:14,className:"text-center py-8",children:"Chargement..."})}):P.length===0?s.jsx(Fa,{children:s.jsx(cr,{colSpan:14,className:"text-center py-8 text-muted-foreground",children:"Aucun prospect. Importez un fichier Excel ou ajoutez manuellement."})}):P.map(C=>{var A,I;return s.jsxs(Fa,{children:[s.jsx(cr,{children:s.jsx(Yo,{checked:r.includes(C.id),onCheckedChange:()=>B(C.id)})}),s.jsx(cr,{children:s.jsx(ku,{value:C.company_name,onSave:U=>H.mutate({id:C.id,updates:{company_name:U}}),className:"font-medium"})}),s.jsx(cr,{children:s.jsxs("div",{className:"space-y-1",children:[s.jsx(ku,{value:C.contact_name,onSave:U=>H.mutate({id:C.id,updates:{contact_name:U}}),className:"font-medium text-xs"}),s.jsx(ku,{value:C.contact_email,onSave:U=>H.mutate({id:C.id,updates:{contact_email:U}}),type:"email",className:"text-xs text-muted-foreground"}),s.jsx(ku,{value:C.contact_phone,onSave:U=>H.mutate({id:C.id,updates:{contact_phone:U}}),type:"tel",className:"text-xs text-muted-foreground"})]})}),s.jsx(cr,{children:s.jsx(ku,{value:C.position,onSave:U=>H.mutate({id:C.id,updates:{position:U}}),className:"text-xs"})}),s.jsx(cr,{children:s.jsx(ku,{value:C.offer_description,onSave:U=>H.mutate({id:C.id,updates:{offer_description:U}}),type:"textarea",className:"text-xs max-w-[200px] line-clamp-3"})}),s.jsx(cr,{children:s.jsx(ku,{value:C.city,onSave:U=>H.mutate({id:C.id,updates:{city:U}}),className:"text-xs"})}),s.jsx(cr,{children:s.jsx(ku,{value:C.modality,onSave:U=>H.mutate({id:C.id,updates:{modality:U}}),className:"text-xs"})}),s.jsx(cr,{children:s.jsx(ku,{value:C.offer_link,onSave:U=>H.mutate({id:C.id,updates:{offer_link:U}}),type:"url",className:"text-xs"})}),s.jsx(cr,{children:s.jsx(ku,{value:C.notes,onSave:U=>H.mutate({id:C.id,updates:{notes:U}}),type:"textarea",className:"text-xs max-w-[150px]"})}),s.jsx(cr,{children:s.jsxs(Ar,{value:C.status,onValueChange:U=>H.mutate({id:C.id,updates:{status:U}}),children:[s.jsx(kr,{className:"w-[100px] h-7 text-xs",children:s.jsx(Te,{variant:((A=jY[C.status])==null?void 0:A.variant)||"default",className:"text-[10px]",children:((I=jY[C.status])==null?void 0:I.label)||C.status})}),s.jsxs(Cr,{children:[s.jsx(ct,{value:"new",children:"Nouveau"}),s.jsx(ct,{value:"contacted",children:"Contacté"}),s.jsx(ct,{value:"interested",children:"Intéressé"}),s.jsx(ct,{value:"converted",children:"Converti"}),s.jsx(ct,{value:"not_interested",children:"Pas intéressé"})]})]})}),s.jsx(cr,{children:s.jsxs(Ar,{value:C.pipeline_stage||"new",onValueChange:U=>H.mutate({id:C.id,updates:{pipeline_stage:U}}),children:[s.jsx(kr,{className:"w-[130px] h-7 text-xs",children:s.jsx(Te,{variant:"outline",className:`text-[10px] ${rCt[C.pipeline_stage||"new"]||""}`,children:tCt[C.pipeline_stage||"new"]||C.pipeline_stage})}),s.jsx(Cr,{children:Jk.map(U=>s.jsx(ct,{value:U.key,children:U.label},U.key))})]})}),s.jsx(cr,{className:"text-center",children:s.jsxs("div",{className:"flex flex-col items-center gap-1",children:[s.jsx("button",{onClick:()=>H.mutate({id:C.id,updates:{linkedin_invitation_accepted:!C.linkedin_invitation_accepted}}),className:`p-1 rounded ${C.linkedin_invitation_accepted?"text-green-600":"text-muted-foreground"}`,title:"Invitation acceptée",children:C.linkedin_invitation_accepted?s.jsx(Rn,{className:"h-4 w-4"}):s.jsx($i,{className:"h-4 w-4"})}),s.jsx("button",{onClick:()=>H.mutate({id:C.id,updates:{linkedin_message_sent:!C.linkedin_message_sent}}),className:`p-1 rounded text-[10px] ${C.linkedin_message_sent?"text-blue-600 font-medium":"text-muted-foreground"}`,title:"Message LinkedIn envoyé",children:"MSG"})]})}),s.jsx(cr,{className:"text-center",children:s.jsx("button",{onClick:()=>H.mutate({id:C.id,updates:{email_sent:!C.email_sent}}),className:`p-1 rounded ${C.email_sent?"text-green-600":"text-muted-foreground"}`,title:"Email envoyé",children:C.email_sent?s.jsx(Rn,{className:"h-4 w-4"}):s.jsx($i,{className:"h-4 w-4"})})}),s.jsx(cr,{children:s.jsx(ku,{value:C.last_send_date,onSave:U=>H.mutate({id:C.id,updates:{last_send_date:U||null}}),type:"date",className:"text-xs"})})]},C.id)})})]})})})]})},im="__all__";function sCt(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 aCt(e){return e?e.split(/[,;/]/).map(t=>t.trim()).filter(Boolean):[]}function iCt(){const e=Zt(),{isAdmin:t,loading:r}=Br(),[n,a]=w.useState(!0),[i,o]=w.useState([]),[l,c]=w.useState([]),[u,d]=w.useState(!1),[f,m]=w.useState(!1),[h,x]=w.useState(!1),[p,g]=w.useState(null),[v,y]=w.useState(""),[b,N]=w.useState(""),[j,_]=w.useState("both"),[S,P]=w.useState(im),[T,R]=w.useState(im);w.useEffect(()=>{!r&&!t&&e("/auth")},[t,r,e]),w.useEffect(()=>{t&&k()},[t]);const k=async()=>{try{const[B,K,C]=await Promise.all([ce.from("trainer_profiles").select("id, name, email, status, preferred_cities, specialties, manual_certified"),ce.from("trainer_contacts").select("email, first_name, city, modules").eq("unsubscribed",!1),ce.from("trainer_contracts").select("trainer_id").eq("counter_signed",!0)]);if(B.error)throw B.error;if(K.error)throw K.error;const A=new Set((C.data||[]).map(I=>I.trainer_id));o((B.data||[]).filter(I=>I.email).map(I=>({email:I.email,first_name:(I.name||"").split(" ")[0],source:"signed_up",cities:(I.preferred_cities||[]).filter(Boolean),modules:(I.specialties||[]).filter(Boolean),certified:A.has(I.id)||!!I.manual_certified,approved:I.status==="approved"}))),c((K.data||[]).map(I=>({email:I.email,first_name:I.first_name||void 0,source:"imported",cities:I.city?[I.city]:[],modules:aCt(I.modules)})))}catch(B){console.error("Error loading mailing data:",B),ae.error("Erreur lors du chargement des destinataires")}finally{a(!1)}},E=async B=>{m(!0);try{const K=await B.text(),C=sCt(K);if(C.length<2)throw new Error("CSV vide ou invalide");const A=C[0].map(he=>he.trim().toLowerCase()),I=he=>A.findIndex(se=>he.some(oe=>se.includes(oe))),U=I(["email","mail"]),Y=I(["nom"]),te=I(["prénom","prenom"]),re=I(["téléphone","telephone","phone"]),J=I(["nda"]),ie=I(["ville","city"]),be=I(["pays","country"]),Q=I(["module","intervention"]);if(U===-1)throw new Error("Colonne Email introuvable dans le CSV");const Ve=new Set,W=C.slice(1).map(he=>({email:(he[U]||"").trim().toLowerCase(),last_name:Y>-1&&(he[Y]||"").trim()||null,first_name:te>-1&&(he[te]||"").trim()||null,phone:re>-1&&(he[re]||"").trim()||null,has_nda:J>-1?/oui|yes|true/i.test(he[J]||""):null,city:ie>-1&&(he[ie]||"").trim()||null,country:be>-1&&(he[be]||"").trim()||null,modules:Q>-1&&(he[Q]||"").trim()||null,source:"csv_import"})).filter(he=>!he.email||!he.email.includes("@")||Ve.has(he.email)?!1:(Ve.add(he.email),!0));if(W.length===0)throw new Error("Aucun email valide trouvé");let Z=0;for(let he=0;he<W.length;he+=200){const se=W.slice(he,he+200),{error:oe}=await ce.from("trainer_contacts").upsert(se,{onConflict:"email"});if(oe)throw oe;Z+=se.length}ae.success(`${Z} formateurs importés`),await k()}catch(K){console.error("CSV import error:",K),ae.error(K instanceof Error?K.message:"Erreur lors de l'import")}finally{m(!1)}},q=()=>j==="signed_up"?i:j==="imported"?l:j==="uncertified"?i.filter(B=>B.approved&&!B.certified):[...i,...l],O=B=>Array.from(new Set(B.map(K=>K.trim()).filter(Boolean))).sort((K,C)=>K.localeCompare(C,"fr")),L=O(q().flatMap(B=>B.cities)),H=O(q().flatMap(B=>B.modules)),V=()=>{const B=new Map;for(const K of q()){if(S!==im&&!K.cities.some(I=>I.toLowerCase()===S.toLowerCase()))continue;if(T!==im){const A=T.toLowerCase();if(!K.modules.some(U=>U.toLowerCase().includes(A)))continue}const C=K.email.trim().toLowerCase();C&&!B.has(C)&&B.set(C,{...K,email:K.email.trim()})}return Array.from(B.values())},z=V().length,M=async()=>{if(!v.trim()||!b.trim()){ae.error("Veuillez remplir le sujet et le contenu");return}const B=V();if(B.length===0){ae.error("Aucun destinataire");return}if(!confirm(`Envoyer cet email à ${B.length} formateurs ?`))return;d(!0),g(null);let K=0,C=0;const A=40,I=Math.ceil(B.length/A),U=[j,S!==im?`ville:${S}`:null,T!==im?`module:${T}`:null].filter(Boolean).join(" ");try{for(let Y=0;Y<B.length;Y+=A){const te=B.slice(Y,Y+A).map(be=>({email:be.email,first_name:be.first_name})),re=Y+A>=B.length;g(`Envoi ${Math.floor(Y/A)+1}/${I}…`);const{data:J,error:ie}=await ce.functions.invoke("send-trainer-mailing",{body:{subject:v,content:b,recipients:te,audience:U,logTotals:re?{recipients:B.length,success:K,failed:C}:void 0}});if(ie)throw ie;K+=(J==null?void 0:J.successCount)||0,C+=(J==null?void 0:J.failedCount)||0}ae.success(`Email envoyé : ${K} réussis${C?`, ${C} échecs`:""}`),y(""),N("")}catch(Y){console.error("Error sending mailing:",Y),ae.error("Erreur lors de l'envoi")}finally{d(!1),g(null)}};return r||n?s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:s.jsx(it,{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(ta,{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(je,{children:[s.jsx(mt,{children:s.jsxs(gt,{className:"flex items-center gap-2 text-lg",children:[s.jsx(fy,{className:"h-5 w-5"}),"Formateurs inscrits"]})}),s.jsxs(Ee,{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(je,{children:[s.jsx(mt,{children:s.jsxs(gt,{className:"flex items-center gap-2 text-lg",children:[s.jsx(LQ,{className:"h-5 w-5"}),"Liste importée"]})}),s.jsxs(Ee,{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(je,{children:[s.jsx(mt,{children:s.jsxs(gt,{className:"flex items-center gap-2 text-lg",children:[s.jsx(er,{className:"h-5 w-5"}),"Destinataires ciblés"]})}),s.jsxs(Ee,{children:[s.jsx("div",{className:"text-4xl font-bold",children:z}),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(je,{children:[s.jsxs(mt,{children:[s.jsx(gt,{children:"Composer un email"}),s.jsx(Kr,{children:"Envoyé depuis contact@qalamsoftware.com via le relais SMTP"})]}),s.jsxs(Ee,{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(We,{htmlFor:"subject",children:"Sujet *"}),s.jsx(Xe,{id:"subject",value:v,onChange:B=>y(B.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:b,onChange:B=>N(B.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(Ar,{value:j,onValueChange:B=>_(B),children:[s.jsx(kr,{children:s.jsx(Dr,{})}),s.jsxs(Cr,{children:[s.jsx(ct,{value:"both",children:"Tous"}),s.jsx(ct,{value:"signed_up",children:"Inscrits"}),s.jsx(ct,{value:"imported",children:"Liste importée"}),s.jsx(ct,{value:"uncertified",children:"Inscrits sans contrat signé"})]})]})]}),s.jsxs("div",{children:[s.jsx(We,{children:"Ville"}),s.jsxs(Ar,{value:S,onValueChange:P,children:[s.jsx(kr,{children:s.jsx(Dr,{})}),s.jsxs(Cr,{children:[s.jsx(ct,{value:im,children:"Toutes"}),L.map(B=>s.jsx(ct,{value:B,children:B},B))]})]})]}),s.jsxs("div",{children:[s.jsx(We,{children:"Module"}),s.jsxs(Ar,{value:T,onValueChange:R,children:[s.jsx(kr,{children:s.jsx(Dr,{})}),s.jsxs(Cr,{children:[s.jsx(ct,{value:im,children:"Tous"}),H.map(B=>s.jsx(ct,{value:B,children:B},B))]})]})]})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs(ne,{variant:"outline",onClick:()=>x(!0),disabled:!v||!b,children:[s.jsx(es,{className:"mr-2 h-4 w-4"}),"Aperçu"]}),s.jsx(ne,{onClick:M,disabled:u||!v||!b||z===0,className:"flex-1",children:u?s.jsxs(s.Fragment,{children:[s.jsx(it,{className:"mr-2 h-4 w-4 animate-spin"}),p||"Envoi en cours…"]}):s.jsxs(s.Fragment,{children:[s.jsx(Js,{className:"mr-2 h-4 w-4"}),"Envoyer à ",z," formateurs"]})})]})]})]}),s.jsxs(je,{children:[s.jsxs(mt,{children:[s.jsx(gt,{children:"Importer une liste (CSV)"}),s.jsx(Kr,{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(Ee,{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(Xe,{id:"csv-upload",type:"file",accept:".csv,text/csv",disabled:f,onChange:B=>{var C;const K=(C=B.target.files)==null?void 0:C[0];K&&E(K),B.target.value=""}}),f&&s.jsx(it,{className:"w-5 h-5 animate-spin text-primary"})]}),s.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:[s.jsx(lc,{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(B=>s.jsxs("div",{className:"flex items-center justify-between p-2 rounded border",children:[s.jsx("span",{className:"truncate",children:B.email}),B.first_name&&s.jsx(Te,{variant:"secondary",className:"text-xs",children:B.first_name})]},B.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(qn,{open:h,onOpenChange:x,children:s.jsxs($n,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[s.jsxs(Un,{children:[s.jsx(Vn,{children:"Aperçu de l'email"}),s.jsx(Sa,{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>"+(b.replace(/\n/g,"<br>")||"<p>Contenu…</p>")}})]})]})})]})})}const oCt=()=>{const{tag:e}=so(),t=e?decodeURIComponent(e).replace(/-/g," "):"",r=t.charAt(0).toUpperCase()+t.slice(1),{data:n,isLoading:a}=la({queryKey:["skill-trainers",t],queryFn:async()=>{const{data:l,error:c}=await ce.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}=la({queryKey:["skill-offers",t],queryFn:async()=>{const{data:l,error:c}=await ce.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(nr,{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(ms,{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(nt,{to:"/",className:"hover:text-primary",children:"Accueil"}),s.jsx(nu,{className:"h-4 w-4"}),s.jsx(nt,{to:"/skills",className:"hover:text-primary",children:"Compétences"}),s.jsx(nu,{className:"h-4 w-4"}),s.jsx("span",{className:"text-foreground font-medium",children:r})]}),s.jsxs("div",{className:"mb-12",children:[s.jsxs(nt,{to:"/skills",className:"inline-flex items-center text-muted-foreground hover:text-primary mb-4",children:[s.jsx(Hn,{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(er,{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(je,{children:s.jsxs(mt,{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(je,{children:s.jsxs(Ee,{className:"py-12 text-center",children:[s.jsx(er,{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(nt,{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(nt,{to:`/trainers/${l.id}`,children:[s.jsxs(je,{className:"h-full hover:shadow-lg transition-shadow cursor-pointer group",children:[s.jsx(mt,{children:s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsxs(bs,{className:"h-16 w-16",children:[s.jsx(ji,{src:l.photo_url||void 0}),s.jsx(ws,{children:s.jsx(Ko,{className:"h-8 w-8"})})]}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx(gt,{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(Ee,{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(Te,{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(Te,{variant:"outline",className:"text-xs",children:["+",l.specialties.length-4]})]})})]}),s.jsx(b1,{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(nt,{to:`/training-offers/${l.id}`,children:s.jsxs(je,{className:"h-full hover:shadow-lg transition-shadow cursor-pointer",children:[s.jsxs(mt,{children:[s.jsx(gt,{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(Ee,{children:s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(Is,{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(nt,{to:"/trainer-signup",children:"Devenir formateur"})}),s.jsx(ne,{asChild:!0,variant:"outline",size:"lg",children:s.jsx(nt,{to:"/training-request",children:"Publier une offre"})})]})]})]})]})},lCt=[{icon:fye,title:"Émargement digital",description:"Feuilles de présence numériques, signatures électroniques, rapports automatiques"},{icon:Hs,title:"Gestion du calendrier",description:"Planning des formations, disponibilité des formateurs, synchronisation agenda"},{icon:Kt,title:"Facturation automatisée",description:"Génération de factures, suivi des paiements, exports comptables"},{icon:er,title:"Publication illimitée",description:"Publiez autant d'offres de formation que vous le souhaitez"},{icon:Mi,title:"Support prioritaire",description:"Assistance dédiée et accompagnement personnalisé"},{icon:Jo,title:"Conformité Qualiopi",description:"Outils conformes aux exigences du référentiel qualité"}],cCt=[{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 uCt(){const{user:e}=Br(),t=Zt(),[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 ce.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(nr,{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(Te,{className:"mb-6",variant:"secondary",children:[s.jsx(wC,{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(Zr,{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($r,{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(Na,{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(yr,{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:lCt.map((o,l)=>{const c=o.icon;return s.jsxs(je,{className:"border-border/50 hover:shadow-lg transition-shadow",children:[s.jsxs(mt,{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(gt,{className:"text-xl",children:o.title})]}),s.jsx(Ee,{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(je,{className:"border-primary/50 shadow-lg",children:[s.jsxs(mt,{className:"text-center pb-2",children:[s.jsx(Te,{className:"w-fit mx-auto mb-4",variant:"secondary",children:"Offre unique"}),s.jsx(gt,{className:"text-3xl",children:"Abonnement Premium"}),s.jsx(Kr,{children:"Tous les outils inclus, développés sur-mesure pour vous"})]}),s.jsxs(Ee,{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(Rn,{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(Rn,{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(Rn,{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(Rn,{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(Rn,{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(Rn,{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(Rn,{className:"h-5 w-5 text-primary flex-shrink-0"}),s.jsx("span",{children:"Évolutions et mises à jour incluses"})]})]})]}),s.jsx(bse,{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:cCt.map((o,l)=>s.jsx(je,{className:"border-border/50",children:s.jsxs(Ee,{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(Zr,{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 dCt=[{slug:"informatique",title:"Informatique & Digital",description:"Développement, cybersécurité, data, cloud et technologies numériques",icon:DQ,trainersCount:"50+"},{slug:"commerce",title:"Commerce & Marketing",description:"Vente, négociation, marketing digital et relation client",icon:Bye,trainersCount:"30+"},{slug:"management",title:"Management & Leadership",description:"Management d'équipe, leadership et gestion de projet",icon:er,trainersCount:"25+"},{slug:"sante",title:"Santé & Secourisme",description:"SST, PSC1, premiers secours et prévention des risques",icon:FR,trainersCount:"20+"},{slug:"langues",title:"Langues & International",description:"Anglais professionnel, FLE et langues étrangères",icon:ap,trainersCount:"15+"},{slug:"rh",title:"Ressources Humaines",description:"Recrutement, droit du travail, paie et GPEC",icon:Qn,trainersCount:"20+"}];function fCt(){return s.jsxs(s.Fragment,{children:[s.jsx(nr,{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(Te,{className:"mb-4",variant:"secondary",children:[s.jsx(Na,{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:dCt.map(e=>{const t=e.icon;return s.jsx(nt,{to:`/ecoles-secteur/${e.slug}`,children:s.jsxs(je,{className:"h-full hover:shadow-lg hover:border-primary/50 transition-all cursor-pointer",children:[s.jsxs(mt,{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(Te,{variant:"secondary",children:[e.trainersCount," formateurs"]})]}),s.jsxs(gt,{className:"flex items-center gap-2",children:[e.title,s.jsx(Zr,{className:"h-4 w-4 text-muted-foreground"})]})]}),s.jsx(Ee,{children:s.jsx("p",{className:"text-muted-foreground",children:e.description})})]})},e.slug)})})})})]})}const hCt={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 mCt(){const{sector:e}=so(),[t,r]=w.useState([]),[n,a]=w.useState(!0),i=e?hCt[e]:null;return w.useEffect(()=>{if(!i)return;dn.trackPageView(`School Sector Landing - ${i.title}`,{pageType:"school_sector_landing",sector:e}),(async()=>{try{const{data:l,error:c}=await ce.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(nr,{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(Te,{className:"mb-4",variant:"secondary",children:[s.jsx(yr,{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(nt,{to:"/inscription-ecole",children:s.jsxs(ne,{size:"lg",children:["Publier une offre",s.jsx(Zr,{className:"ml-2 h-4 w-4"})]})}),s.jsx(nt,{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(it,{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(je,{className:"hover:shadow-lg transition-shadow",children:[s.jsxs(mt,{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(er,{className:"h-6 w-6 text-primary"})}),s.jsxs("div",{children:[s.jsx(gt,{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(Te,{variant:"secondary",className:"text-xs",children:l},c))})]})]}),s.jsxs(Ee,{children:[s.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-4",children:o.bio||"Expert formateur certifié"}),s.jsx(nt,{to:`/formateur/${o.id}`,children:s.jsx(ne,{variant:"outline",size:"sm",className:"w-full",children:"Voir le profil"})})]})]},o.id))}):s.jsxs(je,{className:"p-8 text-center",children:[s.jsx(Na,{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(nt,{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(nt,{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(nt,{to:"/ecoles-secteur",children:s.jsx(ne,{children:"Voir tous les secteurs"})})]})}const pCt=[{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 xCt(){return s.jsxs(s.Fragment,{children:[s.jsx(nr,{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(Te,{className:"mb-4",variant:"secondary",children:[s.jsx(Na,{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:pCt.map(e=>s.jsx(nt,{to:`/ecoles-region/${e.slug}`,children:s.jsxs(je,{className:"h-full hover:shadow-lg hover:border-primary/50 transition-all cursor-pointer",children:[s.jsx(mt,{className:"pb-2",children:s.jsxs(gt,{className:"flex items-center gap-2 text-lg",children:[s.jsx(Is,{className:"h-4 w-4 text-primary"}),e.name,s.jsx(Zr,{className:"h-4 w-4 text-muted-foreground ml-auto"})]})}),s.jsx(Ee,{children:s.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.departments.length," départements couverts"]})})]})},e.slug))})})})]})}const gCt={"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 vCt(){const{region:e}=so(),[t,r]=w.useState([]),[n,a]=w.useState(!0),i=e?gCt[e]:null;return w.useEffect(()=>{if(!i)return;dn.trackPageView(`School Region Landing - ${i.name}`,{pageType:"school_region_landing",region:e}),(async()=>{try{const{data:l,error:c}=await ce.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(nr,{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(Te,{className:"mb-4",variant:"secondary",children:[s.jsx(Is,{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(nt,{to:"/inscription-ecole",children:s.jsxs(ne,{size:"lg",children:["Publier une offre",s.jsx(Zr,{className:"ml-2 h-4 w-4"})]})}),s.jsx(nt,{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(Te,{variant:"outline",children:[o," - ",dv(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(it,{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(je,{className:"hover:shadow-lg transition-shadow",children:[s.jsxs(mt,{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(er,{className:"h-6 w-6 text-primary"})}),s.jsxs("div",{children:[s.jsx(gt,{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(Te,{variant:"secondary",className:"text-xs",children:l},c))})]})]}),s.jsxs(Ee,{children:[s.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-4",children:o.bio||"Expert formateur certifié"}),s.jsx(nt,{to:`/formateur/${o.id}`,children:s.jsx(ne,{variant:"outline",size:"sm",className:"w-full",children:"Voir le profil"})})]})]},o.id))}):s.jsxs(je,{className:"p-8 text-center",children:[s.jsx(Na,{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(nt,{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(nt,{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(nt,{to:"/ecoles-region",children:s.jsx(ne,{children:"Voir toutes les régions"})})]})}const yCt="https://pedagobridge.com/functions/v1/ai-assistant",bCt=[{icon:er,text:"Comment trouver un formateur ?",category:"Recherche"},{icon:Kt,text:"Comment publier une offre de formation ?",category:"Écoles"},{icon:_l,text:"Comment m'inscrire comme formateur ?",category:"Formateurs"},{icon:gx,text:"Comment fonctionne la plateforme ?",category:"Général"}];function wCt(){var p;const e=Zt(),{user:t,loading:r}=Br(),[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 g=>{var _,S,P;const v=await fetch(yCt,{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiIsImlzcyI6InN1cGFiYXNlIiwiaWF0IjoxNzc2MjQzNzQyLCJleHAiOjIwOTE2MDM3NDJ9.73Zk3EieShL_u8EKlAW2LekPnT1agaI3de2bE8hkWq4"},body:JSON.stringify({messages:g,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 y=v.body.getReader(),b=new TextDecoder;let N="",j="";for(;;){const{done:T,value:R}=await y.read();if(T)break;N+=b.decode(R,{stream:!0});let k;for(;(k=N.indexOf(`
`))!==-1;){let E=N.slice(0,k);if(N=N.slice(k+1),E.endsWith("\r")&&(E=E.slice(0,-1)),E.startsWith(":")||E.trim()===""||!E.startsWith("data: "))continue;const q=E.slice(6).trim();if(q==="[DONE]")break;try{const L=(P=(S=(_=JSON.parse(q).choices)==null?void 0:_[0])==null?void 0:S.delta)==null?void 0:P.content;L&&(j+=L,a(H=>{const V=H[H.length-1];return(V==null?void 0:V.role)==="assistant"?H.map((z,M)=>M===H.length-1?{...z,content:j}:z):[...H,{role:"assistant",content:j}]}))}catch{N=E+`
`+N;break}}}},m=async g=>{var y;if(!g.trim()||l)return;const v={role:"user",content:g.trim()};a(b=>[...b,v]),o(""),c(!0);try{await f([...n,v])}catch(b){console.error("Chat error:",b),ae.error(b instanceof Error?b.message:"Erreur de l'assistant"),a(N=>{const j=N[N.length-1];return(j==null?void 0:j.role)==="assistant"&&!j.content?N.slice(0,-1):N})}finally{c(!1),(y=d.current)==null||y.focus()}},h=g=>{g.preventDefault(),m(i)},x=g=>{m(g)};return r?s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:s.jsx(it,{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(nr,{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(Dm,{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(je,{className:"shadow-lg border-primary/10",children:[s.jsx(mt,{className:"border-b bg-muted/30",children:s.jsxs(gt,{className:"flex items-center gap-2 text-lg",children:[s.jsx(Mi,{className:"h-5 w-5 text-primary"}),"Conversation"]})}),s.jsxs(Ee,{className:"p-0",children:[s.jsx(su,{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:bCt.map((g,v)=>s.jsxs(ne,{variant:"outline",className:"h-auto p-4 justify-start text-left hover:bg-primary/5 hover:border-primary/30",onClick:()=>x(g.text),children:[s.jsx(g.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:g.category}),s.jsx("div",{className:"font-medium",children:g.text})]})]},v))})]}):s.jsxs("div",{className:"space-y-4",children:[n.map((g,v)=>s.jsxs("div",{className:`flex gap-3 ${g.role==="user"?"justify-end":"justify-start"}`,children:[g.role==="assistant"&&s.jsx(bs,{className:"h-8 w-8 shrink-0",children:s.jsx(ws,{className:"bg-primary/10 text-primary",children:s.jsx(Dm,{className:"h-4 w-4"})})}),s.jsx("div",{className:`max-w-[80%] rounded-2xl px-4 py-2 ${g.role==="user"?"bg-primary text-primary-foreground":"bg-muted"}`,children:s.jsx("p",{className:"whitespace-pre-wrap text-sm",children:g.content})}),g.role==="user"&&s.jsx(bs,{className:"h-8 w-8 shrink-0",children:s.jsx(ws,{className:"bg-secondary",children:s.jsx(Ko,{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(bs,{className:"h-8 w-8 shrink-0",children:s.jsx(ws,{className:"bg-primary/10 text-primary",children:s.jsx(Dm,{className:"h-4 w-4"})})}),s.jsx("div",{className:"bg-muted rounded-2xl px-4 py-2",children:s.jsx(it,{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(Xe,{ref:d,value:i,onChange:g=>o(g.target.value),placeholder:"Posez votre question...",disabled:l,className:"flex-1"}),s.jsx(ne,{type:"submit",disabled:l||!i.trim(),children:l?s.jsx(it,{className:"h-4 w-4 animate-spin"}):s.jsx(Js,{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 Zpe({label:e,href:t,scrollToId:r}){const n=Zt(),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(Zr,{className:"h-4 w-4"})]})})}const jCt=[{step:"1",icon:_l,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:Rs,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é."}],_Ct=[{icon:Ql,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:er,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:sp,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:wi,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}],NCt=[{icon:qye,title:"Formateurs vérifiés",description:"Chaque formateur est validé par notre équipe : diplômes, expérience, références vérifiés."},{icon:$r,title:"Réponse rapide",description:"Première candidature reçue en moyenne dans les 24h suivant la publication de votre offre."},{icon:wC,title:"Zéro commission cachée",description:"Tarification transparente. Vous payez le formateur, pas PedagoBridge en intermédiaire."},{icon:Na,title:"Conformité Qualiopi",description:"Nos outils et processus sont conçus pour respecter le référentiel qualité national."}],_Y=[{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 SCt(){const e=Zt(),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(nr,{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(ao,{items:_Y}),s.jsx(au,{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(Te,{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(yr,{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(er,{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:jCt.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:_Ct.map(r=>{const n=r.icon;return s.jsxs(je,{className:r.highlight?"border-primary/40 bg-primary/5":"",children:[s.jsx(mt,{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(gt,{className:"text-lg",children:[r.highlight&&s.jsx(Te,{className:"mr-2 text-xs",children:"Nouveau"}),r.title]})]})}),s.jsxs(Ee,{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(Zr,{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:NCt.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(je,{className:"bg-background",children:s.jsxs(Ee,{className:"p-6",children:[s.jsx("div",{className:"flex gap-1 mb-3",children:Array.from({length:5}).map((n,a)=>s.jsx(no,{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:_Y.map(r=>s.jsxs(je,{children:[s.jsx(mt,{className:"pb-2",children:s.jsx(gt,{className:"text-base font-semibold",children:r.question})}),s.jsx(Ee,{children:s.jsx("p",{className:"text-sm text-muted-foreground",children:r.answer})})]},r.question))})]})}),s.jsx(Zpe,{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(Na,{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(Zr,{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 NY=[{icon:Sp,title:"Analyse des besoins",description:"Un conseiller pédagogique PedagoBridge analyse vos objectifs, votre public cible et les contraintes de votre établissement."},{icon:_l,title:"Architecture pédagogique",description:"Nous structurons votre programme : découpage en modules, progression, évaluations, volumes horaires et prérequis."},{icon:er,title:"Sélection des formateurs",description:"Nous identifions dans notre réseau les formateurs experts correspondant à chaque module de votre programme."},{icon:n1,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."}],kCt=["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"],CCt=["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"],SY=[{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 ECt(){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 ce.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(nr,{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(ao,{items:SY}),s.jsx(ms,{items:[{name:"Accueil",url:"/"},{name:"Pour les établissements",url:"/pour-les-ecoles"},{name:"Constitution de programmes",url:"/constitution-de-programme"}]}),s.jsx(au,{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(Te,{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:NY.map((u,d)=>{const f=u.icon;return s.jsxs("div",{className:"relative",children:[d<NY.length-1&&s.jsx(Zr,{className:"hidden lg:block absolute top-6 -right-3 h-5 w-5 text-primary/30 z-10"}),s.jsxs(je,{className:"h-full",children:[s.jsxs(mt,{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(gt,{className:"text-base",children:u.title})]}),s.jsx(Ee,{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:kCt.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(je,{className:"border-primary/20 bg-primary/5",children:s.jsxs(Ee,{className:"p-4 flex gap-3",children:[s.jsx($R,{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(je,{className:"border-green-200 bg-green-50 dark:bg-green-950/20",children:s.jsxs(Ee,{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(je,{children:[s.jsxs(mt,{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(yr,{className:"h-5 w-5 text-primary"}),s.jsx(gt,{children:"Soumettre votre demande"})]}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Entretien de cadrage gratuit — Réponse sous 48h"})]}),s.jsx(Ee,{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(Xe,{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(Xe,{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(Xe,{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(Xe,{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(Ar,{onValueChange:u=>o("domain",u),children:[s.jsx(kr,{children:s.jsx(Dr,{placeholder:"Sélectionnez un domaine"})}),s.jsx(Cr,{children:CCt.map(u=>s.jsx(ct,{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(Xe,{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(Xe,{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(it,{className:"mr-2 h-4 w-4 animate-spin"}),"Envoi en cours..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Ql,{className:"mr-2 h-4 w-4"}),"Envoyer ma demande"]})})]})})]})})]})})}),s.jsx(Zpe,{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:SY.map(u=>s.jsxs(je,{children:[s.jsx(mt,{className:"pb-2",children:s.jsx(gt,{className:"text-base font-semibold",children:u.question})}),s.jsx(Ee,{children:s.jsx("p",{className:"text-sm text-muted-foreground",children:u.answer})})]},u.question))})]})})]})}const ACt=[{icon:Kt,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:s1,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:er,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."}],TCt=[{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."}],kY=[{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 PCt(){const e=Zt(),{user:t}=Br(),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(nr,{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(ao,{items:kY}),s.jsx(ms,{items:[{name:"Accueil",url:"/"},{name:"Formateurs",url:"/trainers"},{name:"Assistance NDA",url:"/assistance-nda"}]}),s.jsx(au,{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(Te,{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(wi,{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(Kt,{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(er,{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(Zr,{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:ACt.map(n=>{const a=n.icon;return s.jsxs(je,{className:"text-center",children:[s.jsxs(mt,{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(gt,{className:"text-base",children:n.title})]}),s.jsx(Ee,{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(Li,{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:TCt.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($r,{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(wi,{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(er,{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:no,title:"Badge « NDA Vérifié »",description:"Votre profil affiche un badge de confiance visible par tous les établissements qui recherchent des formateurs."},{icon:_l,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:er,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:kY.map(n=>s.jsxs(je,{children:[s.jsx(mt,{className:"pb-2",children:s.jsx(gt,{className:"text-base font-semibold",children:n.question})}),s.jsx(Ee,{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(wi,{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(Zr,{className:"ml-2 h-5 w-5"})]})]})})]})}const OCt=[{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}}],DCt=[{icon:$r,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:td,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:s1,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:wC,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."}],CY=[{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 ICt(){const e=Zt(),t=({good:r})=>r===!0?s.jsx(Wr,{className:"h-5 w-5 text-green-500 mx-auto"}):r===!1?s.jsx(vs,{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(nr,{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(ao,{items:CY}),s.jsx(ms,{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(Te,{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(Zr,{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:DCt.map(r=>{const n=r.icon;return s.jsxs(je,{className:"border-red-100 dark:border-red-900/30",children:[s.jsx(mt,{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(gt,{className:"text-base",children:r.title})]})}),s.jsxs(Ee,{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(wi,{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:OCt.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:CY.map(r=>s.jsxs(je,{children:[s.jsx(mt,{className:"pb-2",children:s.jsx(gt,{className:"text-base font-semibold",children:r.question})}),s.jsx(Ee,{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(er,{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(yr,{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 KS="2026-06-11",RCt=[{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}],LCt=[{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."}],EY=[{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 FCt(){const{data:e}=la({queryKey:["network-tjm"],queryFn:async()=>{const{data:t,error:r}=await ce.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(ba,{children:[s.jsx(nr,{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:KS,modifiedTime:KS,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(pae,{}),s.jsx(JL,{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:KS,modifiedTime:KS,url:"/tarif-formateur"}),s.jsx(ao,{items:EY}),s.jsx(ms,{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(nt,{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(nt,{to:"/training-request?utm_source=tarif_formateur&utm_medium=cta",children:["Publier un besoin gratuitement ",s.jsx(Zr,{className:"ml-2 h-4 w-4"})]})}),s.jsx(ne,{asChild:!0,variant:"outline",size:"lg",children:s.jsx(nt,{to:"/formateurs",children:"Parcourir les formateurs"})})]}),e&&s.jsx(je,{className:"mb-8 border-primary/30 bg-primary/5",children:s.jsxs(Ee,{className:"flex items-center gap-3 py-4",children:[s.jsx(ed,{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(gC,{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:RCt.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(nt,{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:LCt.map(t=>s.jsxs(je,{children:[s.jsx(mt,{className:"pb-2",children:s.jsx(gt,{className:"text-base",children:t.level})}),s.jsxs(Ee,{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(je,{children:s.jsxs(Ee,{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(Zn,{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:EY.map(t=>s.jsxs(je,{children:[s.jsx(mt,{className:"pb-2",children:s.jsx(gt,{className:"text-base",children:t.question})}),s.jsx(Ee,{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(Is,{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(Te,{variant:"secondary",asChild:!0,children:s.jsxs(nt,{to:`/villes/${t.toLowerCase().normalize("NFD").replace(/[̀-ͯ]/g,"").replace(/[^a-z0-9]+/g,"-")}`,children:["Formateurs à ",t]})},t))})]}),s.jsx(je,{className:"bg-gradient-to-br from-primary/10 to-primary/5 border-primary/20",children:s.jsxs(Ee,{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(nt,{to:"/training-request?utm_source=tarif_formateur&utm_medium=cta_bottom",children:["Publier mon besoin ",s.jsx(Zr,{className:"ml-2 h-4 w-4"})]})})]})})]})]})}const XS="2026-06-11",MCt=[{icon:Kt,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:Kt,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:s1,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:Qn,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."}],$Ct=["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."],AY=[{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 BCt(){return s.jsxs(ba,{children:[s.jsx(nr,{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:XS,modifiedTime:XS,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(pae,{}),s.jsx(JL,{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:XS,modifiedTime:XS,url:"/devenir-formateur"}),s.jsx(ao,{items:AY}),s.jsx(ms,{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(nt,{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(nt,{to:"/trainer-register?utm_source=devenir_formateur&utm_medium=cta",children:["Créer mon profil formateur (gratuit) ",s.jsx(Zr,{className:"ml-2 h-4 w-4"})]})}),s.jsx(ne,{asChild:!0,variant:"outline",size:"lg",children:s.jsx(nt,{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:MCt.map(e=>s.jsxs(je,{children:[s.jsx(mt,{className:"pb-2",children:s.jsxs(gt,{className:"text-base flex items-center gap-2",children:[s.jsx(e.icon,{className:"h-5 w-5 text-primary"})," ",e.title]})}),s.jsxs(Ee,{children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:e.body}),e.link&&s.jsx(nt,{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(Mi,{className:"h-6 w-6 text-primary"})," Pourquoi rejoindre PedagoBridge ?"]}),s.jsx(je,{children:s.jsx(Ee,{className:"py-5",children:s.jsx("ul",{className:"space-y-3",children:$Ct.map(e=>s.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[s.jsx(Zn,{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:AY.map(e=>s.jsxs(je,{children:[s.jsx(mt,{className:"pb-2",children:s.jsx(gt,{className:"text-base",children:e.question})}),s.jsx(Ee,{children:s.jsx("p",{className:"text-sm text-muted-foreground",children:e.answer})})]},e.question))})]}),s.jsx(je,{className:"bg-gradient-to-br from-primary/10 to-primary/5 border-primary/20",children:s.jsxs(Ee,{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(nt,{to:"/trainer-register?utm_source=devenir_formateur&utm_medium=cta_bottom",children:["Créer mon profil formateur ",s.jsx(Zr,{className:"ml-2 h-4 w-4"})]})})]})})]})]})}const zCt=new i2e;function qCt(){const e=cu();return w.useEffect(()=>{Oi.pageView(e.pathname,{search:e.search}),dn.trackPageView(e.pathname,{search:e.search})},[e]),s.jsx(ba,{children:s.jsxs(mje,{children:[s.jsx(St,{path:"/",element:s.jsx(c6e,{})}),s.jsx(St,{path:"/fonctionnalites",element:s.jsx(m6e,{})}),s.jsx(St,{path:"/fonctionnalites/planning-formateur",element:s.jsx(g6e,{})}),s.jsx(St,{path:"/fonctionnalites/assistant-bpf",element:s.jsx(b6e,{})}),s.jsx(St,{path:"/outils/planning-bpf",element:s.jsx(N6e,{})}),s.jsx(St,{path:"/ecoles",element:s.jsx(S6e,{})}),s.jsx(St,{path:"/ecoles/:id",element:s.jsx(k6e,{})}),s.jsx(St,{path:"/guide-formateur",element:s.jsx(T6e,{})}),s.jsx(St,{path:"/conseil-conduite-du-changement",element:s.jsx(I6e,{})}),s.jsx(St,{path:"/formation-entreprise",element:s.jsx(F6e,{})}),s.jsx(St,{path:"/auth",element:s.jsx(U6e,{})}),s.jsx(St,{path:"/reset-password",element:s.jsx(tvt,{})}),s.jsx(St,{path:"/trainer-register",element:s.jsx(o8e,{})}),s.jsx(St,{path:"/trainer-signup",element:s.jsx(jMe,{})}),s.jsx(St,{path:"/training-request",element:s.jsx(tBe,{})}),s.jsx(St,{path:"/training-offers",element:s.jsx(YUe,{})}),s.jsx(St,{path:"/training-offers/:id",element:s.jsx(JUe,{})}),s.jsx(St,{path:"/blog",element:s.jsx(UUe,{})}),s.jsx(St,{path:"/blog/:slug",element:s.jsx(HUe,{})}),s.jsx(St,{path:"/trainers",element:s.jsx(iX,{})}),s.jsx(St,{path:"/trainers/:id",element:s.jsx(zP,{})}),s.jsx(St,{path:"/skills",element:s.jsx(rvt,{})}),s.jsx(St,{path:"/skills/:skillName",element:s.jsx(xvt,{})}),s.jsx(St,{path:"/villes",element:s.jsx(gvt,{})}),s.jsx(St,{path:"/villes/:cityName",element:s.jsx(yvt,{})}),s.jsx(St,{path:"/villes/:cityName/:skillName",element:s.jsx(wvt,{})}),s.jsx(St,{path:"/recruiter-tools/interview-questions",element:s.jsx(_vt,{})}),s.jsx(St,{path:"/recruiter-tools/interview-questions/:skillName",element:s.jsx(jvt,{})}),s.jsx(St,{path:"/glossaire",element:s.jsx(Nvt,{})}),s.jsx(St,{path:"/glossaire/:slug",element:s.jsx(Svt,{})}),s.jsx(St,{path:"/metiers",element:s.jsx(Cvt,{})}),s.jsx(St,{path:"/metier/:slug",element:s.jsx(Evt,{})}),s.jsx(St,{path:"/ressources",element:s.jsx(zvt,{})}),s.jsx(St,{path:"/ressources/:slug",element:s.jsx(Uvt,{})}),s.jsx(St,{path:"/competence/:tag",element:s.jsx(oCt,{})}),s.jsx(St,{path:"/school-register",element:s.jsx(qP,{})}),s.jsx(St,{path:"/school/dashboard",element:s.jsx(oX,{})}),s.jsx(St,{path:"/school/profile",element:s.jsx(Vgt,{})}),s.jsx(St,{path:"/school/messages",element:s.jsx(Kgt,{})}),s.jsx(St,{path:"/school/applications",element:s.jsx(Jgt,{})}),s.jsx(St,{path:"/school/edit-offer/:id",element:s.jsx(evt,{})}),s.jsx(St,{path:"/privacy",element:s.jsx($U,{})}),s.jsx(St,{path:"/terms",element:s.jsx(wMe,{})}),s.jsx(St,{path:"/tarifs-planning",element:s.jsx(K$e,{})}),s.jsx(St,{path:"/feedback",element:s.jsx(Y$e,{})}),s.jsx(St,{path:"/assistant",element:s.jsx(wCt,{})}),s.jsx(St,{path:"/outils/matching",element:s.jsx(Lvt,{})}),s.jsx(St,{path:"/trainer/profile",element:s.jsx(vn,{requireTrainer:!0,children:s.jsx(C$e,{})})}),s.jsx(St,{path:"/trainer/contract",element:s.jsx(vn,{requireTrainer:!0,children:s.jsx(KUe,{})})}),s.jsx(St,{path:"/trainer-contract",element:s.jsx(D9,{to:"/trainer/contract",replace:!0})}),s.jsx(St,{path:"/trainer/applications",element:s.jsx(vn,{requireTrainer:!0,children:s.jsx(E$e,{})})}),s.jsx(St,{path:"/trainer/messages",element:s.jsx(vn,{requireTrainer:!0,children:s.jsx(A$e,{})})}),s.jsx(St,{path:"/trainer/planning",element:s.jsx(vn,{requireTrainer:!0,children:s.jsx(q$e,{})})}),s.jsx(St,{path:"/trainer/bpf",element:s.jsx(vn,{requireTrainer:!0,children:s.jsx(H$e,{})})}),s.jsx(St,{path:"/admin",element:s.jsx(vn,{requireAdmin:!0,children:s.jsx(M8e,{})})}),s.jsx(St,{path:"/admin/invitations",element:s.jsx(vn,{requireAdmin:!0,children:s.jsx($8e,{})})}),s.jsx(St,{path:"/admin/trainers",element:s.jsx(vn,{requireAdmin:!0,children:s.jsx(UDe,{})})}),s.jsx(St,{path:"/admin/blog",element:s.jsx(vn,{requireAdmin:!0,children:s.jsx(WUe,{})})}),s.jsx(St,{path:"/admin/blog/edit/:id",element:s.jsx(vn,{requireAdmin:!0,children:s.jsx(GUe,{})})}),s.jsx(St,{path:"/admin/editorial-calendar",element:s.jsx(vn,{requireAdmin:!0,children:s.jsx(jRe,{})})}),s.jsx(St,{path:"/admin/newsletter",element:s.jsx(vn,{requireAdmin:!0,children:s.jsx(_Re,{})})}),s.jsx(St,{path:"/admin/training-requests",element:s.jsx(vn,{requireAdmin:!0,children:s.jsx(QUe,{})})}),s.jsx(St,{path:"/admin/email-dashboard",element:s.jsx(vn,{requireAdmin:!0,children:s.jsx(Agt,{})})}),s.jsx(St,{path:"/admin/logs",element:s.jsx(vn,{requireAdmin:!0,children:s.jsx(Ogt,{})})}),s.jsx(St,{path:"/admin/analytics",element:s.jsx(vn,{requireAdmin:!0,children:s.jsx(Dgt,{})})}),s.jsx(St,{path:"/admin/schools",element:s.jsx(vn,{requireAdmin:!0,children:s.jsx(Igt,{})})}),s.jsx(St,{path:"/admin/school/:id",element:s.jsx(vn,{requireAdmin:!0,children:s.jsx(Rgt,{})})}),s.jsx(St,{path:"/admin/invoices",element:s.jsx(vn,{requireAdmin:!0,children:s.jsx(Fgt,{})})}),s.jsx(St,{path:"/admin/contracts",element:s.jsx(vn,{requireAdmin:!0,children:s.jsx(pMe,{})})}),s.jsx(St,{path:"/admin/missions",element:s.jsx(vn,{requireAdmin:!0,children:s.jsx(gMe,{})})}),s.jsx(St,{path:"/admin/planning",element:s.jsx(vn,{requireAdmin:!0,children:s.jsx(bMe,{})})}),s.jsx(St,{path:"/admin/school-reviews",element:s.jsx(vn,{requireAdmin:!0,children:s.jsx(Lgt,{})})}),s.jsx(St,{path:"/admin/glossary",element:s.jsx(vn,{requireAdmin:!0,children:s.jsx(kvt,{})})}),s.jsx(St,{path:"/admin/matcher",element:s.jsx(vn,{requireAdmin:!0,children:s.jsx(Ovt,{})})}),s.jsx(St,{path:"/admin/linkedin-scanner",element:s.jsx(vn,{requireAdmin:!0,children:s.jsx(Mvt,{})})}),s.jsx(St,{path:"/admin/linkedin-lead",element:s.jsx(vn,{requireAdmin:!0,children:s.jsx($vt,{})})}),s.jsx(St,{path:"/admin/jobs",element:s.jsx(vn,{requireAdmin:!0,children:s.jsx(Avt,{})})}),s.jsx(St,{path:"/admin/resources",element:s.jsx(vn,{requireAdmin:!0,children:s.jsx(Wvt,{})})}),s.jsx(St,{path:"/admin/contact-messages",element:s.jsx(vn,{requireAdmin:!0,children:s.jsx(Gvt,{})})}),s.jsx(St,{path:"/admin/documents",element:s.jsx(vn,{requireAdmin:!0,children:s.jsx(Xvt,{})})}),s.jsx(St,{path:"/admin/drive",element:s.jsx(vn,{requireAdmin:!0,children:s.jsx(Zvt,{})})}),s.jsx(St,{path:"/admin/off-platform-trainers",element:s.jsx(vn,{requireAdmin:!0,children:s.jsx(Qvt,{})})}),s.jsx(St,{path:"/admin/nda-requests",element:s.jsx(vn,{requireAdmin:!0,children:s.jsx(eyt,{})})}),s.jsx(St,{path:"/admin/trainer-mailing",element:s.jsx(vn,{requireAdmin:!0,children:s.jsx(iCt,{})})}),s.jsx(St,{path:"/admin/prospection",element:s.jsx(vn,{requireAdmin:!0,children:s.jsx(nCt,{})})}),s.jsx(St,{path:"/pour-les-ecoles",element:s.jsx(SCt,{})}),s.jsx(St,{path:"/constitution-de-programme",element:s.jsx(ECt,{})}),s.jsx(St,{path:"/assistance-nda",element:s.jsx(PCt,{})}),s.jsx(St,{path:"/pourquoi-pedagobridge",element:s.jsx(ICt,{})}),s.jsx(St,{path:"/tarif-formateur",element:s.jsx(FCt,{})}),s.jsx(St,{path:"/devenir-formateur",element:s.jsx(BCt,{})}),s.jsx(St,{path:"/offre-ecoles",element:s.jsx(uCt,{})}),s.jsx(St,{path:"/ecoles-secteur",element:s.jsx(fCt,{})}),s.jsx(St,{path:"/ecoles-secteur/:sector",element:s.jsx(mCt,{})}),s.jsx(St,{path:"/ecoles-region",element:s.jsx(xCt,{})}),s.jsx(St,{path:"/ecoles-region/:region",element:s.jsx(vCt,{})}),s.jsx(St,{path:"/formateurs",element:s.jsx(iX,{})}),s.jsx(St,{path:"/formateur/:id",element:s.jsx(zP,{})}),s.jsx(St,{path:"/formateurs/:id",element:s.jsx(zP,{})}),s.jsx(St,{path:"/privacy-policy",element:s.jsx($U,{})}),s.jsx(St,{path:"/inscription-ecole",element:s.jsx(qP,{})}),s.jsx(St,{path:"/ecoles/inscription",element:s.jsx(qP,{})}),s.jsx(St,{path:"/contact",element:s.jsx(D9,{to:"/#contact",replace:!0})}),s.jsx(St,{path:"/ecole/dashboard",element:s.jsx(oX,{})}),s.jsx(St,{path:"*",element:s.jsx(M6e,{})})]})})}const UCt=()=>(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://")||Oi.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)||Oi.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(TEe,{children:s.jsx(d2e,{client:zCt,children:s.jsxs(z0,{children:[s.jsx(C1e,{}),s.jsx(abe,{}),s.jsx(jje,{children:s.jsx(ZNe,{children:s.jsx(qCt,{})})})]})})}));QJ(document.getElementById("root")).render(s.jsx(UCt,{}));export{os as _,zc as c,Sn as g};