1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/BusinessMap-CkCkF-bE.js","assets/BusinessMap-25t4MxmA.css"])))=>i.map(i=>d[i]); 2var HPe=Object.defineProperty;var hX=t=>{throw TypeError(t)};var WPe=(t,e,n)=>e in t?HPe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Te=(t,e,n)=>WPe(t,typeof e!="symbol"?e+"":e,n),$F=(t,e,n)=>e.has(t)||hX("Cannot "+n);var y=(t,e,n)=>($F(t,e,"read from private field"),n?n.call(t):e.get(t)),q=(t,e,n)=>e.has(t)?hX("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),$=(t,e,n,r)=>($F(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),V=(t,e,n)=>($F(t,e,"access private method"),n);var Vr=(t,e,n,r)=>({set _(s){$(t,e,s,n)},get _(){return y(t,e,r)}});function KPe(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in t)){const i=Object.getOwnPropertyDescriptor(r,s);i&&Object.defineProperty(t,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var YS=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function cp(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function _Lt(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var s=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,s.get?s:{enumerable:!0,get:function(){return t[r]}})}),n}var Bce={exports:{}},CL={},Uce={exports:{}},rn={};/** 3 * @license React 4 * react.production.min.js 5 * 6 * Copyright (c) Facebook, Inc. and its affiliates. 7 * 8 * This source code is licensed under the MIT license found in the 9 * LICENSE file in the root directory of this source tree. 10 */var HE=Symbol.for("react.element"),GPe=Symbol.for("react.portal"),YPe=Symbol.for("react.fragment"),XPe=Symbol.for("react.strict_mode"),JPe=Symbol.for("react.profiler"),QPe=Symbol.for("react.provider"),ZPe=Symbol.for("react.context"),eMe=Symbol.for("react.forward_ref"),tMe=Symbol.for("react.suspense"),nMe=Symbol.for("react.memo"),rMe=Symbol.for("react.lazy"),fX=Symbol.iterator;function sMe(t){return t===null||typeof t!="object"?null:(t=fX&&t[fX]||t["@@iterator"],typeof t=="function"?t:null)}var qce={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Vce=Object.assign,Hce={};function yj(t,e,n){this.props=t,this.context=e,this.refs=Hce,this.updater=n||qce}yj.prototype.isReactComponent={};yj.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=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,t,e,"setState")};yj.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function Wce(){}Wce.prototype=yj.prototype;function vH(t,e,n){this.props=t,this.context=e,this.refs=Hce,this.updater=n||qce}var xH=vH.prototype=new Wce;xH.constructor=vH;Vce(xH,yj.prototype);xH.isPureReactComponent=!0;var pX=Array.isArray,Kce=Object.prototype.hasOwnProperty,yH={current:null},Gce={key:!0,ref:!0,__self:!0,__source:!0};function Yce(t,e,n){var r,s={},i=null,o=null;if(e!=null)for(r in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(i=""+e.key),e)Kce.call(e,r)&&!Gce.hasOwnProperty(r)&&(s[r]=e[r]);var l=arguments.length-2;if(l===1)s.children=n;else if(1<l){for(var c=Array(l),u=0;u<l;u++)c[u]=arguments[u+2];s.children=c}if(t&&t.defaultProps)for(r in l=t.defaultProps,l)s[r]===void 0&&(s[r]=l[r]);return{$$typeof:HE,type:t,key:i,ref:o,props:s,_owner:yH.current}}function iMe(t,e){return{$$typeof:HE,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function bH(t){return typeof t=="object"&&t!==null&&t.$$typeof===HE}function aMe(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(n){return e[n]})}var mX=/\/+/g;function zF(t,e){return typeof t=="object"&&t!==null&&t.key!=null?aMe(""+t.key):e.toString(36)}function mM(t,e,n,r,s){var i=typeof t;(i==="undefined"||i==="boolean")&&(t=null);var o=!1;if(t===null)o=!0;else switch(i){case"string":case"number":o=!0;break;case"object":switch(t.$$typeof){case HE:case GPe:o=!0}}if(o)return o=t,s=s(o),t=r===""?"."+zF(o,0):r,pX(s)?(n="",t!=null&&(n=t.replace(mX,"$&/")+"/"),mM(s,e,n,"",function(u){return u})):s!=null&&(bH(s)&&(s=iMe(s,n+(!s.key||o&&o.key===s.key?"":(""+s.key).replace(mX,"$&/")+"/")+t)),e.push(s)),1;if(o=0,r=r===""?".":r+":",pX(t))for(var l=0;l<t.length;l++){i=t[l];var c=r+zF(i,l);o+=mM(i,e,n,c,s)}
vendor: 4,268 bytes, lines 10-18
10else if(c=sMe(t),typeof c=="function")for(t=c.call(t),l=0;!(i=t.next()).done;)i=i.value,c=r+zF(i,l++),o+=mM(i,e,n,c,s);else if(i==="object")throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return o}function mT(t,e,n){if(t==null)return t;var r=[],s=0;return mM(t,r,"","",function(i){return e.call(n,i,s++)}),r}function oMe(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(n){(t._status===0||t._status===-1)&&(t._status=1,t._result=n)},function(n){(t._status===0||t._status===-1)&&(t._status=2,t._result=n)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var go={current:null},gM={transition:null},lMe={ReactCurrentDispatcher:go,ReactCurrentBatchConfig:gM,ReactCurrentOwner:yH};function Xce(){throw Error("act(...) is not supported in production builds of React.")}rn.Children={map:mT,forEach:function(t,e,n){mT(t,function(){e.apply(this,arguments)},n)},count:function(t){var e=0;return mT(t,function(){e++}),e},toArray:function(t){return mT(t,function(e){return e})||[]},only:function(t){if(!bH(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};rn.Component=yj;rn.Fragment=YPe;rn.Profiler=JPe;rn.PureComponent=vH;rn.StrictMode=XPe;rn.Suspense=tMe;rn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=lMe;rn.act=Xce;rn.cloneElement=function(t,e,n){if(t==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var r=Vce({},t.props),s=t.key,i=t.ref,o=t._owner;if(e!=null){if(e.ref!==void 0&&(i=e.ref,o=yH.current),e.key!==void 0&&(s=""+e.key),t.type&&t.type.defaultProps)var l=t.type.defaultProps;for(c in e)Kce.call(e,c)&&!Gce.hasOwnProperty(c)&&(r[c]=e[c]===void 0&&l!==void 0?l[c]:e[c])}var c=arguments.length-2;if(c===1)r.children=n;else if(1<c){l=Array(c);for(var u=0;u<c;u++)l[u]=arguments[u+2];r.children=l}return{$$typeof:HE,type:t.type,key:s,ref:i,props:r,_owner:o}};rn.createContext=function(t){return t={$$typeof:ZPe,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:QPe,_context:t},t.Consumer=t};rn.createElement=Yce;rn.createFactory=function(t){var e=Yce.bind(null,t);return e.type=t,e};rn.createRef=function(){return{current:null}};rn.forwardRef=function(t){return{$$typeof:eMe,render:t}};rn.isValidElement=bH;rn.lazy=function(t){return{$$typeof:rMe,_payload:{_status:-1,_result:t},_init:oMe}};rn.memo=function(t,e){return{$$typeof:nMe,type:t,compare:e===void 0?null:e}};rn.startTransition=function(t){var e=gM.transition;gM.transition={};try{t()}finally{gM.transition=e}};rn.unstable_act=Xce;rn.useCallback=function(t,e){return go.current.useCallback(t,e)};rn.useContext=function(t){return go.current.useContext(t)};rn.useDebugValue=function(){};rn.useDeferredValue=function(t){return go.current.useDeferredValue(t)};rn.useEffect=function(t,e){return go.current.useEffect(t,e)};rn.useId=function(){return go.current.useId()};rn.useImperativeHandle=function(t,e,n){return go.current.useImperativeHandle(t,e,n)};rn.useInsertionEffect=function(t,e){return go.current.useInsertionEffect(t,e)};rn.useLayoutEffect=function(t,e){return go.current.useLayoutEffect(t,e)};rn.useMemo=function(t,e){return go.current.useMemo(t,e)};rn.useReducer=function(t,e,n){return go.current.useReducer(t,e,n)};rn.useRef=function(t){return go.current.useRef(t)};rn.useState=function(t){return go.current.useState(t)};rn.useSyncExternalStore=function(t,e,n){return go.current.useSyncExternalStore(t,e,n)};rn.useTransition=function(){return go.current.useTransition()};rn.version="18.3.1";Uce.exports=rn;var b=Uce.exports;const ve=cp(b),kL=KPe({__proto__:null,default:ve},[b]);/** 11 * @license React 12 * react-jsx-runtime.production.min.js 13 * 14 * Copyright (c) Facebook, Inc. and its affiliates. 15 * 16 * This source code is licensed under the MIT license found in the 17 * LICENSE file in the root directory of this source tree. 18 */var cMe=b,uMe=Symbol.for("react.element"),dMe=Symbol.for("react.fragment"),hMe=Object.prototype.hasOwnProperty,fMe=cMe.__SECRET_INT
vendor: 4,868 bytes, lines 18-33
18ERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,pMe={key:!0,ref:!0,__self:!0,__source:!0};function Jce(t,e,n){var r,s={},i=null,o=null;n!==void 0&&(i=""+n),e.key!==void 0&&(i=""+e.key),e.ref!==void 0&&(o=e.ref);for(r in e)hMe.call(e,r)&&!pMe.hasOwnProperty(r)&&(s[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)s[r]===void 0&&(s[r]=e[r]);return{$$typeof:uMe,type:t,key:i,ref:o,props:s,_owner:fMe.current}}CL.Fragment=dMe;CL.jsx=Jce;CL.jsxs=Jce;Bce.exports=CL;var a=Bce.exports,Qce={exports:{}},Ul={},Zce={exports:{}},eue={};/** 19 * @license React 20 * scheduler.production.min.js 21 * 22 * Copyright (c) Facebook, Inc. and its affiliates. 23 * 24 * This source code is licensed under the MIT license found in the 25 * LICENSE file in the root directory of this source tree. 26 */(function(t){function e(z,B){var G=z.length;z.push(B);e:for(;0<G;){var U=G-1>>>1,F=z[U];if(0<s(F,B))z[U]=B,z[G]=F,G=U;else break e}}function n(z){return z.length===0?null:z[0]}function r(z){if(z.length===0)return null;var B=z[0],G=z.pop();if(G!==B){z[0]=G;e:for(var U=0,F=z.length,W=F>>>1;U<W;){var Q=2*(U+1)-1,K=z[Q],fe=Q+1,oe=z[fe];if(0>s(K,G))fe<F&&0>s(oe,K)?(z[U]=oe,z[fe]=G,U=fe):(z[U]=K,z[Q]=G,U=Q);else if(fe<F&&0>s(oe,G))z[U]=oe,z[fe]=G,U=fe;else break e}}return B}function s(z,B){var G=z.sortIndex-B.sortIndex;return G!==0?G:z.id-B.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var o=Date,l=o.now();t.unstable_now=function(){return o.now()-l}}var c=[],u=[],d=1,h=null,f=3,p=!1,m=!1,v=!1,x=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function _(z){for(var B=n(u);B!==null;){if(B.callback===null)r(u);else if(B.startTime<=z)r(u),B.sortIndex=B.expirationTime,e(c,B);else break;B=n(u)}}function j(z){if(v=!1,_(z),!m)if(n(c)!==null)m=!0,D(N);else{var B=n(u);B!==null&&O(j,B.startTime-z)}}function N(z,B){m=!1,v&&(v=!1,g(k),k=-1),p=!0;var G=f;try{for(_(B),h=n(c);h!==null&&(!(h.expirationTime>B)||z&&!T());){var U=h.callback;if(typeof U=="function"){h.callback=null,f=h.priorityLevel;var F=U(h.expirationTime<=B);B=t.unstable_now(),typeof F=="function"?h.callback=F:h===n(c)&&r(c),_(B)}else r(c);h=n(c)}if(h!==null)var W=!0;else{var Q=n(u);Q!==null&&O(j,Q.startTime-B),W=!1}return W}finally{h=null,f=G,p=!1}}var S=!1,C=null,k=-1,E=5,P=-1;function T(){return!(t.unstable_now()-P<E)}function M(){if(C!==null){var z=t.unstable_now();P=z;var B=!0;try{B=C(!0,z)}finally{B?R():(S=!1,C=null)}}else S=!1}var R;if(typeof w=="function")R=function(){w(M)};else if(typeof MessageChannel<"u"){var A=new MessageChannel,I=A.port2;A.port1.onmessage=M,R=function(){I.postMessage(null)}}else R=function(){x(M,0)};function D(z){C=z,S||(S=!0,R())}function O(z,B){k=x(function(){z(t.unstable_now())},B)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(z){z.callback=null},t.unstable_continueExecution=function(){m||p||(m=!0,D(N))},t.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"):E=0<z?Math.floor(1e3/z):5},t.unstable_getCurrentPriorityLevel=function(){return f},t.unstable_getFirstCallbackNode=function(){return n(c)},t.unstable_next=function(z){switch(f){case 1:case 2:case 3:var B=3;break;default:B=f}var G=f;f=B;try{return z()}finally{f=G}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(z,B){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var G=f;f=z;try{return B()}finally{f=G}},t.unstable_scheduleCallback=function(z,B,G){var U=t.unstable_now();switch(typeof G=="object"&&G!==null?(G=G.delay,G=typeof G=="number"&&0<G?U+G:U):G=U,z){case 1:var F=-1;break;case 2:F=250;break;case 5:F=1073741823;break;case 4:F=1e4;break;default:F=5e3}return F=G+F,z={id:d++,callback:B,priorityLevel:z,startTime:G,expirationTime:F,sortIndex:-1},G>U?(z.sortIndex=G,e(u,z),n(c)===null&&z===n(u)&&(v?(g(k),k=-1):v=!0,O(j,G-U))):(z.sortIndex=F,e(c,z),m||p||(m=!0,D(N))),z},t.unstable_shouldYield=T,t.unstable_wrapCallback=function(z){var B=f;return function(){var G=f;f=B;try{return z.apply(this,arguments)}finally{f=G}}}})(eue);Zce.exports=eue;var mMe=Zce.exports;/** 27 * @license React 28 * react-dom.production.min.js 29 * 30 * Copyright (c) Facebook, Inc. and its affiliates. 31 * 32 * This source code is licensed under the MIT license found in the 33 * LICENSE file in the root directory of this source tree.
34 */var gMe=b,Dl=mMe;function Le(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var tue=new Set,LC={};function A0(t,e){T_(t,e),T_(t+"Capture",e)}function T_(t,e){for(LC[t]=e,t=0;t<e.length;t++)tue.add(e[t])}var Kf=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),fB=Object.prototype.hasOwnProperty,vMe=/^[: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]*$/,gX={},vX={};function xMe(t){return fB.call(vX,t)?!0:fB.call(gX,t)?!1:vMe.test(t)?vX[t]=!0:(gX[t]=!0,!1)}function yMe(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function bMe(t,e,n,r){if(e===null||typeof e>"u"||yMe(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function vo(t,e,n,r,s,i,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=i,this.removeEmptyString=o}var Ki={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Ki[t]=new vo(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Ki[e]=new vo(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Ki[t]=new vo(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Ki[t]=new vo(t,2,!1,t,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(t){Ki[t]=new vo(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Ki[t]=new vo(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Ki[t]=new vo(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Ki[t]=new vo(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Ki[t]=new vo(t,5,!1,t.toLowerCase(),null,!1,!1)});var wH=/[\-:]([a-z])/g;function _H(t){return t[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(t){var e=t.replace(wH,_H);Ki[e]=new vo(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(wH,_H);Ki[e]=new vo(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(wH,_H);Ki[e]=new vo(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Ki[t]=new vo(t,1,!1,t.toLowerCase(),null,!1,!1)});Ki.xlinkHref=new vo("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Ki[t]=new vo(t,1,!1,t.toLowerCase(),null,!0,!0)});function jH(t,e,n,r){var s=Ki.hasOwnProperty(e)?Ki[e]:null;(s!==null?s.type!==0:r||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(bMe(e,n,s,r)&&(n=null),r||s===null?xMe(e)&&(n===null?t.removeAttribute(e):t.setAttribute(e,""+n)):s.mustUseProperty?t[s.propertyName]=n===null?s.type===3?!1:"":n:(e=s.attributeName,r=s.attributeNamespace,n===null?t.removeAttribute(e):(s=s.type,n=s===3||s===4&&n===!0?"":""+n,r?t.setAttributeNS(r,e,n):t.setAttribute(e,n))))}
vendor: 6,716 bytes, lines 34-38
34var up=gMe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,gT=Symbol.for("react.element"),Gb=Symbol.for("react.portal"),Yb=Symbol.for("react.fragment"),SH=Symbol.for("react.strict_mode"),pB=Symbol.for("react.profiler"),nue=Symbol.for("react.provider"),rue=Symbol.for("react.context"),NH=Symbol.for("react.forward_ref"),mB=Symbol.for("react.suspense"),gB=Symbol.for("react.suspense_list"),CH=Symbol.for("react.memo"),qp=Symbol.for("react.lazy"),sue=Symbol.for("react.offscreen"),xX=Symbol.iterator;function lS(t){return t===null||typeof t!="object"?null:(t=xX&&t[xX]||t["@@iterator"],typeof t=="function"?t:null)}var zr=Object.assign,BF;function XS(t){if(BF===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);BF=e&&e[1]||""}return` 35`+BF+t}var UF=!1;function qF(t,e){if(!t||UF)return"";UF=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(u){var r=u}Reflect.construct(t,[],e)}else{try{e.call()}catch(u){r=u}t.call(e.prototype)}else{try{throw Error()}catch(u){r=u}t()}}catch(u){if(u&&r&&typeof u.stack=="string"){for(var s=u.stack.split(` 36`),i=r.stack.split(` 37`),o=s.length-1,l=i.length-1;1<=o&&0<=l&&s[o]!==i[l];)l--;for(;1<=o&&0<=l;o--,l--)if(s[o]!==i[l]){if(o!==1||l!==1)do if(o--,l--,0>l||s[o]!==i[l]){var c=` 38`+s[o].replace(" at new "," at ");return t.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",t.displayName)),c}while(1<=o&&0<=l);break}}}finally{UF=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?XS(t):""}function wMe(t){switch(t.tag){case 5:return XS(t.type);case 16:return XS("Lazy");case 13:return XS("Suspense");case 19:return XS("SuspenseList");case 0:case 2:case 15:return t=qF(t.type,!1),t;case 11:return t=qF(t.type.render,!1),t;case 1:return t=qF(t.type,!0),t;default:return""}}function vB(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Yb:return"Fragment";case Gb:return"Portal";case pB:return"Profiler";case SH:return"StrictMode";case mB:return"Suspense";case gB:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case rue:return(t.displayName||"Context")+".Consumer";case nue:return(t._context.displayName||"Context")+".Provider";case NH:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case CH:return e=t.displayName||null,e!==null?e:vB(t.type)||"Memo";case qp:e=t._payload,t=t._init;try{return vB(t(e))}catch{}}return null}function _Me(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return vB(e);case 8:return e===SH?"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 e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Mg(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function iue(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function jMe(t){var e=iue(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,i=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return s.call(this)},set:function(o){r=""+o,i.call(this,o)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function vT(t){t._valueTracker||(t._valueTracker=jMe(t))}function aue(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=iue(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function KR(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function xB(t,e){var n=e.checked;return zr({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function yX(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=Mg(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function oue(t,e){e=e.checked,e!=null&&jH(t,"checked",e,!1)}function yB(t,e){oue(t,e);var n=Mg(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?bB(t,e.type,n):e.hasOwnProperty("defaultValue")&&bB(t,e.type,Mg(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function bX(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function bB(t,e,n){(e!=="number"||KR(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var JS=Array.isArray;function _w(t,e,n,r){if(t=t.options,e){e={};for(var s=0;s<n.length;s++)e["$"+n[s]]=!0;for(n=0;n<t.length;n++)s=e.hasOwnProperty("$"+t[n].value),t[n].selected!==s&&(t[n].selected=s),s&&r&&(t[n].defaultSelected=!0)}else{for(n=""+Mg(n),e=null,s=0;s<t.length;s++){if(t[s].value===n){t[s].selected=!0,r&&(t[s].defaultSelected=!0);return}e!==null||t[s].disabled||(e=t[s])}e!==null&&(e.selected=!0)}}function wB(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(Le(91));return zr({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function wX(t,e){var n=e.value;if(n==null){if(n=e.children,e=e.defaultValue,n!=null){if(e!=null)throw Error(Le(92));
vendor: 11,688 bytes, line 38
38if(JS(n)){if(1<n.length)throw Error(Le(93));n=n[0]}e=n}e==null&&(e=""),n=e}t._wrapperState={initialValue:Mg(n)}}function lue(t,e){var n=Mg(e.value),r=Mg(e.defaultValue);n!=null&&(n=""+n,n!==t.value&&(t.value=n),e.defaultValue==null&&t.defaultValue!==n&&(t.defaultValue=n)),r!=null&&(t.defaultValue=""+r)}function _X(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function cue(t){switch(t){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 _B(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?cue(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var xT,uue=function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,n,r,s){MSApp.execUnsafeLocalFunction(function(){return t(e,n,r,s)})}:t}(function(t,e){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=e;else{for(xT=xT||document.createElement("div"),xT.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=xT.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function FC(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var QN={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},SMe=["Webkit","ms","Moz","O"];Object.keys(QN).forEach(function(t){SMe.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),QN[e]=QN[t]})});function due(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||QN.hasOwnProperty(t)&&QN[t]?(""+e).trim():e+"px"}function hue(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=due(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,s):t[n]=s}}var NMe=zr({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 jB(t,e){if(e){if(NMe[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Le(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Le(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Le(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Le(62))}}function SB(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){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 NB=null;function kH(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var CB=null,jw=null,Sw=null;function jX(t){if(t=GE(t)){if(typeof CB!="function")throw Error(Le(280));var e=t.stateNode;e&&(e=ML(e),CB(t.stateNode,t.type,e))}}function fue(t){jw?Sw?Sw.push(t):Sw=[t]:jw=t}function pue(){if(jw){var t=jw,e=Sw;if(Sw=jw=null,jX(t),e)for(t=0;t<e.length;t++)jX(e[t])}}function mue(t,e){return t(e)}function gue(){}var VF=!1;function vue(t,e,n){if(VF)return t(e,n);VF=!0;try{return mue(t,e,n)}finally{VF=!1,(jw!==null||Sw!==null)&&(gue(),pue())}}function $C(t,e){var n=t.stateNode;if(n===null)return null;var r=ML(n);if(r===null)return null;n=r[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(t=t.type,r=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!r;break e;default:t=!1}if(t)return null;if(n&&typeof n!="function")throw Error(Le(231,e,typeof n));return n}var kB=!1;if(Kf)try{var cS={};Object.defineProperty(cS,"passive",{get:function(){kB=!0}}),window.addEventListener("test",cS,cS),window.removeEventListener("test",cS,cS)}catch{kB=!1}function CMe(t,e,n,r,s,i,o,l,c){var u=Array.prototype.slice.call(arguments,3);try{e.apply(n,u)}catch(d){this.onError(d)}}var ZN=!1,GR=null,YR=!1,AB=null,kMe={onError:function(t){ZN=!0,GR=t}};function AMe(t,e,n,r,s,i,o,l,c){ZN=!1,GR=null,CMe.apply(kMe,arguments)}function EMe(t,e,n,r,s,i,o,l,c){if(AMe.apply(this,arguments),ZN){if(ZN){var u=GR;ZN=!1,GR=null}else throw Error(Le(198));YR||(YR=!0,AB=u)}}function E0(t){var e=t,n=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,e.flags&4098&&(n=e.return),t=e.return;while(t)}return e.tag===3?n:null}function xue(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function SX(t){if(E0(t)!==t)throw Error(Le(188))}function TMe(t){var e=t.alternate;if(!e){if(e=E0(t),e===null)throw Error(Le(188));return e!==t?null:t}for(var n=t,r=e;;){var s=n.return;if(s===null)break;var i=s.alternate;if(i===null){if(r=s.return,r!==null){n=r;continue}break}if(s.child===i.child){for(i=s.child;i;){if(i===n)return SX(s),t;if(i===r)return SX(s),e;i=i.sibling}throw Error(Le(188))}if(n.return!==r.return)n=s,r=i;else{for(var o=!1,l=s.child;l;){if(l===n){o=!0,n=s,r=i;break}if(l===r){o=!0,r=s,n=i;break}l=l.sibling}if(!o){for(l=i.child;l;){if(l===n){o=!0,n=i,r=s;break}if(l===r){o=!0,r=i,n=s;break}l=l.sibling}if(!o)throw Error(Le(189))}}if(n.alternate!==r)throw Error(Le(190))}if(n.tag!==3)throw Error(Le(188));return n.stateNode.current===n?t:e}function yue(t){return t=TMe(t),t!==null?bue(t):null}function bue(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=bue(t);if(e!==null)return e;t=t.sibling}return null}var wue=Dl.unstable_scheduleCallback,NX=Dl.unstable_cancelCallback,PMe=Dl.unstable_shouldYield,MMe=Dl.unstable_requestPaint,gs=Dl.unstable_now,RMe=Dl.unstable_getCurrentPriorityLevel,AH=Dl.unstable_ImmediatePriority,_ue=Dl.unstable_UserBlockingPriority,XR=Dl.unstable_NormalPriority,OMe=Dl.unstable_LowPriority,jue=Dl.unstable_IdlePriority,AL=null,Xd=null;function IMe(t){if(Xd&&typeof Xd.onCommitFiberRoot=="function")try{Xd.onCommitFiberRoot(AL,t,void 0,(t.current.flags&128)===128)}catch{}}var Cu=Math.clz32?Math.clz32:FMe,DMe=Math.log,LMe=Math.LN2;function FMe(t){return t>>>=0,t===0?32:31-(DMe(t)/LMe|0)|0}var yT=64,bT=4194304;function QS(t){switch(t&-t){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 t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function JR(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,s=t.suspendedLanes,i=t.pingedLanes,o=n&268435455;if(o!==0){var l=o&~s;l!==0?r=QS(l):(i&=o,i!==0&&(r=QS(i)))}else o=n&~s,o!==0?r=QS(o):i!==0&&(r=QS(i));if(r===0)return 0;if(e!==0&&e!==r&&!(e&s)&&(s=r&-r,i=e&-e,s>=i||s===16&&(i&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0<e;)n=31-Cu(e),s=1<<n,r|=t[n],e&=~s;return r}function $Me(t,e){switch(t){case 1:case 2:case 4:return e+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 e+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 zMe(t,e){for(var n=t.suspendedLanes,r=t.pingedLanes,s=t.expirationTimes,i=t.pendingLanes;0<i;){var o=31-Cu(i),l=1<<o,c=s[o];c===-1?(!(l&n)||l&r)&&(s[o]=$Me(l,e)):c<=e&&(t.expiredLanes|=l),i&=~l}}function EB(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function Sue(){var t=yT;return yT<<=1,!(yT&4194240)&&(yT=64),t}function HF(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function WE(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Cu(e),t[e]=n}function BMe(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0<n;){var s=31-Cu(n),i=1<<s;e[s]=0,r[s]=-1,t[s]=-1,n&=~i}}function EH(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var r=31-Cu(n),s=1<<r;s&e|t[r]&e&&(t[r]|=e),n&=~s}}var Ln=0;function Nue(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var Cue,TH,kue,Aue,Eue,TB=!1,wT=[],pg=null,mg=null,gg=null,zC=new Map,BC=new Map,Xp=[],UMe="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 CX(t,e){switch(t){case"focusin":case"focusout":pg=null;break;case"dragenter":case"dragleave":mg=null;break;case"mouseover":case"mouseout":gg=null;break;case"pointerover":case"pointerout":zC.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":BC.delete(e.pointerId)}}function uS(t,e,n,r,s,i){return t===null||t.nativeEvent!==i?(t={blockedOn:e,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[s]},e!==null&&(e=GE(e),e!==null&&TH(e)),t):(t.eventSystemFlags|=r,e=t.targetContainers,s!==null&&e.indexOf(s)===-1&&e.push(s),t)}function qMe(t,e,n,r,s){switch(e){case"focusin":return pg=uS(pg,t,e,n,r,s),!0;case"dragenter":return mg=uS(mg,t,e,n,r,s),!0;case"mouseover":return gg=uS(gg,t,e,n,r,s),!0;case"pointerover":var i=s.pointerId;return zC.set(i,uS(zC.get(i)||null,t,e,n,r,s)),!0;case"gotpointercapture":return i=s.pointerId,BC.set(i,uS(BC.get(i)||null,t,e,n,r,s)),!0}return!1}function Tue(t){var e=Jv(t.target);if(e!==null){var n=E0(e);if(n!==null){if(e=n.tag,e===13){if(e=xue(n),e!==null){t.blockedOn=e,Eue(t.priority,function(){kue(n)});return}}else if(e===3&&n.stateNode.current.memoizedState.isDehydrated){t.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}t.blockedOn=null}function vM(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=PB(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(n===null){n=t.nativeEvent;var r=new n.constructor(n.type,n);NB=r,n.target.dispatchEvent(r),NB=null}else return e=GE(n),e!==null&&TH(e),t.blockedOn=n,!1;e.shift()}return!0}function kX(t,e,n){vM(t)&&n.delete(e)}function VMe(){TB=!1,pg!==null&&vM(pg)&&(pg=null),mg!==null&&vM(mg)&&(mg=null),gg!==null&&vM(gg)&&(gg=null),zC.forEach(kX),BC.forEach(kX)}function dS(t,e){t.blockedOn===e&&(t.blockedOn=null,TB||(TB=!0,Dl.unstable_scheduleCallback(Dl.unstable_NormalPriority,VMe)))}function UC(t){function e(s){return dS(s,t)}if(0<wT.length){dS(wT[0],t);for(var n=1;n<wT.length;n++){var r=wT[n];r.blockedOn===t&&(r.blockedOn=null)}}for(pg!==null&&dS(pg,t),mg!==null&&dS(mg,t),gg!==null&&dS(gg,t),zC.forEac
vendor: 11,562 bytes, line 38
38h(e),BC.forEach(e),n=0;n<Xp.length;n++)r=Xp[n],r.blockedOn===t&&(r.blockedOn=null);for(;0<Xp.length&&(n=Xp[0],n.blockedOn===null);)Tue(n),n.blockedOn===null&&Xp.shift()}var Nw=up.ReactCurrentBatchConfig,QR=!0;function HMe(t,e,n,r){var s=Ln,i=Nw.transition;Nw.transition=null;try{Ln=1,PH(t,e,n,r)}finally{Ln=s,Nw.transition=i}}function WMe(t,e,n,r){var s=Ln,i=Nw.transition;Nw.transition=null;try{Ln=4,PH(t,e,n,r)}finally{Ln=s,Nw.transition=i}}function PH(t,e,n,r){if(QR){var s=PB(t,e,n,r);if(s===null)t$(t,e,r,ZR,n),CX(t,r);else if(qMe(s,t,e,n,r))r.stopPropagation();else if(CX(t,r),e&4&&-1<UMe.indexOf(t)){for(;s!==null;){var i=GE(s);if(i!==null&&Cue(i),i=PB(t,e,n,r),i===null&&t$(t,e,r,ZR,n),i===s)break;s=i}s!==null&&r.stopPropagation()}else t$(t,e,r,null,n)}}var ZR=null;function PB(t,e,n,r){if(ZR=null,t=kH(r),t=Jv(t),t!==null)if(e=E0(t),e===null)t=null;else if(n=e.tag,n===13){if(t=xue(e),t!==null)return t;t=null}else if(n===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null);return ZR=t,null}function Pue(t){switch(t){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(RMe()){case AH:return 1;case _ue:return 4;case XR:case OMe:return 16;case jue:return 536870912;default:return 16}default:return 16}}var lg=null,MH=null,xM=null;function Mue(){if(xM)return xM;var t,e=MH,n=e.length,r,s="value"in lg?lg.value:lg.textContent,i=s.length;for(t=0;t<n&&e[t]===s[t];t++);var o=n-t;for(r=1;r<=o&&e[n-r]===s[i-r];r++);return xM=s.slice(t,1<r?1-r:void 0)}function yM(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function _T(){return!0}function AX(){return!1}function ql(t){function e(n,r,s,i,o){this._reactName=n,this._targetInst=s,this.type=r,this.nativeEvent=i,this.target=o,this.currentTarget=null;for(var l in t)t.hasOwnProperty(l)&&(n=t[l],this[l]=n?n(i):i[l]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?_T:AX,this.isPropagationStopped=AX,this}return zr(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=_T)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=_T)},persist:function(){},isPersistent:_T}),e}var bj={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},RH=ql(bj),KE=zr({},bj,{view:0,detail:0}),KMe=ql(KE),WF,KF,hS,EL=zr({},KE,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:OH,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==hS&&(hS&&t.type==="mousemove"?(WF=t.screenX-hS.screenX,KF=t.screenY-hS.screenY):KF=WF=0,hS=t),WF)},movementY:function(t){return"movementY"in t?t.movementY:KF}}),EX=ql(EL),GMe=zr({},EL,{dataTransfer:0}),YMe=ql(GMe),XMe=zr({},KE,{relatedTarget:0}),GF=ql(XMe),JMe=zr({},bj,{animationName:0,elapsedTime:0,pseudoElement:0}),QMe=ql(JMe),ZMe=zr({},bj,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),eRe=ql(ZMe),tRe=zr({},bj,{data:0}),TX=ql(tRe),nRe={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},rRe={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"},sRe={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function iRe(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=sRe[t])?!!e[t]:!1}function OH(){return iRe}var aRe=zr({},KE,{key:function(t){if(t.key){var e=nRe[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=yM(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?rRe[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:OH,charCode:function(t){return t.type==="keypress"?yM(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?yM(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),oRe=ql(aRe),lRe=zr({},EL,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),PX=ql(lRe),cRe=zr({},KE,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:OH}),uRe=ql(cRe),dRe=zr({},bj,{propertyName:0,elapsedTime:0,pseudoElement:0}),hRe=ql(dRe),fRe=zr({},EL,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),pRe=ql(fRe),mRe=[9,13,27,32],IH=Kf&&"CompositionEvent"in window,eC=null;Kf&&"documentMode"in document&&(eC=document.documentMode);var gRe=Kf&&"TextEvent"in window&&!eC,Rue=Kf&&(!IH||eC&&8<eC&&11>=eC),MX=" ",RX=!1;function Oue(t,e){switch(t){case"keyup":return mRe.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Iue(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Xb=!1;function vRe(t,e){switch(t){case"compositionend":return Iue(e);case"keypress":return e.which!==32?null:(RX=!0,MX);case"textInput":return t=e.data,t===MX&&RX?null:t;default:return null}}function xRe(t,e){if(Xb)return t==="compositionend"||!IH&&Oue(t,e)?(t=Mue(),xM=MH=lg=null,Xb=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return Rue&&e.locale!=="ko"?null:e.data;default:return null}}var yRe={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 OX(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!yRe[t.type]:e==="textarea"}function Due(t,e,n,r){fue(r),e=eO(e,"onChange"),0<e.length&&(n=new RH("onChange","change",null,n,r),t.push({event:n,listeners:e}))}var tC=null,qC=null;function bRe(t){Kue(t,0)}function TL(t){var e=Zb(t);if(aue(e))return t}function wRe(t,e){if(t==="change")return e}var Lue=!1;if(Kf){var YF;if(Kf){var XF="oninput"in document;if(!XF){var IX=document.createElement("div");IX.setAttribute("oninput","return;"),XF=typeof IX.oninput=="function"}YF=XF}else YF=!1;Lue=YF&&(!document.documentMode||9<document.documentMode)}function DX(){tC&&(tC.detachEvent("onpropertychange",Fue),qC=tC=null)}function Fue(t){if(t.propertyName==="value"&&TL(qC)){var e=[];Due(e,qC,t,kH(t)),vue(bRe,e)}}function _Re(t,e,n){t==="focusin"?(DX(),tC=e,qC=n,tC.attachEvent("onpropertychange",Fue)):t==="focusout"&&DX()}function jRe(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return TL(qC)}function SRe(t,e){if(t==="click")return TL(e)}function NRe(t,e){if(t==="input"||t==="change")return TL(e)}function CRe(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Tu=typeof Object.is=="function"?Object.is:CRe;function VC(t,e){if(Tu(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var s=n[r];if(!fB.call(e,s)||!Tu(t[s],e[s]))return!1}return!0}function LX(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function FX(t,e){var n=LX(t);t=0;for(var r;n;){if(n.nodeType===3){if(r=t+n.textContent.length,t<=e&&r>=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=LX(n)}}function $ue(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?$ue(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function zue(){for(var t=window,e=KR();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=KR(t.document)}return e}function DH(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function kRe(t){var e=zue(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&$ue(n.ownerDocument.documentElement,n)){if(r!==null&&DH(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!t.extend&&i>r&&(s=r,r=i,i=s),s=FX(n,i);var o=FX(n,r);s&&o&&(t.rangeCount!==1||t.anchorNode!==s.node||t.anchorOffset!==s.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(s.node,s.offset),t.removeAllRanges(),i>r?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<e.length;n++)t=e[n],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var ARe=Kf&&"documentMode"in document&&11>=document.documentMode,Jb=null,MB=null,nC=null,RB=!1;function $X(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;RB||Jb==null||Jb!==KR(r)||(r=Jb,"selectionStart"in r&&DH(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focu
vendor: 4,529 bytes, line 38
38sNode:r.focusNode,focusOffset:r.focusOffset}),nC&&VC(nC,r)||(nC=r,r=eO(MB,"onSelect"),0<r.length&&(e=new RH("onSelect","select",null,e,n),t.push({event:e,listeners:r}),e.target=Jb)))}function jT(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var Qb={animationend:jT("Animation","AnimationEnd"),animationiteration:jT("Animation","AnimationIteration"),animationstart:jT("Animation","AnimationStart"),transitionend:jT("Transition","TransitionEnd")},JF={},Bue={};Kf&&(Bue=document.createElement("div").style,"AnimationEvent"in window||(delete Qb.animationend.animation,delete Qb.animationiteration.animation,delete Qb.animationstart.animation),"TransitionEvent"in window||delete Qb.transitionend.transition);function PL(t){if(JF[t])return JF[t];if(!Qb[t])return t;var e=Qb[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in Bue)return JF[t]=e[n];return t}var Uue=PL("animationend"),que=PL("animationiteration"),Vue=PL("animationstart"),Hue=PL("transitionend"),Wue=new Map,zX="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 Yg(t,e){Wue.set(t,e),A0(e,[t])}for(var QF=0;QF<zX.length;QF++){var ZF=zX[QF],ERe=ZF.toLowerCase(),TRe=ZF[0].toUpperCase()+ZF.slice(1);Yg(ERe,"on"+TRe)}Yg(Uue,"onAnimationEnd");Yg(que,"onAnimationIteration");Yg(Vue,"onAnimationStart");Yg("dblclick","onDoubleClick");Yg("focusin","onFocus");Yg("focusout","onBlur");Yg(Hue,"onTransitionEnd");T_("onMouseEnter",["mouseout","mouseover"]);T_("onMouseLeave",["mouseout","mouseover"]);T_("onPointerEnter",["pointerout","pointerover"]);T_("onPointerLeave",["pointerout","pointerover"]);A0("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));A0("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));A0("onBeforeInput",["compositionend","keypress","textInput","paste"]);A0("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));A0("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));A0("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ZS="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(" "),PRe=new Set("cancel close invalid load scroll toggle".split(" ").concat(ZS));function BX(t,e,n){var r=t.type||"unknown-event";t.currentTarget=n,EMe(r,e,void 0,t),t.currentTarget=null}function Kue(t,e){e=(e&4)!==0;for(var n=0;n<t.length;n++){var r=t[n],s=r.event;r=r.listeners;e:{var i=void 0;if(e)for(var o=r.length-1;0<=o;o--){var l=r[o],c=l.instance,u=l.currentTarget;if(l=l.listener,c!==i&&s.isPropagationStopped())break e;BX(s,l,u),i=c}else for(o=0;o<r.length;o++){if(l=r[o],c=l.instance,u=l.currentTarget,l=l.listener,c!==i&&s.isPropagationStopped())break e;BX(s,l,u),i=c}}}if(YR)throw t=AB,YR=!1,AB=null,t}function mr(t,e){var n=e[FB];n===void 0&&(n=e[FB]=new Set);var r=t+"__bubble";n.has(r)||(Gue(e,t,2,!1),n.add(r))}function e$(t,e,n){var r=0;e&&(r|=4),Gue(n,t,r,e)}var ST="_reactListening"+Math.random().toString(36).slice(2);function HC(t){if(!t[ST]){t[ST]=!0,tue.forEach(function(n){n!=="selectionchange"&&(PRe.has(n)||e$(n,!1,t),e$(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[ST]||(e[ST]=!0,e$("selectionchange",!1,e))}}function Gue(t,e,n,r){switch(Pue(e)){case 1:var s=HMe;break;case 4:s=WMe;break;default:s=PH}n=s.bind(null,e,n,t),s=void 0,!kB||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(s=!0),r?s!==void 0?t.addEventListener(e,n,{capture:!0,passive:s}):t.addEventListener(e,n,!0):s!==void 0?t.addEventListener(e,n,{passive:s}):t.addEventListener(e,n,!1)}function t$(t,e,n,r,s){var i=r;if(!(e&1)&&!(e&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var l=r.stateNode.containerInfo;
vendor: 5,353 bytes, lines 38-39
38if(l===s||l.nodeType===8&&l.parentNode===s)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===s||c.nodeType===8&&c.parentNode===s))return;o=o.return}for(;l!==null;){if(o=Jv(l),o===null)return;if(c=o.tag,c===5||c===6){r=i=o;continue e}l=l.parentNode}}r=r.return}vue(function(){var u=i,d=kH(n),h=[];e:{var f=Wue.get(t);if(f!==void 0){var p=RH,m=t;switch(t){case"keypress":if(yM(n)===0)break e;case"keydown":case"keyup":p=oRe;break;case"focusin":m="focus",p=GF;break;case"focusout":m="blur",p=GF;break;case"beforeblur":case"afterblur":p=GF;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=EX;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=YMe;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=uRe;break;case Uue:case que:case Vue:p=QMe;break;case Hue:p=hRe;break;case"scroll":p=KMe;break;case"wheel":p=pRe;break;case"copy":case"cut":case"paste":p=eRe;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=PX}var v=(e&4)!==0,x=!v&&t==="scroll",g=v?f!==null?f+"Capture":null:f;v=[];for(var w=u,_;w!==null;){_=w;var j=_.stateNode;if(_.tag===5&&j!==null&&(_=j,g!==null&&(j=$C(w,g),j!=null&&v.push(WC(w,j,_)))),x)break;w=w.return}0<v.length&&(f=new p(f,m,null,n,d),h.push({event:f,listeners:v}))}}if(!(e&7)){e:{if(f=t==="mouseover"||t==="pointerover",p=t==="mouseout"||t==="pointerout",f&&n!==NB&&(m=n.relatedTarget||n.fromElement)&&(Jv(m)||m[Gf]))break e;if((p||f)&&(f=d.window===d?d:(f=d.ownerDocument)?f.defaultView||f.parentWindow:window,p?(m=n.relatedTarget||n.toElement,p=u,m=m?Jv(m):null,m!==null&&(x=E0(m),m!==x||m.tag!==5&&m.tag!==6)&&(m=null)):(p=null,m=u),p!==m)){if(v=EX,j="onMouseLeave",g="onMouseEnter",w="mouse",(t==="pointerout"||t==="pointerover")&&(v=PX,j="onPointerLeave",g="onPointerEnter",w="pointer"),x=p==null?f:Zb(p),_=m==null?f:Zb(m),f=new v(j,w+"leave",p,n,d),f.target=x,f.relatedTarget=_,j=null,Jv(d)===u&&(v=new v(g,w+"enter",m,n,d),v.target=_,v.relatedTarget=x,j=v),x=j,p&&m)t:{for(v=p,g=m,w=0,_=v;_;_=X0(_))w++;for(_=0,j=g;j;j=X0(j))_++;for(;0<w-_;)v=X0(v),w--;for(;0<_-w;)g=X0(g),_--;for(;w--;){if(v===g||g!==null&&v===g.alternate)break t;v=X0(v),g=X0(g)}v=null}else v=null;p!==null&&UX(h,f,p,v,!1),m!==null&&x!==null&&UX(h,x,m,v,!0)}}e:{if(f=u?Zb(u):window,p=f.nodeName&&f.nodeName.toLowerCase(),p==="select"||p==="input"&&f.type==="file")var N=wRe;else if(OX(f))if(Lue)N=NRe;else{N=jRe;var S=_Re}else(p=f.nodeName)&&p.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(N=SRe);if(N&&(N=N(t,u))){Due(h,N,n,d);break e}S&&S(t,f,u),t==="focusout"&&(S=f._wrapperState)&&S.controlled&&f.type==="number"&&bB(f,"number",f.value)}switch(S=u?Zb(u):window,t){case"focusin":(OX(S)||S.contentEditable==="true")&&(Jb=S,MB=u,nC=null);break;case"focusout":nC=MB=Jb=null;break;case"mousedown":RB=!0;break;case"contextmenu":case"mouseup":case"dragend":RB=!1,$X(h,n,d);break;case"selectionchange":if(ARe)break;case"keydown":case"keyup":$X(h,n,d)}var C;if(IH)e:{switch(t){case"compositionstart":var k="onCompositionStart";break e;case"compositionend":k="onCompositionEnd";break e;case"compositionupdate":k="onCompositionUpdate";break e}k=void 0}else Xb?Oue(t,n)&&(k="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(k="onCompositionStart");k&&(Rue&&n.locale!=="ko"&&(Xb||k!=="onCompositionStart"?k==="onCompositionEnd"&&Xb&&(C=Mue()):(lg=d,MH="value"in lg?lg.value:lg.textContent,Xb=!0)),S=eO(u,k),0<S.length&&(k=new TX(k,t,null,n,d),h.push({event:k,listeners:S}),C?k.data=C:(C=Iue(n),C!==null&&(k.data=C)))),(C=gRe?vRe(t,n):xRe(t,n))&&(u=eO(u,"onBeforeInput"),0<u.length&&(d=new TX("onBeforeInput","beforeinput",null,n,d),h.push({event:d,listeners:u}),d.data=C))}Kue(h,e)})}function WC(t,e,n){return{instance:t,listener:e,currentTarget:n}}function eO(t,e){for(var n=e+"Capture",r=[];t!==null;){var s=t,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=$C(t,n),i!=null&&r.unshift(WC(t,i,s)),i=$C(t,e),i!=null&&r.push(WC(t,i,s))),t=t.return}return r}function X0(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function UX(t,e,n,r,s){for(var i=e._reactName,o=[];n!==null&&n!==r;){var l=n,c=l.alternate,u=l.stateNode;if(c!==null&&c===r)break;l.tag===5&&u!==null&&(l=u,s?(c=$C(n,i),c!=null&&o.unshift(WC(n,c,l))):s||(c=$C(n,i),c!=null&&o.push(WC(n,c,l)))),n=n.return}o.length!==0&&t.push({event:e,listeners:o})}var MRe=/\r\n?/g,RRe=/\u0000|\uFFFD/g;function qX(t){return(typeof t=="string"?t:""+t).replace(MRe,` 39`).replace(RRe,"")}function NT(t,e,n){if(e=qX(e),qX(t)!==e&&n)throw Error(Le(425))}function tO(){}var OB=null,IB=null;function DB(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var LB=typeof setTimeout=="function"?setTimeout:void 0,ORe=typeof clearTimeout=="function"?clearTimeout:void 0,VX=typeof Promise=="function"?Promise:void 0,IRe=typeof queueMicrotask=="function"?queueMicrotask:typeof VX<"u"?function(t){return VX.resolve(null).then(t).cat
vendor: 4,253 bytes, line 39
39ch(DRe)}:LB;function DRe(t){setTimeout(function(){throw t})}function n$(t,e){var n=e,r=0;do{var s=n.nextSibling;if(t.removeChild(n),s&&s.nodeType===8)if(n=s.data,n==="/$"){if(r===0){t.removeChild(s),UC(e);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=s}while(n);UC(e)}function vg(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return t}function HX(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="$"||n==="$!"||n==="$?"){if(e===0)return t;e--}else n==="/$"&&e++}t=t.previousSibling}return null}var wj=Math.random().toString(36).slice(2),Fd="__reactFiber$"+wj,KC="__reactProps$"+wj,Gf="__reactContainer$"+wj,FB="__reactEvents$"+wj,LRe="__reactListeners$"+wj,FRe="__reactHandles$"+wj;function Jv(t){var e=t[Fd];if(e)return e;for(var n=t.parentNode;n;){if(e=n[Gf]||n[Fd]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=HX(t);t!==null;){if(n=t[Fd])return n;t=HX(t)}return e}t=n,n=t.parentNode}return null}function GE(t){return t=t[Fd]||t[Gf],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function Zb(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(Le(33))}function ML(t){return t[KC]||null}var $B=[],ew=-1;function Xg(t){return{current:t}}function br(t){0>ew||(t.current=$B[ew],$B[ew]=null,ew--)}function lr(t,e){ew++,$B[ew]=t.current,t.current=e}var Rg={},Pa=Xg(Rg),Ho=Xg(!1),Wy=Rg;function P_(t,e){var n=t.type.contextTypes;if(!n)return Rg;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=e[i];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=s),s}function Wo(t){return t=t.childContextTypes,t!=null}function nO(){br(Ho),br(Pa)}function WX(t,e,n){if(Pa.current!==Rg)throw Error(Le(168));lr(Pa,e),lr(Ho,n)}function Yue(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in e))throw Error(Le(108,_Me(t)||"Unknown",s));return zr({},n,r)}function rO(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Rg,Wy=Pa.current,lr(Pa,t),lr(Ho,Ho.current),!0}function KX(t,e,n){var r=t.stateNode;if(!r)throw Error(Le(169));n?(t=Yue(t,e,Wy),r.__reactInternalMemoizedMergedChildContext=t,br(Ho),br(Pa),lr(Pa,t)):br(Ho),lr(Ho,n)}var Kh=null,RL=!1,r$=!1;function Xue(t){Kh===null?Kh=[t]:Kh.push(t)}function $Re(t){RL=!0,Xue(t)}function Jg(){if(!r$&&Kh!==null){r$=!0;var t=0,e=Ln;try{var n=Kh;for(Ln=1;t<n.length;t++){var r=n[t];do r=r(!0);while(r!==null)}Kh=null,RL=!1}catch(s){throw Kh!==null&&(Kh=Kh.slice(t+1)),wue(AH,Jg),s}finally{Ln=e,r$=!1}}return null}var tw=[],nw=0,sO=null,iO=0,vc=[],xc=0,Ky=null,Rf=1,Of="";function Tv(t,e){tw[nw++]=iO,tw[nw++]=sO,sO=t,iO=e}function Jue(t,e,n){vc[xc++]=Rf,vc[xc++]=Of,vc[xc++]=Ky,Ky=t;var r=Rf;t=Of;var s=32-Cu(r)-1;r&=~(1<<s),n+=1;var i=32-Cu(e)+s;if(30<i){var o=s-s%5;i=(r&(1<<o)-1).toString(32),r>>=o,s-=o,Rf=1<<32-Cu(e)+s|n<<s|r,Of=i+t}else Rf=1<<i|n<<s|r,Of=t}function LH(t){t.return!==null&&(Tv(t,1),Jue(t,1,0))}function FH(t){for(;t===sO;)sO=tw[--nw],tw[nw]=null,iO=tw[--nw],tw[nw]=null;for(;t===Ky;)Ky=vc[--xc],vc[xc]=null,Of=vc[--xc],vc[xc]=null,Rf=vc[--xc],vc[xc]=null}var Tl=null,Al=null,Er=!1,xu=null;function Que(t,e){var n=_c(5,null,null,0);n.elementType="DELETED",n.stateNode=e,n.return=t,e=t.deletions,e===null?(t.deletions=[n],t.flags|=16):e.push(n)}function GX(t,e){switch(t.tag){case 5:var n=t.type;return e=e.nodeType!==1||n.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(t.stateNode=e,Tl=t,Al=vg(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,Tl=t,Al=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(n=Ky!==null?{id:Rf,overflow:Of}:null,t.memoizedState={dehydrated:e,treeContext:n,retryLane:1073741824},n=_c(18,null,null,0),n.stateNode=e,n.return=t,t.child=n,Tl=t,Al=null,!0):!1;default:return!1}}function zB(t){return(t.mode&1)!==0&&(t.flags&128)===0}function BB(t){if(Er){var e=Al;if(e){var n=e;if(!GX(t,e)){if(zB(t))throw Error(Le(418));e=vg(n.nextSibling);var r=Tl;
vendor: 26,307 bytes, lines 39-41
39e&&GX(t,e)?Que(r,n):(t.flags=t.flags&-4097|2,Er=!1,Tl=t)}}else{if(zB(t))throw Error(Le(418));t.flags=t.flags&-4097|2,Er=!1,Tl=t}}}function YX(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;Tl=t}function CT(t){if(t!==Tl)return!1;if(!Er)return YX(t),Er=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!DB(t.type,t.memoizedProps)),e&&(e=Al)){if(zB(t))throw Zue(),Error(Le(418));for(;e;)Que(t,e),e=vg(e.nextSibling)}if(YX(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(Le(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="/$"){if(e===0){Al=vg(t.nextSibling);break e}e--}else n!=="$"&&n!=="$!"&&n!=="$?"||e++}t=t.nextSibling}Al=null}}else Al=Tl?vg(t.stateNode.nextSibling):null;return!0}function Zue(){for(var t=Al;t;)t=vg(t.nextSibling)}function M_(){Al=Tl=null,Er=!1}function $H(t){xu===null?xu=[t]:xu.push(t)}var zRe=up.ReactCurrentBatchConfig;function fS(t,e,n){if(t=n.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(Le(309));var r=n.stateNode}if(!r)throw Error(Le(147,t));var s=r,i=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===i?e.ref:(e=function(o){var l=s.refs;o===null?delete l[i]:l[i]=o},e._stringRef=i,e)}if(typeof t!="string")throw Error(Le(284));if(!n._owner)throw Error(Le(290,t))}return t}function kT(t,e){throw t=Object.prototype.toString.call(e),Error(Le(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function XX(t){var e=t._init;return e(t._payload)}function ede(t){function e(g,w){if(t){var _=g.deletions;_===null?(g.deletions=[w],g.flags|=16):_.push(w)}}function n(g,w){if(!t)return null;for(;w!==null;)e(g,w),w=w.sibling;return null}function r(g,w){for(g=new Map;w!==null;)w.key!==null?g.set(w.key,w):g.set(w.index,w),w=w.sibling;return g}function s(g,w){return g=wg(g,w),g.index=0,g.sibling=null,g}function i(g,w,_){return g.index=_,t?(_=g.alternate,_!==null?(_=_.index,_<w?(g.flags|=2,w):_):(g.flags|=2,w)):(g.flags|=1048576,w)}function o(g){return t&&g.alternate===null&&(g.flags|=2),g}function l(g,w,_,j){return w===null||w.tag!==6?(w=u$(_,g.mode,j),w.return=g,w):(w=s(w,_),w.return=g,w)}function c(g,w,_,j){var N=_.type;return N===Yb?d(g,w,_.props.children,j,_.key):w!==null&&(w.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===qp&&XX(N)===w.type)?(j=s(w,_.props),j.ref=fS(g,w,_),j.return=g,j):(j=CM(_.type,_.key,_.props,null,g.mode,j),j.ref=fS(g,w,_),j.return=g,j)}function u(g,w,_,j){return w===null||w.tag!==4||w.stateNode.containerInfo!==_.containerInfo||w.stateNode.implementation!==_.implementation?(w=d$(_,g.mode,j),w.return=g,w):(w=s(w,_.children||[]),w.return=g,w)}function d(g,w,_,j,N){return w===null||w.tag!==7?(w=Iy(_,g.mode,j,N),w.return=g,w):(w=s(w,_),w.return=g,w)}function h(g,w,_){if(typeof w=="string"&&w!==""||typeof w=="number")return w=u$(""+w,g.mode,_),w.return=g,w;if(typeof w=="object"&&w!==null){switch(w.$$typeof){case gT:return _=CM(w.type,w.key,w.props,null,g.mode,_),_.ref=fS(g,null,w),_.return=g,_;case Gb:return w=d$(w,g.mode,_),w.return=g,w;case qp:var j=w._init;return h(g,j(w._payload),_)}if(JS(w)||lS(w))return w=Iy(w,g.mode,_,null),w.return=g,w;kT(g,w)}return null}function f(g,w,_,j){var N=w!==null?w.key:null;if(typeof _=="string"&&_!==""||typeof _=="number")return N!==null?null:l(g,w,""+_,j);if(typeof _=="object"&&_!==null){switch(_.$$typeof){case gT:return _.key===N?c(g,w,_,j):null;case Gb:return _.key===N?u(g,w,_,j):null;case qp:return N=_._init,f(g,w,N(_._payload),j)}if(JS(_)||lS(_))return N!==null?null:d(g,w,_,j,null);kT(g,_)}return null}function p(g,w,_,j,N){if(typeof j=="string"&&j!==""||typeof j=="number")return g=g.get(_)||null,l(w,g,""+j,N);if(typeof j=="object"&&j!==null){switch(j.$$typeof){case gT:return g=g.get(j.key===null?_:j.key)||null,c(w,g,j,N);case Gb:return g=g.get(j.key===null?_:j.key)||null,u(w,g,j,N);case qp:var S=j._init;return p(g,w,_,S(j._payload),N)}if(JS(j)||lS(j))return g=g.get(_)||null,d(w,g,j,N,null);kT(w,j)}return null}function m(g,w,_,j){for(var N=null,S=null,C=w,k=w=0,E=null;C!==null&&k<_.length;k++){C.index>k?(E=C,C=null):E=C.sibling;var P=f(g,C,_[k],j);if(P===null){C===null&&(C=E);break}t&&C&&P.alternate===null&&e(g,C),w=i(P,w,k),S===null?N=P:S.sibling=P,S=P,C=E}if(k===_.length)return n(g,C),Er&&Tv(g,k),N;if(C===null){for(;k<_.length;k++)C=h(g,_[k],j),C!==null&&(w=i(C,w,k),S===null?N=C:S.sibling=C,S=C);return Er&&Tv(g,k),N}for(C=r(g,C);k<_.length;k++)E=p(C,g,k,_[k],j),E!==null&&(t&&E.alternate!==null&&C.delete(E.key===null?k:E.key),w=i(E,w,k),S===null?N=E:S.sibling=E,S=E);return t&&C.forEach(function(T){return e(g,T)}),Er&&Tv(g,k),N}function v(g,w,_,j){var N=lS(_);if(typeof N!="function")throw Error(Le(150));if(_=N.call(_),_==null)throw Error(Le(151));for(var S=N=null,C=w,k=w=0,E=null,P=_.next();C!==null&&!P.done;k++,P=_.next()){C.index>k?(E=C,C=null):E=C.sibling;var T=f(g,C,P.value,j);if(T===null){C===null&&(C=E);break}t&&C&&T.alternate===null&&e(g,C),w=i(T,w,k),S===null?N=T:S.sibling=T,S=T,C=E}if(P.done)return n(g,C),Er&&Tv(g,k),N;if(C===null){for(;!P.done;k++,P=_.next())P=h(g,P.value,j),P!==null&&(w=i(P,w,k),S===null?N=P:S.sibling=P,S=P);return Er&&Tv(g,k),N}for(C=r(g,C);!P.done;k++,P=_.next())P=p(C,g,k,P.value,j),P!==null&&(t&&P.alternate!==null&&C.delete(P.key===null?k:P.key),w=i(P,w,k),S===null?N=P:S.sibling=P,S=P);return t&&C.forEach(function(M){return e(g,M)}),Er&&Tv(g,k),N}function x(g,w,_,j){if(typeof _=="object"&&_!==null&&_.type===Yb&&_.key===null&&(_=_.props.children),typeof _=="object"&&_!==null){switch(_.$$typeof){case gT:e:{for(var N=_.key,S=w;S!==null;){if(S.key===N){if(N=_.type,N===Yb){if(S.tag===7){n(g,S.sibling),w=s(S,_.props.children),w.return=g,g=w;break e}}else if(S.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===qp&&XX(N)===S.type){n(g,S.sibling),w=s(S,_.props),w.ref=fS(g,S,_),w.return=g,g=w;break e}n(g,S);break}else e(g,S);S=S.sibling}_.type===Yb?(w=Iy(_.props.children,g.mode,j,_.key),w.return=g,g=w):(j=CM(_.type,_.key,_.props,null,g.mode,j),j.ref=fS(g,w,_),j.return=g,g=j)}return o(g);case Gb:e:{for(S=_.key;w!==null;){if(w.key===S)if(w.tag===4&&w.stateNode.containerInfo===_.containerInfo&&w.stateNode.implementation===_.implementation){n(g,w.sibling),w=s(w,_.children||[]),w.return=g,g=w;break e}else{n(g,w);break}else e(g,w);w=w.sibling}w=d$(_,g.mode,j),w.return=g,g=w}return o(g);case qp:return S=_._init,x(g,w,S(_._payload),j)}if(JS(_))return m(g,w,_,j);if(lS(_))return v(g,w,_,j);kT(g,_)}return typeof _=="string"&&_!==""||typeof _=="number"?(_=""+_,w!==null&&w.tag===6?(n(g,w.sibling),w=s(w,_),w.return=g,g=w):(n(g,w),w=u$(_,g.mode,j),w.return=g,g=w),o(g)):n(g,w)}return x}var R_=ede(!0),tde=ede(!1),aO=Xg(null),oO=null,rw=null,zH=null;function BH(){zH=rw=oO=null}function UH(t){var e=aO.current;br(aO),t._currentValue=e}function UB(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function Cw(t,e){oO=t,zH=rw=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(Uo=!0),t.firstContext=null)}function Mc(t){var e=t._currentValue;if(zH!==t)if(t={context:t,memoizedValue:e,next:null},rw===null){if(oO===null)throw Error(Le(308));rw=t,oO.dependencies={lanes:0,firstContext:t}}else rw=rw.next=t;return e}var Qv=null;function qH(t){Qv===null?Qv=[t]:Qv.push(t)}function nde(t,e,n,r){var s=e.interleaved;return s===null?(n.next=n,qH(e)):(n.next=s.next,s.next=n),e.interleaved=n,Yf(t,r)}function Yf(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var Vp=!1;function VH(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function rde(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function Ff(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function xg(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,vn&2){var s=r.pending;return s===null?e.next=e:(e.next=s.next,s.next=e),r.pending=e,Yf(t,n)}return s=r.interleaved,s===null?(e.next=e,qH(r)):(e.next=s.next,s.next=e),r.interleaved=e,Yf(t,n)}function bM(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,EH(t,n)}}function JX(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?s=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?s=i=e:i=i.next=e}else s=i=e;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function lO(t,e,n,r){var s=t.updateQueue;Vp=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var c=l,u=c.next;c.next=null,o===null?i=u:o.next=u,o=c;var d=t.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 h=s.baseState;o=0,d=u=c=null,l=i;do{var f=l.lane,p=l.eventTime;if((r&f)===f){d!==null&&(d=d.next={eventTime:p,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var m=t,v=l;switch(f=e,p=n,v.tag){case 1:if(m=v.payload,typeof m=="function"){h=m.call(p,h,f);break e}h=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=v.payload,f=typeof m=="function"?m.call(p,h,f):m,f==null)break e;h=zr({},h,f);break e;case 2:Vp=!0}}l.callback!==null&&l.lane!==0&&(t.flags|=64,f=s.effects,f===null?s.effects=[l]:f.push(l))}else p={eventTime:p,lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=p,c=h):d=d.next=p,o|=f;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;f=l,l=f.next,f.next=null,s.lastBaseUpdate=f,s.shared.pending=null}}while(!0);if(d===null&&(c=h),s.baseState=c,s.firstBaseUpdate=u,s.lastBaseUpdate=d,e=s.shared.interleaved,e!==null){s=e;do o|=s.lane,s=s.next;while(s!==e)}else i===null&&(s.shared.lanes=0);Yy|=o,t.lanes=o,t.memoizedState=h}}function QX(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var r=t[e],s=r.callback;if(s!==null){if(r.callback=null,r=n,typeof s!="function")throw Error(Le(191,s));s.call(r)}}}var YE={},Jd=Xg(YE),GC=Xg(YE),YC=Xg(YE);function Zv(t){if(t===YE)throw Error(Le(174));return t}function HH(t,e){switch(lr(YC,e),lr(GC,t),lr(Jd,YE),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:_B(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=_B(e,t)}br(Jd),lr(Jd,e)}function O_(){br(Jd),br(GC),br(YC)}function sde(t){Zv(YC.current);var e=Zv(Jd.current),n=_B(e,t.type);e!==n&&(lr(GC,t),lr(Jd,n))}function WH(t){GC.current===t&&(br(Jd),br(GC))}var Ir=Xg(0);function cO(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var s$=[];function KH(){for(var t=0;t<s$.length;t++)s$[t]._workInProgressVersionPrimary=null;s$.length=0}var wM=up.ReactCurrentDispatcher,i$=up.ReactCurrentBatchConfig,Gy=0,Fr=null,qs=null,fi=null,uO=!1,rC=!1,XC=0,BRe=0;function ea(){throw Error(Le(321))}function GH(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!Tu(t[n],e[n]))return!1;return!0}function YH(t,e,n,r,s,i){if(Gy=i,Fr=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,wM.current=t===null||t.memoizedState===null?HRe:WRe,t=n(r,s),rC){i=0;do{if(rC=!1,XC=0,25<=i)throw Error(Le(301));i+=1,fi=qs=null,e.updateQueue=null,wM.current=KRe,t=n(r,s)}while(rC)}if(wM.current=dO,e=qs!==null&&qs.next!==null,Gy=0,fi=qs=Fr=null,uO=!1,e)throw Error(Le(300));return t}function XH(){var t=XC!==0;return XC=0,t}function id(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return fi===null?Fr.memoizedState=fi=t:fi=fi.next=t,fi}function Rc(){if(qs===null){var t=Fr.alternate;t=t!==null?t.memoizedState:null}else t=qs.next;var e=fi===null?Fr.memoizedState:fi.next;if(e!==null)fi=e,qs=t;else{if(t===null)throw Error(Le(310));qs=t,t={memoizedState:qs.memoizedState,baseState:qs.baseState,baseQueue:qs.baseQueue,queue:qs.queue,next:null},fi===null?Fr.memoizedState=fi=t:fi=fi.next=t}return fi}function JC(t,e){return typeof e=="function"?e(t):e}function a$(t){var e=Rc(),n=e.queue;if(n===null)throw Error(Le(311));n.lastRenderedReducer=t;var r=qs,s=r.baseQueue,i=n.pending;if(i!==null){if(s!==null){var o=s.next;s.next=i.next,i.next=o}r.baseQueue=s=i,n.pending=null}if(s!==null){i=s.next,r=r.baseState;var l=o=null,c=null,u=i;do{var d=u.lane;if((Gy&d)===d)c!==null&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:t(r,u.action);else{var h={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(l=c=h,o=r):c=c.next=h,Fr.lanes|=d,Yy|=d}u=u.next}while(u!==null&&u!==i);c===null?o=r:c.next=l,Tu(r,e.memoizedState)||(Uo=!0),e.memoizedState=r,e.baseState=o,e.baseQueue=c,n.lastRenderedState=r}if(t=n.interleaved,t!==null){s=t;do i=s.lane,Fr.lanes|=i,Yy|=i,s=s.next;while(s!==t)}else s===null&&(n.lanes=0);return[e.memoizedState,n.dispatch]}function o$(t){var e=Rc(),n=e.queue;if(n===null)throw Error(Le(311));n.lastRenderedReducer=t;var r=n.dispatch,s=n.pending,i=e.memoizedState;if(s!==null){n.pending=null;var o=s=s.next;do i=t(i,o.action),o=o.next;while(o!==s);Tu(i,e.memoizedState)||(Uo=!0),e.memoizedState=i,e.baseQueue===null&&(e.baseState=i),n.lastRenderedState=i}return[i,r]}function ide(){}function ade(t,e){var n=Fr,r=Rc(),s=e(),i=!Tu(r.memoizedState,s);if(i&&(r.memoizedState=s,Uo=!0),r=r.queue,JH(cde.bind(null,n,r,t),[t]),r.getSnapshot!==e||i||fi!==null&&fi.memoizedState.tag&1){if(n.flags|=2048,QC(9,lde.bind(null,n,r,s,e),void 0,null),xi===null)throw Error(Le(349));Gy&30||ode(n,e,s)}return s}function ode(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=Fr.updateQueue,e===null?(e={lastEffect:null,stores:null},Fr.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function lde(t,e,n,r){e.value=n,e.getSnapshot=r,ude(e)&&dde(t)}function cde(t,e,n){return n(function(){ude(e)&&dde(t)})}function ude(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!Tu(t,n)}catch{return!0}}function dde(t){var e=Yf(t,1);e!==null&&ku(e,t,1,-1)}function ZX(t){var e=id();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:JC,lastRenderedState:t},e.queue=t,t=t.dispatch=VRe.bind(null,Fr,t),[e.memoizedState,t]}function QC(t,e,n,r){return t={tag:t,create:e,destroy:n,deps:r,next:null},e=Fr.updateQueue,e===null?(e={lastEffect:null,stores:null},Fr.updateQueue=e,e.lastEffect=t.next=t):(n=e.lastEffect,n===null?e.lastEffect=t.next=t:(r=n.next,n.next=t,t.next=r,e.lastEffect=t)),t}function hde(){return Rc().memoizedState}function _M(t,e,n,r){var s=id();Fr.flags|=t,s.memoizedState=QC(1|e,n,void 0,r===void 0?null:r)}function OL(t,e,n,r){var s=Rc();r=r===void 0?null:r;var i=void 0;if(qs!==null){var o=qs.memoizedState;if(i=o.destroy,r!==null&&GH(r,o.deps)){s.memoizedState=QC(e,n,i,r);return}}Fr.flags|=t,s.memoizedState=QC(1|e,n,i,r)}function eJ(t,e){return _M(8390656,8,t,e)}function JH(t,e){return OL(2048,8,t,e)}function fde(t,e){return OL(4,2,t,e)}function pde(t,e){return OL(4,4,t,e)}function mde(t,e){if(typeof e=="function")return t=t(),e(t),function(){e(null)};if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function gde(t,e,n){return n=n!=null?n.concat([t]):null,OL(4,4,mde.bind(null,e,t),n)}function QH(){}function vde(t,e){var n=Rc();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&GH(e,r[1])?r[0]:(n.memoizedState=[t,e],t)}function xde(t,e){var n=Rc();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&GH(e,r[1])?r[0]:(t=t(),n.memoizedState=[t,e],t)}function yde(t,e,n){return Gy&21?(Tu(n,e)||(n=Sue(),Fr.lanes|=n,Yy|=n,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,Uo=!0),t.memoizedState=n)}function URe(t,e){var n=Ln;Ln=n!==0&&4>n?n:4,t(!0);var r=i$.transition;i$.transition={};try{t(!1),e()}finally{Ln=n,i$.transition=r}}function bde(){return Rc().memoizedState}function qRe(t,e,n){var r=bg(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},wde(t))_de(e,n);else if(n=nde(t,e,n,r),n!==null){var s=lo();ku(n,t,r,s),jde(n,e,r)}}function VRe(t,e,n){var r=bg(t),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(wde(t))_de(e,s);else{var i=t.alternate;if(t.lanes===0&&(i===null||i.lanes===0)&&(i=e.lastRenderedReducer,i!==null))try{var o=e.lastRenderedState,l=i(o,n);if(s.hasEagerState=!0,s.eagerState=l,Tu(l,o)){var c=e.interleaved;c===null?(s.next=s,qH(e)):(s.next=c.next,c.next=s),e.interleaved=s;return}}catch{}finally{}n=nde(t,e,s,r),n!==null&&(s=lo(),ku(n,t,r,s),jde(n,e,r))}}function wde(t){var e=t.alternate;return t===Fr||e!==null&&e===Fr}function _de(t,e){rC=uO=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function jde(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,EH(t,n)}}var dO={readContext:Mc,useCallback:ea,useContext:ea,useEffect:ea,useImperativeHandle:ea,useInsertionEffect:ea,useLayoutEffect:ea,useMemo:ea,useReducer:ea,useRef:ea,useState:ea,useDebugValue:ea,useDeferredValue:ea,useTransition:ea,useMutableSource:ea,useSyncExternalStore:ea,useId:ea,unstable_isNewReconciler:!1},HRe={readContext:Mc,useCallback:function(t,e){return id().memoizedState=[t,e===void 0?null:e],t},useContext:Mc,useEffect:eJ,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,_M(4194308,4,mde.bind(null,e,t),n)},useLayoutEffect:function(t,e){return _M(4194308,4,t,e)},useInsertionEffect:function(t,e){return _M(4,2,t,e)},useMemo:function(t,e){var n=id();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=id();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=qRe.bind(null,Fr,t),[r.memoizedState,t]},useRef:function(t){var e=id();return t={current:t},e.memoizedState=t},useState:ZX,useDebugValue:QH,useDeferredValue:function(t){return id().memoizedState=t},useTransition:function(){var t=ZX(!1),e=t[0];return t=URe.bind(null,t[1]),id().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=Fr,s=id();if(Er){if(n===void 0)throw Error(Le(407));n=n()}else{if(n=e(),xi===null)throw Error(Le(349));Gy&30||ode(r,e,n)}s.memoizedState=n;var i={value:n,getSnapshot:e};return s.queue=i,eJ(cde.bind(null,r,i,t),[t]),r.flags|=2048,QC(9,lde.bind(null,r,i,n,e),void 0,null),n},useId:function(){var t=id(),e=xi.identifierPrefix;if(Er){var n=Of,r=Rf;n=(r&~(1<<32-Cu(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=XC++,0<n&&(e+="H"+n.toString(32)),e+=":"}else n=BRe++,e=":"+e+"r"+n.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},WRe={readContext:Mc,useCallback:vde,useContext:Mc,useEffect:JH,useImperativeHandle:gde,useInsertionEffect:fde,useLayoutEffect:pde,useMemo:xde,useReducer:a$,useRef:hde,useState:function(){return a$(JC)},useDebugValue:QH,useDeferredValue:function(t){var e=Rc();return yde(e,qs.memoizedState,t)},useTransition:function(){var t=a$(JC)[0],e=Rc().memoizedState;return[t,e]},useMutableSource:ide,useSyncExternalStore:ade,useId:bde,unstable_isNewReconciler:!1},KRe={readContext:Mc,useCallback:vde,useContext:Mc,useEffect:JH,useImperativeHandle:gde,useInsertionEffect:fde,useLayoutEffect:pde,useMemo:xde,useReducer:o$,useRef:hde,useState:function(){return o$(JC)},useDebugValue:QH,useDeferredValue:function(t){var e=Rc();return qs===null?e.memoizedState=t:yde(e,qs.memoizedState,t)},useTransition:function(){var t=o$(JC)[0],e=Rc().memoizedState;return[t,e]},useMutableSource:ide,useSyncExternalStore:ade,useId:bde,unstable_isNewReconciler:!1};function eu(t,e){if(t&&t.defaultProps){e=zr({},e),t=t.defaultProps;for(var n in t)e[n]===void 0&&(e[n]=t[n]);return e}return e}function qB(t,e,n,r){e=t.memoizedState,n=n(r,e),n=n==null?e:zr({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var IL={isMounted:function(t){return(t=t._reactInternals)?E0(t)===t:!1},enqueueSetState:function(t,e,n){t=t._reactInternals;var r=lo(),s=bg(t),i=Ff(r,s);i.payload=e,n!=null&&(i.callback=n),e=xg(t,i,s),e!==null&&(ku(e,t,s,r),bM(e,t,s))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var r=lo(),s=bg(t),i=Ff(r,s);i.tag=1,i.payload=e,n!=null&&(i.callback=n),e=xg(t,i,s),e!==null&&(ku(e,t,s,r),bM(e,t,s))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=lo(),r=bg(t),s=Ff(n,r);s.tag=2,e!=null&&(s.callback=e),e=xg(t,s,r),e!==null&&(ku(e,t,r,n),bM(e,t,r))}};function tJ(t,e,n,r,s,i,o){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(r,i,o):e.prototype&&e.prototype.isPureReactComponent?!VC(n,r)||!VC(s,i):!0}function Sde(t,e,n){var r=!1,s=Rg,i=e.contextType;return typeof i=="object"&&i!==null?i=Mc(i):(s=Wo(e)?Wy:Pa.current,r=e.contextTypes,i=(r=r!=null)?P_(t,s):Rg),e=new e(n,i),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=IL,t.stateNode=e,e._reactInternals=t,r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=s,t.__reactInternalMemoizedMaskedChildContext=i),e}function nJ(t,e,n,r){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(n,r),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(n,r),e.state!==t&&IL.enqueueReplaceState(e,e.state,null)}function VB(t,e,n,r){var s=t.stateNode;s.props=n,s.state=t.memoizedState,s.refs={},VH(t);var i=e.contextType;typeof i=="object"&&i!==null?s.context=Mc(i):(i=Wo(e)?Wy:Pa.current,s.context=P_(t,i)),s.state=t.memoizedState,i=e.getDerivedStateFromProps,typeof i=="function"&&(qB(t,e,i,n),s.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(e=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),e!==s.state&&IL.enqueueReplaceState(s,s.state,null),lO(t,n,s,r),s.state=t.memoizedState),typeof s.componentDidMount=="function"&&(t.flags|=4194308)}function I_(t,e){try{var n="",r=e;do n+=wMe(r),r=r.return;while(r);var s=n}catch(i){s=` 40Error generating stack: `+i.message+` 41`+i.stack}return{value:t,source:e,stack:s,digest:null}}function l$(t,e,n){return{value:t,source:null,stack:n??null,digest:e??null}}function HB(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var GRe=typeof WeakMap=="function"?WeakMap:Map;function Nde(t,e,n){n=Ff(-1,n),n.tag=3,n.payload={element:null};var r=e.value;return n.callback=function(){fO||(fO=!0,t6=r),HB(t,e)},n}function Cde(t,e,n){n=Ff(-1,n),n.tag=3;var r=t.type.getDerivedStateFromError;if(typeof r=="function"){var s=e.value;n.payload=function(){return r(s)},n.callback=function(){HB(t,e)}}var i=t.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){HB(t,e),typeof r!="function"&&(yg===null?yg=new Set([this]):yg.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),n}function rJ(t,e,n){var r=t.pingCache;if(r===null){r=t.pingCache=new GRe;var s=new Set;r.set(e,s)}else s=r.get(e),s===void 0&&(s=new Set,r.set(e,s));s.has(n)||(s.add(n),t=lOe.bind(null,t,e,n),e.then(t,t))}function sJ(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function iJ(t,e,n,r,s){return t.mode&1?(t.flags|=65536,t.lanes=s,t):(t===e?t.flags|=65536:(t.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(e=Ff(-1,1),e.tag=2,xg(n,e,1))),n.lanes|=1),t)}var YRe=up.ReactCurrentOwner,Uo=!1;function eo(t,e,n,r){e.child=t===null?tde(e,null,n,r):R_(e,t.child,n,r)}function aJ(t,e,n,r,s){n=n.render;var i=e.ref;return Cw(e,s),r=YH(t,e,n,r,i,s),n=XH(),t!==null&&!Uo?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~s,Xf(t,e,s)):(Er&&n&&LH(e),e.flags|=1,eo(t,e,r,s),e.child)}function oJ(t,e,n,r,s){if(t===null){var i=n.type;return typeof i=="function"&&!aW(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=i,kde(t,e,i,r,s)):(t=CM(n.type,null,r,e,e.mode,s),t.ref=e.ref,t.return=e,e.child=t)}if(i=t.child,!(t.lanes&s)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:VC,n(o,r)&&t.ref===e.ref)return Xf(t,e,s)}return e.flags|=1,t=wg(i,r),t.ref=e.ref,t.return=e,e.child=t}function kde(t,e,n,r,s){if(t!==null){var i=t.memoizedProps;if(VC(i,r)&&t.ref===e.ref)if(Uo=!1,e.pendingProps=r=i,(t.lanes&s)!==0)t.flags&131072&&(Uo=!0);else return e.lanes=t.lanes,Xf(t,e,s)}return WB(t,e,n,r,s)}function Ade(t,e,n){var r=e.pendingProps,s=r.children,i=t!==null?t.memoizedState:null;if(r.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},lr(iw,bl),bl|=n;else{if(!(n&1073741824))return t=i!==null?i.baseLanes|n:n,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,lr(iw,bl),bl|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,lr(iw,bl),bl|=r}else i!==null?(r=i.baseLanes|n,e.memoizedState=null):r=n,lr(iw,bl),bl|=r;return eo(t,e,s,n),e.child}function Ede(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}
vendor: 8,034 bytes, line 41
41function WB(t,e,n,r,s){var i=Wo(n)?Wy:Pa.current;return i=P_(e,i),Cw(e,s),n=YH(t,e,n,r,i,s),r=XH(),t!==null&&!Uo?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~s,Xf(t,e,s)):(Er&&r&&LH(e),e.flags|=1,eo(t,e,n,s),e.child)}function lJ(t,e,n,r,s){if(Wo(n)){var i=!0;rO(e)}else i=!1;if(Cw(e,s),e.stateNode===null)jM(t,e),Sde(e,n,r),VB(e,n,r,s),r=!0;else if(t===null){var o=e.stateNode,l=e.memoizedProps;o.props=l;var c=o.context,u=n.contextType;typeof u=="object"&&u!==null?u=Mc(u):(u=Wo(n)?Wy:Pa.current,u=P_(e,u));var d=n.getDerivedStateFromProps,h=typeof d=="function"||typeof o.getSnapshotBeforeUpdate=="function";h||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==r||c!==u)&&nJ(e,o,r,u),Vp=!1;var f=e.memoizedState;o.state=f,lO(e,r,o,s),c=e.memoizedState,l!==r||f!==c||Ho.current||Vp?(typeof d=="function"&&(qB(e,n,d,r),c=e.memoizedState),(l=Vp||tJ(e,n,l,r,f,c,u))?(h||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=r,e.memoizedState=c),o.props=r,o.state=c,o.context=u,r=l):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{o=e.stateNode,rde(t,e),l=e.memoizedProps,u=e.type===e.elementType?l:eu(e.type,l),o.props=u,h=e.pendingProps,f=o.context,c=n.contextType,typeof c=="object"&&c!==null?c=Mc(c):(c=Wo(n)?Wy:Pa.current,c=P_(e,c));var p=n.getDerivedStateFromProps;(d=typeof p=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==h||f!==c)&&nJ(e,o,r,c),Vp=!1,f=e.memoizedState,o.state=f,lO(e,r,o,s);var m=e.memoizedState;l!==h||f!==m||Ho.current||Vp?(typeof p=="function"&&(qB(e,n,p,r),m=e.memoizedState),(u=Vp||tJ(e,n,u,r,f,m,c)||!1)?(d||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,m,c),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,m,c)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=m),o.props=r,o.state=m,o.context=c,r=u):(typeof o.componentDidUpdate!="function"||l===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),r=!1)}return KB(t,e,n,r,i,s)}function KB(t,e,n,r,s,i){Ede(t,e);var o=(e.flags&128)!==0;if(!r&&!o)return s&&KX(e,n,!1),Xf(t,e,i);r=e.stateNode,YRe.current=e;var l=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,t!==null&&o?(e.child=R_(e,t.child,null,i),e.child=R_(e,null,l,i)):eo(t,e,l,i),e.memoizedState=r.state,s&&KX(e,n,!0),e.child}function Tde(t){var e=t.stateNode;e.pendingContext?WX(t,e.pendingContext,e.pendingContext!==e.context):e.context&&WX(t,e.context,!1),HH(t,e.containerInfo)}function cJ(t,e,n,r,s){return M_(),$H(s),e.flags|=256,eo(t,e,n,r),e.child}var GB={dehydrated:null,treeContext:null,retryLane:0};function YB(t){return{baseLanes:t,cachePool:null,transitions:null}}function Pde(t,e,n){var r=e.pendingProps,s=Ir.current,i=!1,o=(e.flags&128)!==0,l;if((l=o)||(l=t!==null&&t.memoizedState===null?!1:(s&2)!==0),l?(i=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(s|=1),lr(Ir,s&1),t===null)return BB(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(o=r.children,t=r.fallback,i?(r=e.mode,i=e.child,o={mode:"hidden",children:o},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=o):i=FL(o,r,0,null),t=Iy(t,r,n,null),i.return=e,t.return=e,i.sibling=t,e.child=i,e.child.memoizedState=YB(n),e.memoizedState=GB,t):ZH(e,o));if(s=t.memoizedState,s!==null&&(l=s.dehydrated,l!==null))return XRe(t,e,o,r,l,s,n);if(i){i=r.fallback,o=e.mode,s=t.child,l=s.sibling;var c={mode:"hidden",children:r.children};return!(o&1)&&e.child!==s?(r=e.child,r.childLanes=0,r.pendingProps=c,e.deletions=null):(r=wg(s,c),r.subtreeFlags=s.subtreeFlags&14680064),l!==null?i=wg(l,i):(i=Iy(i,o,n,null),i.flags|=2),i.return=e,r.return=e,r.sibling=i,e.child=r,r=i,i=e.child,o=t.child.memoizedState,o=o===null?YB(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},i.memoizedState=o,i.childLanes=t.childLanes&~n,e.memoizedState=GB,r}return i=t.child,t=i.sibling,r=wg(i,{mode:"visible",children:r.children}),!(e.mode&1)&&(r.lanes=n),r.return=e,r.sibling=null,t!==null&&(n=e.deletions,n===null?(e.deletions=[t],e.flags|=16):n.push(t)),e.child=r,e.memoizedState=null,r}function ZH(t,e){return e=FL({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function AT(t,e,n,r){return r!==null&&$H(r),R_(e,t.child,null,n),t=ZH(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function XRe(t,e,n,r,s,i,o){if(n)return e.flags&256?(e.flags&=-257,r=l$(Error(Le(422))),AT(t,e,o,r)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(i=r.fallback,s=e.mode,r=FL({mode:"visible",children:r.children},s,0,null),i=Iy(i,s,o,null),i.flags|=2,r.return=e,i.return=e,r.sibling=i,e.child=r,e.mode&1&&R_(e,t.child,null,o),e.child.memoizedState=YB(o),e.memoizedState=GB,i);if(!(e.mode&1))return AT(t,e,o,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var l=r.dgst;return r=l,i=Error(Le(419)),r=l$(i,r,void 0),AT(t,e,o,r)}if(l=(o&t.childLanes)!==0,Uo||l){if(r=xi,r!==null){switch(o&-o){case 4:s=2;break;case 16:s=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:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(r.suspendedLanes|o)?0:s,s!==0&&s!==i.retryLane&&(i.retryLane=s,Yf(t,s),ku(r,t,s,-1))}return iW(),r=l$(Error(Le(421))),AT(t,e,o,r)}return s.data==="$?"?(e.flags|=128,e.child=t.child,e=cOe.bind(null,t),s._reactRetry=e,null):(t=i.treeContext,Al=vg(s.nextSibling),Tl=e,Er=!0,xu=null,t!==null&&(vc[xc++]=Rf,vc[xc++]=Of,vc[xc++]=Ky,Rf=t.id,Of=t.overflow,Ky=e),e=ZH(e,r.children),e.flags|=4096,e)}function uJ(t,e,n){t.lanes|=e;var r=t.alternate;r!==null&&(r.lanes|=e),UB(t.return,e,n)}function c$(t,e,n,r,s){var i=t.memoizedState;i===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:s}:(i.isBackwards=e,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=s)}function Mde(t,e,n){var r=e.pendingProps,s=r.revealOrder,i=r.tail;if(eo(t,e,r.children,n),r=Ir.current,r&2)r=r&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&uJ(t,n,e);else if(t.tag===19)uJ(t,n,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}r&=1}if(lr(Ir,r),!(e.mode&1))e.memoizedState=null;else switch(s){case"forwards":for(n=e.child,s=null;n!==null;)t=n.alternate,t!==null&&cO(t)===null&&(s=n),n=n.sibling;n=s,n===null?(s=e.child,e.child=null):(s=n.sibling,n.sibling=null),c$(e,!1,s,n,i);break;case"backwards":for(n=null,s=e.child,e.child=null;s!==null;){if(t=s.alternate,t!==null&&cO(t)===null){e.child=s;break}t=s.sibling,s.sibling=n,n=s,s=t}c$(e,!0,n,null,i);break;case"together":c$(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function jM(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}
vendor: 5,625 bytes, line 41
41function Xf(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),Yy|=e.lanes,!(n&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(Le(153));if(e.child!==null){for(t=e.child,n=wg(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=wg(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function JRe(t,e,n){switch(e.tag){case 3:Tde(e),M_();break;case 5:sde(e);break;case 1:Wo(e.type)&&rO(e);break;case 4:HH(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,s=e.memoizedProps.value;lr(aO,r._currentValue),r._currentValue=s;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(lr(Ir,Ir.current&1),e.flags|=128,null):n&e.child.childLanes?Pde(t,e,n):(lr(Ir,Ir.current&1),t=Xf(t,e,n),t!==null?t.sibling:null);lr(Ir,Ir.current&1);break;case 19:if(r=(n&e.childLanes)!==0,t.flags&128){if(r)return Mde(t,e,n);e.flags|=128}if(s=e.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),lr(Ir,Ir.current),r)break;return null;case 22:case 23:return e.lanes=0,Ade(t,e,n)}return Xf(t,e,n)}var Rde,XB,Ode,Ide;Rde=function(t,e){for(var n=e.child;n!==null;){if(n.tag===5||n.tag===6)t.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};XB=function(){};Ode=function(t,e,n,r){var s=t.memoizedProps;if(s!==r){t=e.stateNode,Zv(Jd.current);var i=null;switch(n){case"input":s=xB(t,s),r=xB(t,r),i=[];break;case"select":s=zr({},s,{value:void 0}),r=zr({},r,{value:void 0}),i=[];break;case"textarea":s=wB(t,s),r=wB(t,r),i=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(t.onclick=tO)}jB(n,r);var o;n=null;for(u in s)if(!r.hasOwnProperty(u)&&s.hasOwnProperty(u)&&s[u]!=null)if(u==="style"){var l=s[u];for(o in l)l.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(LC.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in r){var c=r[u];if(l=s!=null?s[u]:void 0,r.hasOwnProperty(u)&&c!==l&&(c!=null||l!=null))if(u==="style")if(l){for(o in l)!l.hasOwnProperty(o)||c&&c.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in c)c.hasOwnProperty(o)&&l[o]!==c[o]&&(n||(n={}),n[o]=c[o])}else n||(i||(i=[]),i.push(u,n)),n=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"&&(LC.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&mr("scroll",t),i||l===c||(i=[])):(i=i||[]).push(u,c))}n&&(i=i||[]).push("style",n);var u=i;(e.updateQueue=u)&&(e.flags|=4)}};Ide=function(t,e,n,r){n!==r&&(e.flags|=4)};function pS(t,e){if(!Er)switch(t.tailMode){case"hidden":e=t.tail;for(var n=null;e!==null;)e.alternate!==null&&(n=e),e=e.sibling;n===null?t.tail=null:n.sibling=null;break;case"collapsed":n=t.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:r.sibling=null}}function ta(t){var e=t.alternate!==null&&t.alternate.child===t.child,n=0,r=0;if(e)for(var s=t.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags&14680064,r|=s.flags&14680064,s.return=t,s=s.sibling;else for(s=t.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags,r|=s.flags,s.return=t,s=s.sibling;return t.subtreeFlags|=r,t.childLanes=n,e}function QRe(t,e,n){var r=e.pendingProps;switch(FH(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ta(e),null;case 1:return Wo(e.type)&&nO(),ta(e),null;case 3:return r=e.stateNode,O_(),br(Ho),br(Pa),KH(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(CT(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,xu!==null&&(s6(xu),xu=null))),XB(t,e),ta(e),null;case 5:WH(e);var s=Zv(YC.current);if(n=e.type,t!==null&&e.stateNode!=null)Ode(t,e,n,r,s),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!r){if(e.stateNode===null)throw Error(Le(166));return ta(e),null}if(t=Zv(Jd.current),CT(e)){r=e.stateNode,n=e.type;var i=e.memoizedProps;switch(r[Fd]=e,r[KC]=i,t=(e.mode&1)!==0,n){case"dialog":mr("cancel",r),mr("close",r);break;case"iframe":case"object":case"embed":mr("load",r);break;case"video":case"audio":for(s=0;s<ZS.length;s++)mr(ZS[s],r);break;case"source":mr("error",r);break;case"img":case"image":case"link":mr("error",r),mr("load",r);break;case"details":mr("toggle",r);break;case"input":yX(r,i),mr("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},mr("invalid",r);break;case"textarea":wX(r,i),mr("invalid",r)}jB(n,i),s=null;for(var o in i)if(i.hasOwnProperty(o)){var l=i[o];o==="children"?typeof l=="string"?r.textContent!==l&&(i.suppressHydrationWarning!==!0&&NT(r.textContent,l,t),s=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&NT(r.textContent,l,t),s=["children",""+l]):LC.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&mr("scroll",r)}switch(n){case"input":vT(r),bX(r,i,!0);break;case"textarea":vT(r),_X(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=tO)}r=s,e.updateQueue=r,r!==null&&(e.flags|=4)}else{o=s.nodeType===9?s:s.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=cue(n)),t==="http://www.w3.org/1999/xhtml"?n==="script"?(t=o.createElement("div"),t.innerHTML="<script><\/script>
41",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=o.createElement(n,{is:r.is}):(t=o.createElement(n),n==="select"&&(o=t,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):t=o.createElementNS(t,n),t[Fd]=e,t[KC]=r,Rde(t,e,!1,!1),e.stateNode=t;e:{switch(o=SB(n,r),n){case"dialog":mr("cancel",t),mr("close",t),s=r;break;case"iframe":case"object":case"embed":mr("load",t),s=r;break;case"video":case"audio":for(s=0;s<ZS.length;s++)mr(ZS[s],t);s=r;break;case"source":mr("error",t),s=r;break;case"img":case"image":case"link":mr("error",t),mr("load",t),s=r;break;case"details":mr("toggle",t),s=r;break;case"input":yX(t,r),s=xB(t,r),mr("invalid",t);break;case"option":s=r;break;case"select":t._wrapperState={wasMultiple:!!r.multiple},s=zr({},r,{value:void 0}),mr("invalid",t);break;case"textarea":wX(t,r),s=wB(t,r),mr("invalid",t);break;default:s=r}jB(n,s),l=s;for(i in l)if(l.hasOwnProperty(i)){var c=l[i];i==="style"?hue(t,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&uue(t,c)):i==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&FC(t,c):typeof c=="number"&&FC(t,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(LC.hasOwnProperty(i)?c!=null&&i==="onScroll"&&mr("scroll",t):c!=null&&jH(t,i,c,o))}switch(n){case"input":vT(t),bX(t,r,!1);break;case"textarea":vT(t),_X(t);break;case"option":r.value!=null&&t.setAttribute("value",""+Mg(r.value));break;case"select":t.multiple=!!r.multiple,i=r.value,i!=null?_w(t,!!r.multiple,i,!1):r.defaultValue!=null&&_w(t,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(t.onclick=tO)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return ta(e),null;case 6:if(t&&e.stateNode!=null)Ide(t,e,t.memoizedProps,r);else{if(typeof r!="string"&&e.stateNode===null)throw Error(Le(166));
vendor: 27,207 bytes, line 41
41if(n=Zv(YC.current),Zv(Jd.current),CT(e)){if(r=e.stateNode,n=e.memoizedProps,r[Fd]=e,(i=r.nodeValue!==n)&&(t=Tl,t!==null))switch(t.tag){case 3:NT(r.nodeValue,n,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&NT(r.nodeValue,n,(t.mode&1)!==0)}i&&(e.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Fd]=e,e.stateNode=r}return ta(e),null;case 13:if(br(Ir),r=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(Er&&Al!==null&&e.mode&1&&!(e.flags&128))Zue(),M_(),e.flags|=98560,i=!1;else if(i=CT(e),r!==null&&r.dehydrated!==null){if(t===null){if(!i)throw Error(Le(318));if(i=e.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(Le(317));i[Fd]=e}else M_(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;ta(e),i=!1}else xu!==null&&(s6(xu),xu=null),i=!0;if(!i)return e.flags&65536?e:null}return e.flags&128?(e.lanes=n,e):(r=r!==null,r!==(t!==null&&t.memoizedState!==null)&&r&&(e.child.flags|=8192,e.mode&1&&(t===null||Ir.current&1?Hs===0&&(Hs=3):iW())),e.updateQueue!==null&&(e.flags|=4),ta(e),null);case 4:return O_(),XB(t,e),t===null&&HC(e.stateNode.containerInfo),ta(e),null;case 10:return UH(e.type._context),ta(e),null;case 17:return Wo(e.type)&&nO(),ta(e),null;case 19:if(br(Ir),i=e.memoizedState,i===null)return ta(e),null;if(r=(e.flags&128)!==0,o=i.rendering,o===null)if(r)pS(i,!1);else{if(Hs!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(o=cO(t),o!==null){for(e.flags|=128,pS(i,!1),r=o.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),e.subtreeFlags=0,r=n,n=e.child;n!==null;)i=n,t=r,i.flags&=14680066,o=i.alternate,o===null?(i.childLanes=0,i.lanes=t,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,t=o.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),n=n.sibling;return lr(Ir,Ir.current&1|2),e.child}t=t.sibling}i.tail!==null&&gs()>D_&&(e.flags|=128,r=!0,pS(i,!1),e.lanes=4194304)}else{if(!r)if(t=cO(o),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),pS(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!Er)return ta(e),null}else 2*gs()-i.renderingStartTime>D_&&n!==1073741824&&(e.flags|=128,r=!0,pS(i,!1),e.lanes=4194304);i.isBackwards?(o.sibling=e.child,e.child=o):(n=i.last,n!==null?n.sibling=o:e.child=o,i.last=o)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=gs(),e.sibling=null,n=Ir.current,lr(Ir,r?n&1|2:n&1),e):(ta(e),null);case 22:case 23:return sW(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?bl&1073741824&&(ta(e),e.subtreeFlags&6&&(e.flags|=8192)):ta(e),null;case 24:return null;case 25:return null}throw Error(Le(156,e.tag))}function ZRe(t,e){switch(FH(e),e.tag){case 1:return Wo(e.type)&&nO(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return O_(),br(Ho),br(Pa),KH(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return WH(e),null;case 13:if(br(Ir),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(Le(340));M_()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return br(Ir),null;case 4:return O_(),null;case 10:return UH(e.type._context),null;case 22:case 23:return sW(),null;case 24:return null;default:return null}}var ET=!1,ba=!1,eOe=typeof WeakSet=="function"?WeakSet:Set,dt=null;function sw(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ts(t,e,r)}else n.current=null}function JB(t,e,n){try{n()}catch(r){ts(t,e,r)}}var dJ=!1;function tOe(t,e){if(OB=QR,t=zue(),DH(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,l=-1,c=-1,u=0,d=0,h=t,f=null;t:for(;;){for(var p;h!==n||s!==0&&h.nodeType!==3||(l=o+s),h!==i||r!==0&&h.nodeType!==3||(c=o+r),h.nodeType===3&&(o+=h.nodeValue.length),(p=h.firstChild)!==null;)f=h,h=p;for(;;){if(h===t)break t;if(f===n&&++u===s&&(l=o),f===i&&++d===r&&(c=o),(p=h.nextSibling)!==null)break;h=f,f=h.parentNode}h=p}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(IB={focusedElem:t,selectionRange:n},QR=!1,dt=e;dt!==null;)if(e=dt,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,dt=t;else for(;dt!==null;){e=dt;try{var m=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var v=m.memoizedProps,x=m.memoizedState,g=e.stateNode,w=g.getSnapshotBeforeUpdate(e.elementType===e.type?v:eu(e.type,v),x);g.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var _=e.stateNode.containerInfo;_.nodeType===1?_.textContent="":_.nodeType===9&&_.documentElement&&_.removeChild(_.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Le(163))}}catch(j){ts(e,e.return,j)}if(t=e.sibling,t!==null){t.return=e.return,dt=t;break}dt=e.return}return m=dJ,dJ=!1,m}function sC(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&t)===t){var i=s.destroy;s.destroy=void 0,i!==void 0&&JB(e,n,i)}s=s.next}while(s!==r)}}function DL(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function QB(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function Dde(t){var e=t.alternate;e!==null&&(t.alternate=null,Dde(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Fd],delete e[KC],delete e[FB],delete e[LRe],delete e[FRe])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function Lde(t){return t.tag===5||t.tag===3||t.tag===4}function hJ(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Lde(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function ZB(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=tO));else if(r!==4&&(t=t.child,t!==null))for(ZB(t,e,n),t=t.sibling;t!==null;)ZB(t,e,n),t=t.sibling}function e6(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(e6(t,e,n),t=t.sibling;t!==null;)e6(t,e,n),t=t.sibling}var Mi=null,vu=!1;function Sp(t,e,n){for(n=n.child;n!==null;)Fde(t,e,n),n=n.sibling}function Fde(t,e,n){if(Xd&&typeof Xd.onCommitFiberUnmount=="function")try{Xd.onCommitFiberUnmount(AL,n)}catch{}switch(n.tag){case 5:ba||sw(n,e);case 6:var r=Mi,s=vu;Mi=null,Sp(t,e,n),Mi=r,vu=s,Mi!==null&&(vu?(t=Mi,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):Mi.removeChild(n.stateNode));break;case 18:Mi!==null&&(vu?(t=Mi,n=n.stateNode,t.nodeType===8?n$(t.parentNode,n):t.nodeType===1&&n$(t,n),UC(t)):n$(Mi,n.stateNode));break;case 4:r=Mi,s=vu,Mi=n.stateNode.containerInfo,vu=!0,Sp(t,e,n),Mi=r,vu=s;break;case 0:case 11:case 14:case 15:if(!ba&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&JB(n,e,o),s=s.next}while(s!==r)}Sp(t,e,n);break;case 1:if(!ba&&(sw(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){ts(n,e,l)}Sp(t,e,n);break;case 21:Sp(t,e,n);break;case 22:n.mode&1?(ba=(r=ba)||n.memoizedState!==null,Sp(t,e,n),ba=r):Sp(t,e,n);break;default:Sp(t,e,n)}}function fJ(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new eOe),e.forEach(function(r){var s=uOe.bind(null,t,r);n.has(r)||(n.add(r),r.then(s,s))})}}function qc(t,e){var n=e.deletions;if(n!==null)for(var r=0;r<n.length;r++){var s=n[r];try{var i=t,o=e,l=o;e:for(;l!==null;){switch(l.tag){case 5:Mi=l.stateNode,vu=!1;break e;case 3:Mi=l.stateNode.containerInfo,vu=!0;break e;case 4:Mi=l.stateNode.containerInfo,vu=!0;break e}l=l.return}if(Mi===null)throw Error(Le(160));Fde(i,o,s),Mi=null,vu=!1;var c=s.alternate;c!==null&&(c.return=null),s.return=null}catch(u){ts(s,e,u)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)$de(e,t),e=e.sibling}function $de(t,e){var n=t.alternate,r=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(qc(e,t),Xu(t),r&4){try{sC(3,t,t.return),DL(3,t)}catch(v){ts(t,t.return,v)}try{sC(5,t,t.return)}catch(v){ts(t,t.return,v)}}break;case 1:qc(e,t),Xu(t),r&512&&n!==null&&sw(n,n.return);break;case 5:if(qc(e,t),Xu(t),r&512&&n!==null&&sw(n,n.return),t.flags&32){var s=t.stateNode;try{FC(s,"")}catch(v){ts(t,t.return,v)}}if(r&4&&(s=t.stateNode,s!=null)){var i=t.memoizedProps,o=n!==null?n.memoizedProps:i,l=t.type,c=t.updateQueue;if(t.updateQueue=null,c!==null)try{l==="input"&&i.type==="radio"&&i.name!=null&&oue(s,i),SB(l,o);var u=SB(l,i);for(o=0;o<c.length;o+=2){var d=c[o],h=c[o+1];d==="style"?hue(s,h):d==="dangerouslySetInnerHTML"?uue(s,h):d==="children"?FC(s,h):jH(s,d,h,u)}switch(l){case"input":yB(s,i);break;case"textarea":lue(s,i);break;case"select":var f=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?_w(s,!!i.multiple,p,!1):f!==!!i.multiple&&(i.defaultValue!=null?_w(s,!!i.multiple,i.defaultValue,!0):_w(s,!!i.multiple,i.multiple?[]:"",!1))}s[KC]=i}catch(v){ts(t,t.return,v)}}break;case 6:if(qc(e,t),Xu(t),r&4){if(t.stateNode===null)throw Error(Le(162));s=t.stateNode,i=t.memoizedProps;try{s.nodeValue=i}catch(v){ts(t,t.return,v)}}break;case 3:if(qc(e,t),Xu(t),r&4&&n!==null&&n.memoizedState.isDehydrated)try{UC(e.containerInfo)}catch(v){ts(t,t.return,v)}break;case 4:qc(e,t),Xu(t);break;case 13:qc(e,t),Xu(t),s=t.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(nW=gs())),r&4&&fJ(t);break;case 22:if(d=n!==null&&n.memoizedState!==null,t.mode&1?(ba=(u=ba)||d,qc(e,t),ba=u):qc(e,t),Xu(t),r&8192){if(u=t.memoizedState!==null,(t.stateNode.isHidden=u)&&!d&&t.mode&1)for(dt=t,d=t.child;d!==null;){for(h=dt=d;dt!==null;){switch(f=dt,p=f.child,f.tag){case 0:case 11:case 14:case 15:sC(4,f,f.return);break;case 1:sw(f,f.return);var m=f.stateNode;if(typeof m.componentWillUnmount=="function"){r=f,n=f.return;try{e=r,m.props=e.memoizedProps,m.state=e.memoizedState,m.componentWillUnmount()}catch(v){ts(r,n,v)}}break;case 5:sw(f,f.return);break;case 22:if(f.memoizedState!==null){mJ(h);continue}}p!==null?(p.return=f,dt=p):mJ(h)}d=d.sibling}e:for(d=null,h=t;;){if(h.tag===5){if(d===null){d=h;try{s=h.stateNode,u?(i=s.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(l=h.stateNode,c=h.memoizedProps.style,o=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=due("display",o))}catch(v){ts(t,t.return,v)}}}else if(h.tag===6){if(d===null)try{h.stateNode.nodeValue=u?"":h.memoizedProps}catch(v){ts(t,t.return,v)}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===t)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===t)break e;for(;h.sibling===null;){if(h.return===null||h.return===t)break e;d===h&&(d=null),h=h.return}d===h&&(d=null),h.sibling.return=h.return,h=h.sibling}}break;case 19:qc(e,t),Xu(t),r&4&&fJ(t);break;case 21:break;default:qc(e,t),Xu(t)}}function Xu(t){var e=t.flags;if(e&2){try{e:{for(var n=t.return;n!==null;){if(Lde(n)){var r=n;break e}n=n.return}throw Error(Le(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(FC(s,""),r.flags&=-33);var i=hJ(t);e6(t,i,s);break;case 3:case 4:var o=r.stateNode.containerInfo,l=hJ(t);ZB(t,l,o);break;default:throw Error(Le(161))}}catch(c){ts(t,t.return,c)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function nOe(t,e,n){dt=t,zde(t)}function zde(t,e,n){for(var r=(t.mode&1)!==0;dt!==null;){var s=dt,i=s.child;if(s.tag===22&&r){var o=s.memoizedState!==null||ET;if(!o){var l=s.alternate,c=l!==null&&l.memoizedState!==null||ba;l=ET;var u=ba;if(ET=o,(ba=c)&&!u)for(dt=s;dt!==null;)o=dt,c=o.child,o.tag===22&&o.memoizedState!==null?gJ(s):c!==null?(c.return=o,dt=c):gJ(s);for(;i!==null;)dt=i,zde(i),i=i.sibling;dt=s,ET=l,ba=u}pJ(t)}else s.subtreeFlags&8772&&i!==null?(i.return=s,dt=i):pJ(t)}}function pJ(t){for(;dt!==null;){var e=dt;if(e.flags&8772){var n=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:ba||DL(5,e);break;case 1:var r=e.stateNode;if(e.flags&4&&!ba)if(n===null)r.componentDidMount();else{var s=e.elementType===e.type?n.memoizedProps:eu(e.type,n.memoizedProps);r.componentDidUpdate(s,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=e.updateQueue;i!==null&&QX(e,i,r);break;case 3:var o=e.updateQueue;if(o!==null){if(n=null,e.child!==null)switch(e.child.tag){case 5:n=e.child.stateNode;break;case 1:n=e.child.stateNode}QX(e,o,n)}break;case 5:var l=e.stateNode;if(n===null&&e.flags&4){n=l;var c=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var u=e.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var h=d.dehydrated;h!==null&&UC(h)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Le(163))}ba||e.flags&512&&QB(e)}catch(f){ts(e,e.return,f)}}if(e===t){dt=null;break}if(n=e.sibling,n!==null){n.return=e.return,dt=n;break}dt=e.return}}function mJ(t){for(;dt!==null;){var e=dt;if(e===t){dt=null;break}var n=e.sibling;if(n!==null){n.return=e.return,dt=n;break}dt=e.return}}function gJ(t){for(;dt!==null;){var e=dt;try{switch(e.tag){case 0:case 11:case 15:var n=e.return;try{DL(4,e)}catch(c){ts(e,n,c)}break;case 1:var r=e.stateNode;if(typeof r.componentDidMount=="function"){var s=e.return;try{r.componentDidMount()}catch(c){ts(e,s,c)}}var i=e.return;try{QB(e)}catch(c){ts(e,i,c)}break;case 5:var o=e.return;try{QB(e)}catch(c){ts(e,o,c)}}}catch(c){ts(e,e.return,c)}if(e===t){dt=null;break}var l=e.sibling;if(l!==null){l.return=e.return,dt=l;break}dt=e.return}}var rOe=Math.ceil,hO=up.ReactCurrentDispatcher,eW=up.ReactCurrentOwner,Cc=up.ReactCurrentBatchConfig,vn=0,xi=null,Ss=null,Hi=0,bl=0,iw=Xg(0),Hs=0,ZC=null,Yy=0,LL=0,tW=0,iC=null,$o=null,nW=0,D_=1/0,Bh=null,fO=!1,t6=null,yg=null,TT=!1,cg=null,pO=0,aC=0,n6=null,SM=-1,NM=0;function lo(){return vn&6?gs():SM!==-1?SM:SM=gs()}function bg(t){return t.mode&1?vn&2&&Hi!==0?Hi&-Hi:zRe.transition!==null?(NM===0&&(NM=Sue()),NM):(t=Ln,t!==0||(t=window.event,t=t===void 0?16:Pue(t.type)),t):1}function ku(t,e,n,r){if(50<aC)throw aC=0,n6=null,Error(Le(185));WE(t,n,r),(!(vn&2)||t!==xi)&&(t===xi&&(!(vn&2)&&(LL|=n),Hs===4&&Jp(t,Hi)),Ko(t,r),n===1&&vn===0&&!(e.mode&1)&&(D_=gs()+500,RL&&Jg()))}function Ko(t,e){var n=t.callbackNode;zMe(t,e);var r=JR(t,t===xi?Hi:0);if(r===0)n!==null&&NX(n),t.callbackNode=null,t.callbackPriority=0;else if(e=r&-r,t.callbackPriority!==e){if(n!=null&&NX(n),e===1)t.tag===0?$Re(vJ.bind(null,t)):Xue(vJ.bind(null,t)),IRe(function(){!(vn&6)&&Jg()}),n=null;else{switch(Nue(r)){case 1:n=AH;break;case 4:n=_ue;break;case 16:n=XR;break;case 536870912:n=jue;break;default:n=XR}n=Gde(n,Bde.bind(null,t))}t.callbackPriority=e,t.callbackNode=n}}function Bde(t,e){if(SM=-1,NM=0,vn&6)throw Error(Le(327));var n=t.callbackNode;if(kw()&&t.callbackNode!==n)return null;var r=JR(t,t===xi?Hi:0);if(r===0)return null;if(r&30||r&t.expiredLanes||e)e=mO(t,r);else{e=r;var s=vn;vn|=2;var i=qde();(xi!==t||Hi!==e)&&(Bh=null,D_=gs()+500,Oy(t,e));do try{aOe();break}catch(l){Ude(t,l)}while(!0);BH(),hO.current=i,vn=s,Ss!==null?e=0:(xi=null,Hi=0,e=Hs)}if(e!==0){if(e===2&&(s=EB(t),s!==0&&(r=s,e=r6(t,s))),e===1)throw n=ZC,Oy(t,0),Jp(t,r),Ko(t,gs()),n;if(e===6)Jp(t,r);else{if(s=t.current.alternate,!(r&30)&&!sOe(s)&&(e=mO(t,r),e===2&&(i=EB(t),i!==0&&(r=i,e=r6(t,i))),e===1))throw n=ZC,Oy(t,0),Jp(t,r),Ko(t,gs()),n;switch(t.finishedWork=s,t.finishedLanes=r,e){case 0:case 1:throw Error(Le(345));case 2:Pv(t,$o,Bh);break;case 3:if(Jp(t,r),(r&130023424)===r&&(e=nW+500-gs(),10<e)){if(JR(t,0)!==0)break;if(s=t.suspendedLanes,(s&r)!==r){lo(),t.pingedLanes|=t.suspendedLanes&s;break}t.timeoutHandle=LB(Pv.bind(null,t,$o,Bh),e);break}Pv(t,$o,Bh);break;case 4:if(Jp(t,r),(r&4194240)===r)break;for(e=t.eventTimes,s=-1;0<r;){var o=31-Cu(r);i=1<<o,o=e[o],o>s&&(s=o),r&=~i}if(r=s,r=gs()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*rOe(r/1960))-r,10<r){t.timeoutHandle=LB(Pv.bind(null,t,$o,Bh),r);break}Pv(t,$o,Bh);break;case 5:Pv(t,$o,Bh);break;default:throw Error(Le(329))}}}return Ko(t,gs()),t.callbackNode===n?Bde.bind(null,t):null}function r6(t,e){var n=iC;return t.current.memoizedState.isDehydrated&&(Oy(t,e).flags|=256),t=mO(t,e),t!==2&&(e=$o,$o=n,e!==null&&s6(e)),t}function s6(t){$o===null?$o=t:$o.push.apply($o,t)}function sOe(t){for(var e=t;;){if(e.flags&16384){var n=e.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var s=n[r],i=s.getSnapshot;s=s.value;try{if(!Tu(i(),s))return!1}catch{return!1}}}if(n=e.child,e.subtreeFlags&16384&&n!==null)n.return=e,e=n;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function Jp(t,e){for(e&=~tW,e&=~LL,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var n=31-Cu(e),r=1<<n;t[n]=-1,e&=~r}}function vJ(t){if(vn&6)throw Error(Le(327));kw();var e=JR(t,0);if(!(e&1))return Ko(t,gs()),null;var n=mO(t,e);if(t.tag!==0&&n===2){var r=EB(t);r!==0&&(e=r,n=r6(t,r))}if(n===1)throw n=ZC,Oy(t,0),Jp(t,e),Ko(t,gs()),n;if(n===6)throw Error(Le(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,Pv(t,$o,Bh),Ko(t,gs()),null}function rW(t,e){var n=vn;vn|=1;try{return t(e)}finally{vn=n,vn===0&&(D_=gs()+500,RL&&Jg())}}function Xy(t){cg!==null&&cg.tag===0&&!(vn&6)&&kw();var e=vn;vn|=1;var n=Cc.transition,r=Ln;try{if(Cc.transition=null,Ln=1,t)return t()}finally{Ln=r,Cc.transition=n,vn=e,!(vn&6)&&Jg()}}function sW(){bl=iw.current,br(iw)}function Oy(t,e){t.finishedWork=null,t.finishedLanes=0;var n=t.timeoutHandle;if(n!==-1&&(t.timeoutHandle=-1,ORe(n)),Ss!==null)for(n=Ss.return;n!==null;){var r=n;switch(FH(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&nO();break;case 3:O_(),br(Ho),br(Pa),KH();break;case 5:WH(r);break;case 4:O_();break;case 13:br(Ir);break;case 19:br(Ir);break;case 10:UH(r.type._context);break;case 22:case 23:sW()}n=n.return}if(xi=t,Ss=t=wg(t.current,null),Hi=bl=e,Hs=0,ZC=null,tW=LL=Yy=0,$o=iC=null,Qv!==null){for(e=0;e<Qv.length;e++)if(n=Qv[e],r=n.interleaved,r!==null){n.interleaved=null;var s=r.next,i=n.pending;if(i!==null){var o=i.next;i.next=s,r.next=o}n.pending=r}Qv=null}return t}function Ude(t,e){do{var n=Ss;try{if(BH(),wM.current=dO,uO){for(var r=Fr.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}uO=!1}if(Gy=0,fi=qs=Fr=null,rC=!1,XC=0,eW.current=null,n===null||n.return===null){Hs=1,ZC=e,Ss=null;break}e:{var i=t,o=n.return,l=n,c=e;if(e=Hi,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,d=l,h=d.tag;if(!(d.mode&1)&&(h===0||h===11||h===15)){var f=d.alternate;f?(d.updateQueue=f.updateQueue,d.memoizedState=f.memoizedState,d.lanes=f.lanes):(d.updateQueue=null,d.memoizedState=null)}var p=sJ(o);if(p!==null){p.flags&=-257,iJ(p,o,l,i,e),p.mode&1&&rJ(i,u,e),e=p,c=u;var m=e.updateQueue;if(m===null){var v=new Set;v.add(c),e.updateQueue=v}else m.add(c);break e}else{if(!(e&1)){rJ(i,u,e),iW();break e}c=Error(Le(426))}}else if(Er&&l.mode&1){var x=sJ(o);if(x!==null){!(x.flags&65536)&&(x.flags|=256),iJ(x,o,l,i,e),$H(I_(c,l));break e}}i=c=I_(c,l),Hs!==4&&(Hs=2),iC===null?iC=[i]:iC.push(i),i=o;do{switch(i.tag){case 3:i.flags|=65536,e&=-e,i.lanes|=e;var g=Nde(i,c,e);JX(i,g);break e;case 1:l=c;var w=i.type,_=i.stateNode;if(!(i.flags&128)&&(typeof w.getDerivedStateFromError=="function"||_!==null&&typeof _.componentDidCatch=="function"&&(yg===null||!yg.has(_)))){i.flags|=65536,e&=-e,i.lanes|=e;var j=Cde(i,l,e);JX(i,j);break e}}i=i.return}while(i!==null)}Hde(n)}catch(N){e=N,Ss===n&&n!==null&&(Ss=n=n.return);continue}break}while(!0)}function qde(){var t=hO.current;return hO.current=dO,t===null?dO:t}function iW(){(Hs===0||Hs===3||Hs===2)&&(Hs=4),xi===null||!(Yy&268435455)&&!(LL&268435455)||Jp(xi,Hi)}function mO(t,e){var n=vn;vn|=2;var r=qde();(xi!==t||Hi!==e)&&(Bh=null,Oy(t,e));do try{iOe();break}catch(s){Ude(t,s)}while(!0);if(BH(),vn=n,hO.current=r,Ss!==null)throw Error(Le(261));return xi=null,Hi=0,Hs}function iOe(){for(;Ss!==null;)Vde(Ss)}function aOe(){for(;Ss!==null&&!PMe();)Vde(Ss)}function Vde(t){var e=Kde(t.alternate,t,bl);t.memoizedProps=t.pendingProps,e===null?Hde(t):Ss=e,eW.current=null}function Hde(t){var e=t;do{var n=e.alternate;if(t=e.return,e.flags&32768){if(n=ZRe(n,e),n!==null){n.flags&=32767,Ss=n;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Hs=6,Ss=null;return}}else if(n=QRe(n,e,bl),n!==null){Ss=n;return}if(e=e.sibling,e!==null){Ss=e;return}Ss=e=t}while(e!==null);Hs===0&&(Hs=5)}function Pv(t,e,n){var r=Ln,s=Cc.transition;try{Cc.transition=null,Ln=1,oOe(t,e,n,r)}finally{Cc.transition=s,Ln=r}return null}function oOe(t,e,n,r){do kw();while(cg!==null);if(vn&6)throw Error(Le(327));n=t.finishedWork;var s=t.finishedLanes;if(n===null)return null;if(t.finishedWork=null,t.finishedLanes=0,n===t.current)throw Error(Le(177));t.callbackNode=null,t.callbackPriority=0;var i=n.lanes|n.childLanes;if(BMe(t,i),t===xi&&(Ss=xi=null,Hi=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||TT||(TT=!0,Gde(XR,function(){return kw(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=Cc.transition,Cc.transition=null;var o=Ln;Ln=1;var l=vn;vn|=4,eW.current=null,tOe(t,n),$de(n,t),kRe(IB),QR=!!OB,IB=OB=null,t.current=n,nOe(n),MMe(),vn=l,Ln=o,Cc.transition=i}else t.current=n;if(TT&&(TT=!1,cg=t,pO=s),i=t.pendingLanes,i===0&&(yg=null),IMe(n.stateNode),Ko(t,gs()),e!==null)for(r=t.onRecoverableError,n=0;n<e.length;n++)s=e[n],r(s.value,{componentStack:s.stack,digest:s.digest});if(fO)throw fO=!1,t=t6,t6=null,t;return pO&1&&t.tag!==0&&kw(),i=t.pendingLanes,i&1?t===n6?aC++:(aC=0,n6=t):aC=0,Jg(),null}function kw(){if(cg!==null){var t=Nue(pO),e=Cc.transition,n=Ln;try{if(Cc.transition=null,Ln=16>t?16:t,cg===null)var r=!1;else{if(t=cg,cg=null,pO=0,vn&6)throw Error(Le(331));var s=vn;for(vn|=4,dt=t.current;dt!==null;){var i=dt,o=i.child;if(dt.flags&16){var l=i.deletions;if(l!==null){for(var c=0;c<l.length;c++){var u=l[c];for(dt=u;dt!==null;){var d=dt;switch(d.tag){case 0:case 11:case 15:sC(8,d,i)}var h=d.child;if(h!==null)h.return=d,dt=h;else for(;dt!==null;){d=dt;var f=d.sibling,p=d.return;if(Dde(d),d===u){dt=null;break}if(f!==null){f.return=p,dt=f;break}dt=p}}}var m=i.alternate;if(m!==null){var v=m.child;if(v!==null){m.child=null;do{var x=v.sibling;v.sibling=null,v=x}while(v!==null)}}dt=i}}if(i.subtreeFlags&2064&&o!==null)o.return=i,dt=o;else e:for(;dt!==null;){if(i=dt,i.flags&2048)switch(i.tag){case 0:case 11:case 15:sC(9,i,i.return)}var g=i.sibling;if(g!==null){g.return=i.return,dt=g;break e}dt=i.return}}var w=t.current;for(dt=w;dt!==null;){o=dt;var _=o.child;if(o.subtreeFlags&2064&&_!==null)_.return=o,dt=_;else e:for(o=w;dt!==null;){if(l=dt,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:DL(9,l)}}catch(N){ts(l,l.return,N)}if(l===o){dt=null;break e}var j=l.sibling;if(j!==null){j.return=l.return,dt=j;break e}dt=l.return}}if(vn=s,Jg(),Xd&&typeof Xd.onPostCommitFiberRoot=="function")try{Xd.onPostCommitFiberRoot(AL,t)}catch{}r=!0}return r}finally{Ln=n,Cc.transition=e}}return!1}function xJ(t,e,n){e=I_(n,e),e=Nde(t,e,1),t=xg(t,e,1),e=lo(),t!==null&&(WE(t,1,e),Ko(t,e))}function ts(t,e,n){if(t.tag===3)xJ(t,t,n);else for(;e!==null;){if(e.tag===3){xJ(e,t,n);break}else if(e.tag===1){var r=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(yg===null||!yg.has(r))){t=I_(n,t),t=Cde(e,t,1),e=xg(e,t,1),t=lo(),e!==null&&(WE(e,1,t),Ko(e,t));break}}e=e.return}}function lOe(t,e,n){var r=t.pingCache;r!==null&&r.delete(e),e=lo(),t.pingedLanes|=t.suspendedLanes&n,xi===t&&(Hi&n)===n&&(Hs===4||Hs===3&&(Hi&130023424)===Hi&&500>gs()-nW?Oy(t,0):tW|=n),Ko(t,e)}function Wde(t,e){e===0&&(t.mode&1?(e=bT,bT<<=1,!(bT&130023424)&&(bT=4194304)):e=1);var n=lo();t=Yf(t,e),t!==null&&(WE(t,e,n),Ko(t,n))}function cOe(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),Wde(t,n)}function uOe(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,s=t.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(Le(314))}r!==null&&r.delete(e),Wde(t,n)}var Kde;Kde=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||Ho.current)Uo=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return Uo=!1,JRe(t,e,n);Uo=!!(t.flags&131072)}else Uo=!1,Er&&e.flags&1048576&&Jue(e,iO,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;jM(t,e),t=e.pendingProps;var s=P_(e,Pa.current);Cw(e,n),s=YH(null,e,r,t,s,n);var i=XH();return e.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Wo(r)?(i=!0,rO(e)):i=!1,e.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,VH(e),s.updater=IL,e.stateNode=s,s._reactInternals=e,VB(e,r,t,n),e=KB(null,e,r,!0,i,n)):(e.tag=0,Er&&i&&LH(e),eo(null,e,s,n),e=e.child),e;case 16:r=e.elementType;e:{switch(jM(t,e),t=e.pendingProps,s=r._init,r=s(r._payload),e.type=r,s=e.tag=hOe(r),t=eu(r,t),s){case 0:e=WB(null,e,r,t,n);break e;case 1:e=lJ(null,e,r,t,n);break e;case 11:e=aJ(null,e,r,t,n);break e;case 14:e=oJ(null,e,r,eu(r.type,t),n);break e}throw Error(Le(306,r,""))}return e;case 0:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:eu(r,s),WB(t,e,r,s,n);case 1:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:eu(r,s),lJ(t,e,r,s,n);case 3:e:{if(Tde(e),t===null)throw Error(Le(387));r=e.pendingProps,i=e.memoizedState,s=i.element,rde(t,e),lO(e,r,null,n);var o=e.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=i,e.memoizedState=i,e.flags&256){s=I_(Error(Le(423)),e),e=cJ(t,e,r,n,s);break e}else if(r!==s){s=I_(Error(Le(424)),e),e=cJ(t,e,r,n,s);break e}else for(Al=vg(e.stateNode.containerInfo.firstChild),Tl=e,Er=!0,xu=null,n=tde(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(M_(),r===s){e=Xf(t,e,n);break e}eo(t,e,r,n)}e=e.child}return e;case 5:return sde(e),t===null&&BB(e),r=e.type,s=e.pendingProps,i=t!==null?t.memoizedProps:null,o=s.children,DB(r,s)?o=null:i!==null&&DB(r,i)&&
vendor: 6,463 bytes, line 41
41(e.flags|=32),Ede(t,e),eo(t,e,o,n),e.child;case 6:return t===null&&BB(e),null;case 13:return Pde(t,e,n);case 4:return HH(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=R_(e,null,r,n):eo(t,e,r,n),e.child;case 11:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:eu(r,s),aJ(t,e,r,s,n);case 7:return eo(t,e,e.pendingProps,n),e.child;case 8:return eo(t,e,e.pendingProps.children,n),e.child;case 12:return eo(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,s=e.pendingProps,i=e.memoizedProps,o=s.value,lr(aO,r._currentValue),r._currentValue=o,i!==null)if(Tu(i.value,o)){if(i.children===s.children&&!Ho.current){e=Xf(t,e,n);break e}}else for(i=e.child,i!==null&&(i.return=e);i!==null;){var l=i.dependencies;if(l!==null){o=i.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(i.tag===1){c=Ff(-1,n&-n),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|=n,c=i.alternate,c!==null&&(c.lanes|=n),UB(i.return,n,e),l.lanes|=n;break}c=c.next}}else if(i.tag===10)o=i.type===e.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(Le(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),UB(o,n,e),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===e){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}eo(t,e,s.children,n),e=e.child}return e;case 9:return s=e.type,r=e.pendingProps.children,Cw(e,n),s=Mc(s),r=r(s),e.flags|=1,eo(t,e,r,n),e.child;case 14:return r=e.type,s=eu(r,e.pendingProps),s=eu(r.type,s),oJ(t,e,r,s,n);case 15:return kde(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:eu(r,s),jM(t,e),e.tag=1,Wo(r)?(t=!0,rO(e)):t=!1,Cw(e,n),Sde(e,r,s),VB(e,r,s,n),KB(null,e,r,!0,t,n);case 19:return Mde(t,e,n);case 22:return Ade(t,e,n)}throw Error(Le(156,e.tag))};function Gde(t,e){return wue(t,e)}function dOe(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function _c(t,e,n,r){return new dOe(t,e,n,r)}function aW(t){return t=t.prototype,!(!t||!t.isReactComponent)}function hOe(t){if(typeof t=="function")return aW(t)?1:0;if(t!=null){if(t=t.$$typeof,t===NH)return 11;if(t===CH)return 14}return 2}function wg(t,e){var n=t.alternate;return n===null?(n=_c(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function CM(t,e,n,r,s,i){var o=2;if(r=t,typeof t=="function")aW(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case Yb:return Iy(n.children,s,i,e);case SH:o=8,s|=8;break;case pB:return t=_c(12,n,e,s|2),t.elementType=pB,t.lanes=i,t;case mB:return t=_c(13,n,e,s),t.elementType=mB,t.lanes=i,t;case gB:return t=_c(19,n,e,s),t.elementType=gB,t.lanes=i,t;case sue:return FL(n,s,i,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case nue:o=10;break e;case rue:o=9;break e;case NH:o=11;break e;case CH:o=14;break e;case qp:o=16,r=null;break e}throw Error(Le(130,t==null?t:typeof t,""))}return e=_c(o,n,e,s),e.elementType=t,e.type=r,e.lanes=i,e}function Iy(t,e,n,r){return t=_c(7,t,r,e),t.lanes=n,t}function FL(t,e,n,r){return t=_c(22,t,r,e),t.elementType=sue,t.lanes=n,t.stateNode={isHidden:!1},t}function u$(t,e,n){return t=_c(6,t,null,e),t.lanes=n,t}function d$(t,e,n){return e=_c(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function fOe(t,e,n,r,s){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=HF(0),this.expirationTimes=HF(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=HF(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function oW(t,e,n,r,s,i,o,l,c){return t=new fOe(t,e,n,l,c),e===1?(e=1,i===!0&&(e|=8)):e=0,i=_c(3,null,null,e),t.current=i,i.stateNode=t,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},VH(i),t}function pOe(t,e,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Gb,key:r==null?null:""+r,children:t,containerInfo:e,implementation:n}}function Yde(t){if(!t)return Rg;t=t._reactInternals;e:{if(E0(t)!==t||t.tag!==1)throw Error(Le(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(Wo(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(Le(171))}if(t.tag===1){var n=t.type;if(Wo(n))return Yue(t,n,e)}return e}function Xde(t,e,n,r,s,i,o,l,c){return t=oW(n,r,!0,t,s,i,o,l,c),t.context=Yde(null),n=t.current,r=lo(),s=bg(n),i=Ff(r,s),i.callback=e??null,xg(n,i,s),t.current.lanes=s,WE(t,s,r),Ko(t,r),t}function $L(t,e,n,r){var s=e.current,i=lo(),o=bg(s);return n=Yde(n),e.context===null?e.context=n:e.pendingContext=n,e=Ff(i,o),e.payload={element:t},r=r===void 0?null:r,r!==null&&(e.callback=r),t=xg(s,e,o),t!==null&&(ku(t,s,o,i),bM(t,s,o)),o}function gO(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function yJ(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function lW(t,e){yJ(t,e),(t=t.alternate)&&yJ(t,e)}function mOe(){return null}var Jde=typeof reportError=="function"?reportError:function(t){console.error(t)};function cW(t){this._internalRoot=t}zL.prototype.render=cW.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(Le(409));
vendor: 5,323 bytes, line 41
41$L(t,e,null,null)};zL.prototype.unmount=cW.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;Xy(function(){$L(null,t,null,null)}),e[Gf]=null}};function zL(t){this._internalRoot=t}zL.prototype.unstable_scheduleHydration=function(t){if(t){var e=Aue();t={blockedOn:null,target:t,priority:e};for(var n=0;n<Xp.length&&e!==0&&e<Xp[n].priority;n++);Xp.splice(n,0,t),n===0&&Tue(t)}};function uW(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function BL(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function bJ(){}function gOe(t,e,n,r,s){if(s){if(typeof r=="function"){var i=r;r=function(){var u=gO(o);i.call(u)}}var o=Xde(e,r,t,0,null,!1,!1,"",bJ);return t._reactRootContainer=o,t[Gf]=o.current,HC(t.nodeType===8?t.parentNode:t),Xy(),o}for(;s=t.lastChild;)t.removeChild(s);if(typeof r=="function"){var l=r;r=function(){var u=gO(c);l.call(u)}}var c=oW(t,0,!1,null,null,!1,!1,"",bJ);return t._reactRootContainer=c,t[Gf]=c.current,HC(t.nodeType===8?t.parentNode:t),Xy(function(){$L(e,c,n,r)}),c}function UL(t,e,n,r,s){var i=n._reactRootContainer;if(i){var o=i;if(typeof s=="function"){var l=s;s=function(){var c=gO(o);l.call(c)}}$L(e,o,t,s)}else o=gOe(n,e,t,s,r);return gO(o)}Cue=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var n=QS(e.pendingLanes);n!==0&&(EH(e,n|1),Ko(e,gs()),!(vn&6)&&(D_=gs()+500,Jg()))}break;case 13:Xy(function(){var r=Yf(t,1);if(r!==null){var s=lo();ku(r,t,1,s)}}),lW(t,1)}};TH=function(t){if(t.tag===13){var e=Yf(t,134217728);if(e!==null){var n=lo();ku(e,t,134217728,n)}lW(t,134217728)}};kue=function(t){if(t.tag===13){var e=bg(t),n=Yf(t,e);if(n!==null){var r=lo();ku(n,t,e,r)}lW(t,e)}};Aue=function(){return Ln};Eue=function(t,e){var n=Ln;try{return Ln=t,e()}finally{Ln=n}};CB=function(t,e,n){switch(e){case"input":if(yB(t,n),e=n.name,n.type==="radio"&&e!=null){for(n=t;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<n.length;e++){var r=n[e];if(r!==t&&r.form===t.form){var s=ML(r);if(!s)throw Error(Le(90));aue(r),yB(r,s)}}}break;case"textarea":lue(t,n);break;case"select":e=n.value,e!=null&&_w(t,!!n.multiple,e,!1)}};mue=rW;gue=Xy;var vOe={usingClientEntryPoint:!1,Events:[GE,Zb,ML,fue,pue,rW]},mS={findFiberByHostInstance:Jv,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},xOe={bundleType:mS.bundleType,version:mS.version,rendererPackageName:mS.rendererPackageName,rendererConfig:mS.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:up.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=yue(t),t===null?null:t.stateNode},findFiberByHostInstance:mS.findFiberByHostInstance||mOe,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 PT=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!PT.isDisabled&&PT.supportsFiber)try{AL=PT.inject(xOe),Xd=PT}catch{}}Ul.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=vOe;Ul.createPortal=function(t,e){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!uW(e))throw Error(Le(200));return pOe(t,e,null,n)};Ul.createRoot=function(t,e){if(!uW(t))throw Error(Le(299));var n=!1,r="",s=Jde;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(r=e.identifierPrefix),e.onRecoverableError!==void 0&&(s=e.onRecoverableError)),e=oW(t,1,!1,null,null,n,!1,r,s),t[Gf]=e.current,HC(t.nodeType===8?t.parentNode:t),new cW(e)};Ul.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(Le(188)):(t=Object.keys(t).join(","),Error(Le(268,t)));return t=yue(e),t=t===null?null:t.stateNode,t};Ul.flushSync=function(t){return Xy(t)};Ul.hydrate=function(t,e,n){if(!BL(e))throw Error(Le(200));return UL(null,t,e,!0,n)};Ul.hydrateRoot=function(t,e,n){if(!uW(t))throw Error(Le(405));var r=n!=null&&n.hydratedSources||null,s=!1,i="",o=Jde;if(n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),e=Xde(e,null,t,1,n??null,s,!1,i,o),t[Gf]=e.current,HC(t),r)for(t=0;t<r.length;t++)n=r[t],s=n._getVersion,s=s(n._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[n,s]:e.mutableSourceEagerHydrationData.push(n,s);return new zL(e)};Ul.render=function(t,e,n){if(!BL(e))throw Error(Le(200));return UL(null,t,e,!1,n)};Ul.unmountComponentAtNode=function(t){if(!BL(t))throw Error(Le(40));return t._reactRootContainer?(Xy(function(){UL(null,null,t,!1,function(){t._reactRootContainer=null,t[Gf]=null})}),!0):!1};Ul.unstable_batchedUpdates=rW;Ul.unstable_renderSubtreeIntoContainer=function(t,e,n,r){if(!BL(n))throw Error(Le(200));if(t==null||t._reactInternals===void 0)throw Error(Le(38));return UL(t,e,n,!1,r)};Ul.version="18.3.1-next-f1338f8080-20240426";
41function Qde(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Qde)}catch(t){console.error(t)}}Qde(),Qce.exports=Ul;var Lc=Qce.exports;const dW=cp(Lc);var hW,wJ=Lc;hW=wJ.createRoot,wJ.hydrateRoot;var yOe=typeof Element<"u",bOe=typeof Map=="function",wOe=typeof Set=="function",_Oe=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function kM(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(t.constructor!==e.constructor)return!1;var n,r,s;if(Array.isArray(t)){if(n=t.length,n!=e.length)return!1;for(r=n;r--!==0;)if(!kM(t[r],e[r]))return!1;return!0}var i;if(bOe&&t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(i=t.entries();!(r=i.next()).done;)if(!e.has(r.value[0]))return!1;for(i=t.entries();!(r=i.next()).done;)if(!kM(r.value[1],e.get(r.value[0])))return!1;return!0}if(wOe&&t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(i=t.entries();!(r=i.next()).done;)if(!e.has(r.value[0]))return!1;return!0}if(_Oe&&ArrayBuffer.isView(t)&&ArrayBuffer.isView(e)){if(n=t.length,n!=e.length)return!1;for(r=n;r--!==0;)if(t[r]!==e[r])return!1;return!0}if(t.constructor===RegExp)return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf&&typeof t.valueOf=="function"&&typeof e.valueOf=="function")return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString&&typeof t.toString=="function"&&typeof e.toString=="function")return t.toString()===e.toString();if(s=Object.keys(t),n=s.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(e,s[r]))return!1;if(yOe&&t instanceof Element)return!1;for(r=n;r--!==0;)if(!((s[r]==="_owner"||s[r]==="__v"||s[r]==="__o")&&t.$$typeof)&&!kM(t[s[r]],e[s[r]]))return!1;return!0}return t!==t&&e!==e}var jOe=function(e,n){try{return kM(e,n)}catch(r){if((r.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw r}};const SOe=cp(jOe);var NOe=function(t,e,n,r,s,i,o,l){if(!t){var c;if(e===void 0)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var u=[n,r,s,i,o,l],d=0;c=new Error(e.replace(/%s/g,function(){return u[d++]})),c.name="Invariant Violation"}throw c.framesToPop=1,c}},COe=NOe;const _J=cp(COe);var kOe=function(e,n,r,s){var i=r?r.call(s,e,n):void 0;if(i!==void 0)return!!i;if(e===n)return!0;if(typeof e!="object"||!e||typeof n!="object"||!n)return!1;var o=Object.keys(e),l=Object.keys(n);if(o.length!==l.length)return!1;for(var c=Object.prototype.hasOwnProperty.bind(n),u=0;u<o.length;u++){var d=o[u];if(!c(d))return!1;var h=e[d],f=n[d];if(i=r?r.call(s,h,f,d):void 0,i===!1||i===void 0&&h!==f)return!1}return!0};const AOe=cp(kOe);var Zde=(t=>(t.BASE="base",t.BODY="body",t.HEAD="head",t.HTML="html",t.LINK="link",t.META="meta",t.NOSCRIPT="noscript",t.SCRIPT="script",t.STYLE="style",t.TITLE="title",t.FRAGMENT="Symbol(react.fragment)",t))(Zde||{}),h$={link:{rel:["amphtml","canonical","alternate"]},script:{type:["application/ld+json"]},meta:{charset:"",name:["generator","robots","description"],property:["og:type","og:title","og:url","og:image","og:image:alt","og:description","twitter:url","twitter:title","twitter:description","twitter:image","twitter:image:alt","twitter:card","twitter:site"]}},jJ=Object.values(Zde),qL={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},ehe=Object.entries(qL).reduce((t,[e,n])=>(t[n]=e,t),{}),Su="data-rh",Aw={DEFAULT_TITLE:"defaultTitle",DEFER:"defer",ENCODE_SPECIAL_CHARACTERS:"encodeSpecialCharacters",ON_CHANGE_CLIENT_STATE:"onChangeClientState",TITLE_TEMPLATE:"titleTemplate",PRIORITIZE_SEO_TAGS:"prioritizeSeoTags"},Ew=(t,e)=>{for(let n=t.length-1;n>=0;n-=1){const r=t[n];if(Object.prototype.hasOwnProperty.call(r,e))return r[e]}return null},EOe=t=>{let e=Ew(t,"title");const n=Ew(t,Aw.TITLE_TEMPLATE);if(Array.isArray(e)&&(e=e.join("")),n&&e)return n.replace(/%s/g,()=>e);const r=Ew(t,Aw.DEFAULT_TITLE);return e||r||void 0},TOe=t=>Ew(t,Aw.ON_CHANGE_CLIENT_STATE)||(()=>{}),f$=(t,e)=>e.filter(n=>typeof n[t]<"u").map(n=>n[t]).reduce((n,r)=>({...n,...r}),{}),POe=(t,e)=>e.filter(n=>typeof n.base<"u").map(n=>n.base).reverse().reduce((n,r)=>{if(!n.length){const s=Object.keys(r);for(let i=0;i<s.length;i+=1){const l=s[i].toLowerCase();if(t.indexOf(l)!==-1&&r[l])return n.concat(r)}}return n},[]),MOe=t=>console&&typeof console.warn=="function"&&console.warn(t),gS=(t,e,n)=>{const r={};return n.filter(s=>Array.isArray(s[t])?!0:(typeof s[t]<"u"&&MOe(`Helmet: ${t} should be of type "Array". Instead found type "${typeof s[t]}"`),!1)).map(s=>s[t]).reverse().reduce((s,i)=>{const o={};i.filter(c=>{let u;const d=Object.keys(c);for(let f=0;f<d.length;f+=1){const p=d[f],m=p.toLowerCase();e.indexOf(m)!==-1&&!(u==="rel"&&c[u].toLowerCase()==="canonical")&&!(m==="rel"&&c[m].toLowerCase()==="stylesheet")&&(u=m),e.indexOf(p)!==-1&&(p==="innerHTML"||p==="cssText"||p==="itemprop")&&(u=p)}if(!u||!c[u])return!1;const h=c[u].toLowerCase();return r[u]||(r[u]={}),o[u]||(o[u]={}),r[u][h]?!1:(o[u][h]=!0,!0)}
41).reverse().forEach(c=>s.push(c));const l=Object.keys(o);for(let c=0;c<l.length;c+=1){const u=l[c],d={...r[u],...o[u]};r[u]=d}return s},[]).reverse()},ROe=(t,e)=>{if(Array.isArray(t)&&t.length){for(let n=0;n<t.length;n+=1)if(t[n][e])return!0}return!1},OOe=t=>({baseTag:POe(["href"],t),bodyAttributes:f$("bodyAttributes",t),defer:Ew(t,Aw.DEFER),encode:Ew(t,Aw.ENCODE_SPECIAL_CHARACTERS),htmlAttributes:f$("htmlAttributes",t),linkTags:gS("link",["rel","href"],t),metaTags:gS("meta",["name","charset","http-equiv","property","itemprop"],t),noscriptTags:gS("noscript",["innerHTML"],t),onChangeClientState:TOe(t),scriptTags:gS("script",["src","innerHTML"],t),styleTags:gS("style",["cssText"],t),title:EOe(t),titleAttributes:f$("titleAttributes",t),prioritizeSeoTags:ROe(t,Aw.PRIORITIZE_SEO_TAGS)}),the=t=>Array.isArray(t)?t.join(""):t,IOe=(t,e)=>{const n=Object.keys(t);for(let r=0;r<n.length;r+=1)if(e[n[r]]&&e[n[r]].includes(t[n[r]]))return!0;return!1},p$=(t,e)=>Array.isArray(t)?t.reduce((n,r)=>(IOe(r,e)?n.priority.push(r):n.default.push(r),n),{priority:[],default:[]}):{default:t,priority:[]},SJ=(t,e)=>({...t,[e]:void 0}),DOe=["noscript","script","style"],i6=(t,e=!0)=>e===!1?String(t):String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),nhe=t=>Object.keys(t).reduce((e,n)=>{const r=typeof t[n]<"u"?`${n}="${t[n]}"`:`${n}`;return e?`${e} ${r}`:r},""),LOe=(t,e,n,r)=>{const s=nhe(n),i=the(e);return s?`<${t} ${Su}="true" ${s}>${i6(i,r)}</${t}>`:`<${t} ${Su}="true">${i6(i,r)}</${t}>`},FOe=(t,e,n=!0)=>e.reduce((r,s)=>{const i=s,o=Object.keys(i).filter(u=>!(u==="innerHTML"||u==="cssText")).reduce((u,d)=>{const h=typeof i[d]>"u"?d:`${d}="${i6(i[d],n)}"`;return u?`${u} ${h}`:h},""),l=i.innerHTML||i.cssText||"",c=DOe.indexOf(t)===-1;return`${r}<${t} ${Su}="true" ${o}${c?"/>":`>${l}</${t}>`}`},""),rhe=(t,e={})=>Object.keys(t).reduce((n,r)=>{const s=qL[r];return n[s||r]=t[r],n},e),$Oe=(t,e,n)=>{const r={key:e,[Su]:!0},s=rhe(n,r);return[ve.createElement("title",s,e)]},AM=(t,e)=>e.map((n,r)=>{const s={key:r,[Su]:!0};return Object.keys(n).forEach(i=>{const l=qL[i]||i;if(l==="innerHTML"||l==="cssText"){const c=n.innerHTML||n.cssText;s.dangerouslySetInnerHTML={__html:c}}else s[l]=n[i]}),ve.createElement(t,s)}),nc=(t,e,n=!0)=>{switch(t){case"title":return{toComponent:()=>$Oe(t,e.title,e.titleAttributes),toString:()=>LOe(t,e.title,e.titleAttributes,n)};case"bodyAttributes":case"htmlAttributes":return{toComponent:()=>rhe(e),toString:()=>nhe(e)};default:return{toComponent:()=>AM(t,e),toString:()=>FOe(t,e,n)}}},zOe=({metaTags:t,linkTags:e,scriptTags:n,encode:r})=>{const s=p$(t,h$.meta),i=p$(e,h$.link),o=p$(n,h$.script);return{priorityMethods:{toComponent:()=>[...AM("meta",s.priority),...AM("link",i.priority),...AM("script",o.priority)],toString:()=>`${nc("meta",s.priority,r)} ${nc("link",i.priority,r)} ${nc("script",o.priority,r)}`},metaTags:s.default,linkTags:i.default,scriptTags:o.default}},BOe=t=>{const{baseTag:e,bodyAttributes:n,encode:r=!0,htmlAttributes:s,noscriptTags:i,styleTags:o,title:l="",titleAttributes:c,prioritizeSeoTags:u}=t;let{linkTags:d,metaTags:h,scriptTags:f}=t,p={toComponent:()=>[],toString:()=>""};return u&&({priorityMethods:p,linkTags:d,metaTags:h,scriptTags:f}=zOe(t)),{priority:p,base:nc("base",e,r),bodyAttributes:nc("bodyAttributes",n,r),htmlAttributes:nc("htmlAttributes",s,r),link:nc("link",d,r),meta:nc("meta",h,r),noscript:nc("noscript",i,r),script:nc("script",f,r),style:nc("style",o,r),title:nc("title",{title:l,titleAttributes:c},r)}},a6=BOe,MT=[],fW=!!(typeof window<"u"&&window.document&&window.document.createElement),o6=class{constructor(t,e){Te(this,"instances",[]);Te(this,"canUseDOM",fW);Te(this,"context");Te(this,"value",{setHelmet:t=>{this.context.helmet=t},helmetInstances:{get:()=>this.canUseDOM?MT:this.instances,add:t=>{(this.canUseDOM?MT:this.instances).push(t)},remove:t=>{const e=(this.canUseDOM?MT:this.instances).indexOf(t);(this.canUseDOM?MT:this.instances).splice(e,1)}}});this.context=t,this.canUseDOM=e||!1,e||(t.helmet=a6({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}},UOe=parseInt(ve.version.split(".")[0],10),l6=UOe>=19,qOe={},she=ve.createContext(qOe),hx,ihe=(hx=class extends b.Component{constructor(n){super(n);Te(this,"helmetData");l6?this.helmetData=null:this.helmetData=new o6(this.props.context||{},hx.canUseDOM)}render(){return l6?ve.createElement(ve.Fragment,null,this.props.children):ve.createElement(she.Provider,{value:this.helmetData.value},this.props.children)}},Te(hx,"canUseDOM",fW),hx),J0=(t,e)=>{const n=document.head||document.querySelector("head"),r=n.querySelectorAll(`${t}[${Su}]`),s=[].slice.call(r),i=[];let o;return e&&e.length&&e.forEach(l=>{const c=document.createElement(t);for(const u in l)if(Object.prototype.hasOwnProperty.call(l,u))if(u==="innerHTML")c.innerHTML=l.innerHTML;else if(u==="cssText"){const d=l.cssText;
41c.appendChild(document.createTextNode(d))}else{const d=u,h=typeof l[d]>"u"?"":l[d];c.setAttribute(u,h)}c.setAttribute(Su,"true"),s.some((u,d)=>(o=d,c.isEqualNode(u)))?s.splice(o,1):i.push(c)}),s.forEach(l=>{var c;return(c=l.parentNode)==null?void 0:c.removeChild(l)}),i.forEach(l=>n.appendChild(l)),{oldTags:s,newTags:i}},c6=(t,e)=>{const n=document.getElementsByTagName(t)[0];if(!n)return;const r=n.getAttribute(Su),s=r?r.split(","):[],i=[...s],o=Object.keys(e);for(const l of o){const c=e[l]||"";n.getAttribute(l)!==c&&n.setAttribute(l,c),s.indexOf(l)===-1&&s.push(l);const u=i.indexOf(l);u!==-1&&i.splice(u,1)}for(let l=i.length-1;l>=0;l-=1)n.removeAttribute(i[l]);s.length===i.length?n.removeAttribute(Su):n.getAttribute(Su)!==o.join(",")&&n.setAttribute(Su,o.join(","))},VOe=(t,e)=>{typeof t<"u"&&document.title!==t&&(document.title=the(t)),c6("title",e)},NJ=(t,e)=>{const{baseTag:n,bodyAttributes:r,htmlAttributes:s,linkTags:i,metaTags:o,noscriptTags:l,onChangeClientState:c,scriptTags:u,styleTags:d,title:h,titleAttributes:f}=t;c6("body",r),c6("html",s),VOe(h,f);const p={baseTag:J0("base",n),linkTags:J0("link",i),metaTags:J0("meta",o),noscriptTags:J0("noscript",l),scriptTags:J0("script",u),styleTags:J0("style",d)},m={},v={};Object.keys(p).forEach(x=>{const{newTags:g,oldTags:w}=p[x];g.length&&(m[x]=g),w.length&&(v[x]=p[x].oldTags)}),e&&e(),c(t,m,v)},vS=null,HOe=t=>{vS&&cancelAnimationFrame(vS),t.defer?vS=requestAnimationFrame(()=>{NJ(t,()=>{vS=null})}):(NJ(t),vS=null)},WOe=HOe,CJ=class extends b.Component{constructor(){super(...arguments);Te(this,"rendered",!1)}shouldComponentUpdate(e){return!AOe(e,this.props)}componentDidUpdate(){this.emitChange()}componentWillUnmount(){const{helmetInstances:e}=this.props.context;e.remove(this),this.emitChange()}emitChange(){const{helmetInstances:e,setHelmet:n}=this.props.context;let r=null;const s=OOe(e.get().map(i=>{const{context:o,...l}=i.props;return l}));ihe.canUseDOM?WOe(s):a6&&(r=a6(s)),n(r)}init(){if(this.rendered)return;this.rendered=!0;const{helmetInstances:e}=this.props.context;e.add(this),this.emitChange()}render(){return this.init(),null}},EM=[],kJ=t=>{const e={};for(const n of Object.keys(t))e[ehe[n]||n]=t[n];return e},mv=t=>{const e={};for(const n of Object.keys(t)){const r=qL[n];e[r||n]=t[n]}return e},AJ=(t,e)=>{if(!fW)return;const n=document.getElementsByTagName(t)[0];if(!n)return;const r="data-rh-managed",s=n.getAttribute(r),i=s?s.split(","):[],o=Object.keys(e);for(const l of i)o.includes(l)||n.removeAttribute(l);for(const l of o){const c=e[l];c==null||c===!1?n.removeAttribute(l):c===!0?n.setAttribute(l,""):n.setAttribute(l,String(c))}o.length>0?n.setAttribute(r,o.join(",")):n.removeAttribute(r)},m$=()=>{const t={},e={};for(const n of EM){const{htmlAttributes:r,bodyAttributes:s}=n.props;r&&Object.assign(t,kJ(r)),s&&Object.assign(e,kJ(s))}AJ("html",t),AJ("body",e)},KOe=class extends b.Component{componentDidMount(){EM.push(this),m$()}componentDidUpdate(){m$()}componentWillUnmount(){const t=EM.indexOf(this);t!==-1&&EM.splice(t,1),m$()}resolveTitle(){const{title:t,titleTemplate:e,defaultTitle:n}=this.props;return t&&e?e.replace(/%s/g,()=>Array.isArray(t)?t.join(""):t):t||n||void 0}renderTitle(){const t=this.resolveTitle();if(t===void 0)return null;const e=this.props.titleAttributes||{};return ve.createElement("title",mv(e),t)}renderBase(){const{base:t}=this.props;return t?ve.createElement("base",mv(t)):null}renderMeta(){const{meta:t}=this.props;return!t||!Array.isArray(t)?null:t.map((e,n)=>ve.createElement("meta",{key:n,...mv(e)}))}renderLink(){const{link:t}=this.props;return!t||!Array.isArray(t)?null:t.map((e,n)=>ve.createElement("link",{key:n,...mv(e)}))}renderScript(){const{script:t}=this.props;return!t||!Array.isArray(t)?null:t.map((e,n)=>{const{innerHTML:r,...s}=e,i=mv(s);return r&&(i.dangerouslySetInnerHTML={__html:r}),ve.createElement("script",{key:n,...i})})}renderStyle(){const{style:t}=this.props;return!t||!Array.isArray(t)?null:t.map((e,n)=>{const{cssText:r,...s}=e,i=mv(s);return r&&(i.dangerouslySetInnerHTML={__html:r}),ve.createElement("style",{key:n,...i})})}renderNoscript(){const{noscript:t}=this.props;return!t||!Array.isArray(t)?null:t.map((e,n)=>{const{innerHTML:r,...s}=e,i=mv(s);return r&&(i.dangerouslySetInnerHTML={__html:r}),ve.createElement("noscript",{key:n,...i})})}render(){return ve.createElement(ve.Fragment,null,this.renderTitle(),this.renderBase(),this.renderMeta(),this.renderLink(),this.renderScript(),this.renderStyle(),this.renderNoscript())}},hB,XE=(hB=class extends b.Component{shouldComponentUpdate(t){return!SOe(SJ(this.props,"helmetData"),SJ(t,"helmetData"))}mapNestedChildrenToProps(t,e){if(!e)return null;switch(t.type){case"script":case"noscript":return{innerHTML:e};case"style":return{cssText:e};default:throw new Error(`<${t.type} /> elements are self-closing and can not contain children. Refer to our API for more information.`)}}flattenArrayTypeChildren(t,e,n,r){return{...e,[t.type]:[...e[t.type]||[],{...n,...this.mapNestedChildrenToProps(t,r)}]}}mapObjectTypeChildren(t,e,n,r){switch(t.type){case"title":return{...e,[t.type]:r,titleAttributes:{...n}};case"body":return{...e,bodyAttributes:{...n}};case"html":return{...e,htmlAttributes:{...n}};default:return{...e,[t.type]:{...n}}}}mapArrayTypeChildrenToProps(t,e){let n={...e};return Object.keys(t).forEach(r=>{n={...n,[r]:t[r]}}),n}
41warnOnInvalidChildren(t,e){return _J(jJ.some(n=>t.type===n),typeof t.type=="function"?"You may be attempting to nest <Helmet> components within each other, which is not allowed. Refer to our API for more information.":`Only elements types ${jJ.join(", ")} are allowed. Helmet does not support rendering <${t.type}> elements. Refer to our API for more information.`),_J(!e||typeof e=="string"||Array.isArray(e)&&!e.some(n=>typeof n!="string"),`Helmet expects a string as a child of <${t.type}>. Did you forget to wrap your children in braces? ( <${t.type}>{\`\`}</${t.type}> ) Refer to our API for more information.`),!0}mapChildrenToProps(t,e){let n={};return ve.Children.forEach(t,r=>{if(!r||!r.props)return;const{children:s,...i}=r.props,o=Object.keys(i).reduce((c,u)=>(c[ehe[u]||u]=i[u],c),{});let{type:l}=r;switch(typeof l=="symbol"?l=l.toString():this.warnOnInvalidChildren(r,s),l){case"Symbol(react.fragment)":e=this.mapChildrenToProps(s,e);break;case"link":case"meta":case"noscript":case"script":case"style":n=this.flattenArrayTypeChildren(r,n,o,s);break;default:e=this.mapObjectTypeChildren(r,e,o,s);break}}),this.mapArrayTypeChildrenToProps(n,e)}render(){const{children:t,...e}=this.props;let n={...e},{helmetData:r}=e;if(t&&(n=this.mapChildrenToProps(t,n)),r&&!(r instanceof o6)){const s=r;r=new o6(s.context,!0),delete n.helmetData}return l6?ve.createElement(KOe,{...n}):r?ve.createElement(CJ,{...n,context:r.value}):ve.createElement(she.Consumer,null,s=>ve.createElement(CJ,{...n,context:s}))}},Te(hB,"defaultProps",{defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1}),hB),_j=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Jy=typeof window>"u"||"Deno"in globalThis;function to(){}function GOe(t,e){return typeof t=="function"?t(e):t}function u6(t){return typeof t=="number"&&t>=0&&t!==1/0}function ahe(t,e){return Math.max(t+(e||0)-Date.now(),0)}function _g(t,e){return typeof t=="function"?t(e):t}function mc(t,e){return typeof t=="function"?t(e):t}function EJ(t,e){const{type:n="all",exact:r,fetchStatus:s,predicate:i,queryKey:o,stale:l}=t;if(o){if(r){if(e.queryHash!==pW(o,e.options))return!1}else if(!ek(e.queryKey,o))return!1}if(n!=="all"){const c=e.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof l=="boolean"&&e.isStale()!==l||s&&s!==e.state.fetchStatus||i&&!i(e))}function TJ(t,e){const{exact:n,status:r,predicate:s,mutationKey:i}=t;if(i){if(!e.options.mutationKey)return!1;if(n){if(Qy(e.options.mutationKey)!==Qy(i))return!1}else if(!ek(e.options.mutationKey,i))return!1}return!(r&&e.state.status!==r||s&&!s(e))}function pW(t,e){return((e==null?void 0:e.queryKeyHashFn)||Qy)(t)}function Qy(t){return JSON.stringify(t,(e,n)=>d6(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function ek(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>ek(t[n],e[n])):!1}function ohe(t,e){if(t===e)return t;const n=PJ(t)&&PJ(e);if(n||d6(t)&&d6(e)){const r=n?t:Object.keys(t),s=r.length,i=n?e:Object.keys(e),o=i.length,l=n?[]:{},c=new Set(r);let u=0;for(let d=0;d<o;d++){const h=n?d:i[d];(!n&&c.has(h)||n)&&t[h]===void 0&&e[h]===void 0?(l[h]=void 0,u++):(l[h]=ohe(t[h],e[h]),l[h]===t[h]&&t[h]!==void 0&&u++)}return s===o&&u===s?t:l}return e}function vO(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(const n in t)if(t[n]!==e[n])return!1;return!0}function PJ(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function d6(t){if(!MJ(t))return!1;const e=t.constructor;if(e===void 0)return!0;const n=e.prototype;return!(!MJ(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function MJ(t){return Object.prototype.toString.call(t)==="[object Object]"}function YOe(t){return new Promise(e=>{setTimeout(e,t)})}function h6(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?ohe(t,e):e}function XOe(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function JOe(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var mW=Symbol();function lhe(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===mW?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function che(t,e){return typeof t=="function"?t(...e):!!t}var fx,sm,Ww,Ace,QOe=(Ace=class extends _j{constructor(){super();q(this,fx);q(this,sm);q(this,Ww);$(this,Ww,e=>{if(!Jy&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){y(this,sm)||this.setEventListener(y(this,Ww))}onUnsubscribe(){var e;this.hasListeners()||((e=y(this,sm))==null||e.call(this),$(this,sm,void 0))}setEventListener(e){var n;$(this,Ww,e),(n=y(this,sm))==null||n.call(this),$(this,sm,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){y(this,fx)!==e&&($(this,fx,e),this.onFocus())}onFocus(){const e=this.isFocused();
vendor: 14,127 bytes, line 41
41this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof y(this,fx)=="boolean"?y(this,fx):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},fx=new WeakMap,sm=new WeakMap,Ww=new WeakMap,Ace),gW=new QOe,Kw,im,Gw,Ece,ZOe=(Ece=class extends _j{constructor(){super();q(this,Kw,!0);q(this,im);q(this,Gw);$(this,Gw,e=>{if(!Jy&&window.addEventListener){const n=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){y(this,im)||this.setEventListener(y(this,Gw))}onUnsubscribe(){var e;this.hasListeners()||((e=y(this,im))==null||e.call(this),$(this,im,void 0))}setEventListener(e){var n;$(this,Gw,e),(n=y(this,im))==null||n.call(this),$(this,im,e(this.setOnline.bind(this)))}setOnline(e){y(this,Kw)!==e&&($(this,Kw,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return y(this,Kw)}},Kw=new WeakMap,im=new WeakMap,Gw=new WeakMap,Ece),xO=new ZOe;function f6(){let t,e;const n=new Promise((s,i)=>{t=s,e=i});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),t(s)},n.reject=s=>{r({status:"rejected",reason:s}),e(s)},n}function eIe(t){return Math.min(1e3*2**t,3e4)}function uhe(t){return(t??"online")==="online"?xO.isOnline():!0}var dhe=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function g$(t){return t instanceof dhe}function hhe(t){let e=!1,n=0,r=!1,s;const i=f6(),o=v=>{var x;r||(f(new dhe(v)),(x=t.abort)==null||x.call(t))},l=()=>{e=!0},c=()=>{e=!1},u=()=>gW.isFocused()&&(t.networkMode==="always"||xO.isOnline())&&t.canRun(),d=()=>uhe(t.networkMode)&&t.canRun(),h=v=>{var x;r||(r=!0,(x=t.onSuccess)==null||x.call(t,v),s==null||s(),i.resolve(v))},f=v=>{var x;r||(r=!0,(x=t.onError)==null||x.call(t,v),s==null||s(),i.reject(v))},p=()=>new Promise(v=>{var x;s=g=>{(r||u())&&v(g)},(x=t.onPause)==null||x.call(t)}).then(()=>{var v;s=void 0,r||(v=t.onContinue)==null||v.call(t)}),m=()=>{if(r)return;let v;const x=n===0?t.initialPromise:void 0;try{v=x??t.fn()}catch(g){v=Promise.reject(g)}Promise.resolve(v).then(h).catch(g=>{var S;if(r)return;const w=t.retry??(Jy?0:3),_=t.retryDelay??eIe,j=typeof _=="function"?_(n,g):_,N=w===!0||typeof w=="number"&&n<w||typeof w=="function"&&w(n,g);if(e||!N){f(g);return}n++,(S=t.onFail)==null||S.call(t,n,g),YOe(j).then(()=>u()?void 0:p()).then(()=>{e?f(g):m()})})};return{promise:i,cancel:o,continue:()=>(s==null||s(),i),cancelRetry:l,continueRetry:c,canStart:d,start:()=>(d()?m():p().then(m),i)}}var tIe=t=>setTimeout(t,0);function nIe(){let t=[],e=0,n=l=>{l()},r=l=>{l()},s=tIe;const i=l=>{e?t.push(l):s(()=>{n(l)})},o=()=>{const l=t;t=[],l.length&&s(()=>{r(()=>{l.forEach(c=>{n(c)})})})};return{batch:l=>{let c;e++;try{c=l()}finally{e--,e||o()}return c},batchCalls:l=>(...c)=>{i(()=>{l(...c)})},schedule:i,setNotifyFunction:l=>{n=l},setBatchNotifyFunction:l=>{r=l},setScheduler:l=>{s=l}}}var Vs=nIe(),px,Tce,fhe=(Tce=class{constructor(){q(this,px)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),u6(this.gcTime)&&$(this,px,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Jy?1/0:5*60*1e3))}clearGcTimeout(){y(this,px)&&(clearTimeout(y(this,px)),$(this,px,void 0))}},px=new WeakMap,Tce),Yw,mx,rc,gx,la,oA,vx,ru,Ih,Pce,rIe=(Pce=class extends fhe{constructor(e){super();q(this,ru);q(this,Yw);q(this,mx);q(this,rc);q(this,gx);q(this,la);q(this,oA);q(this,vx);$(this,vx,!1),$(this,oA,e.defaultOptions),this.setOptions(e.options),this.observers=[],$(this,gx,e.client),$(this,rc,y(this,gx).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,$(this,Yw,sIe(this.options)),this.state=e.state??y(this,Yw),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=y(this,la))==null?void 0:e.promise}setOptions(e){this.options={...y(this,oA),...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&y(this,rc).remove(this)}setData(e,n){const r=h6(this.state.data,e,this.options);return V(this,ru,Ih).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(e,n){V(this,ru,Ih).call(this,{type:"setState",state:e,setStateOptions:n})}cancel(e){var r,s;const n=(r=y(this,la))==null?void 0:r.promise;return(s=y(this,la))==null||s.cancel(e),n?n.then(to).catch(to):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(y(this,Yw))}isActive(){return this.observers.some(e=>mc(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===mW||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>_g(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!ahe(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=y(this,la))==null||n.continue()}onOnline(){var n;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=y(this,la))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),y(this,rc).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(y(this,la)&&(y(this,vx)?y(this,la).cancel({revert:!0}):y(this,la).cancelRetry()),this.scheduleGc()),y(this,rc).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||V(this,ru,Ih).call(this,{type:"invalidate"})}fetch(e,n){var u,d,h;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(y(this,la))return y(this,la).continueRetry(),y(this,la).promise}if(e&&this.setOptions(e),!this.options.queryFn){const f=this.observers.find(p=>p.options.queryFn);f&&this.setOptions(f.options)}const r=new AbortController,s=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>($(this,vx,!0),r.signal)})},i=()=>{const f=lhe(this.options,n),m=(()=>{const v={client:y(this,gx),queryKey:this.queryKey,meta:this.meta};return s(v),v})();return $(this,vx,!1),this.options.persister?this.options.persister(f,m,this):f(m)},l=(()=>{const f={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:y(this,gx),state:this.state,fetchFn:i};return s(f),f})();(u=this.options.behavior)==null||u.onFetch(l,this),$(this,mx,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=l.fetchOptions)==null?void 0:d.meta))&&V(this,ru,Ih).call(this,{type:"fetch",meta:(h=l.fetchOptions)==null?void 0:h.meta});const c=f=>{var p,m,v,x;g$(f)&&f.silent||V(this,ru,Ih).call(this,{type:"error",error:f}),g$(f)||((m=(p=y(this,rc).config).onError)==null||m.call(p,f,this),(x=(v=y(this,rc).config).onSettled)==null||x.call(v,this.state.data,f,this)),this.scheduleGc()};return $(this,la,hhe({initialPromise:n==null?void 0:n.initialPromise,fn:l.fetchFn,abort:r.abort.bind(r),onSuccess:f=>{var p,m,v,x;if(f===void 0){c(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(f)}catch(g){c(g);return}(m=(p=y(this,rc).config).onSuccess)==null||m.call(p,f,this),(x=(v=y(this,rc).config).onSettled)==null||x.call(v,f,this.state.error,this),this.scheduleGc()},onError:c,onFail:(f,p)=>{V(this,ru,Ih).call(this,{type:"failed",failureCount:f,error:p})},onPause:()=>{V(this,ru,Ih).call(this,{type:"pause"})},onContinue:()=>{V(this,ru,Ih).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0})),y(this,la).start()}},Yw=new WeakMap,mx=new WeakMap,rc=new WeakMap,gx=new WeakMap,la=new WeakMap,oA=new WeakMap,vx=new WeakMap,ru=new WeakSet,Ih=function(e){const n=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...phe(r.data,this.options),fetchMeta:e.meta??null};case"success":return $(this,mx,void 0),{...r,data:e.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const s=e.error;return g$(s)&&s.revert&&y(this,mx)?{...y(this,mx),fetchStatus:"idle"}:{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=n(this.state),Vs.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),y(this,rc).notify({query:this,type:"updated",action:e})})},Pce);function phe(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:uhe(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function sIe(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=e!==void 0,r=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var ud,Mce,iIe=(Mce=class extends _j{constructor(e={}){super();q(this,ud);this.config=e,$(this,ud,new Map)}build(e,n,r){const s=n.queryKey,i=n.queryHash??pW(s,n);let o=this.get(i);return o||(o=new rIe({client:e,queryKey:s,queryHash:i,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(s)}),this.add(o)),o}add(e){y(this,ud).has(e.queryHash)||(y(this,ud).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=y(this,ud).get(e.queryHash);n&&(e.destroy(),n===e&&y(this,ud).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Vs.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return y(this,ud).get(e)}getAll(){return[...y(this,ud).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(r=>EJ(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>EJ(e,r)):n}notify(e){Vs.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){Vs.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Vs.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},ud=new WeakMap,Mce),dd,Ga,xx,hd,Ip,Rce,aIe=(Rce=class extends fhe{constructor(e){super();q(this,hd);q(this,dd);q(this,Ga);q(this,xx);this.mutationId=e.mutationId,$(this,Ga,e.mutationCache),$(this,dd,[]),this.state=e.state||mhe(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){y(this,dd).includes(e)||(y(this,dd).push(e),this.clearGcTimeout(),y(this,Ga).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){$(this,dd,y(this,dd).filter(n=>n!==e)),this.scheduleGc(),y(this,Ga).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){y(this,dd).length||(this.state.status==="pending"?this.scheduleGc():y(this,Ga).remove(this))}continue(){var e;return((e=y(this,xx))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var i,o,l,c,u,d,h,f,p,m,v,x,g,w,_,j,N,S,C,k;const n=()=>{V(this,hd,Ip).call(this,{type:"continue"})};$(this,xx,hhe({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(E,P)=>{V(this,hd,Ip).call(this,{type:"failed",failureCount:E,error:P})},onPause:()=>{V(this,hd,Ip).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>y(this,Ga).canRun(this)}));const r=this.state.status==="pending",s=!y(this,xx).canStart();try{if(r)n();else{V(this,hd,Ip).call(this,{type:"pending",variables:e,isPaused:s}),await((o=(i=y(this,Ga).config).onMutate)==null?void 0:o.call(i,e,this));const P=await((c=(l=this.options).onMutate)==null?void 0:c.call(l,e));P!==this.state.context&&V(this,hd,Ip).call(this,{type:"pending",context:P,variables:e,isPaused:s})}const E=await y(this,xx).start();return await((d=(u=y(this,Ga).config).onSuccess)==null?void 0:d.call(u,E,e,this.state.context,this)),await((f=(h=this.options).onSuccess)==null?void 0:f.call(h,E,e,this.state.context)),await((m=(p=y(this,Ga).config).onSettled)==null?void 0:m.call(p,E,null,this.state.variables,this.state.context,this)),await((x=(v=this.options).onSettled)==null?void 0:x.call(v,E,null,e,this.state.context)),V(this,hd,Ip).call(this,{type:"success",data:E}),E}catch(E){try{throw await((w=(g=y(this,Ga).config).onError)==null?void 0:w.call(g,E,e,this.state.context,this)),await((j=(_=this.options).onError)==null?void 0:j.call(_,E,e,this.state.context)),await((S=(N=y(this,Ga).config).onSettled)==null?void 0:S.call(N,void 0,E,this.state.variables,this.state.context,this)),await((k=(C=this.options).onSettled)==null?void 0:k.call(C,void 0,E,e,this.state.context)),E}finally{V(this,hd,Ip).call(this,{type:"error",error:E})}}finally{y(this,Ga).runNext(this)}}},dd=new WeakMap,Ga=new WeakMap,xx=new WeakMap,hd=new WeakSet,Ip=function(e){const n=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};
41case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Vs.batch(()=>{y(this,dd).forEach(r=>{r.onMutationUpdate(e)}),y(this,Ga).notify({mutation:this,type:"updated",action:e})})},Rce);function mhe(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Yh,su,lA,Oce,oIe=(Oce=class extends _j{constructor(e={}){super();q(this,Yh);q(this,su);q(this,lA);this.config=e,$(this,Yh,new Set),$(this,su,new Map),$(this,lA,0)}build(e,n,r){const s=new aIe({mutationCache:this,mutationId:++Vr(this,lA)._,options:e.defaultMutationOptions(n),state:r});return this.add(s),s}add(e){y(this,Yh).add(e);const n=RT(e);if(typeof n=="string"){const r=y(this,su).get(n);r?r.push(e):y(this,su).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(y(this,Yh).delete(e)){const n=RT(e);if(typeof n=="string"){const r=y(this,su).get(n);if(r)if(r.length>1){const s=r.indexOf(e);s!==-1&&r.splice(s,1)}else r[0]===e&&y(this,su).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=RT(e);if(typeof n=="string"){const r=y(this,su).get(n),s=r==null?void 0:r.find(i=>i.state.status==="pending");return!s||s===e}else return!0}runNext(e){var r;const n=RT(e);if(typeof n=="string"){const s=(r=y(this,su).get(n))==null?void 0:r.find(i=>i!==e&&i.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Vs.batch(()=>
vendor: 16,713 bytes, line 41
41{y(this,Yh).forEach(e=>{this.notify({type:"removed",mutation:e})}),y(this,Yh).clear(),y(this,su).clear()})}getAll(){return Array.from(y(this,Yh))}find(e){const n={exact:!0,...e};return this.getAll().find(r=>TJ(n,r))}findAll(e={}){return this.getAll().filter(n=>TJ(e,n))}notify(e){Vs.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return Vs.batch(()=>Promise.all(e.map(n=>n.continue().catch(to))))}},Yh=new WeakMap,su=new WeakMap,lA=new WeakMap,Oce);function RT(t){var e;return(e=t.options.scope)==null?void 0:e.id}function RJ(t){return{onFetch:(e,n)=>{var d,h,f,p,m;const r=e.options,s=(f=(h=(d=e.fetchOptions)==null?void 0:d.meta)==null?void 0:h.fetchMore)==null?void 0:f.direction,i=((p=e.state.data)==null?void 0:p.pages)||[],o=((m=e.state.data)==null?void 0:m.pageParams)||[];let l={pages:[],pageParams:[]},c=0;const u=async()=>{let v=!1;const x=_=>{Object.defineProperty(_,"signal",{enumerable:!0,get:()=>(e.signal.aborted?v=!0:e.signal.addEventListener("abort",()=>{v=!0}),e.signal)})},g=lhe(e.options,e.fetchOptions),w=async(_,j,N)=>{if(v)return Promise.reject();if(j==null&&_.pages.length)return Promise.resolve(_);const C=(()=>{const T={client:e.client,queryKey:e.queryKey,pageParam:j,direction:N?"backward":"forward",meta:e.options.meta};return x(T),T})(),k=await g(C),{maxPages:E}=e.options,P=N?JOe:XOe;return{pages:P(_.pages,k,E),pageParams:P(_.pageParams,j,E)}};if(s&&i.length){const _=s==="backward",j=_?lIe:OJ,N={pages:i,pageParams:o},S=j(r,N);l=await w(N,S,_)}else{const _=t??i.length;do{const j=c===0?o[0]??r.initialPageParam:OJ(r,l);if(c>0&&j==null)break;l=await w(l,j),c++}while(c<_)}return l};e.options.persister?e.fetchFn=()=>{var v,x;return(x=(v=e.options).persister)==null?void 0:x.call(v,u,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=u}}}function OJ(t,{pages:e,pageParams:n}){const r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,n[r],n):void 0}function lIe(t,{pages:e,pageParams:n}){var r;return e.length>0?(r=t.getPreviousPageParam)==null?void 0:r.call(t,e[0],e,n[0],n):void 0}var Wr,am,om,Xw,Jw,lm,Qw,Zw,Ice,cIe=(Ice=class{constructor(t={}){q(this,Wr);q(this,am);q(this,om);q(this,Xw);q(this,Jw);q(this,lm);q(this,Qw);q(this,Zw);$(this,Wr,t.queryCache||new iIe),$(this,am,t.mutationCache||new oIe),$(this,om,t.defaultOptions||{}),$(this,Xw,new Map),$(this,Jw,new Map),$(this,lm,0)}mount(){Vr(this,lm)._++,y(this,lm)===1&&($(this,Qw,gW.subscribe(async t=>{t&&(await this.resumePausedMutations(),y(this,Wr).onFocus())})),$(this,Zw,xO.subscribe(async t=>{t&&(await this.resumePausedMutations(),y(this,Wr).onOnline())})))}unmount(){var t,e;Vr(this,lm)._--,y(this,lm)===0&&((t=y(this,Qw))==null||t.call(this),$(this,Qw,void 0),(e=y(this,Zw))==null||e.call(this),$(this,Zw,void 0))}isFetching(t){return y(this,Wr).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return y(this,am).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=y(this,Wr).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=y(this,Wr).build(this,e),r=n.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(_g(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return y(this,Wr).findAll(t).map(({queryKey:e,state:n})=>{const r=n.data;return[e,r]})}setQueryData(t,e,n){const r=this.defaultQueryOptions({queryKey:t}),s=y(this,Wr).get(r.queryHash),i=s==null?void 0:s.state.data,o=GOe(e,i);if(o!==void 0)return y(this,Wr).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(t,e,n){return Vs.batch(()=>y(this,Wr).findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=y(this,Wr).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=y(this,Wr);Vs.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=y(this,Wr);return Vs.batch(()=>(n.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},r=Vs.batch(()=>y(this,Wr).findAll(t).map(s=>s.cancel(n)));return Promise.all(r).then(to).catch(to)}invalidateQueries(t,e={}){return Vs.batch(()=>(y(this,Wr).findAll(t).forEach(n=>{n.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const n={...e,cancelRefetch:e.cancelRefetch??!0},r=Vs.batch(()=>y(this,Wr).findAll(t).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,n);return n.throwOnError||(i=i.catch(to)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(to)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=y(this,Wr).build(this,e);return n.isStaleByTime(_g(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(to).catch(to)}fetchInfiniteQuery(t){return t.behavior=RJ(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(to).catch(to)}ensureInfiniteQueryData(t){return t.behavior=RJ(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return xO.isOnline()?y(this,am).resumePausedMutations():Promise.resolve()}getQueryCache(){return y(this,Wr)}getMutationCache(){return y(this,am)}getDefaultOptions(){return y(this,om)}setDefaultOptions(t){$(this,om,t)}setQueryDefaults(t,e){y(this,Xw).set(Qy(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...y(this,Xw).values()],n={};return e.forEach(r=>{ek(t,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(t,e){y(this,Jw).set(Qy(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...y(this,Jw).values()],n={};return e.forEach(r=>{ek(t,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...y(this,om).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=pW(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===mW&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...y(this,om).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){y(this,Wr).clear(),y(this,am).clear()}},Wr=new WeakMap,am=new WeakMap,om=new WeakMap,Xw=new WeakMap,Jw=new WeakMap,lm=new WeakMap,Qw=new WeakMap,Zw=new WeakMap,Ice),ko,cn,cA,Ya,yx,e1,cm,um,uA,t1,n1,bx,wx,dm,r1,Tn,eN,p6,m6,g6,v6,x6,y6,b6,ghe,Dce,uIe=(Dce=class extends _j{constructor(e,n){super();q(this,Tn);q(this,ko);q(this,cn);q(this,cA);q(this,Ya);q(this,yx);q(this,e1);q(this,cm);q(this,um);q(this,uA);q(this,t1);q(this,n1);q(this,bx);q(this,wx);q(this,dm);q(this,r1,new Set);this.options=n,$(this,ko,e),$(this,um,null),$(this,cm,f6()),this.options.experimental_prefetchInRender||y(this,cm).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(y(this,cn).addObserver(this),IJ(y(this,cn),this.options)?V(this,Tn,eN).call(this):this.updateResult(),V(this,Tn,v6).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return w6(y(this,cn),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return w6(y(this,cn),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,V(this,Tn,x6).call(this),V(this,Tn,y6).call(this),y(this,cn).removeObserver(this)}setOptions(e){const n=this.options,r=y(this,cn);if(this.options=y(this,ko).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof mc(this.options.enabled,y(this,cn))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");V(this,Tn,b6).call(this),y(this,cn).setOptions(this.options),n._defaulted&&!vO(this.options,n)&&y(this,ko).getQueryCache().notify({type:"observerOptionsUpdated",query:y(this,cn),observer:this});const s=this.hasListeners();s&&DJ(y(this,cn),r,this.options,n)&&V(this,Tn,eN).call(this),this.updateResult(),s&&(y(this,cn)!==r||mc(this.options.enabled,y(this,cn))!==mc(n.enabled,y(this,cn))||_g(this.options.staleTime,y(this,cn))!==_g(n.staleTime,y(this,cn)))&&V(this,Tn,p6).call(this);const i=V(this,Tn,m6).call(this);s&&(y(this,cn)!==r||mc(this.options.enabled,y(this,cn))!==mc(n.enabled,y(this,cn))||i!==y(this,dm))&&V(this,Tn,g6).call(this,i)}getOptimisticResult(e){const n=y(this,ko).getQueryCache().build(y(this,ko),e),r=this.createResult(n,e);return hIe(this,r)&&($(this,Ya,r),$(this,e1,this.options),$(this,yx,y(this,cn).state)),r}getCurrentResult(){return y(this,Ya)}trackResult(e,n){return new Proxy(e,{get:(r,s)=>(this.trackProp(s),n==null||n(s),Reflect.get(r,s))})}trackProp(e){y(this,r1).add(e)}getCurrentQuery(){return y(this,cn)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=y(this,ko).defaultQueryOptions(e),r=y(this,ko).getQueryCache().build(y(this,ko),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(e){return V(this,Tn,eN).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),y(this,Ya)))}createResult(e,n){var E;const r=y(this,cn),s=this.options,i=y(this,Ya),o=y(this,yx),l=y(this,e1),u=e!==r?e.state:y(this,cA),{state:d}=e;let h={...d},f=!1,p;if(n._optimisticResults){const P=this.hasListeners(),T=!P&&IJ(e,n),M=P&&DJ(e,r,n,s);(T||M)&&(h={...h,...phe(d.data,e.options)}),n._optimisticResults==="isRestoring"&&(h.fetchStatus="idle")}let{error:m,errorUpdatedAt:v,status:x}=h;p=h.data;let g=!1;if(n.placeholderData!==void 0&&p===void 0&&x==="pending"){let P;i!=null&&i.isPlaceholderData&&n.placeholderData===(l==null?void 0:l.placeholderData)?(P=i.data,g=!0):P=typeof n.placeholderData=="function"?n.placeholderData((E=y(this,n1))==null?void 0:E.state.data,y(this,n1)):n.placeholderData,P!==void 0&&(x="success",p=h6(i==null?void 0:i.data,P,n),f=!0)}if(n.select&&p!==void 0&&!g)if(i&&p===(o==null?void 0:o.data)&&n.select===y(this,uA))p=y(this,t1);else try{$(this,uA,n.select),p=n.select(p),p=h6(i==null?void 0:i.data,p,n),$(this,t1,p),$(this,um,null)}catch(P){$(this,um,P)}y(this,um)&&(m=y(this,um),p=y(this,t1),v=Date.now(),x="error");const w=h.fetchStatus==="fetching",_=x==="pending",j=x==="error",N=_&&w,S=p!==void 0,k={status:x,fetchStatus:h.fetchStatus,isPending:_,isSuccess:x==="success",isError:j,isInitialLoading:N,isLoading:N,data:p,dataUpdatedAt:h.dataUpdatedAt,error:m,errorUpdatedAt:v,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:h.dataUpdateCount>0||h.errorUpdateCount>0,isFetchedAfterMount:h.dataUpdateCount>u.dataUpdateCount||h.errorUpdateCount>u.errorUpdateCount,isFetching:w,isRefetching:w&&!_,isLoadingError:j&&!S,isPaused:h.fetchStatus==="paused",isPlaceholderData:f,isRefetchError:j&&S,isStale:vW(e,n),refetch:this.refetch,promise:y(this,cm),isEnabled:mc(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const P=R=>{k.status==="error"?R.reject(k.error):k.data!==void 0&&R.resolve(k.data)},T=()=>{const R=$(this,cm,k.promise=f6());P(R)},M=y(this,cm);switch(M.status){case"pending":e.queryHash===r.queryHash&&P(M);break;case"fulfilled":(k.status==="error"||k.data!==M.value)&&T();break;case"rejected":(k.status!=="error"||k.error!==M.reason)&&T();break}}return k}updateResult(){const e=y(this,Ya),n=this.createResult(y(this,cn),this.options);if($(this,yx,y(this,cn).state),$(this,e1,this.options),y(this,yx).data!==void 0&&$(this,n1,y(this,cn)),vO(n,e))return;$(this,Ya,n);const r=()=>{if(!e)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!y(this,r1).size)return!0;const o=new Set(i??y(this,r1));return this.options.throwOnError&&o.add("error"),Object.keys(y(this,Ya)).some(l=>{const c=l;return y(this,Ya)[c]!==e[c]&&o.has(c)})};V(this,Tn,ghe).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&V(this,Tn,v6).call(this)}},ko=new WeakMap,cn=new WeakMap,cA=new WeakMap,Ya=new WeakMap,yx=new WeakMap,e1=new WeakMap,cm=new WeakMap,um=new WeakMap,uA=new WeakMap,t1=new WeakMap,n1=new WeakMap,bx=new WeakMap,wx=new WeakMap,dm=new WeakMap,r1=new WeakMap,Tn=new WeakSet,eN=function(e){V(this,Tn,b6).call(this);let n=y(this,cn).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(to)),n},p6=function(){V(this,Tn,x6).call(this);const e=_g(this.options.staleTime,y(this,cn));if(Jy||y(this,Ya).isStale||!u6(e))return;const r=ahe(y(this,Ya).dataUpdatedAt,e)+1;$(this,bx,setTimeout(()=>{y(this,Ya).isStale||this.updateResult()},r))},m6=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(y(this,cn)):this.options.refetchInterval)??!1},g6=function(e){V(this,Tn,y6).call(this),$(this,dm,e),!(Jy||mc(this.options.enabled,y(this,cn))===!1||!u6(y(this,dm))||y(this,dm)===0)&&$(this,wx,setInterval(()=>{(this.options.refetchIntervalInBackground||gW.isFocused())&&V(this,Tn,eN).call(this)},y(this,dm)))},v6=function(){V(this,Tn,p6).call(this),V(this,Tn,g6).call(this,V(this,Tn,m6).call(this))},x6=function(){y(this,bx)&&(clearTimeout(y(this,bx)),$(this,bx,void 0))},y6=function(){y(this,wx)&&(clearInterval(y(this,wx)),$(this,wx,void 0))},b6=function(){const e=y(this,ko).getQueryCache().build(y(this,ko),this.options);if(e===y(this,cn))return;const n=y(this,cn);$(this,cn,e),$(this,cA,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},ghe=function(e){Vs.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(y(this,Ya))}),y(this,ko).getQueryCache().notify({query:y(this,cn),type:"observerResultsUpdated"})})},Dce);function dIe(t,e){return mc(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function IJ(t,e){return dIe(t,e)||t.state.data!==void 0&&w6(t,e,e.refetchOnMount)}function w6(t,e,n){if(mc(e.enabled,t)!==!1&&_g(e.staleTime,t)!=="static"){const r=typeof n=="function"?n(t):n;return r==="always"||r!==!1&&vW(t,e)}return!1}function DJ(t,e,n,r){return(t!==e||mc(r.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&vW(t,n)}function vW(t,e){return mc(e.enabled,t)!==!1&&t.isStaleByTime(_g(e.staleTime,t))}function hIe(t,e){return!vO(t.getCurrentResult(),e)}var hm,fm,Ao,Xh,Vf,TM,_6,Lce,fIe=(Lce=class extends _j{constructor(n,r){super();q(this,Vf);q(this,hm);q(this,fm);q(this,Ao);q(this,Xh);$(this,hm,n),this.setOptions(r),this.bindMethods(),V(this,Vf,TM).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var s;const r=this.options;this.options=y(this,hm).defaultMutationOptions(n),vO(this.options,r)||y(this,hm).getMutationCache().notify({type:"observerOptionsUpdated",mutation:y(this,Ao),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&Qy(r.mutationKey)!==Qy(this.options.mutationKey)?this.reset():((s=y(this,Ao))==null?void 0:s.state.status)==="pending"&&y(this,Ao).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=y(this,Ao))==null||n.removeObserver(this)}onMutationUpdate(n){V(this,Vf,TM).call(this),V(this,Vf,_6).call(this,n)}getCurrentResult(){return y(this,fm)}reset(){var n;(n=y(this,Ao))==null||n.removeObserver(this),$(this,Ao,void 0),V(this,Vf,TM).call(this),V(this,Vf,_6).call(this)}mutate(n,r){var s;return $(this,Xh,r),(s=y(this,Ao))==null||s.removeObserver(this),$(this,Ao,y(this,hm).getMutationCache().build(y(this,hm),this.options)),y(this,Ao).addObserver(this),y(this,Ao).execute(n)}},hm=new WeakMap,fm=new WeakMap,Ao=new WeakMap,Xh=new WeakMap,Vf=new WeakSet,TM=function(){var r;const n=((r=y(this,Ao))==null?void 0:r.state)??mhe();$(this,fm,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},_6=function(n){Vs.batch(()=>{var r,s,i,o,l,c,u,d;if(y(this,Xh)&&this.hasListeners()){const h=y(this,fm).variables,f=y(this,fm).context;(n==null?void 0:n.type)==="success"?((s=(r=y(this,Xh)).onSuccess)==null||s.call(r,n.data,h,f),(o=(i=y(this,Xh)).onSettled)==null||o.call(i,n.data,null,h,f)):(n==null?void 0:n.type)==="error"&&((c=(l=y(this,Xh)).onError)==null||c.call(l,n.error,h,f),(d=(u=y(this,Xh)).onSettled)==null||d.call(u,void 0,n.error,h,f))}
41this.listeners.forEach(h=>{h(y(this,fm))})})},Lce),vhe=b.createContext(void 0),St=t=>{const e=b.useContext(vhe);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},pIe=({client:t,children:e})=>(b.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),a.jsx(vhe.Provider,{value:t,children:e})),xhe=b.createContext(!1),mIe=()=>b.useContext(xhe);xhe.Provider;function gIe(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var vIe=b.createContext(gIe()),xIe=()=>b.useContext(vIe),yIe=(t,e)=>{(t.suspense||t.throwOnError||t.experimental_prefetchInRender)&&(e.isReset()||(t.retryOnMount=!1))},bIe=t=>{b.useEffect(()=>{t.clearReset()},[t])},wIe=({result:t,errorResetBoundary:e,throwOnError:n,query:r,suspense:s})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(s&&t.data===void 0||che(n,[t.error,r])),_Ie=t=>{if(t.suspense){const e=r=>r==="static"?r:Math.max(r??1e3,1e3),n=t.staleTime;t.staleTime=typeof n=="function"?(...r)=>e(n(...r)):e(n),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},jIe=(t,e)=>t.isLoading&&t.isFetching&&!e,SIe=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,LJ=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function NIe(t,e,n){var h,f,p,m,v;const r=mIe(),s=xIe(),i=St(),o=i.defaultQueryOptions(t);(f=(h=i.getDefaultOptions().queries)==null?void 0:h._experimental_beforeQuery)==null||f.call(h,o),o._optimisticResults=r?"isRestoring":"optimistic",_Ie(o),yIe(o,s),bIe(s);const l=!i.getQueryCache().get(o.queryHash),[c]=b.useState(()=>new e(i,o)),u=c.getOptimisticResult(o),d=!r&&t.subscribed!==!1;if(b.useSyncExternalStore(b.useCallback(x=>{const g=d?c.subscribe(Vs.batchCalls(x)):to;return c.updateResult(),g},[c,d]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),b.useEffect(()=>{c.setOptions(o)},[o,c]),SIe(o,u))throw LJ(o,c,s);if(wIe({result:u,errorResetBoundary:s,throwOnError:o.throwOnError,query:i.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw u.error;if((m=(p=i.getDefaultOptions().queries)==null?void 0:p._experimental_afterQuery)==null||m.call(p,o,u),o.experimental_prefetchInRender&&!Jy&&jIe(u,r)){const x=l?LJ(o,c,s):(v=i.getQueryCache().get(o.queryHash))==null?void 0:v.promise;x==null||x.catch(to).finally(()=>{c.updateResult()})}return o.notifyOnChangeProps?u:c.trackResult(u)}function Ne(t,e){return NIe(t,uIe)}function Qe(t,e){const n=St(),[r]=b.useState(()=>new fIe(n,t));b.useEffect(()=>{r.setOptions(t)},[r,t]);const s=b.useSyncExternalStore(b.useCallback(o=>r.subscribe(Vs.batchCalls(o)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=b.useCallback((o,l)=>{r.mutate(o,l).catch(to)},[r]);if(s.error&&che(r.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:i,mutateAsync:s.mutate}}/** 42 * @remix-run/router v1.23.3 43 * 44 * Copyright (c) Remix Software Inc. 45 * 46 * This source code is licensed under the MIT license found in the 47 * LICENSE.md file in the root directory of this source tree. 48 * 49 * @license MIT 50 */function tk(){return tk=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},tk.apply(null,arguments)}var ug;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(ug||(ug={}));const FJ="popstate";function CIe(t){t===void 0&&(t={});function e(r,s){let{pathname:i,search:o,hash:l}=r.location;return j6("",{pathname:i,search:o,hash:l},s.state&&s.state.usr||null,s.state&&s.state.key||"default")}function n(r,s){return typeof s=="string"?s:yO(s)}return AIe(e,n,null,t)}function xs(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function xW(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function kIe(){return Math.random().toString(36).substr(2,8)}function $J(t,e){return{usr:t.state,key:t.key,idx:e}}function j6(t,e,n,r){return n===void 0&&(n=null),tk({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?jj(e):e,{state:n,key:e&&e.key||r||kIe()})}function yO(t){let{pathname:e="/",search:n="",hash:r=""}=t;return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function jj(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}function AIe(t,e,n,r){r===void 0&&(r={});let{window:s=document.defaultView,v5Compat:i=!1}=r,o=s.history,l=ug.Pop,c=null,u=d();u==null&&(u=0,o.replaceState(tk({},o.state,{idx:u}),""));function d(){return(o.state||{idx:null}).idx}function h(){l=ug.Pop;let x=d(),g=x==null?null:x-u;u=x,c&&c({action:l,location:v.location,delta:g})}function f(x,g){l=ug.Push;let w=j6(v.location,x,g);u=d()+1;let _=$J(w,u),j=v.createHref(w);try{o.pushState(_,"",j)}catch(N){if(N instanceof DOMException&&N.name==="DataCloneError")throw N;s.location.assign(j)}i&&c&&c({action:l,location:v.location,delta:1})}function p(x,g){l=ug.Replace;let w=j6(v.location,x,g);u=d();let _=$J(w,u),j=v.createHref(w);o.replaceState(_,"",j),i&&c&&c({action:l,location:v.location,delta:0})}function m(x){let g=s.location.origin!=="null"?s.location.origin:s.location.href,w=typeof x=="str
50ing"?x:yO(x);return w=w.replace(/ $/,"%20"),xs(g,"No window.location.(origin|href) available to create URL for href: "+w),new URL(w,g)}let v={get action(){return l},get location(){return t(s,o)},listen(x){if(c)throw new Error("A history only accepts one active listener");return s.addEventListener(FJ,h),c=x,()=>{s.removeEventListener(FJ,h),c=null}},createHref(x){return e(s,x)},createURL:m,encodeLocation(x){let g=m(x);return{pathname:g.pathname,search:g.search,hash:g.hash}},push:f,replace:p,go(x){return o.go(x)}};return v}var zJ;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(zJ||(zJ={}));function EIe(t,e,n){return n===void 0&&(n="/"),TIe(t,e,n,!1)}function TIe(t,e,n,r){let s=typeof e=="string"?jj(e):e,i=yW(s.pathname||"/",n);if(i==null)return null;let o=yhe(t);PIe(o);let l=null,c=UIe(i);for(let u=0;l==null&&u<o.length;++u)l=zIe(o[u],c,r);return l}function yhe(t,e,n,r){e===void 0&&(e=[]),n===void 0&&(n=[]),r===void 0&&(r="");let s=(i,o,l)=>{let c={relativePath:l===void 0?i.path||"":l,caseSensitive:i.caseSensitive===!0,childrenIndex:o,route:i};c.relativePath.startsWith("/")&&(xs(c.relativePath.startsWith(r),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(r.length));let u=jg([r,c.relativePath]),d=n.concat(c);i.children&&i.children.length>0&&(xs(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),yhe(i.children,e,d,u)),!(i.path==null&&!i.index)&&e.push({path:u,score:FIe(u,i.index),routesMeta:d})};return t.forEach((i,o)=>{var l;if(i.path===""||!((l=i.path)!=null&&l.includes("?")))s(i,o);else for(let c of bhe(i.path))s(i,o,c)}),e}function bhe(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,s=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return s?[i,""]:[i];let o=bhe(r.join("/")),l=[];return l.push(...o.map(c=>c===""?i:[i,c].join("/"))),s&&l.push(...o),l.map(c=>t.startsWith("/")&&c===""?"/":c)}function PIe(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:$Ie(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const MIe=/^:[\w-]+$/,RIe=3,OIe=2,IIe=1,DIe=10,LIe=-2,BJ=t=>t==="*";function FIe(t,e){let n=t.split("/"),r=n.length;return n.some(BJ)&&(r+=LIe),e&&(r+=OIe),n.filter(s=>!BJ(s)).reduce((s,i)=>s+(MIe.test(i)?RIe:i===""?IIe:DIe),r)}function $Ie(t,e){return t.length===e.length&&t.slice(0,-1).every((r,s)=>r===e[s])?t[t.length-1]-e[e.length-1]:0}function zIe(t,e,n){let{routesMeta:r}=t,s={},i="/",o=[];for(let l=0;l<r.length;++l){let c=r[l],u=l===r.length-1,d=i==="/"?e:e.slice(i.length)||"/",h=UJ({path:c.relativePath,caseSensitive:c.caseSensitive,end:u},d),f=c.route;if(!h&&u&&n&&!r[r.length-1].route.index&&(h=UJ({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},d)),!h)return null;
vendor: 7,326 bytes, lines 50-59
50Object.assign(s,h.params),o.push({params:s,pathname:jg([i,h.pathname]),pathnameBase:KIe(jg([i,h.pathnameBase])),route:f}),h.pathnameBase!=="/"&&(i=jg([i,h.pathnameBase]))}return o}function UJ(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,r]=BIe(t.path,t.caseSensitive,t.end),s=e.match(n);if(!s)return null;let i=s[0],o=i.replace(/(.)\/+$/,"$1"),l=s.slice(1);return{params:r.reduce((u,d,h)=>{let{paramName:f,isOptional:p}=d;if(f==="*"){let v=l[h]||"";o=i.slice(0,i.length-v.length).replace(/(.)\/+$/,"$1")}const m=l[h];return p&&!m?u[f]=void 0:u[f]=(m||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:o,pattern:t}}function BIe(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),xW(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let r=[],s="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,c)=>(r.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(r.push({paramName:"*"}),s+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":t!==""&&t!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,e?void 0:"i"),r]}function UIe(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return xW(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function yW(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}const qIe=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,VIe=t=>qIe.test(t);function HIe(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:s=""}=typeof t=="string"?jj(t):t,i;if(n)if(VIe(n))i=n;else{if(n.includes("//")){let o=n;n=whe(n),xW(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?i=qJ(n.substring(1),"/"):i=qJ(n,e)}else i=e;return{pathname:i,search:GIe(r),hash:YIe(s)}}function qJ(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function v$(t,e,n,r){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function WIe(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function bW(t,e){let n=WIe(t);return e?n.map((r,s)=>s===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function wW(t,e,n,r){r===void 0&&(r=!1);let s;typeof t=="string"?s=jj(t):(s=tk({},t),xs(!s.pathname||!s.pathname.includes("?"),v$("?","pathname","search",s)),xs(!s.pathname||!s.pathname.includes("#"),v$("#","pathname","hash",s)),xs(!s.search||!s.search.includes("#"),v$("#","search","hash",s)));let i=t===""||s.pathname==="",o=i?"/":s.pathname,l;if(o==null)l=n;else{let h=e.length-1;if(!r&&o.startsWith("..")){let f=o.split("/");for(;f[0]==="..";)f.shift(),h-=1;s.pathname=f.join("/")}l=h>=0?e[h]:"/"}let c=HIe(s,l),u=o&&o!=="/"&&o.endsWith("/"),d=(i||o===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}const whe=t=>t.replace(/\/\/+/g,"/"),jg=t=>whe(t.join("/")),KIe=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),GIe=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,YIe=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function XIe(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const _he=["post","put","patch","delete"];new Set(_he);const JIe=["get",..._he];new Set(JIe);/** 51 * React Router v6.30.4 52 * 53 * Copyright (c) Remix Software Inc. 54 * 55 * This source code is licensed under the MIT license found in the 56 * LICENSE.md file in the root directory of this source tree. 57 * 58 * @license MIT 59 */function nk(){return nk=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},nk.apply(null,arguments)}const _W=b.createContext(null),QIe=b.createContext(null),Qg=b.createContext(null),VL=b.createContext(null),yh=b.createContext({outlet:null,matches:[],isDataRoute:!1}),jhe=b.createContext(null);function ZIe(t,e){let{relative:n}=e===void 0?{}:e;Sj()||xs(!1);let{basename:r,navigator:s}=b.useContext(Qg),{hash:i,pathname:o,search:l}=Nhe(t,{relative:n}),c=o;return r!=="/"&&(c=o==="/"?r:jg([r,o])),s.createHref({pathname:c,search:l,hash:i})}function Sj(){return b.useContext(VL)!=null}function xo(){return Sj()||xs(!1),b.useContext(VL).location}function She(t){b.useContext(Qg).static||b.useLayoutEffect(t)}function Gs(){let{isDataRoute:t}=b.useContext(yh);return t?pDe():eDe()}function eDe(){Sj()||xs(!1);let t=b.useContext(_W),{basename:e,future:n,navigator:r}=b.useContext(Qg),{matches:s}=b.useContext(yh),{pathname:i}=xo(),o=JSON.stringify(bW(s,n.v7_relativeSplatPath)),l=b.useRef(!1);return She(()=>{l.current=!0}),b.useCallback(function(u,d){if(d===void 0&&(d={}),!l.current)return;if(typeof u=="number"){r.go(u);return}let h=wW(u,JSON.parse(o),i,d.relative==="path");t==null&&e!=="/"&&(h.pathname=h.pathname==="/"?e:jg([e,h.pathname])),(d.replace?r.replace:r.push)(h,d.state,d)},[e,r,o,i,t])}const tDe=b.createContext(null);function nDe(t){let e=b.useContext(yh).outlet;return e&&b.createElement(tDe.Provider,{value:t},e)}function Xi(){let{matches:t}=b.useContext(yh),e=t[t.length-1];return e?e.params:{}}function Nhe(t,e){let{relative:n}=e===void 0?{}:e,{future:r}=b.useContext(Qg),{matches:s}=b.useContext(yh),{pathname:i}=xo(),o=JSON.stringify(bW(s,r.v7_relativeSplatPath));return b.useMemo(()=>wW(t,JSON.parse(o),i,n==="path"),[t,o,i,n])}function rDe(t,e){return sDe(t,e)}function sDe(t,e,n,r){Sj()||xs(!1);let{navigator:s}=b.useContext(Qg),{matches:i}=b.useContext(yh),o=i[i.length-1],l=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let u=xo(),d;if(e){var h;let x=typeof e=="string"?jj(e):e;c==="/"||(h=x.pathname)!=null&&h.startsWith(c)||xs(!1),d=x}else d=u;let f=d.pathname||"/",p=f;if(c!=="/"){let x=c.replace(/^\//,"").split("/");p="/"+f.replace(/^\//,"").split("/").slice(x.length).join("/")}let m=EIe(t,{pathname:p}),v=cDe(m&&m.map(x=>Object.assign({},x,{params:Object.assign({},l,x.params),pathname:jg([c,s.encodeLocation?s.encodeLocation(x.pathname).pathname:x.pathname]),pathnameBase:x.pathnameBase==="/"?c:jg([c,s.encodeLocation?s.encodeLocation(x.pathnameBase).pathname:x.pathnameBase])})),i,n,r);return e&&v?b.createElement(VL.Provider,{value:{location:nk({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:ug.Pop}},v):v}function iDe(){let t=fDe(),e=XIe(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,s={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return b.createElement(b.Fragment,null,b.createElement("h2",null,"Unexpected Application
59Error!"),b.createElement("h3",{style:{fontStyle:"italic"}},e),n?b.createElement("pre",{style:s},n):null,null)}const aDe=b.createElement(iDe,null);class oDe extends b.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error!==void 0?b.createElement(yh.Provider,{value:this.props.routeContext},b.createElement(jhe.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function lDe(t){let{routeContext:e,match:n,children:r}=t,s=b.useContext(_W);return s&&s.static&&s.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=n.route.id),b.createElement(yh.Provider,{value:e},r)}function cDe(t,e,n,r){var s;if(e===void 0&&(e=[]),n===void 0&&(n=null),r===void 0&&(r=null),t==null){var i;if(!n)return null;if(n.errors)t=n.matches;else if((i=r)!=null&&i.v7_partialHydration&&e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let o=t,l=(s=n)==null?void 0:s.errors;if(l!=null){let d=o.findIndex(h=>h.route.id&&(l==null?void 0:l[h.route.id])!==void 0);d>=0||xs(!1),o=o.slice(0,Math.min(o.length,d+1))}let c=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let d=0;d<o.length;d++){let h=o[d];if((h.route.HydrateFallback||h.route.hydrateFallbackElement)&&(u=d),h.route.id){let{loaderData:f,errors:p}=n,m=h.route.loader&&f[h.route.id]===void 0&&(!p||p[h.route.id]===void 0);if(h.route.lazy||m){c=!0,u>=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((d,h,f)=>{let p,m=!1,v=null,x=null;n&&(p=l&&h.route.id?l[h.route.id]:void 0,v=h.route.errorElement||aDe,c&&(u<0&&f===0?(m=!0,x=null):u===f&&(m=!0,x=h.route.hydrateFallbackElement||null)));let g=e.concat(o.slice(0,f+1)),w=()=>{let _;return p?_=v:m?_=x:h.route.Component?_=b.createElement(h.route.Component,null):h.route.element?_=h.route.element:_=d,b.createElement(lDe,{match:h,routeContext:{outlet:d,matches:g,isDataRoute:n!=null},children:_})};return n&&(h.route.ErrorBoundary||h.route.errorElement||f===0)?b.createElement(oDe,{location:n.location,revalidation:n.revalidation,component:v,error:p,children:w(),routeContext:{outlet:null,matches:g,isDataRoute:!0}}):w()},null)}var Che=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(Che||{}),bO=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(bO||{});function uDe(t){let e=b.useContext(_W);return e||xs(!1),e}function dDe(t){let e=b.useContext(QIe);return e||xs(!1),e}function hDe(t){let e=b.useContext(yh);return e||xs(!1),e}function khe(t){let e=hDe(),n=e.matches[e.matches.length-1];return n.route.id||xs(!1),n.route.id}function fDe(){var t;let e=b.useContext(jhe),n=dDe(bO.UseRouteError),r=khe(bO.UseRouteError);return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function pDe(){let{router:t}=uDe(Che.UseNavigateStable),e=khe(bO.UseNavigateStable),n=b.useRef(!1);return She(()=>{n.current=!0}),b.useCallback(function(s,i){i===void 0&&(i={}),n.current&&(typeof s=="number"?t.navigate(s):t.navigate(s,nk({fromRouteId:e},i)))},[t,e])}function mDe(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function ms(t){let{to:e,replace:n,state:r,relative:s}=t;Sj()||xs(!1);let{future:i,static:o}=b.useContext(Qg),{matches:l}=b.useContext(yh),{pathname:c}=xo(),u=Gs(),d=wW(e,bW(l,i.v7_relativeSplatPath),c,s==="path"),h=JSON.stringify(d);return b.useEffect(()=>u(JSON.parse(h),{replace:n,state:r,relative:s}),[u,h,s,n,r]),null}function Ahe(t){return nDe(t.context)}function Ie(t){xs(!1)}function gDe(t){let{basename:e="/",children:n=null,location:r,navigationType:s=ug.Pop,navigator:i,static:o=!1,future:l}=t;Sj()&&xs(!1);let c=e.replace(/^\/*/,"/"),u=b.useMemo(()=>({basename:c,navigator:i,static:o,future:nk({v7_relativeSplatPath:!1},l)}),[c,l,i,o]);typeof r=="string"&&(r=jj(r));let{pathname:d="/",search:h="",hash:f="",state:p=null,key:m="default"}=r,v=b.useMemo(()=>{let x=yW(d,c);return x==null?null:{location:{pathname:x,search:h,hash:f,state:p,key:m},navigationType:s}},[c,d,h,f,p,m,s]);return v==null?null:b.createElement(Qg.Provider,{value:u},b.createElement(VL.Provider,{children:n,value:v}))}function vDe(t){let{children:e,location:n}=t;return rDe(S6(e),n)}new Promise(()=>{});function S6(t,e){e===void 0&&(e=[]);let n=[];
59return b.Children.forEach(t,(r,s)=>{if(!b.isValidElement(r))return;let i=[...e,s];if(r.type===b.Fragment){n.push.apply(n,S6(r.props.children,i));return}r.type!==Ie&&xs(!1),!r.props.index||!r.props.children||xs(!1);let o={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=S6(r.props.children,i)),n.push(o)}),n}/** 60 * React Router DOM v6.30.4 61 * 62 * Copyright (c) Remix Software Inc. 63 * 64 * This source code is licensed under the MIT license found in the 65 * LICENSE.md file in the root directory of this source tree. 66 * 67 * @license MIT 68 */function N6(){return N6=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},N6.apply(null,arguments)}function xDe(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function yDe(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function bDe(t,e){return t.button===0&&(!e||e==="_self")&&!yDe(t)}function C6(t){return t===void 0&&(t=""),new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,n)=>{let r=t[n];return e.concat(Array.isArray(r)?r.map(s=>[n,s]):[[n,r]])},[]))}function wDe(t,e){let n=C6(t);return e&&e.forEach((r,s)=>{n.has(s)||e.getAll(s).forEach(i=>{n.append(s,i)})}),n}const _De=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],jDe="6";try{window.__reactRouterVersion=jDe}catch{}const SDe="startTransition",VJ=kL[SDe];function NDe(t){let{basename:e,children:n,future:r,window:s}=t,i=b.useRef();i.current==null&&(i.current=CIe({window:s,v5Compat:!0}));let o=i.current,[l,c]=b.useState({action:o.action,location:o.location}),{v7_startTransition:u}=r||{},d=b.useCallback(h=>{u&&VJ?VJ(()=>c(h)):c(h)},[c,u]);return b.useLayoutEffect(()=>o.listen(d),[o,d]),b.useEffect(()=>mDe(r),[r]),b.createElement(gDe,{basename:e,children:n,location:l.location,navigationType:l.action,navigator:o,future:r})}const CDe=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",kDe=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,_e=b.forwardRef(function(e,n){let{onClick:r,relative:s,reloadDocument:i,replace:o,state:l,target:c,to:u,preventScrollReset:d,viewTransition:h}=e,f=xDe(e,_De),{basename:p}=b.useContext(Qg),m,v=!1;if(typeof u=="string"&&kDe.test(u)&&(m=u,CDe))try{let _=new URL(window.location.href),j=u.startsWith("//")?new URL(_.protocol+u):new URL(u),N=yW(j.pathname,p);j.origin===_.origin&&N!=null?u=N+j.search+j.hash:v=!0}catch{}let x=ZIe(u,{relative:s}),g=ADe(u,{replace:o,state:l,target:c,preventScrollReset:d,relative:s,viewTransition:h});function w(_){r&&r(_),_.defaultPrevented||g(_)}return b.createElement("a",N6({},f,{href:m||x,onClick:v||i?r:w,ref:n,target:c}))});var HJ;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(HJ||(HJ={}));var WJ;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(WJ||(WJ={}));function ADe(t,e){let{target:n,replace:r,state:s,preventScrollReset:i,relative:o,viewTransition:l}=e===void 0?{}:e,c=Gs(),u=xo(),d=Nhe(t,{relative:o});return b.useCallback(h=>{if(bDe(h,n)){h.preventDefault();let f=r!==void 0?r:yO(u)===yO(d);c(t,{replace:f,state:s,preventScrollReset:i,relative:o,viewTransition:l})}},[u,c,d,r,s,n,t,i,o,l])}function Zg(t){let e=b.useRef(C6(t)),n=b.useRef(!1),r=xo(),s=b.useMemo(()=>wDe(r.search,n.current?null:e.current),[r.search]),i=Gs(),o=b.useCallback((l,c)=>{const u=C6(typeof l=="function"?l(s):l);n.current=!0,i("?"+u,c)},[i,s]);return[s,o]}function EDe(t,e){let{capture:n}={};b.useEffect(()=>{let r=n!=null?{capture:n}:void 0;return window.addEventListener("beforeunload",t,r),()=>{window.removeEventListener("beforeunload",t,r)}},[t,n])}function OT({base:t}){const{slug:e}=Xi();return a.jsx(ms,{to:`${t}/${e??""}`,replace:!0})}function TDe({children:t}){const{pathname:e,search:n}=xo();if(e.startsWith("/amp/"))return a.jsx(ms,{to:e.replace(/^\/amp/,"")+n,replace:!0});const r=e.match(/\/i\/\d+\/([^/?#]+)\/?$/);if(r){const s=r[1];return/\/(les-avantages|carnets?-dadresse)\//.test(e)?a.jsx(ms,{to:`/carnet-adresses/${s}`,replace:!0}):a.jsx(ms,{to:`/actualites/${s}`,replace:!0})}return/^\/nos-magazines\/c\/\d+/.test(e)?a.jsx(ms,{to:"/nos-magazines",replace:!0}):/^\/guides-voyage\/c\/\d+/.test(e)?a.jsx(ms,{to:"/destinations",replace:!0}):/^\/les-avantages\/c\/\d+/.test(e)?a.jsx(ms,{to:"/carte-privilege",replace:!0}):/^\/[^/]+\/c\/\d+\/?$/.test(e)?a.jsx(ms,{to:"/actualites",replace:!0}):e.startsWith("/points-de-depot-esprit-sud")?a.jsx(ms,{to:"/points-de-depot",replace:!0}):e==="/la-carte"?a.jsx(ms,{to:"/carte-privilege",replace:!0}):e.startsWith("/syndication")?a.jsx(ms,{to:"/",replace:!0}):a.jsx(a.Fragment,{children:t})}function PDe(){const{pathname:t}=xo();return b.useEffect(()=>{window.scrollTo({top:0,left:0,behavior:"instant"})},[t]),null}function MDe(t,e,n,r){function s(i){return i instanceof n?i:new n(function(o){o(i)})}
68return new(n||(n=Promise))(function(i,o){function l(d){try{u(r.next(d))}catch(h){o(h)}}function c(d){try{u(r.throw(d))}catch(h){o(h)}}function u(d){d.done?i(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})}const RDe=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);class jW extends Error{constructor(e,n="FunctionsError",r){super(e),this.name=n,this.context=r}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class ODe extends jW{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class KJ extends jW{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class GJ extends jW{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var k6;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(k6||(k6={}));class IDe{constructor(e,{headers:n={},customFetch:r,region:s=k6.Any}={}){this.url=e,this.headers=n,this.region=s,this.fetch=RDe(r)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return MDe(this,arguments,void 0,function*(n,r={}){var s;let i,o;try{const{headers:l,method:c,body:u,signal:d,timeout:h}=r;let f={},{region:p}=r;p||(p=this.region);const m=new URL(`${this.url}/${n}`);p&&p!=="any"&&(f["x-region"]=p,m.searchParams.set("forceFunctionRegion",p));let v;u&&(l&&!Object.prototype.hasOwnProperty.call(l,"Content-Type")||!l)?typeof Blob<"u"&&u instanceof Blob||u instanceof ArrayBuffer?(f["Content-Type"]="application/octet-stream",v=u):typeof u=="string"?(f["Content-Type"]="text/plain",v=u):typeof FormData<"u"&&u instanceof FormData?v=u:(f["Content-Type"]="application/json",v=JSON.stringify(u)):u&&typeof u!="string"&&!(typeof Blob<"u"&&u instanceof Blob)&&!(u instanceof ArrayBuffer)&&!(typeof FormData<"u"&&u instanceof FormData)?v=JSON.stringify(u):v=u;let x=d;h&&(o=new AbortController,i=setTimeout(()=>o.abort(),h),d?(x=o.signal,d.addEventListener("abort",()=>o.abort())):x=o.signal);const g=yield this.fetch(m.toString(),{method:c||"POST",headers:Object.assign(Object.assign(Object.assign({},f),this.headers),l),body:v,signal:x}).catch(N=>{throw new ODe(N)}),w=g.headers.get("x-relay-error");if(w&&w==="true")throw new KJ(g);if(!g.ok)throw new GJ(g);let _=((s=g.headers.get("Content-Type"))!==null&&s!==void 0?s:"text/plain").split(";")[0].trim(),j;return _==="application/json"?j=yield g.json():_==="application/octet-stream"||_==="application/pdf"?j=yield g.blob():_==="text/event-stream"?j=g:_==="multipart/form-data"?j=yield g.formData():j=yield g.text(),{data:j,error:null,response:g}}catch(l){return{data:null,error:l,response:l instanceof GJ||l instanceof KJ?l.context:void 0}}finally{i&&clearTimeout(i)}})}}const Ehe=3,YJ=t=>Math.min(1e3*2**t,3e4),DDe=[520,503],The=["GET","HEAD","OPTIONS"];var XJ=class extends Error{constructor(t){super(t.message),this.name="PostgrestError",this.details=t.details,this.hint=t.hint,this.co
68de=t.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};function JJ(t,e){return new Promise(n=>{if(e!=null&&e.aborted){n();return}const r=setTimeout(()=>{e==null||e.removeEventListener("abort",s),n()},t);function s(){clearTimeout(r),n()}e==null||e.addEventListener("abort",s)})}function LDe(t,e,n,r){return!(!r||n>=Ehe||!The.includes(t)||!DDe.includes(e))}var FDe=class{constructor(t){var e,n,r,s,i;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=t.method,this.url=t.url,this.headers=new Headers(t.headers),this.schema=t.schema,this.body=t.body,this.shouldThrowOnError=(e=t.shouldThrowOnError)!==null&&e!==void 0?e:!1,this.signal=t.signal,this.isMaybeSingle=(n=t.isMaybeSingle)!==null&&n!==void 0?n:!1,this.shouldStripNulls=(r=t.shouldStripNulls)!==null&&r!==void 0?r:!1,this.urlLengthLimit=(s=t.urlLengthLimit)!==null&&s!==void 0?s:8e3,this.retryEnabled=(i=t.retry)!==null&&i!==void 0?i:!0,t.fetch?this.fetch=t.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if(this.headers.get("Accept")==="text/csv")throw new Error("stripNulls() cannot be used with csv()");return this.shouldStripNulls=!0,this}setHeader(t,e){return this.headers=new Headers(this.headers),this.headers.set(t,e),this}retry(t){return this.retryEnabled=t,this}then(t,e){var n=this;if(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"),this.shouldStripNulls){const o=this.headers.get("Accept");o==="application/vnd.pgrst.object+json"?this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped"):(!o||o==="application/json")&&this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}const r=this.fetch;let i=(async()=>{let o=0;for(;;){const u={};n.headers.forEach((h,f)=>{u[f]=h}),o>0&&(u["X-Retry-Count"]=String(o));let d;try{d=await r(n.url.toString(),{method:n.method,headers:u,body:JSON.stringify(n.body,(h,f)=>typeof f=="bigint"?f.toString():f),signal:n.signal})}catch(h){if((h==null?void 0:h.name)==="AbortError"||(h==null?void 0:h.code)==="ABORT_ERR"||!The.includes(n.method))throw h;if(n.retryEnabled&&o<Ehe){const f=YJ(o);o++,await JJ(f,n.signal);continue}throw h}if(LDe(n.method,d.status,o,n.retryEnabled)){var l,c;const h=(l=(c=d.headers)===null||c===void 0?void 0:c.get("Retry-After"))!==null&&l!==void 0?l:null,f=h!==null?Math.max(0,parseInt(h,10)||0)*1e3:YJ(o);await d.text(),o++,await JJ(f,n.signal);continue}return await n.processResponse(d)}})();return this.shouldThrowOnError||(i=i.catch(o=>{var l;let c="",u="",d="";const h=o==null?void 0:o.cause;if(h){var f,p,m,v;const w=(f=h==null?void 0:h.message)!==null&&f!==void 0?f:"",_=(p=h==null?void 0:h.code)!==null&&p!==void 0?p:"";c=`${(m=o==null?void 0:o.name)!==null&&m!==void 0?m:"FetchError"}: ${o==null?void 0:o.message}`,c+=` 69 70Caused by: ${(v=h==null?void 0:h.name)!==null&&v!==void 0?v:"Error"}: ${w}`,_&&(c+=` (${_})`),h!=null&&h.stack&&(c+=` 71${h.stack}`)}else{var x;c=(x=o==null?void 0:o.stack)!==null&&x!==void 0?x:""}const g=this.url.toString().length;return(o==null?void 0:o.name)==="AbortError"||(o==null?void 0:o.code)==="ABORT_ERR"?(d="",u="Request was aborted (timeout or manual cancellation)",g>this.urlLengthLimit&&(u+=`. Note: Your request URL is ${g} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):((h==null?void 0:h.name)==="HeadersOverflowError"||(h==null?void 0:h.code)==="UND_ERR_HEADERS_OVERFLOW")&&(d="",u="HTTP headers exceeded server limits (typically 16KB)",g>this.urlLengthLimit&&(u+=`. Your request URL is ${g} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{success:!1,error:{message:`${(l=o==null?void 0:o.name)!==null&&l!==void 0?l:"FetchError"}: ${o==null?void 0:o.message}`,details:c,hint:u,code:d},data:null,count:null,status:0,statusText:""}}
71)),i.then(t,e)}async processResponse(t){var e=this;let n=null,r=null,s=null,i=t.status,o=t.statusText;if(t.ok){var l,c;if(e.method!=="HEAD"){var u;const f=await t.text();if(f!=="")if(e.headers.get("Accept")==="text/csv")r=f;else if(e.headers.get("Accept")&&(!((u=e.headers.get("Accept"))===null||u===void 0)&&u.includes("application/vnd.pgrst.plan+text")))r=f;else try{r=JSON.parse(f)}catch{if(n={message:f},r=null,e.shouldThrowOnError)throw new XJ({message:f,details:"",hint:"",code:""})}}const d=(l=e.headers.get("Prefer"))===null||l===void 0?void 0:l.match(/count=(exact|planned|estimated)/),h=(c=t.headers.get("content-range"))===null||c===void 0?void 0:c.split("/");d&&h&&h.length>1&&(s=parseInt(h[1])),e.isMaybeSingle&&Array.isArray(r)&&(r.length>1?(n={code:"PGRST116",details:`Results contain ${r.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},r=null,s=null,i=406,o="Not Acceptable"):r.length===1?r=r[0]:r=null)}else{const d=await t.text();try{n=JSON.parse(d),Array.isArray(n)&&t.status===404&&(r=[],n=null,i=200,o="OK")}catch{t.status===404&&d===""?(i=204,o="No Content"):n={message:d}}if(n&&e.shouldThrowOnError)throw new XJ(n)}return{success:n===null,error:n,data:r,count:s,status:i,statusText:o}}returns(){return this}overrideTypes(){return this}},$De=class extends FDe{throwOnError(){return super.throwOnError()}select(t){let e=!1;const n=(t??"*").split("").map(r=>/\s/.test(r)&&!e?"":(r==='"'&&(e=!e),r)).join("");return this.url.searchParams.set("select",n),this.headers.append("Prefer","return=representation"),this}order(t,{ascending:e=!0,nullsFirst:n,foreignTable:r,referencedTable:s=r}={}){const i=s?`${s}.order`:"order",o=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${o?`${o},`:""}${t}.${e?"asc":"desc"}${n===void 0?"":n?".nullsfirst":".nullslast"}`),this}limit(t,{foreignTable:e,referencedTable:n=e}={}){const r=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(r,`${t}`),this}range(t,e,{foreignTable:n,referencedTable:r=n}={}){const s=typeof r>"u"?"offset":`${r}.offset`,i=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(s,`${t}`),this.url.searchParams.set(i,`${e-t+1}`),this}abortSignal(t){return this.signal=t,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:t=!1,verbose:e=!1,settings:n=!1,buffers:r=!1,wal:s=!1,format:i="text"}={}){var o;const l=[t?"analyze":null,e?"verbose":null,n?"settings":null,r?"buffers":null,s?"wal":null].filter(Boolean).join("|"),c=(o=this.headers.get("Accept"))!==null&&o!==void 0?o:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${c}"; options=${l};`),i==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(t){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${t}`),this}};const QJ=new RegExp("[,()]");var Nb=class extends $De{throwOnError(){return super.throwOnError()}eq(t,e){return this.url.searchParams.append(t,`eq.${e}`),this}neq(t,e){return this.url.searchParams.append(t,`neq.${e}`),this}gt(t,e){return this.url.searchParams.append(t,`gt.${e}`),this}gte(t,e){return this.url.searchParams.append(t,`gte.${e}`),this}lt(t,e){return this.url.searchParams.append(t,`lt.${e}`),this}lte(t,e){return this.url.searchParams.append(t,`lte.${e}`),this}like(t,e){return this.url.searchParams.append(t,`like.${e}`),this}likeAllOf(t,e){return this.url.searchParams.append(t,`like(all).{${e.join(",")}}`),this}likeAnyOf(t,e){return this.url.searchParams.append(t,`like(any).{${e.join(",")}}`),this}ilike(t,e){return this.url.searchParams.append(t,`ilike.${e}`),this}ilikeAllOf(t,e){return this.url.searchParams.append(t,`ilike(all).{${e.join(",")}}`),this}ilikeAnyOf(t,e){return this.url.searchParams.append(t,`ilike(any).{${e.join(",")}}`),this}regexMatch(t,e){return this.url.searchParams.append(t,`match.${e}`),this}regexIMatch(t,e){return this.url.searchParams.append(t,`imatch.${e}`),this}is(t,e){return this.url.searchParams.append(t,`is.${e}`),this}isDistinct(t,e){return this.url.searchParams.append(t,`isdistinct.${e}`),this}in(t,e){const n=Array.from(new Set(e)).map(r=>typeof r=="string"&&QJ.test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(t,`in.(${n})`),this}notIn(t,e){const n=Array.from(new Set(e)).map(r=>typeof r=="string"&&QJ.test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(t,`not.in.(${n})`),this}contains(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cs.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cs.{${e.join(",")}}`):this.url.searchParams.append(t,`cs.${JSON.stringify(e)}`),this}containedBy(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cd.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cd.{${e.join(",")}}`):this.url.searchParams.append(t,`cd.${JSON.stringify(e)}`),this}rangeGt(t,e){return this.url.searchParams.append(t,`sr.${e}`),this}rangeGte(t,e){return this.url.searchParams.append(t,`nxl.${e}`),this}rangeLt(t,e){return this.url.searchParams.append(t,`sl.${e}`),this}rangeLte(t,e){return this.url.searchParams.append(t,`nxr.${e}`),this}rangeAdjacent(t,e){return this.url.searchParams.append(t,`adj.${e}`),this}overlaps(t,e){return typeof e=="string"?this.url.searchParams.append(t,`ov.${e}`):this.url.searchParams.append(t,`ov.{${e.join(",")}}`),this}textSearch(t,e,{config:n,type:r}={}){let s="";r==="plain"?s="pl":r==="phrase"?s="ph":r==="websearch"&&(s="w");const i=n===void 0?"":`(${n})`;return this.url.searchParams.append(t,`${s}fts${i}.${e}`),this}match(t){return Object.entries(t).filter(([e,n])=>
71n!==void 0).forEach(([e,n])=>{this.url.searchParams.append(e,`eq.${n}`)}),this}not(t,e,n){return this.url.searchParams.append(t,`not.${e}.${n}`),this}or(t,{foreignTable:e,referencedTable:n=e}={}){const r=n?`${n}.or`:"or";return this.url.searchParams.append(r,`(${t})`),this}filter(t,e,n){return this.url.searchParams.append(t,`${e}.${n}`),this}},zDe=class{constructor(t,{headers:e={},schema:n,fetch:r,urlLengthLimit:s=8e3,retry:i}){this.url=t,this.headers=new Headers(e),this.schema=n,this.fetch=r,this.urlLengthLimit=s,this.retry=i}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(t,e){const{head:n=!1,count:r}=e??{},s=n?"HEAD":"GET";let i=!1;const o=(t??"*").split("").map(u=>/\s/.test(u)&&!i?"":(u==='"'&&(i=!i),u)).join(""),{url:l,headers:c}=this.cloneRequestState();return l.searchParams.set("select",o),r&&c.append("Prefer",`count=${r}`),new Nb({method:s,url:l,headers:c,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(t,{count:e,defaultToNull:n=!0}={}){var r;const s="POST",{url:i,headers:o}=this.cloneRequestState();if(e&&o.append("Prefer",`count=${e}`),n||o.append("Prefer","missing=default"),Array.isArray(t)){const l=t.reduce((c,u)=>c.concat(Object.keys(u)),[]);if(l.length>0){const c=[...new Set(l)].map(u=>`"${u}"`);i.searchParams.set("columns",c.join(","))}}return new Nb({method:s,url:i,headers:o,schema:this.schema,body:t,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(t,{onConflict:e,ignoreDuplicates:n=!1,count:r,defaultToNull:s=!0}={}){var i;const o="POST",{url:l,headers:c}=this.cloneRequestState();if(c.append("Prefer",`resolution=${n?"ignore":"merge"}-duplicates`),e!==void 0&&l.searchParams.set("on_conflict",e),r&&c.append("Prefer",`count=${r}`),s||c.append("Prefer","missing=default"),Array.isArray(t)){const u=t.reduce((d,h)=>d.concat(Object.keys(h)),[]);if(u.length>0){const d=[...new Set(u)].map(h=>`"${h}"`);l.searchParams.set("columns",d.join(","))}}return new Nb({method:o,url:l,headers:c,schema:this.schema,body:t,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(t,{count:e}={}){var n;const r="PATCH",{url:s,headers:i}=this.cloneRequestState();return e&&i.append("Prefer",`count=${e}`),new Nb({method:r,url:s,headers:i,schema:this.schema,body:t,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:t}={}){var e;const n="DELETE",{url:r,headers:s}=this.cloneRequestState();return t&&s.append("Prefer",`count=${t}`),new Nb({method:n,url:r,headers:s,schema:this.schema,fetch:(e=this.fetch)!==null&&e!==void 0?e:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function rk(t){"@babel/helpers - typeof";return rk=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},rk(t)}function BDe(t,e){if(rk(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(rk(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function UDe(t){var e=BDe(t,"string");return rk(e)=="symbol"?e:e+""}function qDe(t,e,n){return(e=UDe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ZJ(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function IT(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ZJ(Object(n),!0).forEach(function(r){qDe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ZJ(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}var VDe=class Phe{constructor(e,{headers:n={},schema:r,fetch:s,timeout:i,urlLengthLimit:o=8e3,retry:l}={}){this.url=e,this.headers=new Headers(n),this.schemaName=r,this.urlLengthLimit=o;const c=s??globalThis.fetch;i!==void 0&&i>0?this.fetch=(u,d)=>{const h=new AbortController,f=setTimeout(()=>h.abort(),i),p=d==null?void 0:d.signal;if(p){if(p.aborted)return clearTimeout(f),c(u,d);const m=()=>{clearTimeout(f),h.abort()};return p.addEventListener("abort",m,{once:!0}),c(u,IT(IT({},d),{},{signal:h.signal})).finally(()=>{clearTimeout(f),p.removeEventListener("abort",m)})}return c(u,IT(IT({},d),{},{signal:h.signal})).finally(()=>clearTimeout(f))}:this.fetch=c,this.retry=l}from(e){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new zDe(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(e){return new Phe(this.url,{headers:this.headers,schema:e,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(e,n={},{head:r=!1,get:s=!1,count:i}={}){var o;let l;const c=new URL(`${this.url}/rpc/${e}`);let u;const d=p=>p!==null&&typeof p=="object"&&(!Array.isArray(p)||p.some(d)),h=r&&Object.values(n).some(d);h?(l="POST",u=n):r||s?(l=r?"HEAD":"GET",Object.entries(n).filter(([p,m])=>m!==void 0).map(([p,m])=>[p,Array.isArray(m)?`{${m.join(",")}}`:`${m}
71`]).forEach(([p,m])=>{c.searchParams.append(p,m)})):(l="POST",u=n);const f=new Headers(this.headers);return h?f.set("Prefer",i?`count=${i},return=minimal`:"return=minimal"):i&&f.set("Prefer",`count=${i}`),new Nb({method:l,url:c,headers:f,schema:this.schemaName,body:u,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};class HDe{constructor(){}static detectEnvironment(){var e;if(typeof WebSocket<"u")return{type:"native",wsConstructor:WebSocket};const n=globalThis;if(typeof globalThis<"u"&&typeof n.WebSocket<"u")return{type:"native",wsConstructor:n.WebSocket};const r=typeof global<"u"?global:void 0;if(r&&typeof r.WebSocket<"u")return{type:"native",wsConstructor:r.WebSocket};if(typeof globalThis<"u"&&typeof n.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"&&n.EdgeRuntime||typeof navigator<"u"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.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."};const s=globalThis.process;if(s){const i=s.versions;if(i&&i.node){const o=i.node,l=parseInt(o.replace(/^v/,"").split(".")[0]);return l>=22?typeof globalThis.WebSocket<"u"?{type:"native",wsConstructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${l} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${l} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option: 72import ws from "ws" 73new 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 e=this.detectEnvironment();if(e.wsConstructor)return e.wsConstructor;let n=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(n+=` 74 75Suggested solution: ${e.workaround}`),new Error(n)}static isWebSocketSupported(){try{const e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}}const WDe="2.108.2",KDe=`realtime-js/${WDe}`,GDe="1.0.0",Mhe="2.0.0",YDe=Mhe,XDe=1e4,JDe=100,Qp={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Rhe={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave",access_token:"access_token"},A6={connecting:"connecting",open:"open",closing:"closing",closed:"closed"};class QDe{constructor(e){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=e??[]}encode(e,n){if(e.event===this.BROADCAST_EVENT&&!(e.payload instanceof ArrayBuffer)&&typeof e.payload.event=="string")return n(this._binaryEncodeUserBroadcastPush(e));let r=[e.join_ref,e.ref,e.topic,e.event,e.payload];return n(JSON.stringify(r))}_binaryEncodeUserBroadcastPush(e){var n;return this._isArrayBuffer((n=e.payload)===null||n===void 0?void 0:n.payload)?this._encodeBinaryUserBroadcastPush(e):this._encodeJsonUserBroadcastPush(e)}_encodeBinaryUserBroadcastPush(e){var n,r;const s=(r=(n=e.payload)===null||n===void 0?void 0:n.payload)!==null&&r!==void 0?r:new ArrayBuffer(0);return this._encodeUserBroadcastPush(e,this.BINARY_ENCODING,s)}_encodeJsonUserBroadcastPush(e){var n,r;const s=(r=(n=e.payload)===null||n===void 0?void 0:n.payload)!==null&&r!==void 0?r:{},o=new TextEncoder().encode(JSON.stringify(s)).buffer;return this._encodeUserBroadcastPush(e,this.JSON_ENCODING,o)}_encodeUserBroadcastPush(e,n,r){var s,i;const o=e.topic,l=(s=e.ref)!==null&&s!==void 0?s:"",c=(i=e.join_ref)!==null&&i!==void 0?i:"",u=e.payload.event,d=this.allowedMetadataKeys?this._pick(e.payload,this.allowedMetadataKeys):{},h=Object.keys(d).length===0?"":JSON.stringify(d);if(c.length>255)throw new Error(`joinRef length ${c.length} exceeds maximum of 255`);if(l.length>255)throw new Error(`ref length ${l.length} exceeds maximum of 255`);if(o.length>255)throw new Error(`topic length ${o.length} exceeds maximum of 255`);if(u.length>255)throw new Error(`userEvent length ${u.length} exceeds maximum of 255`);if(h.length>255)throw new Error(`metadata length ${h.length} exceeds maximum of 255`);const f=this.USER_BROADCAST_PUSH_META_LENGTH+c.length+l.length+o.length+u.length+h.length,p=new ArrayBuffer(this.HEADER_LENGTH+f);let m=new DataView(p),v=0;m.setUint8(v++,this.KINDS.userBroadcastPush),m.setUint8(v++,c.length),m.setUint8(v++,l.length),m.setUint8(v++,o.length),m.setUint8(v++,u.length),m.setUint8(v++,h.length),m.setUint8(v++,n),Array.from(c,g=>m.setUint8(v++,g.charCodeAt(0))),Array.from(l,g=>m.setUint8(v++,g.charCodeAt(0))),Array.from(o,g=>m.setUint8(v++,g.charCodeAt(0))),Array.from(u,g=>m.setUint8(v++,g.charCodeAt(0))),Array.from(h,g=>m.setUint8(v++,g.charCodeAt(0)));var x=new Uint8Array(p.byteLength+r.byteLength);return x.set(new Uint8Array(p),0),x.set(new Uint8Array(r),p.byteLength),x.buffer}decode(e,n){if(this._isArrayBuffer(e)){let r=this._binaryDecode(e);return n(r)}if(typeof e=="string"){const r=JSON.parse(e),[s,i,o,l,c]=r;
75return n({join_ref:s,ref:i,topic:o,event:l,payload:c})}return n({})}_binaryDecode(e){const n=new DataView(e),r=n.getUint8(0),s=new TextDecoder;switch(r){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(e,n,s)}}_decodeUserBroadcast(e,n,r){const s=n.getUint8(1),i=n.getUint8(2),o=n.getUint8(3),l=n.getUint8(4);let c=this.HEADER_LENGTH+4;const u=r.decode(e.slice(c,c+s));c=c+s;const d=r.decode(e.slice(c,c+i));c=c+i;const h=r.decode(e.slice(c,c+o));c=c+o;const f=e.slice(c,e.byteLength),p=l===this.JSON_ENCODING?JSON.parse(r.decode(f)):f,m={type:this.BROADCAST_EVENT,event:d,payload:p};return o>0&&(m.meta=JSON.parse(h)),{join_ref:null,ref:null,topic:u,event:this.BROADCAST_EVENT,payload:m}}_isArrayBuffer(e){var n;return e instanceof ArrayBuffer||((n=e==null?void 0:e.constructor)===null||n===void 0?void 0:n.name)==="ArrayBuffer"}_pick(e,n){return!e||typeof e!="object"?{}:Object.fromEntries(Object.entries(e).filter(([r])=>n.includes(r)))}}var sr;(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(sr||(sr={}));const eQ=(t,e,n={})=>{var r;const s=(r=n.skipTypes)!==null&&r!==void 0?r:[];return e?Object.keys(e).reduce((i,o)=>(i[o]=ZDe(o,t,e,s),i),{}):{}},ZDe=(t,e,n,r)=>{const s=e.find(l=>
vendor: 4,699 bytes, line 75
75l.name===t),i=s==null?void 0:s.type,o=n[t];return i&&!r.includes(i)?Ohe(i,o):E6(o)},Ohe=(t,e)=>{if(t.charAt(0)==="_"){const n=t.slice(1,t.length);return rLe(e,n)}switch(t){case sr.bool:return eLe(e);case sr.float4:case sr.float8:case sr.int2:case sr.int4:case sr.int8:case sr.numeric:case sr.oid:return tLe(e);case sr.json:case sr.jsonb:return nLe(e);case sr.timestamp:return sLe(e);case sr.abstime:case sr.date:case sr.daterange:case sr.int4range:case sr.int8range:case sr.money:case sr.reltime:case sr.text:case sr.time:case sr.timestamptz:case sr.timetz:case sr.tsrange:case sr.tstzrange:return E6(e);default:return E6(e)}},E6=t=>t,eLe=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},tLe=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},nLe=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t},rLe=(t,e)=>{if(typeof t!="string")return t;const n=t.length-1,r=t[n];if(t[0]==="{"&&r==="}"){let i;const o=t.slice(1,n);try{i=JSON.parse("["+o+"]")}catch{i=o?o.split(","):[]}return i.map(l=>Ohe(e,l))}return t},sLe=t=>typeof t=="string"?t.replace(" ","T"):t,Ihe=t=>{const e=new URL(t);return e.protocol=e.protocol.replace(/^ws/i,"http"),e.pathname=e.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),e.pathname===""||e.pathname==="/"?e.pathname="/api/broadcast":e.pathname=e.pathname+"/api/broadcast",e.href};var oC=t=>typeof t=="function"?t:function(){return t},iLe=typeof self<"u"?self:null,Cb=typeof window<"u"?window:null,cd=iLe||Cb||globalThis,aLe="2.0.0",oLe=1e4,lLe=1e3,Dd={connecting:0,open:1,closing:2,closed:3},_o={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Uh={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},T6={longpoll:"longpoll",websocket:"websocket"},cLe={complete:4},P6="base64url.bearer.phx.",DT=class{constructor(t,e,n,r){this.channel=t,this.event=e,this.payload=n||function(){return{}},this.receivedResp=null,this.timeout=r,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(t){this.timeout=t,this.reset(),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()}))}receive(t,e){return this.hasReceived(t)&&e(this.receivedResp.response),this.recHooks.push({status:t,callback:e}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:t,response:e,_ref:n}){this.recHooks.filter(r=>r.status===t).forEach(r=>r.callback(e))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,t=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=t,this.matchReceive(t)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(t){return this.receivedResp&&this.receivedResp.status===t}trigger(t,e){this.channel.trigger(this.refEvent,{status:t,response:e})}},Dhe=class{constructor(t,e){this.callback=t,this.timerCalc=e,this.timer=void 0,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},uLe=class{constructor(t,e,n){this.state=_o.closed,this.topic=t,this.params=oC(e||{}),this.socket=n,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new DT(this,Uh.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new Dhe(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=_o.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(r=>r.send()),this.pushBuffer=[]}),this.joinPush.receive("error",r=>{this.state=_o.errored,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,r),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}
75`),this.state=_o.closed,this.socket.remove(this)}),this.onError(r=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,r),this.isJoining()&&this.joinPush.reset(),this.state=_o.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),new DT(this,Uh.leave,oC({}),this.timeout).send(),this.state=_o.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(Uh.reply,(r,s)=>{this.trigger(this.replyEventName(s),r)})}join(t=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=t,this.joinedOnce=!0,this.rejoin(),this.joinPush}teardown(){this.pushBuffer.forEach(t=>t.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=_o.closed,this.bindings=[]}onClose(t){this.on(Uh.close,t)}onError(t){return this.on(Uh.error,e=>t(e))}on(t,e){let n=this.bindingRef++;return this.bindings.push({event:t,ref:n,callback:e}),n}off(t,e){this.bindings=this.bindings.filter(n=>!(n.event===t&&(typeof e>"u"||e===n.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(t,e,n=this.timeout){if(e=e||{},!this.joinedOnce)throw new Error(`tried to push '${t}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let r=new DT(this,t,function(){return e},n);return this.canPush()?r.send():(r.startTimeout(),this.pushBuffer.push(r)),r}leave(t=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=_o.leaving;let e=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(Uh.close,"leave")},n=new DT(this,Uh.leave,oC({}),t);return n.receive("ok",()=>e()).receive("timeout",()=>e()),n.send(),this.canPush()||n.trigger("ok",{}),n}onMessage(t,e,n){return e}filterBindings(t,e,n){return!0}isMember(t,e,n,r){return this.topic!==t?!1:r&&r!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:t,event:e,payload:n,joinRef:r}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(t=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=_o.joining,this.joinPush.resend(t))}trigger(t,e,n,r){let s=this.onMessage(t,e,n,r);if(e&&!s)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let i=this.bindings.filter(o=>o.event===t&&this.filterBindings(o,e,n));for(let o=0;o<i.length;o++)i[o].callback(s,n,r||this.joinRef())}replyEventName(t){return`chan_reply_${t}`}isClosed(){return this.state===_o.closed}isErrored(){return this.state===_o.errored}isJoined(){return this.state===_o.joined}isJoining(){return this.state===_o.joining}isLeaving(){return this.state===_o.leaving}},wO=class{static request(t,e,n,r,s,i,o){if(cd.XDomainRequest){let l=new cd.XDomainRequest;return this.xdomainRequest(l,t,e,r,s,i,o)}else if(cd.XMLHttpRequest){let l=new cd.XMLHttpRequest;return this.xhrRequest(l,t,e,n,r,s,i,o)}else{if(cd.fetch&&cd.AbortController)return this.fetchRequest(t,e,n,r,s,i,o);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(t,e,n,r,s,i,o){let l={method:t,headers:n,body:r},c=null;return s&&(c=new AbortController,setTimeout(()=>c.abort(),s),l.signal=c.signal),cd.fetch(e,l).then(u=>u.text()).then(u=>this.parseJSON(u)).then(u=>o&&o(u)).catch(u=>{u.name==="AbortError"&&i?i():o&&o(null)}),c}static xdomainRequest(t,e,n,r,s,i,o){return t.timeout=s,t.open(e,n),t.onload=()=>{let l=this.parseJSON(t.responseText);o&&o(l)},i&&(t.ontimeout=i),t.onprogress=()=>{},t.send(r),t}static xhrRequest(t,e,n,r,s,i,o,l){t.open(e,n,!0),t.timeout=i;for(let[c,u]of Object.entries(r))t.setRequestHeader(c,u);return t.onerror=()=>l&&l(null),t.onreadystatechange=()=>{if(t.readyState===cLe.complete&&l){let c=this.parseJSON(t.responseText);l(c)}},o&&(t.ontimeout=o),t.send(s),t}static parseJSON(t){if(!t||t==="")return null;try{return JSON.parse(t)}catch{return console&&console.log("failed to parse JSON response",t),null}}static serialize(t,e){let n=[];for(var r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;let s=e?`${e}[${r}]`:r,i=t[r];typeof i=="object"?n.push(this.serialize(i,s)):n.push(encodeURIComponent(s)+"="+encodeURIComponent(i))}return n.join("&")}static appendParams(t,e){if(Object.keys(e).length===0)return t;let n=t.match(/\?/)?"&":"?";return`${t}${n}${this.serialize(e)}`}},dLe=t=>{let e="",n=new Uint8Array(t),r=n.byteLength;for(let s=0;s<r;s++)e+=String.fromCharCode(n[s]);return btoa(e)},Q0=class{constructor(t,e){e&&e.length===2&&e[1].startsWith(P6)&&(this.authToken=atob(e[1].slice(P6.length))),this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){}
vendor: 14,104 bytes, lines 75-76
75,this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(t),this.readyState=Dd.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(t){return t.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+T6.websocket),"$1/"+T6.longpoll)}endpointURL(){return wO.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(t,e,n){this.close(t,e,n),this.readyState=Dd.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===Dd.open||this.readyState===Dd.connecting}poll(){const t={Accept:"application/json"};this.authToken&&(t["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",t,null,()=>this.ontimeout(),e=>{if(e){var{status:n,token:r,messages:s}=e;if(n===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,"session_gone",!1);return}this.token=r}else n=0;switch(n){case 200:s.forEach(i=>{setTimeout(()=>this.onmessage({data:i}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=Dd.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${n}`)}})}send(t){typeof t!="string"&&(t=dLe(t)),this.currentBatch?this.currentBatch.push(t):this.awaitingBatchAck?this.batchBuffer.push(t):(this.currentBatch=[t],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(t){this.awaitingBatchAck=!0,this.ajax("POST",{"Content-Type":"application/x-ndjson"},t.join(` 76`),()=>this.onerror("timeout"),e=>{this.awaitingBatchAck=!1,!e||e.status!==200?(this.onerror(e&&e.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(t,e,n){for(let s of this.reqs)s.abort();this.readyState=Dd.closed;let r=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:t,reason:e,wasClean:n});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",r)):this.onclose(r)}ajax(t,e,n,r,s){let i,o=()=>{this.reqs.delete(i),r()};i=wO.request(t,this.endpointURL(),e,n,this.timeout,o,l=>{this.reqs.delete(i),this.isActive()&&s(l)}),this.reqs.add(i)}},hLe=class tN{constructor(e,n={}){let r=n.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=e,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(r.state,s=>{let{onJoin:i,onLeave:o,onSync:l}=this.caller;this.joinRef=this.channel.joinRef(),this.state=tN.syncState(this.state,s,i,o),this.pendingDiffs.forEach(c=>{this.state=tN.syncDiff(this.state,c,i,o)}),this.pendingDiffs=[],l()}),this.channel.on(r.diff,s=>{let{onJoin:i,onLeave:o,onSync:l}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(s):(this.state=tN.syncDiff(this.state,s,i,o),l())})}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}list(e){return tN.list(this.state,e)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(e,n,r,s){let i=this.clone(e),o={},l={};return this.map(i,(c,u)=>{n[c]||(l[c]=u)}),this.map(n,(c,u)=>{let d=i[c];if(d){let h=u.metas.map(v=>v.phx_ref),f=d.metas.map(v=>v.phx_ref),p=u.metas.filter(v=>f.indexOf(v.phx_ref)<0),m=d.metas.filter(v=>h.indexOf(v.phx_ref)<0);p.length>0&&(o[c]=u,o[c].metas=p),m.length>0&&(l[c]=this.clone(d),l[c].metas=m)}else o[c]=u}),this.syncDiff(i,{joins:o,leaves:l},r,s)}static syncDiff(e,n,r,s){let{joins:i,leaves:o}=this.clone(n);return r||(r=function(){}),s||(s=function(){}),this.map(i,(l,c)=>{let u=e[l];if(e[l]=this.clone(c),u){let d=e[l].metas.map(f=>f.phx_ref),h=u.metas.filter(f=>d.indexOf(f.phx_ref)<0);e[l].metas.unshift(...h)}r(l,u,c)}),this.map(o,(l,c)=>{let u=e[l];if(!u)return;let d=c.metas.map(h=>h.phx_ref);u.metas=u.metas.filter(h=>d.indexOf(h.phx_ref)<0),s(l,u,c),u.metas.length===0&&delete e[l]}),e}static list(e,n){return n||(n=function(r,s){return s}),this.map(e,(r,s)=>n(r,s))}static map(e,n){return Object.getOwnPropertyNames(e).map(r=>n(r,e[r]))}static clone(e){return JSON.parse(JSON.stringify(e))}},LT={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(t,e){if(t.payload.constructor===ArrayBuffer)return e(this.binaryEncode(t));{let n=[t.join_ref,t.ref,t.topic,t.event,t.payload];return e(JSON.stringify(n))}},decode(t,e){if(t.constructor===ArrayBuffer)return e(this.binaryDecode(t));{let[n,r,s,i,o]=JSON.parse(t);return e({join_ref:n,ref:r,topic:s,event:i,payload:o})}},binaryEncode(t){let{join_ref:e,ref:n,event:r,topic:s,payload:i}=t,o=this.META_LENGTH+e.length+n.length+s.length+r.length,l=new ArrayBuffer(this.HEADER_LENGTH+o),c=new DataView(l),u=0;c.setUint8(u++,this.KINDS.push),c.setUint8(u++,e.length),c.setUint8(u++,n.length),c.setUint8(u++,s.length),c.setUint8(u++,r.length),Array.from(e,h=>c.setUint8(u++,h.charCodeAt(0))),Array.from(n,h=>c.setUint8(u++,h.charCodeAt(0))),Array.from(s,h=>c.setUint8(u++,h.charCodeAt(0))),Array.from(r,h=>c.setUint8(u++,h.charCodeAt(0)));var d=new Uint8Array(l.byteLength+i.byteLength);return d.set(new Uint8Array(l),0),d.set(new Uint8Array(i),l.byteLength),d.buffer},binaryDecode(t){let e=new DataView(t),n=e.getUint8(0),r=new TextDecoder;switch(n){case this.KINDS.push:return this.decodePush(t,e,r);case this.KINDS.reply:return this.decodeReply(t,e,r);case this.KINDS.broadcast:return this.decodeBroadcast(t,e,r)}},decodePush(t,e,n){let r=e.getUint8(1),s=e.getUint8(2),i=e.getUint8(3),o=this.HEADER_LENGTH+this.META_LENGTH-1,l=n.decode(t.slice(o,o+r));o=o+r;let c=n.decode(t.slice(o,o+s));o=o+s;let u=n.decode(t.slice(o,o+i));o=o+i;let d=t.slice(o,t.byteLength);return{join_ref:l,ref:null,topic:c,event:u,payload:d}},decodeReply(t,e,n){let r=e.getUint8(1),s=e.getUint8(2),i=e.getUint8(3),o=e.getUint8(4),l=this.HEADER_LENGTH+this.META_LENGTH,c=n.decode(t.slice(l,l+r));l=l+r;let u=n.decode(t.slice(l,l+s));l=l+s;let d=n.decode(t.slice(l,l+i));l=l+i;let h=n.decode(t.slice(l,l+o));l=l+o;let f=t.slice(l,t.byteLength),p={status:h,response:f};return{join_ref:c,ref:u,topic:d,event:Uh.reply,payload:p}},decodeBroadcast(t,e,n){let r=e.getUint8(1),s=e.getUint8(2),i=this.HEADER_LENGTH+2,o=n.decode(t.slice(i,i+r));i=i+r;let l=n.decode(t.slice(i,i+s));i=i+s;let c=t.slice(i,t.byteLength);return{join_ref:null,ref:null,topic:o,event:l,payload:c}}},fLe=class{constructor(t,e={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=e.timeout||oLe,this.transport=e.transport||cd.WebSocket||Q0,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=e.longPollFallbackMs,this.fallbackTimer=null;let n=null;try{n=cd&&cd.sessionStorage}catch{}this.sessionStore=e.sessionStorage||n,this.establishedConnections=0,this.defaultEncoder=LT.encode.bind(LT),this.defaultDecoder=LT.decode.bind(LT),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=e.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport!==Q0?(this.encode=e.encode||this.defaultEncoder,this.decode=e.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let r=null;Cb&&Cb.addEventListener&&(Cb.addEventListener("pagehide",s=>{this.conn&&(this.disconnect(),r=this.connectClock)}),Cb.addEventListener("pageshow",s=>{r===this.connectClock&&(r=null,this.connect())}),Cb.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pageHidden=!0:(this.pageHidden=!1,!this.isConnected()&&!this.closeWasClean&&this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=e.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=e.autoSendHeartbeat??!0,this.heartbeatCallback=e.heartbeatCallback??(()=>{}),this.rejoinAfterMs=s=>e.rejoinAfterMs?e.rejoinAfterMs(s):[1e3,2e3,5e3][s-1]||1e4,this.reconnectAfterMs=s=>e.reconnectAfterMs?e.reconnectAfterMs(s):[10,50,100,150,200,250,500,1e3,2e3][s-1]||5e3,this.logger=e.logger||null,!this.logger&&e.debug&&(this.logger=(s,i,o)=>{console.log(`${s}: ${i}`,o)}),this.longpollerTimeout=e.longpollerTimeout||2e4,this.params=oC(e.params||{}),this.endPoint=`${t}/${T6.websocket}`,this.vsn=e.vsn||aLe,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new Dhe(()=>{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(async()=>{e.beforeReconnect&&await e.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=e.authToken}getLongPollTransport(){return Q0}replaceTransport(t){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=t}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let t=wO.appendParams(wO.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return t.charAt(0)!=="/"?t:t.charAt(1)==="/"?`${this.protocol()}:${t}`:`${this.protocol()}://${location.host}${t}`}disconnect(t,e,n){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,t&&t()},e,n)}connect(t){t&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=oC(t)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==Q0?this.connectWithFallback(Q0,this.longPollFallbackMs):this.transportConnect())}log(t,e,n){this.logger&&this.logger(t,e,n)}hasLogger(){return this.logger!==null}onOpen(t){let e=this.makeRef();return this.stateChangeCallbacks.open.push([e,t]),e}onClose(t){let e=this.makeRef();return this.stateChangeCallbacks.close.push([e,t]),e}onError(t){let e=this.makeRef();return this.stateChangeCallbacks.error.push([e,t]),e}onMessage(t){let e=this.makeRef();return this.stateChangeCallbacks.message.push([e,t]),e}onHeartbeat(t){this.heartbeatCallback=t}ping(t){if(!this.isConnected())return!1;let e=this.makeRef(),n=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:e});let r=this.onMessage(s=>{s.ref===e&&(this.off([r]),t(Date.now()-n))});return!0}transportName(t){switch(t){case Q0:return"LongPoll";default:return t.name}}transportConnect(){this.connectClock++,this.closeWasClean=!1;let t;this.authToken&&(t=["phoenix",`${P6}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),t),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=e=>this.onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this.onConnClose(e)}getSession(t){return this.sessionStore&&this.sessionStore.getItem(t)}storeSession(t,e){this.sessionStore&&this.sessionStore.setItem(t,e)}connectWithFallback(t,e=2500){clearTimeout(this.fallbackTimer);let n=!1,r=!0,s,i,o=this.transportName(t),l=c=>{this.log("transport",`falling back to ${o}...`,c),this.off([s,i]),r=!1,this.replaceTransport(t),this.transportConnect()};if(this.getSession(`phx:fallback:${o}`))return l("memorized");this.fallbackTimer=setTimeout(l,e),i=this.onError(c=>{this.log("transport","error",c),r&&!n&&(clearTimeout(this.fallbackTimer),l(c))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(n=!0,!r){let c=this.transportName(t);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${c}`,"true"),this.log("transport",`established ${c} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(l,e),this.ping(c=>{this.log("transport","connected to primary after",c),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.autoSendHeartbeat&&this.resetHeartbeat(),this.triggerStateCallbacks("open")}heartbeatTimeout(){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(t){this.log("error","error in heartbeat callback",t)}this.triggerChanError(new Error("heartbeat timeout")),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),lLe,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(t,e,n){if(!this.conn)return t&&t();const r=this.conn;this.waitForBufferDone(r,()=>{e?r.close(e,n||""):r.close(),this.waitForSocketClosed(r,()=>{this.conn===r&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),t&&t()})})}waitForBufferDone(t,e,n=1){if(n===5||!t.bufferedAmount){e();return}setTimeout(()=>{this.waitForBufferDone(t,e,n+1)},150*n)}waitForSocketClosed(t,e,n=1){if(n===5||t.readyState===Dd.closed){e();return}setTimeout(()=>{this.waitForSocketClosed(t,e,n+1)},150*n)}onConnClose(t){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log("transport","close",t),this.triggerChanError(t),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks("close",t)}onConnError(t){this.hasLogger()&&this.log("transport","error",t);let e=this.transport,n=this.establishedConnections;this.triggerStateCallbacks("error",t,e,n),(e===this.transport||n>0)&&this.triggerChanError(t)}
vendor: 4,170 bytes, line 76
76triggerChanError(t){this.channels.forEach(e=>{e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(Uh.error,t)})}connectionState(){switch(this.conn&&this.conn.readyState){case Dd.connecting:return"connecting";case Dd.open:return"open";case Dd.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(t){this.off(t.stateChangeRefs),this.channels=this.channels.filter(e=>e!==t)}off(t){for(let e in this.stateChangeCallbacks)this.stateChangeCallbacks[e]=this.stateChangeCallbacks[e].filter(([n])=>t.indexOf(n)===-1)}channel(t,e={}){let n=new uLe(t,e,this);return this.channels.push(n),n}push(t){if(this.hasLogger()){let{topic:e,event:n,payload:r,ref:s,join_ref:i}=t;this.log("push",`${e} ${n} (${i}, ${s})`,r)}this.isConnected()?this.encode(t,e=>this.conn.send(e)):this.sendBuffer.push(()=>this.encode(t,e=>this.conn.send(e)))}makeRef(){let t=this.ref+1;return t===this.ref?this.ref=0:this.ref=t,this.ref.toString()}sendHeartbeat(){if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(t){this.log("error","error in heartbeat callback",t)}return}if(this.pendingHeartbeatRef){this.heartbeatTimeout();return}this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(t){this.log("error","error in heartbeat callback",t)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(t=>t()),this.sendBuffer=[])}onConnMessage(t){this.decode(t.data,e=>{let{topic:n,event:r,payload:s,ref:i,join_ref:o}=e;if(i&&i===this.pendingHeartbeatRef){const l=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback(s.status==="ok"?"ok":"error",l)}catch(c){this.log("error","error in heartbeat callback",c)}this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.autoSendHeartbeat&&(this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}this.hasLogger()&&this.log("receive",`${s.status||""} ${n} ${r} ${i&&"("+i+")"||""}`.trim(),s);for(let l=0;l<this.channels.length;l++){const c=this.channels[l];c.isMember(n,r,s,o)&&c.trigger(r,s,i,o)}this.triggerStateCallbacks("message",e)})}triggerStateCallbacks(t,...e){try{this.stateChangeCallbacks[t].forEach(([n,r])=>{try{r(...e)}catch(s){this.log("error",`error in ${t} callback`,s)}})}catch(n){this.log("error",`error triggering ${t} callbacks`,n)}}leaveOpenTopic(t){let e=this.channels.find(n=>n.topic===t&&(n.isJoined()||n.isJoining()));e&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${t}"`),e.leave())}};class lC{constructor(e,n){const r=mLe(n);this.presence=new hLe(e.getChannel(),r),this.presence.onJoin((s,i,o)=>{const l=lC.onJoinPayload(s,i,o);e.getChannel().trigger("presence",l)}),this.presence.onLeave((s,i,o)=>{const l=lC.onLeavePayload(s,i,o);e.getChannel().trigger("presence",l)}),this.presence.onSync(()=>{e.getChannel().trigger("presence",{event:"sync"})})}get state(){return lC.transformState(this.presence.state)}static transformState(e){return e=pLe(e),Object.getOwnPropertyNames(e).reduce((n,r)=>{const s=e[r];return n[r]=PM(s),n},{})}static onJoinPayload(e,n,r){const s=tQ(n),i=PM(r);return{event:"join",key:e,currentPresences:s,newPresences:i}}static onLeavePayload(e,n,r){const s=tQ(n),i=PM(r);return{event:"leave",key:e,currentPresences:s,leftPresences:i}}}function PM(t){return t.metas.map(e=>(e.presence_ref=e.phx_ref,delete e.phx_ref,delete e.phx_ref_prev,e))}function pLe(t){return JSON.parse(JSON.stringify(t))}function mLe(t){return(t==null?void 0:t.events)&&{events:t.events}}function tQ(t){return t!=null&&t.metas?PM(t):[]}var nQ;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(nQ||(nQ={}));class gLe{get state(){return this.presenceAdapter.state}constructor(e,n){this.channel=e,this.presenceAdapter=new lC(this.channel.channelAdapter,n)}}function vLe(t){if(t instanceof Error)return t;if(typeof t=="string")return new Error(t);if(t&&typeof t=="object"){const e=t;
76if(typeof e.code=="number"){const n=typeof e.reason=="string"&&e.reason?` (${e.reason})`:"";return new Error(`socket closed: ${e.code}${n}`,{cause:t})}return new Error("channel error: transport failure",{cause:t})}return new Error("channel error: connection lost")}class xLe{constructor(e,n,r){const s=yLe(r);this.channel=e.getSocket().channel(n,s),this.socket=e}get state(){return this.channel.state}set state(e){this.channel.state=e}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(e,n){return this.channel.on(e,n)}off(e,n){this.channel.off(e,n)}subscribe(e){return this.channel.join(e)}unsubscribe(e){return this.channel.leave(e)}teardown(){this.channel.teardown()}onClose(e){this.channel.onClose(e)}onError(e){return this.channel.onError(e)}push(e,n,r){let s;try{s=this.channel.push(e,n,r)}catch{throw new Error(`tried to push '${e}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>JDe){const i=this.channel.pushBuffer.shift();i.cancelTimeout(),this.socket.log("channel",`discarded push due to buffer overflow: ${i.event}`,i.payload())}return s}updateJoinPayload(e){const n=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},n),e)}canPush(){return this.socket.isConnected()&&this.state===Qp.joined}isJoined(){return this.state===Qp.joined}isJoining(){return this.state===Qp.joining}isClosed(){return this.state===Qp.closed}isLeaving(){return this.state===Qp.leaving}updateFilterBindings(e){this.channel.filterBindings=e}updatePayloadTransform(e){this.channel.onMessage=e}getChannel(){return this.channel}}function yLe(t){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},t.config)}}var rQ;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(rQ||(rQ={}));var aw;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(aw||(aw={}));var qh;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(qh||(qh={}));class cC{get state(){return this.channelAdapter.state}set state(e){this.channelAdapter.state=e}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(e,n={config:{}},r){var s,i;if(this.topic=e,this.params=n,this.socket=r,this.bindings={},this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},n.config),this.channelAdapter=new xLe(this.socket.socketAdapter,e,this.params),this.presence=new gLe(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=Ihe(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(!((i=(s=this.params.config)===null||s===void 0?void 0:s.broadcast)===null||i===void 0)&&i.replay))throw new Error(`tried to use replay on public channel '${this.topic}'. It must be a private channel.`)}subscribe(e,n=this.timeout){var r,s,i;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:o,presence:l,private:c}}=this.params,u=(s=(r=this.bindings.postgres_changes)===null||r===void 0?void 0:r.map(p=>p.filter))!==null&&s!==void 0?s:[],d=!!this.bindings[aw.PRESENCE]&&this.bindings[aw.PRESENCE].length>0||((i=this.params.config.presence)===null||i===void 0?void 0:i.enabled)===!0,h={},f={broadcast:o,presence:Object.assign(Object.assign({},l),{enabled:d}),postgres_changes:u,private:c};this.socket.accessTokenValue&&(h.access_token=this.socket.accessTokenValue),this._onError(p=>{e==null||e(qh.CHANNEL_ERROR,vLe(p))}),this._onClose(()=>e==null?void 0:e(qh.CLOSED)),this.updateJoinPayload(Object.assign({config:f},h)),this._updateFilterMessage(),this.channelAdapter.subscribe(n).receive("ok",async({postgres_changes:p})=>{if(this.socket._isManualToken()||this.socket.setAuth(),p===void 0){e==null||e(qh.SUBSCRIBED);return}this._updatePostgresBindings(p,e)}).receive("error",p=>{this.state=Qp.errored;const m=Object.values(p).join(", ")||"error";e==null||e(qh.CHANNEL_ERROR,new Error(m,{cause:p}))}).receive("timeout",()=>{e==null||e(qh.TIMED_OUT)})}return this}_updatePostgresBindings(e,n){var r;const s=this.bindings.postgres_changes,i=(r=s==null?void 0:s.length)!==null&&r!==void 0?r:0,o=[];for(let l=0;l<i;l++){const c=s[l],{filter:{event:u,schema:d,table:h,filter:f}}=c,p=e&&e[l];if(p&&p.event===u&&cC.isFilterValueEqual(p.schema,d)&&cC.isFilterValueEqual(p.table,h)&&cC.isFilterValueEqual(p.filter,f))o.push(Object.assign(Object.assign({},c),{id:p.id}));else{this.unsubscribe(),this.state=Qp.errored,n==null||n(qh.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=o,this.state!=Qp.errored&&n&&n(qh.SUBSCRIBED)}presenceState(){return this.presence.state}async track(e,n={}){return await this.send({type:"presence",event:"track",payload:e},n.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,n,r){const s=this.channelAdapter.isJoined()||this.channelAdapter.isJoining(),i=e===aw.PRESENCE||e===aw.POSTGRES_CHANGES;if(s&&i)throw this.socket.log("channel",`cannot add \`${e}\` callbacks for ${this.topic} after \`subscribe()\`.`),new Error(`cannot add \`${e}\` callbacks for ${this.topic} after \`subscribe()\`.`);return this._on(e,n,r)}async httpSend(e,n,r={}){var s;if(n==null)return Promise.reject(new Error("Payload is required for httpSend()"));const i=n instanceof ArrayBuffer||ArrayBuffer.isView(n),o={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":i?"application/octet-stream":"application/json"};this.socket.accessTokenValue&&(o.Authorization=`Bearer ${this.socket.accessTokenValue}`);const l=new URL(this.broadcastEndpointURL);l.pathname+=`/${encodeURIComponent(this.subTopic)}/events/${encodeURIComponent(e)}`,this.private&&l.searchParams.set("private","true");const c={method:"POST",headers:o,body:i?n:JSON.stringify(n)},u=await this._fetchWithTimeout(l.toString(),c,(s=r.timeout)!==null&&s!==void 0?s:this.timeout);if(u.status===202)return{success:!0};if(u.status===404)return Promise.reject(new Error("httpSend() requires Realtime server v2.97.0 or newer; the endpoint returned 404. Update your Supabase CLI to a recent version, or upgrade the Realtime server in your self-hosted setup. See https://github.com/supabase/supabase-js/blob/master/packages/core/realt
76ime-js/migrations/httpsend-server-version.md"));let d=u.statusText;try{const h=await u.json();d=h.error||h.message||d}catch{}return Promise.reject(new Error(d))}async send(e,n={}){var r,s;if(!this.channelAdapter.canPush()&&e.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}=e,l={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(l.Authorization=`Bearer ${this.socket.accessTokenValue}`);const c={method:"POST",headers:l,body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:o,private:this.private}]})};try{const u=await this._fetchWithTimeout(this.broadcastEndpointURL,c,(r=n.timeout)!==null&&r!==void 0?r:this.timeout);return await((s=u.body)===null||s===void 0?void 0:s.cancel()),u.ok?"ok":"error"}catch(u){return u instanceof Error&&u.name==="AbortError"?"timed out":"error"}}else return new Promise(i=>{var o,l,c;const u=this.channelAdapter.push(e.type,e,n.timeout||this.timeout);e.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(e){this.channelAdapter.updateJoinPayload(e)}async unsubscribe(e=this.timeout){return new Promise(n=>{this.channelAdapter.unsubscribe(e).receive("ok",()=>n("ok")).receive("timeout",()=>n("timed out")).receive("error",()=>n("error"))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(e,n,r){const s=new AbortController,i=setTimeout(()=>s.abort(),r),o=await this.socket.fetch(e,Object.assign(Object.assign({},n),{signal:s.signal}));return clearTimeout(i),o}_on(e,n,r){const s=e.toLocaleLowerCase(),i=this.channelAdapter.on(e,r),o={type:s,filter:n,callback:r,ref:i};return this.bindings[s]?this.bindings[s].push(o):this.bindings[s]=[o],this._updateFilterMessage(),this}_onClose(e){this.channelAdapter.onClose(e)}_onError(e){this.channelAdapter.onError(e)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((e,n,r)=>{var s,i,o,l,c,u,d;const h=e.event.toLocaleLowerCase();if(this._notThisChannelEvent(h,r))return!1;const f=(s=this.bindings[h])===null||s===void 0?void 0:s.find(p=>p.ref===e.ref);if(!f)return!0;if(["broadcast","presence","postgres_changes"].includes(h))if("id"in f){const p=f.id,m=(i=f.filter)===null||i===void 0?void 0:i.event;return p&&((o=n.ids)===null||o===void 0?void 0:o.includes(p))&&(m==="*"||(m==null?void 0:m.toLocaleLowerCase())===((l=n.data)===null||l===void 0?void 0:l.type.toLocaleLowerCase()))}else{const p=(u=(c=f==null?void 0:f.filter)===null||c===void 0?void 0:c.event)===null||u===void 0?void 0:u.toLocaleLowerCase();return p==="*"||p===((d=n==null?void 0:n.event)===null||d===void 0?void 0:d.toLocaleLowerCase())}else return f.type.toLocaleLowerCase()===h})}_notThisChannelEvent(e,n){const{close:r,error:s,leave:i,join:o}=Rhe;return n&&[r,s,i,o].includes(e)&&n!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((e,n,r)=>{if(typeof n=="object"&&"ids"in n){const s=n.data,{schema:i,table:o,commit_timestamp:l,type:c,errors:u}=s;return Object.assign(Object.assign({},{schema:i,table:o,commit_timestamp:l,eventType:c,new:{},old:{},errors:u}),this._getPayloadRecords(s))}return n})}copyBindings(e){if(this.joinedOnce)throw new Error("cannot copy bindings into joined channel");for(const n in e.bindings)for(const r of e.bindings[n])this._on(r.type,r.filter,r.callback)}static isFilterValueEqual(e,n){return(e??void 0)===(n??void 0)}_getPayloadRecords(e){const n={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(n.new=eQ(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(n.old=eQ(e.columns,e.old_record)),n}}class bLe{constructor(e,n){this.socket=new fLe(e,n)}get timeout(){return this.socket.timeout}get endPoint(){return this.socket.endPoint}get transport(){return this.socket.transport}get heartbeatIntervalMs(){return this.socket.heartbeatIntervalMs}get heartbeatCallback(){return this.socket.heartbeatCallback}set heartbeatCallback(e){this.socket.heartbeatCallback=e}get heartbeatTimer(){return this.socket.heartbeatTimer}get pendingHeartbeatRef(){return this.socket.pendingHeartbeatRef}get reconnectTimer(){return this.socket.reconnectTimer}get vsn(){return this.socket.vsn}get encode(){return this.socket.encode}get decode(){return this.socket.decode}get reconnectAfterMs(){return this.socket.reconnectAfterMs}get sendBuffer(){return this.socket.sendBuffer}get stateChangeCallbacks(){return this.socket.stateChangeCallbacks}connect(){this.socket.connect()}disconnect(e,n,r,s=1e4){return new Promise(i=>{setTimeout(()=>i("timeout"),s),this.socket.disconnect(()=>{e(),i("ok")},n,r)})}push(e){this.socket.push(e)}log(e,n,r){this.socket.log(e,n,r)}makeRef(){return this.socket.makeRef()}onOpen(e){this.socket.onOpen(e)}onClose(e){this.socket.onClose(e)}onError(e){this.socket.onError(e)}onMessage(e){this.socket.onMessage(e)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==A6.connecting}isDisconnecting(){return this.socket.connectionState()==A6.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const sQ={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},wLe=[1e3,2e3,5e3,1e4],_Le=1e4;function jLe(){const t=new Map;return{get length(){return t.size},clear(){t.clear()},getItem(e){return t.has(e)?t.get(e):null},key(e){var n;return(n=Array.from(t.keys())[e])!==null&&n!==void 0?n:null},removeItem(e){t.delete(e)},setItem(e,n){t.set(e,String(n))}}}function SLe(){try{if(typeof globalThis<"u"&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return jLe()}const NLe=` 77 addEventListener("message", (e) => { 78 if (e.data.event === "start") { 79 setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval); 80 } 81 });`;class CLe{get endPoint(){return this.socketAdapter.endPoint}get timeout(){return this.socketAdapter.timeout}get transport(){return this.socketAdapter.transport}get heartbeatCallback(){return this.socketAdapter.heartbeatCallback}get heartbeatIntervalMs(){return this.socketAdapter.heartbeatIntervalMs}get heartbeatTimer(){return this.worker?this._workerHeartbeatTimer:this.socketAdapter.heartbeatTimer}get pendingHeartbeatRef(){return this.worker?this._pendingWorkerHeartbeatRef:this.socketAdapter.pendingHeartbeatRef}get reconnectTimer(){return this.socketAdapter.reconnectTimer}get vsn(){return this.socketAdapter.vsn}get encode(){return this.socketAdapter.encode}get decode(){return this.socketAdapter.decode}get reconnectAfterMs(){return this.socketAdapter.reconnectAfterMs}get sendBuffer(){return this.socketAdapter.sendBuffer}get stateChangeCallbacks(){return this.socketAdapter.stateChangeCallbacks}constructor(e,n){var r;if(this.channels=new Array,this.accessTokenValue=null,this.accessToken=null,this.apiKey=null,this.httpEndpoint="",this.headers={},this.params={}
81,this.ref=0,this.serializer=new QDe,this._manuallySetToken=!1,this._authPromise=null,this._workerHeartbeatTimer=void 0,this._pendingWorkerHeartbeatRef=null,this._pendingDisconnectTimer=null,this._disconnectOnEmptyChannelsAfterMs=0,this._resolveFetch=i=>i?(...o)=>i(...o):(...o)=>fetch(...o),!(!((r=n==null?void 0:n.params)===null||r===void 0)&&r.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=n.params.apikey;const s=this._initializeOptions(n);this.socketAdapter=new bLe(e,s),this.httpEndpoint=Ihe(e),this.fetch=this._resolveFetch(n==null?void 0:n.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.isConnected())){this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this._setupConnectionHandlers();try{this.socketAdapter.connect()}catch(e){const n=e.message;throw n.includes("Node.js")?new Error(`${n} 82 83To use Realtime in Node.js, you need to provide a WebSocket implementation: 84 85Option 1: Use Node.js 22+ which has native WebSocket support 86Option 2: Install and provide the "ws" package: 87 88 npm install ws 89 90 import ws from "ws" 91 const client = new RealtimeClient(url, { 92 ...options, 93 transport: ws 94 })`):new Error(`WebSocket not available: ${n}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(e,n){return this._cancelPendingDisconnect(),this.isDisconnecting()?"ok":await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},e,n)}getChannels(){return this.channels}async removeChannel(e){const n=await e.unsubscribe();return n==="ok"&&e.teardown(),n}async removeAllChannels(){const e=this.channels.map(async r=>{const s=await r.unsubscribe();return r.teardown(),s}),n=await Promise.all(e);return await this.disconnect(),n}log(e,n,r){this.socketAdapter.log(e,n,r)}connectionState(){return this.socketAdapter.connectionState()||A6.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(e,n={config:{}}){const r=`realtime:${e}`,s=this.getChannels().find(i=>i.topic===r);if(s)return s;{const i=new cC(`realtime:${e}`,n,this);return this._cancelPendingDisconnect(),this.channels.push(i),i}}push(e){this.socketAdapter.push(e)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(e){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(e)}_makeRef(){return this.socketAdapter.makeRef()}_remove(e){this.channels=this.channels.filter(n=>n.topic!==e.topic),this.channels.length===0&&(this.log("transport","no channels remaining, scheduling disconnect"),this._schedulePendingDisconnect())}_schedulePendingDisconnect(){if(this._cancelPendingDisconnect(),this._disconnectOnEmptyChannelsAfterMs===0){this.log("transport","disconnecting immediately - no channels"),this.disconnect();return}
94this._pendingDisconnectTimer=setTimeout(()=>{this._pendingDisconnectTimer=null,this.channels.length===0&&(this.log("transport","deferred disconnect fired - no channels, disconnecting"),this.disconnect())},this._disconnectOnEmptyChannelsAfterMs),this.log("transport",`deferred disconnect scheduled in ${this._disconnectOnEmptyChannelsAfterMs}ms`)}_cancelPendingDisconnect(){this._pendingDisconnectTimer!==null&&(this.log("transport","pending disconnect cancelled - channel activity detected"),clearTimeout(this._pendingDisconnectTimer),this._pendingDisconnectTimer=null)}async _performAuth(e=null){let n,r=!1;if(e)n=e,r=!0;else if(this.accessToken)try{n=await this.accessToken()}catch(s){this.log("error","Error fetching access token from callback",s),n=this.accessTokenValue}else n=this.accessTokenValue;r?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=n&&(this.accessTokenValue=n,this.channels.forEach(s=>{const i={access_token:n,version:KDe};n&&s.updateJoinPayload(i),s.joinedOnce&&s.channelAdapter.isJoined()&&s.channelAdapter.push(Rhe.access_token,{access_token:n})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(n=>{this.log("error",`Error setting auth in ${e}`,n)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(n=>{this.log("error","error waiting for auth on connect",n)}),this.worker&&!this.workerRef&&this._startWorkerHeartbeat()}),this.socketAdapter.onClose(()=>{this.worker&&this.workerRef&&this._terminateWorker()}),this.socketAdapter.onMessage(e=>{e.ref&&e.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(e){return(n,r)=>{n=="sent"&&this._setAuthSafely(),e&&e(n,r)}}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=n=>{this.log("worker","worker error",n.message),this._terminateWorker(),this.disconnect()},this.workerRef.onmessage=n=>{n.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_workerObjectUrl(e){let n;if(e)n=e;else{const r=new Blob([NLe],{type:"application/javascript"});n=URL.createObjectURL(r)}return n}_initializeOptions(e){var n,r,s,i,o,l,c,u,d,h,f,p;this.worker=(n=e==null?void 0:e.worker)!==null&&n!==void 0?n:!1,this.accessToken=(r=e==null?void 0:e.accessToken)!==null&&r!==void 0?r:null;const m={};m.timeout=(s=e==null?void 0:e.timeout)!==null&&s!==void 0?s:XDe,m.heartbeatIntervalMs=(i=e==null?void 0:e.heartbeatIntervalMs)!==null&&i!==void 0?i:sQ.HEARTBEAT_INTERVAL,this._disconnectOnEmptyChannelsAfterMs=(o=e==null?void 0:e.disconnectOnEmptyChannelsAfterMs)!==null&&o!==void 0?o:2*((l=e==null?void 0:e.heartbeatIntervalMs)!==null&&l!==void 0?l:sQ.HEARTBEAT_INTERVAL),m.transport=(c=e==null?void 0:e.transport)!==null&&c!==void 0?c:HDe.getWebSocketConstructor(),m.params=e==null?void 0:e.params,m.logger=e==null?void 0:e.logger,m.heartbeatCallback=this._wrapHeartbeatCallback(e==null?void 0:e.heartbeatCallback),m.sessionStorage=(u=e==null?void 0:e.sessionStorage)!==null&&u!==void 0?u:SLe(),m.reconnectAfterMs=(d=e==null?void 0:e.reconnectAfterMs)!==null&&d!==void 0?d:w=>wLe[w-1]||_Le;let v,x;const g=(h=e==null?void 0:e.vsn)!==null&&h!==void 0?h:YDe;switch(g){case GDe:v=(w,_)=>_(JSON.stringify(w)),x=(w,_)=>_(JSON.parse(w));break;case Mhe:v=this.serializer.encode.bind(this.serializer),x=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${m.vsn}`)}if(m.vsn=g,m.encode=(f=e==null?void 0:e.encode)!==null&&f!==void 0?f:v,m.decode=(p=e==null?void 0:e.decode)!==null&&p!==void 0?p:x,m.beforeReconnect=this._reconnectAuth.bind(this),(e!=null&&e.logLevel||e!=null&&e.log_level)&&(this.logLevel=e.logLevel||e.log_level,m.params=Object.assign(Object.assign({},m.params),{log_level:this.logLevel})),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e==null?void 0:e.workerUrl,m.autoSendHeartbeat=!this.worker}return m}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}
94var sk=class extends Error{constructor(t,e){var n;super(t),this.name="IcebergError",this.status=e.status,this.icebergType=e.icebergType,this.icebergCode=e.icebergCode,this.details=e.details,this.isCommitStateUnknown=e.icebergType==="CommitStateUnknownException"||[500,502,504].includes(e.status)&&((n=e.icebergType)==null?void 0:n.includes("CommitState"))===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function kLe(t,e,n){const r=new URL(e,t);if(n)for(const[s,i]of Object.entries(n))i!==void 0&&r.searchParams.set(s,i);return r.toString()}async function ALe(t){return!t||t.type==="none"?{}:t.type==="bearer"?{Authorization:`Bearer ${t.token}`}:t.type==="header"?{[t.name]:t.value}:t.type==="custom"?await t.getHeaders():{}}function ELe(t){const e=t.fetchImpl??globalThis.fetch;return{async request({method:n,path:r,query:s,body:i,headers:o}){const l=kLe(t.baseUrl,r,s),c=await ALe(t.auth),u=await e(l,{method:n,headers:{...i?{"Content-Type":"application/json"}:{},...c,...o},body:i?JSON.stringify(i):void 0}),d=await u.text(),h=(u.headers.get("content-type")||"").includes("application/json"),f=h&&d?JSON.parse(d):d;if(!u.ok){const p=h?f:void 0,m=p==null?void 0:p.error;throw new sk((m==null?void 0:m.message)??`Request failed with status ${u.status}`,{status:u.status,icebergType:m==null?void 0:m.type,icebergCode:m==null?void 0:m.code,details:p})}return{status:u.status,headers:u.headers,data:f}}}}function FT(t){return t.join("�")}var TLe=class{constructor(t,e=""){this.client=t,this.prefix=e}async listNamespaces(t){const e=t?{parent:FT(t.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:e})).data.namespaces.map(r=>({namespace:r}))}async createNamespace(t,e){const n={namespace:t.namespace,properties:e==null?void 0:e.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:n})).data}async dropNamespace(t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${FT(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${FT(t.namespace)}`})).data.properties}}async namespaceExists(t){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${FT(t.namespace)}`}),!0}catch(e){if(e instanceof sk&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(t,e){try{return await this.createNamespace(t,e)}catch(n){if(n instanceof sk&&n.status===409)return;throw n}}};function Z0(t){return t.join("�")}var PLe=class{constructor(t,e="",n){this.client=t,this.prefix=e,this.accessDelegation=n}async listTables(t){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Z0(t.namespace)}/tables`})).data.identifiers}async createTable(t,e){const n={};return this.accessDelegation&&(n["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Z0(t.namespace)}/tables`,body:e,headers:n})).data.metadata}async updateTable(t,e){const n=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Z0(t.namespace)}/tables/${t.name}`,body:e});return{"metadata-location":n.data["metadata-location"],metadata:n.data.metadata}}async dropTable(t,e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Z0(t.namespace)}/tables/${t.name}`,query:{purgeRequested:String((e==null?void 0:e.purge)??!1)}})}async loadTable(t){const e={};return this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Z0(t.namespace)}/tables/${t.name}`,headers:e})).data.metadata}async tableExists(t){const e={};this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Z0(t.namespace)}/tables/${t.name}`,headers:e}),!0}catch(n){if(n instanceof sk&&n.status===404)return!1;throw n}}async createTableIfNotExists(t,e){try{return await this.createTable(t,e)}catch(n){if(n instanceof sk&&n.status===409)return await this.loadTable({namespace:t.namespace,name:e.name});throw n}}},MLe=class{constructor(t){var r;let e="v1";t.catalogName&&(e+=`/${t.catalogName}`);const n=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=ELe({baseUrl:n,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=(r=t.accessDelegation)==null?void 0:r.join(","),this.namespaceOps=new TLe(this.client,e),this.tableOps=new PLe(this.client,e,this.accessDelegation)}async listNamespaces(t){return this.namespaceOps.listNamespaces(t)}async createNamespace(t,e){return this.namespaceOps.createNamespace(t,e)}async dropNamespace(t){await this.namespaceOps.dropNamespace(t)}async loadNamespaceMetadata(t){return this.namespaceOps.loadNamespaceMetadata(t)}async listTables(t){return this.tableOps.listTables(t)}
94async createTable(t,e){return this.tableOps.createTable(t,e)}async updateTable(t,e){return this.tableOps.updateTable(t,e)}async dropTable(t,e){await this.tableOps.dropTable(t,e)}async loadTable(t){return this.tableOps.loadTable(t)}async namespaceExists(t){return this.namespaceOps.namespaceExists(t)}async tableExists(t){return this.tableOps.tableExists(t)}async createNamespaceIfNotExists(t,e){return this.namespaceOps.createNamespaceIfNotExists(t,e)}async createTableIfNotExists(t,e){return this.tableOps.createTableIfNotExists(t,e)}};function ik(t){"@babel/helpers - typeof";return ik=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},ik(t)}function RLe(t,e){if(ik(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(ik(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function OLe(t){var e=RLe(t,"string");return ik(e)=="symbol"?e:e+""}function ILe(t,e,n){return(e=OLe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function iQ(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Pt(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?iQ(Object(n),!0).forEach(function(r){ILe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):iQ(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}var HL=class extends Error{constructor(t,e="storage",n,r){super(t),this.__isStorageError=!0,this.namespace=e,this.name=e==="vectors"?"StorageVectorsError":"StorageError",this.status=n,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};function WL(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var M6=class extends HL{constructor(t,e,n,r="storage"){super(t,r,e,n),this.name=r==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=e,this.statusCode=n}toJSON(){return Pt({},super.toJSON())}},Lhe=class extends HL{constructor(t,e,n="storage"){super(t,n),this.name=n==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=e}};function _O(t,e,n){const r=Pt({},t),s=e.toLowerCase();for(const i of Object.keys(r))i.toLowerCase()===s&&delete r[i];return r[s]=n,r}function DLe(t){const e={};for(const[n,r]of Object.entries(t))e[n.toLowerCase()]=r;return e}const LLe=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),FLe=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},R6=t=>{if(Array.isArray(t))return t.map(n=>R6(n));if(typeof t=="function"||t!==Object(t))return t;const e={};return Object.entries(t).forEach(([n,r])=>{const s=n.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));e[s]=R6(r)}),e},$Le=t=>!t||typeof t!="string"||t.length===0||t.length>100||t.trim()!==t||t.includes("/")||t.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(t),aQ=t=>{if(typeof t=="object"&&t!==null){const e=t;if(typeof e.msg=="string")return e.msg;if(typeof e.message=="string")return e.message;if(typeof e.error_description=="string")return e.error_description;if(typeof e.error=="string")return e.error;if(typeof e.error=="object"&&e.error!==null){const n=e.error;if(typeof n.message=="string")return n.message}}return JSON.stringify(t)},zLe=async(t,e,n,r)=>{if(t!==null&&typeof t=="object"&&"json"in t&&typeof t.json=="function"){const s=t;let i=parseInt(String(s.status),10);Number.isFinite(i)||(i=500),s.json().then(o=>{const l=(o==null?void 0:o.statusCode)||(o==null?void 0:o.code)||i+"";e(new M6(aQ(o),i,l,r))}).catch(()=>{const o=i+"";e(new M6(s.statusText||`HTTP ${i} error`,i,o,r))})}else e(new Lhe(aQ(t),t,r))},BLe=(t,e,n,r)=>{const s={method:t,headers:(e==null?void 0:e.headers)||{}};if(t==="GET"||t==="HEAD"||!r)return Pt(Pt({},s),n);if(FLe(r)){var i;const o=(e==null?void 0:e.headers)||{};let l;for(const[c,u]of Object.entries(o))c.toLowerCase()==="content-type"&&(l=u);s.headers=_O(o,"Content-Type",(i=l)!==null&&i!==void 0?i:"application/json"),s.body=JSON.stringify(r)}else s.body=r;return e!=null&&e.duplex&&(s.duplex=e.duplex),Pt(Pt({},s),n)};async function xS(t,e,n,r,s,i,o){return new Promise((l,c)=>
94{t(n,BLe(e,r,s,i)).then(u=>{if(!u.ok)throw u;if(r!=null&&r.noResolveJson)return u;if(o==="vectors"){const d=u.headers.get("content-type");if(u.headers.get("content-length")==="0"||u.status===204)return{};if(!d||!d.includes("application/json"))return{}}return u.json()}).then(u=>l(u)).catch(u=>zLe(u,c,r,o))})}function Fhe(t="storage"){return{get:async(e,n,r,s)=>xS(e,"GET",n,r,s,void 0,t),post:async(e,n,r,s,i)=>xS(e,"POST",n,s,i,r,t),put:async(e,n,r,s,i)=>xS(e,"PUT",n,s,i,r,t),head:async(e,n,r,s)=>xS(e,"HEAD",n,Pt(Pt({},r),{},{noResolveJson:!0}),s,void 0,t),remove:async(e,n,r,s,i)=>xS(e,"DELETE",n,s,i,r,t)}}const ULe=Fhe("storage"),{get:ak,post:tu,put:O6,head:qLe,remove:SW}=ULe,Sl=Fhe("vectors");var Nj=class{constructor(t,e={},n,r="storage"){this.shouldThrowOnError=!1,this.url=t,this.headers=DLe(e),this.fetch=LLe(n),this.namespace=r}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(t,e){return this.headers=_O(this.headers,t,e),this}async handleOperation(t){var e=this;try{return{data:await t(),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(WL(n))return{data:null,error:n};throw n}}};let $he;$he=Symbol.toStringTag;var VLe=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[$he]="StreamDownloadBuilder",this.promise=null}then(t,e){return this.getPromise().then(t,e)}catch(t){return this.getPromise().catch(t)}finally(t){return this.getPromise().finally(t)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var t=this;try{return{data:(await t.downloadFn()).body,error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(WL(e))return{data:null,error:e};throw e}}};let zhe;zhe=Symbol.toStringTag;var HLe=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[zhe]="BlobDownloadBuilder",this.promise=null}asStream(){return new VLe(this.downloadFn,this.shouldThrowOnError)}then(t,e){return this.getPromise().then(t,e)}catch(t){return this.getPromise().catch(t)}finally(t){return this.getPromise().finally(t)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var t=this;try{return{data:await(await t.downloadFn()).blob(),error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(WL(e))return{data:null,error:e};throw e}}};const WLe={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},oQ={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var KLe=class extends Nj{constructor(t,e={},n,r){super(t,e,r,"storage"),this.bucketId=n}async uploadOrUpdate(t,e,n,r){var s=this;return s.handleOperation(async()=>{let i;const o=Pt(Pt({},oQ),r);let l=Pt(Pt({},s.headers),t==="POST"&&{"x-upsert":String(o.upsert)});const c=o.metadata;if(typeof Blob<"u"&&n instanceof Blob?(i=new FormData,i.append("cacheControl",o.cacheControl),c&&i.append("metadata",s.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",s.encodeMetadata(c))):(i=n,l["cache-control"]=`max-age=${o.cacheControl}`,l["content-type"]=o.contentType,c&&(l["x-metadata"]=s.toBase64(s.encodeMetadata(c))),(typeof ReadableStream<"u"&&i instanceof ReadableStream||i&&typeof i=="object"&&"pipe"in i&&typeof i.pipe=="function")&&!o.duplex&&(o.duplex="half")),r!=null&&r.headers)for(const[f,p]of Object.entries(r.headers))l=_O(l,f,p);const u=s._removeEmptyFolders(e),d=s._getFinalPath(u),h=await(t=="PUT"?O6:tu)(s.fetch,`${s.url}/object/${d}`,i,Pt({headers:l},o!=null&&o.duplex?{duplex:o.duplex}:{}));return{path:u,id:h.Id,fullPath:h.Key}})}async upload(t,e,n){return this.uploadOrUpdate("POST",t,e,n)}async uploadToSignedUrl(t,e,n,r){var s=this;const i=s._removeEmptyFolders(t),o=s._getFinalPath(i),l=new URL(s.url+`/object/upload/sign/${o}`);return l.searchParams.set("token",e),s.handleOperation(async()=>{let c;const u=Pt(Pt({},oQ),r);let d=Pt(Pt({},s.headers),{"x-upsert":String(u.upsert)});const h=u.metadata;if(typeof Blob<"u"&&n instanceof Blob?(c=new FormData,c.append("cacheControl",u.cacheControl),h&&c.append("metadata",s.encodeMetadata(h)),c.append("",n)):typeof FormData<"u"&&n instanceof FormData?(c=n,c.has("cacheControl")||c.append("cacheControl",u.cacheControl),h&&!c.has("metadata")&&c.append("metadata",s.encodeMetadata(h))):(c=n,d["cache-control"]=`max-age=${u.cacheControl}`,d["content-type"]=u.contentType,h&&(d["x-metadata"]=s.toBase64(s.encodeMetadata(h))),(typeof ReadableStream<"u"&&c instanceof ReadableStream||c&&typeof c=="object"&&"pipe"in c&&typeof c.pipe=="function")&&!u.duplex&&(u.duplex="half")),r!=null&&r.headers)for(const[f,p]of Object.entries(r.headers))d=_O(d,f,p);return{path:i,fullPath:(await O6(s.fetch,l.toString(),c,Pt({headers:d},u!=null&&u.duplex?{duplex:u.duplex}:{}))).Key}})}async createSignedUploadUrl(t,e){var n=this;return n.handleOperation(async()=>{let r=n._getFinalPath(t);const s=Pt({},n.headers);e!=null&&e.upsert&&(s["x-upsert"]="true");const i=await tu(n.fetch,`${n.url}/object/upload/sign/${r}`,{},{headers:s}),o=new URL(n.url+i.url),l=o.searchParams.get("token");if(!l)throw new HL("No token returned by API");return{signedUrl:o.toString(),path:t,token:l}})}async update(t,e,n){return this.uploadOrUpdate("PUT",t,e,n)}async move(t,e,n){var r=this;return r.handleOperation(async()=>await tu(r.fetch,`${r.url}/object/move`,{bucketId:r.bucketId,sourceKey:t,destinationKey:e,destinationBucket:n==null?void 0:n.destinationBucket},{headers:r.headers}))}async copy(t,e,n){var r=this;return r.handleOperation(async()=>({path:(await tu(r.fetch,`${r.url}/object/copy`,{bucketId:r.bucketId,sourceKey:t,destinationKey:e,destinationBucket:n==null?void 0:n.destinationBucket},{headers:r.headers})).Key}))}async createSignedUrl(t,e,n){var r=this;return r.handleOperation(async()=>{let s=r._getFinalPath(t);const i=typeof(n==null?void 0:n.transform)=="object"&&n.transform!==null&&Object.keys(n.transform).length>0;let o=await tu(r.fetch,`${r.url}/object/sign/${s}
94`,Pt({expiresIn:e},i?{transform:n.transform}:{}),{headers:r.headers});const l=new URLSearchParams;n!=null&&n.download&&l.set("download",n.download===!0?"":n.download),(n==null?void 0:n.cacheNonce)!=null&&l.set("cacheNonce",String(n.cacheNonce));const c=l.toString();return{signedUrl:encodeURI(`${r.url}${o.signedURL}${c?`&${c}`:""}`)}})}async createSignedUrls(t,e,n){var r=this;return r.handleOperation(async()=>{const s=await tu(r.fetch,`${r.url}/object/sign/${r.bucketId}`,{expiresIn:e,paths:t},{headers:r.headers}),i=new URLSearchParams;n!=null&&n.download&&i.set("download",n.download===!0?"":n.download),(n==null?void 0:n.cacheNonce)!=null&&i.set("cacheNonce",String(n.cacheNonce));const o=i.toString();return s.map(l=>Pt(Pt({},l),{},{signedUrl:l.signedURL?encodeURI(`${r.url}${l.signedURL}${o?`&${o}`:""}`):null}))})}download(t,e,n){const r=typeof(e==null?void 0:e.transform)=="object"&&e.transform!==null&&Object.keys(e.transform).length>0?"render/image/authenticated":"object",s=new URLSearchParams;e!=null&&e.transform&&this.applyTransformOptsToQuery(s,e.transform),(e==null?void 0:e.cacheNonce)!=null&&s.set("cacheNonce",String(e.cacheNonce));const i=s.toString(),o=this._getFinalPath(t),l=()=>ak(this.fetch,`${this.url}/${r}/${o}${i?`?${i}`:""}`,{headers:this.headers,noResolveJson:!0},n);return new HLe(l,this.shouldThrowOnError)}async info(t){var e=this;const n=e._getFinalPath(t);return e.handleOperation(async()=>R6(await ak(e.fetch,`${e.url}/object/info/${n}`,{headers:e.headers})))}async exists(t){var e=this;const n=e._getFinalPath(t);try{return await qLe(e.fetch,`${e.url}/object/${n}`,{headers:e.headers}),{data:!0,error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(WL(s)){var r;const i=s instanceof M6?s.status:s instanceof Lhe?(r=s.originalError)===null||r===void 0?void 0:r.status:void 0;if(i!==void 0&&[400,404].includes(i))return{data:!1,error:s}}throw s}}getPublicUrl(t,e){const n=this._getFinalPath(t),r=new URLSearchParams;e!=null&&e.download&&r.set("download",e.download===!0?"":e.download),e!=null&&e.transform&&this.applyTransformOptsToQuery(r,e.transform),(e==null?void 0:e.cacheNonce)!=null&&r.set("cacheNonce",String(e.cacheNonce));const s=r.toString(),i=typeof(e==null?void 0:e.transform)=="object"&&e.transform!==null&&Object.keys(e.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${i}/public/${n}`)+(s?`?${s}`:"")}}}async remove(t){var e=this;return e.handleOperation(async()=>await SW(e.fetch,`${e.url}/object/${e.bucketId}`,{prefixes:t},{headers:e.headers}))}async list(t,e,n){var r=this;return r.handleOperation(async()=>{const s=Pt(Pt(Pt({},WLe),e),{},{prefix:t||""});return await tu(r.fetch,`${r.url}/object/list/${r.bucketId}`,s,{headers:r.headers},n)})}async listV2(t,e){var n=this;return n.handleOperation(async()=>{const r=Pt({},t);return await tu(n.fetch,`${n.url}/object/list-v2/${n.bucketId}`,r,{headers:n.headers},e)})}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,"/")}applyTransformOptsToQuery(t,e){return e.width&&t.set("width",e.width.toString()),e.height&&t.set("height",e.height.toString()),e.resize&&t.set("resize",e.resize),e.format&&t.set("format",e.format),e.quality&&t.set("quality",e.quality.toString()),t}};const GLe="2.108.2",JE={"X-Client-Info":`storage-js/${GLe}`};var YLe=class extends Nj{constructor(t,e={},n,r){const s=new URL(t);r!=null&&r.useNewHostname&&/supabase\.(co|in|red)$/.test(s.hostname)&&!s.hostname.includes("storage.supabase.")&&(s.hostname=s.hostname.replace("supabase.","storage.supabase."));const i=s.href.replace(/\/$/,""),o=Pt(Pt({},JE),e);super(i,o,n,"storage")}async listBuckets(t){var e=this;return e.handleOperation(async()=>{const n=e.listBucketOptionsToQueryString(t);return await ak(e.fetch,`${e.url}/bucket${n}`,{headers:e.headers})})}async getBucket(t){var e=this;return e.handleOperation(async()=>await ak(e.fetch,`${e.url}/bucket/${t}`,{headers:e.headers}))}async createBucket(t,e={public:!1}){var n=this;return n.handleOperation(async()=>await tu(n.fetch,`${n.url}/bucket`,{id:t,name:t,type:e.type,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:n.headers}))}async updateBucket(t,e){var n=this;return n.handleOperation(async()=>await O6(n.fetch,`${n.url}/bucket/${t}`,{id:t,name:t,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:n.headers}))}async emptyBucket(t){var e=this;return e.handleOperation(async()=>await tu(e.fetch,`${e.url}/bucket/${t}/empty`,{},{headers:e.headers}))}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await SW(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}))}listBucketOptionsToQueryString(t){const e={};return t&&("limit"in t&&(e.limit=String(t.limit)),"offset"in t&&(e.offset=String(t.offset)),t.search&&(e.search=t.search),t.sortColumn&&(e.sortColumn=t.sortColumn),t.sortOrder&&(e.sortOrder=t.sortOrder)),Object.keys(e).length>0?"?"+new URLSearchParams(e).toString():""}},XLe=class extends Nj{constructor(t,e={},n){const r=t.replace(/\/$/,""),s=Pt(Pt({},JE),e);super(r,s,n,"storage")}async createBucket(t){var e=this;return e.handleOperation(async()=>await tu(e.fetch,`${e.url}/bucket`,{name:t},{headers:e.headers}))}async listBuckets(t){var e=this;return e.handleOperation(async()=>{const n=new URLSearchParams;(t==null?void 0:t.limit)!==void 0&&n.set("limit",t.limit.toString()),(t==null?void 0:t.offset)!==void 0&&n.set("offset",t.offset.toString()),t!=null&&t.sortColumn&&n.set("sortColumn",t.sortColumn),t!=null&&t.sortOrder&&n.set("sortOrder",t.sortOrder),t!=null&&t.search&&n.set("search",t.search);const r=n.toString(),s=r?`${e.url}/bucket?${r}`:`${e.url}/bucket`;return await ak(e.fetch,s,{headers:e.headers})})}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await SW(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}))}from(t){var e=this;if(!$Le(t))throw new HL("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const n=new MLe({baseUrl:this.url,catalogName:t,auth:{type:"custom",getHeaders:async()=>e.headers},fetch:this.fetch}
94),r=this.shouldThrowOnError;return new Proxy(n,{get(s,i){const o=s[i];return typeof o!="function"?o:async(...l)=>{try{return{data:await o.apply(s,l),error:null}}catch(c){if(r)throw c;return{data:null,error:c}}}}})}},JLe=class extends Nj{constructor(t,e={},n){const r=t.replace(/\/$/,""),s=Pt(Pt({},JE),{},{"Content-Type":"application/json"},e);super(r,s,n,"vectors")}async createIndex(t){var e=this;return e.handleOperation(async()=>await Sl.post(e.fetch,`${e.url}/CreateIndex`,t,{headers:e.headers})||{})}async getIndex(t,e){var n=this;return n.handleOperation(async()=>await Sl.post(n.fetch,`${n.url}/GetIndex`,{vectorBucketName:t,indexName:e},{headers:n.headers}))}async listIndexes(t){var e=this;return e.handleOperation(async()=>await Sl.post(e.fetch,`${e.url}/ListIndexes`,t,{headers:e.headers}))}async deleteIndex(t,e){var n=this;return n.handleOperation(async()=>await Sl.post(n.fetch,`${n.url}/DeleteIndex`,{vectorBucketName:t,indexName:e},{headers:n.headers})||{})}},QLe=class extends Nj{constructor(t,e={},n){const r=t.replace(/\/$/,""),s=Pt(Pt({},JE),{},{"Content-Type":"application/json"},e);super(r,s,n,"vectors")}async putVectors(t){var e=this;if(t.vectors.length<1||t.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return e.handleOperation(async()=>await Sl.post(e.fetch,`${e.url}/PutVectors`,t,{headers:e.headers})||{})}async getVectors(t){var e=this;return e.handleOperation(async()=>await Sl.post(e.fetch,`${e.url}/GetVectors`,t,{headers:e.headers}))}async listVectors(t){var e=this;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 e.handleOperation(async()=>await Sl.post(e.fetch,`${e.url}/ListVectors`,t,{headers:e.headers}))}async queryVectors(t){var e=this;return e.handleOperation(async()=>await Sl.post(e.fetch,`${e.url}/QueryVectors`,t,{headers:e.headers}))}async deleteVectors(t){var e=this;if(t.keys.length<1||t.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return e.handleOperation(async()=>await Sl.post(e.fetch,`${e.url}/DeleteVectors`,t,{headers:e.headers})||{})}},ZLe=class extends Nj{constructor(t,e={},n){const r=t.replace(/\/$/,""),s=Pt(Pt({},JE),{},{"Content-Type":"application/json"},e);super(r,s,n,"vectors")}async createBucket(t){var e=this;return e.handleOperation(async()=>await Sl.post(e.fetch,`${e.url}/CreateVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{})}async getBucket(t){var e=this;return e.handleOperation(async()=>await Sl.post(e.fetch,`${e.url}/GetVectorBucket`,{vectorBucketName:t},{headers:e.headers}))}async listBuckets(t={}){var e=this;return e.handleOperation(async()=>await Sl.post(e.fetch,`${e.url}/ListVectorBuckets`,t,{headers:e.headers}))}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await Sl.post(e.fetch,`${e.url}/DeleteVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{})}},e3e=class extends ZLe{constructor(t,e={}){super(t,e.headers||{},e.fetch)}from(t){return new t3e(this.url,this.headers,t,this.fetch)}async createBucket(t){var e=()=>super.createBucket,n=this;return e().call(n,t)}async getBucket(t){var e=()=>super.getBucket,n=this;return e().call(n,t)}async listBuckets(t={}){var e=()=>super.listBuckets,n=this;return e().call(n,t)}async deleteBucket(t){var e=()=>super.deleteBucket,n=this;return e().call(n,t)}},t3e=class extends JLe{constructor(t,e,n,r){super(t,e,r),this.vectorBucketName=n}async createIndex(t){var e=()=>super.createIndex,n=this;return e().call(n,Pt(Pt({},t),{},{vectorBucketName:n.vectorBucketName}))}async listIndexes(t={}){var e=()=>super.listIndexes,n=this;return e().call(n,Pt(Pt({},t),{},{vectorBucketName:n.vectorBucketName}))}async getIndex(t){var e=()=>super.getIndex,n=this;return e().call(n,n.vectorBucketName,t)}async deleteIndex(t){var e=()=>super.deleteIndex,n=this;return e().call(n,n.vectorBucketName,t)}index(t){return new n3e(this.url,this.headers,this.vectorBucketName,t,this.fetch)}},n3e=class extends QLe{constructor(t,e,n,r,s){super(t,e,s),this.vectorBucketName=n,this.indexName=r}async putVectors(t){var e=()=>super.putVectors,n=this;return e().call(n,Pt(Pt({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async getVectors(t){var e=()=>super.getVectors,n=this;return e().call(n,Pt(Pt({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async listVectors(t={}){var e=()=>super.listVectors,n=this;return e().call(n,Pt(Pt({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async queryVectors(t){var e=()=>super.queryVectors,n=this;return e().call(n,Pt(Pt({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async deleteVectors(t){var e=()=>super.deleteVectors,n=this;return e().call(n,Pt(Pt({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}},r3e=class extends YLe{constructor(t,e={},n,r){super(t,e,n,r)}from(t){return new KLe(this.url,this.headers,t,this.fetch)}get vectors(){return new e3e(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new XLe(this.url+"/iceberg",this.headers,this.fetch)}};function KL(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(n[r[s]]=t[r[s]]);return n}const Bhe="2.108.2",Vh=30*1e3,nN=3,x$=nN*Vh,s3e=2*Vh,i3e="http://localhost:9999",a3e="supabase.auth.token",o3e={"X-Client-Info":`gotrue-js/${Bhe}`},I6="X-Supabase-Api-Version",Uhe={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},l3e=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,c3e=10*60*1e3;
94class ok extends Error{constructor(e,n,r){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=n,this.code=r}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}}function We(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}class u3e extends ok{constructor(e,n,r){super(e,n,r),this.name="AuthApiError",this.status=n,this.code=r}}function d3e(t){return We(t)&&t.name==="AuthApiError"}class yu extends ok{constructor(e,n){super(e),this.name="AuthUnknownError",this.originalError=n}}class bh extends ok{constructor(e,n,r,s){super(e,r,s),this.name=n,this.status=r}}class Zs extends bh{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function $T(t){return We(t)&&t.name==="AuthSessionMissingError"}class eb extends bh{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class zT extends bh{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class BT extends bh{constructor(e,n=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}function h3e(t){return We(t)&&t.name==="AuthImplicitGrantRedirectError"}class lQ extends bh{constructor(e,n=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class f3e extends bh{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.","AuthPKCECodeVerifierMissingError",400,"pkce_code_verifier_not_found")}}class D6 extends bh{constructor(e,n){super(e,"AuthRetryableFetchError",n,void 0)}}function cQ(t){return We(t)&&t.name==="AuthRetryableFetchError"}class uQ extends bh{constructor(e="Refresh result discarded: session state changed mid-flight (e.g., concurrent signOut)"){super(e,"AuthRefreshDiscardedError",409,void 0)}}function p3e(t){return We(t)&&t.name==="AuthRefreshDiscardedError"}class dQ extends bh{constructor(e,n,r){super(e,"AuthWeakPasswordError",n,"weak_password"),this.reasons=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class jO extends bh{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const SO="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),hQ=` 95\r=`.split(""),m3e=(()=>{const t=new Array(128);for(let e=0;e<t.length;e+=1)t[e]=-1;for(let e=0;e<hQ.length;e+=1)t[hQ[e].charCodeAt(0)]=-2;for(let e=0;e<SO.length;e+=1)t[SO[e].charCodeAt(0)]=e;return t})();function fQ(t,e,n){if(t!==null)for(e.queue=e.queue<<8|t,e.queuedBits+=8;e.queuedBits>=6;){const r=e.queue>>e.queuedBits-6&63;n(SO[r]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){const r=e.queue>>e.queuedBits-6&63;n(SO[r]),e.queuedBits-=6}}function qhe(t,e,n){const r=m3e[t];if(r>-1)for(e.queue=e.queue<<6|r,e.queuedBits+=6;e.queuedBits>=8;)n(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(r===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}}function pQ(t){const e=[],n=o=>{e.push(String.fromCodePoint(o))},r={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},i=o=>{x3e(o,r,n)};for(let o=0;o<t.length;o+=1)qhe(t.charCodeAt(o),s,i);return e.join("")}function g3e(t,e){if(t<=127){e(t);return}else if(t<=2047){e(192|t>>6),e(128|t&63);return}else if(t<=65535){e(224|t>>12),e(128|t>>6&63),e(128|t&63);return}else if(t<=1114111){e(240|t>>18),e(128|t>>12&63),e(128|t>>6&63),e(128|t&63);return}throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}function v3e(t,e){for(let n=0;n<t.length;n+=1){let r=t.charCodeAt(n);if(r>55295&&r<=56319){const s=(r-55296)*1024&65535;r=(t.charCodeAt(n+1)-56320&65535|s)+65536,n+=1}g3e(r,e)}}function x3e(t,e,n){if(e.utf8seq===0){if(t<=127){n(t);return}for(let r=1;r<6;r+=1)if(!(t>>7-r&1)){e.utf8seq=r;break}if(e.utf8seq===2)e.codepoint=t&31;else if(e.utf8seq===3)e.codepoint=t&15;else if(e.utf8seq===4)e.codepoint=t&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(t<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|t&63,e.utf8seq-=1,e.utf8seq===0&&n(e.codepoint)}}function Tw(t){const e=[],n={queue:0,queuedBits:0},r=s=>{e.push(s)};for(let s=0;s<t.length;s+=1)qhe(t.charCodeAt(s),n,r);return new Uint8Array(e)}function y3e(t){const e=[];return v3e(t,n=>e.push(n)),new Uint8Array(e)}function ex(t){const e=[],n={queue:0,queuedBits:0},r=s=>{e.push(s)};return t.forEach(s=>fQ(s,n,r)),fQ(null,n,r),e.join("")}function b3e(t){return Math.round(Date.now()/1e3)+t}function w3e(){return Symbol("auth-callback")}const oa=()=>typeof window<"u"&&typeof document<"u",gv={tested:!1,writable:!1},Vhe=()=>{if(!oa())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(gv.tested)return gv.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),gv.tested=!0,gv.writable=!0}catch{gv.tested=!0,gv.writable=!1}return gv.writable};function _3e(t){const e={},n=new URL(t);if(n.hash&&n.hash[0]==="#")try{new URLSearchParams(n.hash.substring(1)).forEac
95h((s,i)=>{e[i]=s})}catch{}return n.searchParams.forEach((r,s)=>{e[s]=r}),e}const Hhe=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),j3e=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",kb=async(t,e,n)=>{await t.setItem(e,JSON.stringify(n))},Vc=async(t,e)=>{const n=await t.getItem(e);if(!n)return null;try{return JSON.parse(n)}catch{return null}},us=async(t,e)=>{await t.removeItem(e)};class GL{constructor(){this.promise=new GL.promiseConstructor((e,n)=>{this.resolve=e,this.reject=n})}}GL.promiseConstructor=Promise;function UT(t){const e=t.split(".");if(e.length!==3)throw new jO("Invalid JWT structure");for(let r=0;r<e.length;r++)if(!l3e.test(e[r]))throw new jO("JWT not in base64url format");return{header:JSON.parse(pQ(e[0])),payload:JSON.parse(pQ(e[1])),signature:Tw(e[2]),raw:{header:e[0],payload:e[1]}}}async function S3e(t){return await new Promise(e=>{setTimeout(()=>e(null),t)})}function N3e(t,e){return new Promise((r,s)=>{(async()=>{for(let i=0;i<1/0;i++)try{const o=await t(i);if(!e(i,null,o)){r(o);return}}catch(o){if(!e(i,o)){s(o);return}}})()})}function C3e(t){return("0"+t.toString(16)).substr(-2)}function k3e(){const e=new Uint32Array(56);if(typeof crypto>"u"){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",r=n.length;let s="";for(let i=0;i<56;i++)s+=n.charAt(Math.floor(Math.random()*r));return s}return crypto.getRandomValues(e),Array.from(e,C3e).join("")}async function A3e(t){const n=new TextEncoder().encode(t),r=await crypto.subtle.digest("SHA-256",n),s=new Uint8Array(r);return Array.from(s).map(i=>String.fromCharCode(i)).join("")}async function E3e(t){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."),t;const n=await A3e(t);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function vv(t,e,n=!1){const r=k3e();let s=r;n&&(s+="/recovery"),await kb(t,`${e}-code-verifier`,s);const i=await E3e(r);return[i,r===i?"plain":"s256"]}const T3e=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function P3e(t){const e=t.headers.get(I6);if(!e||!e.match(T3e))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function M3e(t){if(!t)throw new Error("Missing exp claim");const e=Math.floor(Date.now()/1e3);if(t<=e)throw new Error("JWT has expired")}function R3e(t){switch(t){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 O3e=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Ch(t){if(!O3e.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function Yc(t){if(!t.passkey)throw new Error("@supabase/auth-js: the passkey API is experimental and disabled by default. Enable it by passing `auth: { experimental: { passkey: true } }` to createClient (or to the GoTrueClient constructor).")}function y$(){const t={};return new Proxy(t,{get:(e,n)=>{if(n==="__isUserNotAvailableProxy")return!0;if(typeof n=="symbol"){const r=n.toString();if(r==="Symbol(Symbol.toPrimitive)"||r==="Symbol(Symbol.toStringTag)"||r==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${n}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function I3e(t,e){return new Proxy(t,{get:(n,r,s)=>{if(r==="__isInsecureUserWarningProxy")return!0;
95if(typeof r=="symbol"){const i=r.toString();if(i==="Symbol(Symbol.toPrimitive)"||i==="Symbol(Symbol.toStringTag)"||i==="Symbol(util.inspect.custom)"||i==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(n,r,s)}return!e.value&&typeof r=="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."),e.value=!0),Reflect.get(n,r,s)}})}function mQ(t){return JSON.parse(JSON.stringify(t))}const Mv=t=>{if(typeof t=="object"&&t!==null){const e=t;if(typeof e.msg=="string")return e.msg;if(typeof e.message=="string")return e.message;if(typeof e.error_description=="string")return e.error_description;if(typeof e.error=="string")return e.error}return JSON.stringify(t)},D3e=[500,501,502,503,504,520,521,522,523,524,525,526,527,528,529,530];async function gQ(t){var e;if(!j3e(t))throw new D6(Mv(t),0);if(D3e.includes(t.status))throw new D6(Mv(t),t.status);let n;try{n=await t.json()}catch(i){throw new yu(Mv(i),i)}let r;const s=P3e(t);if(s&&s.getTime()>=Uhe["2024-01-01"].timestamp&&typeof n=="object"&&n&&typeof n.code=="string"?r=n.code:typeof n=="object"&&n&&typeof n.error_code=="string"&&(r=n.error_code),r){if(r==="weak_password")throw new dQ(Mv(n),t.status,((e=n.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(r==="session_not_found")throw new Zs}else if(typeof n=="object"&&n&&typeof n.weak_password=="object"&&n.weak_password&&Array.isArray(n.weak_password.reasons)&&n.weak_password.reasons.length&&n.weak_password.reasons.reduce((i,o)=>i&&typeof o=="string",!0))throw new dQ(Mv(n),t.status,n.weak_password.reasons);throw new u3e(Mv(n),t.status||500,r)}const L3e=(t,e,n,r)=>{const s={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"?s:(s.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e==null?void 0:e.headers),s.body=JSON.stringify(r),Object.assign(Object.assign({},s),n))};async function pt(t,e,n,r){var s;const i=Object.assign({},r==null?void 0:r.headers);i[I6]||(i[I6]=Uhe["2024-01-01"].name),r!=null&&r.jwt&&(i.Authorization=`Bearer ${r.jwt}`);const o=(s=r==null?void 0:r.query)!==null&&s!==void 0?s:{};r!=null&&r.redirectTo&&(o.redirect_to=r.redirectTo);const l=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",c=await F3e(t,e,n+l,{headers:i,noResolveJson:r==null?void 0:r.noResolveJson},{},r==null?void 0:r.body);return r!=null&&r.xform?r==null?void 0:r.xform(c):{data:Object.assign({},c),error:null}}async function F3e(t,e,n,r,s,i){const o=L3e(e,r,s,i);let l;try{l=await t(n,Object.assign({},o))}catch(c){throw console.error(c),new D6(Mv(c),0)}if(l.ok||await gQ(l),r!=null&&r.noResolveJson)return l;try{return await l.json()}catch(c){await gQ(c)}}function Jl(t){var e;let n=null;B3e(t)&&(n=Object.assign({},t),t.expires_at||(n.expires_at=b3e(t.expires_in)));const r=(e=t.user)!==null&&e!==void 0?e:typeof(t==null?void 0:t.id)=="string"?t:null;return{data:{session:n,user:r},error:null}}function vQ(t){const e=Jl(t);return!e.error&&t.weak_password&&typeof t.weak_password=="object"&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.message&&typeof t.weak_password.message=="string"&&t.weak_password.reasons.reduce((n,r)=>n&&typeof r=="string",!0)&&(e.data.weak_password=t.weak_password),e}function Zp(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function $3e(t){return{data:t,error:null}}function z3e(t){const{action_link:e,email_otp:n,hashed_token:r,redirect_to:s,verification_type:i}=t,o=KL(t,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),l={action_link:e,email_otp:n,hashed_token:r,redirect_to:s,verification_type:i},c=Object.assign({},o);return{data:{properties:l,user:c},error:null}}function xQ(t){return t}function B3e(t){return!!t.access_token&&!!t.refresh_token&&!!t.expires_in}const b$=["global","local","others"];class U3e{constructor({url:e="",headers:n={},fetch:r,experimental:s}){this.url=e,this.headers=n,this.fetch=Hhe(r),this.experimental=s??{},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)},this.customProviders={listProviders:this._listCustomProviders.bind(this),createProvider:this._createCustomProvider.bind(this),getProvider:this._getCustomProvider.bind(this),updateProvider:this._updateCustomProvider.bind(this),deleteProvider:this._deleteCustomProvider.bind(this)},this.passkey={listPasskeys:this._adminListPasskeys.bind(this),deletePasskey:this._adminDeletePasskey.bind(this)}}async signOut(e,n=b$[0]){if(b$.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${b$.join(", ")}`);try{return await pt(this.fetch,"POST",`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(r){if(We(r))return{data:null,error:r};throw r}}async inviteUserByEmail(e,n={}){try{return await pt(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:Zp})}catch(r){if(We(r))return{data:{user:null},error:r};throw r}}async generateLink(e){try{const{options:n}=e,r=KL(e,["options"]),s=Object.assign(Object.assign({},r),n);return"newEmail"in r&&(s.new_email=r==null?void 0:r.newEmail,delete s.newEmail),await pt(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:s,headers:this.headers,xform:z3e,redirectTo:n==null?void 0:n.redirectTo})}catch(n){if(We(n))return{data:{properties:null,user:null},error:n};throw n}}async createUser(e){try{return await pt(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:Zp})}catch(n){if(We(n))return{data:{user:null},error:n};throw n}}async listUsers(e){var n,r,s,i,o,l,c;try{const u={nextPage:null,lastPage:0,total:0},d=await pt(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(n=e==null?void 0:e.page)===null||n===void 0?void 0:n.toString())!==null&&r!==void 0?r:"",per_page:(i=(s=e==null?void 0:e.perPage)===null||s===void 0?void 0:s.toString())!==null&&i!==void 0?i:""},xform:xQ});if(d.error)throw d.error;const h=await d.json(),f=(o=d.headers.get("x-total-count"))!==null&&o!==void 0?o:0,p=(c=(l=d.headers.get("link"))===null||l===void 0?void 0:l.split(","))!==null&&c!==void 0?c:[];return p.length>
950&&(p.forEach(m=>{const v=parseInt(m.split(";")[0].split("=")[1].substring(0,1)),x=JSON.parse(m.split(";")[1].split("=")[1]);u[`${x}Page`]=v}),u.total=parseInt(f)),{data:Object.assign(Object.assign({},h),u),error:null}}catch(u){if(We(u))return{data:{users:[]},error:u};throw u}}async getUserById(e){Ch(e);try{return await pt(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:Zp})}catch(n){if(We(n))return{data:{user:null},error:n};throw n}}async updateUserById(e,n){Ch(e);try{return await pt(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:n,headers:this.headers,xform:Zp})}catch(r){if(We(r))return{data:{user:null},error:r};throw r}}async deleteUser(e,n=!1){Ch(e);try{return await pt(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:n},xform:Zp})}catch(r){if(We(r))return{data:{user:null},error:r};throw r}}async _listFactors(e){Ch(e.userId);try{const{data:n,error:r}=await pt(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:s=>({data:{factors:s},error:null})});return{data:n,error:r}}catch(n){if(We(n))return{data:null,error:n};throw n}}async _deleteFactor(e){Ch(e.userId),Ch(e.id);try{return{data:await pt(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(n){if(We(n))return{data:null,error:n};throw n}}async _listOAuthClients(e){var n,r,s,i,o,l,c;try{const u={nextPage:null,lastPage:0,total:0},d=await pt(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(n=e==null?void 0:e.page)===null||n===void 0?void 0:n.toString())!==null&&r!==void 0?r:"",per_page:(i=(s=e==null?void 0:e.perPage)===null||s===void 0?void 0:s.toString())!==null&&i!==void 0?i:""},xform:xQ});if(d.error)throw d.error;const h=await d.json(),f=(o=d.headers.get("x-total-count"))!==null&&o!==void 0?o:0,p=(c=(l=d.headers.get("link"))===null||l===void 0?void 0:l.split(","))!==null&&c!==void 0?c:[];return p.length>0&&(p.forEach(m=>{const v=parseInt(m.split(";")[0].split("=")[1].substring(0,1)),x=JSON.parse(m.split(";")[1].split("=")[1]);u[`${x}Page`]=v}),u.total=parseInt(f)),{data:Object.assign(Object.assign({},h),u),error:null}}catch(u){if(We(u))return{data:{clients:[]},error:u};throw u}}async _createOAuthClient(e){try{return await pt(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(We(n))return{data:null,error:n};throw n}}async _getOAuthClient(e){try{return await pt(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(We(n))return{data:null,error:n};throw n}}async _updateOAuthClient(e,n){try{return await pt(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${e}`,{body:n,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(We(r))return{data:null,error:r};throw r}}async _deleteOAuthClient(e){try{return await pt(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(We(n))return{data:null,error:n};throw n}}async _regenerateOAuthClientSecret(e){try{return await pt(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(We(n))return{data:null,error:n};throw n}}async _listCustomProviders(e){try{const n={};return e!=null&&e.type&&(n.type=e.type),await pt(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:n,xform:r=>{var s;return{data:{providers:(s=r==null?void 0:r.providers)!==null&&s!==void 0?s:[]},error:null}}})}catch(n){if(We(n))return{data:{providers:[]},error:n};throw n}}async _createCustomProvider(e){try{return await pt(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:e,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(We(n))return{data:null,error:n};throw n}}async _getCustomProvider(e){try{return await pt(this.fetch,"GET",`${this.url}/admin/custom-providers/${e}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(We(n))return{data:null,error:n};throw n}}async _updateCustomProvider(e,n){try{return await pt(this.fetch,"PUT",`${this.url}/admin/custom-providers/${e}`,{body:n,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(We(r))return{data:null,error:r};throw r}}async _deleteCustomProvider(e){try{return await pt(this.fetch,"DELET
95E",`${this.url}/admin/custom-providers/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(We(n))return{data:null,error:n};throw n}}async _adminListPasskeys(e){Yc(this.experimental),Ch(e.userId);try{return await pt(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/passkeys`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(We(n))return{data:null,error:n};throw n}}async _adminDeletePasskey(e){Yc(this.experimental),Ch(e.userId),Ch(e.passkeyId);try{return await pt(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/passkeys/${e.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(We(n))return{data:null,error:n};throw n}}}function yQ(t={}){return{getItem:e=>t[e]||null,setItem:(e,n)=>{t[e]=n},removeItem:e=>{delete t[e]}}}globalThis&&Vhe()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug");class q3e extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}function V3e(){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 Whe(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function H3e(t){return parseInt(t,16)}function W3e(t){const e=new TextEncoder().encode(t);return"0x"+Array.from(e,r=>r.toString(16).padStart(2,"0")).join("")}function K3e(t){var e;const{chainId:n,domain:r,expirationTime:s,issuedAt:i=new Date,nonce:o,notBefore:l,requestId:c,resources:u,scheme:d,uri:h,version:f}=t;{if(!Number.isInteger(n))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${n}`);if(!r)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(!h)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(f!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${f}`);if(!((e=t.statement)===null||e===void 0)&&e.includes(` 96`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${t.statement}`)}const p=Whe(t.address),m=d?`${d}://${r}`:r,v=t.statement?`${t.statement} 97`:"",x=`${m} wants you to sign in with your Ethereum account: 98${p} 99 100${v}`;let g=`URI: ${h} 101Version: ${f} 102Chain ID: ${n}${o?` 103Nonce: ${o}`:""} 104Issued At: ${i.toISOString()}`;if(s&&(g+=` 105Expiration Time: ${s.toISOString()}`),l&&(g+=` 106Not Before: ${l.toISOString()}`),c&&(g+=` 107Request ID: ${c}`),u){let w=` 108Resources:`;for(const _ of u){if(!_||typeof _!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${_}`);w+=` 109- ${_}`}g+=w}return`${x} 110${g}`}class _s extends Error{constructor({message:e,code:n,cause:r,name:s}){var i;super(e,{cause:r}),this.__isWebAuthnError=!0,this.name=(i=s??(r instanceof Error?r.name:void 0))!==null&&i!==void 0?i:"Unknown Error",this.code=n}toJSON(){return{name:this.name,message:this.message,code:this.code}}}class NO extends _s{constructor(e,n){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n,message:e}),this.name="WebAuthnUnknownError",this.originalError=n}}function G3e({error:t,options:e}){var n,r,s;const{publicKey:i}=e;if(!i)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new _s({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else if(t.name==="ConstraintError"){if(((n=i.authenticatorSelection)===null||n===void 0?void 0:n.requireResidentKey)===!0)return new _s({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if(e.mediation==="conditional"&&((r=i.authenticatorSelection)===null||r===void 0?void 0:r.userVerification)==="required")return new _s({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:t});if(((s=i.authenticatorSelection)===null||s===void 0?void 0:s.userVerification)==="required")return new _s({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:t})}else{if(t.name==="InvalidStateError")return new _s({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new _s({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="NotSupportedError")return i.pubKeyCredParams.filter(l=>l.type==="public-key").length===0?new _s({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new _s({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:t});if(t.name==="SecurityError"){const o=window.location.hostname;if(Khe(o)){if(i.rp.id!==o)return new _s({message:`The RP ID "${i.rp.id}
110" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new _s({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="TypeError"){if(i.user.id.byteLength<1||i.user.id.byteLength>64)return new _s({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:t})}else if(t.name==="UnknownError")return new _s({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new _s({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function Y3e({error:t,options:e}){const{publicKey:n}=e;if(!n)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new _s({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new _s({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){const r=window.location.hostname;if(Khe(r)){if(n.rpId!==r)return new _s({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new _s({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new _s({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new _s({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}class X3e{createNewAbortSignal(){if(this.controller){const n=new Error("Cancelling existing WebAuthn API call for new one");n.name="AbortError",this.controller.abort(n)}const e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){const e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}}const L6=new X3e;function bQ(t){if(!t)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(t);const{challenge:e,user:n,excludeCredentials:r}=t,s=KL(t,["challenge","user","excludeCredentials"]),i=Tw(e).buffer,o=Object.assign(Object.assign({},n),{id:Tw(n.id).buffer}),l=Object.assign(Object.assign({},s),{challenge:i,user:o});if(r&&r.length>0){l.excludeCredentials=new Array(r.length);for(let c=0;c<r.length;c++){const u=r[c];l.excludeCredentials[c]=Object.assign(Object.assign({},u),{id:Tw(u.id).buffer,type:u.type||"public-key",transports:u.transports})}}return l}function wQ(t){if(!t)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(t);const{challenge:e,allowCredentials:n}=t,r=KL(t,["challenge","allowCredentials"]),s=Tw(e).buffer,i=Object.assign(Object.assign({},r),{challenge:s});if(n&&n.length>0){i.allowCredentials=new Array(n.length);for(let o=0;o<n.length;o++){const l=n[o];i.allowCredentials[o]=Object.assign(Object.assign({},l),{id:Tw(l.id).buffer,type:l.type||"public-key",transports:l.transports})}}return i}function _Q(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const n=t;return{id:t.id,rawId:t.id,response:{attestationObject:ex(new Uint8Array(t.response.attestationObject)),clientDataJSON:ex(new Uint8Array(t.response.clientDataJSON))},type:"public-key",clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:(e=n.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function jQ(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const n=t,r=t.getClientExtensionResults(),s=t.response;return{id:t.id,rawId:t.id,response:{authenticatorData:ex(new Uint8Array(s.authenticatorData)),clientDataJSON:ex(new Uint8Array(s.clientDataJSON)),signature:ex(new Uint8Array(s.signature)),userHandle:s.userHandle?ex(new Uint8Array(s.userHandle)):void 0},type:"public-key",clientExtensionResults:r,authenticatorAttachment:(e=n.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function Khe(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function CO(){var t,e;return!!(oa()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((t=navigator==null?void 0:navigator.credentials)===null||t===void 0?void 0:t.create)=="function"&&typeof((e=navigator==null?void 0:navigator.credentials)===null||e===void 0?void 0:e.get)=="function")}async function Ghe(t){try{const e=await navigator.credentials.create(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new NO("Browser returned unexpected credential type",e)}:{data:null,error:new NO("Empty credential response",e)}}catch(e){return{data:null,error:G3e({error:e,options:t})}}}async function Yhe(t){try{const e=await navigator.credentials.get(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new NO("Browser returned unexpected credential type",e)}:{data:null,error:new NO("Empty credential response",e)}}catch(e){return{data:null,error:Y3e({error:e,options:t})}}}const J3e={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},Q3e={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function kO(...t){const e=s=>s!==null&&typeof s=="object"&&!Array.isArray(s),n=s=>s instanceof ArrayBuffer||ArrayBuffer.isView(s),r={};for(const s of t)if(s)for(const i in s){const o=s[i];if(o!==void 0)if(Array.isArray(o))r[i]=o;else if(n(o))r[i]=o;else if(e(o)){const l=r[i];e(l)?r[i]=kO(l,o):r[i]=kO(o)}else r[i]=o}return r}function Z3e(t,e){return kO(J3e,t,e||{})}function e4e(t,e){return kO(Q3e,t,e||{})}class t4e{constructor(e){this.client=e,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(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:n,friendlyName:r,signal:s},i){var o;try{const{data:l,error:c}=await this.client.mfa.challenge({factorId:e,webauthn:n});if(!l)return{data:null,error:c};const u=s??L6.createNewAbortSignal();if(l.webauthn.type==="create"){const{user:d}=l.webauthn.credential_options.publicKey;if(!d.name){const h=r;if(h)d.name=`${d.id}:${h}`;else{const p=(await this.client.getUser()).data.user,m=((o=p==null?void 0:p.user_metadata)===null||o===void 0?void 0:o.name)||(p==null?void 0:p.email)||(p==null?void 0:p.id)||"User";d.name=`${d.id}:${m}`}}d.displayName||(d.displayName=d.name)}switch(l.webauthn.type){case"create":{const d=Z3e(l.webauthn.credential_options.publicKey,i==null?void 0:i.create),{data:h,error:f}=await Ghe({publicKey:d,signal:u});return h?{data:{factorId:e,challengeId:l.id,webauthn:{type:l.webauthn.type,credential_response:h}},error:null}:{data:null,error:f}}case"request":{const d=e4e(l.webauthn.credential_options.publicKey,i==null?void 0:i.request),{data:h,error:f}=await Yhe(Object.assign(Object.assign({},l.webauthn.credential_options),{publicKey:d,signal:u}));return h?{data:{factorId:e,challengeId:l.id,webauthn:{type:l.webauthn.type,credential_response:h}},error:null}:{data:null,error:f}}}}catch(l){return We(l)?{data:null,error:l}:{data:null,error:new yu("Unexpected error in challenge",l)}}}async _verify({challengeId:e,factorId:n,webauthn:r}){return this.client.mfa.verify({factorId:n,challengeId:e,webauthn:r})}async _authenticate({factorId:e,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:s}={}},i){if(!n)return{data:null,error:new ok("rpId is required for WebAuthn authentication")};try{if(!CO())return{data:null,error:new yu("Browser does not support WebAuthn",null)};const{data:o,error:l}=await this.challenge({factorId:e,webauthn:{rpId:n,rpOrigins:r},signal:s},{request:i});if(!o)return{data:null,error:l};const{webauthn:c}=o;return this._verify({factorId:e,challengeId:o.challengeId,webauthn:{type:c.type,rpId:n,rpOrigins:r,credential_response:c.credential_response}})}catch(o){return We(o)?{data:null,error:o}:{data:null,error:new yu("Unexpected error in authenticate",o)}}}async _register({friendlyName:e,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:s}={}},i){if(!n)return{data:null,error:new ok("rpId is required for WebAuthn registration")};try{if(!CO())return{data:null,error:new yu("Browser does not support WebAuthn",null)};const{data:o,error:l}=await this._enroll({friendlyName:e});if(!o)return await this.client.mfa.listFactors().then(d=>{var h;
110return(h=d.data)===null||h===void 0?void 0:h.all.find(f=>f.factor_type==="webauthn"&&f.friendly_name===e&&f.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:n,rpOrigins:r},signal:s},{create:i});return c?this._verify({factorId:o.id,challengeId:c.challengeId,webauthn:{rpId:n,rpOrigins:r,type:c.webauthn.type,credential_response:c.webauthn.credential_response}}):{data:null,error:u}}catch(o){return We(o)?{data:null,error:o}:{data:null,error:new yu("Unexpected error in register",o)}}}}V3e();const n4e={url:i3e,storageKey:a3e,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:o3e,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}},tb={};class lk{get jwks(){var e,n;return(n=(e=tb[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&n!==void 0?n:{keys:[]}}set jwks(e){tb[this.storageKey]=Object.assign(Object.assign({},tb[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,n;return(n=(e=tb[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&n!==void 0?n:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){tb[this.storageKey]=Object.assign(Object.assign({},tb[this.storageKey]),{cachedAt:e})}constructor(e){var n,r,s;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.lastRefreshFailure=null,this._sessionRemovalEpoch=0,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lock=null,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const i=Object.assign(Object.assign({},n4e),e);if(this.storageKey=i.storageKey,this.instanceID=(n=lk.nextInstanceID[this.storageKey])!==null&&n!==void 0?n:0,lk.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!i.debug,typeof i.debug=="function"&&(this.logger=i.debug),this.instanceID>0&&oa()){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.experimental=(r=i.experimental)!==null&&r!==void 0?r:{},this.admin=new U3e({url:i.url,headers:i.headers,fetch:i.fetch,experimental:this.experimental}),this.url=i.url,this.headers=i.headers,this.fetch=Hhe(i.fetch),this.detectSessionInUrl=i.detectSessionInUrl,this.flowType=i.flowType,this.hasCustomAuthorizationHeader=i.hasCustomAuthorizationHeader,this.throwOnError=i.throwOnError,this.lockAcquireTimeout=i.lockAcquireTimeout,i.lock!=null&&(this.lock=i.lock),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 t4e(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.passkey={startRegistration:this._startPasskeyRegistration.bind(this),verifyRegistration:this._verifyPasskeyRegistration.bind(this),startAuthentication:this._startPasskeyAuthentication.bind(this),verifyAuthentication:this._verifyPasskeyAuthentication.bind(this),list:this._listPasskeys.bind(this),update:this._updatePasskey.bind(this),delete:this._deletePasskey.bind(this)},this.persistSession?(i.storage?this.storage=i.storage:Vhe()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=yQ(this.memoryStorage)),i.userStorage&&(this.userStorage=i.userStorage)):(this.memoryStorage={},this.storage=yQ(this.memoryStorage)),oa()&&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)}(s=this.broadcastChannel)===null||s===void 0||s.addEventListener("message",async o=>{this._debug("received broadcast notification from other tab or client",o),(o.data.event==="TOKEN_REFRESHED"||o.data.event==="SIGNED_IN")&&(this.lastRefreshFailure=null);try{await this._notifyAllSubscribers(o.data.event,o.data.session,!1)}catch(l){this._debug("#broadcastChannel","error",l)}})}i.skipAutoInitialize||this.initialize().catch(o=>{this._debug("#initialize()","error",o)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${Bhe}) ${new Date().toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()):await this._initialize())(),await this.initializePromise)}async _initialize(){var e;try{let n={},r="none";if(oa()&&(n=_3e(window.location.href),this._isImplicitGrantCallback(n)?r="implicit":await this._isPKCECallback(n)&&(r="pkce")),oa()&&this.detectSessionInUrl&&r!=="none"){const{data:s,error:i}=await this._getSessionFromURL(n,r);if(i){if(this._debug("#_initialize()","error detecting session from URL",i),h3e(i)){const c=(e=i.details)===null||e===void 0?void 0:e.code;if(c==="identity_already_exists"||c==="identity_not_found"||c==="single_identity_not_deletable")return{error:i}}return{error:i}}const{session:o,redirectType:l}=s;return this._debug("#_initialize()","detected session in URL",o,"redirect type",l),await this._saveSession(o),setTimeout(async()=>{l==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",o):await this._notifyAllSubscribers("SIGNED_IN",o)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(n){return We(n)?this._returnResult({error:n}):this._returnResult({error:new yu("Unexpected error during initialization",n)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var n,r,s;try{const i=await pt(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(r=(n=e==null?void 0:e.options)===null||n===void 0?void 0:n.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:(s=e==null?void 0:e.options)===null||s===void 0?void 0:s.captchaToken}},xform:Jl}),{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(We(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signUp(e){var n,r,s;try{let i;if("email"in e){const{email:d,password:h,options:f}=e;let p=null,m=null;this.flowType==="pkce"&&([p,m]=await vv(this.storage,this.storageKey)),i=await pt(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:f==null?void 0:f.emailRedirectTo,body:{email:d,password:h,data:(n=f==null?void 0:f.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:f==null?void 0:f.captchaToken},code_challenge:p,code_challenge_method:m},xform:Jl})}else if("phone"in e){const{phone:d,password:h,options:f}=e;i=await pt(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:d,password:h,data:(r=f==null?void 0:f.data)!==null&&r!==void 0?r:{},channel:(s=f==null?void 0:f.channel)!==null&&s!==void 0?s:"sms",gotrue_meta_security:{captcha_token:f==null?void 0:f.captchaToken}},xform:Jl})}else throw new zT("You must provide either an email or phone number and a password");const{data:o,error:l}=i;if(l||!o)return await us(this.storage,`${this.storageKey}-code-verifier`),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(await us(this.storage,`${this.storageKey}-code-verifier`),We(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithPassword(e){try{let n;if("email"in e){const{email:i,password:o,options:l}=e;n=await pt(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:vQ})}else if("phone"in e){const{phone:i,password:o,options:l}=e;n=await pt(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:vQ})}else throw new zT("You must provide either an email or phone number and a password");const{data:r,error:s}=n;if(s)return this._returnResult({data:{user:null,session:null},error:s});if(!r||!r.session||!r.user){const i=new eb;return this._returnResult({data:{user:null,session:null},error:i})}return r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),this._returnResult({data:Object.assign({user:r.user,session:r.session},r.weak_password?{weakPassword:r.weak_password}:null),error:s})}catch(n){if(We(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOAuth(e){var n,r,s,i;return await this._handleProviderSignIn(e.provider,{redirectTo:(n=e.options)===null||n===void 0?void 0:n.redirectTo,scopes:(r=e.options)===null||r===void 0?void 0:r.scopes,queryParams:(s=e.options)===null||s===void 0?void 0:s.queryParams,skipBrowserRedirect:(i=e.options)===null||i===void 0?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this.lock!=null?this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(e)):this._exchangeCodeForSession(e)}async signInWithWeb3(e){const{chain:n}=e;switch(n){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${n}"`)}}async signInWithEthereum(e){var n,r,s,i,o,l,c,u,d,h,f;let p,m;if("message"in e)p=e.message,m=e.signature;else{const{chain:v,wallet:x,statement:g,options:w}=e;let _;if(oa())if(typeof x=="object")_=x;else{const E=window;if("ethereum"in E&&typeof E.ethereum=="object"&&"request"in E.ethereum&&typeof E.ethereum.request=="function")_=E.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof x!="object"||!(w!=null&&w.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");_=x}const j=new URL((n=w==null?void 0:w.url)!==null&&n!==void 0?n:window.location.href),N=await _.request({method:"eth_requestAccounts"}).then(E=>E).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!N||N.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const S=Whe(N[0]);let C=(r=w==null?void 0:w.signInWithEthereum)===null||r===void 0?void 0:r.chainId;if(!C){const E=await _.request({method:"eth_chainId"});C=H3e(E)}const k={domain:j.host,address:S,statement:g,uri:j.href,version:"1",chainId:C,nonce:(s=w==null?void 0:w.signInWithEthereum)===null||s===void 0?void 0:s.nonce,issuedAt:(o=(i=w==null?void 0:w.signInWithEthereum)===null||i===void 0?void 0:i.issuedAt)!==null&&o!==void 0?o:new Date,expirationTime:(l=w==null?void 0:w.signInWithEthereum)===null||l===void 0?void 0:l.expirationTime,notBefore:(c=w==null?void 0:w.signInWithEthereum)===null||c===void 0?void 0:c.notBefore,requestId:(u=w==null?void 0:w.signInWithEthereum)===null||u===void 0?void 0:u.requestId,resources:(d=w==null?void 0:w.signInWithEthereum)===null||d===void 0?void 0:d.resources};p=K3e(k),m=await _.request({method:"personal_sign",params:[W3e(p),S]})}try{const{data:v,error:x}=await pt(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:p,signature:m}
110,!((h=e.options)===null||h===void 0)&&h.captchaToken?{gotrue_meta_security:{captcha_token:(f=e.options)===null||f===void 0?void 0:f.captchaToken}}:null),xform:Jl});if(x)throw x;if(!v||!v.session||!v.user){const g=new eb;return this._returnResult({data:{user:null,session:null},error:g})}return v.session&&(await this._saveSession(v.session),await this._notifyAllSubscribers("SIGNED_IN",v.session)),this._returnResult({data:Object.assign({},v),error:x})}catch(v){if(We(v))return this._returnResult({data:{user:null,session:null},error:v});throw v}}async signInWithSolana(e){var n,r,s,i,o,l,c,u,d,h,f,p;let m,v;if("message"in e)m=e.message,v=e.signature;else{const{chain:x,wallet:g,statement:w,options:_}=e;let j;if(oa())if(typeof g=="object")j=g;else{const S=window;if("solana"in S&&typeof S.solana=="object"&&("signIn"in S.solana&&typeof S.solana.signIn=="function"||"signMessage"in S.solana&&typeof S.solana.signMessage=="function"))j=S.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof g!="object"||!(_!=null&&_.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");j=g}const N=new URL((n=_==null?void 0:_.url)!==null&&n!==void 0?n:window.location.href);if("signIn"in j&&j.signIn){const S=await j.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},_==null?void 0:_.signInWithSolana),{version:"1",domain:N.host,uri:N.href}),w?{statement:w}:null));let C;if(Array.isArray(S)&&S[0]&&typeof S[0]=="object")C=S[0];else if(S&&typeof S=="object"&&"signedMessage"in S&&"signature"in S)C=S;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in C&&"signature"in C&&(typeof C.signedMessage=="string"||C.signedMessage instanceof Uint8Array)&&C.signature instanceof Uint8Array)m=typeof C.signedMessage=="string"?C.signedMessage:new TextDecoder().decode(C.signedMessage),v=C.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in j)||typeof j.signMessage!="function"||!("publicKey"in j)||typeof j!="object"||!j.publicKey||!("toBase58"in j.publicKey)||typeof j.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");m=[`${N.host} wants you to sign in with your Solana account:`,j.publicKey.toBase58(),...w?["",w,""]:[""],"Version: 1",`URI: ${N.href}`,`Issued At: ${(s=(r=_==null?void 0:_.signInWithSolana)===null||r===void 0?void 0:r.issuedAt)!==null&&s!==void 0?s:new Date().toISOString()}`,...!((i=_==null?void 0:_.signInWithSolana)===null||i===void 0)&&i.notBefore?[`Not Before: ${_.signInWithSolana.notBefore}`]:[],...!((o=_==null?void 0:_.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${_.signInWithSolana.expirationTime}`]:[],...!((l=_==null?void 0:_.signInWithSolana)===null||l===void 0)&&l.chainId?[`Chain ID: ${_.signInWithSolana.chainId}`]:[],...!((c=_==null?void 0:_.signInWithSolana)===null||c===void 0)&&c.nonce?[`Nonce: ${_.signInWithSolana.nonce}`]:[],...!((u=_==null?void 0:_.signInWithSolana)===null||u===void 0)&&u.requestId?[`Request ID: ${_.signInWithSolana.requestId}`]:[],...!((h=(d=_==null?void 0:_.signInWithSolana)===null||d===void 0?void 0:d.resources)===null||h===void 0)&&h.length?["Resources",..._.signInWithSolana.resources.map(C=>`- ${C}`)]:[]].join(` 111`);const S=await j.signMessage(new TextEncoder().encode(m),"utf8");if(!S||!(S instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");v=S}}try{const{data:x,error:g}=await pt(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:m,signature:ex(v)},!((f=e.options)===null||f===void 0)&&f.captchaToken?{gotrue_meta_security:{captcha_token:(p=e.options)===null||p===void 0?void 0:p.captchaToken}}:null),xform:Jl});if(g)throw g;if(!x||!x.session||!x.user){const w=new eb;return this._returnResult({data:{user:null,session:null},error:w})}return x.session&&(await this._saveSession(x.session),await this._notifyAllSubscribers("SIGNED_IN",x.session)),this._returnResult({data:Object.assign({},x),error:g})}
111catch(x){if(We(x))return this._returnResult({data:{user:null,session:null},error:x});throw x}}async _exchangeCodeForSession(e){const n=await Vc(this.storage,`${this.storageKey}-code-verifier`),[r,s]=(n??"").split("/");try{if(!r&&this.flowType==="pkce")throw new f3e;const{data:i,error:o}=await pt(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:r},xform:Jl});if(await us(this.storage,`${this.storageKey}-code-verifier`),o)throw o;if(!i||!i.session||!i.user){const l=new eb;return this._returnResult({data:{user:null,session:null,redirectType:null},error:l})}return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers(s==="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",i.session)),this._returnResult({data:Object.assign(Object.assign({},i),{redirectType:s??null}),error:o})}catch(i){if(await us(this.storage,`${this.storageKey}-code-verifier`),We(i))return this._returnResult({data:{user:null,session:null,redirectType:null},error:i});throw i}}async signInWithIdToken(e){try{const{options:n,provider:r,token:s,access_token:i,nonce:o}=e,l=await pt(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:s,access_token:i,nonce:o,gotrue_meta_security:{captcha_token:n==null?void 0:n.captchaToken}},xform:Jl}),{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 eb;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(n){if(We(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOtp(e){var n,r,s,i,o;try{if("email"in e){const{email:l,options:c}=e;let u=null,d=null;this.flowType==="pkce"&&([u,d]=await vv(this.storage,this.storageKey));const{error:h}=await pt(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:l,data:(n=c==null?void 0:c.data)!==null&&n!==void 0?n:{},create_user:(r=c==null?void 0:c.shouldCreateUser)!==null&&r!==void 0?r:!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:h})}if("phone"in e){const{phone:l,options:c}=e,{data:u,error:d}=await pt(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:l,data:(s=c==null?void 0:c.data)!==null&&s!==void 0?s:{},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 zT("You must provide either an email or phone number.")}catch(l){if(await us(this.storage,`${this.storageKey}-code-verifier`),We(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}}async verifyOtp(e){var n,r;try{let s,i;"options"in e&&(s=(n=e.options)===null||n===void 0?void 0:n.redirectTo,i=(r=e.options)===null||r===void 0?void 0:r.captchaToken);const{data:o,error:l}=await pt(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:s,xform:Jl});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(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",c)),this._returnResult({data:{user:u,session:c},error:null})}catch(s){if(We(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithSSO(e){var n,r,s,i,o;try{let l=null,c=null;this.flowType==="pkce"&&([l,c]=await vv(this.storage,this.storageKey));const u=await pt(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(r=(n=e.options)===null||n===void 0?void 0:n.redirectTo)!==null&&r!==void 0?r:void 0}),!((s=e==null?void 0:e.options)===null||s===void 0)&&s.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:l,code_challenge_method:c}),headers:this.headers,xform:$3e});return!((i=u.data)===null||i===void 0)&&i.url&&oa()&&!(!((o=e.options)===null||o===void 0)&&o.skipBrowserRedirect)&&window.location.assign(u.data.url),this._returnResult(u)}catch(l){if(await us(this.storage,`${this.storageKey}-code-verifier`),We(l))return this._returnResult({data:null,error:l});throw l}}async reauthenticate(){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate()):await this._reauthenticate()}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:n},error:r}=e;if(r)throw r;if(!n)throw new Zs;const{error:s}=await pt(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:n.access_token});return this._returnResult({data:{user:null,session:null},error:s})})}catch(e){if(We(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{const n=`${this.url}/resend`;if("email"in e){const{email:r,type:s,options:i}=e;let o=null,l=null;this.flowType==="pkce"&&([o,l]=await vv(this.storage,this.storageKey));const{error:c}=await pt(this.fetch,"POST",n,{headers:this.headers,body:{email:r,type:s,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}
111,code_challenge:o,code_challenge_method:l},redirectTo:i==null?void 0:i.emailRedirectTo});return c&&await us(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:c})}else if("phone"in e){const{phone:r,type:s,options:i}=e,{data:o,error:l}=await pt(this.fetch,"POST",n,{headers:this.headers,body:{phone:r,type:s,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 zT("You must provide either an email or phone number and a type")}catch(n){if(await us(this.storage,`${this.storageKey}-code-verifier`),We(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async getSession(){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async e=>e)):await this._useSession(async e=>e)}async _acquireLock(e,n){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const r=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),s=(async()=>(await r,await n()))();return this.pendingInLock.push((async()=>{try{await s}catch{}})()),s}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const r=n();for(this.pendingInLock.push((async()=>{try{await r}catch{}})()),await r;this.pendingInLock.length;){const s=[...this.pendingInLock];await Promise.all(s),this.pendingInLock.splice(0,s.length)}return await r}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const n=await this.__loadSession();return await e(n)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lock!=null&&!this.lockAcquired&&this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null;const n=await Vc(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",n),n!==null&&(this._isValidSession(n)?e=n:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const r=e.expires_at?e.expires_at*1e3-Date.now()<x$:!1;if(this._debug("#__loadSession()",`session has${r?"":" not"} expired`,"expires_at",e.expires_at),!r){if(this.userStorage){const o=await Vc(this.userStorage,this.storageKey+"-user");o!=null&&o.user?e.user=o.user:e.user=y$()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){const o={value:this.suppressGetSessionWarning};e.user=I3e(e.user,o),o.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}const{data:s,error:i}=await this._callRefreshToken(e.refresh_token);if(i){if(!!(e.expires_at&&e.expires_at*1e3>Date.now())){const l=await Vc(this.storage,this.storageKey);if(l&&l.refresh_token===e.refresh_token)return this._returnResult({data:{session:e},error:null})}return this._returnResult({data:{session:null},error:i})}return this._returnResult({data:{session:s},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){if(e)return await this._getUser(e);await this.initializePromise;let n;return this.lock!=null?n=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser()):n=await this._getUser(),n.data.user&&(this.suppressGetSessionWarning=!0),n}async _getUser(e){try{return e?await pt(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:Zp}):await this._useSession(async n=>{var r,s,i;const{data:o,error:l}=n;if(l)throw l;return!(!((r=o.session)===null||r===void 0)&&r.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Zs}:await pt(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(i=(s=o.session)===null||s===void 0?void 0:s.access_token)!==null&&i!==void 0?i:void 0,xform:Zp})})}catch(n){if(We(n))return $T(n)&&(await this._removeSession(),await us(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:n});throw n}}async updateUser(e,n={}){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,n)):await this._updateUser(e,n)}async _updateUser(e,n={}){try{return await this._useSession(async r=>{const{data:s,error:i}=r;if(i)throw i;if(!s.session)throw new Zs;const o=s.session;let l=null,c=null;this.flowType==="pkce"&&e.email!=null&&([l,c]=await vv(this.storage,this.storageKey));const{data:u,error:d}=await pt(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:n==null?void 0:n.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:l,code_challenge_method:c}),jwt:o.access_token,xform:Zp});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(r){if(await us(this.storage,`${this.storageKey}-code-verifier`),We(r))return this._returnResult({data:{user:null},error:r});throw r}}async setSession(e){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e)):await this._setSession(e)}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new Zs;const n=Date.now()/1e3;let r=n,s=!0,i=null;const{payload:o}=UT(e.access_token);if(o.exp&&(r=o.exp,s=r<=n),s){const{data:l,error:c}=await this._callRefreshToken(e.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(e.access_token);if(c)return this._returnResult({data:{user:null,session:null},error:c});i={access_token:e.access_token,refresh_token:e.refresh_token,user:l.user,token_type:"bearer",expires_in:r-n,expires_at:r},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return this._returnResult({data:{user:i.user,session:i},error:null})}catch(n){if(We(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}}async refreshSession(e){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e)):await this._refreshSession(e)}async _refreshSession(e){try{return await this._useSession(async n=>{var r;if(!e){const{data:o,error:l}=n;if(l)throw l;e=(r=o.session)!==null&&r!==void 0?r:void 0}if(!(e!=null&&e.refresh_token))throw new Zs;const{data:s,error:i}=await this._callRefreshToken(e.refresh_token);return i?this._returnResult({data:{user:null,session:null},error:i}):s?this._returnResult({data:{user:s.user,session:s},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(n){if(We(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async _getSessionFromURL(e,n){var r;try{if(!oa())throw new BT("No browser detected.");
111if(e.error||e.error_description||e.error_code)throw new BT(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(n){case"implicit":if(this.flowType==="pkce")throw new lQ("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new BT("Not a valid implicit grant flow url.");break;default:}if(n==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new lQ("No code detected.");const{data:_,error:j}=await this._exchangeCodeForSession(e.code);if(j)throw j;const N=new URL(window.location.href);return N.searchParams.delete("code"),window.history.replaceState(window.history.state,"",N.toString()),{data:{session:_.session,redirectType:(r=_.redirectType)!==null&&r!==void 0?r:null},error:null}}const{provider_token:s,provider_refresh_token:i,access_token:o,refresh_token:l,expires_in:c,expires_at:u,token_type:d}=e;if(!o||!c||!l||!d)throw new BT("No session defined in URL");const h=Math.round(Date.now()/1e3),f=parseInt(c);let p=h+f;u&&(p=parseInt(u));const m=p-h;m*1e3<=Vh&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${m}s, should have been closer to ${f}s`);const v=p-f;h-v>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",v,p,h):h-v<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",v,p,h);const{data:x,error:g}=await this._getUser(o);if(g)throw g;const w={provider_token:s,provider_refresh_token:i,access_token:o,expires_in:f,expires_at:p,refresh_token:l,token_type:d,user:x.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:w,redirectType:e.type},error:null})}catch(s){if(We(s))return this._returnResult({data:{session:null,redirectType:null},error:s});throw s}}_isImplicitGrantCallback(e){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),e):!!(e.access_token||e.error||e.error_description||e.error_code)}async _isPKCECallback(e){const n=await Vc(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&n)}async signOut(e={scope:"global"}){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e)):await this._signOut(e)}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async n=>{var r;const{data:s,error:i}=n;if(i&&!$T(i))return this._returnResult({error:i});const o=(r=s.session)===null||r===void 0?void 0:r.access_token;if(o){const{error:l}=await this.admin.signOut(o,e);if(l&&!(d3e(l)&&(l.status===404||l.status===401||l.status===403)||$T(l)))return this._returnResult({error:l})}return e!=="others"&&(await this._removeSession(),await us(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const n=w3e(),r={id:n,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",n),this.stateChangeEmitters.delete(n)}};return this._debug("#onAuthStateChange()","registered callback with id",n),this.stateChangeEmitters.set(n,r),(async()=>(await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(n)}):await this._emitInitialSession(n)))(),{data:{subscription:r}}}async _emitInitialSession(e){return await this._useSession(async n=>{var r,s;try{const{data:{session:i},error:o}=n;if(o)throw o;await((r=this.stateChangeEmitters.get(e))===null||r===void 0?void 0:r.callback("INITIAL_SESSION",i)),this._debug("INITIAL_SESSION","callback id",e,"session",i)}catch(i){await((s=this.stateChangeEmitters.get(e))===null||s===void 0?void 0:s.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",i),$T(i)?console.warn(i):console.error(i)}})}async resetPasswordForEmail(e,n={}){let r=null,s=null;this.flowType==="pkce"&&([r,s]=await vv(this.storage,this.storageKey,!0));try{return await pt(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:r,code_challenge_method:s,gotrue_meta_security:{captcha_token:n.captchaToken}},headers:this.headers,redirectTo:n.redirectTo})}catch(i){if(await us(this.storage,`${this.storageKey}-code-verifier`),We(i))return this._returnResult({data:null,error:i});throw i}}async getUserIdentities(){var e;try{const{data:n,error:r}=await this.getUser();if(r)throw r;return this._returnResult({data:{identities:(e=n.user.identities)!==null&&e!==void 0?e:[]},error:null})}catch(n){if(We(n))return this._returnResult({data:null,error:n});throw n}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var n;try{const{data:r,error:s}=await this._useSession(async i=>{var o,l,c,u,d;const{data:h,error:f}=i;if(f)throw f;const p=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(o=e.options)===null||o===void 0?void 0:o.redirectTo,scopes:(l=e.options)===null||l===void 0?void 0:l.scopes,queryParams:(c=e.options)===null||c===void 0?void 0:c.queryParams,skipBrowserRedirect:!0});return await pt(this.fetch,"GET",p,{headers:this.headers,jwt:(d=(u=h.session)===null||u===void 0?void 0:u.access_token)!==null&&d!==void 0?d:void 0})});if(s)throw s;return oa()&&!(!((n=e.options)===null||n===void 0)&&n.skipBrowserRedirect)&&window.location.assign(r==null?void 0:r.url),this._returnResult({data:{provider:e.provider,url:r==null?void 0:r.url},error:null})}catch(r){if(We(r))return this._returnResult({data:{provider:e.provider,url:null},error:r});throw r}}async linkIdentityIdToken(e){return await this._useSession(async n=>{var r;try{const{error:s,data:{session:i}}=n;
111if(s)throw s;const{options:o,provider:l,token:c,access_token:u,nonce:d}=e,h=await pt(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(r=i==null?void 0:i.access_token)!==null&&r!==void 0?r: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:Jl}),{data:f,error:p}=h;return p?this._returnResult({data:{user:null,session:null},error:p}):!f||!f.session||!f.user?this._returnResult({data:{user:null,session:null},error:new eb}):(f.session&&(await this._saveSession(f.session),await this._notifyAllSubscribers("USER_UPDATED",f.session)),this._returnResult({data:f,error:p}))}catch(s){if(await us(this.storage,`${this.storageKey}-code-verifier`),We(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}})}async unlinkIdentity(e){try{return await this._useSession(async n=>{var r,s;const{data:i,error:o}=n;if(o)throw o;return await pt(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(s=(r=i.session)===null||r===void 0?void 0:r.access_token)!==null&&s!==void 0?s:void 0})})}catch(n){if(We(n))return this._returnResult({data:null,error:n});throw n}}async _refreshAccessToken(e){const n="#_refreshAccessToken()";this._debug(n,"begin");try{const r=Date.now();return await N3e(async s=>(s>0&&await S3e(200*Math.pow(2,s-1)),this._debug(n,"refreshing attempt",s),await pt(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:Jl})),(s,i)=>{const o=200*Math.pow(2,s);return i&&cQ(i)&&Date.now()+o-r<Vh})}catch(r){if(this._debug(n,"error",r),We(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}finally{this._debug(n,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,n){const r=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:n.redirectTo,scopes:n.scopes,queryParams:n.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",n,"url",r),oa()&&!n.skipBrowserRedirect&&window.location.assign(r),{data:{provider:e,url:r},error:null}}async _recoverAndRefresh(){var e,n;const r="#_recoverAndRefresh()";this._debug(r,"begin");try{const s=await Vc(this.storage,this.storageKey);if(s&&this.userStorage){let o=await Vc(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:s.user},await kb(this.userStorage,this.storageKey+"-user",o)),s.user=(e=o==null?void 0:o.user)!==null&&e!==void 0?e:y$()}else if(s&&!s.user&&!s.user){const o=await Vc(this.storage,this.storageKey+"-user");o&&(o!=null&&o.user)?(s.user=o.user,await us(this.storage,this.storageKey+"-user"),await kb(this.storage,this.storageKey,s)):s.user=y$()}if(this._debug(r,"session from storage",s),!this._isValidSession(s)){this._debug(r,"session is not valid"),s!==null&&await this._removeSession();return}const i=((n=s.expires_at)!==null&&n!==void 0?n:1/0)*1e3-Date.now()<x$;if(this._debug(r,`session has${i?"":" not"} expired with margin of ${x$}s`),i){if(this.autoRefreshToken&&s.refresh_token){const{error:o}=await this._callRefreshToken(s.refresh_token);o&&(p3e(o)?this._debug(r,"refresh discarded by commit guard",o):this._debug(r,"refresh failed",o))}}else if(s.user&&s.user.__isUserNotAvailableProxy===!0)try{const{data:o,error:l}=await this._getUser(s.access_token);!l&&(o!=null&&o.user)?(s.user=o.user,await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)):this._debug(r,"could not get user data, skipping SIGNED_IN notification")}catch(o){console.error("Error getting user data:",o),this._debug(r,"error getting user data, skipping SIGNED_IN notification",o)}else await this._notifyAllSubscribers("SIGNED_IN",s)}catch(s){this._debug(r,"error",s),console.error(s);return}finally{this._debug(r,"end")}}async _callRefreshToken(e){var n,r;if(!e)throw new Zs;if(this.refreshingDeferred)return this.refreshingDeferred.promise;if(this.lastRefreshFailure&&this.lastRefreshFailure.refreshToken===e&&Date.now()<this.lastRefreshFailure.expiresAt)return this._debug("#_callRefreshToken()","returning c
111ached failure (cooldown active)"),this.lastRefreshFailure.result;const s="#_callRefreshToken()";this._debug(s,"begin");try{this.refreshingDeferred=new GL;const i=await Vc(this.storage,this.storageKey),{data:o,error:l}=await this._refreshAccessToken(e);if(l)throw l;if(!o.session)throw new Zs;const c=await Vc(this.storage,this.storageKey);if(i!==null&&(c===null||c.refresh_token!==i.refresh_token)){this._debug(s,"commit guard: storage changed since refresh started, discarding rotated tokens",{startedWith:"present",nowHolds:c?"replaced":"cleared"});const f={data:null,error:new uQ};return this.refreshingDeferred.resolve(f),f}const d=this._sessionRemovalEpoch;if(await this._saveSession(o.session),this._sessionRemovalEpoch!==d){this._debug(s,"commit guard (post-save): _removeSession ran during _saveSession, undoing write"),await us(this.storage,this.storageKey),this.userStorage&&await us(this.userStorage,this.storageKey+"-user");const f={data:null,error:new uQ};return this.refreshingDeferred.resolve(f),f}await this._notifyAllSubscribers("TOKEN_REFRESHED",o.session);const h={data:o.session,error:null};return this.lastRefreshFailure=null,this.refreshingDeferred.resolve(h),h}catch(i){if(this._debug(s,"error",i),We(i)){const o={data:null,error:i};if(!cQ(i)){const l=await Vc(this.storage,this.storageKey);!!(l!=null&&l.expires_at&&l.expires_at*1e3>Date.now())?this._debug(s,"proactive refresh failed, access token still valid â preserving session"):await this._removeSession()}return this.lastRefreshFailure={refreshToken:e,result:o,expiresAt:Date.now()+s3e},(n=this.refreshingDeferred)===null||n===void 0||n.resolve(o),o}throw(r=this.refreshingDeferred)===null||r===void 0||r.reject(i),i}finally{this.refreshingDeferred=null,this._debug(s,"end")}}async _notifyAllSubscribers(e,n,r=!0){const s=`#_notifyAllSubscribers(${e})`;this._debug(s,"begin",n,`broadcast = ${r}`);try{this.broadcastChannel&&r&&this.broadcastChannel.postMessage({event:e,session:n});const i=[],o=Array.from(this.stateChangeEmitters.values()).map(async l=>{try{await l.callback(e,n)}catch(c){i.push(c)}});if(await Promise.all(o),i.length>0){for(let l=0;l<i.length;l+=1)console.error(i[l]);throw i[0]}}finally{this._debug(s,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0,await us(this.storage,`${this.storageKey}-code-verifier`);const n=Object.assign({},e),r=n.user&&n.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!r&&n.user&&await kb(this.userStorage,this.storageKey+"-user",{user:n.user});const s=Object.assign({},n);delete s.user;const i=mQ(s);await kb(this.storage,this.storageKey,i)}else{const s=mQ(n);await kb(this.storage,this.storageKey,s)}}async _removeSession(){this._sessionRemovalEpoch+=1,this._debug("#_removeSession()"),this.lastRefreshFailure=null,this.suppressGetSessionWarning=!1,await us(this.storage,this.storageKey),await us(this.storage,this.storageKey+"-code-verifier"),await us(this.storage,this.storageKey+"-user"),this.userStorage&&await us(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&oa()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}catch(n){console.error("removing visibilitychange callback failed",n)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),Vh);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e);const n=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=n,n&&typeof n=="object"&&typeof n.unref=="function"?n.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(n)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);const n=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,n&&clearTimeout(n)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async dispose(){var e;this._removeVisibilityChangedCallback(),await this._stopAutoRefresh(),(e=this.broadcastChannel)===null||e===void 0||e.close(),this.broadcastChannel=null,this.stateChangeEmitters.clear()}async _autoRefreshTokenTick(){if(this._debug("#_autoRefreshTokenTick()","begin"),this.lock!=null){try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async n=>{const{data:{session:r}}=n;if(!r||!r.refresh_token||!r.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const s=Math.floor((r.expires_at*1e3-e)/Vh);this._debug("#_autoRefreshTokenTick()",`access token expires in ${s} ticks, a tick lasts ${Vh}ms, refresh threshold is ${nN} ticks`),s<=nN&&await this._callRefreshToken(r.refresh_token)})}catch(n){console.error("Auto refresh tick failed with error. This is likely a transient error.",n)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e instanceof q3e)this._debug("auto refresh token tick lock not available");else throw e}return}if(this.refreshingDeferred!==null){this._debug("#_autoRefreshTokenTick()","refresh already in flight, skipping");return}try{const e=Date.now();try{await this._useSession(async n=>{const{data:{session:r}}=n;if(!r||!r.refresh_token||!r.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const s=Math.floor((r.expires_at*1e3-e)/Vh);this._debug("#_autoRefreshTokenTick()",`access token expires in ${s} ticks, a tick lasts ${Vh}ms, refresh threshold is ${nN} ticks`),s<=nN&&await this._callRefreshToken(r.refresh_token)})}catch(n){console.error("Auto refresh tick failed with error. This is likely a transient error.",n)}}finally{this._debug("#_autoRefreshTokenTick()","end")}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!oa()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(e){this._debug("#visibilityChangedCallback","error",e)}},window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const n=`#_onVisibilityChanged(${e})`;if(this._debug(n,"visibilityState",document.visibilityState),document.visibilityState==="visible"){if(this.autoRefreshToken&&this._startAutoRefresh(),!e)if(await this.initializePromise,this.lock!=null)await this._acquireLock(this.lockAcquireTimeout,async()=>
111{if(document.visibilityState!=="visible"){this._debug(n,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()});else{if(document.visibilityState!=="visible"){this._debug(n,"visibilityState is no longer visible, skipping recovery");return}await this._recoverAndRefresh()}}else document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,n,r){const s=[`provider=${encodeURIComponent(n)}`];if(r!=null&&r.redirectTo&&s.push(`redirect_to=${encodeURIComponent(r.redirectTo)}`),r!=null&&r.scopes&&s.push(`scopes=${encodeURIComponent(r.scopes)}`),this.flowType==="pkce"){const[i,o]=await vv(this.storage,this.storageKey),l=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(o)}`});s.push(l.toString())}if(r!=null&&r.queryParams){const i=new URLSearchParams(r.queryParams);s.push(i.toString())}return r!=null&&r.skipBrowserRedirect&&s.push(`skip_http_redirect=${r.skipBrowserRedirect}`),`${e}?${s.join("&")}`}async _unenroll(e){try{return await this._useSession(async n=>{var r;const{data:s,error:i}=n;return i?this._returnResult({data:null,error:i}):await pt(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(r=s==null?void 0:s.session)===null||r===void 0?void 0:r.access_token})})}catch(n){if(We(n))return this._returnResult({data:null,error:n});throw n}}async _enroll(e){try{return await this._useSession(async n=>{var r,s;const{data:i,error:o}=n;if(o)return this._returnResult({data:null,error:o});const l=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:c,error:u}=await pt(this.fetch,"POST",`${this.url}/factors`,{body:l,headers:this.headers,jwt:(r=i==null?void 0:i.session)===null||r===void 0?void 0:r.access_token});return u?this._returnResult({data:null,error:u}):(e.factorType==="totp"&&c.type==="totp"&&(!((s=c==null?void 0:c.totp)===null||s===void 0)&&s.qr_code)&&(c.totp.qr_code=`data:image/svg+xml;utf-8,${c.totp.qr_code}`),this._returnResult({data:c,error:null}))})}catch(n){if(We(n))return this._returnResult({data:null,error:n});throw n}}async _verify(e){const n=async()=>{try{return await this._useSession(async r=>{var s;const{data:i,error:o}=r;if(o)return this._returnResult({data:null,error:o});const l=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?_Q(e.webauthn.credential_response):jQ(e.webauthn.credential_response)})}:{code:e.code}),{data:c,error:u}=await pt(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:l,headers:this.headers,jwt:(s=i==null?void 0:i.session)===null||s===void 0?void 0:s.access_token});return u?this._returnResult({data:null,error:u}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+c.expires_in},c)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",c),this._returnResult({data:c,error:u}))})}catch(r){if(We(r))return this._returnResult({data:null,error:r});throw r}};return this.lock!=null?this._acquireLock(this.lockAcquireTimeout,n):n()}async _challenge(e){const n=async()=>{try{return await this._useSession(async r=>{var s;const{data:i,error:o}=r;if(o)return this._returnResult({data:null,error:o});const l=await pt(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(s=i==null?void 0:i.session)===null||s===void 0?void 0:s.access_token});if(l.error)return l;const{data:c}=l;if(c.type!=="webauthn")return{data:c,error:null};switch(c.webauthn.type){case"create":return{data:Object.assign(Object.assign({},c),{webauthn:Object.assign(Object.assign({},c.webauthn),{credential_options:Object.assign(Object.assign({},c.webauthn.credential_options),{publicKey:bQ(c.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},c),{webauthn:Object.assign(Object.assign({},c.webauthn),{credential_options:Object.assign(Object.assign({},c.webauthn.credential_options),{publicKey:wQ(c.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(r){if(We(r))return this._returnResult({data:null,error:r});throw r}};return this.lock!=null?this._acquireLock(this.lockAcquireTimeout,n):n()}async _challengeAndVerify(e){const{data:n,error:r}=await this._challenge({factorId:e.factorId});return r?this._returnResult({data:null,error:r}):await this._verify({factorId:e.factorId,challengeId:n.id,code:e.code})}async _listFactors(){var e;const{data:{user:n},error:r}=await this.getUser();if(r)return{data:null,error:r};const s={all:[],phone:[],totp:[],webauthn:[]};for(const i of(e=n==null?void 0:n.factors)!==null&&e!==void 0?e:[])s.all.push(i),i.status==="verified"&&s[i.factor_type].push(i);return{data:s,error:null}}async _getAuthenticatorAssuranceLevel(e){var n,r,s,i;if(e)try{const{payload:p}=UT(e);let m=null;p.aal&&(m=p.aal);let v=m;const{data:{user:x},error:g}=await this.getUser(e);if(g)return this._returnResult({data:null,error:g});((r=(n=x==null?void 0:x.factors)===null||n===void 0?void 0:n.filter(j=>j.status==="verified"))!==null&&r!==void 0?r:[]).length>0&&(v="aal2");const _=p.amr||[];return{data:{currentLevel:m,nextLevel:v,currentAuthenticationMethods:_},error:null}}catch(p){if(We(p))return this._returnResult({data:null,error:p});throw p}const{data:{session:o},error:l}
111=await this.getSession();if(l)return this._returnResult({data:null,error:l});if(!o)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:c}=UT(o.access_token);let u=null;c.aal&&(u=c.aal);let d=u;((i=(s=o.user.factors)===null||s===void 0?void 0:s.filter(p=>p.status==="verified"))!==null&&i!==void 0?i:[]).length>0&&(d="aal2");const f=c.amr||[];return{data:{currentLevel:u,nextLevel:d,currentAuthenticationMethods:f},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async n=>{const{data:{session:r},error:s}=n;return s?this._returnResult({data:null,error:s}):r?await pt(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:r.access_token,xform:i=>({data:i,error:null})}):this._returnResult({data:null,error:new Zs})})}catch(n){if(We(n))return this._returnResult({data:null,error:n});throw n}}async _approveAuthorization(e,n){try{return await this._useSession(async r=>{const{data:{session:s},error:i}=r;if(i)return this._returnResult({data:null,error:i});if(!s)return this._returnResult({data:null,error:new Zs});const o=await pt(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"approve"},xform:l=>({data:l,error:null})});return o.data&&o.data.redirect_url&&oa()&&!(n!=null&&n.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(r){if(We(r))return this._returnResult({data:null,error:r});throw r}}async _denyAuthorization(e,n){try{return await this._useSession(async r=>{const{data:{session:s},error:i}=r;if(i)return this._returnResult({data:null,error:i});if(!s)return this._returnResult({data:null,error:new Zs});const o=await pt(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"deny"},xform:l=>({data:l,error:null})});return o.data&&o.data.redirect_url&&oa()&&!(n!=null&&n.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(r){if(We(r))return this._returnResult({data:null,error:r});throw r}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:n},error:r}=e;return r?this._returnResult({data:null,error:r}):n?await pt(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,xform:s=>({data:s,error:null})}):this._returnResult({data:null,error:new Zs})})}catch(e){if(We(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async n=>{const{data:{session:r},error:s}=n;return s?this._returnResult({data:null,error:s}):r?(await pt(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new Zs})})}catch(n){if(We(n))return this._returnResult({data:null,error:n});throw n}}async fetchJwk(e,n={keys:[]}){let r=n.keys.find(l=>l.kid===e);if(r)return r;const s=Date.now();if(r=this.jwks.keys.find(l=>l.kid===e),r&&this.jwks_cached_at+c3e>s)return r;const{data:i,error:o}=await pt(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=s,r=i.keys.find(l=>l.kid===e),!r)?null:r}async getClaims(e,n={}){try{let r=e;if(!r){const{data:p,error:m}
111=await this.getSession();if(m||!p.session)return this._returnResult({data:null,error:m});r=p.session.access_token}const{header:s,payload:i,signature:o,raw:{header:l,payload:c}}=UT(r);if(!(n!=null&&n.allowExpired))try{M3e(i.exp)}catch(p){throw new jO(p instanceof Error?p.message:"JWT validation failed")}const u=!s.alg||s.alg.startsWith("HS")||!s.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(s.kid,n!=null&&n.keys?{keys:n.keys}:n==null?void 0:n.jwks);if(!u){const{error:p}=await this.getUser(r);if(p)throw p;return{data:{claims:i,header:s,signature:o},error:null}}const d=R3e(s.alg),h=await crypto.subtle.importKey("jwk",u,d,!0,["verify"]);if(!await crypto.subtle.verify(d,h,o,y3e(`${l}.${c}`)))throw new jO("Invalid JWT signature");return{data:{claims:i,header:s,signature:o},error:null}}catch(r){if(We(r))return this._returnResult({data:null,error:r});throw r}}async signInWithPasskey(e){var n,r,s;Yc(this.experimental);try{if(!CO())return this._returnResult({data:null,error:new yu("Browser does not support WebAuthn",null)});const{data:i,error:o}=await this._startPasskeyAuthentication({options:{captchaToken:(n=e==null?void 0:e.options)===null||n===void 0?void 0:n.captchaToken}});if(o||!i)return this._returnResult({data:null,error:o});const l=wQ(i.options),c=(s=(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.signal)!==null&&s!==void 0?s:L6.createNewAbortSignal(),{data:u,error:d}=await Yhe({publicKey:l,signal:c});if(d||!u)return this._returnResult({data:null,error:d??new yu("WebAuthn ceremony failed",null)});const h=jQ(u);return this._verifyPasskeyAuthentication({challengeId:i.challenge_id,credential:h})}catch(i){if(We(i))return this._returnResult({data:null,error:i});throw i}}async registerPasskey(e){var n,r;Yc(this.experimental);try{if(!CO())return this._returnResult({data:null,error:new yu("Browser does not support WebAuthn",null)});const{data:s,error:i}=await this._startPasskeyRegistration();if(i||!s)return this._returnResult({data:null,error:i});const o=bQ(s.options),l=(r=(n=e==null?void 0:e.options)===null||n===void 0?void 0:n.signal)!==null&&r!==void 0?r:L6.createNewAbortSignal(),{data:c,error:u}=await Ghe({publicKey:o,signal:l});if(u||!c)return this._returnResult({data:null,error:u??new yu("WebAuthn ceremony failed",null)});const d=_Q(c);return this._verifyPasskeyRegistration({challengeId:s.challenge_id,credential:d})}catch(s){if(We(s))return this._returnResult({data:null,error:s});throw s}}async _startPasskeyRegistration(){Yc(this.experimental);try{return await this._useSession(async e=>{const{data:{session:n},error:r}=e;if(r)return this._returnResult({data:null,error:r});if(!n)return this._returnResult({data:null,error:new Zs});const{data:s,error:i}=await pt(this.fetch,"POST",`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:n.access_token,body:{}});return i?this._returnResult({data:null,error:i}):this._returnResult({data:s,error:null})})}catch(e){if(We(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyRegistration(e){Yc(this.experimental);try{return await this._useSession(async n=>{const{data:{session:r},error:s}=n;if(s)return this._returnResult({data:null,error:s});if(!r)return this._returnResult({data:null,error:new Zs});const{data:i,error:o}=await pt(this.fetch,"POST",`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:r.access_token,body:{challenge_id:e.challengeId,credential:e.credential}});return o?this._returnResult({data:null,error:o}):this._returnResult({data:i,error:null})})}catch(n){if(We(n))return this._returnResult({data:null,error:n});throw n}}async _startPasskeyAuthentication(e){var n;Yc(this.experimental);try{const{data:r,error:s}=await pt(this.fetch,"POST",`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:(n=e==null?void 0:e.options)===null||n===void 0?void 0:n.captchaToken}}});return s?this._returnResult({data:null,error:s}):this._returnResult({data:r,error:null})}catch(r){if(We(r))return this._returnResult({data:null,error:r});throw r}}async _verifyPasskeyAuthentication(e){Yc(this.experimental);try{const{data:n,error:r}=await pt(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:e.challengeId,credential:e.credential},xform:Jl});return r?this._returnResult({data:null,error:r}):(n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",n.session)),this._returnResult({data:n,error:null}))}catch(n){if(We(n))return this._returnResult({data:null,error:n});throw n}}async _listPasskeys(){Yc(this.experimental);try{return await this._useSession(async e=>{const{data:{session:n},error:r}=e;if(r)return this._returnResult({data:null,error:r});if(!n)return this._returnResult({data:null,error:new Zs});const{data:s,error:i}=await pt(this.fetch,"GET",`${this.url}/passkeys`,{headers:this.headers,jwt:n.access_token,xform:o=>({data:o,error:null})});return i?this._returnResult({data:null,error:i}):this._returnResult({data:s,error:null})})}catch(e){if(We(e))return this._returnResult({data:null,error:e});throw e}}async _updatePasskey(e){Yc(this.experimental);try{return await this._useSession(async n=>{const{data:{session:r},error:s}=n;if(s)return this._returnResult({data:null,error:s});if(!r)return this._returnResult({data:null,error:new Zs});const{data:i,error:o}=await pt(this.fetch,"PATCH",`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:r.access_token,body:{friendly_name:e.friendlyName}});return o?this._returnResult({data:null,error:o}):this._returnResult({data:i,error:null})})}catch(n){if(We(n))return this._returnResult({data:null,error:n});throw n}}async _deletePasskey(e){Yc(this.experimental);try{return await this._useSession(async n=>{const{data:{session:r},error:s}=n;if(s)return this._returnResult({data:null,error:s});if(!r)return this._returnResult({data:null,error:new Zs});const{error:i}
111=await pt(this.fetch,"DELETE",`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:r.access_token,noResolveJson:!0});return i?this._returnResult({data:null,error:i}):this._returnResult({data:null,error:null})})}catch(n){if(We(n))return this._returnResult({data:null,error:n});throw n}}}lk.nextInstanceID={};const r4e=lk,s4e="2.108.2";let rN="",AO;if(typeof Deno<"u"){var w$;rN="deno",AO=(w$=Deno.version)===null||w$===void 0?void 0:w$.deno}else if(typeof document<"u")rN="web";else if(typeof navigator<"u"&&navigator.product==="ReactNative")rN="react-native";else{var _$;rN="node",AO=typeof process<"u"?(_$=process.version)===null||_$===void 0?void 0:_$.replace(/^v/,""):void 0}const Xhe=[`runtime=${rN}`];AO&&Xhe.push(`runtime-version=${AO}`);const i4e={"X-Client-Info":`supabase-js/${s4e}; ${Xhe.join("; ")}`},a4e={headers:i4e},o4e={schema:"public"},l4e={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},c4e={},u4e={enabled:!1,respectSamplingDecision:!0};function d4e(t,e,n,r){function s(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function l(d){try{u(r.next(d))}catch(h){o(h)}}function c(d){try{u(r.throw(d))}catch(h){o(h)}}function u(d){d.done?i(d.value):s(d.value).then(l,c)}u((r=r.apply(t,[])).next())})}let j$=null;const h4e="@opentelemetry/api";function f4e(){return j$===null&&(j$=import(h4e).catch(()=>null)),j$}function p4e(){return d4e(this,void 0,void 0,function*(){try{const t=yield f4e();if(!t||!t.propagation||!t.context)return null;const e={};t.propagation.inject(t.context.active(),e);const n=e.traceparent;return n?{traceparent:n,tracestate:e.tracestate,baggage:e.baggage}:null}catch{return null}})}function m4e(t){if(!t||typeof t!="string")return null;const e=t.split("-");if(e.length!==4)return null;const[n,r,s,i]=e;if(n.length!==2||r.length!==32||s.length!==16||i.length!==2)return null;const o=/^[0-9a-f]+$/i;return!o.test(n)||!o.test(r)||!o.test(s)||!o.test(i)||r==="00000000000000000000000000000000"||s==="0000000000000000"?null:{version:n,traceId:r,parentId:s,traceFlags:i,isSampled:(parseInt(i,16)&1)===1}}function g4e(t,e){if(!t||!e||e.length===0)return!1;let n;if(t instanceof URL)n=t;else try{n=new URL(t)}catch{return!1}for(const r of e)try{if(typeof r=="string"){if(v4e(n.hostname,r))return!0}else if(r instanceof RegExp){if(r.test(n.hostname))return!0}else if(typeof r=="function"&&r(n))return!0}catch{continue}return!1}function v4e(t,e){if(e===t)return!0;if(e.startsWith("*.")){const n=e.slice(2);if(t.endsWith(n)&&(t===n||t.endsWith("."+n)))return!0}return!1}function x4e(t){const e=[];try{const n=new URL(t);e.push(n.hostname)}catch{}return e.push("*.supabase.co","*.supabase.in"),e.push("localhost","127.0.0.1","[::1]"),e}function ck(t){"@babel/helpers - typeof";return ck=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},ck(t)}function y4e(t,e){if(ck(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(ck(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function b4e(t){var e=y4e(t,"string");return ck(e)=="symbol"?e:e+""}function w4e(t,e,n){return(e=b4e(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function SQ(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Xr(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?SQ(Object(n),!0).forEach(function(r){w4e(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):SQ(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}const _4e=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),j4e=()=>Headers,S4e=(t,e,n,r,s)=>{const i=_4e(r),o=j4e(),l=(s==null?void 0:s.enabled)===!0,c=(s==null?void 0:s.respectSamplingDecision)!==!1,u=l?x4e(e):null;return async(d,h)=>{var f;const p=(f=await n())!==null&&f!==void 0?f:t;let m=new o(h==null?void 0:h.headers);if(m.has("apikey")||m.set("apikey",t),m.has("Authorization")||m.set("Authorization",`Bearer ${p}`),u){const v=await N4e(d,u,c);v&&(v.traceparent&&!m.has("traceparent")&&m.set("traceparent",v.traceparent),v.tracestate&&!m.has("tracestate")&&m.set("tracestate",v.tracestate),v.baggage&&!m.has("baggage")&&m.set("baggage",v.baggage))}return i(d,Xr(Xr({},h),{},{headers:m}))}};async function N4e(t,e,n){if(!g4e(typeof t=="string"||t instanceof URL?t:t.url,e))return null;const r=await p4e();if(!r||!r.traceparent)return null;if(n){const s=m4e(r.traceparent);if(s&&!s.isSampled)return null}return r}function NQ(t){return typeof t=="boolean"?{enabled:t}:t}function C4e(t){return t.endsWith("/")?t:t+"/"}function k4e(t,e){var n,r,s,i,o,l;const{db:c,auth:u,realtime:d,global:h}=t,{db:f,auth:p,realtime:m,global:v}=e,x=NQ(t.tracePropagation),g=NQ(e.tracePropagation),w={db:Xr(Xr({},f),c),auth:Xr(Xr({},p),u),realtime:Xr(Xr({},m),d),storage:{},global:Xr(Xr(Xr({},v),h),{},{headers:Xr(Xr({},(n=v==null?void 0:v.headers)!==null&&n!==void 0?n:{}),(r=h==null?void 0:h.headers)!==null&&r!==void 0?r:{})}),tracePropagation:{enabled:(s=(i=x==null?void 0:x.enabled)!==null&&i!==void 0?i:g==null?void 0:g.enabled)!==null&&s!==void 0?s:!1,respectSamplingDecision:(o=(l=x==null?void 0:x.respectSamplingDecision)!==null&&l!==void 0?l:g==null?void 0:g.respectSamplingDecision)!==null&&o!==void 0?o:!0},accessToken:async()=>""};return t.accessToken?w.accessToken=t.accessToken:delete w.accessToken,w}function A4e(t){const e=t==null?void 0:t.trim();if(!e)throw new Error("supabaseUrl is required.");
111if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(C4e(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var E4e=class extends r4e{constructor(t){super(t)}},T4e=class{constructor(t,e,n){var r,s;this.supabaseUrl=t,this.supabaseKey=e;const i=A4e(t);if(!e)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",i),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",i),this.storageUrl=new URL("storage/v1",i),this.functionsUrl=new URL("functions/v1",i);const o=`sb-${i.hostname.split(".")[0]}-auth-token`,l={db:o4e,realtime:c4e,auth:Xr(Xr({},l4e),{},{storageKey:o}),global:a4e,tracePropagation:u4e},c=k4e(n??{},l);if(this.settings=c,this.storageKey=(r=c.auth.storageKey)!==null&&r!==void 0?r:"",this.headers=(s=c.global.headers)!==null&&s!==void 0?s:{},c.accessToken)this.accessToken=c.accessToken,this.auth=new Proxy({},{get:(d,h)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(h)} is not possible`)}});else{var u;this.auth=this._initSupabaseAuthClient((u=c.auth)!==null&&u!==void 0?u:{},this.headers,c.global.fetch)}this.fetch=S4e(e,t,this._getAccessToken.bind(this),c.global.fetch,c.tracePropagation),this.realtime=this._initRealtimeClient(Xr({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},c.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(d=>this.realtime.setAuth(d)).catch(d=>console.warn("Failed to set initial Realtime auth token:",d)),this.rest=new VDe(new URL("rest/v1",i).href,{headers:this.headers,schema:c.db.schema,fetch:this.fetch,timeout:c.db.timeout,urlLengthLimit:c.db.urlLengthLimit}),this.storage=new r3e(this.storageUrl.href,this.headers,this.fetch,n==null?void 0:n.storage),c.accessToken||this._listenForAuthEvents()}get functions(){return new IDe(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,e={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(t,e,n)}channel(t,e={config:{}}){return this.realtime.channel(t,e)}getChannels(){return this.realtime.getChannels()}removeChannel(t){return this.realtime.removeChannel(t)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var t=this,e,n;if(t.accessToken)return await t.accessToken();const{data:r}=await t.auth.getSession();return(e=(n=r.session)===null||n===void 0?void 0:n.access_token)!==null&&e!==void 0?e:t.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:e,detectSessionInUrl:n,storage:r,userStorage:s,storageKey:i,flowType:o,lock:l,debug:c,throwOnError:u,experimental:d,lockAcquireTimeout:h,skipAutoInitialize:f},p,m){const v={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new E4e({url:this.authUrl.href,headers:Xr(Xr({},v),p),storageKey:i,autoRefreshToken:t,persistSession:e,detectSessionInUrl:n,storage:r,userStorage:s,flowType:o,lock:l,debug:c,throwOnError:u,experimental:d,fetch:m,lockAcquireTimeout:h,skipAutoInitialize:f,hasCustomAuthorizationHeader:Object.keys(this.headers).some(x=>x.toLowerCase()==="authorization")})}_initRealtimeClient(t){return new CLe(this.realtimeUrl.href,Xr(Xr({},t),{},{params:Xr(Xr({},{apikey:this.supabaseKey}),t==null?void 0:t.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((t,e)=>{this._handleTokenChanged(t,"CLIENT",e==null?void 0:e.access_token)})}_handleTokenChanged(t,e,n){(t==="TOKEN_REFRESHED"||t==="SIGNED_IN")&&this.changedAccessToken!==n?(this.changedAccessToken=n,this.realtime.setAuth(n)):t==="SIGNED_OUT"&&(this.realtime.setAuth(),e=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const Jhe=(t,e,n)=>new T4e(t,e,n);function P4e(){if(typeof window<"u")return!1;const t=globalThis.process;if(!t)return!1;const e=t.version;if(e==null)return!1;const n=e.match(/^v(\d+)\./);return n?parseInt(n[1],10)<=18:!1}P4e()&&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 N
111ode.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");const M4e="https://aanjkhoyzcvhokzsmifu.supabase.co",R4e="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImFhbmpraG95emN2aG9renNtaWZ1Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzU0ODIxMTgsImV4cCI6MjA5MTA1ODExOH0.FZffw1trnRiA182HIsLL4uQALqBG6SHIIttPS-tq-Qo",Z=Jhe(M4e,R4e),O4e=Object.freeze(Object.defineProperty({__proto__:null,supabase:Z},Symbol.toStringTag,{value:"Module"})),CQ={"nav.actualites":"Actualités","nav.magazines":"Nos Magazines","nav.carte":"Carte Privilège","nav.carnet":"Carnets d'adresses","nav.boutique":"Boutique","nav.contact":"Contact","nav.destinations":"Destinations","nav.evenements":"Ãvénements","nav.home":"Accueil","account.login":"Se connecter","account.logout":"Se déconnecter","account.signup":"Créer un compte","account.my":"Mon compte","account.favorites":"Mes favoris","account.orders":"Mes commandes","account.myCard":"Ma Carte Privilège","action.search":"Rechercher","action.cart":"Panier","action.readMore":"Lire la suite","action.readArticle":"Lire l'article","action.seeAll":"Voir tout","action.back":"Retour","action.share":"Partager","action.copyLink":"Copier le lien","action.send":"Envoyer","action.save":"Enregistrer","action.cancel":"Annuler","action.close":"Fermer","action.subscribe":"S'abonner","action.addToCart":"Ajouter au panier","action.checkout":"Passer commande","action.continueShopping":"Continuer mes achats","action.menu":"Menu","shop.title":"Boutique","shop.products":"Produits","shop.price":"Prix","shop.quantity":"Quantité","shop.total":"Total","shop.subtotal":"Sous-total","shop.shipping":"Livraison","shop.emptyCart":"Votre panier est vide","shop.outOfStock":"Rupture de stock","shop.inStock":"En stock","shop.freeShipping":"Livraison offerte","shop.orderSummary":"Récapitulatif de commande","article.publishedOn":"Publié le","article.readingTime":"min de lecture","article.by":"Par","article.related":"à lire également","article.notFound":"Article introuvable","article.backToNews":"Retour aux actualités","article.translating":"ð English translation loadingâ¦","article.machineTranslated":"Cet article a été traduit automatiquement depuis le français.","form.name":"Nom","form.firstName":"Prénom","form.lastName":"Nom de famille","form.email":"Email","form.phone":"Téléphone","form.subject":"Sujet","form.message":"Message","form.password":"Mot de passe","form.required":"Ce champ est obligatoire","form.invalidEmail":"Adresse email invalide","msg.loading":"Chargementâ¦","msg.error":"Une erreur est survenue. Merci de réessayer.","msg.success":"C'est enregistré !","msg.noResults":"Aucun résultat","msg.pageNotFound":"Cette page n'existe pas","newsletter.title":"Newsletter","newsletter.subt
111itle":"Recevez le meilleur de l'Andalousie dans votre boîte mail.","newsletter.placeholder":"[email protected]","footer.followUs":"Suivez-nous","footer.legal":"Mentions légales","footer.privacy":"Politique de confidentialité","footer.cookies":"Politique de cookies","footer.cgv":"Conditions générales de vente","footer.rights":"Tous droits réservés"},Qhe="esprit-sud-lang";function YL(t){return t==="/en"||t.startsWith("/en/")?"en":"fr"}function I4e(){return YL(window.location.pathname)==="en"?"/en":"/"}function D4e(t){return t==="/en"?"/":t.startsWith("/en/")?t.slice(3)||"/":t||"/"}function uC(t,e){const n=D4e(t.startsWith("/")?t:`/${t}`);return e==="fr"?n:n==="/"?"/en/":`/en${n}`}function L4e(){try{const t=localStorage.getItem(Qhe);return t==="fr"||t==="en"?t:null}catch{return null}}function EO(t){try{localStorage.setItem(Qhe,t)}catch{}}function F4e(){var n;return(((n=navigator.languages)!=null&&n.length?navigator.languages:[navigator.language])[0]||"").toLowerCase().startsWith("en")}function $4e(){const t=window.location.pathname;if(t==="/fr"||t.startsWith("/fr/")){EO("fr"),window.location.replace((t.slice(3)||"/")+window.location.search+window.location.hash);return}YL(t)==="en"||t.startsWith("/admin")||t.startsWith("/annonceurs")||navigator.webdriver||/bot|crawl|spider|slurp|facebookexternalhit|whatsapp|telegram|linkedin|twitter|discord|skype|pinterest|embedly|preview|headless|lighthouse/i.test(navigator.userAgent)||(L4e()??(F4e()?"en":"fr"))!=="en"||window.location.replace(uC(t,"en")+window.location.search+window.location.hash)}const Zhe=b.createContext(void 0);function Uu(){const t=b.useContext(Zhe);if(!t)throw new Error("useLanguage must be used within LanguageProvider");return t}const kQ="ui",z4e=({children:t})=>{const e=xo(),n=b.useMemo(()=>YL(window.location.pathname),[]),[r,s]=b.useState({}),[i,o]=b.useState(n==="fr"),l=b.useRef(new Set),c=b.useRef(null),u=b.useRef(!1),d=b.useCallback(async()=>{const{data:g,error:w}=await Z.from("translations").select("key, en").eq("namespace",kQ);if(!w&&g){const _={};for(const j of g)j.en&&(_[j.key]=j.en);s(_)}o(!0)},[]);b.useEffect(()=>{n==="en"&&d()},[n,d]);const h=b.useCallback(async()=>{const g=Array.from(l.current);if(l.current.clear(),!g.length||u.current)return;u.current=!0;const w={};for(const _ of g){const j=CQ[_];j&&(w[_]=j)}if(Object.keys(w).length)try{await Z.functions.invoke("translate-to-english",{body:{type:"ui",namespace:kQ,texts:w}}),await d()}catch(_){console.warn("[i18n] traduction UI en arrière-plan échouée",_)}},[d]),f=b.useCallback(()=>{c.current&&window.clearTimeout(c.current),c.current=window.setTimeout(()=>void h(),1200)},[h]),p=b.useCallback(g=>{const w=CQ[g]??String(g);if(n==="fr")return w;const _=r[g];return _||(i&&(l.current.add(g),f()),w)},[n,r,i,f]),m=b.useCallback(g=>{EO(g);const w=uC(window.location.pathname,g)+window.location.search+window.location.hash;window.location.assign(w)},[]),v=e.pathname||"/",x=b.useMemo(()=>({lang:n,setLang:m,neutralPath:v,t:p,ready:i}),[n,m,v,p,i]);return a.jsx(Zhe.Provider,{value:x,children:t})},efe="esprit-sud-auto-translations",S$="auto-ui",B4e=60,U4e=350;function AQ(t){let e=0;for(let n=0;n<t.length;n++)e=(e<<5)-e+t.charCodeAt(n),e|=0;return"t"+Math.abs(e).toString(36)+t.length.toString(36)}function q4e(){const t=new Map;try{const e=localStorage.getItem(efe);if(e){const n=JSON.parse(e);if(n&&typeof n=="object")for(const[r,s]of Object.entries(n))typeof s=="string"&&t.set(r,s)}}catch{}return t}function EQ(t){try{const e={};for(const[n,r]of t)e[n]=r;localStorage.setItem(efe,JSON.stringify(e))}catch{}}const V4e=new Set(["SCRIPT","STYLE","NOSCRIPT","IFRAME","CODE","PRE","TEXTAREA","SELECT","SVG","MATH","TEMPLATE","KBD","SAMP"]),H4e=/^https?:\/\/|^(www\.|mailto:|tel:)/i,W4e=/^[\d\s\-+.,â¬$£¥%/():]*$/,TQ=["placeholder","title","aria-label","alt"];function PQ(t){const e=t.trim();return!(e.length<2||H4e.test(e)||W4e.test(e)||!/[a-zA-Z\u00C0-\u024F]{2,}/.test(e))}function N$(t){for(;t;){if(V4e.has(t.tagName)||t.hasAttribute("data-no-translate"))return!0;t=t.parentElement}return!1}
111let K4e=class{constructor(e){Te(this,"cache");Te(this,"pending",new Map);Te(this,"pendingTimer",null);Te(this,"flushInProgress",!1);Te(this,"observer",null);Te(this,"root");Te(this,"processing",!1);Te(this,"applied",new WeakMap);Te(this,"appliedAttrs",new WeakMap);Te(this,"rescan",null);Te(this,"englishValues",new Set);Te(this,"failures",0);Te(this,"stopped",!1);this.root=e,this.cache=q4e();for(const n of this.cache.values())this.englishValues.add(n)}start(){this.observer||(this.stopped=!1,this.preloadAll(),this.processTree(this.root),this.observer=new MutationObserver(e=>this.handleMutations(e)),this.observer.observe(this.root,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:TQ}))}async preloadAll(){try{let n=0,r=!1;for(let s=0;s<20;s++){const{data:i,error:o}=await Z.from("translations").select("key, en").eq("namespace",S$).range(n,n+1e3-1);if(o)throw o;const l=i??[];for(const c of l)c.en&&!this.cache.has(c.key)&&(this.cache.set(c.key,c.en),this.englishValues.add(c.en),r=!0);if(l.length<1e3)break;n+=1e3}r&&!this.stopped&&(EQ(this.cache),this.scheduleRescan())}catch(e){console.warn("[dom-translator] preload failed",e)}}stop(){var e;this.stopped=!0,this.pendingTimer&&window.clearTimeout(this.pendingTimer),this.pendingTimer=null,this.rescan&&window.clearTimeout(this.rescan),this.rescan=null,(e=this.observer)==null||e.disconnect(),this.observer=null}handleMutations(e){if(this.processing){this.scheduleRescan();return}const n=new Set;for(const r of e)if(r.type==="characterData"||r.type==="attributes")n.add(r.target);else for(const s of r.addedNodes)n.add(s);for(const r of n)r.nodeType===Node.TEXT_NODE?this.processTextNode(r):r.nodeType===Node.ELEMENT_NODE&&this.processTree(r)}processTree(e){if(e.nodeType===Node.ELEMENT_NODE&&N$(e))return;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT|NodeFilter.SHOW_ELEMENT,null);e.nodeType===Node.ELEMENT_NODE&&this.processAttributes(e);let r;for(;r=n.nextNode();)r.nodeType===Node.TEXT_NODE?this.processTextNode(r):this.processAttributes(r)}processAttributes(e){if(N$(e))return;const n=this.appliedAttrs.get(e)??{};for(const r of TQ){const s=e.getAttribute(r);if(!s)continue;const i=s.trim();if(n[r]===i||this.englishValues.has(i)||!PQ(i))continue;const o=AQ(i),l=this.cache.get(o);l&&l!==i?(this.processing=!0,e.setAttribute(r,l),n[r]=l,this.appliedAttrs.set(e,n),this.releaseProcessing()):this.cache.has(o)||this.enqueue(o,i)}}processTextNode(e){const n=e.parentElement;if(!n||N$(n))return;const s=(e.textContent||"").trim();if(!PQ(s)||this.applied.get(e)===s||this.englishValues.has(s))return;const i=AQ(s),o=this.cache.get(i);if(o&&o!==s){this.applyTranslation(e,o);return}this.cache.has(i)||this.enqueue(i,s)}enqueue(e,n){this.failures>=3||this.pending.has(e)||(this.pending.set(e,n),this.scheduleFlush())}applyTranslation(e,n){var l,c;const r=e.textContent||"",s=((l=r.match(/^\s*/))==null?void 0:l[0])??"",i=((c=r.match(/\s*$/))==null?void 0:c[0])??"",o=s+n+i;o!==r&&(this.processing=!0,e.textContent=o,this.applied.set(e,n),this.releaseProcessing())}releaseProcessing(){requestAnimationFrame(()=>{this.processing=!1})}scheduleFlush(){this.pendingTimer&&window.clearTimeout(this.pendingTimer),this.pendingTimer=window.setTimeout(()=>void this.flush(),U4e)}scheduleRescan(){this.rescan&&window.clearTimeout(this.rescan),this.rescan=window.setTimeout(()=>this.processTree(this.root),80)}async flush(){if(this.flushInProgress||!this.pending.size)return;this.flushInProgress=!0;const e=Array.from(this.pending.entries()).slice(0,B4e);for(const[r]of e)this.pending.delete(r);const n=Object.fromEntries(e);try{const{error:r}=await Z.functions.invoke("translate-to-english",{body:{type:"ui",namespace:S$,texts:n}});if(r)throw r;await this.reloadCache(e.map(([s])=>s)),this.failures=0}catch(r){if(console.warn("[dom-translator] flush failed",r),this.failures+=1,this.failures<3)for(const[s,i]of e)this.cache.has(s)||this.pending.set(s,i);else this.pending.clear()}finally{this.flushInProgress=!1,this.pending.size&&this.scheduleFlush()}}async reloadCache(e){try{const{data:n,error:r}=await Z.from("translations").select("key, en").eq("namespace",S$).in("key",e);if(r)throw r;let s=!1;for(const i of n??[])i.en&&(this.cache.set(i.key,i.en),this.englishValues.add(i.en),s=!0);s&&(EQ(this.cache),this.scheduleRescan())}catch(n){console.warn("[dom-translator] reload cache failed",n)}}};const tfe=()=>{const{lang:t}=Uu(),e=b.useRef(null);return b.useEffect(()=>{var s;if(t!=="en"||window.location.pathname.includes("/admin")){(s=e.current)==null||s.stop(),e.current=null;return}const n=document.getElementById("root");
111if(!n)return;const r=new K4e(n);return e.current=r,r.start(),()=>{r.stop(),e.current=null}},[t]),null},G4e="G-ZZTL2P4511",Y4e=()=>{const t=xo();return b.useEffect(()=>{if(typeof window.gtag!="function")return;const e=t.pathname+t.search;window.gtag("config",G4e,{page_path:e})},[t.pathname,t.search]),null};var MQ=["light","dark"],X4e="(prefers-color-scheme: dark)",J4e=b.createContext(void 0),Q4e={setTheme:t=>{},themes:[]},Z4e=()=>{var t;return(t=b.useContext(J4e))!=null?t:Q4e};b.memo(({forcedTheme:t,storageKey:e,attribute:n,enableSystem:r,enableColorScheme:s,defaultTheme:i,value:o,attrs:l,nonce:c})=>{let u=i==="system",d=n==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${l.map(m=>`'${m}'`).join(",")})`};`:`var d=document.documentElement,n='${n}',s='setAttribute';`,h=s?MQ.includes(i)&&i?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${i}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",f=(m,v=!1,x=!0)=>{let g=o?o[m]:m,w=v?m+"|| ''":`'${g}'`,_="";return s&&x&&!v&&MQ.includes(m)&&(_+=`d.style.colorScheme = '${m}';`),n==="class"?v||g?_+=`c.add(${w})`:_+="null":g&&(_+=`d[s](n,${w})`),_},p=t?`!function(){${d}${f(t)}}()`:r?`!function(){try{${d}var e=localStorage.getItem('${e}');if('system'===e||(!e&&${u})){var t='${X4e}',m=window.matchMedia(t);if(m.media!==t||m.matches){${f("dark")}}else{${f("light")}}}else if(e){${o?`var x=${JSON.stringify(o)};`:""}${f(o?"x[e]":"e",!0)}}${u?"":"else{"+f(i,!1,!1)+"}"}${h}}catch(e){}}()`:`!function(){try{${d}var e=localStorage.getItem('${e}');if(e){${o?`var x=${JSON.stringify(o)};`:""}${f(o?"x[e]":"e",!0)}}else{${f(i,!1,!1)};}${h}}catch(t){}}();`;return b.createElement("script",{nonce:c,dangerouslySetInnerHTML:{__html:p}})});var eFe=t=>{switch(t){case"success":return rFe;case"info":return iFe;case"warning":return sFe;case"error":return aFe;default:return null}},tFe=Array(12).fill(0),nFe=({visible:t,className:e})=>ve.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":t},ve.createElement("div",{className:"sonner-spinner"},tFe.map((n,r)=>ve.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),rFe=ve.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ve.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"})),sFe=ve.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},ve.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"})),iFe=ve.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ve.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"})),aFe=ve.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ve.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"})),oFe=ve.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"},ve.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),ve.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),lFe=()=>{let[t,e]=ve.useState(document.hidden);return ve.useEffect(()=>{let n=()=>{e(document.hidden)};
111return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),t},F6=1,cFe=class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{let e=this.subscribers.indexOf(t);this.subscribers.splice(e,1)}),this.publish=t=>{this.subscribers.forEach(e=>e(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var e;let{message:n,...r}=t,s=typeof(t==null?void 0:t.id)=="number"||((e=t.id)==null?void 0:e.length)>0?t.id:F6++,i=this.toasts.find(l=>l.id===s),o=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(s)&&this.dismissedToasts.delete(s),i?this.toasts=this.toasts.map(l=>l.id===s?(this.publish({...l,...t,id:s,title:n}),{...l,...t,id:s,dismissible:o,title:n}):l):this.addToast({title:n,...r,dismissible:o,id:s}),s},this.dismiss=t=>(this.dismissedToasts.add(t),t||this.toasts.forEach(e=>{this.subscribers.forEach(n=>n({id:e.id,dismiss:!0}))}),this.subscribers.forEach(e=>e({id:t,dismiss:!0})),t),this.message=(t,e)=>this.create({...e,message:t}),this.error=(t,e)=>this.create({...e,message:t,type:"error"}),this.success=(t,e)=>this.create({...e,type:"success",message:t}),this.info=(t,e)=>this.create({...e,type:"info",message:t}),this.warning=(t,e)=>this.create({...e,type:"warning",message:t}),this.loading=(t,e)=>this.create({...e,type:"loading",message:t}),this.promise=(t,e)=>{if(!e)return;let n;e.loading!==void 0&&(n=this.create({...e,promise:t,type:"loading",message:e.loading,description:typeof e.description!="function"?e.description:void 0}));let r=t instanceof Promise?t:t(),s=n!==void 0,i,o=r.then(async c=>{if(i=["resolve",c],ve.isValidElement(c))s=!1,this.create({id:n,type:"default",message:c});else if(dFe(c)&&!c.ok){s=!1;let u=typeof e.error=="function"?await e.error(`HTTP error! status: ${c.status}`):e.error,d=typeof e.description=="function"?await e.description(`HTTP error! status: ${c.status}`):e.description;this.create({id:n,type:"error",message:u,description:d})}else if(e.success!==void 0){s=!1;let u=typeof e.success=="function"?await e.success(c):e.success,d=typeof e.description=="function"?await e.description(c):e.description;this.create({id:n,type:"success",message:u,description:d})}}).catch(async c=>{if(i=["reject",c],e.error!==void 0){s=!1;let u=typeof e.error=="function"?await e.error(c):e.error,d=typeof e.description=="function"?await e.description(c):e.description;this.create({id:n,type:"error",message:u,description:d})}}).finally(()=>{var c;s&&(this.dismiss(n),n=void 0),(c=e.finally)==null||c.call(e)}),l=()=>new Promise((c,u)=>o.then(()=>i[0]==="reject"?u(i[1]):c(i[1])).catch(u));return typeof n!="string"&&typeof n!="number"?{unwrap:l}:Object.assign(n,{unwrap:l})},this.custom=(t,e)=>{let n=(e==null?void 0:e.id)||F6++;return this.create({jsx:t(n),id:n,...e}),n},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Do=new cFe,uFe=(t,e)=>{let n=(e==null?void 0:e.id)||F6++;return Do.addToast({title:t,...e,id:n}),n},dFe=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",hFe=uFe,fFe=()=>Do.toasts,pFe=()=>Do.getActiveToasts(),ee=Object.assign(hFe,{success:Do.success,info:Do.info,warning:Do.warning,error:Do.error,custom:Do.custom,message:Do.message,promise:Do.promise,dismiss:Do.dismiss,loading:Do.loading},{getHistory:fFe,getToasts:pFe});function mFe(t,{insertAt:e}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",e==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}mFe(`: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;
111left: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}
111: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%);
111--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%)} 112`);function qT(t){return t.label!==void 0}var gFe=3,vFe="32px",xFe="16px",RQ=4e3,yFe=356,bFe=14,wFe=20,_Fe=200;function Hc(...t){return t.filter(Boolean).join(" ")}function jFe(t){let[e,n]=t.split("-"),r=[];return e&&r.push(e),n&&r.push(n),r}var SFe=t=>{var e,n,r,s,i,o,l,c,u,d,h;let{invert:f,toast:p,unstyled:m,interacting:v,setHeights:x,visibleToasts:g,heights:w,index:_,toasts:j,expanded:N,removeToast:S,defaultRichColors:C,closeButton:k,style:E,cancelButtonStyle:P,actionButtonStyle:T,className:M="",descriptionClassName:R="",duration:A,position:I,gap:D,loadingIcon:O,expandByDefault:z,classNames:B,icons:G,closeButtonAriaLabel:U="Close toast",pauseWhenPageIsHidden:F}=t,[W,Q]=ve.useState(null),[K,fe]=ve.useState(null),[oe,ye]=ve.useState(!1),[le,me]=ve.useState(!1),[he,ae]=ve.useState(!1),[re,L]=ve.useState(!1),[X,ne]=ve.useState(!1),[Y,J]=ve.useState(0),[se,ge]=ve.useState(0),de=ve.useRef(p.duration||A||RQ),ce=ve.useRef(null),xe=ve.useRef(null),je=_===0,be=_+1<=g,Ee=p.type,Me
vendor: 4,213 bytes, line 112
112=p.dismissible!==!1,Oe=p.className||"",st=p.descriptionClassName||"",Ye=ve.useMemo(()=>w.findIndex(Be=>Be.toastId===p.id)||0,[w,p.id]),gt=ve.useMemo(()=>{var Be;return(Be=p.closeButton)!=null?Be:k},[p.closeButton,k]),At=ve.useMemo(()=>p.duration||A||RQ,[p.duration,A]),yt=ve.useRef(0),Qt=ve.useRef(0),nr=ve.useRef(0),wn=ve.useRef(null),[Si,it]=I.split("-"),pe=ve.useMemo(()=>w.reduce((Be,Nt,Xe)=>Xe>=Ye?Be:Be+Nt.height,0),[w,Ye]),Pe=lFe(),Ze=p.invert||f,qe=Ee==="loading";Qt.current=ve.useMemo(()=>Ye*D+pe,[Ye,pe]),ve.useEffect(()=>{de.current=At},[At]),ve.useEffect(()=>{ye(!0)},[]),ve.useEffect(()=>{let Be=xe.current;if(Be){let Nt=Be.getBoundingClientRect().height;return ge(Nt),x(Xe=>[{toastId:p.id,height:Nt,position:p.position},...Xe]),()=>x(Xe=>Xe.filter(Ft=>Ft.toastId!==p.id))}},[x,p.id]),ve.useLayoutEffect(()=>{if(!oe)return;let Be=xe.current,Nt=Be.style.height;Be.style.height="auto";let Xe=Be.getBoundingClientRect().height;Be.style.height=Nt,ge(Xe),x(Ft=>Ft.find(Zt=>Zt.toastId===p.id)?Ft.map(Zt=>Zt.toastId===p.id?{...Zt,height:Xe}:Zt):[{toastId:p.id,height:Xe,position:p.position},...Ft])},[oe,p.title,p.description,x,p.id]);let Ve=ve.useCallback(()=>{me(!0),J(Qt.current),x(Be=>Be.filter(Nt=>Nt.toastId!==p.id)),setTimeout(()=>{S(p)},_Fe)},[p,S,x,Qt]);ve.useEffect(()=>{if(p.promise&&Ee==="loading"||p.duration===1/0||p.type==="loading")return;let Be;return N||v||F&&Pe?(()=>{if(nr.current<yt.current){let Nt=new Date().getTime()-yt.current;de.current=de.current-Nt}nr.current=new Date().getTime()})():de.current!==1/0&&(yt.current=new Date().getTime(),Be=setTimeout(()=>{var Nt;(Nt=p.onAutoClose)==null||Nt.call(p,p),Ve()},de.current)),()=>clearTimeout(Be)},[N,v,p,Ee,F,Pe,Ve]),ve.useEffect(()=>{p.delete&&Ve()},[Ve,p.delete]);function bt(){var Be,Nt,Xe;return G!=null&&G.loading?ve.createElement("div",{className:Hc(B==null?void 0:B.loader,(Be=p==null?void 0:p.classNames)==null?void 0:Be.loader,"sonner-loader"),"data-visible":Ee==="loading"},G.loading):O?ve.createElement("div",{className:Hc(B==null?void 0:B.loader,(Nt=p==null?void 0:p.classNames)==null?void 0:Nt.loader,"sonner-loader"),"data-visible":Ee==="loading"},O):ve.createElement(nFe,{className:Hc(B==null?void 0:B.loader,(Xe=p==null?void 0:p.classNames)==null?void 0:Xe.loader),visible:Ee==="loading"})}return ve.createElement("li",{tabIndex:0,ref:xe,className:Hc(M,Oe,B==null?void 0:B.toast,(e=p==null?void 0:p.classNames)==null?void 0:e.toast,B==null?void 0:B.default,B==null?void 0:B[Ee],(n=p==null?void 0:p.classNames)==null?void 0:n[Ee]),"data-sonner-toast":"","data-rich-colors":(r=p.richColors)!=null?r:C,"data-styled":!(p.jsx||p.unstyled||m),"data-mounted":oe,"data-promise":!!p.promise,"data-swiped":X,"data-removed":le,"data-visible":be,"data-y-position":Si,"data-x-position":it,"data-index":_,"data-front":je,"data-swiping":he,"data-dismissible":Me,"data-type":Ee,"data-invert":Ze,"data-swipe-out":re,"data-swipe-direction":K,"data-expanded":!!(N||z&&oe),style:{"--index":_,"--toasts-before":_,"--z-index":j.length-_,"--offset":`${le?Y:Qt.current}px`,"--initial-height":z?"auto":`${se}px`,...E,...p.style},onDragEnd:()=>{ae(!1),Q(null),wn.current=null},onPointerDown:Be=>{qe||!Me||(ce.current=new Date,J(Qt.current),Be.target.setPointerCapture(Be.pointerId),Be.target.tagName!=="BUTTON"&&(ae(!0),wn.current={x:Be.clientX,y:Be.clientY}))},onPointerUp:()=>{var Be,Nt,Xe,Ft;if(re||!Me)return;wn.current=null;let Zt=Number(((Be=xe.current)==null?void 0:Be.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Sr=Number(((Nt=xe.current)==null?void 0:Nt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Ur=new Date().getTime()-((Xe=ce.current)==null?void 0:Xe.getTime()),cs=W==="x"?Zt:Sr,Os=Math.abs(cs)/Ur;if(Math.abs(cs)>=wFe||Os>.11){J(Qt.current),(Ft=p.onDismiss)==null||Ft.call(p,p),fe(W==="x"?Zt>0?"right":"left":Sr>0?"down":"up"),Ve(),L(!0),ne(!1);return}ae(!1),Q(null)},onPointerMove:Be=>{var Nt,Xe,Ft,Zt;if(!wn.current||!Me||((Nt=window.getSelection())==null?void 0:Nt.toString().length)>0)return;let Sr=Be.clientY-wn.current.y,Ur=Be.clientX-wn.current.x,cs=(Xe=t.swipeDirections)!=null?Xe:jFe(I);!W&&(Math.abs(Ur)>1||Math.abs(Sr)>1)&&Q(Math.abs(Ur)>Math.abs(Sr)?"x":"y");let Os={x:0,y:0};
112W==="y"?(cs.includes("top")||cs.includes("bottom"))&&(cs.includes("top")&&Sr<0||cs.includes("bottom")&&Sr>0)&&(Os.y=Sr):W==="x"&&(cs.includes("left")||cs.includes("right"))&&(cs.includes("left")&&Ur<0||cs.includes("right")&&Ur>0)&&(Os.x=Ur),(Math.abs(Os.x)>0||Math.abs(Os.y)>0)&&ne(!0),(Ft=xe.current)==null||Ft.style.setProperty("--swipe-amount-x",`${Os.x}px`),(Zt=xe.current)==null||Zt.style.setProperty("--swipe-amount-y",`${Os.y}px`)}},gt&&!p.jsx?ve.createElement("button",{"aria-label":U,"data-disabled":qe,"data-close-button":!0,onClick:qe||!Me?()=>{}:()=>{var Be;Ve(),(Be=p.onDismiss)==null||Be.call(p,p)},className:Hc(B==null?void 0:B.closeButton,(s=p==null?void 0:p.classNames)==null?void 0:s.closeButton)},(i=G==null?void 0:G.close)!=null?i:oFe):null,p.jsx||b.isValidElement(p.title)?p.jsx?p.jsx:typeof p.title=="function"?p.title():p.title:ve.createElement(ve.Fragment,null,Ee||p.icon||p.promise?ve.createElement("div",{"data-icon":"",className:Hc(B==null?void 0:B.icon,(o=p==null?void 0:p.classNames)==null?void 0:o.icon)},p.promise||p.type==="loading"&&!p.icon?p.icon||bt():null,p.type!=="loading"?p.icon||(G==null?void 0:G[Ee])||eFe(Ee):null):null,ve.createElement("div",{"data-content":"",className:Hc(B==null?void 0:B.content,(l=p==null?void 0:p.classNames)==null?void 0:l.content)},ve.createElement("div",{"data-title":"",className:Hc(B==null?void 0:B.title,(c=p==null?void 0:p.classNames)==null?void 0:c.title)},typeof p.title=="function"?p.title():p.title),p.description?ve.createElement("div",{"data-description":"",className:Hc(R,st,B==null?void 0:B.description,(u=p==null?void 0:p.classNames)==null?void 0:u.description)},typeof p.description=="function"?p.description():p.description):null),b.isValidElement(p.cancel)?p.cancel:p.cancel&&qT(p.cancel)?ve.createElement("button",{"data-button":!0,"data-cancel":!0,style:p.cancelButtonStyle||P,onClick:Be=>{var Nt,Xe;qT(p.cancel)&&Me&&((Xe=(Nt=p.cancel).onClick)==null||Xe.call(Nt,Be),Ve())},className:Hc(B==null?void 0:B.cancelButton,(d=p==null?void 0:p.classNames)==null?void 0:d.cancelButton)},p.cancel.label):null,b.isValidElement(p.action)?p.action:p.action&&qT(p.action)?ve.createElement("button",{"data-button":!0,"data-action":!0,style:p.actionButtonStyle||T,onClick:Be=>{var Nt,Xe;qT(p.action)&&((Xe=(Nt=p.action).onClick)==null||Xe.call(Nt,Be),!Be.defaultPrevented&&Ve())},className:Hc(B==null?void 0:B.actionButton,(h=p==null?void 0:p.classNames)==null?void 0:h.actionButton)},p.action.label):null))};function OQ(){if(typeof window>"u"||typeof document>"u")return"ltr";let t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function NFe(t,e){let n={};return[t,e].forEach((r,s)=>{let i=s===1,o=i?"--mobile-offset":"--offset",l=i?xFe:vFe;function c(u){["top","right","bottom","left"].forEach(d=>{n[`${o}-${d}`]=typeof u=="number"?`${u}px`:u})}typeof r=="number"||typeof r=="string"?c(r):typeof r=="object"?["top","right","bottom","left"].forEach(u=>{r[u]===void 0?n[`${o}-${u}`]=l:n[`${o}-${u}`]=typeof r[u]=="number"?`${r[u]}px`:r[u]}):c(l)}),n}var CFe=b.forwardRef(function(t,e){let{invert:n,position:r="bottom-right",hotkey:s=["altKey","KeyT"],expand:i,closeButton:o,className:l,offset:c,mobileOffset:u,theme:d="light",richColors:h,duration:f,style:p,visibleToasts:m=gFe,toastOptions:v,dir:x=OQ(),gap:g=bFe,loadingIcon:w,icons:_,containerAriaLabel:j="Notifications",pauseWhenPageIsHidden:N}=t,[S,C]=ve.useState([]),k=ve.useMemo(()=>Array.from(new Set([r].concat(S.filter(F=>F.position).map(F=>F.position)))),[S,r]),[E,P]=ve.useState([]),[T,M]=ve.useState(!1),[R,A]=ve.useState(!1),[I,D]=ve.useState(d!=="system"?d:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),O=ve.useRef(null),z=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),B=ve.useRef(null),G=ve.useRef(!1),U=ve.useCallback(F=>{C(W=>{var Q;return(Q=W.find(K=>K.id===F.id))!=null&&Q.delete||Do.dismiss(F.id),W.filter(({id:K})=>K!==F.id)})},[]);return ve.useEffect(()=>Do.subscribe(F=>{if(F.dismiss){C(W=>W.map(Q=>Q.id===F.id?{...Q,delete:!0}:Q));return}setTimeout(()=>{dW.flushSync(()=>{C(W=>{let Q=W.findIndex(K=>
112K.id===F.id);return Q!==-1?[...W.slice(0,Q),{...W[Q],...F},...W.slice(Q+1)]:[F,...W]})})})}),[]),ve.useEffect(()=>{if(d!=="system"){D(d);return}if(d==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?D("dark"):D("light")),typeof window>"u")return;let F=window.matchMedia("(prefers-color-scheme: dark)");try{F.addEventListener("change",({matches:W})=>{D(W?"dark":"light")})}catch{F.addListener(({matches:Q})=>{try{D(Q?"dark":"light")}catch(K){console.error(K)}})}},[d]),ve.useEffect(()=>{S.length<=1&&M(!1)},[S]),ve.useEffect(()=>{let F=W=>{var Q,K;s.every(fe=>W[fe]||W.code===fe)&&(M(!0),(Q=O.current)==null||Q.focus()),W.code==="Escape"&&(document.activeElement===O.current||(K=O.current)!=null&&K.contains(document.activeElement))&&M(!1)};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[s]),ve.useEffect(()=>{if(O.current)return()=>{B.current&&(B.current.focus({preventScroll:!0}),B.current=null,G.current=!1)}},[O.current]),ve.createElement("section",{ref:e,"aria-label":`${j} ${z}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},k.map((F,W)=>{var Q;let[K,fe]=F.split("-");return S.length?ve.createElement("ol",{key:F,dir:x==="auto"?OQ():x,tabIndex:-1,ref:O,className:l,"data-sonner-toaster":!0,"data-theme":I,"data-y-position":K,"data-lifted":T&&S.length>1&&!i,"data-x-position":fe,style:{"--front-toast-height":`${((Q=E[0])==null?void 0:Q.height)||0}px`,"--width":`${yFe}px`,"--gap":`${g}px`,...p,...NFe(c,u)},onBlur:oe=>{G.current&&!oe.currentTarget.contains(oe.relatedTarget)&&(G.current=!1,B.current&&(B.current.focus({preventScroll:!0}),B.current=null))},onFocus:oe=>{oe.target instanceof HTMLElement&&oe.target.dataset.dismissible==="false"||G.current||(G.current=!0,B.current=oe.relatedTarget)},onMouseEnter:()=>M(!0),onMouseMove:()=>M(!0),onMouseLeave:()=>{R||M(!1)},onDragEnd:()=>M(!1),onPointerDown:oe=>{oe.target instanceof HTMLElement&&oe.target.dataset.dismissible==="false"||A(!0)},onPointerUp:()=>A(!1)},S.filter(oe=>!oe.position&&W===0||oe.position===F).map((oe,ye)=>{var le,me;return ve.createElement(SFe,{key:oe.id,icons:_,index:ye,toast:oe,defaultRichColors:h,duration:(le=v==null?void 0:v.duration)!=null?le:f,className:v==null?void 0:v.className,descriptionClassName:v==null?void 0:v.descriptionClassName,invert:n,visibleToasts:m,closeButton:(me=v==null?void 0:v.closeButton)!=null?me:o,interacting:R,position:F,style:v==null?void 0:v.style,unstyled:v==null?void 0:v.unstyled,classNames:v==null?void 0:v.classNames,cancelButtonStyle:v==null?void 0:v.cancelButtonStyle,actionButtonStyle:v==null?void 0:v.actionButtonStyle,removeToast:U,toasts:S.filter(he=>he.position==oe.position),heights:E.filter(he=>he.position==oe.position),setHeights:P,expandByDefault:i,gap:g,loadingIcon:w,expanded:T,pauseWhenPageIsHidden:N,swipeDirections:t.swipeDirections})})):null}))});const kFe=({...t})=>{const{theme:e="system"}=Z4e();return a.jsx(CFe,{theme:e,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"}},...t})},AFe=1,EFe=1e6;let C$=0;function TFe(){return C$=(C$+1)%Number.MAX_SAFE_INTEGER,C$.toString()}const k$=new Map,IQ=t=>{if(k$.has(t))return;const e=setTimeout(()=>{k$.delete(t),dC({type:"REMOVE_TOAST",toastId:t})},EFe);k$.set(t,e)},PFe=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,AFe)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(n=>n.id===e.toast.id?{...n,...e.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=e;return n?IQ(n):t.toasts.forEach(r=>{IQ(r.id)}),{...t,toasts:t.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(n=>n.id!==e.toastId)}}},MM=[];let RM={toasts:[]};
112function dC(t){RM=PFe(RM,t),MM.forEach(e=>{e(RM)})}function Ab({...t}){const e=TFe(),n=s=>dC({type:"UPDATE_TOAST",toast:{...s,id:e}}),r=()=>dC({type:"DISMISS_TOAST",toastId:e});return dC({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:s=>{s||r()}}}),{id:e,dismiss:r,update:n}}function QE(){const[t,e]=b.useState(RM);return b.useEffect(()=>(MM.push(e),()=>{const n=MM.indexOf(e);n>-1&&MM.splice(n,1)}),[t]),{...t,toast:Ab,dismiss:n=>dC({type:"DISMISS_TOAST",toastId:n})}}function ze(t,e,{checkForDefaultPrevented:n=!0}={}){return function(s){if(t==null||t(s),n===!1||!s.defaultPrevented)return e==null?void 0:e(s)}}function DQ(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function XL(...t){return e=>{let n=!1;const r=t.map(s=>{const i=DQ(s,e);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let s=0;s<r.length;s++){const i=r[s];typeof i=="function"?i():DQ(t[s],null)}}}}function $t(...t){return b.useCallback(XL(...t),t)}function MFe(t,e){const n=b.createContext(e),r=i=>{const{children:o,...l}=i,c=b.useMemo(()=>l,Object.values(l));return a.jsx(n.Provider,{value:c,children:o})};r.displayName=t+"Provider";function s(i){const o=b.useContext(n);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${i}\` must be used within \`${t}\``)}return[r,s]}function Ys(t,e=[]){let n=[];function r(i,o){const l=b.createContext(o),c=n.length;n=[...n,o];const u=h=>{var g;const{scope:f,children:p,...m}=h,v=((g=f==null?void 0:f[t])==null?void 0:g[c])||l,x=b.useMemo(()=>m,Object.values(m));return a.jsx(v.Provider,{value:x,children:p})};u.displayName=i+"Provider";function d(h,f){var v;const p=((v=f==null?void 0:f[t])==null?void 0:v[c])||l,m=b.useContext(p);if(m)return m;if(o!==void 0)return o;throw new Error(`\`${h}\` must be used within \`${i}\``)}return[u,d]}const s=()=>{const i=n.map(o=>b.createContext(o));return function(l){const c=(l==null?void 0:l[t])||i;return b.useMemo(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return s.scopeName=t,[r,RFe(s,...e)]}function RFe(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const o=r.reduce((l,{useScope:c,scopeName:u})=>{const h=c(i)[`__scope${u}`];return{...l,...h}},{});return b.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}function Og(t){const e=IFe(t),n=b.forwardRef((r,s)=>{const{children:i,...o}=r,l=b.Children.toArray(i),c=l.find(DFe);if(c){const u=c.props.children,d=l.map(h=>h===c?b.Children.count(u)>1?b.Children.only(null):b.isValidElement(u)?u.props.children:null:h);return a.jsx(e,{...o,ref:s,children:b.isValidElement(u)?b.cloneElement(u,void 0,d):null})}return a.jsx(e,{...o,ref:s,children:i})});return n.displayName=`${t}.Slot`,n}var OFe=Og("Slot");function IFe(t){const e=b.forwardRef((n,r)=>{const{children:s,...i}=n;if(b.isValidElement(s)){const o=FFe(s),l=LFe(i,s.props);return s.type!==b.Fragment&&(l.ref=r?XL(r,o):o),b.cloneElement(s,l)}return b.Children.count(s)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var nfe=Symbol("radix.slottable");function rfe(t){const e=({children:n})=>a.jsx(a.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=nfe,e}function DFe(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===nfe}function LFe(t,e){const n={...e};for(const r in e){const s=t[r],i=e[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...l)=>{const c=i(...l);return s(...l),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function FFe(t){var r,s;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function Cj(t){const e=t+"CollectionProvider",[n,r]=Ys(e),[s,i]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=v=>{const{scope:x,children:g}=v,w=ve.useRef(null),_=ve.useRef(new Map).current;return a.jsx(s,{scope:x,itemMap:_,collectionRef:w,children:g})};o.displayName=e;const l=t+"CollectionSlot",c=Og(l),u=ve.forwardRef((v,x)=>{const{scope:g,children:w}=v,_=i(l,g),j=$t(x,_.collectionRef);return a.jsx(c,{ref:j,children:w})});u.displayName=l;const d=t+"CollectionItemSlot",h="data-radix-collection-item",f=Og(d),p=ve.forwardRef((v,x)=>{const{scope:g,children:w,..._}=v,j=ve.useRef(null),N=$t(x,j),S=i(d,g);return ve.useEffect(()=>(S.itemMap.set(j,{ref:j,..._}),()=>void S.itemMap.delete(j))),a.jsx(f,{[h]:"",ref:N,children:w})});p.displayName=d;function m(v){const x=i(t+"CollectionConsumer",v);return ve.useCallback(()=>{const w=x.collectionRef.current;if(!w)return[];const _=Array.from(w.querySelectorAll(`[${h}]`));return Array.from(x.itemMap.values()).sort((S,C)=>_.indexOf(S.ref.current)-_.indexOf(C.ref.current))},[x.collectionRef,x.itemMap])}return[{Provider:o,Slot:u,ItemSlot:p},m,r]}var $Fe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],et=$Fe.reduce((t,e)=>{const n=Og(`Primitive.${e}`),r=b.forwardRef((s,i)=>{const{asChild:o,...l}=s,c=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...l,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function NW(t,e){t&&Lc.flushSync(()=>t.dispatchEvent(e))}function ho(t){const e=b.useRef(t);return b.useEffect(()=>{e.current=t}),b.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function zFe(t,e=globalThis==null?void 0:globalThis.document){const n=ho(t);b.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var BFe="DismissableLayer",$6="dismissableLayer.update",UFe="dismissableLayer.pointerDownOutside",qFe="dismissableLayer.focusOutside",LQ,sfe=b.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),T0=b.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:i,onInteractOutside:o,onDismiss:l,...c}=t,u=b.useContext(sfe),[d,h]=b.useState(null),f=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=b.useState({}),m=$t(e,C=>
112h(C)),v=Array.from(u.layers),[x]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),g=v.indexOf(x),w=d?v.indexOf(d):-1,_=u.layersWithOutsidePointerEventsDisabled.size>0,j=w>=g,N=HFe(C=>{const k=C.target,E=[...u.branches].some(P=>P.contains(k));!j||E||(s==null||s(C),o==null||o(C),C.defaultPrevented||l==null||l())},f),S=WFe(C=>{const k=C.target;[...u.branches].some(P=>P.contains(k))||(i==null||i(C),o==null||o(C),C.defaultPrevented||l==null||l())},f);return zFe(C=>{w===u.layers.size-1&&(r==null||r(C),!C.defaultPrevented&&l&&(C.preventDefault(),l()))},f),b.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(LQ=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),FQ(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=LQ)}},[d,f,n,u]),b.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),FQ())},[d,u]),b.useEffect(()=>{const C=()=>p({});return document.addEventListener($6,C),()=>document.removeEventListener($6,C)},[]),a.jsx(et.div,{...c,ref:m,style:{pointerEvents:_?j?"auto":"none":void 0,...t.style},onFocusCapture:ze(t.onFocusCapture,S.onFocusCapture),onBlurCapture:ze(t.onBlurCapture,S.onBlurCapture),onPointerDownCapture:ze(t.onPointerDownCapture,N.onPointerDownCapture)})});T0.displayName=BFe;var VFe="DismissableLayerBranch",ife=b.forwardRef((t,e)=>{const n=b.useContext(sfe),r=b.useRef(null),s=$t(e,r);return b.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),a.jsx(et.div,{...t,ref:s})});ife.displayName=VFe;function HFe(t,e=globalThis==null?void 0:globalThis.document){const n=ho(t),r=b.useRef(!1),s=b.useRef(()=>{});return b.useEffect(()=>{const i=l=>{if(l.target&&!r.current){let c=function(){afe(UFe,n,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(e.removeEventListener("click",s.current),s.current=c,e.addEventListener("click",s.current,{once:!0})):c()}else e.removeEventListener("click",s.current);r.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",i),e.removeEventListener("click",s.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function WFe(t,e=globalThis==null?void 0:globalThis.document){const n=ho(t),r=b.useRef(!1);return b.useEffect(()=>{const s=i=>{i.target&&!r.current&&afe(qFe,n,{originalEvent:i},{discrete:!1})};return e.addEventListener("focusin",s),()=>e.removeEventListener("focusin",s)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function FQ(){const t=new CustomEvent($6);document.dispatchEvent(t)}function afe(t,e,n,{discrete:r}){const s=n.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&s.addEventListener(t,e,{once:!0}),r?NW(s,i):s.dispatchEvent(i)}var KFe=T0,GFe=ife,ys=globalThis!=null&&globalThis.document?b.useLayoutEffect:()=>{},YFe="Portal",kj=b.forwardRef((t,e)=>{var l;const{container:n,...r}=t,[s,i]=b.useState(!1);ys(()=>i(!0),[]);const o=n||s&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return o?dW.createPortal(a.jsx(et.div,{...r,ref:e}),o):null});kj.displayName=YFe;function XFe(t,e){return b.useReducer((n,r)=>e[n][r]??n,t)}var yo=t=>{const{present:e,children:n}=t,r=JFe(e),s=typeof n=="function"?n({present:r.isPresent}):b.Children.only(n),i=$t(r.ref,QFe(s));return typeof n=="function"||r.isPresent?b.cloneElement(s,{ref:i}):null};yo.displayName="Presence";function JFe(t){const[e,n]=b.useState(),r=b.useRef(null),s=b.useRef(t),i=b.useRef("none"),o=t?"mounted":"unmounted",[l,c]=XFe(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return b.useEffect(()=>{const u=VT(r.current);i.current=l==="mounted"?u:"none"},[l]),ys(()=>{const u=r.current,d=s.current;if(d!==t){const f=i.current,p=VT(u);t?c("MOUNT"):p==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&f!==p?"ANIMATION_OUT":"UNMOUNT"),s.current=t}},[t,c]),ys(()=>
112{if(e){let u;const d=e.ownerDocument.defaultView??window,h=p=>{const v=VT(r.current).includes(p.animationName);if(p.target===e&&v&&(c("ANIMATION_END"),!s.current)){const x=e.style.animationFillMode;e.style.animationFillMode="forwards",u=d.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=x)})}},f=p=>{p.target===e&&(i.current=VT(r.current))};return e.addEventListener("animationstart",f),e.addEventListener("animationcancel",h),e.addEventListener("animationend",h),()=>{d.clearTimeout(u),e.removeEventListener("animationstart",f),e.removeEventListener("animationcancel",h),e.removeEventListener("animationend",h)}}else c("ANIMATION_END")},[e,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:b.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function VT(t){return(t==null?void 0:t.animationName)||"none"}function QFe(t){var r,s;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var ZFe=kL[" useInsertionEffect ".trim().toString()]||ys;function Xo({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[s,i,o]=e$e({defaultProp:e,onChange:n}),l=t!==void 0,c=l?t:s;{const d=b.useRef(t!==void 0);b.useEffect(()=>{const h=d.current;h!==l&&console.warn(`${r} is changing from ${h?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=l},[l,r])}const u=b.useCallback(d=>{var h;if(l){const f=t$e(d)?d(t):d;f!==t&&((h=o.current)==null||h.call(o,f))}else i(d)},[l,t,i,o]);return[c,u]}function e$e({defaultProp:t,onChange:e}){const[n,r]=b.useState(t),s=b.useRef(n),i=b.useRef(e);return ZFe(()=>{i.current=e},[e]),b.useEffect(()=>{var o;s.current!==n&&((o=i.current)==null||o.call(i,n),s.current=n)},[n,s]),[n,r,i]}function t$e(t){return typeof t=="function"}var ofe=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"}),n$e="VisuallyHidden",JL=b.forwardRef((t,e)=>a.jsx(et.span,{...t,ref:e,style:{...ofe,...t.style}}));JL.displayName=n$e;var r$e=JL,CW="ToastProvider",[kW,s$e,i$e]=Cj("Toast"),[lfe,NLt]=Ys("Toast",[i$e]),[a$e,QL]=lfe(CW),cfe=t=>{const{__scopeToast:e,label:n="Notification",duration:r=5e3,swipeDirection:s="right",swipeThreshold:i=50,children:o}=t,[l,c]=b.useState(null),[u,d]=b.useState(0),h=b.useRef(!1),f=b.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${CW}\`. Expected non-empty \`string\`.`),a.jsx(kW.Provider,{scope:e,children:a.jsx(a$e,{scope:e,label:n,duration:r,swipeDirection:s,swipeThreshold:i,toastCount:u,viewport:l,onViewportChange:c,onToastAdd:b.useCallback(()=>d(p=>p+1),[]),onToastRemove:b.useCallback(()=>d(p=>p-1),[]),isFocusedToastEscapeKeyDownRef:h,isClosePausedRef:f,children:o})})};cfe.displayName=CW;var ufe="ToastViewport",o$e=["F8"],z6="toast.viewportPause",B6="toast.viewportResume",dfe=b.forwardRef((t,e)=>{const{__scopeToast:n,hotkey:r=o$e,label:s="Notifications ({hotkey})",...i}=t,o=QL(ufe,n),l=s$e(n),c=b.useRef(null),u=b.useRef(null),d=b.useRef(null),h=b.useRef(null),f=$t(e,h,o.onViewportChange),p=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),m=o.toastCount>0;b.useEffect(()=>{const x=g=>{var _;r.length!==0&&r.every(j=>g[j]||g.code===j)&&((_=h.current)==null||_.focus())};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[r]),b.useEffect(()=>{const x=c.current,g=h.current;if(m&&x&&g){const w=()=>{if(!o.isClosePausedRef.current){const S=new CustomEvent(z6);g.dispatchEvent(S),o.isClosePausedRef.current=!0}},_=()=>{if(o.isClosePausedRef.current){const S=new CustomEvent(B6);g.dispatchEvent(S),o.isClosePausedRef.current=!1}},j=S=>{!x.contains(S.relatedTarget)&&_()},N=()=>{x.contains(document.activeElement)||_()};return x.addEventListener("focusin",w),x.addEventListener("focusout",j),x.addEventListener("pointermove",w),x.addEventListener("pointerleave",N),window.addEventListener("blur",w),window.addEventListener("focus",_),()=>{x.removeEventListener("focusin",w),x.removeEventListener("focusout",j),x.removeEventListener("pointermove",w),x.removeEventListener("pointerleave",N),window.removeEventListener("blur",w),window.removeEventListener("focus",_)}}},[m,o.isClosePausedRef]);const v=b.useCallback(({tabbingDirection:x})=>{const w=l().map(_=>{const j=_.ref.current,N=[j,...b$e(j)];return x==="forwards"?N:N.reverse()});return(x==="forwards"?w.reverse():w).flat()},[l]);return b.useEffect(()=>{const x=h.current;if(x){const g=w=>{var N,S,C;const _=w.altKey||w.ctrlKey||w.metaKey;if(w.key==="Tab"&&!_){const k=document.activeElement,E=w.shiftKey;if(w.target===x&&E){(N=u.current)==null||N.focus();return}const M=v({tabbingDirection:E?"backwards":"forwards"}),R=M.findIndex(A=>A===k);A$(M.slice(R+1))?w.preventDefault():E?(S=u.current)==null||S.focus():(C=d.current)==null||C.focus()}};return x.addEventListener("keydown",g),()=>x.removeEventListener("keydown",g)}},[l,v]),a.jsxs(GFe,{ref:c,role:"region","aria-label":s.replace("{hotkey}",p),tabIndex:-1,style:{pointerEvents:m?void 0:"none"},children:[m&&a.jsx(U6,{ref:u,onFocusFromOutsideViewport:()=>{const x=v({tabbingDirection:"forwards"});A$(x)}}),a.jsx(kW.Slot,{scope:n,children:a.jsx(et.ol,{tabIndex:-1,...i,ref:f})}),m&&a.jsx(U6,{ref:d,onFocusFromOutsideViewport:()=>{const x=v({tabbingDirection:"backwards"});A$(x)}})]})});dfe.displayName=ufe;var hfe="ToastFocusProxy",U6=b.forwardRef((t,e)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...s}=t,i=QL(hfe,n);return a.jsx(JL,{"aria-hidden":!0,tabIndex:0,...s,ref:e,style:{position:"fixed"},onFocus:o=>{var u;const l=o.relatedTarget;!((u=i.viewport)!=null&&u.contains(l))&&r()}})});U6.displayName=hfe;var ZE="Toast",l$e="toast.swipeStart",c$e="toast.swipeMove",u$e="toast.swipeCancel",d$e="toast.swipeEnd",ffe=b.forwardRef((t,e)=>{const{forceMount:n,open:r,defaultOpen:s,onOpenChange:i,...o}=t,[l,c]=Xo({prop:r,defaultProp:s??!0,onChange:i,caller:ZE});return a.jsx(yo,{present:n||l,children:a.jsx(p$e,{open:l,...o,ref:e,onClose:()=>c(!1),onPause:ho(t.onPause),onResume:ho(t.onResume),onSwipeStart:ze(t.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:ze(t.onSwipeMove,u=>{const{x:d,y:h}=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",`${h}px`)}),onSwipeCancel:ze(t.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:ze(t.onSwipeEnd,u=>{const{x:d,y:h}=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",`${h}px`),c(!1)})})})});ffe.displayName=ZE;var[h$e,f$e]=lfe(ZE,{onClose(){}}),p$e=b.forwardRef((t,e)=>{const{__scopeToast:n,type:r="foreground",duration:s,open:i,onClose:o,onEscapeKeyDown:l,onPause:c,onResume:u,onSwipeStart:d,onSwipeMove:h,onSwipeCancel:f,onSwipeEnd:p,...m}=t,v=QL(ZE,n),[x,g]=b.useState(null),w=$t(e,A=>g(A)),_=b.useRef(null),j=b.useRef(null),N=s||v.duration,S=b.useRef(0),C=b.useRef(N),k=b.useRef(0),{onToastAdd:E,onToastRemove:P}=v,T=ho(()=>{var I;(x==null?void 0:x.contains(document.activeElement))&&((I=v.viewport)==null||I.focus()),o()}),M=b.useCallback(A=>
112{!A||A===1/0||(window.clearTimeout(k.current),S.current=new Date().getTime(),k.current=window.setTimeout(T,A))},[T]);b.useEffect(()=>{const A=v.viewport;if(A){const I=()=>{M(C.current),u==null||u()},D=()=>{const O=new Date().getTime()-S.current;C.current=C.current-O,window.clearTimeout(k.current),c==null||c()};return A.addEventListener(z6,D),A.addEventListener(B6,I),()=>{A.removeEventListener(z6,D),A.removeEventListener(B6,I)}}},[v.viewport,N,c,u,M]),b.useEffect(()=>{i&&!v.isClosePausedRef.current&&M(N)},[i,N,v.isClosePausedRef,M]),b.useEffect(()=>(E(),()=>P()),[E,P]);const R=b.useMemo(()=>x?bfe(x):null,[x]);return v.viewport?a.jsxs(a.Fragment,{children:[R&&a.jsx(m$e,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite","aria-atomic":!0,children:R}),a.jsx(h$e,{scope:n,onClose:T,children:Lc.createPortal(a.jsx(kW.ItemSlot,{scope:n,children:a.jsx(KFe,{asChild:!0,onEscapeKeyDown:ze(l,()=>{v.isFocusedToastEscapeKeyDownRef.current||T(),v.isFocusedToastEscapeKeyDownRef.current=!1}),children:a.jsx(et.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":v.swipeDirection,...m,ref:w,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:ze(t.onKeyDown,A=>{A.key==="Escape"&&(l==null||l(A.nativeEvent),A.nativeEvent.defaultPrevented||(v.isFocusedToastEscapeKeyDownRef.current=!0,T()))}),onPointerDown:ze(t.onPointerDown,A=>{A.button===0&&(_.current={x:A.clientX,y:A.clientY})}),onPointerMove:ze(t.onPointerMove,A=>{if(!_.current)return;const I=A.clientX-_.current.x,D=A.clientY-_.current.y,O=!!j.current,z=["left","right"].includes(v.swipeDirection),B=["left","up"].includes(v.swipeDirection)?Math.min:Math.max,G=z?B(0,I):0,U=z?0:B(0,D),F=A.pointerType==="touch"?10:2,W={x:G,y:U},Q={originalEvent:A,delta:W};O?(j.current=W,HT(c$e,h,Q,{discrete:!1})):$Q(W,v.swipeDirection,F)?(j.current=W,HT(l$e,d,Q,{discrete:!1}),A.target.setPointerCapture(A.pointerId)):(Math.abs(I)>F||Math.abs(D)>F)&&(_.current=null)}),onPointerUp:ze(t.onPointerUp,A=>{const I=j.current,D=A.target;if(D.hasPointerCapture(A.pointerId)&&D.releasePointerCapture(A.pointerId),j.current=null,_.current=null,I){const O=A.currentTarget,z={originalEvent:A,delta:I};$Q(I,v.swipeDirection,v.swipeThreshold)?HT(d$e,p,z,{discrete:!0}):HT(u$e,f,z,{discrete:!0}),O.addEventListener("click",B=>B.preventDefault(),{once:!0})}})})})}),v.viewport)})]}):null}),m$e=t=>{const{__scopeToast:e,children:n,...r}=t,s=QL(ZE,e),[i,o]=b.useState(!1),[l,c]=b.useState(!1);return x$e(()=>o(!0)),b.useEffect(()=>{const u=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(u)},[]),l?null:a.jsx(kj,{asChild:!0,children:a.jsx(JL,{...r,children:i&&a.jsxs(a.Fragment,{children:[s.label," ",n]})})})},g$e="ToastTitle",pfe=b.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return a.jsx(et.div,{...r,ref:e})});pfe.displayName=g$e;var v$e="ToastDescription",mfe=b.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return a.jsx(et.div,{...r,ref:e})});mfe.displayName=v$e;var gfe="ToastAction",vfe=b.forwardRef((t,e)=>{const{altText:n,...r}=t;return n.trim()?a.jsx(yfe,{altText:n,asChild:!0,children:a.jsx(AW,{...r,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${gfe}\`. Expected non-empty \`string\`.`),null)});vfe.displayName=gfe;var xfe="ToastClose",AW=b.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t,s=f$e(xfe,n);return a.jsx(yfe,{asChild:!0,children:a.jsx(et.button,{type:"button",...r,ref:e,onClick:ze(t.onClick,s.onClose)})})});AW.displayName=xfe;var yfe=b.forwardRef((t,e)=>{const{__scopeToast:n,altText:r,...s}=t;return a.jsx(et.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...s,ref:e})});function bfe(t){const e=[];return Array.from(t.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&e.push(r.textContent),y$e(r)){const s=r.ariaHidden||r.hidden||r.style.display==="none",i=r.dataset.radixToastAnnounceExclude==="";if(!s)if(i){const o=r.dataset.radixToastAnnounceAlt;o&&e.push(o)}else e.push(...bfe(r))}}),e}function HT(t,e,n,{discrete:r}){const s=n.originalEvent.currentTarget,i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n});e&&s.addEventListener(t,e,{once:!0}),r?NW(s,i):s.dispatchEvent(i)}var $Q=(t,e,n=0)=>{const r=Math.abs(t.x),s=Math.abs(t.y),i=r>s;return e==="left"||e==="right"?i&&r>n:!i&&s>n};function x$e(t=()=>{}){const e=ho(t);ys(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[e])}function y$e(t){return t.nodeType===t.ELEMENT_NODE}function b$e(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function A$(t){const e=document.activeElement;return t.some(n=>n===e?!0:(n.focus(),document.activeElement!==e))}var w$e=cfe,wfe=dfe,_fe=ffe,jfe=pfe,Sfe=mfe,Nfe=vfe,Cfe=AW;function kfe(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var s=t.length;for(e=0;e<s;e++)t[e]&&(n=kfe(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function mn(){for(var t,e,n=0,r="",s=arguments.length;n<s;n++)(t=arguments[n])&&(e=kfe(t))&&(r&&(r+=" "),r+=e);return r}const zQ=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,BQ=mn,e2=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return BQ(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:i}=e,o=Object.keys(s).map(u=>{const d=n==null?void 0:n[u],h=i==null?void 0:i[u];if(d===null)return null;const f=zQ(d)||zQ(h);return s[u][f]}),l=n&&Object.entries(n).reduce((u,d)=>{let[h,f]=d;return f===void 0||(u[h]=f),u},{}),c=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:h,className:f,...p}=d;return Object.entries(p).every(m=>{let[v,x]=m;return Array.isArray(x)?x.includes({...i,...l}[v]):{...i,...l}[v]===x})?[...u,h,f]:u},[]);return BQ(t,o,c,n==null?void 0:n.class,n==null?void 0:n.className)};/** 113 * @license lucide-react v0.462.0 - ISC 114 * 115 * This source code is licensed under the ISC license. 116 * See the LICENSE file in the root directory of this source tree. 117 */const _$e=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Afe=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim();/** 118 * @license lucide-react v0.462.0 - ISC 119 * 120 * This source code is licensed under the ISC license. 121 * See the LICENSE file in the root directory of this source tree. 122 */var j$e={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"};/** 123 * @license lucide-react v0.462.0 - ISC 124 * 125 * This source code is licensed under the ISC license. 126 * See the LICENSE file in the root directory of this source tree. 127 */const S$e=b.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:i,iconNode:o,...l},c)=>b.createElement("svg",{ref:c,...j$e,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:Afe("lucide",s),...l},[...o.map(([u,d])=>b.createElement(u,d)),...Array.isArray(i)?i:[i]]));/** 128 * @license lucide-react v0.462.0 - ISC 129 * 130 * This source code is licensed under the ISC license. 131 * See the LICENSE file in the root directory of this source tree. 132 */const Ce=(t,e)=>{const n=b.forwardRef(({className:r,...s},i)=>b.createElement(S$e,{ref:i,iconNode:e,className:Afe(`lucide-${_$e(t)}`,r),...s}));return n.displayName=`${t}`,n};/** 133 * @license lucide-react v0.462.0 - ISC 134 * 135 * This source code is licensed under the ISC license. 136 * See the LICENSE file in the root directory of this source tree. 137 */const N$e=Ce("AlignCenter",[["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 18H5",key:"18s9l3"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);/** 138 * @license lucide-react v0.462.0 - ISC 139 * 140 * This source code is licensed under the ISC license. 141 * See the LICENSE file in the root directory of this source tree. 142 */const C$e=Ce("AlignJustify",[["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 18h18",key:"1h113x"}],["path",{d:"M3 6h18",key:"d0wm0j"}]]);/** 143 * @license lucide-react v0.462.0 - ISC 144 * 145 * This source code is licensed under the ISC license. 146 * See the LICENSE file in the root directory of this source tree. 147 */const k$e=Ce("AlignLeft",[["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 18H3",key:"1amg6g"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);/** 148 * @license lucide-react v0.462.0 - ISC 149 * 150 * This source code is licensed under the ISC license. 151 * See the LICENSE file in the root directory of this source tree. 152 */const A$e=Ce("AlignRight",[["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 18H7",key:"1ygte8"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);/** 153 * @license lucide-react v0.462.0 - ISC 154 * 155 * This source code is licensed under the ISC license. 156 * See the LICENSE file in the root directory of this source tree. 157 */const Efe=Ce("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"}]]);/** 158 * @license lucide-react v0.462.0 - ISC 159 * 160 * This source code is licensed under the ISC license. 161 * See the LICENSE file in the root directory of this source tree. 162 */const jr=Ce("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** 163 * @license lucide-react v0.462.0 - ISC 164 * 165 * This source code is licensed under the ISC license. 166 * See the LICENSE file in the root directory of this source tree. 167 */const Tfe=Ce("ArrowRightLeft",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);/** 168 * @license lucide-react v0.462.0 - ISC 169 * 170 * This source code is licensed under the ISC license. 171 * See the LICENSE file in the root directory of this source tree. 172 */const Au=Ce("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** 173 * @license lucide-react v0.462.0 - ISC 174 * 175 * This source code is licensed under the ISC license. 176 * See the LICENSE file in the root directory of this source tree. 177 */const E$e=Ce("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"}]]);/** 178 * @license lucide-react v0.462.0 - ISC 179 * 180 * This source code is licensed under the ISC license. 181 * See the LICENSE file in the root directory of this source tree. 182 */const EW=Ce("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"}]]);/** 183 * @license lucide-react v0.462.0 - ISC 184 * 185 * This source code is licensed under the ISC license. 186 * See the LICENSE file in the root directory of this source tree. 187 */const Pfe=Ce("Bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]);/** 188 * @license lucide-react v0.462.0 - ISC 189 * 190 * This source code is licensed under the ISC license. 191 * See the LICENSE file in the root directory of this source tree. 192 */const Pu=Ce("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"}]]);/** 193 * @license lucide-react v0.462.0 - ISC 194 * 195 * This source code is licensed under the ISC license. 196 * See the LICENSE file in the root directory of this source tree. 197 */const T$e=Ce("BookUser",[["path",{d:"M15 13a3 3 0 1 0-6 0",key:"10j68g"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}]]);/** 198 * @license lucide-react v0.462.0 - ISC 199 * 200 * This source code is licensed under the ISC license. 201 * See the LICENSE file in the root directory of this source tree. 202 */const TO=Ce("Book",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]]);/** 203 * @license lucide-react v0.462.0 - ISC 204 * 205 * This source code is licensed under the ISC license. 206 * See the LICENSE file in the root directory of this source tree. 207 */const P$e=Ce("BriefcaseBusiness",[["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M16 6V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v2",key:"1ksdt3"}],["path",{d:"M22 13a18.15 18.15 0 0 1-20 0",key:"12hx5q"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]);/** 208 * @license lucide-react v0.462.0 - ISC 209 * 210 * This source code is licensed under the ISC license. 211 * See the LICENSE file in the root directory of this source tree. 212 */const M$e=Ce("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"}
212],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/** 213 * @license lucide-react v0.462.0 - ISC 214 * 215 * This source code is licensed under the ISC license. 216 * See the LICENSE file in the root directory of this source tree. 217 */const R$e=Ce("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"}]]);/** 218 * @license lucide-react v0.462.0 - ISC 219 * 220 * This source code is licensed under the ISC license. 221 * See the LICENSE file in the root directory of this source tree. 222 */const q6=Ce("CalendarClock",[["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M17.5 17.5 16 16.3V14",key:"akvzfd"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]]);/** 223 * @license lucide-react v0.462.0 - ISC 224 * 225 * This source code is licensed under the ISC license. 226 * See the LICENSE file in the root directory of this source tree. 227 */const Aj=Ce("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"}]]);/** 228 * @license lucide-react v0.462.0 - ISC 229 * 230 * This source code is licensed under the ISC license. 231 * See the LICENSE file in the root directory of this source tree. 232 */const O$e=Ce("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"}]]);/** 233 * @license lucide-react v0.462.0 - ISC 234 * 235 * This source code is licensed under the ISC license. 236 * See the LICENSE file in the root directory of this source tree. 237 */const Ma=Ce("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** 238 * @license lucide-react v0.462.0 - ISC 239 * 240 * This source code is licensed under the ISC license. 241 * See the LICENSE file in the root directory of this source tree. 242 */const wh=Ce("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** 243 * @license lucide-react v0.462.0 - ISC 244 * 245 * This source code is licensed under the ISC license. 246 * See the LICENSE file in the root directory of this source tree. 247 */const V6=Ce("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** 248 * @license lucide-react v0.462.0 - ISC 249 * 250 * This source code is licensed under the ISC license. 251 * See the LICENSE file in the root directory of this source tree. 252 */const PO=Ce("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** 253 * @license lucide-react v0.462.0 - ISC 254 * 255 * This source code is licensed under the ISC license. 256 * See the LICENSE file in the root directory of this source tree. 257 */const Mfe=Ce("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** 258 * @license lucide-react v0.462.0 - ISC 259 * 260 * This source code is licensed under the ISC license. 261 * See the LICENSE file in the root directory of this source tree. 262 */const Rfe=Ce("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"}]]);/** 263 * @license lucide-react v0.462.0 - ISC 264 * 265 * This source code is licensed under the ISC license. 266 * See the LICENSE file in the root directory of this source tree. 267 */const uk=Ce("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/** 268 * @license lucide-react v0.462.0 - ISC 269 * 270 * This source code is licensed under the ISC license. 271 * See the LICENSE file in the root directory of this source tree. 272 */const sh=Ce("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** 273 * @license lucide-react v0.462.0 - ISC 274 * 275 * This source code is licensed under the ISC license. 276 * See the LICENSE file in the root directory of this source tree. 277 */const H6=Ce("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"}]]);/** 278 * @license lucide-react v0.462.0 - ISC 279 * 280 * This source code is licensed under the ISC license. 281 * See the LICENSE file in the root directory of this source tree. 282 */const I$e=Ce("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** 283 * @license lucide-react v0.462.0 - ISC 284 * 285 * This source code is licensed under the ISC license. 286 * See the LICENSE file in the root directory of this source tree. 287 */const t2=Ce("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** 288 * @license lucide-react v0.462.0 - ISC 289 * 290 * This source code is licensed under the ISC license. 291 * See the LICENSE file in the root directory of this source tree.
292 */const Pl=Ce("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"}]]);/** 293 * @license lucide-react v0.462.0 - ISC 294 * 295 * This source code is licensed under the ISC license. 296 * See the LICENSE file in the root directory of this source tree. 297 */const Jo=Ce("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"}]]);/** 298 * @license lucide-react v0.462.0 - ISC 299 * 300 * This source code is licensed under the ISC license. 301 * See the LICENSE file in the root directory of this source tree. 302 */const D$e=Ce("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"}]]);/** 303 * @license lucide-react v0.462.0 - ISC 304 * 305 * This source code is licensed under the ISC license. 306 * See the LICENSE file in the root directory of this source tree. 307 */const Ts=Ce("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"}]]);/** 308 * @license lucide-react v0.462.0 - ISC 309 * 310 * This source code is licensed under the ISC license. 311 * See the LICENSE file in the root directory of this source tree. 312 */const Gi=Ce("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"}]]);/** 313 * @license lucide-react v0.462.0 - ISC 314 * 315 * This source code is licensed under the ISC license. 316 * See the LICENSE file in the root directory of this source tree. 317 */const Zy=Ce("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"}]]);/** 318 * @license lucide-react v0.462.0 - ISC 319 * 320 * This source code is licensed under the ISC license. 321 * See the LICENSE file in the root directory of this source tree. 322 */const Mu=Ce("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"}]]);/** 323 * @license lucide-react v0.462.0 - ISC 324 * 325 * This source code is licensed under the ISC license. 326 * See the LICENSE file in the root directory of this source tree. 327 */const L$e=Ce("Facebook",[["path",{d:"M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z",key:"1jg4f8"}]]);/** 328 * @license lucide-react v0.462.0 - ISC 329 * 330 * This source code is licensed under the ISC license. 331 * See the LICENSE file in the root directory of this source tree. 332 */const F$e=Ce("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"}]]);/** 333 * @license lucide-react v0.462.0 - ISC 334 * 335 * This source code is licensed under the ISC license. 336 * See the LICENSE file in the root directory of this source tree. 337 */const $$e=Ce("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"}]]);/** 338 * @license lucide-react v0.462.0 - ISC 339 * 340 * This source code is licensed under the ISC license. 341 * See the LICENSE file in the root directory of this source tree. 342 */const dp=Ce("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"}]]);/** 343 * @license lucide-react v0.462.0 - ISC 344 * 345 * This source code is licensed under the ISC license. 346 * See the LICENSE file in the root directory of this source tree. 347 */const z$e=Ce("FileType",[["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 13v-1h6v1",key:"1bb014"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"M11 18h2",key:"12mj7e"}]]);/** 348 * @license lucide-react v0.462.0 - ISC 349 * 350 * This source code is licensed under the ISC license. 351 * See the LICENSE file in the root directory of this source tree. 352 */const W6=Ce("FileUp",[["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 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]]);/** 353 * @license lucide-react v0.462.0 - ISC 354 * 355 * This source code is licensed under the ISC license. 356 * See the LICENSE file in the root directory of this source tree. 357 */const B$e=Ce("Flag",[["path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z",key:"i9b6wo"}],["line",{x1:"4",x2:"4",y1:"22",y2:"15",key:"1cm3nv"}]]);/** 358 * @license lucide-react v0.462.0 - ISC 359 * 360 * This source code is licensed under the ISC license. 361 * See the LICENSE file in the root directory of this source tree. 362 */const Ofe=Ce("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"}]]);/** 363 * @license lucide-react v0.462.0 - ISC 364 * 365 * This source code is licensed under the ISC license. 366 * See the LICENSE file in the root directory of this source tree. 367 */const U$e=Ce("FolderTree",[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]);/** 368 * @license lucide-react v0.462.0 - ISC 369 * 370 * This source code is licensed under the ISC license. 371 * See the LICENSE file in the root directory of this source tree. 372 */const q$e=Ce("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"}]]);/** 373 * @license lucide-react v0.462.0 - ISC 374 * 375 * This source code is licensed under the ISC license. 376 * See the LICENSE file in the root directory of this source tree. 377 */const ZL=Ce("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"}]]);/** 378 * @license lucide-react v0.462.0 - ISC 379 * 380 * This source code is licensed under the ISC license. 381 * See the LICENSE file in the root directory of this source tree. 382 */const V$e=Ce("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"}]]);/** 383 * @license lucide-react v0.462.0 - ISC 384 * 385 * This source code is licensed under the ISC license. 386 * See the LICENSE file in the root directory of this source tree. 387 */const H$e=Ce("Handshake",[["path",{d:"m11 17 2 2a1 1 0 1 0 3-3",key:"efffak"}],["path",{d:"m14 14 2.5 2.5a1 1 0 1 0 3-3l-3.88-3.88a3 3 0 0 0-4.24 0l-.88.88a1 1 0 1 1-3-3l2.81-2.81a5.79 5.79 0 0 1 7.06-.87l.47.28a2 2 0 0 0 1.42.25L21 4",key:"9pr0kb"}],["path",{d:"m21 3 1 11h-2",key:"1tisrp"}],["path",{d:"M3 3 2 14l6.5 6.5a1 1 0 1 0 3-3",key:"1uvwmv"}],["path",{d:"M3 4h8",key:"1ep09j"}]]);/** 388 * @license lucide-react v0.462.0 - ISC 389 * 390 * This source code is licensed under the ISC license. 391 * See the LICENSE file in the root directory of this source tree. 392 */const W$e=Ce("Heading2",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}
392]]);/** 393 * @license lucide-react v0.462.0 - ISC 394 * 395 * This source code is licensed under the ISC license. 396 * See the LICENSE file in the root directory of this source tree. 397 */const K$e=Ce("Heading3",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]]);/** 398 * @license lucide-react v0.462.0 - ISC 399 * 400 * This source code is licensed under the ISC license. 401 * See the LICENSE file in the root directory of this source tree. 402 */const G$e=Ce("Heading4",[["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17 10v3a1 1 0 0 0 1 1h3",key:"tj5zdr"}],["path",{d:"M21 10v8",key:"1kdml4"}],["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}]]);/** 403 * @license lucide-react v0.462.0 - ISC 404 * 405 * This source code is licensed under the ISC license. 406 * See the LICENSE file in the root directory of this source tree. 407 */const K6=Ce("Headphones",[["path",{d:"M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 18 0v7a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3",key:"1xhozi"}]]);/** 408 * @license lucide-react v0.462.0 - ISC 409 * 410 * This source code is licensed under the ISC license. 411 * See the LICENSE file in the root directory of this source tree. 412 */const e3=Ce("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"}]]);/** 413 * @license lucide-react v0.462.0 - ISC 414 * 415 * This source code is licensed under the ISC license. 416 * See the LICENSE file in the root directory of this source tree. 417 */const Y$e=Ce("Highlighter",[["path",{d:"m9 11-6 6v3h9l3-3",key:"1a3l36"}],["path",{d:"m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4",key:"14a9rk"}]]);/** 418 * @license lucide-react v0.462.0 - ISC 419 * 420 * This source code is licensed under the ISC license. 421 * See the LICENSE file in the root directory of this source tree. 422 */const Ife=Ce("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"}]]);/** 423 * @license lucide-react v0.462.0 - ISC 424 * 425 * This source code is licensed under the ISC license. 426 * See the LICENSE file in the root directory of this source tree. 427 */const MO=Ce("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** 428 * @license lucide-react v0.462.0 - ISC 429 * 430 * This source code is licensed under the ISC license. 431 * See the LICENSE file in the root directory of this source tree. 432 */const X$e=Ce("Images",[["path",{d:"M18 22H4a2 2 0 0 1-2-2V6",key:"pblm9e"}],["path",{d:"m22 13-1.296-1.296a2.41 2.41 0 0 0-3.408 0L11 18",key:"nf6bnh"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}],["rect",{width:"16",height:"16",x:"6",y:"2",rx:"2",key:"12espp"}]]);/** 433 * @license lucide-react v0.462.0 - ISC 434 * 435 * This source code is licensed under the ISC license. 436 * See the LICENSE file in the root directory of this source tree. 437 */const n2=Ce("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** 438 * @license lucide-react v0.462.0 - ISC 439 * 440 * This source code is licensed under the ISC license. 441 * See the LICENSE file in the root directory of this source tree. 442 */const J$e=Ce("Instagram",[["rect",{width:"20",height:"20",x:"2",y:"2",rx:"5",ry:"5",key:"2e1cvw"}],["path",{d:"M16 11.37A4 4 0 1 1 12.63 8 4 4 0 0 1 16 11.37z",key:"9exkf1"}],["line",{x1:"17.5",x2:"17.51",y1:"6.5",y2:"6.5",key:"r4j83e"}]]);/** 443 * @license lucide-react v0.462.0 - ISC 444 * 445 * This source code is licensed under the ISC license. 446 * See the LICENSE file in the root directory of this source tree. 447 */const Dfe=Ce("Italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]);/** 448 * @license lucide-react v0.462.0 - ISC 449 * 450 * This source code is licensed under the ISC license. 451 * See the LICENSE file in the root directory of this source tree. 452 */const G6=Ce("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"}]]);/** 453 * @license lucide-react v0.462.0 - ISC 454 * 455 * This source code is licensed under the ISC license. 456 * See the LICENSE file in the root directory of this source tree.
457 */const Q$e=Ce("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/** 458 * @license lucide-react v0.462.0 - ISC 459 * 460 * This source code is licensed under the ISC license. 461 * See the LICENSE file in the root directory of this source tree. 462 */const Z$e=Ce("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/** 463 * @license lucide-react v0.462.0 - ISC 464 * 465 * This source code is licensed under the ISC license. 466 * See the LICENSE file in the root directory of this source tree. 467 */const TW=Ce("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/** 468 * @license lucide-react v0.462.0 - ISC 469 * 470 * This source code is licensed under the ISC license. 471 * See the LICENSE file in the root directory of this source tree. 472 */const e5e=Ce("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"}]]);/** 473 * @license lucide-react v0.462.0 - ISC 474 * 475 * This source code is licensed under the ISC license. 476 * See the LICENSE file in the root directory of this source tree. 477 */const t5e=Ce("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/** 478 * @license lucide-react v0.462.0 - ISC 479 * 480 * This source code is licensed under the ISC license. 481 * See the LICENSE file in the root directory of this source tree. 482 */const Lfe=Ce("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"}]]);/** 483 * @license lucide-react v0.462.0 - ISC 484 * 485 * This source code is licensed under the ISC license. 486 * See the LICENSE file in the root directory of this source tree. 487 */const Je=Ce("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** 488 * @license lucide-react v0.462.0 - ISC 489 * 490 * This source code is licensed under the ISC license. 491 * See the LICENSE file in the root directory of this source tree. 492 */const dk=Ce("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/** 493 * @license lucide-react v0.462.0 - ISC 494 * 495 * This source code is licensed under the ISC license. 496 * See the LICENSE file in the root directory of this source tree. 497 */const n5e=Ce("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/** 498 * @license lucide-react v0.462.0 - ISC 499 * 500 * This source code is licensed under the ISC license. 501 * See the LICENSE file in the root directory of this source tree. 502 */const UQ=Ce("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"}]]);/** 503 * @license lucide-react v0.462.0 - ISC 504 * 505 * This source code is licensed under the ISC license. 506 * See the LICENSE file in the root directory of this source tree. 507 */const Ru=Ce("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"}]]);/** 508 * @license lucide-react v0.462.0 - ISC 509 * 510 * This source code is licensed under the ISC license. 511 * See the LICENSE file in the root directory of this source tree. 512 */const _r=Ce("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"}]]);/** 513 * @license lucide-react v0.462.0 - ISC 514 * 515 * This source code is licensed under the ISC license. 516 * See the LICENSE file in the root directory of this source tree. 517 */const r5e=Ce("Map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]);/** 518 * @license lucide-react v0.462.0 - ISC 519 * 520 * This source code is licensed under the ISC license. 521 * See the LICENSE file in the root directory of this source tree. 522 */const s5e=Ce("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/** 523 * @license lucide-react v0.462.0 - ISC 524 * 525 * This source code is licensed under the ISC license. 526 * See the LICENSE file in the root directory of this source tree. 527 */const Ffe=Ce("Megaphone",[["path",{d:"m3 11 18-5v12L3 14v-3z",key:"n962bs"}],["path",{d:"M11.6 16.8a3 3 0 1 1-5.8-1.6",key:"1yl0tm"}]]);/** 528 * @license lucide-react v0.462.0 - ISC 529 * 530 * This source code is licensed under the ISC license. 531 * See the LICENSE file in the root directory of this source tree. 532 */const $fe=Ce("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"}]]);/** 533 * @license lucide-react v0.462.0 - ISC 534 * 535 * This source code is licensed under the ISC license. 536 * See the LICENSE file in the root directory of this source tree. 537 */const t3=Ce("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"}]]);/** 538 * @license lucide-react v0.462.0 - ISC 539 * 540 * This source code is licensed under the ISC license. 541 * See the LICENSE file in the root directory of this source tree. 542 */const n3=Ce("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/** 543 * @license lucide-react v0.462.0 - ISC 544 * 545 * This source code is licensed under the ISC license. 546 * See the LICENSE file in the root directory of this source tree. 547 */const i5e=Ce("Navigation",[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]]);/** 548 * @license lucide-react v0.462.0 - ISC 549 * 550 * This source code is licensed under the ISC license. 551 * See the LICENSE file in the root directory of this source tree. 552 */const PW=Ce("Newspaper",[["path",{d:"M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-2 2Zm0 0a2 2 0 0 1-2-2v-9c0-1.1.9-2 2-2h2",key:"7pis2x"}],["path",{d:"M18 14h-8",key:"sponae"}],["path",{d:"M15 18h-5",key:"95g1m2"}],["path",{d:"M10 6h8v4h-8V6Z",key:"smlsk5"}]]);/** 553 * @license lucide-react v0.462.0 - ISC 554 * 555 * This source code is licensed under the ISC license. 556 * See the LICENSE file in the root directory of this source tree. 557 */const L_=Ce("Package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7",key:"yx3hmr"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);/** 558 * @license lucide-react v0.462.0 - ISC 559 * 560 * This source code is licensed under the ISC license. 561 * See the LICENSE file in the root directory of this source tree. 562 */const RO=Ce("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"}]]);/** 563 * @license lucide-react v0.462.0 - ISC 564 * 565 * This source code is licensed under the ISC license. 566 * See the LICENSE file in the root directory of this source tree. 567 */const a5e=Ce("PanelRightOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]]);/** 568 * @license lucide-react v0.462.0 - ISC 569 * 570 * This source code is licensed under the ISC license. 571 * See the LICENSE file in the root directory of this source tree. 572 */const o5e=Ce("PanelsTopLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]]);/** 573 * @license lucide-react v0.462.0 - ISC 574 * 575 * This source code is licensed under the ISC license. 576 * See the LICENSE file in the root directory of this source tree. 577 */const qQ=Ce("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]);/** 578 * @license lucide-react v0.462.0 - ISC 579 * 580 * This source code is licensed under the ISC license. 581 * See the LICENSE file in the root directory of this source tree. 582 */const l5e=Ce("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"}]]);/** 583 * @license lucide-react v0.462.0 - ISC 584 * 585 * This source code is licensed under the ISC license. 586 * See the LICENSE file in the root directory of this source tree. 587 */const Oc=Ce("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"}]]);/** 588 * @license lucide-react v0.462.0 - ISC 589 * 590 * This source code is licensed under the ISC license. 591 * See the LICENSE file in the root directory of this source tree. 592 */const c5e=Ce("Percent",[["line",{x1:"19",x2:"5",y1:"5",y2:"19",key:"1x9vlm"}],["circle",{cx:"6.5",cy:"6.5",r:"2.5",key:"4mh3h7"}],["circle",{cx:"17.5",cy:"17.5",r:"2.5",key:"1mdrzq"}]]);/** 593 * @license lucide-react v0.462.0 - ISC 594 * 595 * This source code is licensed under the ISC license. 596 * See the LICENSE file in the root directory of this source tree. 597 */const hk=Ce("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"}]]);/** 598 * @license lucide-react v0.462.0 - ISC 599 * 600 * This source code is licensed under the ISC license. 601 * See the LICENSE file in the root directory of this source tree. 602 */const Y6=Ce("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/** 603 * @license lucide-react v0.462.0 - ISC 604 * 605 * This source code is licensed under the ISC license. 606 * See the LICENSE file in the root directory of this source tree. 607 */const dr=Ce("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** 608 * @license lucide-react v0.462.0 - ISC 609 * 610 * This source code is licensed under the ISC license. 611 * See the LICENSE file in the root directory of this source tree. 612 */const zfe=Ce("Printer",[["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"143wyd"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6",key:"1itne7"}],["rect",{x:"6",y:"14",width:"12",height:"8",rx:"1",key:"1ue0tg"}]]);/** 613 * @license lucide-react v0.462.0 - ISC 614 * 615 * This source code is licensed under the ISC license. 616 * See the LICENSE file in the root directory of this source tree. 617 */const u5e=Ce("Quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);/** 618 * @license lucide-react v0.462.0 - ISC 619 * 620 * This source code is licensed under the ISC license. 621 * See the LICENSE file in the root directory of this source tree. 622 */const d5e=Ce("Redo",[["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]]);/** 623 * @license lucide-react v0.462.0 - ISC 624 * 625 * This source code is licensed under the ISC license. 626 * See the LICENSE file in the root directory of this source tree. 627 */const Ig=Ce("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"}]]);/** 628 * @license lucide-react v0.462.0 - ISC 629 * 630 * This source code is licensed under the ISC license. 631 * See the LICENSE file in the root directory of this source tree. 632 */const h5e=Ce("Reply",[["polyline",{points:"9 17 4 12 9 7",key:"hvgpf2"}
632],["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}]]);/** 633 * @license lucide-react v0.462.0 - ISC 634 * 635 * This source code is licensed under the ISC license. 636 * See the LICENSE file in the root directory of this source tree. 637 */const f5e=Ce("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/** 638 * @license lucide-react v0.462.0 - ISC 639 * 640 * This source code is licensed under the ISC license. 641 * See the LICENSE file in the root directory of this source tree. 642 */const p5e=Ce("Rss",[["path",{d:"M4 11a9 9 0 0 1 9 9",key:"pv89mb"}],["path",{d:"M4 4a16 16 0 0 1 16 16",key:"k0647b"}],["circle",{cx:"5",cy:"19",r:"1",key:"bfqh0e"}]]);/** 643 * @license lucide-react v0.462.0 - ISC 644 * 645 * This source code is licensed under the ISC license. 646 * See the LICENSE file in the root directory of this source tree. 647 */const Ra=Ce("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"}]]);/** 648 * @license lucide-react v0.462.0 - ISC 649 * 650 * This source code is licensed under the ISC license. 651 * See the LICENSE file in the root directory of this source tree. 652 */const Bfe=Ce("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"}]]);/** 653 * @license lucide-react v0.462.0 - ISC 654 * 655 * This source code is licensed under the ISC license. 656 * See the LICENSE file in the root directory of this source tree. 657 */const is=Ce("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** 658 * @license lucide-react v0.462.0 - ISC 659 * 660 * This source code is licensed under the ISC license. 661 * See the LICENSE file in the root directory of this source tree. 662 */const Jf=Ce("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"}]]);/** 663 * @license lucide-react v0.462.0 - ISC 664 * 665 * This source code is licensed under the ISC license. 666 * See the LICENSE file in the root directory of this source tree. 667 */const m5e=Ce("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/** 668 * @license lucide-react v0.462.0 - ISC 669 * 670 * This source code is licensed under the ISC license. 671 * See the LICENSE file in the root directory of this source tree. 672 */const MW=Ce("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** 673 * @license lucide-react v0.462.0 - ISC 674 * 675 * This source code is licensed under the ISC license. 676 * See the LICENSE file in the root directory of this source tree. 677 */const g5e=Ce("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"}]]);/** 678 * @license lucide-react v0.462.0 - ISC 679 * 680 * This source code is licensed under the ISC license. 681 * See the LICENSE file in the root directory of this source tree. 682 */const Wi=Ce("ShoppingBag",[["path",{d:"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z",key:"hou9p0"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}]]);/** 683 * @license lucide-react v0.462.0 - ISC 684 * 685 * This source code is licensed under the ISC license. 686 * See the LICENSE file in the root directory of this source tree. 687 */const $f=Ce("ShoppingCart",[["circle",{cx:"8",cy:"21",r:"1",key:"jimo8o"}
687],["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"}]]);/** 688 * @license lucide-react v0.462.0 - ISC 689 * 690 * This source code is licensed under the ISC license. 691 * See the LICENSE file in the root directory of this source tree. 692 */const v5e=Ce("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"}]]);/** 693 * @license lucide-react v0.462.0 - ISC 694 * 695 * This source code is licensed under the ISC license. 696 * See the LICENSE file in the root directory of this source tree. 697 */const x5e=Ce("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/** 698 * @license lucide-react v0.462.0 - ISC 699 * 700 * This source code is licensed under the ISC license. 701 * See the LICENSE file in the root directory of this source tree. 702 */const hp=Ce("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"}]]);/** 703 * @license lucide-react v0.462.0 - ISC 704 * 705 * This source code is licensed under the ISC license. 706 * See the LICENSE file in the root directory of this source tree. 707 */const Ufe=Ce("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"}]]);/** 708 * @license lucide-react v0.462.0 - ISC 709 * 710 * This source code is licensed under the ISC license. 711 * See the LICENSE file in the root directory of this source tree. 712 */const VQ=Ce("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/** 713 * @license lucide-react v0.462.0 - ISC 714 * 715 * This source code is licensed under the ISC license. 716 * See the LICENSE file in the root directory of this source tree. 717 */const X6=Ce("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"}]]);/** 718 * @license lucide-react v0.462.0 - ISC 719 * 720 * This source code is licensed under the ISC license. 721 * See the LICENSE file in the root directory of this source tree. 722 */const y5e=Ce("Store",[["path",{d:"m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7",key:"ztvudi"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}],["path",{d:"M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4",key:"2ebpfo"}],["path",{d:"M2 7h20",key:"1fcdvo"}],["path",{d:"M22 7v3a2 2 0 0 1-2 2a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12a2 2 0 0 1-2-2V7",key:"6c3vgh"}]]);/** 723 * @license lucide-react v0.462.0 - ISC 724 * 725 * This source code is licensed under the ISC license. 726 * See the LICENSE file in the root directory of this source tree. 727 */const b5e=Ce("Strikethrough",[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]]);/** 728 * @license lucide-react v0.462.0 - ISC 729 * 730 * This source code is licensed under the ISC license. 731 * See the LICENSE file in the root directory of this source tree. 732 */const w5e=Ce("Table",[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]]);/** 733 * @license lucide-react v0.462.0 - ISC 734 * 735 * This source code is licensed under the ISC license. 736 * See the LICENSE file in the root directory of this source tree.
737 */const qfe=Ce("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/** 738 * @license lucide-react v0.462.0 - ISC 739 * 740 * This source code is licensed under the ISC license. 741 * See the LICENSE file in the root directory of this source tree. 742 */const Vfe=Ce("Ticket",[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"M13 5v2",key:"dyzc3o"}],["path",{d:"M13 17v2",key:"1ont0d"}],["path",{d:"M13 11v2",key:"1wjjxi"}]]);/** 743 * @license lucide-react v0.462.0 - ISC 744 * 745 * This source code is licensed under the ISC license. 746 * See the LICENSE file in the root directory of this source tree. 747 */const tr=Ce("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"}]]);/** 748 * @license lucide-react v0.462.0 - ISC 749 * 750 * This source code is licensed under the ISC license. 751 * See the LICENSE file in the root directory of this source tree. 752 */const F_=Ce("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"}]]);/** 753 * @license lucide-react v0.462.0 - ISC 754 * 755 * This source code is licensed under the ISC license. 756 * See the LICENSE file in the root directory of this source tree. 757 */const Pw=Ce("Truck",[["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2",key:"wrbu53"}],["path",{d:"M15 18H9",key:"1lyqi6"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14",key:"lysw3i"}],["circle",{cx:"17",cy:"18",r:"2",key:"332jqn"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}]]);/** 758 * @license lucide-react v0.462.0 - ISC 759 * 760 * This source code is licensed under the ISC license. 761 * See the LICENSE file in the root directory of this source tree. 762 */const _5e=Ce("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);/** 763 * @license lucide-react v0.462.0 - ISC 764 * 765 * This source code is licensed under the ISC license. 766 * See the LICENSE file in the root directory of this source tree. 767 */const j5e=Ce("Underline",[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]]);/** 768 * @license lucide-react v0.462.0 - ISC 769 * 770 * This source code is licensed under the ISC license. 771 * See the LICENSE file in the root directory of this source tree. 772 */const S5e=Ce("Undo",[["path",{d:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]]);/** 773 * @license lucide-react v0.462.0 - ISC 774 * 775 * This source code is licensed under the ISC license. 776 * See the LICENSE file in the root directory of this source tree. 777 */const Oa=Ce("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"}]]);/** 778 * @license lucide-react v0.462.0 - ISC 779 * 780 * This source code is licensed under the ISC license. 781 * See the LICENSE file in the root directory of this source tree. 782 */const N5e=Ce("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"}]]);/** 783 * @license lucide-react v0.462.0 - ISC 784 * 785 * This source code is licensed under the ISC license. 786 * See the LICENSE file in the root directory of this source tree. 787 */const C5e=Ce("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"}]]);/** 788 * @license lucide-react v0.462.0 - ISC 789 * 790 * This source code is licensed under the ISC license. 791 * See the LICENSE file in the root directory of this source tree. 792 */const k5e=Ce("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"}]]);/** 793 * @license lucide-react v0.462.0 - ISC 794 * 795 * This source code is licensed under the ISC license. 796 * See the LICENSE file in the root directory of this source tree. 797 */const qv=Ce("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"}]]);/** 798 * @license lucide-react v0.462.0 - ISC 799 * 800 * This source code is licensed under the ISC license. 801 * See the LICENSE file in the root directory of this source tree. 802 */const RW=Ce("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"}]]);/** 803 * @license lucide-react v0.462.0 - ISC 804 * 805 * This source code is licensed under the ISC license. 806 * See the LICENSE file in the root directory of this source tree. 807 */const A5e=Ce("Variable",[["path",{d:"M8 21s-4-3-4-9 4-9 4-9",key:"uto9ud"}],["path",{d:"M16 3s4 3 4 9-4 9-4 9",key:"4w2vsq"}],["line",{x1:"15",x2:"9",y1:"9",y2:"15",key:"f7djnv"}],["line",{x1:"9",x2:"15",y1:"9",y2:"15",key:"1shsy8"}]]);/** 808 * @license lucide-react v0.462.0 - ISC 809 * 810 * This source code is licensed under the ISC license. 811 * See the LICENSE file in the root directory of this source tree. 812 */const E5e=Ce("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/** 813 * @license lucide-react v0.462.0 - ISC 814 * 815 * This source code is licensed under the ISC license. 816 * See the LICENSE file in the root directory of this source tree. 817 */const OW=Ce("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"}]]);/** 818 * @license lucide-react v0.462.0 - ISC 819 * 820 * This source code is licensed under the ISC license. 821 * See the LICENSE file in the root directory of this source tree.
vendor: 7,264 bytes, lines 822-837
822 */const ks=Ce("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** 823 * @license lucide-react v0.462.0 - ISC 824 * 825 * This source code is licensed under the ISC license. 826 * See the LICENSE file in the root directory of this source tree. 827 */const T5e=Ce("Youtube",[["path",{d:"M2.5 17a24.12 24.12 0 0 1 0-10 2 2 0 0 1 1.4-1.4 49.56 49.56 0 0 1 16.2 0A2 2 0 0 1 21.5 7a24.12 24.12 0 0 1 0 10 2 2 0 0 1-1.4 1.4 49.55 49.55 0 0 1-16.2 0A2 2 0 0 1 2.5 17",key:"1q2vi4"}],["path",{d:"m10 15 5-3-5-3z",key:"1jp15x"}]]);/** 828 * @license lucide-react v0.462.0 - ISC 829 * 830 * This source code is licensed under the ISC license. 831 * See the LICENSE file in the root directory of this source tree. 832 */const P5e=Ce("ZoomIn",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);/** 833 * @license lucide-react v0.462.0 - ISC 834 * 835 * This source code is licensed under the ISC license. 836 * See the LICENSE file in the root directory of this source tree. 837 */const M5e=Ce("ZoomOut",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),IW="-",R5e=t=>{const e=I5e(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{const l=o.split(IW);return l[0]===""&&l.length!==1&&l.shift(),Hfe(l,e)||O5e(o)},getConflictingClassGroupIds:(o,l)=>{const c=n[o]||[];return l&&r[o]?[...c,...r[o]]:c}}},Hfe=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),s=r?Hfe(t.slice(1),r):void 0;if(s)return s;if(e.validators.length===0)return;const i=t.join(IW);return(o=e.validators.find(({validator:l})=>l(i)))==null?void 0:o.classGroupId},HQ=/^\[(.+)\]$/,O5e=t=>{if(HQ.test(t)){const e=HQ.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},I5e=t=>{const{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return L5e(Object.entries(t.classGroups),n).forEach(([i,o])=>{J6(o,r,i,e)}),r},J6=(t,e,n,r)=>{t.forEach(s=>{if(typeof s=="string"){const i=s===""?e:WQ(e,s);i.classGroupId=n;return}if(typeof s=="function"){if(D5e(s)){J6(s(r),e,n,r);return}e.validators.push({validator:s,classGroupId:n});return}Object.entries(s).forEach(([i,o])=>{J6(o,WQ(e,i),n,r)})})},WQ=(t,e)=>{let n=t;return e.split(IW).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},D5e=t=>t.isThemeGetter,L5e=(t,e)=>e?t.map(([n,r])=>{const s=r.map(i=>typeof i=="string"?e+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([o,l])=>[e+o,l])):i);return[n,s]}):t,F5e=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;const s=(i,o)=>{n.set(i,o),e++,e>t&&(e=0,r=n,n=new Map)};return{get(i){let o=n.get(i);if(o!==void 0)return o;if((o=r.get(i))!==void 0)return s(i,o),o},set(i,o){n.has(i)?n.set(i,o):s(i,o)}}},Wfe="!",$5e=t=>{const{separator:e,experimentalParseClassName:n}=t,r=e.length===1,s=e[0],i=e.length,o=l=>{const c=[];let u=0,d=0,h;for(let x=0;x<l.length;x++){let g=l[x];if(u===0){if(g===s&&(r||l.slice(x,x+i)===e)){c.push(l.slice(d,x)),d=x+i;continue}if(g==="/"){h=x;continue}}g==="["?u++:g==="]"&&u--}const f=c.length===0?l:l.substring(d),p=f.startsWith(Wfe),m=p?f.substring(1):f,v=h&&h>d?h-d:void 0;return{modifiers:c,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:v}};return n?l=>n({className:l,parseClassName:o}):o},z5e=t=>{if(t.length<=1)return t;const e=[];let n=[];return t.forEach(r=>{r[0]==="["?(e.push(...n.sort(),r),n=[]):n.push(r)}),e.push(...n.sort()),e},B5e=t=>({cache:F5e(t.cacheSize),parseClassName:$5e(t),...R5e(t)}),U5e=/\s+/,q5e=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s}=e,i=[],o=t.trim().split(U5e);let l="";for(let c=o.length-1;c>=0;c-=1){const u=o[c],{modifiers:d,hasImportantModifier:h,baseClassName:f,maybePostfixModifierPosition:p}=n(u);let m=!!p,v=r(m?f.substring(0,p):f);if(!v){if(!m){l=u+(l.length>0?" "+l:l);continue}if(v=r(f),!v){l=u+(l.length>0?" "+l:l);continue}m=!1}const x=z5e(d).join(":"),g=h?x+Wfe:x,w=g+v;if(i.includes(w))continue;i.push(w);const _=s(v,m);for(let j=0;j<_.length;++j){const N=_[j];i.push(g+N)}l=u+(l.length>0?" "+l:l)}return l};function V5e(){let t=0,e,n,r="";for(;t<arguments.length;)(e=arguments[t++])&&(n=Kfe(e))&&(r&&(r+=" "),r+=n);return r}const Kfe=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=Kfe(t[r]))&&(n&&(n+=" "),n+=e);return n};function H5e(t,...e){let n,r,s,i=o;function o(c){const u=e.reduce((d,h)=>h(d),t());return n=B5e(u),r=n.cache.get,s=n.cache.set,i=l,l(c)}function l(c){const u=r(c);if(u)return u;const d=q5e(c,n);return s(c,d),d}return function(){return i(V5e.apply(null,arguments))}}const pr=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},Gfe=/^\[(?:([a-z-]+):)?(.+)\]$/i,W5e=/^\d+\/\d+$/,K5e=new Set(["px","full","screen"]),G5e=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Y5e=/\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$/,X5e=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,J5e=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Q5e=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,kh=t=>Mw(t)||K5e.has(t)||W5e.test(t),Np=t=>Ej(t,"length",aze),Mw=t=>!!t&&!Number.isNaN(Number(t)),E$=t=>Ej(t,"number",Mw),yS=t=>!!t&&Number.isInteger(Number(t)),Z5e=t=>t.endsWith("%")&&Mw(t.slice(0,-1)),Kt=t=>Gfe.test(t),Cp=t=>G5e.test(t),eze=new Set(["length","size","percentage"]),tze=t=>Ej(t,eze,Yfe),nze=t=>Ej(t,"position",Yfe),rze=new Set(["image","url"]),sze=t=>Ej(t,rze,lze),ize=t=>Ej(t,"",oze),bS=()=>!0,Ej=(t,e,n)=>{const r=Gfe.exec(t);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):n(r[2]):!1},aze=t=>Y5e.test(t)&&!X5e.test(t),Yfe=()=>!1,oze=t=>J5e.test(t),lze=t=>Q5e.test(t),cze=()=>{const t=pr("colors"),e=pr("spacing"),n=pr("blur"),r=pr("brightness"),s=pr("borderColor"),i=pr("borderRadius"),o=pr("borderSpacing"),l=pr("borderWidth"),c=pr("contrast"),u=pr("grayscale"),d=pr("hueRotate"),h=pr("invert"),f=pr("gap"),p=pr("gradientColorStops"),m=pr("gradientColorStopPositions"),v=pr("inset"),x=pr("margin"),g=pr("opacity"),w=pr("padding"),_=pr("saturate"),j=pr("scale"),N=pr("sepia"),S=pr("skew"),C=pr("space"),k=pr("translate"),E=()=>["auto","contain","none"],P=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto",Kt,e],M=()=>[Kt,e],R=()=>["",kh,Np],A=()=>["auto",Mw,Kt],I=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],D=()=>["solid","dashed","dotted","double","none"],O=()=>["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"],B=()=>["","0",Kt],G=()=>["auto","avoid","all","avoid-page","page","left","right","column"],U=()=>[Mw,Kt];return{cacheSize:500,separator:":",theme:{colors:[bS],spacing:[kh,Np],blur:["none","",Cp,Kt],brightness:U(),borderColor:[t],borderRadius:["n
837one","","full",Cp,Kt],borderSpacing:M(),borderWidth:R(),contrast:U(),grayscale:B(),hueRotate:U(),invert:B(),gap:M(),gradientColorStops:[t],gradientColorStopPositions:[Z5e,Np],inset:T(),margin:T(),opacity:U(),padding:M(),saturate:U(),scale:U(),sepia:B(),skew:U(),space:M(),translate:M()},classGroups:{aspect:[{aspect:["auto","square","video",Kt]}],container:["container"],columns:[{columns:[Cp]}],"break-after":[{"break-after":G()}],"break-before":[{"break-before":G()}],"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:[...I(),Kt]}],overflow:[{overflow:P()}],"overflow-x":[{"overflow-x":P()}],"overflow-y":[{"overflow-y":P()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[v]}],"inset-x":[{"inset-x":[v]}],"inset-y":[{"inset-y":[v]}],start:[{start:[v]}],end:[{end:[v]}],top:[{top:[v]}],right:[{right:[v]}],bottom:[{bottom:[v]}],left:[{left:[v]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",yS,Kt]}],basis:[{basis:T()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Kt]}],grow:[{grow:B()}],shrink:[{shrink:B()}],order:[{order:["first","last","none",yS,Kt]}],"grid-cols":[{"grid-cols":[bS]}],"col-start-end":[{col:["auto",{span:["full",yS,Kt]},Kt]}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":[bS]}],"row-start-end":[{row:["auto",{span:[yS,Kt]},Kt]}],"row-start":[{"row-start":A()}],"row-end":[{"row-end":A()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Kt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Kt]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"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:[w]}],px:[{px:[w]}],py:[{py:[w]}],ps:[{ps:[w]}],pe:[{pe:[w]}],pt:[{pt:[w]}],pr:[{pr:[w]}],pb:[{pb:[w]}],pl:[{pl:[w]}],m:[{m:[x]}],mx:[{mx:[x]}],my:[{my:[x]}],ms:[{ms:[x]}],me:[{me:[x]}],mt:[{mt:[x]}],mr:[{mr:[x]}],mb:[{mb:[x]}],ml:[{ml:[x]}],"space-x":[{"space-x":[C]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[C]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Kt,e]}],"min-w":[{"min-w":[Kt,e,"min","max","fit"]}],"max-w":[{"max-w":[Kt,e,"none","full","min","max","fit","prose",{screen:[Cp]},Cp]}],h:[{h:[Kt,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Kt,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Kt,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Kt,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Cp,Np]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",E$]}],"font-family":[{font:[bS]}],"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",Kt]}],"line-clamp":[{"line-clamp":["none",Mw,E$]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",kh,Kt]}],"list-image":[{"list-image":["none",Kt]}],"list-style-type":[{list:["none","disc","decimal",Kt]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[g]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[g]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...D(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",kh,Np]}],"underline-offset":[{"underline-offset":["auto",kh,Kt]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:M()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Kt]}],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",Kt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[g]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...I(),nze]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",tze]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},sze]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[m]}
vendor: 4,239 bytes, line 837
837],"gradient-via-pos":[{via:[m]}],"gradient-to-pos":[{to:[m]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[g]}],"border-style":[{border:[...D(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[g]}],"divide-style":[{divide:D()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...D()]}],"outline-offset":[{"outline-offset":[kh,Kt]}],"outline-w":[{outline:[kh,Np]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:R()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[g]}],"ring-offset-w":[{"ring-offset":[kh,Np]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Cp,ize]}],"shadow-color":[{shadow:[bS]}],opacity:[{opacity:[g]}],"mix-blend":[{"mix-blend":[...O(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":O()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",Cp,Kt]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[h]}],saturate:[{saturate:[_]}],sepia:[{sepia:[N]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[h]}],"backdrop-opacity":[{"backdrop-opacity":[g]}],"backdrop-saturate":[{"backdrop-saturate":[_]}],"backdrop-sepia":[{"backdrop-sepia":[N]}],"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",Kt]}],duration:[{duration:U()}],ease:[{ease:["linear","in","out","in-out",Kt]}],delay:[{delay:U()}],animate:[{animate:["none","spin","ping","pulse","bounce",Kt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[j]}],"scale-x":[{"scale-x":[j]}],"scale-y":[{"scale-y":[j]}],rotate:[{rotate:[yS,Kt]}],"translate-x":[{"translate-x":[k]}],"translate-y":[{"translate-y":[k]}],"skew-x":[{"skew-x":[S]}],"skew-y":[{"skew-y":[S]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Kt]}],accent:[{accent:["auto",t]}],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",
vendor: 5,611 bytes, line 837
837Kt]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":M()}],"scroll-mx":[{"scroll-mx":M()}],"scroll-my":[{"scroll-my":M()}],"scroll-ms":[{"scroll-ms":M()}],"scroll-me":[{"scroll-me":M()}],"scroll-mt":[{"scroll-mt":M()}],"scroll-mr":[{"scroll-mr":M()}],"scroll-mb":[{"scroll-mb":M()}],"scroll-ml":[{"scroll-ml":M()}],"scroll-p":[{"scroll-p":M()}],"scroll-px":[{"scroll-px":M()}],"scroll-py":[{"scroll-py":M()}],"scroll-ps":[{"scroll-ps":M()}],"scroll-pe":[{"scroll-pe":M()}],"scroll-pt":[{"scroll-pt":M()}],"scroll-pr":[{"scroll-pr":M()}],"scroll-pb":[{"scroll-pb":M()}],"scroll-pl":[{"scroll-pl":M()}],"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",Kt]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[kh,Np,E$]}],stroke:[{stroke:[t,"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"]}}},uze=H5e(cze);function Fe(...t){return uze(mn(t))}const dze=w$e,Xfe=b.forwardRef(({className:t,...e},n)=>a.jsx(wfe,{ref:n,className:Fe("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]",t),...e}));Xfe.displayName=wfe.displayName;const hze=e2("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"}}),Jfe=b.forwardRef(({className:t,variant:e,...n},r)=>a.jsx(_fe,{ref:r,className:Fe(hze({variant:e}),t),...n}));Jfe.displayName=_fe.displayName;const fze=b.forwardRef(({className:t,...e},n)=>a.jsx(Nfe,{ref:n,className:Fe("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",t),...e}));fze.displayName=Nfe.displayName;const Qfe=b.forwardRef(({className:t,...e},n)=>a.jsx(Cfe,{ref:n,className:Fe("absolute right-2 top-2 rounded-md p-1 text-foreground
vendor: 4,208 bytes, line 837
837/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",t),"toast-close":"",...e,children:a.jsx(ks,{className:"h-4 w-4"})}));Qfe.displayName=Cfe.displayName;const Zfe=b.forwardRef(({className:t,...e},n)=>a.jsx(jfe,{ref:n,className:Fe("text-sm font-semibold",t),...e}));Zfe.displayName=jfe.displayName;const epe=b.forwardRef(({className:t,...e},n)=>a.jsx(Sfe,{ref:n,className:Fe("text-sm opacity-90",t),...e}));epe.displayName=Sfe.displayName;function pze(){const{toasts:t}=QE();return a.jsxs(dze,{children:[t.map(function({id:e,title:n,description:r,action:s,...i}){return a.jsxs(Jfe,{...i,children:[a.jsxs("div",{className:"grid gap-1",children:[n&&a.jsx(Zfe,{children:n}),r&&a.jsx(epe,{children:r})]}),s,a.jsx(Qfe,{})]},e)}),a.jsx(Xfe,{})]})}var mze=kL[" useId ".trim().toString()]||(()=>{}),gze=0;function Ml(t){const[e,n]=b.useState(mze());return ys(()=>{n(r=>r??String(gze++))},[t]),e?`radix-${e}`:""}const vze=["top","right","bottom","left"],Dg=Math.min,_l=Math.max,OO=Math.round,WT=Math.floor,Qd=t=>({x:t,y:t}),xze={left:"right",right:"left",bottom:"top",top:"bottom"},yze={start:"end",end:"start"};function Q6(t,e,n){return _l(t,Dg(e,n))}function Qf(t,e){return typeof t=="function"?t(e):t}function Zf(t){return t.split("-")[0]}function Tj(t){return t.split("-")[1]}function DW(t){return t==="x"?"y":"x"}function LW(t){return t==="y"?"height":"width"}const bze=new Set(["top","bottom"]);function Vd(t){return bze.has(Zf(t))?"y":"x"}function FW(t){return DW(Vd(t))}function wze(t,e,n){n===void 0&&(n=!1);const r=Tj(t),s=FW(t),i=LW(s);let o=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(o=IO(o)),[o,IO(o)]}function _ze(t){const e=IO(t);return[Z6(t),e,Z6(e)]}function Z6(t){return t.replace(/start|end/g,e=>yze[e])}const KQ=["left","right"],GQ=["right","left"],jze=["top","bottom"],Sze=["bottom","top"];function Nze(t,e,n){switch(t){case"top":case"bottom":return n?e?GQ:KQ:e?KQ:GQ;case"left":case"right":return e?jze:Sze;default:return[]}}function Cze(t,e,n,r){const s=Tj(t);let i=Nze(Zf(t),n==="start",r);return s&&(i=i.map(o=>o+"-"+s),e&&(i=i.concat(i.map(Z6)))),i}function IO(t){return t.replace(/left|right|bottom|top/g,e=>xze[e])}function kze(t){return{top:0,right:0,bottom:0,left:0,...t}}function tpe(t){return typeof t!="number"?kze(t):{top:t,right:t,bottom:t,left:t}}function DO(t){const{x:e,y:n,width:r,height:s}=t;return{width:r,height:s,top:n,left:e,right:e+r,bottom:n+s,x:e,y:n}}function YQ(t,e,n){let{reference:r,floating:s}=t;const i=Vd(e),o=FW(e),l=LW(o),c=Zf(e),u=i==="y",d=r.x+r.width/2-s.width/2,h=r.y+r.height/2-s.height/2,f=r[l]/2-s[l]/2;let p;switch(c){case"top":p={x:d,y:r.y-s.height};break;case"bottom":p={x:d,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:h};break;case"left":p={x:r.x-s.width,y:h};break;default:p={x:r.x,y:r.y}}switch(Tj(e)){case"start":p[o]-=f*(n&&u?-1:1);break;case"end":p[o]+=f*(n&&u?-1:1);break}return p}const Aze=async(t,e,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:o}=n,l=i.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(e));let u=await o.getElementRects({reference:t,floating:e,strategy:s}),{x:d,y:h}=YQ(u,r,c),f=r,p={},m=0;for(let v=0;v<l.length;v++){const{name:x,fn:g}=l[v],{x:w,y:_,data:j,reset:N}=await g({x:d,y:h,initialPlacement:r,placement:f,strategy:s,middlewareData:p,rects:u,platform:o,elements:{reference:t,floating:e}});d=w??d,h=_??h,p={...p,[x]:{...p[x],...j}},N&&m<=50&&(m++,typeof N=="object"&&(N.placement&&(f=N.placement),N.rects&&(u=N.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:s}):N.rects),{x:d,y:h}=YQ(u,f,c)),v=-1)}return{x:d,y:h,placement:f,strategy:s,middlewareData:p}};async function fk(t,e){var n;e===void 0&&(e={});const{x:r,y:s,platform:i,rects:o,elements:l,strategy:c}=t,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:f=!1,padding:p=0}=Qf(e,t),m=tpe(p),x=l[f?h==="floating"?"reference":"floating":h],g=DO(
837await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(x)))==null||n?x:x.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:u,rootBoundary:d,strategy:c})),w=h==="floating"?{x:r,y:s,width:o.floating.width,height:o.floating.height}:o.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),j=await(i.isElement==null?void 0:i.isElement(_))?await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1}:{x:1,y:1},N=DO(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:w,offsetParent:_,strategy:c}):w);return{top:(g.top-N.top+m.top)/j.y,bottom:(N.bottom-g.bottom+m.bottom)/j.y,left:(g.left-N.left+m.left)/j.x,right:(N.right-g.right+m.right)/j.x}}const Eze=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:s,rects:i,platform:o,elements:l,middlewareData:c}=e,{element:u,padding:d=0}=Qf(t,e)||{};if(u==null)return{};const h=tpe(d),f={x:n,y:r},p=FW(s),m=LW(p),v=await o.getDimensions(u),x=p==="y",g=x?"top":"left",w=x?"bottom":"right",_=x?"clientHeight":"clientWidth",j=i.reference[m]+i.reference[p]-f[p]-i.floating[m],N=f[p]-i.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let C=S?S[_]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=l.floating[_]||i.floating[m]);const k=j/2-N/2,E=C/2-v[m]/2-1,P=Dg(h[g],E),T=Dg(h[w],E),M=P,R=C-v[m]-T,A=C/2-v[m]/2+k,I=Q6(M,A,R),D=!c.arrow&&Tj(s)!=null&&A!==I&&i.reference[m]/2-(A<M?P:T)-v[m]/2<0,O=D?A<M?A-M:A-R:0;return{[p]:f[p]+O,data:{[p]:I,centerOffset:A-I-O,...D&&{alignmentOffset:O}},reset:D}}}),Tze=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:s,middlewareData:i,rects:o,initialPlacement:l,platform:c,elements:u}=e,{mainAxis:d=!0,crossAxis:h=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:v=!0,...x}=Qf(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const g=Zf(s),w=Vd(l),_=Zf(l)===l,j=await(c.isRTL==null?void 0:c.isRTL(u.floating)),N=f||(_||!v?[IO(l)]:_ze(l)),S=m!=="none";!f&&S&&N.push(...Cze(l,v,m,j));const C=[l,...N],k=await fk(e,x),E=[];let P=((r=i.flip)==null?void 0:r.overflows)||[];if(d&&E.push(k[g]),h){const A=wze(s,o,j);E.push(k[A[0]],k[A[1]])}if(P=[...P,{placement:s,overflows:E}],!E.every(A=>A<=0)){var T,M;const A=(((T=i.flip)==null?void 0:T.index)||0)+1,I=C[A];if(I&&(!(h==="alignment"?w!==Vd(I):!1)||P.every(z=>z.overflows[0]>0&&Vd(z.placement)===w)))return{data:{index:A,overflows:P},reset:{placement:I}};let D=(M=P.filter(O=>O.overflows[0]<=0).sort((O,z)=>O.overflows[1]-z.overflows[1])[0])==null?void 0:M.placement;if(!D)switch(p){case"bestFit":{var R;const O=(R=P.filter(z=>{if(S){const B=Vd(z.placement);return B===w||B==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(B=>B>0).reduce((B,G)=>B+G,0)]).sort((z,B)=>z[1]-B[1])[0])==null?void 0:R[0];O&&(D=O);break}case"initialPlacement":D=l;break}if(s!==D)return{reset:{placement:D}}}return{}}}};function XQ(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function JQ(t){return vze.some(e=>t[e]>=0)}const Pze=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:r="referenceHidden",...s}=Qf(t,e);switch(r){case"referenceHidden":{const i=await fk(e,{...s,elementContext:"reference"}),o=XQ(i,n.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:JQ(o)}}}case"escaped":{const i=await fk(e,{...s,altBoundary:!0}),o=XQ(i,n.floating);return{data:{escapedOffsets:o,escaped:JQ(o)}}}default:return{}}}}},npe=new Set(["left","top"]);async function Mze(t,e){const{placement:n,platform:r,elements:s}=t,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),o=Zf(n),l=Tj(n),c=Vd(n)==="y",u=npe.has(o)?-1:1,d=i&&c?-1:1,h=Qf(e,t);let{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return l&&typeof m=="number"&&(p=l==="end"?m*-1:m),c?{x:p*d,y:f*u}:{x:f*u,y:p*d}}const Rze=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:s,y:i,placement:o,middlewareData:l}=e,c=await Mze(e,t);return o===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:s+c.x,y:i+c.y,data:{...c,placement:o}}}}},Oze=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:s}=e,{mainAxis:i=!0,crossAxis:o=!1,limiter:l={fn:x=>{let{x:g,y:w}=x;return{x:g,y:w}}},...c}=Qf(t,e),u={x:n,y:r},d=await fk(e,c),h=Vd(Zf(s)),f=DW(h);let p=u[f],m=u[h];if(i){const x=f==="y"?"top":"left",g=f==="y"?"bottom":"right",w=p+d[x],_=p-d[g];p=Q6(w,p,_)}if(o){const x=h==="y"?"top":"left",g=h==="y"?"bottom":"right",w=m+d[x],_=m-d[g];m=Q6(w,m,_)}const v=l.fn({...e,[f]:p,[h]:m});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[f]:i,[h]:o}}}}}},Ize=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:s,rects:i,middlewareData:o}=e,{offset:l=0,mainAxis:c=!0,crossAxis:u=!0}=Qf(t,e),d={x:n,y:r},h=Vd(s),f=DW(h);let p=d[f],m=d[h];const v=Qf(l,e),x=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(c){const _=f==="y"?"height":"width",j=i.reference[f]-i.floating[_]+x.mainAxis,N=i.reference[f]+i.reference[_]-x.mainAxis;p<j?p=j:p>N&&(p=N)}if(u){var g,w;const _=f==="y"?"width":"height",j=npe.has(Zf(s)),N=i.reference[h]-i.floating[_]+(j&&((g=o.offset)==null?void 0:g[h])||0)+(j?0:x.crossAxis),S=i.reference[h]+i.reference[_]+(j?0:((w=o.offset)==null?void 0:w[h])||0)-(j?x.crossAxis:0);m<N?m=N:m>S&&(m=S)}return{[f]:p,[h]:m}}}},Dze=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:s,rects:i,platform:o,elements:l}=e,{apply:c=()=>{},...u}=Qf(t,e),d=await fk(e,u),h=Zf(s),f=Tj(s),p=Vd(s)==="y",{width:m,height:v}=i.floating;let x,g;h==="top"||h==="bottom"?(x=h,g=f===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(g=h,x=f==="end"?"top":"bottom");const w=v-d.top-d.bottom,_=m-d.left-d.right,j=Dg(v-d[x],w),N=Dg(m-d[g],_),S=!e.middlewareData.shift;let C=j,k=N;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(k=_),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(C=w),S&&!f){const P=_l(d.left,0),T=_l(d.right,0),M=_l
837(d.top,0),R=_l(d.bottom,0);p?k=m-2*(P!==0||T!==0?P+T:_l(d.left,d.right)):C=v-2*(M!==0||R!==0?M+R:_l(d.top,d.bottom))}await c({...e,availableWidth:k,availableHeight:C});const E=await o.getDimensions(l.floating);return m!==E.width||v!==E.height?{reset:{rects:!0}}:{}}}};function r3(){return typeof window<"u"}function Pj(t){return rpe(t)?(t.nodeName||"").toLowerCase():"#document"}function Rl(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function _h(t){var e;return(e=(rpe(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function rpe(t){return r3()?t instanceof Node||t instanceof Rl(t).Node:!1}function Ou(t){return r3()?t instanceof Element||t instanceof Rl(t).Element:!1}function ih(t){return r3()?t instanceof HTMLElement||t instanceof Rl(t).HTMLElement:!1}function QQ(t){return!r3()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Rl(t).ShadowRoot}const Lze=new Set(["inline","contents"]);function r2(t){const{overflow:e,overflowX:n,overflowY:r,display:s}=Iu(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!Lze.has(s)}const Fze=new Set(["table","td","th"]);function $ze(t){return Fze.has(Pj(t))}const zze=[":popover-open",":modal"];function s3(t){return zze.some(e=>{try{return t.matches(e)}catch{return!1}})}const Bze=["transform","translate","scale","rotate","perspective"],Uze=["transform","translate","scale","rotate","perspective","filter"],qze=["paint","layout","strict","content"];function $W(t){const e=zW(),n=Ou(t)?Iu(t):t;return Bze.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||Uze.some(r=>(n.willChange||"").includes(r))||qze.some(r=>(n.contain||"").includes(r))}function Vze(t){let e=Lg(t);for(;ih(e)&&!$_(e);){if($W(e))return e;if(s3(e))return null;e=Lg(e)}return null}function zW(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Hze=new Set(["html","body","#document"]);function $_(t){return Hze.has(Pj(t))}function Iu(t){return Rl(t).getComputedStyle(t)}function i3(t){return Ou(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Lg(t){if(Pj(t)==="html")return t;const e=t.assignedSlot||t.parentNode||QQ(t)&&t.host||_h(t);return QQ(e)?e.host:e}function spe(t){const e=Lg(t);return $_(e)?t.ownerDocument?t.ownerDocument.body:t.body:ih(e)&&r2(e)?e:spe(e)}function pk(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const s=spe(t),i=s===((r=t.ownerDocument)==null?void 0:r.body),o=Rl(s);if(i){const l=e8(o);return e.concat(o,o.visualViewport||[],r2(s)?s:[],l&&n?pk(l):[])}return e.concat(s,pk(s,[],n))}function e8(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function ipe(t){const e=Iu(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const s=ih(t),i=s?t.offsetWidth:n,o=s?t.offsetHeight:r,l=OO(n)!==i||OO(r)!==o;return l&&(n=i,r=o),{width:n,height:r,$:l}}function BW(t){return Ou(t)?t:t.contextElement}function Rw(t){const e=BW(t);if(!ih(e))return Qd(1);const n=e.getBoundingClientRect(),{width:r,height:s,$:i}=ipe(e);let o=(i?OO(n.width):n.width)/r,l=(i?OO(n.height):n.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const Wze=Qd(0);function ape(t){const e=Rl(t);
837return!zW()||!e.visualViewport?Wze:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Kze(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Rl(t)?!1:e}function e0(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const s=t.getBoundingClientRect(),i=BW(t);let o=Qd(1);e&&(r?Ou(r)&&(o=Rw(r)):o=Rw(t));const l=Kze(i,n,r)?ape(i):Qd(0);let c=(s.left+l.x)/o.x,u=(s.top+l.y)/o.y,d=s.width/o.x,h=s.height/o.y;if(i){const f=Rl(i),p=r&&Ou(r)?Rl(r):r;let m=f,v=e8(m);for(;v&&r&&p!==m;){const x=Rw(v),g=v.getBoundingClientRect(),w=Iu(v),_=g.left+(v.clientLeft+parseFloat(w.paddingLeft))*x.x,j=g.top+(v.clientTop+parseFloat(w.paddingTop))*x.y;c*=x.x,u*=x.y,d*=x.x,h*=x.y,c+=_,u+=j,m=Rl(v),v=e8(m)}}return DO({width:d,height:h,x:c,y:u})}function UW(t,e){const n=i3(t).scrollLeft;return e?e.left+n:e0(_h(t)).left+n}function ope(t,e,n){n===void 0&&(n=!1);const r=t.getBoundingClientRect(),s=r.left+e.scrollLeft-(n?0:UW(t,r)),i=r.top+e.scrollTop;return{x:s,y:i}}function Gze(t){let{elements:e,rect:n,offsetParent:r,strategy:s}=t;const i=s==="fixed",o=_h(r),l=e?s3(e.floating):!1;if(r===o||l&&i)return n;let c={scrollLeft:0,scrollTop:0},u=Qd(1);const d=Qd(0),h=ih(r);if((h||!h&&!i)&&((Pj(r)!=="body"||r2(o))&&(c=i3(r)),ih(r))){const p=e0(r);u=Rw(r),d.x=p.x+r.clientLeft,d.y=p.y+r.clientTop}const f=o&&!h&&!i?ope(o,c,!0):Qd(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+d.x+f.x,y:n.y*u.y-c.scrollTop*u.y+d.y+f.y}}function Yze(t){return Array.from(t.getClientRects())}function Xze(t){const e=_h(t),n=i3(t),r=t.ownerDocument.body,s=_l(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),i=_l(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+UW(t);const l=-n.scrollTop;return Iu(r).direction==="rtl"&&(o+=_l(e.clientWidth,r.clientWidth)-s),{width:s,height:i,x:o,y:l}}function Jze(t,e){const n=Rl(t),r=_h(t),s=n.visualViewport;let i=r.clientWidth,o=r.clientHeight,l=0,c=0;if(s){i=s.width,o=s.height;const u=zW();(!u||u&&e==="fixed")&&(l=s.offsetLeft,c=s.offsetTop)}return{width:i,height:o,x:l,y:c}}const Qze=new Set(["absolute","fixed"]);function Zze(t,e){const n=e0(t,!0,e==="fixed"),r=n.top+t.clientTop,s=n.left+t.clientLeft,i=ih(t)?Rw(t):Qd(1),o=t.clientWidth*i.x,l=t.clientHeight*i.y,c=s*i.x,u=r*i.y;return{width:o,height:l,x:c,y:u}}function ZQ(t,e,n){let r;if(e==="viewport")r=Jze(t,n);else if(e==="document")r=Xze(_h(t));else if(Ou(e))r=Zze(e,n);else{const s=ape(t);r={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return DO(r)}function lpe(t,e){const n=Lg(t);return n===e||!Ou(n)||$_(n)?!1:Iu(n).position==="fixed"||lpe(n,e)}function eBe(t,e){const n=e.get(t);if(n)return n;let r=pk(t,[],!1).filter(l=>Ou(l)&&Pj(l)!=="body"),s=null;const i=Iu(t).position==="fixed";let o=i?Lg(t):t;for(;Ou(o)&&!$_(o);){const l=Iu(o),c=$W(o);!c&&l.position==="fixed"&&(s=null),(i?!c&&!s:!c&&l.position==="static"&&!!s&&Qze.has(s.position)||r2(o)&&!c&&lpe(t,o))?r=r.filter(d=>d!==o):s=l,o=Lg(o)}return e.set(t,r),r}function tBe(t){let{element:e,boundary:n,rootBoundary:r,strategy:s}=t;const o=[...n==="clippingAncestors"?s3(e)?[]:eBe(e,this._c):[].concat(n),r],l=o[0],c=o.reduce((u,d)=>{const h=ZQ(e,d,s);return u.top=_l(h.top,u.top),u.right=Dg(h.right,u.right),u.bottom=Dg(h.bottom,u.bottom),u.left=_l(h.left,u.left),u},ZQ(e,l,s));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function nBe(t){const{width:e,height:n}=ipe(t);return{width:e,height:n}}function rBe(t,e,n){const r=ih(e),s=_h(e),i=n==="fixed",o=e0(t,!0,i,e);let l={scrollLeft:0,scrollTop:0};const c=Qd(0);function u(){c.x=UW(s)}if(r||!r&&!i)if((Pj(e)!=="body"||r2(s))&&(l=i3(e)),r){const p=e0(e,!0,i,e);c.x=p.x+e.clientLeft,c.y=p.y+e.clientTop}else s&&u();i&&!r&&s&&u();const d=s&&!r&&!i?ope(s,l):Qd(0),h=o.left+l.scrollLeft-c.x-d.x,f=o.top+l.scrollTop-c.y-d.y;return{x:h,y:f,width:o.width,height:o.height}}function T$(t){return Iu(t).position==="static"}function eZ(t,e){if(!ih(t)||Iu(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return _h(t)===n&&(n=n.ownerDocument.body),n}function cpe(t,e){const n=Rl(t);if(s3(t))return n;if(!ih(t)){let s=Lg(t);for(;s&&!$_(s);){if(Ou(s)&&!T$(s))return s;s=Lg(s)}return n}let r=eZ(t,e);for(;r&&$ze(r)&&T$(r);)r=eZ(r,e);return r&&$_(r)&&T$(r)&&!$W(r)?n:r||Vze(t)||n}const sBe=async function(t){const e=this.getOffsetParent||cpe,n=this.getDimensions,r=await n(t.floating);return{reference:rBe(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function iBe(t){return Iu(t).direction==="rtl"}const aBe={convertOffsetParentRelativeRectToViewportRelativeRect:Gze,getDocumentElement:_h,getClippingRect:tBe,getOffsetParent:cpe,getElementRects:sBe,getClientRects:Yze,getDimensions:nBe,getScale:Rw,isElement:Ou,isRTL:iBe};function upe(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function oBe(t,e){let n=null,r;const s=_h(t);function i(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function o(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),i();const u=t.getBoundingClientRect(),{left:d,top:h,width:f,height:p}=u;if(l||e(),!f||!p)return;const m=WT(h),v=WT(s.clientWidth-(d+f)),x=WT(s.clientHeight-(h+p)),g=WT(d),_={rootMargin:-m+"px "+-v+"px "+-x+"px "+-g+"px",threshold:_l(0,Dg(1,c))||1};let j=!0;function N(S){const C=S[0].intersectionRatio;if(C!==c){if(!j)return o();C?o(!1,C):r=setTimeout(()=>{o(!1,1e-7)},1e3)}C===1&&!upe(u,t.getBoundingClientRect())&&o(),j=!1}try{n=new IntersectionObserver(N,{..._,root:s.ownerDocument})}catch{n=new IntersectionObserver(N,_)}n.observe(t)}return o(!0),i}function lBe(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=BW(t),d=s||i?[...u?pk(u):[],...pk(e)]:[];d.forEach(g=>{s&&g.addEventListener("scroll",n,{passive:!0}),i&&g.addEventListener("resize",n)});const h=u&&l?oBe(u,n):null;let f=-1,p=null;o&&(p=new ResizeObserver(g=>{let[w]=g;w&&w.target===u&&p&&(p.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var _;(_=p)==null||_.observe(e)})),n()}),u&&!c&&p.observe(u),p.observe(e));let m,v=c?e0(t):null;c&&x();function x(){const g=e0(t);v&&!upe(v,g)&&n(),v=g,m=requestAnimationFrame(x)}return n(),()=>{var g;d.forEach(w=>{s&&w.removeEventListener("scroll",n),i&&w.removeEventListener("resize",n)}),h==null||h(),(g=p)==null||g.disconnect(),p=null,c&&cancelAnimationFrame(m)}}const cBe=Rze,uBe=Oze,dBe=Tze,hBe=Dze,fBe=Pze,tZ=Eze,pBe=Ize,mBe=(t,e,n)=>{const r=new Map,s={platform:aBe,...n},i={...s.platform,_c:r};return Aze(t,e,{...s,platform:i})};var gBe=typeof document<"u",vBe=function(){},OM=gBe?b.useLayoutEffect:vBe;function LO(t,e){if(t===e)return!0;
vendor: 3,168 bytes, line 837
837if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,s;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!LO(t[r],e[r]))return!1;return!0}if(s=Object.keys(t),n=s.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,s[r]))return!1;for(r=n;r--!==0;){const i=s[r];if(!(i==="_owner"&&t.$$typeof)&&!LO(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function dpe(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function nZ(t,e){const n=dpe(t);return Math.round(e*n)/n}function P$(t){const e=b.useRef(t);return OM(()=>{e.current=t}),e}function xBe(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:i,floating:o}={},transform:l=!0,whileElementsMounted:c,open:u}=t,[d,h]=b.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[f,p]=b.useState(r);LO(f,r)||p(r);const[m,v]=b.useState(null),[x,g]=b.useState(null),w=b.useCallback(z=>{z!==S.current&&(S.current=z,v(z))},[]),_=b.useCallback(z=>{z!==C.current&&(C.current=z,g(z))},[]),j=i||m,N=o||x,S=b.useRef(null),C=b.useRef(null),k=b.useRef(d),E=c!=null,P=P$(c),T=P$(s),M=P$(u),R=b.useCallback(()=>{if(!S.current||!C.current)return;const z={placement:e,strategy:n,middleware:f};T.current&&(z.platform=T.current),mBe(S.current,C.current,z).then(B=>{const G={...B,isPositioned:M.current!==!1};A.current&&!LO(k.current,G)&&(k.current=G,Lc.flushSync(()=>{h(G)}))})},[f,e,n,T,M]);OM(()=>{u===!1&&k.current.isPositioned&&(k.current.isPositioned=!1,h(z=>({...z,isPositioned:!1})))},[u]);const A=b.useRef(!1);OM(()=>(A.current=!0,()=>{A.current=!1}),[]),OM(()=>{if(j&&(S.current=j),N&&(C.current=N),j&&N){if(P.current)return P.current(j,N,R);R()}},[j,N,R,P,E]);const I=b.useMemo(()=>({reference:S,floating:C,setReference:w,setFloating:_}),[w,_]),D=b.useMemo(()=>({reference:j,floating:N}),[j,N]),O=b.useMemo(()=>{const z={position:n,left:0,top:0};if(!D.floating)return z;const B=nZ(D.floating,d.x),G=nZ(D.floating,d.y);return l?{...z,transform:"translate("+B+"px, "+G+"px)",...dpe(D.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:B,top:G}},[n,l,D.floating,d.x,d.y]);return b.useMemo(()=>({...d,update:R,refs:I,elements:D,floatingStyles:O}),[d,R,I,D,O])}const yBe=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:s}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?tZ({element:r.current,padding:s}).fn(n):{}:r?tZ({element:r,padding:s}).fn(n):{}}}},bBe=(t,e)=>({...cBe(t),options:[t,e]}),wBe=(t,e)=>({...uBe(t),options:[t,e]}),_Be=(t,e)=>({...pBe(t),options:[t,e]}),jBe=(t,e)=>({...dBe(t),options:[t,e]}),SBe=(t,e)=>({...hBe(t),options:[t,e]}),NBe=(t,e)=>({...fBe(t),options:[t,e]}),CBe=(t,e)=>({...yBe(t),options:[t,e]});var kBe="Arrow",hpe=b.forwardRef((t,e)=>{const{children:n,width:r=10,height:s=5,...i}=t;return a.jsx(et.svg,{...i,ref:e,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:a.jsx("polygon",{points:"0,0 30,0 15,10"})})});
837hpe.displayName=kBe;var ABe=hpe;function a3(t){const[e,n]=b.useState(void 0);return ys(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const i=s[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=t.offsetWidth,l=t.offsetHeight;n({width:o,height:l})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var qW="Popper",[fpe,ev]=Ys(qW),[EBe,ppe]=fpe(qW),mpe=t=>{const{__scopePopper:e,children:n}=t,[r,s]=b.useState(null);return a.jsx(EBe,{scope:e,anchor:r,onAnchorChange:s,children:n})};mpe.displayName=qW;var gpe="PopperAnchor",vpe=b.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...s}=t,i=ppe(gpe,n),o=b.useRef(null),l=$t(e,o);return b.useEffect(()=>{i.onAnchorChange((r==null?void 0:r.current)||o.current)}),r?null:a.jsx(et.div,{...s,ref:l})});vpe.displayName=gpe;var VW="PopperContent",[TBe,PBe]=fpe(VW),xpe=b.forwardRef((t,e)=>{var oe,ye,le,me,he,ae;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:i="center",alignOffset:o=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:h="partial",hideWhenDetached:f=!1,updatePositionStrategy:p="optimized",onPlaced:m,...v}=t,x=ppe(VW,n),[g,w]=b.useState(null),_=$t(e,re=>w(re)),[j,N]=b.useState(null),S=a3(j),C=(S==null?void 0:S.width)??0,k=(S==null?void 0:S.height)??0,E=r+(i!=="center"?"-"+i:""),P=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},T=Array.isArray(u)?u:[u],M=T.length>0,R={padding:P,boundary:T.filter(RBe),altBoundary:M},{refs:A,floatingStyles:I,placement:D,isPositioned:O,middlewareData:z}=xBe({strategy:"fixed",placement:E,whileElementsMounted:(...re)=>lBe(...re,{animationFrame:p==="always"}),elements:{reference:x.anchor},middleware:[bBe({mainAxis:s+k,alignmentAxis:o}),c&&wBe({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?_Be():void 0,...R}),c&&jBe({...R}),SBe({...R,apply:({elements:re,rects:L,availableWidth:X,availableHeight:ne})=>{const{width:Y,height:J}=L.reference,se=re.floating.style;se.setProperty("--radix-popper-available-width",`${X}px`),se.setProperty("--radix-popper-available-height",`${ne}px`),se.setProperty("--radix-popper-anchor-width",`${Y}px`),se.setProperty("--radix-popper-anchor-height",`${J}px`)}}),j&&CBe({element:j,padding:l}),OBe({arrowWidth:C,arrowHeight:k}),f&&NBe({strategy:"referenceHidden",...R})]}),[B,G]=wpe(D),U=ho(m);ys(()=>{O&&(U==null||U())},[O,U]);const F=(oe=z.arrow)==null?void 0:oe.x,W=(ye=z.arrow)==null?void 0:ye.y,Q=((le=z.arrow)==null?void 0:le.centerOffset)!==0,[K,fe]=b.useState();return ys(()=>{g&&fe(window.getComputedStyle(g).zIndex)},[g]),a.jsx("div",{ref:A.setFloating,"data-radix-popper-content-wrapper":"",style:{...I,transform:O?I.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:K,"--radix-popper-transform-origin":[(me=z.transformOrigin)==null?void 0:me.x,(he=z.transformOrigin)==null?void 0:he.y].join(" "),...((ae=z.hide)==null?void 0:ae.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:a.jsx(TBe,{scope:n,placedSide:B,onArrowChange:N,arrowX:F,arrowY:W,shouldHideArrow:Q,children:a.jsx(et.div,{"data-side":B,"data-align":G,...v,ref:_,style:{...v.style,animation:O?void 0:"none"}})})})});xpe.displayName=VW;var ype="PopperArrow",MBe={top:"bottom",right:"left",bottom:"top",left:"right"},bpe=b.forwardRef(function(e,n){const{__scopePopper:r,...s}=e,i=PBe(ype,r),o=MBe[i.placedSide];return a.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:a.jsx(ABe,{...s,ref:n,style:{...s.style,display:"block"}})})});bpe.displayName=ype;function RBe(t){return t!==null}var OBe=t=>({name:"transformOrigin",options:t,fn(e){var x,g,w;const{placement:n,rects:r,middlewareData:s}=e,o=((x=s.arrow)==null?void 0:x.centerOffset)!==0,l=o?0:t.arrowWidth,c=o?0:t.arrowHeight,[u,d]=wpe(n),h={start:"0%",center:"50%",end:"100%"}[d],f=(((g=s.arrow)==null?void 0:g.x)??0)+l/2,p=(((w=s.arrow)==null?void 0:w.y)??0)+c/2;let m="",v="";return u==="bottom"?(m=o?h:`${f}px`,v=`${-c}px`):u==="top"?(m=o?h:`${f}px`,v=`${r.floating.height+c}px`):u==="right"?(m=`${-c}px`,v=o?h:`${p}px`):u==="left"&&(m=`${r.floating.width+c}px`,v=o?h:`${p}px`),{data:{x:m,y:v}}}});function wpe(t){const[e,n="center"]=t.split("-");return[e,n]}var HW=mpe,s2=vpe,o3=xpe,l3=bpe,[c3,CLt]=Ys("Tooltip",[ev]),WW=ev(),_pe="TooltipProvider",IBe=700,rZ="tooltip.open",[DBe,jpe]=c3(_pe),Spe=t=>{const{__scopeTooltip:e,delayDuration:n=IBe,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:i}=t,o=b.useRef(!0),l=b.useRef(!1),c=b.useRef(0);return b.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),a.jsx(DBe,{scope:e,isOpenDelayedRef:o,delayDuration:n,onOpen:b.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:b.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>
837o.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:b.useCallback(u=>{l.current=u},[]),disableHoverableContent:s,children:i})};Spe.displayName=_pe;var Npe="Tooltip",[kLt,u3]=c3(Npe),t8="TooltipTrigger",LBe=b.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=u3(t8,n),i=jpe(t8,n),o=WW(n),l=b.useRef(null),c=$t(e,l,s.onTriggerChange),u=b.useRef(!1),d=b.useRef(!1),h=b.useCallback(()=>u.current=!1,[]);return b.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),a.jsx(s2,{asChild:!0,...o,children:a.jsx(et.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:c,onPointerMove:ze(t.onPointerMove,f=>{f.pointerType!=="touch"&&!d.current&&!i.isPointerInTransitRef.current&&(s.onTriggerEnter(),d.current=!0)}),onPointerLeave:ze(t.onPointerLeave,()=>{s.onTriggerLeave(),d.current=!1}),onPointerDown:ze(t.onPointerDown,()=>{s.open&&s.onClose(),u.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:ze(t.onFocus,()=>{u.current||s.onOpen()}),onBlur:ze(t.onBlur,s.onClose),onClick:ze(t.onClick,s.onClose)})})});LBe.displayName=t8;var FBe="TooltipPortal",[ALt,$Be]=c3(FBe,{forceMount:void 0}),z_="TooltipContent",Cpe=b.forwardRef((t,e)=>{const n=$Be(z_,t.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...i}=t,o=u3(z_,t.__scopeTooltip);return a.jsx(yo,{present:r||o.open,children:o.disableHoverableContent?a.jsx(kpe,{side:s,...i,ref:e}):a.jsx(zBe,{side:s,...i,ref:e})})}),zBe=b.forwardRef((t,e)=>{const n=u3(z_,t.__scopeTooltip),r=jpe(z_,t.__scopeTooltip),s=b.useRef(null),i=$t(e,s),[o,l]=b.useState(null),{trigger:c,onClose:u}=n,d=s.current,{onPointerInTransitChange:h}=r,f=b.useCallback(()=>{l(null),h(!1)},[h]),p=b.useCallback((m,v)=>{const x=m.currentTarget,g={x:m.clientX,y:m.clientY},w=HBe(g,x.getBoundingClientRect()),_=WBe(g,w),j=KBe(v.getBoundingClientRect()),N=YBe([..._,...j]);l(N),h(!0)},[h]);return b.useEffect(()=>()=>f(),[f]),b.useEffect(()=>{if(c&&d){const m=x=>p(x,d),v=x=>p(x,c);return c.addEventListener("pointerleave",m),d.addEventListener("pointerleave",v),()=>{c.removeEventListener("pointerleave",m),d.removeEventListener("pointerleave",v)}}},[c,d,p,f]),b.useEffect(()=>{if(o){const m=v=>{const x=v.target,g={x:v.clientX,y:v.clientY},w=(c==null?void 0:c.contains(x))||(d==null?void 0:d.contains(x)),_=!GBe(g,o);w?f():_&&(f(),u())};return document.addEventListener("pointermove",m),()=>document.removeEventListener("pointermove",m)}},[c,d,o,u,f]),a.jsx(kpe,{...t,ref:i})}),[BBe,UBe]=c3(Npe,{isInside:!1}),qBe=rfe("TooltipContent"),kpe=b.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:i,onPointerDownOutside:o,...l}=t,c=u3(z_,n),u=WW(n),{onClose:d}=c;return b.useEffect(()=>(document.addEventListener(rZ,d),()=>document.removeEventListener(rZ,d)),[d]),b.useEffect(()=>{if(c.trigger){const h=f=>{const p=f.target;p!=null&&p.contains(c.trigger)&&d()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[c.trigger,d]),a.jsx(T0,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:h=>h.preventDefault(),onDismiss:d,children:a.jsxs(o3,{"data-state":c.stateAttribute,...u,...l,ref:e,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:[a.jsx(qBe,{children:r}),a.jsx(BBe,{scope:n,isInside:!0,children:a.jsx(r$e,{id:c.contentId,role:"tooltip",children:s||r})})]})})});Cpe.displayName=z_;var Ape="TooltipArrow",VBe=b.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=WW(n);return UBe(Ape,n).isInside?null:a.jsx(l3,{...s,...r,ref:e})});VBe.displayName=Ape;function HBe(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),s=Math.abs(e.right-t.x),i=Math.abs(e.left-t.x);switch(Math.min(n,r,s,i)){case i:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function WBe(t,e,n=5){const r=[];switch(e){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}function KBe(t){const{top:e,right:n,bottom:r,left:s}=t;return[{x:s,y:e},{x:n,y:e},{x:n,y:r},{x:s,y:r}]}function GBe(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,o=e.length-1;i<e.length;o=i++){const l=e[i],c=e[o],u=l.x,d=l.y,h=c.x,f=c.y;d>r!=f>r&&n<(h-u)*(r-d)/(f-d)+u&&(s=!s)}return s}function YBe(t){const e=t.slice();return e.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),XBe(e)}function XBe(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r<t.length;r++){const s=t[r];for(;e.length>=2;){const i=e[e.length-1],o=e[e.length-2];if((i.x-o.x)*(s.y-o.y)>=(i.y-o.y)*(s.x-o.x))e.pop();else break}e.push(s)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const s=t[r];for(;n.length>=2;){const i=n[n.length-1],o=n[n.length-2];if((i.x-o.x)*(s.y-o.y)>=(i.y-o.y)*(s.x-o.x))n.pop();else break}n.push(s)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var JBe=Spe,Epe=Cpe;const QBe=JBe,ZBe=b.forwardRef(({className:t,sideOffset:e=4,...n},r)=>
837a.jsx(Epe,{ref:r,sideOffset:e,className:Fe("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",t),...n}));ZBe.displayName=Epe.displayName;const Tpe=b.createContext(void 0),Ppe="esprit-sud-cart";function e6e(){try{const t=localStorage.getItem(Ppe);return t?JSON.parse(t):[]}catch{return[]}}function t6e({children:t}){const[e,n]=b.useState(e6e);b.useEffect(()=>{localStorage.setItem(Ppe,JSON.stringify(e))},[e]);const r=b.useCallback(u=>{n(d=>{var f;return d.find(p=>p.variant_id===u.variant_id)?(f=u.metadata)!=null&&f.selected_issues?d.map(p=>p.variant_id===u.variant_id?u:p):d.map(p=>p.variant_id===u.variant_id?{...p,quantity:p.quantity+u.quantity}:p):[...d,u]})},[]),s=b.useCallback(u=>{n(d=>d.filter(h=>h.variant_id!==u))},[]),i=b.useCallback((u,d)=>{if(d<=0){n(h=>h.filter(f=>f.variant_id!==u));return}n(h=>h.map(f=>f.variant_id===u?{...f,quantity:d}:f))},[]),o=b.useCallback(()=>n([]),[]),l=e.reduce((u,d)=>u+d.quantity,0),c=e.reduce((u,d)=>u+d.price*d.quantity,0);return a.jsx(Tpe.Provider,{value:{items:e,addItem:r,removeItem:s,updateQuantity:i,clearCart:o,itemCount:l,total:c},children:t})}function tv(){const t=b.useContext(Tpe);if(!t)throw new Error("useCart must be used within CartProvider");return t}const Mpe=b.createContext(void 0);function Ji(){const t=b.useContext(Mpe);if(!t)throw new Error("useAuth must be used within AuthProvider");return t}async function sZ(t){const{data:e,error:n}=await Z.from("profiles").select("*").eq("id",t).maybeSingle();if(n)throw n;return e}function n6e({children:t}){const[e,n]=b.useState(null),[r,s]=b.useState(null),[i,o]=b.useState(null),[l,c]=b.useState(!0);b.useEffect(()=>{const{data:{subscription:d}}=Z.auth.onAuthStateChange(async(h,f)=>{o(f),n((f==null?void 0:f.user)??null),f!=null&&f.user?(c(!0),setTimeout(async()=>{try{const p=await sZ(f.user.id);s(p)}catch(p){console.error("Unable to load authenticated profile",p),s(null)}finally{c(!1)}},0)):(s(null),c(!1))});return Z.auth.getSession().then(({data:{session:h}})=>{o(h),n((h==null?void 0:h.user)??null),h!=null&&h.user?sZ(h.user.id).then(s).catch(f=>{console.error("Unable to restore authenticated profile",f),s(null)}).finally(()=>c(!1)):c(!1)}),()=>d.unsubscribe()},[]);const u=b.useCallback(async()=>{await Z.auth.signOut(),n(null),s(null),o(null)},[]);return a.jsx(Mpe.Provider,{value:{user:e,profile:r,session:i,loading:l,signOut:u},children:t})}const Rpe=b.createContext({redirects:new Map,loaded:!1,refresh:async()=>{}});function r6e({children:t}){const[e,n]=b.useState(new Map),[r,s]=b.useState(!1),i=b.useCallback(async()=>{const{data:o,error:l}=await Z.from("custom_redirects").select("id, source_url, target_url, redirect_type, is_active").eq("is_active",!0);if(!l&&o){const c=new Map;for(const u of o)c.set(u.source_url,u);n(c)}s(!0)},[]);return b.useEffect(()=>{i();const o=setInterval(i,5*60*1e3),l=()=>i();return window.addEventListener("focus",l),()=>{clearInterval(o),window.removeEventListener("focus",l)}},[i]),a.jsx(Rpe.Provider,{value:{redirects:e,loaded:r,refresh:i},children:t})}const Ope=()=>b.useContext(Rpe);function KT({children:t,adminRoles:e}){const{user:n,profile:r,loading:s}=Ji(),i=xo();if(s)return a.jsx("div",{className:"flex min-h-[50vh] items-center justify-center text-muted-foreground",children:"Chargement..."});if(!n)return a.jsx(ms,{to:`/login?redirect=${encodeURIComponent(i.pathname)}`,replace:!0});if(e&&e.length>0){const o=r==null?void 0:r.role;if(!o||!e.includes(o))return a.jsxs("div",{className:"flex min-h-[50vh] flex-col items-center justify-center gap-4",children:[a.jsx("h1",{className:"text-2xl font-bold",children:"Accès refusé"}),a.jsx("p",{className:"text-muted-foreground",children:"Vous n'avez pas les permissions nécessaires."}),a.jsx("a",{href:"/",className:"text-primary hover:underline",children:"Retour à l'accueil"})]})}return a.jsx(a.Fragment,{children:t})}function s6e(){var x,g;if(typeof window>"u")return;const t=location.hostname,n=["lovableproject.com","lovableproject-dev.com","lovable.app","gpt-eng.com","gptengineer.run"].some(w=>t===w||t.endsWith("."+w)),r="[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}",s=n?((x=t.match(new RegExp("^(?:id-preview(?:-[a-z0-9]+)?|project)--("+r+")(?:-dev)?(?=\\.|$)","i")))==null?void 0:x[1])??((g=t.match(new RegExp("^("+r+")(?=[.-])","i")))==null?void 0:g[1]):void 0,i=window.parent&&window.parent!==window;if(!s||!i)return localStorage;const o=t.endsWith(".lovableproject-dev.com")||t.endsWith(".gpt-eng.com"),l=o?/^https:\/\/([a-z0-9-]+\.)*(lovable\.dev|gptengineer\.app)$|^http:\/\/localhost:3000$/:/^https:\/\/([a-z0-9-]+\.)*(lovable\.dev|gptengineer\.app)$/,c=location.ancestorOrigins&&location.ancestorOrigins[0]||(document.referrer?new URL(document.referrer).origin:""),u=c&&l.test(c)?[c]:o?["https://lovable.dev","http://localhost:3000"]:["https://lovable.dev"],d="lovable-preview-auth:result",h=2e3,f=()=>Math.random().toString(36).slice(2)+Date.now().toString(36),p=(w,_,j)=>new Promise(N=>{const S=f();let C=!1,k;const E=M=>{C||(C=!0,clearTimeout(k),window.removeEventListener("message",P),N(M))},P=M=>{if(u.indexOf(M.origin)<0)return;const R=M.data;R&&R.type===d&&R.requestId===S&&E(R)};window.addEventListener("message",P);const T={type:w,requestId:S,projectId:s,key:_};j!==void 0&&(T.value=j);for(const M of u)window.parent.postMessage(T,M);k=setTimeout(()=>E(null),h)});let m=!0;const v=250;return{getItem:async w=>{let _=await p("lovable-preview-auth:get",w);return!_&&m&&(await new Promise(j=>setTimeout(j,v)),_=await p("lovable-preview-auth:get",w)),m=!1,_&&_.ok&&typeof _.value=="string"?_.value===""?(localStorage.removeItem(w),null):_.value:localStorage.getItem(w)},setItem:(w,_)=>(localStorage.setItem(w,_),p("lovable-preview-auth:set",w,_).then(()=>{})),removeItem:w=>(localStorage.removeItem(w),p("lovable-preview-auth:remove",w).then(()=>{}))}}const i6e="https://aanjkhoyzcvhokzsmifu.supabase.co",a6e="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImFhbmpraG95emN2aG9renNtaWZ1Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzU0ODIxMTgsImV4cCI6MjA5MTA1ODExOH0.FZffw1trnRiA182HIsLL4uQALqBG6SHIIttPS-tq-Qo",Mt=Jhe(i6e,a6e,{auth:{storage:s6e(),persistSession:!0,autoRefreshToken:!0}}),o6e=e2("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 ke({className:t,variant:e,...n}){return a.jsx("div",{className:Fe(o6e({variant:e}),t),...n})}const M$={articles:[],guides:[],partners:[],events:[]},R$=new Map,iZ=t=>t?new Date(t).toLocaleDateString("fr-FR",{day:"numeric",month:"short",year:"numeric"}):"",l6e=({open:t,onClose:e})=>{const[n,r]=b.useState(""),[s,i]=b.useState(M$),[o,l]=b.useState(!1),c=b.useRef(null),u=b.useRef(null),d=b.useRef(null);if(b.useEffect(()=>{if(t){setTimeout(()=>{var v;return(v=c.current)==null?void 0:v.focus()},50);const m=v=>{v.key==="Escape"&&e()};return window.addEventListener("keydown",m),document.body.style.overflow="hidden",()=>{window.removeEventListener("keydown",m),document.body.style.overflow=""}}else r(""),i(M$)},[t,e]),b.useEffect(()=>{u.current&&window.clearTimeout(u.current),d.current&&d.current.abort();const m=n.trim();if(m.length<2){i(M$),l(!1);return}if(R$.has(m)){i(R$.get(m)),l(!1);return}return l(!0),u.current=window.setTimeout(async()=>{const v=new AbortController;d.current=v;const x=`%${m}%`;try{const[g,w,_,j]=await Promise.all([Mt.from("articles").select("title, slug, cover_image_url, excerpt, published_at").eq("status","published").or(`title.ilike.${x},excerpt.ilike.${x}`).limit(5).abortSignal(v.signal),Mt.from("travel_guides").select("city, slug, cover_image_url, excerpt").eq("is_active",!0).or(`city.ilike.${x},content.ilike.${x}
837`).limit(3).abortSignal(v.signal),Mt.from("partners").select("name, slug, city, category").eq("is_active",!0).or(`name.ilike.${x},city.ilike.${x}`).limit(3).abortSignal(v.signal),Mt.from("events").select("title, slug, city, date_start").eq("is_active",!0).or(`title.ilike.${x},city.ilike.${x}`).limit(3).abortSignal(v.signal)]);if(v.signal.aborted)return;const N={articles:g.data||[],guides:w.data||[],partners:_.data||[],events:j.data||[]};R$.set(m,N),i(N)}catch(g){v.signal.aborted||console.error(g)}finally{v.signal.aborted||l(!1)}},300),()=>{u.current&&window.clearTimeout(u.current)}},[n]),!t)return null;const h=()=>e(),f=s.articles.length+s.guides.length+s.partners.length+s.events.length,p=!o&&n.trim().length>=2&&f===0;return a.jsx("div",{className:"fixed inset-0 z-[100] bg-black/70 backdrop-blur-sm",onClick:e,children:a.jsx("div",{className:"container mx-auto max-w-3xl pt-16 md:pt-24",onClick:m=>m.stopPropagation(),children:a.jsxs("div",{className:"rounded-2xl bg-background shadow-2xl overflow-hidden",children:[a.jsxs("div",{className:"flex items-center gap-3 border-b border-border px-5 py-4",children:[a.jsx(is,{className:"h-5 w-5 text-muted-foreground shrink-0"}),a.jsx("input",{ref:c,value:n,onChange:m=>r(m.target.value),placeholder:"Rechercher un article, un guide, un partenaire...",className:"flex-1 bg-transparent text-base md:text-lg outline-none placeholder:text-muted-foreground"}),o&&a.jsx(Je,{className:"h-4 w-4 animate-spin text-muted-foreground"}),a.jsx("button",{onClick:e,className:"text-muted-foreground hover:text-foreground","aria-label":"Fermer",children:a.jsx(ks,{className:"h-5 w-5"})})]}),a.jsxs("div",{className:"max-h-[60vh] overflow-y-auto",children:[o&&f===0&&a.jsx("div",{className:"p-5 space-y-3",children:[...Array(3)].map((m,v)=>a.jsx("div",{className:"h-14 rounded-lg bg-muted animate-pulse"},v))}),p&&a.jsxs("div",{className:"p-8 text-center text-muted-foreground",children:['Aucun résultat pour "',n,'"']}),n.trim().length<2&&a.jsx("div",{className:"p-8 text-center text-sm text-muted-foreground",children:"Tapez au moins 2 caractères pour rechercher"}),f>0&&a.jsxs("div",{className:"divide-y divide-border",children:[s.articles.length>0&&a.jsx(GT,{title:"Articles",icon:dp,children:s.articles.map(m=>a.jsxs(_e,{to:`/actualites/${m.slug}`,onClick:h,className:"flex gap-3 p-3 hover:bg-muted rounded-lg transition",children:[m.cover_image_url&&a.jsx("img",{src:m.cover_image_url,alt:"",className:"h-14 w-14 rounded-md object-cover shrink-0"}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"font-medium line-clamp-1",children:m.title}),m.excerpt&&a.jsx("div",{className:"text-sm text-muted-foreground line-clamp-1",children:m.excerpt}),m.published_at&&a.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:iZ(m.published_at)})]})]},m.slug))}),s.guides.length>0&&a.jsx(GT,{title:"Destinations",icon:_r,children:s.guides.map(m=>a.jsxs(_e,{to:`/destinations/${m.slug}`,onClick:h,className:"flex gap-3 p-3 hover:bg-muted rounded-lg transition",children:[m.cover_image_url&&a.jsx("img",{src:m.cover_image_url,alt:"",className:"h-14 w-14 rounded-md object-cover shrink-0"}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"font-medium line-clamp-1",children:m.city}),m.excerpt&&a.jsx("div",{className:"text-sm text-muted-foreground line-clamp-1",children:m.excerpt})]})]},m.slug))}),s.partners.length>0&&a.jsx(GT,{title:"Partenaires",icon:R$e,children:s.partners.map(m=>a.jsxs(_e,{to:`/carnet-adresses/${m.slug}`,onClick:h,className:"flex items-center justify-between gap-3 p-3 hover:bg-muted rounded-lg transition",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"font-medium line-clamp-1",children:m.name}),m.city&&a.jsx("div",{className:"text-sm text-muted-foreground",children:m.city})]}),m.category&&a.jsx(ke,{variant:"secondary",className:"shrink-0",children:m.category})]},m.slug))}),s.events.length>0&&a.jsx(GT,{title:"Ãvénements",icon:Aj,children:s.events.map(m=>a.jsxs(_e,{to:`/evenements/${m.slug}`,onClick:h,className:"flex items-center justify-between gap-3 p-3 hover:bg-muted rounded-lg transition",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"font-medium line-clamp-1",children:m.title}),m.city&&a.jsx("div",{className:"text-sm text-muted-foreground",children:m.city})]}),m.date_start&&a.jsx("div",{className:"text-xs text-muted-foreground shrink-0",children:iZ(m.date_start)})]},m.slug))})]})]}),a.jsxs("div",{className:"hidden md:flex items-center justify-end gap-2 border-t border-border px-5 py-2 text-xs text-muted-foreground",children:[a.jsx("kbd",{className:"rounded border border-border bg-muted px-1.5 py-0.5",children:"Esc"})," pour fermer"]})]})})})},GT=({title:t,icon:e,children:n})=>a.jsxs("div",{className:"p-3",children:[a.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:[a.jsx(e,{className:"h-3.5 w-3.5"}),t]}),a.jsx("div",{className:"mt-1 space-y-0.5",children:n})]}
837),mk=e2("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"}}),H=b.forwardRef(({className:t,variant:e,size:n,asChild:r=!1,...s},i)=>{const o=r?OFe:"button";return a.jsx(o,{className:Fe(mk({variant:e,size:n,className:t})),ref:i,...s})});H.displayName="Button";var O$="focusScope.autoFocusOnMount",I$="focusScope.autoFocusOnUnmount",aZ={bubbles:!1,cancelable:!0},c6e="FocusScope",i2=b.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:i,...o}=t,[l,c]=b.useState(null),u=ho(s),d=ho(i),h=b.useRef(null),f=$t(e,v=>c(v)),p=b.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;b.useEffect(()=>{if(r){let v=function(_){if(p.paused||!l)return;const j=_.target;l.contains(j)?h.current=j:Dp(h.current,{select:!0})},x=function(_){if(p.paused||!l)return;const j=_.relatedTarget;j!==null&&(l.contains(j)||Dp(h.current,{select:!0}))},g=function(_){if(document.activeElement===document.body)for(const N of _)N.removedNodes.length>0&&Dp(l)};document.addEventListener("focusin",v),document.addEventListener("focusout",x);const w=new MutationObserver(g);return l&&w.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",x),w.disconnect()}}},[r,l,p.paused]),b.useEffect(()=>{if(l){lZ.add(p);const v=document.activeElement;if(!l.contains(v)){const g=new CustomEvent(O$,aZ);l.addEventListener(O$,u),l.dispatchEvent(g),g.defaultPrevented||(u6e(m6e(Ipe(l)),{select:!0}),document.activeElement===v&&Dp(l))}return()=>{l.removeEventListener(O$,u),setTimeout(()=>{const g=new CustomEvent(I$,aZ);l.addEventListener(I$,d),l.dispatchEvent(g),g.defaultPrevented||Dp(v??document.body,{select:!0}),l.removeEventListener(I$,d),lZ.remove(p)},0)}}},[l,u,d,p]);const m=b.useCallback(v=>{if(!n&&!r||p.paused)return;const x=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,g=document.activeElement;if(x&&g){const w=v.currentTarget,[_,j]=d6e(w);_&&j?!v.shiftKey&&g===j?(v.preventDefault(),n&&Dp(_,{select:!0})):v.shiftKey&&g===_&&(v.preventDefault(),n&&Dp(j,{select:!0})):g===w&&v.preventDefault()}},[n,r,p.paused]);return a.jsx(et.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});i2.displayName=c6e;function u6e(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(Dp(r,{select:e}),document.activeElement!==n)return}function d6e(t){const e=Ipe(t),n=oZ(e,t),r=oZ(e.reverse(),t);return[n,r]}function Ipe(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function oZ(t,e){for(const n of t)if(!h6e(n,{upTo:e}))return n}function h6e(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function f6e(t){return t instanceof HTMLInputElement&&"select"in t}function Dp(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&f6e(t)&&e&&t.select()}}var lZ=p6e();function p6e(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=cZ(t,e),t.unshift(e)},remove(e){var n;t=cZ(t,e),(n=t[0])==null||n.resume()}}}function cZ(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function m6e(t){return t.filter(e=>e.tagName!=="A")}var D$=0;function d3(){b.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??uZ()),document.body.insertAdjacentElement("beforeend",t[1]??uZ()),D$++,()=>{D$===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e
vendor: 5,884 bytes, lines 837-852
837=>e.remove()),D$--}},[])}function uZ(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var $d=function(){return $d=Object.assign||function(e){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},$d.apply(this,arguments)};function Dpe(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(n[r[s]]=t[r[s]]);return n}function g6e(t,e,n){if(n||arguments.length===2)for(var r=0,s=e.length,i;r<s;r++)(i||!(r in e))&&(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return t.concat(i||Array.prototype.slice.call(e))}var IM="right-scroll-bar-position",DM="width-before-scroll-bar",v6e="with-scroll-bars-hidden",x6e="--removed-body-scroll-bar-size";function L$(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function y6e(t,e){var n=b.useState(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(r){var s=n.value;s!==r&&(n.value=r,n.callback(r,s))}}}})[0];return n.callback=e,n.facade}var b6e=typeof window<"u"?b.useLayoutEffect:b.useEffect,dZ=new WeakMap;function w6e(t,e){var n=y6e(null,function(r){return t.forEach(function(s){return L$(s,r)})});return b6e(function(){var r=dZ.get(n);if(r){var s=new Set(r),i=new Set(t),o=n.current;s.forEach(function(l){i.has(l)||L$(l,null)}),i.forEach(function(l){s.has(l)||L$(l,o)})}dZ.set(n,t)},[t]),n}function _6e(t){return t}function j6e(t,e){e===void 0&&(e=_6e);var n=[],r=!1,s={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:t},useMedium:function(i){var o=e(i,r);return n.push(o),function(){n=n.filter(function(l){return l!==o})}},assignSyncMedium:function(i){for(r=!0;n.length;){var o=n;n=[],o.forEach(i)}n={push:function(l){return i(l)},filter:function(){return n}}},assignMedium:function(i){r=!0;var o=[];if(n.length){var l=n;n=[],l.forEach(i),o=n}var c=function(){var d=o;o=[],d.forEach(i)},u=function(){return Promise.resolve().then(c)};u(),n={push:function(d){o.push(d),u()},filter:function(d){return o=o.filter(d),n}}}};return s}function S6e(t){t===void 0&&(t={});var e=j6e(null);return e.options=$d({async:!0,ssr:!1},t),e}var Lpe=function(t){var e=t.sideCar,n=Dpe(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=e.read();if(!r)throw new Error("Sidecar medium not found");return b.createElement(r,$d({},n))};Lpe.isSideCarExport=!0;function N6e(t,e){return t.useMedium(e),Lpe}var Fpe=S6e(),F$=function(){},h3=b.forwardRef(function(t,e){var n=b.useRef(null),r=b.useState({onScrollCapture:F$,onWheelCapture:F$,onTouchMoveCapture:F$}),s=r[0],i=r[1],o=t.forwardProps,l=t.children,c=t.className,u=t.removeScrollBar,d=t.enabled,h=t.shards,f=t.sideCar,p=t.noRelative,m=t.noIsolation,v=t.inert,x=t.allowPinchZoom,g=t.as,w=g===void 0?"div":g,_=t.gapMode,j=Dpe(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),N=f,S=w6e([n,e]),C=$d($d({},j),s);return b.createElement(b.Fragment,null,d&&b.createElement(N,{sideCar:Fpe,removeScrollBar:u,shards:h,noRelative:p,noIsolation:m,inert:v,setCallbacks:i,allowPinchZoom:!!x,lockRef:n,gapMode:_}),o?b.cloneElement(b.Children.only(l),$d($d({},C),{ref:S})):b.createElement(w,$d({},C,{className:c,ref:S}),l))});h3.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};h3.classNames={fullWidth:DM,zeroRight:IM};var C6e=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function k6e(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=C6e();return e&&t.setAttribute("nonce",e),t}function A6e(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function E6e(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var T6e=function(){var t=0,e=null;return{add:function(n){t==0&&(e=k6e())&&(A6e(e,n),E6e(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},P6e=function(){var t=T6e();return function(e,n){b.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},$pe=function(){var t=P6e(),e=function(n){var r=n.styles,s=n.dynamic;return t(r,s),null};return e},M6e={left:0,top:0,right:0,gap:0},$$=function(t){return parseInt(t||"",10)||0},R6e=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],r=e[t==="padding"?"paddingTop":"marginTop"],s=e[t==="padding"?"paddingRight":"marginRight"];return[$$(n),$$(r),$$(s)]},O6e=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return M6e;var e=R6e(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},I6e=$pe(),Ow="data-scroll-locked",D6e=function(t,e,n,r){var s=t.left,i=t.top,o=t.right,l=t.gap;return n===void 0&&(n="margin"),` 838 .`.concat(v6e,` { 839 overflow: hidden `).concat(r,`; 840 padding-right: `).concat(l,"px ").concat(r,`; 841 } 842 body[`).concat(Ow,`] { 843 overflow: hidden `).concat(r,`; 844 overscroll-behavior: contain; 845 `).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&` 846 padding-left: `.concat(s,`px; 847 padding-top: `).concat(i,`px; 848 padding-right: `).concat(o,`px; 849 margin-left:0; 850 margin-top:0; 851 margin-right: `).concat(l,"px ").concat(r,`; 852 `),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";
852")].filter(Boolean).join(""),` 853 } 854 855 .`).concat(IM,` { 856 right: `).concat(l,"px ").concat(r,`; 857 } 858 859 .`).concat(DM,` { 860 margin-right: `).concat(l,"px ").concat(r,`; 861 } 862 863 .`).concat(IM," .").concat(IM,` { 864 right: 0 `).concat(r,`; 865 } 866 867 .`).concat(DM," .").concat(DM,` { 868 margin-right: 0 `).concat(r,`; 869 } 870 871 body[`).concat(Ow,`] { 872 `).concat(x6e,": ").concat(l,`px; 873 } 874`)},hZ=function(){var t=parseInt(document.body.getAttribute(Ow)||"0",10);return isFinite(t)?t:0},L6e=function(){b.useEffect(function(){return document.body.setAttribute(Ow,(hZ()+1).toString()),function(){var t=hZ()-1;t<=0?document.body.removeAttribute(Ow):document.body.setAttribute(Ow,t.toString())}},[])},F6e=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,s=r===void 0?"margin":r;L6e();var i=b.useMemo(function(){return O6e(s)},[s]);return b.createElement(I6e,{styles:D6e(i,!e,s,n?"":"!important")})},n8=!1;if(typeof window<"u")try{var YT=Object.defineProperty({},"passive",{get:function(){return n8=!0,!0}});window.addEventListener("test",YT,YT),window.removeEventListener("test",YT,YT)}catch{n8=!1}var nb=n8?{passive:!1}:!1,$6e=function(t){return t.tagName==="TEXTAREA"},zpe=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!$6e(t)&&n[e]==="visible")},z6e=function(t){return zpe(t,"overflowY")},B6e=function(t){return zpe(t,"overflowX")},fZ=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=Bpe(t,r);if(s){var i=Upe(t,r),o=i[1],l=i[2];if(o>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},U6e=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},q6e=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},Bpe=function(t,e){return t==="v"?z6e(e):B6e(e)},Upe=function(t,e){return t==="v"?U6e(e):q6e(e)},V6e=function(t,e){return t==="h"&&e==="rtl"?-1:1},H6e=function(t,e,n,r,s){var i=V6e(t,window.getComputedStyle(e).direction),o=i*r,l=n.target,c=e.contains(l),u=!1,d=o>0,h=0,f=0;do{if(!l)break;var p=Upe(t,l),m=p[0],v=p[1],x=p[2],g=v-x-i*m;(m||g)&&Bpe(t,l)&&(h+=g,f+=m);var w=l.parentNode;l=w&&w.nodeType===Node.DOCUMENT_FRAGMENT_NODE?w.host:w}while(!c&&l!==document.body||c&&(e.contains(l)||e===l));return(d&&(Math.abs(h)<1||!s)||!d&&(Math.abs(f)<1||!s))&&(u=!0),u},XT=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},pZ=function(t){return[t.deltaX,t.deltaY]},mZ=function(t){return t&&"current"in t?t.current:t},W6e=function(t,e){return t[0]===e[0]&&t[1]===e[1]},K6e=function(t){return` 875 .block-interactivity-`.concat(t,` {pointer-events: none;} 876 .allow-interactivity-`).concat(t,` {pointer-events: all;} 877`)},G6e=0,rb=[];function Y6e(t){var e=b.useRef([]),n=b.useRef([0,0]),r=b.useRef(),s=b.useState(G6e++)[0],i=b.useState($pe)[0],o=b.useRef(t);b.useEffect(function(){o.current=t},[t]),b.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(s));var v=g6e([t.lockRef.current],(t.shards||[]).map(mZ),!0).filter(Boolean);return v.forEach(function(x){return x.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),v.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(s))})}}},[t.inert,t.lockRef.current,t.shards]);var l=b.useCallback(function(v,x){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!o.current.allowPinchZoom;var g=XT(v),w=n.current,_="deltaX"in v?v.deltaX:w[0]-g[0],j="deltaY"in v?v.deltaY:w[1]-g[1],N,S=v.target,C=Math.abs(_)>Math.abs(j)?"h":"v";if("touches"in v&&C==="h"&&S.type==="range")return!1;var k=fZ(C,S);if(!k)return!0;if(k?N=C:(N=C==="v"?"h":"v",k=fZ(C,S)),!k)return!1;if(!r.current&&"changedTouches"in v&&(_||j)&&(r.current=N),!N)return!0;var E=r.current||N;return H6e(E,x,v,E==="h"?_:j,!0)},[]),c=b.useCallback(function(v){var x=v;if(!(!rb.length||rb[rb.length-1]!==i)){var g="deltaY"in x?pZ(x):XT(x),w=e.current.filter(function(N){return N.name===x.type&&(N.target===x.target||x.target===N.shadowParent)&&W6e(N.delta,g)})[0];if(w&&w.should){x.cancelable&&x.preventDefault();return}
vendor: 4,526 bytes, line 877
877if(!w){var _=(o.current.shards||[]).map(mZ).filter(Boolean).filter(function(N){return N.contains(x.target)}),j=_.length>0?l(x,_[0]):!o.current.noIsolation;j&&x.cancelable&&x.preventDefault()}}},[]),u=b.useCallback(function(v,x,g,w){var _={name:v,delta:x,target:g,should:w,shadowParent:X6e(g)};e.current.push(_),setTimeout(function(){e.current=e.current.filter(function(j){return j!==_})},1)},[]),d=b.useCallback(function(v){n.current=XT(v),r.current=void 0},[]),h=b.useCallback(function(v){u(v.type,pZ(v),v.target,l(v,t.lockRef.current))},[]),f=b.useCallback(function(v){u(v.type,XT(v),v.target,l(v,t.lockRef.current))},[]);b.useEffect(function(){return rb.push(i),t.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:f}),document.addEventListener("wheel",c,nb),document.addEventListener("touchmove",c,nb),document.addEventListener("touchstart",d,nb),function(){rb=rb.filter(function(v){return v!==i}),document.removeEventListener("wheel",c,nb),document.removeEventListener("touchmove",c,nb),document.removeEventListener("touchstart",d,nb)}},[]);var p=t.removeScrollBar,m=t.inert;return b.createElement(b.Fragment,null,m?b.createElement(i,{styles:K6e(s)}):null,p?b.createElement(F6e,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function X6e(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const J6e=N6e(Fpe,Y6e);var a2=b.forwardRef(function(t,e){return b.createElement(h3,$d({},t,{ref:e,sideCar:J6e}))});a2.classNames=h3.classNames;var Q6e=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},sb=new WeakMap,JT=new WeakMap,QT={},z$=0,qpe=function(t){return t&&(t.host||qpe(t.parentNode))},Z6e=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=qpe(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},e8e=function(t,e,n,r){var s=Z6e(e,Array.isArray(t)?t:[t]);QT[n]||(QT[n]=new WeakMap);var i=QT[n],o=[],l=new Set,c=new Set(s),u=function(h){!h||l.has(h)||(l.add(h),u(h.parentNode))};s.forEach(u);var d=function(h){!h||c.has(h)||Array.prototype.forEach.call(h.children,function(f){if(l.has(f))d(f);else try{var p=f.getAttribute(r),m=p!==null&&p!=="false",v=(sb.get(f)||0)+1,x=(i.get(f)||0)+1;sb.set(f,v),i.set(f,x),o.push(f),v===1&&m&&JT.set(f,!0),x===1&&f.setAttribute(n,"true"),m||f.setAttribute(r,"true")}catch(g){console.error("aria-hidden: cannot operate on ",f,g)}})};return d(e),l.clear(),z$++,function(){o.forEach(function(h){var f=sb.get(h)-1,p=i.get(h)-1;sb.set(h,f),i.set(h,p),f||(JT.has(h)||h.removeAttribute(r),JT.delete(h)),p||h.removeAttribute(n)}),z$--,z$||(sb=new WeakMap,sb=new WeakMap,JT=new WeakMap,QT={})}},f3=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),s=Q6e(t);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live]"))),e8e(r,s,n,"aria-hidden")):function(){return null}},p3="Dialog",[Vpe,Hpe]=Ys(p3),[t8e,qu]=Vpe(p3),Wpe=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:o=!0}=t,l=b.useRef(null),c=b.useRef(null),[u,d]=Xo({prop:r,defaultProp:s??!1,onChange:i,caller:p3});return a.jsx(t8e,{scope:e,triggerRef:l,contentRef:c,contentId:Ml(),titleId:Ml(),descriptionId:Ml(),open:u,onOpenChange:d,onOpenToggle:b.useCallback(()=>d(h=>!h),[d]),modal:o,children:n})};Wpe.displayName=p3;var Kpe="DialogTrigger",Gpe=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=qu(Kpe,n),i=$t(e,s.triggerRef);return a.jsx(et.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":YW(s.open),...r,ref:i,onClick:ze(t.onClick,s.onOpenToggle)})});Gpe.displayName=Kpe;var KW="DialogPortal",[n8e,Ype]=Vpe(KW,{forceMount:void 0}),Xpe=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:s}=t,i=qu(KW,e);return a.jsx(n8e,{scope:e,forceMount:n,children:b.Children.map(r,o=>a.jsx(yo,{present:n||i.open,children:a.jsx(kj,{asChild:!0,container:s,children:o})}))})};Xpe.displayName=KW;var FO="DialogOverlay",Jpe=b.forwardRef((t,e)=>{const n=Ype(FO,t.__scopeDialog),{forceMount:r=n.forceMount,...s}=t,i=qu(FO,t.__scopeDialog);return i.modal?a.jsx(yo,{present:r||i.open,children:a.jsx(s8e,{...s,ref:e})}):null});Jpe.displayName=FO;var r8e=Og("DialogOverlay.RemoveScroll"),s8e=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=qu(FO,n);return a.jsx(a2,{as:r8e,allowPinchZoom:!0,shards:[s.contentRef],children:a.jsx(et.div,{"data-state":YW(s.open
877),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),t0="DialogContent",Qpe=b.forwardRef((t,e)=>{const n=Ype(t0,t.__scopeDialog),{forceMount:r=n.forceMount,...s}=t,i=qu(t0,t.__scopeDialog);return a.jsx(yo,{present:r||i.open,children:i.modal?a.jsx(i8e,{...s,ref:e}):a.jsx(a8e,{...s,ref:e})})});Qpe.displayName=t0;var i8e=b.forwardRef((t,e)=>{const n=qu(t0,t.__scopeDialog),r=b.useRef(null),s=$t(e,n.contentRef,r);return b.useEffect(()=>{const i=r.current;if(i)return f3(i)},[]),a.jsx(Zpe,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ze(t.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:ze(t.onPointerDownOutside,i=>{const o=i.detail.originalEvent,l=o.button===0&&o.ctrlKey===!0;(o.button===2||l)&&i.preventDefault()}),onFocusOutside:ze(t.onFocusOutside,i=>i.preventDefault())})}),a8e=b.forwardRef((t,e)=>{const n=qu(t0,t.__scopeDialog),r=b.useRef(!1),s=b.useRef(!1);return a.jsx(Zpe,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,l;(o=t.onCloseAutoFocus)==null||o.call(t,i),i.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{var c,u;(c=t.onInteractOutside)==null||c.call(t,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=i.target;((u=n.triggerRef.current)==null?void 0:u.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),Zpe=b.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,...o}=t,l=qu(t0,n),c=b.useRef(null),u=$t(e,c);return d3(),a.jsxs(a.Fragment,{children:[a.jsx(i2,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:a.jsx(T0,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":YW(l.open),...o,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),a.jsxs(a.Fragment,{children:[a.jsx(l8e,{titleId:l.titleId}),a.jsx(u8e,{contentRef:c,descriptionId:l.descriptionId})]})]})}),GW="DialogTitle",eme=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=qu(GW,n);return a.jsx(et.h2,{id:s.titleId,...r,ref:e})});eme.displayName=GW;var tme="DialogDescription",nme=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=qu(tme,n);return a.jsx(et.p,{id:s.descriptionId,...r,ref:e})});nme.displayName=tme;var rme="DialogClose",sme=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=qu(rme,n);return a.jsx(et.button,{type:"button",...r,ref:e,onClick:ze(t.onClick,()=>s.onOpenChange(!1))})});sme.displayName=rme;function YW(t){return t?"open":"closed"}var ime="DialogTitleWarning",[o8e,ame]=MFe(ime,{contentName:t0,titleName:GW,docsSlug:"dialog"}),l8e=({titleId:t})=>{const e=ame(ime),n=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users. 878 879If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component. 880 881For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return b.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},c8e="DialogDescriptionWarning",u8e=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${ame(c8e).contentName}}.`;return b.useEffect(()=>{var i;const s=(i=t.current)==null?void 0:i.getAttribute("aria-describedby");e&&s&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},m3=Wpe,g3=Gpe,v3=Xpe,Mj=Jpe,Rj=Qpe,Oj=eme,Ij=nme,o2=sme;const Dj=m3,XW=g3,d8e=v3,ome=b.forwardRef(({className:t,...e},n)=>a.jsx(Mj,{className:Fe("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",t),...e,ref:n}));ome.displayName=Mj.displayName;const h8e=e2("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"}}),P0=b.forwardRef(({side:t="right",className:e,children:n,...r},s)=>
881a.jsxs(d8e,{children:[a.jsx(ome,{}),a.jsxs(Rj,{ref:s,className:Fe(h8e({side:t}),e),...r,children:[n,a.jsxs(o2,{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:[a.jsx(ks,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));P0.displayName=Rj.displayName;const l2=({className:t,...e})=>a.jsx("div",{className:Fe("flex flex-col space-y-2 text-center sm:text-left",t),...e});l2.displayName="SheetHeader";const lme=({className:t,...e})=>a.jsx("div",{className:Fe("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});lme.displayName="SheetFooter";const c2=b.forwardRef(({className:t,...e},n)=>a.jsx(Oj,{ref:n,className:Fe("text-lg font-semibold text-foreground",t),...e}));c2.displayName=Oj.displayName;const cme=b.forwardRef(({className:t,...e},n)=>a.jsx(Ij,{ref:n,className:Fe("text-sm text-muted-foreground",t),...e}));cme.displayName=Ij.displayName;var f8e=b.createContext(void 0);function Lj(t){const e=b.useContext(f8e);return t||e||"ltr"}var B$="rovingFocusGroup.onEntryFocus",p8e={bubbles:!1,cancelable:!0},u2="RovingFocusGroup",[r8,ume,m8e]=Cj(u2),[g8e,x3]=Ys(u2,[m8e]),[v8e,x8e]=g8e(u2),dme=b.forwardRef((t,e)=>a.jsx(r8.Provider,{scope:t.__scopeRovingFocusGroup,children:a.jsx(r8.Slot,{scope:t.__scopeRovingFocusGroup,children:a.jsx(y8e,{...t,ref:e})})}));dme.displayName=u2;var y8e=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:i,currentTabStopId:o,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...h}=t,f=b.useRef(null),p=$t(e,f),m=Lj(i),[v,x]=Xo({prop:o,defaultProp:l??null,onChange:c,caller:u2}),[g,w]=b.useState(!1),_=ho(u),j=ume(n),N=b.useRef(!1),[S,C]=b.useState(0);return b.useEffect(()=>{const k=f.current;if(k)return k.addEventListener(B$,_),()=>k.removeEventListener(B$,_)},[_]),a.jsx(v8e,{scope:n,orientation:r,dir:m,loop:s,currentTabStopId:v,onItemFocus:b.useCallback(k=>x(k),[x]),onItemShiftTab:b.useCallback(()=>w(!0),[]),onFocusableItemAdd:b.useCallback(()=>C(k=>k+1),[]),onFocusableItemRemove:b.useCallback(()=>C(k=>k-1),[]),children:a.jsx(et.div,{tabIndex:g||S===0?-1:0,"data-orientation":r,...h,ref:p,style:{outline:"none",...t.style},onMouseDown:ze(t.onMouseDown,()=>{N.current=!0}),onFocus:ze(t.onFocus,k=>{const E=!N.current;if(k.target===k.currentTarget&&E&&!g){const P=new CustomEvent(B$,p8e);if(k.currentTarget.dispatchEvent(P),!P.defaultPrevented){const T=j().filter(D=>D.focusable),M=T.find(D=>D.active),R=T.find(D=>
881D.id===v),I=[M,R,...T].filter(Boolean).map(D=>D.ref.current);pme(I,d)}}N.current=!1}),onBlur:ze(t.onBlur,()=>w(!1))})})}),hme="RovingFocusGroupItem",fme=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:i,children:o,...l}=t,c=Ml(),u=i||c,d=x8e(hme,n),h=d.currentTabStopId===u,f=ume(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:v}=d;return b.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),a.jsx(r8.ItemSlot,{scope:n,id:u,focusable:r,active:s,children:a.jsx(et.span,{tabIndex:h?0:-1,"data-orientation":d.orientation,...l,ref:e,onMouseDown:ze(t.onMouseDown,x=>{r?d.onItemFocus(u):x.preventDefault()}),onFocus:ze(t.onFocus,()=>d.onItemFocus(u)),onKeyDown:ze(t.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){d.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const g=_8e(x,d.orientation,d.dir);if(g!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let _=f().filter(j=>j.focusable).map(j=>j.ref.current);if(g==="last")_.reverse();else if(g==="prev"||g==="next"){g==="prev"&&_.reverse();const j=_.indexOf(x.currentTarget);_=d.loop?j8e(_,j+1):_.slice(j+1)}setTimeout(()=>pme(_))}}),children:typeof o=="function"?o({isCurrentTabStop:h,hasTabStop:v!=null}):o})})});fme.displayName=hme;var b8e={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function w8e(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function _8e(t,e,n){const r=w8e(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return b8e[r]}function pme(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function j8e(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var mme=dme,gme=fme,s8=["Enter"," "],S8e=["ArrowDown","PageUp","Home"],vme=["ArrowUp","PageDown","End"],N8e=[...S8e,...vme],C8e={ltr:[...s8,"ArrowRight"],rtl:[...s8,"ArrowLeft"]},k8e={ltr:["ArrowLeft"],rtl:["ArrowRight"]},d2="Menu",[gk,A8e,E8e]=Cj(d2),[M0,xme]=Ys(d2,[E8e,ev,x3]),y3=ev(),yme=x3(),[T8e,R0]=M0(d2),[P8e,h2]=M0(d2),bme=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:s,onOpenChange:i,modal:o=!0}=t,l=y3(e),[c,u]=b.useState(null),d=b.useRef(!1),h=ho(i),f=Lj(s);return b.useEffect(()=>{const p=()=>{d.current=!0,document.addEventListener("pointerdown",m,{capture:!0,once:!0}),document.addEventListener("pointermove",m,{capture:!0,once:!0})},m=()=>d.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",m,{capture:!0}),document.removeEventListener("pointermove",m,{capture:!0})}},[]),a.jsx(HW,{...l,children:a.jsx(T8e,{scope:e,open:n,onOpenChange:h,content:c,onContentChange:u,children:a.jsx(P8e,{scope:e,onClose:b.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:d,dir:f,modal:o,children:r})})})};bme.displayName=d2;var M8e="MenuAnchor",JW=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=y3(n);return a.jsx(s2,{...s,...r,ref:e})});JW.displayName=M8e;var QW="MenuPortal",[R8e,wme]=M0(QW,{forceMount:void 0}),_me=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:s}=t,i=R0(QW,e);return a.jsx(R8e,{scope:e,forceMount:n,children:a.jsx(yo,{present:n||i.open,children:a.jsx(kj,{asChild:!0,container:s,children:r})})})};_me.displayName=QW;var kc="MenuContent",[O8e,ZW]=M0(kc),jme=b.forwardRef((t,e)=>{const n=wme(kc,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,i=R0(kc,t.__scopeMenu),o=h2(kc,t.__scopeMenu);return a.jsx(gk.Provider,{scope:t.__scopeMenu,children:a.jsx(yo,{present:r||i.open,children:a.jsx(gk.Slot,{scope:t.__scopeMenu,children:o.modal?a.jsx(I8e,{...s,ref:e}):a.jsx(D8e,{...s,ref:e})})})})}),I8e=b.forwardRef((t,e)=>{const n=R0(kc,t.__scopeMenu),r=b.useRef(null),s=$t(e,r);return b.useEffect(()=>{const i=r.current;if(i)return f3(i)},[]),a.jsx(e9,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:ze(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),D8e=b.forwardRef((t,e)=>{const n=R0(kc,t.__scopeMenu);return a.jsx(e9,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),L8e=Og("MenuContent.ScrollLock"),e9=b.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...v}
881=t,x=R0(kc,n),g=h2(kc,n),w=y3(n),_=yme(n),j=A8e(n),[N,S]=b.useState(null),C=b.useRef(null),k=$t(e,C,x.onContentChange),E=b.useRef(0),P=b.useRef(""),T=b.useRef(0),M=b.useRef(null),R=b.useRef("right"),A=b.useRef(0),I=m?a2:b.Fragment,D=m?{as:L8e,allowPinchZoom:!0}:void 0,O=B=>{var oe,ye;const G=P.current+B,U=j().filter(le=>!le.disabled),F=document.activeElement,W=(oe=U.find(le=>le.ref.current===F))==null?void 0:oe.textValue,Q=U.map(le=>le.textValue),K=Y8e(Q,G,W),fe=(ye=U.find(le=>le.textValue===K))==null?void 0:ye.ref.current;(function le(me){P.current=me,window.clearTimeout(E.current),me!==""&&(E.current=window.setTimeout(()=>le(""),1e3))})(G),fe&&setTimeout(()=>fe.focus())};b.useEffect(()=>()=>window.clearTimeout(E.current),[]),d3();const z=b.useCallback(B=>{var U,F;return R.current===((U=M.current)==null?void 0:U.side)&&J8e(B,(F=M.current)==null?void 0:F.area)},[]);return a.jsx(O8e,{scope:n,searchRef:P,onItemEnter:b.useCallback(B=>{z(B)&&B.preventDefault()},[z]),onItemLeave:b.useCallback(B=>{var G;z(B)||((G=C.current)==null||G.focus(),S(null))},[z]),onTriggerLeave:b.useCallback(B=>{z(B)&&B.preventDefault()},[z]),pointerGraceTimerRef:T,onPointerGraceIntentChange:b.useCallback(B=>{M.current=B},[]),children:a.jsx(I,{...D,children:a.jsx(i2,{asChild:!0,trapped:s,onMountAutoFocus:ze(i,B=>{var G;B.preventDefault(),(G=C.current)==null||G.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:a.jsx(T0,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:f,onDismiss:p,children:a.jsx(mme,{asChild:!0,..._,dir:g.dir,orientation:"vertical",loop:r,currentTabStopId:N,onCurrentTabStopIdChange:S,onEntryFocus:ze(c,B=>{g.isUsingKeyboardRef.current||B.preventDefault()}),preventScrollOnEntryFocus:!0,children:a.jsx(o3,{role:"menu","aria-orientation":"vertical","data-state":$me(x.open),"data-radix-menu-content":"",dir:g.dir,...w,...v,ref:k,style:{outline:"none",...v.style},onKeyDown:ze(v.onKeyDown,B=>{const U=B.target.closest("[data-radix-menu-content]")===B.currentTarget,F=B.ctrlKey||B.altKey||B.metaKey,W=B.key.length===1;U&&(B.key==="Tab"&&B.preventDefault(),!F&&W&&O(B.key));const Q=C.current;if(B.target!==Q||!N8e.includes(B.key))return;B.preventDefault();const fe=j().filter(oe=>!oe.disabled).map(oe=>oe.ref.current);vme.includes(B.key)&&fe.reverse(),K8e(fe)}),onBlur:ze(t.onBlur,B=>{B.currentTarget.contains(B.target)||(window.clearTimeout(E.current),P.current="")}),onPointerMove:ze(t.onPointerMove,vk(B=>{const G=B.target,U=A.current!==B.clientX;if(B.currentTarget.contains(G)&&U){const F=B.clientX>A.current?"right":"left";R.current=F,A.current=B.clientX}}))})})})})})})});jme.displayName=kc;var F8e="MenuGroup",t9=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(et.div,{role:"group",...r,ref:e})});t9.displayName=F8e;var $8e="MenuLabel",Sme=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(et.div,{...r,ref:e})});Sme.displayName=$8e;var $O="MenuItem",gZ="menu.itemSelect",b3=b.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...s}=t,i=b.useRef(null),o=h2($O,t.__scopeMenu),l=ZW($O,t.__scopeMenu),c=$t(e,i),u=b.useRef(!1),d=()=>{const h=i.current;if(!n&&h){const f=new CustomEvent(gZ,{bubbles:!0,cancelable:!0});h.addEventListener(gZ,p=>r==null?void 0:r(p),{once:!0}),NW(h,f),f.defaultPrevented?u.current=!1:o.onClose()}};return a.jsx(Nme,{...s,ref:c,disabled:n,onClick:ze(t.onClick,d),onPointerDown:h=>{var f;(f=t.onPointerDown)==null||f.call(t,h),u.current=!0},onPointerUp:ze(t.onPointerUp,h=>{var f;u.current||(f=h.currentTarget)==null||f.click()}),onKeyDown:ze(t.onKeyDown,h=>{const f=l.searchRef.current!=="";n||f&&h.key===" "||s8.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});b3.displayName=$O;var Nme=b.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...i}=t,o=ZW($O,n),l=yme(n),c=b.useRef(null),u=$t(e,c),[d,h]=b.useState(!1),[f,p]=b.useState("");return b.useEffect(()=>{const m=c.current;m&&p((m.textContent??"").trim())},[i.children]),a.jsx(gk.ItemSlot,{scope:n,disabled:r,textValue:s??f,children:a.jsx(gme,{asChild:!0,...l,focusable:!r,children:a.jsx(et.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:u,onPointerMove:ze(t.onPointerMove,vk(m=>{r?o.onItemLeave(m):(o.onItemEnter(m),m.defaultPrevented||m.currentTarget.focu
881s({preventScroll:!0}))})),onPointerLeave:ze(t.onPointerLeave,vk(m=>o.onItemLeave(m))),onFocus:ze(t.onFocus,()=>h(!0)),onBlur:ze(t.onBlur,()=>h(!1))})})})}),z8e="MenuCheckboxItem",Cme=b.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...s}=t;return a.jsx(Pme,{scope:t.__scopeMenu,checked:n,children:a.jsx(b3,{role:"menuitemcheckbox","aria-checked":zO(n)?"mixed":n,...s,ref:e,"data-state":r9(n),onSelect:ze(s.onSelect,()=>r==null?void 0:r(zO(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Cme.displayName=z8e;var kme="MenuRadioGroup",[B8e,U8e]=M0(kme,{value:void 0,onValueChange:()=>{}}),Ame=b.forwardRef((t,e)=>{const{value:n,onValueChange:r,...s}=t,i=ho(r);return a.jsx(B8e,{scope:t.__scopeMenu,value:n,onValueChange:i,children:a.jsx(t9,{...s,ref:e})})});Ame.displayName=kme;var Eme="MenuRadioItem",Tme=b.forwardRef((t,e)=>{const{value:n,...r}=t,s=U8e(Eme,t.__scopeMenu),i=n===s.value;return a.jsx(Pme,{scope:t.__scopeMenu,checked:i,children:a.jsx(b3,{role:"menuitemradio","aria-checked":i,...r,ref:e,"data-state":r9(i),onSelect:ze(r.onSelect,()=>{var o;return(o=s.onValueChange)==null?void 0:o.call(s,n)},{checkForDefaultPrevented:!1})})})});Tme.displayName=Eme;var n9="MenuItemIndicator",[Pme,q8e]=M0(n9,{checked:!1}),Mme=b.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...s}=t,i=q8e(n9,n);return a.jsx(yo,{present:r||zO(i.checked)||i.checked===!0,children:a.jsx(et.span,{...s,ref:e,"data-state":r9(i.checked)})})});Mme.displayName=n9;var V8e="MenuSeparator",Rme=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(et.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});Rme.displayName=V8e;var H8e="MenuArrow",Ome=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=y3(n);return a.jsx(l3,{...s,...r,ref:e})});Ome.displayName=H8e;var W8e="MenuSub",[ELt,Ime]=M0(W8e),sN="MenuSubTrigger",Dme=b.forwardRef((t,e)=>{const n=R0(sN,t.__scopeMenu),r=h2(sN,t.__scopeMenu),s=Ime(sN,t.__scopeMenu),i=ZW(sN,t.__scopeMenu),o=b.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=i,u={__scopeMenu:t.__scopeMenu},d=b.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return b.useEffect(()=>d,[d]),b.useEffect(()=>{const h=l.current;return()=>{window.clearTimeout(h),c(null)}},[l,c]),a.jsx(JW,{asChild:!0,...u,children:a.jsx(Nme,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":$me(n.open),...t,ref:XL(e,s.onTriggerChange),onClick:h=>{var f;(f=t.onClick)==null||f.call(t,h),!(t.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:ze(t.onPointerMove,vk(h=>{i.onItemEnter(h),!h.defaultPrevented&&!t.disabled&&!n.open&&!o.current&&(i.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:ze(t.onPointerLeave,vk(h=>{var p,m;d();const f=(p=n.content)==null?void 0:p.getBoundingClientRect();if(f){const v=(m=n.content)==null?void 0:m.dataset.side,x=v==="right",g=x?-5:5,w=f[x?"left":"right"],_=f[x?"right":"left"];i.onPointerGraceIntentChange({area:[{x:h.clientX+g,y:h.clientY},{x:w,y:f.top},{x:_,y:f.top},{x:_,y:f.bottom},{x:w,y:f.bottom}],side:v}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(h),h.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:ze(t.onKeyDown,h=>{var p;const f=i.searchRef.current!=="";t.disabled||f&&h.key===" "||C8e[r.dir].includes(h.key)&&(n.onOpenChange(!0),(p=n.content)==null||p.focus(),h.preventDefault())})})})});Dme.displayName=sN;var Lme="MenuSubContent",Fme=b.forwardRef((t,e)=>{const n=wme(kc,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,i=R0(kc,t.__scopeMenu),o=h2(kc,t.__scopeMenu),l=Ime(Lme,t.__scopeMenu),c=b.useRef(null),u=$t(e,c);return a.jsx(gk.Provider,{scope:t.__scopeMenu,children:a.jsx(yo,{present:r||i.open,children:a.jsx(gk.Slot,{scope:t.__scopeMenu,children:a.jsx(e9,{id:l.contentId,"aria-labelledby":l.triggerId,...s,ref:u,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var h;o.isUsingKeyboardRef.current&&((h=c.current)==null||h.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:ze(t.onFocusOutside,d=>{d.target!==l.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:ze(t.onEscapeKeyDown,d=>{o.onClose(),d.preventDefault()}),onKeyDown:ze(t.onKeyDown,d=>{var p;const h=d.currentTarget.contains(d.target),f=k8e[o.dir].includes(d.key);h&&f&&(i.onOpenChange(!1),(p=l.trigger)==null||p.focus(),d.preventDefault())})})})})})});Fme.displayName=Lme;function $me(t){return t?"open":"closed"}function zO(t){return t==="indeterminate"}function r9(t){return zO(t)?"indeterminate":t?"checked":"unchecked"}function K8e(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function G8e(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function Y8e(t,e,n){const s=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let o=G8e(t,Math.max(i,0));s.length===1&&(o=o.filter(u=>u!==n));const c=o.find(u=>u.toLowerCase().startsWith(s.toLowerCase()));return c!==n?c:void 0}function X8e(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,o=e.length-1;i<e.length;o=i++){const l=e[i],c=e[o],u=l.x,d=l.y,h=c.x,f=c.y;d>r!=f>r&&n<(h-u)*(r-d)/(f-d)+u&&(s=!s)}return s}function J8e(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return X8e(n,e)}function vk(t){return e=>e.pointerType==="mouse"?t(e):void 0}var Q8e=bme,Z8e=JW,eUe=_me,tUe=jme,nUe=t9,rUe=Sme,sUe=b3,iUe=Cme,aUe=Ame,oUe=Tme,lUe=Mme,cUe=Rme,uUe=Ome,dUe=Dme,hUe=Fme,w3="DropdownMenu",[fUe,TLt]=Ys(w3,[xme]),bo=xme(),[pUe,zme]=fUe(w3),Bme=t=>{const{__scopeDropdownMenu:e,children:n,dir:r,open:s,defaultOpen:i,onOpenChange:o,modal:l=!0}=t,c=bo(e),u=b.useRef(null),[d,h]=Xo({prop:s,defaultProp:i??!1,onChange:o,caller:w3});return a.jsx(pUe,{scope:e,triggerId:Ml(),triggerRef:u,contentId:Ml(),open:d,onOpenChange:h,onOpenToggle:b.useCallback(()=>h(f=>!f),[h]),modal:l,children:a.jsx(Q8e,{...c,open:d,onOpenChange:h,dir:r,modal:l,children:n})})};Bme.displayName=w3;var Ume="DropdownMenuTrigger",qme=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...s}=t,i=zme(Ume,n),o=bo(n);return a.jsx(Z8e,{asChild:!0,...o,children:a.jsx(et.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":r?"":void 0,disabled:r,...s,ref:XL(e,i.triggerRef),onPointerDown:ze(t.onPointerDown,l=>{!r&&l.button===0&&l.ctrlKey===!1&&(i.onOpenToggle(),i.open||l.preventDefault())}),onKeyDown:ze(t.onKeyDown,l=>{r||(["Enter"," "].includes(l.key)&&i.onOpenToggle(),l.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});qme.displayName=Ume;var mUe="DropdownMenuPortal",Vme=t=>{const{__scopeDropdownMenu:e,...n}=t,r=bo(e);return a.jsx(eUe,{...r,...n})};Vme.displayName=mUe;var Hme="DropdownMenuContent",Wme=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=zme(Hme,n),i=bo(n),o=b.useRef(!1);return a.jsx(tUe,{id:s.contentId,"aria-labelledby":s.triggerId,...i,...r,ref:e,onCloseAutoFocus:ze(t.onCloseAutoFocus,l=>{var c;o.current||(c=s.triggerRef.current)==null||c.focus(),o.current=!1,l.preventDefault()}),onInteractOutside:ze(t.onInteractOutside,l=>{const c=l.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,d=c.button===2||u;(!s.modal||d)&&(o.current=!0)}),style:{...t.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)"}})});Wme.displayName=Hme;var gUe="DropdownMenuGroup",vUe=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=bo(n);return a.jsx(nUe,{...s,...r,ref:e})});vUe.displayName=gUe;var xUe="DropdownMenuLabel",Kme=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=bo(n);return a.jsx(rUe,{...s,...r,ref:e})});Kme.displayName=xUe;var yUe="DropdownMenuItem",Gme=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=bo(n);return a.jsx(sUe,{...s,...r,ref:e})});Gme.displayName=yUe;var bUe="DropdownMenuCheckboxItem",Yme=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=bo(n);return a.jsx(iUe,{...s,...r,ref:e})});Yme.displayName=bUe;var wUe="DropdownMenuRadioGroup",_Ue=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=bo(n);return a.jsx(aUe,{...s,...r,ref:e})});_Ue.displayName=wUe;var jUe="DropdownMenuRadioItem",Xme=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=bo(n);return a.jsx(oUe,{...s,...r,ref:e})});Xme.displayName=jUe;var SUe="DropdownMenuItemIndicator",Jme=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=bo(n);return a.jsx(lUe,{...s,...r,ref:e})});Jme.displayName=SUe;var NUe="DropdownMenuSeparator",Qme=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=bo(n);return a.jsx(cUe,{...s,...r,ref:e})});Qme.displayName=NUe;var CUe="DropdownMenuArrow",kUe=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=bo(n);return a.jsx(uUe,{...s,...r,ref:e})});kUe.displayName=CUe;var AUe="DropdownMenuSubTrigger",Zme=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=bo(n);return a.jsx(dUe,{...s,...r,ref:e})});Zme.displayName=AUe;var EUe="DropdownMenuSubContent",ege=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=bo(n);return a.jsx(hUe,{...s,...r,ref:e,style:{...t.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)"}})});ege.displayName=EUe;var TUe=Bme,PUe=qme,MUe=Vme,tge=Wme,nge=Kme,rge=Gme,sge=Yme,ige=Xme,age=Jme,oge=Qme,lge=Zme,cge=ege;const uge=TUe,dge=PUe,RUe=b.forwardRef(({className:t,inset:e,children:n,...r},s)=>
881a.jsxs(lge,{ref:s,className:Fe("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",e&&"pl-8",t),...r,children:[n,a.jsx(PO,{className:"ml-auto h-4 w-4"})]}));RUe.displayName=lge.displayName;const OUe=b.forwardRef(({className:t,...e},n)=>a.jsx(cge,{ref:n,className:Fe("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",t),...e}));OUe.displayName=cge.displayName;const s9=b.forwardRef(({className:t,sideOffset:e=4,...n},r)=>a.jsx(MUe,{children:a.jsx(tge,{ref:r,sideOffset:e,className:Fe("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",t),...n})}));s9.displayName=tge.displayName;const Vv=b.forwardRef(({className:t,inset:e,...n},r)=>a.jsx(rge,{ref:r,className:Fe("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",e&&"pl-8",t),...n}));Vv.displayName=rge.displayName;const IUe=b.forwardRef(({className:t,children:e,checked:n,...r},s)=>a.jsxs(sge,{ref:s,className:Fe("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",t),checked:n,...r,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(age,{children:a.jsx(Ma,{className:"h-4 w-4"})})}),e]}));IUe.displayName=sge.displayName;const DUe=b.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(ige,{ref:r,className:Fe("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",t),...n,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(age,{children:a.jsx(I$e,{className:"h-2 w-2 fill-current"})})}),e]}));DUe.displayName=ige.displayName;const LUe=b.forwardRef(({className:t,inset:e,...n},r)=>a.jsx(nge,{ref:r,className:Fe("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",t),...n}));LUe.displayName=nge.displayName;const hge=b.forwardRef(({className:t,...e},n)=>a.jsx(oge,{ref:n,className:Fe("-mx-1 my-1 h-px bg-muted",t),...e}));hge.displayName=oge.displayName;function BO(t,[e,n]){return Math.min(n,Math.max(e,t))}function _3(t){const e=b.useRef({value:t,previous:t});return b.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var FUe=[" ","Enter","ArrowUp","ArrowDown"],$Ue=[" ","Enter"],n0="Select",[j3,S3,zUe]=Cj(n0),[Fj,PLt]=Ys(n0,[zUe,ev]),N3=ev(),[BUe,nv]=Fj(n0),[UUe,qUe]=Fj(n0),fge=t=>{const{__scopeSelect:e,children:n,open:r,defaultOpen:s,onOpenChange:i,value:o,defaultValue:l,onValueChange:c,dir:u,name:d,autoComplete:h,disabled:f,required:p,form:m}=t,v=N3(e),[x,g]=b.useState(null),[w,_]=b.useState(null),[j,N]=b.useState(!1),S=Lj(u),[C,k]=Xo({prop:r,defaultProp:s??!1,onChange:i,caller:n0}),[E,P]=Xo({prop:o,defaultProp:l,onChange:c,caller:n0}),T=b.useRef(null),M=x?m||!!x.closest("form"):!0,[R,A]=b.useState(new Set),I=Array.from(R).map(D=>D.props.value).join(";");return a.jsx(HW,{...v,children:a.jsxs(BUe,{required:p,scope:e,trigger:x,onTriggerChange:g,valueNode:w,onValueNodeChange:_,valueNodeHasChildren:j,onValueNodeHasChildrenChange:N,contentId:Ml(),value:E,onValueChange:P,open:C,onOpenChange:k,dir:S,triggerPointerDownPosRef:T,disabled:f,children:[a.jsx(j3.Provider,{scope:e,children:a.jsx(UUe,{scope:t.__scopeSelect,onNativeOptionAdd:b.useCallback(D=>{A(O=>new Set(O).add(D))},[]),onNativeOptionRemove:b.useCallback(D=>{A(O=>{const z=new Set(O);return z.delete(D),z})},[]),children:n})}),M?a.jsxs(Lge,{"aria-hidden":!0,required:p,tabIndex:-1,name:d,autoComplete:h,value:E,onChange:D=>P(D.target.value),disabled:f,form:m,children:[E===void 0?a.jsx("option",{value:""}):null,Array.from(R)]},I):null]})})};fge.displayName=n0;var pge="SelectTrigger",mge=b.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...s}=t,i=N3(n),o=nv(pge,n),l=o.disabled||r,c=$t(e,o.onTriggerChange),u=S3(n),d=b.useRef("touch"),[h,f,p]=$ge(v=>{const x=u().filter(_=>!_.disabled),g=x.find(_=>_.value===o.value),w=zge(x,v,g);w!==void 0&&o.onValueChange(w.value)}),m=v=>{l||(o.onOpenChange(!0),p()),v&&(o.triggerPointerDownPosRef.current={x:Math.round(v.pageX),y:Math.round(v.pageY)})};return a.jsx(s2,{asChild:!0,...i,children:a.jsx(et.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":Fge(o.value)?"":void 0,...s,ref:c,onClick:ze(s.onClick,v=>
881{v.currentTarget.focus(),d.current!=="mouse"&&m(v)}),onPointerDown:ze(s.onPointerDown,v=>{d.current=v.pointerType;const x=v.target;x.hasPointerCapture(v.pointerId)&&x.releasePointerCapture(v.pointerId),v.button===0&&v.ctrlKey===!1&&v.pointerType==="mouse"&&(m(v),v.preventDefault())}),onKeyDown:ze(s.onKeyDown,v=>{const x=h.current!=="";!(v.ctrlKey||v.altKey||v.metaKey)&&v.key.length===1&&f(v.key),!(x&&v.key===" ")&&FUe.includes(v.key)&&(m(),v.preventDefault())})})})});mge.displayName=pge;var gge="SelectValue",vge=b.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:s,children:i,placeholder:o="",...l}=t,c=nv(gge,n),{onValueNodeHasChildrenChange:u}=c,d=i!==void 0,h=$t(e,c.onValueNodeChange);return ys(()=>{u(d)},[u,d]),a.jsx(et.span,{...l,ref:h,style:{pointerEvents:"none"},children:Fge(c.value)?a.jsx(a.Fragment,{children:o}):i})});vge.displayName=gge;var VUe="SelectIcon",xge=b.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...s}=t;return a.jsx(et.span,{"aria-hidden":!0,...s,ref:e,children:r||"â¼"})});xge.displayName=VUe;var HUe="SelectPortal",yge=t=>a.jsx(kj,{asChild:!0,...t});yge.displayName=HUe;var r0="SelectContent",bge=b.forwardRef((t,e)=>{const n=nv(r0,t.__scopeSelect),[r,s]=b.useState();if(ys(()=>{s(new DocumentFragment)},[]),!n.open){const i=r;return i?Lc.createPortal(a.jsx(wge,{scope:t.__scopeSelect,children:a.jsx(j3.Slot,{scope:t.__scopeSelect,children:a.jsx("div",{children:t.children})})}),i):null}return a.jsx(_ge,{...t,ref:e})});bge.displayName=r0;var Xc=10,[wge,rv]=Fj(r0),WUe="SelectContentImpl",KUe=Og("SelectContent.RemoveScroll"),_ge=b.forwardRef((t,e)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:i,onPointerDownOutside:o,side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:h,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:v,avoidCollisions:x,...g}=t,w=nv(r0,n),[_,j]=b.useState(null),[N,S]=b.useState(null),C=$t(e,oe=>j(oe)),[k,E]=b.useState(null),[P,T]=b.useState(null),M=S3(n),[R,A]=b.useState(!1),I=b.useRef(!1);b.useEffect(()=>{if(_)return f3(_)},[_]),d3();const D=b.useCallback(oe=>{const[ye,...le]=M().map(ae=>ae.ref.current),[me]=le.slice(-1),he=document.activeElement;for(const ae of oe)if(ae===he||(ae==null||ae.scrollIntoView({block:"nearest"}),ae===ye&&N&&(N.scrollTop=0),ae===me&&N&&(N.scrollTop=N.scrollHeight),ae==null||ae.focus(),document.activeElement!==he))return},[M,N]),O=b.useCallback(()=>D([k,_]),[D,k,_]);b.useEffect(()=>{R&&O()},[R,O]);const{onOpenChange:z,triggerPointerDownPosRef:B}=w;b.useEffect(()=>{if(_){let oe={x:0,y:0};const ye=me=>{var he,ae;oe={x:Math.abs(Math.round(me.pageX)-(((he=B.current)==null?void 0:he.x)??0)),y:Math.abs(Math.round(me.pageY)-(((ae=B.current)==null?void 0:ae.y)??0))}},le=me=>{oe.x<=10&&oe.y<=10?me.preventDefault():_.contains(me.target)||z(!1),document.removeEventListener("pointermove",ye),B.current=null};return B.current!==null&&(document.addEventListener("pointermove",ye),document.addEventListener("pointerup",le,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ye),document.removeEventListener("pointerup",le,{capture:!0})}}},[_,z,B]),b.useEffect(()=>{const oe=()=>z(!1);return window.addEventListener("blur",oe),window.addEventListener("resize",oe),()=>{window.removeEventListener("blur",oe),window.removeEventListener("resize",oe)}},[z]);const[G,U]=$ge(oe=>{const ye=M().filter(he=>!he.disabled),le=ye.find(he=>he.ref.current===document.activeElement),me=zge(ye,oe,le);me&&setTimeout(()=>me.ref.current.focus())}),F=b.useCallback((oe,ye,le)=>{const me=!I.current&&!le;(w.value!==void 0&&w.value===ye||me)&&(E(oe),me&&(I.current=!0))},[w.value]),W=b.useCallback(()=>_==null?void 0:_.focus(),[_]),Q=b.useCallback((oe,ye,le)=>{const me=!I.current&&!le;(w.value!==void 0&&w.value===ye||me)&&T(oe)},[w.value]),K=r==="popper"?i8:jge,fe=K===i8?{side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:h,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:v,avoidCollisions:x}:{};return a.jsx(wge,{scope:n,content:_,viewport:N,onViewportChange:S,itemRefCallback:F,selectedItem:k,onItemLeave:W,itemTextRefCallback:Q,focusSelectedItem:O,selectedItemText:P,position:r,isPositioned:R,searchRef:G,children:a.jsx(a2,{as:KUe,allowPinchZoom:!0,children:a.jsx(i2,{asChild:!0,trapped:w.open,onMountAutoFocus:oe=>{oe.preventDefault()},onUnmountAutoFocus:ze(s,oe=>{var ye;
881(ye=w.trigger)==null||ye.focus({preventScroll:!0}),oe.preventDefault()}),children:a.jsx(T0,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:oe=>oe.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:a.jsx(K,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:oe=>oe.preventDefault(),...g,...fe,onPlaced:()=>A(!0),ref:C,style:{display:"flex",flexDirection:"column",outline:"none",...g.style},onKeyDown:ze(g.onKeyDown,oe=>{const ye=oe.ctrlKey||oe.altKey||oe.metaKey;if(oe.key==="Tab"&&oe.preventDefault(),!ye&&oe.key.length===1&&U(oe.key),["ArrowUp","ArrowDown","Home","End"].includes(oe.key)){let me=M().filter(he=>!he.disabled).map(he=>he.ref.current);if(["ArrowUp","End"].includes(oe.key)&&(me=me.slice().reverse()),["ArrowUp","ArrowDown"].includes(oe.key)){const he=oe.target,ae=me.indexOf(he);me=me.slice(ae+1)}setTimeout(()=>D(me)),oe.preventDefault()}})})})})})})});_ge.displayName=WUe;var GUe="SelectItemAlignedPosition",jge=b.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...s}=t,i=nv(r0,n),o=rv(r0,n),[l,c]=b.useState(null),[u,d]=b.useState(null),h=$t(e,C=>d(C)),f=S3(n),p=b.useRef(!1),m=b.useRef(!0),{viewport:v,selectedItem:x,selectedItemText:g,focusSelectedItem:w}=o,_=b.useCallback(()=>{if(i.trigger&&i.valueNode&&l&&u&&v&&x&&g){const C=i.trigger.getBoundingClientRect(),k=u.getBoundingClientRect(),E=i.valueNode.getBoundingClientRect(),P=g.getBoundingClientRect();if(i.dir!=="rtl"){const he=P.left-k.left,ae=E.left-he,re=C.left-ae,L=C.width+re,X=Math.max(L,k.width),ne=window.innerWidth-Xc,Y=BO(ae,[Xc,Math.max(Xc,ne-X)]);l.style.minWidth=L+"px",l.style.left=Y+"px"}else{const he=k.right-P.right,ae=window.innerWidth-E.right-he,re=window.innerWidth-C.right-ae,L=C.width+re,X=Math.max(L,k.width),ne=window.innerWidth-Xc,Y=BO(ae,[Xc,Math.max(Xc,ne-X)]);l.style.minWidth=L+"px",l.style.right=Y+"px"}const T=f(),M=window.innerHeight-Xc*2,R=v.scrollHeight,A=window.getComputedStyle(u),I=parseInt(A.borderTopWidth,10),D=parseInt(A.paddingTop,10),O=parseInt(A.borderBottomWidth,10),z=parseInt(A.paddingBottom,10),B=I+D+R+z+O,G=Math.min(x.offsetHeight*5,B),U=window.getComputedStyle(v),F=parseInt(U.paddingTop,10),W=parseInt(U.paddingBottom,10),Q=C.top+C.height/2-Xc,K=M-Q,fe=x.offsetHeight/2,oe=x.offsetTop+fe,ye=I+D+oe,le=B-ye;if(ye<=Q){const he=T.length>0&&x===T[T.length-1].ref.current;l.style.bottom="0px";const ae=u.clientHeight-v.offsetTop-v.offsetHeight,re=Math.max(K,fe+(he?W:0)+ae+O),L=ye+re;l.style.height=L+"px"}else{const he=T.length>0&&x===T[0].ref.current;l.style.top="0px";const re=Math.max(Q,I+v.offsetTop+(he?F:0)+fe)+le;l.style.height=re+"px",v.scrollTop=ye-Q+v.offsetTop}l.style.margin=`${Xc}px 0`,l.style.minHeight=G+"px",l.style.maxHeight=M+"px",r==null||r(),requestAnimationFrame(()=>p.current=!0)}},[f,i.trigger,i.valueNode,l,u,v,x,g,i.dir,r]);ys(()=>_(),[_]);const[j,N]=b.useState();ys(()=>{u&&N(window.getComputedStyle(u).zIndex)},[u]);const S=b.useCallback(C=>{C&&m.current===!0&&(_(),w==null||w(),m.current=!1)},[_,w]);return a.jsx(XUe,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:p,onScrollButtonChange:S,children:a.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:j},children:a.jsx(et.div,{...s,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});jge.displayName=GUe;var YUe="SelectPopperPosition",i8=b.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=Xc,...i}=t,o=N3(n);return a.jsx(o3,{...o,...i,ref:e,align:r,collisionPadding:s,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)"}})});i8.displayName=YUe;var[XUe,i9]=Fj(r0,{}),a8="SelectViewport",Sge=b.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...s}=t,i=rv(a8,n),o=i9(a8,n),l=$t(e,i.onViewportChange),c=b.useRef(0);return a.jsxs(a.Fragment,{children:[a.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:r}),a.jsx(j3.Slot,{scope:n,children:a.jsx(et.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:ze(s.onScroll,u=>{const d=u.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:f}=o;if(f!=null&&f.current&&h){const p=Math.abs(c.current-d.scrollTop);if(p>0){const m=window.innerHeight-Xc*2,v=parseFloat(h.style.minHeight),x=parseFloat(h.style.height),g=Math.max(v,x);if(g<m){const w=g+p,_=Math.min(m,w),j=w-_;h.style.height=_+"px",h.style.bottom==="0px"&&(d.scrollTop=j>0?j:0,h.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});Sge.displayName=a8;var Nge="SelectGroup",[JUe,QUe]=Fj(Nge),ZUe=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,s=Ml();return a.jsx(JUe,{scope:n,id:s,children:a.jsx(et.div,{role:"group","aria-labelledby":s,...r,ref:e})})});ZUe.displayName=Nge;var Cge="SelectLabel",kge=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,s=QUe(Cge,n);return a.jsx(et.div,{id:s.id,...r,ref:e})});kge.displayName=Cge;var UO="SelectItem",[eqe,Age]=Fj(UO),Ege=b.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:i,...o}=t,l=nv(UO,n),c=rv(UO,n),u=l.value===r,[d,h]=b.useState(i??""),[f,p]=b.useState(!1),m=$t(e,w=>{var _;return(_=c.itemRefCallback)==null?void 0:_.call(c,w,r,s)}),v=Ml(),x=b.useRef("touch"),g=()=>{s||(l.onValueChange(r),l.onOpenChange(!1))};if(r==="")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 a.jsx(eqe,{scope:n,value:r,disabled:s,textId:v,isSelected:u,onItemTextChange:b.useCallback(w=>{h(_=>_||((w==null?void 0:w.textContent)??"").trim())},[]),children:a.jsx(j3.ItemSlot,{scope:n,value:r,disabled:s,textValue:d,children:a.jsx(et.div,{role:"option","aria-labelledby":v,"data-highlighted":f?"":void 0,"aria-selected":u&&f,"data-state":u?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...o,ref:m,onFocus:ze(o.onFocus,()=>p(!0)),onBlur:ze(o.onBlur,()=>
881p(!1)),onClick:ze(o.onClick,()=>{x.current!=="mouse"&&g()}),onPointerUp:ze(o.onPointerUp,()=>{x.current==="mouse"&&g()}),onPointerDown:ze(o.onPointerDown,w=>{x.current=w.pointerType}),onPointerMove:ze(o.onPointerMove,w=>{var _;x.current=w.pointerType,s?(_=c.onItemLeave)==null||_.call(c):x.current==="mouse"&&w.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ze(o.onPointerLeave,w=>{var _;w.currentTarget===document.activeElement&&((_=c.onItemLeave)==null||_.call(c))}),onKeyDown:ze(o.onKeyDown,w=>{var j;((j=c.searchRef)==null?void 0:j.current)!==""&&w.key===" "||($Ue.includes(w.key)&&g(),w.key===" "&&w.preventDefault())})})})})});Ege.displayName=UO;var iN="SelectItemText",Tge=b.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:s,...i}=t,o=nv(iN,n),l=rv(iN,n),c=Age(iN,n),u=qUe(iN,n),[d,h]=b.useState(null),f=$t(e,g=>h(g),c.onItemTextChange,g=>{var w;return(w=l.itemTextRefCallback)==null?void 0:w.call(l,g,c.value,c.disabled)}),p=d==null?void 0:d.textContent,m=b.useMemo(()=>a.jsx("option",{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:v,onNativeOptionRemove:x}=u;return ys(()=>(v(m),()=>x(m)),[v,x,m]),a.jsxs(a.Fragment,{children:[a.jsx(et.span,{id:c.textId,...i,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Lc.createPortal(i.children,o.valueNode):null]})});Tge.displayName=iN;var Pge="SelectItemIndicator",Mge=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return Age(Pge,n).isSelected?a.jsx(et.span,{"aria-hidden":!0,...r,ref:e}):null});Mge.displayName=Pge;var o8="SelectScrollUpButton",Rge=b.forwardRef((t,e)=>{const n=rv(o8,t.__scopeSelect),r=i9(o8,t.__scopeSelect),[s,i]=b.useState(!1),o=$t(e,r.onScrollButtonChange);return ys(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollTop>0;i(u)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),s?a.jsx(Ige,{...t,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});Rge.displayName=o8;var l8="SelectScrollDownButton",Oge=b.forwardRef((t,e)=>{const n=rv(l8,t.__scopeSelect),r=i9(l8,t.__scopeSelect),[s,i]=b.useState(!1),o=$t(e,r.onScrollButtonChange);return ys(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)<u;i(d)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),s?a.jsx(Ige,{...t,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});Oge.displayName=l8;var Ige=b.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=t,i=rv("SelectScrollButton",n),o=b.useRef(null),l=S3(n),c=b.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return b.useEffect(()=>()=>c(),[c]),ys(()=>{var d;const u=l().find(h=>h.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[l]),a.jsx(et.div,{"aria-hidden":!0,...s,ref:e,style:{flexShrink:0,...s.style},onPointerDown:ze(s.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:ze(s.onPointerMove,()=>{var u;(u=i.onItemLeave)==null||u.call(i),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:ze(s.onPointerLeave,()=>{c()})})}),tqe="SelectSeparator",Dge=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return a.jsx(et.div,{"aria-hidden":!0,...r,ref:e})});Dge.displayName=tqe;var c8="SelectArrow",nqe=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,s=N3(n),i=nv(c8,n),o=rv(c8,n);return i.open&&o.position==="popper"?a.jsx(l3,{...s,...r,ref:e}):null});nqe.displayName=c8;var rqe="SelectBubbleInput",Lge=b.forwardRef(({__scopeSelect:t,value:e,...n},r)=>{const s=b.useRef(null),i=$t(r,s),o=_3(e);return b.useEffect(()=>{const l=s.current;if(!l)return;const c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(o!==e&&d){const h=new Event("change",{bubbles:!0});d.call(l,e),l.dispatchEvent(h)}},[o,e]),a.jsx(et.select,{...n,style:{...ofe,...n.style},ref:i,defaultValue:e})});Lge.displayName=rqe;function Fge(t){return t===""||t===void 0}function $ge(t){const e=ho(t),n=b.useRef(""),r=b.useRef(0),s=b.useCallback(o=>{const l=n.current+o;e(l),function c(u){n.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>c(""),1e3))}(l)},[e]),i=b.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return b.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,i]}
881function zge(t,e,n){const s=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let o=sqe(t,Math.max(i,0));s.length===1&&(o=o.filter(u=>u!==n));const c=o.find(u=>u.textValue.toLowerCase().startsWith(s.toLowerCase()));return c!==n?c:void 0}function sqe(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var iqe=fge,Bge=mge,aqe=vge,oqe=xge,lqe=yge,Uge=bge,cqe=Sge,qge=kge,Vge=Ege,uqe=Tge,dqe=Mge,Hge=Rge,Wge=Oge,Kge=Dge;const lt=iqe,ct=aqe,nt=b.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(Bge,{ref:r,className:Fe("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",t),...n,children:[e,a.jsx(oqe,{asChild:!0,children:a.jsx(wh,{className:"h-4 w-4 opacity-50"})})]}));nt.displayName=Bge.displayName;const Gge=b.forwardRef(({className:t,...e},n)=>a.jsx(Hge,{ref:n,className:Fe("flex cursor-default items-center justify-center py-1",t),...e,children:a.jsx(Mfe,{className:"h-4 w-4"})}));Gge.displayName=Hge.displayName;const Yge=b.forwardRef(({className:t,...e},n)=>a.jsx(Wge,{ref:n,className:Fe("flex cursor-default items-center justify-center py-1",t),...e,children:a.jsx(wh,{className:"h-4 w-4"})}));Yge.displayName=Wge.displayName;const rt=b.forwardRef(({className:t,children:e,position:n="popper",...r},s)=>a.jsx(lqe,{children:a.jsxs(Uge,{ref:s,className:Fe("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...r,children:[a.jsx(Gge,{}),a.jsx(cqe,{className:Fe("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),a.jsx(Yge,{})]})}));rt.displayName=Uge.displayName;const hqe=b.forwardRef(({className:t,...e},n)=>a.jsx(qge,{ref:n,className:Fe("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...e}));hqe.displayName=qge.displayName;const Ae=b.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(Vge,{ref:r,className:Fe("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",t),...n,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(dqe,{children:a.jsx(Ma,{className:"h-4 w-4"})})}),a.jsx(uqe,{children:e})]}));Ae.displayName=Vge.displayName;const fqe=b.forwardRef(({className:t,...e},n)=>a.jsx(Kge,{ref:n,className:Fe("-mx-1 my-1 h-px bg-muted",t),...e}));fqe.displayName=Kge.displayName;const pqe=[{code:"ES",label:"Espagne"},{code:"FR",label:"France"},{code:"BE",label:"Belgique"},{code:"LU",label:"Luxembourg"},{code:"CH",label:"Suisse"},{code:"DE",label:"Allemagne"},{code:"IT",label:"Italie"},{code:"PT",label:"Portugal"},{code:"NL",label:"Pays-Bas"},{code:"AT",label:"Autriche"},{code:"GB",label:"Royaume-Uni"},{code:"IE",label:"Irlande"},{code:"DK",label:"Danemark"},{code:"SE",label:"Suède"},{code:"NO",label:"Norvège"},{code:"FI",label:"Finlande"}],Xge=pqe;function Jge(t){const e=t.toUpperCase();return e==="ES"?[{id:"correos-es",name:"Correos â Livraison à domicile",price:5,days:"2-4 jours ouvrés",estimateMin:2,estimateMax:4},{id:"relay-es",name:"Relais colis",price:4,days:"3-5 jours ouvrés",estimateMin:3,estimateMax:5}]:e==="FR"?[{id:"correos-eu",name:"Correos â Livraison à domicile",price:12,days:"5-7 jours ouvrés",estimateMin:5,estimateMax:7},{id:"relay-fr",name:"Relais colis",price:6,days:"4-6 jours ouvrés",estimateMin:4,estimateMax:6}]:[{id:"correos-eu",name:"Correos â Livraison à domicile",price:12,days:"5-7 jours ouvrés",estimateMin:5,estimateMax:7}]}const U$=21;function Qge(t,e=0){const n=new Map;for(const o of t){const l=o.tax_rate||21,c=o.price*o.quantity,u=c/(1+l/100),d=c-u,h=n.get(l)||{base_ht:0,tax_amount:0};h.base_ht+=u,h.tax_amount+=d,n.set(l,h)}if(e>0){const o=e/(1+U$/100),l=e-o,c=n.get(U$)||{base_ht:0,tax_amount:0};c.base_ht+=o,c.tax_amount+=l,n.set(U$,c)}const r=Array.from(n.entries()).map(([o,{base_ht:l,tax_amount:c}])=>({rate:o,base_ht:Math.round(l*100)/100,tax_amount:Math.round(c*100)/100})).sort((o,l)=>o.rate-l.rate),s=r.reduce((o,l)=>o+l.base_ht,0),i=r.reduce((o,l)=>o+l.tax_amount,0);return{lines:r,total_ht:Math.round(s*100)/100,total_tax:Math.round(i*100)/100,total_ttc:Math.round((s+i)*100)/100}}const ib=t=>t.toFixed(2).replace(".",",")+" â¬",mqe=({open:t,onOpenChange:e})=>{const{items:n,updateQuantity:r,removeItem:s,total:i,itemCount:o}=tv(),[l,c]=b.useState("ES"),[u,d]=b.useState(""),h=n.some(_=>_.format==="papier"||_.product_type!=="digital"&&_.product_type!=="experience"&&_.format!=="pdf"),f=b.useMemo(()=>Jge(l),[l]),p=_=>{c(_),d("")},m=f.find(_=>_.id===u),v=h&&m?m.price:0,x=i+v,g=b.useMemo(()=>Qge(n.map(_=>({price:_.price*_.quantity,quantity:1,tax_rate:_.tax_rate||21})),v),[n,v]),w=!h||!!u;return a.jsx(Dj,{open:t,onOpenChange:e,children:a.jsxs(P0,{side:"right",className:"flex w-full flex-col sm:w-96",children:[a.jsx(l2,{className:"border-b border-border pb-4",children:a.jsxs(c2,{className:"flex items-center gap-2 font-heading",children:[a.jsx(Wi,{className:"h-5 w-5"}),"Panier (",o,")"]})}),n.length===0?a.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-3 text-muted-foreground",children:[a.jsx(Wi,{className:"h-12 w-12 opacity-30"}),a.jsx("p",{className:"text-sm",children:"Votre panier est vide"}),a.jsx(H,{variant:"outline",size:"sm",asChild:!0,onClick:()=>e(!1),children:a.jsx(_e,{to:"/boutique",children:"Découvrir la boutique"})})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"flex-1 overflow-y-auto py-4 space-y-3",children:n.map(_=>a.jsxs("div",{className:"flex gap-3 rounded-lg border border-border bg-card p-3",children:[a.jsx("div",{className:"h-14 w-14 shrink-0 overflow-hidden rounded-md bg-muted",children:_.image?a.jsx("img",{src:_.image,alt:_.name,className:"h-full w-full object-cover"}):a.jsx("div",{className:"flex h-full items-center justify-center",children:a.jsx(Wi,{className:"h-4 w-4 text-muted-foreground"})})}),a.jsxs("div",{className:"flex flex-1 flex-col gap-1.5 min-w-0",children:[a.jsxs("div",{className:"flex items-start justify-between gap-1",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-sm font-medium leading-tight truncate",children:_.name}),_.variant_name&&a.jsx("p",{className:"text-xs text-muted-foreground truncate",children:_.variant_name})]}),a.jsx(H,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0 text-muted-foreground hover:text-destructive",onClick:()=>s(_.variant_id),children:a.jsx(ks,{className:"h-3 w-3"})})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(H,{variant:"outline",size:"icon",className:"h-6 w-6",onClick:()=>r(_.variant_id,_.quantity-1),children:a.jsx(n3,{className:"h-2.5 w-2.5"})}),a.jsx("span",{className:"w-5 text-center text-xs font-medium",children:_.quantity}),a.jsx(H,{variant:"outline",size:"icon",className:"h-6 w-6",onClick:()=>r(_.variant_id,_.quantity+1),children:a.jsx(dr,{className:"h-2.5 w-2.5"})})]}),a.jsx("span",{className:"text-sm font-bold text-primary",children:ib(_.price*_.quantity)})]})]})]},_.variant_id))}),a.jsxs("div",{className:"border-t border-border pt-4 space-y-3",children:[h?a.jsxs("div",{className:"space-y-2.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5 text-sm font-medium",children:[a.jsx(_r,{className:"h-4 w-4 text-muted-foreground"}),"Livraison"]}),a.jsxs(lt,{value:l,onValueChange:p,children:[a.jsx(nt,{className:"h-8 text-xs",children:a.jsx(ct,{placeholder:"Pays de destination"})}),a.jsx(rt,{children:Xge.map(_=>a.jsx(Ae,{value:_.code,children:_.label},_.code))})]}),a.jsx("div",{className:"space-y-1.5",children:f.map(_=>a.jsxs("button",{onClick:()=>d(_.id),className:`w-full flex items-center gap-2.5 rounded-lg border p-2.5 text-left transition-colors text-xs ${u===_.id?"border-primary bg-primary/5 ring-1 ring-primary":"border-border hover:border-primary/40"}`,children:[a.jsx(Pw,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"font-medium truncate",children:_.name}),a.jsx("p",{className:"text-muted-foreground",children:_.days})]}),a.jsx("span",{className:"font-bold text-sm whitespace-nowrap",children:ib(_.price)})]},_.id))}),!u&&a.jsx("p",{className:"text-xs text-amber-600",children:"Veuillez choisir un mode de livraison"})]}):a.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground rounded-lg border border-border p-2.5",children:[a.jsx(Ts,{className:"h-4 w-4 shrink-0"}),a.jsx("span",{children:"Téléchargement immédiat â Pas de frais de livraison"})]}),a.jsxs("div",{className:"space-y-1 text-sm",children:[a.jsxs("div",{className:"flex justify-between text-muted-foreground",children:[a.jsx("span",{children:"Sous-total HT"}),a.jsx("span",{children:ib(g.total_ht)})]}),g.lines.map(_=>a.jsxs("div",{className:"flex justify-between text-muted-foreground",children:[a.jsxs("span",{children:["IVA ",_.rate,"%"]}),a.jsx("span",{children:ib(_.tax_amount)})]},_.rate)),h&&m&&a.jsxs("div",{className:"flex justify-between text-muted-foreground",children:[a.jsx("span",{children:"Livraison"}),a.jsx("span",{children:ib(v)})]}),a.jsxs("div",{className:"flex justify-between font-heading text-base font-bold pt-1 border-t border-border",children:[a.jsx("span",{children:"Total TTC"}),a.jsx("span",{className:"text-primary",children:ib(x)})]}),a.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:"Prix TVA incluse â IVA incluido"})]}),a.jsx(H,{size:"lg",className:"w-full rounded-xl bg-[#C8962E] hover:bg-[#b8862a] text-white",asChild:!0,onClick:()=>e(!1),disabled:!w,children:a.jsx(_e,{to:`/boutique/panier?country=${l}&shipping=${u}`,children:"Commander"})})]})]})]})})},q$=[{lang:"fr",flag:"ð«ð·",code:"FR",label:"Français"},{lang:"en",flag:"ð¬ð§",code:"EN",label:"English"}],gqe=({className:t=""})=>{const{lang:e,setLang:n}=Uu(),[r,s]=b.useState(!1),i=b.useRef(null);b.useEffect(()=>{if(!r)return;const l=u=>{i.current&&!i.current.contains(u.target)&&s(!1)},c=u=>{u.key==="Escape"&&s(!1)};return document.addEventListener("pointerdown",l),document.addEventListener("keydown",c),()=>{document.removeEventListener("pointerdown",l),document.removeEventListener("keydown",c)}},[r]);const o=q$.find(l=>l.lang===e)??q$[0];return a.jsxs("div",{ref:i,className:`relative ${t}`,children:[a.jsxs("button",{type:"button",onClick:()=>s(l=>!l),"aria-haspopup":"listbox","aria-expanded":r,"aria-label":"Langue / Language",className:"flex items-center gap-1.5 rounded-lg border border-border px-2.5 py-1.5 text-xs font-medium text-foreground transition-colors hover:bg-muted",children:[a.jsx("span",{"aria-hidden":"true",className:"text-sm leading-none",children:o.flag}),a.jsx("span",{className:"hidden sm:inline",children:o.code}),a.jsx(wh,{className:`h-3.5 w-3.5 text-muted-foreground transition-transform duration-200 ${r?"rotate-180":""}`,"aria-hidden":"true"})]}),r&&a.jsx("div",{role:"listbox","aria-label":"Choisir la langue / Choose language",className:"absolute right-0 top-full z-50 mt-1.5 w-40 overflow-hidden rounded-lg border border-border bg-background shadow-lg",children:q$.map(l=>{const c=l.lang===e;return a.jsxs("button",{type:"button",role:"option","aria-selected":c,onClick:()=>{s(!1),c||n(l.lang)},className:`flex w-full items-center gap-2.5 px-3 py-2.5 text-sm transition-colors hover:bg-muted ${c?"font-semibold text-primary":"text-foreground"}`,children:[a.jsx("span",{"aria-hidden":"true",className:"text-base leading-none",children:l.flag}),a.jsx("span",{className:"flex-1 text-left",children:l.label}),c&&a.jsx(Ma,{className:"h-4 w-4 text-primary","aria-hidden":"true"})]},l.lang)})})]})},qO="/assets/logo-black-DHoF_4N4.png",V$=[{label:"Actualités",href:"/actualites"},{label:"Nos Magazines",href:"/nos-magazines"},{label:"Carte Privilège",href:"/carte-privilege"},{label:"Carnet des Pros",href:"/annuaire"},{label:"Carnets d'adresses",href:"https://tufaisquoi.com/carnet-adresses",external:!0},{label:"Boutique",href:"/boutique"},{label:"Contact",href:"/contact"}],vqe=()=>{var m,v;const t=xo(),e=Gs(),[n,r]=b.useState(!1),[s,i]=b.useState(!1),[o,l]=b.useState(!1),{itemCount:c}=tv();b.useEffect(()=>{const x=g=>{(g.ctrlKey||g.metaKey)&&g.key.toLowerCase()==="k"&&(g.preventDefault(),l(!0))};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[]);const{user:u,profile:d,signOut:h}=Ji(),f=d?`${d.first_name||""} ${d.last_name||""}`.trim()||d.full_name||((m=u==null?void 0:u.email)==null?void 0:m.split("@")[0]):(v=u==null?void 0:u.email)==null?void 0:v.split("@")[0],p=async()=>{await h(),e("/")};return a.jsxs(a.Fragment,{children:[a.jsxs("header",{className:"sticky top-0 z-50 border-b border-border bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80",children:[a.jsxs("div",{className:"container flex h-16 items-center justify-between md:h-20",children:[a.jsx(_e,{to:"/",className:"flex items-center","aria-label":"Esprit Sud Magazine â Accueil",children:a.jsx("img",{src:qO,alt:"Esprit Sud Magazine",className:"h-8 w-auto md:h-10"})}),a.jsx("nav",{className:"hidden items-center gap-1 lg:flex",children:V$.map(x=>x.external?a.jsx("a",{href:x.href,target:"_blank",rel:"noopener noreferrer",className:"rounded-lg px-3 py-2 text-sm font-medium text-muted-foreground transition-colors hover:bg-muted",children:x.label},x.href):a.jsx(_e,{to:x.href,className:`rounded-lg px-3 py-2 text-sm font-medium transition-colors hover:bg-muted ${t.pathname.startsWith(x.href)?"text-primary":"text-muted-foreground"}`,children:x.label},x.href))}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(gqe,{}),a.jsx(H,{variant:"ghost",size:"icon",className:"text-muted-foreground",onClick:()=>l(!0),"aria-label":"Rechercher",children:a.jsx(is,{className:"h-5 w-5"})}),a.jsxs(H,{variant:"ghost",size:"icon",className:"relative text-muted-foreground",onClick:()=>i(!0),"aria-label":"Panier",children:[a.jsx($f,{className:"h-5 w-5","aria-hidden":"true"}),c>0&&a.jsx(ke,{className:"absolute -right-1 -top-1 flex h-5 w-5 items-center justify-center rounded-full bg-accent p-0 text-[10px] text-accent-foreground",children:c})]}),u?a.jsxs(uge,{children:[a.jsx(dge,{asChild:!0,children:a.jsxs(H,{variant:"outline",size:"sm",className:"hidden gap-1.5 sm:flex",children:[a.jsx(qv,{className:"h-4 w-4"}),a.jsx("span",{className:"max-w-[120px] truncate",children:f}),a.jsx(wh,{className:"h-3 w-3 opacity-50"})]})}),a.jsxs(s9,{align:"end",className:"w-52",children:[a.jsx(Vv,{asChild:!0,children:a.jsxs(_e,{to:"/mon-compte",className:"flex items-center gap-2",children:[a.jsx(qv,{className:"h-4 w-4"})," Mon compte"]})}),a.jsx(Vv,{asChild:!0,children:a.jsxs(_e,{to:"/mon-compte",className:"flex items-center gap-2",children:[a.jsx(e3,{className:"h-4 w-4"})," Mes favoris"]})}),a.jsx(Vv,{asChild:!0,children:a.jsxs(_e,{to:"/mon-compte",className:"flex items-center gap-2",children:[a.jsx(Wi,{className:"h-4 w-4"})," Mes commandes"]})}),a.jsx(Vv,{asChild:!0,children:a.jsxs(_e,{to:"/carte-privilege/mon-espace",className:"flex items-center gap-2",children:[a.jsx(Jo,{className:"h-4 w-4"})," Ma Carte Privilège"]})}),a.jsx(hge,{}),a.jsxs(Vv,{onClick:p,className:"flex items-center gap-2 text-destructive focus:text-destructive",children:[a.jsx(UQ,{className:"h-4 w-4"})," Se déconnecter"]})]})]}):a.jsx(H,{variant:"outline",size:"sm",className:"hidden sm:flex",asChild:!0,children:a.jsxs(_e,{to:"/login",children:[a.jsx(qv,{className:"mr-2 h-4 w-4"})," Se connecter"]})}),a.jsxs(Dj,{open:n,onOpenChange:r,children:[a.jsx(XW,{asChild:!0,children:a.
881jsx(H,{variant:"ghost",size:"icon",className:"lg:hidden","aria-label":"Menu",children:a.jsx($fe,{className:"h-5 w-5","aria-hidden":"true"})})}),a.jsx(P0,{side:"right",className:"w-72",children:a.jsxs("nav",{className:"mt-8 flex flex-col gap-1",children:[V$.map(x=>x.external?a.jsx("a",{href:x.href,target:"_blank",rel:"noopener noreferrer",onClick:()=>r(!1),className:"rounded-lg px-4 py-3 text-base font-medium text-foreground transition-colors hover:bg-muted",children:x.label},x.href):a.jsx(_e,{to:x.href,onClick:()=>r(!1),className:`rounded-lg px-4 py-3 text-base font-medium transition-colors hover:bg-muted ${t.pathname.startsWith(x.href)?"bg-muted text-primary":"text-foreground"}`,children:x.label},x.href)),a.jsx("hr",{className:"my-2"}),a.jsxs("button",{onClick:()=>{r(!1),i(!0)},className:"flex items-center gap-2 rounded-lg px-4 py-3 text-base font-medium text-foreground hover:bg-muted text-left",children:[a.jsx($f,{className:"h-4 w-4"})," Panier ",c>0&&`(${c})`]}),u?a.jsxs(a.Fragment,{children:[a.jsxs(_e,{to:"/mon-compte",onClick:()=>r(!1),className:"flex items-center gap-2 rounded-lg px-4 py-3 text-base font-medium text-foreground hover:bg-muted",children:[a.jsx(qv,{className:"h-4 w-4"})," Mon compte"]}),a.jsxs("button",{onClick:()=>{r(!1),p()},className:"flex items-center gap-2 rounded-lg px-4 py-3 text-left text-base font-medium text-destructive hover:bg-muted",children:[a.jsx(UQ,{className:"h-4 w-4"})," Se déconnecter"]})]}):a.jsxs(_e,{to:"/login",onClick:()=>r(!1),className:"flex items-center gap-2 rounded-lg px-4 py-3 text-base font-medium text-foreground hover:bg-muted",children:[a.jsx(qv,{className:"h-4 w-4"})," Se connecter"]})]})})]})]})]}),a.jsx("div",{className:"border-t border-border bg-background/95 backdrop-blur lg:hidden",children:a.jsx("div",{className:"container",children:a.jsx("nav",{"aria-label":"Menu principal",className:"flex items-center gap-1 overflow-x-auto scrollbar-hide py-2",children:V$.map(x=>x.external?a.jsx("a",{href:x.href,target:"_blank",rel:"noopener noreferrer",className:"shrink-0 rounded-lg px-3 py-2 text-sm font-medium text-muted-foreground transition-colors hover:bg-muted",children:x.label},x.href):a.jsx(_e,{to:x.href,className:`shrink-0 rounded-lg px-3 py-2 text-sm font-medium transition-colors hover:bg-muted ${t.pathname.startsWith(x.href)?"text-primary":"text-muted-foreground"}`,children:x.label},x.href))})})})]}),a.jsx(mqe,{open:s,onOpenChange:i}),a.jsx(l6e,{open:o,onClose:()=>l(!1)})]})},a9="/assets/logo-white-nwAZNQR0.png",H$={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_LOVABLE_CONNECTOR_GOOGLE_MAPS_BROWSER_KEY:"AIzaSyAaNoOWSDXiB9DbWDLSklRFzVAeh_atBII",VITE_SUPABASE_ANON_KEY:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImFhbmpraG95emN2aG9renNtaWZ1Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzU0ODIxMTgsImV4cCI6MjA5MTA1ODExOH0.FZffw1trnRiA182HIsLL4uQALqBG6SHIIttPS-tq-Qo",VITE_SUPABASE_PROJECT_ID:"aanjkhoyzcvhokzsmifu",VITE_SUPABASE_PUBLISHABLE_KEY:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImFhbmpraG95emN2aG9renNtaWZ1Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzU0ODIxMTgsImV4cCI6MjA5MTA1ODExOH0.FZffw1trnRiA182HIsLL4uQALqBG6SHIIttPS-tq-Qo",VITE_SUPABASE_URL:"https://aanjkhoyzcvhokzsmifu.supabase.co"},Zge="cookie_consent",u8="open-cookie-prefs";function LM(){try{const t=localStorage.getItem(Zge);return t?JSON.parse(t):null}catch{return null}}function W$(t){const e={...t,date:new Date().toISOString().slice(0,10)};localStorage.setItem(Zge,JSON.stringify(e)),t.analytics&&eve(),window.dispatchEvent(new CustomEvent("cookie-consent-change",{detail:e}))}function xqe(){window.dispatchEvent(new Event(u8))}let vZ=!1;function eve(){if(vZ)return;const t=H$==null?void 0:H$.VITE_GA_ID;if(!t)return;vZ=!0;const e=document.createElement("script");e.async=!0,e.src=`https://www.googletagmanager.com/gtag/js?id=${t}`,document.head.appendChild(e);const n=document.createElement("script");n.innerHTML=`window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}gtag('js', new Date());gtag('config', '${t}', { anonymize_ip: true });`,document.head.appendChild(n)}const ue=b.forwardRef(({className:t,type:e,...n},r)=>a.jsx("input",{type:e,className:Fe("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",t),ref:r,...n}));ue.displayName="Input";function yqe(t,e,n){const r=t.trim().toLowerCase();return Z.from("newsletter_subscribers").insert({email:r,source:e,first_name:(n==null?void 0:n.trim())||null,is_active:!0})}function tve({source:t,variant:e="default",showFirstName:n=!1,className:r}){const[s,i]=b.useState(""),[o,l]=b.useState(""),[c,u]=b.useState(!1),d=async h=>{if(h.preventDefault(),!s)return;u(!0);const{error:f}=await yqe(s,t,n?o:null);if(u(!1),f){const p=(f.message||"").toLowerCase();if(p.includes("duplicate")||p.includes("unique")||f.code==="23505"){ee.info("Vous êtes déjà inscrit !"),i("");return}ee.error("Erreur lors de l'inscription");return}ee.success("Merci ! Vous êtes inscrit à notre newsletter."),i(""),l("")};return e==="compact"?a.jsxs("form",{onSubmit:d,className:`flex gap-2 ${r??""}`,children:[a.jsx(ue,{type:"email",required:!0,value:s,onChange:h=>i(h.target.value),placeholder:"[email protected]",className:"h-10 flex-1 bg-white/10 border-white/20 text-white placeholder:text-white/70"}),a.jsx(H,{type:"submit",size:"icon",disabled:c,"aria-label":"S'inscrire",className:"shrink-0",children:a.jsx(Jf,{className:"h-4 w-4"})})]}):e==="full"?a.jsxs("form",{onSubmit:d,className:`space-y-3 ${r??""}`,children:[n&&a.jsx(ue,{value:o,onChange:h=>l(h.target.value),placeholder:"Prénom (optionnel)",className:"h-12"}),a.jsx(ue,{type:"email",required:!0,value:s,onChange:h=>i(h.target.value),placeholder:"[email protected]",className:"h-12"}
881),a.jsx(H,{type:"submit",size:"lg",disabled:c,className:"w-full",children:c?"Inscription...":"S'inscrire"}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["En vous inscrivant, vous acceptez notre ",a.jsx(_e,{to:"/politique-confidentialite",className:"underline",children:"politique de confidentialité"}),"."]})]}):a.jsxs("form",{onSubmit:d,className:`flex flex-col gap-3 sm:flex-row ${r??""}`,children:[a.jsx(ue,{type:"email",required:!0,value:s,onChange:h=>i(h.target.value),placeholder:"[email protected]",className:"h-12 rounded-full border-white/30 bg-white text-foreground"}),a.jsx(H,{type:"submit",size:"lg",disabled:c,className:"shrink-0 rounded-full bg-foreground text-background hover:bg-foreground/90",children:c?"...":"S'inscrire"})]})}const bqe=()=>a.jsx("footer",{className:"border-t border-border bg-[#1A1A1A] text-white/80",children:a.jsxs("div",{className:"container py-14 md:py-20",children:[a.jsxs("div",{className:"grid gap-10 md:grid-cols-2 lg:grid-cols-4",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsx("img",{src:a9,alt:"Esprit Sud Magazine",className:"h-10 w-auto"}),a.jsx("p",{className:"text-sm leading-relaxed",children:"Le magazine francophone de référence sur l'Andalousie. Actualités, guides de voyage et art de vivre."}),a.jsxs("div",{className:"flex gap-3 pt-2",children:[a.jsx("a",{href:"https://www.facebook.com/espritsud.mag",target:"_blank",rel:"noopener noreferrer","aria-label":"Facebook",className:"rounded-full bg-white/10 p-2 text-white transition-colors hover:bg-white/20",children:a.jsx(L$e,{className:"h-4 w-4"})}),a.jsx("a",{href:"https://www.instagram.com/espritsudmagazine/",target:"_blank",rel:"noopener noreferrer","aria-label":"Instagram",className:"rounded-full bg-white/10 p-2 text-white transition-colors hover:bg-white/20",children:a.jsx(J$e,{className:"h-4 w-4"})}),a.jsx("a",{href:"https://aanjkhoyzcvhokzsmifu.supabase.co/functions/v1/rss-feed",target:"_blank",rel:"noopener noreferrer","aria-label":"Flux RSS",className:"rounded-full bg-white/10 p-2 text-white transition-colors hover:bg-white/20",children:a.jsx(p5e,{className:"h-4 w-4"})})]})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("h3",{className:"text-sm font-semibold uppercase tracking-wider text-white",children:"Le magazine"}),a.jsxs("nav",{className:"flex flex-col gap-2 text-sm",children:[a.jsx(_e,{to:"/actualites",className:"transition-colors hover:text-white",children:"Actualités"}),a.jsx(_e,{to:"/nos-magazines",className:"transition-colors hover:text-white",children:"Nos magazines"}),a.jsx(_e,{to:"/destinations",className:"transition-colors hover:text-white",children:"Destinations"}),a.jsx(_e,{to:"/carnet-adresses",className:"transition-colors hover:text-white",children:"Carnet d'adresses"}),a.jsx(_e,{to:"/annuaire",className:"transition-colors hover:text-white",children:"Carnet d'adresses des Pros"}),a.jsx(_e,{to:"/evenements",className:"transition-colors hover:text-white",children:"Agenda"})]})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("h3",{className:"text-sm font-semibold uppercase tracking-wider text-white",children:"Services"}),a.jsxs("nav",{className:"flex flex-col gap-2 text-sm",children:[a.jsx(_e,{to:"/boutique",className:"transition-colors hover:text-white",children:"Boutique"}),a.jsx(_e,{to:"/carte-privilege",className:"transition-colors hover:text-white",children:"Carte Privilège"}),a.jsx(_e,{to:"/points-de-depot",className:"transition-colors hover:text-white",children:"Points de dépôt"}),a.jsx(_e,{to:"/annonceurs",className:"transition-colors hover:text-white",children:"Annonceurs"}),a.jsx(_e,{to:"/newsletter",className:"transition-colors hover:text-white",children:"Newsletter"})]})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("h3",{className:"text-sm font-semibold uppercase tracking-wider text-white",children:"Informations"}),a.jsxs("nav",{className:"flex flex-col gap-2 text-sm",children:[a.jsx(_e,{to:"/mentions-legales",className:"transition-colors hover:text-white",children:"Mentions légales"}),a.jsx(_e,{to:"/conditions-generales-vente",className:"transition-colors hover:text-white",children:"CGV"}),a.jsx(_e,{to:"/politique-confidentialite",className:"transition-colors hover:text-white",children:"Politique de confidentialité"}),a.jsx(_e,{to:"/politique-cookies",className:"transition-colors hover:text-white",children:"Politique cookies"}),a.jsx("button",{type:"button",onClick:xqe,className:"text-left transition-colors hover:text-white",children:"Gérer les cookies"}),a.jsx(_e,{to:"/contact",className:"transition-colors hover:text-white",children:"Contact"}),a.jsx(_e,{to:"/recrutement",className:"transition-colors hover:text-white",children:"Recrutement"})]})]})]}
881),a.jsxs("div",{className:"mt-10 grid gap-4 rounded-2xl bg-white/5 p-6 md:grid-cols-[1fr_auto] md:items-center",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold uppercase tracking-wider text-white",children:"Newsletter"}),a.jsx("p",{className:"mt-1 text-sm",children:"Recevez nos actualités et bons plans chaque mois."})]}),a.jsx(tve,{source:"footer",variant:"compact",className:"md:min-w-[320px]"})]}),a.jsx("hr",{className:"my-10 border-white/10"}),a.jsxs("nav",{"aria-label":"Langue",className:"mb-4 flex justify-center gap-4 text-xs","data-no-translate":!0,children:[a.jsx("a",{href:"/fr/",hrefLang:"fr",onClick:()=>EO("fr"),className:"text-white/70 hover:text-white",children:"Version française"}),a.jsx("span",{className:"text-white/30",children:"|"}),a.jsx("a",{href:"/en/",hrefLang:"en",onClick:()=>EO("en"),className:"text-white/70 hover:text-white",children:"English version"})]}),a.jsxs("p",{className:"text-center text-xs text-white/70",children:["© ",new Date().getFullYear()," Esprit Sud Magazine. Tous droits réservés."]})]})});var C3="Switch",[wqe,MLt]=Ys(C3),[_qe,jqe]=wqe(C3),nve=b.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:s,defaultChecked:i,required:o,disabled:l,value:c="on",onCheckedChange:u,form:d,...h}=t,[f,p]=b.useState(null),m=$t(e,_=>p(_)),v=b.useRef(!1),x=f?d||!!f.closest("form"):!0,[g,w]=Xo({prop:s,defaultProp:i??!1,onChange:u,caller:C3});return a.jsxs(_qe,{scope:n,checked:g,disabled:l,children:[a.jsx(et.button,{type:"button",role:"switch","aria-checked":g,"aria-required":o,"data-state":ave(g),"data-disabled":l?"":void 0,disabled:l,value:c,...h,ref:m,onClick:ze(t.onClick,_=>{w(j=>!j),x&&(v.current=_.isPropagationStopped(),v.current||_.stopPropagation())})}),x&&a.jsx(ive,{control:f,bubbles:!v.current,name:r,value:c,checked:g,required:o,disabled:l,form:d,style:{transform:"translateX(-100%)"}})]})});nve.displayName=C3;var rve="SwitchThumb",sve=b.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,s=jqe(rve,n);return a.jsx(et.span,{"data-state":ave(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:e})});sve.displayName=rve;var Sqe="SwitchBubbleInput",ive=b.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...s},i)=>{const o=b.useRef(null),l=$t(o,i),c=_3(n),u=a3(e);return b.useEffect(()=>{const d=o.current;if(!d)return;const h=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(h,"checked").set;if(c!==n&&p){const m=new Event("click",{bubbles:r});p.call(d,n),d.dispatchEvent(m)}},[c,n,r]),a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:l,style:{...s.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});ive.displayName=Sqe;function ave(t){return t?"checked":"unchecked"}var ove=nve,Nqe=sve;const _n=b.forwardRef(({className:t,...e},n)=>a.jsx(ove,{className:Fe("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",t),...e,ref:n,children:a.jsx(Nqe,{className:Fe("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")})}));_n.displayName=ove.displayName;function Cqe(){const[t,e]=b.useState(!1),[n,r]=b.useState(!1),[s,i]=b.useState(!1);b.useEffect(()=>{const u=LM();u?u.analytics&&(eve(),i(!0)):e(!0);const d=()=>{const h=LM();i((h==null?void 0:h.analytics)??!1),r(!0)};return window.addEventListener(u8,d),()=>window.removeEventListener(u8,d)},[]);const o=()=>{W$({analytics:!0}),e(!1),r(!1)},l=()=>{W$({analytics:!1}),e(!1),r(!1)},c=()=>{W$({analytics:s}),e(!1),r(!1)};return a.jsxs(a.Fragment,{children:[t&&a.jsx("div",{role:"region","aria-label":"Consentement cookies",className:"fixed inset-x-0 bottom-0 z-[60] border-t border-border bg-background shadow-[0_-8px_24px_-12px_rgba(0,0,0,0.15)]",children:a.jsxs("div",{className:"container flex flex-col gap-3 py-4 md:flex-row md:items-center md:gap-6",children:[a.jsxs("p",{className:"flex-1 text-sm text-foreground",children:["Nous utilisons de
881s cookies pour améliorer votre expérience et analyser le trafic du site."," ",a.jsx(_e,{to:"/politique-cookies",className:"underline hover:no-underline",children:"En savoir plus"})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx("button",{type:"button",onClick:()=>{var u;i(((u=LM())==null?void 0:u.analytics)??!1),r(!0)},className:"text-sm underline hover:no-underline",children:"Personnaliser"}),a.jsx(H,{variant:"outline",size:"sm",onClick:l,children:"Refuser les non-essentiels"}),a.jsx(H,{size:"sm",onClick:o,className:"bg-emerald-600 text-white hover:bg-emerald-700",children:"Tout accepter"})]})]})}),a.jsx(Dj,{open:n,onOpenChange:r,children:a.jsxs(P0,{side:"right",className:"w-full sm:max-w-md",children:[a.jsxs(l2,{children:[a.jsx(c2,{children:"Préférences cookies"}),a.jsx(cme,{children:"Choisissez les catégories de cookies que vous autorisez. Les cookies techniques sont nécessaires au fonctionnement du site."})]}),a.jsxs("div",{className:"mt-6 space-y-4",children:[a.jsxs("div",{className:"flex items-start justify-between gap-4 rounded-lg border border-border p-4",children:[a.jsxs("div",{children:[a.jsx("p",{className:"font-medium",children:"Cookies techniques"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Nécessaires au fonctionnement (session, panier, consentement)."})]}),a.jsx(_n,{checked:!0,disabled:!0})]}),a.jsxs("div",{className:"flex items-start justify-between gap-4 rounded-lg border border-border p-4",children:[a.jsxs("div",{children:[a.jsx("p",{className:"font-medium",children:"Cookies analytiques"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Google Analytics â statistiques de fréquentation anonymisées."})]}),a.jsx(_n,{checked:s,onCheckedChange:i})]})]}),a.jsxs(lme,{className:"mt-6 flex-col gap-2 sm:flex-row",children:[a.jsx(H,{variant:"outline",onClick:l,className:"w-full sm:w-auto",children:"Refuser tout"}),a.jsx(H,{onClick:c,className:"w-full sm:w-auto",children:"Enregistrer mes préférences"})]})]})})]})}const kqe=()=>a.jsxs("div",{className:"flex min-h-screen flex-col",children:[a.jsx(vqe,{}),a.jsx("main",{className:"flex-1",children:a.jsx(Ahe,{})}),a.jsx(bqe,{}),a.jsx(Cqe,{}),a.jsx(tfe,{})]}),lve=b.createContext({});function k3(t){const e=b.useRef(null);return e.current===null&&(e.current=t()),e.current}const o9=b.createContext(null),l9=b.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function Aqe(t=!0){const e=b.useContext(o9);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:s}=e,i=b.useId();b.useEffect(()=>{t&&s(i)},[t]);const o=b.useCallback(()=>t&&r&&r(i),[i,r,t]);return!n&&r?[!1,o]:[!0]}const c9=typeof window<"u",u9=c9?b.useLayoutEffect:b.useEffect,co=t=>t;let Eqe=co,d8=co;function d9(t){let e;return()=>(e===void 0&&(e=t()),e)}const s0=(t,e,n)=>{const r=e-t;return r===0?1:(n-t)/r},zf=t=>t*1e3,Bf=t=>t/1e3,Tqe={skipAnimations:!1,useManualTiming:!1};function Pqe(t){let e=new Set,n=new Set,r=!1,s=!1;const i=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function l(u){i.has(u)&&(c.schedule(u),t()),u(o)}const c={schedule:(u,d=!1,h=!1)=>{const p=h&&r?e:n;return d&&i.add(u),p.has(u)||p.add(u),u},cancel:u=>{n.delete(u),i.delete(u)},process:u=>{if(o=u,r){s=!0;return}r=!0,[e,n]=[n,e],e.forEach(l),e.clear(),r=!1,s&&(s=!1,c.process(u))}};return c}const ZT=["read","resolveKeyframes","update","preRender","render","postRender"],Mqe=40;function cve(t,e){let n=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,o=ZT.reduce((g,w)=>(g[w]=Pqe(i),g),{}),{read:l,resolveKeyframes:c,update:u,preRender:d,render:h,postRender:f}=o,p=()=>{const g=performance.now();n=!1,s.delta=r?1e3/60:Math.max(Math.min(g-s.timestamp,Mqe),1),s.timestamp=g,s.isProcessing=!0,l.process(s),c.process(s),u.process(s),d.process(s),h.process(s),f.process(s),s.isProcessing=!1,n&&e&&(r=!1,t(p))},m=()=>{n=!0,r=!0,s.isProcessing||t(p)};return{schedule:ZT.reduce((g,w)=>{const _=o[w];return g[w]=(j,N=!1,S=!1)=>(n||m(),_.schedule(j,N,S)),g},{}),cancel:g=>{for(let w=0;w<ZT.length;w++)o[ZT[w]].cancel(g)},state:s,steps:o}}const{schedule:kn,cancel:Du,state:ci,steps:K$}=cve(typeof requestAnimationFrame<"u"?requestAnimationFrame:co,!0),uve=b.createContext({strict:!1}),xZ={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},B_={};for(const t in xZ)B_[t]={isEnabled:e=>xZ[t].some(n=>!!e[n])};function Rqe(t){for(const e in t)B_[e]={...B_[e],...t[e]}}const Oqe=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function VO(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||Oqe.has(t)}let dve=t=>!VO(t);function Iqe(t){t&&(dve=e=>e.startsWith("on")?!VO(e):t(e))}try{Iqe(require("@emotion/is-prop-valid").default)}catch{}function Dqe(t,e,n){const r={};for(const s in t)s==="values"&&typeof t.values=="object"||(dve(s)||n===!0&&VO(s)||!e&&!VO(s)||t.draggable&&s.startsWith("onDrag"))&&(r[s]=t[s]);return r}function Lqe(t){if(typeof Proxy>"u")return t;const e=new Map,n=(...r)=>t(...r);return new Proxy(n,{get:(r,s)=>s==="create"?t:(e.has(s)||e.set(s,t(s)),e.get(s))})}const A3=b.createContext({});function xk(t){return typeof t=="string"||Array.isArray(t)}function E3(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const h9=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],f9=["initial",...h9];function T3(t){return E3(t.animate)||f9.some(e=>xk(t[e]))}function hve(t){return!!(T3(t)||t.variants)}function Fqe(t,e){if(T3(t)){const{initial:n,animate:r}=t;return{initial:n===!1||xk(n)?n:void 0,animate:xk(r)?r:void 0}}return t.inherit!==!1?e:{}}function $qe(t){const{initial:e,animate:n}=Fqe(t,b.useContext(A3));return b.useMemo(()=>({initial:e,animate:n}),[yZ(e),yZ(n)])}function yZ(t){return Array.isArray(t)?t.join(" "):t}const zqe=Symbol.for("motionComponentSymbol");function ow(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function Bqe(t,e,n){return b.useCallback(r=>{r&&t.onMount&&t.onMount(r),e&&(r?e.mount(r):e.unmount()),n&&(typeof n=="function"?n(r):ow(n)&&(n.current=r))},[e])}const p9=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),Uqe="framerAppearId",fve="data-"+p9(Uqe),{schedule:m9,cancel:RLt}=cve(queueMicrotask,!1),pve=b.createContext({});function qqe(t,e,n,r,s){var i,o;const{visualElement:l}=b.useContext(A3),c=b.useContext(uve),u=b.useContext(o9),d=b.useContext(l9).reducedMotion,h=b.useRef(null);r=r||c.renderer,!h.current&&r&&(h.current=r(t,{visualState:e,parent:l,props:n,presenceContext:u,blockInitialAnimation:u?u.
vendor: 34,555 bytes, line 881
881initial===!1:!1,reducedMotionConfig:d}));const f=h.current,p=b.useContext(pve);f&&!f.projection&&s&&(f.type==="html"||f.type==="svg")&&Vqe(h.current,n,s,p);const m=b.useRef(!1);b.useInsertionEffect(()=>{f&&m.current&&f.update(n,u)});const v=n[fve],x=b.useRef(!!v&&!(!((i=window.MotionHandoffIsComplete)===null||i===void 0)&&i.call(window,v))&&((o=window.MotionHasOptimisedAnimation)===null||o===void 0?void 0:o.call(window,v)));return u9(()=>{f&&(m.current=!0,window.MotionIsMounted=!0,f.updateFeatures(),m9.render(f.render),x.current&&f.animationState&&f.animationState.animateChanges())}),b.useEffect(()=>{f&&(!x.current&&f.animationState&&f.animationState.animateChanges(),x.current&&(queueMicrotask(()=>{var g;(g=window.MotionHandoffMarkAsComplete)===null||g===void 0||g.call(window,v)}),x.current=!1))}),f}function Vqe(t,e,n,r){const{layoutId:s,layout:i,drag:o,dragConstraints:l,layoutScroll:c,layoutRoot:u}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:mve(t.parent)),t.projection.setOptions({layoutId:s,layout:i,alwaysMeasureLayout:!!o||l&&ow(l),visualElement:t,animationType:typeof i=="string"?i:"both",initialPromotionConfig:r,layoutScroll:c,layoutRoot:u})}function mve(t){if(t)return t.options.allowProjection!==!1?t.projection:mve(t.parent)}function Hqe({preloadedFeatures:t,createVisualElement:e,useRender:n,useVisualState:r,Component:s}){var i,o;t&&Rqe(t);function l(u,d){let h;const f={...b.useContext(l9),...u,layoutId:Wqe(u)},{isStatic:p}=f,m=$qe(u),v=r(u,p);if(!p&&c9){Kqe();const x=Gqe(f);h=x.MeasureLayout,m.visualElement=qqe(s,v,f,e,x.ProjectionNode)}return a.jsxs(A3.Provider,{value:m,children:[h&&m.visualElement?a.jsx(h,{visualElement:m.visualElement,...f}):null,n(s,u,Bqe(v,m.visualElement,d),v,p,m.visualElement)]})}l.displayName=`motion.${typeof s=="string"?s:`create(${(o=(i=s.displayName)!==null&&i!==void 0?i:s.name)!==null&&o!==void 0?o:""})`}`;const c=b.forwardRef(l);return c[zqe]=s,c}function Wqe({layoutId:t}){const e=b.useContext(lve).id;return e&&t!==void 0?e+"-"+t:t}function Kqe(t,e){b.useContext(uve).strict}function Gqe(t){const{drag:e,layout:n}=B_;if(!e&&!n)return{};const r={...e,...n};return{MeasureLayout:e!=null&&e.isEnabled(t)||n!=null&&n.isEnabled(t)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}const Yqe=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function g9(t){return typeof t!="string"||t.includes("-")?!1:!!(Yqe.indexOf(t)>-1||/[A-Z]/u.test(t))}function bZ(t){const e=[{},{}];return t==null||t.values.forEach((n,r)=>{e[0][r]=n.get(),e[1][r]=n.getVelocity()}),e}function v9(t,e,n,r){if(typeof e=="function"){const[s,i]=bZ(r);e=e(n!==void 0?n:t.custom,s,i)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[s,i]=bZ(r);e=e(n!==void 0?n:t.custom,s,i)}return e}const h8=t=>Array.isArray(t),Xqe=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),Jqe=t=>h8(t)?t[t.length-1]||0:t,_a=t=>!!(t&&t.getVelocity);function FM(t){const e=_a(t)?t.get():t;return Xqe(e)?e.toValue():e}function Qqe({scrapeMotionValuesFromProps:t,createRenderState:e,onUpdate:n},r,s,i){const o={latestValues:Zqe(r,s,i,t),renderState:e()};return n&&(o.onMount=l=>n({props:r,current:l,...o}),o.onUpdate=l=>n(l)),o}const gve=t=>(e,n)=>{const r=b.useContext(A3),s=b.useContext(o9),i=()=>Qqe(t,e,r,s);return n?i():k3(i)};function Zqe(t,e,n,r){const s={},i=r(t,{});for(const f in i)s[f]=FM(i[f]);let{initial:o,animate:l}=t;const c=T3(t),u=hve(t);e&&u&&!c&&t.inherit!==!1&&(o===void 0&&(o=e.initial),l===void 0&&(l=e.animate));let d=n?n.initial===!1:!1;d=d||o===!1;const h=d?l:o;if(h&&typeof h!="boolean"&&!E3(h)){const f=Array.isArray(h)?h:[h];for(let p=0;p<f.length;p++){const m=v9(t,f[p]);if(m){const{transitionEnd:v,transition:x,...g}=m;for(const w in g){let _=g[w];if(Array.isArray(_)){const j=d?_.length-1:0;_=_[j]}_!==null&&(s[w]=_)}for(const w in v)s[w]=v[w]}}}return s}const $j=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],O0=new Set($j),vve=t=>e=>typeof e=="string"&&e.startsWith(t),xve=vve("--"),eVe=vve("var(--"),x9=t=>eVe(t)?tVe.test(t.split("/*")[0].trim()):!1,tVe=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,yve=(t,e)=>e&&typeof t=="number"?e.transform(t):t,ah=(t,e,n)=>n>e?e:n<t?t:n,zj={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},yk={...zj,transform:t=>ah(0,1,t)},eP={...zj,default:1},f2=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),Lp=f2("deg"),Zd=f2("%"),Tt=f2("px"),nVe=f2("vh"),rVe=f2("vw"),wZ={...Zd,parse:t=>Zd.parse(t)/100,transform:t=>Zd.transform(t*100)},sVe={borderWidth:Tt,borderTopWidth:Tt,borderRightWidth:Tt,borderBottomWidth:Tt,borderLeftWidth:Tt,borderRadius:Tt,radius:Tt,borderTopLeftRadius:Tt,borderTopRightRadius:Tt,borderBottomRightRadius:Tt,borderBottomLeftRadius:Tt,width:Tt,maxWidth:Tt,height:Tt,maxHeight:Tt,top:Tt,right:Tt,bottom:Tt,left:Tt,padding:Tt,paddingTop:Tt,paddingRight:Tt,paddingBottom:Tt,paddingLeft:Tt,margin:Tt,marginTop:Tt,marginRight:Tt,marginBottom:Tt,marginLeft:Tt,backgroundPositionX:Tt,backgroundPositionY:Tt},iVe={rotate:Lp,rotateX:Lp,rotateY:Lp,rotateZ:Lp,scale:eP,scaleX:eP,scaleY:eP,scaleZ:eP,skew:Lp,skewX:Lp,skewY:Lp,distance:Tt,translateX:Tt,translateY:Tt,translateZ:Tt,x:Tt,y:Tt,z:Tt,perspective:Tt,transformPerspective:Tt,opacity:yk,originX:wZ,originY:wZ,originZ:Tt},_Z={...zj,transform:Math.round},y9={...sVe,...iVe,zIndex:_Z,size:Tt,fillOpacity:yk,strokeOpacity:yk,numOctaves:_Z},aVe={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},oVe=$j.length;function lVe(t,e,n){let r="",s=!0;for(let i=0;i<oVe;i++){const o=$j[i],l=t[o];if(l===void 0)continue;let c=!0;if(typeof l=="number"?c=l===(o.startsWith("scale")?1:0):c=parseFloat(l)===0,!c||n){const u=yve(l,y9[o]);if(!c){s=!1;const d=aVe[o]||o;r+=`${d}(${u}) `}n&&(e[o]=u)}}return r=r.trim(),n?r=n(e,s?"":r):s&&(r="none"),r}function b9(t,e,n){const{style:r,vars:s,transformOrigin:i}=t;let o=!1,l=!1;for(const c in e){const u=e[c];if(O0.has(c)){o=!0;continue}else if(xve(c)){s[c]=u;continue}else{const d=yve(u,y9[c]);c.startsWith("origin")?(l=!0,i[c]=d):r[c]=d}}if(e.transform||(o||n?r.transform=lVe(e,t.transform,n):r.transform&&(r.transform="none")),l){const{originX:c="50%",originY:u="50%",originZ:d=0}=i;r.transformOrigin=`${c} ${u} ${d}`}}const cVe={offset:"stroke-dashoffset",array:"stroke-dasharray"},uVe={offset:"strokeDashoffset",array:"strokeDasharray"};function dVe(t,e,n=1,r=0,s=!0){t.pathLength=1;const i=s?cVe:uVe;t[i.offset]=Tt.transform(-r);const o=Tt.transform(e),l=Tt.transform(n);t[i.array]=`${o} ${l}`}function jZ(t,e,n){return typeof t=="string"?t:Tt.transform(e+n*t)}function hVe(t,e,n){const r=jZ(e,t.x,t.width),s=jZ(n,t.y,t.height);return`${r} ${s}`}function w9(t,{attrX:e,attrY:n,attrScale:r,originX:s,originY:i,pathLength:o,pathSpacing:l=1,pathOffset:c=0,...u},d,h){if(b9(t,u,h),d){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:f,style:p,dimensions:m}=t;f.transform&&(m&&(p.transform=f.transform),delete f.transform),m&&(s!==void 0||i!==void 0||p.transform)&&(p.transformOrigin=hVe(m,s!==void 0?s:.5,i!==void 0?i:.5)),e!==void 0&&(f.x=e),n!==void 0&&(f.y=n),r!==void 0&&(f.scale=r),o!==void 0&&dVe(f,o,l,c,!1)}const _9=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),bve=()=>({..._9(),attrs:{}}),j9=t=>typeof t=="string"&&t.toLowerCase()==="svg";function wve(t,{style:e,vars:n},r,s){Object.assign(t.style,e,s&&s.getProjectionStyles(r));for(const i in n)t.style.setProperty(i,n[i])}const _ve=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function jve(t,e,n,r){wve(t,e,void 0,r);for(const s in e.attrs)t.setAttribute(_ve.has(s)?s:p9(s),e.attrs[s])}const HO={};function fVe(t){Object.assign(HO,t)}function Sve(t,{layout:e,layoutId:n}){return O0.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!HO[t]||t==="opacity")}function S9(t,e,n){var r;const{style:s}=t,i={};for(const o in s)(_a(s[o])||e.style&&_a(e.style[o])||Sve(o,t)||((r=n==null?void 0:n.getValue(o))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(i[o]=s[o]);return i}function Nve(t,e,n){const r=S9(t,e,n);for(const s in t)if(_a(t[s])||_a(e[s])){const i=$j.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[i]=t[s]}return r}function pVe(t,e){try{e.dimensions=typeof t.getBBox=="function"?t.getBBox():t.getBoundingClientRect()}catch{e.dimensions={x:0,y:0,width:0,height:0}}}const SZ=["x","y","width","height","cx","cy","r"],mVe={useVisualState:gve({scrapeMotionValuesFromProps:Nve,createRenderState:bve,onUpdate:({props:t,prevProps:e,current:n,renderState:r,latestValues:s})=>{if(!n)return;let i=!!t.drag;if(!i){for(const l in s)if(O0.has(l)){i=!0;break}}if(!i)return;let o=!e;if(e)for(let l=0;l<SZ.length;l++){const c=SZ[l];t[c]!==e[c]&&(o=!0)}o&&kn.read(()=>{pVe(n,r),kn.render(()=>{w9(r,s,j9(n.tagName),t.transformTemplate),jve(n,r)})})}})},gVe={useVisualState:gve({scrapeMotionValuesFromProps:S9,createRenderState:_9})};function Cve(t,e,n){for(const r in e)!_a(e[r])&&!Sve(r,n)&&(t[r]=e[r])}function vVe({transformTemplate:t},e){return b.useMemo(()=>{const n=_9();return b9(n,e,t),Object.assign({},n.vars,n.style)},[e])}function xVe(t,e){const n=t.style||{},r={};return Cve(r,n,t),Object.assign(r,vVe(t,e)),r}function yVe(t,e){const n={},r=xVe(t,e);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=r,n}function bVe(t,e,n,r){const s=b.useMemo(()=>{const i=bve();return w9(i,e,j9(r),t.transformTemplate),{...i.attrs,style:{...i.style}}},[e]);if(t.style){const i={};Cve(i,t.style,t),s.style={...i,...s.style}}return s}function wVe(t=!1){return(n,r,s,{latestValues:i},o)=>{const c=(g9(n)?bVe:yVe)(r,i,o,n),u=Dqe(r,typeof n=="string",t),d=n!==b.Fragment?{...u,...c,ref:s}:{},{children:h}=r,f=b.useMemo(()=>_a(h)?h.get():h,[h]);return b.createElement(n,{...d,children:f})}}function _Ve(t,e){return function(r,{forwardMotionProps:s}={forwardMotionProps:!1}){const o={...g9(r)?mVe:gVe,preloadedFeatures:t,useRender:wVe(s),createVisualElement:e,Component:r};return Hqe(o)}}function kve(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}function P3(t,e,n){const r=t.getProps();return v9(r,e,n!==void 0?n:r.custom,t)}const Ave=d9(()=>window.ScrollTimeline!==void 0);class jVe{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}get finished(){return Promise.all(this.animations.map(e=>"finished"in e?e.finished:e))}getAll(e){return this.animations[0][e]}setAll(e,n){for(let r=0;r<this.animations.length;r++)this.animations[r][e]=n}attachTimeline(e,n){const r=this.animations.map(s=>{if(Ave()&&s.attachTimeline)return s.attachTimeline(e);if(typeof n=="function")return n(s)});return()=>{r.forEach((s,i)=>{s&&s(),this.animations[i].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get startTime(){return this.getAll("startTime")}get duration(){let e=0;for(let n=0;n<this.animations.length;n++)e=Math.max(e,this.animations[n].duration);return e}runAll(e){this.animations.forEach(n=>n[e]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class SVe extends jVe{then(e,n){return Promise.all(this.animations).then(e).catch(n)}}function N9(t,e){return t?t[e]||t.default||t:void 0}const f8=2e4;function Eve(t){let e=0;const n=50;let r=t.next(e);for(;!r.done&&e<f8;)e+=n,r=t.next(e);return e>=f8?1/0:e}function C9(t){return typeof t=="function"}function NZ(t,e){t.timeline=e,t.onfinish=null}const k9=t=>Array.isArray(t)&&typeof t[0]=="number",NVe={linearEasing:void 0};function CVe(t,e){const n=d9(t);return()=>{var r;return(r=NVe[e])!==null&&r!==void 0?r:n()}}const WO=CVe(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Tve=(t,e,n=10)=>{let r="";const s=Math.max(Math.round(e/n),2);for(let i=0;i<s;i++)r+=t(s0(0,s-1,i))+", ";return`linear(${r.substring(0,r.length-2)})`};function Pve(t){return!!(typeof t=="function"&&WO()||!t||typeof t=="string"&&(t in p8||WO())||k9(t)||Array.isArray(t)&&t.every(Pve))}const aN=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,p8={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:aN([0,.65,.55,1]),circOut:aN([.55,0,1,.45]),backIn:aN([.31,.01,.66,-.59]),backOut:aN([.33,1.53,.69,.99])};function Mve(t,e){if(t)return typeof t=="function"&&WO()?Tve(t,e):k9(t)?aN(t):Array.isArray(t)?t.map(n=>Mve(n,e)||p8.easeOut):p8[t]}const Jc={x:!1,y:!1};function Rve(){return Jc.x||Jc.y}function A9(t,e,n){var r;if(t instanceof Element)return[t];if(typeof t=="string"){let s=document;const i=(r=void 0)!==null&&r!==void 0?r:s.querySelectorAll(t);return i?Array.from(i):[]}return Array.from(t)}function Ove(t,e){const n=A9(t),r=new AbortController,s={passive:!0,...e,signal:r.signal};return[n,s,()=>r.abort()]}function CZ(t){return e=>{e.pointerType==="touch"||Rve()||t(e)}}function kVe(t,e,n={}){const[r,s,i]=Ove(t,n),o=CZ(l=>{const{target:c}=l,u=e(l);if(typeof u!="function"||!c)return;const d=CZ(h=>{u(h),c.removeEventListener("pointerleave",d)});c.addEventListener("pointerleave",d,s)});return r.forEach(l=>{l.addEventListener("pointerenter",o,s)}),i}const Ive=(t,e)=>e?t===e?!0:Ive(t,e.parentElement):!1,E9=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,AVe=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function EVe(t){return AVe.has(t.tagName)||t.tabIndex!==-1}const oN=new WeakSet;function kZ(t){return e=>{e.key==="Enter"&&t(e)}}function G$(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const TVe=(t,e)=>{const n=t.currentTarget;if(!n)return;const r=kZ(()=>{if(oN.has(n))return;G$(n,"down");const s=kZ(()=>{G$(n,"up")}),i=()=>G$(n,"cancel");n.addEventListener("keyup",s,e),n.addEventListener("blur",i,e)});n.addEventListener("keydown",r,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),e)};function AZ(t){return E9(t)&&!Rve()}function PVe(t,e,n={}){const[r,s,i]=Ove(t,n),o=l=>{const c=l.currentTarget;if(!AZ(l)||oN.has(c))return;oN.add(c);const u=e(l),d=(p,m)=>{window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",f),!(!AZ(p)||!oN.has(c))&&(oN.delete(c),typeof u=="function"&&u(p,{success:m}))},h=p=>{d(p,n.useGlobalTarget||Ive(c,p.target))},f=p=>{d(p,!1)};window.addEventListener("pointerup",h,s),window.addEventListener("pointercancel",f,s)};return r.forEach(l=>{!EVe(l)&&l.getAttribute("tabindex")===null&&(l.tabIndex=0),(n.useGlobalTarget?window:l).addEventListener("pointerdown",o,s),l.addEventListener("focus",u=>TVe(u,s),s)}),i}function MVe(t){return t==="x"||t==="y"?Jc[t]?null:(Jc[t]=!0,()=>{Jc[t]=!1}):Jc.x||Jc.y?null:(Jc.x=Jc.y=!0,()=>{Jc.x=Jc.y=!1})}const Dve=new Set(["width","height","top","left","right","bottom",...$j]);let $M;function RVe(){$M=void 0}const eh={now:()=>($M===void 0&&eh.set(ci.isProcessing||Tqe.useManualTiming?ci.timestamp:performance.now()),$M),set:t=>{$M=t,queueMicrotask(RVe)}};function T9(t,e){t.indexOf(e)===-1&&t.push(e)}function P9(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}class M9{constructor(){this.subscriptions=[]}add(e){return T9(this.subscriptions,e),()=>P9(this.subscriptions,e)}notify(e,n,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](e,n,r);else for(let i=0;i<s;i++){const o=this.subscriptions[i];o&&o(e,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function R9(t,e){return e?t*(1e3/e):0}const EZ=30,OVe=t=>!isNaN(parseFloat(t)),hC={current:void 0};class IVe{constructor(e,n={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,s=!0)=>{const i=eh.now();this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),s&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=eh.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=OVe(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new M9);const r=this.events[e].add(n);return e==="change"?()=>{r(),kn.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e,n=!0){!n||!this.passiveEffect?this.updateAndNotify(e,n):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,n=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return hC.current&&hC.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const e=eh.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>EZ)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,EZ);return R9(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Hd(t,e){return new IVe(t,e)}function DVe(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Hd(n))}function LVe(t,e){const n=P3(t,e);let{transitionEnd:r={},transition:s={},...i}=n||{};i={...i,...r};for(const o in i){const l=Jqe(i[o]);DVe(t,o,l)}}function FVe(t){return!!(_a(t)&&t.add)}function m8(t,e){const n=t.getValue("willChange");if(FVe(n))return n.add(e)}function Lve(t){return t.props[fve]}const Fve=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,$Ve=1e-7,zVe=12;function BVe(t,e,n,r,s){let i,o,l=0;do o=e+(n-e)/2,i=Fve(o,r,s)-t,i>0?n=o:e=o;while(Math.abs(i)>$Ve&&++l<zVe);return o}function p2(t,e,n,r){if(t===e&&n===r)return co;const s=i=>BVe(i,0,1,t,n);return i=>i===0||i===1?i:Fve(s(i),e,r)}const $ve=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,zve=t=>e=>1-t(1-e),Bve=p2(.33,1.53,.69,.99),O9=zve(Bve),Uve=$ve(O9),qve=t=>(t*=2)<1?.5*O9(t):.5*(2-Math.pow(2,-10*(t-1))),I9=t=>1-Math.sin(Math.acos(t)),Vve=zve(I9),Hve=$ve(I9),Wve=t=>/^0[^.\s]+$/u.test(t);function UVe(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||Wve(t):!0}const fC=t=>Math.round(t*1e5)/1e5,D9=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function qVe(t){return t==null}const VVe=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,L9=(t,e)=>n=>!!(typeof n=="string"&&VVe.test(n)&&n.startsWith(t)||e&&!qVe(n)&&Object.prototype.hasOwnProperty.call(n,e)),Kve=(t,e,n)=>r=>{if(typeof r!="string")return r;const[s,i,o,l]=r.match(D9);return{[t]:parseFloat(s),[e]:parseFloat(i),[n]:parseFloat(o),alpha:l!==void 0?parseFloat(l):1}},HVe=t=>ah(0,255,t),Y$={...zj,transform:t=>Math.round(HVe(t))},tx={test:L9("rgb","red"),parse:Kve("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+Y$.transform(t)+", "+Y$.transform(e)+", "+Y$.transform(n)+", "+fC(yk.transform(r))+")"};function WVe(t){let e="",n="",r="",s="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),r=t.substring(5,7),s=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),r=t.substring(3,4),s=t.substring(4,5),e+=e,n+=n,r+=r,s+=s),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const g8={test:L9("#"),parse:WVe,transform:tx.transform},lw={test:L9("hsl","hue"),parse:Kve("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+Zd.transform(fC(e))+", "+Zd.transform(fC(n))+", "+fC(yk.transform(r))+")"},ga={test:t=>tx.test(t)||g8.test(t)||lw.test(t),parse:t=>tx.test(t)?tx.parse(t):lw.test(t)?lw.parse(t):g8.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?tx.transform(t):lw.transform(t)},KVe=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function GVe(t){var e,n;return isNaN(t)&&typeof t=="string"&&(((e=t.match(D9))===null||e===void 0?void 0:e.length)||0)+(((n=t.match(KVe))===null||n===void 0?void 0:n.length)||0)>0}const Gve="number",Yve="color",YVe="var",XVe="var(",TZ="${}",JVe=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function bk(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},s=[];let i=0;const l=e.replace(JVe,c=>(ga.test(c)?(r.color.push(i),s.push(Yve),n.push(ga.parse(c))):c.startsWith(XVe)?(r.var.push(i),s.push(YVe),n.push(c)):(r.number.push(i),s.push(Gve),n.push(parseFloat(c))),++i,TZ)).split(TZ);return{values:n,split:l,indexes:r,types:s}}function Xve(t){return bk(t).values}function Jve(t){const{split:e,types:n}=bk(t),r=e.length;return s=>{let i="";for(let o=0;o<r;o++)if(i+=e[o],s[o]!==void 0){const l=n[o];l===Gve?i+=fC(s[o]):l===Yve?i+=ga.transform(s[o]):i+=s[o]}return i}}const QVe=t=>typeof t=="number"?0:t;function ZVe(t){const e=Xve(t);return Jve(t)(e.map(QVe))}const Fg={test:GVe,parse:Xve,createTransformer:Jve,getAnimatableNone:ZVe},eHe=new Set(["brightness","contrast","saturate","opacity"]);function tHe(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[r]=n.match(D9)||[];if(!r)return t;const s=n.replace(r,"");let i=eHe.has(e)?1:0;return r!==n&&(i*=100),e+"("+i+s+")"}const nHe=/\b([a-z-]*)\(.*?\)/gu,v8={...Fg,getAnimatableNone:t=>{const e=t.match(nHe);return e?e.map(tHe).join(" "):t}},rHe={...y9,color:ga,backgroundColor:ga,outlineColor:ga,fill:ga,stroke:ga,borderColor:ga,borderTopColor:ga,borderRightColor:ga,borderBottomColor:ga,borderLeftColor:ga,filter:v8,WebkitFilter:v8},F9=t=>rHe[t];function Qve(t,e){let n=F9(t);return n!==v8&&(n=Fg),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const sHe=new Set(["auto","none","0"]);function iHe(t,e,n){let r=0,s;for(;r<t.length&&!s;){const i=t[r];typeof i=="string"&&!sHe.has(i)&&bk(i).values.length&&(s=t[r]),r++}if(s&&n)for(const i of e)t[i]=Qve(n,s)}const PZ=t=>t===zj||t===Tt,MZ=(t,e)=>parseFloat(t.split(", ")[e]),RZ=(t,e)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const s=r.match(/^matrix3d\((.+)\)$/u);if(s)return MZ(s[1],e);{const i=r.match(/^matrix\((.+)\)$/u);return i?MZ(i[1],t):0}},aHe=new Set(["x","y","z"]),oHe=$j.filter(t=>!aHe.has(t));function lHe(t){const e=[];return oHe.forEach(n=>{const r=t.getValue(n);r!==void 0&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),e}const U_={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:RZ(4,13),y:RZ(5,14)};U_.translateX=U_.x;U_.translateY=U_.y;const Dy=new Set;let x8=!1,y8=!1;function Zve(){if(y8){const t=Array.from(Dy).filter(r=>r.needsMeasurement),e=new Set(t.map(r=>r.element)),n=new Map;e.forEach(r=>{const s=lHe(r);s.length&&(n.set(r,s),r.render())}),t.forEach(r=>r.measureInitialState()),e.forEach(r=>{r.render();const s=n.get(r);s&&s.forEach(([i,o])=>{var l;(l=r.getValue(i))===null||l===void 0||l.set(o)})}),t.forEach(r=>r.measureEndState()),t.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}y8=!1,x8=!1,Dy.forEach(t=>t.complete()),Dy.clear()}function exe(){Dy.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(y8=!0)})}function cHe(){exe(),Zve()}class $9{constructor(e,n,r,s,i,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=r,this.motionValue=s,this.element=i,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Dy.add(this),x8||(x8=!0,kn.read(exe),kn.resolveKeyframes(Zve))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:r,motionValue:s}=this;for(let i=0;i<e.length;i++)if(e[i]===null)if(i===0){const o=s==null?void 0:s.get(),l=e[e.length-1];if(o!==void 0)e[0]=o;else if(r&&n){const c=r.readValue(n,l);c!=null&&(e[0]=c)}e[0]===void 0&&(e[0]=l),s&&o===void 0&&s.set(e[0])}else e[i]=e[i-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),Dy.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Dy.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const txe=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),uHe=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function dHe(t){const e=uHe.exec(t);if(!e)return[,];const[,n,r,s]=e;return[`--${n??r}`,s]}function nxe(t,e,n=1){const[r,s]=dHe(t);if(!r)return;const i=window.getComputedStyle(e).getPropertyValue(r);if(i){const o=i.trim();return txe(o)?parseFloat(o):o}return x9(s)?nxe(s,e,n+1):s}const rxe=t=>e=>e.test(t),hHe={test:t=>t==="auto",parse:t=>t},sxe=[zj,Tt,Zd,Lp,rVe,nVe,hHe],OZ=t=>sxe.find(rxe(t));class ixe extends $9{constructor(e,n,r,s,i){super(e,n,r,s,i,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let c=0;c<e.length;c++){let u=e[c];if(typeof u=="string"&&(u=u.trim(),x9(u))){const d=nxe(u,n.current);d!==void 0&&(e[c]=d),c===e.length-1&&(this.finalKeyframe=u)}}if(this.resolveNoneKeyframes(),!Dve.has(r)||e.length!==2)return;const[s,i]=e,o=OZ(s),l=OZ(i);if(o!==l)if(PZ(o)&&PZ(l))for(let c=0;c<e.length;c++){const u=e[c];typeof u=="string"&&(e[c]=parseFloat(u))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,r=[];for(let s=0;s<e.length;s++)UVe(e[s])&&r.push(s);r.length&&iHe(e,r,n)}measureInitialState(){const{element:e,unresolvedKeyframes:n,name:r}=this;if(!e||!e.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=U_[r](e.measureViewportBox(),window.getComputedStyle(e.current)),n[0]=this.measuredOrigin;const s=n[n.length-1];s!==void 0&&e.getValue(r,s).jump(s,!1)}measureEndState(){var e;const{element:n,name:r,unresolvedKeyframes:s}=this;if(!n||!n.current)return;const i=n.getValue(r);i&&i.jump(this.measuredOrigin,!1);const o=s.length-1,l=s[o];s[o]=U_[r](n.measureViewportBox(),window.getComputedStyle(n.current)),l!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=l),!((e=this.removedTransforms)===null||e===void 0)&&e.length&&this.removedTransforms.forEach(([c,u])=>{n.getValue(c).set(u)}),this.resolveNoneKeyframes()}}const IZ=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Fg.test(t)||t==="0")&&!t.startsWith("url("));function fHe(t){const e=t[0];if(t.length===1)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}function pHe(t,e,n,r){const s=t[0];if(s===null)return!1;if(e==="display"||e==="visibility")return!0;const i=t[t.length-1],o=IZ(s,e),l=IZ(i,e);return!o||!l?!1:fHe(t)||(n==="spring"||C9(n))&&r}const mHe=t=>t!==null;function M3(t,{repeat:e,repeatType:n="loop"},r){const s=t.filter(mHe),i=e&&n!=="loop"&&e%2===1?0:s.length-1;return!i||r===void 0?s[i]:r}const gHe=40;class axe{constructor({autoplay:e=!0,delay:n=0,type:r="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:o="loop",...l}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=eh.now(),this.options={autoplay:e,delay:n,type:r,repeat:s,repeatDelay:i,repeatType:o,...l},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>gHe?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&cHe(),this._resolved}onKeyframesResolved(e,n){this.resolvedAt=eh.now(),this.hasAttemptedResolve=!0;const{name:r,type:s,velocity:i,delay:o,onComplete:l,onUpdate:c,isGenerator:u}=this.options;if(!u&&!pHe(e,r,s,i))if(o)this.options.duration=0;else{c&&c(M3(e,this.options,n)),l&&l(),this.resolveFinishedPromise();return}const d=this.initPlayback(e,n);d!==!1&&(this._resolved={keyframes:e,finalKeyframe:n,...d},this.onPostResolved())}onPostResolved(){}then(e,n){return this.currentFinishedPromise.then(e,n)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}const Lr=(t,e,n)=>t+(e-t)*n;function X$(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function vHe({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,e/=100,n/=100;let s=0,i=0,o=0;if(!e)s=i=o=n;else{const l=n<.5?n*(1+e):n+e-n*e,c=2*n-l;s=X$(c,l,t+1/3),i=X$(c,l,t),o=X$(c,l,t-1/3)}return{red:Math.round(s*255),green:Math.round(i*255),blue:Math.round(o*255),alpha:r}}function KO(t,e){return n=>n>0?e:t}const J$=(t,e,n)=>{const r=t*t,s=n*(e*e-r)+r;return s<0?0:Math.sqrt(s)},xHe=[g8,tx,lw],yHe=t=>xHe.find(e=>e.test(t));function DZ(t){const e=yHe(t);if(!e)return!1;let n=e.parse(t);return e===lw&&(n=vHe(n)),n}const LZ=(t,e)=>{const n=DZ(t),r=DZ(e);if(!n||!r)return KO(t,e);const s={...n};return i=>(s.red=J$(n.red,r.red,i),s.green=J$(n.green,r.green,i),s.blue=J$(n.blue,r.blue,i),s.alpha=Lr(n.alpha,r.alpha,i),tx.transform(s))},bHe=(t,e)=>n=>e(t(n)),m2=(...t)=>t.reduce(bHe),b8=new Set(["none","hidden"]);function wHe(t,e){return b8.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function _He(t,e){return n=>Lr(t,e,n)}function z9(t){return typeof t=="number"?_He:typeof t=="string"?x9(t)?KO:ga.test(t)?LZ:NHe:Array.isArray(t)?oxe:typeof t=="object"?ga.test(t)?LZ:jHe:KO}function oxe(t,e){const n=[...t],r=n.length,s=t.map((i,o)=>z9(i)(i,e[o]));return i=>{for(let o=0;o<r;o++)n[o]=s[o](i);return n}}function jHe(t,e){const n={...t,...e},r={};for(const s in n)t[s]!==void 0&&e[s]!==void 0&&(r[s]=z9(t[s])(t[s],e[s]));return s=>{for(const i in r)n[i]=r[i](s);return n}}function SHe(t,e){var n;const r=[],s={color:0,var:0,number:0};for(let i=0;i<e.values.length;i++){const o=e.types[i],l=t.indexes[o][s[o]],c=(n=t.values[l])!==null&&n!==void 0?n:0;r[i]=c,s[o]++}return r}const NHe=(t,e)=>{const n=Fg.createTransformer(e),r=bk(t),s=bk(e);return r.indexes.var.length===s.indexes.var.length&&r.indexes.color.length===s.indexes.color.length&&r.indexes.number.length>=s.indexes.number.length?b8.has(t)&&!s.values.length||b8.has(e)&&!r.values.length?wHe(t,e):m2(oxe(SHe(r,s),s.values),n):KO(t,e)};function lxe(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?Lr(t,e,n):z9(t)(t,e)}const CHe=5;function cxe(t,e,n){const r=Math.max(e-CHe,0);return R9(n-t(r),e-r)}const Zr={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},Q$=.001;function kHe({duration:t=Zr.duration,bounce:e=Zr.bounce,velocity:n=Zr.velocity,mass:r=Zr.mass}){let s,i,o=1-e;o=ah(Zr.minDamping,Zr.maxDamping,o),t=ah(Zr.minDuration,Zr.maxDuration,Bf(t)),o<1?(s=u=>{const d=u*o,h=d*t,f=d-n,p=w8(u,o),m=Math.exp(-h);return Q$-f/p*m},i=u=>{const h=u*o*t,f=h*n+n,p=Math.pow(o,2)*Math.pow(u,2)*t,m=Math.exp(-h),v=w8(Math.pow(u,2),o);return(-s(u)+Q$>0?-1:1)*((f-p)*m)/v}):(s=u=>{const d=Math.exp(-u*t),h=(u-n)*t+1;return-Q$+d*h},i=u=>{const d=Math.exp(-u*t),h=(n-u)*(t*t);return d*h});const l=5/t,c=EHe(s,i,l);if(t=zf(t),isNaN(c))return{stiffness:Zr.stiffness,damping:Zr.damping,duration:t};{const u=Math.pow(c,2)*r;return{stiffness:u,damping:o*2*Math.sqrt(r*u),duration:t}}}const AHe=12;function EHe(t,e,n){let r=n;for(let s=1;s<AHe;s++)r=r-t(r)/e(r);return r}function w8(t,e){return t*Math.sqrt(1-e*e)}const THe=["duration","bounce"],PHe=["stiffness","damping","mass"];function FZ(t,e){return e.some(n=>t[n]!==void 0)}function MHe(t){let e={velocity:Zr.velocity,stiffness:Zr.stiffness,damping:Zr.damping,mass:Zr.mass,isResolvedFromDuration:!1,...t};if(!FZ(t,PHe)&&FZ(t,THe))if(t.visualDuration){const n=t.visualDuration,r=2*Math.PI/(n*1.2),s=r*r,i=2*ah(.05,1,1-(t.bounce||0))*Math.sqrt(s);e={...e,mass:Zr.mass,stiffness:s,damping:i}}else{const n=kHe(t);e={...e,...n,mass:Zr.mass},e.isResolvedFromDuration=!0}return e}function uxe(t=Zr.visualDuration,e=Zr.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:r,restDelta:s}=n;const i=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],l={done:!1,value:i},{stiffness:c,damping:u,mass:d,duration:h,velocity:f,isResolvedFromDuration:p}=MHe({...n,velocity:-Bf(n.velocity||0)}),m=f||0,v=u/(2*Math.sqrt(c*d)),x=o-i,g=Bf(Math.sqrt(c/d)),w=Math.abs(x)<5;r||(r=w?Zr.restSpeed.granular:Zr.restSpeed.default),s||(s=w?Zr.restDelta.granular:Zr.restDelta.default);let _;if(v<1){const N=w8(g,v);_=S=>{const C=Math.exp(-v*g*S);return o-C*((m+v*g*x)/N*Math.sin(N*S)+x*Math.cos(N*S))}}else if(v===1)_=N=>o-Math.exp(-g*N)*(x+(m+g*x)*N);else{const N=g*Math.sqrt(v*v-1);_=S=>{const C=Math.exp(-v*g*S),k=Math.min(N*S,300);return o-C*((m+v*g*x)*Math.sinh(k)+N*x*Math.cosh(k))/N}}
vendor: 5,538 bytes, line 881
881const j={calculatedDuration:p&&h||null,next:N=>{const S=_(N);if(p)l.done=N>=h;else{let C=0;v<1&&(C=N===0?zf(m):cxe(_,N,S));const k=Math.abs(C)<=r,E=Math.abs(o-S)<=s;l.done=k&&E}return l.value=l.done?o:S,l},toString:()=>{const N=Math.min(Eve(j),f8),S=Tve(C=>j.next(N*C).value,N,30);return N+"ms "+S}};return j}function $Z({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:i=500,modifyTarget:o,min:l,max:c,restDelta:u=.5,restSpeed:d}){const h=t[0],f={done:!1,value:h},p=k=>l!==void 0&&k<l||c!==void 0&&k>c,m=k=>l===void 0?c:c===void 0||Math.abs(l-k)<Math.abs(c-k)?l:c;let v=n*e;const x=h+v,g=o===void 0?x:o(x);g!==x&&(v=g-h);const w=k=>-v*Math.exp(-k/r),_=k=>g+w(k),j=k=>{const E=w(k),P=_(k);f.done=Math.abs(E)<=u,f.value=f.done?g:P};let N,S;const C=k=>{p(f.value)&&(N=k,S=uxe({keyframes:[f.value,m(f.value)],velocity:cxe(_,k,f.value),damping:s,stiffness:i,restDelta:u,restSpeed:d}))};return C(0),{calculatedDuration:null,next:k=>{let E=!1;return!S&&N===void 0&&(E=!0,j(k),C(k)),N!==void 0&&k>=N?S.next(k-N):(!E&&j(k),f)}}}const RHe=p2(.42,0,1,1),OHe=p2(0,0,.58,1),dxe=p2(.42,0,.58,1),IHe=t=>Array.isArray(t)&&typeof t[0]!="number",zZ={linear:co,easeIn:RHe,easeInOut:dxe,easeOut:OHe,circIn:I9,circInOut:Hve,circOut:Vve,backIn:O9,backInOut:Uve,backOut:Bve,anticipate:qve},BZ=t=>{if(k9(t)){d8(t.length===4);const[e,n,r,s]=t;return p2(e,n,r,s)}else if(typeof t=="string")return d8(zZ[t]!==void 0),zZ[t];return t};function DHe(t,e,n){const r=[],s=n||lxe,i=t.length-1;for(let o=0;o<i;o++){let l=s(t[o],t[o+1]);if(e){const c=Array.isArray(e)?e[o]||co:e;l=m2(c,l)}r.push(l)}return r}function B9(t,e,{clamp:n=!0,ease:r,mixer:s}={}){const i=t.length;if(d8(i===e.length),i===1)return()=>e[0];if(i===2&&e[0]===e[1])return()=>e[1];const o=t[0]===t[1];t[0]>t[i-1]&&(t=[...t].reverse(),e=[...e].reverse());const l=DHe(e,r,s),c=l.length,u=d=>{if(o&&d<t[0])return e[0];let h=0;if(c>1)for(;h<t.length-2&&!(d<t[h+1]);h++);const f=s0(t[h],t[h+1],d);return l[h](f)};return n?d=>u(ah(t[0],t[i-1],d)):u}function LHe(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const s=s0(0,e,r);t.push(Lr(n,1,s))}}function hxe(t){const e=[0];return LHe(e,t.length-1),e}function FHe(t,e){return t.map(n=>n*e)}function $He(t,e){return t.map(()=>e||dxe).splice(0,t.length-1)}function GO({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const s=IHe(r)?r.map(BZ):BZ(r),i={done:!1,value:e[0]},o=FHe(n&&n.length===e.length?n:hxe(e),t),l=B9(o,e,{ease:Array.isArray(s)?s:$He(e,s)});return{calculatedDuration:t,next:c=>(i.value=l(c),i.done=c>=t,i)}}const zHe=t=>{const e=({timestamp:n})=>t(n);return{start:()=>kn.update(e,!0),stop:()=>Du(e),now:()=>ci.isProcessing?ci.timestamp:eh.now()}},BHe={decay:$Z,inertia:$Z,tween:GO,keyframes:GO,spring:uxe},UHe=t=>t/100;class U9 extends axe{constructor(e){super(e),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:c}=this.options;c&&c()};const{name:n,motionValue:r,element:s,keyframes:i}=this.options,o=(s==null?void 0:s.KeyframeResolver)||$9,l=(c,u)=>this.onKeyframesResolved(c,u);this.resolver=new o(i,l,n,r,s),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(e){const{type:n="keyframes",repeat:r=0,repeatDelay:s=0,repeatType:i,velocity:o=0}=this.options,l=C9(n)?n:BHe[n]||GO;let c,u;l!==GO&&typeof e[0]!="number"&&(c=m2(UHe,lxe(e[0],e[1])),e=[0,100]);const d=l({...this.options,keyframes:e});i==="mirror"&&(u=l({...this.options,keyframes:[...e].reverse(),velocity:-o})),d.calculatedDuration===null&&(d.calculatedDuration=Eve(d));const{calculatedDuration:h}=d,f=h+s,p=f*(r+1)-s;return{generator:d,mirroredGenerator:u,mapPercentToKeyframes:c,calculatedDuration:h,resolvedDuration:f,totalDuration:p}}onPostResolved(){const{autoplay:e=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!e?this.pause():this.state=this.pendingPlayState}tick(e,n=!1){const{resolved:r}=this;if(!r){const{keyframes:k}=this.options;return{done:!0,value:k[k.length-1]}}const{finalKeyframe:s,generator:i,mirroredGenerator:o,mapPercentToKeyframes:l,keyframes:c,calculatedDuration:u,totalDuration:d,resolvedDuration:h}=r;if(this.startTime===null)return i.next(0);const{delay:f,repeat:p,repeatType:m,repeatDelay:v,onUpdate:x}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-d/this.speed,this.startTime)),n?this.currentTime=e:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;const g=this.currentTime-f*(this.speed>=0?1:-1),w=this.speed>=0?g<0:g>d;this.currentTime=Math.max(g,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let _=this.currentTime,j=i;if(p){const k=Math.min(this.currentTime,d)/h;let E=Math.floor(k),P=k%1;!P&&k>=1&&(P=1),P===1&&E--,E=Math.min(E,p+1),!!(E%2)&&(m==="reverse"?(P=1-P,v&&(P-=v/h)):m==="mirror"&&(j=o)),_=ah(0,1,P)*h}const N=w?{done:!1,value:c[0]}:j.next(_);l&&(N.value=l(N.value));let{done:S}=N;!w&&u!==null&&(S=this.speed>=0?this.currentTime>=d:this.currentTime<=0);const C=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&S);return C&&s!==void 0&&(N.value=M3(c,this.options,s)),x&&x(N.value),C&&this.finish(),N}get duration(){const{resolved:e}=this;return e?Bf(e.calculatedDuration):0}
vendor: 33,247 bytes, line 881
881get time(){return Bf(this.currentTime)}set time(e){e=zf(e),this.currentTime=e,this.holdTime!==null||this.speed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){const n=this.playbackSpeed!==e;this.playbackSpeed=e,n&&(this.time=Bf(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=zHe,onPlay:n,startTime:r}=this.options;this.driver||(this.driver=e(i=>this.tick(i))),n&&n();const s=this.driver.now();this.holdTime!==null?this.startTime=s-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=s):this.startTime=r??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var e;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(e=this.currentTime)!==null&&e!==void 0?e:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:e}=this.options;e&&e()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}}const qHe=new Set(["opacity","clipPath","filter","transform"]);function VHe(t,e,n,{delay:r=0,duration:s=300,repeat:i=0,repeatType:o="loop",ease:l="easeInOut",times:c}={}){const u={[e]:n};c&&(u.offset=c);const d=Mve(l,s);return Array.isArray(d)&&(u.easing=d),t.animate(u,{delay:r,duration:s,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:i+1,direction:o==="reverse"?"alternate":"normal"})}const HHe=d9(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),YO=10,WHe=2e4;function KHe(t){return C9(t.type)||t.type==="spring"||!Pve(t.ease)}function GHe(t,e){const n=new U9({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:t[0]};const s=[];let i=0;for(;!r.done&&i<WHe;)r=n.sample(i),s.push(r.value),i+=YO;return{times:void 0,keyframes:s,duration:i-YO,ease:"linear"}}const fxe={anticipate:qve,backInOut:Uve,circInOut:Hve};function YHe(t){return t in fxe}class UZ extends axe{constructor(e){super(e);const{name:n,motionValue:r,element:s,keyframes:i}=this.options;this.resolver=new ixe(i,(o,l)=>this.onKeyframesResolved(o,l),n,r,s),this.resolver.scheduleResolve()}initPlayback(e,n){let{duration:r=300,times:s,ease:i,type:o,motionValue:l,name:c,startTime:u}=this.options;if(!l.owner||!l.owner.current)return!1;if(typeof i=="string"&&WO()&&YHe(i)&&(i=fxe[i]),KHe(this.options)){const{onComplete:h,onUpdate:f,motionValue:p,element:m,...v}=this.options,x=GHe(e,v);e=x.keyframes,e.length===1&&(e[1]=e[0]),r=x.duration,s=x.times,i=x.ease,o="keyframes"}const d=VHe(l.owner.current,c,e,{...this.options,duration:r,times:s,ease:i});return d.startTime=u??this.calcStartTime(),this.pendingTimeline?(NZ(d,this.pendingTimeline),this.pendingTimeline=void 0):d.onfinish=()=>{const{onComplete:h}=this.options;l.set(M3(e,this.options,n)),h&&h(),this.cancel(),this.resolveFinishedPromise()},{animation:d,duration:r,times:s,type:o,ease:i,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:n}=e;return Bf(n)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:n}=e;return Bf(n.currentTime||0)}set time(e){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.currentTime=zf(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:n}=e;return n.playbackRate}set speed(e){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:n}=e;return n.playState}get startTime(){const{resolved:e}=this;if(!e)return null;const{animation:n}=e;return n.startTime}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{const{resolved:n}=this;if(!n)return co;const{animation:r}=n;NZ(r,e)}return co}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.playState==="finished"&&this.updateFinishedPromise(),n.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:e}=this;if(!e)return;const{animation:n,keyframes:r,duration:s,type:i,ease:o,times:l}=e;if(n.playState==="idle"||n.playState==="finished")return;if(this.time){const{motionValue:u,onUpdate:d,onComplete:h,element:f,...p}=this.options,m=new U9({...p,keyframes:r,duration:s,type:i,ease:o,times:l,isGenerator:!0}),v=zf(this.time);u.setWithVelocity(m.sample(v-YO).value,m.sample(v).value,YO)}const{onStop:c}=this.options;c&&c(),this.cancel()}complete(){const{resolved:e}=this;e&&e.animation.finish()}cancel(){const{resolved:e}=this;e&&e.animation.cancel()}static supports(e){const{motionValue:n,name:r,repeatDelay:s,repeatType:i,damping:o,type:l}=e;if(!n||!n.owner||!(n.owner.current instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:u}=n.owner.getProps();return HHe()&&r&&qHe.has(r)&&!c&&!u&&!s&&i!=="mirror"&&o!==0&&l!=="inertia"}}const XHe={type:"spring",stiffness:500,damping:25,restSpeed:10},JHe=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),QHe={type:"keyframes",duration:.8},ZHe={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},eWe=(t,{keyframes:e})=>e.length>2?QHe:O0.has(t)?t.startsWith("scale")?JHe(e[1]):XHe:ZHe;function tWe({when:t,delay:e,delayChildren:n,staggerChildren:r,staggerDirection:s,repeat:i,repeatType:o,repeatDelay:l,from:c,elapsed:u,...d}){return!!Object.keys(d).length}const q9=(t,e,n,r={},s,i)=>o=>{const l=N9(r,t)||{},c=l.delay||r.delay||0;let{elapsed:u=0}=r;u=u-zf(c);let d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...l,delay:-u,onUpdate:f=>{e.set(f),l.onUpdate&&l.onUpdate(f)},onComplete:()=>{o(),l.onComplete&&l.onComplete()},name:t,motionValue:e,element:i?void 0:s};tWe(l)||(d={...d,...eWe(t,d)}),d.duration&&(d.duration=zf(d.duration)),d.repeatDelay&&(d.repeatDelay=zf(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let h=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(d.duration=0,d.delay===0&&(h=!0)),h&&!i&&e.get()!==void 0){const f=M3(d.keyframes,l);if(f!==void 0)return kn.update(()=>{d.onUpdate(f),d.onComplete()}),new SVe([])}return!i&&UZ.supports(d)?new UZ(d):new U9(d)};function nWe({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,r}function pxe(t,e,{delay:n=0,transitionOverride:r,type:s}={}){var i;let{transition:o=t.getDefaultTransition(),transitionEnd:l,...c}=e;r&&(o=r);const u=[],d=s&&t.animationState&&t.animationState.getState()[s];for(const h in c){const f=t.getValue(h,(i=t.latestValues[h])!==null&&i!==void 0?i:null),p=c[h];if(p===void 0||d&&nWe(d,h))continue;const m={delay:n,...N9(o||{},h)};let v=!1;if(window.MotionHandoffAnimation){const g=Lve(t);if(g){const w=window.MotionHandoffAnimation(g,h,kn);w!==null&&(m.startTime=w,v=!0)}}m8(t,h),f.start(q9(h,f,p,t.shouldReduceMotion&&Dve.has(h)?{type:!1}:m,t,v));const x=f.animation;x&&u.push(x)}return l&&Promise.all(u).then(()=>{kn.update(()=>{l&&LVe(t,l)})}),u}function _8(t,e,n={}){var r;const s=P3(t,e,n.type==="exit"?(r=t.presenceContext)===null||r===void 0?void 0:r.custom:void 0);let{transition:i=t.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(i=n.transitionOverride);const o=s?()=>Promise.all(pxe(t,s,n)):()=>Promise.resolve(),l=t.variantChildren&&t.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:h,staggerDirection:f}=i;return rWe(t,e,d+u,h,f,n)}:()=>Promise.resolve(),{when:c}=i;if(c){const[u,d]=c==="beforeChildren"?[o,l]:[l,o];return u().then(()=>d())}else return Promise.all([o(),l(n.delay)])}function rWe(t,e,n=0,r=0,s=1,i){const o=[],l=(t.variantChildren.size-1)*r,c=s===1?(u=0)=>u*r:(u=0)=>l-u*r;return Array.from(t.variantChildren).sort(sWe).forEach((u,d)=>{u.notify("AnimationStart",e),o.push(_8(u,e,{...i,delay:n+c(d)}).then(()=>u.notify("AnimationComplete",e)))}),Promise.all(o)}function sWe(t,e){return t.sortNodePosition(e)}function iWe(t,e,n={}){t.notify("AnimationStart",e);let r;if(Array.isArray(e)){const s=e.map(i=>_8(t,i,n));r=Promise.all(s)}else if(typeof e=="string")r=_8(t,e,n);else{const s=typeof e=="function"?P3(t,e,n.custom):e;r=Promise.all(pxe(t,s,n))}return r.then(()=>{t.notify("AnimationComplete",e)})}const aWe=f9.length;function mxe(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?mxe(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<aWe;n++){const r=f9[n],s=t.props[r];(xk(s)||s===!1)&&(e[r]=s)}return e}const oWe=[...h9].reverse(),lWe=h9.length;function cWe(t){return e=>Promise.all(e.map(({animation:n,options:r})=>iWe(t,n,r)))}function uWe(t){let e=cWe(t),n=qZ(),r=!0;const s=c=>(u,d)=>{var h;const f=P3(t,d,c==="exit"?(h=t.presenceContext)===null||h===void 0?void 0:h.custom:void 0);if(f){const{transition:p,transitionEnd:m,...v}=f;u={...u,...v,...m}}return u};function i(c){e=c(t)}function o(c){const{props:u}=t,d=mxe(t.parent)||{},h=[],f=new Set;let p={},m=1/0;for(let x=0;x<lWe;x++){const g=oWe[x],w=n[g],_=u[g]!==void 0?u[g]:d[g],j=xk(_),N=g===c?w.isActive:null;N===!1&&(m=x);let S=_===d[g]&&_!==u[g]&&j;if(S&&r&&t.manuallyAnimateOnMount&&(S=!1),w.protectedKeys={...p},!w.isActive&&N===null||!_&&!w.prevProp||E3(_)||typeof _=="boolean")continue;const C=dWe(w.prevProp,_);let k=C||g===c&&w.isActive&&!S&&j||x>m&&j,E=!1;const P=Array.isArray(_)?_:[_];let T=P.reduce(s(g),{});N===!1&&(T={});const{prevResolvedValues:M={}}=w,R={...M,...T},A=O=>{k=!0,f.has(O)&&(E=!0,f.delete(O)),w.needsAnimating[O]=!0;const z=t.getValue(O);z&&(z.liveStyle=!1)};for(const O in R){const z=T[O],B=M[O];if(p.hasOwnProperty(O))continue;let G=!1;h8(z)&&h8(B)?G=!kve(z,B):G=z!==B,G?z!=null?A(O):f.add(O):z!==void 0&&f.has(O)?A(O):w.protectedKeys[O]=!0}w.prevProp=_,w.prevResolvedValues=T,w.isActive&&(p={...p,...T}),r&&t.blockInitialAnimation&&(k=!1),k&&(!(S&&C)||E)&&h.push(...P.map(O=>({animation:O,options:{type:g}})))}if(f.size){const x={};f.forEach(g=>{const w=t.getBaseTarget(g),_=t.getValue(g);_&&(_.liveStyle=!0),x[g]=w??null}),h.push({animation:x})}let v=!!h.length;return r&&(u.initial===!1||u.initial===u.animate)&&!t.manuallyAnimateOnMount&&(v=!1),r=!1,v?e(h):Promise.resolve()}function l(c,u){var d;if(n[c].isActive===u)return Promise.resolve();(d=t.variantChildren)===null||d===void 0||d.forEach(f=>{var p;return(p=f.animationState)===null||p===void 0?void 0:p.setActive(c,u)}),n[c].isActive=u;const h=o(c);for(const f in n)n[f].protectedKeys={};return h}return{animateChanges:o,setActive:l,setAnimateFunction:i,getState:()=>n,reset:()=>{n=qZ(),r=!0}}}function dWe(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!kve(e,t):!1}function xv(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function qZ(){return{animate:xv(!0),whileInView:xv(),whileHover:xv(),whileTap:xv(),whileDrag:xv(),whileFocus:xv(),exit:xv()}}class sv{constructor(e){this.isMounted=!1,this.node=e}update(){}}class hWe extends sv{constructor(e){super(e),e.animationState||(e.animationState=uWe(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();E3(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)===null||e===void 0||e.call(this)}}let fWe=0;class pWe extends sv{constructor(){super(...arguments),this.id=fWe++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;const s=this.node.animationState.setActive("exit",!e);n&&!e&&s.then(()=>n(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const mWe={animation:{Feature:hWe},exit:{Feature:pWe}};function wk(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function g2(t){return{point:{x:t.pageX,y:t.pageY}}}const gWe=t=>e=>E9(e)&&t(e,g2(e));function pC(t,e,n,r){return wk(t,e,gWe(n),r)}const VZ=(t,e)=>Math.abs(t-e);function vWe(t,e){const n=VZ(t.x,e.x),r=VZ(t.y,e.y);return Math.sqrt(n**2+r**2)}class gxe{constructor(e,n,{transformPagePoint:r,contextWindow:s,dragSnapToOrigin:i=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const h=e5(this.lastMoveEventInfo,this.history),f=this.startEvent!==null,p=vWe(h.offset,{x:0,y:0})>=3;if(!f&&!p)return;const{point:m}=h,{timestamp:v}=ci;this.history.push({...m,timestamp:v});const{onStart:x,onMove:g}=this.handlers;f||(x&&x(this.lastMoveEvent,h),this.startEvent=this.lastMoveEvent),g&&g(this.lastMoveEvent,h)},this.handlePointerMove=(h,f)=>{this.lastMoveEvent=h,this.lastMoveEventInfo=Z$(f,this.transformPagePoint),kn.update(this.updatePoint,!0)},this.handlePointerUp=(h,f)=>{this.end();const{onEnd:p,onSessionEnd:m,resumeAnimation:v}=this.handlers;if(this.dragSnapToOrigin&&v&&v(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const x=e5(h.type==="pointercancel"?this.lastMoveEventInfo:Z$(f,this.transformPagePoint),this.history);this.startEvent&&p&&p(h,x),m&&m(h,x)},!E9(e))return;this.dragSnapToOrigin=i,this.handlers=n,this.transformPagePoint=r,this.contextWindow=s||window;const o=g2(e),l=Z$(o,this.transformPagePoint),{point:c}=l,{timestamp:u}=ci;this.history=[{...c,timestamp:u}];const{onSessionStart:d}=n;d&&d(e,e5(l,this.history)),this.removeListeners=m2(pC(this.contextWindow,"pointermove",this.handlePointerMove),pC(this.contextWindow,"pointerup",this.handlePointerUp),pC(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),Du(this.updatePoint)}}function Z$(t,e){return e?{point:e(t.point)}:t}function HZ(t,e){return{x:t.x-e.x,y:t.y-e.y}}function e5({point:t},e){return{point:t,delta:HZ(t,vxe(e)),offset:HZ(t,xWe(e)),velocity:yWe(e,.1)}}function xWe(t){return t[0]}function vxe(t){return t[t.length-1]}function yWe(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,r=null;const s=vxe(t);for(;n>=0&&(r=t[n],!(s.timestamp-r.timestamp>zf(e)));)n--;if(!r)return{x:0,y:0};const i=Bf(s.timestamp-r.timestamp);if(i===0)return{x:0,y:0};const o={x:(s.x-r.x)/i,y:(s.y-r.y)/i};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}const xxe=1e-4,bWe=1-xxe,wWe=1+xxe,yxe=.01,_We=0-yxe,jWe=0+yxe;function Ll(t){return t.max-t.min}function SWe(t,e,n){return Math.abs(t-e)<=n}function WZ(t,e,n,r=.5){t.origin=r,t.originPoint=Lr(e.min,e.max,t.origin),t.scale=Ll(n)/Ll(e),t.translate=Lr(n.min,n.max,t.origin)-t.originPoint,(t.scale>=bWe&&t.scale<=wWe||isNaN(t.scale))&&(t.scale=1),(t.translate>=_We&&t.translate<=jWe||isNaN(t.translate))&&(t.translate=0)}function mC(t,e,n,r){WZ(t.x,e.x,n.x,r?r.originX:void 0),WZ(t.y,e.y,n.y,r?r.originY:void 0)}function KZ(t,e,n){t.min=n.min+e.min,t.max=t.min+Ll(e)}function NWe(t,e,n){KZ(t.x,e.x,n.x),KZ(t.y,e.y,n.y)}function GZ(t,e,n){t.min=e.min-n.min,t.max=t.min+Ll(e)}function gC(t,e,n){GZ(t.x,e.x,n.x),GZ(t.y,e.y,n.y)}function CWe(t,{min:e,max:n},r){return e!==void 0&&t<e?t=r?Lr(e,t,r.min):Math.max(t,e):n!==void 0&&t>n&&(t=r?Lr(n,t,r.max):Math.min(t,n)),t}function YZ(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function kWe(t,{top:e,left:n,bottom:r,right:s}){return{x:YZ(t.x,n,s),y:YZ(t.y,e,r)}}function XZ(t,e){let n=e.min-t.min,r=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,r]=[r,n]),{min:n,max:r}}function AWe(t,e){return{x:XZ(t.x,e.x),y:XZ(t.y,e.y)}}function EWe(t,e){let n=.5;const r=Ll(t),s=Ll(e);return s>r?n=s0(e.min,e.max-r,t.min):r>s&&(n=s0(t.min,t.max-s,e.min)),ah(0,1,n)}function TWe(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const j8=.35;function PWe(t=j8){return t===!1?t=0:t===!0&&(t=j8),{x:JZ(t,"left","right"),y:JZ(t,"top","bottom")}}function JZ(t,e,n){return{min:QZ(t,e),max:QZ(t,n)}}function QZ(t,e){return typeof t=="number"?t:t[e]||0}const ZZ=()=>({translate:0,scale:1,origin:0,originPoint:0}),cw=()=>({x:ZZ(),y:ZZ()}),eee=()=>({min:0,max:0}),ps=()=>({x:eee(),y:eee()});function Zl(t){return[t("x"),t("y")]}function bxe({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}function MWe({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function RWe(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function t5(t){return t===void 0||t===1}function S8({scale:t,scaleX:e,scaleY:n}){return!t5(t)||!t5(e)||!t5(n)}function Rv(t){return S8(t)||wxe(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function wxe(t){return tee(t.x)||tee(t.y)}function tee(t){return t&&t!=="0%"}function XO(t,e,n){const r=t-n,s=e*r;return n+s}function nee(t,e,n,r,s){return s!==void 0&&(t=XO(t,s,r)),XO(t,n,r)+e}function N8(t,e=0,n=1,r,s){t.min=nee(t.min,e,n,r,s),t.max=nee(t.max,e,n,r,s)}function _xe(t,{x:e,y:n}){N8(t.x,e.translate,e.scale,e.originPoint),N8(t.y,n.translate,n.scale,n.originPoint)}const ree=.999999999999,see=1.0000000000001;function OWe(t,e,n,r=!1){const s=n.length;if(!s)return;e.x=e.y=1;let i,o;for(let l=0;l<s;l++){i=n[l],o=i.projectionDelta;const{visualElement:c}=i.options;c&&c.props.style&&c.props.style.display==="contents"||(r&&i.options.layoutScroll&&i.scroll&&i!==i.root&&dw(t,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),o&&(e.x*=o.x.scale,e.y*=o.y.scale,_xe(t,o)),r&&Rv(i.latestValues)&&dw(t,i.latestValues))}e.x<see&&e.x>ree&&(e.x=1),e.y<see&&e.y>ree&&(e.y=1)}function uw(t,e){t.min=t.min+e,t.max=t.max+e}function iee(t,e,n,r,s=.5){const i=Lr(t.min,t.max,s);N8(t,e,n,i,r)}function dw(t,e){iee(t.x,e.x,e.scaleX,e.scale,e.originX),iee(t.y,e.y,e.scaleY,e.scale,e.originY)}function jxe(t,e){return bxe(RWe(t.getBoundingClientRect(),e))}function IWe(t,e,n){const r=jxe(t,n),{scroll:s}=e;return s&&(uw(r.x,s.offset.x),uw(r.y,s.offset.y)),r}const Sxe=({current:t})=>t?t.ownerDocument.defaultView:null,DWe=new WeakMap;class LWe{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ps(),this.visualElement=e}start(e,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const s=d=>{const{dragSnapToOrigin:h}=this.getProps();h?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(g2(d).point)},i=(d,h)=>{const{drag:f,dragPropagation:p,onDragStart:m}=this.getProps();if(f&&!p&&(this.openDragLock&&this.openDragLock(),this.openDragLock=MVe(f),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Zl(x=>{let g=this.getAxisMotionValue(x).get()||0;if(Zd.test(g)){const{projection:w}=this.visualElement;if(w&&w.layout){const _=w.layout.layoutBox[x];_&&(g=Ll(_)*(parseFloat(g)/100))}}this.originPoint[x]=g}),m&&kn.postRender(()=>m(d,h)),m8(this.visualElement,"transform");const{animationState:v}=this.visualElement;v&&v.setActive("whileDrag",!0)},o=(d,h)=>{const{dragPropagation:f,dragDirectionLock:p,onDirectionLock:m,onDrag:v}=this.getProps();if(!f&&!this.openDragLock)return;const{offset:x}=h;if(p&&this.currentDirection===null){this.currentDirection=FWe(x),this.currentDirection!==null&&m&&m(this.currentDirection);return}this.updateAxis("x",h.point,x),this.updateAxis("y",h.point,x),this.visualElement.render(),v&&v(d,h)},l=(d,h)=>this.stop(d,h),c=()=>Zl(d=>{var h;return this.getAnimationState(d)==="paused"&&((h=this.getAxisMotionValue(d).animation)===null||h===void 0?void 0:h.play())}),{dragSnapToOrigin:u}=this.getProps();this.panSession=new gxe(e,{onSessionStart:s,onStart:i,onMove:o,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:Sxe(this.visualElement)})}stop(e,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:s}=n;this.startAnimation(s);const{onDragEnd:i}=this.getProps();i&&kn.postRender(()=>i(e,n))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(e,n,r){const{drag:s}=this.getProps();if(!r||!tP(e,s,this.currentDirection))return;const i=this.getAxisMotionValue(e);let o=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(o=CWe(o,this.constraints[e],this.elastic[e])),i.set(o)}resolveConstraints(){var e;const{dragConstraints:n,dragElastic:r}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(e=this.visualElement.projection)===null||e===void 0?void 0:e.layout,i=this.constraints;n&&ow(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&s?this.constraints=kWe(s.layoutBox,n):this.constraints=!1,this.elastic=PWe(r),i!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&Zl(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=TWe(s.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!ow(e))return!1;const r=e.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const i=IWe(r,s.root,this.visualElement.getTransformPagePoint());let o=AWe(s.layout.layoutBox,i);if(n){const l=n(MWe(o));this.hasMutatedConstraints=!!l,l&&(o=bxe(l))}return o}startAnimation(e){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},u=Zl(d=>{if(!tP(d,n,this.currentDirection))return;let h=c&&c[d]||{};o&&(h={min:0,max:0});const f=s?200:1e6,p=s?40:1e7,m={type:"inertia",velocity:r?e[d]:0,bounceStiffness:f,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...i,...h};return this.startAxisValueAnimation(d,m)});return Promise.all(u).then(l)}startAxisValueAnimation(e,n){const r=this.getAxisMotionValue(e);return m8(this.visualElement,e),r.start(q9(e,r,0,n,this.visualElement,!1))}stopAnimation(){Zl(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){Zl(e=>{var n;return(n=this.getAxisMotionValue(e).animation)===null||n===void 0?void 0:n.pause()})}getAnimationState(e){var n;return(n=this.getAxisMotionValue(e).animation)===null||n===void 0?void 0:n.state}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,r=this.visualElement.getProps(),s=r[n];return s||this.visualElement.getValue(e,(r.initial?r.initial[e]:void 0)||0)}snapToCursor(e){Zl(n=>{const{drag:r}=this.getProps();if(!tP(n,r,this.currentDirection))return;const{projection:s}=this.visualElement,i=this.getAxisMotionValue(n);if(s&&s.layout){const{min:o,max:l}=s.layout.layoutBox[n];i.set(e[n]-Lr(o,l,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!ow(n)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};Zl(o=>{const l=this.getAxisMotionValue(o);if(l&&this.constraints!==!1){const c=l.get();s[o]=EWe({min:c,max:c},this.constraints[o])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),Zl(o=>{if(!tP(o,e,null))return;const l=this.getAxisMotionValue(o),{min:c,max:u}=this.constraints[o];l.set(Lr(c,u,s[o]))})}addListeners(){if(!this.visualElement.current)return;DWe.set(this.visualElement,this);const e=this.visualElement.current,n=pC(e,"pointerdown",c=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(c)}),r=()=>{const{dragConstraints:c}=this.getProps();ow(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,i=s.addEventListener("measure",r);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),kn.read(r);const o=wk(window,"resize",()=>this.scalePositionWithinConstraints()),l=s.addEventListener("didUpdate",({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(Zl(d=>{const h=this.getAxisMotionValue(d);h&&(this.originPoint[d]+=c[d].translate,h.set(h.get()+c[d].translate))}),this.visualElement.render())});return()=>{o(),n(),i(),l&&l()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:i=!1,dragElastic:o=j8,dragMomentum:l=!0}=e;return{...e,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:i,dragElastic:o,dragMomentum:l}}}function tP(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function FWe(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class $We extends sv{constructor(e){super(e),this.removeGroupControls=co,this.removeListeners=co,this.controls=new LWe(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||co}unmount(){this.removeGroupControls(),this.removeListeners()}}const aee=t=>(e,n)=>{t&&kn.postRender(()=>t(e,n))};class zWe extends sv{constructor(){super(...arguments),this.removePointerDownListener=co}onPointerDown(e){this.session=new gxe(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Sxe(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:aee(e),onStart:aee(n),onMove:r,onEnd:(i,o)=>{delete this.session,s&&kn.postRender(()=>s(i,o))}}}mount(){this.removePointerDownListener=pC(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const zM={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function oee(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const wS={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(Tt.test(t))t=parseFloat(t);else return t;const n=oee(t,e.target.x),r=oee(t,e.target.y);return`${n}% ${r}%`}},BWe={correct:(t,{treeScale:e,projectionDelta:n})=>{const r=t,s=Fg.parse(t);if(s.length>5)return r;const i=Fg.createTransformer(t),o=typeof s[0]!="number"?1:0,l=n.x.scale*e.x,c=n.y.scale*e.y;s[0+o]/=l,s[1+o]/=c;const u=Lr(l,c,.5);return typeof s[2+o]=="number"&&(s[2+o]/=u),typeof s[3+o]=="number"&&(s[3+o]/=u),i(s)}};class UWe extends b.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:i}=e;fVe(qWe),i&&(n.group&&n.group.add(i),r&&r.register&&s&&r.register(i),i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),zM.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:r,drag:s,isPresent:i}=this.props,o=r.projection;return o&&(o.isPresent=i,s||e.layoutDependency!==n||n===void 0?o.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?o.promote():o.relegate()||kn.postRender(()=>{const l=o.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),m9.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=e;s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function Nxe(t){const[e,n]=Aqe(),r=b.useContext(lve);return a.jsx(UWe,{...t,layoutGroup:r,switchLayoutGroup:b.useContext(pve),isPresent:e,safeToRemove:n})}const qWe={borderRadius:{...wS,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:wS,borderTopRightRadius:wS,borderBottomLeftRadius:wS,borderBottomRightRadius:wS,boxShadow:BWe};function VWe(t,e,n){const r=_a(t)?t:Hd(t);return r.start(q9("",r,e,n)),r.animation}function HWe(t){return t instanceof SVGElement&&t.tagName!=="svg"}const WWe=(t,e)=>t.depth-e.depth;class KWe{constructor(){this.children=[],this.isDirty=!1}add(e){T9(this.children,e),this.isDirty=!0}remove(e){P9(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(WWe),this.isDirty=!1,this.children.forEach(e)}}function GWe(t,e){const n=eh.now(),r=({timestamp:s})=>{const i=s-n;i>=e&&(Du(r),t(i-e))};return kn.read(r,!0),()=>Du(r)}const Cxe=["TopLeft","TopRight","BottomLeft","BottomRight"],YWe=Cxe.length,lee=t=>typeof t=="string"?parseFloat(t):t,cee=t=>typeof t=="number"||Tt.test(t);function XWe(t,e,n,r,s,i){s?(t.opacity=Lr(0,n.opacity!==void 0?n.opacity:1,JWe(r)),t.opacityExit=Lr(e.opacity!==void 0?e.opacity:1,0,QWe(r))):i&&(t.opacity=Lr(e.opacity!==void 0?e.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let o=0;o<YWe;o++){const l=`border${Cxe[o]}Radius`;let c=uee(e,l),u=uee(n,l);if(c===void 0&&u===void 0)continue;c||(c=0),u||(u=0),c===0||u===0||cee(c)===cee(u)?(t[l]=Math.max(Lr(lee(c),lee(u),r),0),(Zd.test(u)||Zd.test(c))&&(t[l]+="%")):t[l]=u}(e.rotate||n.rotate)&&(t.rotate=Lr(e.rotate||0,n.rotate||0,r))}function uee(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const JWe=kxe(0,.5,Vve),QWe=kxe(.5,.95,co);function kxe(t,e,n){return r=>r<t?0:r>e?1:n(s0(t,e,r))}function dee(t,e){t.min=e.min,t.max=e.max}function Hl(t,e){dee(t.x,e.x),dee(t.y,e.y)}function hee(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function fee(t,e,n,r,s){return t-=e,t=XO(t,1/n,r),s!==void 0&&(t=XO(t,1/s,r)),t}function ZWe(t,e=0,n=1,r=.5,s,i=t,o=t){if(Zd.test(e)&&(e=parseFloat(e),e=Lr(o.min,o.max,e/100)-o.min),typeof e!="number")return;let l=Lr(i.min,i.max,r);t===i&&(l-=e),t.min=fee(t.min,e,n,l,s),t.max=fee(t.max,e,n,l,s)}function pee(t,e,[n,r,s],i,o){ZWe(t,e[n],e[r],e[s],e.scale,i,o)}const e9e=["x","scaleX","originX"],t9e=["y","scaleY","originY"];function mee(t,e,n,r){pee(t.x,e,e9e,n?n.x:void 0,r?r.x:void 0),pee(t.y,e,t9e,n?n.y:void 0,r?r.y:void 0)}function gee(t){return t.translate===0&&t.scale===1}function Axe(t){return gee(t.x)&&gee(t.y)}function vee(t,e){return t.min===e.min&&t.max===e.max}function n9e(t,e){return vee(t.x,e.x)&&vee(t.y,e.y)}function xee(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function Exe(t,e){return xee(t.x,e.x)&&xee(t.y,e.y)}function yee(t){return Ll(t.x)/Ll(t.y)}function bee(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class r9e{constructor(){this.members=[]}add(e){T9(this.members,e),e.scheduleRender()}remove(e){if(P9(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){const n=this.members.findIndex(s=>e===s);if(n===0)return!1;let r;for(let s=n;s>=0;s--){const i=this.members[s];if(i.isPresent!==!1){r=i;break}}return r?(this.promote(r),!0):!1}promote(e,n){const r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.instance&&r.scheduleRender(),e.scheduleRender(),e.resumeFrom=r,n&&(e.resumeFrom.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:s}=e.options;s===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:n,resumingFrom:r}=e;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function s9e(t,e,n){let r="";const s=t.x.translate/e.x,i=t.y.translate/e.y,o=(n==null?void 0:n.z)||0;if((s||i||o)&&(r=`translate3d(${s}px, ${i}px, ${o}px) `),(e.x!==1||e.y!==1)&&(r+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:u,rotate:d,rotateX:h,rotateY:f,skewX:p,skewY:m}=n;u&&(r=`perspective(${u}px) ${r}`),d&&(r+=`rotate(${d}deg) `),h&&(r+=`rotateX(${h}deg) `),f&&(r+=`rotateY(${f}deg) `),p&&(r+=`skewX(${p}deg) `),m&&(r+=`skewY(${m}deg) `)}const l=t.x.scale*e.x,c=t.y.scale*e.y;return(l!==1||c!==1)&&(r+=`scale(${l}, ${c}
881)`),r||"none"}const Ov={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},lN=typeof window<"u"&&window.MotionDebug!==void 0,n5=["","X","Y","Z"],i9e={visibility:"hidden"},wee=1e3;let a9e=0;function r5(t,e,n,r){const{latestValues:s}=e;s[t]&&(n[t]=s[t],e.setStaticValue(t,0),r&&(r[t]=0))}function Txe(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=Lve(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:i}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",kn,!(s||i))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&Txe(r)}function Pxe({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(o={},l=e==null?void 0:e()){this.id=a9e++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,lN&&(Ov.totalNodes=Ov.resolvedTargetDeltas=Ov.recalculatedProjection=0),this.nodes.forEach(c9e),this.nodes.forEach(p9e),this.nodes.forEach(m9e),this.nodes.forEach(u9e),lN&&window.MotionDebug.record(Ov)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let c=0;c<this.path.length;c++)this.path[c].shouldResetTransform=!0;this.root===this&&(this.nodes=new KWe)}addEventListener(o,l){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new M9),this.eventHandlers.get(o).add(l)}notifyListeners(o,...l){const c=this.eventHandlers.get(o);c&&c.notify(...l)}hasListeners(o){return this.eventHandlers.has(o)}mount(o,l=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=HWe(o),this.instance=o;const{layoutId:c,layout:u,visualElement:d}=this.options;if(d&&!d.current&&d.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),l&&(u||c)&&(this.isLayoutDirty=!0),t){let h;const f=()=>this.root.updateBlockedByResize=!1;t(o,()=>{this.root.updateBlockedByResize=!0,h&&h(),h=GWe(f,250),zM.hasAnimatedSinceResize&&(zM.hasAnimatedSinceResize=!1,this.nodes.forEach(jee))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&d&&(c||u)&&this.addEventListener("didUpdate",({delta:h,hasLayoutChanged:f,hasRelativeTargetChanged:p,layout:m})=>
vendor: 17,795 bytes, line 881
881{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const v=this.options.transition||d.getDefaultTransition()||b9e,{onLayoutAnimationStart:x,onLayoutAnimationComplete:g}=d.getProps(),w=!this.targetLayout||!Exe(this.targetLayout,m)||p,_=!f&&p;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||_||f&&(w||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(h,_);const j={...N9(v,"layout"),onPlay:x,onComplete:g};(d.shouldReduceMotion||this.options.layoutRoot)&&(j.delay=0,j.type=!1),this.startAnimation(j)}else f||jee(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=m})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Du(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(g9e),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Txe(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d<this.path.length;d++){const h=this.path[d];h.shouldResetTransform=!0,h.updateScroll("snapshot"),h.options.layoutRoot&&h.willUpdate(!1)}const{layoutId:l,layout:c}=this.options;if(l===void 0&&!c)return;const u=this.getTransformTemplate();this.prevTransformTemplateValue=u?u(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(_ee);return}this.isUpdating||this.nodes.forEach(h9e),this.isUpdating=!1,this.nodes.forEach(f9e),this.nodes.forEach(o9e),this.nodes.forEach(l9e),this.clearAllSnapshots();const l=eh.now();ci.delta=ah(0,1e3/60,l-ci.timestamp),ci.timestamp=l,ci.isProcessing=!0,K$.update.process(ci),K$.preRender.process(ci),K$.render.process(ci),ci.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,m9.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(d9e),this.sharedNodes.forEach(v9e)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,kn.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){kn.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c<this.path.length;c++)this.path[c].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutCorrected=ps(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:l}=this.options;l&&l.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let l=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(l=!1),l){const c=r(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:c,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:c}}}resetTransform(){if(!s)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,l=this.projectionDelta&&!Axe(this.projectionDelta),c=this.getTransformTemplate(),u=c?c(this.latestValues,""):void 0,d=u!==this.prevTransformTemplateValue;o&&(l||Rv(this.latestValues)||d)&&(s(this.instance,u),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const l=this.measurePageBox();let c=this.removeElementScroll(l);return o&&(c=this.removeTransform(c)),w9e(c),{animationId:this.root.animationId,measuredBox:l,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){var o;const{visualElement:l}=this.options;if(!l)return ps();const c=l.measureViewportBox();if(!(((o=this.scroll)===null||o===void 0?void 0:o.wasRoot)||this.path.some(_9e))){const{scroll:d}=this.root;d&&(uw(c.x,d.offset.x),uw(c.y,d.offset.y))}return c}removeElementScroll(o){var l;const c=ps();if(Hl(c,o),!((l=this.scroll)===null||l===void 0)&&l.wasRoot)return c;for(let u=0;u<this.path.length;u++){const d=this.path[u],{scroll:h,options:f}=d;d!==this.root&&h&&f.layoutScroll&&(h.wasRoot&&Hl(c,o),uw(c.x,h.offset.x),uw(c.y,h.offset.y))}return c}applyTransform(o,l=!1){const c=ps();Hl(c,o);for(let u=0;u<this.path.length;u++){const d=this.path[u];!l&&d.options.layoutScroll&&d.scroll&&d!==d.root&&dw(c,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),Rv(d.latestValues)&&dw(c,d.latestValues)}return Rv(this.latestValues)&&dw(c,this.latestValues),c}removeTransform(o){const l=ps();Hl(l,o);for(let c=0;c<this.path.length;c++){const u=this.path[c];if(!u.instance||!Rv(u.latestValues))continue;S8(u.latestValues)&&u.updateSnapshot();const d=ps(),h=u.measurePageBox();Hl(d,h),mee(l,u.latestValues,u.snapshot?u.snapshot.layoutBox:void 0,d)}return Rv(this.latestValues)&&mee(l,this.latestValues),l}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==ci.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){var l;const c=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=c.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=c.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=c.isSharedProjectionDirty);const u=!!this.resumingFrom||this!==c;if(!(o||u&&this.isSharedProjectionDirty||this.isProjectionDirty||!((l=this.parent)===null||l===void 0)&&l.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:h,layoutId:f}=this.options;if(!(!this.layout||!(h||f))){if(this.resolvedRelativeTargetAt=ci.timestamp,!this.targetDelta&&!this.relativeTarget){const p=this.getClosestProjectingParent();p&&p.layout&&this.animationProgress!==1?(this.relativeParent=p,this.forceRelativeParentToResolveTarget(),this.relativeTarget=ps(),this.relativeTargetOrigin=ps(),gC(this.relativeTargetOrigin,this.layout.layoutBox,p.layout.layoutBox),Hl(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=ps(),this.targetWithTransforms=ps()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),NWe(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Hl(this.target,this.layout.layoutBox),_xe(this.target,this.targetDelta)):Hl(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const p=this.getClosestProjectingParent();p&&!!p.resumingFrom==!!this.resumingFrom&&!p.options.layoutScroll&&p.target&&this.animationProgress!==1?(this.relativeParent=p,this.forceRelativeParentToResolveTarget(),this.relativeTarget=ps(),this.relativeTargetOrigin=ps(),gC(this.relativeTargetOrigin,this.target,p.target),Hl(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}lN&&Ov.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||S8(this.parent.latestValues)||wxe(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var o;const l=this.getLead(),c=!!this.resumingFrom||this!==l;let u=!0;if((this.isProjectionDirty||!((o=this.parent)===null||o===void 0)&&o.isProjectionDirty)&&(u=!1),c&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(u=!1),this.resolvedRelativeTargetAt===ci.timestamp&&(u=!1),u)return;const{layout:d,layoutId:h}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(d||h))return;Hl(this.layoutCorrected,this.layout.layoutBox);const f=this.treeScale.x,p=this.treeScale.y;OWe(this.layoutCorrected,this.treeScale,this.path,c),l.layout&&!l.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(l.target=l.layout.layoutBox,l.targetWithTransforms=ps());const{target:m}=l;if(!m){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(hee(this.prevProjectionDelta.x,this.projectionDelta.x),hee(this.prevProjectionDelta.y,this.projectionDelta.y)),mC(this.projectionDelta,this.layoutCorrected,m,this.latestValues),(this.treeScale.x!==f||this.treeScale.y!==p||!bee(this.projectionDelta.x,this.prevProjectionDelta.x)||!bee(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",m)),lN&&Ov.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){var l;if((l=this.options.visualElement)===null||l===void 0||l.scheduleRender(),o){const c=this.getStack();c&&c.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=cw(),this.projectionDelta=cw(),this.projectionDeltaWithTransform=cw()}setAnimationOrigin(o,l=!1){const c=this.snapshot,u=c?c.latestValues:{},d={...this.latestValues},h=cw();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!l;const f=ps(),p=c?c.source:void 0,m=this.layout?this.layout.source:void 0,v=p!==m,x=this.getStack(),g=!x||x.members.length<=1,w=!!(v&&!g&&this.options.crossfade===!0&&!this.path.some(y9e));this.animationProgress=0;let _;this.mixTargetDelta=j=>{const N=j/1e3;See(h.x,o.x,N),See(h.y,o.y,N),this.setTargetDelta(h),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(gC(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox),x9e(this.relativeTarget,this.relativeTargetOrigin,f,N),_&&n9e(this.relativeTarget,_)&&(this.isProjectionDirty=!1),_||(_=ps()),Hl(_,this.relativeTarget)),v&&(this.animationValues=d,XWe(d,u,this.latestValues,N,w,g)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=N},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Du(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=kn.update(()=>{zM.hasAnimatedSinceResize=!0,this.currentAnimation=VWe(0,wee,{...o,onUpdate:l=>{this.mixTargetDelta(l),o.onUpdate&&o.onUpdate(l)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(wee),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:l,target:c,layout:u,latestValues:d}=o;if(!(!l||!c||!u)){if(this!==o&&this.layout&&u&&Mxe(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||ps();const h=Ll(this.layout.layoutBox.x);c.x.min=o.target.x.min,c.x.max=c.x.min+h;const f=Ll(this.layout.layoutBox.y);c.y.min=o.target.y.min,c.y.max=c.y.min+f}Hl(l,c),dw(l,d),mC(this.projectionDeltaWithTransform,this.layoutCorrected,l,d)}}registerSharedNode(o,l){this.sharedNodes.has(o)||this.sharedNodes.set(o,new r9e),this.sharedNodes.get(o).add(l);const u=l.options.initialPromotionConfig;l.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(l):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:l}=this.options;return l?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:l}=this.options;return l?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:l,preserveFollowOpacity:c}={}){const u=this.getStack();u&&u.promote(this,c),o&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let l=!1;const{latestValues:c}=o;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(l=!0),!l)return;const u={};c.z&&r5("z",o,u,this.animationValues);for(let d=0;d<n5.length;d++)r5(`rotate${n5[d]}`,o,u,this.animationValues),r5(`skew${n5[d]}`,o,u,this.animationValues);o.render();for(const d in u)o.setStaticValue(d,u[d]),this.animationValues&&(this.animationValues[d]=u[d]);o.scheduleRender()}getProjectionStyles(o){var l,c;if(!this.instance||this.isSVG)return;if(!this.isVisible)return i9e;const u={visibility:""},d=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,u.opacity="",u.pointerEvents=FM(o==null?void 0:o.pointerEvents)||"",u.transform=d?d(this.latestValues,""):"none",u;const h=this.getLead();if(!this.projectionDelta||!this.layout||!h.target){const v={};return this.options.layoutId&&(v.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,v.pointerEvents=FM(o==null?void 0:o.pointerEvents)||""),this.hasProjected&&!Rv(this.latestValues)&&(v.transform=d?d({},""):"none",this.hasProjected=!1),v}const f=h.animationValues||h.latestValues;this.applyTransformsToTarget(),u.transform=s9e(this.projectionDeltaWithTransform,this.treeScale,f),d&&(u.transform=d(f,u.transform));const{x:p,y:m}=this.projectionDelta;u.transformOrigin=`${p.origin*100}% ${m.origin*100}% 0`,h.animationValues?u.opacity=h===this?(c=(l=f.opacity)!==null&&l!==void 0?l:this.latestValues.opacity)!==null&&c!==void 0?c:1:this.preserveOpacity?this.latestValues.opacity:f.opacityExit:u.opacity=h===this?f.opacity!==void 0?f.opacity:"":f.opacityExit!==void 0?f.opacityExit:0;for(const v in HO){if(f[v]===void 0)continue;const{correct:x,applyTo:g}=HO[v],w=u.transform==="none"?f[v]:x(f[v],h);if(g){const _=g.length;for(let j=0;j<_;j++)u[g[j]]=w}else u[v]=w}return this.options.layoutId&&(u.pointerEvents=h===this?FM(o==null?void 0:o.pointerEvents)||"":"none"),u}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>{var l;return(l=o.currentAnimation)===null||l===void 0?void 0:l.stop()}),this.root.nodes.forEach(_ee),this.root.sharedNodes.clear()}}}function o9e(t){t.updateLayout()}function l9e(t){var e;const n=((e=t.resumeFrom)===null||e===void 0?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&n&&t.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:s}=t.layout,{animationType:i}=t.options,o=n.source!==t.layout.source;i==="size"?Zl(h=>{const f=o?n.measuredBox[h]:n.layoutBox[h],p=Ll(f);f.min=r[h].min,f.max=f.min+p}):Mxe(i,n.layoutBox,r)&&Zl(h=>{const f=o?n.measuredBox[h]:n.layoutBox[h],p=Ll(r[h]);f.max=f.min+p,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[h].max=t.relativeTarget[h].min+p)});const l=cw();mC(l,r,n.layoutBox);const c=cw();o?mC(c,t.applyTransform(s,!0),n.measuredBox):mC(c,r,n.layoutBox);const u=!Axe(l);let d=!1;if(!t.resumeFrom){const h=t.getClosestProjectingParent();if(h&&!h.resumeFrom){const{snapshot:f,layout:p}=h;if(f&&p){const m=ps();gC(m,n.layoutBox,f.layoutBox);const v=ps();gC(v,r,p.layoutBox),Exe(m,v)||(d=!0),h.options.layoutRoot&&(t.relativeTarget=v,t.relativeTargetOrigin=m,t.relativeParent=h)}}}t.notifyListeners("didUpdate",{layout:r,snapshot:n,delta:c,layoutDelta:l,hasLayoutChanged:u,hasRelativeTargetChanged:d})}else if(t.isLead()){const{onExitComplete:r}=t.options;r&&r()}t.options.transition=void 0}function c9e(t){lN&&Ov.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.
vendor: 7,335 bytes, line 881
881isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function u9e(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function d9e(t){t.clearSnapshot()}function _ee(t){t.clearMeasurements()}function h9e(t){t.isLayoutDirty=!1}function f9e(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function jee(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function p9e(t){t.resolveTargetDelta()}function m9e(t){t.calcProjection()}function g9e(t){t.resetSkewAndRotation()}function v9e(t){t.removeLeadSnapshot()}function See(t,e,n){t.translate=Lr(e.translate,0,n),t.scale=Lr(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function Nee(t,e,n,r){t.min=Lr(e.min,n.min,r),t.max=Lr(e.max,n.max,r)}function x9e(t,e,n,r){Nee(t.x,e.x,n.x,r),Nee(t.y,e.y,n.y,r)}function y9e(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const b9e={duration:.45,ease:[.4,0,.1,1]},Cee=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),kee=Cee("applewebkit/")&&!Cee("chrome/")?Math.round:co;function Aee(t){t.min=kee(t.min),t.max=kee(t.max)}function w9e(t){Aee(t.x),Aee(t.y)}function Mxe(t,e,n){return t==="position"||t==="preserve-aspect"&&!SWe(yee(e),yee(n),.2)}function _9e(t){var e;return t!==t.root&&((e=t.scroll)===null||e===void 0?void 0:e.wasRoot)}const j9e=Pxe({attachResizeListener:(t,e)=>wk(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),s5={current:void 0},Rxe=Pxe({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!s5.current){const t=new j9e({});t.mount(window),t.setOptions({layoutScroll:!0}),s5.current=t}return s5.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),S9e={pan:{Feature:zWe},drag:{Feature:$We,ProjectionNode:Rxe,MeasureLayout:Nxe}};function Eee(t,e,n){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover",n==="Start");const s="onHover"+n,i=r[s];i&&kn.postRender(()=>i(e,g2(e)))}class N9e extends sv{mount(){const{current:e}=this.node;e&&(this.unmount=kVe(e,n=>(Eee(this.node,n,"Start"),r=>Eee(this.node,r,"End"))))}unmount(){}}class C9e extends sv{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=m2(wk(this.node.current,"focus",()=>this.onFocus()),wk(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function Tee(t,e,n){const{props:r}=t;t.animationState&&r.whileTap&&t.animationState.setActive("whileTap",n==="Start");const s="onTap"+(n==="End"?"":n),i=r[s];i&&kn.postRender(()=>i(e,g2(e)))}class k9e extends sv{mount(){const{current:e}=this.node;e&&(this.unmount=PVe(e,n=>(Tee(this.node,n,"Start"),(r,{success:s})=>Tee(this.node,r,s?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const C8=new WeakMap,i5=new WeakMap,A9e=t=>{const e=C8.get(t.target);e&&e(t)},E9e=t=>{t.forEach(A9e)};function T9e({root:t,...e}){const n=t||document;i5.has(n)||i5.set(n,{});const r=i5.get(n),s=JSON.stringify(e);return r[s]||(r[s]=new IntersectionObserver(E9e,{root:t,...e})),r[s]}function P9e(t,e,n){const r=T9e(e);return C8.set(t,n),r.observe(t),()=>{C8.delete(t),r.unobserve(t)}}const M9e={some:0,all:1};class R9e extends sv{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:r,amount:s="some",once:i}=e,o={root:n?n.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:M9e[s]},l=c=>{const{isIntersecting:u}=c;if(this.isInView===u||(this.isInView=u,i&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:d,onViewportLeave:h}=this.node.getProps(),f=u?d:h;f&&f(c)};return P9e(this.node.current,o,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(O9e(e,n))&&this.startObserver()}unmount(){}}function O9e({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const I9e={inView:{Feature:R9e},tap:{Feature:k9e},focus:{Feature:C9e},hover:{Feature:N9e}},D9e={layout:{ProjectionNode:Rxe,MeasureLayout:Nxe}},k8={current:null},Oxe={current:!1};function L9e(){if(Oxe.current=!0,!!c9)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>k8.current=t.matches;t.addListener(e),e()}else k8.current=!1}const F9e=[...sxe,ga,Fg],$9e=t=>F9e.find(rxe(t)),Pee=new WeakMap;function z9e(t,e,n){for(const r in e){const s=e[r],i=n[r];if(_a(s))t.addValue(r,s);else if(_a(i))t.addValue(r,Hd(s,{owner:t}));else if(i!==s)if(t.hasValue(r)){const o=t.getValue(r);o.liveStyle===!0?o.jump(s):o.hasAnimated||o.set(s)}else{const o=t.getStaticValue(r);t.addValue(r,Hd(o!==void 0?o:s,{owner:t}))}}for(const r in n)e[r]===void 0&&t.removeValue(r);return e}const Mee=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class B9e{scrapeMotionValuesFromProps(e,n,r){return{}}constructor({parent:e,props:n,presenceContext:r,reducedMotionConfig:s,blockInitialAnimation:i,visualState:o},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=$9,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const p=eh.now();this.renderScheduledAt<p&&(this.renderScheduledAt=p,kn.render(this.render,!1,!0))};const{latestValues:c,renderState:u,onUpdate:d}=o;this.onUpdate=d,this.latestValues=c,this.baseTarget={...c},this.initialValues=n.initial?{...c}:{},this.renderState=u,this.parent=e,this.props=n,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=s,this.options=l,this.blockInitialAnimation=!!i,this.isControllingVariants=T3(n),this.isVariantNode=hve(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:h,...f}=this.scrapeMotionValuesFromProps(n,{},this);for(const p in f){const m=f[p];c[p]!==void 0&&_a(m)&&m.set(c[p],!1)}}mount(e){this.current=e,Pee.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEac
vendor: 6,493 bytes, line 881
881h((n,r)=>this.bindToMotionValue(r,n)),Oxe.current||L9e(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:k8.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Pee.delete(this.current),this.projection&&this.projection.unmount(),Du(this.notifyUpdate),Du(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const n=this.features[e];n&&(n.unmount(),n.isMounted=!1)}this.current=null}bindToMotionValue(e,n){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const r=O0.has(e),s=n.on("change",l=>{this.latestValues[e]=l,this.props.onUpdate&&kn.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),i=n.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{s(),i(),o&&o(),n.owner&&n.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in B_){const n=B_[e];if(!n)continue;const{isEnabled:r,Feature:s}=n;if(!this.features[e]&&s&&r(this.props)&&(this.features[e]=new s(this)),this.features[e]){const i=this.features[e];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):ps()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<Mee.length;r++){const s=Mee[r];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const i="on"+s,o=e[i];o&&(this.propEventSubscriptions[s]=this.on(s,o))}this.prevMotionValues=z9e(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue(),this.onUpdate&&this.onUpdate(this)}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(e),()=>n.variantChildren.delete(e)}addValue(e,n){const r=this.values.get(e);n!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,n),this.values.set(e,n),this.latestValues[e]=n.get())}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return r===void 0&&n!==void 0&&(r=Hd(n===null?void 0:n,{owner:this}),this.addValue(e,r)),r}readValue(e,n){var r;let s=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:(r=this.getBaseTargetFromProps(this.props,e))!==null&&r!==void 0?r:this.readValueFromInstance(this.current,e,this.options);return s!=null&&(typeof s=="string"&&(txe(s)||Wve(s))?s=parseFloat(s):!$9e(s)&&Fg.test(n)&&(s=Qve(e,n)),this.setBaseTarget(e,_a(s)?s.get():s)),_a(s)?s.get():s}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){var n;const{initial:r}=this.props;let s;if(typeof r=="string"||typeof r=="object"){const o=v9(this.props,r,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);o&&(s=o[e])}if(r&&s!==void 0)return s;const i=this.getBaseTargetFromProps(this.props,e);return i!==void 0&&!_a(i)?i:this.initialValues[e]!==void 0&&s===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new M9),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}}class Ixe extends B9e{constructor(){super(...arguments),this.KeyframeResolver=ixe}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){return e.style?e.style[n]:void 0}removeValueFromRenderState(e,{vars:n,style:r}){delete n[e],delete r[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;_a(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function U9e(t){return window.getComputedStyle(t)}class q9e extends Ixe{constructor(){super(...arguments),this.type="html",this.renderInstance=wve}readValueFromInstance(e,n){if(O0.has(n)){const r=F9(n);return r&&r.default||0}else{const r=U9e(e),s=(xve(n)?r.getPropertyValue(n):r[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(e,{transformPagePoint:n}){return jxe(e,n)}build(e,n,r){b9(e,n,r.transformTemplate)}scrapeMotionValuesFromProps(e,n,r){return S9(e,n,r)}}class V9e extends Ixe{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ps}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(O0.has(n)){const r=F9(n);return r&&r.default||0}return n=_ve.has(n)?n:p9(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,r){return Nve(e,n,r)}build(e,n,r){w9(e,n,this.isSVGTag,r.transformTemplate)}renderInstance(e,n,r,s){jve(e,n,r,s)}mount(e){this.isSVGTag=j9(e.tagName),super.mount(e)}}const H9e=(t,e)=>g9(t)?new V9e(e):new q9e(e,{allowProjection:t!==b.Fragment}),W9e=_Ve({...mWe,...I9e,...S9e,...D9e},H9e),Zo=Lqe(W9e);function Dxe(t,e){let n;const r=()=>{const{currentTime:s}=e,o=(s===null?0:s.value)/100;n!==o&&t(o),n=o};return kn.update(r,!0),()=>Du(r)}const BM=new WeakMap;let Fp;function K9e(t,e){if(e){const{inlineSize:n,blockSize:r}=e[0];return{width:n,height:r}}else return t instanceof SVGElement&&"getBBox"in t?t.getBBox():{width:t.offsetWidth,height:t.offsetHeight}}function G9e({target:t,contentRect:e,borderBoxSize:n}){var r;
881(r=BM.get(t))===null||r===void 0||r.forEach(s=>{s({target:t,contentSize:e,get size(){return K9e(t,n)}})})}function Y9e(t){t.forEach(G9e)}function X9e(){typeof ResizeObserver>"u"||(Fp=new ResizeObserver(Y9e))}function J9e(t,e){Fp||X9e();const n=A9(t);return n.forEach(r=>{let s=BM.get(r);s||(s=new Set,BM.set(r,s)),s.add(e),Fp==null||Fp.observe(r)}),()=>{n.forEach(r=>{const s=BM.get(r);s==null||s.delete(e),s!=null&&s.size||Fp==null||Fp.unobserve(r)})}}const UM=new Set;let vC;function Q9e(){vC=()=>{const t={width:window.innerWidth,height:window.innerHeight},e={target:window,size:t,contentSize:t};UM.forEach(n=>n(e))},window.addEventListener("resize",vC)}function Z9e(t){return UM.add(t),vC||Q9e(),()=>{UM.delete(t),!UM.size&&vC&&(vC=void 0)}}function e7e(t,e){return typeof t=="function"?Z9e(t):J9e(t,e)}const t7e=50,Ree=()=>({current:0,offset:[],progress:0,scrollLength:0,targetOffset:0,targetLength:0,containerLength:0,velocity:0}),n7e=()=>({time:0,x:Ree(),y:Ree()}),r7e={x:{length:"Width",position:"Left"},y:{length:"Height",position:"Top"}};function Oee(t,e,n,r){const s=n[e],{length:i,position:o}=r7e[e],l=s.current,c=n.time;s.current=t[`scroll${o}`],s.scrollLength=t[`scroll${i}`]-t[`client${i}`],s.offset.length=0,s.offset[0]=0,s.offset[1]=s.scrollLength,s.progress=s0(0,s.scrollLength,s.current);const u=r-c;s.velocity=u>t7e?0:R9(s.current-l,u)}function s7e(t,e,n){Oee(t,"x",e,n),Oee(t,"y",e,n),e.time=n}function i7e(t,e){const n={x:0,y:0};let r=t;for(;r&&r!==e;)if(r instanceof HTMLElement)n.x+=r.offsetLeft,n.y+=r.offsetTop,r=r.offsetParent;else if(r.tagName==="svg"){const s=r.getBoundingClientRect();r=r.parentElement;const i=r.getBoundingClientRect();n.x+=s.left-i.left,n.y+=s.top-i.top}else if(r instanceof SVGGraphicsElement){const{x:s,y:i}=r.getBBox();n.x+=s,n.y+=i;let o=null,l=r.parentNode;for(;!o;)l.tagName==="svg"&&(o=l),l=r.parentNode;r=o}else break;return n}const A8={start:0,center:.5,end:1};function Iee(t,e,n=0){let r=0;if(t in A8&&(t=A8[t]),typeof t=="string"){const s=parseFloat(t);t.endsWith("px")?r=s:t.endsWith("%")?t=s/100:t.endsWith("vw")?r=s/100*document.documentElement.clientWidth:t.endsWith("vh")?r=s/100*document.documentElement.clientHeight:t=s}return typeof t=="number"&&(r=e*t),n+r}const a7e=[0,0];function o7e(t,e,n,r){let s=Array.isArray(t)?t:a7e,i=0,o=0;return typeof t=="number"?s=[t,t]:typeof t=="string"&&(t=t.trim(),t.includes(" ")?s=t.split(" "):s=[t,A8[t]?t:"0"]),i=Iee(s[0],n,r),o=Iee(s[1],e),i-o}const l7e={Enter:[[0,1],[1,1]],Exit:[[0,0],[1,0]],Any:[[1,0],[0,1]],All:[[0,0],[1,1]]},c7e={x:0,y:0};function u7e(t){return"getBBox"in t&&t.tagName!=="svg"?t.getBBox():{width:t.clientWidth,height:t.clientHeight}}function d7e(t,e,n){const{offset:r=l7e.All}=n,{target:s=t,axis:i="y"}=n,o=i==="y"?"height":"width",l=s!==t?i7e(s,t):c7e,c=s===t?{width:t.scrollWidth,height:t.scrollHeight}:u7e(s),u={width:t.clientWidth,height:t.clientHeight};e[i].offset.length=0;let d=!e[i].interpolate;const h=r.length;for(let f=0;f<h;f++){const p=o7e(r[f],u[o],c[o],l[i]);!d&&p!==e[i].interpolatorOffsets[f]&&(d=!0),e[i].offset[f]=p}d&&(e[i].interpolate=B9(e[i].offset,hxe(r),{clamp:!1}),e[i].interpolatorOffsets=[...e[i].offset]),e[i].progress=ah(0,1,e[i].interpolate(e[i].current))}function h7e(t,e=t,n){if(n.x.targetOffset=0,n.y.targetOffset=0,e!==t){let r=e;for(;r&&r!==t;)n.x.targetOffset+=r.offsetLeft,n.y.targetOffset+=r.offsetTop,r=r.offsetParent}n.x.targetLength=e===t?e.scrollWidth:e.clientWidth,n.y.targetLength=e===t?e.scrollHeight:e.clientHeight,n.x.containerLength=t.clientWidth,n.y.containerLength=t.clientHeight}function f7e(t,e,n,r={}){return{measure:()=>h7e(t,r.target,n),update:s=>{s7e(t,n,s),(r.offset||r.target)&&d7e(t,n,r)},notify:()=>e(n)}}const _S=new WeakMap,Dee=new WeakMap,a5=new WeakMap,Lee=t=>t===document.documentElement?window:t;function V9(t,{container:e=document.documentElement,...n}={}){let r=a5.get(e);r||(r=new Set,a5.set(e,r));const s=n7e(),i=f7e(e,t,s,n);if(r.add(i),!_S.has(e)){const l=()=>{for(const f of r)f.measure()},c=()=>{for(const f of r)f.update(ci.timestamp)},u=()=>{for(const f of r)f.notify()},d=()=>{kn.read(l,!1,!0),kn.read(c,!1,!0),kn.update(u,!1,!0)};_S.set(e,d);const h=Lee(e);window.addEventListener("resize",d,{passive:!0}),e!==document.documentElement&&Dee.set(e,e7e(e,d)),h.addEventListener("scroll",d,{passive:!0})}const o=_S.get(e);return kn.read(o,!1,!0),()=>{var l;Du(o);const c=a5.get(e);if(!c||(c.delete(i),c.size))return;const u=_S.get(e);_S.delete(e),u&&(Lee(e).removeEventListener("scroll",u),(l=Dee.get(e))===null||l===void 0||l(),window.removeEventListener("resize",u))}}function p7e({source:t,container:e,axis:n="y"}){t&&(e=t);const r={value:0},s=V9(i=>{r.value=i[n].progress*100},{container:e,axis:n});return{currentTime:r,cancel:s}}const o5=new Map;function Lxe({source:t,container:e=document.documentElement,axis:n="y"}={}){t&&(e=t),o5.has(e)||o5.set(e,{});const r=o5.get(e);return r[n]||(r[n]=Ave()?new ScrollTimeline({source:e,axis:n}):p7e({source:e,axis:n})),r[n]}function m7e(t){return t.length===2}function Fxe(t){return t&&(t.target||t.offset)}function g7e(t,e){return m7e(t)||Fxe(e)?V9(n=>{t(n[e.axis].progress,n)},e):Dxe(t,Lxe(e))}function v7e(t,e){if(t.flatten(),Fxe(e))return t.pause(),V9(n=>{t.time=t.duration*n[e.axis].progress},e);{const n=Lxe(e);return t.attachTimeline?t.attachTimeline(n,r=>(r.pause(),Dxe(s=>{r.time=r.duration*s},n))):co}}function x7e(t,{axis:e="y",...n}={}){const r={axis:e,...n};return typeof t=="function"?g7e(t,r):v7e(t,r)}function Fee(t,e){Eqe(!!(!e||e.current))}const y7e=()=>({scrollX:Hd(0),scrollY:Hd(0),scrollXProgress:Hd(0),scrollYProgress:Hd(0)});function b7e({container:t,target:e,layoutEffect:n=!0,...r}={}){const s=k3(y7e);return(n?u9:b.useEffect)(()=>(Fee("target",e),Fee("container",t),x7e((o,{x:l,y:c})=>{s.scrollX.set(l.current),s.scrollXProgress.set(l.progress),s.scrollY.set(c.current),s.scrollYProgress.set(c.progress)},{...r,container:(t==null?void 0:t.current)||void 0,target:(e==null?void 0:e.current)||void 0})),[t,e,JSON.stringify(r.offset)]),s}function w7e(t){const e=k3(()=>Hd(t)),{isStatic:n}=b.useContext(l9);if(n){const[,r]=b.useState(t);b.useEffect(()=>e.on("change",r),[])}return e}function $xe(t,e){const n=w7e(e()),r=()=>n.set(e());return r(),u9(()=>{const s=()=>kn.preRender(r,!1,!0),i=t.map(o=>o.on("change",s));return()=>
881{i.forEach(o=>o()),Du(r)}}),n}const _7e=t=>t&&typeof t=="object"&&t.mix,j7e=t=>_7e(t)?t.mix:void 0;function S7e(...t){const e=!Array.isArray(t[0]),n=e?0:-1,r=t[0+n],s=t[1+n],i=t[2+n],o=t[3+n],l=B9(s,i,{mixer:j7e(i[0]),...o});return e?l(r):l}function N7e(t){hC.current=[],t();const e=$xe(hC.current,t);return hC.current=void 0,e}function C7e(t,e,n,r){if(typeof t=="function")return N7e(t);const s=typeof e=="function"?e:S7e(e,n,r);return Array.isArray(t)?$ee(t,s):$ee([t],([i])=>s(i))}function $ee(t,e){const n=k3(()=>[]);return $xe(t,()=>{n.length=0;const r=t.length;for(let s=0;s<r;s++)n[s]=t[s].get();return e(n)})}const k7e={some:0,all:1};function A7e(t,e,{root:n,margin:r,amount:s="some"}={}){const i=A9(t),o=new WeakMap,l=u=>{u.forEach(d=>{const h=o.get(d.target);if(d.isIntersecting!==!!h)if(d.isIntersecting){const f=e(d);typeof f=="function"?o.set(d.target,f):c.unobserve(d.target)}else typeof h=="function"&&(h(d),o.delete(d.target))})},c=new IntersectionObserver(l,{root:n,rootMargin:r,threshold:typeof s=="number"?s:k7e[s]});return i.forEach(u=>c.observe(u)),()=>c.disconnect()}function E7e(t,{root:e,margin:n,amount:r,once:s=!1}={}){const[i,o]=b.useState(!1);return b.useEffect(()=>{if(!t.current||s&&i)return;const l=()=>(o(!0),s?void 0:()=>o(!1)),c={root:e&&e.current||void 0,margin:n,amount:r};return A7e(t.current,l,c)},[e,t,n,s,r]),i}function Xt({className:t,...e}){return a.jsx("div",{className:Fe("animate-pulse rounded-md bg-muted",t),...e})}const zxe=["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"];function jc(t){if(!t)return"";const e=new Date(t);return isNaN(e.getTime())?"":`${e.getDate()} ${zxe[e.getMonth()]} ${e.getFullYear()}`}function T7e(t,e){const n=new Date(t);if(!e)return jc(t);const r=new Date(e);return n.getMonth()===r.getMonth()&&n.getFullYear()===r.getFullYear()?`Du ${n.getDate()} au ${r.getDate()} ${zxe[n.getMonth()]} ${n.getFullYear()}`:`Du ${jc(t)} au ${jc(e)}`}const qM="https://www.espritsud.es",l5="Esprit Sud Magazine",P7e=`${qM}/logo.png`;function M7e(t,e=160){if(!t)return"";const n=t.replace(/\s+/g," ").trim();return n.length>e?n.slice(0,e-1).trimEnd()+"â¦":n}const Fn=({title:t,description:e="Esprit Sud Magazine â Votre média francophone sur l'Andalousie.",path:n,image:r,type:s="website",jsonLd:i,noIndex:o=!1})=>{const l=typeof window<"u"?window.location.pathname:"/",c=YL(l),u=n??(c==="en"?l.replace(/^\/en/,"")||"/":l),d=t.includes(l5)?t:`${t} | ${l5}`,h=M7e(e,160),f=`${qM}${uC(u,c)}`,p=`${qM}${uC(u,"fr")}`,m=`${qM}${uC(u,"en")}`,v=r||P7e,x=i?Array.isArray(i)?i:[i]:[];return a.jsxs(XE,{htmlAttributes:{lang:c},children:[a.jsx("title",{children:d}),a.jsx("meta",{name:"description",content:h}),a.jsx("link",{rel:"canonical",href:f}),o&&a.jsx("meta",{name:"robots",content:"noindex,nofollow"}),a.jsx("link",{rel:"alternate",hrefLang:"fr",href:p}),a.jsx("link",{rel:"alternate",hrefLang:"en",href:m}),a.jsx("link",{rel:"alternate",hrefLang:"x-default",href:p}),a.jsx("meta",{property:"og:title",content:d}),a.jsx("meta",{property:"og:description",content:h}),a.jsx("meta",{property:"og:image",content:v}),a.jsx("meta",{property:"og:url",content:f}),a.jsx("meta",{property:"og:type",content:s}),a.jsx("meta",{property:"og:site_name",content:l5}),a.jsx("meta",{property:"og:locale",content:c==="en"?"en_GB":"fr_FR"}),a.jsx("meta",{name:"twitter:card",content:"summary_large_image"}),a.jsx("meta",{name:"twitter:title",content:d}),a.jsx("meta",{name:"twitter:description",content:h}),a.jsx("meta",{name:"twitter:image",content:v}),x.map((g,w)=>a.jsx("script",{type:"application/ld+json",children:JSON.stringify(g)},w))]})};let c5=!1;function R7e(t){if(c5||!t)return;if(document.querySelector('script[src*="adsbygoogle.js"]')){c5=!0;return}c5=!0;const e=document.createElement("script");e.async=!0,e.crossOrigin="anonymous",e.src=`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${t}`,document.head.appendChild(e)}function O7e({placement:t,className:e="",format:n="auto"}){const[r,s]=b.useState(null),i=LM(),o=!!(i!=null&&i.analytics);return b.useEffect(()=>{o&&(async()=>{var h;let l=null;const{data:c}=await Z.from("site_settings_public").select("value").eq("key","adsense_config").maybeSingle();if(c!=null&&c.value&&(l=c.value),!l){const{data:f}=await Z.from("site_settings").select("value").eq("key","adsense_config").maybeSingle();l=(f==null?void 0:f.value)||null}if(!l||!l.enabled)return;const u=l.publisher_id||"",d=((h=l.slots)==null?void 0:h[t])||"";!u||!d||(s({pub:u,slot:d}),R7e(u))})()},[o,t]),b.useEffect(()=>{if(r)try{(window.adsbygoogle=window.adsbygoogle||[]).push({})}catch{}},[r]),!o||!r?null:a.jsxs("div",{className:e,children:[a.jsx("p",{className:"mb-1 text-[10px] uppercase tracking-wider text-muted-foreground",children:"Publicité"}),a.jsx("ins",{className:"adsbygoogle",style:{display:"block"},"data-ad-client":r.pub,"data-ad-slot":r.slot,"data-ad-format":n,"data-full-width-responsive":"true"},`${r.pub}-${r.slot}`)]})}function I7e(t){return`https://aanjkhoyzcvhokzsmifu.supabase.co/functions/v1/site-media?contract=${encodeURIComponent(t)}`}function q_({placement:t,categoryId:e,className:n="",vertical:r=!1,hideAdsense:s=!1}){const[i,o]=b.useState(null),[l,c]=b.useState(!1);b.useEffect(()=>{let h=!1;return(async()=>{try{const{data:f,error:p}=await Z.functions.invoke("sponsor-banners",{body:{placement:t,categoryId:e??null}});if(h)return;if(p){o([]);return}o((f==null?void 0:f.contracts)||[])}catch{h||o([])}})(),()=>{h=!0}},[t,e]);const u=b.useMemo(()=>!i||i.length===0?null:i[Math.floor(Math.random()*i.length)],[i]);if(b.useEffect(()=>{u&&Z.rpc("increment_ad_stat",{_contract:u.id,_field:"impressions"}).then(()=>{},()=>{})},[u==null?void 0:u.id]),i===null)return null;if(!u||t!=="homepage"&&l)return s?null:a.jsx(O7e,{placement:t,className:n,format:r?"vertical":"auto"});if(l)return null;const d=()=>{Z.rpc("increment_ad_stat",{_contract:u.id,_field:"clicks"}).then(()=>{},()=>{})};return a.jsxs("div",{className:n,children:[a.jsx("p",{className:"mb-1 text-[10px] uppercase tracking-wider text-muted-foreground",children:"Publicité"}),a.jsx("a",{href:u.destination_url||"#",target:"_blank",rel:"noopener sponsored noreferrer",onClick:d,className:"block overflow-hidden rounded-lg border border-border bg-card transition-shadow hover:shadow-md",children:a.jsx("img",{src:I7e(u.id),alt:u.alt_text||"Publicité",loading:"lazy",onError:()=>c(!0),className:r?"w-full h-auto":"w-full h-auto object-cover"})})]})}const D7e="https://images.unsplash.com/photo-1509840841025-9088ba78a826?w=1600&q=70&auto=format&fm=webp",zee=t=>t.toFixed(2).replace(".",",")+" â¬",Ah={hidden:{opacity:0,y:24},visible:{opacity:1,y:0,transition:{duration:.6,ease:"easeOut"}}};function Bee({kicker:t,title:e,link:n,linkLabel:r}){return a.jsxs("div",{className:"mb-10 flex items-end justify-between gap-4",children:[a.jsxs("div",{children:[t&&a.jsx("p",{className:"mb-1 text-xs font-semibold uppercase tracking-[0.18em] text-accent",children:t}),a.jsx("h2",{className:"font-heading text-3xl font-bold leading-tight md:text-4xl",children:e})]}),n&&a.jsxs(_e,{to:n,className:"hidden shrink-0 items-center gap-1 text-sm font-medium text-primary hover:underline sm:flex",children:[r??"Voir tout"," ",a.jsx(Au,{className:"h-4 w-4"})]})]})}function u5({to:t,suffix:e="",prefix:n=""}){const r=b.useRef(null),s=E7e(r,{once:!0,margin:"-100px"}),[i,o]=b.useState(0);return b.useEffect(()=>{if(!s)return;const l=1400,c=performance.now();let u=0;const d=h=>{const f=Math.min(1,(h-c)/l);o(Math.round(f*t)),f<1&&(u=requestAnimationFrame(d))};return u=requestAnimationFrame(d),()=>cancelAnimationFrame(u)},[s,t]),a.jsxs("span",{ref:r,children:[n,i,e]})}const L7e=()=>{var x;const t=b.useRef(null),{scrollY:e}=b7e(),n=C7e(e,[0,600],[0,120]),{data:r,isLoading:s}=Ne({queryKey:["home-articles"],queryFn:async()=>{const{data:g,error:w}=await Z.from("articles").select("id, slug, title, excerpt, cover_image_url, published_at, categories(name, slug)").eq("status","published").order("published_at",{ascending:!1}).limit(6);if(w)throw w;return g??[]}}),{data:i}=Ne({queryKey:["home-magazine"],queryFn:async()=>{const{data:g}=await Z.from("magazine_issues").select("id, issue_number, title, theme, cover_image_url, publication_date, pdf_digital_url").eq("status","distributed").order("issue_number",{ascending:!1}).limit(1).maybeSingle();return g}}),{data:o}=Ne({queryKey:["home-carte"],queryFn:async()=>{const[{count:g},{data:w},{data:_}]=await Promise.all([Z.from("partners").select("id",{count:"exact",head:!0}).eq("is_carte_privilege",!0).eq("is_active",!0),Z.from("partners").select("carte_discount_percent").eq("is_carte_privilege",!0).eq("is_active",!0).order("carte_discount_percent",{ascending:!1}).limit(1).maybeSingle(),Z.from("partners").select("id, name, slug, logo_url, images").eq("is_carte_privilege",!0).eq("is_active",!0).not("logo_url","is",null).limit(6)]);return{count:g??0,maxDiscount:(w==null?void 0:w.carte_discount_percent)??45,logos:_??[]}}}),{data:l}=Ne({queryKey:["home-products"],queryFn:async()=>{const g=async _=>{let j=Z.from("products").select("id, slug, name, price, promo_price, images, is_featured").eq("is_active",!0).order("created_at",{ascending:!1});_&&(j=j.eq("is_featured",!0));const{data:N}=await j.limit(8);return N??[]};let w=await g(!0);return w.length===0&&(w=await g(!1)),w.slice(0,4)}}),[c,u]=b.useState(""),[d,h]=b.useState(!1),f=async g=>{if(g.preventDefault(),!c)return;h(!0);const{error:w}=await Z.from("newsletter_subscribers").insert({email:c.trim().toLowerCase(),source:"homepage",is_active:!0});if(h(!1),w){const _=(w.message||"").toLowerCase();if(_.includes("duplicate")||_.includes("unique")||w.code==="23505"){ee.info("Vous êtes déjà inscrit !"),u("");return}ee.error("Erreur lors de l'inscription");return}ee.success("Merci ! Vous êtes inscrit à notre newsletter."),u("")},p=r==null?void 0:r[0],m=(r==null?void 0:r.slice(1,3))??[],v=(r==null?void 0:r.slice(3,6))??[];return a.jsxs("div",{children:[a.jsx(Fn,{title:"Esprit Sud Magazine | Le média francophone de l'Andalousie",description:"Actualités, guides de voyage, bons plans et Carte Privilège pour les francophones en Andalousie. Magazine papier et digital.",path:"/"}),a.jsxs("section",{ref:t,className:"relative flex min-h-[80vh] items-center justify-center overflow-hidden",children:[a.jsx(Zo.div,{style:{y:n},className:"absolute inset-0 -top-20 -bottom-20",children:a.jsx("img",{src:D7e,alt:"L'Andalousie vue par Esprit Sud Magazine",width:1920,height:1280,fetchPriority:"high",decoding:"async",className:"h-full w-full object-cover"})}),a.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/80 via-black/40 to-black/20"}),a.jsxs(Zo.div,{initial:{opacity:0,y:30}
881,animate:{opacity:1,y:0},transition:{duration:.8},className:"container relative z-10 text-center text-white",children:[a.jsx("h1",{className:"mx-auto max-w-4xl font-heading text-4xl font-bold leading-[1.1] text-balance md:text-6xl lg:text-7xl",children:"Le média francophone de l'Andalousie"}),a.jsx("p",{className:"mx-auto mt-6 max-w-2xl text-base text-white/85 md:text-lg",children:"Magazine papier, actualités, guides de voyage, bons plans, carte privilège et évènements"}),a.jsxs("div",{className:"mt-10 flex flex-col items-center justify-center gap-3 sm:flex-row",children:[a.jsx(H,{asChild:!0,size:"lg",variant:"outline",className:"rounded-full border-white bg-transparent text-white hover:bg-white hover:text-foreground",children:a.jsx(_e,{to:"/actualites",children:"Découvrir nos articles"})}),a.jsx(H,{asChild:!0,size:"lg",className:"rounded-full bg-accent text-accent-foreground hover:bg-accent/90",children:a.jsx(_e,{to:"/carte-privilege",children:"Carte Privilège"})})]})]})]}),a.jsx("section",{className:"container py-6 md:py-8",children:a.jsx(q_,{placement:"homepage",className:"mx-auto max-w-5xl"})}),((r==null?void 0:r.length)??0)>0&&a.jsxs("section",{className:"container py-20 md:py-24",children:[a.jsx(Bee,{kicker:"L'actualité",title:"à la une",link:"/actualites",linkLabel:"Voir toutes les actualités"}),s?a.jsxs("div",{className:"grid gap-6 lg:grid-cols-5",children:[a.jsx(Xt,{className:"h-[460px] rounded-2xl lg:col-span-3"}),a.jsxs("div",{className:"space-y-6 lg:col-span-2",children:[a.jsx(Xt,{className:"h-[220px] rounded-2xl"}),a.jsx(Xt,{className:"h-[220px] rounded-2xl"})]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid gap-6 lg:grid-cols-5",children:[p&&a.jsx(Zo.article,{initial:"hidden",whileInView:"visible",viewport:{once:!0},variants:Ah,className:"lg:col-span-3",children:a.jsxs(_e,{to:`/actualites/${p.slug}`,className:"group block overflow-hidden rounded-2xl bg-card shadow-sm transition-shadow hover:shadow-xl",children:[a.jsx("div",{className:"aspect-[16/10] overflow-hidden bg-muted",children:p.cover_image_url&&a.jsx("img",{src:p.cover_image_url,alt:p.title,className:"h-full w-full object-cover transition-transform duration-700 group-hover:scale-105"})}),a.jsxs("div",{className:"p-6 md:p-8",children:[a.jsxs("div",{className:"mb-3 flex items-center gap-3",children:[((x=p.categories)==null?void 0:x.name)&&a.jsx(ke,{className:"bg-accent text-accent-foreground hover:bg-accent",children:p.categories.name}),p.published_at&&a.jsx("span",{className:"text-xs text-muted-foreground",children:jc(p.published_at)})]}),a.jsx("h3",{className:"mb-3 font-heading text-2xl font-bold leading-tight md:text-3xl",children:p.title}),p.excerpt&&a.jsx("p",{className:"line-clamp-3 text-muted-foreground",children:p.excerpt})]})]})}),a.jsx("div",{className:"space-y-6 lg:col-span-2",children:m.map((g,w)=>{var _;return a.jsx(Zo.article,{initial:"hidden",whileInView:"visible",viewport:{once:!0},variants:Ah,transition:{delay:w*.1},children:a.jsxs(_e,{to:`/actualites/${g.slug}`,className:"group flex gap-4 overflow-hidden rounded-2xl bg-card shadow-sm transition-shadow hover:shadow-lg",children:[a.jsx("div",{className:"h-32 w-32 shrink-0 overflow-hidden bg-muted sm:h-40 sm:w-40",children:g.cover_image_url&&a.jsx("img",{src:g.cover_image_url,alt:g.title,loading:"lazy",className:"h-full w-full object-cover transition-transform duration-500 group-hover:scale-110"})}),a.jsxs("div",{className:"flex flex-1 flex-col justify-center p-3 pr-4 sm:py-5",children:[((_=g.categories)==null?void 0:_.name)&&a.jsx("span",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wider text-accent",children:g.categories.name}),a.jsx("h4",{className:"line-clamp-3 font-heading text-base font-semibold leading-snug",children:g.title}),g.published_at&&a.jsx("span",{className:"mt-2 text-xs text-muted-foreground",children:jc(g.published_at)})]})]})},g.id)})})]}),v.length>0&&a.jsx("div",{className:"mt-6 grid gap-6 sm:grid-cols-2 lg:grid-cols-3",children:v.map((g,w)=>{var _;return a.jsx(Zo.article,{initial:"hidden",whileInView:"visible",viewport:{once:!0},variants:Ah,transition:{delay:w*.1},children:a.jsxs(_e,{to:`/actualites/${g.slug}`,className:"group block overflow-hidden rounded-2xl bg-card shadow-sm transition-shadow hover:shadow-lg",children:[a.jsx("div",{className:"aspect-[16/10] overflow-hidden bg-muted",children:g.cover_image_url&&a.jsx("img",{src:g.cover_image_url,alt:g.title,loading:"lazy",className:"h-full w-full object-cover transition-transform duration-500 group-hover:scale-105"})}),a.jsxs("div",{className:"p-5",children:[a.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[((_=g.categories)==null?void 0:_.name)&&a.jsx(ke,{variant:"secondary",className:"text-xs",children:g.categories.name}),g.published_at&&a.jsx("span",{className:"text-xs text-muted-foreground",children:jc(g.published_at)})]}),a.jsx("h4",{className:"line-clamp-2 font-heading text-lg font-semibold leading-snug",children:g.title})]})]})},g.id)})})]})]}),i&&a.jsx("section",{className:"overflow-x-hidden bg-[hsl(var(--surface-alt))] py-20 md:py-24",children:a.jsxs("div",{className:"container grid items-center gap-12 lg:grid-cols-2",children:[a.jsx(Zo.div,{initial:{opacity:0,y:30},whileInView:{opacity:1,y:0},viewport:{once:!0},transition:{duration:.7},className:"flex justify-center",children:a.jsxs("div",{className:"group relative",children:[a.jsx("div",{className:"absolute inset-0 -rotate-3 rounded-lg bg-primary/10 blur-xl transition-all group-hover:-rotate-2"}),i.cover_image_url?a.jsx("img",{src:i.cover_image_url,alt:`Couverture du magazine n°${i.issue_number}`,className:"relative aspect-[210/297] w-full max-w-md -rotate-2 roun
881ded-md object-cover shadow-2xl transition-transform duration-500 group-hover:-rotate-1 group-hover:scale-105"}):a.jsx("div",{className:"relative flex aspect-[210/297] w-full max-w-md -rotate-2 items-center justify-center rounded-md bg-primary text-primary-foreground shadow-2xl",children:a.jsxs("span",{className:"font-heading text-4xl",children:["N°",i.issue_number]})})]})}),a.jsxs(Zo.div,{initial:{opacity:0,y:30},whileInView:{opacity:1,y:0},viewport:{once:!0},transition:{duration:.7},children:[a.jsx(ke,{className:"mb-4 bg-accent text-accent-foreground hover:bg-accent",children:"Dernier magazine"}),a.jsxs("h2",{className:"font-heading text-3xl font-bold leading-tight md:text-5xl",children:["N°",i.issue_number," â ",i.title]}),i.publication_date&&a.jsx("p",{className:"mt-3 text-sm font-medium uppercase tracking-wider text-muted-foreground",children:jc(i.publication_date)}),a.jsx("p",{className:"mt-6 text-lg leading-relaxed text-muted-foreground",children:i.theme||"Retrouvez dans ce numéro nos reportages, guides et rencontres au cÅur de l'Andalousie."}),a.jsxs("div",{className:"mt-8 flex flex-wrap gap-3",children:[a.jsx(H,{asChild:!0,size:"lg",className:"rounded-full",children:a.jsx(_e,{to:`/nos-magazines/${i.issue_number}`,children:"Feuilleter le magazine"})}),a.jsx(H,{asChild:!0,size:"lg",variant:"outline",className:"rounded-full",children:a.jsx(_e,{to:"/nos-magazines",children:"Voir tous les numéros"})})]})]})]})}),a.jsx("section",{className:"relative overflow-hidden bg-gradient-to-br from-primary via-primary to-secondary py-20 text-white md:py-28",children:a.jsxs("div",{className:"container relative z-10 text-center",children:[a.jsxs(Zo.div,{initial:"hidden",whileInView:"visible",viewport:{once:!0},variants:Ah,children:[a.jsx("p",{className:"mb-3 text-xs font-semibold uppercase tracking-[0.3em] text-white/80",children:"Avantages exclusifs"}),a.jsx("h2",{className:"mx-auto max-w-3xl font-heading text-3xl font-bold leading-tight md:text-5xl",children:"La Carte Privilège Esprit Sud"}),a.jsx("p",{className:"mx-auto mt-4 max-w-2xl text-lg text-white/85",children:"Profitez de réductions exclusives chez nos partenaires en Andalousie"})]}),a.jsxs("div",{className:"mx-auto mt-14 grid max-w-3xl grid-cols-1 gap-10 sm:grid-cols-3",children:[a.jsxs(Zo.div,{initial:"hidden",whileInView:"visible",viewport:{once:!0},variants:Ah,children:[a.jsx("div",{className:"font-heading text-5xl font-bold text-white md:text-6xl",children:a.jsx(u5,{to:(o==null?void 0:o.count)??0,suffix:"+"})}),a.jsx("p",{className:"mt-2 text-sm uppercase tracking-wider text-white/80",children:"Partenaires"})]}),a.jsxs(Zo.div,{initial:"hidden",whileInView:"visible",viewport:{once:!0},variants:Ah,transition:{delay:.1},children:[a.jsx("div",{className:"font-heading text-5xl font-bold text-white md:text-6xl",children:a.jsx(u5,{to:(o==null?void 0:o.maxDiscount)??45,prefix:"-",suffix:"%"})}),a.jsx("p",{className:"mt-2 text-sm uppercase tracking-wider text-white/80",children:"Jusqu'à "})]}),a.jsxs(Zo.div,{initial:"hidden",whileInView:"visible",viewport:{once:!0},variants:Ah,transition:{delay:.2},children:[a.jsx("div",{className:"font-heading text-5xl font-bold text-white md:text-6xl",children:a.jsx(u5,{to:75,suffix:"â¬"})}),a.jsx("p",{className:"mt-2 text-sm uppercase tracking-wider text-white/80",children:"par an"})]})]}),a.jsx(H,{asChild:!0,size:"lg",variant:"outline",className:"mt-12 rounded-full border-white bg-transparent text-white hover:bg-white hover:text-primary",children:a.jsx(_e,{to:"/carte-privilege",children:"Découvrir la Carte Privilège"})})]})}),((l==null?void 0:l.length)??0)>0&&a.jsx("section",{className:"bg-[hsl(var(--surface-alt))] py-20 md:py-24",children:a.jsxs("div",{className:"container",children:[a.jsx(Bee,{kicker:"Boutique",title:"Notre boutique",link:"/boutique",linkLabel:"Voir la boutique"}),a.jsx("div",{className:"grid gap-6 grid-cols-2 lg:grid-cols-4",children:l.map((g,w)=>{var N;const _=(N=g.images)==null?void 0:N[0],j=g.promo_price??g.price;return a.jsx(Zo.div,{initial:"hidden",whileInView:"visible",viewport:{once:!0},variants:Ah,transition:{delay:w*.08},children:a.jsxs(_e,{to:`/boutique/${g.slug}`,className:"group block overflow-hidden rounded-2xl bg-card shadow-sm transition-shadow hover:shadow-lg",children:[a.jsx("div",{className:"aspect-square overflow-hidden bg-muted",children:_&&a.jsx("img",{src:_,alt:g.name,loading:"lazy",className:"h-full w-full object-cover transition-transform duration-500 group-hover:scale-105"})}),a.jsxs("div",{className:"p-4",children:[a.jsx("h3",{className:"line-clamp-2 text-sm font-medium leading-snug",children:g.name}),a.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[a.jsxs("p",{className:"font-heading text-lg font-bold text-primary",children:[zee(Number(j)),g.promo_price&&a.jsx("span",{className:"ml-2 text-xs font-normal text-muted-foreground line-through",children:zee(Number(g.price))})]}),a.jsx("span",{className:"text-xs font-semibold text-accent",children:"Voir â"})]})]})]})},g.id)})})]})}),a.jsxs("section",{className:"relative overflow-hidden bg-[#C4A265] py-20 md:py-24",children:[a.jsx("div",{className:"absolute inset-0 opacity-10",style:{backgroundImage:"radial-gradient(circle at 20% 30%, white 1px, transparent 1px), radial-gradient(circle at 70% 60%, white 1px, transparent 1px)",backgroundSize:"40px 40px"}}),a.jsx("div",{className:"container relative z-10",children:a.jsxs(Zo.div,{initial:"hidden",
881whileInView:"visible",viewport:{once:!0},variants:Ah,className:"mx-auto max-w-xl text-center text-white",children:[a.jsx("h2",{className:"font-heading text-3xl font-bold md:text-4xl",children:"Restez informé"}),a.jsx("p",{className:"mt-3 text-white/90",children:"Recevez nos dernières actualités et bons plans chaque mois"}),a.jsxs("form",{onSubmit:f,className:"mt-8 flex flex-col gap-3 sm:flex-row",children:[a.jsx(ue,{type:"email",required:!0,value:c,onChange:g=>u(g.target.value),placeholder:"[email protected]",className:"h-12 rounded-full border-white/30 bg-white text-foreground"}),a.jsx(H,{type:"submit",size:"lg",disabled:d,className:"shrink-0 rounded-full bg-foreground text-background hover:bg-foreground/90",children:d?"...":"S'inscrire"})]}),a.jsxs("p",{className:"mt-4 text-xs text-white/80",children:["En vous inscrivant, vous acceptez notre ",a.jsx(_e,{to:"/politique-confidentialite",className:"underline",children:"politique de confidentialité"}),". Désabonnement possible à tout moment."]})]})})]})]})},F7e=()=>{if(typeof window>"u")return"fr";const t=localStorage.getItem("annonceurs_lang");if(t&&["fr","en","es"].includes(t))return t;const e=(navigator.language||"fr").slice(0,2).toLowerCase();return e==="en"?"en":e==="es"?"es":"fr"},jo={langLabel:{fr:"Français",en:"English",es:"Español"},hero_title:{fr:"Votre activité, au cÅur de la communauté francophone d'Andalousie",en:"Your business, at the heart of the French-speaking community in Andalusia",es:"Su negocio, en el corazón de la comunidad francófona de AndalucÃa"},hero_sub:{fr:"Le média de référence â Magazine papier ⢠Digital ⢠Réseaux sociaux",en:"The reference media â Print magazine ⢠Digital ⢠Social networks",es:"El medio de referencia â Revista impresa ⢠Digital ⢠Redes sociales"},hero_cta:{fr:"Recevoir notre kit média",en:"Get our media kit",es:"Recibir nuestro kit de prensa"},story:{fr:"De Málaga à Sotogrande, dans les offices de tourisme, les restaurants, les golfs et les boutiques de la Costa del Sol, Esprit Sud Magazine accompagne depuis 2020 les francophones qui vivent, s'installent ou voyagent en Andalousie. Chaque trimestre, notre magazine est distribué dans plus de 300 lieux soigneusement choisis. Sur le digital, notre c
881ommunauté dépasse le million de vues mensuelles.",en:"From Málaga to Sotogrande, in tourist offices, restaurants, golf courses and boutiques of the Costa del Sol, Esprit Sud Magazine has been supporting since 2020 the French speakers who live, settle or travel in Andalusia. Every quarter, our magazine is distributed in more than 300 carefully chosen locations. Online, our community exceeds one million monthly views.",es:"De Málaga a Sotogrande, en las oficinas de turismo, los restaurantes, los campos de golf y las boutiques de la Costa del Sol, Esprit Sud Magazine acompaña desde 2020 a los francófonos que viven, se instalan o viajan en AndalucÃa. Cada trimestre, nuestra revista se distribuye en más de 300 lugares cuidadosamente seleccionados. En digital, nuestra comunidad supera el millón de visualizaciones mensuales."},impact_title:{fr:"Notre impact",en:"Our impact",es:"Nuestro impacto"},channel_print:{fr:"Magazine papier",en:"Print magazine",es:"Revista impresa"},channel_print_stats:{fr:"20 000 lecteurs · 300+ points de distribution · 3 à 6 mois de visibilité par édition",en:"20,000 readers · 300+ distribution points · 3 to 6 months of visibility per issue",es:"20 000 lectores · 300+ puntos de distribución · 3 a 6 meses de visibilidad por edición"},channel_digital:{fr:"Digital & App",en:"Digital & App",es:"Digital y App"},channel_digital_stats:{fr:"500+ visiteurs uniques/jour · 3 000+ applications installées · 85% audience Costa del Sol",en:"500+ unique visitors/day · 3,000+ apps installed · 85% Costa del Sol audience",es:"500+ visitantes únicos/dÃa · 3 000+ aplicaciones instaladas · 85% audiencia Costa del Sol"},channel_social:{fr:"Réseaux sociaux",en:"Social networks",es:"Redes sociales"},channel_social_stats:{fr:"1 000 000+ vues mensuelles · 500 000+ comptes atteints · 75 000+ interactions/mois",en:"1,000,000+ monthly views · 500,000+ accounts reached · 75,000+ interactions/month",es:"1 000 000+ visualizaciones mensuales · 500 000+ cuentas alcanzadas · 75 000+ interacciones/mes"},reader_profile:{fr:"40-70 ans · Profil socio-économique moyen-haut · Culture, gastronomie, tourisme, lifestyle · 65% résidents francophones",en:"40-70 years old · Mid-to-upper socio-economic profile · Culture, gastronomy, tourism, lifestyle · 65% French-speaking residents",es:"40-70 años · Perfil socioeconómico medio-alto · Cultura, gastronomÃa, turismo, lifestyle · 65% residentes francófonos"},data_updated:{fr:"Données actualisées mai 2026",en:"Data updated May 2026",es:"Datos actualizados mayo 2026"},solutions_title:{fr:"Nos solutions",en:"Our solutions",es:"Nuestras soluciones"},sol_ad:{fr:"Publicité magazine",en:"Magazine advertising",es:"Publicidad en revista"},sol_ad_desc:{fr:"Votre visuel dans notre revue trimestrielle premium, distribuée dans 300+ lieux",en:"Your visual in our premium quarterly magazine, distributed in 300+ locations",es:"Su anuncio en nuestra revista trimestral premium, distribuida en 300+ lugares"},sol_content:{fr:"Publireportage & contenu",en:"Sponsored content",es:"Publirreportaje y contenido"},sol_content_desc:{fr:"Un article dédié à votre activité, rédigé par notre équipe éditoriale",en:"A dedicated article about your business, written by our editorial team",es:"Un artÃculo dedicado a su actividad, redactado por nuestro equipo editorial"},sol_video:{fr:"Vidéo promotionnelle",en:"Promotional video",es:"VÃdeo promocional"},sol_video_desc:{fr:"Script, tournage et diffusion sur nos réseaux et notre site",en:"Script, filming and broadcast on our networks and website",es:"Guion, rodaje y difusión en nuestras redes y sitio web"},sol_pack:{fr:"Pack complet",en:"Full package",es:"Pack completo"},sol_pack_desc:{fr:"Magazine + digital + réseaux sociaux : une visibilité à 360° sur tous nos supports",en:"Magazine + digital + social: 360° visibility across all our channels",es:"Revista + digital + redes sociales: visibilidad 360° en todos nuestros soportes"},sol_tailored:{fr:"Chaque offre est construite sur mesure selon vos objectifs et votre budget.",en:"Every offer is tailored to your goals and budget.",es:"Cada oferta se construye a medida según sus objetivos y presupuesto."},tfk_title:{fr:"Figurez dans le 1er carnet d'adresses francophone de la Costa del Sol",en:"Feature in the leading French-speaking directory of the Costa del Sol",es:"Aparezca en el directorio francófono de referencia de la Costa del Sol"},tfk_text:{fr:"L'annuaire de référence pour les francophones qui cherchent un professionnel de confiance en Andalousie. Restaurants, artisans, commerces, professions libérales : vos clients vous cherchent, faites-vous trouver.",en:"The go-to directory for French speakers looking for trusted professionals in Andalusia. Restaurants, tradespeople, shops, services: your clients are looking for you.",es:"El directorio de referencia para los francófonos que buscan un profesional de confianza en AndalucÃa. Restaurantes, artesanos, comercios, profesiones liberales: sus clientes le buscan, hágase encontrar."},tfk_count:{fr:"200+ professionnels référencés",en:"200+ professionals listed",es:"200+ profesionales listados"},tfk_link:{fr:"Découvrir TuFaisQuoi â",en:"Discover TuFaisQuoi â",es:"Descubrir TuFaisQuoi â"},contact_title:{fr:"Votre contact",en:"Your contact",es:"Su contacto"},contact_role:{fr:"Régie publicitaire",en:"Advertising",es:"Publicidad"},contact_quote:{fr:"Installé sur la Costa del Sol depuis plus de 10 ans, j'accompagne les entreprises locales dans leur visibilité auprès de la communauté francophone. Parlons de votre projet â ensemble, nous trouverons la solution qui vous correspond.",en:"Based on the Costa del Sol for over 10 years, I help local businesses reach the French-speaking community. Let's talk about your project â together we'll find the right solution.",es:"Instalado en la Costa del Sol desde hace más de 10 años, acompaño a las empresas locales en su visibilidad ante la comunidad francófona. Hablemos de su proyecto â juntos encontraremos la solución adecuada."},btn_call:{fr:"ð Appeler",en:"ð Call",es:"ð Llamar"},btn_write:{fr:"âï¸ Ãcrire",en:"âï¸ Write",es:"âï¸ Escribir"},form_title:{fr:"Recevez notre kit média complet",en:"Get our complete media kit",es:"Reciba nuestro kit de prensa completo"},form_sub:{fr:"Tarifs, calendrier éditorial, exemples de réalisations â réponse sous 24h",en:"Rates, editorial calendar, case studies â reply within 24h",es:"Tarifas, calendario editorial, ejemplos â respuesta en 24h"},f_name:{fr:"Nom",en:"Name",es:"Nombre"},f_email:{fr:"Email",en:"Email",es:"Email"},f_company:{fr:"Entreprise (optionnel)",en:"Company (optional)",es:"Empresa (opcional)"},f_phone:{fr:"Téléphone (optionnel)",en:"Phone (optional)",es:"Teléfono (opcional)"},f_message:{fr:"Message (optionnel)",en:"Message (optional)",es:"Mensaje (opcional)"},f_interest:{fr:"Je suis intéressé par",en:"I'm interested in",es:"Me interesa"},f_interest_placeholder:{fr:"Choisirâ¦",en:"Chooseâ¦",es:"Elegirâ¦"},interests:{fr:["Magazine papier","Digital & Réseaux","Vidéo","Pack complet","Je ne sais pas encore"],en:["Print magazine","Digital & Social","Video","Full package","Not sure yet"],es:["Revista impresa","Digital y Redes","VÃdeo","Pack completo","Aún no lo sé"]},f_submit:{fr:"Recevoir le kit média",en:"Get the media kit",es:"Recibir el kit de prensa"},form_success:{fr:"Merci ! Nous vous envoyons le kit média sous 24h. Vous pouvez déjà télécharger nos fiches techniques :",en:"Thank y
881ou! We'll send your media kit within 24h. You can already download our technical sheets:",es:"¡Gracias! Le enviamos el kit en 24h. Ya puede descargar nuestras fichas técnicas:"},dl_print:{fr:"Fiche technique â Magazine",en:"Print media specs",es:"Ficha técnica â Revista"},dl_digital:{fr:"Fiche technique â Digital",en:"Digital media specs",es:"Ficha técnica â Digital"},next_issue:{fr:"ð
Prochain numéro : N°26 â Automne 2026 · Réservation avant le 15 septembre 2026",en:"ð
Next issue: N°26 â Fall 2026 · Book before September 15, 2026",es:"ð
Próximo número: N°26 â Otoño 2026 · Reserva antes del 15 de septiembre de 2026"},legal:{fr:"Mentions légales",en:"Legal notice",es:"Aviso legal"},privacy:{fr:"Politique de confidentialité",en:"Privacy policy",es:"PolÃtica de privacidad"},seo_title:{fr:"Annonceurs â Esprit Sud Magazine",en:"Advertisers â Esprit Sud Magazine",es:"Anunciantes â Esprit Sud Magazine"},seo_desc:{fr:"Régie publicitaire d'Esprit Sud Magazine : magazine papier, digital, réseaux sociaux, carnet d'adresses. Visibilité premium auprès des francophones d'Andalousie.",en:"Esprit Sud Magazine advertising: print, digital, social, directory. Premium visibility with the French-speaking community in Andalusia.",es:"Publicidad Esprit Sud Magazine: impresa, digital, redes, directorio. Visibilidad premium con la comunidad francófona en AndalucÃa."}},Eh="#C4A265",nP="#1B4F72",$7e=[{code:"fr",flag:"ð«ð·"},{code:"en",flag:"ð¬ð§"},{code:"es",flag:"ðªð¸"}];function z7e(){var _,j,N,S,C,k,E,P,T,M;const[t,e]=b.useState("fr"),[n,r]=b.useState({}),[s,i]=b.useState(!1),[o,l]=b.useState(!1),c=b.useRef(null);b.useEffect(()=>{e(F7e())},[]),b.useEffect(()=>{typeof window<"u"&&localStorage.setItem("annonceurs_lang",t)},[t]),b.useEffect(()=>{(async()=>{const{data:R}=await Mt.from("site_settings").select("value").eq("key","annonceurs_kit").maybeSingle();R!=null&&R.value&&r(R.value)})()},[]);const u=R=>jo[R][t],d=((_=n.luc_quote)==null?void 0:_[t])||u("contact_quote"),h=((j=n.next_issue)==null?void 0:j[t])||u("next_issue"),f=((S=(N=n.stats)==null?void 0:N.print)==null?void 0:S[t])||u("channel_print_stats"),p=((k=(C=n.stats)==null?void 0:C.digital)==null?void 0:k[t])||u("channel_digital_stats"),m=((P=(E=n.stats)==null?void 0:E.social)==null?void 0:P[t])||u("channel_social_stats"),v=((M=(T=n.stats)==null?void 0:T.profile)==null?void 0:M[t])||u("reader_profile"),x=()=>{var R;return(R=c.current)==null?void 0:R.scrollIntoView({behavior:"smooth"})},g=async R=>{R.preventDefault(),i(!0);const A=new FormData(R.currentTarget),I=String(A.get("name")||"").trim(),D=String(A.get("email")||"").trim();if(!I||!D){i(!1);return}const O={name:I,email:D,company:String(A.get("company")||"").trim()||null,phone:String(A.get("phone")||"").trim()||null,interest:String(A.get("interest")||"").trim()||null,message:String(A.get("message")||"").trim()||null},{data:z,error:B}=await Mt.functions.invoke("advertiser-lead",{body:O});if(i(!1),B||z!=null&&z.error){ee.error((z==null?void 0:z.error)||(B==null?void 0:B.message)||"Erreur lors de l'envoi");return}l(!0)},w=jo.interests[t];return a.jsxs("div",{className:"min-h-screen bg-white",style:{color:"#1A1A1A"},children:[a.jsxs(XE,{children:[a.jsx("title",{children:u("seo_title")}),a.jsx("meta",{name:"description",content:u("seo_desc")}),a.jsx("html",{lang:t})]}),a.jsx("header",{className:"sticky top-0 z-30 border-b border-black/5 bg-white/95 backdrop-blur",children:a.jsxs("div",{className:"mx-auto flex max-w-6xl items-center justify-between px-4 py-4",children:[a.jsx(_e,{to:"/",className:"flex items-center",children:a.jsx("img",{src:qO,alt:"Esprit Sud Magazine",className:"h-9 w-auto"})}),a.jsx("div",{className:"flex items-center gap-2",children:$7e.map(R=>a.jsx("button",{onClick:()=>e(R.code),className:`text-2xl leading-none transition-opacity ${t===R.code?"opacity-100":"opacity-40 hover:opacity-70"}`,"aria-label":R.code,children:R.flag},R.code))})]})}),a.jsx("section",{className:"relative overflow-hidden text-white",style:{background:`linear-gradient(135deg, ${nP} 0%, #1B2F1B 100%)`},children:a.jsxs("div",{className:"mx-auto max-w-4xl px-4 py-24 text-center md:py-32",children:[a.jsx("h1",{className:"font-heading text-4xl font-bold leading-tight md:text-6xl",children:u("hero_title")}),a.jsx("p",{className:"mt-6 text-lg text-white/85 md:text-xl",children:u("hero_sub")}),a.jsx("button",{onClick:x,className:"mt-10 inline-flex items-center rounded-md px-8 py-4 text-base font-semibold text-[#1A1A1A] shadow-lg transition-transform hover:scale-[1.02]",style:{backgroundColor:Eh},children:u("hero_cta")})]})}),a.jsx("section",{className:"mx-auto max-w-3xl px-6 py-24 text-center md:py-32",children:a.jsx("p",{className:"font-heading text-2xl italic leading-relaxed md:text-3xl md:leading-relaxed",style:{color:"#1A1A1A"},children:jo.story[t]})}),a.jsx("section",{className:"bg-neutral-50 py-20 md:py-28",children:a.jsxs("div",{className:"mx-auto max-w-6xl px-4",children:[a.jsx("h2",{className:"mb-14 text-center font-heading text-3xl font-bold md:text-4xl",children:u("impact_title")}),a.jsx("div",{className:"grid gap-8 md:grid-cols-3",children:[{icon:"ð°",title:jo.channel_print[t],stats:f},{icon:"ð±",title:jo.channel_digital[t],stats:p},{icon:"ð¬",title:jo.channel_social[t],stats:m}].map(R=>a.jsxs("div",{className:"rounded-xl border border-black/5 bg-white p-8 shadow-sm",children:[a.jsx("div",{className:"text-3xl",children:R.icon}),a.jsx("h3",{className:"mt-4 font-heading text-xl font-semibold",children:R.title}),a.jsx("p",{className:"mt-3 text-[15px] leading-relaxed text-neutral-700",style:{fontSize:"clamp(15px, 1.4vw, 17px)"},children:R.stats})]},R.title))}),a.jsx("p",{className:"mt-10 text-center text-sm text-neutral-600",children:v}),a.jsx("p",{className:"mt-2 text-center text-xs text-neutral-400",children:u("data_updated")})]})}),a.jsxs("section",{className:"mx-auto max-w-6xl px-4 py-20 md:py-28",children:[a.jsx("h2",{className:"mb-14 text-center font-heading text-3xl font-bold md:text-4xl",children:u("solutions_title")}),a.jsx("div",{className:"grid gap-6 md:grid-cols-2 lg:grid-cols-4",children:[{icon:"ð¼ï¸",title:jo.sol_ad[t],desc:jo.sol_ad_desc[t]}
881,{icon:"âï¸",title:jo.sol_content[t],desc:jo.sol_content_desc[t]},{icon:"ð¬",title:jo.sol_video[t],desc:jo.sol_video_desc[t]},{icon:"ð",title:jo.sol_pack[t],desc:jo.sol_pack_desc[t]}].map(R=>a.jsxs("div",{className:"rounded-xl border border-black/5 p-6 transition-shadow hover:shadow-md",children:[a.jsx("div",{className:"text-2xl",children:R.icon}),a.jsx("h3",{className:"mt-3 font-heading text-lg font-semibold",children:R.title}),a.jsx("p",{className:"mt-2 text-sm leading-relaxed text-neutral-600",children:R.desc})]},R.title))}),a.jsx("p",{className:"mt-10 text-center text-sm italic text-neutral-600",children:u("sol_tailored")})]}),a.jsx("section",{className:"px-4 pb-20",children:a.jsxs("div",{className:"mx-auto max-w-5xl rounded-2xl border-2 p-10 md:p-14",style:{borderColor:Eh,backgroundColor:"#FDFAF3"},children:[a.jsx("div",{className:"text-4xl",children:"ð"}),a.jsx("h2",{className:"mt-4 font-heading text-2xl font-bold md:text-3xl",children:u("tfk_title")}),a.jsx("p",{className:"mt-5 text-base leading-relaxed text-neutral-700 md:text-lg",children:u("tfk_text")}),a.jsx("p",{className:"mt-6 font-heading text-2xl font-semibold",style:{color:Eh},children:u("tfk_count")}),a.jsx("a",{href:"https://tufaisquoi.com/comment-ca-marche",target:"_blank",rel:"noopener noreferrer",className:"mt-6 inline-block font-semibold underline underline-offset-4",style:{color:nP},children:u("tfk_link")})]})}),a.jsx("section",{className:"bg-neutral-50 py-20 md:py-28",children:a.jsxs("div",{className:"mx-auto max-w-2xl px-4",children:[a.jsx("h2",{className:"mb-10 text-center font-heading text-3xl font-bold",children:u("contact_title")}),a.jsxs("div",{className:"rounded-2xl bg-white p-8 text-center shadow-sm md:p-10",children:[a.jsx("div",{className:"mx-auto h-28 w-28 overflow-hidden rounded-full bg-neutral-200",children:n.luc_photo_url?a.jsx("img",{src:n.luc_photo_url,alt:"Luc Broes",className:"h-full w-full object-cover"}):a.jsx("div",{className:"flex h-full w-full items-center justify-center text-3xl",style:{color:nP},children:"LB"})}),a.jsx("div",{className:"mt-5 font-heading text-xl font-bold",children:"Luc BROES"}),a.jsx("div",{className:"text-sm text-neutral-500",children:u("contact_role")}),a.jsxs("p",{className:"mt-6 italic leading-relaxed text-neutral-700",children:["« ",d," »"]}),a.jsxs("div",{className:"mt-6 space-y-1 text-sm",children:[a.jsx("div",{children:a.jsx("a",{href:"tel:+34664203719",className:"hover:underline",children:"+34 664 203 719"})}),a.jsx("div",{children:a.jsx("a",{href:"mailto:[email protected]",className:"hover:underline",children:"[email protected]"})})]}),a.jsxs("div",{className:"mt-6 flex flex-col justify-center gap-3 sm:flex-row",children:[a.jsx("a",{href:"tel:+34664203719",className:"inline-flex items-center justify-center rounded-md px-6 py-2.5 text-sm font-semibold text-[#1A1A1A]",style:{backgroundColor:Eh},children:u("btn_call")}),a.jsx("a",{href:"mailto:[email protected]",className:"inline-flex items-center justify-center rounded-md border-2 px-6 py-2.5 text-sm font-semibold",style:{borderColor:Eh,color:"#1A1A1A"},children:u("btn_write")}),a.jsxs("a",{href:"https://wa.me/34664203719",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center gap-2 rounded-md px-6 py-2.5 text-sm font-semibold text-white",style:{backgroundColor:"#25D366"},children:[a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"h-4 w-4",children:a.jsx("path",{d:"M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.226 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z"})}),"WhatsApp"]})]})]})]})}),a.jsx("section",{ref:c,id:"kit-media",className:"px-4 py-20 md:py-28",children:a.jsxs("div",{className:"mx-auto max-w-xl",children:[a.jsx("h2",{className:"text-center font-heading text-3xl font-bold md:text-4xl",children:u("form_title")}),a.jsx("p",{className:"mt-3 text-center text-neutral-600",children:u("form_sub")}),o?a.jsxs("div",{className:"mt-10 rounded-xl border p-8 text-center",style:{borderColor:Eh,backgroundColor:"#FDFAF3"},children:[a.jsx("p",{className:"text-base leading-relaxed",children:u("form_success")}),a.jsxs("div",{className:"mt-5 flex flex-col justify-center gap-3 sm:flex-row",children:[n.kit_print_pdf&&a.jsxs("a",{href:n.kit_print_pdf,target:"_blank",rel:"noopener",className:"rounded-md px-5 py-2.5 text-sm font-semibold text-[#1A1A1A]",style:{backgroundColor:Eh},children:["⬠",u("dl_print")]}),n.kit_digital_pdf&&a.jsxs("a",{href:n.kit_digital_pdf,target:"_blank",rel:"noopener",className:"rounded-md border-2 px-5 py-2.5 text-sm font-semibold",style:{borderColor:Eh},children:["⬠",u("dl_digital")]})]})]}):a.jsxs("form",{onSubmit:g,className:"mt-10 space-y-4",children:[a.jsx("input",{required:!0,name:"name",placeholder:u("f_name")+" *",className:"w-full rounded-md border border-neutral-300 px-4 py-3 text-base focus:border-neutral-900 focus:outline-none"}),a.jsx("input",{required:!0,type:"email",name:"email",placeholder:u("f_email")+" *",className:"w-full rounded-md border border-neutral-300 px-4 py-3 text-base focus:border-neutral-900 focus:outline-none"}),a.jsx("input",{name:"company",placeholder:u("f_company"),className:"w-full rounded-md border border-neutral-300 px-4 py-3 text-base focus:border-neutral-900 focus:outline-none"}),a.jsx("input",{type:"tel",name:"phone",placeholder:u("f_phone"),className:"w-full rounded-md border border-neutral-300 px-4 py-3 text-base focus:border-neutral-900 focus:outline-none"}),a.jsx("textarea",{name:"message",rows:4,placeholder:u("f_message"),className:"w-full rounded-md border border-neutral-300 px-4 py-3 text-base focus:border-neutral-900 focus:outline-none"}),a.jsxs("select",{name:"interest",defaultValue:"",className:"w-full rounded-md border border-neutral-300 bg-white px-4 py-3 text-base focus:border-neutral-900 focus:outline-none",children:[a.jsxs("option",{value:"",disabled:!0,children:[u("f_interest"),": ",u("f_interest_placeholder")]}),w.map(R=>a.jsx("option",{value:R,children:R},R))]}),a.jsx("button",{type:"submit",disabled:s,className:"mt-2 w-full rounded-md py-4 text-base font-semibold text-[#1A1A1A] shadow-md transition-transform hover:scale-[1.01] disabled:opacity-60",style:{backgroundColor:Eh},children:s?"â¦":u("f_submit")})]})]})}),a.jsx("section",{className:"text-center text-white",style:{backgroundColor:nP},children:a.jsx("div",{className:"mx-auto max-w-5xl px-4 py-8 text-sm md:text-base",children:h})}),a.jsx("footer",{className:"border-t border-neutral-200 bg-white py-10",children:a.jsxs("div",{className:"mx-auto flex max-w-5xl flex-col items-center gap-4 px-4 text-center text-sm text-neutral-600",children:[a.jsx("img",{src:qO,alt:"Esprit Sud",className:"h-8 w-auto"}),a.jsxs("div",{children:[a.jsx("a",{href:"mailto:[email protected]",className:"hover:underline",children:"[email protected]"})," · ",a.jsx("a",{href:"https://www.espritsud.es",className:"hover:underline",children:"www.espritsud.es"})]}),a.jsxs("div",{className:"flex gap-4 text-xs",children:[a.jsx(_e,{to:"/mentions-legales",className:"hover:underline",children:u("legal")}),a.jsx(_e,{to:"/politique-confidentialite",className:"hover:underline",children:u("privacy")})]})]})})]})}const jS=t=>t.toFixed(2).replace(".",",")+" â¬",B7e=()=>{var C,k,E;const[t,e]=b.useState(""),[n,r]=b.useState(""),{addItem:s}=tv(),{lang:i}=Uu(),o=i==="en",l=P=>o&&P.name_en||P.name,c=P=>o&&P.short_description_en||P.short_description,{data:u,isLoading:d}=Ne({queryKey:["boutique_products_variants"],queryFn:async()=>{const{data:P,error:T}=await Z.from("products").select("*, product_categories(name, slug)").eq("is_active",!0).order("created_at",{ascending:!1});if(T)throw T;const{data:M,error:R}=await Z.from("product_variants").select("*").eq("is_active",!0).order("sort_order");if(R)throw R;return{products:P??[],variants:M??[]}}}),h=(u==null?void 0:u.products)??[],f=(u==null?void 0:u.variants)??[],p=h.filter(P=>{var T,M;return((T=P.slug)==null?void 0:T.includes("guide"))||((M=P.name)==null?void 0:M.toLowerCase().includes("guide"))}),m=(k=(C=p.find(P=>{var T;return(T=P.images)==null?void 0:T[0]}))==null?void 0:C.images)==null?void 0:k[0],v=P=>{const T=`${P.slug??""} ${P.name??""}`.toLowerCase();return/(pdf|num[ée]rique|digital|ebook)/.test(T)?"pdf":"papier"},x=h.find(P=>{var T,M;return((T=P.slug)==null?void 0:T.includes("magazine"))||((M=P.name)==null?void 0:M.toLowerCase().includes("magazine"))}),g=x?f.filter(P=>{var T;return P.product_id===x.id&&((T=P.sku)==null?void 0:T.startsWith("MAG-"))}).sort((P,T)=>(T.numero??0)-(P.numero??0)):[],w=g.find(P=>P.id===n),_=h.filter(P=>!p.some(T=>T.id===P.id)&&P.id!==(x==null?void 0:x.id)),j=_.filter(P=>l(P).toLowerCase().includes(t.toLowerCase())),N=(P,T)=>{var R;const M={product_id:P.id,variant_id:T.id,stripe_price_id:T.stripe_price_id||"",name:l(P),variant_name:T.name,format:T.format||"papier",image:((R=P.images)==null?void 0:R[0])??"",price:T.price_override??T.price??P.price,quantity:1,numero:T.numero,product_type:P.product_type,carte_privilege_discount_percent:P.carte_privilege_discount_percent??0,tax_rate:P.tax_rate_percent??21};s(M),ee.success("Ajouté au panier",{description:`${l(P)} â ${T.name}`})},S=P=>{var A;const M=f.filter(I=>I.product_id===P.id)[0],R={product_id:P.id,variant_id:(M==null?void 0:M.id)||P.id,stripe_price_id:(M==null?void 0:M.stripe_price_id)||"",name:l(P),variant_name:(M==null?void 0:M.name)||"",format:(M==null?void 0:M.format)||P.product_type||"papier",image:((A=P.images)==null?void 0:A[0])??"",price:(M==null?void 0:M.price_override)??P.promo_price??P.price,quantity:1,product_type:P.product_type,carte_privilege_discount_percent:P.carte_privilege_discount_percent??0,tax_rate:P.tax_rate_percent??21};s(R),ee.success("Ajouté au panier",{description:l(P)})};return a.jsxs("div",{children:[a.jsx(Fn,{title:"Boutique Esprit Sud | Magazines & guides d'Andalousie",description:"Magazines, guides de voyage, livres et produits inspirés de l'Andalousie. Livraison en France et en Esp
881agne.",path:"/boutique"}),a.jsx("div",{className:"bg-primary py-10 md:py-14",children:a.jsxs("div",{className:"container",children:[a.jsx("h1",{className:"font-heading text-3xl font-bold text-primary-foreground md:text-4xl",children:"Boutique Esprit Sud"}),a.jsx("p",{className:"mt-2 text-primary-foreground/80",children:"Publications, produits locaux et expériences andalouses"})]})}),a.jsx("div",{className:"container py-8 md:py-12 space-y-16",children:d?a.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[a.jsx(Xt,{className:"h-80 rounded-xl"}),a.jsx(Xt,{className:"h-80 rounded-xl"})]}):a.jsxs(a.Fragment,{children:[p.length>0&&(()=>{const P=l(p[0]).replace(/\s*[-â]\s*(papier|pdf|num[ée]rique|digital|ebook|broch[ée])\s*$/i,"").trim(),T=c(p.find(M=>c(M)));return a.jsxs("section",{children:[a.jsx("h2",{className:"font-heading text-2xl font-bold md:text-3xl",children:P}),T&&a.jsx("p",{className:"mt-2 text-muted-foreground max-w-2xl",children:T}),a.jsxs("div",{className:"mt-6 grid gap-6 md:grid-cols-2",children:[a.jsx("div",{className:"overflow-hidden rounded-xl bg-muted",children:m?a.jsx("img",{src:m,alt:`${P} â couverture du guide de voyage${T?` : ${T}`:""}`,className:"w-full object-contain aspect-[4/3] p-3"}):a.jsx("div",{className:"flex aspect-[4/3] items-center justify-center text-muted-foreground",children:a.jsx($f,{className:"h-12 w-12","aria-hidden":"true"})})}),a.jsx("div",{className:"flex flex-col gap-4",children:p.map(M=>{const A=v(M)==="pdf",I=A?dp:L_,D=A?"Version PDF":"Version Papier",O=Number(M.promo_price??M.price);return a.jsxs("div",{className:"relative flex-1 rounded-xl border border-border bg-card p-6 shadow-sm transition-shadow hover:shadow-md",children:[A&&a.jsxs(ke,{className:"absolute top-3 right-3 bg-green-100 text-green-800 border-green-200",children:[a.jsx(Ts,{className:"mr-1 h-3 w-3"})," Téléchargement immédiat"]}),a.jsxs(_e,{to:`/boutique/${M.slug}`,className:"block group",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[a.jsx(I,{className:"h-6 w-6 text-[#C8962E]"}),a.jsx("h3",{className:"font-heading text-lg font-semibold group-hover:text-primary transition-colors",children:D})]}),c(M)&&a.jsx("p",{className:"text-sm text-muted-foreground mb-4 line-clamp-2",children:c(M)})]}),a.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[a.jsx("span",{className:"font-heading text-2xl font-bold text-primary",children:jS(O)}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(H,{variant:"outline",size:"sm",className:"rounded-xl",asChild:!0,children:a.jsx(_e,{to:`/boutique/${M.slug}`,children:"Voir le détail"})}),a.jsx(H,{className:"rounded-xl bg-[#C8962E] hover:bg-[#b8862a] text-white",onClick:()=>S(M),children:"Ajouter au panier"})]})]})]},M.id)})})]})]})})(),x&&g.length>0&&a.jsxs("section",{children:[a.jsx("h2",{className:"font-heading text-2xl font-bold md:text-3xl",children:l(x)}),c(x)&&a.jsx("p",{className:"mt-2 text-muted-foreground max-w-2xl",children:c(x)}),a.jsxs("div",{className:"mt-2 inline-flex items-center gap-2 rounded-full bg-amber-50 border border-amber-200 px-4 py-2 text-sm text-amber-800",children:["ð ",a.jsx("strong",{children:"Offre spéciale :"})," 3 achetés + 1 gratuit"]}),a.jsxs("div",{className:"mt-6 grid gap-6 md:grid-cols-2",children:[a.jsx("div",{className:"overflow-hidden rounded-xl bg-muted",children:(E=x.images)!=null&&E[0]?a.jsx("img",{src:x.images[0],alt:l(x),className:"w-full object-contain aspect-[4/3] p-3"}):a.jsx("div",{className:"flex aspect-[4/3] items-center justify-center text-muted-foreground",children:a.jsx($f,{className:"h-12 w-12"})})}),a.jsxs("div",{className:"rounded-xl border border-border bg-card p-6 shadow-sm",children:[a.jsx("label",{className:"mb-2 block text-sm font-medium",children:"Choisir un numéro"}),a.jsxs(lt,{value:n,onValueChange:r,children:[a.jsx(nt,{className:"h-11",children:a.jsx(ct,{placeholder:"Sélectionner un numéro..."})}),a.jsx(rt,{children:g.map(P=>a.jsxs(Ae,{value:P.id,children:["Numéro ",P.numero," â ",P.name]},P.id))})]}),w&&a.jsxs("div",{className:"mt-4 space-y-3",children:[a.jsxs("div",{className:"flex items-baseline justify-between",children:[a.jsxs("div",{children:[a.jsxs("p",{className:"font-medium",children:["Numéro ",w.numero]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:w.name})]}),a.jsx("span",{className:"font-heading text-2xl font-bold text-primary",children:jS(w.price_override??w.price??x.price)})]}),a.jsx(H,{className:"w-full rounded-xl bg-[#C8962E] hover:bg-[#b8862a] text-white",onClick:()=>N(x,w),children:"Ajouter au panier"})]})]})]})]}),_.length>0&&a.jsxs("section",{children:[a.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[a.jsx("h2",{className:"font-heading text-2xl font-bold md:text-3xl",children:"Tous nos produits"}),a.jsxs("div",{className:"relative",children:[a.jsx(is,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(ue,{placeholder:"Rechercher...",value:t,onChange:P=>e(P.target.value),className:"h-9 w-48 pl-9"})]})]}),a.jsx("div",{className:"mt-6 grid gap-6 grid-cols-2 md:grid-cols-3 lg:grid-cols-4",children:j.map(P=>{var T;return a.jsxs(_e,{to:`/boutique/${P.slug}`,className:"group block overflow-hidden rounded-lg border border-border bg-card shadow-sm transition-shadow hover:shadow-lg",children:[a.jsxs("div",{className:"relative aspect-[4/3] overflow-hidden bg-muted",children:[(T=P.images)!=null&&T[0]?a.jsx("img",{src:P.images[0],alt:l(P),loading:"lazy",className:"h-full w-full object-contain p-2 transition-transform duration-300 group-hover:scale-105"}):a.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:a.jsx($f,{className:"h-8 w-8"})}),P.promo_price!=null&&a.jsx(ke,{className:"absolute left-2 top-2 bg-accent text-accent-foreground text-[10px]",children:"Promo"})]}),a.jsxs("div",{className:"p-3 md:p-4",children:[a.jsx("h3",{className:"text-sm font-medium leading-snug line-clamp-2",children:l(P)}),a.jsx("div",{className:"mt-2 flex items-baseline gap-2",children:P.promo_price!=null?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"font-heading text-lg font-bold text-accent",children:jS(P.promo_price)}),a.jsx("span",{className:"text-xs text-muted-foreground line-through",children:jS(P.price)})]}):a.jsx("span",{className:"font-heading text-lg font-bold text-primary",children:jS(P.price)})}),a.jsx(H,{size:"sm",className:"mt-3 w-full rounded-lg text-xs bg-[#C8962E] hover:bg-[#b8862a] text-white",onClick:M=>{M.preventDefault(),M.stopPropagation(),S(P)},children:"Ajouter au panier"})]})]},P.id)})}),j.length===0&&a.jsx("div",{className:"py-12 text-center text-muted-foreground",children:"Aucun produit trouvé."})]})]})})]})};function bn(t){const e=Object.prototype.toString.call(t);return t instanceof Date||typeof t=="object"&&e==="[object Date]"?new t.constructor(+t):typeof t=="number"||e==="[object Number]"||typeof t=="string"||e==="[object String]"?new Date(t):new Date(NaN)}function Fl(t,e){return t instanceof Date?new t.constructor(e):new Date(e)}function no(t,e){const n=bn(t);return isNaN(e)?Fl(t,NaN):(e&&n.setDate(n.getDate()+e),n)}function Lu(t,e){const n=bn(t);if(isNaN(e))return Fl(t,NaN);if(!e)return n;const r=n.getDate(),s=Fl(t,n.getTime());s.setMonth(n.getMonth()+e+1,0);const i=s.getDate();return r>=i?s:(n.setFullYear(s.getFullYear(),s.getMonth(),r),n)}const H9=6048e5,U7e=864e5;let q7e={};function v2(){return q7e}function oh(t,e){var l,c,u,d;
881const n=v2(),r=(e==null?void 0:e.weekStartsOn)??((c=(l=e==null?void 0:e.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??n.weekStartsOn??((d=(u=n.locale)==null?void 0:u.options)==null?void 0:d.weekStartsOn)??0,s=bn(t),i=s.getDay(),o=(i<r?7:0)+i-r;return s.setDate(s.getDate()-o),s.setHours(0,0,0,0),s}function i0(t){return oh(t,{weekStartsOn:1})}function Bxe(t){const e=bn(t),n=e.getFullYear(),r=Fl(t,0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);const s=i0(r),i=Fl(t,0);i.setFullYear(n,0,4),i.setHours(0,0,0,0);const o=i0(i);return e.getTime()>=s.getTime()?n+1:e.getTime()>=o.getTime()?n:n-1}function V_(t){const e=bn(t);return e.setHours(0,0,0,0),e}function JO(t){const e=bn(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function Wd(t,e){const n=V_(t),r=V_(e),s=+n-JO(n),i=+r-JO(r);return Math.round((s-i)/U7e)}function V7e(t){const e=Bxe(t),n=Fl(t,0);return n.setFullYear(e,0,4),n.setHours(0,0,0,0),i0(n)}function E8(t,e){const n=e*7;return no(t,n)}function Uxe(t,e){return Lu(t,e*12)}function H7e(t){let e;return t.forEach(function(n){const r=bn(n);(e===void 0||e<r||isNaN(Number(r)))&&(e=r)}),e||new Date(NaN)}function W7e(t){let e;return t.forEach(n=>{const r=bn(n);(!e||e>r||isNaN(+r))&&(e=r)}),e||new Date(NaN)}function qo(t,e){const n=V_(t),r=V_(e);return+n==+r}function W9(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function K7e(t){if(!W9(t)&&typeof t!="number")return!1;const e=bn(t);return!isNaN(Number(e))}function _k(t,e){const n=bn(t),r=bn(e),s=n.getFullYear()-r.getFullYear(),i=n.getMonth()-r.getMonth();return s*12+i}function G7e(t,e,n){const r=oh(t,n),s=oh(e,n),i=+r-JO(r),o=+s-JO(s);return Math.round((i-o)/H9)}function K9(t){const e=bn(t),n=e.getMonth();return e.setFullYear(e.getFullYear(),n+1,0),e.setHours(23,59,59,999),e}function Go(t){const e=bn(t);return e.setDate(1),e.setHours(0,0,0,0),e}function qxe(t){const e=bn(t),n=Fl(t,0);return n.setFullYear(e.getFullYear(),0,1),n.setHours(0,0,0,0),n}function G9(t,e){var l,c,u,d;const n=v2(),r=(e==null?void 0:e.weekStartsOn)??((c=(l=e==null?void 0:e.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??n.weekStartsOn??((d=(u=n.locale)==null?void 0:u.options)==null?void 0:d.weekStartsOn)??0,s=bn(t),i=s.getDay(),o=(i<r?-7:0)+6-(i-r);return s.setDate(s.getDate()+o),s.setHours(23,59,59,999),s}function Vxe(t){return G9(t,{weekStartsOn:1})}const Y7e={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"}},X7e=(t,e,n)=>{let r;const s=Y7e[t];return typeof s=="string"?r=s:e===1?r=s.one:r=s.other.replace("{{count}}",e.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function Iw(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const J7e={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Q7e={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Z7e={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},eKe={date:Iw({formats:J7e,defaultWidth:"full"}),time:Iw({formats:Q7e,defaultWidth:"full"}),dateTime:Iw({formats:Z7e,defaultWidth:"full"})},tKe={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},nKe=(t,e,n,r)=>tKe[t];function zd(t){return(e,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let s;if(r==="formatting"&&t.formattingValues){const o=t.defaultFormattingWidth||t.defaultWidth,l=n!=null&&n.width?String(n.width):o;s=t.formattingValues[l]||t.formattingValues[o]}else{const o=t.defaultWidth,l=n!=null&&n.width?String(n.width):t.defaultWidth;s=t.values[l]||t.values[o]}const i=t.argumentCallback?t.argumentCallback(e):e;return s[i]}}const rKe={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},sKe={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},iKe={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"]},aKe={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","Frid
881ay","Saturday"]},oKe={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"}},lKe={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"}},cKe=(t,e)=>{const n=Number(t),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},uKe={ordinalNumber:cKe,era:zd({values:rKe,defaultWidth:"wide"}),quarter:zd({values:sKe,defaultWidth:"wide",argumentCallback:t=>t-1}),month:zd({values:iKe,defaultWidth:"wide"}),day:zd({values:aKe,defaultWidth:"wide"}),dayPeriod:zd({values:oKe,defaultWidth:"wide",formattingValues:lKe,defaultFormattingWidth:"wide"})};function Bd(t){return(e,n={})=>{const r=n.width,s=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],i=e.match(s);if(!i)return null;const o=i[0],l=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],c=Array.isArray(l)?hKe(l,h=>h.test(o)):dKe(l,h=>h.test(o));let u;u=t.valueCallback?t.valueCallback(c):c,u=n.valueCallback?n.valueCallback(u):u;const d=e.slice(o.length);return{value:u,rest:d}}}function dKe(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function hKe(t,e){for(let n=0;n<t.length;n++)if(e(t[n]))return n}function Hxe(t){return(e,n={})=>{const r=e.match(t.matchPattern);if(!r)return null;const s=r[0],i=e.match(t.parsePattern);if(!i)return null;let o=t.valueCallback?t.valueCallback(i[0]):i[0];o=n.valueCallback?n.valueCallback(o):o;const l=e.slice(s.length);return{value:o,rest:l}}}const fKe=/^(\d+)(th|st|nd|rd)?/i,pKe=/\d+/i,mKe={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},gKe={any:[/^b/i,/^(a|c)/i]},vKe={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},xKe={any:[/1/i,/2/i,/3/i,/4/i]},yKe={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},bKe={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]},wKe={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},_Ke={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]},jKe={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},SKe={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}},NKe={ordinalNumber:Hxe({matchPattern:fKe,parsePattern:pKe,valueCallback:t=>parseInt(t,10)}),era:Bd({matchPatterns:mKe,defaultMatchWidth:"wide",parsePatterns:gKe,defaultParseWidth:"any"}),quarter:Bd({matchPatterns:vKe,defaultMatchWidth:"wide",parsePatterns:xKe,defaultParseWidth:"any",valueCallback:t=>t+1}),month:Bd({matchPatterns:yKe,defaultMatchWidth:"wide",parsePatterns:bKe,defaultParseWidth:"any"}),day:Bd({matchPatterns:wKe,defaultMatchWidth:"wide",parsePatterns:_Ke,defaultParseWidth:"any"}),dayPeriod:Bd({matchPatterns:jKe,defaultMatchWidth:"any",parsePatterns:SKe,defaultParseWidth:"any"})},Wxe={code:"en-US",formatDistance:X7e,formatLong:eKe,formatRelative:nKe,localize:uKe,match:NKe,options:{weekStartsOn:0,firstWeekContainsDate:1}};function CKe(t){const e=bn(t);return Wd(e,qxe(e))+1}function Kxe(t){const e=bn(t),n=+i0(e)-+V7e(e);return Math.round(n/H9)+1}function Gxe(t,e){var d,h,f,p;const n=bn(t),r=n.getFullYear(),s=v2(),i=(e==null?void 0:e.firstWeekContainsDate)??((h=(d=e==null?void 0:e.locale)==null?void 0:d.options)==null?void 0:h.firstWeekContainsDate)??s.firstWeekContainsDate??((p=(f=s.locale)==null?void 0:f.options)==null?void 0:p.firstWeekContainsDate)??1,o=Fl(t,0);o.setFullYear(r+1,0,i),o.setHours(0,0,0,0);const l=oh(o,e),c=Fl(t,0);c.setFullYear(r,0,i),c.setHours(0,0,0,0);const u=oh(c,e);return n.getTime()>=l.getTime()?r+1:n.getTime()>=u.getTime()?r:r-1}function kKe(t,e){var l,c,u,d;
881const n=v2(),r=(e==null?void 0:e.firstWeekContainsDate)??((c=(l=e==null?void 0:e.locale)==null?void 0:l.options)==null?void 0:c.firstWeekContainsDate)??n.firstWeekContainsDate??((d=(u=n.locale)==null?void 0:u.options)==null?void 0:d.firstWeekContainsDate)??1,s=Gxe(t,e),i=Fl(t,0);return i.setFullYear(s,0,r),i.setHours(0,0,0,0),oh(i,e)}function Yxe(t,e){const n=bn(t),r=+oh(n,e)-+kKe(n,e);return Math.round(r/H9)+1}function Dn(t,e){const n=t<0?"-":"",r=Math.abs(t).toString().padStart(e,"0");return n+r}const kp={y(t,e){const n=t.getFullYear(),r=n>0?n:1-n;return Dn(e==="yy"?r%100:r,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):Dn(n+1,2)},d(t,e){return Dn(t.getDate(),e.length)},a(t,e){const n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(t,e){return Dn(t.getHours()%12||12,e.length)},H(t,e){return Dn(t.getHours(),e.length)},m(t,e){return Dn(t.getMinutes(),e.length)},s(t,e){return Dn(t.getSeconds(),e.length)},S(t,e){const n=e.length,r=t.getMilliseconds(),s=Math.trunc(r*Math.pow(10,n-3));return Dn(s,e.length)}},ab={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Uee={G:function(t,e,n){const r=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){const r=t.getFullYear(),s=r>0?r:1-r;return n.ordinalNumber(s,{unit:"year"})}return kp.y(t,e)},Y:function(t,e,n,r){const s=Gxe(t,r),i=s>0?s:1-s;if(e==="YY"){const o=i%100;return Dn(o,2)}return e==="Yo"?n.ordinalNumber(i,{unit:"year"}):Dn(i,e.length)},R:function(t,e){const n=Bxe(t);return Dn(n,e.length)},u:function(t,e){const n=t.getFullYear();return Dn(n,e.length)},Q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(r);case"QQ":return Dn(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(r);case"qq":return Dn(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,e,n){const r=t.getMonth();switch(e){case"M":case"MM":return kp.M(t,e);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(t,e,n){const r=t.getMonth();switch(e){case"L":return String(r+1);case"LL":return Dn(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(t,e,n,r){const s=Yxe(t,r);return e==="wo"?n.ordinalNumber(s,{unit:"week"}):Dn(s,e.length)},I:function(t,e,n){const r=Kxe(t);return e==="Io"?n.ordinalNumber(r,{unit:"week"}):Dn(r,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):kp.d(t,e)},D:function(t,e,n){const r=CKe(t);return e==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):Dn(r,e.length)},E:function(t,e,n){const r=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(t,e,n,r){const s=t.getDay(),i=(s-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(i);case"ee":return Dn(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(s,{width:"short",context:"formatting"});case"eeee":default:return n.day(s,{width:"wide",context:"formatting"})}},c:function(t,e,n,r){const s=t.getDay(),i=(s-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(i);case"cc":return Dn(i,e.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(s,{width:"narrow",context:"standalone"});case"cccccc":return n.day(s,{width:"short",context:"standalone"});case"cccc":default:return n.day(s,{width:"wide",context:"standalone"})}},i:function(t,e,n){const r=t.getDay(),s=r===0?7:r;switch(e){case"i":return String(s);case"ii":return Dn(s,e.length);case"io":return n.ordinalNumber(s,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(t,e,n){const s=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(t,e,n){const r=t.getHours();let s;switch(r===12?s=ab.noon:r===0?s=ab.midnight:s=r/12>
881=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(t,e,n){const r=t.getHours();let s;switch(r>=17?s=ab.evening:r>=12?s=ab.afternoon:r>=4?s=ab.morning:s=ab.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let r=t.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return kp.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):kp.H(t,e)},K:function(t,e,n){const r=t.getHours()%12;return e==="Ko"?n.ordinalNumber(r,{unit:"hour"}):Dn(r,e.length)},k:function(t,e,n){let r=t.getHours();return r===0&&(r=24),e==="ko"?n.ordinalNumber(r,{unit:"hour"}):Dn(r,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):kp.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):kp.s(t,e)},S:function(t,e){return kp.S(t,e)},X:function(t,e,n){const r=t.getTimezoneOffset();if(r===0)return"Z";switch(e){case"X":return Vee(r);case"XXXX":case"XX":return Iv(r);case"XXXXX":case"XXX":default:return Iv(r,":")}},x:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"x":return Vee(r);case"xxxx":case"xx":return Iv(r);case"xxxxx":case"xxx":default:return Iv(r,":")}},O:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+qee(r,":");case"OOOO":default:return"GMT"+Iv(r,":")}},z:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+qee(r,":");case"zzzz":default:return"GMT"+Iv(r,":")}},t:function(t,e,n){const r=Math.trunc(t.getTime()/1e3);return Dn(r,e.length)},T:function(t,e,n){const r=t.getTime();return Dn(r,e.length)}};function qee(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),s=Math.trunc(r/60),i=r%60;return i===0?n+String(s):n+String(s)+e+Dn(i,2)}function Vee(t,e){return t%60===0?(t>0?"-":"+")+Dn(Math.abs(t)/60,2):Iv(t,e)}function Iv(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),s=Dn(Math.trunc(r/60),2),i=Dn(r%60,2);return n+s+e+i}const Hee=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},Xxe=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},AKe=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],s=n[2];if(!s)return Hee(t,e);let i;switch(r){case"P":i=e.dateTime({width:"short"});break;case"PP":i=e.dateTime({width:"medium"});break;case"PPP":i=e.dateTime({width:"long"});break;case"PPPP":default:i=e.dateTime({width:"full"});break}return i.replace("{{date}}",Hee(r,e)).replace("{{time}}",Xxe(s,e))},EKe={p:Xxe,P:AKe},TKe=/^D+$/,PKe=/^Y+$/,MKe=["D","DD","YY","YYYY"];function RKe(t){return TKe.test(t)}function OKe(t){return PKe.test(t)}function IKe(t,e,n){const r=DKe(t,e,n);if(console.warn(r),MKe.includes(t))throw new RangeError(r)}function DKe(t,e,n){const r=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const LKe=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,FKe=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,$Ke=/^'([^]*?)'?$/,zKe=/''/g,BKe=/[a-zA-Z]/;function lh(t,e,n){var d,h,f,p,m,v,x,g;const r=v2(),s=(n==null?void 0:n.locale)??r.locale??Wxe,i=(n==null?void 0:n.firstWeekContainsDate)??((h=(d=n==null?void 0:n.locale)==null?void 0:d.options)==null?void 0:h.firstWeekContainsDate)??r.firstWeekContainsDate??((p=(f=r.locale)==null?void 0:f.options)==null?void 0:p.firstWeekContainsDate)??1,o=(n==null?void 0:n.weekStartsOn)??((v=(m=n==null?void 0:n.locale)==null?void 0:m.options)==null?void 0:v.weekStartsOn)??r.weekStartsOn??((g=(x=r.locale)==null?void 0:x.options)==null?void 0:g.weekStartsOn)??0,l=bn(t);if(!K7e(l))throw new RangeError("Invalid time value");let c=e.match(FKe).map(w=>{const _=w[0];if(_==="p"||_==="P"){const j=EKe[_];return j(w,s.formatLong)}return w}).join("").match(LKe).map(w=>{if(w==="''")return{isToken:!1,value:"'"};const _=w[0];if(_==="'")return{isToken:!1,value:UKe(w)};if(Uee[_])return{isToken:!0,value:w};
881if(_.match(BKe))throw new RangeError("Format string contains an unescaped latin alphabet character `"+_+"`");return{isToken:!1,value:w}});s.localize.preprocessor&&(c=s.localize.preprocessor(l,c));const u={firstWeekContainsDate:i,weekStartsOn:o,locale:s};return c.map(w=>{if(!w.isToken)return w.value;const _=w.value;(!(n!=null&&n.useAdditionalWeekYearTokens)&&OKe(_)||!(n!=null&&n.useAdditionalDayOfYearTokens)&&RKe(_))&&IKe(_,e,String(t));const j=Uee[_[0]];return j(l,_,s.localize,u)}).join("")}function UKe(t){const e=t.match($Ke);return e?e[1].replace(zKe,"'"):t}function qKe(t){const e=bn(t),n=e.getFullYear(),r=e.getMonth(),s=Fl(t,0);return s.setFullYear(n,r+1,0),s.setHours(0,0,0,0),s.getDate()}function VKe(t){return Math.trunc(+bn(t)/1e3)}function HKe(t){const e=bn(t),n=e.getMonth();return e.setFullYear(e.getFullYear(),n+1,0),e.setHours(0,0,0,0),e}function WKe(t,e){return G7e(HKe(t),Go(t),e)+1}function T8(t,e){const n=bn(t),r=bn(e);return n.getTime()>r.getTime()}function Jxe(t,e){const n=bn(t),r=bn(e);return+n<+r}function Y9(t,e){const n=bn(t),r=bn(e);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()}function KKe(t,e){const n=bn(t),r=bn(e);return n.getFullYear()===r.getFullYear()}function d5(t,e){return no(t,-e)}function h5(t,e){const n=bn(t),r=n.getFullYear(),s=n.getDate(),i=Fl(t,0);i.setFullYear(r,e,15),i.setHours(0,0,0,0);const o=qKe(i);return n.setMonth(e,Math.min(s,o)),n}function Wee(t,e){const n=bn(t);return isNaN(+n)?Fl(t,NaN):(n.setFullYear(e),n)}const GKe={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"}},YKe=(t,e,n)=>{let r;const s=GKe[t];return typeof s=="string"?r=s:e===1?r=s.one:r=s.other.replace("{{count}}",String(e)),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"dans "+r:"il y a "+r:r},XKe={full:"EEEE d MMMM y",long:"d MMMM y",medium:"d MMM y",short:"dd/MM/y"},JKe={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},QKe={full:"{{date}} 'à ' {{time}}",long:"{{date}} 'à ' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},ZKe={date:Iw({formats:XKe,defaultWidth:"full"}),time:Iw({formats:JKe,defaultWidth:"full"}),dateTime:Iw({formats:QKe,defaultWidth:"full"})},eGe={lastWeek:"eeee 'dernier à ' p",yesterday:"'hier à ' p",today:"'aujourdâhui à ' p",tomorrow:"'demain à ' p'",nextWeek:"eeee 'prochain à ' p",other:"P"},tGe=(t,e,n,r)=>eGe[t],nGe={narrow:["av. J.-C","ap. J.-C"],abbreviated:["av. J.-C","ap. J.-C"],wide:["avant Jésus-Christ","après Jésus-Christ"]},rGe={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"]},sGe={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"]},iGe={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"]},aGe={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"}},oGe=(t,e)=>{const n=Number(t),r=e==null?void 0:e.unit;if(n===0)return"0";const s=["year","week","hour","minute","second"];let i;return n===1?i=r&&s.includes(r)?"ère":"er":i="ème",n+i},lGe=["MMM","MMMM"],cGe={preprocessor:(t,e)=>t.getDate()===1||!e.some(r=>r.isToken&&lGe.includes(r.value))?e:e.map(r=>r.isToken&&r.value==="do"?{isToken:!0,value:"d"}:r),ordinalNumber:oGe,era:zd({values:nGe,defaultWidth:"wide"}),quarter:zd({values:rGe,defaultWidth:"wide",argumentCallback:t=>t-1}),month:zd({values:sGe,defaultWidth:"wide"}),day:zd({values:iGe,defaultWidth:"wide"}),dayPeriod:zd({values:aGe,defaultWidth:"wide"})},uGe=/^(\d+)(ième|ère|ème|er|e)?/i,dGe=/\d+/i,hGe={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},fGe={any:[/^av/i,/^ap/i]},pGe={narrow:/^T?[1234]/i,abbreviated:/^[1234](er|ème|e)? trim\.?/i,wide:/^[1234](er|ème|e)? trimestre/i},mGe={any:[/1/i,/2/i,/3/i,/4/i]},gGe={narrow:/^[jfmasond]/i,abbreviated:/^(janv|févr|mars|avr|mai|juin|juill|juil|août|sept|oct|nov|déc)\.?/i,wide:/^(janv
881ier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i},vGe={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]},xGe={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},yGe={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]},bGe={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},wGe={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}},_Ge={ordinalNumber:Hxe({matchPattern:uGe,parsePattern:dGe,valueCallback:t=>parseInt(t)}),era:Bd({matchPatterns:hGe,defaultMatchWidth:"wide",parsePatterns:fGe,defaultParseWidth:"any"}),quarter:Bd({matchPatterns:pGe,defaultMatchWidth:"wide",parsePatterns:mGe,defaultParseWidth:"any",valueCallback:t=>t+1}),month:Bd({matchPatterns:gGe,defaultMatchWidth:"wide",parsePatterns:vGe,defaultParseWidth:"any"}),day:Bd({matchPatterns:xGe,defaultMatchWidth:"wide",parsePatterns:yGe,defaultParseWidth:"any"}),dayPeriod:Bd({matchPatterns:bGe,defaultMatchWidth:"any",parsePatterns:wGe,defaultParseWidth:"any"})},Qxe={code:"fr",formatDistance:YKe,formatLong:ZKe,formatRelative:tGe,localize:cGe,match:_Ge,options:{weekStartsOn:1,firstWeekContainsDate:4}};var R3="Collapsible",[jGe,Zxe]=Ys(R3),[SGe,X9]=jGe(R3),eye=b.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:r,defaultOpen:s,disabled:i,onOpenChange:o,...l}=t,[c,u]=Xo({prop:r,defaultProp:s??!1,onChange:o,caller:R3});return a.jsx(SGe,{scope:n,disabled:i,contentId:Ml(),open:c,onOpenToggle:b.useCallback(()=>u(d=>!d),[u]),children:a.jsx(et.div,{"data-state":e7(c),"data-disabled":i?"":void 0,...l,ref:e})})});eye.displayName=R3;var tye="CollapsibleTrigger",J9=b.forwardRef((t,e)=>{const{__scopeCollapsible:n,...r}=t,s=X9(tye,n);return a.jsx(et.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":e7(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:e,onClick:ze(t.onClick,s.onOpenToggle)})});J9.displayName=tye;var Q9="CollapsibleContent",Z9=b.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=X9(Q9,t.__scopeCollapsible);return a.jsx(yo,{present:n||s.open,children:({present:i})=>a.jsx(NGe,{...r,ref:e,present:i})})});Z9.displayName=Q9;var NGe=b.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:r,children:s,...i}=t,o=X9(Q9,n),[l,c]=b.useState(r),u=b.useRef(null),d=$t(e,u),h=b.useRef(0),f=h.current,p=b.useRef(0),m=p.current,v=o.open||l,x=b.useRef(v),g=b.useRef(void 0);return b.useEffect(()=>{const w=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(w)},[]),ys(()=>{const w=u.current;if(w){g.current=g.current||{transitionDuration:w.style.transitionDuration,animationName:w.style.animationName},w.style.transitionDuration="0s",w.style.animationName="none";const _=w.getBoundingClientRect();h.current=_.height,p.current=_.width,x.current||(w.style.transitionDuration=g.current.transitionDuration,w.style.animationName=g.current.animationName),c(r)}},[o.open,r]),a.jsx(et.div,{"data-state":e7(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!v,...i,ref:d,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...t.style},children:v&&s})});function e7(t){return t?"open":"closed"}var nye=eye,CGe=J9,kGe=Z9,Vu="Accordion",AGe=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[t7,EGe,TGe]=Cj(Vu),[O3,ILt]=Ys(Vu,[TGe,Zxe]),n7=Zxe(),rye=ve.forwardRef((t,e)=>{const{type:n,...r}=t,s=r,i=r;return a.jsx(t7.Provider,{scope:t.__scopeAccordion,children:n==="multiple"?a.jsx(OGe,{...i,ref:e}):a.jsx(RGe,{...s,ref:e})})});rye.displayName=Vu;var[sye,PGe]=O3(Vu),[iye,MGe]=O3(Vu,{collapsible:!1}),RGe=ve.forwardRef((t,e)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},collapsible:i=!1,...o}=t,[l,c]=Xo({prop:n,defaultProp:r??"",onChange:s,caller:Vu});return a.jsx(sye,{scope:t.__scopeAccordion,value:ve.useMemo(()=>l?[l]:[],[l]),onItemOpen:c,onItemClose:ve.useCallback(()=>i&&c(""),[i,c]),children:a.jsx(iye,{scope:t.__scopeAccordion,collapsible:i,children:a.jsx(aye,{...o,ref:e})})})}),OGe=ve.forwardRef((t,e)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},...i}=t,[o,l]=Xo({prop:n,defaultProp:r??[],onChange:s,caller:Vu}),c=ve.useCallback(d=>l((h=[])=>[...h,d]),[l]),u=ve.useCallback(d=>l((h=[])=>h.filter(f=>f!==d)),[l]);return a.jsx(sye,{scope:t.__scopeAccordion,value:o,onItemOpen:c,onItemClose:u,children:a.jsx(iye,{scope:t.__scopeAccordion,collapsible:!0,children:a.jsx(aye,{...i,ref:e})})})}),[IGe,I3]=O3(Vu),aye=ve.forwardRef((t,e)=>{const{__scopeAccordion:n,disabled:r,dir:s,orientation:i="vertical",...o}=t,l=ve.useRef(null),c=$t(l,e),u=EGe(n),h=Lj(s)==="ltr",f=ze(t.onKeyDown,p=>{var k;if(!AGe.includes(p.key))return;const m=p.target,v=u().filter(E=>{var P;return!((P=E.ref.current)!=null&&P.disabled)}),x=v.findIndex(E=>E.ref.current===m),g=v.length;if(x===-1)return;p.preventDefault();let w=x;const _=0,j=g-1,N=()=>{w=x+1,w>j&&(w=_)},S=()=>{w=x-1,w<_&&(w=j)};switch(p.key){case"Home":w=_;break;case"End":w=j;break;case"ArrowRight":i==="horizontal"&&(h?N():S());break;case"ArrowDown":i==="vertical"&&N();break;case"ArrowLeft":i==="horizontal"&&(h?S():N());break;case"ArrowUp":i==="vertical"&&S();break}const C=w%g;(k=v[C].ref.current)==null||k.focus()});return a.jsx(IGe,{scope:n,disabled:r,direction:s,orientation:i,children:a.jsx(t7.Slot,{scope:n,children:a.jsx(et.div,{...o,"data-orientation":i,ref:c,onKeyDown:r?void 0:f})})})}),QO="AccordionItem",[DGe,r7]=O3(QO),oye=ve.forwardRef((t,e)=>{const{__scopeAccordion:n,value:r,...s}=t,i=I3(QO,n),o=PGe(QO,n),l=n7(n),c=Ml(),u=r&&o.value.includes(r)||!1,d=i.disabled||t.disabled;return a.jsx(DGe,{scope:n,open:u,disabled:d,triggerId:c,children:a.jsx(nye,{"data-orientation":i.orientation,"data-state":fye(u),...l,...s,ref:e,disabled:d,open:u,onOpenChange:h=>{h?o.onItemOpen(r):o.onItemClose(r)}})})});oye.displayName=QO;var lye="AccordionHeader",cye=ve.forwardRef((t,e)=>{const{__scopeAccordion:n,...r}=t,s=I3(Vu,n),i=r7(lye,n);return a.jsx(et.h3,{"data-orientation":s.orientation,"data-state":fye(i.open
881),"data-disabled":i.disabled?"":void 0,...r,ref:e})});cye.displayName=lye;var P8="AccordionTrigger",uye=ve.forwardRef((t,e)=>{const{__scopeAccordion:n,...r}=t,s=I3(Vu,n),i=r7(P8,n),o=MGe(P8,n),l=n7(n);return a.jsx(t7.ItemSlot,{scope:n,children:a.jsx(CGe,{"aria-disabled":i.open&&!o.collapsible||void 0,"data-orientation":s.orientation,id:i.triggerId,...l,...r,ref:e})})});uye.displayName=P8;var dye="AccordionContent",hye=ve.forwardRef((t,e)=>{const{__scopeAccordion:n,...r}=t,s=I3(Vu,n),i=r7(dye,n),o=n7(n);return a.jsx(kGe,{role:"region","aria-labelledby":i.triggerId,"data-orientation":s.orientation,...o,...r,ref:e,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...t.style}})});hye.displayName=dye;function fye(t){return t?"open":"closed"}var LGe=rye,FGe=oye,$Ge=cye,pye=uye,mye=hye;const s7=LGe,D3=b.forwardRef(({className:t,...e},n)=>a.jsx(FGe,{ref:n,className:Fe("border-b",t),...e}));D3.displayName="AccordionItem";const L3=b.forwardRef(({className:t,children:e,...n},r)=>a.jsx($Ge,{className:"flex",children:a.jsxs(pye,{ref:r,className:Fe("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",t),...n,children:[e,a.jsx(wh,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));L3.displayName=pye.displayName;const F3=b.forwardRef(({className:t,children:e,...n},r)=>a.jsx(mye,{ref:r,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...n,children:a.jsx("div",{className:Fe("pb-4 pt-0",t),children:e})}));F3.displayName=mye.displayName;var Lt=function(){return Lt=Object.assign||function(e){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},Lt.apply(this,arguments)};function zGe(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(n[r[s]]=t[r[s]]);return n}function gye(t,e,n){for(var r=0,s=e.length,i;r<s;r++)(i||!(r in e))&&(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return t.concat(i||Array.prototype.slice.call(e))}function x2(t){return t.mode==="multiple"}function y2(t){return t.mode==="range"}function $3(t){return t.mode==="single"}var BGe={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 UGe(t,e){return lh(t,"LLLL y",e)}function qGe(t,e){return lh(t,"d",e)}function VGe(t,e){return lh(t,"LLLL",e)}function HGe(t){return"".concat(t)}function WGe(t,e){return lh(t,"cccccc",e)}function KGe(t,e){return lh(t,"yyyy",e)}var GGe=Object.freeze({__proto__:null,formatCaption:UGe,formatDay:qGe,formatMonthCaption:VGe,formatWeekNumber:HGe,formatWeekdayName:WGe,formatYearCaption:KGe}),YGe=function(t,e,n){return lh(t,"do MMMM (EEEE)",n)},XGe=function(){return"Month: "},JGe=function(){return"Go to next month"},QGe=function(){return"Go to previous month"},ZGe=function(t,e){return lh(t,"cccc",e)},eYe=function(t){return"Week n. ".concat(t)},tYe=function(){return"Year: "},nYe=Object.freeze({__proto__:null,labelDay:YGe,labelMonthDropdown:XGe,labelNext:JGe,labelPrevious:QGe,labelWeekNumber:eYe,labelWeekday:ZGe,labelYearDropdown:tYe});function rYe(){var t="buttons",e=BGe,n=Wxe,r={},s={},i=1,o={},l=new Date;return{captionLayout:t,classNames:e,formatters:GGe,labels:nYe,locale:n,modifiersClassNames:r,modifiers:s,numberOfMonths:i,styles:o,today:l,mode:"default"}}function sYe(t){var e=t.fromYear,n=t.toYear,r=t.fromMonth,s=t.toMonth,i=t.fromDate,o=t.toDate;
881return r?i=Go(r):e&&(i=new Date(e,0,1)),s?o=K9(s):n&&(o=new Date(n,11,31)),{fromDate:i?V_(i):void 0,toDate:o?V_(o):void 0}}var vye=b.createContext(void 0);function iYe(t){var e,n=t.initialProps,r=rYe(),s=sYe(n),i=s.fromDate,o=s.toDate,l=(e=n.captionLayout)!==null&&e!==void 0?e:r.captionLayout;l!=="buttons"&&(!i||!o)&&(l="buttons");var c;($3(n)||x2(n)||y2(n))&&(c=n.onSelect);var u=Lt(Lt(Lt({},r),n),{captionLayout:l,classNames:Lt(Lt({},r.classNames),n.classNames),components:Lt({},n.components),formatters:Lt(Lt({},r.formatters),n.formatters),fromDate:i,labels:Lt(Lt({},r.labels),n.labels),mode:n.mode||r.mode,modifiers:Lt(Lt({},r.modifiers),n.modifiers),modifiersClassNames:Lt(Lt({},r.modifiersClassNames),n.modifiersClassNames),onSelect:c,styles:Lt(Lt({},r.styles),n.styles),toDate:o});return a.jsx(vye.Provider,{value:u,children:t.children})}function hr(){var t=b.useContext(vye);if(!t)throw new Error("useDayPicker must be used within a DayPickerProvider.");return t}function xye(t){var e=hr(),n=e.locale,r=e.classNames,s=e.styles,i=e.formatters.formatCaption;return a.jsx("div",{className:r.caption_label,style:s.caption_label,"aria-live":"polite",role:"presentation",id:t.id,children:i(t.displayMonth,{locale:n})})}function aYe(t){return a.jsx("svg",Lt({width:"8px",height:"8px",viewBox:"0 0 120 120","data-testid":"iconDropdown"},t,{children:a.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 yye(t){var e,n,r=t.onChange,s=t.value,i=t.children,o=t.caption,l=t.className,c=t.style,u=hr(),d=(n=(e=u.components)===null||e===void 0?void 0:e.IconDropdown)!==null&&n!==void 0?n:aYe;return a.jsxs("div",{className:l,style:c,children:[a.jsx("span",{className:u.classNames.vhidden,children:t["aria-label"]}),a.jsx("select",{name:t.name,"aria-label":t["aria-label"],className:u.classNames.dropdown,style:u.styles.dropdown,value:s,onChange:r,children:i}),a.jsxs("div",{className:u.classNames.caption_label,style:u.styles.caption_label,"aria-hidden":"true",children:[o,a.jsx(d,{className:u.classNames.dropdown_icon,style:u.styles.dropdown_icon})]})]})}function oYe(t){var e,n=hr(),r=n.fromDate,s=n.toDate,i=n.styles,o=n.locale,l=n.formatters.formatMonthCaption,c=n.classNames,u=n.components,d=n.labels.labelMonthDropdown;if(!r)return a.jsx(a.Fragment,{});if(!s)return a.jsx(a.Fragment,{});var h=[];if(KKe(r,s))for(var f=Go(r),p=r.getMonth();p<=s.getMonth();p++)h.push(h5(f,p));else for(var f=Go(new Date),p=0;p<=11;p++)h.push(h5(f,p));var m=function(x){var g=Number(x.target.value),w=h5(Go(t.displayMonth),g);t.onChange(w)},v=(e=u==null?void 0:u.Dropdown)!==null&&e!==void 0?e:yye;return a.jsx(v,{name:"months","aria-label":d(),className:c.dropdown_month,style:i.dropdown_month,onChange:m,value:t.displayMonth.getMonth(),caption:l(t.displayMonth,{locale:o}),children:h.map(function(x){return a.jsx("option",{value:x.getMonth(),children:l(x,{locale:o})},x.getMonth())})})}function lYe(t){var e,n=t.displayMonth,r=hr(),s=r.fromDate,i=r.toDate,o=r.locale,l=r.styles,c=r.classNames,u=r.components,d=r.formatters.formatYearCaption,h=r.labels.labelYearDropdown,f=[];if(!s)return a.jsx(a.Fragment,{});if(!i)return a.jsx(a.Fragment,{});for(var p=s.getFullYear(),m=i.getFullYear(),v=p;v<=m;v++)f.push(Wee(qxe(new Date),v));var x=function(w){var _=Wee(Go(n),Number(w.target.value));t.onChange(_)},g=(e=u==null?void 0:u.Dropdown)!==null&&e!==void 0?e:yye;return a.jsx(g,{name:"years","aria-label":h(),className:c.dropdown_year,style:l.dropdown_year,onChange:x,value:n.getFullYear(),caption:d(n,{locale:o}),children:f.map(function(w){return a.jsx("option",{value:w.getFullYear(),children:d(w,{locale:o})},w.getFullYear())})})}function cYe(t,e){var n=b.useState(t),r=n[0],s=n[1],i=e===void 0?r:e;return[i,s]}function uYe(t){var e=t.month,n=t.defaultMonth,r=t.today,s=e||n||r||new Date,i=t.toDate,o=t.fromDate,l=t.numberOfMonths,c=l===void 0?1:l;if(i&&_k(i,s)<0){var u=-1*(c-1);s=Lu(i,u)}return o&&_k(s,o)<0&&(s=o),Go(s)}function dYe(){var t=hr(),e=uYe(t),n=cYe(e,t.month),r=n[0],s=n[1],i=function(o){var l;if(!t.disableNavigation){var c=Go(o);s(c),(l=t.onMonthChange)===null||l===void 0||l.call(t,c)}};return[r,i]}function hYe(t,e){for(var n=e.reverseMonths,r=e.numberOfMonths,s=Go(t),i=Go(Lu(s,r)),o=_k(i,s),l=[],c=0;c<o;c++){var u=Lu(s,c);l.push(u)}return n&&(l=l.reverse()),l}function fYe(t,e){if(!e.disableNavigation){var n=e.toDate,r=e.pagedNavigation,s=e.numberOfMonths,i=s===void 0?1:s,o=r?i:1,l=Go(t);
881if(!n)return Lu(l,o);var c=_k(n,t);if(!(c<i))return Lu(l,o)}}function pYe(t,e){if(!e.disableNavigation){var n=e.fromDate,r=e.pagedNavigation,s=e.numberOfMonths,i=s===void 0?1:s,o=r?i:1,l=Go(t);if(!n)return Lu(l,-o);var c=_k(l,n);if(!(c<=0))return Lu(l,-o)}}var bye=b.createContext(void 0);function mYe(t){var e=hr(),n=dYe(),r=n[0],s=n[1],i=hYe(r,e),o=fYe(r,e),l=pYe(r,e),c=function(h){return i.some(function(f){return Y9(h,f)})},u=function(h,f){c(h)||(f&&Jxe(h,f)?s(Lu(h,1+e.numberOfMonths*-1)):s(h))},d={currentMonth:r,displayMonths:i,goToMonth:s,goToDate:u,previousMonth:l,nextMonth:o,isDateDisplayed:c};return a.jsx(bye.Provider,{value:d,children:t.children})}function b2(){var t=b.useContext(bye);if(!t)throw new Error("useNavigation must be used within a NavigationProvider");return t}function Kee(t){var e,n=hr(),r=n.classNames,s=n.styles,i=n.components,o=b2().goToMonth,l=function(d){o(Lu(d,t.displayIndex?-t.displayIndex:0))},c=(e=i==null?void 0:i.CaptionLabel)!==null&&e!==void 0?e:xye,u=a.jsx(c,{id:t.id,displayMonth:t.displayMonth});return a.jsxs("div",{className:r.caption_dropdowns,style:s.caption_dropdowns,children:[a.jsx("div",{className:r.vhidden,children:u}),a.jsx(oYe,{onChange:l,displayMonth:t.displayMonth}),a.jsx(lYe,{onChange:l,displayMonth:t.displayMonth})]})}function gYe(t){return a.jsx("svg",Lt({width:"16px",height:"16px",viewBox:"0 0 120 120"},t,{children:a.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 vYe(t){return a.jsx("svg",Lt({width:"16px",height:"16px",viewBox:"0 0 120 120"},t,{children:a.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 ZO=b.forwardRef(function(t,e){var n=hr(),r=n.classNames,s=n.styles,i=[r.button_reset,r.button];t.className&&i.push(t.className);var o=i.join(" "),l=Lt(Lt({},s.button_reset),s.button);return t.style&&Object.assign(l,t.style),a.jsx("button",Lt({},t,{ref:e,type:"button",className:o,style:l}))});function xYe(t){var e,n,r=hr(),s=r.dir,i=r.locale,o=r.classNames,l=r.styles,c=r.labels,u=c.labelPrevious,d=c.labelNext,h=r.components;if(!t.nextMonth&&!t.previousMonth)return a.jsx(a.Fragment,{});var f=u(t.previousMonth,{locale:i}),p=[o.nav_button,o.nav_button_previous].join(" "),m=d(t.nextMonth,{locale:i}),v=[o.nav_button,o.nav_button_next].join(" "),x=(e=h==null?void 0:h.IconRight)!==null&&e!==void 0?e:vYe,g=(n=h==null?void 0:h.IconLeft)!==null&&n!==void 0?n:gYe;return a.jsxs("div",{className:o.nav,style:l.nav,children:[!t.hidePrevious&&a.jsx(ZO,{name:"previous-month","aria-label":f,className:p,style:l.nav_button_previous,disabled:!t.previousMonth,onClick:t.onPreviousClick,children:s==="rtl"?a.jsx(x,{className:o.nav_icon,style:l.nav_icon}):a.jsx(g,{className:o.nav_icon,style:l.nav_icon})}),!t.hideNext&&a.jsx(ZO,{name:"next-month","aria-label":m,className:v,style:l.nav_button_next,disabled:!t.nextMonth,onClick:t.onNextClick,children:s==="rtl"?a.jsx(g,{className:o.nav_icon,style:l.nav_icon}):a.jsx(x,{className:o.nav_icon,style:l.nav_icon})})]})}function Gee(t){var e=hr().numberOfMonths,n=b2(),r=n.previousMonth,s=n.nextMonth,i=n.goToMonth,o=n.displayMonths,l=o.findIndex(function(m){return Y9(t.displayMonth,m)}),c=l===0,u=l===o.length-1,d=e>1&&(c||!u),h=e>1&&(u||!c),f=function(){r&&i(r)},p=function(){s&&i(s)};return a.jsx(xYe,{displayMonth:t.displayMonth,hideNext:d,hidePrevious:h,nextMonth:s,previousMonth:r,onPreviousClick:f,onNextClick:p})}function yYe(t){var e,n=hr(),r=n.classNames,s=n.disableNavigation,i=n.styles,o=n.captionLayout,l=n.components,c=(e=l==null?void 0:l.CaptionLabel)!==null&&e!==void 0?e:xye,u;return s?u=a.jsx(c,{id:t.id,displayMonth:t.displayMonth}):o==="dropdown"?u=a.jsx(Kee,{displayMonth:t.displayMonth,id:t.id}):o==="dropdown-buttons"?u=a.jsxs(a.Fragment,{children:[a.jsx(Kee,{displayMonth:t.displayMonth,displayIndex:t.displayIndex,id:t.id}),a.jsx(Gee,{displayMonth:t.displayMonth,displayIndex:t.displayIndex,id:t.id})]}):u=a.jsxs(a.Fragment,{children:[a.jsx(c,{id:t.id,displayMonth:t.displayMonth,displayIndex:t.displayIndex}),a.jsx(Gee,{displayMonth:t.displayMonth,id:t.id})]}),a.jsx("div",{className:r.caption,style:i.caption,children:u})}function bYe(t){var e=hr(),n=e.footer,r=e.styles,s=e.classNames.tfoot;return n?a.jsx("tfoot",{className:s,style:r.tfoot,children:a.jsx("tr",{children:a.jsx("td",{colSpan:8,children:n})})}):a.jsx(a.Fragment,{})}function wYe(t,e,n){for(var r=n?i0(new Date):oh(new Date,{locale:t,weekStartsOn:e}),s=[],i=0;i<7;i++){var o=no(r,i);s.push(o)}return s}function _Ye(){var t=hr(),e=t.classNames,n=t.styles,r=t.showWeekNumber,s=t.locale,i=t.weekStartsOn,o=t.ISOWeek,l=t.formatters.formatWeekdayName,c=t.labels.labelWeekday,u=wYe(s,i,o);return a.jsxs("tr",{style:n.head_row,className:e.head_row,children:[r&&a.jsx("td",{style:n.head_cell,className:e.head_cell}),u.map(function(d,h){return a.jsx("th",{scope:"col",className:e.head_cell,style:n.head_cell,"aria-label":c(d,{locale:s}),children:l(d,{locale:s})},h)})]})}function jYe(){var t,e=hr(),n=e.classNames,r=e.styles,s=e.components,i=(t=s==null?void 0:s.HeadRow)!==null&&t!==void 0?t:_Ye;return a.jsx("thead",{style:r.head,className:n.head,children:a.jsx(i,{})})}function SYe(t){var e=hr(),n=e.locale,r=e.formatters.formatDay;return a.jsx(a.Fragment,{children:r(t.date,{locale:n})})}var i7=b.createContext(void 0);function NYe(t){if(!x2(t.initialProps)){var e={selected:void 0,modifiers:{disabled:[]}};return a.jsx(i7.Provider,{value:e,children:t.children})}return a.jsx(CYe,{initialProps:t.initialProps,children:t.children})}function CYe(t){var e=t.initialProps,n=t.children,r=e.selected,s=e.min,i=e.max,o=function(u,d,h){var f,p;(f=e.onDayClick)===null||f===void 0||f.call(e,u,d,h);var m=!!(d.selected&&s&&(r==null?void 0:r.length)===s);if(!m){var v=!!(!d.selected&&i&&(r==null?void 0:r.length)===i);if(!v){var x=r?gye([],r):[];if(d.selected){var g=x.findIndex(function(w){return qo(u,w)});x.splice(g,1)}else x.push(u);(p=e.onSelect)===null||p===void 0||p.call(e,x,u,d,h)}}},l={disabled:[]};r&&l.disabled.push(function(u){var d=i&&r.length>i-1,h=r.some(function(f){return qo(f,u)});return!!(d&&!h)});var c={selected:r,onDayClick:o,modifiers:l};return a.jsx(i7.Provider,{value:c,children:n})}function a7(){var t=b.useContext(i7);if(!t)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return t}
881function kYe(t,e){var n=e||{},r=n.from,s=n.to;return r&&s?qo(s,t)&&qo(r,t)?void 0:qo(s,t)?{from:s,to:void 0}:qo(r,t)?void 0:T8(r,t)?{from:t,to:s}:{from:r,to:t}:s?T8(t,s)?{from:s,to:t}:{from:t,to:s}:r?Jxe(t,r)?{from:t,to:r}:{from:r,to:t}:{from:t,to:void 0}}var o7=b.createContext(void 0);function AYe(t){if(!y2(t.initialProps)){var e={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return a.jsx(o7.Provider,{value:e,children:t.children})}return a.jsx(EYe,{initialProps:t.initialProps,children:t.children})}function EYe(t){var e=t.initialProps,n=t.children,r=e.selected,s=r||{},i=s.from,o=s.to,l=e.min,c=e.max,u=function(p,m,v){var x,g;(x=e.onDayClick)===null||x===void 0||x.call(e,p,m,v);var w=kYe(p,r);(g=e.onSelect)===null||g===void 0||g.call(e,w,p,m,v)},d={range_start:[],range_end:[],range_middle:[],disabled:[]};if(i?(d.range_start=[i],o?(d.range_end=[o],qo(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:d5(i,l-1),before:no(i,l-1)}),i&&o&&d.disabled.push({after:i,before:no(i,l-1)}),!i&&o&&d.disabled.push({after:d5(o,l-1),before:no(o,l-1)})),c){if(i&&!o&&(d.disabled.push({before:no(i,-c+1)}),d.disabled.push({after:no(i,c-1)})),i&&o){var h=Wd(o,i)+1,f=c-h;d.disabled.push({before:d5(i,f)}),d.disabled.push({after:no(o,f)})}!i&&o&&(d.disabled.push({before:no(o,-c+1)}),d.disabled.push({after:no(o,c-1)}))}return a.jsx(o7.Provider,{value:{selected:r,onDayClick:u,modifiers:d},children:n})}function l7(){var t=b.useContext(o7);if(!t)throw new Error("useSelectRange must be used within a SelectRangeProvider");return t}function VM(t){return Array.isArray(t)?gye([],t):t!==void 0?[t]:[]}function TYe(t){var e={};return Object.entries(t).forEach(function(n){var r=n[0],s=n[1];e[r]=VM(s)}),e}var Fu;(function(t){t.Outside="outside",t.Disabled="disabled",t.Selected="selected",t.Hidden="hidden",t.Today="today",t.RangeStart="range_start",t.RangeEnd="range_end",t.RangeMiddle="range_middle"})(Fu||(Fu={}));var PYe=Fu.Selected,Th=Fu.Disabled,MYe=Fu.Hidden,RYe=Fu.Today,f5=Fu.RangeEnd,p5=Fu.RangeMiddle,m5=Fu.RangeStart,OYe=Fu.Outside;function IYe(t,e,n){var r,s=(r={},r[PYe]=VM(t.selected),r[Th]=VM(t.disabled),r[MYe]=VM(t.hidden),r[RYe]=[t.today],r[f5]=[],r[p5]=[],r[m5]=[],r[OYe]=[],r);return t.fromDate&&s[Th].push({before:t.fromDate}),t.toDate&&s[Th].push({after:t.toDate}),x2(t)?s[Th]=s[Th].concat(e.modifiers[Th]):y2(t)&&(s[Th]=s[Th].concat(n.modifiers[Th]),s[m5]=n.modifiers[m5],s[p5]=n.modifiers[p5],s[f5]=n.modifiers[f5]),s}var wye=b.createContext(void 0);function DYe(t){var e=hr(),n=a7(),r=l7(),s=IYe(e,n,r),i=TYe(e.modifiers),o=Lt(Lt({},s),i);return a.jsx(wye.Provider,{value:o,children:t.children})}function _ye(){var t=b.useContext(wye);if(!t)throw new Error("useModifiers must be used within a ModifiersProvider");return t}function LYe(t){return!!(t&&typeof t=="object"&&"before"in t&&"after"in t)}function FYe(t){return!!(t&&typeof t=="object"&&"from"in t)}function $Ye(t){return!!(t&&typeof t=="object"&&"after"in t)}function zYe(t){return!!(t&&typeof t=="object"&&"before"in t)}function BYe(t){return!!(t&&typeof t=="object"&&"dayOfWeek"in t)}function UYe(t,e){var n,r=e.from,s=e.to;if(r&&s){var i=Wd(s,r)<0;i&&(n=[s,r],r=n[0],s=n[1]);var o=Wd(t,r)>=0&&Wd(s,t)>=0;return o}return s?qo(s,t):r?qo(r,t):!1}function qYe(t){return W9(t)}function VYe(t){return Array.isArray(t)&&t.every(W9)}function HYe(t,e){return e.some(function(n){if(typeof n=="boolean")return n;if(qYe(n))return qo(t,n);if(VYe(n))return n.includes(t);if(FYe(n))return UYe(t,n);if(BYe(n))return n.dayOfWeek.includes(t.getDay());if(LYe(n)){var r=Wd(n.before,t),s=Wd(n.after,t),i=r>0,o=s<0,l=T8(n.before,n.after);return l?o&&i:i||o}return $Ye(n)?Wd(t,n.after)>0:zYe(n)?Wd(n.before,t)>0:typeof n=="function"?n(t):!1})}function c7(t,e,n){var r=Object.keys(e).reduce(function(i,o){var l=e[o];return HYe(t,l)&&i.push(o),i},[]),s={};return r.forEach(function(i){return s[i]=!0}),n&&!Y9(t,n)&&(s.outside=!0),s}function WYe(t,e){for(var n=Go(t[0]),r=K9(t[t.length-1]),s,i,o=n;o<=r;){var l=c7(o,e),c=!l.disabled&&!l.hidden;if(!c){o=no(o,1);continue}if(l.selected)return o;l.today&&!i&&(i=o),s||(s=o),o=no(o,1)}return i||s}var KYe=365;function jye(t,e){var n=e.moveBy,r=e.direction,s=e.context,i=e.modifiers,o=e.retry,l=o===void 0?{count:0,lastFocused:t}:o,c=s.weekStartsOn,u=s.fromDate,d=s.toDate,h=s.locale,f={day:no,week:E8,month:Lu,year:Uxe,startOfWeek:function(x){return s.ISOWeek?i0(x):oh(x,{locale:h,weekStartsOn:c})},endOfWeek:function(x){return s.ISOWeek?Vxe(x):G9(x,{locale:h,weekStartsOn:c})}},p=f[n](t,r==="after"?1:-1);r==="before"&&u?p=H7e([u,p]):r==="after"&&d&&(p=W7e([d,p]));var m=!0;if(i){var v=c7(p,i);m=!v.disabled&&!v.hidden}return m?p:l.count>KYe?l.lastFocused:jye(p,{moveBy:n,direction:r,context:s,modifiers:i,retry:Lt(Lt({},l),{count:l.count+1})})}var Sye=b.createContext(void 0);function GYe(t){var e=b2(),n=_ye(),r=b.useState(),s=r[0],i=r[1],o=b.useState(),l=o[0],c=o[1],u=WYe(e.dis
881playMonths,n),d=s??(l&&e.isDateDisplayed(l))?l:u,h=function(){c(s),i(void 0)},f=function(x){i(x)},p=hr(),m=function(x,g){if(s){var w=jye(s,{moveBy:x,direction:g,context:p,modifiers:n});qo(s,w)||(e.goToDate(w,s),f(w))}},v={focusedDay:s,focusTarget:d,blur:h,focus:f,focusDayAfter:function(){return m("day","after")},focusDayBefore:function(){return m("day","before")},focusWeekAfter:function(){return m("week","after")},focusWeekBefore:function(){return m("week","before")},focusMonthBefore:function(){return m("month","before")},focusMonthAfter:function(){return m("month","after")},focusYearBefore:function(){return m("year","before")},focusYearAfter:function(){return m("year","after")},focusStartOfWeek:function(){return m("startOfWeek","before")},focusEndOfWeek:function(){return m("endOfWeek","after")}};return a.jsx(Sye.Provider,{value:v,children:t.children})}function u7(){var t=b.useContext(Sye);if(!t)throw new Error("useFocusContext must be used within a FocusProvider");return t}function YYe(t,e){var n=_ye(),r=c7(t,n,e);return r}var d7=b.createContext(void 0);function XYe(t){if(!$3(t.initialProps)){var e={selected:void 0};return a.jsx(d7.Provider,{value:e,children:t.children})}return a.jsx(JYe,{initialProps:t.initialProps,children:t.children})}function JYe(t){var e=t.initialProps,n=t.children,r=function(i,o,l){var c,u,d;if((c=e.onDayClick)===null||c===void 0||c.call(e,i,o,l),o.selected&&!e.required){(u=e.onSelect)===null||u===void 0||u.call(e,void 0,i,o,l);return}(d=e.onSelect)===null||d===void 0||d.call(e,i,i,o,l)},s={selected:e.selected,onDayClick:r};return a.jsx(d7.Provider,{value:s,children:n})}function Nye(){var t=b.useContext(d7);if(!t)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return t}function QYe(t,e){var n=hr(),r=Nye(),s=a7(),i=l7(),o=u7(),l=o.focusDayAfter,c=o.focusDayBefore,u=o.focusWeekAfter,d=o.focusWeekBefore,h=o.blur,f=o.focus,p=o.focusMonthBefore,m=o.focusMonthAfter,v=o.focusYearBefore,x=o.focusYearAfter,g=o.focusStartOfWeek,w=o.focusEndOfWeek,_=function(O){var z,B,G,U;$3(n)?(z=r.onDayClick)===null||z===void 0||z.call(r,t,e,O):x2(n)?(B=s.onDayClick)===null||B===void 0||B.call(s,t,e,O):y2(n)?(G=i.onDayClick)===null||G===void 0||G.call(i,t,e,O):(U=n.onDayClick)===null||U===void 0||U.call(n,t,e,O)},j=function(O){var z;f(t),(z=n.onDayFocus)===null||z===void 0||z.call(n,t,e,O)},N=function(O){var z;h(),(z=n.onDayBlur)===null||z===void 0||z.call(n,t,e,O)},S=function(O){var z;(z=n.onDayMouseEnter)===null||z===void 0||z.call(n,t,e,O)},C=function(O){var z;(z=n.onDayMouseLeave)===null||z===void 0||z.call(n,t,e,O)},k=function(O){var z;(z=n.onDayPointerEnter)===null||z===void 0||z.call(n,t,e,O)},E=function(O){var z;(z=n.onDayPointerLeave)===null||z===void 0||z.call(n,t,e,O)},P=function(O){var z;(z=n.onDayTouchCancel)===null||z===void 0||z.call(n,t,e,O)},T=function(O){var z;(z=n.onDayTouchEnd)===null||z===void 0||z.call(n,t,e,O)},M=function(O){var z;(z=n.onDayTouchMove)===null||z===void 0||z.call(n,t,e,O)},R=function(O){var z;(z=n.onDayTouchStart)===null||z===void 0||z.call(n,t,e,O)},A=function(O){var z;(z=n.onDayKeyUp)===null||z===void 0||z.call(n,t,e,O)},I=function(O){var z;switch(O.key){case"ArrowLeft":O.preventDefault(),O.stopPropagation(),n.dir==="rtl"?l():c();break;case"ArrowRight":O.preventDefault(),O.stopPropagation(),n.dir==="rtl"?c():l();break;case"ArrowDown":O.preventDefault(),O.stopPropagation(),u();break;case"ArrowUp":O.preventDefault(),O.stopPropagation(),d();break;case"PageUp":O.preventDefault(),O.stopPropagation(),O.shiftKey?v():p();break;case"PageDown":O.preventDefault(),O.stopPropagation(),O.shiftKey?x():m();break;case"Home":O.preventDefault(),O.stopPropagation(),g();break;case"End":O.preventDefault(),O.stopPropagation(),w();break}(z=n.onDayKeyDown)===null||z===void 0||z.call(n,t,e,O)},D={onClick:_,onFocus:j,onBlur:N,onKeyDown:I,onKeyUp:A,onMouseEnter:S,onMouseLeave:C,onPointerEnter:k,onPointerLeave:E,onTouchCancel:P,onTouchEnd:T,onTouchMove:M,onTouchStart:R};return D}function ZYe(){var t=hr(),e=Nye(),n=a7(),r=l7(),s=$3(t)?e.selected:x2(t)?n.selected:y2(t)?r.selected:void 0;return s}function eXe(t){return Object.values(Fu).includes(t)}function tXe(t,e){var n=[t.classNames.day];return Object.keys(e).forEach(function(r){var s=t.modifiersClassNames[r];if(s)n.push(s);else if(eXe(r)){var i=t.classNames["day_".concat(r)];i&&n.push(i)}}),n}function nXe(t,e){var n=Lt({},t.styles.day);return Object.keys(e).forEach(function(r){var s;n=Lt(Lt({},n),(s=t.modifiersStyles)===null||s===void 0?void 0:s[r])}),n}function rXe(t,e,n){var r,s,i,o=hr(),l=u7(),c=YYe(t,e),u=QYe(t,c),d=ZYe(),h=!!(o.onDayCl
881ick||o.mode!=="default");b.useEffect(function(){var S;c.outside||l.focusedDay&&h&&qo(l.focusedDay,t)&&((S=n.current)===null||S===void 0||S.focus())},[l.focusedDay,t,n,h,c.outside]);var f=tXe(o,c).join(" "),p=nXe(o,c),m=!!(c.outside&&!o.showOutsideDays||c.hidden),v=(i=(s=o.components)===null||s===void 0?void 0:s.DayContent)!==null&&i!==void 0?i:SYe,x=a.jsx(v,{date:t,displayMonth:e,activeModifiers:c}),g={style:p,className:f,children:x,role:"gridcell"},w=l.focusTarget&&qo(l.focusTarget,t)&&!c.outside,_=l.focusedDay&&qo(l.focusedDay,t),j=Lt(Lt(Lt({},g),(r={disabled:c.disabled,role:"gridcell"},r["aria-selected"]=c.selected,r.tabIndex=_||w?0:-1,r)),u),N={isButton:h,isHidden:m,activeModifiers:c,selectedDays:d,buttonProps:j,divProps:g};return N}function sXe(t){var e=b.useRef(null),n=rXe(t.date,t.displayMonth,e);return n.isHidden?a.jsx("div",{role:"gridcell"}):n.isButton?a.jsx(ZO,Lt({name:"day",ref:e},n.buttonProps)):a.jsx("div",Lt({},n.divProps))}function iXe(t){var e=t.number,n=t.dates,r=hr(),s=r.onWeekNumberClick,i=r.styles,o=r.classNames,l=r.locale,c=r.labels.labelWeekNumber,u=r.formatters.formatWeekNumber,d=u(Number(e),{locale:l});if(!s)return a.jsx("span",{className:o.weeknumber,style:i.weeknumber,children:d});var h=c(Number(e),{locale:l}),f=function(p){s(e,n,p)};return a.jsx(ZO,{name:"week-number","aria-label":h,className:o.weeknumber,style:i.weeknumber,onClick:f,children:d})}function aXe(t){var e,n,r=hr(),s=r.styles,i=r.classNames,o=r.showWeekNumber,l=r.components,c=(e=l==null?void 0:l.Day)!==null&&e!==void 0?e:sXe,u=(n=l==null?void 0:l.WeekNumber)!==null&&n!==void 0?n:iXe,d;return o&&(d=a.jsx("td",{className:i.cell,style:s.cell,children:a.jsx(u,{number:t.weekNumber,dates:t.dates})})),a.jsxs("tr",{className:i.row,style:s.row,children:[d,t.dates.map(function(h){return a.jsx("td",{className:i.cell,style:s.cell,role:"presentation",children:a.jsx(c,{displayMonth:t.displayMonth,date:h})},VKe(h))})]})}function Yee(t,e,n){for(var r=n!=null&&n.ISOWeek?Vxe(e):G9(e,n),s=n!=null&&n.ISOWeek?i0(t):oh(t,n),i=Wd(r,s),o=[],l=0;l<=i;l++)o.push(no(s,l));var c=o.reduce(function(u,d){var h=n!=null&&n.ISOWeek?Kxe(d):Yxe(d,n),f=u.find(function(p){return p.weekNumber===h});return f?(f.dates.push(d),u):(u.push({weekNumber:h,dates:[d]}),u)},[]);return c}function oXe(t,e){var n=Yee(Go(t),K9(t),e);if(e!=null&&e.useFixedWeeks){var r=WKe(t,e);if(r<6){var s=n[n.length-1],i=s.dates[s.dates.length-1],o=E8(i,6-r),l=Yee(E8(i,1),o,e);n.push.apply(n,l)}}return n}function lXe(t){var e,n,r,s=hr(),i=s.locale,o=s.classNames,l=s.styles,c=s.hideHead,u=s.fixedWeeks,d=s.components,h=s.weekStartsOn,f=s.firstWeekContainsDate,p=s.ISOWeek,m=oXe(t.displayMonth,{useFixedWeeks:!!u,ISOWeek:p,locale:i,weekStartsOn:h,firstWeekContainsDate:f}),v=(e=d==null?void 0:d.Head)!==null&&e!==void 0?e:jYe,x=(n=d==null?void 0:d.Row)!==null&&n!==void 0?n:aXe,g=(r=d==null?void 0:d.Footer)!==null&&r!==void 0?r:bYe;return a.jsxs("table",{id:t.id,className:o.table,style:l.table,role:"grid","aria-labelledby":t["aria-labelledby"],children:[!c&&a.jsx(v,{}),a.jsx("tbody",{className:o.tbody,style:l.tbody,children:m.map(function(w){return a.jsx(x,{displayMonth:t.displayMonth,dates:w.dates,weekNumber:w.weekNumber},w.weekNumber)})}),a.jsx(g,{displayMonth:t.displayMonth})]})}function cXe(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var uXe=cXe()?b.useLayoutEffect:b.useEffect,g5=!1,dXe=0;function Xee(){return"react-day-picker-".concat(++dXe)}function hXe(t){var e,n=t??(g5?Xee():null),r=b.useState(n),s=r[0],i=r[1];return uXe(function(){s===null&&i(Xee())},[]),b.useEffect(function(){g5===!1&&(g5=!0)},[]),(e=t??s)!==null&&e!==void 0?e:void 0}function fXe(t){var e,n,r=hr(),s=r.dir,i=r.classNames,o=r.styles,l=r.components,c=b2().displayMonths,u=hXe(r.id?"".concat(r.id,"-").concat(t.displayIndex):void 0),d=r.id?"".concat(r.id,"-grid-").concat(t.displayIndex):void 0,h=[i.month],f=o.month,p=t.displayIndex===0,m=t.displayIndex===c.length-1,v=!p&&!m;s==="rtl"&&(e=[p,m],m=e[0],p=e[1]),p&&(h.push(i.caption_start),f=Lt(Lt({},f),o.caption_start)),m&&(h.push(i.caption_end),f=Lt(Lt({},f),o.caption_end)),v&&(h.push(i.caption_between),f=Lt(Lt({},f),o.caption_between));var x=(n=l==null?void 0:l.Caption)!==null&&n!==void 0?n:yYe;return a.jsxs("div",{className:h.join(" "),style:f,children:[a.jsx(x,{id:u,displayMonth:t.displayMonth,displayIndex:t.displayIndex}),a.jsx(lXe,{id:d,"aria-labelledby":u,displayMonth:t.displayMonth})]},t.displayIndex)}function pXe(t){var e=hr(),n=e.classNames,r=e.styles;return a.jsx("div",{className:n.months,style:r.months,children:t.children})}function mXe(t){var e,n,r=t.initialProps,s=hr(),i=u7(),o=b2(),l=b.useState(!1),c=l[0],u=l[1];b.useEffect(function(){s.initialFocus&&i.focusTarget&&(c||(i.focus(i.focusTarget),u(!0)))},[s.initialFocus,c,i.focus,i.focusTarget,i]);var d=[s.classNames.root,s.className];s.numberOfMonths>1&&d.push(s.classNames.multiple_months),s.showWeekNumber&&d.push(s.classNames.with_weeknumber);var h=Lt(Lt({},s.styles.root),s.style),f=Object.keys(r).filter(function(m){return m.startsWith("data-")}).reduce(function(m,v){var x;return Lt(Lt({},m),(x={},x[v]=r[v],x))},{}),p=(n=(e=r.components)===null||e===void 0?void 0:e.Months)!==null&&n!==void 0?n:pXe;return a.jsx("div",Lt({className:d.join(" "),style:h,dir:s.dir,id:s.id,nonce:r.nonce,title:r.title,lang:r.lang},f,{children:a.jsx(p,{children:o.displayMonths.map(function(m,v){return a.jsx(fXe,{displayIndex:v,displayMonth:m},v)})})}))}function gXe(t){var e=t.children,n=zGe(t,["children"]);return a.jsx(iYe,{initialProps:n,children:a.jsx(mYe,{children:a.jsx(XYe,{initialProps:n,children:a.jsx(NYe,{initialProps:n,children:a.jsx(AYe,{initialProps:n,children:a.jsx(DYe,{children:a.jsx(GYe,{children:e})})})})})})})}function vXe(t){return a.jsx(gXe,Lt({},t,{children:a.jsx(mXe,{initialProps:t})}))}function h7({className:t,classNames:e,showOutsideDays:n=!0,...r}){return a.jsx(vXe,{showOutsideDays:n,className:Fe("p-3",t),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:sp
881ace-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:Fe(mk({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:Fe(mk({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",...e},components:{IconLeft:({...s})=>a.jsx(V6,{className:"h-4 w-4"}),IconRight:({...s})=>a.jsx(PO,{className:"h-4 w-4"})},...r})}h7.displayName="Calendar";var z3="Popover",[Cye,DLt]=Ys(z3,[ev]),w2=ev(),[xXe,iv]=Cye(z3),kye=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:o=!1}=t,l=w2(e),c=b.useRef(null),[u,d]=b.useState(!1),[h,f]=Xo({prop:r,defaultProp:s??!1,onChange:i,caller:z3});return a.jsx(HW,{...l,children:a.jsx(xXe,{scope:e,contentId:Ml(),triggerRef:c,open:h,onOpenChange:f,onOpenToggle:b.useCallback(()=>f(p=>!p),[f]),hasCustomAnchor:u,onCustomAnchorAdd:b.useCallback(()=>d(!0),[]),onCustomAnchorRemove:b.useCallback(()=>d(!1),[]),modal:o,children:n})})};kye.displayName=z3;var Aye="PopoverAnchor",yXe=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=iv(Aye,n),i=w2(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:l}=s;return b.useEffect(()=>(o(),()=>l()),[o,l]),a.jsx(s2,{...i,...r,ref:e})});yXe.displayName=Aye;var Eye="PopoverTrigger",Tye=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=iv(Eye,n),i=w2(n),o=$t(e,s.triggerRef),l=a.jsx(et.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Iye(s.open),...r,ref:o,onClick:ze(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?l:a.jsx(s2,{asChild:!0,...i,children:l})});Tye.displayName=Eye;var f7="PopoverPortal",[bXe,wXe]=Cye(f7,{forceMount:void 0}),Pye=t=>{const{__scopePopover:e,forceMount:n,children:r,container:s}=t,i=iv(f7,e);return a.jsx(bXe,{scope:e,forceMount:n,children:a.jsx(yo,{present:n||i.open,children:a.jsx(kj,{asChild:!0,container:s,children:r})})})};Pye.displayName=f7;var H_="PopoverContent",Mye=b.forwardRef((t,e)=>{const n=wXe(H_,t.__scopePopover),{forceMount:r=n.forceMount,...s}=t,i=iv(H_,t.__scopePopover);return a.jsx(yo,{present:r||i.open,children:i.modal?a.jsx(jXe,{...s,ref:e}):a.jsx(SXe,{...s,ref:e})})});Mye.displayName=H_;var _Xe=Og("PopoverContent.RemoveScroll"),jXe=b.forwardRef((t,e)=>{const n=iv(H_,t.__scopePopover),r=b.useRef(null),s=$t(e,r),i=b.useRef(!1);return b.useEffect(()=>{const o=r.current;if(o)return f3(o)},[]),a.jsx(a2,{as:_Xe,allowPinchZoom:!0,children:a.jsx(Rye,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ze(t.onCloseAutoFocus,o=>{var l;o.preventDefault(),i.current||(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:ze(t.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:ze(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),SXe=b.forwardRef((t,e)=>{const n=iv(H_,t.__scopePopover),r=b.useRef(!1),s=b.useRef(!1);return a.jsx(Rye,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,l;(o=t.onCloseAutoFocus)==null||o.call(t,i),i.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{var c,u;(c=t.onInteractOutside)==null||c.call(t,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=i.target;((u=n.triggerRef.current)==null?void 0:u.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),Rye=b.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:o,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onInteractOutside:d,...h}=t,f=iv(H_,n),p=w2(n);return d3(),a.jsx(i2,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:a.jsx(T0,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:d,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onDismiss:()=>f.onOpenChange(!1),children:a.jsx(o3,{"data-state":Iye(f.open),role:"dialog",id:f.contentId,...p,...h,ref:e,style:{...h.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Oye="PopoverClose",NXe=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=iv(Oye,n);return a.jsx(et.button,{type:"button",...r,ref:e,onClick:ze(t.onClick,()=>s.onOpenChange(!1))})});NXe.displayName=Oye;var CXe="PopoverArrow",kXe=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=w2(n);return a.jsx(l3,{...s,...r,ref:e})});kXe.displayName=CXe;function Iye(t){return t?"open":"closed"}var AXe=kye,EXe=Tye,TXe=Pye,Dye=Mye;const p7=AXe,m7=EXe,B3=b.forwardRef(({className:t,align:e="center",sideOffset:n=4,...r},s)=>
881a.jsx(TXe,{children:a.jsx(Dye,{ref:s,align:e,sideOffset:n,className:Fe("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",t),...r})}));B3.displayName=Dye.displayName;const PXe=()=>{const{slug:t}=Xi(),{addItem:e}=tv(),n=St(),{lang:r}=Uu(),s=r==="en",i=b.useRef(!1),[o,l]=b.useState(1),[c,u]=b.useState(0),[d,h]=b.useState(""),[f,p]=b.useState(),[m,v]=b.useState(""),{data:x,isLoading:g}=Ne({queryKey:["product",t],queryFn:async()=>{const{data:U,error:F}=await Z.from("products").select("*, product_categories(name, slug)").eq("slug",t).eq("is_active",!0).single();if(F)throw F;return U}}),w=s&&!!(x!=null&&x.id)&&!(x!=null&&x.name_en);b.useEffect(()=>{!w||i.current||(i.current=!0,(async()=>{try{await Z.functions.invoke("translate-to-english",{body:{type:"product",id:x.id}}),n.invalidateQueries({queryKey:["product",t]})}catch(U){console.warn("[i18n] traduction du produit échouée",U)}})())},[w,x==null?void 0:x.id,t,n]);const{data:_}=Ne({queryKey:["product_variants",x==null?void 0:x.id],enabled:!!x,queryFn:async()=>{const{data:U,error:F}=await Z.from("product_variants").select("*").eq("product_id",x.id).eq("is_active",!0).order("sort_order");if(F)throw F;return U}}),{data:j}=Ne({queryKey:["experience_slots",x==null?void 0:x.id,f==null?void 0:f.toISOString()],enabled:(x==null?void 0:x.product_type)==="experience"&&!!f,queryFn:async()=>{const U=lh(f,"yyyy-MM-dd"),{data:F,error:W}=await Z.from("experience_slots").select("*").eq("product_id",x.id).eq("date",U).eq("is_active",!0);if(W)throw W;return(F==null?void 0:F.filter(Q=>Q.booked_count<Q.max_participants))??[]}}),{data:N}=Ne({queryKey:["shipping_rates"],queryFn:async()=>{const{data:U,error:F}=await Z.from("shipping_rates").select("*");if(F)throw F;return U}}),{data:S}=Ne({queryKey:["related_products",x==null?void 0:x.category_id,x==null?void 0:x.id],enabled:!!x,queryFn:async()=>{const{data:U,error:F}=await Z.from("products").select("*, product_categories(name)").eq("is_active",!0).eq("category_id",x.category_id).neq("id",x.id).limit(4);if(F)throw F;return U}}),C=U=>s&&U.name_en||U.name;if(g)return a.jsx("div",{className:"container py-10",children:a.jsxs("div",{className:"grid gap-10 lg:grid-cols-5",children:[a.jsx(Xt,{className:"aspect-square w-full rounded-xl lg:col-span-3"}),a.jsxs("div",{className:"space-y-4 lg:col-span-2",children:[a.jsx(Xt,{className:"h-8 w-3/4"}),a.jsx(Xt,{className:"h-10 w-1/3"}),a.jsx(Xt,{className:"h-20 w-full"})]})]})});if(!x)return a.jsxs("div",{className:"container py-20 text-center",children:[a.jsx("p",{className:"text-muted-foreground",children:"Produit introuvable."}),a.jsx(H,{asChild:!0,className:"mt-4",children:a.jsx(_e,{to:"/boutique",children:"Retour à la boutique"})})]});const k=s&&x.name_en||x.name,E=s&&x.description_en||x.description,P=s&&x.short_description_en||x.short_description,T=s?x.seo_title_en||x.name_en||x.seo_title||x.name:x.seo_title||x.name,M=s?x.seo_description_en||x.short_description_en||x.seo_description||x.short_description||x.name:x.seo_description||x.short_description||x.name,R=x.images??[],A=x.promo_price??x.price,I=_==null?void 0:_.find(U=>U.id===d),D=I?I.stock:x.stock,O=x.carte_privilege_discount_percent>0?A*(1-x.carte_privilege_discount_percent/100):null,z=U=>U.toFixed(2).replace(".",",")+" â¬",B={spain:"Espagne",france:"France",europe:"Europe"},G=()=>{const U=I||(_==null?void 0:_[0]);e({product_id:x.id,variant_id:(U==null?void 0:U.id)||x.id,stripe_price_id:(U==null?void 0:U.stripe_price_id)||"",name:k,variant_name:(U==null?void 0:U.name)||"",format:(U==null?void 0:U.format)||x.product_type||"papier",image:R[0]??"",price:(U==null?void 0:U.price_override)??A,quantity:o,product_type:x.product_type,carte_privilege_discount_percent:x.carte_privilege_discount_percent??0,tax_rate:x.tax_rate_percent??21,numero:U==null?void 0:U.numero}),ee.success("Ajouté au panier",{description:k})};return a.jsxs("div",{className:"container py-8 md:py-14",children:[a.jsx(Fn,{title:T,description:M,path:`/boutique/${x.slug}`,image:R[0],type:"product",jsonLd:{"@context":"https://schema.org","@type":"Product",name:k,description:P||M,image:R[0]||void 0,sku:x.id,mpn:x.id,brand:{"@type":"Brand",name:"Esprit Sud Magazine"},offers:{"@type":"Offer",price:A,priceCurrency:"EUR",availability:D>0?"https://schema.org/InStock":"https://schema.org/OutOfStock",url:`https://www.espritsud.es/boutique/${x.slug}`,seller:{"@type":"Organization",name:"Esprit Sud Magazine"}}}}),a.jsx(H,{variant:"ghost",size:"sm",asChild:!0,className:"mb-6",children:a.jsxs(_e,{to:"/boutique",children:[a.jsx(jr,{className:"mr-2 h-4 w-4"})," Boutique"]})}),a.jsxs("div",{className:"grid gap-8 lg:grid-cols-5 lg:gap-12",children:[a.jsxs("div",{className:"space-y-3 lg:col-span-3",children:[a.jsx("div",{className:"overflow-hidden rounded-xl bg-muted",children:R[c]?a.jsx("img",{src:R[c],alt:k,className:"aspect-square w-full object-contain p-2"}):a.jsx("div",{className:"flex aspect-square items-center justify-center",children:a.jsx($f,{className:"h-16 w-16 text-muted-foreground"})})}),R.length>
8811&&a.jsx("div",{className:"grid grid-cols-5 gap-2",children:R.map((U,F)=>a.jsx("button",{onClick:()=>u(F),className:Fe("aspect-square overflow-hidden rounded-lg border-2 bg-muted",F===c?"border-primary":"border-transparent"),children:a.jsx("img",{src:U,alt:"",className:"h-full w-full object-contain p-1",loading:"lazy"})},F))})]}),a.jsxs("div",{className:"lg:col-span-2",children:[x.product_categories&&a.jsx(ke,{variant:"secondary",className:"mb-3",children:x.product_categories.name}),a.jsx("h1",{className:"font-heading text-2xl font-bold md:text-3xl",children:k}),a.jsx("div",{className:"mt-4 flex items-baseline gap-3",children:x.promo_price!=null?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"font-heading text-3xl font-bold text-accent",children:z(x.promo_price)}),a.jsx("span",{className:"text-lg text-muted-foreground line-through",children:z(x.price)})]}):a.jsx("span",{className:"font-heading text-3xl font-bold text-primary",children:z(x.price)})}),O!==null&&a.jsxs("div",{className:"mt-3 rounded-lg border border-amber-300 bg-amber-50 p-3",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-amber-800",children:[a.jsx(Jo,{className:"h-4 w-4"}),"Avec la Carte Privilège : ",z(O)," au lieu de ",z(A)]}),a.jsx(_e,{to:"/carte-privilege",className:"mt-1 block text-xs text-amber-600 underline",children:"Découvrir la Carte Privilège"})]}),P&&a.jsx("p",{className:"mt-4 text-muted-foreground",children:P}),E&&a.jsx(s7,{type:"single",collapsible:!0,className:"mt-2",children:a.jsxs(D3,{value:"desc",children:[a.jsx(L3,{className:"text-sm",children:"Voir la description complète"}),a.jsx(F3,{className:"text-sm text-muted-foreground whitespace-pre-line",children:E})]})}),a.jsx("hr",{className:"my-5"}),_&&_.length>1&&a.jsxs("div",{className:"mb-4",children:[a.jsx("label",{className:"mb-2 block text-sm font-medium",children:"Variante"}),a.jsxs(lt,{value:d,onValueChange:h,children:[a.jsx(nt,{children:a.jsx(ct,{placeholder:"Choisir..."})}),a.jsx(rt,{children:_.map(U=>a.jsxs(Ae,{value:U.id,children:[U.name," ",U.price_override?`â ${z(U.price_override)}`:""," (",U.stock," en stock)"]},U.id))})]})]}),x.product_type==="experience"&&a.jsxs("div",{className:"mb-4 space-y-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"mb-2 block text-sm font-medium",children:"Date"}),a.jsxs(p7,{children:[a.jsx(m7,{asChild:!0,children:a.jsxs(H,{variant:"outline",className:Fe("w-full justify-start",!f&&"text-muted-foreground"),children:[a.jsx(Aj,{className:"mr-2 h-4 w-4"}),f?lh(f,"PPP",{locale:Qxe}):"Choisir une date"]})}),a.jsx(B3,{className:"w-auto p-0",align:"start",children:a.jsx(h7,{mode:"single",selected:f,onSelect:p,disabled:U=>U<new Date,className:"p-3 pointer-events-auto"})})]})]}),f&&j&&a.jsxs("div",{children:[a.jsx("label",{className:"mb-2 block text-sm font-medium",children:"Créneau"}),j.length>0?a.jsxs(lt,{value:m,onValueChange:v,children:[a.jsx(nt,{children:a.jsx(ct,{placeholder:"Choisir un créneau"})}),a.jsx(rt,{children:j.map(U=>a.jsx(Ae,{value:U.time_slot,children:a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx(t2,{className:"h-3.5 w-3.5"})," ",U.time_slot," â ",U.max_participants-U.booked_count," places"]})},U.id))})]}):a.jsx("p",{className:"text-sm text-muted-foreground",children:"Aucun créneau disponible à cette date."})]})]}),a.jsxs("div",{className:"mb-5",children:[a.jsx("label",{className:"mb-2 block text-sm font-medium",children:"Quantité"}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(H,{variant:"outline",size:"icon",onClick:()=>l(Math.max(1,o-1)),children:a.jsx(n3,{className:"h-4 w-4"})}),a.jsx("span",{className:"w-8 text-center font-medium",children:o}),a.jsx(H,{variant:"outline",size:"icon",onClick:()=>l(Math.min(D??999,o+1)),children:a.jsx(dr,{className:"h-4 w-4"})}),D!=null&&a.jsxs("span",{className:"text-xs text-muted-foreground",children:[D," en stock"]})]})]}),a.jsxs(H,{size:"lg",className:"w-full rounded-xl bg-accent text-accent-foreground hover:bg-accent/90",onClick:G,children:[a.jsx($f,{className:"mr-2 h-5 w-5"}
881),x.product_type==="experience"?"Réserver":"Ajouter au panier"]}),x.product_type==="digital"&&a.jsxs("div",{className:"mt-3 flex items-center gap-2 text-sm text-muted-foreground",children:[a.jsx(Ts,{className:"h-4 w-4"})," Téléchargement immédiat après achat"]}),x.product_type!=="digital"&&N&&N.length>0&&a.jsxs("div",{className:"mt-6 rounded-lg border border-border p-4",children:[a.jsxs("div",{className:"mb-3 flex items-center gap-2 text-sm font-medium",children:[a.jsx(Pw,{className:"h-4 w-4"})," Livraison"]}),a.jsx("div",{className:"space-y-2 text-sm",children:N.map(U=>a.jsxs("div",{className:"flex justify-between text-muted-foreground",children:[a.jsx("span",{children:B[U.zone]??U.zone}),a.jsxs("span",{children:[z(U.shipping_cost)," · ",U.estimated_days_min,"-",U.estimated_days_max," jours"]})]},U.id))})]})]})]}),S&&S.length>0&&a.jsxs("section",{className:"mt-16",children:[a.jsx("h2",{className:"mb-6 font-heading text-xl font-bold",children:"Vous pourriez aussi aimer"}),a.jsx("div",{className:"grid gap-6 grid-cols-2 lg:grid-cols-4",children:S.map(U=>{var F;return a.jsxs(_e,{to:`/boutique/${U.slug}`,className:"group block overflow-hidden rounded-lg border border-border bg-card transition-shadow hover:shadow-lg",children:[a.jsx("div",{className:"aspect-[4/3] overflow-hidden bg-muted",children:(F=U.images)!=null&&F[0]?a.jsx("img",{src:U.images[0],alt:C(U),loading:"lazy",className:"h-full w-full object-contain p-2 transition-transform duration-300 group-hover:scale-105"}):a.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:a.jsx($f,{className:"h-6 w-6"})})}),a.jsxs("div",{className:"p-3",children:[a.jsx("h3",{className:"text-sm font-medium line-clamp-2",children:C(U)}),a.jsx("p",{className:"mt-1 font-heading text-base font-bold text-primary",children:z(U.promo_price??U.price)})]})]},U.id)})})]})]})},an=m3,W_=g3,MXe=v3,Lye=b.forwardRef(({className:t,...e},n)=>a.jsx(Mj,{ref:n,className:Fe("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",t),...e}));Lye.displayName=Mj.displayName;const nn=b.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(MXe,{children:[a.jsx(Lye,{}),a.jsxs(Rj,{ref:r,className:Fe("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",t),...n,children:[e,a.jsxs(o2,{className:"absolute right-4 top-4 roun
881ded-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:[a.jsx(ks,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));nn.displayName=Rj.displayName;const on=({className:t,...e})=>a.jsx("div",{className:Fe("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});on.displayName="DialogHeader";const ss=({className:t,...e})=>a.jsx("div",{className:Fe("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});ss.displayName="DialogFooter";const ln=b.forwardRef(({className:t,...e},n)=>a.jsx(Oj,{ref:n,className:Fe("text-lg font-semibold leading-none tracking-tight",t),...e}));ln.displayName=Oj.displayName;const Eu=b.forwardRef(({className:t,...e},n)=>a.jsx(Ij,{ref:n,className:Fe("text-sm text-muted-foreground",t),...e}));Eu.displayName=Ij.displayName;const RXe="https://aanjkhoyzcvhokzsmifu.supabase.co",OXe="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImFhbmpraG95emN2aG9renNtaWZ1Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzU0ODIxMTgsImV4cCI6MjA5MTA1ODExOH0.FZffw1trnRiA182HIsLL4uQALqBG6SHIIttPS-tq-Qo";async function Jee(t={}){var n,r;if(t.refresh){const{data:s,error:i}=await Z.auth.refreshSession();if(!i)return(n=s.session)==null?void 0:n.access_token;console.warn("[EdgeFunction] Failed to refresh session:",i.message)}const{data:e}=await Z.auth.getSession();return(r=e==null?void 0:e.session)==null?void 0:r.access_token}async function g7(t,e,n={}){const r=`${RXe}/functions/v1/${t}`,s=async d=>{console.log(`[EdgeFunction] ${t} â HTTP ${d.status}`);const h=d.headers.get("content-type")||"",f=await d.text();if(!h.includes("application/json"))throw console.error(`[EdgeFunction] ${t} returned non-JSON:`,f),new Error(`Réponse inattendue du serveur (${d.status}). Contactez le support.`);let p;try{p=JSON.parse(f)}catch{throw console.error(`[EdgeFunction] ${t} JSON parse error:`,f),new Error("Réponse invalide du serveur.")}return{data:p,response:d}},i=async d=>{const h={"Content-Type":"application/json",Accept:"application/json",apikey:OXe};d&&(h.Authorization=`Bearer ${d}`),console.log(`[EdgeFunction] Calling ${t}`);const f=await fetch(r,{method:"POST",headers:h,body:JSON.stringify(e)});return s(f)},o=n.requireAuth?await Jee():void 0;if(n.requireAuth&&!o)throw new Error("Votre session a expiré. Reconnectez-vous puis réessayez.");let{data:l,response:c}=await i(o);if(c.status===401&&((l==null?void 0:l.message)==="Invalid JWT"||(l==null?void 0:l.error)==="Invalid JWT")&&n.requireAuth){console.warn(`[EdgeFunction] ${t} invalid JWT, refreshing session and retrying once`);const d=await Jee({refresh:!0});if(!d)throw new Error("Votre session a expiré. Reconnectez-vous puis réessayez.");({data:l,response:c}=await i(d))}if(!c.ok)throw console.error(`[EdgeFunction] ${t} error response:`,l),new Error((l==null?void 0:l.error)||(l==null?void 0:l.message)||`Erreur serveur (${c.status})`);return l}async function IXe(t){const e=await g7("create-checkout",t);if(!e.url)throw new Error(e.error||"URL de paiement non reçue");return e.url}async function DXe(t){const e=await g7("create-carte-subscription",t,{requireAuth:!0});if(!e.url)throw new Error(e.error||"URL de paiement non reçue");return e.url}async function LXe(t){const e=await g7("create-portal-session",t,{requireAuth:!0});if(!e.url)throw new Error(e.error||"URL du portail non reçue");return e.url}const Ju=t=>t.toFixed(2).replace(".",",")+" â¬",FXe=()=>{const{items:t,updateQuantity:e,removeItem:n,clearCart:r,total:s}=tv(),{user:i}=Ji(),o=Gs(),[l]=Zg(),[c,u]=b.useState(""),[d,h]=b.useState(null),[f,p]=b.useState(""),[m,v]=b.useState(!1),[x,g]=b.useState(!1),[w,_]=b.useState(!1),[j,N]=b.useState(""),[S,C]=b.useState(l.get("country")||"ES"),[k,E]=b.useState(l.get("shipping")||""),P=t.some(K=>K.format==="papier"||K.product_type!=="digital"&&K.product_type!=="experience"&&K.format!=="pdf"),T=b.useMemo(()=>Jge(S),[S]),M=T.find(K=>K.id===k),R=P&&M?M.price:0,A=K=>{C(K),E("")},{data:I}=Ne({queryKey:["carte_privilege_active"],queryFn:async()=>{const{data:{user:K}}=await Z.auth.getUser();if(!K)return null;const{data:fe,error:oe}=await Z.from("carte_privilege").select("*").eq("user_id",K.id).eq("status","active").maybeSingle();return oe?null:fe}}),D=async()=>
881{if(c.trim()){v(!0),p("");try{const{data:K,error:fe}=await Z.from("promo_codes").select("*").ilike("code",c.trim()).eq("is_active",!0).maybeSingle();if(fe)throw fe;const oe=new Date;if(!K){p("Code promo invalide ou expiré."),h(null);return}if(K.valid_from&&new Date(K.valid_from)>oe){p("Code promo invalide ou expiré."),h(null);return}if(K.valid_until&&new Date(K.valid_until)<oe){p("Code promo invalide ou expiré."),h(null);return}if(K.max_uses&&(K.current_uses??0)>=K.max_uses){p("Code promo invalide ou expiré."),h(null);return}if(K.min_order_amount&&s<Number(K.min_order_amount)){p(`Montant minimum de ${Number(K.min_order_amount).toFixed(2)} ⬠requis`),h(null);return}h({id:K.id,code:K.code,discount_type:K.discount_type,discount_value:Number(K.discount_value)}),ee.success(`Code promo "${K.code}" appliqué !`)}catch{p("Erreur lors de la vérification.")}finally{v(!1)}}},O=()=>{h(null),u(""),p("")},z=b.useMemo(()=>Qge(t.map(K=>({price:K.price*K.quantity,quantity:1,tax_rate:K.tax_rate||21})),R),[t,R]),B=async K=>{g(!0);try{const fe=t.map(ye=>{var me,he;let le=ye.name+(ye.variant_name?` â ${ye.variant_name}`:"");if((he=(me=ye.metadata)==null?void 0:me.selected_issues)!=null&&he.length){const ae=ye.metadata.selected_issues.map(X=>`N°${X}`).join(", "),re=ye.metadata.free_issues||0,L=ye.metadata.total_issues||ye.metadata.selected_issues.length;le=`Magazines Esprit Sud (${ae}) â ${L} numéros${re>0?` dont ${re} offert${re>1?"s":""}`:""}`}return{product_id:ye.product_id,variant_id:ye.variant_id,metadata:ye.metadata,price_data:{currency:"eur",product_data:{name:le,images:ye.image?[ye.image]:[]},unit_amount:Math.round(ye.price*100)},quantity:ye.quantity}}),oe=await IXe({items:fe,customer_email:K,success_url:window.location.origin+"/boutique/merci",cancel_url:window.location.origin+"/boutique/panier",metadata:{order_source:"boutique",tax_details:JSON.stringify(z.lines),...d?{promo_code:d.code,promo_code_id:d.id}:{}},has_physical:P,shipping_method_id:M==null?void 0:M.id,shipping_country:S,shipping_price:R,shipping_name:M==null?void 0:M.name,shipping_estimate_min:M==null?void 0:M.estimateMin,shipping_estimate_max:M==null?void 0:M.estimateMax});window.open(oe,"_blank")}catch(fe){console.error("Checkout error:",fe),ee.error("Erreur lors du paiement",{description:fe.message||"Veuillez réessayer."})}finally{g(!1)}},G=()=>{if(P&&!k){ee.error("Veuillez choisir un mode de livraison");return}i!=null&&i.email?B(i.email):_(!0)},U=I?t.reduce((K,fe)=>fe.carte_privilege_discount_percent>0?K+fe.price*fe.quantity*(fe.carte_privilege_discount_percent/100):K,0):0;let F=0;d&&(F=d.discount_type==="percent"?s*(d.discount_value/100):Math.min(d.discount_value,s));const Q=s-U-F+R;return t.length===0?a.jsxs("div",{className:"container py-20 text-center",children:[a.jsx(Wi,{className:"mx-auto h-16 w-16 text-muted-foreground"}),a.jsx("h1",{className:"mt-4 font-heading text-2xl font-bold",children:"Votre panier est vide"}),a.jsx("p",{className:"mt-2 text-muted-foreground",children:"Découvrez nos produits et expériences andalouses."}),a.jsx(H,{asChild:!0,className:"mt-6 rounded-xl",children:a.jsx(_e,{to:"/boutique",children:"Découvrir la boutique"})})]}):a.jsxs("div",{className:"container py-8 md:py-14",children:[a.jsx(H,{variant:"ghost",size:"sm",asChild:!0,className:"mb-6",children:a.jsxs(_e,{to:"/boutique",children:[a.jsx(jr,{className:"mr-2 h-4 w-4"})," Continuer mes achats"]})}),a.jsx("h1",{className:"font-heading text-3xl font-bold md:text-4xl",children:"Panier"}),a.jsxs("div",{className:"mt-8 grid gap-8 lg:grid-cols-3",children:[a.jsx("div",{className:"space-y-3 lg:col-span-2",children:t.map(K=>{var oe,ye,le;const fe=!!((ye=(oe=K.metadata)==null?void 0:oe.selected_issues)!=null&&ye.length);return a.jsxs("div",{className:"flex gap-4 rounded-lg border border-border bg-card p-4",children:[a.jsx("div",{className:"h-20 w-20 shrink-0 overflow-hidden rounded-lg bg-muted",children:K.image?a.jsx("img",{src:K.image,alt:K.name,className:"h-full w-full object-cover"}):a.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:a.jsx(Wi,{className:"h-6 w-6"})})}),a.jsxs("div",{className:"flex flex-1 flex-col justify-between gap-2",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-medium",children:K.name}),fe?a.jsxs(a.Fragment,{children:[a.jsxs("p",{className:"text-xs text-muted-foreground",children:[K.metadata.selected_issues.map(me=>`N°${me}`).join(", ")," ","(",K.metadata.total_issues," numéros",(K.metadata.free_issues??0)>0?` dont ${K.metadata.free_issues} offert${(K.metadata.free_issues??0)>1?"s":""}`:"",")"]}),a.jsx(_e,{to:((le=K.metadata)==null?void 0:le.edit_url)||"/boutique/nos-magazines-papier",className:"text-xs text-primary underline mt-1 inline-block",children:"Modifier la sélection"})]}):a.jsxs(a.Fragment,{children:[K.variant_name&&a.jsx("p",{className:"text-xs text-muted-foreground",children:K.variant_name}),K.numero&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Numéro ",K.numero]})]})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[fe?a.jsxs("span",{className:"text-xs text-muted-foreground",children:[K.quantity," à ",Ju(K.price)]}):a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(H,{variant:"outline",size:"icon",className:"h-7 w-7",onClick:()=>e(K.variant_id,K.quantity-1),children:a.jsx(n3,{className:"h-3 w-3"})}),a.jsx("span",{className:"w-6 text-center text-sm font-medium",children:K.quantity}),a.jsx(H,{variant:"outline",size:"icon",className:"h-7 w-7",onClick:()=>e(K.variant_id,K.quantity+1),children:a.jsx(dr,{className:"h-3 w-3"})})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"font-heading font-bold text-primary",children:Ju(K.price*K.quantity)}),a.jsx(H,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",onClick:()=>n(K.variant_id),children:a.jsx(tr,{className:"h-3.5 w-3.5"})})]})]})]})]},K.variant_id)})}),a.jsxs("div",{className:"rounded-xl border border-border bg-card p-6",children:[a.jsx("h2",{className:"font-heading text-lg font-semibold",children:"Récapitulatif"}),a.jsxs("div",{className:"mt-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(qfe,{className:"h-4 w-4 text-muted-foreground"}),a.jsx(ue,{placeholder:"Code promo",className:"h-9",value:c,onChange:K=>u(K.target.value)}),a.jsx(H,{variant:"outline",size:"sm",onClick:D,disabled:m,children:m?"...":"OK"})]}),f&&a.jsx("p",{className:"mt-1 text-xs text-destructive",children:f}),d&&a.jsxs("div",{className:"mt-1 flex items-center justify-between rounded-md bg-green-50 px-2 py-1 text-xs text-green-700",children:[a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(uk,{className:"h-3 w-3"}),"Code ",d.code," appliqué : -",Ju(d.discount_type==="percent"?s*(d.discount_value/100):Math.min(d.discount_value,s))]}),a.jsx("button",{type:"button",onClick:O,className:"ml-2 text-green-700 hover:text-green-900","aria-label":"Retirer le code promo",children:"â"})]})]}),P?a.jsxs("div",{className:"mt-4 space-y-2.5",children:[a.jsxs("label",{className:"flex items-center gap-1.5 text-sm font-medium",children:[a.jsx(_r,{className:"h-4 w-4"})," Livraison"]}),a.jsxs(lt,{value:S,onValueChange:A,children:[a.jsx(nt,{className:"h-9",children:a.jsx(ct,{})}),a.jsx(rt,{children:Xge.map(K=>a.jsx(Ae,{value:K.code,children:K.label},K.code))})]}),a.jsx("div",{className:"space-y-1.5",children:T.map(K=>a.jsxs("button",{onClick:()=>E(K.id),className:`w-full flex items-center gap-2.5 rounded-lg border p-3 text-left transition-colors text-sm ${k===K.id?"border-primary bg-primary/5 ring-1 ring-primary":"border-border hover:border-primary/40"}`,children:[a.jsx(Pw,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"font-medium",children:K.name}),a.jsx("p",{className:"text-xs text-muted-foreground",children:K.days})]}),a.jsx("span",{className:"font-bold whitespace-nowrap",children:Ju(K.price)})]},K.id))}),!k&&a.jsx("p",{className:"text-xs text-amber-600",children:"Sélectionnez un mode de livraison"})]}):a.jsxs("div",{className:"mt-4 flex items-center gap-2 text-xs text-muted-foreground rounded-lg border border-border p-3",children:[a.jsx(Ts,{className:"h-4 w-4 shrink-0"}),a.jsx("span",{children:"Téléchargement immédiat â Pas de frais de livraison"})]}),a.jsx("hr",{className:"my-4"}),a.jsxs("div",{className:"space-y-2 text-sm",children:[a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-muted-foreground",children:"Sous-total HT"}),a.jsx("span",{children:Ju(z.total_ht)})]}),z.lines.map(K=>a.jsxs("div",{className:"flex justify-between text-muted-foreground",children:[a.jsxs("span",{children:["IVA ",K.rate,"%"]}),a.jsx("span",{children:Ju(K.tax_amount)})]},K.rate)),F>0&&a.jsxs("div",{className:"flex justify-between text-green-600",children:[a.jsx("span",{children:"Réduction promo"}),a.jsxs("span",{children:["-",Ju(F)]})]}),U>0&&a.jsxs("div",{className:"flex justify-between text-green-600",children:[a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(Jo,{className:"h-3.5 w-3.5"})," Carte Privilège"]}),a.jsxs("span",{children:["-",Ju(U)]})]}),P&&M&&a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-muted-foreground",children:"Livraison (TTC)"}
881),a.jsx("span",{children:Ju(R)})]})]}),a.jsx("hr",{className:"my-4"}),a.jsxs("div",{className:"flex justify-between font-heading text-lg font-bold",children:[a.jsx("span",{children:"Total TTC"}),a.jsx("span",{className:"text-primary",children:Ju(Q)})]}),a.jsx("p",{className:"text-xs text-muted-foreground italic mt-1",children:"Prix TVA incluse â IVA incluido"}),a.jsx(H,{size:"lg",className:"mt-6 w-full rounded-xl",disabled:x||P&&!k,onClick:G,children:x?a.jsxs(a.Fragment,{children:[a.jsx(Je,{className:"mr-2 h-4 w-4 animate-spin"})," Paiement en cours..."]}):"Commander"}),a.jsx(an,{open:w,onOpenChange:_,children:a.jsxs(nn,{children:[a.jsx(on,{children:a.jsx(ln,{children:"Commander en tant qu'invité"})}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Entrez votre email pour recevoir la confirmation de commande."}),a.jsx(ue,{type:"email",placeholder:"[email protected]",value:j,onChange:K=>N(K.target.value)}),a.jsxs(ss,{className:"gap-2",children:[a.jsx(H,{variant:"outline",onClick:()=>{_(!1),o("/login?redirect=/boutique/panier")},children:"Se connecter"}),a.jsx(H,{onClick:()=>{_(!1),B(j)},disabled:!j.includes("@"),children:"Continuer"})]})]})})]})]})]})},$Xe=()=>{const{clearCart:t}=tv();return b.useEffect(()=>{t()},[t]),a.jsxs("div",{className:"container py-20 text-center max-w-lg mx-auto",children:[a.jsx("div",{className:"mx-auto flex h-20 w-20 items-center justify-center rounded-full bg-green-100",children:a.jsx(uk,{className:"h-10 w-10 text-green-600"})}),a.jsx("h1",{className:"mt-6 font-heading text-3xl font-bold",children:"Merci pour votre commande !"}),a.jsx("p",{className:"mt-4 text-muted-foreground",children:"Votre commande a été enregistrée avec succès. Vous recevrez un email de confirmation sous quelques minutes."}),a.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Si des produits digitaux étaient dans votre panier, vos téléchargements seront bientôt disponibles dans votre espace."}),a.jsxs("div",{className:"mt-8 flex flex-col gap-3",children:[a.jsx(H,{asChild:!0,size:"lg",className:"rounded-xl",children:a.jsxs(_e,{to:"/boutique",children:[a.jsx(Wi,{className:"mr-2 h-4 w-4"})," Retour à la boutique"]})}),a.jsx(H,{asChild:!0,variant:"outline",size:"lg",className:"rounded-xl",children:a.jsxs(_e,{to:"/mon-compte",children:["Mon compte ",a.jsx(Au,{className:"ml-2 h-4 w-4"})]})})]})]})},zXe=()=>{const{clearCart:t}=tv();return b.useEffect(()=>{t()},[t]),a.jsxs("div",{className:"container py-20 text-center max-w-lg mx-auto",children:[a.jsx("div",{className:"mx-auto flex h-20 w-20 items-center justify-center rounded-full",style:{backgroundColor:"rgba(200,150,46,0.12)"},children:a.jsx(uk,{className:"h-10 w-10",style:{color:"#C8962E"}})}),a.jsx("h1",{className:"mt-6 font-heading text-3xl font-bold",children:"Merci pour votre commande !"}),a.jsxs("p",{className:"mt-4 text-muted-foreground leading-relaxed",children:["Votre commande a été enregistrée avec succès. Vous recevrez un ",a.jsx("strong",{children:"email de confirmation"})," sous quelques minutes avec tous les détails."]}),a.jsxs("div",{className:"mt-6 rounded-xl border border-border bg-card p-5 text-left space-y-3",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(Ts,{className:"h-5 w-5 mt-0.5 shrink-0",style:{color:"#C8962E"}}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"Produits numériques (PDF)"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Votre lien de téléchargement est dans l'email de confirmation. Il est valable 30 jours avec un maximum de 5 téléchargements."})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(Wi,{className:"h-5 w-5 mt-0.5 shrink-0",style:{color:"#C8962E"}}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"Produits physiques"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Expédition sous 3 à 5 jours ouvrés. Vous recevrez un email de suivi dès l'envoi."})]})]})]}),a.jsxs("div",{className:"mt-8 flex flex-col gap-3",children:[a.jsx(H,{asChild:!0,size:"lg",className:"rounded-xl bg-[#C8962E] hover:bg-[#b8862a] text-white",children:a.jsxs(_e,{to:"/",children:[a.jsx(Ife,{className:"mr-2 h-4 w-4"})," Retour à l'accueil"]})}),a.jsx(H,{asChild:!0,variant:"outline",size:"lg",className:"rounded-xl",children:a.jsxs(_e,{to:"/boutique",children:[a.jsx(Wi,{className:"mr-2 h-4 w-4"})," Continuer mes achats"]})})]}),a.jsxs("p",{className:"mt-8 text-xs text-muted-foreground",children:["Une question ? Contactez-nous à ",a.jsx("a",{href:"mailto:[email protected]",className:"underline",style:{color:"#C8962E"},children:"[email protected]"})]})]})};function Qee(t){return t?t.replace(/<[^>]+>/g," ").replace(/ /g," ").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/€/g,"â¬").replace(/\s+/g," ").trim():""}var BXe="Label",Fye=b.forwardRef((t,e)=>a.jsx(et.label,{...t,ref:e,onMouseDown:n=>{var s;n.target.closest("button, input, select, textarea")||((s=t.onMouseDown)==null||s.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Fye.displayName=BXe;var $ye=Fye;const UXe=e2("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),te=b.forwardRef(({className:t,...e},n)=>a.jsx($ye,{ref:n,className:Fe(UXe(),t),...e}));te.displayName=$ye.displayName;const qXe="AIzaSyAaNoOWSDXiB9DbWDLSklRFzVAeh_atBII";let rP=null;async function VXe(){var t;try{const{data:e}=await Mt.from("site_settings").select("value").eq("key","google_maps_config").maybeSingle(),n=(t=e==null?void 0:e.value)==null?void 0:t.api_key;if(n&&n.trim().length>0)return n.trim()}catch{}return qXe}function _2(t=[]){var e;return typeof window>"u"?Promise.reject(new Error("SSR")):(e=window.google)!=null&&e.maps?Promise.resolve(window.google):rP||(rP=(async()=>{const n=await VXe();if(!n)throw new Error("Google Maps browser key non configurée");return await new Promise((r,s)=>{window.__lovableInitMap=()=>r(window.google);const i=document.createElement("script"),o=new URLSearchParams({key:n,v:"weekly",loading:"async",callback:"__lovableInitMap"});t.length>0&&o.set("libraries",t.join(",")),i.src=`https://maps.googleapis.com/ma
881ps/api/js?${o.toString()}`,i.async=!0,i.defer=!0,i.onerror=()=>s(new Error("Ãchec de chargement de Google Maps")),document.head.appendChild(i)})})(),rP)}const HXe={lat:36.7213,lng:-4.4214},zye=({points:t,center:e=HXe,zoom:n=8,height:r=480,className:s})=>{const i=b.useRef(null),o=b.useRef(null),l=b.useRef([]),c=b.useRef(null),[u,d]=b.useState(null),[h,f]=b.useState(null);b.useEffect(()=>{let m=!1;return _2([]).then(v=>{m||!i.current||(o.current=new v.maps.Map(i.current,{center:e,zoom:n,scrollwheel:!1,mapTypeControl:!1,streetViewControl:!1,fullscreenControl:!0}),c.current=new v.maps.InfoWindow,c.current.addListener("closeclick",()=>f(null)),p())}).catch(v=>d(v.message??"Erreur Google Maps")),()=>{var v;m=!0,l.current.forEach(x=>x.setMap(null)),l.current=[],(v=c.current)==null||v.close()}},[]),b.useEffect(()=>{o.current&&p()},[t]);const p=()=>{const m=o.current;if(!m||!window.google)return;l.current.forEach(g=>g.setMap(null)),l.current=[];const v=new google.maps.LatLngBounds;let x=0;t.forEach(g=>{if(g.latitude==null||g.longitude==null)return;const w={lat:Number(g.latitude),lng:Number(g.longitude)},_=new google.maps.Marker({map:m,position:w,title:g.name});_.addListener("click",()=>{if(!c.current)return;const j=document.createElement("div"),N=a.jsx("div",{className:"text-sm text-foreground",children:g.popup??a.jsx("strong",{children:g.name})});f({node:j,content:N}),c.current.setContent(j),c.current.open({map:m,anchor:_})}),l.current.push(_),v.extend(w),x++}),x>1?m.fitBounds(v,60):x===1&&(m.setCenter(v.getCenter()),m.setZoom(13))};return a.jsxs("div",{className:s??"overflow-hidden rounded-lg border border-border",style:{height:r},children:[u?a.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:u}):a.jsx("div",{ref:i,style:{width:"100%",height:"100%"}}),h?Lc.createPortal(h.content,h.node):null]})},sP=[{value:"all",label:"Choisir une catégorie",match:()=>!0},{value:"golf",label:"Golf",match:t=>!!t.is_esprit_golf||t.category==="golf"},{value:"activite",label:"Activités & Loisirs",match:t=>t.category==="activite"&&!t.is_esprit_golf},{value:"immobilier",label:"Immobilier",match:t=>t.category==="immobilier"||t.category==="agent_immobilier"},{value:"apprentissage_formation",label:"Apprentissage & Formation",match:t=>t.category==="apprentissage_formation"},{value:"assurance",label:"Assurance",match:t=>t.category==="assurance"},{value:"conciergerie",label:"Conciergerie",match:t=>t.category==="conciergerie"},{value:"gestion",label:"Gestion",match:t=>t.category==="gestion"},{value:"maison_travaux",label:"Maison & Travaux",match:t=>t.category==="maison_travaux"},{value:"mode_decoration",label:"Mode & Décoration",match:t=>t.category==="mode_decoration"},{value:"photographie",label:"Photographie",match:t=>t.category==="photographie"},{value:"restaurant",label:"Restaurants",match:t=>t.category==="restaurant"},{value:"sante_bien_etre",label:"Santé & Bien-être",match:t=>t.category==="sante_bien_etre"},{value:"service",label:"Services",match:t=>t.category==="service"},{value:"services_juridiques",label:"Services Juridiques",match:t=>t.category==="services_juridiques"},{value:"transports",label:"Transports",match:t=>t.category==="transports"},{value:"voyages_logement",label:"Voyages & Logement",match:t=>t.category==="voyages_logement"}],WXe=[{q:"Comment utiliser ma carte ?",a:"Présentez votre carte digitale depuis votre espace membre chez le partenaire. La réduction est appliquée immédiatement."},{q:"Comment résilier ?",a:"Depuis votre espace membre, en un clic. Votre carte reste active jusqu'à la fin de la période payée."},{q:"Les réductions sont-elles cumulables ?",a:"Non, les réductions Carte Privilège ne sont pas cumulables avec d'autres offres en cours."},{q:"Puis-je parrainer quelqu'un ?",a:"Oui ! Partagez votre lien de parrainage et recevez une réduction sur votre prochain renouvellement pour chaque filleul qui souscrit."},{q:"La carte est-elle valable partout en Andalousie ?",a:"Oui, la carte est valable chez tous nos partenaires en Andalousie. Consultez la liste complète sur cette page."}],KXe=[{icon:Jo,title:"Souscrivez en ligne",desc:"Choisissez votre abonnement annuel et payez en toute sécurité."},{icon:x5e,title:"Recevez votre carte digitale",desc:"Accédez instantanément à votre carte depuis votre espace membre."},{icon:c5e,title:"Présentez-la chez nos partenaires",desc:"Montrez votre carte et profitez de réductions immédiates."}],GXe={activite:"Activités",immobilier:"Immobilier",apprentissage_formation:"Apprentissage & Formation",assurance:"Assurance",commerce:"Commerces",conciergerie:"Conciergerie",gestion:"Gestion",golf:"Golf",hotel:"Hôtels",maison_travaux:"Maison & Travaux",mode_decoration:"Mode & Décoration",photographie:"Photographie",restaurant:"Restaurants",sante:"Santé",sante_bien_etre:"Santé & Bien-être",service:"Services",services_juridiques:"Services Juridiques",transports:"Transports",voyages_logement:"Voyages & Logement"},YXe=()=>{var P;const t=Gs(),[e,n]=b.useState("all"),[r,s]=b.useState("all"),[i,o]=b.useState(""),{data:l=[],isLoading:c}=Ne({queryKey:["carte_partners"],queryFn:async()=>{const{data:T,error:M}=await Z.from("partners").select("*").eq("is_carte_privilege",!0).eq("is_active",!0).order("name");if(M)throw M;return T}}),{data:u}=Ne({queryKey:["my_carte_privilege_exists"],queryFn:async()=>{const{data:{user:T}}=await Z.auth.getUser();if(!T)return null;const{data:M}=await Z.from("carte_privilege").select("id").eq("user_id",T.id).maybeSingle();return M}}),d=b.useMemo(()=>l.filter(T=>T.is_esprit_golf||T.category==="golf"),[l]),h=b.useMemo(()=>[...new Set(l.map(T=>
881T.city).filter(Boolean))].sort(),[l]),f=b.useMemo(()=>{const T=sP.find(R=>R.value===e)||sP[0],M=i.trim().toLowerCase();return l.filter(R=>T.match(R)).filter(R=>r==="all"||R.city===r).filter(R=>!M||(R.name||"").toLowerCase().includes(M))},[l,e,r,i]),p=b.useMemo(()=>f.filter(T=>T.latitude!=null&&T.longitude!=null),[f]),m=b.useMemo(()=>l.filter(M=>M.carte_discount_percent>0).slice(0,3).map(M=>{const R=M.category==="restaurant"?50:M.category==="hotel"?120:40,A=R*(1-M.carte_discount_percent/100);return{name:M.name,base:R,discounted:A,saving:R-A,percent:M.carte_discount_percent}}),[l]),[v,x]=b.useState(null),[g,w]=b.useState(!1),[_,j]=b.useState(""),[N,S]=b.useState(""),C=async(T,M)=>{const{data:{user:R}}=await Z.auth.getUser();if(!R){ee.info("Connectez-vous pour souscrire",{description:"Vous serez redirigé après connexion."}),t("/login?redirect=/carte-privilege");return}const{data:A}=await Z.from("carte_privilege").select("id").eq("user_id",R.id).eq("status","active").maybeSingle();if(A){ee.success("Vous êtes déjà abonné !",{description:"Accédez à votre espace membre."}),t("/carte-privilege/mon-espace");return}x(T);try{const I=await DXe({plan:T,...M,success_url:window.location.origin+"/carte-privilege/mon-espace?success=true",cancel_url:window.location.origin+"/carte-privilege"});window.open(I,"_blank")}catch(I){console.error("Stripe error:",I),ee.error("Erreur lors du paiement",{description:I.message||"Veuillez réessayer."})}finally{x(null)}},k=()=>C("individual"),E=T=>{if(T.preventDefault(),!_.trim()){ee.error("Le nom de l'accompagnant est requis.");return}w(!1),C("couple",{companion_name:_.trim(),companion_email:N.trim()||void 0})};return a.jsxs("div",{children:[a.jsx(Fn,{title:"Carte Privilège Esprit Sud | Réductions en Andalousie",description:"Bénéficiez de réductions exclusives chez plus de 200 partenaires en Andalousie avec la Carte Privilège Esprit Sud.",path:"/carte-privilege"}),a.jsxs("section",{className:"relative overflow-hidden py-16 md:py-24",style:{background:"linear-gradient(135deg, #1B4F72 0%, #2E86C1 100%)"},children:[a.jsx("div",{className:"container relative z-10",children:a.jsxs("div",{className:"mx-auto max-w-3xl text-center",children:[a.jsx(ke,{className:"mb-4 bg-white/20 text-white hover:bg-white/30 border-0",children:"Programme fidélité"}),a.jsx("h1",{className:"font-heading text-3xl font-bold text-white md:text-5xl lg:text-6xl",children:"Carte Privilège Esprit Sud"}),a.jsx("p",{className:"mt-4 text-lg text-white/80 md:text-xl",children:"Profitez de réductions exclusives chez nos partenaires en Andalousie"}),a.jsxs("div",{className:"mt-8 flex flex-col items-center gap-3 sm:flex-row sm:justify-center",children:[a.jsxs(H,{size:"lg",onClick:k,disabled:!!v,className:"rounded-xl bg-[#E74C3C] text-white hover:bg-[#C0392B] text-base px-8",children:[v?"Redirection...":"Souscrire maintenant"," ",!v&&a.jsx(Au,{className:"ml-2 h-4 w-4"})]}),a.jsx(H,{size:"lg",variant:"outline",onClick:()=>{var T;return(T=document.getElementById("partenaires"))==null?void 0:T.scrollIntoView({behavior:"smooth"})},className:"rounded-xl border-white/40 bg-white/10 text-white hover:bg-white/20 hover:text-white text-base px-8",children:"Voir les partenaires"})]}),u&&a.jsx("div",{className:"mt-4 text-center",children:a.jsxs(_e,{to:"/carte-privilege/mon-espace",className:"inline-flex items-center gap-1 text-sm text-white/90 underline underline-offset-4 hover:text-white",children:["Vous avez déjà une carte ? Accéder à mon espace",a.jsx(Au,{className:"h-3.5 w-3.5"})]})})]})}),a.jsx("div",{className:"absolute inset-0 bg-[url('/placeholder.svg')] opacity-5"})]}),a.jsx("section",{className:"bg-muted py-14 md:py-20",children:a.jsxs("div",{className:"container",children:[a.jsx("h2",{className:"text-center font-heading text-2xl font-bold md:text-3xl",children:"Comment ça marche"}),a.jsx("div",{className:"mt-10 grid gap-8 sm:grid-cols-3",children:KXe.map((T,M)=>a.jsxs("div",{className:"flex flex-col items-center text-center",children:[a.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-2xl bg-primary/10",children:a.jsx(T.icon,{className:"h-8 w-8 text-primary"})}),a.jsx("div",{className:"mt-1 flex h-6 w-6 items-center justify-center rounded-full bg-primary text-xs font-bold text-primary-foreground",children:M+1}),a.jsx("h3",{className:"mt-3 font-heading text-lg font-semibold",children:T.title}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:T.desc})]},M))})]})}),a.jsxs("section",{id:"partenaires",className:"container py-14 md:py-20",children:[a.jsx("h2",{className:"font-heading text-2xl font-bold md:text-3xl",children:"Nos partenaires et avantages"}),a.jsxs("div",{className:"mt-6 space-y-3",children:[a.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx(is,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(ue,{value:i,onChange:T=>o(T.target.value),placeholder:"Rechercher un partenaire...",className:"pl-9"})]}),a.jsxs(lt,{value:e,onValueChange:n,children:[a.jsx(nt,{className:"sm:w-52",children:a.jsx(ct,{placeholder:"Catégorie"})}),a.jsx(rt,{children:sP.map(T=>a.jsx(Ae,{value:T.value,children:T.label},T.value))})]}),a.jsxs(lt,{value:r,onValueChange:s,children:[a.jsx(nt,{className:"sm:w-48",children:a.jsx(ct,{placeholder:"Ville"})}),a.jsxs(rt,{children:[a.jsx(Ae,{value:"all",children:"Toutes les villes"}),h.map(T=>a.jsx(Ae,{value:T,children:T},T))]})]})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm text-muted-foreground",children:[!c&&a.jsxs("span",{children:[f.length," partenaire",f.length>
8811?"s":""]}),(e!=="all"||r!=="all"||i)&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-border",children:"â¢"}),e!=="all"&&a.jsxs("button",{onClick:()=>n("all"),className:"rounded-full bg-primary/10 px-2.5 py-0.5 text-xs text-primary hover:bg-primary/20",children:[(P=sP.find(T=>T.value===e))==null?void 0:P.label," Ã"]}),r!=="all"&&a.jsxs("button",{onClick:()=>s("all"),className:"rounded-full bg-primary/10 px-2.5 py-0.5 text-xs text-primary hover:bg-primary/20",children:[r," Ã"]}),i&&a.jsxs("button",{onClick:()=>o(""),className:"rounded-full bg-primary/10 px-2.5 py-0.5 text-xs text-primary hover:bg-primary/20",children:["« ",i," » Ã"]}),a.jsx("button",{onClick:()=>{n("all"),s("all"),o("")},className:"ml-auto text-xs underline hover:text-foreground",children:"Tout effacer"})]})]})]}),p.length>0&&a.jsx("div",{className:"mt-6",children:a.jsx(zye,{height:400,zoom:7,center:{lat:37.3891,lng:-5.9845},className:"overflow-hidden rounded-xl border border-border",points:p.map(T=>({id:T.id,name:T.name,latitude:T.latitude,longitude:T.longitude,popup:a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"font-heading font-semibold",children:T.name}),a.jsx("div",{className:"text-xs text-muted-foreground",children:T.city}),T.carte_discount_percent>0&&a.jsxs("div",{className:"text-sm font-bold text-[#E74C3C]",children:["-",T.carte_discount_percent,"%"]}),a.jsx(_e,{to:`/carnet-adresses/${T.slug}`,className:"text-xs text-primary underline",children:"Voir la fiche"})]})}))})}),c?a.jsx("div",{className:"mt-10 grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[1,2,3,4,5,6].map(T=>a.jsx("div",{className:"h-64 animate-pulse rounded-xl bg-muted"},T))}):a.jsx("div",{className:"mt-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:f.map(T=>{var M,R;return a.jsxs(_e,{to:`/carnet-adresses/${T.slug}`,className:"group overflow-hidden rounded-xl border border-border bg-card transition-shadow hover:shadow-lg",children:[a.jsxs("div",{className:"relative h-40 bg-muted",children:[(M=T.images)!=null&&M[0]||T.logo_url?a.jsx("img",{src:((R=T.images)==null?void 0:R[0])||T.logo_url,alt:T.name,className:"h-full w-full object-cover",loading:"lazy"}):a.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:a.jsx(X6,{className:"h-8 w-8"})}),T.carte_discount_percent>0&&a.jsxs("div",{className:"absolute right-3 top-3 rounded-full bg-[#E74C3C] px-3 py-1 text-sm font-bold text-white shadow-lg",children:["-",T.carte_discount_percent,"%"]})]}),a.jsxs("div",{className:"p-4",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsx("h3",{className:"font-heading font-semibold group-hover:text-primary transition-colors",children:T.name}),a.jsx(ke,{variant:"outline",className:"shrink-0 text-xs",children:GXe[T.category]||T.category})]}),a.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:T.city}),T.carte_discount_conditions&&a.jsx("p",{className:"mt-2 text-sm text-muted-foreground line-clamp-2",children:Qee(T.carte_discount_conditions)})]})]},T.id)})}),!c&&f.length===0&&a.jsx("p",{className:"mt-10 text-center text-muted-foreground",children:"Aucun partenaire trouvé pour ces critères."})]}),d.length>0&&a.jsx("section",{className:"py-14 md:py-20",style:{background:"linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%)"},children:a.jsxs("div",{className:"container",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("h2",{className:"font-heading text-2xl font-bold md:text-3xl",children:"Esprit Golf"}),a.jsxs("a",{href:"https://espritgolf.es",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-sm text-primary hover:underline",children:["espritgolf.es ",a.jsx(Gi,{className:"h-3.5 w-3.5"})]})]}),a.jsx("p",{className:"mt-2 text-muted-foreground",children:"Nos partenaires golf avec réductions exclusives"}),a.jsx("div",{className:"mt-8 grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:d.map(T=>{var M,R;return a.jsxs(_e,{to:`/carnet-adresses/${T.slug}`,className:"group overflow-hidden rounded-xl border border-green-200 bg-white transition-shadow hover:shadow-lg",children:[a.jsxs("div",{className:"relative h-36 bg-green-50",children:[(M=T.images)!=null&&M[0]||T.logo_url?a.jsx("img",{src:((R=T.images)==null?void 0:R[0])||T.logo_url,alt:T.name,className:"h-full w-full object-cover",loading:"lazy"}):a.jsx("div",{className:"flex h-full items-center justify-center text-green-300",children:a.jsx(X6,{className:"h-8 w-8"})}),T.carte_discount_percent>0&&a.jsxs("div",{className:"absolute right-3 top-3 rounded-full bg-green-600 px-3 py-1 text-sm font-bold text-white",children:["-",T.carte_discount_percent,"%"]})]}),a.jsxs("div",{className:"p-4",children:[a.jsx("h3",{className:"font-heading font-semibold",children:T.name}),a.jsx("p",{className:"text-xs text-muted-foreground",children:T.city}),T.carte_discount_conditions&&a.jsx("p",{className:"mt-1 text-sm text-muted-foreground line-clamp-2",children:Qee(T.carte_discount_conditions)})]})]},T.id)})})]})}),m.length>0&&a.jsxs("section",{className:"container py-14 md:py-20",children:[a.jsx("h2",{className:"text-center font-heading text-2xl font-bold md:text-3xl",children:"Avec / Sans la carte"}),a.jsx("p",{className:"mt-2 text-center text-muted-foreground",children:"Des exemples concrets d'économies"}),a.jsx("div",{className:"mx-auto mt-8 max-w-2xl overflow-hidden rounded-xl border border-border",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"bg-muted",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Partenaire"}),a.jsx("th",{className:"px-4 py-3 text-right font-medium",children:"Sans carte"}),a.jsx("th",{className:"px-4 py-3 text-right font-medium",children:"Avec carte"}),a.jsx("th",{className:"px-4 py-3 text-right font-medium",children:"Ãconomie"})]})}),a.jsx("tbody",{children:m.map((T,M)=>a.jsxs("tr",{className:"border-t border-border",children:[a.jsx("td",{className:"px-4 py-3 font-medium",children:T.name}),a.jsxs("td",{className:"px-4 py-3 text-right text-muted-foreground",children:[T.base.toFixed(2).replace(".",",")," â¬"]}),a.jsxs("td",{className:"px-4 py-3 text-right font-semibold text-primary",children:[T.discounted.toFixed(2).replace(".",",")," â¬"]}),a.jsxs("td",{className:"px-4 py-3 text-right font-semibold text-green-600",children:["-",T.saving.toFixed(2).replace(".",",")," â¬"]})]},M))})]})})]}),a.jsx("section",{className:"bg-muted py-14 md:py-20",children:a.jsxs("div",{className:"container",children:[a.jsx("h2",{className:"text-center font-heading text-2xl font-bold md:text-3xl",children:"Choisissez votre formule"}),a.jsx("p",{className:"mt-2 text-center text-muted-foreground",children:"Ãconomisez davantage à deux"}),a.jsxs("div",{className:"mx-auto mt-10 grid max-w-4xl gap-6 md:grid-cols-2",children:[a.jsxs("div",{className:"rounded-2xl border-2 border-border bg-card p-8 text-center shadow-sm flex flex-col",children:[a.jsx(ke,{variant:"outline",className:"mb-4 mx-auto w-fit",children:"Individuel"}),a.jsx("div",{className:"font-heading text-5xl font-bold text-primary",children:"75â¬"}),a.jsx("div",{className:"mt-1 text-muted-foreground",children:"par an"}),a.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:"1 carte, 1 personne"}),a.jsx("ul",{className:"mt-6 space-y-3 text-left flex-1",children:["Accès à tous les partenaires","Réductions immédiates","Valable 1 an, renouvelable","Parrainez et économisez"].map(T=>a.jsxs("li",{className:"flex items-center gap-2",children:[a.jsx(Ma,{className:"h-4 w-4 shrink-0 text-green-600"}),a.jsx("span",{className:"text-sm",children:T})]},T))}),a.jsx(H,{size:"lg",onClick:()=>C("individual"),disabled:!!v,className:"mt-8 w-full rounded-xl bg-[#E74C3C] text-white hover:bg-[#C0392B]",children:v==="individual"?"Redirection...":"Souscrire"})]}),a.jsxs("div",{className:"relative rounded-2xl border-2 bg-card p-8 text-center shadow-lg flex flex-col",style:{borderColor:"#C8962E"},children:[a.jsx("div",{className:"absolute -top-3 left-1/2 -translate-x-1/2 roun
881ded-full px-4 py-1 text-xs font-bold text-white shadow",style:{background:"#C8962E"},children:"Ãconomisez 25â¬"}),a.jsx(ke,{className:"mb-4 mx-auto w-fit",style:{background:"#C8962E",color:"#fff"},children:"Couple"}),a.jsx("div",{className:"font-heading text-5xl font-bold",style:{color:"#C8962E"},children:"125â¬"}),a.jsx("div",{className:"mt-1 text-muted-foreground",children:"par an au lieu de 150â¬"}),a.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:"2 cartes, 2 personnes"}),a.jsx("ul",{className:"mt-6 space-y-3 text-left flex-1",children:["Accès à tous les partenaires","Réductions immédiates","Valable 1 an, renouvelable","Parrainez et économisez","2 cartes avec le même compte"].map(T=>a.jsxs("li",{className:"flex items-center gap-2",children:[a.jsx(Ma,{className:"h-4 w-4 shrink-0 text-green-600"}),a.jsx("span",{className:"text-sm",children:T})]},T))}),a.jsx(H,{size:"lg",onClick:()=>w(!0),disabled:!!v,className:"mt-8 w-full rounded-xl text-white hover:opacity-90",style:{background:"#C8962E"},children:v==="couple"?"Redirection...":"Souscrire en couple"})]})]})]})}),a.jsx(an,{open:g,onOpenChange:w,children:a.jsxs(nn,{children:[a.jsxs(on,{children:[a.jsx(ln,{children:"Informations de l'accompagnant"}),a.jsx(Eu,{children:"Renseignez les informations de la 2ème personne qui bénéficiera de la carte couple."})]}),a.jsxs("form",{onSubmit:E,className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"companion-name",children:"Nom complet de l'accompagnant *"}),a.jsx(ue,{id:"companion-name",value:_,onChange:T=>j(T.target.value),placeholder:"Marie Dupont",required:!0,maxLength:100})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"companion-email",children:"Email de l'accompagnant (optionnel)"}),a.jsx(ue,{id:"companion-email",type:"email",value:N,onChange:T=>S(T.target.value),placeholder:"[email protected]",maxLength:255}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Pour un futur accès propre à l'espace membre."})]}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx(H,{type:"button",variant:"outline",onClick:()=>w(!1),children:"Annuler"}),a.jsx(H,{type:"submit",className:"text-white",style:{background:"#C8962E"},disabled:!!v,children:"Continuer vers le paiement"})]})]})]})}),a.jsxs("section",{className:"container py-14 md:py-20",children:[a.jsx("h2",{className:"text-center font-heading text-2xl font-bold md:text-3xl",children:"Questions fréquentes"}),a.jsx("div",{className:"mx-auto mt-8 max-w-2xl",children:a.jsx(s7,{type:"single",collapsible:!0,children:WXe.map((T,M)=>a.jsxs(D3,{value:`faq-${M}`,children:[a.jsx(L3,{className:"text-left font-medium",children:T.q}),a.jsx(F3,{className:"text-muted-foreground",children:T.a})]},M))})})]}),a.jsx("section",{className:"py-16",style:{background:"linear-gradient(135deg, #1B4F72 0%, #2E86C1 100%)"},children:a.jsxs("div",{className:"container text-center",children:[a.jsx("h2",{className:"font-heading text-2xl font-bold text-white md:text-3xl",children:"Prêt à profiter de l'Andalousie autrement ?"}),a.jsx("p",{className:"mt-3 text-white/80",children:"Rejoignez les membres qui économisent chaque jour."}),a.jsxs(H,{size:"lg",onClick:k,disabled:!!v,className:"mt-8 rounded-xl bg-[#E74C3C] text-white hover:bg-[#C0392B]",children:[v?"Redirection...":"Souscrire maintenant"," ",!v&&a.jsx(Au,{className:"ml-2 h-4 w-4"})]})]})})]})};var Bye="AlertDialog",[XXe,LLt]=Ys(Bye,[Hpe]),fp=Hpe(),Uye=t=>{const{__scopeAlertDialog:e,...n}=t,r=fp(e);return a.jsx(m3,{...r,...n,modal:!0})};Uye.displayName=Bye;var JXe="AlertDialogTrigger",qye=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=fp(n);return a.jsx(g3,{...s,...r,ref:e})});qye.displayName=JXe;var QXe="AlertDialogPortal",Vye=t=>{const{__scopeAlertDialog:e,...n}=t,r=fp(e);return a.jsx(v3,{...r,...n})};Vye.displayName=QXe;var ZXe="AlertDialogOverlay",Hye=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=fp(n);return a.jsx(Mj,{...s,...r,ref:e})});Hye.displayName=ZXe;var Dw="AlertDialogContent",[eJe,tJe]=XXe(Dw),nJe=rfe("AlertDialogContent"),Wye=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,children:r,...s}=t,i=fp(n),o=b.useRef(null),l=$t(e,o),c=b.useRef(null);return a.jsx(o8e,{contentName:Dw,titleName:Kye,docsSlug:"alert-dialog",children:a.jsx(eJe,{scope:n,cancelRef:c,children:a.jsxs(Rj,{role:"alertdialog",...i,...s,ref:l,onOpenAutoFocus:ze(s.onOpenAutoFocus,u=>{var d;u.preventDefault(),(d=c.current)==null||d.focus({preventScroll:!0})}),onPointerDownOutside:u=>u.preventDefault(),onInteractOutside:u=>u.preventDefault(),children:[a.jsx(nJe,{children:r}),a.jsx(sJe,{contentRef:o})]})})})});
881Wye.displayName=Dw;var Kye="AlertDialogTitle",Gye=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=fp(n);return a.jsx(Oj,{...s,...r,ref:e})});Gye.displayName=Kye;var Yye="AlertDialogDescription",Xye=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=fp(n);return a.jsx(Ij,{...s,...r,ref:e})});Xye.displayName=Yye;var rJe="AlertDialogAction",Jye=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=fp(n);return a.jsx(o2,{...s,...r,ref:e})});Jye.displayName=rJe;var Qye="AlertDialogCancel",Zye=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,{cancelRef:s}=tJe(Qye,n),i=fp(n),o=$t(e,s);return a.jsx(o2,{...i,...r,ref:o})});Zye.displayName=Qye;var sJe=({contentRef:t})=>{const e=`\`${Dw}\` requires a description for the component to be accessible for screen reader users. 882 883You can add a description to the \`${Dw}\` by passing a \`${Yye}\` component as a child, which also benefits sighted users by adding visible context to the dialog. 884 885Alternatively, 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 \`${Dw}\`. 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. 886 887For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return b.useEffect(()=>{var r;document.getElementById((r=t.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},iJe=Uye,aJe=qye,oJe=Vye,e0e=Hye,t0e=Wye,n0e=Jye,r0e=Zye,s0e=Gye,i0e=Xye;const ro=iJe,U3=aJe,lJe=oJe,a0e=b.forwardRef(({className:t,...e},n)=>a.jsx(e0e,{className:Fe("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",t),...e,ref:n}));a0e.displayName=e0e.displayName;const ja=b.forwardRef(({className:t,...e},n)=>a.jsxs(lJe,{children:[a.jsx(a0e,{}),a.jsx(t0e,{ref:n,className:Fe("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",t),...e})]}));ja.displayName=t0e.displayName;const Sa=({className:t,...e})=>a.jsx("div",{className:Fe("flex flex-col space-y-2 text-center sm:text-left",t),...e});Sa.displayName="AlertDialogHeader";const Na=({className:t,...e})=>a.jsx("div",{className:Fe("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});Na.displayName="AlertDialogFooter";const Ca=b.forwardRef(({className:t,...e},n)=>a.jsx(s0e,{ref:n,className:Fe("text-lg font-semibold",t),...e}));Ca.displayName=s0e.displayName;const ka=b.forwardRef(({className:t,...e},n)=>a.jsx(i0e,{ref:n,className:Fe("text-sm text-muted-foreground",t),...e}));ka.displayName=i0e.displayName;const Aa=b.forwardRef(({className:t,...e},n)=>a.jsx(n0e,{ref:n,className:Fe(mk(),t),...e}));Aa.displayName=n0e.displayName;const Ea=b.forwardRef(({className:t,...e},n)=>a.jsx(r0e,{ref:n,className:Fe(mk({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));Ea.displayName=r0e.displayName;const cJe="modulepreload",uJe=function(t){return"/"+t},Zee={},Ac=function(e,n,r){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));s=Promise.allSettled(n.map(c=>{if(c=uJe(c),c in Zee)return;Zee[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const h=document.createElement("link");if(h.rel=u?"stylesheet":cJe,u||(h.as="script"),h.crossOrigin="",h.href=c,l&&h.setAttribute("nonce",l),document.head.appendChild(h),u)return new Promise((f,p)=>{h.addEventListener("load",f),h.addEventListener("error",()=>p(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 s.then(o=>{for(const l of o||[])l.status==="rejected"&&i(l.reason);return e().catch(i)})},dJe=t=>{if(!t)return"â/â";const e=new Date(t),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getFullYear()).slice(-2);return`${n}/${r}`},hJe=t=>
887t.split(" ").filter(Boolean).slice(0,2).map(e=>{var n;return(n=e[0])==null?void 0:n.toUpperCase()}).join(""),xC=({fullName:t,cardNumber:e,validUntil:n,avatarUrl:r,userId:s,referralCode:i,onAvatarUpdate:o,readOnly:l,label:c,companionBadge:u,onCustomUpload:d})=>{const h=b.useRef(null),f=b.useRef(null),[p,m]=b.useState(!1),[v,x]=b.useState(!1),[g,w]=b.useState(!1),[_,j]=b.useState(!1),N=async T=>{var R;const M=(R=T.target.files)==null?void 0:R[0];if(M){if(M.size>5*1024*1024){ee.error("Image trop lourde (max 5 Mo).");return}w(!0);try{if(d){const A=await d(M);o==null||o(A),ee.success("Photo mise à jour !")}else{const A=(M.name.split(".").pop()||"jpg").toLowerCase(),I=`avatars/${s}/${Date.now()}.${A}`,{error:D}=await Z.storage.from("images").upload(I,M,{upsert:!0});if(D)throw D;const{data:O}=Z.storage.from("images").getPublicUrl(I),{error:z}=await Z.from("profiles").update({avatar_url:O.publicUrl}).eq("id",s);if(z)throw z;o==null||o(O.publicUrl),ee.success("Photo de profil mise à jour !")}}catch(A){ee.error(A.message||"Erreur d'upload")}finally{w(!1)}}},S=async()=>{j(!0);try{const{data:T,error:M}=await Z.functions.invoke("generate-wallet-pass",{body:{card_number:e,member_name:t,valid_until:n,is_companion:!!u,...u?{companion_name:t}:{}}});if(M)throw M;const R=T instanceof Blob?T:new Blob([T],{type:"application/vnd.apple.pkpass"}),A=R.type?R:new Blob([R],{type:"application/vnd.apple.pkpass"}),I=URL.createObjectURL(A);window.open(I,"_blank"),setTimeout(()=>URL.revokeObjectURL(I),6e4),ee.success("Carte générée !")}catch(T){console.error(T),ee.error((T==null?void 0:T.message)||"Impossible de générer la carte Apple Wallet.")}finally{j(!1)}},C=()=>ee.info("Google Wallet â bientôt disponible."),k=async()=>{if(f.current){m(!0);try{const[{default:T},{jsPDF:M}]=await Promise.all([Ac(()=>import("./html2canvas.esm-CBrSDip1.js"),[]),Ac(()=>import("./jspdf.es.min-DJcAk7nZ.js"),[])]),R=await T(f.current,{scale:3,backgroundColor:null,useCORS:!0,logging:!1}),A=R.toDataURL("image/png"),I=new M({orientation:"portrait",unit:"mm",format:"a4"}),D=I.internal.pageSize.getWidth(),O=I.internal.pageSize.getHeight(),z=100,B=z*(R.height/R.width),G=(D-z)/2,U=(O-B)/2;I.addImage(A,"PNG",G,U,z,B),I.save(`carte-privilege-${e||"espritsud"}.pdf`),ee.success("Carte téléchargée !")}catch(T){console.error(T),ee.error((T==null?void 0:T.message)||"Erreur lors du téléchargement")}finally{m(!1)}}},E=async()=>{if(f.current){x(!0);try{const{default:T}=await Ac(async()=>{const{default:I}=await import("./html2canvas.esm-CBrSDip1.js");return{default:I}},[]),R=(await T(f.current,{scale:3,backgroundColor:null,useCORS:!0,logging:!1})).toDataURL("image/png"),A=document.createElement("a");A.href=R,A.download=`carte-privilege-${e||"espritsud"}.png`,document.body.appendChild(A),A.click(),A.remove(),ee.success("Image téléchargée !")}catch(T){console.error(T),ee.error((T==null?void 0:T.message)||"Erreur lors du téléchargement")}finally{x(!1)}}},P=hJe(t||"ES");return a.jsxs("div",{className:"flex flex-col items-center",children:[c&&a.jsx("div",{className:"mb-3 text-sm font-medium text-muted-foreground",children:c}),a.jsxs("div",{ref:f,className:"relative w-full max-w-[380px] overflow-hidden rounded-2xl animate-in fade-in zoom-in-95 duration-500",style:{backgroundColor:"#C4A265",boxShadow:"0 20px 60px rgba(0,0,0,0.3)",aspectRatio:"2 / 3"},children:[u&&a.jsx("div",{className:"absolute right-2 top-2 z-10 rounded-full bg-purple-600/95 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-white shadow",children:"Accompagnant"}),a.jsxs("div",{className:"relative flex flex-col items-center justify-center px-6 pt-5 pb-16",style:{backgroundColor:"#1B2F1B",height:"32%"},children:[a.jsx("div",{className:"text-center font-serif text-[11px] tracking-[0.5em]",style:{color:"#D4A84B"},children:"PRIVILÃGE"}),a.jsx("img",{src:a9,alt:"Esprit Sud Magazine",className:"mt-2 h-12 w-auto md:h-14"})]}),a.jsxs("div",{className:"relative -mt-[75px] flex justify-center",children:[a.jsxs("button",{type:"button",onClick:()=>{var T;return!l&&((T=h.current)==null?void 0:T.click())},disabled:l,className:"group relative h-[150px] w-[150px] rounded-full border-4 border-white bg-muted overflow-hidden shadow-lg disabled:cursor-default","aria-label":"Changer de photo",children:[r?a.jsx("img",{src:r,alt:t,className:"h-full w-full object-cover"}):a.jsx("div",{className:"flex h-full w-full items-center justify-center bg-gray-300 font-serif text-4xl font-bold text-gray-700",children:P}),!l&&a.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50 opacity-0 transition-opacity group-hover:opacity-100",children:g?a.jsx(Je,{className:"h-6 w-6 animate-spin text-white"}):a.jsx(O$e,{className:"h-6 w-6 text-white"})})]}),!l&&a.jsx("input",{ref:h,type:"file",accept:"image/*",onChange:N,className:"hidden"})]}),a.jsxs("div",{className:"mt-5 px-6 text-center",style:{color:"#1A1A1A"},children:[a.jsx("div",{className:"font-serif text-xl font-semibold uppercase leading-tight",style:{fontFamily:"'Playfair Display', Georgia, serif",fontVariant:"small-caps",letterSpacing:"0.05em"},children:t||"â"}),a.jsxs("div",{className:"mt-4 font-serif text-sm tracking-[0.2em]",style:{fontFamily:"'Playfair Display', Georgia, serif"},children:["ID : ",e||"â"]}),a.jsxs("div",{className:"mt-2 font-serif text-sm tracking-[0.2em]",style:{fontFamily:"'Playfair Display', Georgia, serif"},children:["CADUCIDAD : ",dJe(n)]})]})]}),a.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-center gap-3",children:[a.jsxs("button",{onClick:S,disabled:_,className:"flex h-12 items-center gap-2 rounded-lg bg-black px-5 text-white transition-opacity hover:opacity-90 disabled:opacity-60",children:[_?a.jsx(Je,{className:"h-5 w-5 animate-spin"}):a.jsx("svg",{viewBox:"0 0 24 24",className:"h-5 w-5 fill-current",children:a.jsx("path",{d:"M17.05 12.04c0-2.86 2.34-4.23 2.45-4.3-1.34-1.95-3.42-2.22-4.16-2.25-1.77-.18-3.45 1.04-4.35 1.04-.9 0-2.29-1.02-3.76-.99-1.94.03-3.73 1.13-4.72 2.86-2.01 3.5-.52 8.66 1.45 11.5.96 1.39 2.11 2.95 3.61 2.89 1.45-.06 2-.94 3.76-.94 1.75 0 2.25.94 3.78.91 1.56-.03 2.55-1.41 3.5-2.81 1.1-1.61 1.56-3.17 1.58-3.25-.04-.02-3.03-1.16-3.06-4.61zM14.36 4.4c.79-.96 1.32-2.29 1.18-3.62-1.13.05-2.51.76-3.32 1.71-.73.85-1.37 2.21-1.2 3.51 1.27.1 2.55-.64 3.34-1.6z"})}),a.jsxs("span",{className:"text-left text-xs leading-tight",children:[a.jsx("span",{className:"block text-[10px] opacity-80",children:_?"Générationâ¦":"Ajouter à "}),a.jsx("span",{className:"block font-semibold",children:_?"Carte Wallet":u?`Wallet â ${t}`:"Apple Wallet"})]})]}),a.jsxs("button",{onClick:C,className:"flex h-12 items-center gap-2 rounded-lg bg-black px-5 text-white transition-opacity hover:opacity-90",children:[a.jsxs("svg",{viewBox:"0 0 24 24",className:"h-5 w-5",children:[a.jsx("path",{fill:"#4285F4",d:"M21 7H3a2 2 0 00-2 2v8a2 2 0 002 2h18a2 2 0 002-2V9a2 2 0 00-2-2z"}),a.jsx("path",{fill:"#fff",d:"M7 13h2v-2H7v2z"})]}),a.jsxs("span",{className:"text-left text-xs leading-tight",children:[a.jsx("span",{className:"block text-[10px] opacity-80",children:"Ajouter à "}),a.jsx("span",{className:"block font-semibold",children:"Google Wallet"})]})]})]}),a.jsxs("div",{className:"mt-3 flex flex-wrap items-center justify-center gap-2",children:[a.jsxs(H,{size:"sm",variant:"outline",onClick:k,disabled:p,children:[p?a.jsx(Je,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):a.jsx(Ts,{className:"mr-1.5 h-3.5 w-3.5"}),"Télécharger en PDF"]}),a.jsxs(H,{size:"sm",variant:"outline",onClick:E,disabled:v,children:[v?a.jsx(Je,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):a.jsx(Ts,{className:"mr-1.5 h-3.5 w-3.5"}),"Télécharger en image"]})]})]})}
887,M8=[{value:"all",label:"Tous",match:()=>!0},{value:"golf",label:"Golf",match:t=>!!t.is_esprit_golf},{value:"activite",label:"Activités & Loisirs",match:t=>t.category==="activite"&&!t.is_esprit_golf},{value:"immobilier",label:"Immobilier",match:t=>t.category==="immobilier"||t.category==="agent_immobilier"},{value:"apprentissage_formation",label:"Apprentissage & Formation",match:t=>t.category==="apprentissage_formation"},{value:"assurance",label:"Assurance",match:t=>t.category==="assurance"},{value:"conciergerie",label:"Conciergerie",match:t=>t.category==="conciergerie"},{value:"gestion",label:"Gestion",match:t=>t.category==="gestion"},{value:"maison_travaux",label:"Maison & Travaux",match:t=>t.category==="maison_travaux"},{value:"mode_decoration",label:"Mode & Décoration",match:t=>t.category==="mode_decoration"},{value:"photographie",label:"Photographie",match:t=>t.category==="photographie"},{value:"restaurant",label:"Restaurants",match:t=>t.category==="restaurant"},{value:"sante_bien_etre",label:"Santé & Bien-être",match:t=>t.category==="sante_bien_etre"},{value:"service",label:"Services",match:t=>t.category==="service"},{value:"services_juridiques",label:"Services Juridiques",match:t=>t.category==="services_juridiques"},{value:"transports",label:"Transports",match:t=>t.category==="transports"},{value:"voyages_logement",label:"Voyages & Logement",match:t=>t.category==="voyages_logement"}];Object.fromEntries(M8.filter(t=>t.value!=="all"&&t.value!=="golf").map(t=>[t.value,t.label]));const fJe=()=>{const{user:t,profile:e}=Ji(),[n]=Zg(),[r,s]=b.useState("all"),[i,o]=b.useState("all"),[l,c]=b.useState(""),[u,d]=b.useState(null),[h,f]=b.useState(!1);b.useEffect(()=>{n.get("success")==="true"&&ee.success("Bienvenue ! Votre Carte Privilège est maintenant active.",{description:"Profitez de vos réductions chez tous nos partenaires.",duration:6e3})},[n]);const{data:p=[],isLoading:m}=Ne({queryKey:["my_carte_privilege",t==null?void 0:t.id],enabled:!!t,queryFn:async()=>{const{data:O,error:z}=await Z.from("carte_privilege").select("*").eq("user_id",t.id).eq("status","active").order("is_companion",{ascending:!0});if(z)throw z;return O||[]}}),v=p.find(O=>!O.is_companion)||p[0]||null,x=p.find(O=>O.is_companion)||null,g=!!x,[w,_]=b.useState(null);b.useEffect(()=>{x!=null&&x.companion_avatar_url&&_(x.companion_avatar_url)},[x==null?void 0:x.companion_avatar_url]);const j=async O=>{const z=O.name.split(".").pop(),B=`companions/${x.id}-${Date.now()}.${z}`,{error:G}=await Z.storage.from("images").upload(B,O,{upsert:!0});if(G)throw G;const{data:U}=Z.storage.from("images").getPublicUrl(B),{error:F}=await Z.from("carte_privilege").update({companion_avatar_url:U.publicUrl}).eq("id",x.id);if(F)throw F;return U.publicUrl},N=async O=>{if(!x||!O.trim())return;const{error:z}=await Z.from("carte_privilege").update({companion_name:O.trim()}).eq("id",x.id);if(z)return ee.error(z.message);ee.success("Nom de l'accompagnant mis à jour."),x.companion_name=O.trim()},{data:S=[]}=Ne({queryKey:["carte_partners_espace"],enabled:!!v,queryFn:async()=>{const{data:O,error:z}=await Z.from("partners").select("*").eq("is_carte_privilege",!0).eq("is_active",!0).order("name");if(z)throw z;return O}}),{data:C}=Ne({queryKey:["my_referrals",t==null?void 0:t.id],enabled:!!t&&!!v,queryFn:async()=>{const{data:O,error:z}=await Z.from("referrals").select("id, status, reward_amount").eq("referrer_id",t.id);if(z)return{count:0,totalReward:0};const B=(O||[]).filter(G=>G.status==="completed");return{count:(O==null?void 0:O.length)||0,totalReward:B.reduce((G,U)=>G+(U.reward_amount||0),0)}}});b.useMemo(()=>[...new Set(S.map(O=>O.city))].filter(Boolean).sort(),[S]),b.useMemo(()=>{const O=M8.find(B=>B.value===r)||M8[0],z=l.trim().toLowerCase();return S.filter(B=>O.match(B)).filter(B=>i==="all"||B.city===i).filter(B=>!z||(B.name||"").toLowerCase().includes(z))},[S,r,i,l]);const k=v!=null&&v.valid_until?Math.ceil((new Date(v.valid_until).getTime()-Date.now())/864e5):0,E=k>30?"bg-green-500":k>0?"bg-orange-500":"bg-red-500",P=k>30?"Active":k>0?"Expire bientôt":"Expirée",T=v!=null&&v.referral_code?`espritsud.es/carte-privilege?ref=${v.referral_code}`:"",M=()=>{navigator.clipboard.writeText(T),ee.success("Lien copié !")},R=async()=>
887{if(!(v!=null&&v.stripe_customer_id)){ee.error("Contactez-nous pour gérer votre abonnement : [email protected]");return}f(!0);try{const O=await LXe({customer_id:v.stripe_customer_id,return_url:window.location.origin+"/carte-privilege/mon-espace"});window.location.href=O}catch(O){ee.error((O==null?void 0:O.message)||"Impossible d'ouvrir le portail Stripe."),f(!1)}};if(m)return a.jsx("div",{className:"container py-20 text-center text-muted-foreground",children:"Chargement..."});if(!v)return a.jsx("div",{className:"container py-16 md:py-24",children:a.jsxs("div",{className:"mx-auto max-w-2xl rounded-2xl border border-border bg-card p-8 md:p-12 text-center shadow-sm",children:[a.jsx("div",{className:"mx-auto flex h-20 w-20 items-center justify-center rounded-full bg-primary/10",children:a.jsx(Jo,{className:"h-10 w-10 text-primary"})}),a.jsx("h1",{className:"mt-6 font-heading text-2xl font-bold md:text-3xl",children:"Vous n'avez pas encore de Carte Privilège"}),a.jsx("p",{className:"mt-3 text-muted-foreground",children:"Souscrivez à la Carte Privilège Esprit Sud et profitez de réductions exclusives chez plus de 200 partenaires en Andalousie : restaurants, hôtels, activités, golf, services et bien plus."}),a.jsxs("div",{className:"mt-8 flex flex-col items-center gap-3 sm:flex-row sm:justify-center",children:[a.jsx(H,{asChild:!0,size:"lg",className:"rounded-xl",children:a.jsx(_e,{to:"/carte-privilege#tarifs",children:"S'abonner maintenant"})}),a.jsx(H,{asChild:!0,size:"lg",variant:"outline",className:"rounded-xl",children:a.jsx(_e,{to:"/carte-privilege",children:"Découvrir les avantages"})})]}),a.jsx("p",{className:"mt-6 text-xs text-muted-foreground",children:"Déjà abonné ? Vérifiez que vous êtes connecté avec le bon compte ou contactez-nous à [email protected]."})]})});const A=(e==null?void 0:e.full_name)||`${(e==null?void 0:e.first_name)||""} ${(e==null?void 0:e.last_name)||""}`.trim()||t.email||"",I=v.valid_until?new Date(v.valid_until).toLocaleDateString("fr-FR",{day:"numeric",month:"long",year:"numeric"}):"â",D=v.subscribed_at?new Date(v.subscribed_at).toLocaleDateString("fr-FR",{day:"numeric",month:"long",year:"numeric"}):"â";return a.jsxs("div",{className:"container py-8 md:py-14",children:[a.jsx("h1",{className:"font-heading text-3xl font-bold md:text-4xl text-center",children:"Mon espace Carte Privilège"}),a.jsx("section",{className:"mt-8",children:x?a.jsxs("div",{className:"grid gap-8 md:grid-cols-2",children:[a.jsx(xC,{fullName:A,cardNumber:v.card_number,validUntil:v.valid_until,avatarUrl:u??(e==null?void 0:e.avatar_url)??null,userId:t.id,referralCode:v.referral_code,onAvatarUpdate:O=>d(O),label:"Ma carte"}),a.jsxs("div",{className:"flex flex-col items-center",children:[a.jsx(xC,{fullName:x.companion_name||"Accompagnant",cardNumber:x.card_number,validUntil:x.valid_until,avatarUrl:w,userId:t.id,companionBadge:!0,label:"Carte accompagnant",onCustomUpload:j,onAvatarUpdate:O=>_(O)}),a.jsx(H,{size:"sm",variant:"ghost",className:"mt-2 text-xs",onClick:()=>{const O=window.prompt("Nom de l'accompagnant",x.companion_name||"");O&&N(O)},children:"Modifier le nom"})]})]}):a.jsx(xC,{fullName:A,cardNumber:v.card_number,validUntil:v.valid_until,avatarUrl:u??(e==null?void 0:e.avatar_url)??null,userId:t.id,referralCode:v.referral_code,onAvatarUpdate:O=>d(O)})}),a.jsxs("section",{className:"mt-10",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("h2",{className:"font-heading text-xl font-bold",children:"Mon abonnement"}),g&&a.jsx(ke,{className:"bg-purple-600 text-white",children:"Formule Couple"})]}),g&&a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Vos 2 cartes donnent accès aux mêmes avantages."}),a.jsxs("div",{className:"mt-4 rounded-xl border border-border bg-card p-6",children:[a.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground",children:"Date de souscription"}),a.jsx("div",{className:"mt-0.5 font-medium",children:D})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground",children:"Date d'expiration"}),a.jsx("div",{className:"mt-0.5 font-medium",children:I})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground",children:"Statut"}),a.jsx(ke,{className:`mt-0.5 ${E} border-0 text-white`,children:P}),k>0&&k<=30&&a.jsxs("p",{className:"mt-1 text-xs text-orange-600",children:[k," jours restants"]})]})]}),a.jsxs("div",{className:"mt-6 flex flex-wrap gap-3",children:[a.jsx(H,{variant:"outline",onClick:R,disabled:h,children:h?a.jsxs(a.Fragment,{children:[a.jsx(Je,{className:"mr-2 h-4 w-4 animate-spin"})," Redirection vers Stripeâ¦"]}):"Gérer mon abonnement"}),a.jsxs(ro,{children:[a.jsx(U3,{asChild:!0,children:a.jsxs(H,{variant:"ghost",className:"text-destructive hover:text-destructive",children:[a.jsx(F_,{className:"mr-2 h-4 w-4"})," Résilier"]})}),a.jsxs(ja,{children:[a.jsxs(Sa,{children:[a.jsx(Ca,{children:"Résilier votre Carte Privilège ?"}),a.jsxs(ka,{children:["Votre carte restera active jusqu'au ",I,". Après cette date, vous perdrez l'accès aux réductions partenaires."]})]}),a.jsxs(Na,{children:[a.jsx(Ea,{children:"Annuler"}),a.jsx(Aa,{onClick:()=>ee.info("La résiliation Stripe sera bientôt disponible."),children:"Confirmer la résiliation"})]})]})]})]})]})]}),a.jsxs("section",{className:"mt-10",children:[a.jsx("h2",{className:"font-heading text-xl font-bold",children:"Mon parrainage"}),a.jsxs("div",{className:"mt-4 rounded-xl border border-border bg-card p-6",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Partagez votre lien et recevez une réduction sur votre prochain renouvellement pour chaque filleul qui souscrit."}),T&&a.jsxs("div",{className:"mt-4 flex items-center gap-2",children:[a.jsx(ue,{readOnly:!0,value:T,className:"h-9 bg-muted font-mono text-xs"}),a.jsxs(H,{size:"sm",variant:"outline",onClick:M,children:[a.jsx(Pl,{className:"mr-1 h-3.5 w-3.5"})," Copier"]})]}),a.jsxs("div",{className:"mt-4 flex gap-6",children:[a.jsxs("div",{children:[a.jsx("div",{className:"font-heading text-2xl font-bold text-primary",children:(C==null?void 0:C.count)||0}),a.jsx("div",{className:"text-xs text-muted-foreground",children:"Filleuls"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"font-heading text-2xl font-bold text-green-600",children:[((C==null?void 0:C.totalReward)||0).toFixed(2).replace(".",",")," â¬"]}),a.jsx("div",{className:"text-xs text-muted-foreground",children:"Réduction accumulée"})]})]})]})]}),a.jsx("section",{className:"mt-10",children:a.jsxs("div",{className:"rounded-xl border border-border bg-card p-6 md:p-8 text-center",children:[a.jsx("h2",{className:"font-heading text-xl font-bold md:text-2xl",children:"Mes avantages"}),a.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Retrouvez la liste complète de nos partenaires et de vos réductions exclusives."}),a.jsx(H,{asChild:!0,size:"lg",className:"mt-5 rounded-xl",children:a.jsx(_e,{to:"/carte-privilege#partenaires",children:"Voir les partenaires"})})]})})]})},pJe=()=>{const t=new Date(Date.now()+2592e7).toISOString(),e=new Date().toLocaleDateString("fr-FR",{day:"numeric",month:"long",year:"numeric"}),n=new Date(t).toLocaleDateString("fr-FR",{day:"numeric",month:"long",year:"numeric"});return a.jsxs("div",{className:"container py-8 md:py-14",children:[a.jsx("div",{className:"mb-6 rounded-lg border border-dashed border-primary/40 bg-primary/5 p-3 text-center text-xs text-primary",children:"Aperçu de démonstration â données fictives, aucun accès requis."}),a.jsx("h1",{className:"text-center font-heading text-3xl font-bold md:text-4xl",children:"Mon espace Carte Privilège"}),a.jsx("section",{className:"mt-8",children:a.jsxs("div",{className:"grid gap-8 md:grid-cols-2",children:[a.jsx(xC,{fullName:"Maud Maluenda",cardNumber:"ESM-2026-000123",validUntil:t,avatarUrl:null,userId:"preview-u
887ser",referralCode:"MAUD2026",label:"Ma carte",readOnly:!0}),a.jsx("div",{className:"flex flex-col items-center",children:a.jsx(xC,{fullName:"Julien Maluenda",cardNumber:"ESM-2026-000124",validUntil:t,avatarUrl:null,userId:"preview-user",companionBadge:!0,label:"Carte accompagnant",readOnly:!0})})]})}),a.jsxs("section",{className:"mt-10",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("h2",{className:"font-heading text-xl font-bold",children:"Mon abonnement"}),a.jsx(ke,{className:"bg-purple-600 text-white",children:"Formule Couple"})]}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Vos 2 cartes donnent accès aux mêmes avantages."}),a.jsx("div",{className:"mt-4 rounded-xl border border-border bg-card p-6",children:a.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground",children:"Date de souscription"}),a.jsx("div",{className:"mt-0.5 font-medium",children:e})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground",children:"Date d'expiration"}),a.jsx("div",{className:"mt-0.5 font-medium",children:n})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground",children:"Statut"}),a.jsx(ke,{className:"mt-0.5 border-0 bg-green-500 text-white",children:"Active"})]})]})})]})]})};function eI(t){return t?typeof DOMParser<"u"?new DOMParser().parseFromString(t,"text/html").body.textContent||"":t.replace(/<[^>]+>/g,""):""}function o0e(t){const e=t.trim();return e?e.split(/\s+/).length:0}function mJe(t){return Math.max(1,Math.ceil(o0e(t)/200))}function K_(t){if(!t)return[];const e=[],n=/<img[^>]+src=["']([^"']+)["']/gi;let r;for(;r=n.exec(t);)e.push(r[1]);return e}async function l0e(t,e){var n;try{const s=await(await fetch(t,{mode:"cors"})).blob(),i=URL.createObjectURL(s),o=document.createElement("a");o.href=i,o.download=e||((n=t.split("/").pop())==null?void 0:n.split("?")[0])||"image",document.body.appendChild(o),o.click(),o.remove(),setTimeout(()=>URL.revokeObjectURL(i),1e3)}catch{window.open(t,"_blank","noopener")}}async function c0e(t,e=""){var n;for(let r=0;r<t.length;r++){const s=t[r],i=`${e}${e?"-":""}${String(r+1).padStart(2,"0")}-${((n=s.split("/").pop())==null?void 0:n.split("?")[0])||"image"}`;await l0e(s,i),await new Promise(o=>setTimeout(o,400))}}function R8(t){var n;if((n=navigator.clipboard)!=null&&n.writeText)return navigator.clipboard.writeText(t);const e=document.createElement("textarea");return e.value=t,e.style.position="fixed",e.style.left="-9999px",document.body.appendChild(e),e.select(),document.execCommand("copy"),e.remove(),Promise.resolve()}function O8(t){const e=[];return t.title&&e.push(t.title.toUpperCase()),t.author_name&&e.push(`Par ${t.author_name}`),e.push(""),t.excerpt&&(e.push(t.excerpt),e.push("")),t.content&&e.push(eI(t.content)),e.join(` 888`)}const gJe={planning:"Planification",in_progress:"En cours",review:"Relecture",ready_for_print:"Bon à tirer",printing:"Impression",distributed:"Distribué"},vJe={planning:"bg-gray-200 text-gray-800",in_progress:"bg-blue-100 text-blue-800",review:"bg-yellow-100 text-yellow-800",ready_for_print:"bg-orange-100 text-orange-800",printing:"bg-purple-100 text-purple-800",distributed:"bg-green-100 text-green-800"},u0e={draft:"Brouillon",review:"En relecture",validated:"Validé",published:"Publié",archived:"Archivé"},d0e={draft:"bg-gray-200 text-gray-800",review:"bg-yellow-100 text-yellow-800",validated:"bg-green-100 text-green-800",published:"bg-blue-100 text-blue-800",archived:"bg-red-100 text-red-800"},I8={article:"Article",ad:"Publicité",editorial:"Ãditorial",toc:"Sommaire",cover:"Couverture",blank:"Vide"},ete={article:"bg-blue-100 border-blue-300",ad:"bg-orange-100 border-orange-300",editorial:"bg-green-100 border-green-300",toc:"bg-purple-100 border-purple-300",cover:"bg-pink-100 border-pink-300",blank:"bg-gray-50 border-gray-200"};function v7(t){const r=(t||"").replace(/<[^>]*>/g," ").replace(/ /g," ").replace(/\s+/g," ").trim().split(" ").filter(i=>i.length>0).length;return Math.max(1,Math.ceil(r/200))}const v5=20,xJe=()=>{var S;const[t,e]=Zg(),{lang:n}=Uu(),r=n==="en",s=t.get("categorie")||"",i=t.get("tag")||"",[o,l]=b.useState(s),[c,u]=b.useState(""),[d,h]=b.useState("recent"),[f,p]=b.useState(0),{data:m}=Ne({queryKey:["categories"],queryFn:async()=>{try{const{data:C,error:k}=await Z.from("categories").select("id, name, slug").order("name");if(k)throw console.error("Error fetching categories:",k),k;return C??[]}catch(C){return console.error("Categories fetch failed:",C),[]}}}),v=o?(S=m==null?void 0:m.find(C=>
888C.slug===o))==null?void 0:S.id:null,{data:x,isLoading:g}=Ne({queryKey:["articles",o,v,c,d,f],enabled:!o||!!v,queryFn:async()=>{try{let C=Z.from("articles").select("*, categories(name, slug), profiles(full_name, avatar_url)",{count:"exact"}).eq("status","published");v&&(C=C.eq("category_id",v)),c&&(C=C.textSearch("search_vector",c)),C=d==="popular"?C.order("views_count",{ascending:!1}):C.order("published_at",{ascending:!1}),C=C.range(f*v5,(f+1)*v5-1);const{data:k,error:E,count:P}=await C;if(E)throw console.error("Error fetching articles:",E),E;return{articles:k??[],total:P??0}}catch(C){return console.error("Articles fetch failed:",C),{articles:[],total:0}}}}),w=(x==null?void 0:x.articles)??[],_=(x==null?void 0:x.total)??0,j=Math.ceil(_/v5),N=C=>{l(C),p(0),e(C?{categorie:C}:{})};return a.jsxs("div",{className:"container py-10 md:py-16",children:[a.jsx(Fn,{title:"Actualités | Esprit Sud Magazine",description:"Toute l'actualité de l'Andalousie en français : culture, art de vivre, événements, gastronomie.",path:"/actualites"}),a.jsx("h1",{className:"font-heading text-3xl font-bold md:text-4xl",children:"L'actualité"}),a.jsxs("div",{className:"mt-8 flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[a.jsxs("div",{className:"flex flex-wrap gap-2",children:[a.jsx(H,{variant:o?"outline":"default",size:"sm",className:"rounded-full",onClick:()=>N(""),children:"Toutes"}),m==null?void 0:m.map(C=>a.jsx(H,{variant:o===C.slug?"default":"outline",size:"sm",className:"rounded-full",onClick:()=>N(C.slug),children:C.name},C.id))]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("div",{className:"relative",children:[a.jsx(is,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(ue,{placeholder:"Rechercher...",value:c,onChange:C=>{u(C.target.value),p(0)},className:"h-9 w-48 pl-9"})]}),a.jsxs(lt,{value:d,onValueChange:C=>{h(C),p(0)},children:[a.jsx(nt,{className:"h-9 w-36",children:a.jsx(ct,{})}),a.jsxs(rt,{children:[a.jsx(Ae,{value:"recent",children:"Plus récents"}),a.jsx(Ae,{value:"popular",children:"Plus lus"})]})]})]})]}),g?a.jsx("div",{className:"mt-8 grid gap-6 sm:grid-cols-2 lg:grid-cols-3",children:Array.from({length:6}).map((C,k)=>a.jsxs("div",{className:"space-y-3",children:[a.jsx(Xt,{className:"aspect-[16/9] w-full rounded-lg"}),a.jsx(Xt,{className:"h-4 w-3/4"}),a.jsx(Xt,{className:"h-4 w-1/2"})]},k))}):a.jsx("div",{className:"mt-8 grid gap-6 sm:grid-cols-2 lg:grid-cols-3",children:w.map(C=>{var P,T;const k=r&&C.title_en||C.title,E=r&&C.excerpt_en||C.excerpt;return a.jsxs(_e,{to:`/actualites/${C.slug}`,className:"group overflow-hidden rounded-lg border border-border bg-card transition-shadow hover:shadow-lg",children:[a.jsxs("div",{className:"relative aspect-[16/9] overflow-hidden",children:[C.cover_image_url&&a.jsx("img",{src:C.cover_image_url,alt:k,loading:"lazy",className:"h-full w-full object-cover transition-transform duration-300 group-hover:scale-105"}),a.jsxs("div",{className:"absolute left-3 top-3 flex gap-1.5",children:[((P=C.categories)==null?void 0:P.name)&&a.jsx(ke,{className:"text-xs",children:C.categories.name}),C.is_sponsored&&a.jsx(ke,{variant:"outline",className:"bg-background/80 text-xs",children:"Sponsorisé"})]})]}),a.jsxs("div",{className:"p-5",children:[a.jsx("h2",{className:"mb-2 line-clamp-2 font-heading text-lg font-semibold leading-snug",children:k}),a.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[a.jsx("span",{children:C.author_name??((T=C.profiles)==null?void 0:T.full_name)??"Rédaction Esprit Sud"}),a.jsx("span",{children:"·"}),a.jsx("span",{children:jc(C.published_at)}),a.jsx("span",{children:"·"}),a.jsxs("span",{children:[v7(C.content)," min de lecture"]})]}),a.jsx("p",{className:"line-clamp-2 text-sm text-muted-foreground",children:E})]})]},C.id)})}),j>1&&a.jsxs("div",{className:"mt-10 flex items-center justify-center gap-3",children:[a.jsx(H,{variant:"outline",size:"sm",disabled:f===0,onClick:()=>p(f-1),children:"Page précédente"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:["Page ",f+1," / ",j]}),a.jsx(H,{variant:"outline",size:"sm",disabled:f>=j-1,onClick:()=>p(f+1),children:"Page suivante"})]})]})};function yJe(){const t=window.innerWidth,e=navigator.userAgent;return/iPad|Tablet/i.test(e)||t>=768&&t<1024&&"ontouchstart"in window?"tablet":/Mobi|Android|iPhone/i.test(e)||t<768?"mobile":"desktop"}const x5="article-tts-active";function bJe(){const t=window.speechSynthesis.getVoices();return t.find(e=>e.lang==="fr-FR")||t.find(e=>e.lang==="fr-ES")||t.find(e=>e.lang.toLowerCase().startsWith("fr"))}function wJe({html:t,containerSelector:e,articleId:n,articleTitle:r}){const s=typeof window<"u"&&"speechSynthesis"in window,[i,o]=b.useState("idle"),[l,c]=b.useState(0),u=b.useRef(0),d=b.useRef([]),h=b.useRef(1),f=b.useRef(0),p=b.useRef(!1),m=v7(t),v=b.useRef(0),x=b.useRef(null),g=b.useRef(0),w=()=>{const T=x.current?Date.now()-x.current:0;return Math.round((v.current+T)/1e3)},_=()=>{x.current&&(v.current+=Date.now()-x.current),x.current=null},j=T=>{const M=T==="play"?0:w(),R=T==="complete"?100:T==="play"?0:Math.round(g.current);Z.from("article_audio_stats").insert({article_id:n??null,article_title:(r==null?void 0:r.slice(0,500))??null,event:T,listen_duration_seconds:M,article_duration_seconds:m*60,completion_percent:Math.max(0,Math.min(100,R)),device_type:yJe()}).then(()=>{},()=>{})},N=()=>document.querySelectorAll(`.${x5}`).forEach(T=>T.classList.remove(x5)),S=(T="stop")=>{T&&(x.current!==null||v.current>0)&&(_(),j(T)),v.current=0,x.current=null,g.current=0,p.current=!0,window.speechSynthesis.cancel(),N(),u.current=0,f.current=0,c(0),o("idle")};b.useEffect(()=>{if(s)return window.speechSynthesis.getVoices(),()=>{p.current=!0,window.speechSynthesis.cancel(),N()}},[s,t]);const C=T=>{const M=d.current;if(T>=M.length){g.current=100,S("complete");return}u.current=T;const R=M[T],A=(R.textContent||"").replace(/\s+/g," ").trim();N(),R.classList.add(x5);const I=R.getBoundingClientRect();(I.top<80||I.bottom>window.innerHeight-80)&&R.scrollIntoView({behavior:"smooth",block:"center"});const D=new SpeechSynthesisUtterance(A),O=bJe();O&&(D.voice=O),D.lang="fr-FR",D.rate=.95,D.pitch=1,D.volume=1,D.onboundary=z=>{const B=Math.min(100,(f.current+z.charIndex)/h.current*100);g.current=B,c(B)},D.onend=()=>
888{if(p.current)return;f.current+=A.length;const z=Math.min(100,f.current/h.current*100);g.current=z,c(z),C(T+1)},D.onerror=()=>{p.current||C(T+1)},window.speechSynthesis.speak(D)},k=()=>{const T=window.speechSynthesis;if(i==="paused"){T.resume(),x.current=Date.now(),o("playing");return}const M=document.querySelector(e),R=M?Array.from(M.querySelectorAll("p, h2, h3, h4, li, blockquote")).filter(A=>{var I;return(A.textContent||"").trim().length>1&&!((I=A.parentElement)!=null&&I.closest("li, blockquote"))}):[];R.length&&(d.current=R,h.current=Math.max(1,R.reduce((A,I)=>A+(I.textContent||"").replace(/\s+/g," ").trim().length,0)),f.current=0,p.current=!1,T.cancel(),v.current=0,g.current=0,x.current=Date.now(),j("play"),o("playing"),C(0))},E=()=>{window.speechSynthesis.pause(),_(),j("pause"),o("paused")};if(!s)return null;const P=i==="playing"?a.jsxs("button",{type:"button",onClick:E,className:"inline-flex items-center gap-1.5 rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:opacity-90","aria-label":"Mettre en pause",children:[a.jsx(qQ,{className:"h-4 w-4"})," Pause"]}):a.jsxs("button",{type:"button",onClick:k,className:"inline-flex items-center gap-1.5 rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:opacity-90","aria-label":i==="paused"?"Reprendre la lecture":"Lire l'article",children:[a.jsx(Y6,{className:"h-4 w-4"})," ",i==="paused"?"Reprendre":"Lire"]});return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"my-6 w-full rounded-xl border border-gold bg-cream px-4 py-3",children:[a.jsxs("div",{className:"mb-2 flex items-center gap-2 text-sm font-medium text-foreground",children:[a.jsx(K6,{className:"h-4 w-4 text-gold"})," Ãcouter cet article"]}),a.jsxs("div",{className:"flex items-center gap-3",children:[P,a.jsx("div",{className:"h-1.5 flex-1 overflow-hidden rounded-full bg-muted",role:"progressbar","aria-valuenow":Math.round(l),"aria-valuemin":0,"aria-valuemax":100,children:a.jsx("div",{className:"h-full rounded-full bg-gold transition-all duration-300",style:{width:`${l}%`}})}),a.jsxs("span",{className:"whitespace-nowrap text-sm text-muted-foreground",children:[m," min"]}),i!=="idle"?a.jsx("button",{type:"button",onClick:()=>S("stop"),className:"inline-flex h-9 w-9 items-center justify-center rounded-full border border-border text-foreground hover:bg-muted","aria-label":"Arrêter la lecture",children:a.jsx(VQ,{className:"h-4 w-4"})}):a.jsx(E5e,{className:"h-4 w-4 text-gold","aria-hidden":"true"})]})]}),i!=="idle"&&a.jsxs("div",{className:"fixed inset-x-0 bottom-0 z-50 flex h-14 items-center gap-3 border-t border-border bg-card px-4 shadow-lg md:hidden",children:[a.jsx("button",{type:"button",onClick:i==="playing"?E:k,className:"inline-flex h-10 w-10 items-center justify-center rounded-full bg-primary text-primary-foreground","aria-label":i==="playing"?"Mettre en pause":"Reprendre la lecture",children:i==="playing"?a.jsx(qQ,{className:"h-4 w-4"}):a.jsx(Y6,{className:"h-4 w-4"})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex items-center gap-1.5 text-sm font-medium text-foreground",children:[a.jsx(K6,{className:"h-4 w-4 text-gold"})," Ãcouter cet article"]}),a.jsx("div",{className:"mt-1 h-1 overflow-hidden rounded-full bg-muted",children:a.jsx("div",{className:"h-full bg-gold transition-all duration-300",style:{width:`${l}%`}})})]}),a.jsx("button",{type:"button",onClick:()=>S("stop"),className:"inline-flex h-10 w-10 items-center justify-center rounded-full border border-border text-foreground","aria-label":"Arrêter la lecture",children:a.jsx(VQ,{className:"h-4 w-4"})})]})]})}function _Je({categoryId:t,hideAdsense:e=!1}){return a.jsx("aside",{className:"hidden xl:block xl:w-[300px] shrink-0",children:a.jsxs("div",{className:"sticky top-24 space-y-6",children:[a.jsx(q_,{placement:"sidebar",categoryId:t,vertical:!0,hideAdsense:e}),a.jsx(q_,{placement:"sidebar",categoryId:t,vertical:!0,hideAdsense:e})]})})}function jJe({containerRef:t,categoryId:e,hideAdsense:n=!1}){const r=b.useRef(null),s=b.useRef(null);return b.useEffect(()=>{if(!t.current)return;const i=t.current.querySelectorAll("p");
888if(i.length<4)return;const o=i[2],l=document.createElement("div");return l.className="my-8",o.insertAdjacentElement("afterend",l),s.current=l,r.current=hW(l),r.current.render(a.jsx(q_,{placement:"article_middle",categoryId:e,hideAdsense:n})),()=>{setTimeout(()=>{var c,u;(c=r.current)==null||c.unmount(),(u=s.current)==null||u.remove()},0)}},[t,e,n]),null}const fn=b.forwardRef(({className:t,...e},n)=>a.jsx("textarea",{className:Fe("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",t),ref:n,...e}));fn.displayName="Textarea";var h0e={exports:{}},f0e={};/** 889 * @license React 890 * use-sync-external-store-shim.production.js 891 * 892 * Copyright (c) Meta Platforms, Inc. and affiliates. 893 * 894 * This source code is licensed under the MIT license found in the 895 * LICENSE file in the root directory of this source tree. 896 */var G_=b;function SJe(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var NJe=typeof Object.is=="function"?Object.is:SJe,CJe=G_.useState,kJe=G_.useEffect,AJe=G_.useLayoutEffect,EJe=G_.useDebugValue;function TJe(t,e){var n=e(),r=CJe({inst:{value:n,getSnapshot:e}}),s=r[0].inst,i=r[1];return AJe(function(){s.value=n,s.getSnapshot=e,y5(s)&&i({inst:s})},[t,n,e]),kJe(function(){return y5(s)&&i({inst:s}),t(function(){y5(s)&&i({inst:s})})},[t]),EJe(n),n}function y5(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!NJe(t,n)}catch{return!0}}function PJe(t,e){return e()}var MJe=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?PJe:TJe;f0e.useSyncExternalStore=G_.useSyncExternalStore!==void 0?G_.useSyncExternalStore:MJe;h0e.exports=f0e;var q3=h0e.exports;function RJe(){return q3.useSyncExternalStore(OJe,()=>!0,()=>!1)}function OJe(){return()=>{}}var x7="Avatar",[IJe,FLt]=Ys(x7),[DJe,p0e]=IJe(x7),m0e=b.forwardRef((t,e)=>{const{__scopeAvatar:n,...r}=t,[s,i]=b.useState("idle");return a.jsx(DJe,{scope:n,imageLoadingStatus:s,onImageLoadingStatusChange:i,children:a.jsx(et.span,{...r,ref:e})})});m0e.displayName=x7;var g0e="AvatarImage",v0e=b.forwardRef((t,e)=>{const{__scopeAvatar:n,src:r,onLoadingStatusChange:s=()=>{},...i}=t,o=p0e(g0e,n),l=LJe(r,i),c=ho(u=>{s(u),o.onImageLoadingStatusChange(u)});return ys(()=>{l!=="idle"&&c(l)},[l,c]),l==="loaded"?a.jsx(et.img,{...i,ref:e,src:r}):null});v0e.displayName=g0e;var x0e="AvatarFallback",y0e=b.forwardRef((t,e)=>{const{__scopeAvatar:n,delayMs:r,...s}=t,i=p0e(x0e,n),[o,l]=b.useState(r===void 0);return b.useEffect(()=>{if(r!==void 0){const c=window.setTimeout(()=>l(!0),r);return()=>window.clearTimeout(c)}},[r]),o&&i.imageLoadingStatus!=="loaded"?a.jsx(et.span,{...s,ref:e}):null});y0e.displayName=x0e;function tte(t,e){return t?e?(t.src!==e&&(t.src=e),t.complete&&t.naturalWidth>0?"loaded":"loading"):"error":"idle"}function LJe(t,{referrerPolicy:e,crossOrigin:n}){const r=RJe(),s=b.useRef(null),i=r?(s.current||(s.current=new window.Image),s.current):null,[o,l]=b.useState(()=>tte(i,t));return ys(()=>{l(tte(i,t))},[i,t]),ys(()=>{const c=h=>()=>{l(h)};if(!i)return;const u=c("loaded"),d=c("error");return i.addEventListener("load",u),i.addEventListener("error",d),e&&(i.referrerPolicy=e),typeof n=="string"&&(i.crossOrigin=n),()=>{i.removeEventListener("load",u),i.removeEventListener("error",d)}},[i,n,e]),o}var b0e=m0e,w0e=v0e,_0e=y0e;const V3=b.forwardRef(({className:t,...e},n)=>a.jsx(b0e,{ref:n,className:Fe("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...e}));V3.displayName=b0e.displayName;const H3=b.forwardRef(({className:t,...e},n)=>a.jsx(w0e,{ref:n,className:Fe("aspect-square h-full w-full",t),...e}));H3.displayName=w0e.displayName;const W3=b.forwardRef(({className:t,...e},n)=>a.jsx(_0e,{ref:n,className:Fe("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...e}));W3.displayName=_0e.displayName;const yC=Z,FJe=t=>{const e=(Date.now()-new Date(t).getTime())/1e3;return e<60?"Ã l'instant":e<3600?`il y a ${Math.floor(e/60)} min`:e<86400?`il y a ${Math.floor(e/3600)} h`:e<604800?`il y a ${Math.floor(e/86400)} j`:new Date(t).toLocaleDateString("fr-FR",{day:"numeric",month:"long",year:"numeric"})},$Je=t=>
896(t||"?").split(" ").filter(Boolean).slice(0,2).map(e=>{var n;return((n=e[0])==null?void 0:n.toUpperCase())||""}).join("")||"?",j0e=({comment:t,replies:e,articleId:n,onReplyPosted:r,user:s,depth:i=0})=>{var x,g,w,_;const[o,l]=b.useState(!1),[c,u]=b.useState(""),[d,h]=b.useState(!1),[f,p]=b.useState(t.is_flagged),m=async()=>{if(!c.trim()||!s)return;h(!0);const{error:j}=await yC.from("comments").insert({article_id:n,user_id:s.id,parent_id:t.id,content:c.trim()});if(h(!1),j){ee.error("Erreur lors de la publication.");return}u(""),l(!1),r()},v=async()=>{if(f)return;const{error:j}=await yC.from("comments").update({is_flagged:!0}).eq("id",t.id);if(j){ee.error("Erreur lors du signalement.");return}p(!0),ee.success("Commentaire signalé. Merci !")};return a.jsxs("div",{className:i>0?"ml-8 mt-4 border-l-2 border-border pl-4":"mt-6",children:[a.jsxs("div",{className:"flex gap-3",children:[a.jsxs(V3,{className:"h-10 w-10 shrink-0",children:[((x=t.author)==null?void 0:x.avatar_url)&&a.jsx(H3,{src:t.author.avatar_url,alt:((g=t.author)==null?void 0:g.full_name)||""}),a.jsx(W3,{children:$Je((w=t.author)==null?void 0:w.full_name)})]}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-baseline gap-2",children:[a.jsx("span",{className:"font-medium text-sm",children:((_=t.author)==null?void 0:_.full_name)||"Anonyme"}),a.jsx("span",{className:"text-xs text-muted-foreground",children:FJe(t.created_at)})]}),a.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap break-words",children:t.content}),a.jsxs("div",{className:"mt-2 flex items-center gap-3",children:[s&&i===0&&a.jsxs("button",{type:"button",onClick:()=>l(j=>!j),className:"inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-primary",children:[a.jsx(h5e,{className:"h-3 w-3"})," Répondre"]}),a.jsxs("button",{type:"button",onClick:v,disabled:f,className:"inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-destructive disabled:opacity-50",children:[a.jsx(B$e,{className:"h-3 w-3"})," ",f?"Signalé":"Signaler"]})]}),o&&a.jsxs("div",{className:"mt-3 space-y-2",children:[a.jsx(fn,{value:c,onChange:j=>u(j.target.value),placeholder:"Votre réponseâ¦",maxLength:2e3,rows:3}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx(H,{size:"sm",variant:"ghost",onClick:()=>l(!1),children:"Annuler"}),a.jsxs(H,{size:"sm",onClick:m,disabled:d||!c.trim(),children:[d&&a.jsx(Je,{className:"mr-1.5 h-3 w-3 animate-spin"})," Publier"]})]})]})]})]}),e.map(j=>a.jsx(j0e,{comment:j,replies:[],articleId:n,onReplyPosted:r,user:s,depth:i+1},j.id))]})};function zJe({articleId:t}){const{user:e}=Ji(),n=St(),[r,s]=b.useState(""),{data:i=[],isLoading:o}=Ne({queryKey:["article_comments",t],queryFn:async()=>{const{data:h,error:f}=await yC.from("comments").select("*").eq("article_id",t).eq("is_approved",!0).order("created_at",{ascending:!1});if(f)throw f;const p=h||[],m=[...new Set(p.map(g=>g.user_id))];if(m.length===0)return p;const{data:v}=await yC.from("profiles").select("id, full_name, avatar_url").in("id",m),x=new Map((v||[]).map(g=>[g.id,g]));return p.map(g=>({...g,author:x.get(g.user_id)||null}))}}),l=Qe({mutationFn:async()=>{if(!e||!r.trim())throw new Error("Vide");const{error:h}=await yC.from("comments").insert({article_id:t,user_id:e.id,parent_id:null,content:r.trim()});if(h)throw h},onSuccess:()=>{s(""),n.invalidateQueries({queryKey:["article_comments",t]}),ee.success("Commentaire envoyé ! Il sera visible après validation.")},onError:()=>ee.error("Erreur lors de la publication.")}),c=i.filter(h=>!h.parent_id),u=h=>i.filter(f=>f.parent_id===h).sort((f,p)=>+new Date(f.created_at)-+new Date(p.created_at)),d=()=>n.invalidateQueries({queryKey:["article_comments",t]});return a.jsxs("section",{className:"border-t border-border pt-8",children:[a.jsxs("h2",{className:"flex items-center gap-2 font-heading text-xl font-bold",children:[a.jsx(t3,{className:"h-5 w-5"}),"Commentaires (",i.length,")"]}),e?a.jsxs("div",{className:"mt-4 space-y-2",children:[a.jsx(fn,{value:r,onChange:h=>s(h.target.value),placeholder:"Partagez votre avisâ¦",maxLength:2e3,rows:4}),a.jsx("div",{className:"flex justify-end",children:a.jsxs(H,{onClick:()=>l.mutate(),disabled:l.isPending||!r.trim(),children:[l.isPending&&a.jsx(Je,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Publier"]})})]}):a.jsxs("p",{className:"mt-4 rounded-lg border border-border bg-muted/30 p-4 text-sm text-muted-foreground",children:[a.jsx(_e,{to:"/login",className:"font-medium text-primary hover:underline",children:"Connectez-vous"})," pour commenter."]}),o?a.jsx("p",{className:"mt-6 text-sm text-muted-foreground",children:"Chargementâ¦"}):c.length===0?a.jsx("p",{className:"mt-6 text-sm text-muted-foreground",children:"Soyez le premier à commenter."}):a.jsx("div",{className:"mt-2",children:c.map(h=>a.jsx(j0e,{comment:h,replies:u(h.id),articleId:t,onReplyPosted:d,user:e},h.id))})]})}/*! @license DOMPurify 3.4.12 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.12/LICENSE */function nte(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function BJe(t){if(Array.isArray(t))return t}function UJe(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,u=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}
vendor: 6,722 bytes, lines 896-897
896finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function qJe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 897In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function VJe(t,e){return BJe(t)||UJe(t,e)||HJe(t,e)||qJe()}function HJe(t,e){if(t){if(typeof t=="string")return nte(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?nte(t,e):void 0}}const S0e=Object.entries,rte=Object.setPrototypeOf,WJe=Object.isFrozen,KJe=Object.getPrototypeOf,GJe=Object.getOwnPropertyDescriptor;let Bi=Object.freeze,Yi=Object.seal,Eb=Object.create,N0e=typeof Reflect<"u"&&Reflect,D8=N0e.apply,L8=N0e.construct;Bi||(Bi=function(e){return e});Yi||(Yi=function(e){return e});D8||(D8=function(e,n){for(var r=arguments.length,s=new Array(r>2?r-2:0),i=2;i<r;i++)s[i-2]=arguments[i];return e.apply(n,s)});L8||(L8=function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return new e(...r)});const ob=Ps(Array.prototype.forEach),YJe=Ps(Array.prototype.lastIndexOf),ste=Ps(Array.prototype.pop),lb=Ps(Array.prototype.push),XJe=Ps(Array.prototype.splice),em=Array.isArray,cN=Ps(String.prototype.toLowerCase),b5=Ps(String.prototype.toString),ite=Ps(String.prototype.match),SS=Ps(String.prototype.replace),ate=Ps(String.prototype.indexOf),JJe=Ps(String.prototype.trim),QJe=Ps(Number.prototype.toString),ZJe=Ps(Boolean.prototype.toString),ote=typeof BigInt>"u"?null:Ps(BigInt.prototype.toString),lte=typeof Symbol>"u"?null:Ps(Symbol.prototype.toString),ti=Ps(Object.prototype.hasOwnProperty),NS=Ps(Object.prototype.toString),ei=Ps(RegExp.prototype.test),yv=eQe(TypeError);function Ps(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return D8(t,e,r)}}function eQe(t){return function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return L8(t,n)}}function pn(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:cN;if(rte&&rte(t,null),!em(e))return t;let r=e.length;for(;r--;){let s=e[r];if(typeof s=="string"){const i=n(s);i!==s&&(WJe(e)||(e[r]=i),s=i)}t[s]=!0}return t}function tQe(t){for(let e=0;e<t.length;e++)ti(t,e)||(t[e]=null);return t}function Wa(t){const e=Eb(null);for(const r of S0e(t)){var n=VJe(r,2);const s=n[0],i=n[1];ti(t,s)&&(em(i)?e[s]=tQe(i):i&&typeof i=="object"&&i.constructor===Object?e[s]=Wa(i):e[s]=i)}return e}function nQe(t){switch(typeof t){case"string":return t;case"number":return QJe(t);case"boolean":return ZJe(t);case"bigint":return ote?ote(t):"0";case"symbol":return lte?lte(t):"Symbol()";case"undefined":return NS(t);case"function":case"object":{if(t===null)return NS(t);const e=t,n=rd(e,"toString");if(typeof n=="function"){const r=n(e);return typeof r=="string"?r:NS(r)}return NS(t)}default:return NS(t)}}function rd(t,e){for(;t!==null;){const r=GJe(t,e);if(r){if(r.get)return Ps(r.get);if(typeof r.value=="function")return Ps(r.value)}t=KJe(t)}function n(){return null}return n}function rQe(t){try{return ei(t,""),!0}catch{return!1}}const cte=Bi(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),w5=Bi(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),_5=Bi(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),sQe=Bi(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),j5=Bi(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),iQe=Bi(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ute=Bi(["#text"]),dte=Bi(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","
897spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),S5=Bi(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),hte=Bi(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),iP=Bi(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),aQe=Yi(/{{[\w\W]*|^[\w\W]*}}/g),oQe=Yi(/<%[\w\W]*|^[\w\W]*%>/g),lQe=Yi(/\${[\w\W]*/g),cQe=Yi(/^data-[\-\w.\u00B7-\uFFFF]+$/),uQe=Yi(/^aria-[\-\w]+$/),fte=Yi(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),dQe=Yi(/^(?:\w+script|data):/i),hQe=Yi(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),fQe=Yi(/^html$/i),pQe=Yi(/^[a-z][.\w]*(-[.\w]+)+$/i),pte=Yi(/<[/\w!]/g),mte=Yi(/<[/\w]/g),mQe=Yi(/<\/no(script|embed|frames)/i),gQe=Yi(/\/>/i),el={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},vQe=function(){return typeof window>"u"?null:window},xQe=function(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null;
vendor: 4,129 bytes, line 897
897const s="data-tt-policy-suffix";n&&n.hasAttribute(s)&&(r=n.getAttribute(s));const i="dompurify"+(r?"#"+r:"");try{return e.createPolicy(i,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},gte=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Ap=function(e,n,r,s){return ti(e,n)&&em(e[n])?pn(s.base?Wa(s.base):{},e[n],s.transform):r};function C0e(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:vQe();const e=Ue=>C0e(Ue);if(e.version="3.4.12",e.removed=[],!t||!t.document||t.document.nodeType!==el.document||!t.Element)return e.isSupported=!1,e;let n=t.document;const r=n,s=r.currentScript;t.DocumentFragment;const i=t.HTMLTemplateElement,o=t.Node,l=t.Element,c=t.NodeFilter,u=t.NamedNodeMap;u===void 0&&(t.NamedNodeMap||t.MozNamedAttrMap),t.HTMLFormElement;const d=t.DOMParser,h=t.trustedTypes,f=l.prototype,p=rd(f,"cloneNode"),m=rd(f,"remove"),v=rd(f,"nextSibling"),x=rd(f,"childNodes"),g=rd(f,"parentNode"),w=rd(f,"shadowRoot"),_=rd(f,"attributes"),j=o&&o.prototype?rd(o.prototype,"nodeType"):null,N=o&&o.prototype?rd(o.prototype,"nodeName"):null;if(typeof i=="function"){const Ue=n.createElement("template");Ue.content&&Ue.content.ownerDocument&&(n=Ue.content.ownerDocument)}let S,C="",k,E=!1,P=0;const T=function(){if(P>0)throw yv('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},M=function(ie){T(),P++;try{return S.createHTML(ie)}finally{P--}},R=function(ie){T(),P++;try{return S.createScriptURL(ie)}finally{P--}},A=function(){return E||(k=xQe(h,s),E=!0),k},I=n,D=I.implementation,O=I.createNodeIterator,z=I.createDocumentFragment,B=I.getElementsByTagName,G=r.importNode;let U=gte();e.isSupported=typeof S0e=="function"&&typeof g=="function"&&D&&D.createHTMLDocument!==void 0;const F=aQe,W=oQe,Q=lQe,K=cQe,fe=uQe,oe=dQe,ye=hQe,le=pQe;let me=fte,he=null;const ae=pn({},[...cte,...w5,..._5,...j5,...ute]);let re=null;const L=pn({},[...dte,...S5,...hte,...iP]);let X=Object.seal(Eb(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ne=null,Y=null;const J=Object.seal(Eb(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let se=!0,ge=!0,de=!1,ce=!0,xe=!1,je=!0,be=!1,Ee=!1,Me=null,Oe=null,st=!1,Ye=!1,gt=!1,At=!1,yt=!0,Qt=!1;const nr="user-content-";let wn=!0,Si=!1,it={},pe=null;const Pe=pn({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Ze=null;const qe=pn({},["audio","video","img","source","image","track"]);let Ve=null;const bt=pn({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Be="http://www.w3.org/1998/Math/MathML",Nt="http://www.w3.org/2000/svg",Xe="http://www.w3.org/1999/xhtml";let Ft=Xe,Zt=!1,Sr=null;const Ur=pn({},[Be,Nt,Xe],b5),cs=Bi(["mi","mo","mn","ms","mtext"]);let Os=pn({},cs);const K0=Bi(["annotation-xml"]);let OF=pn({},K0);const TPe=pn({},["title","style","font","a","script"]);let aS=null;const PPe=["application/xhtml+xml","text/html"],MPe="text/html";let Pr=null,G0=null;const RPe=n.createElement("form"),rX=function(ie){return ie instanceof RegExp||ie instanceof Function},IF=function(){let ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(G0&&G0===ie)return;(!ie||typeof ie!="object")&&(ie={}
vendor: 5,482 bytes, line 897
897),ie=Wa(ie),aS=PPe.indexOf(ie.PARSER_MEDIA_TYPE)===-1?MPe:ie.PARSER_MEDIA_TYPE,Pr=aS==="application/xhtml+xml"?b5:cN,he=Ap(ie,"ALLOWED_TAGS",ae,{transform:Pr}),re=Ap(ie,"ALLOWED_ATTR",L,{transform:Pr}),Sr=Ap(ie,"ALLOWED_NAMESPACES",Ur,{transform:b5}),Ve=Ap(ie,"ADD_URI_SAFE_ATTR",bt,{transform:Pr,base:bt}),Ze=Ap(ie,"ADD_DATA_URI_TAGS",qe,{transform:Pr,base:qe}),pe=Ap(ie,"FORBID_CONTENTS",Pe,{transform:Pr}),ne=Ap(ie,"FORBID_TAGS",Wa({}),{transform:Pr}),Y=Ap(ie,"FORBID_ATTR",Wa({}),{transform:Pr}),it=ti(ie,"USE_PROFILES")?ie.USE_PROFILES&&typeof ie.USE_PROFILES=="object"?Wa(ie.USE_PROFILES):ie.USE_PROFILES:!1,se=ie.ALLOW_ARIA_ATTR!==!1,ge=ie.ALLOW_DATA_ATTR!==!1,de=ie.ALLOW_UNKNOWN_PROTOCOLS||!1,ce=ie.ALLOW_SELF_CLOSE_IN_ATTR!==!1,xe=ie.SAFE_FOR_TEMPLATES||!1,je=ie.SAFE_FOR_XML!==!1,be=ie.WHOLE_DOCUMENT||!1,Ye=ie.RETURN_DOM||!1,gt=ie.RETURN_DOM_FRAGMENT||!1,At=ie.RETURN_TRUSTED_TYPE||!1,st=ie.FORCE_BODY||!1,yt=ie.SANITIZE_DOM!==!1,Qt=ie.SANITIZE_NAMED_PROPS||!1,wn=ie.KEEP_CONTENT!==!1,Si=ie.IN_PLACE||!1,me=rQe(ie.ALLOWED_URI_REGEXP)?ie.ALLOWED_URI_REGEXP:fte,Ft=typeof ie.NAMESPACE=="string"?ie.NAMESPACE:Xe,Os=ti(ie,"MATHML_TEXT_INTEGRATION_POINTS")&&ie.MATHML_TEXT_INTEGRATION_POINTS&&typeof ie.MATHML_TEXT_INTEGRATION_POINTS=="object"?Wa(ie.MATHML_TEXT_INTEGRATION_POINTS):pn({},cs),OF=ti(ie,"HTML_INTEGRATION_POINTS")&&ie.HTML_INTEGRATION_POINTS&&typeof ie.HTML_INTEGRATION_POINTS=="object"?Wa(ie.HTML_INTEGRATION_POINTS):pn({},K0);const Se=ti(ie,"CUSTOM_ELEMENT_HANDLING")&&ie.CUSTOM_ELEMENT_HANDLING&&typeof ie.CUSTOM_ELEMENT_HANDLING=="object"?Wa(ie.CUSTOM_ELEMENT_HANDLING):Eb(null);if(X=Eb(null),ti(Se,"tagNameCheck")&&rX(Se.tagNameCheck)&&(X.tagNameCheck=Se.tagNameCheck),ti(Se,"attributeNameCheck")&&rX(Se.attributeNameCheck)&&(X.attributeNameCheck=Se.attributeNameCheck),ti(Se,"allowCustomizedBuiltInElements")&&typeof Se.allowCustomizedBuiltInElements=="boolean"&&(X.allowCustomizedBuiltInElements=Se.allowCustomizedBuiltInElements),Yi(X),xe&&(ge=!1),gt&&(Ye=!0),it&&(he=pn({},ute),re=Eb(null),it.html===!0&&(pn(he,cte),pn(re,dte)),it.svg===!0&&(pn(he,w5),pn(re,S5),pn(re,iP)),it.svgFilters===!0&&(pn(he,_5),pn(re,S5),pn(re,iP)),it.mathMl===!0&&(pn(he,j5),pn(re,hte),pn(re,iP))),J.tagCheck=null,J.attributeCheck=null,ti(ie,"ADD_TAGS")&&(typeof ie.ADD_TAGS=="function"?J.tagCheck=ie.ADD_TAGS:em(ie.ADD_TAGS)&&(he===ae&&(he=Wa(he)),pn(he,ie.ADD_TAGS,Pr))),ti(ie,"ADD_ATTR")&&(typeof ie.ADD_ATTR=="function"?J.attributeCheck=ie.ADD_ATTR:em(ie.ADD_ATTR)&&(re===L&&(re=Wa(re)),pn(re,ie.ADD_ATTR,Pr))),ti(ie,"ADD_URI_SAFE_ATTR")&&em(ie.ADD_URI_SAFE_ATTR)&&pn(Ve,ie.ADD_URI_SAFE_ATTR,Pr),ti(ie,"FORBID_CONTENTS")&&em(ie.FORBID_CONTENTS)&&(pe===Pe&&(pe=Wa(pe)),pn(pe,ie.FORBID_CONTENTS,Pr)),ti(ie,"ADD_FORBID_CONTENTS")&&em(ie.ADD_FORBID_CONTENTS)&&(pe===Pe&&(pe=Wa(pe)),pn(pe,ie.ADD_FORBID_CONTENTS,Pr)),wn&&(he["#text"]=!0),be&&pn(he,["html","head","body"]),he.table&&(pn(he,["tbody"]),delete ne.tbody),ie.TRUSTED_TYPES_POLICY){if(typeof ie.TRUSTED_TYPES_POLICY.createHTML!="function")throw yv('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof ie.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw yv('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const Re=S;S=ie.TRUSTED_TYPES_POLICY;try{C=M("")}catch(vt){throw S=Re,vt}}else ie.TRUSTED_TYPES_POLICY===null?(S=void 0,C=""):(S===void 0&&(S=A()),S&&typeof C=="string"&&(C=M("")));Bi&&Bi(ie),G0=ie},sX=pn({},[...w5,..._5,...sQe]),iX=pn({},[...j5,...iQe]),OPe=function(ie,Se,Re){return Se.namespaceURI===Xe?ie==="svg":Se.namespaceURI===Be?ie==="svg"&&(Re==="annotation-xml"||Os[Re]):!!sX[ie]},IPe=function(ie,Se,Re){return Se.namespaceURI===Xe?ie==="math":Se.namespaceURI===Nt?ie==="math"&&OF[Re]:!!iX[ie]},DPe=function(ie,Se,Re){return Se.namespaceURI===Nt&&!OF[Re]||Se.namespaceURI===Be&&!Os[Re]?!1:!iX[ie]&&(TPe[ie]||!sX[ie])},LPe=function(ie){let Se=g(ie);(!Se||!Se.tagName)&&(Se={namespaceURI:Ft,tagName:"template"});const Re=cN(ie.tagName),vt=cN(Se.tagName);return Sr[ie.namespaceURI]?ie.namespaceURI===Nt?OPe(Re,Se,vt):ie.namespaceURI===Be?IPe(Re,Se,vt):ie.namespaceURI===Xe?DPe(Re,Se,vt):!!(aS==="application/xhtml+xml"&&Sr[ie.namespaceURI]):!1},jp=function(ie){lb(e.removed,{element:ie});try{g(ie).removeChild(ie)}catch{if(m(ie),!g(ie))throw yv("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},dT=function(ie){DF(ie);const Se=x(ie);if(Se){const vt=[];ob(Se,Rt=>{lb(vt,Rt)}),ob(vt,Rt=>{try{m(Rt)}catch{}})}const Re=_(ie);if(Re)for(let vt=Re.length-1;vt>=0;--vt){const Rt=Re[vt],zt=Rt&&Rt.name;if(typeof zt=="string")try{ie.removeAttribute(zt)}catch{}}},pv=function(ie,Se){try{lb(e.removed,{attribute:Se.getAttributeNode(ie),from:Se})}catch{lb(e.removed,{attribute:null,from:Se})}if(Se.removeAttribute(ie),ie==="is")if(Ye||gt)try{jp(Se)}catch{}else try{Se.setAttribute(ie,"")}catch{}},FPe=function(ie){const Se=_(ie);if(Se)for(let Re=Se.length-1;Re>=0;--Re){const vt=Se[Re],Rt=vt&&vt.name;if(!(typeof Rt!="string"||re[Pr(Rt)]))try{ie.removeAttribute(Rt)}catch{}}},DF=function(ie){const Se=[ie];for(;Se.length>0;){const Re=Se.pop();(j?j(Re):Re.nodeType)===el.element&&FPe(Re);const Rt=x(Re);if(Rt)for(let zt=Rt.length-1;zt>=0;--zt)Se.push(Rt[zt])}},$Pe=function(ie){if(!je)return;const Se=[ie];for(;Se.length>0;){const Re=Se.pop(),vt=j?j(Re):Re.nodeType;if(vt===el.processingInstruction||vt===el.comment&&ei(mte,Re.data)){try{m(Re)}catch{}continue}
897if(vt===el.element){const zt=Re,qr=Pr(N?N(Re):Re.nodeName);try{zt.hasAttribute&&zt.hasAttribute("patchsrc")&&zt.removeAttribute("patchsrc"),zt.hasAttribute&&zt.hasAttribute("for")&&qr!=="label"&&qr!=="output"&&zt.removeAttribute("for")}catch{}}const Rt=x(Re);if(Rt)for(let zt=Rt.length-1;zt>=0;--zt)Se.push(Rt[zt])}},aX=function(ie){let Se=null,Re=null;if(st)ie="<remove></remove>"+ie;else{const zt=ite(ie,/^[\r\n\t ]+/);Re=zt&&zt[0]}aS==="application/xhtml+xml"&&Ft===Xe&&(ie='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+ie+"</body></html>");const vt=S?M(ie):ie;if(Ft===Xe)try{Se=new d().parseFromString(vt,aS)}catch{}if(!Se||!Se.documentElement){Se=D.createDocument(Ft,"template",null);try{Se.documentElement.innerHTML=Zt?C:vt}catch{}}const Rt=Se.body||Se.documentElement;return ie&&Re&&Rt.insertBefore(n.createTextNode(Re),Rt.childNodes[0]||null),Ft===Xe?B.call(Se,be?"html":"body")[0]:be?Se.documentElement:Rt},oX=function(ie){return O.call(ie.ownerDocument||ie,ie,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},hT=function(ie){return ie=SS(ie,F," "),ie=SS(ie,W," "),ie=SS(ie,Q," "),ie},LF=function(ie){var Se;ie.normalize();const Re=O.call(ie.ownerDocument||ie,ie,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null);let vt=Re.nextNode();for(;vt;)vt.data=hT(vt.data),vt=Re.nextNode();const Rt=(Se=ie.querySelectorAll)===null||Se===void 0?void 0:Se.call(ie,"template");Rt&&ob(Rt,zt=>{Y0(zt.content)&&LF(zt.content)})},fT=function(ie){const Se=N?N(ie):null;return typeof Se!="string"||Pr(Se)!=="form"?!1:typeof ie.nodeName!="string"||typeof ie.textContent!="string"||typeof ie.removeChild!="function"||ie.attributes!==_(ie)||typeof ie.removeAttribute!="function"||typeof ie.setAttribute!="function"||typeof ie.namespaceURI!="string"||typeof ie.insertBefore!="function"||typeof ie.hasChildNodes!="function"||ie.nodeType!==j(ie)||ie.childNodes!==x(ie)},Y0=function(ie){if(!j||typeof ie!="object"||ie===null)return!1;try{return j(ie)===el.documentFragment}catch{return!1}},oS=function(ie){if(!j||typeof ie!="object"||ie===null)return!1;try{return typeof j(ie)=="number"}catch{return!1}};function Yu(Ue,ie,Se){Ue.length!==0&&ob(Ue,Re=>{Re.call(e,ie,Se,G0)})}const zPe=function(ie,Se){return!!(je&&ie.hasChildNodes()&&!oS(ie.firstElementChild)&&ei(pte,ie.textContent)&&ei(pte,ie.innerHTML)||je&&ie.namespaceURI===Xe&&Se==="style"&&oS(ie.firstElementChild)||ie.nodeType===el.processingInstruction||je&&ie.nodeType===el.comment&&ei(mte,ie.data))},BPe=function(ie,Se){if(!ne[Se]&&uX(Se)&&(X.tagNameCheck instanceof RegExp&&ei(X.tagNameCheck,Se)||X.tagNameCheck instanceof Function&&X.tagNameCheck(Se)))return!1;if(wn&&!pe[Se]){const Re=g(ie),vt=x(ie);if(vt&&Re){const Rt=vt.length;for(let zt=Rt-1;zt>=0;--zt){const qr=Si?vt[zt]:p(vt[zt],!0);Re.insertBefore(qr,v(ie))}}}return jp(ie),!0},lX=function(ie,Se){if(Yu(U.beforeSanitizeElements,ie,null),ie!==Se&&g(ie)===null)return!0;if(fT(ie))return jp(ie),!0;const Re=Pr(N?N(ie):ie.nodeName);if(Yu(U.uponSanitizeElement,ie,{tagName:Re,allowedTags:he}),ie!==Se&&g(ie)===null)return!0;if(zPe(ie,Re))return jp(ie),!0;if(ne[Re]||!(J.tagCheck instanceof Function&&J.tagCheck(Re))&&!he[Re]){const Rt=BPe(ie,Re);return Rt===!1&&Yu(U.afterSanitizeElements,ie,null),Rt}if((j?j(ie):ie.nodeType)===el.element&&!LPe(ie)||(Re==="noscript"||Re==="noembed"||Re==="noframes")&&ei(mQe,ie.innerHTML))return jp(ie),!0;if(xe&&ie.nodeType===el.text){const Rt=hT(ie.textContent);ie.textContent!==Rt&&(lb(e.removed,{element:ie.cloneNode()}),ie.textContent=Rt)}return Yu(U.afterSanitizeElements,ie,null),!1},cX=function(ie,Se,Re){if(Y[Se]||je&&Se==="patchsrc"||je&&Se==="for"&&ie!=="label"&&ie!=="output"||yt&&(Se==="id"||Se==="name")&&(Re in n||Re in RPe))return!1;const vt=re[Se]||J.attributeCheck instanceof Function&&J.attributeCheck(Se,ie);if(!(ge&&ei(K,Se))){if(!(se&&ei(fe,Se))){if(vt){if(!Ve[Se]){if(!ei(me,SS(Re,ye,""))){if(!((Se==="src"||Se==="xlink:href"||Se==="href")&&ie!=="script"&&ate(Re,"data:")===0&&Ze[ie])){if(!(de&&!ei(oe,SS(Re,ye,"")))){if(Re)return!1}}}}}else if(!(uX(ie)&&(X.tagNameCheck instanceof RegExp&&ei(X.tagNameCheck,ie)||X.tagNameCheck instanceof Function&&X.tagNameCheck(ie))&&(X.attributeNameCheck instanceof RegExp&&ei(X.attributeNameCheck,Se)||X.attributeNameCheck instanceof Function&&X.attributeNameCheck(Se,ie))||Se==="is"&&X.allowCustomizedBuiltInElements&&(X.tagNameCheck instanceof RegExp&&ei(X.tagNameCheck,Re)||X.tagNameCheck instanceof Function&&X.tagNameCheck(Re))))return!1}}return!0},UPe=pn({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),uX=function(ie){return!UPe[cN(ie)]&&ei(le,
897ie)},qPe=function(ie,Se,Re,vt){if(S&&typeof h=="object"&&typeof h.getAttributeType=="function"&&!Re)switch(h.getAttributeType(ie,Se)){case"TrustedHTML":return M(vt);case"TrustedScriptURL":return R(vt)}return vt},VPe=function(ie,Se,Re,vt){try{Re?ie.setAttributeNS(Re,Se,vt):ie.setAttribute(Se,vt),fT(ie)?jp(ie):ste(e.removed)}catch{pv(Se,ie)}},dX=function(ie){Yu(U.beforeSanitizeAttributes,ie,null);const Se=ie.attributes;if(!Se||fT(ie))return;const Re={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:re,forceKeepAttr:void 0};let vt=Se.length;const Rt=Pr(ie.nodeName);for(;vt--;){const zt=Se[vt],qr=zt.name,Zi=zt.namespaceURI,Bc=zt.value,wo=Pr(qr),Uc=Bc;let Ua=qr==="value"?Uc:JJe(Uc);if(Re.attrName=wo,Re.attrValue=Ua,Re.keepAttr=!0,Re.forceKeepAttr=void 0,Yu(U.uponSanitizeAttribute,ie,Re),Ua=Re.attrValue,Qt&&(wo==="id"||wo==="name")&&ate(Ua,nr)!==0&&(pv(qr,ie),Ua=nr+Ua),je&&ei(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Ua)){pv(qr,ie);continue}if(wo==="attributename"&&ite(Ua,"href")){pv(qr,ie);continue}if(!Re.forceKeepAttr){if(!Re.keepAttr){pv(qr,ie);continue}if(!ce&&ei(gQe,Ua)){pv(qr,ie);continue}if(xe&&(Ua=hT(Ua)),!cX(Rt,wo,Ua)){pv(qr,ie);continue}Ua=qPe(Rt,wo,Zi,Ua),Ua!==Uc&&VPe(ie,qr,Zi,Ua)}}Yu(U.afterSanitizeAttributes,ie,null)},pT=function(ie){let Se=null;const Re=oX(ie);for(Yu(U.beforeSanitizeShadowDOM,ie,null);Se=Re.nextNode();)if(Yu(U.uponSanitizeShadowNode,Se,null),lX(Se,ie),dX(Se),Y0(Se.content)&&pT(Se.content),(j?j(Se):Se.nodeType)===el.element){const Rt=w(Se);Y0(Rt)&&(FF(Rt),pT(Rt))}Yu(U.afterSanitizeShadowDOM,ie,null)},FF=function(ie){const Se=[{node:ie,shadow:null}];for(;Se.length>0;){const Re=Se.pop();if(Re.shadow){pT(Re.shadow);continue}const vt=Re.node,zt=(j?j(vt):vt.nodeType)===el.element,qr=x(vt);if(qr)for(let Zi=qr.length-1;Zi>=0;--Zi)Se.push({node:qr[Zi],shadow:null});if(zt){const Zi=N?N(vt):null;if(typeof Zi=="string"&&Pr(Zi)==="template"){const Bc=vt.content;Y0(Bc)&&Se.push({node:Bc,shadow:null})}}if(zt){const Zi=w(vt);Y0(Zi)&&Se.push({node:null,shadow:Zi},{node:Zi,shadow:null})}}};return e.sanitize=function(Ue){let ie=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Se=null,Re=null,vt=null,Rt=null;if(Zt=!Ue,Zt&&(Ue="<!-->"),typeof Ue!="string"&&!oS(Ue)&&(Ue=nQe(Ue),typeof Ue!="string"))throw yv("dirty is not a string, aborting");if(!e.isSupported)return Ue;Ee?(he=Me,re=Oe):IF(ie),(U.uponSanitizeElement.length>0||U.uponSanitizeAttribute.length>0)&&(he=Wa(he)),U.uponSanitizeAttribute.length>0&&(re=Wa(re)),e.removed=[];const zt=Si&&typeof Ue!="string"&&oS(Ue);if(zt){$Pe(Ue);const wo=N?N(Ue):Ue.nodeName;if(typeof wo=="string"){const Uc=Pr(wo);if(!he[Uc]||ne[Uc])throw dT(Ue),yv("root node is forbidden and cannot be sanitized in-place")}if(fT(Ue))throw dT(Ue),yv("root node is clobbered and cannot be sanitized in-place");try{FF(Ue)}catch(Uc){throw dT(Ue),Uc}}else if(oS(Ue))Se=aX("<!---->"),Re=Se.ownerDocument.importNode(Ue,!0),Re.nodeType===el.element&&Re.nodeName==="BODY"||Re.nodeName==="HTML"?Se=Re:Se.appendChild(Re),FF(Re);else{if(!Ye&&!xe&&!be&&Ue.indexOf("<")===-1)return S&&At?M(Ue):Ue;if(Se=aX(Ue),!Se)return Ye?null:At?C:""}Se&&st&&jp(Se.firstChild);const qr=zt?Ue:Se,Zi=oX(qr);try{for(;vt=Zi.nextNode();)lX(vt,qr),dX(vt),Y0(vt.content)&&pT(vt.content)}catch(wo){throw zt&&(dT(Ue),ob(e.removed,Uc=>{Uc.element&&DF(Uc.element)})),wo}if(zt)return ob(e.removed,wo=>{wo.element&&DF(wo.element)}),xe&&LF(Ue),Ue;if(Ye){if(xe&&LF(Se),gt)for(Rt=z.call(Se.ownerDocument);Se.firstChild;)Rt.appendChild(Se.firstChild);else Rt=Se;return(re.shadowroot||re.shadowrootmode)&&(Rt=G.call(r,Rt,!0)),Rt}let Bc=be?Se.outerHTML:Se.innerHTML;return be&&he["!doctype"]&&Se.ownerDocument&&Se.ownerDocument.doctype&&Se.ownerDocument.doctype.name&&ei(fQe,Se.ownerDocument.doctype.name)&&(Bc="<!DOCTYPE "+Se.ownerDocument.doctype.name+`> 898`+Bc),xe&&(Bc=hT(Bc)),S&&At?M(Bc):Bc},e.setConfig=function(){let Ue=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};IF(Ue),Ee=!0,Me=he,Oe=re},e.clearConfig=function(){G0=null,Ee=!1,Me=null,Oe=null,S=k,C=""},e.isValidAttribute=function(Ue,ie,Se){G0||IF({});const Re=Pr(Ue),vt=Pr(ie);return cX(Re,vt,Se)},e.addHook=function(Ue,ie){typeof ie=="function"&&ti(U,Ue)&&lb(U[Ue],ie)},e.removeHook=function(Ue,ie){if(ti(U,Ue)){if(ie!==void 0){const Se=YJe(U[Ue],ie);return Se===-1?void 0:XJe(U[Ue],Se,1)[0]}return ste(U[Ue])}},e.removeHooks=function(Ue){ti(U,Ue)&&(U[Ue]=[])},e.removeAllHooks=function(){U=gte()},e}var yQe=C0e();function a0(t){return t?yQe.sanitize(t,{ADD_TAGS:["iframe"],ADD_ATTR:["allow","allowfullscreen","frameborder","scrolling","target","rel","loading","referrerpolicy"],ALLOWED_URI_REGEXP:/^(?:(?:https?|mailto|tel):|[^a-z]|[a-z+.-]+(?:[^a-z+.\-:]|$))/i}):""}const bQe=()=>{var T,M,R,A,I;const{slug:t}=Xi(),e=Gs(),n=xo(),{redirects:r,loaded:s}=Ope(),{user:i}=Ji(),{toast:o}=QE(),l=St(),{data:c,isLoading:u}=Ne({queryKey:["article",t],queryFn:async()=>{try{const{data:D,error:O}=await Z.from("articles").select("*, categories(name, slug), profiles(full_name, avatar_url)").eq("slug",t).eq("status","published").maybeSingle();if(O)throw console.error("Error fetching article:",O),O;return D}catch(D){return console.error("Article fetch failed:",D),null}},enabled:!!t}),{lang:d}=Uu(),h=d==="en",f=b.useRef(!1),p=h&&!!(c!=null&&c.id)&&!(c!=null&&c.title_en);b.useEffect(()=>{!p||f.current||(f.current=!0,(async()=>{try{await Z.functions.invoke("translate-to-english",{body:{type:"article",id:c.id}}
898),l.invalidateQueries({queryKey:["article",t]})}catch(D){console.warn("[i18n] traduction de l'article échouée",D)}})())},[p,c==null?void 0:c.id,t,l]),b.useEffect(()=>{!(c!=null&&c.id)||!t||(async()=>{try{await Z.rpc("increment_views",{article_slug:t})}catch{await Z.from("articles").update({views_count:(c.views_count??0)+1}).eq("slug",t)}})()},[c==null?void 0:c.id,t]);const{data:m}=Ne({queryKey:["article-tags",c==null?void 0:c.id],queryFn:async()=>{try{const{data:D,error:O}=await Z.from("article_tags").select("tags(id, name, slug)").eq("article_id",c.id);return O&&console.error("Error fetching tags:",O),(D==null?void 0:D.map(z=>z.tags).filter(Boolean))??[]}catch(D){return console.error("Tags fetch failed:",D),[]}},enabled:!!(c!=null&&c.id)}),{data:v}=Ne({queryKey:["similar-articles",c==null?void 0:c.id],queryFn:async()=>{const{extractKeywords:D}=await Ac(async()=>{const{extractKeywords:F}=await Promise.resolve().then(()=>FCe);return{extractKeywords:F}},void 0),O="id, title, slug, cover_image_url, published_at, categories(name, slug)",z=new Set([c.id]),B=[],G=4,U=F=>{for(const W of F||[]){if(B.length>=G)break;z.has(W.id)||(z.add(W.id),B.push(W))}};try{const{data:F}=await Z.from("article_tags").select("tag_id").eq("article_id",c.id),W=(F||[]).map(Q=>Q.tag_id);if(W.length&&c.category_id){const{data:Q}=await Z.from("article_tags").select("article_id").in("tag_id",W),K=[...new Set((Q||[]).map(fe=>fe.article_id))].filter(fe=>fe!==c.id);if(K.length){const{data:fe}=await Z.from("articles").select(O).eq("status","published").eq("category_id",c.category_id).in("id",K).order("published_at",{ascending:!1}).limit(G);U(fe)}}}catch(F){console.error("Similar step 1 failed:",F)}if(B.length<G&&c.category_id){const{data:F}=await Z.from("articles").select(O).eq("status","published").eq("category_id",c.category_id).not("id","in",`(${[...z].join(",")})`).order("published_at",{ascending:!1}).limit(G-B.length);U(F)}if(B.length<G){const F=D(c.title||"").slice(0,5);if(F.length){const W=F.map(K=>`title.ilike.%${K}%`).join(","),{data:Q}=await Z.from("articles").select(O).eq("status","published").or(W).not("id","in",`(${[...z].join(",")})`).order("published_at",{ascending:!1}).limit(G-B.length);U(Q)}}if(B.length<G){const{data:F}=await Z.from("articles").select(O).eq("status","published").not("id","in",`(${[...z].join(",")})`).order("published_at",{ascending:!1}).limit(G-B.length);U(F)}return B},enabled:!!(c!=null&&c.id)}),{data:x}=Ne({queryKey:["favorite",c==null?void 0:c.id,i==null?void 0:i.id],queryFn:async()=>{try{const{count:D}=await Z.from("favorites").select("id",{count:"exact",head:!0}).eq("user_id",i.id).eq("article_id",c.id);return(D??0)>0}catch(D){return console.error("Favorite check failed:",D),!1}},enabled:!!(c!=null&&c.id)&&!!(i!=null&&i.id)}),g=Qe({mutationFn:async()=>{if(!i){window.location.href=`/login?redirect=/actualites/${t}`;return}x?await Z.from("favorites").delete().eq("user_id",i.id).eq("article_id",c.id):await Z.from("favorites").insert({user_id:i.id,article_id:c.id})},onSuccess:()=>l.invalidateQueries({queryKey:["favorite",c==null?void 0:c.id]})}),w=()=>{navigator.clipboard.writeText(window.location.href),o({title:"Lien copié !"})},_=encodeURIComponent(window.location.href),j=encodeURIComponent((c==null?void 0:c.title)??"");if(b.useEffect(()=>{if(u||c||!s)return;const D=n.pathname,O=r.get(D);if(O&&O.target_url&&O.target_url!==D){e(O.target_url,{replace:!0});return}Ac(async()=>{const{check404Redirect:z,log404:B}=await Promise.resolve().then(()=>Tnt);return{check404Redirect:z,log404:B}},void 0).then(({check404Redirect:z,log404:B})=>{z(D).then(G=>{G&&G!==D?e(G,{replace:!0}):B(D)})})},[u,c,s,r,n.pathname,e]),u||!c&&!s)return a.jsxs("div",{className:"container py-16",children:[a.jsx(Xt,{className:"h-[400px] w-full rounded-xl"}),a.jsx(Xt,{className:"mx-auto mt-8 h-8 w-2/3"}),a.jsx(Xt,{className:"mx-auto mt-4 h-4 w-1/3"})]});if(!c)return a.jsxs("div",{className:"container py-16 text-center",children:[a.jsx("h1",{className:"font-heading text-2xl font-bold",children:"Article introuvable"}),a.jsx(H,{variant:"ghost",size:"sm",asChild:!0,className:"mt-4",children:a.jsxs(_e,{to:"/actualites",children:[a.jsx(jr,{className:"mr-2 h-4 w-4"})," Retour aux actualités"]})})]});const N=c.author_name??((T=c.profiles)==null?void 0:T.full_name)??"Rédaction Esprit Sud",S=h&&c.title_en||c.title,C=h&&c.content_text_en||c.content,k=h&&c.excerpt_en||c.excerpt,E=h?c.seo_title_en||c.title_en||c.seo_title||c.title:c.seo_title||c.title,P=h?c.seo_de
898scription_en||c.excerpt_en||c.seo_description||c.excerpt||"":c.seo_description||c.excerpt||"";return a.jsxs("div",{children:[a.jsx(Fn,{title:E,description:P,path:`/actualites/${c.slug}`,image:c.cover_image_url,type:"article",jsonLd:[{"@context":"https://schema.org","@type":"NewsArticle",headline:S,description:k||P||"",image:c.cover_image_url?[c.cover_image_url]:void 0,datePublished:c.published_at,dateModified:c.updated_at||c.published_at,author:[{"@type":"Person",name:N}],publisher:{"@type":"Organization",name:"Esprit Sud Magazine",logo:{"@type":"ImageObject",url:"https://aanjkhoyzcvhokzsmifu.supabase.co/storage/v1/object/public/images/cmsphoto/[email protected]",width:600,height:60}},inLanguage:"fr",isAccessibleForFree:!0,articleSection:((M=c.categories)==null?void 0:M.name)||void 0,mainEntityOfPage:{"@type":"WebPage","@id":`https://espritsud.es/actualites/${c.slug}`}},...c.faq_jsonld?[c.faq_jsonld]:[]]}),a.jsxs(XE,{children:[a.jsx("meta",{name:"robots",content:"max-image-preview:large"}),m&&m.length>0&&a.jsx("meta",{name:"news_keywords",content:m.map(D=>D.name).join(", ")}),c.published_at&&a.jsx("meta",{property:"article:published_time",content:new Date(c.published_at).toISOString()}),(c.updated_at||c.published_at)&&a.jsx("meta",{property:"article:modified_time",content:new Date(c.updated_at||c.published_at).toISOString()}),((R=c.categories)==null?void 0:R.name)&&a.jsx("meta",{property:"article:section",content:c.categories.name}),a.jsx("meta",{property:"article:author",content:N})]}),c.cover_image_url&&a.jsxs("div",{className:"relative w-full bg-muted md:h-[50vh]",children:[a.jsx("img",{src:c.cover_image_url,alt:c.title,className:"h-auto w-full object-contain md:h-full md:object-cover"}),a.jsx("div",{className:"pointer-events-none absolute inset-0 hidden bg-gradient-to-t from-foreground
898/60 to-transparent md:block"})]}),a.jsx("div",{className:"container relative mt-6 md:-mt-20 z-10",children:a.jsxs("div",{className:"mx-auto flex max-w-[1400px] gap-8",children:[a.jsxs("div",{className:"mx-auto w-full min-w-0 max-w-3xl flex-1 rounded-t-2xl bg-card p-6 md:p-10 shadow-lg",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-3 mb-4",children:[((A=c.categories)==null?void 0:A.name)&&a.jsx(_e,{to:`/actualites?categorie=${c.categories.slug}`,children:a.jsx(ke,{children:c.categories.name})}),a.jsxs("span",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[a.jsx(t2,{className:"h-3.5 w-3.5"})," ",v7(c.content)," min de lecture"]}),a.jsxs("span",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[a.jsx(Aj,{className:"h-3.5 w-3.5"})," ",jc(c.published_at)]})]}),h&&!c.title_en&&a.jsx("div",{className:"mb-4 rounded-lg border border-border bg-muted/60 px-4 py-2 text-sm text-muted-foreground",children:"ð English translation loadingâ¦"}),a.jsx("h1",{className:"font-heading text-2xl font-bold leading-tight md:text-4xl",children:S}),a.jsxs("div",{className:"mt-3 flex items-center gap-3",children:[!c.author_name&&((I=c.profiles)==null?void 0:I.avatar_url)&&a.jsx("img",{src:c.profiles.avatar_url,alt:"",className:"h-8 w-8 rounded-full object-cover"}),a.jsxs("span",{className:"text-muted-foreground",children:["Par ",a.jsx("span",{className:"font-medium text-foreground",children:N})]})]}),c.is_sponsored&&c.sponsor_name&&a.jsx("div",{className:"mt-4 rounded-lg border-l-4 border-amber-500 bg-amber-50 px-4 py-3 text-sm",children:a.jsxs("strong",{children:["Cet article est réalisé en partenariat avec ",c.sponsor_name]})}),a.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[a.jsxs(H,{variant:"outline",size:"sm",onClick:()=>g.mutate(),children:[a.jsx(e3,{className:`mr-1.5 h-4 w-4 ${x?"fill-accent text-accent":""}`})," Favoris"]}),a.jsxs(H,{variant:"outline",size:"sm",onClick:w,children:[a.jsx(Pl,{className:"mr-1.5 h-4 w-4"})," Copier le lien"]}),a.jsx(H,{variant:"outline",size:"sm",asChild:!0,children:a.jsxs("a",{href:`https://wa.me/?text=${j}%20${_}`,target:"_blank",rel:"noopener noreferrer",children:[a.jsx(g5e,{className:"mr-1.5 h-4 w-4"})," WhatsApp"]})}),a.jsx(H,{variant:"outline",size:"sm",asChild:!0,children:a.jsxs("a",{href:`https://www.facebook.com/sharer/sharer.php?u=${_}`,target:"_blank",rel:"noopener noreferrer",children:[a.jsx(Gi,{className:"mr-1.5 h-4 w-4"})," Facebook"]})}),a.jsx(H,{variant:"outline",size:"sm",asChild:!0,children:a.jsxs("a",{href:`https://twitter.com/intent/tweet?url=${_}&text=${j}`,target:"_blank",rel:"noopener noreferrer",children:[a.jsx(Gi,{className:"mr-1.5 h-4 w-4"})," X"]})})]}),a.jsx(wJe,{html:C||"",containerSelector:"#article-body",articleId:c.id,articleTitle:c.title}),a.jsx("hr",{className:"my-6"}),a.jsx(q_,{placement:"article_top",categoryId:c.category_id,hideAdsense:!!c.disable_adsense,className:"mb-6"}),a.jsx(wQe,{html:C||"",categoryId:c.category_id,hideAdsense:!!c.disable_adsense}),a.jsx(q_,{placement:"article_bottom",categoryId:c.category_id,hideAdsense:!!c.disable_adsense,className:"mt-6"}),m&&m.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("hr",{className:"my-8"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:m.map(D=>a.jsx(_e,{to:`/actualites?tag=${D.slug}`,children:a.jsx(ke,{variant:"outline",children:D.name})},D.id))})]}),a.jsx("div",{className:"mt-8",children:a.jsx(H,{variant:"ghost",size:"sm",asChild:!0,children:a.jsxs(_e,{to:"/actualites",children:[a.jsx(jr,{className:"mr-2 h-4 w-4"})," Retour aux actualités"]})})})]}),a.jsx(_Je,{categoryId:c.category_id,hideAdsense:!!c.disable_adsense})]})}),a.jsx("div",{className:"container max-w-3xl pb-10",children:a.jsx(zJe,{articleId:c.id})}),v&&v.length>0&&a.jsxs("div",{className:"container py-10",children:[a.jsx("h2",{className:"font-heading text-xl font-bold mb-6",children:"Articles similaires"}),a.jsx("div",{className:"grid gap-4 grid-cols-2 lg:grid-cols-4",children:v.map(D=>a.jsxs(_e,{to:`/actualites/${D.slug}`,className:"group overflow-hidden rounded-lg border border-border bg-card",children:[a.jsx("div",{className:"aspect-[16/9] overflow-hidden",children:D.cover_image_url&&a.jsx("img",{src:D.cover_image_url,alt:D.title,loading:"lazy",className:"h-full w-full object-cover transition-transform duration-300 group-hover:scale-105"})}),a.jsxs("div",{className:"p-3",children:[a.jsx("h3",{className:"line-clamp-2 text-sm font-semibold",children:D.title}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:jc(D.published_at)})]})]},D.id))})]})]})};function wQe({html:t,categoryId:e,hideAdsense:n}){const r=b.useRef(null);return a.jsxs(a.Fragment,{children:[a.jsx("div",{ref:r,id:"article-body",className:"article-tts-body prose prose-lg max-w-none prose-headings:font-heading prose-img:rounded-xl text-left",dangerouslySetInnerHTML:{__html:a0(t)}}),a.jsx(jJe,{containerRef:r,categoryId:e,hideAdsense:n})]})}const _Qe=["Toutes","Malaga","Sevilla","Cadiz","Granada","Cordoba","Almeria","Huelva","Jaen"],jQe=()=>{const[t,e]=b.useState("Toutes"),{data:n,isLoading:r}=Ne({queryKey:["travel-guides",t],queryFn:async()=>{let s=Z.from("travel_guides").select("id, slug, city, province, cover_image_url, excerpt, guide_type").eq("is_active",!0).order("city");t!=="Toutes"&&(s=s.eq("province",t));const{data:i,error:o}=await s;if(o)throw o;return i??[]}});return a.jsxs("div",{className:"container py-10 md:py-16",children:[a.jsx(Fn,{title:"Destinations Andalousie | Guides de voyage Esprit Sud",description:"Explorez l'Andalousie avec nos guides de voyage : Séville, Grenade, Malaga, Cordoue et toutes les pépites andalouses.",path:"/destinations"}),a.jsx("h1",{className:"font-heading text-3xl font-bold md:text-4xl",children:"Destinations"}),a.jsx("p",{className:"mt-2 text-muted-foreground",children:"Explorez l'Andalousie avec Esprit Sud"}),a.jsx("div",{className:"mt-8 flex flex-wrap gap-2",children:_Qe.map(s=>a.jsx(H,{variant:t===s?"default":"outline",size:"sm",className:"rounded-full",onClick:()=>e(s),children:s==="Toutes"?"Toutes":s},s))}),r?a.jsx("div",{className:"mt-10 grid gap-6 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:Array.from({length:8}).map((s,i)=>a.jsx(Xt,{className:"h-72 rounded-xl"},i))}):a.jsx("div",{className:"mt-10 grid gap-6 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:n==null?void 0:n.map(s=>a.jsxs(_e,{to:`/destinations/${s.slug}`,className:"group relative block h-72 overflow-hidden rounded-xl",children:[s.cover_image_url?a.jsx("img",{src:s.cover_image_url,alt:s.city,loading:"lazy",className:"h-full w-full object-cover transition-transform duration-300 group-hover:scale-105"}):a.jsx("div",{className:"h-full w-full bg-muted"}),a.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-foreground
898/70 via-foreground/20 to-transparent"}),a.jsxs("div",{className:"absolute bottom-0 left-0 right-0 p-5",children:[a.jsxs("div",{className:"flex items-center gap-1.5 text-primary-foreground",children:[a.jsx(_r,{className:"h-4 w-4"}),a.jsx("h2",{className:"font-heading text-xl font-bold",children:s.city})]}),a.jsx("p",{className:"mt-1 text-sm text-primary-foreground/80",children:s.excerpt})]})]},s.id))})]})},SQe=()=>{const{slug:t}=Xi(),e=St(),{lang:n}=Uu(),r=n==="en",s=b.useRef(!1),i=g=>g.city,o=g=>r&&g.excerpt_en||g.excerpt,l=g=>r&&g.content_en||g.content,c=g=>r&&g.seo_title_en||g.seo_title,u=g=>r&&g.seo_description_en||g.seo_description,{data:d,isLoading:h}=Ne({queryKey:["travel-guide",t],queryFn:async()=>{const{data:g,error:w}=await Z.from("travel_guides").select("*").eq("slug",t).eq("is_active",!0).single();if(w)throw w;return g},enabled:!!t}),f=r&&!!(d!=null&&d.id)&&!d.city_en;b.useEffect(()=>{!f||s.current||(s.current=!0,(async()=>{try{await Z.functions.invoke("translate-to-english",{body:{type:"travel_guide",id:d.id}}),e.invalidateQueries({queryKey:["travel-guide",t]})}catch(g){console.warn("[i18n] traduction du guide échouée",g)}})())},[f,d==null?void 0:d.id,t,e]);const{data:p}=Ne({queryKey:["destination-partners",d==null?void 0:d.city],queryFn:async()=>{const{data:g}=await Z.from("partners").select("id, slug, name, name_en, city, category, category_en, short_description, short_description_en, images, is_carte_privilege, carte_discount_percent").eq("city",d.city).eq("is_active",!0).order("is_premium",{ascending:!1});return g??[]},enabled:!!(d!=null&&d.city)}),{data:m}=Ne({queryKey:["destination-articles",d==null?void 0:d.city],queryFn:async()=>{const{data:g}=await Z.from("articles").select("id, slug, title, cover_image_url, published_at").eq("status","published").order("published_at",{ascending:!1}).limit(4);return g??[]},enabled:!!(d!=null&&d.city)}),{data:v}=Ne({queryKey:["destination-events",d==null?void 0:d.city],queryFn:async()=>{const{data:g}=await Z.from("events").select("id, slug, title, title_en, event_type, date_start, city").eq("city",d.city).eq("is_active",!0).gte("date_start",new Date().toISOString()).order("date_start").limit(3);return g??[]},enabled:!!(d!=null&&d.city)}),{data:x}=Ne({queryKey:["similar-guides",d==null?void 0:d.id],queryFn:async()=>{const g="id, slug, city, province, guide_type, cover_image_url, excerpt, excerpt_en",w=new Set([d.id]),_=[],j=4,N=S=>{for(const C of S||[]){if(_.length>=j)break;w.has(C.id)||(w.add(C.id),_.push(C))}};if(d.province){const{data:S}=await Z.from("travel_guides").select(g).eq("is_active",!0).eq("province",d.province).neq("id",d.id).order("updated_at",{ascending:!1}).limit(j);N(S)}if(_.length<j&&d.guide_type){const{data:S}=await Z.from("travel_guides").select(g).eq("is_active",!0).eq("guide_type",d.guide_type).not("id","in",`(${[...w].join(",")})`).order("updated_at",{ascending:!1}).limit(j-_.length);N(S)}if(_.length<j){const{data:S}=await Z.from("travel_guides").select(g).eq("is_active",!0).not("id","in",`(${[...w].join(",")})`).order("updated_at",{ascending:!1}).limit(j-_.length);N(S)}return _},enabled:!!(d!=null&&d.id)});return h?a.jsx("div",{className:"container py-16",children:a.jsx(Xt,{className:"h-[50vh] w-full rounded-xl"})}):d?a.jsxs("div",{children:[a.jsx(Fn,{title:c(d)||`Guide de ${i(d)} | Esprit Sud`,description:u(d)||o(d)||`Découvrez ${i(d)} avec Esprit Sud Magazine.`,path:`/destinations/${d.slug}`,image:d.cover_image_url,type:"article",jsonLd:{"@context":"https://schema.org","@type":"TouristDestination",name:i(d),description:o(d)||u(d)||"",image:d.cover_image_url||void 0,touristType:"Francophone",containedInPlace:{"@type":"Place",name:`${d.province}, Andalousie, Espagne`}}}),a.jsxs("div",{className:"relative h-[40vh] md:h-[50vh]",children:[d.cover_image_url?a.jsx("img",{src:d.cover_image_url,alt:i(d),className:"h-full w-full object-cover"}):a.jsx("div",{className:"h-full w-full bg-muted"}),a.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-foreground
898/60 to-transparent"}),a.jsxs("div",{className:"container absolute bottom-0 left-0 right-0 pb-10",children:[a.jsxs("div",{className:"flex items-center gap-2 text-primary-foreground",children:[a.jsx(_r,{className:"h-5 w-5"}),a.jsx("h1",{className:"font-heading text-3xl font-bold md:text-5xl",children:i(d)})]}),a.jsxs("p",{className:"mt-2 text-lg text-primary-foreground/80",children:["Province de ",d.province,", Andalousie"]})]})]}),a.jsxs("div",{className:"container py-10 md:py-16",children:[a.jsx(H,{variant:"ghost",size:"sm",asChild:!0,className:"mb-8",children:a.jsxs(_e,{to:"/destinations",children:[a.jsx(jr,{className:"mr-2 h-4 w-4"})," Toutes les destinations"]})}),a.jsxs("div",{className:"mx-auto max-w-3xl",children:[a.jsx("div",{className:"prose prose-lg max-w-none prose-headings:font-heading prose-img:rounded-xl text-justify",dangerouslySetInnerHTML:{__html:a0(l(d)||"")}}),d.gallery&&d.gallery.length>0&&a.jsxs("div",{className:"mt-10",children:[a.jsx("h2",{className:"font-heading text-xl font-bold mb-4",children:"Photos"}),a.jsx("div",{className:"grid gap-3 grid-cols-2 md:grid-cols-3",children:d.gallery.map((g,w)=>a.jsx("img",{src:g,alt:`${i(d)} ${w+1}`,loading:"lazy",className:"rounded-lg object-cover aspect-[4/3] w-full"},w))})]})]}),p&&p.length>0&&a.jsxs("div",{className:"mt-16",children:[a.jsxs("h2",{className:"font-heading text-xl font-bold mb-6",children:["Nos partenaires à ",i(d)]}),a.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:p.map(g=>a.jsxs(_e,{to:`/carnet-adresses/${g.slug}`,className:"flex items-center justify-between rounded-lg border border-border bg-card p-4 hover:shadow-md transition-shadow",children:[a.jsxs("div",{children:[a.jsx("span",{className:"font-medium",children:r&&g.name_en||g.name}),a.jsx("div",{className:"flex items-center gap-2 mt-1",children:a.jsx(ke,{variant:"secondary",className:"text-xs",children:r&&g.category_en||g.category})})]}),g.is_carte_privilege&&g.carte_discount_percent>0&&a.jsxs(ke,{variant:"outline",className:"text-accent border-accent/30 font-semibold",children:["-",g.carte_discount_percent,"%"]})]},g.id))})]}),m&&m.length>0&&a.jsxs("div",{className:"mt-16",children:[a.jsxs("h2",{className:"font-heading text-xl font-bold mb-6",children:["Actualités sur ",i(d)]}),a.jsx("div",{className:"grid gap-4 grid-cols-2 lg:grid-cols-4",children:m.map(g=>a.jsxs(_e,{to:`/actualites/${g.slug}`,className:"group overflow-hidden rounded-lg border border-border bg-card",children:[a.jsx("div",{className:"aspect-[16/9] overflow-hidden",children:g.cover_image_url&&a.jsx("img",{src:g.cover_image_url,alt:r&&g.title_en||g.title,loading:"lazy",className:"h-full w-full object-cover transition-transform duration-300 group-hover:scale-105"})}),a.jsxs("div",{className:"p-3",children:[a.jsx("h3",{className:"line-clamp-2 text-sm font-semibold",children:r&&g.title_en||g.title}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:jc(g.published_at)})]})]},g.id))})]}),v&&v.length>0&&a.jsxs("div",{className:"mt-16",children:[a.jsx("h2",{className:"font-heading text-xl font-bold mb-6",children:"Ãvénements à venir"}),a.jsx("div",{className:"space-y-3",children:v.map(g=>a.jsxs(_e,{to:`/evenements/${g.slug}
898`,className:"flex items-center gap-4 rounded-lg border border-border bg-card p-4 hover:shadow-md transition-shadow",children:[a.jsxs("div",{className:"flex-shrink-0 text-center",children:[a.jsx("div",{className:"text-2xl font-bold text-primary",children:new Date(g.date_start).getDate()}),a.jsx("div",{className:"text-xs text-muted-foreground uppercase",children:new Date(g.date_start).toLocaleDateString("fr-FR",{month:"short"})})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold",children:r&&g.title_en||g.title}),a.jsxs("div",{className:"flex gap-2 mt-1",children:[a.jsx(ke,{variant:"secondary",className:"text-xs",children:g.event_type}),a.jsx("span",{className:"text-xs text-muted-foreground",children:g.city})]})]})]},g.id))})]}),x&&x.length>0&&a.jsxs("div",{className:"mt-16",children:[a.jsx("h2",{className:"font-heading text-xl font-bold mb-6",children:"Guides similaires"}),a.jsx("div",{className:"grid gap-4 grid-cols-2 lg:grid-cols-4",children:x.map(g=>a.jsxs(_e,{to:`/destinations/${g.slug}`,className:"group overflow-hidden rounded-lg border border-border bg-card",children:[a.jsx("div",{className:"aspect-[16/9] overflow-hidden bg-muted",children:g.cover_image_url&&a.jsx("img",{src:g.cover_image_url,alt:g.city_en||g.city,loading:"lazy",className:"h-full w-full object-cover transition-transform duration-300 group-hover:scale-105"})}),a.jsxs("div",{className:"p-3",children:[a.jsx("h3",{className:"line-clamp-2 text-sm font-semibold",children:g.city_en||g.city}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:g.province})]})]},g.id))})]})]})]}):a.jsxs("div",{className:"container py-16 text-center",children:[a.jsx("h1",{className:"font-heading text-2xl font-bold",children:"Destination introuvable"}),a.jsx(H,{variant:"ghost",size:"sm",asChild:!0,className:"mt-4",children:a.jsxs(_e,{to:"/destinations",children:[a.jsx(jr,{className:"mr-2 h-4 w-4"})," Toutes les destinations"]})})]})};async function NQe(){const{data:t}=await Mt.from("site_settings").select("value").eq("key","tfk_config").maybeSingle();return(t==null?void 0:t.value)??{enabled:!1,url:""}}function CQe(){return Ne({queryKey:["site_settings","tfk_config"],queryFn:NQe,staleTime:5*60*1e3})}function k0e(){const{data:t}=CQe(),e=!!(t!=null&&t.enabled&&(t!=null&&t.url));return Ne({queryKey:["tfk-partners",t==null?void 0:t.url],enabled:e,staleTime:15*60*1e3,queryFn:async()=>{const n=t.url;try{const{data:r,error:s}=await Mt.functions.invoke("proxy-tfk",{body:{url:n}});if(s)return[];const i=(r==null?void 0:r.partners)??[];return Array.isArray(i)?i:[]}catch{return[]}}})}const kQe=[{value:"all",label:"Choisir une catégorie"},{value:"immobilier",label:"Immobilier"},{value:"apprentissage_formation",label:"Apprentissage & Formation"},{value:"assurance",label:"Assurance"},{value:"conciergerie",label:"Conciergerie"},{value:"gestion",label:"Gestion"},{value:"maison_travaux",label:"Maison & Travaux"},{value:"mode_decoration",label:"Mode & Décoration"},{value:"photographie",label:"Photographie"},{value:"restaurant",label:"Restaurant"},{value:"sante_bien_etre",label:"Santé & Bien-être"},{value:"service",label:"Service"},{value:"transports",label:"Transports"},{value:"voyages_logement",label:"Voyages & Logement"},{value:"activite",label:"Activité"}],AQe="#FFC400",aP=t=>(t||"").toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g," ").trim(),EQe=()=>{const[t,e]=b.useState("all"),[n,r]=b.useState("all"),[s,i]=b.useState(!1),[o,l]=b.useState("all"),[c,u]=b.useState(""),{data:d,isLoading:h}=Ne({queryKey:["partners-directory-all"],queryFn:async()=>{const{data:w,error:_}=await Z.from("partners").select("id, slug, name, city, category, short_description, images, is_carte_privilege, carte_discount_percent, is_premium, is_active").eq("is_active",!0).order("is_premium",{ascending:!1}).order("is_carte_privilege",{ascending:!1}).order("name");if(_)throw _;return w??[]}}),{data:f,isLoading:p}=k0e(),m=b.useMemo(()=>{const w=(d??[]).map(N=>({source:"esm",id:N.id,slug:N.slug,name:N.name,city:N.city,category:N.category,short_description:N.short_description,image:Array.isArray(N.images)?N.images[0]:void 0,is_carte_privilege:!!N.is_carte_privilege,carte_discount_percent:N.carte_discount_percent,is_premium:!!N.is_premium,href:`/carnet-adresses/${N.slug}`})),_=new Set(w.map(N=>`${aP(N.name)}|${aP(N.city)}`)),j=(f??[]).reduce((N,S)=>{var k;if(!(S!=null&&S.slug)||!(S!=null&&S.name))return N;const C=`${aP(S.name)}|${aP(S.city)}`;return _.has(C)||(_.add(C),N.push({source:"tfk",id:`tfk-${S.slug}`,slug:S.slug,name:S.name,city:S.city,category:S.category,short_description:S.short_description,image:((k=S.images)==null?void 0:k[0])||S.image,href:`/carnet-adresses/tfk/${S.slug}`})),N},[]);return[...w,...j]},[d,f]),v=b.useMemo(()=>[...new Set(m.map(w=>
898w.city).filter(Boolean))].sort(),[m]),x=b.useMemo(()=>{const w=c.trim().toLowerCase();return m.filter(_=>!(o!=="all"&&_.source!==o||t!=="all"&&_.city!==t||n!=="all"&&_.category!==n||s&&!_.is_carte_privilege||w&&!_.name.toLowerCase().includes(w)))},[m,o,t,n,s,c]),g=h||p;return a.jsxs("div",{className:"container py-10 md:py-16",children:[a.jsx(Fn,{title:"Carnet d'adresses | Nos partenaires en Andalousie",description:"Découvrez notre sélection de restaurants, hôtels, commerces et services partenaires en Andalousie.",path:"/carnet-adresses"}),a.jsx("h1",{className:"font-heading text-3xl font-bold md:text-4xl",children:"Carnet d'adresses"}),a.jsxs("p",{className:"mt-2 text-muted-foreground",children:[x.length," adresses en Andalousie"]}),a.jsxs("div",{className:"mt-8 flex flex-col gap-4 sm:flex-row sm:items-center sm:flex-wrap",children:[a.jsxs(lt,{value:t,onValueChange:e,children:[a.jsx(nt,{className:"w-44",children:a.jsx(ct,{placeholder:"Toutes les villes"})}),a.jsxs(rt,{children:[a.jsx(Ae,{value:"all",children:"Toutes les villes"}),v.map(w=>a.jsx(Ae,{value:w,children:w},w))]})]}),a.jsxs(lt,{value:n,onValueChange:r,children:[a.jsx(nt,{className:"w-44",children:a.jsx(ct,{placeholder:"Toutes catégories"})}),a.jsx(rt,{children:kQe.map(w=>a.jsx(Ae,{value:w.value,children:w.label},w.value))})]}),a.jsxs(lt,{value:o,onValueChange:w=>l(w),children:[a.jsx(nt,{className:"w-44",children:a.jsx(ct,{placeholder:"Source"})}),a.jsxs(rt,{children:[a.jsx(Ae,{value:"all",children:"Toutes sources"}),a.jsx(Ae,{value:"esm",children:"Esprit Sud"}),a.jsx(Ae,{value:"tfk",children:"TuFaisQuoi"})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(_n,{id:"carte-only",checked:s,onCheckedChange:i}),a.jsx(te,{htmlFor:"carte-only",className:"text-sm",children:"Carte Privilège uniquement"})]}),a.jsxs("div",{className:"relative",children:[a.jsx(is,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(ue,{placeholder:"Rechercher...",value:c,onChange:w=>u(w.target.value),className:"h-9 w-48 pl-9"})]})]}),g?a.jsx("div",{className:"mt-8 grid gap-6 sm:grid-cols-2 lg:grid-cols-3",children:Array.from({length:6}).map((w,_)=>a.jsx(Xt,{className:"h-64 rounded-lg"},_))}):a.jsx("div",{className:"mt-8 grid gap-6 sm:grid-cols-2 lg:grid-cols-3",children:x.map(w=>a.jsxs(_e,{to:w.href,className:`group overflow-hidden rounded-lg border bg-card transition-shadow hover:shadow-lg ${w.is_premium?"border-amber-400/50 ring-1 ring-amber-400/20":"border-border"}`,children:[a.jsxs("div",{className:"aspect-[16/10] overflow-hidden bg-muted relative",children:[w.image&&a.jsx("img",{src:w.image,alt:w.name,loading:"lazy",className:"h-full w-full object-cover transition-transform duration-300 group-hover:scale-105"}),a.jsx("div",{className:"absolute left-2 top-2",children:w.source==="esm"?a.jsx(ke,{className:"bg-primary text-primary-foreground border-transparent text-[10px]",children:"Esprit Sud"}):a.jsx(ke,{style:{backgroundColor:AQe,color:"#000"},className:"border-transparent text-[10px]",children:"TuFaisQuoi"})})]}),a.jsxs("div",{className:"p-4",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"font-heading font-semibold",children:w.name}),a.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[w.city&&a.jsx("span",{className:"text-xs text-muted-foreground",children:w.city}),w.category&&a.jsx(ke,{variant:"secondary",className:"text-xs",children:w.category})]})]}),w.is_carte_privilege&&(w.carte_discount_percent??0)>0&&a.jsxs(ke,{className:"bg-amber-500/10 text-amber-700 border-amber-400/30 font-bold text-sm shrink-0",children:["-",w.carte_discount_percent,"%"]})]}),w.short_description&&a.jsx("p",{className:"mt-2 line-clamp-2 text-sm text-muted-foreground",children:w.short_description})]})]},w.id))})]})};function Lw(t){if(!window.open(t,"_blank","noopener,noreferrer"))try{window.top.location.href=t}catch{window.location.href=t}}function A0e(t){return`https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(t)}`}function E0e(t,e){return`https://www.google.com/maps?q=${t},${e}`}const TQe=()=>{const{slug:t}=Xi(),{user:e}=Ji(),n=St(),{lang:r}=Uu(),s=r==="en",i=b.useRef(!1),o=j=>s&&j.name_en||j.name,l=j=>s&&j.short_description_en||j.short_description,c=j=>s&&j.description_en||j.description,u=j=>s&&j.category_en||j.category,{data:d,isLoading:h}=Ne({queryKey:["partner",t],queryFn:async()=>{const{data:j,error:N}=await Z.from("partners").select("*").eq("slug",t).eq("is_active",!0).single();if(N)throw N;return j},enabled:!!t}),f=s&&!!(d!=null&&d.id)&&!d.name_en;b.useEffect(()=>{!f||i.current||(i.current=!0,(async()=>{try{await Z.functions.invoke("translate-to-english",{body:{type:"partner",id:d.id}}),n.invalidateQueries({queryKey:["partner",t]})}catch(j){console.warn("[i18n] traduction du partenaire échouée",j)}})())},[f,d==null?void 0:d.id,t,n]);const{data:p}=Ne({queryKey:["partner-guide",d==null?void 0:d.city],queryFn:async()=>{const{data:j}=await Z.from("travel_guides").select("slug, city").eq("city",d.city).eq("is_active",!0).limit(1).maybeSingle();return j},enabled:!!(d!=null&&d.city)}),{data:m}=Ne({queryKey:["user-carte",e==null?void 0:e.id],queryFn:async()=>{const{count:j}=await Z.from("carte_privilege").select("id",{count:"exact",head:!0}).eq("user_id",e.id).eq("status","active");return(j??0)>0},enabled:!!(e!=null&&e.id)}),{data:v}=Ne({queryKey:["similar-partners",d==null?void 0:d.id],queryFn:async()=>{const{distanceKm:j}=await Ac(async()=>{const{distanceKm:P}=await Promise.resolve().then(()=>FCe);return{distanceKm:P}}
898,void 0),N="id, slug, name, name_en, city, category, category_en, short_description, short_description_en, images, is_carte_privilege, carte_discount_percent, latitude, longitude",S=new Set([d.id]),C=[],k=4,E=P=>{for(const T of P||[]){if(C.length>=k)break;S.has(T.id)||(S.add(T.id),C.push(T))}};if(d.city){const{data:P}=await Z.from("partners").select(N).eq("is_active",!0).eq("city",d.city).neq("id",d.id).order("is_premium",{ascending:!1}).limit(k);E(P)}if(C.length<k&&d.category){const{data:P}=await Z.from("partners").select(N).eq("is_active",!0).eq("category",d.category).not("id","in",`(${[...S].join(",")})`).order("is_premium",{ascending:!1}).limit(k-C.length);E(P)}if(C.length<k&&d.latitude&&d.longitude){const{data:P}=await Z.from("partners").select(N).eq("is_active",!0).not("id","in",`(${[...S].join(",")})`).not("latitude","is",null).not("longitude","is",null).limit(50),T={lat:Number(d.latitude),lng:Number(d.longitude)},M=(P||[]).map(R=>({p:R,d:j(T,{lat:Number(R.latitude),lng:Number(R.longitude)})})).sort((R,A)=>R.d-A.d).map(R=>R.p);E(M)}return C},enabled:!!(d!=null&&d.id)});if(h)return a.jsx("div",{className:"container py-16",children:a.jsx(Xt,{className:"h-96 w-full rounded-xl"})});if(!d)return a.jsxs("div",{className:"container py-16 text-center",children:[a.jsx("h1",{className:"font-heading text-2xl font-bold",children:"Partenaire introuvable"}),a.jsx(H,{variant:"ghost",size:"sm",asChild:!0,className:"mt-4",children:a.jsxs(_e,{to:"/carnet-adresses",children:[a.jsx(jr,{className:"mr-2 h-4 w-4"})," Carnet d'adresses"]})})]});const x=d.images??[],g=d.latitude&&d.longitude,w=g?`https://www.google.com/maps?q=${d.latitude},${d.longitude}`:null,_=g?`https://www.google.com/maps/dir/?api=1&destination=${d.latitude},${d.longitude}`:null;return a.jsxs("div",{className:"container py-10 md:py-16",children:[a.jsx(Fn,{title:d.seo_title_en||d.seo_title||`${o(d)} - ${d.city} | Esprit Sud`,description:d.seo_description_en||d.seo_description||l(d)||`${o(d)} à ${d.city}, partenaire Esprit Sud.`,path:`/carnet-adresses/${d.slug}`,image:x[0],type:"website",jsonLd:{"@context":"https://schema.org","@type":"LocalBusiness",name:o(d),description:l(d)||d.seo_description_en||d.seo_description||"",image:x[0]||void 0,address:{"@type":"PostalAddress",streetAddress:d.address||void 0,postalCode:d.postal_code||void 0,addressLocality:d.city,addressRegion:d.province||void 0,addressCountry:"ES"},telephone:d.phone||void 0,url:d.website||void 0,geo:g?{"@type":"GeoCoordinates",latitude:d.latitude,longitude:d.longitude}:void 0}}),a.jsx(H,{variant:"ghost",size:"sm",asChild:!0,className:"mb-6",children:a.jsxs(_e,{to:"/carnet-adresses",children:[a.jsx(jr,{className:"mr-2 h-4 w-4"})," Carnet d'adresses"]})}),a.jsxs("div",{className:"grid gap-8 lg:grid-cols-3",children:[a.jsxs("div",{className:"lg:col-span-2",children:[x.length>0&&a.jsx("div",{className:"overflow-hidden rounded-xl",children:x.length===1?a.jsx("img",{src:x[0],alt:o(d),className:"w-full aspect-[16/9] object-cover rounded-xl"}):a.jsx("div",{className:"grid gap-2 grid-cols-2",children:x.slice(0,4).map((j,N)=>a.jsx("img",{src:j,alt:`${o(d)} ${N+1}`,loading:"lazy",className:`w-full object-cover rounded-lg ${N===0?"col-span-2 aspect-[16/9]":"aspect-[4/3]"}`},N))})}),a.jsxs("div",{className:"mt-6",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[a.jsx("h1",{className:"font-heading text-2xl font-bold md:text-3xl",children:o(d)}),a.jsx(ke,{variant:"secondary",children:u(d)}),d.is_premium&&a.jsx(ke,{className:"bg-amber-500/10 text-amber-700 border-amber-400/30",children:"Premium"})]}),a.jsxs("div",{className:"mt-1 flex items-center gap-1 text-muted-foreground",children:[a.jsx(_r,{className:"h-4 w-4"}),a.jsxs("span",{children:[d.city,", ",d.province]})]})]}),d.is_carte_privilege&&a.jsx("div",{className:"mt-6 rounded-lg border-2 border-amber-400/30 bg-amber-50/50 p-5",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(Jo,{className:"h-5 w-5 text-amber-600 mt-0.5"}),a.jsxs("div",{children:[a.jsxs("h3",{className:"font-heading font-semibold text-amber-800",children:["Carte Privilège",d.carte_discount_percent>0?` : -${d.carte_discount_percent}%`:""]}),d.carte_discount_conditions&&a.jsx("div",{className:"mt-2 prose prose-sm max-w-none prose-headings:font-heading prose-headings:text-amber-800 prose-h4:text-sm prose-h4:mt-3 prose-h4:mb-1 prose-p:my-1 prose-ul:my-1 prose-li:my-0.5 text-amber-700 prose-strong:text-amber-800",dangerouslySetInnerHTML:{__html:a0(d.carte_discount_conditions)}}),!m&&a.jsx(H,{size:"sm",className:"mt-3",asChild:!0,children:a.jsx(_e,{to:"/carte-privilege",children:"Souscrire à la Carte"})})]})]})}),a.jsx("div",{className:"mt-6 prose prose-lg max-w-none prose-headings:font-heading",dangerouslySetInnerHTML:{__html:a0(c(d)||l(d)||"")}})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"rounded-lg border border-border bg-card p-5 space-y-4",children:[a.jsx("h3",{className:"font-heading font-semibold",children:"Infos pratiques"}),d.address&&a.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[a.jsx(_r,{className:"h-4 w-4 mt-0.5 text-muted-foreground shrink-0"}),a.jsxs("button",{type:"button",onClick:()=>Lw(A0e(`${d.address}, ${d.postal_code??""} ${d.city??""}`.trim())),className:"text-left text-primary hover:underline",children:[d.address,", ",d.postal_code," ",d.city]})]}),d.phone&&a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx(hk,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("a",{href:`tel:${d.phone}`,className:"text-primary hover:underline",children:d.phone})]}),d.website&&a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx(ZL,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("a",{href:d.website,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline truncate",children:d.website.replace(/^https?:\/\//,"")})]}),d.opening_hours&&a.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[a.jsx(t2,{className:"h-4 w-4 mt-0.5 text-muted-foreground shrink-0"}),a.jsx("span",{className:"whitespace-pre-line",children:typeof d.opening_hours=="string"?d.opening_hours:JSON.stringify(d.opening_hours)})]})]}),g&&a.jsxs("div",{className:"space-y-2",children:[a.jsxs(H,{variant:"outline",className:"w-full",onClick:()=>Lw(w),children:[a.jsx(_r,{className:"mr-2 h-4 w-4"})," Voir sur Google Maps"]}),a.jsxs(H,{variant:"outline",className:"w-full",onClick:()=>Lw(_),children:[a.jsx(i5e,{className:"mr-2 h-4 w-4"})," Itinéraire"]})]}),p&&a.jsx(_e,{to:`/destinations/${p.slug}`,className:"block rounded-lg border border-border bg-card p-4 hover:shadow-md transition-shadow text-center",children:a.jsxs("span",{className:"text-sm text-primary font-medium",children:["Découvrir ",p.city," â"]})})]})]}),v&&v.length>0&&a.jsxs("div",{className:"mt-16",children:[a.jsxs("h2",{className:"font-heading text-xl font-bold mb-6",children:["Autres adresses à ",d.city]}),a.jsx("div",{className:"grid gap-4 grid-cols-2 lg:grid-cols-4",children:v.map(j=>a.jsxs(_e,{to:`/carnet-adresses/${j.slug}`,className:"group overflow-hidden rounded-lg border border-border bg-card",children:[a.jsx("div",{className:"aspect-[16/9] overflow-hidden bg-muted",children:Array.isArray(j.images)&&j.images[0]&&a.jsx("img",{src:j.images[0],alt:o(j),loading:"lazy",className:"h-full w-full object-cover transition-transform duration-300 group-hover:scale-105"})}),a.jsxs("div",{className:"p-3",children:[a.jsx("h3",{className:"line-clamp-1 text-sm font-semibold",children:o(j)}),a.jsxs("div",{className:"mt-1 flex items-center gap-1 text-xs text-muted-foreground",children:[a.jsx(ke,{variant:"secondary",className:"text-[10px]",children:u(j)}),a.jsx("span",{children:j.city})]})]})]},j.id))})]})]})},PQe="#FFC400";function MQe(){var u,d;const{slug:t}=Xi(),{data:e,isLoading:n}=k0e(),r=e==null?void 0:e.find(h=>h.slug===t);if(n)return a.jsx("div",{className:"container py-16",children:a.jsx(Xt,{className:"h-96 w-full rounded-xl"})});if(!r)return a.jsxs("div",{className:"container py-16 text-center",children:[a.jsx("h1",{className:"font-heading text-2xl font-bold",children:"Adresse introuvable"}),a.jsx(H,{variant:"ghost",size:"sm",asChild:!0,className:"mt-4",children:a.jsxs(_e,{to:"/carnet-adresses",children:[a.jsx(jr,{className:"mr-2 h-4 w-4"})," Carnet d'adresses"]})})]});const s=r.latitude!=null?Number(r.latitude):null,i=r.longitude!=null?Number(r.longitude):null,o=s!=null&&i!=null&&!Number.isNaN(s)&&!Number.isNaN(i),l=((u
898=r.images)==null?void 0:u[0])||r.image,c=`https://tufaisquoi.com/carnet-adresses/${r.slug}`;return a.jsxs("div",{className:"container py-10 md:py-16",children:[a.jsx(Fn,{title:`${r.name} | Carnet d'adresses`,description:r.short_description||((d=r.description)==null?void 0:d.slice(0,160))||r.name,path:`/carnet-adresses/tfk/${r.slug}`,image:l}),a.jsx(H,{variant:"ghost",size:"sm",asChild:!0,className:"mb-6",children:a.jsxs(_e,{to:"/carnet-adresses",children:[a.jsx(jr,{className:"mr-2 h-4 w-4"})," Carnet d'adresses"]})}),a.jsx("div",{className:"mb-4",children:a.jsx(ke,{style:{backgroundColor:PQe,color:"#000"},className:"border-transparent",children:"TuFaisQuoi"})}),a.jsxs("div",{className:"grid gap-8 lg:grid-cols-3",children:[a.jsxs("div",{className:"lg:col-span-2",children:[l&&a.jsx("img",{src:l,alt:r.name,className:"w-full aspect-[16/9] object-cover rounded-xl"}),a.jsxs("div",{className:"mt-6",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[a.jsx("h1",{className:"font-heading text-2xl font-bold md:text-3xl",children:r.name}),r.category&&a.jsx(ke,{variant:"secondary",children:r.category})]}),r.city&&a.jsxs("div",{className:"mt-1 flex items-center gap-1 text-muted-foreground",children:[a.jsx(_r,{className:"h-4 w-4"}),a.jsx("span",{children:r.city})]})]}),(r.description||r.short_description)&&a.jsx("div",{className:"mt-6 prose prose-lg max-w-none prose-headings:font-heading",dangerouslySetInnerHTML:{__html:a0(r.description||r.short_description||"")}}),a.jsx("div",{className:"mt-8",children:a.jsx(H,{asChild:!0,variant:"outline",children:a.jsxs("a",{href:c,target:"_blank",rel:"noopener noreferrer",children:["Voir sur TuFaisQuoi ",a.jsx(Gi,{className:"ml-2 h-4 w-4"})]})})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"rounded-lg border border-border bg-card p-5 space-y-4",children:[a.jsx("h3",{className:"font-heading font-semibold",children:"Infos pratiques"}),r.address&&a.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[a.jsx(_r,{className:"h-4 w-4 mt-0.5 text-muted-foreground shrink-0"}),a.jsx("span",{children:r.address})]}),r.phone&&a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx(hk,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("a",{href:`tel:${r.phone}`,className:"text-primary hover:underline",children:r.phone})]}),r.website&&a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx(ZL,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("a",{href:r.website,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline truncate",children:r.website.replace(/^https?:\/\//,"")})]})]}),o&&a.jsxs(a.Fragment,{children:[a.jsx(zye,{height:240,zoom:14,center:{lat:s,lng:i},points:[{id:r.slug,name:r.name,latitude:s,longitude:i}]}),a.jsxs(H,{variant:"outline",className:"w-full",onClick:()=>Lw(E0e(s,i)),children:[a.jsx(_r,{className:"mr-2 h-4 w-4"})," Voir sur Google Maps"]})]})]})]})]})}const vte=["Tous","Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre"],RQe=[{value:"all",label:"Tous les types"},{value:"feria",label:"Feria"},{value:"festival",label:"Festival"},{value:"concert",label:"Concert"},{value:"marche",label:"Marché"},{value:"sport",label:"Sport"},{value:"exposition",label:"Exposition"}],OQe=()=>{const[t,e]=b.useState("Tous"),[n,r]=b.useState("all"),[s,i]=b.useState("all"),{data:o}=Ne({queryKey:["event-cities"],queryFn:async()=>{const{data:u}=await Z.from("events").select("city").eq("is_active",!0);return[...new Set((u??[]).map(d=>d.city).filter(Boolean))].sort()}}),{data:l,isLoading:c}=Ne({queryKey:["events",t,n,s],queryFn:async()=>{let u=Z.from("events").select("*").eq("is_active",!0).gte("date_start",new Date().toISOString()).order("date_start");n!=="all"&&(u=u.eq("city",n)),s!=="all"&&(u=u.eq("event_type",s));const{data:d,error:h}=await u;if(h)throw h;let f=d??[];if(t!=="Tous"){const p=vte.indexOf(t)-1;f=f.filter(m=>new Date(m.date_start).getMonth()===p)}return f}});return a.jsxs("div",{className:"container py-10 md:py-16",children:[a.jsx(Fn,{title:"Agenda | Ferias et événements en Andalousie",description:"L'agenda complet des ferias, festivals, concerts et événements culturels en Andalousie.",path:"/evenements"}),a.jsx("h1",{className:"font-heading text-3xl font-bold md:text-4xl",children:"Agenda"}),a.jsx("p",{className:"mt-2 text-muted-foreground",children:"Ferias, festivals et événements en Andalousie"}),a.jsxs("div",{className:"mt-8 flex flex-col gap-3 sm:flex-row sm:flex-wrap",children:[a.jsxs(lt,{value:t,onValueChange:e,children:[a.jsx(nt,{className:"w-40",children:a.jsx(ct,{placeholder:"Mois"})}),a.jsx(rt,{children:vte.map(u=>a.jsx(Ae,{value:u,children:u},u))})]}),a.jsxs(lt,{value:n,onValueChange:r,children:[a.jsx(nt,{className:"w-40",children:a.jsx(ct,{placeholder:"Toutes les villes"})}),a.jsxs(rt,{children:[a.jsx(Ae,{value:"all",children:"Toutes les villes"}),o==null?void 0:o.map(u=>a.jsx(Ae,{value:u,children:u},u))]})]}),a.jsxs(lt,{value:s,onValueChange:i,children:[a.jsx(nt,{className:"w-40",children:a.jsx(ct,{placeholder:"Tous les types"})}),a.jsx(rt,{children:RQe.map(u=>a.jsx(Ae,{value:u.value,children:u.label},u.value))})]})]}),c?a.jsx("div",{className:"mt-8 space-y-4",children:Array.from({length:5}).map((u,d)=>a.jsx(Xt,{className:"h-24 rounded-lg"},d))}):a.jsxs("div",{className:"mt-8 space-y-4",children:[(l==null?void 0:l.length)===0&&a.jsx("p",{className:"text-muted-foreground text-center py-10",children:"Aucun événement à venir pour cette sélection."}),l==null?void 0:l.map(u=>{const d=new Date(u.date_start);return a.jsxs(_e,{to:`/evenements/${u.slug}
898`,className:"flex items-start gap-4 rounded-lg border border-border bg-card p-4 hover:shadow-md transition-shadow",children:[a.jsxs("div",{className:"flex-shrink-0 w-16 text-center rounded-lg bg-primary/5 p-2",children:[a.jsx("div",{className:"text-2xl font-bold text-primary",children:d.getDate()}),a.jsx("div",{className:"text-xs text-muted-foreground uppercase",children:d.toLocaleDateString("fr-FR",{month:"short"})})]}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("h2",{className:"font-heading font-semibold",children:u.title}),a.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-2",children:[a.jsx(ke,{variant:"secondary",className:"text-xs",children:u.event_type}),a.jsx("span",{className:"text-xs text-muted-foreground",children:u.city})]}),u.short_description&&a.jsx("p",{className:"mt-1 line-clamp-2 text-sm text-muted-foreground",children:u.short_description}),u.external_url&&a.jsxs("span",{className:"mt-1 inline-flex items-center gap-1 text-xs text-primary",children:[a.jsx(Gi,{className:"h-3 w-3"})," Plus d'infos"]})]})]},u.id)})]})]})};function IQe(t,e,n){const r=new Date(t.date_start).toISOString().replace(/[-:]/g,"").split(".")[0]+"Z",s=t.date_end?new Date(t.date_end).toISOString().replace(/[-:]/g,"").split(".")[0]+"Z":r;return["BEGIN:VCALENDAR","VERSION:2.0","BEGIN:VEVENT",`DTSTART:${r}`,`DTEND:${s}`,`SUMMARY:${e}`,`LOCATION:${t.venue||""}, ${t.city||""}`,`DESCRIPTION:${(n||"").replace(/\n/g,"\\n")}`,"END:VEVENT","END:VCALENDAR"].join(`\r 899`)}const DQe=()=>{const{slug:t}=Xi(),e=St(),{lang:n}=Uu(),r=n==="en",s=b.useRef(!1),i=m=>r&&m.title_en||m.title,o=m=>r&&m.description_en||m.description,l=m=>r&&m.short_description_en||m.short_description,{data:c,isLoading:u}=Ne({queryKey:["event",t],queryFn:async()=>{const{data:m,error:v}=await Z.from("events").select("*").eq("slug",t).eq("is_active",!0).single();if(v)throw v;return m},enabled:!!t}),d=r&&!!(c!=null&&c.id)&&!c.title_en;b.useEffect(()=>{!d||s.current||(s.current=!0,(async()=>{try{await Z.functions.invoke("translate-to-english",{body:{type:"event",id:c.id}}),e.invalidateQueries({queryKey:["event",t]})}catch(m){console.warn("[i18n] traduction de l'événement échouée",m)}})())},[d,c==null?void 0:c.id,t,e]);const{data:h}=Ne({queryKey:["event-articles",c==null?void 0:c.city],queryFn:async()=>{const{data:m}=await Z.from("articles").select("id, slug, title, cover_image_url, published_at").eq("status","published").order("published_at",{ascending:!1}).limit(3);return m??[]},enabled:!!(c!=null&&c.city)}),f=()=>{if(!c)return;const m=IQe(c,i(c),l(c)),v=new Blob([m],{type:"text/calendar;charset=utf-8"}),x=URL.createObjectURL(v),g=document.createElement("a");g.href=x,g.download=`${c.slug}.ics`,g.click(),URL.revokeObjectURL(x)};if(u)return a.jsx("div",{className:"container py-16",children:a.jsx(Xt,{className:"h-96 w-full rounded-xl"})});if(!c)return a.jsxs("div",{className:"container py-16 text-center",children:[a.jsx("h1",{className:"font-heading text-2xl font-bold",children:"Ãvénement introuvable"}),a.jsx(H,{variant:"ghost",size:"sm",asChild:!0,className:"mt-4",children:a.jsxs(_e,{to:"/evenements",children:[a.jsx(jr,{className:"mr-2 h-4 w-4"})," Agenda"]})})]});const p=c.programme;return a.jsxs("div",{children:[a.jsx(Fn,{title:`${i(c)} | Agenda Esprit Sud`,description:(l(c)||o(c)||"").toString().replace(/<[^>]+>/g,"").slice(0,155),path:`/evenements/${c.slug}`,image:c.cover_image_url,type:"article",jsonLd:{"@context":"https://schema.org","@type":"Event",name:i(c),description:(l(c)||o(c)||"").toString().replace(/<[^>]+>/g,""),startDate:c.date_start,endDate:c.date_end||c.date_start,image:c.cover_image_url||void 0,location:{"@type":"Place",name:c.venue||c.city,address:{"@type":"PostalAddress",addressLocality:c.city,addressCountry:"ES"}}}}),c.cover_image_url&&a.jsxs("div",{className:"relative h-[35vh] md:h-[45vh]",children:[a.jsx("img",{src:c.cover_image_url,alt:i(c),className:"h-full w-full object-cover"}),a.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-foreground
899/60 to-transparent"})]}),a.jsxs("div",{className:"container py-10 md:py-16",children:[a.jsx(H,{variant:"ghost",size:"sm",asChild:!0,className:"mb-6",children:a.jsxs(_e,{to:"/evenements",children:[a.jsx(jr,{className:"mr-2 h-4 w-4"})," Agenda"]})}),a.jsxs("div",{className:"mx-auto max-w-3xl",children:[a.jsx("div",{className:"flex flex-wrap gap-2 mb-3",children:a.jsx(ke,{children:c.event_type})}),a.jsx("h1",{className:"font-heading text-2xl font-bold md:text-4xl",children:i(c)}),a.jsxs("div",{className:"mt-4 flex flex-wrap gap-4 text-sm text-muted-foreground",children:[a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx(Aj,{className:"h-4 w-4"})," ",T7e(c.date_start,c.date_end)]}),c.time_info&&a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx(t2,{className:"h-4 w-4"})," ",c.time_info]}),(c.venue||c.city)&&a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx(_r,{className:"h-4 w-4"})," ",[c.venue,c.city].filter(Boolean).join(", ")]})]}),a.jsxs("div",{className:"mt-6 flex flex-wrap gap-2",children:[a.jsxs(H,{variant:"outline",size:"sm",onClick:f,children:[a.jsx(Ts,{className:"mr-1.5 h-4 w-4"})," Ajouter à mon agenda"]}),c.external_url&&a.jsx(H,{variant:"outline",size:"sm",asChild:!0,children:a.jsxs("a",{href:c.external_url,target:"_blank",rel:"noopener noreferrer",children:[a.jsx(Gi,{className:"mr-1.5 h-4 w-4"})," Site officiel"]})})]}),a.jsx("hr",{className:"my-8"}),a.jsx("div",{className:"prose prose-lg max-w-none prose-headings:font-heading",dangerouslySetInnerHTML:{__html:a0(o(c)||"")}}),p&&Object.keys(p).length>0&&a.jsxs("div",{className:"mt-10",children:[a.jsx("h2",{className:"font-heading text-xl font-bold mb-4",children:"Programme"}),a.jsx(s7,{type:"multiple",className:"w-full",children:Object.entries(p).map(([m,v])=>a.jsxs(D3,{value:m,children:[a.jsx(L3,{className:"font-heading",children:m}),a.jsx(F3,{children:a.jsx("ul",{className:"space-y-1",children:v.map((x,g)=>a.jsx("li",{className:"text-sm",children:x},g))})})]},m))})]}),h&&h.length>0&&a.jsxs("div",{className:"mt-10",children:[a.jsx("h2",{className:"font-heading text-xl font-bold mb-4",children:"Articles liés"}),a.jsx("div",{className:"grid gap-4 grid-cols-1 sm:grid-cols-3",children:h.map(m=>a.jsxs(_e,{to:`/actualites/${m.slug}`,className:"group overflow-hidden rounded-lg border border-border bg-card",children:[a.jsx("div",{className:"aspect-[16/9] overflow-hidden",children:m.cover_image_url&&a.jsx("img",{src:m.cover_image_url,alt:m.title,loading:"lazy",className:"h-full w-full object-cover transition-transform duration-300 group-hover:scale-105"})}),a.jsxs("div",{className:"p-3",children:[a.jsx("h3",{className:"line-clamp-2 text-sm font-semibold",children:m.title}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:jc(m.published_at)})]})]},m.id))})]})]})]})]})},LQe=()=>a.jsxs("div",{className:"container py-10 md:py-16",children:[a.jsx(Fn,{title:"Contact | Esprit Sud Magazine",description:"Contactez l'équipe d'Esprit Sud Magazine : rédaction, publicité, partenariats, abonnements.",path:"/contact"}),a.jsxs("div",{className:"mx-auto max-w-4xl",children:[a.jsx("h1",{className:"font-heading text-3xl font-bold md:text-4xl",children:"Contact"}),a.jsx("p",{className:"mt-2 text-muted-foreground",children:"Une question ? N'hésitez pas à nous écrire."}),a.jsx("div",{className:"mt-10",children:a.jsxs("form",{className:"mx-auto max-w-2xl space-y-4",children:[a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(te,{htmlFor:"name",children:"Nom"}),a.jsx(ue,{id:"name",placeholder:"Votre nom",className:"mt-1.5"})]}),a.jsxs("div",{children:[a.jsx(te,{htmlFor:"email",children:"Email"}),a.jsx(ue,{id:"email",type:"email",placeholder:"[email protected]",className:"mt-1.5"})]})]}),a.jsxs("div",{children:[a.jsx(te,{htmlFor:"subject",children:"Sujet"}),a.jsx(ue,{id:"subject",placeholder:"De quoi souhaitez-vous parler ?",className:"mt-1.5"})]}),a.jsxs("div",{children:[a.jsx(te,{htmlFor:"message",children:"Message"}),a.jsx(fn,{id:"message",placeholder:"Votre message...",rows:5,className:"mt-1.5"})]}),a.jsx(H,{size:"lg",className:"w-full rounded-xl",children:"Envoyer le message"})]})})]})]}),FQe="/assets/recrutement-hero-CzUeo6fI.jpg",tI=[{id:"commercial-francophone",badge:"ð«ð· Francophone",title:"Commercial(e) francophone",kicker:"Esprit Sud recrute !",summary:"Développez notre portefeuille de partenaires et d'annonceurs auprès de la communauté francophone de la Costa del Sol. Terrain, rencontres et nouveaux marchés.",location:"Costa del Sol â Málaga à Sotogrande",intro:["Esprit Sud Magazine évolue et renforce son ancrage auprès de la communauté francophone de la Costa del Sol.","Pour accompagner ce développement, nous recherchons un(e) commercial(e) parfaitement à l'aise en français, capable de développer notre portefeuille de partenaires et d'annonceurs auprès de la communauté francophone de la Costa del Sol."],sections:[{icon:"ð¯",title:"Votre mission",paragraphs:["Prospecter et rencontrer de nouveaux clients, présenter Esprit Sud Magazine et nos différents supports de communication, et développer des partenariats publicitaires auprès des entreprises souhaitant toucher une clientèle francophone.","ð Vous pourrez vous adresser aussi bien aux entreprises françaises, belges, suisses qu'aux communautés francophones dont le français est la langue commune de communication."]},{icon:"ð¤",title:"Le profil que nous recherchons",bullets:["Excellent niveau de français indispensable","Notions d'espagnol souhaitées","Anglais : un vrai plus, mais pas indispensable","Très bon relationnel et goût du contact","Autonomie et sens commercial","Connaissance de la Costa del Sol appréciée","Une expérience commerciale est un plus"]},{icon:"ð",title:"Secteur",paragraphs:["Costa del Sol â Málaga à Sotogrande"]}],outro:["Vous aimez le terrain, créer des contacts et développer de nouveaux marchés ? Rejoignez l'aventure Esprit Sud et participez au développement de notre c
899ommunauté francophone.","ð© Envoyez-nous votre candidature ou contactez-nous directement en message privé."],signature:"ESPRIT SUD MAGAZINE â La Costa del Sol en français⦠and now in English."},{id:"commercial-anglophone",badge:"ð¬ð§ Anglophone",title:"Commercial(e) anglophone",kicker:"Esprit Sud recrute !",summary:"Esprit Sud devient bilingue françaisâanglais. Développez nos partenariats auprès de la communauté internationale de la Costa del Sol.",location:"Costa del Sol â Málaga à Sotogrande",intro:["Esprit Sud Magazine évolue et devient bilingue françaisâanglais.","Pour accompagner ce développement, nous recherchons un(e) commercial(e) parfaitement à l'aise en anglais, capable de développer notre portefeuille de partenaires et d'annonceurs auprès de la communauté internationale de la Costa del Sol."],sections:[{icon:"ð¯",title:"Votre mission",paragraphs:["Prospecter et rencontrer de nouveaux clients, présenter Esprit Sud Magazine et nos différents supports de communication, et développer des partenariats publicitaires auprès des entreprises souhaitant toucher une clientèle internationale.","ð Vous pourrez vous adresser aussi bien aux entreprises britanniques qu'aux communautés scandinaves, néerlandaises, allemandes, ukrainiennes, russophones ou internationales dont l'anglais est la langue commune de communication."]},{icon:"ð¤",title:"Le profil que nous recherchons",bullets:["Excellent niveau d'anglais indispensable","Notions d'espagnol souhaitées","Français : un vrai plus, mais pas indispensable","Très bon relationnel et goût du contact","Autonomie et sens commercial","Connaissance de la Costa del Sol appréciée","Une expérience commerciale est un plus"]},{icon:"ð",title:"Secteur",paragraphs:["Costa del Sol â Málaga à Sotogrande"]}],outro:["Vous aimez le terrain, créer des contacts et développer de nouveaux marchés ? Rejoignez l'aventure Esprit Sud et participez au lancement de notre nouvelle édition bilingue.","ð© Envoyez-nous votre candidature ou contactez-nous directement en message privé."],signature:"ESPRIT SUD MAGAZINE â La Costa del Sol en français⦠and now in English."},{id:"grands-comptes",badge:"ð¢ Grands Comptes",title:"Responsable Grands Comptes",kicker:"Esprit Sud recrute",summary:"Profil B2B expérimenté pour ouvrir les portes des grandes enseignes, groupes internationaux et marques premium de la Costa del Sol.",location:"Costa del Sol â Málaga à Sotogrande",intro:["Esprit Sud Magazine accélère son développement et recherche un profil commercial expérimenté capable d'ouvrir les portes des grandes enseignes, groupes internationaux et marques premium présents sur la Costa del Sol.","Notre objectif : aller au-delà de la prospection locale et développer de véritables partenariats avec les acteurs majeurs de la région."],sections:[{icon:"ð¢",title:"Votre mission",paragraphs:["Identifier les entreprises et marques à fort potentiel, trouver les bons interlocuteurs et décideurs, initier le contact, présenter nos différents supports et construire des propositions commerciales adaptées.","Grande distribution, automobile, immobilier, décoration, banques, assurances, beauté, gastronomie, tourisme, hôtellerie, golf, luxeâ¦","Nous souhaitons notamment développer des relations avec des enseignes et groupes tels que Carrefour, Leroy Merlin, Maisons du Monde, Yves Rocher, Roche Bobois, Porsche, Rolex, et bien d'autres."]},{icon:"ð¯",title:"Nous recherchons avant tout",bullets:["Une véritable expérience commerciale B2B","Une expérience ou bonne connaissance des grands comptes","La capacité à identifier et atteindre les décideurs","Une excellente aisance relationnelle et commerciale","Autonomie, persévérance et capacité de négociation","Un excellent niveau d'anglais","L'espagnol est fortement souhaité","Le français constitue un véritable atout"]},{icon:"ð",title:"Secteur",paragraphs:["Costa del Sol â Málaga à Sotogrande"]}],outro:["Esprit Sud entre dans une nouvelle étape de son développement avec son magazine bilingue françaisâanglais, ses plateformes digitales, ses réseaux sociaux et ses événements.","Nous ne cherchons pas simplement quelqu'un pour vendre des espaces publicitaires. Nous cherchons quelqu'un capable de créer des relations commerciales durables avec les grandes marques.","ð© Intéressé(e) ? Contactez-nous en message privé ou envoyez-nous votre candidature."]}];Object.fromEntries(tI.map(t=>[t.id,t.title]));var K3="Checkbox",[$Qe,$Lt]=Ys(K3),[zQe,y7]=$Qe(K3);function BQe(t){const{__scopeCheckbox:e,checked:n,children:r,defaultChecked:s,disabled:i,form:o,name:l,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:h}=t,[f,p]=Xo({prop:n,defaultProp:s??!1,onChange:c,caller:K3}),[m,v]=b.useState(null),[x,g]=b.useState(null),w=b.useRef(!1),_=m?!!o||!!m.closest("form"):!0,j={checked:f,disabled:i,setChecked:p,control:m,setControl:v,name:l,form:o,value:d,hasConsumerStoppedPropagationRef:w,required:u,defaultChecked:Sg(s)?!1:s,isFormControl:_,bubbleInput:x,setBubbleInput:g};return a.jsx(zQe,{scope:e,...j,children:UQe(h)?h(j):r})}var T0e="CheckboxTrigger",P0e=b.forwardRef(({__scopeCheckbox:t,onKeyDown:e,onClick:n,...r},s)=>{const{control:i,value:o,disabled:l,checked:c,required:u,setControl:d,setChecked:h,hasConsumerStoppedPropagationRef:f,isFormControl:p,bubbleInput:m}=y7(T0e,t),v=$t(s,d),x=b.useRef(c);return b.useEffect(()=>{const g=i==null?void 0:i.form;if(g){const w=()=>h(x.current);return g.addEventListener("reset",w),()=>g.removeEventListener("reset",w)}},[i,h]),a.jsx(et.button,{type:"button",role:"checkbox","aria-checked":Sg(c)?"mixed":c,"aria-required":u,"data-state":D0e(c),"data-disabled":l?"":void 0,disabled:l,value:o,...r,ref:v,onKeyDown:ze(e,g=>{g.key==="Enter"&&g.preventDefault()}),onClick:ze(n,g=>{h(w=>Sg(w)?!0:!w),m&&p&&(f.current=g.isPropagationStopped(),f.current||g.stopPropagation())})})});P0e.displayName=T0e;var b7=b.forwardRef((t,e)=>{const{__scopeCheckbox:n,name:r,checked:s,defaultChecked:i,required:o,disabled:l,value:c,onCheckedChange:u,form:d,...h}=t;return a.jsx(BQe,{__scopeCheckbox:n,checked:s,defaultChecked:i,disabled:l,required:o,onCheckedChange:u,name:r,form:d,value:c,internal_do_not_use_render:({isFormControl:f})=>a.jsxs(a.Fragment,{children:[a.jsx(P0e,{...h,ref:e,__scopeCheckbox:n}),f&&a.jsx(I0e,{__scopeCheckbox:n})]})})});b7.displayName=K3;var M0e="CheckboxIndicator",R0e=b.forwardRef((t,e)=>{const{__scopeCheckbox:n,forceMount:r,...s}
899=t,i=y7(M0e,n);return a.jsx(yo,{present:r||Sg(i.checked)||i.checked===!0,children:a.jsx(et.span,{"data-state":D0e(i.checked),"data-disabled":i.disabled?"":void 0,...s,ref:e,style:{pointerEvents:"none",...t.style}})})});R0e.displayName=M0e;var O0e="CheckboxBubbleInput",I0e=b.forwardRef(({__scopeCheckbox:t,...e},n)=>{const{control:r,hasConsumerStoppedPropagationRef:s,checked:i,defaultChecked:o,required:l,disabled:c,name:u,value:d,form:h,bubbleInput:f,setBubbleInput:p}=y7(O0e,t),m=$t(n,p),v=_3(i),x=a3(r);b.useEffect(()=>{const w=f;if(!w)return;const _=window.HTMLInputElement.prototype,N=Object.getOwnPropertyDescriptor(_,"checked").set,S=!s.current;if(v!==i&&N){const C=new Event("click",{bubbles:S});w.indeterminate=Sg(i),N.call(w,Sg(i)?!1:i),w.dispatchEvent(C)}},[f,v,i,s]);const g=b.useRef(Sg(i)?!1:i);return a.jsx(et.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??g.current,required:l,disabled:c,name:u,value:d,form:h,...e,tabIndex:-1,ref:m,style:{...e.style,...x,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});I0e.displayName=O0e;function UQe(t){return typeof t=="function"}function Sg(t){return t==="indeterminate"}function D0e(t){return Sg(t)?"indeterminate":t?"checked":"unchecked"}const wr=b.forwardRef(({className:t,...e},n)=>a.jsx(b7,{ref:n,className:Fe("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",t),...e,children:a.jsx(R0e,{className:Fe("flex items-center justify-center text-current"),children:a.jsx(Ma,{className:"h-4 w-4"})})}));wr.displayName=b7.displayName;const qQe=["Français","Anglais","Espagnol","Autre"],oP=100,VQe=5*1024*1024;function HQe(t){return new Promise((e,n)=>{const r=new FileReader;r.onload=()=>e(String(r.result).split(",")[1]??""),r.onerror=()=>n(new Error("Lecture du fichier impossible")),r.readAsDataURL(t)})}const WQe=({job:t,onClose:e,onApply:n})=>a.jsx(an,{open:!!t,onOpenChange:r=>!r&&e(),children:a.jsx(nn,{className:"max-h-[85vh] max-w-2xl overflow-y-auto",children:t&&a.jsxs(a.Fragment,{children:[a.jsxs(on,{children:[a.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.2em] text-[#C8962E]",children:t.kicker}),a.jsx(ln,{className:"font-heading text-2xl",children:t.title})]}),a.jsxs("div",{className:"space-y-5 text-sm leading-relaxed text-muted-foreground",children:[t.intro.map((r,s)=>a.jsx("p",{children:r},s)),t.sections.map(r=>{var s;return a.jsxs("div",{className:"rounded-xl border border-[#C8962E]/25 bg-[#C8962E]/[0.04] p-4",children:[a.jsxs("h3",{className:"font-heading text-base font-semibold text-foreground",children:[a.jsx("span",{className:"mr-2",children:r.icon}),r.title]}),a.jsxs("div",{className:"mt-2 space-y-2",children:[(s=r.paragraphs)==null?void 0:s.map((i,o)=>a.jsx("p",{children:i},o)),r.bullets&&a.jsx("ul",{className:"list-disc space-y-1 pl-5",children:r.bullets.map(i=>a.jsx("li",{children:i},i))})]})]},r.title)}),t.outro.map((r,s)=>a.jsx("p",{children:r},s)),t.signature&&a.jsx("p",{className:"font-heading text-sm font-semibold text-foreground",children:t.signature})]}),a.jsx(H,{size:"lg",className:"mt-2 w-full rounded-xl bg-[#C8962E] text-white hover:bg-[#b07f22]",onClick:()=>n(t),children:"Postuler à ce poste"})]})})});function KQe(){const{toast:t}=QE(),e=b.useRef(null),[n,r]=b.useState(null),[s,i]=b.useState(!1),[o,l]=b.useState(!1),[c,u]=b.useState(""),[d,h]=b.useState(""),[f,p]=b.useState(""),[m,v]=b.useState(""),[x,g]=b.useState(""),[w,_]=b.useState([]),[j,N]=b.useState(""),[S,C]=b.useState(""),[k,E]=b.useState(null),P=I=>{I&&g(I.title),r(null),setTimeout(()=>{var D;return(D=e.current)==null?void 0:D.scrollIntoView({behavior:"smooth",block:"start"})},100)},T=I=>_(D=>D.includes(I)?D.filter(O=>O!==I):[...D,I]),M=()=>{u(""),h(""),p(""),v(""),g(""),_([]),N(""),C(""),E(null)},R=I=>{if(!I)return E(null);if(I.type!=="application/pdf"){t({title:"Format invalide",description:"Le CV doit être un fichier PDF.",variant:"destructive"});return}if(I.size>
899VQe){t({title:"Fichier trop lourd",description:"Le CV ne doit pas dépasser 5 Mo.",variant:"destructive"});return}E(I)},A=async I=>{if(I.preventDefault(),!c.trim()||!d.trim()||!f.trim()||!x){t({title:"Champs manquants",description:"Merci de remplir les champs obligatoires.",variant:"destructive"});return}if(j.trim().length>0&&j.trim().length<oP){t({title:"Message trop court",description:`Votre message doit faire au moins ${oP} caractères.`,variant:"destructive"});return}i(!0);try{const D={first_name:c.trim(),last_name:d.trim(),email:f.trim(),phone:m.trim()||null,position:x,languages:w,message:j.trim()||null,portfolio_url:S.trim()||null};k&&(D.cv={filename:k.name,content_base64:await HQe(k)});const{data:O,error:z}=await Mt.functions.invoke("submit-application",{body:D});if(z)throw z;if(O!=null&&O.error)throw new Error(O.error);l(!0),M(),t({title:"Candidature envoyée",description:"Vous recevrez un email de confirmation sous peu."})}catch(D){t({title:"Envoi impossible",description:D instanceof Error?D.message:"Une erreur est survenue, merci de réessayer.",variant:"destructive"})}finally{i(!1)}};return a.jsxs(a.Fragment,{children:[a.jsx(Fn,{title:"Recrutement â Esprit Sud Magazine",description:"Rejoignez l'équipe Esprit Sud Magazine sur la Costa del Sol. 3 postes commerciaux ouverts : francophone, anglophone et grands comptes.",path:"/recrutement"}),a.jsxs("section",{className:"relative isolate overflow-hidden",children:[a.jsx("img",{src:FQe,alt:"Coucher de soleil sur la Costa del Sol en Andalousie",width:1920,height:1088,className:"absolute inset-0 h-full w-full object-cover"}),a.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-black/85 via-black/60 to-[#C8962E]/70"}),a.jsxs("div",{className:"container relative z-10 flex min-h-[60vh] flex-col items-center justify-center py-20 text-center",children:[a.jsx("img",{src:a9,alt:"Esprit Sud Magazine",className:"mb-8 h-16 w-auto md:h-20"}),a.jsx("h1",{className:"font-heading text-4xl font-bold text-white md:text-6xl",children:"Esprit Sud recrute"}),a.jsx("p",{className:"mt-4 max-w-2xl text-lg text-white/85 md:text-xl",children:"Rejoignez l'aventure Esprit Sud Magazine sur la Costa del Sol"}),a.jsx(H,{size:"lg",className:"mt-8 rounded-xl bg-[#C8962E] px-8 text-white hover:bg-[#b07f22]",onClick:()=>P(),children:"Déposer ma candidature"})]})]}),a.jsxs("section",{className:"container py-14 md:py-20",children:[a.jsx("h2",{className:"text-center font-heading text-3xl font-bold md:text-4xl",children:"Nos postes ouverts"}),a.jsx("p",{className:"mx-auto mt-3 max-w-2xl text-center text-muted-foreground",children:"Trois opportunités commerciales, de Málaga à Sotogrande."}),a.jsx("div",{className:"mt-10 grid gap-6 md:grid-cols-3",children:tI.map(I=>a.jsxs("article",{className:"flex flex-col rounded-2xl border border-border bg-card p-6 shadow-sm transition-shadow hover:shadow-lg",children:[a.jsx(ke,{className:"w-fit rounded-full bg-[#C8962E]/12 text-[#C8962E] hover:bg-[#C8962E]/20",children:I.badge}),a.jsx("h3",{className:"mt-4 font-heading text-xl font-bold",children:I.title}),a.jsx("p",{className:"mt-3 flex-1 text-sm leading-relaxed text-muted-foreground",children:I.summary}),a.jsxs("p",{className:"mt-4 flex items-center gap-1.5 text-xs text-muted-foreground",children:[a.jsx(_r,{className:"h-3.5 w-3.5 text-[#C8962E]"})," ",I.location]}),a.jsxs("div",{className:"mt-5 flex flex-col gap-2",children:[a.jsx(H,{variant:"outline",className:"rounded-xl border-[#C8962E]/40 text-[#C8962E] hover:bg-[#C8962E]/10 hover:text-[#C8962E]",onClick:()=>r(I),children:"Voir l'annonce complète"}),a.jsx(H,{className:"rounded-xl bg-[#C8962E] text-white hover:bg-[#b07f22]",onClick:()=>P(I),children:"Postuler"})]})]},I.id))})]}),a.jsx(WQe,{job:n,onClose:()=>r(null),onApply:I=>P(I)}),a.jsx("section",{ref:e,className:"bg-muted/40 py-14 md:py-20",children:a.jsxs("div",{className:"container max-w-3xl",children:[a.jsx("h2",{className:"text-center font-heading text-3xl font-bold md:text-4xl",children:"Votre candidature"}),a.jsx("p",{className:"mt-3 text-center text-muted-foreground",children:"Un seul formulaire pour les trois postes. Nous revenons vers vous sous 7 jours ouvrés."}),o?a.jsxs("div",{className:"mt-10 rounded-2xl border border-[#C8962E]/40 bg-card p-8 text-center shadow-sm",children:[a.jsx("p",{className:"font-heading text-xl font-semibold",children:"â
Votre candidature a bien été envoyée !"}),a.jsx("p",{className:"mt-2 text-muted-foreground",children:"Vous recevrez un email de confirmation sous peu."}),a.jsx(H,{variant:"outline",className:"mt-6 rounded-xl",onClick:()=>l(!1),children:"Envoyer une autre candidature"})]}):a.jsxs("form",{onSubmit:A,className:"mt-10 space-y-5 rounded-2xl border border-border bg-card p-6 shadow-sm md:p-8",children:[a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(te,{htmlFor:"firstName",children:"Prénom *"}),a.jsx(ue,{id:"firstName",required:!0,value:c,onChange:I=>u(I.target.value),className:"mt-1.5"})]}),a.jsxs("div",{children:[a.jsx(te,{htmlFor:"lastName",children:"Nom *"}),a.jsx(ue,{id:"lastName",required:!0,value:d,onChange:I=>h(I.target.value),className:"mt-1.5"})]})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(te,{htmlFor:"email",children:"Email *"}),a.jsx(ue,{id:"email",type:"email",required:!0,value:f,onChange:I=>p(I.target.value),className:"mt-1.5"})]}),a.jsxs("div",{children:[a.jsx(te,{htmlFor:"phone",children:"Téléphone"}),a.jsx(ue,{id:"phone",type:"tel",value:m,onChange:I=>v(I.target.value),className:"mt-1.5"})]})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Poste souhaité *"}),a.jsxs(lt,{value:x,onValueChange:g,children:[a.jsx(nt,{className:"mt-1.5",children:a.jsx(ct,{placeholder:"Choisissez un poste"})}),a.jsx(rt,{children:tI.map(I=>a.jsx(Ae,{value:I.title,children:I.title},I.id))})]})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Langues parlées"}),a.jsx("div",{className:"mt-2 flex flex-wrap gap-4",children:qQe.map(I=>a.jsxs("label",{className:"flex cursor-pointer items-center gap-2 text-sm",children:[a.jsx(wr,{checked:w.includes(I),onCheckedChange:()=>T(I)}),I]},I))})]}),a.jsxs("div",{children:[a.jsx(te,{htmlFor:"message",children:"Message / Lettre de motivation"}),a.jsx(fn,{id:"message",rows:6,value:j,onChange:I=>N(I.target.value),placeholder:"Parlez-nous de votre parcours et de votre motivationâ¦",className:"mt-1.5"}),a.jsxs("p",{className:`mt-1 text-right text-xs ${j.length>0&&j.length<oP?"text-destructive":"text-muted-foreground"}`,children:[j.length," / ",oP," caractères minimum"]})]}),a.jsxs("div",{children:[a.jsx(te,{htmlFor:"portfolio",children:"LinkedIn ou site web"}),a.jsx(ue,{id:"portfolio",type:"url",placeholder:"https://â¦",value:S,onChange:I=>C(I.target.value),className:"mt-1.5"})]}),a.jsxs("div",{children:[a.jsx(te,{htmlFor:"cv",children:"CV (PDF, 5 Mo maximum)"}),a.jsxs("div",{className:"mt-1.5 flex items-center gap-3",children:[a.jsx(ue,{id:"cv",type:"file",accept:"application/pdf",onChange:I=>{var D;return R(((D=I.target.files)==null?void 0:D[0])??null)},className:"cursor-pointer"}),a.jsx(Oa,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]}),k&&a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:k.name})]}),a.jsxs(H,{type:"submit",size:"lg",disabled:s,className:"w-full rounded-xl bg-[#C8962E] text-white hover:bg-[#b07f22]",children:[s&&a.jsx(Je,{className:"mr-2 h-4 w-4 animate-spin"}),"Envoyer ma candidature"]})]})]})})]})}const GQe=["Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre"];function xte(t){if(!t)return"";const e=new Date(t);return isNaN(e.getTime())?"":`${GQe[e.getMonth()]} ${e.getFullYear()}`}const YQe=()=>{const[t,e]=b.useState(!0),{lang:n}=Uu(),r=n==="en",s=h=>r&&h.title_en||h.title,i=h=>r&&h.theme_en||h.theme;b.useEffect(()=>{document.title="Nos Magazines - Esprit Sud Magazine";const h=document.querySelector('meta[name="description"]');h&&h.setAttribute("content","Retrouvez tous les numéros d'Esprit Sud Magazine, le magazine francophone dédié à l'And
899alousie. Du N°1 au dernier numéro.")},[]);const{data:o=[],isLoading:l}=Ne({queryKey:["public-magazine-issues"],queryFn:async()=>{const{data:h,error:f}=await Z.from("magazine_issues").select("id, issue_number, title, title_en, theme, theme_en, cover_image_url, pdf_digital_url, status, publication_date, created_at").eq("status","distributed").neq("issue_number",26).order("issue_number",{ascending:!1});if(f)throw f;return h??[]}}),c=[...o].sort((h,f)=>t?f.issue_number-h.issue_number:h.issue_number-f.issue_number),u=o.length?o.reduce((h,f)=>f.issue_number>((h==null?void 0:h.issue_number)??-1)?f:h,null):null,d=c.filter(h=>u&&h.id!==u.id);return a.jsxs("div",{className:"min-h-screen bg-gradient-to-b from-background via-muted/30 to-background",children:[a.jsx(Fn,{title:"Nos Magazines | Tous les numéros d'Esprit Sud",description:"Retrouvez tous les numéros d'Esprit Sud Magazine depuis 2020. Versions papier et numérique disponibles.",path:"/nos-magazines"}),a.jsxs("div",{className:"container py-12 md:py-20",children:[a.jsxs("div",{className:"text-center",children:[a.jsx("h1",{className:"font-heading text-4xl md:text-6xl font-bold tracking-tight",style:{color:"#1B4F72"},children:"Nos Magazines"}),a.jsx("p",{className:"mt-4 text-lg text-muted-foreground max-w-2xl mx-auto",children:"Retrouvez tous les numéros d'Esprit Sud Magazine depuis 2020"}),!l&&a.jsxs("p",{className:"mt-2 text-sm font-medium",style:{color:"#E74C3C"},children:[o.length," numéro",o.length>1?"s":""," publié",o.length>1?"s":""]}),a.jsx("div",{className:"mt-8 mx-auto max-w-3xl rounded-2xl border border-primary/20 bg-primary/5 p-6 md:p-8 shadow-sm",children:a.jsxs("div",{className:"flex flex-col md:flex-row items-center justify-center gap-4 md:gap-6",children:[a.jsx("div",{className:"flex h-14 w-14 shrink-0 items-center justify-center rounded-full bg-primary text-white",children:a.jsx(_r,{className:"h-7 w-7"})}),a.jsxs("div",{className:"text-center md:text-left",children:[a.jsx("h2",{className:"font-heading text-xl md:text-2xl font-bold",style:{color:"#1B4F72"},children:"Où trouver le magazine ?"}),a.jsx("p",{className:"mt-1 text-sm md:text-base text-muted-foreground",children:"Découvrez les points de dépôt près de chez vous : kiosques, librairies, offices de tourisme et autres lieux partenaires."})]}),a.jsx(H,{asChild:!0,size:"lg",className:"shrink-0 text-white hover:opacity-90 shadow-md",style:{backgroundColor:"#E74C3C"},children:a.jsx(_e,{to:"/points-de-depot",children:"Voir les points de dépôt"})})]})}),a.jsx("div",{className:"mt-6 flex justify-center",children:a.jsx(H,{asChild:!0,size:"lg",className:"rounded-xl text-white hover:opacity-90 shadow-lg",style:{backgroundColor:"#C4A265"},children:a.jsx(_e,{to:"/boutique/nos-magazines-papier",children:"ð¦ Commander en version papier â 3,99⬠/ numéro, offre 3+1 gratuit"})})})]}),l?a.jsxs("div",{className:"mt-12 grid gap-8 md:grid-cols-2",children:[a.jsx(Xt,{className:"aspect-[3/4] rounded-lg"}),a.jsx(Xt,{className:"h-64 rounded-lg"})]}):a.jsxs(a.Fragment,{children:[u&&a.jsxs("section",{className:"mt-12 md:mt-16 grid gap-10 md:grid-cols-2 items-center",children:[a.jsx("div",{className:"flex justify-center md:justify-end",children:a.jsx(_e,{to:`/nos-magazines/${u.issue_number}`,"aria-label":`Voir le magazine N°${u.issue_number}`,className:"relative w-full max-w-[400px] aspect-[3/4] rounded shadow-2xl overflow-hidden transition-transform duration-500 hover:rotate-0 block",style:{transform:"rotate(2deg)",boxShadow:"0 25px 50px -12px rgba(0,0,0,0.35)"},children:u.cover_image_url?a.jsx("img",{src:u.cover_image_url,alt:`Esprit Sud Magazine N°${u.issue_number} â ${s(u)}`,className:"h-full w-full object-cover"}):a.jsx("div",{className:"h-full w-full bg-muted flex items-center justify-center",children:a.jsx(TO,{className:"h-16 w-16 text-muted-foreground"})})})}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(ke,{className:"text-white border-0",style:{backgroundColor:"#E74C3C"},children:"Nouveau"}),a.jsxs("h2",{className:"font-heading text-3xl md:text-4xl font-bold",style:{color:"#1B4F72"},children:["N°",u.issue_number," â ",s(u)]}),u.publication_date&&a.jsx("p",{className:"text-muted-foreground",children:xte(u.publication_date)}),i(u)&&a.jsx("p",{className:"text-sm italic text-muted-foreground",children:i(u)}),a.jsxs("div",{className:"flex flex-wrap gap-3 pt-2",children:[u.pdf_digital_url?a.jsx(H,{asChild:!0,size:"lg",style:{backgroundColor:"#1B4F72"},className:"text-white hover:opacity-90",children:a.jsxs(_e,{to:`/nos-magazines/${u.issue_number}/lire`,children:[a.jsx(Pu,{className:"mr-2 h-4 w-4"}),"Lire le magazine"]})}):a.jsxs(H,{size:"lg",disabled:!0,style:{backgroundColor:"#1B4F72"},className:"text-white opacity-60",children:[a.jsx(Pu,{className:"mr-2 h-4 w-4"}),"Bientôt disponible"]}),a.jsx(H,{asChild:!0,size:"lg",variant:"outline",style:{borderColor:"#E74C3C",color:"#E74C3C"},children:a.jsxs(_e,{to:`/boutique/nos-magazines-papier?issue=${u.issue_number}`,children:[a.jsx(Wi,{className:"mr-2 h-4 w-4"}
899),"Acheter la version papier"]})}),a.jsx(H,{asChild:!0,size:"lg",variant:"ghost",children:a.jsxs(_e,{to:"/points-de-depot",children:[a.jsx(_r,{className:"mr-2 h-4 w-4"}),"Où trouver le magazine ?"]})})]})]})]}),d.length>0&&a.jsxs("section",{className:"mt-20",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[a.jsx("h2",{className:"font-heading text-2xl md:text-3xl font-bold",style:{color:"#1B4F72"},children:"Tous les numéros"}),a.jsxs(H,{variant:"outline",size:"sm",onClick:()=>e(h=>!h),children:[a.jsx(E$e,{className:"mr-2 h-4 w-4"}),t?"Du plus ancien au plus récent":"Du plus récent au plus ancien"]})]}),a.jsx("div",{className:"mt-8 grid gap-8 grid-cols-2 md:grid-cols-3 lg:grid-cols-4",children:d.map((h,f)=>a.jsxs("article",{className:"group animate-fade-in opacity-0",style:{animationDelay:`${Math.min(f*80,800)}ms`},children:[a.jsx(_e,{to:`/nos-magazines/${h.issue_number}`,className:"block aspect-[3/4] overflow-hidden rounded shadow-lg transition-all duration-300 group-hover:shadow-2xl group-hover:-translate-y-1 group-hover:scale-[1.03] bg-muted","aria-label":`Voir le magazine N°${h.issue_number}`,children:h.cover_image_url?a.jsx("img",{src:h.cover_image_url,alt:`Esprit Sud Magazine N°${h.issue_number} â ${s(h)}`,loading:"lazy",className:"h-full w-full object-cover"}):a.jsx("div",{className:"h-full w-full flex items-center justify-center",children:a.jsx(TO,{className:"h-12 w-12 text-muted-foreground"})})}),a.jsxs("div",{className:"mt-3 space-y-1",children:[a.jsxs("h3",{className:"font-heading font-semibold",style:{color:"#1B4F72"},children:["N°",h.issue_number]}),s(h)&&a.jsx("p",{className:"text-sm text-foreground/80 line-clamp-2",children:s(h)}),h.publication_date&&a.jsx("p",{className:"text-xs text-muted-foreground",children:xte(h.publication_date)}),a.jsxs("div",{className:"pt-2 flex gap-2",children:[h.pdf_digital_url?a.jsx(H,{asChild:!0,size:"sm",variant:"outline",className:"flex-1",children:a.jsx(_e,{to:`/nos-magazines/${h.issue_number}/lire`,children:"Feuilleter"})}):a.jsx(H,{size:"sm",variant:"outline",className:"flex-1 opacity-60",disabled:!0,children:"Feuilleter"}),a.jsx(H,{asChild:!0,size:"sm",className:"flex-1 text-white hover:opacity-90",style:{backgroundColor:"#E74C3C"},children:a.jsx(_e,{to:`/boutique/nos-magazines-papier?issue=${h.issue_number}`,children:"Acheter"})})]})]})]},h.id))})]}),o.length===0&&a.jsx("div",{className:"mt-20 text-center text-muted-foreground",children:"Aucun numéro publié pour le moment."})]})]})]})},lP=3.99,XQe=4,cb=t=>t.toFixed(2).replace(".",",")+" â¬",JQe=()=>{const{addItem:t}=tv(),e=Gs(),[n]=Zg(),[r,s]=b.useState([]),{data:i=[],isLoading:o}=Ne({queryKey:["public-magazine-issues-papier"],queryFn:async()=>{const{data:g,error:w}=await Z.from("magazine_issues").select("id, issue_number, title, cover_image_url, status, publication_date").order("issue_number",{ascending:!1});if(w)throw w;return g??[]}}),{data:l}=Ne({queryKey:["product-nos-magazines-papier"],queryFn:async()=>{const{data:g,error:w}=await Z.from("products").select("id, name, price, tax_rate_percent, carte_privilege_discount_percent").eq("slug","nos-magazines-papier").maybeSingle();if(w)throw w;return g}}),c=b.useMemo(()=>i.length?Math.max(...i.map(g=>g.issue_number)):null,[i]);b.useEffect(()=>{const g=n.get("issue");if(!g)return;const w=parseInt(g,10);Number.isFinite(w)&&i.some(_=>_.issue_number===w)&&s(_=>_.includes(w)?_:[..._,w].sort((j,N)=>N-j))},[n,i]);const u=g=>{s(w=>w.includes(g)?w.filter(_=>_!==g):[...w,g].sort((_,j)=>j-_))},d=r.length,h=Math.floor(d/XQe),f=d-h,p=f*lP,m=d*lP,v=m-p,x=()=>{var _;if(!l){ee.error("Produit indisponible pour le moment");return}if(r.length===0)return;const g=r.map(j=>`N°${j}`).join(", "),w=`${r.join("-")}`;t({product_id:l.id,variant_id:"magazines-papier-bundle",stripe_price_id:"",name:l.name||"Magazines Esprit Sud - Version papier",variant_name:`${g}${h>0?` (${d} numéros dont ${h} offert${h>1?"s":""})`:""}`,format:"papier",image:((_=i.find(j=>j.issue_number===r[0]))==null?void 0:_.cover_image_url)||"",price:lP,quantity:f,product_type:"physical",carte_privilege_discount_percent:l.carte_privilege_discount_percent||0,tax_rate:Number(l.tax_rate_percent)||4,metadata:{selected_issues:r,total_issues:d,free_issues:h,edit_url:"/boutique/nos-magazines-papier",variant_key:w}}),ee.success("Ajouté au panier",{description:`${d} numéro${d>1?"s":""}${h>0?` dont ${h} offert${h>1?"s":""}`:""}`,action:{label:"Voir le panier",onClick:()=>e("/boutique/panier")}})};return b.useEffect(()=>{document.title="Magazines Esprit Sud en version papier - 3,99⬠/ numéro"},[]),a.jsxs("div",{className:"min-h-screen bg-gradient-to-b from-background via-muted/30 to-background",children:[a.jsx(Fn,{title:"Magazines papier Esprit Sud â 3,99⬠/ numéro",description:"Commandez vos numéros d'Esprit Sud Magazine en version papier. Offre spéciale : 3 achetés = 1 offert !",path:"/boutique/nos-magazines-papier"}),a.jsxs("div",{className:"container py-8 md:py-14",children:[a.jsx(H,{variant:"ghost",size:"sm",asChild:!0,className:"mb-6",children:a.jsxs(_e,{to:"/boutique",children:[a.jsx(jr,{className:"mr-2 h-4 w-4"})," Retour à la boutique"]})}),a.jsxs("header",{className:"text-center max-w-3xl mx-auto",children:[a.jsx("h1",{className:"font-heading text-4xl md:text-5xl font-bold tracking-tight",style:{color:"#1B4F72"},children:"Nos Magazines en version papier"}),a.jsxs("p",{className:"mt-3 text-lg text-muted-foreground",children:["3,99⬠le numéro â ",a.jsx("span",{className:"font-semibold",style:{color:"#E74C3C"},children:"Offre spéciale : 3 achetés = 1 offert !"})]})]}),a.jsxs("div",{className:"mt-6 rounded-xl px-6 py-4 text-center text-white font-medium shadow-lg flex items-center justify-center gap-3",style:{backgroundColor:"#C4A265"},children:[a.jsx(q$e,{className:"h-5 w-5"}),a.jsx("span",{children:"ð OFFRE 3+1 GRATUIT â Choisissez 4 numéros, le 4ème est offert
899!"})]}),a.jsxs("div",{className:"mt-10 grid gap-8 lg:grid-cols-[1fr_360px]",children:[a.jsxs("section",{children:[a.jsx("h2",{className:"font-heading text-2xl font-bold mb-4",style:{color:"#1B4F72"},children:"Choisissez vos numéros"}),o?a.jsx("div",{className:"grid gap-4 grid-cols-2 md:grid-cols-3 lg:grid-cols-4",children:Array.from({length:8}).map((g,w)=>a.jsx(Xt,{className:"aspect-[3/4] rounded-lg"},w))}):a.jsx("div",{className:"grid gap-4 grid-cols-2 md:grid-cols-3 lg:grid-cols-4",children:i.map(g=>{const w=r.includes(g.issue_number),_=g.issue_number===c;return a.jsxs("button",{type:"button",onClick:()=>u(g.issue_number),className:`group relative text-left rounded-lg overflow-hidden border-2 transition-all bg-card shadow-sm hover:shadow-md ${w?"border-[#1B4F72] ring-2 ring-[#1B4F72]/30":"border-transparent"}`,children:[a.jsx("div",{className:"absolute top-2 right-2 z-10",children:a.jsx("div",{className:`h-6 w-6 rounded-md border-2 flex items-center justify-center transition-colors ${w?"bg-[#1B4F72] border-[#1B4F72] text-white":"bg-white/90 border-white"}`,children:w&&a.jsx(Ma,{className:"h-4 w-4"})})}),_&&a.jsx(ke,{className:"absolute top-2 left-2 z-10 text-white border-0",style:{backgroundColor:"#E74C3C"},children:"Nouveau"}),a.jsx("div",{className:"aspect-[3/4] bg-muted",children:g.cover_image_url?a.jsx("img",{src:g.cover_image_url,alt:`Esprit Sud N°${g.issue_number}`,loading:"lazy",className:"h-full w-full object-cover"}):a.jsx("div",{className:"h-full w-full flex items-center justify-center",children:a.jsx(TO,{className:"h-10 w-10 text-muted-foreground"})})}),a.jsxs("div",{className:"p-3",children:[a.jsxs("p",{className:"font-heading font-semibold text-sm",style:{color:"#1B4F72"},children:["N°",g.issue_number]}),g.title&&a.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2 mt-0.5",children:g.title})]})]},g.id)})})]}),a.jsxs("aside",{className:"lg:sticky lg:top-24 h-fit rounded-xl border border-border bg-card p-6 shadow-sm",children:[a.jsx("h3",{className:"font-heading text-lg font-bold mb-4",style:{color:"#1B4F72"},children:"Votre commande"}),a.jsxs("p",{className:"text-sm",children:["Numéros sélectionnés : ",a.jsx("span",{className:"font-bold",children:d})]}),r.length>0&&a.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:r.map(g=>`N°${g}`).join(", ")}),a.jsx("hr",{className:"my-4"}),d===0?a.jsx("p",{className:"text-sm text-muted-foreground italic",children:"Cochez au moins un numéro pour voir le récapitulatif."}):a.jsxs("div",{className:"space-y-2 text-sm",children:[a.jsxs("div",{className:"flex justify-between",children:[a.jsxs("span",{className:"text-muted-foreground",children:[f," à ",cb(lP)]}),a.jsx("span",{className:"font-medium",children:cb(p)})]}),h>0&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex justify-between text-muted-foreground line-through",children:[a.jsx("span",{children:"Prix normal"}),a.jsx("span",{children:cb(m)})]}),a.jsxs("div",{className:"flex justify-between text-green-600 font-medium",children:[a.jsxs("span",{children:[h," numéro",h>1?"s":""," offert",h>1?"s":""]}),a.jsxs("span",{children:["-",cb(v)]})]})]}),a.jsx("hr",{className:"my-2"}),a.jsxs("div",{className:"flex justify-between font-heading text-lg font-bold",children:[a.jsx("span",{children:"Total"}),a.jsx("span",{style:{color:"#1B4F72"},children:cb(p)})]}),h>0&&a.jsxs("p",{className:"text-xs text-green-600 font-medium",children:["Vous économisez ",cb(v)," !"]})]}),a.jsxs(H,{size:"lg",className:"mt-6 w-full rounded-xl text-white hover:opacity-90",style:{backgroundColor:"#1B4F72"},disabled:d===0,onClick:x,children:[a.jsx($f,{className:"mr-2 h-4 w-4"}),"Ajouter au panier"]}),a.jsx("p",{className:"mt-3 text-xs text-muted-foreground text-center",children:"Hors frais de livraison"})]})]})]})]})},Za=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),F8=[.001,0,0,.001,0,0],N5=1.35,yl={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},Ud={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},jk="pdfjs_internal_editor_",Bt={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102}
899,sn={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_THICKNESS:32,HIGHLIGHT_FREE:33,HIGHLIGHT_SHOW_ALL:34,DRAW_STEP:41},L0e={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},Ni={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},bC={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},ds={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26},Tb={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},j2={ERRORS:0,WARNINGS:1,INFOS:5},Y_={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91,setStrokeTransparent:92,setFillTransparent:93,rawFillPath:94},cP={moveTo:0,lineTo:1,curveTo:2,closePath:3},F0e={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let G3=j2.WARNINGS;function QQe(t){Number.isInteger(t)&&(G3=t)}function ZQe(){return G3}function Y3(t){G3>=j2.INFOS&&console.info(`Info: ${t}`)}function Ut(t){G3>=j2.WARNINGS&&console.warn(`Warning: ${t}`)}function Zn(t){throw new Error(t)}function un(t,e){t||Zn(e)}function eZe(t){switch(t==null?void 0:t.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function w7(t,e=null,n=null){if(!t)return null;if(n&&typeof t=="string"){if(n.addDefaultProtocol&&t.startsWith("www.")){const s=t.match(/\./g);(s==null?void 0:s.length)>=2&&(t=`http://${t}`)}if(n.tryConvertEncoding)try{t=iZe(t)}catch{}}const r=e?URL.parse(t,e):URL.parse(t);return eZe(r)?r:null}function _7(t,e,n=!1){const r=URL.parse(t);return r?(r.hash=e,r.href):n&&w7(t,"http://example.com")?t.split("#",1)[0]+`${e?`#${e}`:""}`:""}function Gt(t,e,n,r=!1){return Object.defineProperty(t,e,{value:n,enumerable:!r,configurable:!0,writable:!1}),n}const I0=function(){function e(n,r){this.message=n,this.name=r}return e.prototype=new Error,e.constructor=e,e}();class yte extends I0{constructor(e,n){super(e,"PasswordException"),this.code=n}}class C5 extends I0{constructor(e,n){super(e,"UnknownErrorException"),this.details=n}}class nI extends I0{constructor(e){super(e,"InvalidPDFException")}}class Sk extends I0{constructor(e,n,r){super(e,"ResponseException"),this.status=n,this.missing=r}}class tZe extends I0{constructor(e){super(e,"FormatError")}}class ep extends I0{constructor(e){super(e,"AbortException")}}function $0e(t){(typeof t!="object"||(t==null?void 0:t.length)===void 0)&&Zn("Invalid argument for bytesToString");const e=t.length,n=8192;if(e<n)return String.fromCharCode.apply(null,t);const r=[];for(let s=0;s<e;s+=n){const i=Math.min(s+n,e),o=t.subarray(s,i);r.push(String.fromCharCode.apply(null,o))}return r.join("")}function S2(t){typeof t!="string"&&Zn("Invalid argument for stringToBytes");const e=t.length,n=new Uint8Array(e);for(let r=0;r<e;++r)n[r]=t.charCodeAt(r)&255;return n}function nZe(t){return String.fromCharCode(t>>24&255,t>>16&255,t>>8&255,t&255)}function rZe(){const t=new Uint8Array(4);return t[0]=1,new Uint32Array(t.buffer,0,1)[0]===1}function sZe(){try{return new Function(""),!0}catch{return!1}}class yi{static get isLittleEndian(){return Gt(this,"isLittleEndian",rZe())}static get isEvalSupported(){return Gt(this,"isEvalSupported",sZe())}static get isOffscreenCanvasSupported(){return Gt(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return Gt(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get platform(){const{platform:e,userAgent:n}=navigator;return Gt(this,"platform",{isAndroid:n.includes("Android"),isLinux:e.includes("Linux"),isMac:e.includes("Mac"),isWindows:e.includes("Win"),isFirefox:n.includes("Firefox")})}static get isCSSRoundSupported(){var e,n;return Gt(this,"isCSSRoundSupported",(n=(e=globalThis.CSS)==null?void 0:e.supports)==null?void 0:n.call(e,"width: round(1.5px, 1px)"))}}const k5=Array.from(Array(256).keys(),t=>t.toString(16).padStart(2,"0"));var Hf,HM,$8;class ot{static makeHexColor(e,n,r){return`#${k5[e]}${k5[n]}${k5[r]}`}static domMatrixToTransform(e){return[e.a,e.b,e.c,e.d,e.e,e.f]}static scaleMinMax(e,n){let r;e[0]?(e[0]<0&&(r=n[0],n[0]=n[2],n[2]=r),n[0]*=e[0],n[2]*=e[0],e[3]<0&&(r=n[1],n[1]=n[3],n[3]=r),n[1]*=e[3],n[3]*=e[3]):(r=n[0],n[0]=n[1],n[1]=r,r=n[2],n[2]=n[3],n[3]=r,e[1]<0&&(r=n[1],n[1]=n[3],n[3]=r),n[1]*=e[1],n[3]*=e[1],e[2]<0&&(r=n[0],n[0]=n[2],n[2]=r),n[0]*=e[2],n[2]*=e[2]),n[0]+=e[4],n[1]+=e[5],n[2]+=e[4],n[3]+=e[5]}static transform(e,n){return[e[0]*n[0]+e[2]*n[1],e[1]*n[0]+e[3]*n[1],e[0]*n[2]+e[2]*n[3],e[1]*n[2]+e[3]*n[3],e[0]*n[4]+e[2]*n[5]+e[4],e[1]*n[4]+e[3]*n[5]+e[5]]}static multiplyByDOMMatrix(e,n){return[e[0]*n.a+e[2]*n.b,e[1]*n.a+e[3]*n.b,e[0]*n.c+e[2]*n.d,e[1]*n.c+e[3]*n.d,e[0]*n.e+e[2]*n.f+e[4],e[1]*n.e+e[3]*n.f+e[5]]}static applyTransform(e,n,r=0){const s=e[r],i=e[r+1];e[r]=s*n[0]+i*n[2]+n[4],e[r+1]=s*n[1]+i*n[3]+n[5]}
899static applyTransformToBezier(e,n,r=0){const s=n[0],i=n[1],o=n[2],l=n[3],c=n[4],u=n[5];for(let d=0;d<6;d+=2){const h=e[r+d],f=e[r+d+1];e[r+d]=h*s+f*o+c,e[r+d+1]=h*i+f*l+u}}static applyInverseTransform(e,n){const r=e[0],s=e[1],i=n[0]*n[3]-n[1]*n[2];e[0]=(r*n[3]-s*n[2]+n[2]*n[5]-n[4]*n[3])/i,e[1]=(-r*n[1]+s*n[0]+n[4]*n[1]-n[5]*n[0])/i}static axialAlignedBoundingBox(e,n,r){const s=n[0],i=n[1],o=n[2],l=n[3],c=n[4],u=n[5],d=e[0],h=e[1],f=e[2],p=e[3];let m=s*d+c,v=m,x=s*f+c,g=x,w=l*h+u,_=w,j=l*p+u,N=j;if(i!==0||o!==0){const S=i*d,C=i*f,k=o*h,E=o*p;m+=k,g+=k,x+=E,v+=E,w+=S,N+=S,j+=C,_+=C}r[0]=Math.min(r[0],m,x,v,g),r[1]=Math.min(r[1],w,j,_,N),r[2]=Math.max(r[2],m,x,v,g),r[3]=Math.max(r[3],w,j,_,N)}static inverseTransform(e){const n=e[0]*e[3]-e[1]*e[2];return[e[3]/n,-e[1]/n,-e[2]/n,e[0]/n,(e[2]*e[5]-e[4]*e[3])/n,(e[4]*e[1]-e[5]*e[0])/n]}static singularValueDecompose2dScale(e,n){const r=e[0],s=e[1],i=e[2],o=e[3],l=r**2+s**2,c=r*i+s*o,u=i**2+o**2,d=(l+u)/2,h=Math.sqrt(d**2-(l*u-c**2));n[0]=Math.sqrt(d+h||1),n[1]=Math.sqrt(d-h||1)}static normalizeRect(e){const n=e.slice(0);return e[0]>e[2]&&(n[0]=e[2],n[2]=e[0]),e[1]>e[3]&&(n[1]=e[3],n[3]=e[1]),n}static intersect(e,n){const r=Math.max(Math.min(e[0],e[2]),Math.min(n[0],n[2])),s=Math.min(Math.max(e[0],e[2]),Math.max(n[0],n[2]));if(r>s)return null;const i=Math.max(Math.min(e[1],e[3]),Math.min(n[1],n[3])),o=Math.min(Math.max(e[1],e[3]),Math.max(n[1],n[3]));return i>o?null:[r,i,s,o]}static pointBoundingBox(e,n,r){r[0]=Math.min(r[0],e),r[1]=Math.min(r[1],n),r[2]=Math.max(r[2],e),r[3]=Math.max(r[3],n)}static rectBoundingBox(e,n,r,s,i){i[0]=Math.min(i[0],e,r),i[1]=Math.min(i[1],n,s),i[2]=Math.max(i[2],e,r),i[3]=Math.max(i[3],n,s)}static bezierBoundingBox(e,n,r,s,i,o,l,c,u){u[0]=Math.min(u[0],e,l),u[1]=Math.min(u[1],n,c),u[2]=Math.max(u[2],e,l),u[3]=Math.max(u[3],n,c),V(this,Hf,$8).call(this,e,r,i,l,n,s,o,c,3*(-e+3*(r-i)+l),6*(e-2*r+i),3*(r-e),u),V(this,Hf,$8).call(this,e,r,i,l,n,s,o,c,3*(-n+3*(s-o)+c),6*(n-2*s+o),3*(s-n),u)}}Hf=new WeakSet,HM=function(e,n,r,s,i,o,l,c,u,d){if(u<=0||u>=1)return;const h=1-u,f=u*u,p=f*u,m=h*(h*(h*e+3*u*n)+3*f*r)+p*s,v=h*(h*(h*i+3*u*o)+3*f*l)+p*c;d[0]=Math.min(d[0],m),d[1]=Math.min(d[1],v),d[2]=Math.max(d[2],m),d[3]=Math.max(d[3],v)},$8=function(e,n,r,s,i,o,l,c,u,d,h,f){if(Math.abs(u)<1e-12){Math.abs(d)>=1e-12&&V(this,Hf,HM).call(this,e,n,r,s,i,o,l,c,-h/d,f);return}const p=d**2-4*h*u;if(p<0)return;const m=Math.sqrt(p),v=2*u;V(this,Hf,HM).call(this,e,n,r,s,i,o,l,c,(-d+m)/v,f),V(this,Hf,HM).call(this,e,n,r,s,i,o,l,c,(-d-m)/v,f)},q(ot,Hf);function iZe(t){return decodeURIComponent(escape(t))}let A5=null,bte=null;function z0e(t){return A5||(A5=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu,bte=new Map([["ï¬
","ſt"]])),t.replaceAll(A5,(e,n,r)=>n?n.normalize("NFKC"):bte.get(r))}function j7(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();const t=new Uint8Array(32);return crypto.getRandomValues(t),$0e(t)}const S7="pdfjs_internal_id_";function aZe(t,e,n){if(!Array.isArray(n)||n.length<2)return!1;const[r,s,...i]=n;if(!t(r)&&!Number.isInteger(r)||!e(s))return!1;const o=i.length;let l=!0;switch(s.name){case"XYZ":if(o<2||o>3)return!1;break;case"Fit":case"FitB":return o===0;case"FitH":case"FitBH":case"FitV":case"FitBV":if(o>1)return!1;break;case"FitR":if(o!==4)return!1;l=!1;break;default:return!1}for(const c of i)if(!(typeof c=="number"||l&&c===null))return!1;return!0}function va(t,e,n){return Math.min(Math.max(t,e),n)}function B0e(t){return Uint8Array.prototype.toBase64?t.toBase64():btoa($0e(t))}function oZe(t){return Uint8Array.fromBase64?Uint8Array.fromBase64(t):S2(atob(t))}typeof Promise.try!="function"&&(Promise.try=function(t,...e){return new Promise(n=>{n(t(...e))})});typeof Math.sumPrecise!="function"&&(Math.sumPrecise=function(t){return t.reduce((e,n)=>e+n,0)});class Nk{static textContent(e){const n=[],r={items:n,styles:Object.create(null)};function s(i){var c;if(!i)return;let o=null;const l=i.name;if(l==="#text")o=i.value;else if(Nk.shouldBuildText(l))(c=i==null?void 0:i.attributes)!=null&&c.textContent?o=i.attributes.textContent:i.value&&(o=i.value);else return;if(o!==null&&n.push({str:o}),!!i.children)for(const u of i.children)s(u)}return s(e),r}static shouldBuildText(e){return!(e==="textarea"||e==="input"||e==="option"||e==="select")}}class N7{static setupStorage(e,n,r,s,i){const o=s.getValue(n,{value:null});switch(r.name){case"textarea":if(o.value!==null&&(e.textContent=o.value),i==="print")break;e.addEventListener("input",l=>{s.setValue(n,{value:l.target.value})});break;case"input":if(r.attributes.type==="radio"||r.attributes.type==="checkbox"){if(o.value===r.attributes.xfaOn?e.setAttribute("checked",!0):o.value===r.attributes.xfaOff&&e.removeAttribute("checked"),i==="print")break;e.addEventListener("change",l=>{s.setValue(n,{value:l.target.checked?l.target.getAttribute("xfaOn"):l.target.getAttribute("xfaOff")})})}else{if(o.value!==null&&e.setAttribute("value",o.value),i==="print")break;e.addEventListener("input",l=>{s.setValue(n,{value:l.target.value})})}break;case"select":if(o.value!==null){e.setAttribute("value",o.value);for(const l of r.children)l.attributes.value===o.value?l.attributes.selected=!0:l.attributes.hasOwnProperty("selected")&&delete l.attributes.selected}e.addEventListener("input",l=>{const c=l.target.options,u=c.selectedIndex===-1?"":c[c.selectedIndex].value;s.setValue(n,{value:u})});break}}static setAttributes({html:e,element:n,storage:r=null,intent:s,linkService:i}){const{attributes:o}=n,l=e instanceof HTMLAnchorElement;o.type==="radio"&&(o.name=`${o.name}-${s}`);for(const[c,u]of Object.entries(o))if(u!=null)switch(c){case"class":u.length&&e.setAttribute(c,u.join(" "));break;case"dataId":break;case"id":e.setAttribute("data-element-id",u);break;case"style":Object.assign(e.style,u);break;case"textContent":e.textContent=u;break;default:(!l||c!=="href"&&c!=="newWindow")&&e.setAttribute(c,u)}l&&i.addLinkAttributes(e,o.href,o.newWindow),r&&o.dataId&&this.setupStorage(e,o.dataId,n,r)}static render(e){var h,f;const n=e.annotationStorage,r=e.linkService,s=e.xfaHtml,i=e.intent||"display",o=document.createElement(s.name);s.attributes&&this.setAttributes({html:o,element:s,intent:i,linkService:r});const l=i!=="richText",c=e.div;if(c.append(o),e.viewport){const p=`matrix(${e.viewport.transform.join(",")})`;c.style.transform=p}l&&c.setAttribute("class","xfaLayer xfaFont");const u=[];
899if(s.children.length===0){if(s.value){const p=document.createTextNode(s.value);o.append(p),l&&Nk.shouldBuildText(s.name)&&u.push(p)}return{textDivs:u}}const d=[[s,-1,o]];for(;d.length>0;){const[p,m,v]=d.at(-1);if(m+1===p.children.length){d.pop();continue}const x=p.children[++d.at(-1)[1]];if(x===null)continue;const{name:g}=x;if(g==="#text"){const _=document.createTextNode(x.value);u.push(_),v.append(_);continue}const w=(h=x==null?void 0:x.attributes)!=null&&h.xmlns?document.createElementNS(x.attributes.xmlns,g):document.createElement(g);if(v.append(w),x.attributes&&this.setAttributes({html:w,element:x,storage:n,intent:i,linkService:r}),((f=x.children)==null?void 0:f.length)>0)d.push([x,-1,w]);else if(x.value){const _=document.createTextNode(x.value);l&&Nk.shouldBuildText(g)&&u.push(_),w.append(_)}}for(const p of c.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))p.setAttribute("readOnly",!0);return{textDivs:u}}static update(e){const n=`matrix(${e.viewport.transform.join(",")})`;e.div.style.transform=n,e.div.hidden=!1}}const Dh="http://www.w3.org/2000/svg",Gv=class Gv{};Te(Gv,"CSS",96),Te(Gv,"PDF",72),Te(Gv,"PDF_TO_CSS_UNITS",Gv.CSS/Gv.PDF);let tp=Gv;async function Bj(t,e="text"){if(uN(t,document.baseURI)){const n=await fetch(t);if(!n.ok)throw new Error(n.statusText);switch(e){case"arraybuffer":return n.arrayBuffer();case"blob":return n.blob();case"json":return n.json()}return n.text()}return new Promise((n,r)=>{const s=new XMLHttpRequest;s.open("GET",t,!0),s.responseType=e,s.onreadystatechange=()=>{if(s.readyState===XMLHttpRequest.DONE){if(s.status===200||s.status===0){switch(e){case"arraybuffer":case"blob":case"json":n(s.response);return}n(s.responseText);return}r(new Error(s.statusText))}},s.send(null)})}class N2{constructor({viewBox:e,userUnit:n,scale:r,rotation:s,offsetX:i=0,offsetY:o=0,dontFlip:l=!1}){this.viewBox=e,this.userUnit=n,this.scale=r,this.rotation=s,this.offsetX=i,this.offsetY=o,r*=n;const c=(e[2]+e[0])/2,u=(e[3]+e[1])/2;let d,h,f,p;switch(s%=360,s<0&&(s+=360),s){case 180:d=-1,h=0,f=0,p=1;break;case 90:d=0,h=1,f=1,p=0;break;case 270:d=0,h=-1,f=-1,p=0;break;case 0:d=1,h=0,f=0,p=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}l&&(f=-f,p=-p);let m,v,x,g;d===0?(m=Math.abs(u-e[1])*r+i,v=Math.abs(c-e[0])*r+o,x=(e[3]-e[1])*r,g=(e[2]-e[0])*r):(m=Math.abs(c-e[0])*r+i,v=Math.abs(u-e[1])*r+o,x=(e[2]-e[0])*r,g=(e[3]-e[1])*r),this.transform=[d*r,h*r,f*r,p*r,m-d*r*c-f*r*u,v-h*r*c-p*r*u],this.width=x,this.height=g}get rawDims(){const e=this.viewBox;return Gt(this,"rawDims",{pageWidth:e[2]-e[0],pageHeight:e[3]-e[1],pageX:e[0],pageY:e[1]})}clone({scale:e=this.scale,rotation:n=this.rotation,offsetX:r=this.offsetX,offsetY:s=this.offsetY,dontFlip:i=!1}={}){return new N2({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:e,rotation:n,offsetX:r,offsetY:s,dontFlip:i})}convertToViewportPoint(e,n){const r=[e,n];return ot.applyTransform(r,this.transform),r}convertToViewportRectangle(e){const n=[e[0],e[1]];ot.applyTransform(n,this.transform);const r=[e[2],e[3]];return ot.applyTransform(r,this.transform),[n[0],n[1],r[0],r[1]]}convertToPdfPoint(e,n){const r=[e,n];return ot.applyInverseTransform(r,this.transform),r}}class X3 extends I0{constructor(e,n=0){super(e,"RenderingCancelledException"),this.extraDelay=n}}function C2(t){const e=t.length;let n=0;for(;n<e&&t[n].trim()==="";)n++;return t.substring(n,n+5).toLowerCase()==="data:"}function J3(t){return typeof t=="string"&&/\.pdf$/i.test(t)}function U0e(t){return[t]=t.split(/[#?]/,1),t.substring(t.lastIndexOf("/")+1)}function q0e(t,e="document.pdf"){if(typeof t!="string")return e;if(C2(t))return Ut('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),e;const r=(l=>{try{return new URL(l)}catch{try{return new URL(decodeURIComponent(l))}catch{try{return new URL(l,"https://foo.bar")}catch{try{return new URL(decodeURIComponent(l),"https://foo.bar")}catch{return null}}}}})(t);if(!r)return e;const s=l=>{try{let c=decodeURIComponent(l);return c.includes("/")?(c=c.split("/").at(-1),c.test(/^\.pdf$/i)?c:l):c}catch{return l}},i=/\.pdf$/i,o=r.pathname.split("/").at(-1);if(i.test(o))return s(o);if(r.searchParams.size>0){const l=Array.from(r.searchParams.values()).reverse();for(const u of l)if(i.test(u))return s(u);const c=Array.from(r.searchParams.keys()).reverse();for(const u of c)if(i.test(u))return s(u)}if(r.hash){const c=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i.exec(r.hash);if(c)return s(c[0])}return e}class wte{constructor(){Te(this,"started",Object.create(null));Te(this,"times",[])}time(e){e in this.started&&Ut(`Timer is already running for ${e}`),this.started[e]=Date.now()}timeEnd(e){e in this.started||Ut(`Timer has not been started for ${e}`),this.times.push({name:e,start:this.started[e],end:Date.now()}),delete this.started[e]}toString(){const e=[];let n=0;for(const{name:r}of this.times)n=Math.max(r.length,n);for(const{name:r,start:s,end:i}of this.times)e.push(`${r.padEnd(n)} ${i-s}ms 900`);return e.join("")}}function uN(t,e){const n=e?URL.parse(t,e):URL.parse(t);return(n==null?void 0:n.protocol)==="http:"||(n==null?void 0:n.protocol)==="https:"}function $l(t){t.preventDefault()}function Dr(t){t.preventDefault(),t.stopPropagation()}function lZe(t){console.log("Deprecated API usage: "+t)}var dA;class Ck{static toDateObject(e){if(e instanceof Date)return e;if(!e||typeof e!="string")return null;y(this,dA)||$(this,dA,new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const n=y(this,dA).exec(e);if(!n)return null;const r=parseInt(n[1],10);let s=parseInt(n[2],10);s=s>=1&&s<=12?s-1:0;let i=parseInt(n[3],10);i=i>=1&&i<=31?i:1;let o=parseInt(n[4],10);o=o>=0&&o<=23?o:0;let l=parseInt(n[5],10);l=l>=0&&l<=59?l:0;let c=parseInt(n[6],10);c=c>=0&&c<=59?c:0;const u=n[7]||"Z";let d=parseInt(n[8],10);d=d>=0&&d<=23?d:0;let h=parseInt(n[9],10)||0;return h=h>=0&&h<=59?h:0,u==="-"?(o+=d,l+=h):u==="+"&&(o-=d,l-=h),new Date(Date.UTC(r,s,i,o,l,c))}}dA=new WeakMap,q(Ck,dA);function V0e(t,{scale:e=1,rotation:n=0}){const{width:r,height:s}=t.attributes.style,i=[0,0,parseInt(r),parseInt(s)];return new N2({viewBox:i,userUnit:1,scale:e,rotation:n})}function Uj(t){if(t.startsWith("#")){const e=parseInt(t.slice(1),16);return[(e&16711680)>>16,(e&65280)>>8,e&255]}return t.startsWith("rgb(")?t.slice(4,-1).split(",").map(e=>parseInt(e)):t.startsWith("rgba(")?t.slice(5,-1).split(",").map(e=>parseInt(e)).slice(0,3):(Ut(`Not a valid color format: "${t}"`),[0,0,0])}function cZe(t){const e=document.createElement("span");e.style.visibility="hidden",e.style.colorScheme="only light",document.body.append(e);for(const n of t.keys()){e.style.color=n;const r=window.getComputedStyle(e).color;t.set(n,Uj(r))}e.remove()}function Rr(t){const{a:e,b:n,c:r,d:s,e:i,f:o}=t.getTransform();return[e,n,r,s,i,o]}function Qu(t){const{a:e,b:n,c:r,d:s,e:i,f:o}=t.getTransform().invertSelf();return[e,n,r,s,i,o]}function $g(t,e,n=!1,r=!0){if(e instanceof N2){const{pageWidth:s,pageHeight:i}=e.rawDims,{style:o}=t,l=yi.isCSSRoundSupported,c=`var(--total-scale-factor) * ${s}px`,u=`var(--total-scale-factor) * ${i}px`,d=l?`round(down, ${c}, var(--scale-round-x))`:`calc(${c})`,h=l?`round(down, ${u}, var(--scale-round-y))`:`calc(${u})`;!n||e.rotation%180===0?(o.width=d,o.height=h):(o.width=h,o.height=d)}r&&t.setAttribute("data-main-rotation",e.rotation)}class $u{constructor(){const{pixelRatio:e}=$u;this.sx=e,this.sy=e}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}limitCanvas(e,n,r,s,i=-1){let o=1/0,l=1/0,c=1/0;r=$u.capPixels(r,i),r>0&&(o=Math.sqrt(r/(e*n))),s!==-1&&(l=s/e,c=s/n);const u=Math.min(o,l,c);return this.sx>u||this.sy>u?(this.sx=u,this.sy=u,!0):!1}static get pixelRatio(){return globalThis.devicePixelRatio||1}static capPixels(e,n){if(n>
900=0){const r=Math.ceil(window.screen.availWidth*window.screen.availHeight*this.pixelRatio**2*(1+n/100));return e>0?Math.min(e,r):r}return e}}const rI=["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"];class uZe{static get isDarkMode(){var e;return Gt(this,"isDarkMode",!!((e=window==null?void 0:window.matchMedia)!=null&&e.call(window,"(prefers-color-scheme: dark)").matches))}}class H0e{static get commentForegroundColor(){const e=document.createElement("span");e.classList.add("comment","sidebar");const{style:n}=e;n.width=n.height="0",n.display="none",n.color="var(--comment-fg-color)",document.body.append(e);const{color:r}=window.getComputedStyle(e);return e.remove(),Gt(this,"commentForegroundColor",Uj(r))}}function W0e(t,e,n,r){r=Math.min(Math.max(r??1,0),1);const s=255*(1-r);return t=Math.round(t*r+s),e=Math.round(e*r+s),n=Math.round(n*r+s),[t,e,n]}function _te(t,e){const n=t[0]/255,r=t[1]/255,s=t[2]/255,i=Math.max(n,r,s),o=Math.min(n,r,s),l=(i+o)/2;if(i===o)e[0]=e[1]=0;else{const c=i-o;switch(e[1]=l<.5?c/(i+o):c/(2-i-o),i){case n:e[0]=((r-s)/c+(r<s?6:0))*60;break;case r:e[0]=((s-n)/c+2)*60;break;case s:e[0]=((n-r)/c+4)*60;break}}e[2]=l}function z8(t,e){const n=t[0],r=t[1],s=t[2],i=(1-Math.abs(2*s-1))*r,o=i*(1-Math.abs(n/60%2-1)),l=s-i/2;switch(Math.floor(n/60)){case 0:e[0]=i+l,e[1]=o+l,e[2]=l;break;case 1:e[0]=o+l,e[1]=i+l,e[2]=l;break;case 2:e[0]=l,e[1]=i+l,e[2]=o+l;break;case 3:e[0]=l,e[1]=o+l,e[2]=i+l;break;case 4:e[0]=o+l,e[1]=l,e[2]=i+l;break;case 5:case 6:e[0]=i+l,e[1]=l,e[2]=o+l;break}}function jte(t){return t<=.03928?t/12.92:((t+.055)/1.055)**2.4}function Ste(t,e,n){z8(t,n),n.map(jte);const r=.2126*n[0]+.7152*n[1]+.0722*n[2];z8(e,n),n.map(jte);const s=.2126*n[0]+.7152*n[1]+.0722*n[2];return r>s?(r+.05)/(s+.05):(s+.05)/(r+.05)}const Nte=new Map;function K0e(t,e){const n=t[0]+t[1]*256+t[2]*65536+e[0]*16777216+e[1]*4294967296+e[2]*1099511627776;let r=Nte.get(n);if(r)return r;const s=new Float32Array(9),i=s.subarray(0,3),o=s.subarray(3,6);_te(t,o);const l=s.subarray(6,9);_te(e,l);const c=l[2]<.5,u=c?12:4.5;if(o[2]=c?Math.sqrt(o[2]):1-Math.sqrt(1-o[2]),Ste(o,l,i)<u){let d,h;c?(d=o[2],h=1):(d=0,h=o[2]);const f=.005;for(;h-d>f;){const p=o[2]=(d+h)/2;c===Ste(o,l,i)<u?d=p:h=p}o[2]=c?h:d}return z8(o,i),r=ot.makeHexColor(Math.round(i[0]*255),Math.round(i[1]*255),Math.round(i[2]*255)),Nte.set(n,r),r}function C7({html:t,dir:e,className:n},r){const s=document.createDocumentFragment();if(typeof t=="string"){const i=document.createElement("p");i.dir=e||"auto";const o=t.split(/(?:\r\n?|\n)/);for(let l=0,c=o.length;l<c;++l){const u=o[l];i.append(document.createTextNode(u)),l<c-1&&i.append(document.createElement("br"))}s.append(i)}else N7.render({xfaHtml:t,div:s,intent:"richText"});s.firstChild.classList.add("richText",n),r.append(s)}var pm,mm,sc,ic,hA,gm,s1,i1,bc,fA,oL,G0e,zi,Y0e,X0e,Pb,dN;let dZe=(bc=class{constructor(e){q(this,zi);q(this,pm,null);q(this,mm,null);q(this,sc);q(this,ic,null);q(this,hA,null);q(this,gm,null);q(this,s1,null);q(this,i1,null);$(this,sc,e),y(bc,fA)||$(bc,fA,Object.freeze({freetext:"pdfjs-editor-remove-freetext-button",highlight:"pdfjs-editor-remove-highlight-button",ink:"pdfjs-editor-remove-ink-button",stamp:"pdfjs-editor-remove-stamp-button",signature:"pdfjs-editor-remove-signature-button"}))}render(){const e=$(this,pm,document.createElement("div"));e.classList.add("editToolbar","hidden"),e.setAttribute("role","toolbar");const n=y(this,sc)._uiManager._signal;n instanceof AbortSignal&&!n.aborted&&(e.addEventListener("contextmenu",$l,{signal:n}),e.addEventListener("pointerdown",V(bc,oL,G0e),{signal:n}));const r=$(this,ic,document.createElement("div"));r.className="buttons",e.append(r);const s=y(this,sc).toolbarPosition;if(s){const{style:i}=e,o=y(this,sc)._uiManager.direction==="ltr"?1-s[0]:s[0];i.insetInlineEnd=`${100*o}%`,i.top=`calc(${100*s[1]}% + var(--editor-toolbar-vert-offset))`}return e}get div(){return y(this,pm)}hide(){var e;y(this,pm).classList.add("hidden"),(e=y(this,mm))==null||e.hideDropdown()}show(){var e,n;y(this,pm).classList.remove("hidden"),(e=y(this,hA))==null||e.shown(),(n=y(this,gm))==null||n.shown()}
900addDeleteButton(){const{editorType:e,_uiManager:n}=y(this,sc),r=document.createElement("button");r.classList.add("basic","deleteButton"),r.tabIndex=0,r.setAttribute("data-l10n-id",y(bc,fA)[e]),V(this,zi,Pb).call(this,r)&&r.addEventListener("click",s=>{n.delete()},{signal:n._signal}),y(this,ic).append(r)}async addAltText(e){const n=await e.render();V(this,zi,Pb).call(this,n),y(this,ic).append(n,y(this,zi,dN)),$(this,hA,e)}addComment(e,n=null){if(y(this,gm))return;const r=e.renderForToolbar();if(!r)return;V(this,zi,Pb).call(this,r);const s=$(this,s1,y(this,zi,dN));n?(y(this,ic).insertBefore(r,n),y(this,ic).insertBefore(s,n)):y(this,ic).append(r,s),$(this,gm,e),e.toolbar=this}addColorPicker(e){if(y(this,mm))return;$(this,mm,e);const n=e.renderButton();V(this,zi,Pb).call(this,n),y(this,ic).append(n,y(this,zi,dN))}async addEditSignatureButton(e){const n=$(this,i1,await e.renderEditButton(y(this,sc)));V(this,zi,Pb).call(this,n),y(this,ic).append(n,y(this,zi,dN))}removeButton(e){var n,r;switch(e){case"comment":(n=y(this,gm))==null||n.removeToolbarCommentButton(),$(this,gm,null),(r=y(this,s1))==null||r.remove(),$(this,s1,null);break}}async addButton(e,n){switch(e){case"colorPicker":this.addColorPicker(n);break;case"altText":await this.addAltText(n);break;case"editSignature":await this.addEditSignatureButton(n);break;case"delete":this.addDeleteButton();break;case"comment":this.addComment(n);break}}async addButtonBefore(e,n,r){const s=y(this,ic).querySelector(r);s&&e==="comment"&&this.addComment(n,s)}updateEditSignatureButton(e){y(this,i1)&&(y(this,i1).title=e)}remove(){var e;y(this,pm).remove(),(e=y(this,mm))==null||e.destroy(),$(this,mm,null)}},pm=new WeakMap,mm=new WeakMap,sc=new WeakMap,ic=new WeakMap,hA=new WeakMap,gm=new WeakMap,s1=new WeakMap,i1=new WeakMap,fA=new WeakMap,oL=new WeakSet,G0e=function(e){e.stopPropagation()},zi=new WeakSet,Y0e=function(e){y(this,sc)._focusEventsAllowed=!1,Dr(e)},X0e=function(e){y(this,sc)._focusEventsAllowed=!0,Dr(e)},Pb=function(e){const n=y(this,sc)._uiManager._signal;return!(n instanceof AbortSignal)||n.aborted?!1:(e.addEventListener("focusin",V(this,zi,Y0e).bind(this),{capture:!0,signal:n}),e.addEventListener("focusout",V(this,zi,X0e).bind(this),{capture:!0,signal:n}),e.addEventListener("contextmenu",$l,{signal:n}),!0)},dN=function(){const e=document.createElement("div");return e.className="divider",e},q(bc,oL),q(bc,fA,null),bc);var pA,_x,Jh,op,J0e,Q0e,B8;class hZe{constructor(e){q(this,op);q(this,pA,null);q(this,_x,null);q(this,Jh);$(this,Jh,e)}show(e,n,r){const[s,i]=V(this,op,Q0e).call(this,n,r),{style:o}=y(this,_x)||$(this,_x,V(this,op,J0e).call(this));e.append(y(this,_x)),o.insetInlineEnd=`${100*s}%`,o.top=`calc(${100*i}% + var(--editor-toolbar-vert-offset))`}hide(){y(this,_x).remove()}}pA=new WeakMap,_x=new WeakMap,Jh=new WeakMap,op=new WeakSet,J0e=function(){const e=$(this,_x,document.createElement("div"));e.className="editToolbar",e.setAttribute("role","toolbar");const n=y(this,Jh)._signal;n instanceof AbortSignal&&!n.aborted&&e.addEventListener("contextmenu",$l,{signal:n});const r=$(this,pA,document.createElement("div"));return r.className="buttons",e.append(r),y(this,Jh).hasCommentManager()&&V(this,op,B8).call(this,"commentButton","pdfjs-comment-floating-button","pdfjs-comment-floating-button-label",()=>{y(this,Jh).commentSelection("floating_button")}),V(this,op,B8).call(this,"highlightButton","pdfjs-highlight-floating-button1","pdfjs-highlight-floating-button-label",()=>{y(this,Jh).highlightSelection("floating_button")}),e},Q0e=function(e,n){let r=0,s=0;for(const i of e){const o=i.y+i.height;if(o<r)continue;const l=i.x+(n?i.width:0);if(o>r){s=l,r=o;continue}n?l>s&&(s=l):l<s&&(s=l)}return[n?1-s:s,r]},B8=function(e,n,r,s){const i=document.createElement("button");i.classList.add("basic",e),i.tabIndex=0,i.setAttribute("data-l10n-id",n);const o=document.createElement("span");i.append(o),o.className="visuallyHidden",o.setAttribute("data-l10n-id",r);const l=y(this,Jh)._signal;l instanceof AbortSignal&&!l.aborted&&(i.addEventListener("contextmenu",$l,{signal:l}
900),i.addEventListener("click",s,{signal:l})),y(this,pA).append(i)};function Z0e(t,e,n){for(const r of n)e.addEventListener(r,t[r].bind(t))}var lL;class fZe{constructor(){q(this,lL,0)}get id(){return`${jk}${Vr(this,lL)._++}`}}lL=new WeakMap;var a1,mA,ca,o1,WM;const QY=class QY{constructor(){q(this,o1);q(this,a1,j7());q(this,mA,0);q(this,ca,null)}static get _isSVGFittingCanvas(){const e='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>',r=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),s=new Image;s.src=e;const i=s.decode().then(()=>(r.drawImage(s,0,0,1,1,0,0,1,3),new Uint32Array(r.getImageData(0,0,1,1).data.buffer)[0]===0));return Gt(this,"_isSVGFittingCanvas",i)}async getFromFile(e){const{lastModified:n,name:r,size:s,type:i}=e;return V(this,o1,WM).call(this,`${n}_${r}_${s}_${i}`,e)}async getFromUrl(e){return V(this,o1,WM).call(this,e,e)}async getFromBlob(e,n){const r=await n;return V(this,o1,WM).call(this,e,r)}async getFromId(e){y(this,ca)||$(this,ca,new Map);const n=y(this,ca).get(e);if(!n)return null;if(n.bitmap)return n.refCounter+=1,n;if(n.file)return this.getFromFile(n.file);if(n.blobPromise){const{blobPromise:r}=n;return delete n.blobPromise,this.getFromBlob(n.id,r)}return this.getFromUrl(n.url)}getFromCanvas(e,n){y(this,ca)||$(this,ca,new Map);let r=y(this,ca).get(e);if(r!=null&&r.bitmap)return r.refCounter+=1,r;const s=new OffscreenCanvas(n.width,n.height);return s.getContext("2d").drawImage(n,0,0),r={bitmap:s.transferToImageBitmap(),id:`image_${y(this,a1)}_${Vr(this,mA)._++}`,refCounter:1,isSvg:!1},y(this,ca).set(e,r),y(this,ca).set(r.id,r),r}getSvgUrl(e){const n=y(this,ca).get(e);return n!=null&&n.isSvg?n.svgUrl:null}deleteId(e){var s;y(this,ca)||$(this,ca,new Map);const n=y(this,ca).get(e);if(!n||(n.refCounter-=1,n.refCounter!==0))return;const{bitmap:r}=n;if(!n.url&&!n.file){const i=new OffscreenCanvas(r.width,r.height);i.getContext("bitmaprenderer").transferFromImageBitmap(r),n.blobPromise=i.convertToBlob()}(s=r.close)==null||s.call(r),n.bitmap=null}isValidId(e){return e.startsWith(`image_${y(this,a1)}_`)}};a1=new WeakMap,mA=new WeakMap,ca=new WeakMap,o1=new WeakSet,WM=async function(e,n){y(this,ca)||$(this,ca,new Map);let r=y(this,ca).get(e);if(r===null)return null;if(r!=null&&r.bitmap)return r.refCounter+=1,r;try{r||(r={bitmap:null,id:`image_${y(this,a1)}_${Vr(this,mA)._++}`,refCounter:0,isSvg:!1});let s;if(typeof n=="string"?(r.url=n,s=await Bj(n,"blob")):n instanceof File?s=r.file=n:n instanceof Blob&&(s=n),s.type==="image/svg+xml"){const i=QY._isSVGFittingCanvas,o=new FileReader,l=new Image,c=new Promise((u,d)=>{l.onload=()=>{r.bitmap=l,r.isSvg=!0,u()},o.onload=async()=>{const h=r.svgUrl=o.result;l.src=await i?`${h}#svgView(preserveAspectRatio(none))`:h},l.onerror=o.onerror=d});o.readAsDataURL(s),await c}else r.bitmap=await createImageBitmap(s);r.refCounter=1}catch(s){Ut(s),r=null}return y(this,ca).set(e,r),r&&y(this,ca).set(r.id,r),r};let U8=QY;var hs,vm,gA,Mr,Fce;let pZe=(Fce=class{constructor(e=128){q(this,hs,[]);q(this,vm,!1);q(this,gA);q(this,Mr,-1);$(this,gA,e)}add({cmd:e,undo:n,post:r,mustExec:s,type:i=NaN,overwriteIfSameType:o=!1,keepUndo:l=!1}){if(s&&e(),y(this,vm))return;const c={cmd:e,undo:n,post:r,type:i};if(y(this,Mr)===-1){y(this,hs).length>0&&(y(this,hs).length=0),$(this,Mr,0),y(this,hs).push(c);return}if(o&&y(this,hs)[y(this,Mr)].type===i){l&&(c.undo=y(this,hs)[y(this,Mr)].undo),y(this,hs)[y(this,Mr)]=c;return}const u=y(this,Mr)+1;u===y(this,gA)?y(this,hs).splice(0,1):($(this,Mr,u),u<y(this,hs).length&&y(this,hs).splice(u)),y(this,hs).push(c)}undo(){if(y(this,Mr)===-1)return;$(this,vm,!0);const{undo:e,post:n}=y(this,hs)[y(this,Mr)];e(),n==null||n(),$(this,vm,!1),$(this,Mr,y(this,Mr)-1)}redo(){if(y(this,Mr)<y(this,hs).length-1){$(this,Mr,y(this,Mr)+1),$(this,vm,!0);const{cmd:e,post:n}=y(this,hs)[y(this,Mr)];e(),n==null||n(),$(this,vm,!1)}}hasSomethingToUndo(){return y(this,Mr)!==-1}hasSomethingToRedo(){return y(this,Mr)<y(this,hs).length-1}cleanType(e){if(y(this,Mr)!==-1){for(let n=y(this,Mr);n>=0;n--)if(y(this,hs)[n].type!==e){y(this,hs).splice(n+1,y(this,Mr)-n),$(this,Mr,n);return}y(this,hs).length=0,$(this,Mr,-1)}}destroy(){$(this,hs,null)}},hs=new WeakMap,vm=new WeakMap,gA=new WeakMap,Mr=new WeakMap,Fce);var cL,ebe;class k2{constructor(e){q(this,cL);this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:n}=yi.platform;for(const[r,s,i={}]of e)for(const o of r){const l=o.startsWith("mac+");n&&l?(this.callbacks.set(o.slice(4),{callback:s,options:i}),this.allKeys.add(o.split("+").at(-1))):!n&&!l&&(this.callbacks.set(o,{callback:s,options:i}),this.allKeys.add(o.split("+").at(-1)))}}
900exec(e,n){if(!this.allKeys.has(n.key))return;const r=this.callbacks.get(V(this,cL,ebe).call(this,n));if(!r)return;const{callback:s,options:{bubbles:i=!1,args:o=[],checker:l=null}}=r;l&&!l(e,n)||(s.bind(e,...o,n)(),i||Dr(n))}}cL=new WeakSet,ebe=function(e){e.altKey&&this.buffer.push("alt"),e.ctrlKey&&this.buffer.push("ctrl"),e.metaKey&&this.buffer.push("meta"),e.shiftKey&&this.buffer.push("shift"),this.buffer.push(e.key);const n=this.buffer.join("+");return this.buffer.length=0,n};const uL=class uL{get _colors(){const e=new Map([["CanvasText",null],["Canvas",null]]);return cZe(e),Gt(this,"_colors",e)}convert(e){const n=Uj(e);if(!window.matchMedia("(forced-colors: active)").matches)return n;for(const[r,s]of this._colors)if(s.every((i,o)=>i===n[o]))return uL._colorsMapping.get(r);return n}getHexCode(e){const n=this._colors.get(e);return n?ot.makeHexColor(...n):e}};Te(uL,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));let q8=uL;var l1,nl,c1,Kr,Fs,u1,ac,d1,oc,ua,xm,ym,h1,bm,fd,lc,jx,vA,xA,f1,yA,pd,wm,p1,_m,md,dL,jm,m1,bA,Sm,Sx,g1,Nm,wA,ws,On,Qh,Cm,km,_A,v1,jA,Am,gd,Zh,SA,NA,cc,He,KM,V8,tbe,nbe,hN,rbe,sbe,ibe,H8,abe,W8,K8,obe,qa,Lh,lbe,cbe,G8,ube,fN,Y8;const xw=class xw{constructor(e,n,r,s,i,o,l,c,u,d,h,f,p,m,v,x){q(this,He);q(this,l1,new AbortController);q(this,nl,null);q(this,c1,null);q(this,Kr,new Map);q(this,Fs,new Map);q(this,u1,null);q(this,ac,null);q(this,d1,null);q(this,oc,new pZe);q(this,ua,null);q(this,xm,null);q(this,ym,null);q(this,h1,0);q(this,bm,new Set);q(this,fd,null);q(this,lc,null);q(this,jx,new Set);Te(this,"_editorUndoBar",null);q(this,vA,!1);q(this,xA,!1);q(this,f1,!1);q(this,yA,null);q(this,pd,null);q(this,wm,null);q(this,p1,null);q(this,_m,!1);q(this,md,null);q(this,dL,new fZe);q(this,jm,!1);q(this,m1,!1);q(this,bA,!1);q(this,Sm,null);q(this,Sx,null);q(this,g1,null);q(this,Nm,null);q(this,wA,null);q(this,ws,Bt.NONE);q(this,On,new Set);q(this,Qh,null);q(this,Cm,null);q(this,km,null);q(this,_A,null);q(this,v1,null);q(this,jA,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1});q(this,Am,[0,0]);q(this,gd,null);q(this,Zh,null);q(this,SA,null);q(this,NA,null);q(this,cc,null);const g=this._signal=y(this,l1).signal;$(this,Zh,e),$(this,SA,n),$(this,NA,r),$(this,u1,s),$(this,ua,i),$(this,Cm,o),$(this,v1,c),this._eventBus=l,l._on("editingaction",this.onEditingAction.bind(this),{signal:g}),l._on("pagechanging",this.onPageChanging.bind(this),{signal:g}),l._on("scalechanging",this.onScaleChanging.bind(this),{signal:g}),l._on("rotationchanging",this.onRotationChanging.bind(this),{signal:g}),l._on("setpreference",this.onSetPreference.bind(this),{signal:g}),l._on("switchannotationeditorparams",w=>this.updateParams(w.type,w.value),{signal:g}),window.addEventListener("pointerdown",()=>{$(this,m1,!0)},{capture:!0,signal:g}),window.addEventListener("pointerup",()=>{$(this,m1,!1)},{capture:!0,signal:g}),V(this,He,rbe).call(this),V(this,He,obe).call(this),V(this,He,H8).call(this),$(this,ac,c.annotationStorage),$(this,yA,c.filterFactory),$(this,km,u),$(this,p1,d||null),$(this,vA,h),$(this,xA,f),$(this,f1,p),$(this,wA,m||null),this.viewParameters={realScale:tp.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=v||null,this._supportsPinchToZoom=x!==!1,i==null||i.setSidebarUiManager(this)}static get _keyboardManager(){const e=xw.prototype,n=o=>y(o,Zh).contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&o.hasSomethingToControl(),r=(o,{target:l})=>{if(l instanceof HTMLInputElement){const{type:c}=l;return c!=="text"&&c!=="number"}return!0},s=this.TRANSLATE_SMALL,i=this.TRANSLATE_BIG;return Gt(this,"_keyboardManager",new k2([[["ctrl+a","mac+meta+a"],e.selectAll,{checker:r}],[["ctrl+z","mac+meta+z"],e.undo,{checker:r}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],e.redo,{checker:r}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],e.delete,{checker:r}
900],[["Enter","mac+Enter"],e.addNewEditorFromKeyboard,{checker:(o,{target:l})=>!(l instanceof HTMLButtonElement)&&y(o,Zh).contains(l)&&!o.isEnterHandled}],[[" ","mac+ "],e.addNewEditorFromKeyboard,{checker:(o,{target:l})=>!(l instanceof HTMLButtonElement)&&y(o,Zh).contains(document.activeElement)}],[["Escape","mac+Escape"],e.unselectAll],[["ArrowLeft","mac+ArrowLeft"],e.translateSelectedEditors,{args:[-s,0],checker:n}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e.translateSelectedEditors,{args:[-i,0],checker:n}],[["ArrowRight","mac+ArrowRight"],e.translateSelectedEditors,{args:[s,0],checker:n}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e.translateSelectedEditors,{args:[i,0],checker:n}],[["ArrowUp","mac+ArrowUp"],e.translateSelectedEditors,{args:[0,-s],checker:n}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e.translateSelectedEditors,{args:[0,-i],checker:n}],[["ArrowDown","mac+ArrowDown"],e.translateSelectedEditors,{args:[0,s],checker:n}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e.translateSelectedEditors,{args:[0,i],checker:n}]]))}destroy(){var e,n,r,s,i,o,l,c,u;(e=y(this,cc))==null||e.resolve(),$(this,cc,null),(n=y(this,l1))==null||n.abort(),$(this,l1,null),this._signal=null;for(const d of y(this,Fs).values())d.destroy();y(this,Fs).clear(),y(this,Kr).clear(),y(this,jx).clear(),(r=y(this,Nm))==null||r.clear(),$(this,nl,null),y(this,On).clear(),y(this,oc).destroy(),(s=y(this,u1))==null||s.destroy(),(i=y(this,ua))==null||i.destroy(),(o=y(this,Cm))==null||o.destroy(),(l=y(this,md))==null||l.hide(),$(this,md,null),(c=y(this,g1))==null||c.destroy(),$(this,g1,null),$(this,c1,null),y(this,pd)&&(clearTimeout(y(this,pd)),$(this,pd,null)),y(this,gd)&&(clearTimeout(y(this,gd)),$(this,gd,null)),(u=this._editorUndoBar)==null||u.destroy(),$(this,v1,null)}combinedSignal(e){return AbortSignal.any([this._signal,e.signal])}get mlManager(){return y(this,wA)}get useNewAltTextFlow(){return y(this,xA)}get useNewAltTextWhenAddingImage(){return y(this,f1)}get hcmFilter(){return Gt(this,"hcmFilter",y(this,km)?y(this,yA).addHCMFilter(y(this,km).foreground,y(this,km).background):"none")}get direction(){return Gt(this,"direction",getComputedStyle(y(this,Zh)).direction)}get _highlightColors(){return Gt(this,"_highlightColors",y(this,p1)?new Map(y(this,p1).split(",").map(e=>(e=e.split("=").map(n=>n.trim()),e[1]=e[1].toUpperCase(),e))):null)}get highlightColors(){const{_highlightColors:e}=this;if(!e)return Gt(this,"highlightColors",null);const n=new Map,r=!!y(this,km);for(const[s,i]of e){const o=s.endsWith("_HCM");if(r&&o){n.set(s.replace("_HCM",""),i);continue}!r&&!o&&n.set(s,i)}return Gt(this,"highlightColors",n)}get highlightColorNames(){return Gt(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,e=>e.reverse())):null)}getNonHCMColor(e){if(!this._highlightColors)return e;const n=this.highlightColorNames.get(e);return this._highlightColors.get(n)||e}getNonHCMColorName(e){return this.highlightColorNames.get(e)||e}setCurrentDrawingSession(e){e?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),$(this,ym,e)}setMainHighlightColorPicker(e){$(this,g1,e)}editAltText(e,n=!1){var r;(r=y(this,u1))==null||r.editAltText(this,e,n)}hasCommentManager(){return!!y(this,ua)}editComment(e,n,r,s){var i;(i=y(this,ua))==null||i.showDialog(this,e,n,r,s)}selectComment(e,n){const r=y(this,Fs).get(e),s=r==null?void 0:r.getEditorByUID(n);s==null||s.toggleComment(!0,!0)}updateComment(e){var n;(n=y(this,ua))==null||n.updateComment(e.getData())}updatePopupColor(e){var n;(n=y(this,ua))==null||n.updatePopupColor(e)}removeComment(e){var n;(n=y(this,ua))==null||n.removeComments([e.uid])}toggleComment(e,n,r=void 0){var s;(s=y(this,ua))==null||s.toggleCommentPopup(e,n,r)}makeCommentColor(e,n){var r;return e&&((r=y(this,ua))==null?void 0:r.makeCommentColor(e,n))||null}getCommentDialogElement(){var e;return((e=y(this,ua))==null?void 0:e.dialogElement)||null}async waitForEditorsRendered(e){if(y(this,Fs).has(e-1))return;const{resolve:n,promise:r}=Promise.withResolvers(),s=i=>{i.pageNumber===e&&(this._eventBus._off("editorsrendered",s),n())};this._eventBus.on("editorsrendered",s),await r}getSignature(e){var n;(n=y(this,Cm))==null||n.getSignature({uiManager:this,editor:e})}get signatureManager(){return y(this,Cm)}switchToMode(e,n){this._eventBus.on("annotationeditormodechanged",n,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:e})}setPreference(e,n){this._eventBus.dispatch("setpreference",{source:this,name:e,value:n})}onSetPreference({name:e,value:n}){switch(e){case"enableNewAltTextWhenAddingImage":$(this,f1,n);break}}onPageChanging({pageNumber:e}){$(this,h1,e-1)}focusMainContainer(){y(this,Zh).focus()}findParent(e,n){for(const r of y(this,Fs).values()){const{x:s,y:i,width:o,height:l}=r.div.getBoundingClientRect();if(e>=s&&e<=s+o&&n>=i&&n<=i+l)return r}return null}disableUserSelect(e=!1){y(this,SA).classList.toggle("noUserSelect",e)}addShouldRescale(e){y(this,jx).add(e)}removeShouldRescale(e){y(this,jx).delete(e)}onScaleChanging({scale:e}){var n;this.commitOrRemove(),this.viewParameters.realScale=e*tp.PDF_TO_CSS_UNITS;for(const r of y(this,jx))r.onScaleChanging();(n=y(this,ym))==null||n.onScaleChanging()}
900onRotationChanging({pagesRotation:e}){this.commitOrRemove(),this.viewParameters.rotation=e}highlightSelection(e="",n=!1){const r=document.getSelection();if(!r||r.isCollapsed)return;const{anchorNode:s,anchorOffset:i,focusNode:o,focusOffset:l}=r,c=r.toString(),d=V(this,He,KM).call(this,r).closest(".textLayer"),h=this.getSelectionBoxes(d);if(!h)return;r.empty();const f=V(this,He,V8).call(this,d),p=y(this,ws)===Bt.NONE,m=()=>{const v=f==null?void 0:f.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:e,boxes:h,anchorNode:s,anchorOffset:i,focusNode:o,focusOffset:l,text:c});p&&this.showAllEditors("highlight",!0,!0),n&&(v==null||v.editComment())};if(p){this.switchToMode(Bt.HIGHLIGHT,m);return}m()}commentSelection(e=""){this.highlightSelection(e,!0)}getAndRemoveDataFromAnnotationStorage(e){if(!y(this,ac))return null;const n=`${jk}${e}`,r=y(this,ac).getRawValue(n);return r&&y(this,ac).remove(n),r}addToAnnotationStorage(e){!e.isEmpty()&&y(this,ac)&&!y(this,ac).has(e.id)&&y(this,ac).setValue(e.id,e)}a11yAlert(e,n=null){const r=y(this,NA);r&&(r.setAttribute("data-l10n-id",e),n?r.setAttribute("data-l10n-args",JSON.stringify(n)):r.removeAttribute("data-l10n-args"))}blur(){if(this.isShiftKeyDown=!1,y(this,_m)&&($(this,_m,!1),V(this,He,hN).call(this,"main_toolbar")),!this.hasSelection)return;const{activeElement:e}=document;for(const n of y(this,On))if(n.div.contains(e)){$(this,Sx,[n,e]),n._focusEventsAllowed=!1;break}}focus(){if(!y(this,Sx))return;const[e,n]=y(this,Sx);$(this,Sx,null),n.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:this._signal}),n.focus()}addEditListeners(){V(this,He,H8).call(this),V(this,He,W8).call(this)}removeEditListeners(){V(this,He,abe).call(this),V(this,He,K8).call(this)}dragOver(e){for(const{type:n}of e.dataTransfer.items)for(const r of y(this,lc))if(r.isHandlingMimeForPasting(n)){e.dataTransfer.dropEffect="copy",e.preventDefault();return}}drop(e){for(const n of e.dataTransfer.items)for(const r of y(this,lc))if(r.isHandlingMimeForPasting(n.type)){r.paste(n,this.currentLayer),e.preventDefault();return}}copy(e){var r;if(e.preventDefault(),(r=y(this,nl))==null||r.commitOrRemove(),!this.hasSelection)return;const n=[];for(const s of y(this,On)){const i=s.serialize(!0);i&&n.push(i)}n.length!==0&&e.clipboardData.setData("application/pdfjs",JSON.stringify(n))}cut(e){this.copy(e),this.delete()}async paste(e){e.preventDefault();const{clipboardData:n}=e;for(const i of n.items)for(const o of y(this,lc))if(o.isHandlingMimeForPasting(i.type)){o.paste(i,this.currentLayer);return}let r=n.getData("application/pdfjs");if(!r)return;try{r=JSON.parse(r)}catch(i){Ut(`paste: "${i.message}".`);return}if(!Array.isArray(r))return;this.unselectAll();const s=this.currentLayer;try{const i=[];for(const c of r){const u=await s.deserialize(c);if(!u)return;i.push(u)}const o=()=>{for(const c of i)V(this,He,G8).call(this,c);V(this,He,Y8).call(this,i)},l=()=>{for(const c of i)c.remove()};this.addCommands({cmd:o,undo:l,mustExec:!0})}catch(i){Ut(`paste: "${i.message}".`)}}keydown(e){!this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!0),y(this,ws)!==Bt.NONE&&!this.isEditorHandlingKeyboard&&xw._keyboardManager.exec(this,e)}keyup(e){this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!1,y(this,_m)&&($(this,_m,!1),V(this,He,hN).call(this,"main_toolbar")))}onEditingAction({name:e}){switch(e){case"undo":case"redo":case"delete":case"selectAll":this[e]();break;case"highlightSelection":this.highlightSelection("context_menu");break;case"commentSelection":this.commentSelection("context_menu");break}}setEditingState(e){e?(V(this,He,sbe).call(this),V(this,He,W8).call(this),V(this,He,qa).call(this,{isEditing:y(this,ws)!==Bt.NONE,isEmpty:V(this,He,fN).call(this),hasSomethingToUndo:y(this,oc).hasSomethingToUndo(),hasSomethingToRedo:y(this,oc).hasSomethingToRedo(),hasSelectedEditor:!1})):(V(this,He,ibe).call(this),V(this,He,K8).call(this),V(this,He,qa).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(e){if(!y(this,lc)){$(this,lc,e);for(const n of y(this,lc))V(this,He,Lh).call(this,n.defaultPropertiesToUpdate)}}getId(){return y(this,dL).id}get currentLayer(){return y(this,Fs).get(y(this,h1))}getLayer(e){return y(this,Fs).get(e)}get currentPageIndex(){return y(this,h1)}addLayer(e){y(this,Fs).set(e.pageIndex,e),y(this,jm)?e.enable():e.disable()}removeLayer(e){y(this,Fs).delete(e.pageIndex)}async updateMode(e,n=null,r=!1,s=!1,i=!1){var o,l,c,u,d,h;if(y(this,ws)!==e&&!(y(this,cc)&&(await y(this,cc).promise,!y(this,cc)))){if($(this,cc,Promise.withResolvers()),(o=y(this,ym))==null||o.commitOrRemove(),y(this,ws)===Bt.POPUP&&((l=y(this,ua))==null||l.hideSidebar()),(c=y(this,ua))==null||c.destroyPopup(),$(this,ws,e),e===Bt.NONE){this.setEditingState(!1),V(this,He,cbe).call(this);for(const f of y(this,Kr).values())f.hideStandaloneCommentButton();(u=this._editorUndoBar)==null||u.hide(),this.toggleComment(null),y(this,cc).resolve();return}for(const f of y(this,Kr).values())f.addStandaloneCommentButton();e===Bt.SIGNATURE&&await((d=y(this,Cm))==null?void 0:d.loadSignatures()),this.setEditingState(!0),await V(this,He,lbe).call(this),this.unselectAll();for(const f of y(this,Fs).values())f.updateMode(e);if(e===Bt.POPUP){y(this,c1)||$(this,c1,await y(this,v1).getAnnotationsByType(new Set(y(this,lc).map(m=>m._editorType))));const f=new Set,p=[];for(const m of y(this,Kr).values()){const{annotationElementId:v,hasComment:x,deleted:g}=m;v&&f.add(v),x&&!g&&p.push(m.getData())}
900for(const m of y(this,c1)){const{id:v,popupRef:x,contentsObj:g}=m;x&&(g!=null&&g.str)&&!f.has(v)&&!y(this,bm).has(v)&&p.push(m)}(h=y(this,ua))==null||h.showSidebar(p)}if(!n){r&&this.addNewEditorFromKeyboard(),y(this,cc).resolve();return}for(const f of y(this,Kr).values())f.uid===n?(this.setSelected(f),i?f.editComment():s?f.enterInEditMode():f.focus()):f.unselect();y(this,cc).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(e){e.mode!==y(this,ws)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,...e})}updateParams(e,n){if(y(this,lc)){switch(e){case sn.CREATE:this.currentLayer.addNewEditor(n);return;case sn.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(y(this,_A)||$(this,_A,new Map)).set(e,n),this.showAllEditors("highlight",n);break}if(this.hasSelection)for(const r of y(this,On))r.updateParams(e,n);else for(const r of y(this,lc))r.updateDefaultParams(e,n)}}showAllEditors(e,n,r=!1){var i;for(const o of y(this,Kr).values())o.editorType===e&&o.show(n);(((i=y(this,_A))==null?void 0:i.get(sn.HIGHLIGHT_SHOW_ALL))??!0)!==n&&V(this,He,Lh).call(this,[[sn.HIGHLIGHT_SHOW_ALL,n]])}enableWaiting(e=!1){if(y(this,bA)!==e){$(this,bA,e);for(const n of y(this,Fs).values())e?n.disableClick():n.enableClick(),n.div.classList.toggle("waiting",e)}}*getEditors(e){for(const n of y(this,Kr).values())n.pageIndex===e&&(yield n)}getEditor(e){return y(this,Kr).get(e)}addEditor(e){y(this,Kr).set(e.id,e)}removeEditor(e){var n,r;e.div.contains(document.activeElement)&&(y(this,pd)&&clearTimeout(y(this,pd)),$(this,pd,setTimeout(()=>{this.focusMainContainer(),$(this,pd,null)},0))),y(this,Kr).delete(e.id),e.annotationElementId&&((n=y(this,Nm))==null||n.delete(e.annotationElementId)),this.unselect(e),(!e.annotationElementId||!y(this,bm).has(e.annotationElementId))&&((r=y(this,ac))==null||r.remove(e.id))}addDeletedAnnotationElement(e){y(this,bm).add(e.annotationElementId),this.addChangedExistingAnnotation(e),e.deleted=!0}isDeletedAnnotationElement(e){return y(this,bm).has(e)}removeDeletedAnnotationElement(e){y(this,bm).delete(e.annotationElementId),this.removeChangedExistingAnnotation(e),e.deleted=!1}setActiveEditor(e){y(this,nl)!==e&&($(this,nl,e),e&&V(this,He,Lh).call(this,e.propertiesToUpdate))}updateUI(e){y(this,He,ube)===e&&V(this,He,Lh).call(this,e.propertiesToUpdate)}updateUIForDefaultProperties(e){V(this,He,Lh).call(this,e.defaultPropertiesToUpdate)}toggleSelected(e){if(y(this,On).has(e)){y(this,On).delete(e),e.unselect(),V(this,He,qa).call(this,{hasSelectedEditor:this.hasSelection});return}y(this,On).add(e),e.select(),V(this,He,Lh).call(this,e.propertiesToUpdate),V(this,He,qa).call(this,{hasSelectedEditor:!0})}setSelected(e){var n;this.updateToolbar({mode:e.mode,editId:e.id}),(n=y(this,ym))==null||n.commitOrRemove();for(const r of y(this,On))r!==e&&r.unselect();y(this,On).clear(),y(this,On).add(e),e.select(),V(this,He,Lh).call(this,e.propertiesToUpdate),V(this,He,qa).call(this,{hasSelectedEditor:!0})}isSelected(e){return y(this,On).has(e)}get firstSelectedEditor(){return y(this,On).values().next().value}unselect(e){e.unselect(),y(this,On).delete(e),V(this,He,qa).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return y(this,On).size!==0}get isEnterHandled(){return y(this,On).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){var e;y(this,oc).undo(),V(this,He,qa).call(this,{hasSomethingToUndo:y(this,oc).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:V(this,He,fN).call(this)}),(e=this._editorUndoBar)==null||e.hide()}redo(){y(this,oc).redo(),V(this,He,qa).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:y(this,oc).hasSomethingToRedo(),isEmpty:V(this,He,fN).call(this)})}addCommands(e){y(this,oc).add(e),V(this,He,qa).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:V(this,He,fN).call(this)})}cleanUndoStack(e){y(this,oc).cleanType(e)}delete(){var i;this.commitOrRemove();const e=(i=this.currentLayer)==null?void 0:i.endDrawingSession(!0);if(!this.hasSelection&&!e)return;const n=e?[e]:[...y(this,On)],r=()=>{var o;(o=this._editorUndoBar)==null||o.show(s,n.length===1?n[0].editorType:n.length);for(const l of n)l.remove()},s=()=>{for(const o of n)V(this,He,G8).call(this,o)};this.addCommands({cmd:r,undo:s,mustExec:!0})}commitOrRemove(){var e;(e=y(this,nl))==null||e.commitOrRemove()}hasSomethingToControl(){return y(this,nl)||this.hasSelection}selectAll(){for(const e of y(this,On))e.commit();V(this,He,Y8).call(this,y(this,Kr).values())}unselectAll(){var e;
900if(!(y(this,nl)&&(y(this,nl).commitOrRemove(),y(this,ws)!==Bt.NONE))&&!((e=y(this,ym))!=null&&e.commitOrRemove())&&this.hasSelection){for(const n of y(this,On))n.unselect();y(this,On).clear(),V(this,He,qa).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(e,n,r=!1){if(r||this.commitOrRemove(),!this.hasSelection)return;y(this,Am)[0]+=e,y(this,Am)[1]+=n;const[s,i]=y(this,Am),o=[...y(this,On)],l=1e3;y(this,gd)&&clearTimeout(y(this,gd)),$(this,gd,setTimeout(()=>{$(this,gd,null),y(this,Am)[0]=y(this,Am)[1]=0,this.addCommands({cmd:()=>{for(const c of o)y(this,Kr).has(c.id)&&(c.translateInPage(s,i),c.translationDone())},undo:()=>{for(const c of o)y(this,Kr).has(c.id)&&(c.translateInPage(-s,-i),c.translationDone())},mustExec:!1})},l));for(const c of o)c.translateInPage(e,n),c.translationDone()}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),$(this,fd,new Map);for(const e of y(this,On))y(this,fd).set(e,{savedX:e.x,savedY:e.y,savedPageIndex:e.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!y(this,fd))return!1;this.disableUserSelect(!1);const e=y(this,fd);$(this,fd,null);let n=!1;for(const[{x:s,y:i,pageIndex:o},l]of e)l.newX=s,l.newY=i,l.newPageIndex=o,n||(n=s!==l.savedX||i!==l.savedY||o!==l.savedPageIndex);if(!n)return!1;const r=(s,i,o,l)=>{if(y(this,Kr).has(s.id)){const c=y(this,Fs).get(l);c?s._setParentAndPosition(c,i,o):(s.pageIndex=l,s.x=i,s.y=o)}};return this.addCommands({cmd:()=>{for(const[s,{newX:i,newY:o,newPageIndex:l}]of e)r(s,i,o,l)},undo:()=>{for(const[s,{savedX:i,savedY:o,savedPageIndex:l}]of e)r(s,i,o,l)},mustExec:!0}),!0}dragSelectedEditors(e,n){if(y(this,fd))for(const r of y(this,fd).keys())r.drag(e,n)}rebuild(e){if(e.parent===null){const n=this.getLayer(e.pageIndex);n?(n.changeParent(e),n.addOrRebuild(e)):(this.addEditor(e),this.addToAnnotationStorage(e),e.rebuild())}else e.parent.addOrRebuild(e)}get isEditorHandlingKeyboard(){var e;return((e=this.getActive())==null?void 0:e.shouldGetKeyboardEvents())||y(this,On).size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(e){return y(this,nl)===e}getActive(){return y(this,nl)}getMode(){return y(this,ws)}isEditingMode(){return y(this,ws)!==Bt.NONE}get imageManager(){return Gt(this,"imageManager",new U8)}getSelectionBoxes(e){if(!e)return null;const n=document.getSelection();for(let u=0,d=n.rangeCount;u<d;u++)if(!e.contains(n.getRangeAt(u).commonAncestorContainer))return null;const{x:r,y:s,width:i,height:o}=e.getBoundingClientRect();let l;switch(e.getAttribute("data-main-rotation")){case"90":l=(u,d,h,f)=>({x:(d-s)/o,y:1-(u+h-r)/i,width:f/o,height:h/i});break;case"180":l=(u,d,h,f)=>({x:1-(u+h-r)/i,y:1-(d+f-s)/o,width:h/i,height:f/o});break;case"270":l=(u,d,h,f)=>({x:1-(d+f-s)/o,y:(u-r)/i,width:f/o,height:h/i});break;default:l=(u,d,h,f)=>({x:(u-r)/i,y:(d-s)/o,width:h/i,height:f/o});break}const c=[];for(let u=0,d=n.rangeCount;u<d;u++){const h=n.getRangeAt(u);if(!h.collapsed)for(const{x:f,y:p,width:m,height:v}of h.getClientRects())m===0||v===0||c.push(l(f,p,m,v))}return c.length===0?null:c}addChangedExistingAnnotation({annotationElementId:e,id:n}){(y(this,d1)||$(this,d1,new Map)).set(e,n)}removeChangedExistingAnnotation({annotationElementId:e}){var n;(n=y(this,d1))==null||n.delete(e)}renderAnnotationElement(e){var s;const n=(s=y(this,d1))==null?void 0:s.get(e.data.id);if(!n)return;const r=y(this,ac).getRawValue(n);r&&(y(this,ws)===Bt.NONE&&!r.hasBeenModified||r.renderAnnotationElement(e))}setMissingCanvas(e,n,r){var i;const s=(i=y(this,Nm))==null?void 0:i.get(e);s&&(s.setCanvas(n,r),y(this,Nm).delete(e))}addMissingCanvas(e,n){(y(this,Nm)||$(this,Nm,new Map)).set(e,n)}};l1=new WeakMap,nl=new WeakMap,c1=new WeakMap,Kr=new WeakMap,Fs=new WeakMap,u1=new WeakMap,ac=new WeakMap,d1=new WeakMap,oc=new WeakMap,ua=new WeakMap,xm=new WeakMap,ym=new WeakMap,h1=new WeakMap,bm=new WeakMap,fd=new WeakMap,lc=new WeakMap,jx=new WeakMap,vA=new WeakMap,xA=new WeakMap,f1=new WeakMap,yA=new WeakMap,pd=new WeakMap,wm=new WeakMap,p1=new WeakMap,_m=new WeakMap,md=new WeakMap,dL=new WeakMap,jm=new WeakMap,m1=new WeakMap,bA=new WeakMap,Sm=new WeakMap,Sx=new WeakMap,g1=new WeakMap,Nm=new WeakMap,wA=new WeakMap,ws=new WeakMap,On=new WeakMap,Qh=new WeakMap,Cm=new WeakMap,km=new WeakMap,_A=new WeakMap,v1=new WeakMap,jA=new WeakMap,Am=new WeakMap,gd=new WeakMap,Zh=new WeakMap,SA=new WeakMap,NA=new WeakMap,cc=new WeakMap,He=new WeakSet,KM=function({anchorNode:e}
900){return e.nodeType===Node.TEXT_NODE?e.parentElement:e},V8=function(e){const{currentLayer:n}=this;if(n.hasTextLayer(e))return n;for(const r of y(this,Fs).values())if(r.hasTextLayer(e))return r;return null},tbe=function(){const e=document.getSelection();if(!e||e.isCollapsed)return;const r=V(this,He,KM).call(this,e).closest(".textLayer"),s=this.getSelectionBoxes(r);s&&(y(this,md)||$(this,md,new hZe(this)),y(this,md).show(r,s,this.direction==="ltr"))},nbe=function(){var i,o,l;const e=document.getSelection();if(!e||e.isCollapsed){y(this,Qh)&&((i=y(this,md))==null||i.hide(),$(this,Qh,null),V(this,He,qa).call(this,{hasSelectedText:!1}));return}const{anchorNode:n}=e;if(n===y(this,Qh))return;const s=V(this,He,KM).call(this,e).closest(".textLayer");if(!s){y(this,Qh)&&((o=y(this,md))==null||o.hide(),$(this,Qh,null),V(this,He,qa).call(this,{hasSelectedText:!1}));return}if((l=y(this,md))==null||l.hide(),$(this,Qh,n),V(this,He,qa).call(this,{hasSelectedText:!0}),!(y(this,ws)!==Bt.HIGHLIGHT&&y(this,ws)!==Bt.NONE)&&(y(this,ws)===Bt.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),$(this,_m,this.isShiftKeyDown),!this.isShiftKeyDown)){const c=y(this,ws)===Bt.HIGHLIGHT?V(this,He,V8).call(this,s):null;if(c==null||c.toggleDrawing(),y(this,m1)){const u=new AbortController,d=this.combinedSignal(u),h=f=>{f.type==="pointerup"&&f.button!==0||(u.abort(),c==null||c.toggleDrawing(!0),f.type==="pointerup"&&V(this,He,hN).call(this,"main_toolbar"))};window.addEventListener("pointerup",h,{signal:d}),window.addEventListener("blur",h,{signal:d})}else c==null||c.toggleDrawing(!0),V(this,He,hN).call(this,"main_toolbar")}},hN=function(e=""){y(this,ws)===Bt.HIGHLIGHT?this.highlightSelection(e):y(this,vA)&&V(this,He,tbe).call(this)},rbe=function(){document.addEventListener("selectionchange",V(this,He,nbe).bind(this),{signal:this._signal})},sbe=function(){if(y(this,wm))return;$(this,wm,new AbortController);const e=this.combinedSignal(y(this,wm));window.addEventListener("focus",this.focus.bind(this),{signal:e}),window.addEventListener("blur",this.blur.bind(this),{signal:e})},ibe=function(){var e;(e=y(this,wm))==null||e.abort(),$(this,wm,null)},H8=function(){if(y(this,Sm))return;$(this,Sm,new AbortController);const e=this.combinedSignal(y(this,Sm));window.addEventListener("keydown",this.keydown.bind(this),{signal:e}),window.addEventListener("keyup",this.keyup.bind(this),{signal:e})},abe=function(){var e;(e=y(this,Sm))==null||e.abort(),$(this,Sm,null)},W8=function(){if(y(this,xm))return;$(this,xm,new AbortController);const e=this.combinedSignal(y(this,xm));document.addEventListener("copy",this.copy.bind(this),{signal:e}),document.addEventListener("cut",this.cut.bind(this),{signal:e}),document.addEventListener("paste",this.paste.bind(this),{signal:e})},K8=function(){var e;(e=y(this,xm))==null||e.abort(),$(this,xm,null)},obe=function(){const e=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:e}),document.addEventListener("drop",this.drop.bind(this),{signal:e})},qa=function(e){Object.entries(e).some(([r,s])=>y(this,jA)[r]!==s)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(y(this,jA),e)}),y(this,ws)===Bt.HIGHLIGHT&&e.hasSelectedEditor===!1&&V(this,He,Lh).call(this,[[sn.HIGHLIGHT_FREE,!0]]))},Lh=function(e){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:e})},lbe=async function(){if(!y(this,jm)){$(this,jm,!0);const e=[];for(const n of y(this,Fs).values())e.push(n.enable());await Promise.all(e);for(const n of y(this,Kr).values())n.enable()}},cbe=function(){if(this.unselectAll(),y(this,jm)){$(this,jm,!1);for(const e of y(this,Fs).values())e.disable();for(const e of y(this,Kr).values())e.disable()}},G8=function(e){const n=y(this,Fs).get(e.pageIndex);n?n.addOrRebuild(e):(this.addEditor(e),this.addToAnnotationStorage(e))},ube=function(){let e=null;for(e of y(this,On));return e},fN=function(){if(y(this,Kr).size===0)return!0;if(y(this,Kr).size===1)for(const e of y(this,Kr).values())return e.isEmpty();return!1},Y8=function(e){for(const n of y(this,On))n.unselect();y(this,On).clear();for(const n of e)n.isEmpty()||(y(this,On).add(n),n.select());V(this,He,qa).call(this,{hasSelectedEditor:this.hasSelection})},Te(xw,"TRANSLATE_SMALL",1),Te(xw,"TRANSLATE_BIG",10);let zg=xw;var ni,vd,iu,x1,xd,rl,y1,yd,Eo,ef,Nx,bd,Em,Nu,pN,GM;const Ka=class Ka{constructor(e){q(this,Nu);q(this,ni,null);q(this,vd,!1);q(this,iu,null);q(this,x1,null);q(this,xd,null);q(this,rl,null);q(this,y1,!1);q(this,yd,null);q(this,Eo,null);q(this,ef,null);q(this,Nx,null);q(this,bd,!1);$(this,Eo,e),$(this,bd,e._uiManager.useNewAltTextFlow),y(Ka,Em)||$(Ka,Em,Object.freeze({added:"pdfjs-editor-new-alt-text-added-button","added-label":"pdfjs-editor-new-alt-text-added-button-label",missing:"pdfjs-editor-new-alt-text-missing-button","missing-label":"pdfjs-editor-new-alt-text-missing-button-label",review:"pdfjs-editor-new-alt-text-to-review-button","review-label":"pdfjs-editor-new-alt-text-to-review-button-label"}))}static initialize(e){Ka._l10n??(Ka._l10n=e)}async render(){const e=$(this,iu,document.createElement("button"));e.className="altText",e.tabIndex="0";
900const n=$(this,x1,document.createElement("span"));e.append(n),y(this,bd)?(e.classList.add("new"),e.setAttribute("data-l10n-id",y(Ka,Em).missing),n.setAttribute("data-l10n-id",y(Ka,Em)["missing-label"])):(e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),n.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));const r=y(this,Eo)._uiManager._signal;e.addEventListener("contextmenu",$l,{signal:r}),e.addEventListener("pointerdown",i=>i.stopPropagation(),{signal:r});const s=i=>{i.preventDefault(),y(this,Eo)._uiManager.editAltText(y(this,Eo)),y(this,bd)&&y(this,Eo)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:y(this,Nu,pN)}})};return e.addEventListener("click",s,{capture:!0,signal:r}),e.addEventListener("keydown",i=>{i.target===e&&i.key==="Enter"&&($(this,y1,!0),s(i))},{signal:r}),await V(this,Nu,GM).call(this),e}finish(){y(this,iu)&&(y(this,iu).focus({focusVisible:y(this,y1)}),$(this,y1,!1))}isEmpty(){return y(this,bd)?y(this,ni)===null:!y(this,ni)&&!y(this,vd)}hasData(){return y(this,bd)?y(this,ni)!==null||!!y(this,ef):this.isEmpty()}get guessedText(){return y(this,ef)}async setGuessedText(e){y(this,ni)===null&&($(this,ef,e),$(this,Nx,await Ka._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:e})),V(this,Nu,GM).call(this))}toggleAltTextBadge(e=!1){var n;if(!y(this,bd)||y(this,ni)){(n=y(this,yd))==null||n.remove(),$(this,yd,null);return}if(!y(this,yd)){const r=$(this,yd,document.createElement("div"));r.className="noAltTextBadge",y(this,Eo).div.append(r)}y(this,yd).classList.toggle("hidden",!e)}serialize(e){let n=y(this,ni);return!e&&y(this,ef)===n&&(n=y(this,Nx)),{altText:n,decorative:y(this,vd),guessedText:y(this,ef),textWithDisclaimer:y(this,Nx)}}get data(){return{altText:y(this,ni),decorative:y(this,vd)}}set data({altText:e,decorative:n,guessedText:r,textWithDisclaimer:s,cancel:i=!1}){r&&($(this,ef,r),$(this,Nx,s)),!(y(this,ni)===e&&y(this,vd)===n)&&(i||($(this,ni,e),$(this,vd,n)),V(this,Nu,GM).call(this))}toggle(e=!1){y(this,iu)&&(!e&&y(this,rl)&&(clearTimeout(y(this,rl)),$(this,rl,null)),y(this,iu).disabled=!e)}shown(){y(this,Eo)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:y(this,Nu,pN)}})}destroy(){var e,n;(e=y(this,iu))==null||e.remove(),$(this,iu,null),$(this,x1,null),$(this,xd,null),(n=y(this,yd))==null||n.remove(),$(this,yd,null)}};ni=new WeakMap,vd=new WeakMap,iu=new WeakMap,x1=new WeakMap,xd=new WeakMap,rl=new WeakMap,y1=new WeakMap,yd=new WeakMap,Eo=new WeakMap,ef=new WeakMap,Nx=new WeakMap,bd=new WeakMap,Em=new WeakMap,Nu=new WeakSet,pN=function(){return y(this,ni)&&"added"||y(this,ni)===null&&this.guessedText&&"review"||"missing"},GM=async function(){var s,i,o;const e=y(this,iu);if(!e)return;if(y(this,bd)){if(e.classList.toggle("done",!!y(this,ni)),e.setAttribute("data-l10n-id",y(Ka,Em)[y(this,Nu,pN)]),(s=y(this,x1))==null||s.setAttribute("data-l10n-id",y(Ka,Em)[`${y(this,Nu,pN)}-label`]),!y(this,ni)){(i=y(this,xd))==null||i.remove();return}}else{if(!y(this,ni)&&!y(this,vd)){e.classList.remove("done"),(o=y(this,xd))==null||o.remove();return}e.classList.add("done"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let n=y(this,xd);if(!n){$(this,xd,n=document.createElement("span")),n.className="tooltip",n.setAttribute("role","tooltip"),n.id=`alt-text-tooltip-${y(this,Eo).id}`;const l=100,c=y(this,Eo)._uiManager._signal;c.addEventListener("abort",()=>{clearTimeout(y(this,rl)),$(this,rl,null)},{once:!0}),e.addEventListener("mouseenter",()=>{$(this,rl,setTimeout(()=>{$(this,rl,null),y(this,xd).classList.add("show"),y(this,Eo)._reportTelemetry({action:"alt_text_tooltip"})},l))},{signal:c}),e.addEventListener("mouseleave",()=>{var u;y(this,rl)&&(clearTimeout(y(this,rl)),$(this,rl,null)),(u=y(this,xd))==null||u.classList.remove("show")},{signal:c})}y(this,vd)?n.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(n.removeAttribute("data-l10n-id"),n.textContent=y(this,ni)),n.parentNode||e.append(n);const r=y(this,Eo).getElementForAltText();r==null||r.setAttribute("aria-describedby",n.id)},q(Ka,Em,null),Te(Ka,"_l10n",null);let sI=Ka;
900var Ci,uc,Cx,ir,CA,kx,au,Ax,Ex,Tx,kA,X8;class uP{constructor(e){q(this,kA);q(this,Ci,null);q(this,uc,null);q(this,Cx,!1);q(this,ir,null);q(this,CA,null);q(this,kx,null);q(this,au,null);q(this,Ax,null);q(this,Ex,!1);q(this,Tx,null);$(this,ir,e)}renderForToolbar(){const e=$(this,uc,document.createElement("button"));return e.className="comment",V(this,kA,X8).call(this,e,!1)}renderForStandalone(){const e=$(this,Ci,document.createElement("button"));e.className="annotationCommentButton";const n=y(this,ir).commentButtonPosition;if(n){const{style:r}=e;r.insetInlineEnd=`calc(${100*(y(this,ir)._uiManager.direction==="ltr"?1-n[0]:n[0])}% - var(--comment-button-dim))`,r.top=`calc(${100*n[1]}% - var(--comment-button-dim))`;const s=y(this,ir).commentButtonColor;s&&(r.backgroundColor=s)}return V(this,kA,X8).call(this,e,!0)}focusButton(){setTimeout(()=>{var e;(e=y(this,Ci)??y(this,uc))==null||e.focus()},0)}onUpdatedColor(){if(!y(this,Ci))return;const e=y(this,ir).commentButtonColor;e&&(y(this,Ci).style.backgroundColor=e),y(this,ir)._uiManager.updatePopupColor(y(this,ir))}get commentButtonWidth(){var e;return(((e=y(this,Ci))==null?void 0:e.getBoundingClientRect().width)??0)/y(this,ir).parent.boundingClientRect.width}get commentPopupPositionInLayer(){if(y(this,Tx))return y(this,Tx);if(!y(this,Ci))return null;const{x:e,y:n,height:r}=y(this,Ci).getBoundingClientRect(),{x:s,y:i,width:o,height:l}=y(this,ir).parent.boundingClientRect;return[(e-s)/o,(n+r-i)/l]}set commentPopupPositionInLayer(e){$(this,Tx,e)}hasDefaultPopupPosition(){return y(this,Tx)===null}removeStandaloneCommentButton(){var e;(e=y(this,Ci))==null||e.remove(),$(this,Ci,null)}removeToolbarCommentButton(){var e;(e=y(this,uc))==null||e.remove(),$(this,uc,null)}setCommentButtonStates({selected:e,hasPopup:n}){y(this,Ci)&&(y(this,Ci).classList.toggle("selected",e),y(this,Ci).ariaExpanded=n)}edit(e){const n=this.commentPopupPositionInLayer;let r,s;if(n)[r,s]=n;else{[r,s]=y(this,ir).commentButtonPosition;const{width:d,height:h,x:f,y:p}=y(this,ir);r=f+r*d,s=p+s*h}const i=y(this,ir).parent.boundingClientRect,{x:o,y:l,width:c,height:u}=i;y(this,ir)._uiManager.editComment(y(this,ir),o+r*c,l+s*u,{...e,parentDimensions:i})}finish(){y(this,uc)&&(y(this,uc).focus({focusVisible:y(this,Cx)}),$(this,Cx,!1))}isDeleted(){return y(this,Ex)||y(this,au)===""}isEmpty(){return y(this,au)===null}hasBeenEdited(){return this.isDeleted()||y(this,au)!==y(this,CA)}serialize(){return this.data}get data(){return{text:y(this,au),richText:y(this,kx),date:y(this,Ax),deleted:this.isDeleted()}}set data(e){if(e!==y(this,au)&&$(this,kx,null),e===null){$(this,au,""),$(this,Ex,!0);return}$(this,au,e),$(this,Ax,new Date),$(this,Ex,!1)}setInitialText(e,n=null){$(this,CA,e),this.data=e,$(this,Ax,null),$(this,kx,n)}shown(){}destroy(){var e,n;(e=y(this,uc))==null||e.remove(),$(this,uc,null),(n=y(this,Ci))==null||n.remove(),$(this,Ci,null),$(this,au,""),$(this,kx,null),$(this,Ax,null),$(this,ir,null),$(this,Cx,!1),$(this,Ex,!1)}}Ci=new WeakMap,uc=new WeakMap,Cx=new WeakMap,ir=new WeakMap,CA=new WeakMap,kx=new WeakMap,au=new WeakMap,Ax=new WeakMap,Ex=new WeakMap,Tx=new WeakMap,kA=new WeakSet,X8=function(e,n){if(!y(this,ir)._uiManager.hasCommentManager())return null;e.tabIndex="0",e.ariaHasPopup="dialog",n?(e.ariaControls="commentPopup",e.setAttribute("data-l10n-id","pdfjs-show-comment-button")):(e.ariaControlsElements=[y(this,ir)._uiManager.getCommentDialogElement()],e.setAttribute("data-l10n-id","pdfjs-editor-edit-comment-button"));const r=y(this,ir)._uiManager._signal;if(!(r instanceof AbortSignal)||r.aborted)return e;e.addEventListener("contextmenu",$l,{signal:r}),n&&(e.addEventListener("focusin",i=>{y(this,ir)._focusEventsAllowed=!1,Dr(i)},{capture:!0,signal:r}),e.addEventListener("focusout",i=>{y(this,ir)._focusEventsAllowed=!0,Dr(i)},{capture:!0,signal:r})),e.addEventListener("pointerdown",i=>i.stopPropagation(),{signal:r});const s=i=>{i.preventDefault(),e===y(this,uc)?this.edit():y(this,ir).toggleComment(!0)};return e.addEventListener("click",s,{capture:!0,signal:r}),e.addEventListener("keydown",i=>{i.target===e&&i.key==="Enter"&&($(this,Cx,!0),s(i))},{signal:r}),e.addEventListener("pointerenter",()=>{y(this,ir).toggleComment(!1,!0)},{signal:r}),e.addEventListener("pointerleave",()=>{y(this,ir).toggleComment(!1,!1)},{signal:r}),e};
900var b1,Px,AA,EA,TA,PA,MA,tf,Mx,nf,Rx,rf,Kg,dbe,hbe,fbe;const ZY=class ZY{constructor({container:e,isPinchingDisabled:n=null,isPinchingStopped:r=null,onPinchStart:s=null,onPinching:i=null,onPinchEnd:o=null,signal:l}){q(this,Kg);q(this,b1);q(this,Px,!1);q(this,AA,null);q(this,EA);q(this,TA);q(this,PA);q(this,MA);q(this,tf,null);q(this,Mx);q(this,nf,null);q(this,Rx);q(this,rf,null);$(this,b1,e),$(this,AA,r),$(this,EA,n),$(this,TA,s),$(this,PA,i),$(this,MA,o),$(this,Rx,new AbortController),$(this,Mx,AbortSignal.any([l,y(this,Rx).signal])),e.addEventListener("touchstart",V(this,Kg,dbe).bind(this),{passive:!1,signal:y(this,Mx)})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/$u.pixelRatio}destroy(){var e,n;(e=y(this,Rx))==null||e.abort(),$(this,Rx,null),(n=y(this,tf))==null||n.abort(),$(this,tf,null)}};b1=new WeakMap,Px=new WeakMap,AA=new WeakMap,EA=new WeakMap,TA=new WeakMap,PA=new WeakMap,MA=new WeakMap,tf=new WeakMap,Mx=new WeakMap,nf=new WeakMap,Rx=new WeakMap,rf=new WeakMap,Kg=new WeakSet,dbe=function(e){var s,i,o;if((s=y(this,EA))!=null&&s.call(this))return;if(e.touches.length===1){if(y(this,tf))return;const l=$(this,tf,new AbortController),c=AbortSignal.any([y(this,Mx),l.signal]),u=y(this,b1),d={capture:!0,signal:c,passive:!1},h=f=>{var p;f.pointerType==="touch"&&((p=y(this,tf))==null||p.abort(),$(this,tf,null))};u.addEventListener("pointerdown",f=>{f.pointerType==="touch"&&(Dr(f),h(f))},d),u.addEventListener("pointerup",h,d),u.addEventListener("pointercancel",h,d);return}if(!y(this,rf)){$(this,rf,new AbortController);const l=AbortSignal.any([y(this,Mx),y(this,rf).signal]),c=y(this,b1),u={signal:l,capture:!1,passive:!1};c.addEventListener("touchmove",V(this,Kg,hbe).bind(this),u);const d=V(this,Kg,fbe).bind(this);c.addEventListener("touchend",d,u),c.addEventListener("touchcancel",d,u),u.capture=!0,c.addEventListener("pointerdown",Dr,u),c.addEventListener("pointermove",Dr,u),c.addEventListener("pointercancel",Dr,u),c.addEventListener("pointerup",Dr,u),(i=y(this,TA))==null||i.call(this)}if(Dr(e),e.touches.length!==2||(o=y(this,AA))!=null&&o.call(this)){$(this,nf,null);return}let[n,r]=e.touches;n.identifier>r.identifier&&([n,r]=[r,n]),$(this,nf,{touch0X:n.screenX,touch0Y:n.screenY,touch1X:r.screenX,touch1Y:r.screenY})},hbe=function(e){var j;if(!y(this,nf)||e.touches.length!==2)return;Dr(e);let[n,r]=e.touches;n.identifier>r.identifier&&([n,r]=[r,n]);const{screenX:s,screenY:i}=n,{screenX:o,screenY:l}=r,c=y(this,nf),{touch0X:u,touch0Y:d,touch1X:h,touch1Y:f}=c,p=h-u,m=f-d,v=o-s,x=l-i,g=Math.hypot(v,x)||1,w=Math.hypot(p,m)||1;if(!y(this,Px)&&Math.abs(w-g)<=ZY.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(c.touch0X=s,c.touch0Y=i,c.touch1X=o,c.touch1Y=l,!y(this,Px)){$(this,Px,!0);return}const _=[(s+o)/2,(i+l)/2];(j=y(this,PA))==null||j.call(this,_,w,g)},fbe=function(e){var n;e.touches.length>=2||(y(this,rf)&&(y(this,rf).abort(),$(this,rf,null),(n=y(this,MA))==null||n.call(this)),y(this,nf)&&(Dr(e),$(this,nf,null),$(this,Px,!1)))};let kk=ZY;var Ox,ou,Cr,Gn,sf,w1,Tm,RA,ki,Ix,af,wd,Pm,OA,Dx,sl,IA,Lx,of,_d,_1,j1,dc,Fx,DA,hL,Et,J8,LA,Q8,YM,pbe,mbe,Z8,XM,eU,gbe,vbe,xbe,tU,ybe,nU,bbe,wbe,_be,rU,mN;const qt=class qt{constructor(e){q(this,Et);q(this,Ox,null);q(this,ou,null);q(this,Cr,null);q(this,Gn,null);q(this,sf,null);q(this,w1,!1);q(this,Tm,null);q(this,RA,"");q(this,ki,null);q(this,Ix,null);q(this,af,null);q(this,wd,null);q(this,Pm,null);q(this,OA,"");q(this,Dx,!1);q(this,sl,null);q(this,IA,!1);q(this,Lx,!1);q(this,of,!1);q(this,_d,null);q(this,_1,0);q(this,j1,0);q(this,dc,null);q(this,Fx,null);Te(this,"isSelected",!1);Te(this,"_isCopy",!1);Te(this,"_editToolbar",null);Te(this,"_initialOptions",Object.create(null));Te(this,"_initialData",null);Te(this,"_isVisible",!0);Te(this,"_uiManager",null);Te(this,"_focusEventsAllowed",!0);q(this,DA,!1);q(this,hL,qt._zIndex++);this.parent=e.parent,this.id=e.id,this.width=this.height=null,this.pageIndex=e.parent.pageIndex,this.name=e.name,this.div=null,this._uiManager=e.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=e.isCentered,this._structTreeParentId=null,this.annotationElementId=e.annotationElementId||null,this.creationDate=e.creationDate||new Date,this.modificationDate=e.modificationDate||null;const{rotation:n,rawDims:{pageWidth:r,pageHeight:s,pageX:i,pageY:o}}=this.parent.viewport;this.rotation=n,this.pageRotation=(360+n-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[r,s],this.pageTranslation=[i,o];const[l,c]=this.parentDimensions;this.x=e.x/l,this.y=e.y/c,this.isAttachedToDOM=!1,this.deleted=!1}static get _resizerKeyboardManager(){const e=qt.prototype._resizeWithKeyboard,n=zg.TRANSLATE_SMALL,r=zg.TRANSLATE_BIG;return Gt(this,"_resizerKeyboardManager",new k2([[["ArrowLeft","mac+ArrowLeft"],e,{args:[-n,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e,{args:[-r,0]}],[["ArrowRight","mac+ArrowRight"],e,{args:[n,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e,{args:[r,0]}],[["ArrowUp","mac+ArrowUp"],e,{args:[0,-n]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e,{args:[0,-r]}],[["ArrowDown","mac+ArrowDown"],e,{args:[0,n]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e,{args:[0,r]}],[["Escape","mac+Escape"],qt.prototype._stopResizingWithKeyboard]]))}get editorType(){return Object.getPrototypeOf(this).constructor._type}get mode(){return Object.getPrototypeOf(this).constructor._editorType}static get isDrawer(){return!1}static get _defaultLineColor(){return Gt(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(e){const n=new mZe({id:e.parent.getNextId(),parent:e.parent,uiManager:e._uiManager});n.annotationElementId=e.annotationElementId,n.deleted=!0,n._uiManager.addToAnnotationStorage(n)}static initialize(e,n){if(qt._l10n??(qt._l10n=e),qt._l10nResizer||(qt._l10nResizer=Object.freeze({topLeft:"pdfjs-editor-resizer-top-left",topMiddle:"pdfjs-editor-resizer-top-middle",topRight:"pdfjs-editor-resizer-top-right",middleRight:"pdfjs-editor-resizer-middle-right",bottomRight:"pdfjs-editor-resizer-bottom-right",bottomMiddle:"pdfjs-editor-resizer-bottom-middle",bottomLeft:"pdfjs-editor-resizer-bottom-left",middleLeft:"pdfjs-editor-resizer-middle-left"})),qt._borderLineWidth!==-1)return;const r=getComputedStyle(document.documentElement);qt._borderLineWidth=parseFloat(r.getPropertyValue("--outline-width"))||0}static updateDefaultParams(e,n){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(e){return!1}static paste(e,n){Zn("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return y(this,DA)}set _isDraggable(e){var n;$(this,DA,e),(n=this.div)==null||n.classList.toggle("draggable",e)}get uid(){return this.annotationElementId||this.id}get isEnterHandled(){return!0}center(){const[e,n]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*n/(e*2),this.y+=this.width*e/(n*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*n/(e*2),this.y-=this.width*e/(n*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(e){this._uiManager.addCommands(e)}get currentLayer(){return this._uiManager.currentLayer}
900setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=y(this,hL)}setParent(e){var n;e!==null?(this.pageIndex=e.pageIndex,this.pageDimensions=e.pageDimensions):(V(this,Et,mN).call(this),(n=y(this,wd))==null||n.remove(),$(this,wd,null)),this.parent=e}focusin(e){this._focusEventsAllowed&&(y(this,Dx)?$(this,Dx,!1):this.parent.setSelected(this))}focusout(e){var r;if(!this._focusEventsAllowed||!this.isAttachedToDOM)return;const n=e.relatedTarget;n!=null&&n.closest(`#${this.id}`)||(e.preventDefault(),(r=this.parent)!=null&&r.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.isInEditMode()&&this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(e,n,r,s){const[i,o]=this.parentDimensions;[r,s]=this.screenToPageTranslation(r,s),this.x=(e+r)/i,this.y=(n+s)/o,this.fixAndSetPosition()}_moveAfterPaste(e,n){const[r,s]=this.parentDimensions;this.setAt(e*r,n*s,this.width*r,this.height*s),this._onTranslated()}translate(e,n){V(this,Et,J8).call(this,this.parentDimensions,e,n)}translateInPage(e,n){y(this,sl)||$(this,sl,[this.x,this.y,this.width,this.height]),V(this,Et,J8).call(this,this.pageDimensions,e,n),this.div.scrollIntoView({block:"nearest"})}translationDone(){this._onTranslated(this.x,this.y)}drag(e,n){y(this,sl)||$(this,sl,[this.x,this.y,this.width,this.height]);const{div:r,parentDimensions:[s,i]}=this;if(this.x+=e/s,this.y+=n/i,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:h,y:f}=this.div.getBoundingClientRect();this.parent.findNewParent(this,h,f)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:o,y:l}=this;const[c,u]=this.getBaseTranslation();o+=c,l+=u;const{style:d}=r;d.left=`${(100*o).toFixed(2)}%`,d.top=`${(100*l).toFixed(2)}%`,this._onTranslating(o,l),r.scrollIntoView({block:"nearest"})}_onTranslating(e,n){}_onTranslated(e,n){}get _hasBeenMoved(){return!!y(this,sl)&&(y(this,sl)[0]!==this.x||y(this,sl)[1]!==this.y)}get _hasBeenResized(){return!!y(this,sl)&&(y(this,sl)[2]!==this.width||y(this,sl)[3]!==this.height)}getBaseTranslation(){const[e,n]=this.parentDimensions,{_borderLineWidth:r}=qt,s=r/e,i=r/n;switch(this.rotation){case 90:return[-s,i];case 180:return[s,i];case 270:return[s,-i];default:return[-s,-i]}}get _mustFixPosition(){return!0}fixAndSetPosition(e=this.rotation){const{div:{style:n},pageDimensions:[r,s]}=this;let{x:i,y:o,width:l,height:c}=this;if(l*=r,c*=s,i*=r,o*=s,this._mustFixPosition)switch(e){case 0:i=va(i,0,r-l),o=va(o,0,s-c);break;case 90:i=va(i,0,r-c),o=va(o,l,s);break;case 180:i=va(i,l,r),o=va(o,c,s);break;case 270:i=va(i,c,r),o=va(o,0,s-l);break}this.x=i/=r,this.y=o/=s;const[u,d]=this.getBaseTranslation();i+=u,o+=d,n.left=`${(100*i).toFixed(2)}%`,n.top=`${(100*o).toFixed(2)}%`,this.moveInDOM()}screenToPageTranslation(e,n){var r;return V(r=qt,LA,Q8).call(r,e,n,this.parentRotation)}pageTranslationToScreen(e,n){var r;return V(r=qt,LA,Q8).call(r,e,n,360-this.parentRotation)}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:e,pageDimensions:[n,r]}=this;return[n*e,r*e]}setDims(){const{div:{style:e},width:n,height:r}=this;e.width=`${(100*n).toFixed(2)}%`,e.height=`${(100*r).toFixed(2)}%`}getInitialTranslation(){return[0,0]}_onResized(){}static _round(e){return Math.round(e*1e4)/1e4}_onResizing(){}altTextFinish(){var e;(e=y(this,Cr))==null||e.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||y(this,Lx))return this._editToolbar;this._editToolbar=new dZe(this),this.div.append(this._editToolbar.render());const{toolbarButtons:e}=this;if(e)for(const[n,r]of e)await this._editToolbar.addButton(n,r);return this.hasComment||this._editToolbar.addButton("comment",this.addCommentButton()),this._editToolbar.addButton("delete"),this._editToolbar}addCommentButtonInToolbar(){var e;(e=this._editToolbar)==null||e.addButtonBefore("comment",this.addCommentButton(),".deleteButton")}
900removeCommentButtonFromToolbar(){var e;(e=this._editToolbar)==null||e.removeButton("comment")}removeEditToolbar(){var e,n;(e=this._editToolbar)==null||e.remove(),this._editToolbar=null,(n=y(this,Cr))==null||n.destroy()}addContainer(e){var r;const n=(r=this._editToolbar)==null?void 0:r.div;n?n.before(e):this.div.append(e)}getClientDimensions(){return this.div.getBoundingClientRect()}createAltText(){return y(this,Cr)||(sI.initialize(qt._l10n),$(this,Cr,new sI(this)),y(this,Ox)&&(y(this,Cr).data=y(this,Ox),$(this,Ox,null))),y(this,Cr)}get altTextData(){var e;return(e=y(this,Cr))==null?void 0:e.data}set altTextData(e){y(this,Cr)&&(y(this,Cr).data=e)}get guessedAltText(){var e;return(e=y(this,Cr))==null?void 0:e.guessedText}async setGuessedAltText(e){var n;await((n=y(this,Cr))==null?void 0:n.setGuessedText(e))}serializeAltText(e){var n;return(n=y(this,Cr))==null?void 0:n.serialize(e)}hasAltText(){return!!y(this,Cr)&&!y(this,Cr).isEmpty()}hasAltTextData(){var e;return((e=y(this,Cr))==null?void 0:e.hasData())??!1}focusCommentButton(){var e;(e=y(this,Gn))==null||e.focusButton()}addCommentButton(){return y(this,Gn)||$(this,Gn,new uP(this))}addStandaloneCommentButton(){if(y(this,sf)){this._uiManager.isEditingMode()&&y(this,sf).classList.remove("hidden");return}this.hasComment&&($(this,sf,y(this,Gn).renderForStandalone()),this.div.append(y(this,sf)))}removeStandaloneCommentButton(){y(this,Gn).removeStandaloneCommentButton(),$(this,sf,null)}hideStandaloneCommentButton(){var e;(e=y(this,sf))==null||e.classList.add("hidden")}get comment(){const{data:{richText:e,text:n,date:r,deleted:s}}=y(this,Gn);return{text:n,richText:e,date:r,deleted:s,color:this.getNonHCMColor(),opacity:this.opacity??1}}set comment(e){y(this,Gn)||$(this,Gn,new uP(this)),y(this,Gn).data=e,this.hasComment?(this.removeCommentButtonFromToolbar(),this.addStandaloneCommentButton(),this._uiManager.updateComment(this)):(this.addCommentButtonInToolbar(),this.removeStandaloneCommentButton(),this._uiManager.removeComment(this))}setCommentData({comment:e,popupRef:n,richText:r}){if(!n||(y(this,Gn)||$(this,Gn,new uP(this)),y(this,Gn).setInitialText(e,r),!this.annotationElementId))return;const s=this._uiManager.getAndRemoveDataFromAnnotationStorage(this.annotationElementId);s&&this.updateFromAnnotationLayer(s)}get hasEditedComment(){var e;return(e=y(this,Gn))==null?void 0:e.hasBeenEdited()}get hasDeletedComment(){var e;return(e=y(this,Gn))==null?void 0:e.isDeleted()}get hasComment(){return!!y(this,Gn)&&!y(this,Gn).isEmpty()&&!y(this,Gn).isDeleted()}async editComment(e){y(this,Gn)||$(this,Gn,new uP(this)),y(this,Gn).edit(e)}toggleComment(e,n=void 0){this.hasComment&&this._uiManager.toggleComment(this,e,n)}setSelectedCommentButton(e){y(this,Gn).setSelectedButton(e)}addComment(e){if(this.hasEditedComment){const[,,,s]=e.rect,[i]=this.pageDimensions,[o]=this.pageTranslation,l=o+i+1,c=s-100,u=l+180;e.popup={contents:this.comment.text,deleted:this.comment.deleted,rect:[l,c,u,s]}}}updateFromAnnotationLayer({popup:{contents:e,deleted:n}}){y(this,Gn).data=n?null:e}get parentBoundingClientRect(){return this.parent.boundingClientRect}render(){var o;const e=this.div=document.createElement("div");e.setAttribute("data-editor-rotation",(360-this.rotation)%360),e.className=this.name,e.setAttribute("id",this.id),e.tabIndex=y(this,w1)?-1:0,e.setAttribute("role","application"),this.defaultL10nId&&e.setAttribute("data-l10n-id",this.defaultL10nId),this._isVisible||e.classList.add("hidden"),this.setInForeground(),V(this,Et,nU).call(this);const[n,r]=this.parentDimensions;this.parentRotation%180!==0&&(e.style.maxWidth=`${(100*r/n).toFixed(2)}%`,e.style.maxHeight=`${(100*n/r).toFixed(2)}%`);const[s,i]=this.getInitialTranslation();return this.translate(s,i),Z0e(this,e,["keydown","pointerdown","dblclick"]),this.isResizable&&this._uiManager._supportsPinchToZoom&&(y(this,Fx)||$(this,Fx,new kk({container:e,isPinchingDisabled:()=>!this.isSelected,onPinchStart:V(this,Et,gbe).bind(this),onPinching:V(this,Et,vbe).bind(this),onPinchEnd:V(this,Et,xbe).bind(this),signal:this._uiManager._signal}))),this.addStandaloneCommentButton(),(o=this._uiManager._editorUndoBar)==null||o.hide(),e}pointerdown(e){const{isMac:n}=yi.platform;if(e.button!==0||e.ctrlKey&&n){e.preventDefault();return}if($(this,Dx,!0),this._isDraggable){V(this,Et,ybe).call(this,e);return}V(this,Et,tU).call(this,e)}_onStartDragging(){}_onStopDragging(){}moveInDOM(){y(this,_d)&&clearTimeout(y(this,_d)),$(this,_d,setTimeout(()=>{var e;$(this,_d,null),(e=this.parent)==null||e.moveEditorInDOM(this)},0))}_setParentAndPosition(e,n,r){e.changeParent(this),this.x=n,this.y=r,this.fixAndSetPosition(),this._onTranslated()}getRect(e,n,r=this.rotation){const s=this.parentScale,[i,o]=this.pageDimensions,[l,c]=this.pageTranslation,u=e/s,d=n/s,h=this.x*i,f=this.y*o,p=this.width*i,m=this.height*o;switch(r){case 0:return[h+u+l,o-f-d-m+c,h+u+p+l,o-f-d+c];case 90:return[h+d+l,o-f+u+c,h+d+m+l,o-f+u+p+c];case 180:return[h-u-p+l,o-f+d+c,h-u+l,o-f+d+m+c];case 270:return[h-d-m+l,o-f-u-p+c,h-d+l,o-f-u+c];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(e,n){const[r,s,i,o]=e,l=i-r,c=o-s;switch(this.rotation){case 0:return[r,n-o,l,c];case 90:return[r,n-s,c,l];case 180:return[i,n-s,l,c];case 270:return[i,n-o,c,l];default:throw new Error("Invalid rotation")}}getPDFRect(){return this.getRect(0,0)}getNonHCMColor(){return this.color&&qt._colorManager.convert(this._uiManager.getNonHCMColor(this.color))}onUpdatedColor(){var e;(e=y(this,Gn))==null||e.onUpdatedColor()}getData(){const{comment:{text:e,color:n,date:r,opacity:s,deleted:i,richText:o},uid:l,pageIndex:c,creationDate:u,modificationDate:d}=this;return{id:l,pageIndex:c,rect:this.getPDFRect(),richText:o,contentsObj:{str:e},creationDate:u,modificationDate:r||d,popupRef:!i,color:n,opacity:s}}onceAdded(e){}isEmpty(){return!1}enableEditMode(){return this.isInEditMode()?!1:(this.parent.setEditingState(!1),$(this,Lx,!0),!0)}disableEditMode(){return this.isInEditMode()?(this.parent.setEditingState(!0),$(this,Lx,!1),!0):!1}isInEditMode(){return y(this,Lx)}shouldGetKeyboardEvents(){return y(this,of)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){const{top:e,left:n,bottom:r,right:s}=this.getClientDimensions(),{innerHeight:i,innerWidth:o}=window;return n<o&&s>0&&e<i&&r>0}rebuild(){V(this,Et,nU).call(this)}rotate(e){}resize(){}serializeDeleted(){var e;return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:((e=this._initialData)==null?void 0:e.popupRef)||""}}serialize(e=!1,n=null){var r;return{annotationType:this.mode,pageIndex:this.pageIndex,rect:this.getPDFRect(),rotation:this.rotation,structTreeParentId:this._structTreeParentId,popupRef:((r=this._initialData)==null?void 0:r.popupRef)||""}}static async deserialize(e,n,r){const s=new this.prototype.constructor({parent:n,id:n.getNextId(),uiManager:r,annotationElementId:e.annotationElementId,creationDate:e.creationDate,modificationDate:e.modificationDate});s.rotation=e.rotation,$(s,Ox,e.accessibilityData),s._isCopy=e.isCopy||!1;const[i,o]=s.pageDimensions,[l,c,u,d]=s.getRectInCurrentCoords(e.rect,o);return s.x=l/i,s.y=c/o,s.width=u/i,s.height=d/o,s}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){var e,n;if((e=y(this,Pm))==null||e.abort(),$(this,Pm,null),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),y(this,_d)&&(clearTimeout(y(this,_d)),$(this,_d,null)),V(this,Et,mN).call(this),this.removeEditToolbar(),y(this,dc)){for(const r of y(this,dc).values())clearTimeout(r);$(this,dc,null)}this.parent=null,(n=y(this,Fx))==null||n.destroy(),$(this,Fx,null)}get isResizable(){return!1}makeResizable(){this.isResizable&&(V(this,Et,pbe).call(this),y(this,ki).classList.remove("hidden"))}get toolbarPosition(){return null}get commentButtonPosition(){return this._uiManager.direction==="ltr"?[1,0]:[0,0]}get commentButtonPositionInPage(){const{commentButtonPosition:[e,n]}=this,[r,s,i,o]=this.getPDFRect();return[qt._round(r+(i-r)*e),qt._round(s+(o-s)*(1-n))]}get commentButtonColor(){return this._uiManager.makeCommentColor(this.getNonHCMColor(),this.opacity)}get commentPopupPosition(){return y(this,Gn).commentPopupPositionInLayer}set commentPopupPosition(e){y(this,Gn).commentPopupPositionInLayer=e}hasDefaultPopupPosition(){return y(this,Gn).hasDefaultPopupPosition()}get commentButtonWidth(){return y(this,Gn).commentButtonWidth}get elementBeforePopup(){return this.div}setCommentButtonStates(e){y(this,Gn).setCommentButtonStates(e)}keydown(e){if(!this.isResizable||e.target!==this.div||e.key!=="Enter")return;this._uiManager.setSelected(this),$(this,af,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const n=y(this,ki).children;if(!y(this,ou)){$(this,ou,Array.from(n));const o=V(this,Et,bbe).bind(this),l=V(this,Et,wbe).bind(this),c=this._uiManager._signal;for(const u of y(this,ou)){const d=u.getAttribute("data-resizer-name");u.setAttribute("role","spinbutton"),u.addEventListener("keydown",o,{signal:c}),u.addEventListener("blur",l,{signal:c}),u.addEventListener("focus",V(this,Et,_be).bind(this,d),{signal:c}),u.setAttribute("data-l10n-id",qt._l10nResizer[d])}}const r=y(this,ou)[0];let s=0;for(const o of n){if(o===r)break;s++}const i=(360-this.rotation+this.parentRotation)%360/90*(y(this,ou).length/4);if(i!==s){if(i<s)for(let l=0;l<s-i;l++)y(this,ki).append(y(this,ki).firstChild);else if(i>s)for(let l=0;l<i-s;l++)y(this,ki).firstChild.before(y(this,ki).lastChild);let o=0;for(const l of n){const u=y(this,ou)[o++].getAttribute("data-resizer-name");l.setAttribute("data-l10n-id",qt._l10nResizer[u])}}
900V(this,Et,rU).call(this,0),$(this,of,!0),y(this,ki).firstChild.focus({focusVisible:!0}),e.preventDefault(),e.stopImmediatePropagation()}_resizeWithKeyboard(e,n){y(this,of)&&V(this,Et,eU).call(this,y(this,OA),{deltaX:e,deltaY:n,fromKeyboard:!0})}_stopResizingWithKeyboard(){V(this,Et,mN).call(this),this.div.focus()}select(){var e,n,r;if(this.isSelected&&this._editToolbar){this._editToolbar.show();return}if(this.isSelected=!0,this.makeResizable(),(e=this.div)==null||e.classList.add("selectedEditor"),!this._editToolbar){this.addEditToolbar().then(()=>{var s,i;(s=this.div)!=null&&s.classList.contains("selectedEditor")&&((i=this._editToolbar)==null||i.show())});return}(n=this._editToolbar)==null||n.show(),(r=y(this,Cr))==null||r.toggleAltTextBadge(!1)}focus(){this.div&&!this.div.contains(document.activeElement)&&setTimeout(()=>{var e;return(e=this.div)==null?void 0:e.focus({preventScroll:!0})},0)}unselect(){var e,n,r,s,i;this.isSelected&&(this.isSelected=!1,(e=y(this,ki))==null||e.classList.add("hidden"),(n=this.div)==null||n.classList.remove("selectedEditor"),(r=this.div)!=null&&r.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),(s=this._editToolbar)==null||s.hide(),(i=y(this,Cr))==null||i.toggleAltTextBadge(!0),this.hasComment&&this._uiManager.toggleComment(this,!1,!1))}updateParams(e,n){}disableEditing(){}enableEditing(){}get canChangeContent(){return!1}enterInEditMode(){this.canChangeContent&&(this.enableEditMode(),this.div.focus())}dblclick(e){e.target.nodeName!=="BUTTON"&&(this.enterInEditMode(),this.parent.updateToolbar({mode:this.constructor._editorType,editId:this.id}))}getElementForAltText(){return this.div}get contentDiv(){return this.div}get isEditing(){return y(this,IA)}set isEditing(e){$(this,IA,e),this.parent&&(e?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(e,n=!1){if(n){y(this,dc)||$(this,dc,new Map);const{action:r}=e;let s=y(this,dc).get(r);s&&clearTimeout(s),s=setTimeout(()=>{this._reportTelemetry(e),y(this,dc).delete(r),y(this,dc).size===0&&$(this,dc,null)},qt._telemetryTimeout),y(this,dc).set(r,s);return}e.type||(e.type=this.editorType),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:e}})}show(e=this._isVisible){this.div.classList.toggle("hidden",!e),this._isVisible=e}enable(){this.div&&(this.div.tabIndex=0),$(this,w1,!1)}disable(){this.div&&(this.div.tabIndex=-1),$(this,w1,!0)}updateFakeAnnotationElement(e){if(!y(this,wd)&&!this.deleted){$(this,wd,e.addFakeAnnotation(this));return}if(this.deleted){y(this,wd).remove(),$(this,wd,null);return}(this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized)&&y(this,wd).updateEdited({rect:this.getPDFRect(),popup:this.comment})}renderAnnotationElement(e){if(this.deleted)return e.hide(),null;let n=e.container.querySelector(".annotationContent");if(!n)n=document.createElement("div"),n.classList.add("annotationContent",this.editorType),e.container.prepend(n);else if(n.nodeName==="CANVAS"){const r=n;n=document.createElement("div"),n.classList.add("annotationContent",this.editorType),r.before(n)}return n}resetAnnotationElement(e){const{firstChild:n}=e.container;(n==null?void 0:n.nodeName)==="DIV"&&n.classList.contains("annotationContent")&&n.remove()}};Ox=new WeakMap,ou=new WeakMap,Cr=new WeakMap,Gn=new WeakMap,sf=new WeakMap,w1=new WeakMap,Tm=new WeakMap,RA=new WeakMap,ki=new WeakMap,Ix=new WeakMap,af=new WeakMap,wd=new WeakMap,Pm=new WeakMap,OA=new WeakMap,Dx=new WeakMap,sl=new WeakMap,IA=new WeakMap,Lx=new WeakMap,of=new WeakMap,_d=new WeakMap,_1=new WeakMap,j1=new WeakMap,dc=new WeakMap,Fx=new WeakMap,DA=new WeakMap,hL=new WeakMap,Et=new WeakSet,J8=function([e,n],r,s){[r,s]=this.screenToPageTranslation(r,s),this.x+=r/e,this.y+=s/n,this._onTranslating(this.x,this.y),this.fixAndSetPosition()},LA=new WeakSet,Q8=function(e,n,r){switch(r){case 90:return[n,-e];case 180:return[-e,-n];case 270:return[-n,e];default:return[e,n]}},YM=function(e){switch(e){case 90:{const[n,r]=this.pageDimensions;return[0,-n/r,r/n,0]}case 180:return[-1,0,0,-1];case 270:{const[n,r]=this.pageDimensions;return[0,n/r,-r/n,0]}default:return[1,0,0,1]}},pbe=function(){if(y(this,ki))return;$(this,ki,document.createElement("div")),y(this,ki).classList.add("resizers");const e=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],n=this._uiManager._signal;for(const r of e){const s=document.createElement("div");y(this,ki).append(s),s.classList.add("resizer",r),s.setAttribute("data-resizer-name",r),s.addEventListener("pointerdown",V(this,Et,mbe).bind(this,r),{signal:n}),s.addEventListener("contextmenu",$l,{signal:n}),s.tabIndex=-1}this.div.prepend(y(this,ki))},mbe=function(e,n){var d;n.preventDefault();const{isMac:r}=yi.platform;if(n.button!==0||n.ctrlKey&&r)return;(d=y(this,Cr))==null||d.toggle(!1);const s=this._isDraggable;this._isDraggable=!1,$(this,Ix,[n.screenX,n.screenY]);const i=new AbortController,o=this._uiManager.combinedSignal(i);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",V(this,Et,eU).bind(this,e),{passive:!0,capture:!0,signal:o}),window.addEventListener("touchmove",Dr,{passive:!1,signal:o}),window.addEventListener("contextmenu",$l,{signal:o}),$(this,af,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const l=this.parent.div.style.cursor,c=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(n.target).cursor;const u=()=>{var h;i.abort(),this.parent.togglePointerEvents(!0),(h=y(this,Cr))==null||h.toggle(!0),this._isDraggable=s,this.parent.div.style.cursor=l,this.div.style.cursor=c,V(this,Et,XM).call(this)};window.addEventListener("pointerup",u,{signal:o}),window.addEventListener("blur",u,{signal:o})}
900,Z8=function(e,n,r,s){this.width=r,this.height=s,this.x=e,this.y=n,this.setDims(),this.fixAndSetPosition(),this._onResized()},XM=function(){if(!y(this,af))return;const{savedX:e,savedY:n,savedWidth:r,savedHeight:s}=y(this,af);$(this,af,null);const i=this.x,o=this.y,l=this.width,c=this.height;i===e&&o===n&&l===r&&c===s||this.addCommands({cmd:V(this,Et,Z8).bind(this,i,o,l,c),undo:V(this,Et,Z8).bind(this,e,n,r,s),mustExec:!0})},eU=function(e,n){const[r,s]=this.parentDimensions,i=this.x,o=this.y,l=this.width,c=this.height,u=qt.MIN_SIZE/r,d=qt.MIN_SIZE/s,h=V(this,Et,YM).call(this,this.rotation),f=(D,O)=>[h[0]*D+h[2]*O,h[1]*D+h[3]*O],p=V(this,Et,YM).call(this,360-this.rotation),m=(D,O)=>[p[0]*D+p[2]*O,p[1]*D+p[3]*O];let v,x,g=!1,w=!1;switch(e){case"topLeft":g=!0,v=(D,O)=>[0,0],x=(D,O)=>[D,O];break;case"topMiddle":v=(D,O)=>[D/2,0],x=(D,O)=>[D/2,O];break;case"topRight":g=!0,v=(D,O)=>[D,0],x=(D,O)=>[0,O];break;case"middleRight":w=!0,v=(D,O)=>[D,O/2],x=(D,O)=>[0,O/2];break;case"bottomRight":g=!0,v=(D,O)=>[D,O],x=(D,O)=>[0,0];break;case"bottomMiddle":v=(D,O)=>[D/2,O],x=(D,O)=>[D/2,0];break;case"bottomLeft":g=!0,v=(D,O)=>[0,O],x=(D,O)=>[D,0];break;case"middleLeft":w=!0,v=(D,O)=>[0,O/2],x=(D,O)=>[D,O/2];break}const _=v(l,c),j=x(l,c);let N=f(...j);const S=qt._round(i+N[0]),C=qt._round(o+N[1]);let k=1,E=1,P,T;if(n.fromKeyboard)({deltaX:P,deltaY:T}=n);else{const{screenX:D,screenY:O}=n,[z,B]=y(this,Ix);[P,T]=this.screenToPageTranslation(D-z,O-B),y(this,Ix)[0]=D,y(this,Ix)[1]=O}if([P,T]=m(P/r,T/s),g){const D=Math.hypot(l,c);k=E=Math.max(Math.min(Math.hypot(j[0]-_[0]-P,j[1]-_[1]-T)/D,1/l,1/c),u/l,d/c)}else w?k=va(Math.abs(j[0]-_[0]-P),u,1)/l:E=va(Math.abs(j[1]-_[1]-T),d,1)/c;const M=qt._round(l*k),R=qt._round(c*E);N=f(...x(M,R));const A=S-N[0],I=C-N[1];y(this,sl)||$(this,sl,[this.x,this.y,this.width,this.height]),this.width=M,this.height=R,this.x=A,this.y=I,this.setDims(),this.fixAndSetPosition(),this._onResizing()},gbe=function(){var e;$(this,af,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height}),(e=y(this,Cr))==null||e.toggle(!1),this.parent.togglePointerEvents(!1)},vbe=function(e,n,r){let i=.7*(r/n)+1-.7;if(i===1)return;const o=V(this,Et,YM).call(this,this.rotation),l=(S,C)=>[o[0]*S+o[2]*C,o[1]*S+o[3]*C],[c,u]=this.parentDimensions,d=this.x,h=this.y,f=this.width,p=this.height,m=qt.MIN_SIZE/c,v=qt.MIN_SIZE/u;i=Math.max(Math.min(i,1/f,1/p),m/f,v/p);const x=qt._round(f*i),g=qt._round(p*i);if(x===f&&g===p)return;y(this,sl)||$(this,sl,[d,h,f,p]);const w=l(f/2,p/2),_=qt._round(d+w[0]),j=qt._round(h+w[1]),N=l(x/2,g/2);this.x=_-N[0],this.y=j-N[1],this.width=x,this.height=g,this.setDims(),this.fixAndSetPosition(),this._onResizing()},xbe=function(){var e;(e=y(this,Cr))==null||e.toggle(!0),this.parent.togglePointerEvents(!0),V(this,Et,XM).call(this)},tU=function(e){const{isMac:n}=yi.platform;e.ctrlKey&&!n||e.shiftKey||e.metaKey&&n?this.parent.toggleSelected(this):this.parent.setSelected(this)},ybe=function(e){const{isSelected:n}=this;this._uiManager.setUpDragSession();let r=!1;const s=new AbortController,i=this._uiManager.combinedSignal(s),o={capture:!0,passive:!1,signal:i},l=u=>{s.abort(),$(this,Tm,null),$(this,Dx,!1),this._uiManager.endDragSession()||V(this,Et,tU).call(this,u),r&&this._onStopDragging()};n&&($(this,_1,e.clientX),$(this,j1,e.clientY),$(this,Tm,e.pointerId),$(this,RA,e.pointerType),window.addEventListener("pointermove",u=>{r||(r=!0,this._uiManager.toggleComment(this,!0,!1),this._onStartDragging());const{clientX:d,clientY:h,pointerId:f}=u;if(f!==y(this,Tm)){Dr(u);return}const[p,m]=this.screenToPageTranslation(d-y(this,_1),h-y(this,j1));$(this,_1,d),$(this,j1,h),this._uiManager.dragSelectedEditors(p,m)},o),window.addEventListener("touchmove",Dr,o),window.addEventListener("pointerdown",u=>{u.pointerType===y(this,RA)&&(y(this,Fx)||u.isPrimary)&&l(u),Dr(u)},o));const c=u=>{if(!y(this,Tm)||y(this,Tm)===u.pointerId){l(u);return}Dr(u)};window.addEventListener("pointerup",c,{signal:i}),window.addEventListener("blur",c,{signal:i})},nU=function(){if(y(this,Pm)||!this.div)return;$(this,Pm,new AbortController);const e=this._uiManager.combinedSignal(y(this,Pm));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:e}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:e})},bbe=function(e){qt._resizerKeyboardManager.exec(this,e)},wbe=function(e){var n;y(this,of)&&((n=e.relatedTarget)==null?void 0:n.parentNode)!==y(this,ki)&&V(this,Et,mN).call(this)},_be=function(e){$(this,OA,y(this,of)?e:"")},rU=function(e){if(y(this,ou))for(const n of y(this,ou))n.tabIndex=e}
900,mN=function(){$(this,of,!1),V(this,Et,rU).call(this,-1),V(this,Et,XM).call(this)},q(qt,LA),Te(qt,"_l10n",null),Te(qt,"_l10nResizer",null),Te(qt,"_borderLineWidth",-1),Te(qt,"_colorManager",new q8),Te(qt,"_zIndex",1),Te(qt,"_telemetryTimeout",1e3);let cr=qt;class mZe extends cr{constructor(e){super(e),this.annotationElementId=e.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}const Cte=3285377520,Wl=4294901760,Zu=65535;class jbe{constructor(e){this.h1=e?e&4294967295:Cte,this.h2=e?e&4294967295:Cte}update(e){let n,r;if(typeof e=="string"){n=new Uint8Array(e.length*2),r=0;for(let v=0,x=e.length;v<x;v++){const g=e.charCodeAt(v);g<=255?n[r++]=g:(n[r++]=g>>>8,n[r++]=g&255)}}else if(ArrayBuffer.isView(e))n=e.slice(),r=n.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");const s=r>>2,i=r-s*4,o=new Uint32Array(n.buffer,0,s);let l=0,c=0,u=this.h1,d=this.h2;const h=3432918353,f=461845907,p=h&Zu,m=f&Zu;for(let v=0;v<s;v++)v&1?(l=o[v],l=l*h&Wl|l*p&Zu,l=l<<15|l>>>17,l=l*f&Wl|l*m&Zu,u^=l,u=u<<13|u>>>19,u=u*5+3864292196):(c=o[v],c=c*h&Wl|c*p&Zu,c=c<<15|c>>>17,c=c*f&Wl|c*m&Zu,d^=c,d=d<<13|d>>>19,d=d*5+3864292196);switch(l=0,i){case 3:l^=n[s*4+2]<<16;case 2:l^=n[s*4+1]<<8;case 1:l^=n[s*4],l=l*h&Wl|l*p&Zu,l=l<<15|l>>>17,l=l*f&Wl|l*m&Zu,s&1?u^=l:d^=l}this.h1=u,this.h2=d}hexdigest(){let e=this.h1,n=this.h2;return e^=n>>>1,e=e*3981806797&Wl|e*36045&Zu,n=n*4283543511&Wl|((n<<16|e>>>16)*2950163797&Wl)>>>16,e^=n>>>1,e=e*444984403&Wl|e*60499&Zu,n=n*3301882366&Wl|((n<<16|e>>>16)*3120437893&Wl)>>>16,e^=n>>>1,(e>>>0).toString(16).padStart(8,"0")+(n>>>0).toString(16).padStart(8,"0")}}const sU=Object.freeze({map:null,hash:"",transfer:void 0});var $x,zx,lf,Ai,fL,Sbe;class k7{constructor(){q(this,fL);q(this,$x,!1);q(this,zx,null);q(this,lf,null);q(this,Ai,new Map);this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(e,n){const r=y(this,Ai).get(e);return r===void 0?n:Object.assign(n,r)}getRawValue(e){return y(this,Ai).get(e)}remove(e){const n=y(this,Ai).get(e);if(n!==void 0&&(n instanceof cr&&y(this,lf).delete(n.annotationElementId),y(this,Ai).delete(e),y(this,Ai).size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function")){for(const r of y(this,Ai).values())if(r instanceof cr)return;this.onAnnotationEditor(null)}}setValue(e,n){const r=y(this,Ai).get(e);let s=!1;if(r!==void 0)for(const[i,o]of Object.entries(n))r[i]!==o&&(s=!0,r[i]=o);else s=!0,y(this,Ai).set(e,n);s&&V(this,fL,Sbe).call(this),n instanceof cr&&((y(this,lf)||$(this,lf,new Map)).set(n.annotationElementId,n),typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(n.constructor._type))}has(e){return y(this,Ai).has(e)}get size(){return y(this,Ai).size}resetModified(){y(this,$x)&&($(this,$x,!1),typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new Nbe(this)}get serializable(){if(y(this,Ai).size===0)return sU;const e=new Map,n=new jbe,r=[],s=Object.create(null);let i=!1;for(const[o,l]of y(this,Ai)){const c=l instanceof cr?l.serialize(!1,s):l;c&&(e.set(o,c),n.update(`${o}:${JSON.stringify(c)}`),i||(i=!!c.bitmap))}if(i)for(const o of e.values())o.bitmap&&r.push(o.bitmap);return e.size>0?{map:e,hash:n.hexdigest(),transfer:r}:sU}get editorStats(){let e=null;const n=new Map;let r=0,s=0;for(const i of y(this,Ai).values()){if(!(i instanceof cr)){i.popup&&(i.popup.deleted?s+=1:r+=1);continue}i.isCommentDeleted?s+=1:i.hasEditedComment&&(r+=1);const o=i.telemetryFinalData;if(!o)continue;const{type:l}=o;n.has(l)||n.set(l,Object.getPrototypeOf(i).constructor),e||(e=Object.create(null));const c=e[l]||(e[l]=new Map);for(const[u,d]of Object.entries(o)){if(u==="type")continue;let h=c.get(u);h||(h=new Map,c.set(u,h));const f=h.get(d)??0;h.set(d,f+1)}}if((s>0||r>0)&&(e||(e=Object.create(null)),e.comments={deleted:s,edited:r}),!e)return null;for(const[i,o]of n)e[i]=o.computeTelemetryFinalData(e[i]);return e}resetModifiedIds(){$(this,zx,null)}updateEditor(e,n){var s;const r=(s=y(this,lf))==null?void 0:s.get(e);return r?(r.updateFromAnnotationLayer(n),!0):!1}getEditor(e){var n;return((n=y(this,lf))==null?void 0:n.get(e))||null}get modifiedIds(){if(y(this,zx))return y(this,zx);const e=[];
900if(y(this,lf))for(const n of y(this,lf).values())n.serialize()&&e.push(n.annotationElementId);return $(this,zx,{ids:new Set(e),hash:e.join(",")})}[Symbol.iterator](){return y(this,Ai).entries()}}$x=new WeakMap,zx=new WeakMap,lf=new WeakMap,Ai=new WeakMap,fL=new WeakSet,Sbe=function(){y(this,$x)||($(this,$x,!0),typeof this.onSetModified=="function"&&this.onSetModified())};var FA;class Nbe extends k7{constructor(n){super();q(this,FA);const{map:r,hash:s,transfer:i}=n.serializable,o=structuredClone(r,i?{transfer:i}:null);$(this,FA,{map:o,hash:s,transfer:i})}get print(){Zn("Should not call PrintAnnotationStorage.print")}get serializable(){return y(this,FA)}get modifiedIds(){return Gt(this,"modifiedIds",{ids:new Set,hash:""})}}FA=new WeakMap;var S1;class gZe{constructor({ownerDocument:e=globalThis.document,styleElement:n=null}){q(this,S1,new Set);this._document=e,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(e){this.nativeFontFaces.add(e),this._document.fonts.add(e)}removeNativeFontFace(e){this.nativeFontFaces.delete(e),this._document.fonts.delete(e)}insertRule(e){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const n=this.styleElement.sheet;n.insertRule(e,n.cssRules.length)}clear(){for(const e of this.nativeFontFaces)this._document.fonts.delete(e);this.nativeFontFaces.clear(),y(this,S1).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:e,disableFontFace:n,_inspectFont:r}){if(!(!e||y(this,S1).has(e.loadedName))){if(un(!n,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:s,src:i,style:o}=e,l=new FontFace(s,i,o);this.addNativeFontFace(l);try{await l.load(),y(this,S1).add(s),r==null||r(e)}catch{Ut(`Cannot load system font: ${e.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(l)}return}Zn("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(e){if(e.attached||e.missingFile&&!e.systemFontInfo)return;if(e.attached=!0,e.systemFontInfo){await this.loadSystemFont(e);return}if(this.isFontLoadingAPISupported){const r=e.createNativeFontFace();if(r){this.addNativeFontFace(r);try{await r.loaded}catch(s){throw Ut(`Failed to load font '${r.family}': '${s}'.`),e.disableFontFace=!0,s}}return}const n=e.createFontFaceRule();if(n){if(this.insertRule(n),this.isSyncFontLoadingSupported)return;await new Promise(r=>{const s=this._queueLoadingCallback(r);this._prepareFontLoadEvent(e,s)})}}get isFontLoadingAPISupported(){var n;const e=!!((n=this._document)!=null&&n.fonts);return Gt(this,"isFontLoadingAPISupported",e)}get isSyncFontLoadingSupported(){return Gt(this,"isSyncFontLoadingSupported",Za||yi.platform.isFirefox)}_queueLoadingCallback(e){function n(){for(un(!s.done,"completeRequest() cannot be called twice."),s.done=!0;r.length>0&&r[0].done;){const i=r.shift();setTimeout(i.callback,0)}}const{loadingRequests:r}=this,s={done:!1,complete:n,callback:e};return r.push(s),s}get _loadTestFont(){const e=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return Gt(this,"_loadTestFont",e)}
900_prepareFontLoadEvent(e,n){function r(j,N){return j.charCodeAt(N)<<24|j.charCodeAt(N+1)<<16|j.charCodeAt(N+2)<<8|j.charCodeAt(N+3)&255}function s(j,N,S,C){const k=j.substring(0,N),E=j.substring(N+S);return k+C+E}let i,o;const l=this._document.createElement("canvas");l.width=1,l.height=1;const c=l.getContext("2d");let u=0;function d(j,N){if(++u>30){Ut("Load test font never loaded."),N();return}if(c.font="30px "+j,c.fillText(".",0,20),c.getImageData(0,0,1,1).data[3]>0){N();return}setTimeout(d.bind(null,j,N))}const h=`lt${Date.now()}${this.loadTestFontId++}`;let f=this._loadTestFont;f=s(f,976,h.length,h);const m=16,v=1482184792;let x=r(f,m);for(i=0,o=h.length-3;i<o;i+=4)x=x-v+r(h,i)|0;i<h.length&&(x=x-v+r(h+"XXX",i)|0),f=s(f,m,4,nZe(x));const g=`url(data:font/opentype;base64,${btoa(f)});`,w=`@font-face {font-family:"${h}";src:${g}}`;this.insertRule(w);const _=this._document.createElement("div");_.style.visibility="hidden",_.style.width=_.style.height="10px",_.style.position="absolute",_.style.top=_.style.left="0px";for(const j of[e.loadedName,h]){const N=this._document.createElement("span");N.textContent="Hi",N.style.fontFamily=j,_.append(N)}this._document.body.append(_),d(h,()=>{_.remove(),n.complete()})}}S1=new WeakMap;var zn;class vZe{constructor(e,n=null,r,s){q(this,zn);this.compiledGlyphs=Object.create(null),$(this,zn,e),this._inspectFont=n,r&&Object.assign(this,r),s&&(this.charProcOperatorList=s)}createNativeFontFace(){var n;if(!this.data||this.disableFontFace)return null;let e;if(!this.cssFontInfo)e=new FontFace(this.loadedName,this.data,{});else{const r={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(r.style=`oblique ${this.cssFontInfo.italicAngle}deg`),e=new FontFace(this.cssFontInfo.fontFamily,this.data,r)}return(n=this._inspectFont)==null||n.call(this,this),e}createFontFaceRule(){var r;if(!this.data||this.disableFontFace)return null;const e=`url(data:${this.mimetype};base64,${B0e(this.data)});`;let n;if(!this.cssFontInfo)n=`@font-face {font-family:"${this.loadedName}";src:${e}}`;else{let s=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(s+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),n=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${s}src:${e}}`}return(r=this._inspectFont)==null||r.call(this,this,e),n}getPathGenerator(e,n){if(this.compiledGlyphs[n]!==void 0)return this.compiledGlyphs[n];const r=this.loadedName+"_path_"+n;let s;try{s=e.get(r)}catch(o){Ut(`getPathGenerator - ignoring character: "${o}".`)}const i=new Path2D(s||"");return this.fontExtraProperties||e.delete(r),this.compiledGlyphs[n]=i}get black(){return y(this,zn).black}get bold(){return y(this,zn).bold}get disableFontFace(){return y(this,zn).disableFontFace??!1}get fontExtraProperties(){return y(this,zn).fontExtraProperties??!1}get isInvalidPDFjsFont(){return y(this,zn).isInvalidPDFjsFont}get isType3Font(){return y(this,zn).isType3Font}get italic(){return y(this,zn).italic}get missingFile(){return y(this,zn).missingFile}get remeasure(){return y(this,zn).remeasure}get vertical(){return y(this,zn).vertical}get ascent(){return y(this,zn).ascent}get defaultWidth(){return y(this,zn).defaultWidth}get descent(){return y(this,zn).descent}get bbox(){return y(this,zn).bbox}get fontMatrix(){return y(this,zn).fontMatrix}get fallbackName(){return y(this,zn).fallbackName}get loadedName(){return y(this,zn).loadedName}get mimetype(){return y(this,zn).mimetype}get name(){return y(this,zn).name}get data(){return y(this,zn).data}clearData(){y(this,zn).clearData()}get cssFontInfo(){return y(this,zn).cssFontInfo}get systemFontInfo(){return y(this,zn).systemFontInfo}get defaultVMetrics(){return y(this,zn).defaultVMetrics}}zn=new WeakMap;function xZe(t){if(t instanceof URL)return t.href;if(typeof t=="string"){if(Za)return t;const e=URL.parse(t,window.location);if(e)return e.href}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function yZe(t){if(Za&&typeof Buffer<"u"&&t instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength)return t;if(typeof t=="string")return S2(t);if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)||typeof t=="object"&&!isNaN(t==null?void 0:t.length))return new Uint8Array(t);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}function dP(t){if(typeof t!="string")return null;if(t.endsWith("/"))return t;throw new Error(`Invalid factory url: "${t}" must include trailing slash.`)}const iU=t=>typeof t=="object"&&Number.isInteger(t==null?void 0:t.num)&&t.num>=0&&Number.isInteger(t==null?void 0:t.gen)&&t.gen>=0,bZe=t=>
900typeof t=="object"&&typeof(t==null?void 0:t.name)=="string",Cbe=aZe.bind(null,iU,bZe);var cf,pL;class wZe{constructor(){q(this,cf,new Map);q(this,pL,Promise.resolve())}postMessage(e,n){const r={data:structuredClone(e,n?{transfer:n}:null)};y(this,pL).then(()=>{for(const[s]of y(this,cf))s.call(this,r)})}addEventListener(e,n,r=null){let s=null;if((r==null?void 0:r.signal)instanceof AbortSignal){const{signal:i}=r;if(i.aborted){Ut("LoopbackPort - cannot use an `aborted` signal.");return}const o=()=>this.removeEventListener(e,n);s=()=>i.removeEventListener("abort",o),i.addEventListener("abort",o)}y(this,cf).set(n,s)}removeEventListener(e,n){const r=y(this,cf).get(n);r==null||r(),y(this,cf).delete(n)}terminate(){for(const[,e]of y(this,cf))e==null||e();y(this,cf).clear()}}cf=new WeakMap,pL=new WeakMap;const hP={DATA:1,ERROR:2},bs={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function kte(){}function So(t){if(t instanceof ep||t instanceof nI||t instanceof yte||t instanceof Sk||t instanceof C5)return t;switch(t instanceof Error||typeof t=="object"&&t!==null||Zn('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),t.name){case"AbortException":return new ep(t.message);case"InvalidPDFException":return new nI(t.message);case"PasswordException":return new yte(t.message,t.code);case"ResponseException":return new Sk(t.message,t.status,t.missing);case"UnknownErrorException":return new C5(t.message,t.details)}return new C5(t.message,t.toString())}var N1,Pc,kbe,Abe,Ebe,JM;class gN{constructor(e,n,r){q(this,Pc);q(this,N1,new AbortController);this.sourceName=e,this.targetName=n,this.comObj=r,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),r.addEventListener("message",V(this,Pc,kbe).bind(this),{signal:y(this,N1).signal})}on(e,n){const r=this.actionHandler;if(r[e])throw new Error(`There is already an actionName called "${e}"`);r[e]=n}send(e,n,r){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:n},r)}sendWithPromise(e,n,r){const s=this.callbackId++,i=Promise.withResolvers();this.callbackCapabilities[s]=i;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:s,data:n},r)}catch(o){i.reject(o)}return i.promise}sendWithStream(e,n,r,s){const i=this.streamId++,o=this.sourceName,l=this.targetName,c=this.comObj;return new ReadableStream({start:u=>{const d=Promise.withResolvers();return this.streamControllers[i]={controller:u,startCall:d,pullCall:null,cancelCall:null,isClosed:!1},c.postMessage({sourceName:o,targetName:l,action:e,streamId:i,data:n,desiredSize:u.desiredSize},s),d.promise},pull:u=>{const d=Promise.withResolvers();return this.streamControllers[i].pullCall=d,c.postMessage({sourceName:o,targetName:l,stream:bs.PULL,streamId:i,desiredSize:u.desiredSize}),d.promise},cancel:u=>{un(u instanceof Error,"cancel must have a valid reason");const d=Promise.withResolvers();return this.streamControllers[i].cancelCall=d,this.streamControllers[i].isClosed=!0,c.postMessage({sourceName:o,targetName:l,stream:bs.CANCEL,streamId:i,reason:So(u)}),d.promise}},r)}destroy(){var e;(e=y(this,N1))==null||e.abort(),$(this,N1,null)}}N1=new WeakMap,Pc=new WeakSet,kbe=function({data:e}){if(e.targetName!==this.sourceName)return;if(e.stream){V(this,Pc,Ebe).call(this,e);return}if(e.callback){const r=e.callbackId,s=this.callbackCapabilities[r];if(!s)throw new Error(`Cannot resolve callback ${r}`);if(delete this.callbackCapabilities[r],e.callback===hP.DATA)s.resolve(e.data);else if(e.callback===hP.ERROR)s.reject(So(e.reason));else throw new Error("Unexpected callback case");return}const n=this.actionHandler[e.action];if(!n)throw new Error(`Unknown action from worker: ${e.action}`);if(e.callbackId){const r=this.sourceName,s=e.sourceName,i=this.comObj;Promise.try(n,e.data).then(function(o){i.postMessage({sourceName:r,targetName:s,callback:hP.DATA,callbackId:e.callbackId,data:o})},function(o){i.postMessage({sourceName:r,targetName:s,callback:hP.E
900RROR,callbackId:e.callbackId,reason:So(o)})});return}if(e.streamId){V(this,Pc,Abe).call(this,e);return}n(e.data)},Abe=function(e){const n=e.streamId,r=this.sourceName,s=e.sourceName,i=this.comObj,o=this,l=this.actionHandler[e.action],c={enqueue(u,d=1,h){if(this.isCancelled)return;const f=this.desiredSize;this.desiredSize-=d,f>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),i.postMessage({sourceName:r,targetName:s,stream:bs.ENQUEUE,streamId:n,chunk:u},h)},close(){this.isCancelled||(this.isCancelled=!0,i.postMessage({sourceName:r,targetName:s,stream:bs.CLOSE,streamId:n}),delete o.streamSinks[n])},error(u){un(u instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,i.postMessage({sourceName:r,targetName:s,stream:bs.ERROR,streamId:n,reason:So(u)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};c.sinkCapability.resolve(),c.ready=c.sinkCapability.promise,this.streamSinks[n]=c,Promise.try(l,e.data,c).then(function(){i.postMessage({sourceName:r,targetName:s,stream:bs.START_COMPLETE,streamId:n,success:!0})},function(u){i.postMessage({sourceName:r,targetName:s,stream:bs.START_COMPLETE,streamId:n,reason:So(u)})})},Ebe=function(e){const n=e.streamId,r=this.sourceName,s=e.sourceName,i=this.comObj,o=this.streamControllers[n],l=this.streamSinks[n];switch(e.stream){case bs.START_COMPLETE:e.success?o.startCall.resolve():o.startCall.reject(So(e.reason));break;case bs.PULL_COMPLETE:e.success?o.pullCall.resolve():o.pullCall.reject(So(e.reason));break;case bs.PULL:if(!l){i.postMessage({sourceName:r,targetName:s,stream:bs.PULL_COMPLETE,streamId:n,success:!0});break}l.desiredSize<=0&&e.desiredSize>0&&l.sinkCapability.resolve(),l.desiredSize=e.desiredSize,Promise.try(l.onPull||kte).then(function(){i.postMessage({sourceName:r,targetName:s,stream:bs.PULL_COMPLETE,streamId:n,success:!0})},function(u){i.postMessage({sourceName:r,targetName:s,stream:bs.PULL_COMPLETE,streamId:n,reason:So(u)})});break;case bs.ENQUEUE:if(un(o,"enqueue should have stream controller"),o.isClosed)break;o.controller.enqueue(e.chunk);break;case bs.CLOSE:if(un(o,"close should have stream controller"),o.isClosed)break;o.isClosed=!0,o.controller.close(),V(this,Pc,JM).call(this,o,n);break;case bs.ERROR:un(o,"error should have stream controller"),o.controller.error(So(e.reason)),V(this,Pc,JM).call(this,o,n);break;case bs.CANCEL_COMPLETE:e.success?o.cancelCall.resolve():o.cancelCall.reject(So(e.reason)),V(this,Pc,JM).call(this,o,n);break;case bs.CANCEL:if(!l)break;const c=So(e.reason);Promise.try(l.onCancel||kte,c).then(function(){i.postMessage({sourceName:r,targetName:s,stream:bs.CANCEL_COMPLETE,streamId:n,success:!0})},function(u){i.postMessage({sourceName:r,targetName:s,stream:bs.CANCEL_COMPLETE,streamId:n,reason:So(u)})}),l.sinkCapability.reject(c),l.isCancelled=!0,delete this.streamSinks[n];break;default:throw new Error("Unexpected stream case")}},JM=async function(e,n){var r,s,i;await Promise.allSettled([(r=e.startCall)==null?void 0:r.promise,(s=e.pullCall)==null?void 0:s.promise,(i=e.cancelCall)==null?void 0:i.promise]),delete this.streamControllers[n]};var $A;class Tbe{constructor({enableHWA:e=!1}){q(this,$A,!1);$(this,$A,e)}create(e,n){if(e<=0||n<=0)throw new Error("Invalid canvas size");const r=this._createCanvas(e,n);return{canvas:r,context:r.getContext("2d",{willReadFrequently:!y(this,$A)})}}reset(e,n,r){if(!e.canvas)throw new Error("Canvas is not specified");if(n<=0||r<=0)throw new Error("Invalid canvas size");e.canvas.width=n,e.canvas.height=r}destroy(e){if(!e.canvas)throw new Error("Canvas is not specified");e.canvas.width=0,e.canvas.height=0,e.canvas=null,e.context=null}_createCanvas(e,n){Zn("Abstract method `_createCanvas` called.")}}$A=new WeakMap;class _Ze extends Tbe{constructor({ownerDocument:e=globalThis.document,enableHWA:n=!1}){super({enableHWA:n}),this._document=e}_createCanvas(e,n){const r=this._document.createElement("canvas");return r.width=e,r.height=n,r}}class Pbe{constructor({baseUrl:e=null,isCompressed:n=!0}){this.baseUrl=e,this.isCompressed=n}async fetch({name:e}){if(!this.baseUrl)throw new Error("Ensure that the `cMapUrl` and `cMapPacked` API parameters are provided.");if(!e)throw new Error("CMap name must be specified.");const n=this.baseUrl+e+(this.isCompressed?".bcmap":"");return this._fetch(n).then(r=>({cMapData:r,isCompressed:this.isCompressed})).catch(r=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${n}`)})}async _fetch(e){Zn("Abstract method `_fetch` called.")}}class Ate extends Pbe{async _fetch(e){const n=await Bj(e,this.isCompressed?"arraybuffer":"text");return n instanceof ArrayBuffer?new Uint8Array(n):S2(n)}}class Mbe{addFilter(e){return"none"}addHCMFilter(e,n){return"none"}addAlphaFilter(e){return"none"}addLuminosityFilter(e){return"none"}addHighlightHCMFilter(e,n,r,s,i){return"none"}destroy(e=!1){}}var Bx,C1,uf,df,da,Ux,qx,tt,ia,vN,Mb,QM,Rb,Rbe,aU,Ob,xN,yN,oU,bN;
900class jZe extends Mbe{constructor({docId:n,ownerDocument:r=globalThis.document}){super();q(this,tt);q(this,Bx);q(this,C1);q(this,uf);q(this,df);q(this,da);q(this,Ux);q(this,qx,0);$(this,df,n),$(this,da,r)}addFilter(n){if(!n)return"none";let r=y(this,tt,ia).get(n);if(r)return r;const[s,i,o]=V(this,tt,QM).call(this,n),l=n.length===1?s:`${s}${i}${o}`;if(r=y(this,tt,ia).get(l),r)return y(this,tt,ia).set(n,r),r;const c=`g_${y(this,df)}_transfer_map_${Vr(this,qx)._++}`,u=V(this,tt,Rb).call(this,c);y(this,tt,ia).set(n,u),y(this,tt,ia).set(l,u);const d=V(this,tt,Ob).call(this,c);return V(this,tt,yN).call(this,s,i,o,d),u}addHCMFilter(n,r){var m;const s=`${n}-${r}`,i="base";let o=y(this,tt,vN).get(i);if((o==null?void 0:o.key)===s||(o?((m=o.filter)==null||m.remove(),o.key=s,o.url="none",o.filter=null):(o={key:s,url:"none",filter:null},y(this,tt,vN).set(i,o)),!n||!r))return o.url;const l=V(this,tt,bN).call(this,n);n=ot.makeHexColor(...l);const c=V(this,tt,bN).call(this,r);if(r=ot.makeHexColor(...c),y(this,tt,Mb).style.color="",n==="#000000"&&r==="#ffffff"||n===r)return o.url;const u=new Array(256);for(let v=0;v<=255;v++){const x=v/255;u[v]=x<=.03928?x/12.92:((x+.055)/1.055)**2.4}const d=u.join(","),h=`g_${y(this,df)}_hcm_filter`,f=o.filter=V(this,tt,Ob).call(this,h);V(this,tt,yN).call(this,d,d,d,f),V(this,tt,aU).call(this,f);const p=(v,x)=>{const g=l[v]/255,w=c[v]/255,_=new Array(x+1);for(let j=0;j<=x;j++)_[j]=g+j/x*(w-g);return _.join(",")};return V(this,tt,yN).call(this,p(0,5),p(1,5),p(2,5),f),o.url=V(this,tt,Rb).call(this,h),o.url}addAlphaFilter(n){let r=y(this,tt,ia).get(n);if(r)return r;const[s]=V(this,tt,QM).call(this,[n]),i=`alpha_${s}`;if(r=y(this,tt,ia).get(i),r)return y(this,tt,ia).set(n,r),r;const o=`g_${y(this,df)}_alpha_map_${Vr(this,qx)._++}`,l=V(this,tt,Rb).call(this,o);y(this,tt,ia).set(n,l),y(this,tt,ia).set(i,l);const c=V(this,tt,Ob).call(this,o);return V(this,tt,oU).call(this,s,c),l}addLuminosityFilter(n){let r=y(this,tt,ia).get(n||"luminosity");if(r)return r;let s,i;if(n?([s]=V(this,tt,QM).call(this,[n]),i=`luminosity_${s}`):i="luminosity",r=y(this,tt,ia).get(i),r)return y(this,tt,ia).set(n,r),r;const o=`g_${y(this,df)}_luminosity_map_${Vr(this,qx)._++}`,l=V(this,tt,Rb).call(this,o);y(this,tt,ia).set(n,l),y(this,tt,ia).set(i,l);const c=V(this,tt,Ob).call(this,o);return V(this,tt,Rbe).call(this,c),n&&V(this,tt,oU).call(this,s,c),l}addHighlightHCMFilter(n,r,s,i,o){var w;const l=`${r}-${s}-${i}-${o}`;let c=y(this,tt,vN).get(n);if((c==null?void 0:c.key)===l||(c?((w=c.filter)==null||w.remove(),c.key=l,c.url="none",c.filter=null):(c={key:l,url:"none",filter:null},y(this,tt,vN).set(n,c)),!r||!s))return c.url;const[u,d]=[r,s].map(V(this,tt,bN).bind(this));let h=Math.round(.2126*u[0]+.7152*u[1]+.0722*u[2]),f=Math.round(.2126*d[0]+.7152*d[1]+.0722*d[2]),[p,m]=[i,o].map(V(this,tt,bN).bind(this));f<h&&([h,f,p,m]=[f,h,m,p]),y(this,tt,Mb).style.color="";const v=(_,j,N)=>{const S=new Array(256),C=(f-h)/N,k=_/255,E=(j-_)/(255*N);let P=0;for(let T=0;T<=N;T++){const M=Math.round(h+T*C),R=k+T*E;for(let A=P;A<=M;A++)S[A]=R;P=M+1}for(let T=P;T<256;T++)S[T]=S[P-1];return S.join(",")},x=`g_${y(this,df)}_hcm_${n}_filter`,g=c.filter=V(this,tt,Ob).call(this,x);return V(this,tt,aU).call(this,g),V(this,tt,yN).call(this,v(p[0],m[0],5),v(p[1],m[1],5),v(p[2],m[2],5),g),c.url=V(this,tt,Rb).call(this,x),c.url}destroy(n=!1){var r,s,i,o;n&&((r=y(this,Ux))!=null&&r.size)||((s=y(this,uf))==null||s.parentNode.parentNode.remove(),$(this,uf,null),(i=y(this,C1))==null||i.clear(),$(this,C1,null),(o=y(this,Ux))==null||o.clear(),$(this,Ux,null),$(this,qx,0))}}Bx=new WeakMap,C1=new WeakMap,uf=new WeakMap,df=new WeakMap,da=new WeakMap,Ux=new WeakMap,qx=new WeakMap,tt=new WeakSet,ia=function(){return y(this,C1)||$(this,C1,new Map)},vN=function(){return y(this,Ux)||$(this,Ux,new Map)},Mb=function(){if(!y(this,uf)){const n=y(this,da).createElement("div"),{style:r}=n;r.visibility="hidden",r.contain="strict",r.width=r.height=0,r.position="absolute",r.top=r.left=0,r.zIndex=-1;const s=y(this,da).createElementNS(Dh,"svg");s.setAttribute("width",0),s.setAttribute("height",0),$(this,uf,y(this,da).createElementNS(Dh,"defs")),n.append(s),s.append(y(this,uf)),y(this,da).body.append(n)}return y(this,uf)},QM=function(n){if(n.length===1){const u=n[0],d=new Array(256);for(let f=0;f<256;f++)d[f]=u[f]/255;const h=d.join(",");return[h,h,h]}const[r,s,i]=n,o=new Array(256),l=new Array(256),c=new Array(256);for(let u=0;u<256;u++)o[u]=r[u]/255,l[u]=s[u]/255,c[u]=i[u]/255;return[o.join(","),l.join(","),c.join(",")]},Rb=function(n){if(y(this,Bx)===void 0){$(this,Bx,"");const r=y(this,da).URL;r!==y(this,da).baseURI&&(C2(r)?Ut('#createUrl: ignore "data:"-URL for performance reasons.'):$(this,Bx,_7(r,"")))}return`url(${y(this,Bx)}#${n})`}
900,Rbe=function(n){const r=y(this,da).createElementNS(Dh,"feColorMatrix");r.setAttribute("type","matrix"),r.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"),n.append(r)},aU=function(n){const r=y(this,da).createElementNS(Dh,"feColorMatrix");r.setAttribute("type","matrix"),r.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"),n.append(r)},Ob=function(n){const r=y(this,da).createElementNS(Dh,"filter");return r.setAttribute("color-interpolation-filters","sRGB"),r.setAttribute("id",n),y(this,tt,Mb).append(r),r},xN=function(n,r,s){const i=y(this,da).createElementNS(Dh,r);i.setAttribute("type","discrete"),i.setAttribute("tableValues",s),n.append(i)},yN=function(n,r,s,i){const o=y(this,da).createElementNS(Dh,"feComponentTransfer");i.append(o),V(this,tt,xN).call(this,o,"feFuncR",n),V(this,tt,xN).call(this,o,"feFuncG",r),V(this,tt,xN).call(this,o,"feFuncB",s)},oU=function(n,r){const s=y(this,da).createElementNS(Dh,"feComponentTransfer");r.append(s),V(this,tt,xN).call(this,s,"feFuncA",n)},bN=function(n){return y(this,tt,Mb).style.color=n,Uj(getComputedStyle(y(this,tt,Mb)).getPropertyValue("color"))};class Obe{constructor({baseUrl:e=null}){this.baseUrl=e}async fetch({filename:e}){if(!this.baseUrl)throw new Error("Ensure that the `standardFontDataUrl` API parameter is provided.");if(!e)throw new Error("Font filename must be specified.");const n=`${this.baseUrl}${e}`;return this._fetch(n).catch(r=>{throw new Error(`Unable to load font data at: ${n}`)})}async _fetch(e){Zn("Abstract method `_fetch` called.")}}class Ete extends Obe{async _fetch(e){const n=await Bj(e,"arraybuffer");return new Uint8Array(n)}}class Ibe{constructor({baseUrl:e=null}){this.baseUrl=e}async fetch({filename:e}){if(!this.baseUrl)throw new Error("Ensure that the `wasmUrl` API parameter is provided.");if(!e)throw new Error("Wasm filename must be specified.");const n=`${this.baseUrl}${e}`;return this._fetch(n).catch(r=>{throw new Error(`Unable to load wasm data at: ${n}`)})}async _fetch(e){Zn("Abstract method `_fetch` called.")}}class Tte extends Ibe{async _fetch(e){const n=await Bj(e,"arraybuffer");return new Uint8Array(n)}}Za&&Ut("Please use the `legacy` build in Node.js environments.");async function A7(t){const n=await process.getBuiltinModule("fs").promises.readFile(t);return new Uint8Array(n)}class SZe extends Mbe{}class NZe extends Tbe{_createCanvas(e,n){return process.getBuiltinModule("module").createRequire(import.meta.url)("@napi-rs/canvas").createCanvas(e,n)}}class CZe extends Pbe{async _fetch(e){return A7(e)}}class kZe extends Obe{async _fetch(e){return A7(e)}}class AZe extends Ibe{async _fetch(e){return A7(e)}}const ub="__forcedDependency",{floor:Pte,ceil:Mte}=Math;function fP(t,e,n,r,s,i){t[e*4+0]=Math.min(t[e*4+0],n),t[e*4+1]=Math.min(t[e*4+1],r),t[e*4+2]=Math.max(t[e*4+2],s),t[e*4+3]=Math.max(t[e*4+3],i)}const lU=new Uint32Array(new Uint8Array([255,255,0,0]).buffer)[0];var k1,Mm;class EZe{constructor(e,n){q(this,k1);q(this,Mm);
900$(this,k1,e),$(this,Mm,n)}get length(){return y(this,k1).length}isEmpty(e){return y(this,k1)[e]===lU}minX(e){return y(this,Mm)[e*4+0]/256}minY(e){return y(this,Mm)[e*4+1]/256}maxX(e){return(y(this,Mm)[e*4+2]+1)/256}maxY(e){return(y(this,Mm)[e*4+3]+1)/256}}k1=new WeakMap,Mm=new WeakMap;const pP=(t,e)=>{if(!t)return;let n=t.get(e);return n||(n={dependencies:new Set,isRenderingOperation:!1},t.set(e,n)),n};var To,Po,Vx,lu,Hx,hf,In,Bn,ff,Mo,zA,A1,Wx,Kx,pf,ha,jd,BA,cU;class TZe{constructor(e,n,r=!1){q(this,BA);q(this,To,{__proto__:null});q(this,Po,{__proto__:null,transform:[],moveText:[],sameLineText:[],[ub]:[]});q(this,Vx,new Map);q(this,lu,[]);q(this,Hx,[]);q(this,hf,[[1,0,0,1,0,0]]);q(this,In,[-1/0,-1/0,1/0,1/0]);q(this,Bn,new Float64Array([1/0,1/0,-1/0,-1/0]));q(this,ff,-1);q(this,Mo,new Set);q(this,zA,new Map);q(this,A1,new Map);q(this,Wx);q(this,Kx);q(this,pf);q(this,ha);q(this,jd);$(this,Wx,e.width),$(this,Kx,e.height),V(this,BA,cU).call(this,n),r&&$(this,jd,new Map)}growOperationsCount(e){e>=y(this,ha).length&&V(this,BA,cU).call(this,e,y(this,ha))}save(e){return $(this,To,{__proto__:y(this,To)}),$(this,Po,{__proto__:y(this,Po),transform:{__proto__:y(this,Po).transform},moveText:{__proto__:y(this,Po).moveText},sameLineText:{__proto__:y(this,Po).sameLineText},[ub]:{__proto__:y(this,Po)[ub]}}),$(this,In,{__proto__:y(this,In)}),y(this,lu).push(e),this}restore(e){var s;const n=Object.getPrototypeOf(y(this,To));if(n===null)return this;$(this,To,n),$(this,Po,Object.getPrototypeOf(y(this,Po))),$(this,In,Object.getPrototypeOf(y(this,In)));const r=y(this,lu).pop();return r!==void 0&&((s=pP(y(this,jd),e))==null||s.dependencies.add(r),y(this,ha)[e]=y(this,ha)[r]),this}recordOpenMarker(e){return y(this,lu).push(e),this}getOpenMarker(){return y(this,lu).length===0?null:y(this,lu).at(-1)}recordCloseMarker(e){var r;const n=y(this,lu).pop();return n!==void 0&&((r=pP(y(this,jd),e))==null||r.dependencies.add(n),y(this,ha)[e]=y(this,ha)[n]),this}beginMarkedContent(e){return y(this,Hx).push(e),this}endMarkedContent(e){var r;const n=y(this,Hx).pop();return n!==void 0&&((r=pP(y(this,jd),e))==null||r.dependencies.add(n),y(this,ha)[e]=y(this,ha)[n]),this}pushBaseTransform(e){return y(this,hf).push(ot.multiplyByDOMMatrix(y(this,hf).at(-1),e.getTransform())),this}popBaseTransform(){return y(this,hf).length>1&&y(this,hf).pop(),this}recordSimpleData(e,n){return y(this,To)[e]=n,this}recordIncrementalData(e,n){return y(this,Po)[e].push(n),this}resetIncrementalData(e,n){return y(this,Po)[e].length=0,this}recordNamedData(e,n){return y(this,Vx).set(e,n),this}recordSimpleDataFromNamed(e,n,r){y(this,To)[e]=y(this,Vx).get(n)??r}recordFutureForcedDependency(e,n){return this.recordIncrementalData(ub,n),this}inheritSimpleDataAsFutureForcedDependencies(e){for(const n of e)n in y(this,To)&&this.recordFutureForcedDependency(n,y(this,To)[n]);return this}inheritPendingDependenciesAsFutureForcedDependencies(){for(const e of y(this,Mo))this.recordFutureForcedDependency(ub,e);return this}resetBBox(e){return y(this,ff)!==e&&($(this,ff,e),y(this,Bn)[0]=1/0,y(this,Bn)[1]=1/0,y(this,Bn)[2]=-1/0,y(this,Bn)[3]=-1/0),this}recordClipBox(e,n,r,s,i,o){const l=ot.multiplyByDOMMatrix(y(this,hf).at(-1),n.getTransform()),c=[1/0,1/0,-1/0,-1/0];ot.axialAlignedBoundingBox([r,i,s,o],l,c);const u=ot.intersect(y(this,In),c);return u?(y(this,In)[0]=u[0],y(this,In)[1]=u[1],y(this,In)[2]=u[2],y(this,In)[3]=u[3]):(y(this,In)[0]=y(this,In)[1]=1/0,y(this,In)[2]=y(this,In)[3]=-1/0),this}recordBBox(e,n,r,s,i,o){const l=y(this,In);if(l[0]===1/0)return this;const c=ot.multiplyByDOMMatrix(y(this,hf).at(-1),n.getTransform());if(l[0]===-1/0)return ot.axialAlignedBoundingBox([r,i,s,o],c,y(this,Bn)),this;const u=[1/0,1/0,-1/0,-1/0];return ot.axialAlignedBoundingBox([r,i,s,o],c,u),y(this,Bn)[0]=Math.min(y(this,Bn)[0],Math.max(u[0],l[0])),y(this,Bn)[1]=Math.min(y(this,Bn)[1],Math.max(u[1],l[1])),y(this,Bn)[2]=Math.max(y(this,Bn)[2],Math.min(u[2],l[2])),y(this,Bn)[3]=Math.max(y(this,Bn)[3],Math.min(u[3],l[3])),this}recordCharacterBBox(e,n,r,s=1,i=0,o=0,l){const c=r.bbox;let u,d;if(c&&(u=c[2]!==c[0]&&c[3]!==c[1]&&y(this,A1).get(r),u!==!1&&(d=[0,0,0,0],ot.axialAlignedBoundingBox(c,r.fontMatrix,d),(s!==1||i!==0||o!==0)&&ot.scaleMinMax([s,0,0,-s,i,o],d),u)))return this.recordBBox(e,n,d[0],d[2],d[1],d[3]);if(!l)return this.recordFullPageBBox(e);const h=l();return c&&d&&u===void 0&&(u=d[0]<=i-h.actualBoundingBoxLeft&&d[2]>=i+h.actualBoundingBoxRight&&d[1]<=o-h.actualBoundingBoxAscent&&d[3]>=o+h.actualBoundingBoxDescent,y(this,A1).set(r,u),u)?this.recordBBox(e,n,d[0],d[2],d[1],d[3]):this.recordBBox(e,n,i-h.actualBoundingBoxLeft,i+h.actualBoundingBoxRight,o-h.actualBoundingBoxAscent,o+h.actualBoundingBoxDescent)}recordFullPageBBox(e){return y(this,Bn)[0]=Math.max(0,y(this,In)[0]),y(this,Bn)[1]=Math.max(0,y(this,In)[1]),y(this,Bn)[2]=Math.min(y(this,Wx),y(this,In)[2]),y(this,Bn)[3]=Math.min(y(this,Kx),y(this,In)[3]),this}getSimpleIndex(e){return y(this,To)[e]}recordDependencies(e,n){const r=y(this,Mo),s=y(this,To),i=y(this,Po);for(const o of n)o in y(this,To)?r.add(s[o]):o in i&&i[o].forEac
900h(r.add,r);return this}recordNamedDependency(e,n){return y(this,Vx).has(n)&&y(this,Mo).add(y(this,Vx).get(n)),this}recordOperation(e,n=!1){if(this.recordDependencies(e,[ub]),y(this,jd)){const r=pP(y(this,jd),e),{dependencies:s}=r;y(this,Mo).forEach(s.add,s),y(this,lu).forEach(s.add,s),y(this,Hx).forEach(s.add,s),s.delete(e),r.isRenderingOperation=!0}if(y(this,ff)===e){const r=Pte(y(this,Bn)[0]*256/y(this,Wx)),s=Pte(y(this,Bn)[1]*256/y(this,Kx)),i=Mte(y(this,Bn)[2]*256/y(this,Wx)),o=Mte(y(this,Bn)[3]*256/y(this,Kx));fP(y(this,pf),e,r,s,i,o);for(const l of y(this,Mo))l!==e&&fP(y(this,pf),l,r,s,i,o);for(const l of y(this,lu))l!==e&&fP(y(this,pf),l,r,s,i,o);for(const l of y(this,Hx))l!==e&&fP(y(this,pf),l,r,s,i,o);n||(y(this,Mo).clear(),$(this,ff,-1))}return this}recordShowTextOperation(e,n=!1){const r=Array.from(y(this,Mo));this.recordOperation(e,n),this.recordIncrementalData("sameLineText",e);for(const s of r)this.recordIncrementalData("sameLineText",s);return this}bboxToClipBoxDropOperation(e,n=!1){return y(this,ff)===e&&($(this,ff,-1),y(this,In)[0]=Math.max(y(this,In)[0],y(this,Bn)[0]),y(this,In)[1]=Math.max(y(this,In)[1],y(this,Bn)[1]),y(this,In)[2]=Math.min(y(this,In)[2],y(this,Bn)[2]),y(this,In)[3]=Math.min(y(this,In)[3],y(this,Bn)[3]),n||y(this,Mo).clear()),this}_takePendingDependencies(){const e=y(this,Mo);return $(this,Mo,new Set),e}_extractOperation(e){const n=y(this,zA).get(e);return y(this,zA).delete(e),n}_pushPendingDependencies(e){for(const n of e)y(this,Mo).add(n)}take(){return y(this,A1).clear(),new EZe(y(this,ha),y(this,pf))}takeDebugMetadata(){return y(this,jd)}}To=new WeakMap,Po=new WeakMap,Vx=new WeakMap,lu=new WeakMap,Hx=new WeakMap,hf=new WeakMap,In=new WeakMap,Bn=new WeakMap,ff=new WeakMap,Mo=new WeakMap,zA=new WeakMap,A1=new WeakMap,Wx=new WeakMap,Kx=new WeakMap,pf=new WeakMap,ha=new WeakMap,jd=new WeakMap,BA=new WeakSet,cU=function(e,n){const r=new ArrayBuffer(e*4);$(this,pf,new Uint8ClampedArray(r)),$(this,ha,new Uint32Array(r)),n&&n.length>0?(y(this,ha).set(n),y(this,ha).fill(lU,n.length)):y(this,ha).fill(lU)};var Yn,Gr,cu,E1,T1;const eX=class eX{constructor(e,n,r){q(this,Yn);q(this,Gr);q(this,cu);q(this,E1,0);q(this,T1,0);if(e instanceof eX&&y(e,cu)===!!r)return e;$(this,Yn,e),$(this,Gr,n),$(this,cu,!!r)}growOperationsCount(){throw new Error("Unreachable")}save(e){return Vr(this,T1)._++,y(this,Yn).save(y(this,Gr)),this}restore(e){return y(this,T1)>0&&(y(this,Yn).restore(y(this,Gr)),Vr(this,T1)._--),this}recordOpenMarker(e){return Vr(this,E1)._++,this}getOpenMarker(){return y(this,E1)>0?y(this,Gr):y(this,Yn).getOpenMarker()}recordCloseMarker(e){return Vr(this,E1)._--,this}beginMarkedContent(e){return this}endMarkedContent(e){return this}pushBaseTransform(e){return y(this,Yn).pushBaseTransform(e),this}popBaseTransform(){return y(this,Yn).popBaseTransform(),this}recordSimpleData(e,n){return y(this,Yn).recordSimpleData(e,y(this,Gr)),this}recordIncrementalData(e,n){return y(this,Yn).recordIncrementalData(e,y(this,Gr)),this}resetIncrementalData(e,n){return y(this,Yn).resetIncrementalData(e,y(this,Gr)),this}recordNamedData(e,n){return this}recordSimpleDataFromNamed(e,n,r){return y(this,Yn).recordSimpleDataFromNamed(e,n,y(this,Gr)),this}recordFutureForcedDependency(e,n){return y(this,Yn).recordFutureForcedDependency(e,y(this,Gr)),this}inheritSimpleDataAsFutureForcedDependencies(e){return y(this,Yn).inheritSimpleDataAsFutureForcedDependencies(e),this}inheritPendingDependenciesAsFutureForcedDependencies(){return y(this,Yn).inheritPendingDependenciesAsFutureForcedDependencies(),this}resetBBox(e){return y(this,cu)||y(this,Yn).resetBBox(y(this,Gr)),this}recordClipBox(e,n,r,s,i,o){return y(this,cu)||y(this,Yn).recordClipBox(y(this,Gr),n,r,s,i,o),this}recordBBox(e,n,r,s,i,o){return y(this,cu)||y(this,Yn).recordBBox(y(this,Gr),n,r,s,i,o),this}recordCharacterBBox(e,n,r,s,i,o,l){return y(this,cu)||y(this,Yn).recordCharacterBBox(y(this,Gr),n,r,s,i,o,l),this}recordFullPageBBox(e){return y(this,cu)||y(this,Yn).recordFullPageBBox(y(this,Gr)),this}getSimpleIndex(e){return y(this,Yn).getSimpleIndex(e)}recordDependencies(e,n){return y(this,Yn).recordDependencies(y(this,Gr),n),this}recordNamedDependency(e,n){return y(this,Yn).recordNamedDependency(y(this,Gr),n),this}recordOperation(e){return y(this,Yn).recordOperation(y(this,Gr),!0),this}recordShowTextOperation(e){return y(this,Yn).recordShowTextOperation(y(this,Gr),!0),this}bboxToClipBoxDropOperation(e){return y(this,cu)||y(this,Yn).bboxToClipBoxDropOperation(y(this,Gr),!0),this}take(){throw new Error("Unreachable")}takeDebugMetadata(){throw new Error("Unreachable")}};Yn=new WeakMap,Gr=new WeakMap,cu=new WeakMap,E1=new WeakMap,T1=new WeakMap;let iI=eX;const Kl={stroke:["path","transform","filter","strokeColor","strokeAlpha","lineWidth","lineCap","lineJoin","miterLimit","dash"],fill:["path","transform","filter","fillColor","fillAlpha","globalCompositeOperation","SMask"],imageXObject:["transform","SMask","filter","fillAlpha","strokeAlpha","globalCompositeOperation"],rawFillPath:["f
900ilter","fillColor","fillAlpha"],showText:["transform","leading","charSpacing","wordSpacing","hScale","textRise","moveText","textMatrix","font","fontObj","filter","fillColor","textRenderingMode","SMask","fillAlpha","strokeAlpha","globalCompositeOperation","sameLineText"],transform:["transform"],transformAndFill:["transform","fillColor"]},Di={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function uU(t,e){if(!e)return;const n=e[2]-e[0],r=e[3]-e[1],s=new Path2D;s.rect(e[0],e[1],n,r),t.clip(s)}class E7{isModifyingCurrentTransform(){return!1}getPattern(){Zn("Abstract method `getPattern` called.")}}class PZe extends E7{constructor(e){super(),this._type=e[1],this._bbox=e[2],this._colorStops=e[3],this._p0=e[4],this._p1=e[5],this._r0=e[6],this._r1=e[7],this.matrix=null}_createGradient(e){let n;this._type==="axial"?n=e.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type==="radial"&&(n=e.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const r of this._colorStops)n.addColorStop(r[0],r[1]);return n}getPattern(e,n,r,s){let i;if(s===Di.STROKE||s===Di.FILL){const o=n.current.getClippedPathBoundingBox(s,Rr(e))||[0,0,0,0],l=Math.ceil(o[2]-o[0])||1,c=Math.ceil(o[3]-o[1])||1,u=n.cachedCanvases.getCanvas("pattern",l,c),d=u.context;d.clearRect(0,0,d.canvas.width,d.canvas.height),d.beginPath(),d.rect(0,0,d.canvas.width,d.canvas.height),d.translate(-o[0],-o[1]),r=ot.transform(r,[1,0,0,1,o[0],o[1]]),d.transform(...n.baseTransform),this.matrix&&d.transform(...this.matrix),uU(d,this._bbox),d.fillStyle=this._createGradient(d),d.fill(),i=e.createPattern(u.canvas,"no-repeat");const h=new DOMMatrix(r);i.setTransform(h)}else uU(e,this._bbox),i=this._createGradient(e);return i}}function E5(t,e,n,r,s,i,o,l){const c=e.coords,u=e.colors,d=t.data,h=t.width*4;let f;c[n+1]>c[r+1]&&(f=n,n=r,r=f,f=i,i=o,o=f),c[r+1]>c[s+1]&&(f=r,r=s,s=f,f=o,o=l,l=f),c[n+1]>c[r+1]&&(f=n,n=r,r=f,f=i,i=o,o=f);const p=(c[n]+e.offsetX)*e.scaleX,m=(c[n+1]+e.offsetY)*e.scaleY,v=(c[r]+e.offsetX)*e.scaleX,x=(c[r+1]+e.offsetY)*e.scaleY,g=(c[s]+e.offsetX)*e.scaleX,w=(c[s+1]+e.offsetY)*e.scaleY;if(m>=w)return;const _=u[i],j=u[i+1],N=u[i+2],S=u[o],C=u[o+1],k=u[o+2],E=u[l],P=u[l+1],T=u[l+2],M=Math.round(m),R=Math.round(w);let A,I,D,O,z,B,G,U;for(let F=M;F<=R;F++){if(F<x){const oe=F<m?0:(m-F)/(m-x);A=p-(p-v)*oe,I=_-(_-S)*oe,D=j-(j-C)*oe,O=N-(N-k)*oe}else{let oe;F>w?oe=1:x===w?oe=0:oe=(x-F)/(x-w),A=v-(v-g)*oe,I=S-(S-E)*oe,D=C-(C-P)*oe,O=k-(k-T)*oe}let W;F<m?W=0:F>w?W=1:W=(m-F)/(m-w),z=p-(p-g)*W,B=_-(_-E)*W,G=j-(j-P)*W,U=N-(N-T)*W;const Q=Math.round(Math.min(A,z)),K=Math.round(Math.max(A,z));let fe=h*F+Q*4;for(let oe=Q;oe<=K;oe++)W=(A-oe)/(A-z),W<0?W=0:W>1&&(W=1),d[fe++]=I-(I-B)*W|0,d[fe++]=D-(D-G)*W|0,d[fe++]=O-(O-U)*W|0,d[fe++]=255}}function MZe(t,e,n){const r=e.coords,s=e.colors;let i,o;switch(e.type){case"lattice":const l=e.verticesPerRow,c=Math.floor(r.length/l)-1,u=l-1;for(i=0;i<c;i++){let d=i*l;for(let h=0;h<u;h++,d++)E5(t,n,r[d],r[d+1],r[d+l],s[d],s[d+1],s[d+l]),E5(t,n,r[d+l+1],r[d+1],r[d+l],s[d+l+1],s[d+1],s[d+l])}break;case"triangles":for(i=0,o=r.length;i<o;i+=3)E5(t,n,r[i],r[i+1],r[i+2],s[i],s[i+1],s[i+2]);break;default:throw new Error("illegal figure")}}class RZe extends E7{constructor(e){super(),this._coords=e[2],this._colors=e[3],this._figures=e[4],this._bounds=e[5],this._bbox=e[6],this._background=e[7],this.matrix=null}_createMeshCanvas(e,n,r){const l=Math.floor(this._bounds[0]),c=Math.floor(this._bounds[1]),u=Math.ceil(this._bounds[2])-l,d=Math.ceil(this._bounds[3])-c,h=Math.min(Math.ceil(Math.abs(u*e[0]*1.1)),3e3),f=Math.min(Math.ceil(Math.abs(d*e[1]*1.1)),3e3),p=u/h,m=d/f,v={coords:this._coords,colors:this._colors,offsetX:-l,offsetY:-c,scaleX:1/p,scaleY:1/m},x=h+2*2,g=f+2*2,w=r.getCanvas("mesh",x,g),_=w.context,j=_.createImageData(h,f);if(n){const S=j.data;for(let C=0,k=S.length;C<k;C+=4)S[C]=n[0],S[C+1]=n[1],S[C+2]=n[2],S[C+3]=255}for(const S of this._figures)MZe(j,S,v);return _.putImageData(j,2,2),{canvas:w.canvas,offsetX:l-2*p,offsetY:c-2*m,scaleX:p,scaleY:m}}isModifyingCurrentTransform(){return!0}
900getPattern(e,n,r,s){uU(e,this._bbox);const i=new Float32Array(2);if(s===Di.SHADING)ot.singularValueDecompose2dScale(Rr(e),i);else if(this.matrix){ot.singularValueDecompose2dScale(this.matrix,i);const[l,c]=i;ot.singularValueDecompose2dScale(n.baseTransform,i),i[0]*=l,i[1]*=c}else ot.singularValueDecompose2dScale(n.baseTransform,i);const o=this._createMeshCanvas(i,s===Di.SHADING?null:this._background,n.cachedCanvases);return s!==Di.SHADING&&(e.setTransform(...n.baseTransform),this.matrix&&e.transform(...this.matrix)),e.translate(o.offsetX,o.offsetY),e.scale(o.scaleX,o.scaleY),e.createPattern(o.canvas,"no-repeat")}}class OZe extends E7{getPattern(){return"hotpink"}}function IZe(t){switch(t[0]){case"RadialAxial":return new PZe(t);case"Mesh":return new RZe(t);case"Dummy":return new OZe}throw new Error(`Unknown IR type: ${t[0]}`)}const Rte={COLORED:1,UNCOLORED:2},mL=class mL{constructor(e,n,r,s){this.color=e[1],this.operatorList=e[2],this.matrix=e[3],this.bbox=e[4],this.xstep=e[5],this.ystep=e[6],this.paintType=e[7],this.tilingType=e[8],this.ctx=n,this.canvasGraphicsFactory=r,this.baseTransform=s}createPatternCanvas(e,n){var B,G;const{bbox:r,operatorList:s,paintType:i,tilingType:o,color:l,canvasGraphicsFactory:c}=this;let{xstep:u,ystep:d}=this;u=Math.abs(u),d=Math.abs(d),Y3("TilingType: "+o);const h=r[0],f=r[1],p=r[2],m=r[3],v=p-h,x=m-f,g=new Float32Array(2);ot.singularValueDecompose2dScale(this.matrix,g);const[w,_]=g;ot.singularValueDecompose2dScale(this.baseTransform,g);const j=w*g[0],N=_*g[1];let S=v,C=x,k=!1,E=!1;const P=Math.ceil(u*j),T=Math.ceil(d*N),M=Math.ceil(v*j),R=Math.ceil(x*N);P>=M?S=u:k=!0,T>=R?C=d:E=!0;const A=this.getSizeAndScale(S,this.ctx.canvas.width,j),I=this.getSizeAndScale(C,this.ctx.canvas.height,N),D=e.cachedCanvases.getCanvas("pattern",A.size,I.size),O=D.context,z=c.createCanvasGraphics(O,n);if(z.groupLevel=e.groupLevel,this.setFillAndStrokeStyleToContext(z,i,l),O.translate(-A.scale*h,-I.scale*f),z.transform(0,A.scale,0,0,I.scale,0,0),O.save(),(B=z.dependencyTracker)==null||B.save(),this.clipBbox(z,h,f,p,m),z.baseTransform=Rr(z.ctx),z.executeOperatorList(s),z.endDrawing(),(G=z.dependencyTracker)==null||G.restore(),O.restore(),k||E){const U=D.canvas;k&&(S=u),E&&(C=d);const F=this.getSizeAndScale(S,this.ctx.canvas.width,j),W=this.getSizeAndScale(C,this.ctx.canvas.height,N),Q=F.size,K=W.size,fe=e.cachedCanvases.getCanvas("pattern-workaround",Q,K),oe=fe.context,ye=k?Math.floor(v/u):0,le=E?Math.floor(x/d):0;for(let me=0;me<=ye;me++)for(let he=0;he<=le;he++)oe.drawImage(U,Q*me,K*he,Q,K,0,0,Q,K);return{canvas:fe.canvas,scaleX:F.scale,scaleY:W.scale,offsetX:h,offsetY:f}}return{canvas:D.canvas,scaleX:A.scale,scaleY:I.scale,offsetX:h,offsetY:f}}getSizeAndScale(e,n,r){const s=Math.max(mL.MAX_PATTERN_SIZE,n);let i=Math.ceil(e*r);return i>=s?i=s:r=i/e,{scale:r,size:i}}clipBbox(e,n,r,s,i){const o=s-n,l=i-r;e.ctx.rect(n,r,o,l),ot.axialAlignedBoundingBox([n,r,s,i],Rr(e.ctx),e.current.minMax),e.clip(),e.endPath()}setFillAndStrokeStyleToContext(e,n,r){const s=e.ctx,i=e.current;switch(n){case Rte.COLORED:const{fillStyle:o,strokeStyle:l}=this.ctx;s.fillStyle=i.fillColor=o,s.strokeStyle=i.strokeColor=l;break;case Rte.UNCOLORED:s.fillStyle=s.strokeStyle=r,i.fillColor=i.strokeColor=r;break;default:throw new tZe(`Unsupported paint type: ${n}`)}}isModifyingCurrentTransform(){return!1}getPattern(e,n,r,s,i){let o=r;s!==Di.SHADING&&(o=ot.transform(o,n.baseTransform),this.matrix&&(o=ot.transform(o,this.matrix)));const l=this.createPatternCanvas(n,i);let c=new DOMMatrix(o);c=c.translate(l.offsetX,l.offsetY),c=c.scale(1/l.scaleX,1/l.scaleY);const u=e.createPattern(l.canvas,"repeat");return u.setTransform(c),u}};Te(mL,"MAX_PATTERN_SIZE",3e3);let dU=mL;function DZe({src:t,srcPos:e=0,dest:n,width:r,height:s,nonBlackColor:i=4294967295,inverseDecode:o=!1}){const l=yi.isLittleEndian?4278190080:255,[c,u]=o?[i,l]:[l,i],d=r>>3,h=r&7,f=t.length;n=new Uint32Array(n.buffer);let p=0;for(let m=0;m<s;m++){for(const x=e+d;e<x;e++){const g=e<f?t[e]:255;n[p++]=g&128?u:c,n[p++]=g&64?u:c,n[p++]=g&32?u:c,n[p++]=g&16?u:c,n[p++]=g&8?u:c,n[p++]=g&4?u:c,n[p++]=g&2?u:c,n[p++]=g&1?u:c}if(h===0)continue;const v=e<f?t[e++]:255;for(let x=0;x<h;x++)n[p++]=v&1<<7-x?u:c}return{srcPos:e,destPos:p}}const Ote=16,Ite=100,LZe=15,Dte=10,Lo=16,T5=new DOMMatrix,wl=new Float32Array(2),hw=new Float32Array([1/0,1/0,-1/0,-1/0]);function FZe(t,e){if(t._removeMirroring)throw new Error("Context is already forwarding operations.");t.__originalSave=t.save,t.__originalRestore=t.restore,t.__originalRotate=t.rotate,t.__originalScale=t.scale,t.__originalTranslate=t.translate,t.__originalTransform=t.transform,t.__originalSetTransform=t.setTransform,t.__originalResetTransform=t.resetTransform,t.__originalClip=t.clip,t.__originalMoveTo=t.moveTo,t.__originalLineTo=t.lineTo,t.__originalBezierCurveTo=t.bezierCurveTo,t.__originalRect=t.rect,t.__originalClosePath=t.closePath,t.__originalBeginPath=t.beginPath,t._removeMirroring=()=>{t.save=t.__originalSave,t.restore=t.__originalRestore,t.rotate=t.__originalRotate,t.scale=t.__originalScale,t.translate=t.__originalTranslate,t.transform=t.__originalTransform,t.setTransform=t.__originalSetTransform,t.resetTransform=t.__originalResetTransform,t.clip=t.__originalClip,t.moveTo=t.__originalMoveTo,t.lineTo=t.__originalLineTo,t.bezierCurveTo=t.__originalBezierCurveTo,t.rect=t.__originalRect,t.closePath=t.__originalClosePath,t.beginPath=t.__originalBeginPath,delete t._removeMirroring},t.save=function(){e.save(),this.__originalSave()}
900,t.restore=function(){e.restore(),this.__originalRestore()},t.translate=function(n,r){e.translate(n,r),this.__originalTranslate(n,r)},t.scale=function(n,r){e.scale(n,r),this.__originalScale(n,r)},t.transform=function(n,r,s,i,o,l){e.transform(n,r,s,i,o,l),this.__originalTransform(n,r,s,i,o,l)},t.setTransform=function(n,r,s,i,o,l){e.setTransform(n,r,s,i,o,l),this.__originalSetTransform(n,r,s,i,o,l)},t.resetTransform=function(){e.resetTransform(),this.__originalResetTransform()},t.rotate=function(n){e.rotate(n),this.__originalRotate(n)},t.clip=function(n){e.clip(n),this.__originalClip(n)},t.moveTo=function(n,r){e.moveTo(n,r),this.__originalMoveTo(n,r)},t.lineTo=function(n,r){e.lineTo(n,r),this.__originalLineTo(n,r)},t.bezierCurveTo=function(n,r,s,i,o,l){e.bezierCurveTo(n,r,s,i,o,l),this.__originalBezierCurveTo(n,r,s,i,o,l)},t.rect=function(n,r,s,i){e.rect(n,r,s,i),this.__originalRect(n,r,s,i)},t.closePath=function(){e.closePath(),this.__originalClosePath()},t.beginPath=function(){e.beginPath(),this.__originalBeginPath()}}class $Ze{constructor(e){this.canvasFactory=e,this.cache=Object.create(null)}getCanvas(e,n,r){let s;return this.cache[e]!==void 0?(s=this.cache[e],this.canvasFactory.reset(s,n,r)):(s=this.canvasFactory.create(n,r),this.cache[e]=s),s}delete(e){delete this.cache[e]}clear(){for(const e in this.cache){const n=this.cache[e];this.canvasFactory.destroy(n),delete this.cache[e]}}}function mP(t,e,n,r,s,i,o,l,c,u){const[d,h,f,p,m,v]=Rr(t);if(h===0&&f===0){const w=o*d+m,_=Math.round(w),j=l*p+v,N=Math.round(j),S=(o+c)*d+m,C=Math.abs(Math.round(S)-_)||1,k=(l+u)*p+v,E=Math.abs(Math.round(k)-N)||1;return t.setTransform(Math.sign(d),0,0,Math.sign(p),_,N),t.drawImage(e,n,r,s,i,0,0,C,E),t.setTransform(d,h,f,p,m,v),[C,E]}if(d===0&&p===0){const w=l*f+m,_=Math.round(w),j=o*h+v,N=Math.round(j),S=(l+u)*f+m,C=Math.abs(Math.round(S)-_)||1,k=(o+c)*h+v,E=Math.abs(Math.round(k)-N)||1;return t.setTransform(0,Math.sign(h),Math.sign(f),0,_,N),t.drawImage(e,n,r,s,i,0,0,E,C),t.setTransform(d,h,f,p,m,v),[E,C]}t.drawImage(e,n,r,s,i,o,l,c,u);const x=Math.hypot(d,h),g=Math.hypot(f,p);return[x*c,g*u]}class Lte{constructor(e,n,r){Te(this,"alphaIsShape",!1);Te(this,"fontSize",0);Te(this,"fontSizeScale",1);Te(this,"textMatrix",null);Te(this,"textMatrixScale",1);Te(this,"fontMatrix",F8);Te(this,"leading",0);Te(this,"x",0);Te(this,"y",0);Te(this,"lineX",0);Te(this,"lineY",0);Te(this,"charSpacing",0);Te(this,"wordSpacing",0);Te(this,"textHScale",1);Te(this,"textRenderingMode",Ni.FILL);Te(this,"textRise",0);Te(this,"fillColor","#000000");Te(this,"strokeColor","#000000");Te(this,"patternFill",!1);Te(this,"patternStroke",!1);Te(this,"fillAlpha",1);Te(this,"strokeAlpha",1);Te(this,"lineWidth",1);Te(this,"activeSMask",null);Te(this,"transferMaps","none");r==null||r(this),this.clipBox=new Float32Array([0,0,e,n]),this.minMax=hw.slice()}clone(){const e=Object.create(this);return e.clipBox=this.clipBox.slice(),e.minMax=this.minMax.slice(),e}getPathBoundingBox(e=Di.FILL,n=null){const r=this.minMax.slice();if(e===Di.STROKE){n||Zn("Stroke bounding box must include transform."),ot.singularValueDecompose2dScale(n,wl);const s=wl[0]*this.lineWidth/2,i=wl[1]*this.lineWidth/2;r[0]-=s,r[1]-=i,r[2]+=s,r[3]+=i}return r}updateClipFromPath(){const e=ot.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(e||[0,0,0,0])}isEmptyClip(){return this.minMax[0]===1/0}startNewPathAndClipBox(e){this.clipBox.set(e,0),this.minMax.set(hw,0)}getClippedPathBoundingBox(e=Di.FILL,n=null){return ot.intersect(this.clipBox,this.getPathBoundingBox(e,n))}}function Fte(t,e){if(e instanceof ImageData){t.putImageData(e,0,0);return}const n=e.height,r=e.width,s=n%Lo,i=(n-s)/Lo,o=s===0?i:i+1,l=t.createImageData(r,Lo);let c=0,u;const d=e.data,h=l.data;let f,p,m,v;if(e.kind===bC.GRAYSCALE_1BPP){const x=d.byteLength,g=new Uint32Array(h.buffer,0,h.byteLength>>2),w=g.length,_=r+7>>3,j=4294967295,N=yi.isLittleEndian?4278190080:255;for(f=0;f<o;f++){for(m=f<i?Lo:s,u=0,p=0;p<m;p++){const S=x-c;let C=0;const k=S>_?r:S*8-7,E=k&-8;let P=0,T=0;for(;C<E;C+=8)T=d[c++],g[u++]=T&128?j:N,g[u++]=T&64?j:N,g[u++]=T&32?j:N,g[u++]=T&
90016?j:N,g[u++]=T&8?j:N,g[u++]=T&4?j:N,g[u++]=T&2?j:N,g[u++]=T&1?j:N;for(;C<k;C++)P===0&&(T=d[c++],P=128),g[u++]=T&P?j:N,P>>=1}for(;u<w;)g[u++]=0;t.putImageData(l,0,f*Lo)}}else if(e.kind===bC.RGBA_32BPP){for(p=0,v=r*Lo*4,f=0;f<i;f++)h.set(d.subarray(c,c+v)),c+=v,t.putImageData(l,0,p),p+=Lo;f<o&&(v=r*s*4,h.set(d.subarray(c,c+v)),t.putImageData(l,0,p))}else if(e.kind===bC.RGB_24BPP)for(m=Lo,v=r*m,f=0;f<o;f++){for(f>=i&&(m=s,v=r*m),u=0,p=v;p--;)h[u++]=d[c++],h[u++]=d[c++],h[u++]=d[c++],h[u++]=255;t.putImageData(l,0,f*Lo)}else throw new Error(`bad image kind: ${e.kind}`)}function $te(t,e){if(e.bitmap){t.drawImage(e.bitmap,0,0);return}const n=e.height,r=e.width,s=n%Lo,i=(n-s)/Lo,o=s===0?i:i+1,l=t.createImageData(r,Lo);let c=0;const u=e.data,d=l.data;for(let h=0;h<o;h++){const f=h<i?Lo:s;({srcPos:c}=DZe({src:u,srcPos:c,dest:d,width:r,height:f,nonBlackColor:0})),t.putImageData(l,0,h*Lo)}}function CS(t,e){const n=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const r of n)t[r]!==void 0&&(e[r]=t[r]);t.setLineDash!==void 0&&(e.setLineDash(t.getLineDash()),e.lineDashOffset=t.lineDashOffset)}function gP(t){t.strokeStyle=t.fillStyle="#000000",t.fillRule="nonzero",t.globalAlpha=1,t.lineWidth=1,t.lineCap="butt",t.lineJoin="miter",t.miterLimit=10,t.globalCompositeOperation="source-over",t.font="10px sans-serif",t.setLineDash!==void 0&&(t.setLineDash([]),t.lineDashOffset=0);const{filter:e}=t;e!=="none"&&e!==""&&(t.filter="none")}function zte(t,e){if(e)return!0;ot.singularValueDecompose2dScale(t,wl);const n=Math.fround($u.pixelRatio*tp.PDF_TO_CSS_UNITS);return wl[0]<=n&&wl[1]<=n}const zZe=["butt","round","square"],BZe=["miter","round","bevel"],UZe={},Bte={};var Bu,hU,fU,pU;const tX=class tX{constructor(e,n,r,s,i,{optionalContentConfig:o,markedContentStack:l=null},c,u,d){q(this,Bu);this.ctx=e,this.current=new Lte(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=n,this.objs=r,this.canvasFactory=s,this.filterFactory=i,this.groupStack=[],this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=l||[],this.optionalContentConfig=o,this.cachedCanvases=new $Ze(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=c,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=u,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map,this.dependencyTracker=d??null}getObject(e,n,r=null){var s;return typeof n=="string"?((s=this.dependencyTracker)==null||s.recordNamedDependency(e,n),n.startsWith("g_")?this.commonObjs.get(n):this.objs.get(n)):r}beginDrawing({transform:e,viewport:n,transparency:r=!1,background:s=null}){const i=this.ctx.canvas.width,o=this.ctx.canvas.height,l=this.ctx.fillStyle;if(this.ctx.fillStyle=s||"#ffffff",this.ctx.fillRect(0,0,i,o),this.ctx.fillStyle=l,r){const c=this.cachedCanvases.getCanvas("transparent",i,o);this.compositeCtx=this.ctx,this.transparentCanvas=c.canvas,this.ctx=c.context,this.ctx.save(),this.ctx.transform(...Rr(this.compositeCtx))}this.ctx.save(),gP(this.ctx),e&&(this.ctx.transform(...e),this.outputScaleX=e[0],this.outputScaleY=e[0]),this.ctx.transform(...n.transform),this.viewportScale=n.scale,this.baseTransform=Rr(this.ctx)}executeOperatorList(e,n,r,s,i){var g;const o=e.argsArray,l=e.fnArray;let c=n||0;const u=o.length;if(u===c)return c;const d=u-c>Dte&&typeof r=="function",h=d?Date.now()+LZe:0;let f=0;const p=this.commonObjs,m=this.objs;let v,x;for(;;){if(s!==void 0&&c===s.nextBreakPoint)return s.breakIt(c,r),c;if(!i||i(c))if(v=l[c],x=o[c]??null,v!==Y_.dependency)x===null?this[v](c):this[v](c,...x);else for(const w of x){(g=this.dependencyTracker)==null||g.recordNamedData(w,c);const _=w.startsWith("g_")?p:m;if(!_.has(w))return _.get(w,r),c}if(c++,c===u)return c;if(d&&++f>Dte){if(Date.now()>h)return r(),c;f=0}}}endDrawing(){V(this,Bu,hU).call(this),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const e of this._cachedBitmapsMap.values()){for(const n of e.values())typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement&&(n.width=n.height=0);e.clear()}this._cachedBitmapsMap.clear(),V(this,Bu,fU).call(this)}
vendor: 5,063 bytes, line 900
900_scaleImage(e,n){const r=e.width??e.displayWidth,s=e.height??e.displayHeight;let i=Math.max(Math.hypot(n[0],n[1]),1),o=Math.max(Math.hypot(n[2],n[3]),1),l=r,c=s,u="prescale1",d,h;for(;i>2&&l>1||o>2&&c>1;){let f=l,p=c;i>2&&l>1&&(f=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l/2),i/=l/f),o>2&&c>1&&(p=c>=16384?Math.floor(c/2)-1||1:Math.ceil(c)/2,o/=c/p),d=this.cachedCanvases.getCanvas(u,f,p),h=d.context,h.clearRect(0,0,f,p),h.drawImage(e,0,0,l,c,0,0,f,p),e=d.canvas,l=f,c=p,u=u==="prescale1"?"prescale2":"prescale1"}return{img:e,paintWidth:l,paintHeight:c}}_createMaskCanvas(e,n){var P,T;const r=this.ctx,{width:s,height:i}=n,o=this.current.fillColor,l=this.current.patternFill,c=Rr(r);let u,d,h,f;if((n.bitmap||n.data)&&n.count>1){const M=n.bitmap||n.data.buffer;d=JSON.stringify(l?c:[c.slice(0,4),o]),u=this._cachedBitmapsMap.get(M),u||(u=new Map,this._cachedBitmapsMap.set(M,u));const R=u.get(d);if(R&&!l){const A=Math.round(Math.min(c[0],c[2])+c[4]),I=Math.round(Math.min(c[1],c[3])+c[5]);return(P=this.dependencyTracker)==null||P.recordDependencies(e,Kl.transformAndFill),{canvas:R,offsetX:A,offsetY:I}}h=R}h||(f=this.cachedCanvases.getCanvas("maskCanvas",s,i),$te(f.context,n));let p=ot.transform(c,[1/s,0,0,-1/i,0,0]);p=ot.transform(p,[1,0,0,1,0,-i]);const m=hw.slice();ot.axialAlignedBoundingBox([0,0,s,i],p,m);const[v,x,g,w]=m,_=Math.round(g-v)||1,j=Math.round(w-x)||1,N=this.cachedCanvases.getCanvas("fillCanvas",_,j),S=N.context,C=v,k=x;S.translate(-C,-k),S.transform(...p),h||(h=this._scaleImage(f.canvas,Qu(S)),h=h.img,u&&l&&u.set(d,h)),S.imageSmoothingEnabled=zte(Rr(S),n.interpolate),mP(S,h,0,0,h.width,h.height,0,0,s,i),S.globalCompositeOperation="source-in";const E=ot.transform(Qu(S),[1,0,0,1,-C,-k]);return S.fillStyle=l?o.getPattern(r,this,E,Di.FILL,e):o,S.fillRect(0,0,s,i),u&&!l&&(this.cachedCanvases.delete("fillCanvas"),u.set(d,N.canvas)),(T=this.dependencyTracker)==null||T.recordDependencies(e,Kl.transformAndFill),{canvas:N.canvas,offsetX:Math.round(C),offsetY:Math.round(k)}}setLineWidth(e,n){var r;(r=this.dependencyTracker)==null||r.recordSimpleData("lineWidth",e),n!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=n,this.ctx.lineWidth=n}setLineCap(e,n){var r;(r=this.dependencyTracker)==null||r.recordSimpleData("lineCap",e),this.ctx.lineCap=zZe[n]}setLineJoin(e,n){var r;(r=this.dependencyTracker)==null||r.recordSimpleData("lineJoin",e),this.ctx.lineJoin=BZe[n]}setMiterLimit(e,n){var r;(r=this.dependencyTracker)==null||r.recordSimpleData("miterLimit",e),this.ctx.miterLimit=n}setDash(e,n,r){var i;(i=this.dependencyTracker)==null||i.recordSimpleData("dash",e);const s=this.ctx;s.setLineDash!==void 0&&(s.setLineDash(n),s.lineDashOffset=r)}setRenderingIntent(e,n){}setFlatness(e,n){}setGState(e,n){var r,s,i,o,l;for(const[c,u]of n)switch(c){case"LW":this.setLineWidth(e,u);break;case"LC":this.setLineCap(e,u);break;case"LJ":this.setLineJoin(e,u);break;case"ML":this.setMiterLimit(e,u);break;case"D":this.setDash(e,u[0],u[1]);break;case"RI":this.setRenderingIntent(e,u);break;case"FL":this.setFlatness(e,u);break;case"Font":this.setFont(e,u[0],u[1]);break;case"CA":(r=this.dependencyTracker)==null||r.recordSimpleData("strokeAlpha",e),this.current.strokeAlpha=u;break;case"ca":(s=this.dependencyTracker)==null||s.recordSimpleData("fillAlpha",e),this.ctx.globalAlpha=this.current.fillAlpha=u;break;case"BM":(i=this.dependencyTracker)==null||i.recordSimpleData("globalCompositeOperation",e),this.ctx.globalCompositeOperation=u;break;case"SMask":(o=this.dependencyTracker)==null||o.recordSimpleData("SMask",e),this.current.activeSMask=u?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":(l=this.dependencyTracker)==null||l.recordSimpleData("filter",e),this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(u);break}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const e=this.inSMaskMode;this.current.activeSMask&&!e?this.beginSMaskMode():!this.current.activeSMask&&e&&this.endSMaskMode()}beginSMaskMode(e){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const n=this.ctx.canvas.width,r=this.ctx.canvas.height,s="smaskGroupAt"+this.groupLevel,i=this.cachedCanvases.getCanvas(s,n,r);this.suspendedCtx=this.ctx;const o=this.ctx=i.context;o.setTransform(this.suspendedCtx.getTransform()),CS(this.suspendedCtx,o),FZe(o,this.suspendedCtx),this.setGState(e,[["BM","source-over"]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),CS(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(e){if(!this.current.activeSMask)return;e?(e[0]=Math.floor(e[0]),e[1]=Math.floor(e[1]),e[2]=Math.ceil(e[2]),e[3]=Math.ceil(e[3])):e=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const n=this.current.activeSMask,r=this.suspendedCtx;this.composeSMask(r,n,this.ctx,e),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore(
900)}composeSMask(e,n,r,s){const i=s[0],o=s[1],l=s[2]-i,c=s[3]-o;l===0||c===0||(this.genericComposeSMask(n.context,r,l,c,n.subtype,n.backdrop,n.transferMap,i,o,n.offsetX,n.offsetY),e.save(),e.globalAlpha=1,e.globalCompositeOperation="source-over",e.setTransform(1,0,0,1,0,0),e.drawImage(r.canvas,0,0),e.restore())}genericComposeSMask(e,n,r,s,i,o,l,c,u,d,h){let f=e.canvas,p=c-d,m=u-h;if(o)if(p<0||m<0||p+r>f.width||m+s>f.height){const x=this.cachedCanvases.getCanvas("maskExtension",r,s),g=x.context;g.drawImage(f,-p,-m),g.globalCompositeOperation="destination-atop",g.fillStyle=o,g.fillRect(0,0,r,s),g.globalCompositeOperation="source-over",f=x.canvas,p=m=0}else{e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0);const x=new Path2D;x.rect(p,m,r,s),e.clip(x),e.globalCompositeOperation="destination-atop",e.fillStyle=o,e.fillRect(p,m,r,s),e.restore()}n.save(),n.globalAlpha=1,n.setTransform(1,0,0,1,0,0),i==="Alpha"&&l?n.filter=this.filterFactory.addAlphaFilter(l):i==="Luminosity"&&(n.filter=this.filterFactory.addLuminosityFilter(l));const v=new Path2D;v.rect(c,u,r,s),n.clip(v),n.globalCompositeOperation="destination-in",n.drawImage(f,p,m,r,s,c,u,r,s),n.restore()}save(e){var r;this.inSMaskMode&&CS(this.ctx,this.suspendedCtx),this.ctx.save();const n=this.current;this.stateStack.push(n),this.current=n.clone(),(r=this.dependencyTracker)==null||r.save(e)}restore(e){var n;if((n=this.dependencyTracker)==null||n.restore(e),this.stateStack.length===0){this.inSMaskMode&&this.endSMaskMode();return}this.current=this.stateStack.pop(),this.ctx.restore(),this.inSMaskMode&&CS(this.suspendedCtx,this.ctx),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}transform(e,n,r,s,i,o,l){var c;(c=this.dependencyTracker)==null||c.recordIncrementalData("transform",e),this.ctx.transform(n,r,s,i,o,l),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(e,n,r,s){let[i]=r;if(!s){i||(i=r[0]=new Path2D),this[n](e,i);return}if(this.dependencyTracker!==null){const o=n===Y_.stroke?this.current.lineWidth/2:0;this.dependencyTracker.resetBBox(e).recordBBox(e,this.ctx,s[0]-o,s[2]+o,s[1]-o,s[3]+o).recordDependencies(e,["transform"])}if(!(i instanceof Path2D)){const o=r[0]=new Path2D;for(let l=0,c=i.length;l<c;)switch(i[l++]){case cP.moveTo:o.moveTo(i[l++],i[l++]);break;case cP.lineTo:o.lineTo(i[l++],i[l++]);break;case cP.curveTo:o.bezierCurveTo(i[l++],i[l++],i[l++],i[l++],i[l++],i[l++]);break;case cP.closePath:o.closePath();break;default:Ut(`Unrecognized drawing path operator: ${i[l-1]}`);break}i=o}ot.axialAlignedBoundingBox(s,Rr(this.ctx),this.current.minMax),this[n](e,i),this._pathStartIdx=e}closePath(e){this.ctx.closePath()}stroke(e,n,r=!0){var o;const s=this.ctx,i=this.current.strokeColor;if(s.globalAlpha=this.current.strokeAlpha,this.contentVisible)if(typeof i=="object"&&(i!=null&&i.getPattern)){const l=i.isModifyingCurrentTransform()?s.getTransform():null;if(s.save(),s.strokeStyle=i.getPattern(s,this,Qu(s),Di.STROKE,e),l){const c=new Path2D;c.addPath(n,s.getTransform().invertSelf().multiplySelf(l)),n=c}this.rescaleAndStroke(n,!1),s.restore()}else this.rescaleAndStroke(n,!0);(o=this.dependencyTracker)==null||o.recordDependencies(e,Kl.stroke),r&&this.consumePath(e,n,this.current.getClippedPathBoundingBox(Di.STROKE,Rr(this.ctx))),s.globalAlpha=this.current.fillAlpha}closeStroke(e,n){this.stroke(e,n)}fill(e,n,r=!0){var u,d,h;const s=this.ctx,i=this.current.fillColor,o=this.current.patternFill;let l=!1;if(o){const f=i.isModifyingCurrentTransform()?s.getTransform():null;if((u=this.dependencyTracker)==null||u.save(e),s.save(),s.fillStyle=i.getPattern(s,this,Qu(s),Di.FILL,e),f){const p=new Path2D;p.addPath(n,s.getTransform().invertSelf().multiplySelf(f)),n=p}l=!0}const c=this.current.getClippedPathBoundingBox();this.contentVisible&&c!==null&&(this.pendingEOFill?(s.fill(n,"evenodd"),this.pendingEOFill=!1):s.fill(n)),(d=this.dependencyTracker)==null||d.recordDependencies(e,Kl.fill),l&&(s.restore(),(h=this.dependencyTracker)==null||h.restore(e)),r&&this.consumePath(e,n,c)}eoFill(e,n){this.pendingEOFill=!0,this.fill(e,n)}fillStroke(e,n){this.fill(e,n,!1),this.stroke(e,n,!1),this.consumePath(e,n)}eoFillStroke(e,n){this.pendingEOFill=!0,this.fillStroke(e,n)}closeFillStroke(e,n){this.fillStroke(e,n)}closeEOFillStroke(e,n){this.pendingEOFill=!0,this.fillStroke(e,n)}endPath(e,n){this.consumePath(e,n)}rawFillPath(e,n){var r;this.ctx.fill(n),(r=this.dependencyTracker)==null||r.recordDependencies(e,Kl.rawFillPath).recordOperation(e)}clip(e){var n;(n=this.dependencyTracker)==null||n.recordFutureForcedDependency("clipMode",e),this.pendingClip=UZe}eoClip(e){var n;(n=this.dependencyTracker)==null||n.recordFutureForcedDependency("clipMode",e),this.pendingClip=Bte}beginText(e){var n;this.current.textMatrix=null,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0,
900(n=this.dependencyTracker)==null||n.recordOpenMarker(e).resetIncrementalData("sameLineText").resetIncrementalData("moveText",e)}endText(e){const n=this.pendingTextPaths,r=this.ctx;if(this.dependencyTracker){const{dependencyTracker:s}=this;n!==void 0&&s.recordFutureForcedDependency("textClip",s.getOpenMarker()).recordFutureForcedDependency("textClip",e),s.recordCloseMarker(e)}if(n!==void 0){const s=new Path2D,i=r.getTransform().invertSelf();for(const{transform:o,x:l,y:c,fontSize:u,path:d}of n)d&&s.addPath(d,new DOMMatrix(o).preMultiplySelf(i).translate(l,c).scale(u,-u));r.clip(s)}delete this.pendingTextPaths}setCharSpacing(e,n){var r;(r=this.dependencyTracker)==null||r.recordSimpleData("charSpacing",e),this.current.charSpacing=n}setWordSpacing(e,n){var r;(r=this.dependencyTracker)==null||r.recordSimpleData("wordSpacing",e),this.current.wordSpacing=n}setHScale(e,n){var r;(r=this.dependencyTracker)==null||r.recordSimpleData("hScale",e),this.current.textHScale=n/100}setLeading(e,n){var r;(r=this.dependencyTracker)==null||r.recordSimpleData("leading",e),this.current.leading=-n}setFont(e,n,r){var h,f;(h=this.dependencyTracker)==null||h.recordSimpleData("font",e).recordSimpleDataFromNamed("fontObj",n,e);const s=this.commonObjs.get(n),i=this.current;if(!s)throw new Error(`Can't find font for ${n}`);if(i.fontMatrix=s.fontMatrix||F8,(i.fontMatrix[0]===0||i.fontMatrix[3]===0)&&Ut("Invalid font matrix for font "+n),r<0?(r=-r,i.fontDirection=-1):i.fontDirection=1,this.current.font=s,this.current.fontSize=r,s.isType3Font)return;const o=s.loadedName||"sans-serif",l=((f=s.systemFontInfo)==null?void 0:f.css)||`"${o}", ${s.fallbackName}`;let c="normal";s.black?c="900":s.bold&&(c="bold");const u=s.italic?"italic":"normal";let d=r;r<Ote?d=Ote:r>Ite&&(d=Ite),this.current.fontSizeScale=r/d,this.ctx.font=`${u} ${c} ${d}px ${l}`}setTextRenderingMode(e,n){var r;(r=this.dependencyTracker)==null||r.recordSimpleData("textRenderingMode",e),this.current.textRenderingMode=n}setTextRise(e,n){var r;(r=this.dependencyTracker)==null||r.recordSimpleData("textRise",e),this.current.textRise=n}moveText(e,n,r){var s;(s=this.dependencyTracker)==null||s.resetIncrementalData("sameLineText").recordIncrementalData("moveText",e),this.current.x=this.current.lineX+=n,this.current.y=this.current.lineY+=r}setLeadingMoveText(e,n,r){this.setLeading(e,-r),this.moveText(e,n,r)}setTextMatrix(e,n){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("textMatrix",e);const{current:r}=this;r.textMatrix=n,r.textMatrixScale=Math.hypot(n[0],n[1]),r.x=r.lineX=0,r.y=r.lineY=0}nextLine(e){var n;this.moveText(e,0,this.current.leading),(n=this.dependencyTracker)==null||n.recordIncrementalData("moveText",this.dependencyTracker.getSimpleIndex("leading")??e)}paintChar(e,n,r,s,i,o){var g,w,_,j;const l=this.ctx,c=this.current,u=c.font,d=c.textRenderingMode,h=c.fontSize/c.fontSizeScale,f=d&Ni.FILL_STROKE_MASK,p=!!(d&Ni.ADD_TO_PATH_FLAG),m=c.patternFill&&!u.missingFile,v=c.patternStroke&&!u.missingFile;let x;if((u.disableFontFace||p||m||v)&&!u.missingFile&&(x=u.getPathGenerator(this.commonObjs,n)),x&&(u.disableFontFace||m||v)){l.save(),l.translate(r,s),l.scale(h,-h),(g=this.dependencyTracker)==null||g.recordCharacterBBox(e,l,u);let N;if(f===Ni.FILL||f===Ni.FILL_STROKE)if(i){N=l.getTransform(),l.setTransform(...i);const S=V(this,Bu,pU).call(this,x,N,i);l.fill(S)}else l.fill(x);if(f===Ni.STROKE||f===Ni.FILL_STROKE)if(o){N||(N=l.getTransform()),l.setTransform(...o);const{a:S,b:C,c:k,d:E}=N,P=ot.inverseTransform(o),T=ot.transform([S,C,k,E,0,0],P);ot.singularValueDecompose2dScale(T,wl),l.lineWidth*=Math.max(wl[0],wl[1])/h,l.stroke(V(this,Bu,pU).call(this,x,N,o))}else l.lineWidth/=h,l.stroke(x);l.restore()}else(f===Ni.FILL||f===Ni.FILL_STROKE)&&(l.fillText(n,r,s),(w=this.dependencyTracker)==null||w.recordCharacterBBox(e,l,u,h,r,s,()=>l.measureText(n))),(f===Ni.STROKE||f===Ni.FILL_STROKE)&&(this.dependencyTracker&&((_=this.dependencyTracker)==null||_.recordCharacterBBox(e,l,u,h,r,s,()=>l.measureText(n)).recordDependencies(e,Kl.stroke)),l.strokeText(n,r,s));p&&((this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:Rr(l),x:r,y:s,fontSize:h,path:x}),(j=this.dependencyTracker)==null||j.recordCharacterBBox(e,l,u,h,r,s))}get isFontSubpixelAAEnabled(){const{context:e}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);e.scale(1.5,1),e.fillText("I",0,10);const n=e.getImageData(0,0,10,10).data;let r=!1;for(let s=3;s<n.length;s+=4)if(n[s]>0&&n[s]<255){r=!0;break}return Gt(this,"isFontSubpixelAAEnabled",r)}showText(e,n){var k,E,P,T;this.dependencyTracker&&(this.dependencyTracker.recordDependencies(e,Kl.showText).resetBBox(e),this.current.textRenderingMode&Ni.ADD_TO_PATH_FLAG&&this.dependencyTracker.recordFutureForcedDependency("textClip",e).inheritPendingDependenciesAsFutureForcedDependencies());const r=this.current,s=r.font;if(s.isType3Font){this.showType3Text(e,n),(k=this.dependencyTracker)==null||k.recordShowTextOperation(e);return}const i=r.fontSize;if(i===0){(E=this.dependencyTracker)==null||E.recordOperation(e);return}const o=this.ctx,l=r.fontSizeScale,c=r.charSpacing,u=r.wordSpacing,d=r.fontDirection,h=r.textHScale*d,f=n.length,p=s.vertical,m=p?1:-1,v=s.defaultVMetrics,x=i*r.fontMatrix[0],g=r.textRenderingMode===Ni.FILL&&!s.disableFontFace&&!r.patternFill;o.save(),r.textMatrix&&o.transform(...r.textMatrix),o.translate(r.x,r.y+r.textRise),d>0?o.scale(h,-1):o.scale(h,1);let w,_;if(r.patternFill){o.save();const M=r.fillColor.getPattern(o,this,Qu(o),Di.FILL,e);
900w=Rr(o),o.restore(),o.fillStyle=M}if(r.patternStroke){o.save();const M=r.strokeColor.getPattern(o,this,Qu(o),Di.STROKE,e);_=Rr(o),o.restore(),o.strokeStyle=M}let j=r.lineWidth;const N=r.textMatrixScale;if(N===0||j===0){const M=r.textRenderingMode&Ni.FILL_STROKE_MASK;(M===Ni.STROKE||M===Ni.FILL_STROKE)&&(j=this.getSinglePixelWidth())}else j/=N;if(l!==1&&(o.scale(l,l),j/=l),o.lineWidth=j,s.isInvalidPDFjsFont){const M=[];let R=0;for(const I of n)M.push(I.unicode),R+=I.width;const A=M.join("");if(o.fillText(A,0,0),this.dependencyTracker!==null){const I=o.measureText(A);this.dependencyTracker.recordBBox(e,this.ctx,-I.actualBoundingBoxLeft,I.actualBoundingBoxRight,-I.actualBoundingBoxAscent,I.actualBoundingBoxDescent).recordShowTextOperation(e)}r.x+=R*x*h,o.restore(),this.compose();return}let S=0,C;for(C=0;C<f;++C){const M=n[C];if(typeof M=="number"){S+=m*M*i/1e3;continue}let R=!1;const A=(M.isSpace?u:0)+c,I=M.fontChar,D=M.accent;let O,z,B=M.width;if(p){const F=M.vmetric||v,W=-(M.vmetric?F[1]:B*.5)*x,Q=F[2]*x;B=F?-F[0]:B,O=W/l,z=(S+Q)/l}else O=S/l,z=0;let G;if(s.remeasure&&B>0){G=o.measureText(I);const F=G.width*1e3/i*l;if(B<F&&this.isFontSubpixelAAEnabled){const W=B/F;R=!0,o.save(),o.scale(W,1),O/=W}else B!==F&&(O+=(B-F)/2e3*i/l)}if(this.contentVisible&&(M.isInFont||s.missingFile)){if(g&&!D)o.fillText(I,O,z),(P=this.dependencyTracker)==null||P.recordCharacterBBox(e,o,G?{bbox:null}:s,i/l,O,z,()=>G??o.measureText(I));else if(this.paintChar(e,I,O,z,w,_),D){const F=O+i*D.offset.x/l,W=z-i*D.offset.y/l;this.paintChar(e,D.fontChar,F,W,w,_)}}const U=p?B*x-A*d:B*x+A*d;S+=U,R&&o.restore()}p?r.y-=S:r.x+=S*h,o.restore(),this.compose(),(T=this.dependencyTracker)==null||T.recordShowTextOperation(e)}showType3Text(e,n){const r=this.ctx,s=this.current,i=s.font,o=s.fontSize,l=s.fontDirection,c=i.vertical?1:-1,u=s.charSpacing,d=s.wordSpacing,h=s.textHScale*l,f=s.fontMatrix||F8,p=n.length,m=s.textRenderingMode===Ni.INVISIBLE;let v,x,g,w;if(m||o===0)return;this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,r.save(),s.textMatrix&&r.transform(...s.textMatrix),r.translate(s.x,s.y+s.textRise),r.scale(h,l);const _=this.dependencyTracker;for(this.dependencyTracker=_?new iI(_,e):null,v=0;v<p;++v){if(x=n[v],typeof x=="number"){w=c*x*o/1e3,this.ctx.translate(w,0),s.x+=w*h;continue}const j=(x.isSpace?d:0)+u,N=i.charProcOperatorList[x.operatorListId];N?this.contentVisible&&(this.save(),r.scale(o,o),r.transform(...f),this.executeOperatorList(N),this.restore()):Ut(`Type3 character "${x.operatorListId}" is not available.`);const S=[x.width,0];ot.applyTransform(S,f),g=S[0]*o+j,r.translate(g,0),s.x+=g*h}r.restore(),_&&(this.dependencyTracker=_)}setCharWidth(e,n,r){}setCharWidthAndBounds(e,n,r,s,i,o,l){var u;const c=new Path2D;c.rect(s,i,o-s,l-i),this.ctx.clip(c),(u=this.dependencyTracker)==null||u.recordBBox(e,this.ctx,s,o,i,l).recordClipBox(e,this.ctx,s,o,i,l),this.endPath(e)}getColorN_Pattern(e,n){let r;if(n[0]==="TilingPattern"){const s=this.baseTransform||Rr(this.ctx),i={createCanvasGraphics:(o,l)=>new tX(o,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack},void 0,void 0,this.dependencyTracker?new iI(this.dependencyTracker,l,!0):null)};r=new dU(n,this.ctx,i,s)}else r=this._getPattern(e,n[1],n[2]);return r}setStrokeColorN(e,...n){var r;(r=this.dependencyTracker)==null||r.recordSimpleData("strokeColor",e),this.current.strokeColor=this.getColorN_Pattern(e,n),this.current.patternStroke=!0}setFillColorN(e,...n){var r;(r=this.dependencyTracker)==null||r.recordSimpleData("fillColor",e),this.current.fillColor=this.getColorN_Pattern(e,n),this.current.patternFill=!0}setStrokeRGBColor(e,n){var r;(r=this.dependencyTracker)==null||r.recordSimpleData("strokeColor",e),this.ctx.strokeStyle=this.current.strokeColor=n,this.current.patternStroke=!1}
900setStrokeTransparent(e){var n;(n=this.dependencyTracker)==null||n.recordSimpleData("strokeColor",e),this.ctx.strokeStyle=this.current.strokeColor="transparent",this.current.patternStroke=!1}setFillRGBColor(e,n){var r;(r=this.dependencyTracker)==null||r.recordSimpleData("fillColor",e),this.ctx.fillStyle=this.current.fillColor=n,this.current.patternFill=!1}setFillTransparent(e){var n;(n=this.dependencyTracker)==null||n.recordSimpleData("fillColor",e),this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(e,n,r=null){let s;return this.cachedPatterns.has(n)?s=this.cachedPatterns.get(n):(s=IZe(this.getObject(e,n)),this.cachedPatterns.set(n,s)),r&&(s.matrix=r),s}shadingFill(e,n){var o;if(!this.contentVisible)return;const r=this.ctx;this.save(e);const s=this._getPattern(e,n);r.fillStyle=s.getPattern(r,this,Qu(r),Di.SHADING,e);const i=Qu(r);if(i){const{width:l,height:c}=r.canvas,u=hw.slice();ot.axialAlignedBoundingBox([0,0,l,c],i,u);const[d,h,f,p]=u;this.ctx.fillRect(d,h,f-d,p-h)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);(o=this.dependencyTracker)==null||o.resetBBox(e).recordFullPageBBox(e).recordDependencies(e,Kl.transform).recordDependencies(e,Kl.fill).recordOperation(e),this.compose(this.current.getClippedPathBoundingBox()),this.restore(e)}beginInlineImage(){Zn("Should not call beginInlineImage")}beginImageData(){Zn("Should not call beginImageData")}paintFormXObjectBegin(e,n,r){var s;if(this.contentVisible&&(this.save(e),this.baseTransformStack.push(this.baseTransform),n&&this.transform(e,...n),this.baseTransform=Rr(this.ctx),r)){ot.axialAlignedBoundingBox(r,this.baseTransform,this.current.minMax);const[i,o,l,c]=r,u=new Path2D;u.rect(i,o,l-i,c-o),this.ctx.clip(u),(s=this.dependencyTracker)==null||s.recordClipBox(e,this.ctx,i,l,o,c),this.endPath(e)}}paintFormXObjectEnd(e){this.contentVisible&&(this.restore(e),this.baseTransform=this.baseTransformStack.pop())}beginGroup(e,n){var _;if(!this.contentVisible)return;this.save(e),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const r=this.ctx;
900n.isolated||Y3("TODO: Support non-isolated groups."),n.knockout&&Ut("Knockout groups not supported.");const s=Rr(r);if(n.matrix&&r.transform(...n.matrix),!n.bbox)throw new Error("Bounding box is required.");let i=hw.slice();ot.axialAlignedBoundingBox(n.bbox,Rr(r),i);const o=[0,0,r.canvas.width,r.canvas.height];i=ot.intersect(i,o)||[0,0,0,0];const l=Math.floor(i[0]),c=Math.floor(i[1]),u=Math.max(Math.ceil(i[2])-l,1),d=Math.max(Math.ceil(i[3])-c,1);this.current.startNewPathAndClipBox([0,0,u,d]);let h="groupAt"+this.groupLevel;n.smask&&(h+="_smask_"+this.smaskCounter++%2);const f=this.cachedCanvases.getCanvas(h,u,d),p=f.context;p.translate(-l,-c),p.transform(...s);let m=new Path2D;const[v,x,g,w]=n.bbox;if(m.rect(v,x,g-v,w-x),n.matrix){const j=new Path2D;j.addPath(m,new DOMMatrix(n.matrix)),m=j}p.clip(m),n.smask&&this.smaskStack.push({canvas:f.canvas,context:p,offsetX:l,offsetY:c,subtype:n.smask.subtype,backdrop:n.smask.backdrop,transferMap:n.smask.transferMap||null,startTransformInverse:null}),(!n.smask||this.dependencyTracker)&&(r.setTransform(1,0,0,1,0,0),r.translate(l,c),r.save()),CS(r,p),this.ctx=p,(_=this.dependencyTracker)==null||_.inheritSimpleDataAsFutureForcedDependencies(["fillAlpha","strokeAlpha","globalCompositeOperation"]).pushBaseTransform(r),this.setGState(e,[["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(r),this.groupLevel++}endGroup(e,n){var i;if(!this.contentVisible)return;this.groupLevel--;const r=this.ctx,s=this.groupStack.pop();if(this.ctx=s,this.ctx.imageSmoothingEnabled=!1,(i=this.dependencyTracker)==null||i.popBaseTransform(),n.smask)this.tempSMask=this.smaskStack.pop(),this.restore(e),this.dependencyTracker&&this.ctx.restore();else{this.ctx.restore();const o=Rr(this.ctx);this.restore(e),this.ctx.save(),this.ctx.setTransform(...o);const l=hw.slice();ot.axialAlignedBoundingBox([0,0,r.canvas.width,r.canvas.height],o,l),this.ctx.drawImage(r.canvas,0,0),this.ctx.restore(),this.compose(l)}}beginAnnotation(e,n,r,s,i,o){if(V(this,Bu,hU).call(this),gP(this.ctx),this.ctx.save(),this.save(e),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),r){const l=r[2]-r[0],c=r[3]-r[1];if(o&&this.annotationCanvasMap){s=s.slice(),s[4]-=r[0],s[5]-=r[1],r=r.slice(),r[0]=r[1]=0,r[2]=l,r[3]=c,ot.singularValueDecompose2dScale(Rr(this.ctx),wl);const{viewportScale:u}=this,d=Math.ceil(l*this.outputScaleX*u),h=Math.ceil(c*this.outputScaleY*u);this.annotationCanvas=this.canvasFactory.create(d,h);const{canvas:f,context:p}=this.annotationCanvas;this.annotationCanvasMap.set(n,f),this.annotationCanvas.savedCtx=this.ctx,this.ctx=p,this.ctx.save(),this.ctx.setTransform(wl[0],0,0,-wl[1],0,c*wl[1]),gP(this.ctx)}else{gP(this.ctx),this.endPath(e);const u=new Path2D;u.rect(r[0],r[1],l,c),this.ctx.clip(u)}}this.current=new Lte(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(e,...s),this.transform(e,...i)}endAnnotation(e){this.annotationCanvas&&(this.ctx.restore(),V(this,Bu,fU).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(e,n){var l;if(!this.contentVisible)return;const r=n.count;n=this.getObject(e,n.data,n),n.count=r;const s=this.ctx,i=this._createMaskCanvas(e,n),o=i.canvas;s.save(),s.setTransform(1,0,0,1,0,0),s.drawImage(o,i.offsetX,i.offsetY),(l=this.dependencyTracker)==null||l.resetBBox(e).recordBBox(e,this.ctx,i.offsetX,i.offsetX+o.width,i.offsetY,i.offsetY+o.height).recordOperation(e),s.restore(),this.compose()}paintImageMaskXObjectRepeat(e,n,r,s=0,i=0,o,l){var h,f,p;if(!this.contentVisible)return;n=this.getObject(e,n.data,n);const c=this.ctx;c.save();const u=Rr(c);c.transform(r,s,i,o,0,0);const d=this._createMaskCanvas(e,n);c.setTransform(1,0,0,1,d.offsetX-u[4],d.offsetY-u[5]),(h=this.dependencyTracker)==null||h.resetBBox(e);for(let m=0,v=l.length;m<v;m+=2){const x=ot.transform(u,[r,s,i,o,l[m],l[m+1]]);c.drawImage(d.canvas,x[4],x[5]),(f=this.dependencyTracker)==null||f.recordBBox(e,this.ctx,x[4],x[4]+d.canvas.width,x[5],x[5]+d.canvas.height)}c.restore(),this.compose(),(p=this.dependencyTracker)==null||p.recordOperation(e)}paintImageMaskXObjectGroup(e,n){var o,l,c;if(!this.contentVisible)return;const r=this.ctx,s=this.current.fillColor,i=this.current.patternFill;(o=this.dependencyTracker)==null||o.resetBBox(e).recordDependencies(e,Kl.transformAndFill);for(const u of n){const{data:d,width:h,height:f,transform:p}=u,m=this.cachedCanvases.getCanvas("maskCanvas",h,f),v=m.context;v.save();const x=this.getObject(e,d,u);$te(v,x),v.globalCompositeOperation="source-in",v.fillStyle=i?s.getPattern(v,this,Qu(r),Di.FILL,e):s,v.fillRect(0,0,h,f),v.restore(
900),r.save(),r.transform(...p),r.scale(1,-1),mP(r,m.canvas,0,0,h,f,0,-1,1,1),(l=this.dependencyTracker)==null||l.recordBBox(e,r,0,h,0,f),r.restore()}this.compose(),(c=this.dependencyTracker)==null||c.recordOperation(e)}paintImageXObject(e,n){if(!this.contentVisible)return;const r=this.getObject(e,n);if(!r){Ut("Dependent image isn't ready yet");return}this.paintInlineImageXObject(e,r)}paintImageXObjectRepeat(e,n,r,s,i){if(!this.contentVisible)return;const o=this.getObject(e,n);if(!o){Ut("Dependent image isn't ready yet");return}const l=o.width,c=o.height,u=[];for(let d=0,h=i.length;d<h;d+=2)u.push({transform:[r,0,0,s,i[d],i[d+1]],x:0,y:0,w:l,h:c});this.paintInlineImageXObjectGroup(e,o,u)}applyTransferMapsToCanvas(e){return this.current.transferMaps!=="none"&&(e.filter=this.current.transferMaps,e.drawImage(e.canvas,0,0),e.filter="none"),e.canvas}applyTransferMapsToBitmap(e){if(this.current.transferMaps==="none")return e.bitmap;const{bitmap:n,width:r,height:s}=e,i=this.cachedCanvases.getCanvas("inlineImage",r,s),o=i.context;return o.filter=this.current.transferMaps,o.drawImage(n,0,0),o.filter="none",i.canvas}paintInlineImageXObject(e,n){var u;if(!this.contentVisible)return;const r=n.width,s=n.height,i=this.ctx;this.save(e);const{filter:o}=i;o!=="none"&&o!==""&&(i.filter="none"),i.scale(1/r,-1/s);let l;if(n.bitmap)l=this.applyTransferMapsToBitmap(n);else if(typeof HTMLElement=="function"&&n instanceof HTMLElement||!n.data)l=n;else{const h=this.cachedCanvases.getCanvas("inlineImage",r,s).context;Fte(h,n),l=this.applyTransferMapsToCanvas(h)}const c=this._scaleImage(l,Qu(i));i.imageSmoothingEnabled=zte(Rr(i),n.interpolate),(u=this.dependencyTracker)==null||u.resetBBox(e).recordBBox(e,i,0,r,-s,0).recordDependencies(e,Kl.imageXObject).recordOperation(e),mP(i,c.img,0,0,c.paintWidth,c.paintHeight,0,-s,r,s),this.compose(),this.restore(e)}paintInlineImageXObjectGroup(e,n,r){var o,l,c;if(!this.contentVisible)return;const s=this.ctx;let i;if(n.bitmap)i=n.bitmap;else{const u=n.width,d=n.height,f=this.cachedCanvases.getCanvas("inlineImage",u,d).context;Fte(f,n),i=this.applyTransferMapsToCanvas(f)}(o=this.dependencyTracker)==null||o.resetBBox(e);for(const u of r)s.save(),s.transform(...u.transform),s.scale(1,-1),mP(s,i,u.x,u.y,u.w,u.h,0,-1,1,1),(l=this.dependencyTracker)==null||l.recordBBox(e,s,0,1,-1,0),s.restore();(c=this.dependencyTracker)==null||c.recordOperation(e),this.compose()}paintSolidColorImageMask(e){var n;this.contentVisible&&((n=this.dependencyTracker)==null||n.resetBBox(e).recordBBox(e,this.ctx,0,1,0,1).recordDependencies(e,Kl.fill).recordOperation(e),this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(e,n){}markPointProps(e,n,r){}beginMarkedContent(e,n){var r;(r=this.dependencyTracker)==null||r.beginMarkedContent(e),this.markedContentStack.push({visible:!0})}beginMarkedContentProps(e,n,r){var s;(s=this.dependencyTracker)==null||s.beginMarkedContent(e),n==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(r)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(e){var n;(n=this.dependencyTracker)==null||n.endMarkedContent(e),this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(e){}endCompat(e){}consumePath(e,n,r){var o,l;const s=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(r);const i=this.ctx;this.pendingClip?(s||(this.pendingClip===Bte?i.clip(n,"evenodd"):i.clip(n)),this.pendingClip=null,(o=this.dependencyTracker)==null||o.bboxToClipBoxDropOperation(e).recordFutureForcedDependency("clipPath",e)):(l=this.dependencyTracker)==null||l.recordOperation(e),this.current.startNewPathAndClipBox(this.current.clipBox)}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const e=Rr(this.ctx);if(e[1]===0&&e[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(e[0]),Math.abs(e[3]));else{const n=Math.abs(e[0]*e[3]-e[2]*e[1]),r=Math.hypot(e[0],e[2]),s=Math.hypot(e[1],e[3]);this._cachedGetSinglePixelWidth=Math.max(r,s)/n}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){const{lineWidth:e}=this.current,{a:n,b:r,c:s,d:i}=this.ctx.getTransform();let o,l;if(r===0&&s===0){const c=Math.abs(n),u=Math.abs(i);if(c===u)if(e===0)o=l=1/c;else{const d=c*e;o=l=d<1?1/d:1}else if(e===0)o=1/c,l=1/u;else{const d=c*e,h=u*e;o=d<1?1/d:1,l=h<1?1/h:1}}else{const c=Math.abs(n*i-r*s),u=Math.hypot(n,r),d=Math.hypot(s,i);if(e===0)o=d/c,l=u/c;else{const h=e*c;o=d>h?d/h:1,l=u>h?u/h:1}}this._cachedScaleForStroking[0]=o,this._cachedScaleForStroking[1]=l}return this._cachedScaleForStroking}rescaleAndStroke(e,n){const{ctx:r,current:{lineWidth:s}}=this,[i,o]=this.getScaleForStroking();if(i===o){r.lineWidth=(s||1)*i,r.stroke(e);return}const l=r.getLineDash();n&&r.save(),r.scale(i,o),T5.a=1/i,T5.d=1/o;const c=new Path2D;if(c.addPath(e,T5),l.length>0){const u=Math.max(i,o);r.setLineDash(l.map(d=>d/u)),r.lineDashOffset/=u}
900r.lineWidth=s||1,r.stroke(c),n&&r.restore()}isContentVisible(){for(let e=this.markedContentStack.length-1;e>=0;e--)if(!this.markedContentStack[e].visible)return!1;return!0}};Bu=new WeakSet,hU=function(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.current.activeSMask=null,this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null)},fU=function(){if(this.pageColors){const e=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(e!=="none"){const n=this.ctx.filter;this.ctx.filter=e,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=n}}},pU=function(e,n,r){const s=new Path2D;return s.addPath(e,new DOMMatrix(r).invertSelf().multiplySelf(n)),s};let Fw=tX;for(const t in Y_)Fw.prototype[t]!==void 0&&(Fw.prototype[Y_[t]]=Fw.prototype[t]);var P1,M1,UA,R1,ZM;const yw=class yw{constructor(e){q(this,R1);q(this,P1);q(this,M1);q(this,UA);$(this,P1,e),$(this,M1,new DataView(y(this,P1))),$(this,UA,new TextDecoder)}static write(e){const n=new TextEncoder,r={};let s=0;for(const u of yw.strings){const d=n.encode(e[u]);r[u]=d,s+=4+d.length}const i=new ArrayBuffer(s),o=new Uint8Array(i),l=new DataView(i);let c=0;for(const u of yw.strings){const d=r[u],h=d.length;l.setUint32(c,h),o.set(d,c+4),c+=4+h}return un(c===i.byteLength,"CssFontInfo.write: Buffer overflow"),i}get fontFamily(){return V(this,R1,ZM).call(this,0)}get fontWeight(){return V(this,R1,ZM).call(this,1)}get italicAngle(){return V(this,R1,ZM).call(this,2)}};P1=new WeakMap,M1=new WeakMap,UA=new WeakMap,R1=new WeakSet,ZM=function(e){un(e<yw.strings.length,"Invalid string index");let n=0;for(let s=0;s<e;s++)n+=y(this,M1).getUint32(n)+4;const r=y(this,M1).getUint32(n);return y(this,UA).decode(new Uint8Array(y(this,P1),n+4,r))},Te(yw,"strings",["fontFamily","fontWeight","italicAngle"]);let aI=yw;var Rm,Sd,Gx,Yx,wN;const bw=class bw{constructor(e){q(this,Yx);q(this,Rm);q(this,Sd);q(this,Gx);$(this,Rm,e),$(this,Sd,new DataView(y(this,Rm))),$(this,Gx,new TextDecoder)}static write(e){const n=new TextEncoder,r={};let s=0;for(const f of bw.strings){const p=n.encode(e[f]);r[f]=p,s+=4+p.length}s+=4;let i,o,l=1+s;e.style&&(i=n.encode(e.style.style),o=n.encode(e.style.weight),l+=4+i.length+4+o.length);const c=new ArrayBuffer(l),u=new Uint8Array(c),d=new DataView(c);let h=0;d.setUint8(h++,e.guessFallback?1:0),d.setUint32(h,0),h+=4,s=0;for(const f of bw.strings){const p=r[f],m=p.length;s+=4+m,d.setUint32(h,m),u.set(p,h+4),h+=4+m}return d.setUint32(h-s-4,s),e.style&&(d.setUint32(h,i.length),u.set(i,h+4),h+=4+i.length,d.setUint32(h,o.length),u.set(o,h+4),h+=4+o.length),un(h<=c.byteLength,"SubstitionInfo.write: Buffer overflow"),c.transferToFixedLength(h)}get guessFallback(){return y(this,Sd).getUint8(0)!==0}get css(){return V(this,Yx,wN).call(this,0)}get loadedName(){return V(this,Yx,wN).call(this,1)}get baseFontName(){return V(this,Yx,wN).call(this,2)}get src(){return V(this,Yx,wN).call(this,3)}get style(){let e=1;e+=4+y(this,Sd).getUint32(e);const n=y(this,Sd).getUint32(e),r=y(this,Gx).decode(new Uint8Array(y(this,Rm),e+4,n));e+=4+n;const s=y(this,Sd).getUint32(e),i=y(this,Gx).decode(new Uint8Array(y(this,Rm),e+4,s));return{style:r,weight:i}}};Rm=new WeakMap,Sd=new WeakMap,Gx=new WeakMap,Yx=new WeakSet,wN=function(e){un(e<bw.strings.length,"Invalid string index");let n=5;for(let s=0;s<e;s++)n+=y(this,Sd).getUint32(n)+4;const r=y(this,Sd).getUint32(n);return y(this,Gx).decode(new Uint8Array(y(this,Rm),n+4,r))},Te(bw,"strings",["css","loadedName","baseFontName","src"]);let oI=bw;var O1,I1,D1,L1,il,Nd,qA,Un,es,Kc,eR,_N;const Wt=class Wt{constructor({data:e,extra:n}){q(this,es);q(this,Nd);q(this,qA);q(this,Un);$(this,Nd,e),$(this,qA,new TextDecoder),$(this,Un,new DataView(y(this,Nd))),n&&Object.assign(this,n)}get black(){return V(this,es,Kc).call(this,0)}get bold(){return V(this,es,Kc).call(this,1)}get disableFontFace(){return V(this,es,Kc).call(this,2)}get fontExtraProperties(){return V(this,es,Kc).call(this,3)}get isInvalidPDFjsFont(){return V(this,es,Kc).call(this,4)}get isType3Font(){return V(this,es,Kc).call(this,5)}get italic(){return V(this,es,Kc).call(this,6)}get missingFile(){return V(this,es,Kc).call(this,7)}get remeasure(){return V(this,es,Kc).call(this,8)}get vertical(){return V(this,es,Kc).call(this,9)}get ascent(){return V(this,es,eR).call(this,0)}get defaultWidth(){return V(this,es,eR).call(this,1)}get descent(){return V(this,es,eR).call(this,2)}get bbox(){let e=y(Wt,I1);if(y(this,Un).getUint8(e)===0)return;e+=1;const r=[];for(let s=0;s<4;s++)r.push(y(this,Un).getInt16(e,!0)),e+=2;return r}get fontMatrix(){let e=y(Wt,D1);if(y(this,Un).getUint8(e)===0)return;e+=1;const r=[];for(let s=0;s<6;s++)r.push(y(this,Un).getFloat64(e,!0)),e+=8;return r}get defaultVMetrics(){let e=y(Wt,L1);if(y(this,Un).getUint8(e)===0)return;e+=1;const r=[];for(let s=0;s<3;s++)r.push(y(this,Un).getInt16(e,!0)),e+=2;return r}get fallbackName(){return V(this,es,_N).call(this,0)}get loadedName(){return V(this,es,_N).call(this,1)}get mimetype(){return V(this,es,_N).call(this,2)}get name(){return V(this,es,_N).call(this,3)}get data(){let e=y(Wt,il);const n=y(this,Un).getUint32(e);e+=4+n;const r=y(this,Un).getUint32(e);e+=4+r;const s=y(this,Un).getUint32(e);e+=4+s;const i=y(this,Un).getUint32(e);if(i!==0)return new Uint8Array(y(this,Nd),e+4,i)}clearData(){let e=y(Wt,il);const n=y(this,Un).getUint32(e);e+=4+n;const r=y(this,Un).getUint32(e);e+=4+r;const s=y(this,Un).getUint32(e);e+=4+s;const i=y(this,Un).getUint32(e);new Uint8Array(y(this,Nd),e+4,i).fill(0),y(this,Un).setUint32(e,0)}get cssFontInfo(){let e=y(Wt,il);const n=y(this,Un).getUint32(e);e+=4+n;const r=y(this,Un).getUint32(e);e+=4+r;const s=y(this,Un).getUint32(e);if(s===0)return null;const i=new Uint8Array(s);return i.set(new Uint8Array(y(this,Nd),e+4,s)),new aI(i.buffer)}get systemFontInfo(){let e=y(Wt,il);const n=y(this,Un).getUint32(e);e+=4+n;const r=y(this,Un).getUint32(e);if(r===0)return null;const s=new Uint8Array(r);return s.set(new Uint8Array(y(this,Nd),e+4,r)),new oI(s.buffer)}static write(e){const n=e.systemFontInfo?oI.write(e.systemFontInfo):null,r=e.cssFontInfo?aI.write(e.cssFontInfo):null,s=new TextEncoder,i={};let o=0;for(const v of Wt.strings)i[v]=s.encode(e[v]),o+=4+i[v].length;const l=y(Wt,il)+4+o+4+(n?n.byteLength:0)+4+(r?r.byteLength:0)+4+(e.data?e.data.length:0),c=new ArrayBuffer(l),u=new Uint8Array(c),d=new DataView(c);let h=0;const f=Wt.bools.length;let p=0,m=0;for(let v=0;v<f;v++){const x=e[Wt.bools[v]];p|=(x===void 0?0:x?2:1)<<m,m+=2,(m===8||v===f-1)&&(d.setUint8(h++,p),p=0,m=0)}un(h===y(Wt,O1),"FontInfo.write: Boolean properties offset mismatch");for(const v of Wt.numbers)d.setFloat64(h,e[v]),h+=8;if(un(h===y(Wt,I1),"FontInfo.write: Number properties offset mismatch"),e.bbox){d.setUint8(h++,4);for(const v of e.bbox)d.setInt16(h,v,!0),h+=2}else d.setUint8(h++,0),h+=2*4;if(un(h===y(Wt,D1),"FontInfo.write: BBox properties offset mismatch"),e.fontMatrix){d.setUint8(h++,6);for(const v of e.fontMatrix)d.setFloat64(h,v,!0),h+=8}else d.setUint8(h++,0),h+=8*6;if(un(h===y(Wt,L1),"FontInfo.write: FontMatrix properties offset mismatch"),e.defaultVMetrics){d.setUint8(h++,1);for(const v of e.defaultVMetrics)d.setInt16(h,v,!0),h+=2}else d.setUint8(h++,0),h+=3*2;un(h===y(Wt,il),"FontInfo.write: DefaultVMetrics properties offset mismatch"),d.setUint32(y(Wt,il),0),h+=4;for(const v of Wt.strings){const x=i[v],g=x.length;d.setUint32(h,g),u.set(x,h+4),h+=4+g}if(d.setUint32(y(Wt,il),h-y(Wt,il)-4),!n)d.setUint32(h,0),h+=4;else{const v=n.byteLength;d.setUint32(h,v),un(h+4+v<=c.byteLength,"FontInfo.write: Buffer overflow at systemFontInfo"),u.set(new Uint8Array(n),h+4),h+=4+v}if(!r)d.setUint32(h,0),h+=4;else{const v=r.byteLength;d.setUint32(h,v),un(h+4+v<=c.byteLength,"FontInfo.write: Buffer overflow at cssFontInfo"),u.set(new Uint8Array(r),h+4),h+=4+v}return e.data===void 0?(d.setUint32(h,0),h+=4):(d.setUint32(h,e.data.length),u.set(e.data,h+4),h+=4+e.data.length),un(h<=c.byteLength,"FontInfo.write: Buffer overflow"),c.transferTo
900FixedLength(h)}};O1=new WeakMap,I1=new WeakMap,D1=new WeakMap,L1=new WeakMap,il=new WeakMap,Nd=new WeakMap,qA=new WeakMap,Un=new WeakMap,es=new WeakSet,Kc=function(e){un(e<Wt.bools.length,"Invalid boolean index");const n=Math.floor(e/4),r=e*2%8,s=y(this,Un).getUint8(n)>>r&3;return s===0?void 0:s===2},eR=function(e){return un(e<Wt.numbers.length,"Invalid number index"),y(this,Un).getFloat64(y(Wt,O1)+e*8)},_N=function(e){un(e<Wt.strings.length,"Invalid string index");let n=y(Wt,il)+4;for(let i=0;i<e;i++)n+=y(this,Un).getUint32(n)+4;const r=y(this,Un).getUint32(n),s=new Uint8Array(r);return s.set(new Uint8Array(y(this,Nd),n+4,r)),y(this,qA).decode(s)},Te(Wt,"bools",["black","bold","disableFontFace","fontExtraProperties","isInvalidPDFjsFont","isType3Font","italic","missingFile","remeasure","vertical"]),Te(Wt,"numbers",["ascent","defaultWidth","descent"]),Te(Wt,"strings",["fallbackName","loadedName","mimetype","name"]),q(Wt,O1,Math.ceil(Wt.bools.length*2/8)),q(Wt,I1,y(Wt,O1)+Wt.numbers.length*8),q(Wt,D1,y(Wt,I1)+1+2*4),q(Wt,L1,y(Wt,D1)+1+8*6),q(Wt,il,y(Wt,L1)+1+2*3);let mU=Wt;var VA,HA;class Nl{static get workerPort(){return y(this,VA)}static set workerPort(e){if(!(typeof Worker<"u"&&e instanceof Worker)&&e!==null)throw new Error("Invalid `workerPort` type.");$(this,VA,e)}static get workerSrc(){return y(this,HA)}static set workerSrc(e){if(typeof e!="string")throw new Error("Invalid `workerSrc` type.");$(this,HA,e)}}VA=new WeakMap,HA=new WeakMap,q(Nl,VA,null),q(Nl,HA,"");var F1,WA;class qZe{constructor({parsedData:e,rawData:n}){q(this,F1);q(this,WA);$(this,F1,e),$(this,WA,n)}getRaw(){return y(this,WA)}get(e){return y(this,F1).get(e)??null}[Symbol.iterator](){return y(this,F1).entries()}}F1=new WeakMap,WA=new WeakMap;const Ib=Symbol("INTERNAL");var KA,GA,YA,$1;class VZe{constructor(e,{name:n,intent:r,usage:s,rbGroups:i}){q(this,KA,!1);q(this,GA,!1);q(this,YA,!1);q(this,$1,!0);$(this,KA,!!(e&yl.DISPLAY)),$(this,GA,!!(e&yl.PRINT)),this.name=n,this.intent=r,this.usage=s,this.rbGroups=i}get visible(){if(y(this,YA))return y(this,$1);if(!y(this,$1))return!1;const{print:e,view:n}=this.usage;return y(this,KA)?(n==null?void 0:n.viewState)!=="OFF":y(this,GA)?(e==null?void 0:e.printState)!=="OFF":!0}_setVisible(e,n,r=!1){e!==Ib&&Zn("Internal method `_setVisible` called."),$(this,YA,r),$(this,$1,n)}}KA=new WeakMap,GA=new WeakMap,YA=new WeakMap,$1=new WeakMap;var Om,qn,z1,B1,XA,gU;class HZe{constructor(e,n=yl.DISPLAY){q(this,XA);q(this,Om,null);q(this,qn,new Map);q(this,z1,null);q(this,B1,null);if(this.renderingIntent=n,this.name=null,this.creator=null,e!==null){this.name=e.name,this.creator=e.creator,$(this,B1,e.order);for(const r of e.groups)y(this,qn).set(r.id,new VZe(n,r));if(e.baseState==="OFF")for(const r of y(this,qn).values())r._setVisible(Ib,!1);for(const r of e.on)y(this,qn).get(r)._setVisible(Ib,!0);for(const r of e.off)y(this,qn).get(r)._setVisible(Ib,!1);$(this,z1,this.getHash())}}isVisible(e){if(y(this,qn).size===0)return!0;if(!e)return Y3("Optional content group not defined."),!0;if(e.type==="OCG")return y(this,qn).has(e.id)?y(this,qn).get(e.id).visible:(Ut(`Optional content group not found: ${e.id}`),!0);if(e.type==="OCMD"){if(e.expression)return V(this,XA,gU).call(this,e.expression);if(!e.policy||e.policy==="AnyOn"){for(const n of e.ids){if(!y(this,qn).has(n))return Ut(`Optional content group not found: ${n}`),!0;if(y(this,qn).get(n).visible)return!0}return!1}else if(e.policy==="AllOn"){for(const n of e.ids){if(!y(this,qn).has(n))return Ut(`Optional content group not found: ${n}`),!0;if(!y(this,qn).get(n).visible)return!1}return!0}else if(e.policy==="AnyOff"){for(const n of e.ids){if(!y(this,qn).has(n))return Ut(`Optional content group not found: ${n}`),!0;if(!y(this,qn).get(n).visible)return!0}return!1}else if(e.policy==="AllOff"){for(const n of e.ids){if(!y(this,qn).has(n))return Ut(`Optional content group not found: ${n}`),!0;if(y(this,qn).get(n).visible)return!1}return!0}return Ut(`Unknown optional content policy ${e.policy}.`),!0}return Ut(`Unknown group type ${e.type}.`),!0}setVisibility(e,n=!0,r=!0){var i;const s=y(this,qn).get(e);if(!s){Ut(`Optional content group not found: ${e}`);return}if(r&&n&&s.rbGroups.length)for(const o of s.rbGroups)for(const l of o)l!==e&&((i=y(this,qn).get(l))==null||i._setVisible(Ib,!1,!0));s._setVisible(Ib,!!n,!0),$(this,Om,null)}setOCGState({state:e,preserveRB:n}){let r;for(const s of e){switch(s){case"ON":case"OFF":case"Toggle":r=s;continue}const i=y(this,qn).get(s);if(i)switch(r){case"ON":this.setVisibility(s,!0,n);break;case"OFF":this.setVisibility(s,!1,n);break;case"Toggle":this.setVisibility(s,!i.visible,n);break}}$(this,Om,null)}get hasInitialVisibility(){return y(this,z1)===null||this.getHash()===y(this,z1)}getOrder(){return y(this,qn).size?y(this,B1)?y(this,B1).slice():[...y(this,qn).keys()]:null}getGroup(e){return y(this,qn).get(e)||null}getHash(){if(y(this,Om)!==null)return y(this,Om);const e=new jbe;for(const[n,r]of y(this,qn))e.update(`${n}:${r.visible}`);return $(this,Om,e.hexdigest())}[Symbol.iterator](){return y(this,qn).entries()}}Om=new WeakMap,qn=new WeakMap,z1=new WeakMap,B1=new WeakMap,XA=new WeakSet,gU=function(e){const n=e.length;if(n<2)return!0;const r=e[0];for(let s=1;s<n;s++){const i=e[s];let o;if(Array.isArray(i))o=V(this,XA,gU).call(this,i);else if(y(this,qn).has(i))o=y(this,qn).get(i).visible;else return Ut(`Optional content group not found: ${i}`),!0;switch(r){case"And":if(!o)return!1;break;case"Or":if(o)return!0;break;case"Not":return!o;default:return!0}}return r==="And"};class WZe{constructor(e,{disableRange:n=!1,disableStream:r=!1}){un(e,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:s,initialData:i,progressiveDone:o,contentDispositionFilename:l}=e;if(this._queuedChunks=[],this._progressiveDone=o,this._contentDispositionFilename=l,(i==null?void 0:i.length)>0){const c=i instanceof Uint8Array&&i.byteLength===i.buffer.byteLength?i.buffer:new Uint8Array(i).buffer;this._queuedChunks.push(c)}this._pdfDataRangeTransport=e,this._isStreamingSupported=!r,this._isRangeSupported=!n,this._contentLength=s,this._fullRequestReader=null,this._rangeReaders=[],e.addRangeListener((c,u)=>{this._onReceiveData({begin:c,chunk:u})}),e.addProgressListener((c,u)=>{this._onProgress({loaded:c,total:u})}),e.addProgressiveReadListener(c=>{this._onReceiveData({chunk:c})}),e.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),e.transportReady()}_onReceiveData({begin:e,chunk:n}){const r=n instanceof Uint8Array&&n.byteLength===n.buffer.byteLength?n.buffer:new Uint8Array(n).buffer;if(e===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(r):this._queuedChunks.push(r);else{const s=this._rangeReaders.some(function(i){return i._begin!==e?!1:(i._enqueue(r),!0)});un(s,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){var e;return((e=this._fullRequestReader)==null?void 0:e._loaded)??0}_onProgress(e){var n,r,s,i;e.total===void 0?(r=(n=this._rangeReaders[0])==null?void 0:n.onProgress)==null||r.call(n,{loaded:e.loaded}):(i=(s=this._fullRequestReader)==null?void 0:s.onProgress)==null||i.call(s,{loaded:e.loaded,total:e.total})}_onProgressiveDone(){var e;(e=this._fullRequestReader)==null||e.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(e){const n=this._rangeReaders.indexOf(e);n>=0&&this._rangeReaders.splice(n,1)}getFullReader(){un(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const e=this._queuedChunks;return this._queuedChunks=null,new KZe(this,e,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(e,n){if(n<=this._progressiveDataLength)return null;const r=new GZe(this,e,n);return this._pdfDataRangeTransport.requestDataRange(e,n),this._rangeReaders.push(r),r}cancelAllRequests(e){var n;(n=this._fullRequestReader)==null||n.cancel(e);for(const r of this._rangeReaders.slice(0))r.cancel(e);this._pdfDataRangeTransport.abort()}}class KZe{constructor(e,n,r=!1,s=null){this._stream=e,this._done=r||!1,this._filename=J3(s)?s:null,this._queuedChunks=n||[],this._loaded=0;for(const i of this._queuedChunks)this._loaded+=i.byteLength;
900this._requests=[],this._headersReady=Promise.resolve(),e._fullRequestReader=this,this.onProgress=null}_enqueue(e){this._done||(this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunks.push(e),this._loaded+=e.byteLength)}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const n of this._requests)n.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class GZe{constructor(e,n,r){this._stream=e,this._begin=n,this._end=r,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(e){if(!this._done){if(this._requests.length===0)this._queuedChunk=e;else{this._requests.shift().resolve({value:e,done:!1});for(const r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const n=this._queuedChunk;return this._queuedChunk=null,{value:n,done:!1}}if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const n of this._requests)n.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}function YZe(t){let e=!0,n=r("filename\\*","i").exec(t);if(n){n=n[1];let d=l(n);return d=unescape(d),d=c(d),d=u(d),i(d)}if(n=o(t),n){const d=u(n);return i(d)}if(n=r("filename","i").exec(t),n){n=n[1];let d=l(n);return d=u(d),i(d)}function r(d,h){return new RegExp("(?:^|;)\\s*"+d+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',h)}function s(d,h){if(d){if(!/^[\x00-\xFF]+$/.test(h))return h;try{const f=new TextDecoder(d,{fatal:!0}),p=S2(h);h=f.decode(p),e=!1}catch{}}return h}function i(d){return e&&/[\x80-\xff]/.test(d)&&(d=s("utf-8",d),e&&(d=s("iso-8859-1",d))),d}function o(d){const h=[];let f;const p=r("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(f=p.exec(d))!==null;){let[,v,x,g]=f;if(v=parseInt(v,10),v in h){if(v===0)break;continue}h[v]=[x,g]}const m=[];for(let v=0;v<h.length&&v in h;++v){let[x,g]=h[v];g=l(g),x&&(g=unescape(g),v===0&&(g=c(g))),m.push(g)}return m.join("")}function l(d){if(d.startsWith('"')){const h=d.slice(1).split('\\"');for(let f=0;f<h.length;++f){const p=h[f].indexOf('"');p!==-1&&(h[f]=h[f].slice(0,p),h.length=f+1),h[f]=h[f].replaceAll(/\\(.)/g,"$1")}d=h.join('"')}return d}function c(d){const h=d.indexOf("'");if(h===-1)return d;const f=d.slice(0,h),m=d.slice(h+1).replace(/^[^']*'/,"");return s(f,m)}function u(d){return!d.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(d)?d:d.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(h,f,p,m){if(p==="q"||p==="Q")return m=m.replaceAll("_"," "),m=m.replaceAll(/=([0-9a-fA-F]{2})/g,function(v,x){return String.fromCharCode(parseInt(x,16))}),s(f,m);try{m=atob(m)}catch{}return s(f,m)})}return""}function Dbe(t,e){const n=new Headers;if(!t||!e||typeof e!="object")return n;for(const r in e){const s=e[r];s!==void 0&&n.append(r,s)}return n}function Q3(t){var e;return((e=URL.parse(t))==null?void 0:e.origin)??null}function Lbe({responseHeaders:t,isHttp:e,rangeChunkSize:n,disableRange:r}){const s={allowRangeRequests:!1,suggestedLength:void 0},i=parseInt(t.get("Content-Length"),10);return!Number.isInteger(i)||(s.suggestedLength=i,i<=2*n)||r||!e||t.get("Accept-Ranges")!=="bytes"||(t.get("Content-Encoding")||"identity")!=="identity"||(s.allowRangeRequests=!0),s}function Fbe(t){const e=t.get("Content-Disposition");if(e){let n=YZe(e);if(n.includes("%"))try{n=decodeURIComponent(n)}catch{}if(J3(n))return n}return null}
900function A2(t,e){return new Sk(`Unexpected server response (${t}) while retrieving PDF "${e}".`,t,t===404||t===0&&e.startsWith("file:"))}function $be(t){return t===200||t===206}function zbe(t,e,n){return{method:"GET",headers:t,signal:n.signal,mode:"cors",credentials:e?"include":"same-origin",redirect:"follow"}}function Bbe(t){return t instanceof Uint8Array?t.buffer:t instanceof ArrayBuffer?t:(Ut(`getArrayBuffer - unexpected data format: ${t}`),new Uint8Array(t).buffer)}class XZe{constructor(e){Te(this,"_responseOrigin",null);this.source=e,this.isHttp=/^https?:/i.test(e.url),this.headers=Dbe(this.isHttp,e.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var e;return((e=this._fullRequestReader)==null?void 0:e._loaded)??0}getFullReader(){return un(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new JZe(this),this._fullRequestReader}getRangeReader(e,n){if(n<=this._progressiveDataLength)return null;const r=new QZe(this,e,n);return this._rangeRequestReaders.push(r),r}cancelAllRequests(e){var n;(n=this._fullRequestReader)==null||n.cancel(e);for(const r of this._rangeRequestReaders.slice(0))r.cancel(e)}}class JZe{constructor(e){this._stream=e,this._reader=null,this._loaded=0,this._filename=null;const n=e.source;this._withCredentials=n.withCredentials||!1,this._contentLength=n.length,this._headersCapability=Promise.withResolvers(),this._disableRange=n.disableRange||!1,this._rangeChunkSize=n.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!n.disableStream,this._isRangeSupported=!n.disableRange;const r=new Headers(e.headers),s=n.url;fetch(s,zbe(r,this._withCredentials,this._abortController)).then(i=>{if(e._responseOrigin=Q3(i.url),!$be(i.status))throw A2(i.status,s);this._reader=i.body.getReader(),this._headersCapability.resolve();const o=i.headers,{allowRangeRequests:l,suggestedLength:c}=Lbe({responseHeaders:o,isHttp:e.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=l,this._contentLength=c||this._contentLength,this._filename=Fbe(o),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new ep("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){var r;await this._headersCapability.promise;const{value:e,done:n}=await this._reader.read();return n?{value:e,done:n}:(this._loaded+=e.byteLength,(r=this.onProgress)==null||r.call(this,{loaded:this._loaded,total:this._contentLength}),{value:Bbe(e),done:!1})}cancel(e){var n;(n=this._reader)==null||n.cancel(e),this._abortController.abort()}}class QZe{constructor(e,n,r){this._stream=e,this._reader=null,this._loaded=0;const s=e.source;this._withCredentials=s.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!s.disableStream,this._abortController=new AbortController;const i=new Headers(e.headers);i.append("Range",`bytes=${n}-${r-1}`);const o=s.url;fetch(o,zbe(i,this._withCredentials,this._abortController)).then(l=>{const c=Q3(l.url);if(c!==e._responseOrigin)throw new Error(`Expected range response-origin "${c}" to match "${e._responseOrigin}".`);if(!$be(l.status))throw A2(l.status,o);this._readCapability.resolve(),this._reader=l.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){var r;await this._readCapability.promise;const{value:e,done:n}=await this._reader.read();return n?{value:e,done:n}:(this._loaded+=e.byteLength,(r=this.onProgress)==null||r.call(this,{loaded:this._loaded}),{value:Bbe(e),done:!1})}cancel(e){var n;(n=this._reader)==null||n.cancel(e),this._abortController.abort()}}const P5=200,M5=206;function ZZe(t){const e=t.response;return typeof e!="string"?e:S2(e).buffer}class eet{constructor({url:e,httpHeaders:n,withCredentials:r}){Te(this,"_responseOrigin",null);this.url=e,this.isHttp=/^https?:/i.test(e),this.headers=Dbe(this.isHttp,n),this.withCredentials=r||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}request(e){const n=new XMLHttpRequest,r=this.currXhrId++,s=this.pendingRequests[r]={x
900hr:n};n.open("GET",this.url),n.withCredentials=this.withCredentials;for(const[i,o]of this.headers)n.setRequestHeader(i,o);return this.isHttp&&"begin"in e&&"end"in e?(n.setRequestHeader("Range",`bytes=${e.begin}-${e.end-1}`),s.expectedStatus=M5):s.expectedStatus=P5,n.responseType="arraybuffer",un(e.onError,"Expected `onError` callback to be provided."),n.onerror=()=>{e.onError(n.status)},n.onreadystatechange=this.onStateChange.bind(this,r),n.onprogress=this.onProgress.bind(this,r),s.onHeadersReceived=e.onHeadersReceived,s.onDone=e.onDone,s.onError=e.onError,s.onProgress=e.onProgress,n.send(null),r}onProgress(e,n){var s;const r=this.pendingRequests[e];r&&((s=r.onProgress)==null||s.call(r,n))}onStateChange(e,n){const r=this.pendingRequests[e];if(!r)return;const s=r.xhr;if(s.readyState>=2&&r.onHeadersReceived&&(r.onHeadersReceived(),delete r.onHeadersReceived),s.readyState!==4||!(e in this.pendingRequests))return;if(delete this.pendingRequests[e],s.status===0&&this.isHttp){r.onError(s.status);return}const i=s.status||P5;if(!(i===P5&&r.expectedStatus===M5)&&i!==r.expectedStatus){r.onError(s.status);return}const l=ZZe(s);if(i===M5){const c=s.getResponseHeader("Content-Range"),u=/bytes (\d+)-(\d+)\/(\d+)/.exec(c);u?r.onDone({begin:parseInt(u[1],10),chunk:l}):(Ut('Missing or invalid "Content-Range" header.'),r.onError(0))}else l?r.onDone({begin:0,chunk:l}):r.onError(s.status)}getRequestXhr(e){return this.pendingRequests[e].xhr}isPendingRequest(e){return e in this.pendingRequests}abortRequest(e){const n=this.pendingRequests[e].xhr;delete this.pendingRequests[e],n.abort()}}class tet{constructor(e){this._source=e,this._manager=new eet(e),this._rangeChunkSize=e.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(e){const n=this._rangeRequestReaders.indexOf(e);n>=0&&this._rangeRequestReaders.splice(n,1)}getFullReader(){return un(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new net(this._manager,this._source),this._fullRequestReader}getRangeReader(e,n){const r=new ret(this._manager,e,n);return r.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(r),r}cancelAllRequests(e){var n;(n=this._fullRequestReader)==null||n.cancel(e);for(const r of this._rangeRequestReaders.slice(0))r.cancel(e)}}class net{constructor(e,n){this._manager=e,this._url=n.url,this._fullRequestId=e.request({onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._headersCapability=Promise.withResolvers(),this._disableRange=n.disableRange||!1,this._contentLength=n.length,this._rangeChunkSize=n.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){const e=this._fullRequestId,n=this._manager.getRequestXhr(e);this._manager._responseOrigin=Q3(n.responseURL);const r=n.getAllResponseHeaders(),s=new Headers(r?r.trimStart().replace(/[^\S ]+$/,"").split(/[\r\n]+/).map(l=>{const[c,...u]=l.split(": ");return[c,u.join(": ")]}):[]),{allowRangeRequests:i,suggestedLength:o}=Lbe({responseHeaders:s,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});i&&(this._isRangeSupported=!0),this._contentLength=o||this._contentLength,this._filename=Fbe(s),this._isRangeSupported&&this._manager.abortRequest(e),this._headersCapability.resolve()}_onDone(e){if(e&&(this._requests.length>0?this._requests.shift().resolve({value:e.chunk,done:!1}):this._cachedChunks.push(e.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const n of this._requests)n.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(e){this._storedError=A2(e,this._url),this._headersCapability.reject(this._storedError);for(const n of this._requests)n.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(e){var n;(n=this.onProgress)==null||n.call(this,{loaded:e.loaded,total:e.lengthComputable?e.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersCapability.promise}async read(){if(await this._headersCapability.promise,this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this._headersCapability.reject(e);for(const n of this._requests)n.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest
900(this._fullRequestId),this._fullRequestReader=null}}class ret{constructor(e,n,r){this._manager=e,this._url=e.url,this._requestId=e.request({begin:n,end:r,onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_onHeadersReceived(){var n;const e=Q3((n=this._manager.getRequestXhr(this._requestId))==null?void 0:n.responseURL);e!==this._manager._responseOrigin&&(this._storedError=new Error(`Expected range response-origin "${e}" to match "${this._manager._responseOrigin}".`),this._onError(0))}_close(){var e;(e=this.onClosed)==null||e.call(this,this)}_onDone(e){const n=e.chunk;this._requests.length>0?this._requests.shift().resolve({value:n,done:!1}):this._queuedChunk=n,this._done=!0;for(const r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(e){this._storedError??(this._storedError=A2(e,this._url));for(const n of this._requests)n.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(e){var n;this.isStreamingSupported||(n=this.onProgress)==null||n.call(this,{loaded:e.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const n=this._queuedChunk;return this._queuedChunk=null,{value:n,done:!1}}if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const n of this._requests)n.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}const set=/^[a-z][a-z0-9\-+.]+:/i;function iet(t){if(set.test(t))return new URL(t);const e=process.getBuiltinModule("url");return new URL(e.pathToFileURL(t))}class aet{constructor(e){this.source=e,this.url=iet(e.url),un(this.url.protocol==="file:","PDFNodeStream only supports file:// URLs."),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var e;return((e=this._fullRequestReader)==null?void 0:e._loaded)??0}getFullReader(){return un(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=new oet(this),this._fullRequestReader}getRangeReader(e,n){if(n<=this._progressiveDataLength)return null;const r=new cet(this,e,n);return this._rangeRequestReaders.push(r),r}cancelAllRequests(e){var n;(n=this._fullRequestReader)==null||n.cancel(e);for(const r of this._rangeRequestReaders.slice(0))r.cancel(e)}}class oet{constructor(e){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null;const n=e.source;this._contentLength=n.length,this._loaded=0,this._filename=null,this._disableRange=n.disableRange||!1,this._rangeChunkSize=n.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!n.disableStream,this._isRangeSupported=!n.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers();const r=process.getBuiltinModule("fs");r.promises.lstat(this._url).then(s=>{this._contentLength=s.size,this._setReadableStream(r.createReadStream(this._url)),this._headersCapability.resolve()},s=>{s.code==="ENOENT"&&(s=A2(0,this._url.href)),this._storedError=s,this._headersCapability.reject(s)})}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){var r;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();return e===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=e.length,(r=this.onProgress)==null||r.call(this,{loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(e).buffer,done:!1})}cancel(e){if(!this._readableStream){this._error(e);return}this._readableStream.destroy(e)}_error(e){this._storedError=e,this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e,e.on("readable",()=>{this._readCapability.resolve()}),e.on("end",()=>{e.destroy(),this._done=!0,this._readCapability.resolve()}),e.on("error",n=>{this._error(n)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new ep("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class cet{constructor(e,n,r){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const s=e.source;this._isStreamingSupported=!s.disableStream;const i=process.getBuiltinModule("fs");this._setReadableStream(i.createReadStream(this._url,{start:n,end:r-1}))}get isStreamingSupported(){return this._isStreamingSupported}async read(){var r;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();return e===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=e.length,(r=this.onProgress)==null||r.call(this,{loaded:this._loaded}),{value:new Uint8Array(e).buffer,done:!1})}cancel(e){if(!this._readableStream){this._error(e);return}this._readableStream.destroy(e)}_error(e){this._storedError=e,this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e,e.on("readable",()=>{this._readCapability.resolve()}),e.on("end",()=>{e.destroy(),this._done=!0,this._readCapability.resolve()}),e.on("error",n=>{this._error(n)}),this._storedError&&this._readableStream.destroy(this._storedError)}}const kS=Symbol("INITIAL_DATA");var al,JA,vU;class Ube{constructor(){q(this,JA);q(this,al,Object.create(null))}get(e,n=null){if(n){const s=V(this,JA,vU).call(this,e);return s.promise.then(()=>n(s.data)),null}const r=y(this,al)[e];if(!r||r.data===kS)throw new Error(`Requesting object that isn't resolved yet ${e}.`);return r.data}has(e){const n=y(this,al)[e];return!!n&&n.data!==kS}delete(e){const n=y(this,al)[e];
900return!n||n.data===kS?!1:(delete y(this,al)[e],!0)}resolve(e,n=null){const r=V(this,JA,vU).call(this,e);r.data=n,r.resolve()}clear(){var e;for(const n in y(this,al)){const{data:r}=y(this,al)[n];(e=r==null?void 0:r.bitmap)==null||e.close()}$(this,al,Object.create(null))}*[Symbol.iterator](){for(const e in y(this,al)){const{data:n}=y(this,al)[e];n!==kS&&(yield[e,n])}}}al=new WeakMap,JA=new WeakSet,vU=function(e){var n;return(n=y(this,al))[e]||(n[e]={...Promise.withResolvers(),data:kS})};const uet=1e5,Ute=30;var $ce,Im,Ro,QA,ZA,Xx,mf,eE,tE,Jx,U1,q1,Dm,V1,nE,H1,Qx,rE,sE,Qr,W1,Zx,iE,Lm,K1,lp,qbe,Vbe,xU,Il,tR,yU,Hbe,Wbe;let Ak=(Qr=class{constructor({textContentSource:e,container:n,viewport:r}){q(this,lp);q(this,Im,Promise.withResolvers());q(this,Ro,null);q(this,QA,!1);q(this,ZA,!!(($ce=globalThis.FontInspector)!=null&&$ce.enabled));q(this,Xx,null);q(this,mf,null);q(this,eE,0);q(this,tE,0);q(this,Jx,null);q(this,U1,null);q(this,q1,0);q(this,Dm,0);q(this,V1,Object.create(null));q(this,nE,[]);q(this,H1,null);q(this,Qx,[]);q(this,rE,new WeakMap);q(this,sE,null);var c;if(e instanceof ReadableStream)$(this,H1,e);else if(typeof e=="object")$(this,H1,new ReadableStream({start(u){u.enqueue(e),u.close()}}));else throw new Error('No "textContentSource" parameter specified.');$(this,Ro,$(this,U1,n)),$(this,Dm,r.scale*$u.pixelRatio),$(this,q1,r.rotation),$(this,mf,{div:null,properties:null,ctx:null});const{pageWidth:s,pageHeight:i,pageX:o,pageY:l}=r.rawDims;$(this,sE,[1,0,0,-1,-o,l+i]),$(this,tE,s),$(this,eE,i),V(c=Qr,Il,Hbe).call(c),$g(n,r),y(this,Im).promise.finally(()=>{y(Qr,K1).delete(this),$(this,mf,null),$(this,V1,null)}).catch(()=>{})}static get fontFamilyMap(){const{isWindows:e,isFirefox:n}=yi.platform;return Gt(this,"fontFamilyMap",new Map([["sans-serif",`${e&&n?"Calibri, ":""}sans-serif`],["monospace",`${e&&n?"Lucida Console, ":""}monospace`]]))}render(){const e=()=>{y(this,Jx).read().then(({value:n,done:r})=>{if(r){y(this,Im).resolve();return}y(this,Xx)??$(this,Xx,n.lang),Object.assign(y(this,V1),n.styles),V(this,lp,qbe).call(this,n.items),e()},y(this,Im).reject)};return $(this,Jx,y(this,H1).getReader()),y(Qr,K1).add(this),e(),y(this,Im).promise}update({viewport:e,onBefore:n=null}){var i;const r=e.scale*$u.pixelRatio,s=e.rotation;if(s!==y(this,q1)&&(n==null||n(),$(this,q1,s),$g(y(this,U1),{rotation:s})),r!==y(this,Dm)){n==null||n(),$(this,Dm,r);const o={div:null,properties:null,ctx:V(i=Qr,Il,tR).call(i,y(this,Xx))};for(const l of y(this,Qx))o.properties=y(this,rE).get(l),o.div=l,V(this,lp,xU).call(this,o)}}cancel(){var n;const e=new ep("TextLayer task cancelled.");(n=y(this,Jx))==null||n.cancel(e).catch(()=>{}),$(this,Jx,null),y(this,Im).reject(e)}get textDivs(){return y(this,Qx)}get textContentItemsStr(){return y(this,nE)}static cleanup(){if(!(y(this,K1).size>0)){y(this,W1).clear();for(const{canvas:e}of y(this,Zx).values())e.remove();y(this,Zx).clear()}}},Im=new WeakMap,Ro=new WeakMap,QA=new WeakMap,ZA=new WeakMap,Xx=new WeakMap,mf=new WeakMap,eE=new WeakMap,tE=new WeakMap,Jx=new WeakMap,U1=new WeakMap,q1=new WeakMap,Dm=new WeakMap,V1=new WeakMap,nE=new WeakMap,H1=new WeakMap,Qx=new WeakMap,rE=new WeakMap,sE=new WeakMap,W1=new WeakMap,Zx=new WeakMap,iE=new WeakMap,Lm=new WeakMap,K1=new WeakMap,lp=new WeakSet,qbe=function(e){var s,i;if(y(this,QA))return;(i=y(this,mf)).ctx??(i.ctx=V(s=Qr,Il,tR).call(s,y(this,Xx)));const n=y(this,Qx),r=y(this,nE);for(const o of e){if(n.length>uet){Ut("Ignoring additional textDivs for performance reasons."),$(this,QA,!0);return}if(o.str===void 0){if(o.type==="beginMarkedContentProps"||o.type==="beginMarkedContent"){const l=y(this,Ro);$(this,Ro,document.createElement("span")),y(this,Ro).classList.add("markedContent"),o.id&&y(this,Ro).setAttribute("id",`${o.id}`),l.append(y(this,Ro))}else o.type==="endMarkedContent"&&$(this,Ro,y(this,Ro).parentNode);continue}r.push(o.str),V(this,lp,Vbe).call(this,o)}},Vbe=function(e){var v;const n=document.createElement("span"),r={angle:0,canvasWidth:0,hasText:e.str!=="",hasEOL:e.hasEOL,fontSize:0};y(this,Qx).push(n);const s=ot.transform(y(this,sE),e.transform);let i=Math.atan2(s[1],s[0]);const o=y(this,V1)[e.fontName];o.vertical&&(i+=Math.PI/2);let l=y(this,ZA)&&o.fontSubstitution||o.fontFamily;l=Qr.fontFamilyMap.get(l)||l;const c=Math.hypot(s[2],s[3]),u=c*V(v=Qr,Il,Wbe).call(v,l,o,y(this,Xx));let d,h;i===0?(d=s[4],h=s[5]-u):(d=s[4]+u*Math.sin(i),h=s[5]-u*Math.cos(i));const f="calc(var(--total-scale-factor) *",p=n.style;y(this,Ro)===y(this,U1)?(p.left=`${(100*d/y(this,tE)).toFixed(2)}%`,p.top=`${(100*h/y(this,eE)).toFixed(2)}%`):(p.left=`${f}${d.toFixed(2)}px)`,p.top=`${f}${h.toFixed(2)}px)`),p.fontSize=`${f}${(y(Qr,Lm)*c).toFixed(2)}px)`,p.fontFamily=l,r.fontSize=c,n.setAttribute("role","presentation"),n.textContent=e.str,n.dir=e.dir,y(this,ZA)&&(n.dataset.fontName=o.fontSubstitutionLoadedName||e.fontName),i!==0&&(r.angle=i*(180/Math.PI));let m=!1;if(e.str.length>1)m=!0;else if(e.str!==" "&&e.transform[0]!==e.transform[3]){const x=Math.abs(e.transform[0]),g=Math.abs(e.transform[3]);x!==g&&Math.max(x,g)/Math.min(x,g)>1.5&&(m=!0)}if(m&&(r.canvasWidth=o.vertical?e.height:e.width),y(this,rE).set(n,r),y(this,mf).div=n,y(this,mf).properties=r,V(this,lp,xU).call(this,y(this,mf)),r.hasText&&y(this,Ro).append(n),r.hasEOL){const x=document.createElement("br");x.setAttribute("role","presentation"),y(this,Ro).append(x)}},xU=function(e){var l;const{div:n,properties:r,ctx:s}=e,{style:i}=n;let o="";if(y(Qr,Lm)>1&&(o=`scale(${1/y(Qr,Lm)})`),r.canvasWidth!==0&&r.hasText){const{fontFamily:c}=i,{canvasWidth:u,fontSize:d}=r;V(l=Qr,Il,yU).call(l,s,d*y(this,Dm),c);const{width:h}=s.measureText(n.textContent);h>0&&(o=`scaleX(${u*y(this,Dm)/h}) ${o}`)}r.angle!==0&&(o=`rotate(${r.angle}deg) ${o}`),o.length>0&&(i.transform=o)},Il=new WeakSet,tR=function(e=null){let n=y(this,Zx).get(e||(e=""));if(!n){const r=document.createElement("canvas");r.className="hiddenCanvasElement",r.lang=e,document.body.append(r),n=r.getContext("2d",{alpha:!1,willReadFrequently:!0}),y(this,Zx).set(e,n),y(this,iE).set(n,{size:0,family:""})}return n},yU=function(e,n,r){const s=y(this,iE).get(e);n===s.size&&r===s.family||(e.font=`${n}px ${r}`,s.size=n,s.family=r)},Hbe=function(){if(y(this,Lm)!==null)return;const e=document.createElement("div");e.style.opacity=0,e.style.lineHeight=1,e.style.fontSize="1px",e.style.position="absolute",e.textContent="X",document.body.append(e),$(this,Lm,e.getBoundingClientRect().height),e.remove()},Wbe=function(e,n,r){const s=y(this,W1).get(e);if(s)return s;const i=V(this,Il,tR).call(this,r);i.canvas.width=i.canvas.height=Ute,V(this,Il,yU).call(this,i,Ute,e);const o=i.measureText(""),l=o.fontBoundingBoxAscent,c=Math.abs(o.fontBoundingBoxDescent);i.canvas.width=i.canvas.height=0;let u=.8;return l?u=l/(l+c):(yi.platform.isFirefox&&Ut("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering."),n.ascent?u=n.ascent:n.descent&&(u=1+n.descent)),y(this,W1).set(e,u),u},q(Qr,Il),q(Qr,W1,new Map),q(Qr,Zx,new Map),q(Qr,iE,new WeakMap),q(Qr,Lm,null),q(Qr,K1,new Set),Qr);const det=100;function T7(t={}){typeof t=="string"||t instanceof URL?t={url:t}:(t instanceof ArrayBuffer||ArrayBuffer.isView(t))&&(t={data:t});const e=new bU,{docId:n}=e,r=t.url?xZe(t.url):null,s=t.data?yZe(t.data):null,i=t.httpHeaders||null,o=t.withCredentials===!0,l=t.password??null,c=t.range instanceof P7?t.range:null,u=Number.isInteger(t.rangeChunkSize)&&t.rangeChunkSize>0?t.rangeChunkSize:2**16;let d=t.worker instanceof X_?t.worker:null;const h=t.verbosity,f=typeof t.docBaseUrl=="string"&&!C2(t.docBaseUrl)?t.docBaseUrl:null,p=dP(t.cMapUrl),m=t.cMapPacked!==!1,v=t.CMapReaderFactory||(Za?CZe:Ate),x=dP(t.iccUrl),g=dP(t.standardFontDataUrl),w=t.StandardFontDataFactory||(Za?kZe:Ete),_=dP(t.wasmUrl),j=t.WasmFactory||(Za?AZe:Tte),N=t.stopAtErrors!==!0,S=Number.isInteger(t.maxImageSize)&&t.maxImageSize>-1?t.maxImageSize:-1,C=t.isEvalSupported!==!1,k=typeof t.isOffscreenCanvasSupported=="boolean"?t.isOffscreenCanvasSupported:!Za,E=typeof t.isImageDecoderSupported=="boolean"?t.isImageDecoderSupported:!Za&&(yi.platform.isFirefox||!globalThis.chrome),P=Number.isInteger(t.canvasMaxAreaInBytes)?t.canvasMaxAreaInBytes:-1,T=typeof t.disableFontFace=="boolean"?t.disableFontFace:Za,M=t.fontE
900xtraProperties===!0,R=t.enableXfa===!0,A=t.ownerDocument||globalThis.document,I=t.disableRange===!0,D=t.disableStream===!0,O=t.disableAutoFetch===!0,z=t.pdfBug===!0,B=t.CanvasFactory||(Za?NZe:_Ze),G=t.FilterFactory||(Za?SZe:jZe),U=t.enableHWA===!0,F=t.useWasm!==!1,W=c?c.length:t.length??NaN,Q=typeof t.useSystemFonts=="boolean"?t.useSystemFonts:!Za&&!T,K=typeof t.useWorkerFetch=="boolean"?t.useWorkerFetch:!!(v===Ate&&w===Ete&&j===Tte&&p&&g&&_&&uN(p,document.baseURI)&&uN(g,document.baseURI)&&uN(_,document.baseURI)),fe=null;QQe(h);const oe={canvasFactory:new B({ownerDocument:A,enableHWA:U}),filterFactory:new G({docId:n,ownerDocument:A}),cMapReaderFactory:K?null:new v({baseUrl:p,isCompressed:m}),standardFontDataFactory:K?null:new w({baseUrl:g}),wasmFactory:K?null:new j({baseUrl:_})};d||(d=X_.create({verbosity:h,port:Nl.workerPort}),e._worker=d);const ye={docId:n,apiVersion:"5.4.296",data:s,password:l,disableAutoFetch:O,rangeChunkSize:u,length:W,docBaseUrl:f,enableXfa:R,evaluatorOptions:{maxImageSize:S,disableFontFace:T,ignoreErrors:N,isEvalSupported:C,isOffscreenCanvasSupported:k,isImageDecoderSupported:E,canvasMaxAreaInBytes:P,fontExtraProperties:M,useSystemFonts:Q,useWasm:F,useWorkerFetch:K,cMapUrl:p,iccUrl:x,standardFontDataUrl:g,wasmUrl:_}},le={ownerDocument:A,pdfBug:z,styleElement:fe,loadingParams:{disableAutoFetch:O,enableXfa:R}};return d.promise.then(function(){if(e.destroyed)throw new Error("Loading aborted");if(d.destroyed)throw new Error("Worker was destroyed");const me=d.messageHandler.sendWithPromise("GetDocRequest",ye,s?[s.buffer]:null);let he;if(c)he=new WZe(c,{disableRange:I,disableStream:D});else if(!s){if(!r)throw new Error("getDocument - no `url` parameter provided.");const ae=uN(r)?XZe:Za?aet:tet;he=new ae({url:r,length:W,httpHeaders:i,withCredentials:o,rangeChunkSize:u,disableRange:I,disableStream:D})}return me.then(ae=>{if(e.destroyed)throw new Error("Loading aborted");if(d.destroyed)throw new Error("Worker was destroyed");const re=new gN(n,ae,d.port),L=new pet(re,e,he,le,oe,U);e._transport=L,re.send("Ready",null)})}).catch(e._capability.reject),e}var gL;const vL=class vL{constructor(){Te(this,"_capability",Promise.withResolvers());Te(this,"_transport",null);Te(this,"_worker",null);Te(this,"docId",`d${Vr(vL,gL)._++}`);Te(this,"destroyed",!1);Te(this,"onPassword",null);Te(this,"onProgress",null)}get promise(){return this._capability.promise}async destroy(){var e,n,r,s;this.destroyed=!0;try{(e=this._worker)!=null&&e.port&&(this._worker._pendingDestroy=!0),await((n=this._transport)==null?void 0:n.destroy())}catch(i){throw(r=this._worker)!=null&&r.port&&delete this._worker._pendingDestroy,i}this._transport=null,(s=this._worker)==null||s.destroy(),this._worker=null}async getData(){return this._transport.getData()}};gL=new WeakMap,q(vL,gL,0);let bU=vL;var ey,aE,oE,lE,cE,zce;let P7=(zce=class{constructor(e,n,r=!1,s=null){q(this,ey,Promise.withResolvers());q(this,aE,[]);q(this,oE,[]);q(this,lE,[]);q(this,cE,[]);this.length=e,this.initialData=n,this.progressiveDone=r,this.contentDispositionFilename=s}addRangeListener(e){y(this,cE).push(e)}addProgressListener(e){y(this,lE).push(e)}addProgressiveReadListener(e){y(this,oE).push(e)}addProgressiveDoneListener(e){y(this,aE).push(e)}onDataRange(e,n){for(const r of y(this,cE))r(e,n)}onDataProgress(e,n){y(this,ey).promise.then(()=>{for(const r of y(this,lE))r(e,n)})}onDataProgressiveRead(e){y(this,ey).promise.then(()=>{for(const n of y(this,oE))n(e)})}onDataProgressiveDone(){y(this,ey).promise.then(()=>{for(const e of y(this,aE))e()})}transportReady(){y(this,ey).resolve()}requestDataRange(e,n){Zn("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}},ey=new WeakMap,aE=new WeakMap,oE=new WeakMap,lE=new WeakMap,cE=new WeakMap,zce);class het{constructor(e,n){this._pdfInfo=e,this._transport=n}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return Gt(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(e){return this._transport.getPage(e)}getPageIndex(e){return this._transport.getPageIndex(e)}
900getDestinations(){return this._transport.getDestinations()}getDestination(e){return this._transport.getDestination(e)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getAnnotationsByType(e,n){return this._transport.getAnnotationsByType(e,n)}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:e="display"}={}){const{renderingIntent:n}=this._transport.getRenderingIntent(e);return this._transport.getOptionalContentConfig(n)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(e=!1){return this._transport.startCleanup(e||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(e){return this._transport.cachedPageNumber(e)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}var gf,ty,jN;class fet{constructor(e,n,r,s=!1){q(this,ty);q(this,gf,!1);this._pageIndex=e,this._pageInfo=n,this._transport=r,this._stats=s?new wte:null,this._pdfBug=s,this.commonObjs=r.commonObjs,this.objs=new Ube,this._intentStates=new Map,this.destroyed=!1,this.recordedBBoxes=null}get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:e,rotation:n=this.rotate,offsetX:r=0,offsetY:s=0,dontFlip:i=!1}={}){return new N2({viewBox:this.view,userUnit:this.userUnit,scale:e,rotation:n,offsetX:r,offsetY:s,dontFlip:i})}getAnnotations({intent:e="display"}={}){const{renderingIntent:n}=this._transport.getRenderingIntent(e);return this._transport.getAnnotations(this._pageIndex,n)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return Gt(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){var e;return((e=this._transport._htmlForXfa)==null?void 0:e.children[this._pageIndex])||null}render({canvasContext:e,canvas:n=e.canvas,viewport:r,intent:s="display",annotationMode:i=Ud.ENABLE,transform:o=null,background:l=null,optionalContentConfigPromise:c=null,annotationCanvasMap:u=null,pageColors:d=null,printAnnotationStorage:h=null,isEditing:f=!1,recordOperations:p=!1,operationsFilter:m=null}){var E,P,T;(E=this._stats)==null||E.time("Overall");const v=this._transport.getRenderingIntent(s,i,h,f),{renderingIntent:x,cacheKey:g}=v;$(this,gf,!1),c||(c=this._transport.getOptionalContentConfig(x));let w=this._intentStates.get(g);w||(w=Object.create(null),this._intentStates.set(g,w)),w.streamReaderCancelTimeout&&(clearTimeout(w.streamReaderCancelTimeout),w.streamReaderCancelTimeout=null);const _=!!(x&yl.PRINT);w.displayReadyCapability||(w.displayReadyCapability=Promise.withResolvers(),w.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(P=this._stats)==null||P.time("Page Request"),this._pumpOperatorList(v));const j=!!(this._pdfBug&&((T=globalThis.StepperManager)!=null&&T.enabled)),N=!this.recordedBBoxes&&(p||j),S=M=>{var R,A;if(w.renderTasks.delete(C),N){const I=(R=C.gfx)==null?void 0:R.dependencyTracker.take();I&&(C.stepper&&C.stepper.setOperatorBBoxes(I,C.gfx.dependencyTracker.takeDebugMetadata()),p&&(this.recordedBBoxes=I))}_&&$(this,gf,!0),V(this,ty,jN).call(this),M?(C.capability.reject(M),this._abortOperatorList({intentState:w,reason:M instanceof Error?M:new Error(M)})):C.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),(A=globalThis.Stats)!=null&&A.enabled&&globalThis.Stats.add(this.pageNumber,this._stats)
900)},C=new wU({callback:S,params:{canvas:n,canvasContext:e,dependencyTracker:N?new TZe(n,w.operatorList.length,j):null,viewport:r,transform:o,background:l},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:u,operatorList:w.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!_,pdfBug:this._pdfBug,pageColors:d,enableHWA:this._transport.enableHWA,operationsFilter:m});(w.renderTasks||(w.renderTasks=new Set)).add(C);const k=C.task;return Promise.all([w.displayReadyCapability.promise,c]).then(([M,R])=>{var A;if(this.destroyed){S();return}if((A=this._stats)==null||A.time("Rendering"),!(R.renderingIntent&x))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");C.initializeGraphics({transparency:M,optionalContentConfig:R}),C.operatorListChanged()}).catch(S),k}getOperatorList({intent:e="display",annotationMode:n=Ud.ENABLE,printAnnotationStorage:r=null,isEditing:s=!1}={}){var u;function i(){l.operatorList.lastChunk&&(l.opListReadCapability.resolve(l.operatorList),l.renderTasks.delete(c))}const o=this._transport.getRenderingIntent(e,n,r,s,!0);let l=this._intentStates.get(o.cacheKey);l||(l=Object.create(null),this._intentStates.set(o.cacheKey,l));let c;return l.opListReadCapability||(c=Object.create(null),c.operatorListChanged=i,l.opListReadCapability=Promise.withResolvers(),(l.renderTasks||(l.renderTasks=new Set)).add(c),l.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(u=this._stats)==null||u.time("Page Request"),this._pumpOperatorList(o)),l.opListReadCapability.promise}streamTextContent({includeMarkedContent:e=!1,disableNormalization:n=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:e===!0,disableNormalization:n===!0},{highWaterMark:100,size(s){return s.items.length}})}getTextContent(e={}){if(this._transport._htmlForXfa)return this.getXfa().then(r=>Nk.textContent(r));const n=this.streamTextContent(e);return new Promise(function(r,s){function i(){o.read().then(function({value:c,done:u}){if(u){r(l);return}l.lang??(l.lang=c.lang),Object.assign(l.styles,c.styles),l.items.push(...c.items),i()},s)}const o=n.getReader(),l={items:[],styles:Object.create(null),lang:null};i()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const e=[];for(const n of this._intentStates.values())if(this._abortOperatorList({intentState:n,reason:new Error("Page was destroyed."),force:!0}),!n.opListReadCapability)for(const r of n.renderTasks)e.push(r.completed),r.cancel();return this.objs.clear(),$(this,gf,!1),Promise.all(e)}cleanup(e=!1){$(this,gf,!0);const n=V(this,ty,jN).call(this);return e&&n&&this._stats&&(this._stats=new wte),n}_startRenderPage(e,n){var s,i;const r=this._intentStates.get(n);r&&((s=this._stats)==null||s.timeEnd("Page Request"),(i=r.displayReadyCapability)==null||i.resolve(e))}_renderPageChunk(e,n){for(let r=0,s=e.length;r<s;r++)n.operatorList.fnArray.push(e.fnArray[r]),n.operatorList.argsArray.push(e.argsArray[r]);n.operatorList.lastChunk=e.lastChunk,n.operatorList.separateAnnots=e.separateAnnots;for(const r of n.renderTasks)r.operatorListChanged();e.lastChunk&&V(this,ty,jN).call(this)}_pumpOperatorList({renderingIntent:e,cacheKey:n,annotationStorageSerializable:r,modifiedIds:s}){const{map:i,transfer:o}=r,c=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:e,cacheKey:n,annotationStorage:i,modifiedIds:s},o).getReader(),u=this._intentStates.get(n);u.streamReader=c;const d=()=>{c.read().then(({value:h,done:f})=>{if(f){u.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(h,u),d())},h=>{if(u.streamReader=null,!this._transport.destroyed){if(u.operatorList){u.operatorList.lastChunk=!0;for(const f of u.renderTasks)f.operatorListChanged();V(this,ty,jN).call(this)}if(u.displayReadyCapability)u.displayReadyCapability.reject(h);else if(u.opListReadCapability)u.opListReadCapability.reject(h);else throw h}})};d()}_abortOperatorList({intentState:e,reason:n,force:r=!1}){if(e.streamReader){if(e.streamReaderCancelTimeout&&(clearTimeout(e.streamReaderCancelTimeout),e.streamReaderCancelTimeout=null),!r){if(e.renderTasks.size>0)return;if(n instanceof X3){let s=det;n.extraDelay>0&&n.extraDelay<1e3&&(s+=n.extraDelay),e.streamReaderCancelTimeout=setTimeout(()=>{e.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:e,reason:n,force:!0})},s);return}}if(e.streamReader.cancel(new ep(n.message)).catch(()=>{}),e.streamReader=null,!this._transport.destroyed){for(const[s,i]of this._intentStates)if(i===e){this._intentStates.delete(s);break}this.cleanup()}}}get stats(){return this._stats}}gf=new WeakMap,ty=new WeakSet,jN=function(){if(!y(this,gf)||this.destroyed)return!1;for(const{renderTasks:e,operatorList:n}of this._intentStates.values())if(e.size>0||!n.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),$(this,gf,!1),!0};var Fm,uu,vf,ny,xL,ry,sy,oo,nR,Kbe,Gbe,SN,G1,rR;const Nr=class Nr{constructor({name:e=null,port:n=null,verbosity:r=ZQe()}={}){q(this,oo);q(this,Fm,Promise.withResolvers());q(this,uu,null);q(this,vf,null);q(this,ny,null);if(this.name=e,this.destroyed=!1,this.verbosity=r,n){if(y(Nr,sy).has(n))throw new Error("Cannot use more than one PDFWorker per port.");y(Nr,sy).set(n,this),V(this,oo,Kbe).call(this,n)}else V(this,oo,Gbe).call(this)}get promise(){return y(this,Fm).promise}get port(){return y(this,vf)}get messageHandler(){return y(this,uu)}destroy(){var e,n;this.destroyed=!0,(e=y(this,ny))==null||e.terminate(),$(this,ny,null),y(Nr,sy).delete(y(this,vf)),$(this,vf,null),(n=y(this,uu))==null||n.destroy(),$(this,uu,null)}static create(e){const n=y(this,sy).get(e==null?void 0:e.port);
900if(n){if(n._pendingDestroy)throw new Error("PDFWorker.create - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return n}return new Nr(e)}static get workerSrc(){if(Nl.workerSrc)return Nl.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return Gt(this,"_setupFakeWorkerGlobal",(async()=>y(this,G1,rR)?y(this,G1,rR):(await import(this.workerSrc)).WorkerMessageHandler)())}};Fm=new WeakMap,uu=new WeakMap,vf=new WeakMap,ny=new WeakMap,xL=new WeakMap,ry=new WeakMap,sy=new WeakMap,oo=new WeakSet,nR=function(){y(this,Fm).resolve(),y(this,uu).send("configure",{verbosity:this.verbosity})},Kbe=function(e){$(this,vf,e),$(this,uu,new gN("main","worker",e)),y(this,uu).on("ready",()=>{}),V(this,oo,nR).call(this)},Gbe=function(){if(y(Nr,ry)||y(Nr,G1,rR)){V(this,oo,SN).call(this);return}let{workerSrc:e}=Nr;try{Nr._isSameOrigin(window.location,e)||(e=Nr._createCDNWrapper(new URL(e,window.location).href));const n=new Worker(e,{type:"module"}),r=new gN("main","worker",n),s=()=>{i.abort(),r.destroy(),n.terminate(),this.destroyed?y(this,Fm).reject(new Error("Worker was destroyed")):V(this,oo,SN).call(this)},i=new AbortController;n.addEventListener("error",()=>{y(this,ny)||s()},{signal:i.signal}),r.on("test",l=>{if(i.abort(),this.destroyed||!l){s();return}$(this,uu,r),$(this,vf,n),$(this,ny,n),V(this,oo,nR).call(this)}),r.on("ready",l=>{if(i.abort(),this.destroyed){s();return}try{o()}catch{V(this,oo,SN).call(this)}});const o=()=>{const l=new Uint8Array;r.send("test",l,[l.buffer])};o();return}catch{Y3("The worker has been disabled.")}V(this,oo,SN).call(this)},SN=function(){y(Nr,ry)||(Ut("Setting up fake worker."),$(Nr,ry,!0)),Nr._setupFakeWorkerGlobal.then(e=>{if(this.destroyed){y(this,Fm).reject(new Error("Worker was destroyed"));return}const n=new wZe;$(this,vf,n);const r=`fake${Vr(Nr,xL)._++}`,s=new gN(r+"_worker",r,n);e.setup(s,n),$(this,uu,new gN(r,r+"_worker",n)),V(this,oo,nR).call(this)}).catch(e=>{y(this,Fm).reject(new Error(`Setting up fake worker failed: "${e.message}".`))})},G1=new WeakSet,rR=function(){var e;try{return((e=globalThis.pdfjsWorker)==null?void 0:e.WorkerMessageHandler)||null}catch{return null}},q(Nr,G1),q(Nr,xL,0),q(Nr,ry,!1),q(Nr,sy,new WeakMap),Za&&($(Nr,ry,!0),Nl.workerSrc||(Nl.workerSrc="./pdf.worker.mjs")),Nr._isSameOrigin=(e,n)=>{const r=URL.parse(e);if(!(r!=null&&r.origin)||r.origin==="null")return!1;const s=new URL(n,r);return r.origin===s.origin},Nr._createCDNWrapper=e=>{const n=`await import("${e}");`;return URL.createObjectURL(new Blob([n],{type:"text/javascript"}))},Nr.fromPort=e=>{if(lZe("`PDFWorker.fromPort` - please use `PDFWorker.create` instead."),!(e!=null&&e.port))throw new Error("PDFWorker.fromPort - invalid method signature.");return Nr.create(e)};let X_=Nr;var xf,Cd,Y1,X1,yf,iy,NN;class pet{constructor(e,n,r,s,i,o){q(this,iy);q(this,xf,new Map);q(this,Cd,new Map);q(this,Y1,new Map);q(this,X1,new Map);q(this,yf,null);this.messageHandler=e,this.loadingTask=n,this.commonObjs=new Ube,this.fontLoader=new gZe({ownerDocument:s.ownerDocument,styleElement:s.styleElement}),this.loadingParams=s.loadingParams,this._params=s,this.canvasFactory=i.canvasFactory,this.filterFactory=i.filterFactory,this.cMapReaderFactory=i.cMapReaderFactory,this.standardFontDataFactory=i.standardFontDataFactory,this.wasmFactory=i.wasmFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=r,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.enableHWA=o,this.setupMessageHandler()}get annotationStorage(){return Gt(this,"annotationStorage",new k7)}getRenderingIntent(e,n=Ud.ENABLE,r=null,s=!1,i=!1){let o=yl.DISPLAY,l=sU;switch(e){case"any":o=yl.ANY;break;case"display":break;case"print":o=yl.PRINT;break;default:Ut(`getRenderingIntent - invalid intent: ${e}`)}const c=o&yl.PRINT&&r instanceof Nbe?r:this.annotationStorage;switch(n){case Ud.DISABLE:o+=yl.ANNOTATIONS_DISABLE;break;case Ud.ENABLE:break;case Ud.ENABLE_FORMS:o+=yl.ANNOTATIONS_FORMS;break;case Ud.ENABLE_STORAGE:o+=yl.ANNOTATIONS_STORAGE,l=c.serializable;break;default:Ut(`getRenderingIntent - invalid annotationMode: ${n}`)}s&&(o+=yl.IS_EDITING),i&&(o+=yl.OPLIST);const{ids:u,hash:d}=c.modifiedIds,h=[o,l.hash,d];return{renderingIntent:o,cacheKey:h.join("_"),annotationStorageSerializable:l,modifiedIds:u}}destroy(){var r;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),(r=y(this,yf))==null||r.reject(new Error("Worker was destroyed during onPassword callback"));const e=[];for(const s of y(this,Cd).values())e.push(s._destroy());y(this,Cd).clear(),y(this,Y1).clear(),y(this,X1).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();
900const n=this.messageHandler.sendWithPromise("Terminate",null);return e.push(n),Promise.all(e).then(()=>{var s,i;this.commonObjs.clear(),this.fontLoader.clear(),y(this,xf).clear(),this.filterFactory.destroy(),Ak.cleanup(),(s=this._networkStream)==null||s.cancelAllRequests(new ep("Worker was terminated.")),(i=this.messageHandler)==null||i.destroy(),this.messageHandler=null,this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:e,loadingTask:n}=this;e.on("GetReader",(r,s)=>{un(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=i=>{this._lastProgress={loaded:i.loaded,total:i.total}},s.onPull=()=>{this._fullReader.read().then(function({value:i,done:o}){if(o){s.close();return}un(i instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),s.enqueue(new Uint8Array(i),1,[i])}).catch(i=>{s.error(i)})},s.onCancel=i=>{this._fullReader.cancel(i),s.ready.catch(o=>{if(!this.destroyed)throw o})}}),e.on("ReaderHeadersReady",async r=>{var l;await this._fullReader.headersReady;const{isStreamingSupported:s,isRangeSupported:i,contentLength:o}=this._fullReader;return(!s||!i)&&(this._lastProgress&&((l=n.onProgress)==null||l.call(n,this._lastProgress)),this._fullReader.onProgress=c=>{var u;(u=n.onProgress)==null||u.call(n,{loaded:c.loaded,total:c.total})}),{isStreamingSupported:s,isRangeSupported:i,contentLength:o}}),e.on("GetRangeReader",(r,s)=>{un(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const i=this._networkStream.getRangeReader(r.begin,r.end);if(!i){s.close();return}s.onPull=()=>{i.read().then(function({value:o,done:l}){if(l){s.close();return}un(o instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),s.enqueue(new Uint8Array(o),1,[o])}).catch(o=>{s.error(o)})},s.onCancel=o=>{i.cancel(o),s.ready.catch(l=>{if(!this.destroyed)throw l})}}),e.on("GetDoc",({pdfInfo:r})=>{this._numPages=r.numPages,this._htmlForXfa=r.htmlForXfa,delete r.htmlForXfa,n._capability.resolve(new het(r,this))}),e.on("DocException",r=>{n._capability.reject(So(r))}),e.on("PasswordRequest",r=>{$(this,yf,Promise.withResolvers());try{if(!n.onPassword)throw So(r);const s=i=>{i instanceof Error?y(this,yf).reject(i):y(this,yf).resolve({password:i})};n.onPassword(s,r.code)}catch(s){y(this,yf).reject(s)}return y(this,yf).promise}),e.on("DataLoaded",r=>{var s;(s=n.onProgress)==null||s.call(n,{loaded:r.length,total:r.length}),this.downloadInfoCapability.resolve(r)}),e.on("StartRenderPage",r=>{if(this.destroyed)return;y(this,Cd).get(r.pageIndex)._startRenderPage(r.transparency,r.cacheKey)}),e.on("commonobj",([r,s,i])=>{var o;if(this.destroyed||this.commonObjs.has(r))return null;switch(s){case"Font":if("error"in i){const h=i.error;Ut(`Error during font loading: ${h}`),this.commonObjs.resolve(r,h);break}const l=new mU(i),c=this._params.pdfBug&&((o=globalThis.FontInspector)!=null&&o.enabled)?(h,f)=>globalThis.FontInspector.fontAdded(h,f):null,u=new vZe(l,c,i.extra,i.charProcOperatorList);this.fontLoader.bind(u).catch(()=>e.sendWithPromise("FontFallback",{id:r})).finally(()=>{!u.fontExtraProperties&&u.data&&u.clearData(),this.commonObjs.resolve(r,u)});break;case"CopyLocalImage":const{imageRef:d}=i;un(d,"The imageRef must be defined.");for(const h of y(this,Cd).values())for(const[,f]of h.objs)if((f==null?void 0:f.ref)===d)return f.dataLen?(this.commonObjs.resolve(r,structuredClone(f)),f.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(r,i);break;default:throw new Error(`Got unknown common object type ${s}`)}return null}),e.on("obj",([r,s,i,o])=>{var c;if(this.destroyed)return;const l=y(this,Cd).get(s);if(!l.objs.has(r)){if(l._intentStates.size===0){(c=o==null?void 0:o.bitmap)==null||c.close();return}switch(i){case"Image":case"Pattern":l.objs.resolve(r,o);break;default:throw new Error(`Got unknown object type ${i}`)}}}),e.on("DocProgress",r=>{var s;this.destroyed||(s=n.onProgress)==null||s.call(n,{loaded:r.loaded,total:r.total})}),e.on("FetchBinaryData",async r=>{if(this.destroyed)throw new Error("Worker was destroyed.");const s=this[r.type];if(!s)throw new Error(`${r.type} not initialized, see the \`useWorkerFetch\` parameter.`);return s.fetch(r)})}
900getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var r;this.annotationStorage.size<=0&&Ut("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:e,transfer:n}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:e,filename:((r=this._fullReader)==null?void 0:r.filename)??null},n).finally(()=>{this.annotationStorage.resetModified()})}getPage(e){if(!Number.isInteger(e)||e<=0||e>this._numPages)return Promise.reject(new Error("Invalid page request."));const n=e-1,r=y(this,Y1).get(n);if(r)return r;const s=this.messageHandler.sendWithPromise("GetPage",{pageIndex:n}).then(i=>{if(this.destroyed)throw new Error("Transport destroyed");i.refStr&&y(this,X1).set(i.refStr,e);const o=new fet(n,i,this,this._params.pdfBug);return y(this,Cd).set(n,o),o});return y(this,Y1).set(n,s),s}getPageIndex(e){return iU(e)?this.messageHandler.sendWithPromise("GetPageIndex",{num:e.num,gen:e.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(e,n){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:e,intent:n})}getFieldObjects(){return V(this,iy,NN).call(this,"GetFieldObjects")}hasJSActions(){return V(this,iy,NN).call(this,"HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(e){return typeof e!="string"?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:e})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getAnnotationsByType(e,n){return this.messageHandler.sendWithPromise("GetAnnotationsByType",{types:e,pageIndexesToSkip:n})}getDocJSActions(){return V(this,iy,NN).call(this,"GetDocJSActions")}getPageJSActions(e){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:e})}getStructTree(e){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:e})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(e){return V(this,iy,NN).call(this,"GetOptionalContentConfig").then(n=>new HZe(n,e))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const e="GetMetadata",n=y(this,xf).get(e);if(n)return n;const r=this.messageHandler.sendWithPromise(e,null).then(s=>{var i,o;return{info:s[0],metadata:s[1]?new qZe(s[1]):null,contentDispositionFilename:((i=this._fullReader)==null?void 0:i.filename)??null,contentLength:((o=this._fullReader)==null?void 0:o.contentLength)??null}});return y(this,xf).set(e,r),r}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(e=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const n of y(this,Cd).values())if(!n.cleanup())throw new Error(`startCleanup: Page ${n.pageNumber} is currently rendering.`);this.commonObjs.clear(),e||this.fontLoader.clear(),y(this,xf).clear(),this.filterFactory.destroy(!0),Ak.cleanup()}}cachedPageNumber(e){if(!iU(e))return null;const n=e.gen===0?`${e.num}R`:`${e.num}R${e.gen}`;return y(this,X1).get(n)??null}}xf=new WeakMap,Cd=new WeakMap,Y1=new WeakMap,X1=new WeakMap,yf=new WeakMap,iy=new WeakSet,NN=function(e,n=null){const r=y(this,xf).get(e);if(r)return r;const s=this.messageHandler.sendWithPromise(e,n);return y(this,xf).set(e,s),s};var $m;class met{constructor(e){q(this,$m,null);Te(this,"onContinue",null);Te(this,"onError",null);$(this,$m,e)}get promise(){return y(this,$m).capability.promise}cancel(e=0){y(this,$m).cancel(null,e)}get separateAnnots(){const{separateAnnots:e}=y(this,$m).operatorList;if(!e)return!1;const{annotationCanvasMap:n}=y(this,$m);return e.form||e.canvas&&(n==null?void 0:n.size)>0}}$m=new WeakMap;var zm,ay;const Yv=class Yv{constructor({callback:e,params:n,objs:r,commonObjs:s,annotationCanvasMap:i,operatorList:o,pageIndex:l,canvasFactory:c,filterFactory:u,useRequestAnimationFrame:d=!1,pdfBug:h=!1,pageColors:f=null,enableHWA:p=!1,operationsFilter:m=null}){q(this,zm,null);this.callback=e,this.params=n,this.objs=r,this.commonObjs=s,this.annotationCanvasMap=i,this.operatorListIdx=null,this.operatorList=o,this._pageIndex=l,this.canvasFactory=c,this.filterFactory=u,this._pdfBug=h,this.pageColors=f,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=d===!0&&typeof window<"u",this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new met(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=n.canvas,this._canvasContext=n.canvas?null:n.canvasContext,this._enableHWA=p,this._dependencyTracker=n.dependencyTracker,this._operationsFilter=m}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:e=!1,optionalContentConfig:n}){var c,u;if(this.cancelled)return;
900if(this._canvas){if(y(Yv,ay).has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");y(Yv,ay).add(this._canvas)}this._pdfBug&&((c=globalThis.StepperManager)!=null&&c.enabled)&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{viewport:r,transform:s,background:i,dependencyTracker:o}=this.params,l=this._canvasContext||this._canvas.getContext("2d",{alpha:!1,willReadFrequently:!this._enableHWA});this.gfx=new Fw(l,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:n},this.annotationCanvasMap,this.pageColors,o),this.gfx.beginDrawing({transform:s,viewport:r,transparency:e,background:i}),this.operatorListIdx=0,this.graphicsReady=!0,(u=this.graphicsReadyCallback)==null||u.call(this)}cancel(e=null,n=0){var r,s,i;this.running=!1,this.cancelled=!0,(r=this.gfx)==null||r.endDrawing(),y(this,zm)&&(window.cancelAnimationFrame(y(this,zm)),$(this,zm,null)),y(Yv,ay).delete(this._canvas),e||(e=new X3(`Rendering cancelled, page ${this._pageIndex+1}`,n)),this.callback(e),(i=(s=this.task).onError)==null||i.call(s,e)}operatorListChanged(){var e,n;if(!this.graphicsReady){this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound);return}(e=this.gfx.dependencyTracker)==null||e.growOperationsCount(this.operatorList.fnArray.length),(n=this.stepper)==null||n.updateOperatorList(this.operatorList),!this.running&&this._continue()}_continue(){this.running=!0,!this.cancelled&&(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?$(this,zm,window.requestAnimationFrame(()=>{$(this,zm,null),this._nextBound().catch(this._cancelBound)})):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper,this._operationsFilter),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),y(Yv,ay).delete(this._canvas),this.callback())))}};zm=new WeakMap,ay=new WeakMap,q(Yv,ay,new WeakSet);let wU=Yv;const Z3="5.4.296",Ybe="f56dc8601";var ol,oy,J1,$s,uE,Q1,bf,dE,Bm,du,hE,Hn,_U,jU,SU,Dv,Xbe,$p;const Co=class Co{constructor({editor:e=null,uiManager:n=null}){q(this,Hn);q(this,ol,null);q(this,oy,null);q(this,J1);q(this,$s,null);q(this,uE,!1);q(this,Q1,!1);q(this,bf,null);q(this,dE);q(this,Bm,null);q(this,du,null);var r,s;e?($(this,Q1,!1),$(this,bf,e)):$(this,Q1,!0),$(this,du,(e==null?void 0:e._uiManager)||n),$(this,dE,y(this,du)._eventBus),$(this,J1,((r=e==null?void 0:e.color)==null?void 0:r.toUpperCase())||((s=y(this,du))==null?void 0:s.highlightColors.values().next().value)||"#FFFF98"),y(Co,hE)||$(Co,hE,Object.freeze({blue:"pdfjs-editor-colorpicker-blue",green:"pdfjs-editor-colorpicker-green",pink:"pdfjs-editor-colorpicker-pink",red:"pdfjs-editor-colorpicker-red",yellow:"pdfjs-editor-colorpicker-yellow"}))}static get _keyboardManager(){return Gt(this,"_keyboardManager",new k2([[["Escape","mac+Escape"],Co.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],Co.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],Co.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],Co.prototype._moveToPrevious],[["Home","mac+Home"],Co.prototype._moveToBeginning],[["End","mac+End"],Co.prototype._moveToEnd]]))}renderButton(){const e=$(this,ol,document.createElement("button"));e.className="colorPicker",e.tabIndex="0",e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),e.ariaHasPopup="true",y(this,bf)&&(e.ariaControls=`${y(this,bf).id}_colorpicker_dropdown`);const n=y(this,du)._signal;e.addEventListener("click",V(this,Hn,Dv).bind(this),{signal:n}),e.addEventListener("keydown",V(this,Hn,SU).bind(this),{signal:n});const r=$(this,oy,document.createElement("span"));return r.className="swatch",r.ariaHidden="true",r.style.backgroundColor=y(this,J1
900),e.append(r),e}renderMainDropdown(){const e=$(this,$s,V(this,Hn,_U).call(this));return e.ariaOrientation="horizontal",e.ariaLabelledBy="highlightColorPickerLabel",e}_colorSelectFromKeyboard(e){if(e.target===y(this,ol)){V(this,Hn,Dv).call(this,e);return}const n=e.target.getAttribute("data-color");n&&V(this,Hn,jU).call(this,n,e)}_moveToNext(e){var n,r;if(!y(this,Hn,$p)){V(this,Hn,Dv).call(this,e);return}if(e.target===y(this,ol)){(n=y(this,$s).firstChild)==null||n.focus();return}(r=e.target.nextSibling)==null||r.focus()}_moveToPrevious(e){var n,r;if(e.target===((n=y(this,$s))==null?void 0:n.firstChild)||e.target===y(this,ol)){y(this,Hn,$p)&&this._hideDropdownFromKeyboard();return}y(this,Hn,$p)||V(this,Hn,Dv).call(this,e),(r=e.target.previousSibling)==null||r.focus()}_moveToBeginning(e){var n;if(!y(this,Hn,$p)){V(this,Hn,Dv).call(this,e);return}(n=y(this,$s).firstChild)==null||n.focus()}_moveToEnd(e){var n;if(!y(this,Hn,$p)){V(this,Hn,Dv).call(this,e);return}(n=y(this,$s).lastChild)==null||n.focus()}hideDropdown(){var e,n;(e=y(this,$s))==null||e.classList.add("hidden"),y(this,ol).ariaExpanded="false",(n=y(this,Bm))==null||n.abort(),$(this,Bm,null)}_hideDropdownFromKeyboard(){var e;if(!y(this,Q1)){if(!y(this,Hn,$p)){(e=y(this,bf))==null||e.unselect();return}this.hideDropdown(),y(this,ol).focus({preventScroll:!0,focusVisible:y(this,uE)})}}updateColor(e){if(y(this,oy)&&(y(this,oy).style.backgroundColor=e),!y(this,$s))return;const n=y(this,du).highlightColors.values();for(const r of y(this,$s).children)r.ariaSelected=n.next().value===e.toUpperCase()}destroy(){var e,n;(e=y(this,ol))==null||e.remove(),$(this,ol,null),$(this,oy,null),(n=y(this,$s))==null||n.remove(),$(this,$s,null)}};ol=new WeakMap,oy=new WeakMap,J1=new WeakMap,$s=new WeakMap,uE=new WeakMap,Q1=new WeakMap,bf=new WeakMap,dE=new WeakMap,Bm=new WeakMap,du=new WeakMap,hE=new WeakMap,Hn=new WeakSet,_U=function(){const e=document.createElement("div"),n=y(this,du)._signal;e.addEventListener("contextmenu",$l,{signal:n}),e.className="dropdown",e.role="listbox",e.ariaMultiSelectable="false",e.ariaOrientation="vertical",e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown"),y(this,bf)&&(e.id=`${y(this,bf).id}_colorpicker_dropdown`);for(const[r,s]of y(this,du).highlightColors){const i=document.createElement("button");i.tabIndex="0",i.role="option",i.setAttribute("data-color",s),i.title=r,i.setAttribute("data-l10n-id",y(Co,hE)[r]);const o=document.createElement("span");i.append(o),o.className="swatch",o.style.backgroundColor=s,i.ariaSelected=s===y(this,J1),i.addEventListener("click",V(this,Hn,jU).bind(this,s),{signal:n}),e.append(i)}return e.addEventListener("keydown",V(this,Hn,SU).bind(this),{signal:n}),e}
900,jU=function(e,n){n.stopPropagation(),y(this,dE).dispatch("switchannotationeditorparams",{source:this,type:sn.HIGHLIGHT_COLOR,value:e}),this.updateColor(e)},SU=function(e){Co._keyboardManager.exec(this,e)},Dv=function(e){if(y(this,Hn,$p)){this.hideDropdown();return}if($(this,uE,e.detail===0),y(this,Bm)||($(this,Bm,new AbortController),window.addEventListener("pointerdown",V(this,Hn,Xbe).bind(this),{signal:y(this,du).combinedSignal(y(this,Bm))})),y(this,ol).ariaExpanded="true",y(this,$s)){y(this,$s).classList.remove("hidden");return}const n=$(this,$s,V(this,Hn,_U).call(this));y(this,ol).append(n)},Xbe=function(e){var n;(n=y(this,$s))!=null&&n.contains(e.target)||this.hideDropdown()},$p=function(){return y(this,$s)&&!y(this,$s).classList.contains("hidden")},q(Co,hE,null);let Ek=Co;var kd,fE,Z1,pE;const Xv=class Xv{constructor(e){q(this,kd,null);q(this,fE,null);q(this,Z1,null);$(this,fE,e),$(this,Z1,e._uiManager),y(Xv,pE)||$(Xv,pE,Object.freeze({freetext:"pdfjs-editor-color-picker-free-text-input",ink:"pdfjs-editor-color-picker-ink-input"}))}renderButton(){if(y(this,kd))return y(this,kd);const{editorType:e,colorType:n,colorValue:r}=y(this,fE),s=$(this,kd,document.createElement("input"));return s.type="color",s.value=r||"#000000",s.className="basicColorPicker",s.tabIndex=0,s.setAttribute("data-l10n-id",y(Xv,pE)[e]),s.addEventListener("input",()=>{y(this,Z1).updateParams(n,s.value)},{signal:y(this,Z1)._signal}),s}update(e){y(this,kd)&&(y(this,kd).value=e)}destroy(){var e;(e=y(this,kd))==null||e.remove(),$(this,kd,null)}hideDropdown(){}};kd=new WeakMap,fE=new WeakMap,Z1=new WeakMap,pE=new WeakMap,q(Xv,pE,null);let lI=Xv;function qte(t){return Math.floor(Math.max(0,Math.min(1,t))*255).toString(16).padStart(2,"0")}function AS(t){return Math.max(0,Math.min(255,255*t))}class Vte{static CMYK_G([e,n,r,s]){return["G",1-Math.min(1,.3*e+.59*r+.11*n+s)]}static G_CMYK([e]){return["CMYK",0,0,0,1-e]}static G_RGB([e]){return["RGB",e,e,e]}static G_rgb([e]){return e=AS(e),[e,e,e]}static G_HTML([e]){const n=qte(e);return`#${n}${n}${n}`}static RGB_G([e,n,r]){return["G",.3*e+.59*n+.11*r]}static RGB_rgb(e){return e.map(AS)}static RGB_HTML(e){return`#${e.map(qte).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([e,n,r,s]){return["RGB",1-Math.min(1,e+s),1-Math.min(1,r+s),1-Math.min(1,n+s)]}static CMYK_rgb([e,n,r,s]){return[AS(1-Math.min(1,e+s)),AS(1-Math.min(1,r+s)),AS(1-Math.min(1,n+s))]}static CMYK_HTML(e){const n=this.CMYK_RGB(e).slice(1);return this.RGB_HTML(n)}static RGB_CMYK([e,n,r]){const s=1-e,i=1-n,o=1-r,l=Math.min(s,i,o);return["CMYK",s,i,o,l]}}class get{create(e,n,r=!1){if(e<=0||n<=0)throw new Error("Invalid SVG dimensions");const s=this._createSVG("svg:svg");return s.setAttribute("version","1.1"),r||(s.setAttribute("width",`${e}px`),s.setAttribute("height",`${n}px`)),s.setAttribute("preserveAspectRatio","none"),s.setAttribute("viewBox",`0 0 ${e} ${n}`),s}createElement(e){if(typeof e!="string")throw new Error("Invalid SVG element type");return this._createSVG(e)}_createSVG(e){Zn("Abstract method `_createSVG` called.")}}class Tk extends get{_createSVG(e){return document.createElementNS(Dh,e)}}const vet=9,o0=new WeakSet,xet=new Date().getTimezoneOffset()*60*1e3;class Hte{static create(e){switch(e.data.annotationType){case ds.LINK:return new M7(e);case ds.TEXT:return new bet(e);case ds.WIDGET:switch(e.data.fieldType){case"Tx":return new wet(e);case"Btn":return e.data.radioButton?new Zbe(e):e.data.checkBox?new jet(e):new Net(e);case"Ch":return new Cet(e);case"Sig":return new _et(e)}return new D0(e);case ds.POPUP:return new CU(e);case ds.FREETEXT:return new swe(e);case ds.LINE:return new Aet(e);case ds.SQUARE:return new Eet(e);case ds.CIRCLE:return new Tet(e);case ds.POLYLINE:return new iwe(e);case ds.CARET:return new Met(e);case ds.INK:return new R7(e);case ds.POLYGON:return new Pet(e);case ds.HIGHLIGHT:return new awe(e);case ds.UNDERLINE:return new Ret(e);case ds.SQUIGGLY:return new Oet(e);case ds.STRIKEOUT:return new Iet(e);case ds.STAMP:return new owe(e);case ds.FILEATTACHMENT:return new Det(e);default:return new $r(e)}}}var ly,e_,hc,mE,NU;const nX=class nX{constructor(e,{isRenderable:n=!1,ignoreBorder:r=!1,createQuadrilaterals:s=!1}={}){q(this,mE);q(this,ly,null);q(this,e_,!1);q(this,hc,null);this.isRenderable=n,this.data=e.data,this.layer=e.layer,this.linkService=e.linkService,this.downloadManager=e.downloadManager,this.imageResourcesPath=e.imageResourcesPath,this.renderForms=e.renderForms,this.svgFactory=e.svgFactory,this.annotationStorage=e.annotationStorage,this.enableComment=e.enableComment,this.enableScripting=e.enableScripting,this.hasJSActions=e.hasJSActions,this._fieldObjects=e.fieldObjects,this.parent=e.parent,n&&
900(this.container=this._createContainer(r)),s&&this._createQuadrilaterals()}static _hasPopupData({contentsObj:e,richText:n}){return!!(e!=null&&e.str||n!=null&&n.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return nX._hasPopupData(this.data)||this.enableComment&&!!this.commentText}get commentData(){var r;const{data:e}=this,n=(r=this.annotationStorage)==null?void 0:r.getEditor(e.id);return n?n.getData():e}get hasCommentButton(){return this.enableComment&&this.hasPopupElement}get commentButtonPosition(){var l;const e=(l=this.annotationStorage)==null?void 0:l.getEditor(this.data.id);if(e)return e.commentButtonPositionInPage;const{quadPoints:n,inkLists:r,rect:s}=this.data;let i=-1/0,o=-1/0;if((n==null?void 0:n.length)>=8){for(let c=0;c<n.length;c+=8)n[c+1]>o?(o=n[c+1],i=n[c+2]):n[c+1]===o&&(i=Math.max(i,n[c+2]));return[i,o]}if((r==null?void 0:r.length)>=1){for(const c of r)for(let u=0,d=c.length;u<d;u+=2)c[u+1]>o?(o=c[u+1],i=c[u]):c[u+1]===o&&(i=Math.max(i,c[u]));if(i!==1/0)return[i,o]}return s?[s[2],s[3]]:null}_normalizePoint(e){const{page:{view:n},viewport:{rawDims:{pageWidth:r,pageHeight:s,pageX:i,pageY:o}}}=this.parent;return e[1]=n[3]-e[1]+n[1],e[0]=100*(e[0]-i)/r,e[1]=100*(e[1]-o)/s,e}get commentText(){var n,r,s;const{data:e}=this;return((r=(n=this.annotationStorage.getRawValue(`${jk}${e.id}`))==null?void 0:n.popup)==null?void 0:r.contents)||((s=e.contentsObj)==null?void 0:s.str)||""}set commentText(e){const{data:n}=this,r={deleted:!e,contents:e||""};this.annotationStorage.updateEditor(n.id,{popup:r})||this.annotationStorage.setValue(`${jk}${n.id}`,{id:n.id,annotationType:n.annotationType,pageIndex:this.parent.page._pageIndex,popup:r,popupRef:n.popupRef,modificationDate:new Date}),e||this.removePopup()}removePopup(){var e,n;(n=((e=y(this,hc))==null?void 0:e.popup)||this.popup)==null||n.remove(),$(this,hc,this.popup=null)}updateEdited(e){var i;if(!this.container)return;e.rect&&(y(this,ly)||$(this,ly,{rect:this.data.rect.slice(0)}));const{rect:n,popup:r}=e;n&&V(this,mE,NU).call(this,n);let s=((i=y(this,hc))==null?void 0:i.popup)||this.popup;!s&&(r!=null&&r.text)&&(this._createPopup(r),s=y(this,hc).popup),s&&(s.updateEdited(e),r!=null&&r.deleted&&(s.remove(),$(this,hc,null),this.popup=null))}resetEdited(){var e;y(this,ly)&&(V(this,mE,NU).call(this,y(this,ly).rect),(e=y(this,hc))==null||e.popup.resetEdited(),$(this,ly,null))}_createContainer(e){const{data:n,parent:{page:r,viewport:s}}=this,i=document.createElement("section");i.setAttribute("data-annotation-id",n.id),!(this instanceof D0)&&!(this instanceof M7)&&(i.tabIndex=0);const{style:o}=i;if(o.zIndex=this.parent.zIndex,this.parent.zIndex+=2,n.alternativeText&&(i.title=n.alternativeText),n.noRotate&&i.classList.add("norotate"),!n.rect||this instanceof CU){const{rotation:v}=n;return!n.hasOwnCanvas&&v!==0&&this.setRotation(v,i),i}const{width:l,height:c}=this;if(!e&&n.borderStyle.width>0){o.borderWidth=`${n.borderStyle.width}px`;const v=n.borderStyle.horizontalCornerRadius,x=n.borderStyle.verticalCornerRadius;if(v>0||x>0){const w=`calc(${v}px * var(--total-scale-factor)) / calc(${x}px * var(--total-scale-factor))`;o.borderRadius=w}else if(this instanceof Zbe){const w=`calc(${l}px * var(--total-scale-factor)) / calc(${c}px * var(--total-scale-factor))`;o.borderRadius=w}switch(n.borderStyle.style){case Tb.SOLID:o.borderStyle="solid";break;case Tb.DASHED:o.borderStyle="dashed";break;case Tb.BEVELED:Ut("Unimplemented border style: beveled");break;case Tb.INSET:Ut("Unimplemented border style: inset");break;case Tb.UNDERLINE:o.borderBottomStyle="solid";break}const g=n.borderColor||null;g?($(this,e_,!0),o.borderColor=ot.makeHexColor(g[0]|0,g[1]|0,g[2]|0)):o.borderWidth=0}const u=ot.normalizeRect([n.rect[0],r.view[3]-n.rect[1]+r.view[1],n.rect[2],r.view[3]-n.rect[3]+r.view[1]]),{pageWidth:d,pageHeight:h,pageX:f,pageY:p}=s.rawDims;o.left=`${100*(u[0]-f)/d}%`,o.top=`${100*(u[1]-p)/h}%`;const{rotation:m}=n;return n.hasOwnCanvas||m===0?(o.width=`${100*l/d}%`,o.height=`${100*c/h}%`):this.setRotation(m,i),i}setRotation(e,n=this.container){if(!this.data.rect)return;const{pageWidth:r,pageHeight:s}=this.parent.viewport.rawDims;let{width:i,height:o}=this;e%180!==0&&([i,o]=[o,i]),n.style.width=`${100*i/r}%`,n.style.height=`${100*o/s}
900%`,n.setAttribute("data-main-rotation",(360-e)%360)}get _commonActions(){const e=(n,r,s)=>{const i=s.detail[n],o=i[0],l=i.slice(1);s.target.style[r]=Vte[`${o}_HTML`](l),this.annotationStorage.setValue(this.data.id,{[r]:Vte[`${o}_rgb`](l)})};return Gt(this,"_commonActions",{display:n=>{const{display:r}=n.detail,s=r%2===1;this.container.style.visibility=s?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:s,noPrint:r===1||r===2})},print:n=>{this.annotationStorage.setValue(this.data.id,{noPrint:!n.detail.print})},hidden:n=>{const{hidden:r}=n.detail;this.container.style.visibility=r?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:r,noView:r})},focus:n=>{setTimeout(()=>n.target.focus({preventScroll:!1}),0)},userName:n=>{n.target.title=n.detail.userName},readonly:n=>{n.target.disabled=n.detail.readonly},required:n=>{this._setRequired(n.target,n.detail.required)},bgColor:n=>{e("bgColor","backgroundColor",n)},fillColor:n=>{e("fillColor","backgroundColor",n)},fgColor:n=>{e("fgColor","color",n)},textColor:n=>{e("textColor","color",n)},borderColor:n=>{e("borderColor","borderColor",n)},strokeColor:n=>{e("strokeColor","borderColor",n)},rotation:n=>{const r=n.detail.rotation;this.setRotation(r),this.annotationStorage.setValue(this.data.id,{rotation:r})}})}_dispatchEventFromSandbox(e,n){const r=this._commonActions;for(const s of Object.keys(n.detail)){const i=e[s]||r[s];i==null||i(n)}}_setDefaultPropertiesFromJS(e){if(!this.enableScripting)return;const n=this.annotationStorage.getRawValue(this.data.id);if(!n)return;const r=this._commonActions;for(const[s,i]of Object.entries(n)){const o=r[s];
900if(o){const l={detail:{[s]:i},target:e};o(l),delete n[s]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:e}=this.data;if(!e)return;const[n,r,s,i]=this.data.rect.map(v=>Math.fround(v));if(e.length===8){const[v,x,g,w]=e.subarray(2,6);if(s===v&&i===x&&n===g&&r===w)return}const{style:o}=this.container;let l;if(y(this,e_)){const{borderColor:v,borderWidth:x}=o;o.borderWidth=0,l=["url('data:image/svg+xml;utf8,",'<svg xmlns="http://www.w3.org/2000/svg"',' preserveAspectRatio="none" viewBox="0 0 1 1">',`<g fill="transparent" stroke="${v}" stroke-width="${x}">`],this.container.classList.add("hasBorder")}const c=s-n,u=i-r,{svgFactory:d}=this,h=d.createElement("svg");h.classList.add("quadrilateralsContainer"),h.setAttribute("width",0),h.setAttribute("height",0),h.role="none";const f=d.createElement("defs");h.append(f);const p=d.createElement("clipPath"),m=`clippath_${this.data.id}`;p.setAttribute("id",m),p.setAttribute("clipPathUnits","objectBoundingBox"),f.append(p);for(let v=2,x=e.length;v<x;v+=8){const g=e[v],w=e[v+1],_=e[v+2],j=e[v+3],N=d.createElement("rect"),S=(_-n)/c,C=(i-w)/u,k=(g-_)/c,E=(w-j)/u;N.setAttribute("x",S),N.setAttribute("y",C),N.setAttribute("width",k),N.setAttribute("height",E),p.append(N),l==null||l.push(`<rect vector-effect="non-scaling-stroke" x="${S}" y="${C}" width="${k}" height="${E}"/>`)}y(this,e_)&&(l.push("</g></svg>')"),o.backgroundImage=l.join("")),this.container.append(h),this.container.style.clipPath=`url(#${m})`}_createPopup(e=null){const{data:n}=this;let r,s;e?(r={str:e.text},s=e.date):(r=n.contentsObj,s=n.modificationDate);const i=$(this,hc,new CU({data:{color:n.color,titleObj:n.titleObj,modificationDate:s,contentsObj:r,richText:n.richText,parentRect:n.rect,borderStyle:0,id:`popup_${n.id}`,rotation:n.rotation,noRotate:!0},linkService:this.linkService,parent:this.parent,elements:[this]}));this.parent._commentManager||this.parent.div.append(i.render())}get hasPopupElement(){return!!(y(this,hc)||this.popup||this.data.popupRef)}get extraPopupElement(){return y(this,hc)}render(){Zn("Abstract method `AnnotationElement.render` called")}_getElementsByName(e,n=null){const r=[];if(this._fieldObjects){const s=this._fieldObjects[e];if(s)for(const{page:i,id:o,exportValues:l}of s){if(i===-1||o===n)continue;const c=typeof l=="string"?l:null,u=document.querySelector(`[data-element-id="${o}"]`);if(u&&!o0.has(u)){Ut(`_getElementsByName - element not allowed: ${o}`);continue}r.push({id:o,exportValue:c,domElement:u})}return r}for(const s of document.getElementsByName(e)){const{exportValue:i}=s,o=s.getAttribute("data-element-id");o!==n&&o0.has(s)&&r.push({id:o,exportValue:i,domElement:s})}return r}show(){var e;this.container&&(this.container.hidden=!1),(e=this.popup)==null||e.maybeShow()}hide(){var e;this.container&&(this.container.hidden=!0),(e=this.popup)==null||e.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const e=this.getElementsToTriggerPopup();if(Array.isArray(e))for(const n of e)n.classList.add("highlightArea");else e.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:e,data:{id:n}}=this;this.container.addEventListener("dblclick",()=>{var r;(r=this.linkService.eventBus)==null||r.dispatch("switchannotationeditormode",{source:this,mode:e,editId:n,mustEnterInEditMode:!0})})}get width(){return this.data.rect[2]-this.data.rect[0]}get height(){return this.data.rect[3]-this.data.rect[1]}};ly=new WeakMap,e_=new WeakMap,hc=new WeakMap,mE=new WeakSet,NU=function(e){const{container:{style:n},data:{rect:r,rotation:s},parent:{viewport:{rawDims:{pageWidth:i,pageHeight:o,pageX:l,pageY:c}}}}=this;r==null||r.splice(0,4,...e),n.left=`${100*(e[0]-l)/i}%`,n.top=`${100*(o-e[3]+c)/o}%`,s===0?(n.width=`${100*(e[2]-e[0])/i}%`,n.height=`${100*(e[3]-e[1])/o}%`):this.setRotation(s)};let $r=nX;class yet extends $r{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.editor=e.editor}render(){return this.container.className="editorAnnotation",this.container}createOrUpdatePopup(){const{editor:e}=this;e.hasComment&&(this._createPopup(e.comment),this.extraPopupElement.popup.renderCommentButton())}get hasCommentButton(){return this.enableComment&&this.editor.hasComment}
900get commentButtonPosition(){return this.editor.commentButtonPositionInPage}get commentText(){return this.editor.comment.text}set commentText(e){this.editor.comment=e,e||this.removePopup()}get commentData(){return this.editor.getData()}remove(){this.container.remove(),this.container=null,this.removePopup()}}var jl,Lv,Jbe,Qbe;class M7 extends $r{constructor(n,r=null){super(n,{isRenderable:!0,ignoreBorder:!!(r!=null&&r.ignoreBorder),createQuadrilaterals:!0});q(this,jl);this.isTooltipOnly=n.data.isTooltipOnly}render(){const{data:n,linkService:r}=this,s=document.createElement("a");s.setAttribute("data-element-id",n.id);let i=!1;return n.url?(r.addLinkAttributes(s,n.url,n.newWindow),i=!0):n.action?(this._bindNamedAction(s,n.action,n.overlaidText),i=!0):n.attachment?(V(this,jl,Jbe).call(this,s,n.attachment,n.overlaidText,n.attachmentDest),i=!0):n.setOCGState?(V(this,jl,Qbe).call(this,s,n.setOCGState,n.overlaidText),i=!0):n.dest?(this._bindLink(s,n.dest,n.overlaidText),i=!0):(n.actions&&(n.actions.Action||n.actions["Mouse Up"]||n.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(s,n),i=!0),n.resetForm?(this._bindResetFormAction(s,n.resetForm),i=!0):this.isTooltipOnly&&!i&&(this._bindLink(s,""),i=!0)),this.container.classList.add("linkAnnotation"),i&&this.container.append(s),this.container}_bindLink(n,r,s=""){n.href=this.linkService.getDestinationHash(r),n.onclick=()=>(r&&this.linkService.goToDestination(r),!1),(r||r==="")&&V(this,jl,Lv).call(this),s&&(n.title=s)}_bindNamedAction(n,r,s=""){n.href=this.linkService.getAnchorUrl(""),n.onclick=()=>(this.linkService.executeNamedAction(r),!1),s&&(n.title=s),V(this,jl,Lv).call(this)}_bindJSAction(n,r){n.href=this.linkService.getAnchorUrl("");const s=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const i of Object.keys(r.actions)){const o=s.get(i);o&&(n[o]=()=>{var l;return(l=this.linkService.eventBus)==null||l.dispatch("dispatcheventinsandbox",{source:this,detail:{id:r.id,name:i}}),!1})}r.overlaidText&&(n.title=r.overlaidText),n.onclick||(n.onclick=()=>!1),V(this,jl,Lv).call(this)}_bindResetFormAction(n,r){const s=n.onclick;if(s||(n.href=this.linkService.getAnchorUrl("")),V(this,jl,Lv).call(this),!this._fieldObjects){Ut('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),s||(n.onclick=()=>!1);return}n.onclick=()=>{var h;s==null||s();const{fields:i,refs:o,include:l}=r,c=[];if(i.length!==0||o.length!==0){const f=new Set(o);for(const p of i){const m=this._fieldObjects[p]||[];for(const{id:v}of m)f.add(v)}for(const p of Object.values(this._fieldObjects))for(const m of p)f.has(m.id)===l&&c.push(m)}else for(const f of Object.values(this._fieldObjects))c.push(...f);const u=this.annotationStorage,d=[];for(const f of c){const{id:p}=f;switch(d.push(p),f.type){case"text":{const v=f.defaultValue||"";u.setValue(p,{value:v});break}case"checkbox":case"radiobutton":{const v=f.defaultValue===f.exportValues;u.setValue(p,{value:v});break}case"combobox":case"listbox":{const v=f.defaultValue||"";u.setValue(p,{value:v});break}default:continue}const m=document.querySelector(`[data-element-id="${p}"]`);if(m){if(!o0.has(m)){Ut(`_bindResetFormAction - element not allowed: ${p}`);continue}}else continue;m.dispatchEvent(new Event("resetform"))}return this.enableScripting&&((h=this.linkService.eventBus)==null||h.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:d,name:"ResetForm"}})),!1}}}jl=new WeakSet,Lv=function(){this.container.setAttribute("data-internal-link","")},Jbe=function(n,r,s="",i=null){n.href=this.linkService.getAnchorUrl(""),r.description?n.title=r.description:s&&(n.title=s),n.onclick=()=>{var o;return(o=this.downloadManager)==null||o.openOrDownloadData(r.content,r.filename,i),!1},V(this,jl,Lv).call(this)},Qbe=function(n,r,s=""){n.href=this.linkService.getAnchorUrl(""),n.onclick=()=>(this.linkService.executeSetOCGState(r),!1),s&&(n.title=s),V(this,jl,Lv).call(this)};class bet extends $r{constructor(e){super(e,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const e=document.createElement("img");return e.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",e.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),e.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(e),this.container}}
900class D0 extends $r{render(){return this.container}showElementAndHideCanvas(e){var n;this.data.hasOwnCanvas&&(((n=e.previousSibling)==null?void 0:n.nodeName)==="CANVAS"&&(e.previousSibling.hidden=!0),e.hidden=!1)}_getKeyModifier(e){return yi.platform.isMac?e.metaKey:e.ctrlKey}_setEventListener(e,n,r,s,i){r.includes("mouse")?e.addEventListener(r,o=>{var l;(l=this.linkService.eventBus)==null||l.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:s,value:i(o),shift:o.shiftKey,modifier:this._getKeyModifier(o)}})}):e.addEventListener(r,o=>{var l;if(r==="blur"){if(!n.focused||!o.relatedTarget)return;n.focused=!1}else if(r==="focus"){if(n.focused)return;n.focused=!0}i&&((l=this.linkService.eventBus)==null||l.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:s,value:i(o)}}))})}_setEventListeners(e,n,r,s){var i,o,l;for(const[c,u]of r)(u==="Action"||(i=this.data.actions)!=null&&i[u])&&((u==="Focus"||u==="Blur")&&(n||(n={focused:!1})),this._setEventListener(e,n,c,u,s),u==="Focus"&&!((o=this.data.actions)!=null&&o.Blur)?this._setEventListener(e,n,"blur","Blur",null):u==="Blur"&&!((l=this.data.actions)!=null&&l.Focus)&&this._setEventListener(e,n,"focus","Focus",null))}_setBackgroundColor(e){const n=this.data.backgroundColor||null;e.style.backgroundColor=n===null?"transparent":ot.makeHexColor(n[0],n[1],n[2])}_setTextStyle(e){const n=["left","center","right"],{fontColor:r}=this.data.defaultAppearanceData,s=this.data.defaultAppearanceData.fontSize||vet,i=e.style;let o;const l=2,c=u=>Math.round(10*u)/10;if(this.data.multiLine){const u=Math.abs(this.data.rect[3]-this.data.rect[1]-l),d=Math.round(u/(N5*s))||1,h=u/d;o=Math.min(s,c(h/N5))}else{const u=Math.abs(this.data.rect[3]-this.data.rect[1]-l);o=Math.min(s,c(u/N5))}i.fontSize=`calc(${o}px * var(--total-scale-factor))`,i.color=ot.makeHexColor(r[0],r[1],r[2]),this.data.textAlignment!==null&&(i.textAlign=n[this.data.textAlignment])}_setRequired(e,n){n?e.setAttribute("required",!0):e.removeAttribute("required"),e.setAttribute("aria-required",n)}}class wet extends D0{constructor(e){const n=e.renderForms||e.data.hasOwnCanvas||!e.data.hasAppearance&&!!e.data.fieldValue;super(e,{isRenderable:n})}setPropertyOnSiblings(e,n,r,s){const i=this.annotationStorage;
900for(const o of this._getElementsByName(e.name,e.id))o.domElement&&(o.domElement[n]=r),i.setValue(o.id,{[s]:r})}render(){var s,i;const e=this.annotationStorage,n=this.data.id;this.container.classList.add("textWidgetAnnotation");let r=null;if(this.renderForms){const o=e.getValue(n,{value:this.data.fieldValue});let l=o.value||"";const c=e.getValue(n,{charLimit:this.data.maxLen}).charLimit;c&&l.length>c&&(l=l.slice(0,c));let u=o.formattedValue||((s=this.data.textContent)==null?void 0:s.join(` 901`))||null;u&&this.data.comb&&(u=u.replaceAll(/\s+/g,""));const d={userValue:l,formattedValue:u,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(r=document.createElement("textarea"),r.textContent=u??l,this.data.doNotScroll&&(r.style.overflowY="hidden")):(r=document.createElement("input"),r.type=this.data.password?"password":"text",r.setAttribute("value",u??l),this.data.doNotScroll&&(r.style.overflowX="hidden")),this.data.hasOwnCanvas&&(r.hidden=!0),o0.add(r),r.setAttribute("data-element-id",n),r.disabled=this.data.readOnly,r.name=this.data.fieldName,r.tabIndex=0;const{datetimeFormat:h,datetimeType:f,timeStep:p}=this.data,m=!!f&&this.enableScripting;h&&(r.title=h),this._setRequired(r,this.data.required),c&&(r.maxLength=c),r.addEventListener("input",x=>{e.setValue(n,{value:x.target.value}),this.setPropertyOnSiblings(r,"value",x.target.value,"value"),d.formattedValue=null}),r.addEventListener("resetform",x=>{const g=this.data.defaultFieldValue??"";r.value=d.userValue=g,d.formattedValue=null});let v=x=>{const{formattedValue:g}=d;g!=null&&(x.target.value=g),x.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){r.addEventListener("focus",g=>{var _;if(d.focused)return;const{target:w}=g;if(m&&(w.type=f,p&&(w.step=p)),d.userValue){const j=d.userValue;if(m)if(f==="time"){const N=new Date(j),S=[N.getHours(),N.getMinutes(),N.getSeconds()];w.value=S.map(C=>C.toString().padStart(2,"0")).join(":")}else w.value=new Date(j-xet).toISOString().split(f==="date"?"T":".",1)[0];else w.value=j}d.lastCommittedValue=w.value,d.commitKey=1,(_=this.data.actions)!=null&&_.Focus||(d.focused=!0)}),r.addEventListener("updatefromsandbox",g=>{this.showElementAndHideCanvas(g.target);const w={value(_){d.userValue=_.detail.value??"",m||e.setValue(n,{value:d.userValue.toString()}),_.target.value=d.userValue},formattedValue(_){const{formattedValue:j}=_.detail;d.formattedValue=j,j!=null&&_.target!==document.activeElement&&(_.target.value=j);const N={formattedValue:j};m&&(N.value=j),e.setValue(n,N)},selRange(_){_.target.setSelectionRange(..._.detail.selRange)},charLimit:_=>{var C;const{charLimit:j}=_.detail,{target:N}=_;if(j===0){N.removeAttribute("maxLength");return}N.setAttribute("maxLength",j);let S=d.userValue;!S||S.length<=j||(S=S.slice(0,j),N.value=d.userValue=S,e.setValue(n,{value:S}),(C=this.linkService.eventBus)==null||C.dispatch("dispatcheventinsandbox",{source:this,detail:{id:n,name:"Keystroke",value:S,willCommit:!0,commitKey:1,selStart:N.selectionStart,selEnd:N.selectionEnd}}))}};this._dispatchEventFromSandbox(w,g)}),r.addEventListener("keydown",g=>{var j;d.commitKey=1;let w=-1;
901if(g.key==="Escape"?w=0:g.key==="Enter"&&!this.data.multiLine?w=2:g.key==="Tab"&&(d.commitKey=3),w===-1)return;const{value:_}=g.target;d.lastCommittedValue!==_&&(d.lastCommittedValue=_,d.userValue=_,(j=this.linkService.eventBus)==null||j.dispatch("dispatcheventinsandbox",{source:this,detail:{id:n,name:"Keystroke",value:_,willCommit:!0,commitKey:w,selStart:g.target.selectionStart,selEnd:g.target.selectionEnd}}))});const x=v;v=null,r.addEventListener("blur",g=>{var j,N;if(!d.focused||!g.relatedTarget)return;(j=this.data.actions)!=null&&j.Blur||(d.focused=!1);const{target:w}=g;let{value:_}=w;if(m){if(_&&f==="time"){const S=_.split(":").map(C=>parseInt(C,10));_=new Date(2e3,0,1,S[0],S[1],S[2]||0).valueOf(),w.step=""}else _.includes("T")||(_=`${_}T00:00`),_=new Date(_).valueOf();w.type="text"}d.userValue=_,d.lastCommittedValue!==_&&((N=this.linkService.eventBus)==null||N.dispatch("dispatcheventinsandbox",{source:this,detail:{id:n,name:"Keystroke",value:_,willCommit:!0,commitKey:d.commitKey,selStart:g.target.selectionStart,selEnd:g.target.selectionEnd}})),x(g)}),(i=this.data.actions)!=null&&i.Keystroke&&r.addEventListener("beforeinput",g=>{var E;d.lastCommittedValue=null;const{data:w,target:_}=g,{value:j,selectionStart:N,selectionEnd:S}=_;let C=N,k=S;switch(g.inputType){case"deleteWordBackward":{const P=j.substring(0,N).match(/\w*[^\w]*$/);P&&(C-=P[0].length);break}
vendor: 8,298 bytes, line 901
901case"deleteWordForward":{const P=j.substring(N).match(/^[^\w]*\w*/);P&&(k+=P[0].length);break}case"deleteContentBackward":N===S&&(C-=1);break;case"deleteContentForward":N===S&&(k+=1);break}g.preventDefault(),(E=this.linkService.eventBus)==null||E.dispatch("dispatcheventinsandbox",{source:this,detail:{id:n,name:"Keystroke",value:j,change:w||"",willCommit:!1,selStart:C,selEnd:k}})}),this._setEventListeners(r,d,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],g=>g.target.value)}if(v&&r.addEventListener("blur",v),this.data.comb){const g=(this.data.rect[2]-this.data.rect[0])/c;r.classList.add("comb"),r.style.letterSpacing=`calc(${g}px * var(--total-scale-factor) - 1ch)`}}else r=document.createElement("div"),r.textContent=this.data.fieldValue,r.style.verticalAlign="middle",r.style.display="table-cell",this.data.hasOwnCanvas&&(r.hidden=!0);return this._setTextStyle(r),this._setBackgroundColor(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}}class _et extends D0{constructor(e){super(e,{isRenderable:!!e.data.hasOwnCanvas})}}class jet extends D0{constructor(e){super(e,{isRenderable:e.renderForms})}render(){const e=this.annotationStorage,n=this.data,r=n.id;let s=e.getValue(r,{value:n.exportValue===n.fieldValue}).value;typeof s=="string"&&(s=s!=="Off",e.setValue(r,{value:s})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const i=document.createElement("input");return o0.add(i),i.setAttribute("data-element-id",r),i.disabled=n.readOnly,this._setRequired(i,this.data.required),i.type="checkbox",i.name=n.fieldName,s&&i.setAttribute("checked",!0),i.setAttribute("exportValue",n.exportValue),i.tabIndex=0,i.addEventListener("change",o=>{const{name:l,checked:c}=o.target;for(const u of this._getElementsByName(l,r)){const d=c&&u.exportValue===n.exportValue;u.domElement&&(u.domElement.checked=d),e.setValue(u.id,{value:d})}e.setValue(r,{value:c})}),i.addEventListener("resetform",o=>{const l=n.defaultFieldValue||"Off";o.target.checked=l===n.exportValue}),this.enableScripting&&this.hasJSActions&&(i.addEventListener("updatefromsandbox",o=>{const l={value(c){c.target.checked=c.detail.value!=="Off",e.setValue(r,{value:c.target.checked})}};this._dispatchEventFromSandbox(l,o)}),this._setEventListeners(i,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],o=>o.target.checked)),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class Zbe extends D0{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const e=this.annotationStorage,n=this.data,r=n.id;let s=e.getValue(r,{value:n.fieldValue===n.buttonValue}).value;if(typeof s=="string"&&(s=s!==n.buttonValue,e.setValue(r,{value:s})),s)for(const o of this._getElementsByName(n.fieldName,r))e.setValue(o.id,{value:!1});const i=document.createElement("input");if(o0.add(i),i.setAttribute("data-element-id",r),i.disabled=n.readOnly,this._setRequired(i,this.data.required),i.type="radio",i.name=n.fieldName,s&&i.setAttribute("checked",!0),i.tabIndex=0,i.addEventListener("change",o=>{const{name:l,checked:c}=o.target;for(const u of this._getElementsByName(l,r))e.setValue(u.id,{value:!1});e.setValue(r,{value:c})}),i.addEventListener("resetform",o=>{const l=n.defaultFieldValue;o.target.checked=l!=null&&l===n.buttonValue}),this.enableScripting&&this.hasJSActions){const o=n.buttonValue;i.addEventListener("updatefromsandbox",l=>{const c={value:u=>{const d=o===u.detail.value;for(const h of this._getElementsByName(u.target.name)){const f=d&&h.id===r;h.domElement&&(h.domElement.checked=f),e.setValue(h.id,{value:f})}}};this._dispatchEventFromSandbox(c,l)}),this._setEventListeners(i,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],l=>l.target.checked)}return this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class Net extends M7{constructor(e){super(e,{ignoreBorder:e.data.hasAppearance})}render(){const e=super.render();e.classList.add("buttonWidgetAnnotation","pushButton");const n=e.lastChild;return this.enableScripting&&this.hasJSActions&&n&&(this._setDefaultPropertiesFromJS(n),n.addEventListener("updatefromsandbox",r=>{this._dispatchEventFromSandbox({},r)})),e}}class Cet extends D0{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const e=this.annotationStorage,n=this.data.id,r=e.getValue(n,{value:this.data.fieldValue}),s=document.createElement("select");o0.add(s),s.setAttribute("data-element-id",n),s.disabled=this.data.readOnly,this._setRequired(s,this.data.required),s.name=this.data.fieldName,s.tabIndex=0;let i=this.data.combo&&this.data.options.length>0;this.data.combo||(s.size=this.data.options.length,this.data.multiSelect&&(s.multiple=!0)),s.addEventListener("resetform",d=>{const h=this.data.defaultFieldValue;for(const f of s.options)f.selected=f.value===h});for(const d of this.data.options){const h=document.createElement("option");h.textContent=d.displayValue,h.value=d.exportValue,r.value.includes(d.exportValue)&&(h.setAttribute("selected",!0),i=!1),s.append(h)}let o=null;if(i){const d=document.createElement("option");d.value=" ",d.setAttribute("hidden",!0),d.setAttribute("selected",!0),s.prepend(d),o=()=>{d.remove(),s.removeEventListener("input",o),o=null},s.addEventListener("input",o)}const l=d=>{const h=d?"value":"textContent",{options:f,multiple:p}=s;return p?Array.prototype.filter.call(f,m=>m.selected).map(m=>m[h]):f.selectedIndex===-1?null:f[f.selectedIndex][h]};let c=l(!1);const u=d=>{const h=d.target.options;return Array.prototype.map.call(h,f=>({displayValue:f.textContent,exportValue:f.value}))};return this.enableScripting&&this.hasJSActions?(s.addEventListener("updatefromsandbox",d=>{const h={value(f){o==null||o();const p=f.detail.value,m=new Set(Array.isArray(p)?p:[p]);for(const v of s.options)v.selected=m.has(v.value);e.setValue(n,{value:l(!0)}),c=l(!1)},multipleSelection(f){s.multiple=!0},remove(f){const p=s.options,m=f.detail.remove;p[m].selected=!1,s.remove(m),p.length>0&&Array.prototype.findIndex.call(p,x=>x.selected)===-1&&(p[0].selected=!0),e.setValue(n,{value:l(!0),items:u(f)}),c=l(!1)},clear(f){for(;s.length!==0;)s.remove(0);e.setValue(n,{value:null,items:[]}),c=l(!1)},insert(f){const{index:p,displayValue:m,exportValue:v}=f.detail.insert,x=s.children[p],g=document.createElement("option");g.textContent=m,g.value=v,x?x.before(g):s.append(g),e.setValue(n,{value:l(!0),items:u(f)}),c=l(!1)},items(f){const{items:p}=f.detail;for(;s.length!==0;)s.remove(0);for(const m of p){const{displayValue:v,exportValue:x}=m,g=document.createElement("option");g.textContent=v,g.value=x,s.append(g)}s.options.length>0&&(s.options[0].selected=!0),e.setValue(n,{value:l(!0),items:u(f)}),c=l(!1)},indices(f){const p=new Set(f.detail.indices);for(const m of f.target.options)m.selected=p.has(m.index);e.setValue(n,{value:l(!0)}),c=l(!1)},editable(f){f.target.disabled=!f.detail.editable}};this._dispatchEventFromSandbox(h,d)}),s.addEventListener("input",d=>{var p;const h=l(!0),f=l(!1);e.setValue(n,{value:h}),d.preventDefault(),(p=this.linkService.eventBus)==null||p.dispatch("dispatcheventinsandbox",{source:this,detail:{id:n,name:"Keystroke",value:c,change:f,changeEx:h,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(s,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],d=>d.target.value)):s.addEventListener("input",function(d){e.setValue(n,{value:l(!0)})}),this.data.combo&&this._setTextStyle(s),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}var gE,kU;class CU extends $r{constructor(n){const{data:r,elements:s,parent:i}=n,o=!!i._commentManager;super(n,{isRenderable:!o&&$r._hasPopupData(r)}
901);q(this,gE);if(this.elements=s,o&&$r._hasPopupData(r)){const l=this.popup=V(this,gE,kU).call(this);for(const c of s)c.popup=l}else this.popup=null}render(){const{container:n}=this;n.classList.add("popupAnnotation"),n.role="comment";const r=this.popup=V(this,gE,kU).call(this),s=[];for(const i of this.elements)i.popup=r,i.container.ariaHasPopup="dialog",s.push(i.data.id),i.addHighlightArea();return this.container.setAttribute("aria-controls",s.map(i=>`${S7}${i}`).join(",")),this.container}}gE=new WeakSet,kU=function(){return new ket({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate||this.data.creationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open,commentManager:this.parent._commentManager})};var ll,Um,yL,bL,t_,n_,Yr,Ad,qm,cy,r_,s_,Ed,cl,wf,_f,ri,jf,Vm,vE,Sf,i_,uy,Hm,fa,Wm,Jt,sR,AU,EU,TU,iR,PU,ewe,twe,nwe,rwe,aR,oR,MU;class ket{constructor({container:e,color:n,elements:r,titleObj:s,modificationDate:i,contentsObj:o,richText:l,parent:c,rect:u,parentRect:d,open:h,commentManager:f=null}){q(this,Jt);q(this,ll,null);q(this,Um,V(this,Jt,nwe).bind(this));q(this,yL,V(this,Jt,MU).bind(this));q(this,bL,V(this,Jt,oR).bind(this));q(this,t_,V(this,Jt,aR).bind(this));q(this,n_,null);q(this,Yr,null);q(this,Ad,null);q(this,qm,null);q(this,cy,null);q(this,r_,null);q(this,s_,null);q(this,Ed,!1);q(this,cl,null);q(this,wf,null);q(this,_f,null);q(this,ri,null);q(this,jf,null);q(this,Vm,null);q(this,vE,null);q(this,Sf,null);q(this,i_,null);q(this,uy,null);q(this,Hm,!1);q(this,fa,null);q(this,Wm,null);$(this,Yr,e),$(this,i_,s),$(this,Ad,o),$(this,Sf,l),$(this,r_,c),$(this,n_,n),$(this,vE,u),$(this,s_,d),$(this,cy,r),$(this,ll,f),$(this,fa,r[0]),$(this,qm,Ck.toDateObject(i)),this.trigger=r.flatMap(p=>p.getElementsToTriggerPopup()),f?this.renderCommentButton():(V(this,Jt,sR).call(this),y(this,Yr).hidden=!0,h&&V(this,Jt,aR).call(this))}renderCommentButton(){if(y(this,ri)||(y(this,jf)||V(this,Jt,AU).call(this),!y(this,jf)))return;const{signal:e}=$(this,wf,new AbortController),n=!!y(this,fa).extraPopupElement,r=()=>{y(this,ll).toggleCommentPopup(this,!0,void 0,!n)},s=()=>{y(this,ll).toggleCommentPopup(this,!1,!0,!n)},i=()=>{y(this,ll).toggleCommentPopup(this,!1,!1)};if(n){$(this,ri,y(this,fa).container);for(const o of this.trigger)o.ariaHasPopup="dialog",o.ariaControls="commentPopup",o.addEventListener("keydown",y(this,Um),{signal:e}),o.addEventListener("click",r,{signal:e}),o.addEventListener("pointerenter",s,{signal:e}),o.addEventListener("pointerleave",i,{signal:e}),o.classList.add("popupTriggerArea")}else{const o=$(this,ri,document.createElement("button"));o.className="annotationCommentButton";const l=y(this,fa).container;o.style.zIndex=l.style.zIndex+1,o.tabIndex=0,o.ariaHasPopup="dialog",o.ariaControls="commentPopup",o.setAttribute("data-l10n-id","pdfjs-show-comment-button"),V(this,Jt,TU).call(this),V(this,Jt,EU).call(this),o.addEventListener("keydown",y(this,Um),{signal:e}),o.addEventListener("click",r,{signal:e}),o.addEventListener("pointerenter",s,{signal:e}),o.addEventListener("pointerleave",i,{signal:e}),l.after(o)}}get commentButtonColor(){const{color:e,opacity:n}=y(this,fa).commentData;return e?y(this,r_)._commentManager.makeCommentColor(e,n):null}focusCommentButton(){setTimeout(()=>{var e;(e=y(this,ri))==null||e.focus()},0)}getData(){const{richText:e,color:n,opacity:r,creationDate:s,modificationDate:i}=y(this,fa).commentData;return{contentsObj:{str:this.comment},richText:e,color:n,opacity:r,creationDate:s,modificationDate:i}}get elementBeforePopup(){return y(this,ri)}get comment(){return y(this,Wm)||$(this,Wm,y(this,fa).commentText),y(this,Wm)}set comment(e){e!==this.comment&&(y(this,fa).commentText=$(this,Wm,e))}get parentBoundingClientRect(){return y(this,fa).layer.getBoundingClientRect()}setCommentButtonStates({selected:e,hasPopup:n}){y(this,ri)&&(y(this,ri).classList.toggle("selected",e),y(this,ri).ariaExpanded=n)}setSelectedCommentButton(e){y(this,ri).classList.toggle("selected",e)}get commentPopupPosition(){if(y(this,Vm))return y(this,Vm);const{x:e,y:n,height:r}=y(this,ri).getBoundingClientRect(),{x:s,y:i,width:o,height:l}=y(this,fa).layer.getBoundingClientRect();return[(e-s)/o,(n+r-i)/l]}set commentPopupPosition(e){$(this,Vm,e)}hasDefaultPopupPosition(){return y(this,Vm)===null}get commentButtonPosition(){return y(this,jf)}get commentButtonWidth(){return y(this,ri).getBoundingClientRect().width/this.parentBoundingClientRect.width}editComment(e){const[n,r]=y(this,Vm)||this.commentButtonPosition.map(u=>u/100),s=this.parentBoundingClientRect,{x:i,y:o,width:l,height:c}=s;y(this,ll).showDialog(null,this,i+n*l,o+r*c,{...e,parentDimensions:s})}render(){var r,s;if(y(this,cl))return;const e=$(this,cl,document.createElement("div"));if(e.className="popup",y(this,n_)){const i=e.style.outlineColor=ot.makeHexColor(...y(this,n_));e.style.backgroundColor=`color-mix(in srgb, ${i} 30%, white)`}const n=document.createElement("span");if(n.className="header",(r=y(this,i_))!=null&&r.str){const i=document.createElement("span");i.className="title",n.append(i),{dir:i.dir,str:i.textContent}=y(this,i_)}if(e.append(n),y(this,qm)){const i=document.createElement("time");i.className="popupDate",i.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),i.setAttribute("data-l10n-args",JSON.stringify({dateObj:y(this,qm).valueOf()})),i.dateTime=y(this,qm).toISOString(),n.append(i)}C7({html:y(this,Jt,iR)||y(this,Ad).str,dir:(s=y(this,Ad))==null?void 0:s.dir,className:"popupContent"},e),y(this,Yr).append(e)}updateEdited({rect:e,popup:n,deleted:r}){var s;if(y(this,ll)){r?(this.remove(),$(this,Wm,null)):n&&(n.deleted?this.remove():(V(this,Jt,TU).call(this),$(this,Wm,n.text))),e&&($(this,jf,null),V(this,Jt,AU).call(this),V(this,Jt,EU).call(this));return}if(r||n!=null&&n.deleted){this.remove();return}V(this,Jt,sR).call(this),y(this,uy)||$(this,uy,{contentsObj:y(this,Ad),richText:y(this,Sf)}
901),e&&$(this,_f,null),n&&n.text&&($(this,Sf,V(this,Jt,twe).call(this,n.text)),$(this,qm,Ck.toDateObject(n.date)),$(this,Ad,null)),(s=y(this,cl))==null||s.remove(),$(this,cl,null)}resetEdited(){var e;y(this,uy)&&({contentsObj:Vr(this,Ad)._,richText:Vr(this,Sf)._}=y(this,uy),$(this,uy,null),(e=y(this,cl))==null||e.remove(),$(this,cl,null),$(this,_f,null))}remove(){var e,n,r;if((e=y(this,wf))==null||e.abort(),$(this,wf,null),(n=y(this,cl))==null||n.remove(),$(this,cl,null),$(this,Hm,!1),$(this,Ed,!1),(r=y(this,ri))==null||r.remove(),$(this,ri,null),this.trigger)for(const s of this.trigger)s.classList.remove("popupTriggerArea")}forceHide(){$(this,Hm,this.isVisible),y(this,Hm)&&(y(this,Yr).hidden=!0)}maybeShow(){y(this,ll)||(V(this,Jt,sR).call(this),y(this,Hm)&&(y(this,cl)||V(this,Jt,oR).call(this),$(this,Hm,!1),y(this,Yr).hidden=!1))}get isVisible(){return y(this,ll)?!1:y(this,Yr).hidden===!1}}ll=new WeakMap,Um=new WeakMap,yL=new WeakMap,bL=new WeakMap,t_=new WeakMap,n_=new WeakMap,Yr=new WeakMap,Ad=new WeakMap,qm=new WeakMap,cy=new WeakMap,r_=new WeakMap,s_=new WeakMap,Ed=new WeakMap,cl=new WeakMap,wf=new WeakMap,_f=new WeakMap,ri=new WeakMap,jf=new WeakMap,Vm=new WeakMap,vE=new WeakMap,Sf=new WeakMap,i_=new WeakMap,uy=new WeakMap,Hm=new WeakMap,fa=new WeakMap,Wm=new WeakMap,Jt=new WeakSet,sR=function(){var n;if(y(this,wf))return;$(this,wf,new AbortController);const{signal:e}=y(this,wf);for(const r of this.trigger)r.addEventListener("click",y(this,t_),{signal:e}),r.addEventListener("pointerenter",y(this,bL),{signal:e}),r.addEventListener("pointerleave",y(this,yL),{signal:e}),r.classList.add("popupTriggerArea");for(const r of y(this,cy))(n=r.container)==null||n.addEventListener("keydown",y(this,Um),{signal:e})},AU=function(){const e=y(this,cy).find(n=>n.hasCommentButton);e&&$(this,jf,e._normalizePoint(e.commentButtonPosition))},EU=function(){if(y(this,fa).extraPopupElement&&!y(this,fa).editor)return;this.renderCommentButton();const[e,n]=y(this,jf),{style:r}=y(this,ri);r.left=`calc(${e}%)`,r.top=`calc(${n}% - var(--comment-button-dim))`},TU=function(){y(this,fa).extraPopupElement||(this.renderCommentButton(),y(this,ri).style.backgroundColor=this.commentButtonColor||"")},iR=function(){const e=y(this,Sf),n=y(this,Ad);return e!=null&&e.str&&(!(n!=null&&n.str)||n.str===e.str)&&y(this,Sf).html||null},PU=function(){var e,n,r;return((r=(n=(e=y(this,Jt,iR))==null?void 0:e.attributes)==null?void 0:n.style)==null?void 0:r.fontSize)||0},ewe=function(){var e,n,r;return((r=(n=(e=y(this,Jt,iR))==null?void 0:e.attributes)==null?void 0:n.style)==null?void 0:r.color)||null},twe=function(e){const n=[],r={str:e,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:n}]}},s={style:{color:y(this,Jt,ewe),fontSize:y(this,Jt,PU)?`calc(${y(this,Jt,PU)}px * var(--total-scale-factor))`:""}};for(const i of e.split(` 902`))n.push({name:"span",value:i,attributes:s});return r},nwe=function(e){e.altKey||e.shiftKey||e.ctrlKey||e.metaKey||(e.key==="Enter"||e.key==="Escape"&&y(this,Ed))&&V(this,Jt,aR).call(this)},rwe=function(){if(y(this,_f)!==null)return;const{page:{view:e},viewport:{rawDims:{pageWidth:n,pageHeight:r,pageX:s,pageY:i}}}=y(this,r_);let o=!!y(this,s_),l=o?y(this,s_):y(this,vE);for(const m of y(this,cy))if(!l||ot.intersect(m.data.rect,l)!==null){l=m.data.rect,o=!0;break}const c=ot.normalizeRect([l[0],e[3]-l[1]+e[1],l[2],e[3]-l[3]+e[1]]),d=o?l[2]-l[0]+5:0,h=c[0]+d,f=c[1];$(this,_f,[100*(h-s)/n,100*(f-i)/r]);const{style:p}=y(this,Yr);p.left=`${y(this,_f)[0]}%`,p.top=`${y(this,_f)[1]}%`},aR=function(){if(y(this,ll)){y(this,ll).toggleCommentPopup(this,!1);return}$(this,Ed,!y(this,Ed)),y(this,Ed)?(V(this,Jt,oR).call(this),y(this,Yr).addEventListener("click",y(this,t_)),y(this,Yr).addEventListener("keydown",y(this,Um))):(V(this,Jt,MU).call(this),y(this,Yr).removeEventListener("click",y(this,t_)),y(this,Yr).removeEventListener("keydown",y(this,Um)))},oR=function(){y(this,cl)||this.render(),this.isVisible?y(this,Ed)&&y(this,Yr).classList.add("focused"):(V(this,Jt,rwe).call(this),y(this,Yr).hidden=!1,y(this,Yr).style.zIndex=parseInt(y(this,Yr).style.zIndex)+1e3)},MU=function(){y(this,Yr).classList.remove("focused"),!(y(this,Ed)||!this.isVisible)&&(y(this,Yr).hidden=!0,y(this,Yr).style.zIndex=parseInt(y(this,Yr).style.zIndex)-1e3)};class swe extends $r{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.textContent=e.data.textContent,this.textPosition=e.data.textPosition,this.annotationEditorType=Bt.FREETEXT}
902render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const e=document.createElement("div");e.classList.add("annotationTextContent"),e.setAttribute("role","comment");for(const n of this.textContent){const r=document.createElement("span");r.textContent=n,e.append(r)}this.container.append(e)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}var xE;class Aet extends $r{constructor(n){super(n,{isRenderable:!0,ignoreBorder:!0});q(this,xE,null)}render(){this.container.classList.add("lineAnnotation");const{data:n,width:r,height:s}=this,i=this.svgFactory.create(r,s,!0),o=$(this,xE,this.svgFactory.createElement("svg:line"));return o.setAttribute("x1",n.rect[2]-n.lineCoordinates[0]),o.setAttribute("y1",n.rect[3]-n.lineCoordinates[1]),o.setAttribute("x2",n.rect[2]-n.lineCoordinates[2]),o.setAttribute("y2",n.rect[3]-n.lineCoordinates[3]),o.setAttribute("stroke-width",n.borderStyle.width||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),i.append(o),this.container.append(i),!n.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return y(this,xE)}addHighlightArea(){this.container.classList.add("highlightArea")}}xE=new WeakMap;var yE;class Eet extends $r{constructor(n){super(n,{isRenderable:!0,ignoreBorder:!0});q(this,yE,null)}render(){this.container.classList.add("squareAnnotation");const{data:n,width:r,height:s}=this,i=this.svgFactory.create(r,s,!0),o=n.borderStyle.width,l=$(this,yE,this.svgFactory.createElement("svg:rect"));return l.setAttribute("x",o/2),l.setAttribute("y",o/2),l.setAttribute("width",r-o),l.setAttribute("height",s-o),l.setAttribute("stroke-width",o||1),l.setAttribute("stroke","transparent"),l.setAttribute("fill","transparent"),i.append(l),this.container.append(i),!n.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return y(this,yE)}addHighlightArea(){this.container.classList.add("highlightArea")}}yE=new WeakMap;var bE;class Tet extends $r{constructor(n){super(n,{isRenderable:!0,ignoreBorder:!0});q(this,bE,null)}render(){this.container.classList.add("circleAnnotation");const{data:n,width:r,height:s}=this,i=this.svgFactory.create(r,s,!0),o=n.borderStyle.width,l=$(this,bE,this.svgFactory.createElement("svg:ellipse"));return l.setAttribute("cx",r/2),l.setAttribute("cy",s/2),l.setAttribute("rx",r/2-o/2),l.setAttribute("ry",s/2-o/2),l.setAttribute("stroke-width",o||1),l.setAttribute("stroke","transparent"),l.setAttribute("fill","transparent"),i.append(l),this.container.append(i),!n.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return y(this,bE)}addHighlightArea(){this.container.classList.add("highlightArea")}}bE=new WeakMap;var wE;class iwe extends $r{constructor(n){super(n,{isRenderable:!0,ignoreBorder:!0});q(this,wE,null);this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:n,vertices:r,borderStyle:s,popupRef:i},width:o,height:l}=this;if(!r)return this.container;const c=this.svgFactory.create(o,l,!0);let u=[];for(let h=0,f=r.length;h<f;h+=2){const p=r[h]-n[0],m=n[3]-r[h+1];u.push(`${p},${m}`)}u=u.join(" ");const d=$(this,wE,this.svgFactory.createElement(this.svgElementName));return d.setAttribute("points",u),d.setAttribute("stroke-width",s.width||1),d.setAttribute("stroke","transparent"),d.setAttribute("fill","transparent"),c.append(d),this.container.append(c),!i&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return y(this,wE)}addHighlightArea(){this.container.classList.add("highlightArea")}}wE=new WeakMap;class Pet extends iwe{constructor(e){super(e),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class Met extends $r{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}
902var _E,dy,jE,RU;class R7 extends $r{constructor(n){super(n,{isRenderable:!0,ignoreBorder:!0});q(this,jE);q(this,_E,null);q(this,dy,[]);this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=this.data.it==="InkHighlight"?Bt.HIGHLIGHT:Bt.INK}render(){this.container.classList.add(this.containerClassName);const{data:{rect:n,rotation:r,inkLists:s,borderStyle:i,popupRef:o}}=this,{transform:l,width:c,height:u}=V(this,jE,RU).call(this,r,n),d=this.svgFactory.create(c,u,!0),h=$(this,_E,this.svgFactory.createElement("svg:g"));d.append(h),h.setAttribute("stroke-width",i.width||1),h.setAttribute("stroke-linecap","round"),h.setAttribute("stroke-linejoin","round"),h.setAttribute("stroke-miterlimit",10),h.setAttribute("stroke","transparent"),h.setAttribute("fill","transparent"),h.setAttribute("transform",l);for(let f=0,p=s.length;f<p;f++){const m=this.svgFactory.createElement(this.svgElementName);y(this,dy).push(m),m.setAttribute("points",s[f].join(",")),h.append(m)}return!o&&this.hasPopupData&&this._createPopup(),this.container.append(d),this._editOnDoubleClick(),this.container}updateEdited(n){super.updateEdited(n);const{thickness:r,points:s,rect:i}=n,o=y(this,_E);if(r>=0&&o.setAttribute("stroke-width",r||1),s)for(let l=0,c=y(this,dy).length;l<c;l++)y(this,dy)[l].setAttribute("points",s[l].join(","));if(i){const{transform:l,width:c,height:u}=V(this,jE,RU).call(this,this.data.rotation,i);o.parentElement.setAttribute("viewBox",`0 0 ${c} ${u}`),o.setAttribute("transform",l)}}getElementsToTriggerPopup(){return y(this,dy)}addHighlightArea(){this.container.classList.add("highlightArea")}}_E=new WeakMap,dy=new WeakMap,jE=new WeakSet,RU=function(n,r){switch(n){case 90:return{transform:`rotate(90) translate(${-r[0]},${r[1]}) scale(1,-1)`,width:r[3]-r[1],height:r[2]-r[0]};case 180:return{transform:`rotate(180) translate(${-r[2]},${r[1]}) scale(1,-1)`,width:r[2]-r[0],height:r[3]-r[1]};case 270:return{transform:`rotate(270) translate(${-r[2]},${r[3]}) scale(1,-1)`,width:r[3]-r[1],height:r[2]-r[0]};default:return{transform:`translate(${-r[0]},${r[3]}) scale(1,-1)`,width:r[2]-r[0],height:r[3]-r[1]}}};class awe extends $r{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=Bt.HIGHLIGHT}render(){const{data:{overlaidText:e,popupRef:n}}=this;if(!n&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),e){const r=document.createElement("mark");r.classList.add("overlaidText"),r.textContent=e,this.container.append(r)}return this.container}}class Ret extends $r{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:e,popupRef:n}}=this;if(!n&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),e){const r=document.createElement("u");r.classList.add("overlaidText"),r.textContent=e,this.container.append(r)}return this.container}}class Oet extends $r{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:e,popupRef:n}}=this;if(!n&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),e){const r=document.createElement("u");r.classList.add("overlaidText"),r.textContent=e,this.container.append(r)}return this.container}}class Iet extends $r{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:e,popupRef:n}}=this;if(!n&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),e){const r=document.createElement("s");r.classList.add("overlaidText"),r.textContent=e,this.container.append(r)}return this.container}}class owe extends $r{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=Bt.STAMP}render(){return this.container.classList.add("stampAnnotation"),this.container.setAttribute("role","img"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}
902var SE,NE,OU;class Det extends $r{constructor(n){var s;super(n,{isRenderable:!0});q(this,NE);q(this,SE,null);const{file:r}=this.data;this.filename=r.filename,this.content=r.content,(s=this.linkService.eventBus)==null||s.dispatch("fileattachmentannotation",{source:this,...r})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:n,data:r}=this;let s;r.hasAppearance||r.fillAlpha===0?s=document.createElement("div"):(s=document.createElement("img"),s.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(r.name)?"paperclip":"pushpin"}.svg`,r.fillAlpha&&r.fillAlpha<1&&(s.style=`filter: opacity(${Math.round(r.fillAlpha*100)}%);`)),s.addEventListener("dblclick",V(this,NE,OU).bind(this)),$(this,SE,s);const{isMac:i}=yi.platform;return n.addEventListener("keydown",o=>{o.key==="Enter"&&(i?o.metaKey:o.ctrlKey)&&V(this,NE,OU).call(this)}),!r.popupRef&&this.hasPopupData?this._createPopup():s.classList.add("popupTriggerArea"),n.append(s),n}getElementsToTriggerPopup(){return y(this,SE)}addHighlightArea(){this.container.classList.add("highlightArea")}}SE=new WeakMap,NE=new WeakSet,OU=function(){var n;(n=this.downloadManager)==null||n.openOrDownloadData(this.content,this.filename)};var a_,hy,o_,Km,CE,fy,Gg,IU,DU,l_;let O7=(l_=class{constructor({div:e,accessibilityManager:n,annotationCanvasMap:r,annotationEditorUIManager:s,page:i,viewport:o,structTreeLayer:l,commentManager:c,linkService:u,annotationStorage:d}){q(this,Gg);q(this,a_,null);q(this,hy,null);q(this,o_,null);q(this,Km,new Map);q(this,CE,null);q(this,fy,null);this.div=e,$(this,a_,n),$(this,hy,r),$(this,CE,l||null),$(this,fy,u||null),$(this,o_,d||new k7),this.page=i,this.viewport=o,this.zIndex=0,this._annotationEditorUIManager=s,this._commentManager=c||null}hasEditableAnnotations(){return y(this,Km).size>0}async render(e){var o,l,c;const{annotations:n}=e,r=this.div;$g(r,this.viewport);const s=new Map,i={data:null,layer:r,linkService:y(this,fy),downloadManager:e.downloadManager,imageResourcesPath:e.imageResourcesPath||"",renderForms:e.renderForms!==!1,svgFactory:new Tk,annotationStorage:y(this,o_),enableComment:e.enableComment===!0,enableScripting:e.enableScripting===!0,hasJSActions:e.hasJSActions,fieldObjects:e.fieldObjects,parent:this,elements:null};for(const u of n){if(u.noHTML)continue;const d=u.annotationType===ds.POPUP;if(d){const p=s.get(u.id);if(!p)continue;i.elements=p}else if(u.rect[2]===u.rect[0]||u.rect[3]===u.rect[1])continue;i.data=u;const h=Hte.create(i);if(!h.isRenderable)continue;if(!d&&u.popupRef){const p=s.get(u.popupRef);p?p.push(h):s.set(u.popupRef,[h])}const f=h.render();u.hidden&&(f.style.visibility="hidden"),await V(this,Gg,IU).call(this,f,u.id,i.elements),(l=(o=h.extraPopupElement)==null?void 0:o.popup)==null||l.renderCommentButton(),h._isEditable&&(y(this,Km).set(h.data.id,h),(c=this._annotationEditorUIManager)==null||c.renderAnnotationElement(h))}V(this,Gg,DU).call(this)}async addLinkAnnotations(e){const n={data:null,layer:this.div,linkService:y(this,fy),svgFactory:new Tk,parent:this};for(const r of e){r.borderStyle||(r.borderStyle=l_._defaultBorderStyle),n.data=r;const s=Hte.create(n);if(!s.isRenderable)continue;const i=s.render();await V(this,Gg,IU).call(this,i,r.id,null)}}update({viewport:e}){const n=this.div;this.viewport=e,$g(n,{rotation:e.rotation}),V(this,Gg,DU).call(this),n.hidden=!1}getEditableAnnotations(){return Array.from(y(this,Km).values())}getEditableAnnotation(e){return y(this,Km).get(e)}addFakeAnnotation(e){var l;const{div:n}=this,{id:r,rotation:s}=e,i=new yet({data:{id:r,rect:e.getPDFRect(),rotation:s},editor:e,layer:n,parent:this,enableComment:!!this._commentManager,linkService:y(this,fy),annotationStorage:y(this,o_)}),o=i.render();return n.append(o),(l=y(this,a_))==null||l.moveElementInDOM(n,o,o,!1),i.createOrUpdatePopup(),i}static get _defaultBorderStyle(){return Gt(this,"_defaultBorderStyle",Object.freeze({width:1,rawWidth:1,style:Tb.SOLID,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}},a_=new WeakMap,hy=new WeakMap,o_=new WeakMap,Km=new WeakMap,CE=new WeakMap,fy=new WeakMap,Gg=new WeakSet,IU=async function(e,n,r){var l,c;const s=e.firstChild||e,i=s.id=`${S7}${n}
902`,o=await((l=y(this,CE))==null?void 0:l.getAriaAttributes(i));if(o)for(const[u,d]of o)s.setAttribute(u,d);r?r.at(-1).container.after(e):(this.div.append(e),(c=y(this,a_))==null||c.moveElementInDOM(this.div,e,s,!1))},DU=function(){var n;if(!y(this,hy))return;const e=this.div;for(const[r,s]of y(this,hy)){const i=e.querySelector(`[data-annotation-id="${r}"]`);if(!i)continue;s.className="annotationContent";const{firstChild:o}=i;o?o.nodeName==="CANVAS"?o.replaceWith(s):o.classList.contains("annotationContent")?o.after(s):o.before(s):i.append(s);const l=y(this,Km).get(r);l&&(l._hasNoCanvas?((n=this._annotationEditorUIManager)==null||n.setMissingCanvas(r,i.id,s),l._hasNoCanvas=!1):l.canvas=s)}y(this,hy).clear()},l_);const vP=/\r\n?|\n/g;var ul,kE,py,dl,Es,lwe,cwe,uwe,lR,Wf,cR,uR,dwe,FU,hwe;const gr=class gr extends cr{constructor(n){super({...n,name:"freeTextEditor"});q(this,Es);q(this,ul,"");q(this,kE,`${this.id}-editor`);q(this,py,null);q(this,dl);Te(this,"_colorPicker",null);this.color=n.color||gr._defaultColor||cr._defaultLineColor,$(this,dl,n.fontSize||gr._defaultFontSize),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-freetext-added-alert")}static get _keyboardManager(){const n=gr.prototype,r=o=>o.isEmpty(),s=zg.TRANSLATE_SMALL,i=zg.TRANSLATE_BIG;return Gt(this,"_keyboardManager",new k2([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],n.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],n.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],n._translateEmpty,{args:[-s,0],checker:r}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],n._translateEmpty,{args:[-i,0],checker:r}],[["ArrowRight","mac+ArrowRight"],n._translateEmpty,{args:[s,0],checker:r}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],n._translateEmpty,{args:[i,0],checker:r}],[["ArrowUp","mac+ArrowUp"],n._translateEmpty,{args:[0,-s],checker:r}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],n._translateEmpty,{args:[0,-i],checker:r}],[["ArrowDown","mac+ArrowDown"],n._translateEmpty,{args:[0,s],checker:r}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],n._translateEmpty,{args:[0,i],checker:r}]]))}static initialize(n,r){cr.initialize(n,r);const s=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(s.getPropertyValue("--freetext-padding"))}static updateDefaultParams(n,r){switch(n){case sn.FREETEXT_SIZE:gr._defaultFontSize=r;break;case sn.FREETEXT_COLOR:gr._defaultColor=r;break}}updateParams(n,r){switch(n){case sn.FREETEXT_SIZE:V(this,Es,lwe).call(this,r);break;case sn.FREETEXT_COLOR:V(this,Es,cwe).call(this,r);break}}static get defaultPropertiesToUpdate(){return[[sn.FREETEXT_SIZE,gr._defaultFontSize],[sn.FREETEXT_COLOR,gr._defaultColor||cr._defaultLineColor]]}get propertiesToUpdate(){return[[sn.FREETEXT_SIZE,y(this,dl)],[sn.FREETEXT_COLOR,this.color]]}get toolbarButtons(){return this._colorPicker||(this._colorPicker=new lI(this)),[["colorPicker",this._colorPicker]]}get colorType(){return sn.FREETEXT_COLOR}onUpdatedColor(){var n;this.editorDiv.style.color=this.color,(n=this._colorPicker)==null||n.update(this.color),super.onUpdatedColor()}_translateEmpty(n,r){this._uiManager.translateSelectedEditors(n,r,!0)}getInitialTranslation(){const n=this.parentScale;return[-gr._internalPadding*n,-(gr._internalPadding+y(this,dl))*n]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(!super.enableEditMode())return!1;this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),$(this,py,new AbortController);const n=this._uiManager.combinedSignal(y(this,py));return this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:n}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:n}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:n}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:n}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:n}),!0}disableEditMode(){var n;return super.disableEditMode()?(this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",y(this,kE)),this._isDraggable=!0,(n=y(this,py))==null||n.abort(),$(this,py,null),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"),!0):!1}focusin(n){this._focusEventsAllowed&&(super.focusin(n),n.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(n){var r;this.width||(this.enableEditMode(),n&&this.editorDiv.focus(),(r=this._initialOptions)!=null&&r.isCentered&&this.center(),this._initialOptions=null)}isEmpty(){return!this.editorDiv||this.editorDiv.innerText.trim()===""}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add("freetextEditing")),super.remove()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();const n=y(this,ul),r=$(this,ul,V(this,Es,uwe).call(this).trimEnd());if(n===r)return;const s=i=>{if($(this,ul,i),!i){this.remove();return}V(this,Es,uR).call(this),this._uiManager.rebuild(this),V(this,Es,lR).call(this)};this.addCommands({cmd:()=>{s(r)}
902,undo:()=>{s(n)},mustExec:!1}),V(this,Es,lR).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}keydown(n){n.target===this.div&&n.key==="Enter"&&(this.enterInEditMode(),n.preventDefault())}editorDivKeydown(n){gr._keyboardManager.exec(this,n)}editorDivFocus(n){this.isEditing=!0}editorDivBlur(n){this.isEditing=!1}editorDivInput(n){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}get canChangeContent(){return!0}render(){if(this.div)return this.div;let n,r;(this._isCopy||this.annotationElementId)&&(n=this.x,r=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",y(this,kE)),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text2"),this.editorDiv.setAttribute("data-l10n-attrs","default-content"),this.enableEditing(),this.editorDiv.contentEditable=!0;const{style:s}=this.editorDiv;if(s.fontSize=`calc(${y(this,dl)}px * var(--total-scale-factor))`,s.color=this.color,this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),this._isCopy||this.annotationElementId){const[i,o]=this.parentDimensions;if(this.annotationElementId){const{position:l}=this._initialData;let[c,u]=this.getInitialTranslation();[c,u]=this.pageTranslationToScreen(c,u);const[d,h]=this.pageDimensions,[f,p]=this.pageTranslation;let m,v;switch(this.rotation){case 0:m=n+(l[0]-f)/d,v=r+this.height-(l[1]-p)/h;break;case 90:m=n+(l[0]-f)/d,v=r-(l[1]-p)/h,[c,u]=[u,-c];break;case 180:m=n-this.width+(l[0]-f)/d,v=r-(l[1]-p)/h,[c,u]=[-c,-u];break;case 270:m=n+(l[0]-f-this.height*h)/d,v=r+(l[1]-p-this.width*d)/h,[c,u]=[-u,c];break}this.setAt(m*i,v*o,c,u)}else this._moveAfterPaste(n,r);V(this,Es,uR).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(n){var m,v,x;const r=n.clipboardData||window.clipboardData,{types:s}=r;if(s.length===1&&s[0]==="text/plain")return;n.preventDefault();const i=V(m=gr,Wf,FU).call(m,r.getData("text")||"").replaceAll(vP,` 903`);if(!i)return;const o=window.getSelection();if(!o.rangeCount)return;this.editorDiv.normalize(),o.deleteFromDocument();const l=o.getRangeAt(0);if(!i.includes(` 904`)){l.insertNode(document.createTextNode(i)),this.editorDiv.normalize(),o.collapseToStart();return}const{startContainer:c,startOffset:u}=l,d=[],h=[];if(c.nodeType===Node.TEXT_NODE){const g=c.parentElement;if(h.push(c.nodeValue.slice(u).replaceAll(vP,"")),g!==this.editorDiv){let w=d;for(const _ of this.editorDiv.childNodes){if(_===g){w=h;continue}w.push(V(v=gr,Wf,cR).call(v,_))}}d.push(c.nodeValue.slice(0,u).replaceAll(vP,""))}else if(c===this.editorDiv){let g=d,w=0;for(const _ of this.editorDiv.childNodes)w++===u&&(g=h),g.push(V(x=gr,Wf,cR).call(x,_))}$(this,ul,`${d.join(` 905`)}${i}${h.join(` 906`)}`),V(this,Es,uR).call(this);const f=new Range;let p=Math.sumPrecise(d.map(g=>g.length));for(const{firstChild:g}of this.editorDiv.childNodes)if(g.nodeType===Node.TEXT_NODE){const w=g.nodeValue.length;if(p<=w){f.setStart(g,p),f.setEnd(g,p);break}p-=w}o.removeAllRanges(),o.addRange(f)}get contentDiv(){return this.editorDiv}getPDFRect(){const n=gr._internalPadding*this.parentScale;return this.getRect(n,n)}static async deserialize(n,r,s){var l;let i=null;if(n instanceof swe){const{data:{defaultAppearanceData:{fontSize:c,fontColor:u},rect:d,rotation:h,id:f,popupRef:p,richText:m,contentsObj:v,creationDate:x,modificationDate:g},textContent:w,textPosition:_,parent:{page:{pageNumber:j}}}=n;if(!w||w.length===0)return null;i=n={annotationType:Bt.FREETEXT,color:Array.from(u),fontSize:c,value:w.join(` 907`),position:_,pageIndex:j-1,rect:d.slice(0),rotation:h,annotationElementId:f,id:f,deleted:!1,popupRef:p,comment:(v==null?void 0:v.str)||null,richText:m,creationDate:x,modificationDate:g}}const o=await super.deserialize(n,r,s);return $(o,dl,n.fontSize),o.color=ot.makeHexColor(...n.color),$(o,ul,V(l=gr,Wf,FU).call(l,n.value)),o._initialData=i,n.comment&&o.setCommentData(n),o}serialize(n=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const r=cr._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.color),s=Object.assign(super.serialize(n),{color:r,fontSize:y(this,dl),value:V(this,Es,dwe).call(this)});return this.addComment(s),n?(s.isCopy=!0,s):this.annotationElementId&&!V(this,Es,hwe).call(this,s)?null:(s.id=this.annotationElementId,s)}renderAnnotationElement(n){const r=super.renderAnnotationElement(n);if(!r)return null;const{style:s}=r;s.fontSize=`calc(${y(this,dl)}px * var(--total-scale-factor))`,s.color=this.color,r.replaceChildren();for(const i of y(this,ul).split(` 908`)){const o=document.createElement("div");o.append(i?document.createTextNode(i):document.createElement("br")),r.append(o)}return n.updateEdited({rect:this.getPDFRect(),popup:this._uiManager.hasCommentManager()||this.hasEditedComment?this.comment:{text:y(this,ul)}}),r}resetAnnotationElement(n){super.resetAnnotationElement(n),n.resetEdited()}};ul=new WeakMap,kE=new WeakMap,py=new WeakMap,dl=new WeakMap,Es=new WeakSet,lwe=function(n){const r=i=>{this.editorDiv.style.fontSize=`calc(${i}px * var(--total-scale-factor))`,this.translate(0,-(i-y(this,dl))*this.parentScale),$(this,dl,i),V(this,Es,lR).call(this)},s=y(this,dl);this.addCommands({cmd:r.bind(this,n),undo:r.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:sn.FREETEXT_S
908IZE,overwriteIfSameType:!0,keepUndo:!0})},cwe=function(n){const r=i=>{this.color=i,this.onUpdatedColor()},s=this.color;this.addCommands({cmd:r.bind(this,n),undo:r.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:sn.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},uwe=function(){var s;const n=[];this.editorDiv.normalize();let r=null;for(const i of this.editorDiv.childNodes)(r==null?void 0:r.nodeType)===Node.TEXT_NODE&&i.nodeName==="BR"||(n.push(V(s=gr,Wf,cR).call(s,i)),r=i);return n.join(` 909`)},lR=function(){const[n,r]=this.parentDimensions;let s;if(this.isAttachedToDOM)s=this.div.getBoundingClientRect();else{const{currentLayer:i,div:o}=this,l=o.style.display,c=o.classList.contains("hidden");o.classList.remove("hidden"),o.style.display="hidden",i.div.append(this.div),s=o.getBoundingClientRect(),o.remove(),o.style.display=l,o.classList.toggle("hidden",c)}this.rotation%180===this.parentRotation%180?(this.width=s.width/n,this.height=s.height/r):(this.width=s.height/n,this.height=s.width/r),this.fixAndSetPosition()},Wf=new WeakSet,cR=function(n){return(n.nodeType===Node.TEXT_NODE?n.nodeValue:n.innerText).replaceAll(vP,"")},uR=function(){if(this.editorDiv.replaceChildren(),!!y(this,ul))for(const n of y(this,ul).split(` 910`)){const r=document.createElement("div");r.append(n?document.createTextNode(n):document.createElement("br")),this.editorDiv.append(r)}},dwe=function(){return y(this,ul).replaceAll("Â "," ")},FU=function(n){return n.replaceAll(" ","Â ")},hwe=function(n){const{value:r,fontSize:s,color:i,pageIndex:o}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||n.value!==r||n.fontSize!==s||n.color.some((l,c)=>l!==i[c])||n.pageIndex!==o},q(gr,Wf),Te(gr,"_freeTextDefaultContent",""),Te(gr,"_internalPadding",0),Te(gr,"_defaultColor",null),Te(gr,"_defaultFontSize",10),Te(gr,"_type","freetext"),Te(gr,"_editorType",Bt.FREETEXT);let LU=gr;class at{toSVGPath(){Zn("Abstract method `toSVGPath` must be implemented.")}get box(){Zn("Abstract getter `box` must be implemented.")}serialize(e,n){Zn("Abstract method `serialize` must be implemented.")}static _rescale(e,n,r,s,i,o){o||(o=new Float32Array(e.length));for(let l=0,c=e.length;l<c;l+=2)o[l]=n+e[l]*s,o[l+1]=r+e[l+1]*i;return o}static _rescaleAndSwap(e,n,r,s,i,o){o||(o=new Float32Array(e.length));for(let l=0,c=e.length;l<c;l+=2)o[l]=n+e[l+1]*s,o[l+1]=r+e[l]*i;return o}static _translate(e,n,r,s){s||(s=new Float32Array(e.length));for(let i=0,o=e.length;i<o;i+=2)s[i]=n+e[i],s[i+1]=r+e[i+1];return s}static svgRound(e){return Math.round(e*1e4)}static _normalizePoint(e,n,r,s,i){switch(i){case 90:return[1-n/r,e/s];case 180:return[1-e/r,1-n/s];case 270:return[n/r,1-e/s];default:return[e/r,n/s]}}static _normalizePagePoint(e,n,r){switch(r){case 90:return[1-n,e];case 180:return[1-e,1-n];case 270:return[n,1-e];default:return[e,n]}}static createBezierPoints(e,n,r,s,i,o){return[(e+5*r)/6,(n+5*s)/6,(5*r+i)/6,(5*s+o)/6,(r+i)/2,(s+o)/2]}}Te(at,"PRECISION",1e-4);var hl,hu,c_,u_,Td,tn,my,gy,AE,EE,d_,h_,Gm,TE,wL,_L,Ws,CN,fwe,pwe,mwe,gwe,vwe,xwe;const Wh=class Wh{constructor({x:e,y:n},r,s,i,o,l=0){q(this,Ws);q(this,hl);q(this,hu,[]);q(this,c_);q(this,u_);q(this,Td,[]);q(this,tn,new Float32Array(18));q(this,my);q(this,gy);q(this,AE);q(this,EE);q(this,d_);q(this,h_);q(this,Gm,[]);$(this,hl,r),$(this,h_,i*s),$(this,u_,o),y(this,tn).set([NaN,NaN,NaN,NaN,e,n],6),$(this,c_,l),$(this,EE,y(Wh,TE)*s),$(this,AE,y(Wh,_L)*s),$(this,d_,s),y(this,Gm).push(e,n)}isEmpty(){return isNaN(y(this,tn)[8])}add({x:e,y:n}){var E;$(this,my,e),$(this,gy,n);const[r,s,i,o]=y(this,hl);let[l,c,u,d]=y(this,tn).subarray(8,12);const h=e-u,f=n-d,p=Math.hypot(h,f);if(p<y(this,AE))return!1;const m=p-y(this,EE),v=m/p,x=v*h,g=v*f;let w=l,_=c;l=u,c=d,u+=x,d+=g,(E=y(this,Gm))==null||E.push(e,n);const j=-g/m,N=x/m,S=j*y(this,h_),C=N*y(this,h_);return y(this,tn).set(y(this,tn).subarray(2,8),0),y(this,tn).set([u+S,d+C],4),y(this,tn).set(y(this,tn).subarray(14,18),12),y(this,tn).set([u-S,d-C],16),isNaN(y(this,tn)[6])?(y(this,Td).length===0&&(y(this,tn).set([l+S,c+C],2),y(this,Td).push(NaN,NaN,NaN,NaN,(l+S-r)/i,(c+C-s)/o),y(this,tn).set([l-S,c-C],14),y(this,hu).push(NaN,NaN,NaN,NaN,(l-S-r)/i,(c-C-s)/o)),y(this,tn).set([w,_,l,c,u,d],6),!this.isEmpty()):(y(this,tn).set([w,_,l,c,u,d],6),Math.abs(Math.atan2(_-c,w-l)-Math.atan2(g,x))<Math.PI/2?([l,c,u,d]=y(this,tn).subarray(2,6),y(this,Td).push(NaN,NaN,NaN,NaN,((l+u)/2-r)/i,((c+d)/2-s)/o),[l,c,w,_]=y(this,tn).subarray(14,18),y(this,hu).push(NaN,NaN,NaN,NaN,((w+l)/2-r)/i,((_+c)/2-s)/o),!0):([w,_,l,c,u,d]=y(this,tn).subarray(0,6),y(this,Td).push(((w+5*l)/6-r)/i,((_+5*c)/6-s)/o,((5*l+u)/6-r)/i,((5*c+d)/6-s)/o,((l+u)/2-r)/i,((c+d)/2-s)/o),[u,d,l,c,w,_]=y(this,tn).subarray(12,18),y(this,hu).push(((w+5*l)/6-r)/i,((_+5*c)/6-s)/o,((5*l+u)/6-r)/i,((5*c+d)/6-s)/o,((l+u)/2-r)/i,((c+d)/2-s)/o),!0))}toSVGPath(){if(this.isEmpty())return"";const e=y(this,Td),n=y(this,hu);if(isNaN(y(this,tn)[6])&&!this.isEmpty())return V(this,Ws,fwe).call(this);const r=[];r.push(`M${e[4]} ${e[5]}`);for(let s=6;s<e.length;s+=6)isNaN(e[s])?r.push(`L${e[s+4]} ${e[s+5]}`):r.push(`C${e[s]} ${e[s+1]} ${e[s+2]} ${e[s+3]} ${e[s+4]} ${e[s+5]}`);V(this,Ws,mwe).call(this,r);for(let s=n.length-6;s>=6;s-=6)isNaN(n[s])?r.push(`L${n[s+4]} ${n[s+5]}`):r.push(`C${n[s]} ${n[s+1]} ${n[s+2]} ${n[s+3]} ${n[s+4]} ${n[s+5]}`);return V(this,Ws,pwe).call(this,r),r.join(" ")}newFreeDrawOutline(e,n,r,s,i,o){return new ywe(e,n,r,s,i,o)}getOutlines(){var h;const e=y(this,Td),n=y(this,hu),r=y(this,tn),[s,i,o,l]=y(this,hl),c=new Float32Array((((h=y(this,Gm))==null?void 0:h.length)??0)+2);for(let f=0,p=c.length-2;f<p;f+=2)c[f]=(y(this,Gm)[f]-s)/o,c[f+1]=(y(this,Gm)[f+1]-i)/l;
910if(c[c.length-2]=(y(this,my)-s)/o,c[c.length-1]=(y(this,gy)-i)/l,isNaN(r[6])&&!this.isEmpty())return V(this,Ws,gwe).call(this,c);const u=new Float32Array(y(this,Td).length+24+y(this,hu).length);let d=e.length;for(let f=0;f<d;f+=2){if(isNaN(e[f])){u[f]=u[f+1]=NaN;continue}u[f]=e[f],u[f+1]=e[f+1]}d=V(this,Ws,xwe).call(this,u,d);for(let f=n.length-6;f>=6;f-=6)for(let p=0;p<6;p+=2){if(isNaN(n[f+p])){u[d]=u[d+1]=NaN,d+=2;continue}u[d]=n[f+p],u[d+1]=n[f+p+1],d+=2}return V(this,Ws,vwe).call(this,u,d),this.newFreeDrawOutline(u,c,y(this,hl),y(this,d_),y(this,c_),y(this,u_))}};hl=new WeakMap,hu=new WeakMap,c_=new WeakMap,u_=new WeakMap,Td=new WeakMap,tn=new WeakMap,my=new WeakMap,gy=new WeakMap,AE=new WeakMap,EE=new WeakMap,d_=new WeakMap,h_=new WeakMap,Gm=new WeakMap,TE=new WeakMap,wL=new WeakMap,_L=new WeakMap,Ws=new WeakSet,CN=function(){const e=y(this,tn).subarray(4,6),n=y(this,tn).subarray(16,18),[r,s,i,o]=y(this,hl);return[(y(this,my)+(e[0]-n[0])/2-r)/i,(y(this,gy)+(e[1]-n[1])/2-s)/o,(y(this,my)+(n[0]-e[0])/2-r)/i,(y(this,gy)+(n[1]-e[1])/2-s)/o]},fwe=function(){const[e,n,r,s]=y(this,hl),[i,o,l,c]=V(this,Ws,CN).call(this);return`M${(y(this,tn)[2]-e)/r} ${(y(this,tn)[3]-n)/s} L${(y(this,tn)[4]-e)/r} ${(y(this,tn)[5]-n)/s} L${i} ${o} L${l} ${c} L${(y(this,tn)[16]-e)/r} ${(y(this,tn)[17]-n)/s} L${(y(this,tn)[14]-e)/r} ${(y(this,tn)[15]-n)/s} Z`},pwe=function(e){const n=y(this,hu);e.push(`L${n[4]} ${n[5]} Z`)},mwe=function(e){const[n,r,s,i]=y(this,hl),o=y(this,tn).subarray(4,6),l=y(this,tn).subarray(16,18),[c,u,d,h]=V(this,Ws,CN).call(this);e.push(`L${(o[0]-n)/s} ${(o[1]-r)/i} L${c} ${u} L${d} ${h} L${(l[0]-n)/s} ${(l[1]-r)/i}`)},gwe=function(e){const n=y(this,tn),[r,s,i,o]=y(this,hl),[l,c,u,d]=V(this,Ws,CN).call(this),h=new Float32Array(36);return h.set([NaN,NaN,NaN,NaN,(n[2]-r)/i,(n[3]-s)/o,NaN,NaN,NaN,NaN,(n[4]-r)/i,(n[5]-s)/o,NaN,NaN,NaN,NaN,l,c,NaN,NaN,NaN,NaN,u,d,NaN,NaN,NaN,NaN,(n[16]-r)/i,(n[17]-s)/o,NaN,NaN,NaN,NaN,(n[14]-r)/i,(n[15]-s)/o],0),this.newFreeDrawOutline(h,e,y(this,hl),y(this,d_),y(this,c_),y(this,u_))},vwe=function(e,n){const r=y(this,hu);return e.set([NaN,NaN,NaN,NaN,r[4],r[5]],n),n+=6},xwe=function(e,n){const r=y(this,tn).subarray(4,6),s=y(this,tn).subarray(16,18),[i,o,l,c]=y(this,hl),[u,d,h,f]=V(this,Ws,CN).call(this);return e.set([NaN,NaN,NaN,NaN,(r[0]-i)/l,(r[1]-o)/c,NaN,NaN,NaN,NaN,u,d,NaN,NaN,NaN,NaN,h,f,NaN,NaN,NaN,NaN,(s[0]-i)/l,(s[1]-o)/c],n),n+=24},q(Wh,TE,8),q(Wh,wL,2),q(Wh,_L,y(Wh,TE)+y(Wh,wL));let cI=Wh;var f_,vy,Nf,PE,fl,ME,fs,jL,bwe;class ywe extends at{constructor(n,r,s,i,o,l){super();q(this,jL);q(this,f_);q(this,vy,new Float32Array(4));q(this,Nf);q(this,PE);q(this,fl);q(this,ME);q(this,fs);$(this,fs,n),$(this,fl,r),$(this,f_,s),$(this,ME,i),$(this,Nf,o),$(this,PE,l),this.firstPoint=[NaN,NaN],this.lastPoint=[NaN,NaN],V(this,jL,bwe).call(this,l);const[c,u,d,h]=y(this,vy);for(let f=0,p=n.length;f<p;f+=2)n[f]=(n[f]-c)/d,n[f+1]=(n[f+1]-u)/h;for(let f=0,p=r.length;f<p;f+=2)r[f]=(r[f]-c)/d,r[f+1]=(r[f+1]-u)/h}toSVGPath(){const n=[`M${y(this,fs)[4]} ${y(this,fs)[5]}`];for(let r=6,s=y(this,fs).length;r<s;r+=6){if(isNaN(y(this,fs)[r])){n.push(`L${y(this,fs)[r+4]} ${y(this,fs)[r+5]}`);continue}n.push(`C${y(this,fs)[r]} ${y(this,fs)[r+1]} ${y(this,fs)[r+2]} ${y(this,fs)[r+3]} ${y(this,fs)[r+4]} ${y(this,fs)[r+5]}`)}return n.push("Z"),n.join(" ")}serialize([n,r,s,i],o){const l=s-n,c=i-r;let u,d;switch(o){case 0:u=at._rescale(y(this,fs),n,i,l,-c),d=at._rescale(y(this,fl),n,i,l,-c);break;case 90:u=at._rescaleAndSwap(y(this,fs),n,r,l,c),d=at._rescaleAndSwap(y(this,fl),n,r,l,c);break;case 180:u=at._rescale(y(this,fs),s,r,-l,c),d=at._rescale(y(this,fl),s,r,-l,c);break;case 270:u=at._rescaleAndSwap(y(this,fs),s,i,-l,-c),d=at._rescaleAndSwap(y(this,fl),s,i,-l,-c);break}return{outline:Array.from(u),points:[Array.from(d)]}}get box(){return y(this,vy)}newOutliner(n,r,s,i,o,l=0){return new cI(n,r,s,i,o,l)}getNewOutline(n,r){const[s,i,o,l]=y(this,vy),[c,u,d,h]=y(this,f_),f=o*d,p=l*h,m=s*d+c,v=i*h+u,x=this.newOutliner({x:y(this,fl)[0]*f+m,y:y(this,fl)[1]*p+v},y(this,f_),y(this,ME),n,y(this,PE),r??y(this,Nf));for(let g=2;g<y(this,fl).length;g+=2)x.add({x:y(this,fl)[g]*f+m,y:y(this,fl)[g+1]*p+v});return x.getOutlines()}}f_=new WeakMap,vy=new WeakMap,Nf=new WeakMap,PE=new WeakMap,fl=new WeakMap,ME=new WeakMap,fs=new WeakMap,jL=new WeakSet,bwe=function(n){const r=y(this,fs);let s=r[4],i=r[5];const o=[s,i,s,i];let l=s,c=i,u=s,d=i;const h=n?Math.max:Math.min,f=new Float32Array(4);for(let m=6,v=r.length;m<v;m+=6){const x=r[m+4],g=r[m+5];isNaN(r[m])?(ot.pointBoundingBox(x,g,o),c>g?(l=x,c=g):c===g&&(l=h(l,x)),d<g?(u=x,d=g):d===g&&(u=h(u,x))):(f[0]=f[1]=1/0,f[2]=f[3]=-1/0,ot.bezierBoundingBox(s,i,...r.slice(m,m+6),f),ot.rectBoundingBox(f[0],f[1],f[2],f[3],o),c>f[1]?(l=f[0],c=f[1]):c===f[1]&&(l=h(l,f[0])),d<f[3]?(u=f[2],d=f[3]):d===f[3]&&(u=h(u,f[2]))),s=x,i=g}const p=y(this,vy);p[0]=o[0]-y(this,Nf),p[1]=o[1]-y(this,Nf),p[2]=o[2]-o[0]+2*y(this,Nf),p[3]=o[3]-o[1]+2*y(this,Nf),this.firstPoint=[l,c],this.lastPoint=[u,d]};var RE,OE,IE,Ym,fu,uo,wwe,dR,_we,jwe,zU;class $U{constructor(e,n=0,r=0,s=!0){q(this,uo);q(this,RE);q(this,OE);q(this,IE);q(this,Ym,[]);q(this,fu,[]);const i=[1/0,1/0,-1/0,-1/0],l=10**-4;for(const{x,y:g,width:w,height:_}of e){const j=Math.floor((x-n)/l)*l,N=Math.ceil((x+w+n)/l)*l,S=Math.floor((g-n)/l)*l,C=Math.ceil((g+_+n)/l)*l,k=[j,S,C,!0],E=[N,S,C,!1];y(this,Ym).push(k,E),ot.rectBoundingBox(j,S,N,C,i)}const c=i[2]-i[0]+2*r,u=i[3]-i[1]+2*r,d=i[0]-r,h=i[1]-r;let f=s?-1/0:1/0,p=1/0;const m=y(this,Ym).at(s?-1:-2),v=[m[0],m[2]];for(const x of y(this,Ym)){const[g,w,_,j]=x;!j&&s?w<p?(p=w,f=g):w===p&&(f=Math.max(f,g)):j&&!s&&(w<p?(p=w,f=g):w===p&&(f=Math.min(f,g))),x[0]=(g-d)/c,x[1]=(w-h)/u,x[2]=(_-h)/u}$(this,RE,new Float32Array([d,h,c,u])),$(this,OE,[f,p]),$(this,IE,v)}getOutlines(){y(this,Ym).sort((n,r)=>n[0]-r[0]||n[1]-r[1]||n[2]-r[2]);const e=[];for(const n of y(this,Ym))n[3]?(e.push(...V(this,uo,zU).call(this,n)),V(this,uo,_we).call(this,n)):(V(this,uo,jwe).call(this,n),e.push(...V(this,uo,zU).call(this,n)));return V(this,uo,wwe).call(this,e)}}RE=new WeakMap,OE=new WeakMap,IE=new WeakMap,Ym=new WeakMap,fu=new WeakMap,uo=new WeakSet,wwe=function(e){const n=[],r=new Set;for(const o of e){const[l,c,u]=o;n.push([l,c,o],[l,u,o])}n.sort((o,l)=>o[1]-l[1]||o[0]-l[0]);for(let o=0,l=n.length;o<l;o+=2){const c=n[o][2],u=n[o+1][2];c.push(u),u.push(c),r.add(c),r.add(u)}const s=[];let i;for(;r.size>0;){const o=r.values().next().value;let[l,c,u,d,h]=o;r.delete(o);let f=l,p=c;for(i=[l,u],s.push(i);;){let m;if(r.has(d))m=d;
910else if(r.has(h))m=h;else break;r.delete(m),[l,c,u,d,h]=m,f!==l&&(i.push(f,p,l,p===c?c:u),f=l),p=p===c?u:c}i.push(f,p)}return new Let(s,y(this,RE),y(this,OE),y(this,IE))},dR=function(e){const n=y(this,fu);let r=0,s=n.length-1;for(;r<=s;){const i=r+s>>1,o=n[i][0];if(o===e)return i;o<e?r=i+1:s=i-1}return s+1},_we=function([,e,n]){const r=V(this,uo,dR).call(this,e);y(this,fu).splice(r,0,[e,n])},jwe=function([,e,n]){const r=V(this,uo,dR).call(this,e);for(let s=r;s<y(this,fu).length;s++){const[i,o]=y(this,fu)[s];if(i!==e)break;if(i===e&&o===n){y(this,fu).splice(s,1);return}}for(let s=r-1;s>=0;s--){const[i,o]=y(this,fu)[s];if(i!==e)break;if(i===e&&o===n){y(this,fu).splice(s,1);return}}},zU=function(e){const[n,r,s]=e,i=[[n,r,s]],o=V(this,uo,dR).call(this,s);for(let l=0;l<o;l++){const[c,u]=y(this,fu)[l];for(let d=0,h=i.length;d<h;d++){const[,f,p]=i[d];if(!(u<=f||p<=c)){if(f>=c){if(p>u)i[d][1]=u;else{if(h===1)return[];i.splice(d,1),d--,h--}continue}i[d][2]=c,p>u&&i.push([n,u,p])}}}return i};var DE,p_;class Let extends at{constructor(n,r,s,i){super();q(this,DE);q(this,p_);$(this,p_,n),$(this,DE,r),this.firstPoint=s,this.lastPoint=i}toSVGPath(){const n=[];for(const r of y(this,p_)){let[s,i]=r;n.push(`M${s} ${i}`);for(let o=2;o<r.length;o+=2){const l=r[o],c=r[o+1];l===s?(n.push(`V${c}`),i=c):c===i&&(n.push(`H${l}`),s=l)}n.push("Z")}return n.join(" ")}serialize([n,r,s,i],o){const l=[],c=s-n,u=i-r;for(const d of y(this,p_)){const h=new Array(d.length);for(let f=0;f<d.length;f+=2)h[f]=n+d[f]*c,h[f+1]=i-d[f+1]*u;l.push(h)}return l}get box(){return y(this,DE)}get classNamesForOutlining(){return["highlightOutline"]}}DE=new WeakMap,p_=new WeakMap;class BU extends cI{newFreeDrawOutline(e,n,r,s,i,o){return new Fet(e,n,r,s,i,o)}}class Fet extends ywe{newOutliner(e,n,r,s,i,o=0){return new BU(e,n,r,s,i,o)}}var m_,LE,Cf,xy,FE,Oo,$E,zE,yy,pl,ml,Ei,g_,v_,pa,x_,fc,BE,Yt,UU,hR,Swe,Nwe,Cwe,qU,Fv,wc,Db,kwe,fR,pR,Awe,Ewe,Twe,Pwe,Mwe;const Sn=class Sn extends cr{constructor(n){super({...n,name:"highlightEditor"});q(this,Yt);q(this,m_,null);q(this,LE,0);q(this,Cf);q(this,xy,null);q(this,FE,null);q(this,Oo,null);q(this,$E,null);q(this,zE,0);q(this,yy,null);q(this,pl,null);q(this,ml,null);q(this,Ei,!1);q(this,g_,null);q(this,v_,null);q(this,pa,null);q(this,x_,"");q(this,fc);q(this,BE,"");this.color=n.color||Sn._defaultColor,$(this,fc,n.thickness||Sn._defaultThickness),this.opacity=n.opacity||Sn._defaultOpacity,$(this,Cf,n.boxes||null),$(this,BE,n.methodOfCreation||""),$(this,x_,n.text||""),this._isDraggable=!1,this.defaultL10nId="pdfjs-editor-highlight-editor",n.highlightId>-1?($(this,Ei,!0),V(this,Yt,hR).call(this,n),V(this,Yt,Fv).call(this)):y(this,Cf)&&($(this,m_,n.anchorNode),$(this,LE,n.anchorOffset),$(this,$E,n.focusNode),$(this,zE,n.focusOffset),V(this,Yt,UU).call(this),V(this,Yt,Fv).call(this),this.rotate(this.rotation)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-highlight-added-alert")}static get _keyboardManager(){const n=Sn.prototype;return Gt(this,"_keyboardManager",new k2([[["ArrowLeft","mac+ArrowLeft"],n._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],n._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],n._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],n._moveCaret,{args:[3]}]]))}get telemetryInitialData(){return{action:"added",type:y(this,Ei)?"free_highlight":"highlight",color:this._uiManager.getNonHCMColorName(this.color),thickness:y(this,fc),methodOfCreation:y(this,BE)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.getNonHCMColorName(this.color)}}static computeTelemetryFinalData(n){return{numberOfColors:n.get("color").size}}static initialize(n,r){var s;cr.initialize(n,r),Sn._defaultColor||(Sn._defaultColor=((s=r.highlightColors)==null?void 0:s.values().next().value)||"#fff066")}static updateDefaultParams(n,r){switch(n){case sn.HIGHLIGHT_COLOR:Sn._defaultColor=r;break;case sn.HIGHLIGHT_THICKNESS:Sn._defaultThickness=r;break}}translateInPage(n,r){}get toolbarPosition(){return y(this,v_)}get commentButtonPosition(){return y(this,g_)}updateParams(n,r){switch(n){case sn.HIGHLIGHT_COLOR:V(this,Yt,Swe).call(this,r);break;case sn.HIGHLIGHT_THICKNESS:V(this,Yt,Nwe).call(this,r);break}}static get defaultPropertiesToUpdate(){return[[sn.HIGHLIGHT_COLOR,Sn._defaultColor],[sn.HIGHLIGHT_THICKNESS,Sn._defaultThickness]]}get propertiesToUpdate(){return[[sn.HIGHLIGHT_COLOR,this.color||Sn._defaultColor],[sn.HIGHLIGHT_THICKNESS,y(this,fc)||Sn._defaultThickness],[sn.HIGHLIGHT_FREE,y(this,Ei)]]}onUpdatedColor(){var n,r;(n=this.parent)==null||n.drawLayer.updateProperties(y(this,ml),{root:{fill:this.color,"fill-opacity":this.opacity}}),(r=y(this,FE))==null||r.updateColor(this.color),super.onUpdatedColor()}get toolbarButtons(){return this._uiManager.highlightColors?[["colorPicker",$(this,FE,new Ek({editor:this}))]]:super.toolbarButtons}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(V(this,Yt,pR).call(this))}getBaseTranslation(){return[0,0]}getRect(n,r){return super.getRect(n,r,V(this,Yt,pR).call(this))}onceAdded(n){this.annotationElementId||this.parent.addUndoableEditor(this),n&&this.div.focus()}remove(){V(this,Yt,qU).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(V(this,Yt,Fv).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(n){var s;let r=!1;this.parent&&!n?V(this,Yt,qU).call(this):n&&(V(this,Yt,Fv).call(this,n),r=!this.parent&&((s=this.div)==null?void 0:s.classList.contains("selectedEditor"))),super.setParent(n),this.show(this._isVisible),r&&this.select()}rotate(n){var i,o,l;const{drawLayer:r}=this.parent;let s;y(this,Ei)?(n=(n-this.rotation+360)%360,s=V(i=Sn,wc,Db).call(i,y(this,pl).box,n)):s=V(o=Sn,wc,Db).call(o,[this.x,this.y,this.width,this.height],n),r.updateProperties(y(this,ml),{bbox:s,root:{"data-main-rotation":n}}),r.updateProperties(y(this,pa),{bbox:V(l=Sn,wc,Db).call(l,y(this,Oo).box,n),root:{"data-main-rotation":n}})}
910render(){if(this.div)return this.div;const n=super.render();y(this,x_)&&(n.setAttribute("aria-label",y(this,x_)),n.setAttribute("role","mark")),y(this,Ei)?n.classList.add("free"):this.div.addEventListener("keydown",V(this,Yt,kwe).bind(this),{signal:this._uiManager._signal});const r=$(this,yy,document.createElement("div"));return n.append(r),r.setAttribute("aria-hidden","true"),r.className="internal",r.style.clipPath=y(this,xy),this.setDims(this.width,this.height),Z0e(this,y(this,yy),["pointerover","pointerleave"]),this.enableEditing(),n}pointerover(){var n;this.isSelected||(n=this.parent)==null||n.drawLayer.updateProperties(y(this,pa),{rootClass:{hovered:!0}})}pointerleave(){var n;this.isSelected||(n=this.parent)==null||n.drawLayer.updateProperties(y(this,pa),{rootClass:{hovered:!1}})}_moveCaret(n){switch(this.parent.unselect(this),n){case 0:case 2:V(this,Yt,fR).call(this,!0);break;case 1:case 3:V(this,Yt,fR).call(this,!1);break}}select(){var n;super.select(),y(this,pa)&&((n=this.parent)==null||n.drawLayer.updateProperties(y(this,pa),{rootClass:{hovered:!1,selected:!0}}))}unselect(){var n;super.unselect(),y(this,pa)&&((n=this.parent)==null||n.drawLayer.updateProperties(y(this,pa),{rootClass:{selected:!1}}),y(this,Ei)||V(this,Yt,fR).call(this,!1))}get _mustFixPosition(){return!y(this,Ei)}show(n=this._isVisible){super.show(n),this.parent&&(this.parent.drawLayer.updateProperties(y(this,ml),{rootClass:{hidden:!n}}),this.parent.drawLayer.updateProperties(y(this,pa),{rootClass:{hidden:!n}}))}static startHighlighting(n,r,{target:s,x:i,y:o}){const{x:l,y:c,width:u,height:d}=s.getBoundingClientRect(),h=new AbortController,f=n.combinedSignal(h),p=m=>{h.abort(),V(this,wc,Pwe).call(this,n,m)};window.addEventListener("blur",p,{signal:f}),window.addEventListener("pointerup",p,{signal:f}),window.addEventListener("pointerdown",Dr,{capture:!0,passive:!1,signal:f}),window.addEventListener("contextmenu",$l,{signal:f}),s.addEventListener("pointermove",V(this,wc,Twe).bind(this,n),{signal:f}),this._freeHighlight=new BU({x:i,y:o},[l,c,u,d],n.scale,this._defaultThickness/2,r,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=n.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:this._defaultColor,"fill-opacity":this._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:this._freeHighlight.toSVGPath()}},!0,!0)}static async deserialize(n,r,s){var v,x,g,w;let i=null;if(n instanceof awe){const{data:{quadPoints:_,rect:j,rotation:N,id:S,color:C,opacity:k,popupRef:E,richText:P,contentsObj:T,creationDate:M,modificationDate:R},parent:{page:{pageNumber:A}}}=n;i=n={annotationType:Bt.HIGHLIGHT,color:Array.from(C),opacity:k,quadPoints:_,boxes:null,pageIndex:A-1,rect:j.slice(0),rotation:N,annotationElementId:S,id:S,deleted:!1,popupRef:E,richText:P,comment:(T==null?void 0:T.str)||null,creationDate:M,modificationDate:R}}else if(n instanceof R7){const{data:{inkLists:_,rect:j,rotation:N,id:S,color:C,borderStyle:{rawWidth:k},popupRef:E,richText:P,contentsObj:T,creationDate:M,modificationDate:R},parent:{page:{pageNumber:A}}}=n;i=n={annotationType:Bt.HIGHLIGHT,color:Array.from(C),thickness:k,inkLists:_,boxes:null,pageIndex:A-1,rect:j.slice(0),rotation:N,annotationElementId:S,id:S,deleted:!1,popupRef:E,richText:P,comment:(T==null?void 0:T.str)||null,creationDate:M,modificationDate:R}}const{color:o,quadPoints:l,inkLists:c,opacity:u}=n,d=await super.deserialize(n,r,s);d.color=ot.makeHexColor(...o),d.opacity=u||1,c&&$(d,fc,n.thickness),d._initialData=i,n.comment&&d.setCommentData(n);const[h,f]=d.pageDimensions,[p,m]=d.pageTranslation;if(l){const _=$(d,Cf,[]);for(let j=0;j<l.length;j+=8)_.push({x:(l[j]-p)/h,y:1-(l[j+1]-m)/f,width:(l[j+2]-l[j])/h,height:(l[j+1]-l[j+5])/f});V(v=d,Yt,UU).call(v),V(x=d,Yt,Fv).call(x),d.rotate(d.rotation)}else if(c){$(d,Ei,!0);const _=c[0],j={x:_[0]-p,y:f-(_[1]-m)},N=new BU(j,[0,0,h,f],1,y(d,fc)/2,!0,.001);for(let k=0,E=_.length;k<E;k+=2)j.x=_[k]-p,j.y=f-(_[k+1]-m),N.add(j);const{id:S,clipPathId:C}=r.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:d.color,"fill-opacity":d._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:N.toSVGPath()}},!0,!0);V(g=d,Yt,hR).call(g,{highlightOutlines:N.getOutlines(),highlightId:S,clipPathId:C}),V(w=d,Yt,Fv).call(w),d.rotate(d.parentRotation)}return d}serialize(n=!1){if(this.isEmpty()||n)return null;if(this.deleted)return this.serializeDeleted();const r=cr._colorManager.convert(this._uiManager.getNonHCMColor(this.color)),s=super.serialize(n);return Object.assign(s,{color:r,opacity:this.opacity,thickness:y(this,fc),quadPoints:V(this,Yt,Awe).call(this),outlines:V(this,Yt,Ewe).call(this,s.rect)}),this.addComment(s),this.annotationElementId&&!V(this,Yt,Mwe).call(this,s)?null:(s.id=this.annotationElementId,s)}renderAnnotationElement(n){return this.deleted?(n.hide(),null):(n.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}static canCreateNewEmptyEditor(){return!1}};m_=new WeakMap,LE=new WeakMap,Cf=new WeakMap,xy=new WeakMap,FE=new WeakMap,Oo=new WeakMap,$E=new WeakMap,zE=new WeakMap,yy=new WeakMap,pl=new WeakMap,ml=new WeakMap,Ei=new WeakMap,g_=new WeakMap,v_=new WeakMap,pa=new WeakMap,x_=new WeakMap,fc=new WeakMap,BE=new WeakMap,Yt=new WeakSet,UU=function(){const n=new $U(y(this,Cf),.001);$(this,pl,n.getOutlines()),[this.x,this.y,this.width,this.height]=y(this,pl).box;const r=new $U(y(this,Cf),.0025,.001,this._uiManager.direction==="ltr");$(this,Oo,r.getOutlines());const{firstPoint:s}=y(this,pl);$(this,g_,[(s[0]-this.x)/this.width,(s[1]-this.y)/this.height]);const{lastPoint:i}=y(this,Oo);$(this,v_,[(i[0]-this.x)/this.width,(i[1]-this.y)/this.height])},hR=function({highlightOutlines:n,highlightId:r,clipPathId:s}){var f,p;if($(this,pl,n),$(this,Oo,n.getNewOutline(y(this,fc)/2+1.5,.0025)),r>=0)$(this,ml,r),$(this,xy,s),this.parent.drawLayer.finalizeDraw(r,{bbox:n.box,path:{d:n.toSVGPath()}}),$(this,pa,this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:y(this,Oo).box,path:{d:y(this,Oo).toSVGPath()}},!0));else if(this.parent){const m=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties(y(this,ml),{bbox:V(f=Sn,wc,Db).call(f,y(this,pl).box,(m-this.rotation+360)%360),path:{d:n.toSVGPath()}}),this.parent.drawLayer.updateProperties(y(this,pa),{bbox:V(p=Sn,wc,Db).call(p,y(this,Oo).box,m),path:{d:y(this,Oo).toSVGPath()}})}const[o,l,c,u]=n.box;switch(this.rotation){case 0:this.x=o,this.y=l,this.width=c,this.height=u;break;case 90:{const[m,v]=this.parentDimensions;this.x=l,this.y=1-o,this.width=c*v/m,this.height=u*m/v;break}case 180:this.x=1-o,this.y=1-l,this.width=c,this.height=u;break;case 270:{const[m,v]=this.parentDimensions;this.x=1-l,this.y=o,this.width=c*v/m,this.height=u*m/v;break}}const{firstPoint:d}=n;$(this,g_,[(d[0]-o)/c,(d[1]-l)/u]);const{lastPoint:h}=y(this,Oo);$(this,v_,[(h[0]-o)/c,(h[1]-l)/u])},Swe=function(n){const r=(o,l)=>{this.color=o,this.opacity=l,this.onUpdatedColor()},s=this.color,i=this.opacity;this.addCommands({cmd:r.bind(this,n,Sn._defaultOpacity),undo:r.bind(this,s,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:sn.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.getNonHCMColorName(n)},!0)},Nwe=function(n){const r=y(this,fc),s=i=>{$(this,fc,i),V(this,Yt,Cwe).call(this,i)};this.addCommands({cmd:s.bind(this,n),undo:s.bind(this,r),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:sn.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:n},!0)},Cwe=function(n){y(this,Ei)&&(V(this,Yt,hR).call(this,{highlightOutlines:y(this,pl).getNewOutline(n/2)}),this.fixAndSetPosition(),this.setDims(this.width,this.height))},qU=function(){y(this,ml)===null||!this.parent||(this.parent.drawLayer.remove(y(this,ml)),$(this,ml,null),this.parent.drawLayer.remove(y(this,pa)),$(this,pa,null))},Fv=function(n=this.parent){y(this,ml)===null&&({id:Vr(this,ml)._,clipPathId:Vr(this,xy)._}=n.drawLayer.draw({bbox:y(this,pl).box,root:{viewBox:"0 0 1 1",fill:this.color,"fill-opacity":this.opacity},rootClass:{highlight:!0,free:y(this,Ei)},path:{d:y(this,pl).toSVGPath()}},!1,!0),$(this,pa,n.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:y(this,Ei)},bbox:y(this,Oo).box,path:{d:y(this,Oo).toSVGPath()}},y(this,Ei))),y(this,yy)&&(y(this,yy).style.clipPath=y(this,xy)))},wc=new WeakSet,Db=function([n,r,s,i],o){switch(o){case 90:return[1-r-i,n,i,s];case 180:return[1-n-s,1-r-i,s,i];case 270:return[r,1-n-s,i,s]}return[n,r,s,i]},kwe=function(n){Sn._keyboardManager.exec(this,n)},fR=function(n){if(!y(this,m_))return;const r=window.getSelection();n?r.setPosition(y(this,m_),y(this,LE)):r.setPosition(y(this,$E),y(this,zE))},pR=function(){return y(this,Ei)?this.rotation:0},Awe=function(){if(y(this,Ei))return null;const[n,r]=this.pageDimensions,[s,i]=this.pageTranslation,o=y(this,Cf),l=new Float32Array(o.length*8);let c=0;for(const{x:u,y:d,width:h,height:f}of o){const p=u*n+s,m=(1-d)*r+i;l[c]=l[c+4]=p,l[c+1]=l[c+3]=m,l[c+2]=l[c+6]=p+h*n,l[c+5]=l[c+7]=m-f*r,c+=8}return l},Ewe=function(n){return y(this,pl).serialize(n,V(this,Yt,pR).call(this))},Twe=function(n,r){this._freeHighlight.add(r)&&n.drawLayer.updateProperties(this._freeHighlightId,{path:{d:this._freeHighlight.toSVGPath()}})},Pwe=function(n,r){this._freeHighlight.isEmpty()?n.drawLayer.remove(this._freeHighlightId):n.createAndAddNewEditor(r,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""},Mwe=function(n){const{color:r}=this._initialData;return this.hasEditedComment||n.color.some((s,i)=>s!==r[i])},q(Sn,wc),Te(Sn,"_defaultColor",null),Te(Sn,"_defaultOpacity",1),Te(Sn,"_defaultThickness",12),Te(Sn,"_type","highlight"),Te(Sn,"_editorType",Bt.HIGHLIGHT),Te(Sn,"_freeHighlightId",-1),Te(Sn,"_freeHighlight",null),Te(Sn,"_freeHighlightClipId","");let uI=Sn;var by;class Rwe{constructor(){q(this,by,Object.create(null))}updateProperty(e,n){this[e]=n,this.updateSVGProperty(e,n)}updateProperties(e){if(e)for(const[n,r]of Object.entries(e))n.startsWith("_")||this.updateProperty(n,r)}updateSVGProperty(e,n){y(this,by)[e]=n}toSVGProperties(){const e=y(this,by);return $(this,by,Object.create(null)),{root:e}}reset(){$(this,by,Object.create(null))}updateAll(e=this){this.updateProperties(e)}clone(){Zn("Not implemented")}}by=new WeakMap;var gl,y_,si,wy,_y,Xm,Jm,Qm,jy,xn,VU,HU,WU,kN,Owe,mR,AN,Lb;
910const ft=class ft extends cr{constructor(n){super(n);q(this,xn);q(this,gl,null);q(this,y_);Te(this,"_colorPicker",null);Te(this,"_drawId",null);$(this,y_,n.mustBeCommitted||!1),this._addOutlines(n)}onUpdatedColor(){var n;(n=this._colorPicker)==null||n.update(this.color),super.onUpdatedColor()}_addOutlines(n){n.drawOutlines&&(V(this,xn,VU).call(this,n),V(this,xn,kN).call(this))}static _mergeSVGProperties(n,r){const s=new Set(Object.keys(n));for(const[i,o]of Object.entries(r))s.has(i)?Object.assign(n[i],o):n[i]=o;return n}static getDefaultDrawingOptions(n){Zn("Not implemented")}static get typesMap(){Zn("Not implemented")}static get isDrawer(){return!0}static get supportMultipleDrawings(){return!1}static updateDefaultParams(n,r){const s=this.typesMap.get(n);s&&this._defaultDrawingOptions.updateProperty(s,r),this._currentParent&&(y(ft,si).updateProperty(s,r),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(n,r){const s=this.constructor.typesMap.get(n);s&&this._updateProperty(n,s,r)}static get defaultPropertiesToUpdate(){const n=[],r=this._defaultDrawingOptions;for(const[s,i]of this.typesMap)n.push([s,r[i]]);return n}get propertiesToUpdate(){const n=[],{_drawingOptions:r}=this;for(const[s,i]of this.constructor.typesMap)n.push([s,r[i]]);return n}_updateProperty(n,r,s){const i=this._drawingOptions,o=i[r],l=c=>{var d;i.updateProperty(r,c);const u=y(this,gl).updateProperty(r,c);u&&V(this,xn,AN).call(this,u),(d=this.parent)==null||d.drawLayer.updateProperties(this._drawId,i.toSVGProperties()),n===this.colorType&&this.onUpdatedColor()};this.addCommands({cmd:l.bind(this,s),undo:l.bind(this,o),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:n,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){var n;(n=this.parent)==null||n.drawLayer.updateProperties(this._drawId,ft._mergeSVGProperties(y(this,gl).getPathResizingSVGProperties(V(this,xn,mR).call(this)),{bbox:V(this,xn,Lb).call(this)}))}_onResized(){var n;(n=this.parent)==null||n.drawLayer.updateProperties(this._drawId,ft._mergeSVGProperties(y(this,gl).getPathResizedSVGProperties(V(this,xn,mR).call(this)),{bbox:V(this,xn,Lb).call(this)}))}_onTranslating(n,r){var s;(s=this.parent)==null||s.drawLayer.updateProperties(this._drawId,{bbox:V(this,xn,Lb).call(this)})}_onTranslated(){var n;(n=this.parent)==null||n.drawLayer.updateProperties(this._drawId,ft._mergeSVGProperties(y(this,gl).getPathTranslatedSVGProperties(V(this,xn,mR).call(this),this.parentDimensions),{bbox:V(this,xn,Lb).call(this)}))}_onStartDragging(){var n;(n=this.parent)==null||n.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){var n;(n=this.parent)==null||n.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!1}})}commit(){super.commit(),this.disableEditMode(),this.disableEditing()}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}getBaseTranslation(){return[0,0]}get isResizable(){return!0}onceAdded(n){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,y(this,y_)&&($(this,y_,!1),this.commit(),this.parent.setSelected(this),n&&this.isOnScreen&&this.div.focus())}remove(){V(this,xn,WU).call(this),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(V(this,xn,kN).call(this),V(this,xn,AN).call(this,y(this,gl).box),this.isAttachedToDOM||this.parent.add(this)))}setParent(n){var s;let r=!1;this.parent&&!n?(this._uiManager.removeShouldRescale(this),V(this,xn,WU).call(this)):n&&(this._uiManager.addShouldRescale(this),V(this,xn,kN).call(this,n),r=!this.parent&&((s=this.div)==null?void 0:s.classList.contains("selectedEditor"))),super.setParent(n),r&&this.select()}rotate(){this.parent&&this.parent.drawLayer.updateProperties(this._drawId,ft._mergeSVGProperties({bbox:V(this,xn,Lb).call(this)},y(this,gl).updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&V(this,xn,AN).call(this,y(this,gl).updateParentDimensions(this.parentDimensions,this.parent.scale))}static onScaleChangingWhenDrawing(){}
910render(){if(this.div)return this.div;let n,r;this._isCopy&&(n=this.x,r=this.y);const s=super.render();s.classList.add("draw");const i=document.createElement("div");return s.append(i),i.setAttribute("aria-hidden","true"),i.className="internal",this.setDims(),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(n,r),s}static createDrawerInstance(n,r,s,i,o){Zn("Not implemented")}static startDrawing(n,r,s,i){var x;const{target:o,offsetX:l,offsetY:c,pointerId:u,pointerType:d}=i;if(y(ft,Jm)&&y(ft,Jm)!==d)return;const{viewport:{rotation:h}}=n,{width:f,height:p}=o.getBoundingClientRect(),m=$(ft,wy,new AbortController),v=n.combinedSignal(m);if(y(ft,Xm)||$(ft,Xm,u),y(ft,Jm)??$(ft,Jm,d),window.addEventListener("pointerup",g=>{var w;y(ft,Xm)===g.pointerId?this._endDraw(g):(w=y(ft,Qm))==null||w.delete(g.pointerId)},{signal:v}),window.addEventListener("pointercancel",g=>{var w;y(ft,Xm)===g.pointerId?this._currentParent.endDrawingSession():(w=y(ft,Qm))==null||w.delete(g.pointerId)},{signal:v}),window.addEventListener("pointerdown",g=>{y(ft,Jm)===g.pointerType&&((y(ft,Qm)||$(ft,Qm,new Set)).add(g.pointerId),y(ft,si).isCancellable()&&(y(ft,si).removeLastElement(),y(ft,si).isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:v}),window.addEventListener("contextmenu",$l,{signal:v}),o.addEventListener("pointermove",this._drawMove.bind(this),{signal:v}),o.addEventListener("touchmove",g=>{g.timeStamp===y(ft,jy)&&Dr(g)},{signal:v}),n.toggleDrawing(),(x=r._editorUndoBar)==null||x.hide(),y(ft,si)){n.drawLayer.updateProperties(this._currentDrawId,y(ft,si).startNew(l,c,f,p,h));return}r.updateUIForDefaultProperties(this),$(ft,si,this.createDrawerInstance(l,c,f,p,h)),$(ft,_y,this.getDefaultDrawingOptions()),this._currentParent=n,{id:this._currentDrawId}=n.drawLayer.draw(this._mergeSVGProperties(y(ft,_y).toSVGProperties(),y(ft,si).defaultSVGProperties),!0,!1)}static _drawMove(n){var o;if($(ft,jy,-1),!y(ft,si))return;const{offsetX:r,offsetY:s,pointerId:i}=n;if(y(ft,Xm)===i){if(((o=y(ft,Qm))==null?void 0:o.size)>=1){this._endDraw(n);return}this._currentParent.drawLayer.updateProperties(this._currentDrawId,y(ft,si).add(r,s)),$(ft,jy,n.timeStamp),Dr(n)}}static _cleanup(n){n&&(this._currentDrawId=-1,this._currentParent=null,$(ft,si,null),$(ft,_y,null),$(ft,Jm,null),$(ft,jy,NaN)),y(ft,wy)&&(y(ft,wy).abort(),$(ft,wy,null),$(ft,Xm,NaN),$(ft,Qm,null))}static _endDraw(n){const r=this._currentParent;if(r){if(r.toggleDrawing(!0),this._cleanup(!1),(n==null?void 0:n.target)===r.div&&r.drawLayer.updateProperties(this._currentDrawId,y(ft,si).end(n.offsetX,n.offsetY)),this.supportMultipleDrawings){const s=y(ft,si),i=this._currentDrawId,o=s.getLastElement();r.addCommands({cmd:()=>{r.drawLayer.updateProperties(i,s.setLastElement(o))},undo:()=>{r.drawLayer.updateProperties(i,s.removeLastElement())},mustExec:!1,type:sn.DRAW_STEP});return}this.endDrawing(!1)}}static endDrawing(n){const r=this._currentParent;if(!r)return null;if(r.toggleDrawing(!0),r.cleanUndoStack(sn.DRAW_STEP),!y(ft,si).isEmpty()){const{pageDimensions:[s,i],scale:o}=r,l=r.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:y(ft,si).getOutlines(s*o,i*o,o,this._INNER_MARGIN),drawingOptions:y(ft,_y),mustBeCommitted:!n});return this._cleanup(!0),l}return r.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(n){}static deserializeDraw(n,r,s,i,o,l){Zn("Not implemented")}static async deserialize(n,r,s){var h,f;const{rawDims:{pageWidth:i,pageHeight:o,pageX:l,pageY:c}}=r.viewport,u=this.deserializeDraw(l,c,i,o,this._INNER_MARGIN,n),d=await super.deserialize(n,r,s);return d.createDrawingOptions(n),V(h=d,xn,VU).call(h,{drawOutlines:u}),V(f=d,xn,kN).call(f),d.onScaleChanging(),d.rotate(),d}serializeDraw(n){const[r,s]=this.pageTranslation,[i,o]=this.pageDimensions;
910return y(this,gl).serialize([r,s,i,o],n)}renderAnnotationElement(n){return n.updateEdited({rect:this.getPDFRect()}),null}static canCreateNewEmptyEditor(){return!1}};gl=new WeakMap,y_=new WeakMap,si=new WeakMap,wy=new WeakMap,_y=new WeakMap,Xm=new WeakMap,Jm=new WeakMap,Qm=new WeakMap,jy=new WeakMap,xn=new WeakSet,VU=function({drawOutlines:n,drawId:r,drawingOptions:s}){$(this,gl,n),this._drawingOptions||(this._drawingOptions=s),this.annotationElementId||this._uiManager.a11yAlert(`pdfjs-editor-${this.editorType}-added-alert`),r>=0?(this._drawId=r,this.parent.drawLayer.finalizeDraw(r,n.defaultProperties)):this._drawId=V(this,xn,HU).call(this,n,this.parent),V(this,xn,AN).call(this,n.box)},HU=function(n,r){const{id:s}=r.drawLayer.draw(ft._mergeSVGProperties(this._drawingOptions.toSVGProperties(),n.defaultSVGProperties),!1,!1);return s},WU=function(){this._drawId===null||!this.parent||(this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset())},kN=function(n=this.parent){if(!(this._drawId!==null&&this.parent===n)){if(this._drawId!==null){this.parent.drawLayer.updateParent(this._drawId,n.drawLayer);return}this._drawingOptions.updateAll(),this._drawId=V(this,xn,HU).call(this,y(this,gl),n)}},Owe=function([n,r,s,i]){const{parentDimensions:[o,l],rotation:c}=this;switch(c){case 90:return[r,1-n,s*(l/o),i*(o/l)];case 180:return[1-n,1-r,s,i];case 270:return[1-r,n,s*(l/o),i*(o/l)];default:return[n,r,s,i]}},mR=function(){const{x:n,y:r,width:s,height:i,parentDimensions:[o,l],rotation:c}=this;switch(c){case 90:return[1-r,n,s*(o/l),i*(l/o)];case 180:return[1-n,1-r,s,i];case 270:return[r,1-n,s*(o/l),i*(l/o)];default:return[n,r,s,i]}},AN=function(n){[this.x,this.y,this.width,this.height]=V(this,xn,Owe).call(this,n),this.div&&(this.fixAndSetPosition(),this.setDims()),this._onResized()},Lb=function(){const{x:n,y:r,width:s,height:i,rotation:o,parentRotation:l,parentDimensions:[c,u]}=this;switch((o*4+l)/90){case 1:return[1-r-i,n,i,s];case 2:return[1-n-s,1-r-i,s,i];case 3:return[r,1-n-s,i,s];case 4:return[n,r-s*(c/u),i*(u/c),s*(c/u)];case 5:return[1-r,n,s*(c/u),i*(u/c)];case 6:return[1-n-i*(u/c),1-r,i*(u/c),s*(c/u)];case 7:return[r-s*(c/u),1-n-i*(u/c),s*(c/u),i*(u/c)];case 8:return[n-s,r-i,s,i];case 9:return[1-r,n-s,i,s];case 10:return[1-n,1-r,s,i];case 11:return[r-i,1-n,i,s];case 12:return[n-i*(u/c),r,i*(u/c),s*(c/u)];case 13:return[1-r-s*(c/u),n-i*(u/c),s*(c/u),i*(u/c)];case 14:return[1-n,1-r-s*(c/u),i*(u/c),s*(c/u)];case 15:return[r,1-n,s*(c/u),i*(u/c)];default:return[n,r,s,i]}},Te(ft,"_currentDrawId",-1),Te(ft,"_currentParent",null),q(ft,si,null),q(ft,wy,null),q(ft,_y,null),q(ft,Xm,NaN),q(ft,Jm,null),q(ft,Qm,null),q(ft,jy,NaN),Te(ft,"_INNER_MARGIN",3);let dI=ft;var Pd,ii,ai,Sy,b_,Xa,Ti,pc,Ny,Cy,ky,w_,gR;class $et{constructor(e,n,r,s,i,o){q(this,w_);q(this,Pd,new Float64Array(6));q(this,ii);q(this,ai);q(this,Sy);q(this,b_);q(this,Xa);q(this,Ti,"");q(this,pc,0);q(this,Ny,new E2);q(this,Cy);q(this,ky);$(this,Cy,r),$(this,ky,s),$(this,Sy,i),$(this,b_,o),[e,n]=V(this,w_,gR).call(this,e,n);const l=$(this,ii,[NaN,NaN,NaN,NaN,e,n]);$(this,Xa,[e,n]),$(this,ai,[{line:l,points:y(this,Xa)}]),y(this,Pd).set(l,0)}updateProperty(e,n){e==="stroke-width"&&$(this,b_,n)}isEmpty(){return!y(this,ai)||y(this,ai).length===0}isCancellable(){return y(this,Xa).length<=10}add(e,n){[e,n]=V(this,w_,gR).call(this,e,n);const[r,s,i,o]=y(this,Pd).subarray(2,6),l=e-i,c=n-o;return Math.hypot(y(this,Cy)*l,y(this,ky)*c)<=2?null:(y(this,Xa).push(e,n),isNaN(r)?(y(this,Pd).set([i,o,e,n],2),y(this,ii).push(NaN,NaN,NaN,NaN,e,n),{path:{d:this.toSVGPath()}}):(isNaN(y(this,Pd)[0])&&y(this,ii).splice(6,6),y(this,Pd).set([r,s,i,o,e,n],0),y(this,ii).push(...at.createBezierPoints(r,s,i,o,e,n)),{path:{d:this.toSVGPath()}}))}end(e,n){const r=this.add(e,n);return r||(y(this,Xa).length===2?{path:{d:this.toSVGPath()}}:null)}startNew(e,n,r,s,i){$(this,Cy,r),$(this,ky,s),$(this,Sy,i),[e,n]=V(this,w_,gR).call(this,e,n);const o=$(this,ii,[NaN,NaN,NaN,NaN,e,n]);$(this,Xa,[e,n]);const l=y(this,ai).at(-1);return l&&(l.line=new Float32Array(l.line),l.points=new Float32Array(l.points)),y(this,ai).push({line:o,points:y(this,Xa)}),y(this,Pd).set(o,0),$(this,pc,0),this.toSVGPath(),null}getLastElement(){return y(this,ai).at(-1)}setLastElement(e){return y(this,ai)?(y(this,ai).push(e),$(this,ii,e.line),$(this,Xa,e.points),$(this,pc,0),{path:{d:this.toSVGPath()}}):y(this,Ny).setLastElement(e)}removeLastElement(){if(!y(this,ai))return y(this,Ny).removeLastElement();y(this,ai).pop(),$(this,Ti,"");for(let e=0,n=y(this,ai).length;e<n;e++){const{line:r,points:s}=y(this,ai)[e];$(this,ii,r),$(this,Xa,s),$(this,pc,0),this.toSVGPath()}return{path:{d:y(this,Ti)}}}toSVGPath(){const e=at.svgRound(y(this,ii)[4]),n=at.svgRound(y(this,ii)[5]);if(y(this,Xa).length===2)return $(this,Ti,`${y(this,Ti)} M ${e} ${n} Z`),y(this,Ti);if(y(this,Xa).length<=6){const s=y(this,Ti).lastIndexOf("M");$(this,Ti,`${y(this,Ti).slice(0,s)} M ${e} ${n}`),$(this,pc,6)}if(y(this,Xa).length===4){const s=at.svgRound(y(this,ii)[10]),i=at.svgRound(y(this,ii)[11]);return $(this,Ti,`${y(this,Ti)} L ${s} ${i}`),$(this,pc,12),y(this,Ti)}const r=[];y(this,pc)===0&&(r.push(`M ${e} ${n}`),$(this,pc,6));for(let s=y(this,pc),i=y(this,ii).length;s<i;s+=6){const[o,l,c,u,d,h]=y(this,ii).slice(s,s+6).map(at.svgRound);r.push(`C${o} ${l} ${c} ${u} ${d} ${h}`)}return $(this,Ti,y(this,Ti)+r.join(" ")),$(this,pc,y(this,ii).length),y(this,Ti)}
910getOutlines(e,n,r,s){const i=y(this,ai).at(-1);return i.line=new Float32Array(i.line),i.points=new Float32Array(i.points),y(this,Ny).build(y(this,ai),e,n,r,y(this,Sy),y(this,b_),s),$(this,Pd,null),$(this,ii,null),$(this,ai,null),$(this,Ti,null),y(this,Ny)}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}}Pd=new WeakMap,ii=new WeakMap,ai=new WeakMap,Sy=new WeakMap,b_=new WeakMap,Xa=new WeakMap,Ti=new WeakMap,pc=new WeakMap,Ny=new WeakMap,Cy=new WeakMap,ky=new WeakMap,w_=new WeakSet,gR=function(e,n){return at._normalizePoint(e,n,y(this,Cy),y(this,ky),y(this,Sy))};var Ja,UE,qE,vl,Md,Rd,__,j_,Ay,Li,Fh,Iwe,Dwe,Lwe;class E2 extends at{constructor(){super(...arguments);q(this,Li);q(this,Ja);q(this,UE,0);q(this,qE);q(this,vl);q(this,Md);q(this,Rd);q(this,__);q(this,j_);q(this,Ay)}build(n,r,s,i,o,l,c){$(this,Md,r),$(this,Rd,s),$(this,__,i),$(this,j_,o),$(this,Ay,l),$(this,qE,c??0),$(this,vl,n),V(this,Li,Dwe).call(this)}get thickness(){return y(this,Ay)}setLastElement(n){return y(this,vl).push(n),{path:{d:this.toSVGPath()}}}removeLastElement(){return y(this,vl).pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){const n=[];for(const{line:r}of y(this,vl)){if(n.push(`M${at.svgRound(r[4])} ${at.svgRound(r[5])}`),r.length===6){n.push("Z");continue}if(r.length===12&&isNaN(r[6])){n.push(`L${at.svgRound(r[10])} ${at.svgRound(r[11])}`);continue}for(let s=6,i=r.length;s<i;s+=6){const[o,l,c,u,d,h]=r.subarray(s,s+6).map(at.svgRound);n.push(`C${o} ${l} ${c} ${u} ${d} ${h}`)}}return n.join("")}serialize([n,r,s,i],o){const l=[],c=[],[u,d,h,f]=V(this,Li,Iwe).call(this);let p,m,v,x,g,w,_,j,N;switch(y(this,j_)){case 0:N=at._rescale,p=n,m=r+i,v=s,x=-i,g=n+u*s,w=r+(1-d-f)*i,_=n+(u+h)*s,j=r+(1-d)*i;break;case 90:N=at._rescaleAndSwap,p=n,m=r,v=s,x=i,g=n+d*s,w=r+u*i,_=n+(d+f)*s,j=r+(u+h)*i;break;case 180:N=at._rescale,p=n+s,m=r,v=-s,x=i,g=n+(1-u-h)*s,w=r+d*i,_=n+(1-u)*s,j=r+(d+f)*i;break;case 270:N=at._rescaleAndSwap,p=n+s,m=r+i,v=-s,x=-i,g=n+(1-d-f)*s,w=r+(1-u-h)*i,_=n+(1-d)*s,j=r+(1-u)*i;break}for(const{line:S,points:C}of y(this,vl))l.push(N(S,p,m,v,x,o?new Array(S.length):null)),c.push(N(C,p,m,v,x,o?new Array(C.length):null));return{lines:l,points:c,rect:[g,w,_,j]}}static deserialize(n,r,s,i,o,{paths:{lines:l,points:c},rotation:u,thickness:d}){const h=[];let f,p,m,v,x;switch(u){case 0:x=at._rescale,f=-n/s,p=r/i+1,m=1/s,v=-1/i;break;case 90:x=at._rescaleAndSwap,f=-r/i,p=-n/s,m=1/i,v=1/s;break;case 180:x=at._rescale,f=n/s+1,p=-r/i,m=-1/s,v=1/i;break;case 270:x=at._rescaleAndSwap,f=r/i+1,p=n/s+1,m=-1/i,v=-1/s;break}if(!l){l=[];for(const w of c){const _=w.length;if(_===2){l.push(new Float32Array([NaN,NaN,NaN,NaN,w[0],w[1]]));continue}if(_===4){l.push(new Float32Array([NaN,NaN,NaN,NaN,w[0],w[1],NaN,NaN,NaN,NaN,w[2],w[3]]));continue}const j=new Float32Array(3*(_-2));l.push(j);let[N,S,C,k]=w.subarray(0,4);j.set([NaN,NaN,NaN,NaN,N,S],0);for(let E=4;E<_;E+=2){const P=w[E],T=w[E+1];j.set(at.createBezierPoints(N,S,C,k,P,T),(E-2)*3),[N,S,C,k]=[C,k,P,T]}}}for(let w=0,_=l.length;w<_;w++)h.push({line:x(l[w].map(j=>j??NaN),f,p,m,v),points:x(c[w].map(j=>j??NaN),f,p,m,v)});const g=new this.prototype.constructor;return g.build(h,s,i,1,u,d,o),g}get box(){return y(this,Ja)}updateProperty(n,r){return n==="stroke-width"?V(this,Li,Lwe).call(this,r):null}updateParentDimensions([n,r],s){const[i,o]=V(this,Li,Fh).call(this);$(this,Md,n),$(this,Rd,r),$(this,__,s);const[l,c]=V(this,Li,Fh).call(this),u=l-i,d=c-o,h=y(this,Ja);return h[0]-=u,h[1]-=d,h[2]+=2*u,h[3]+=2*d,h}updateRotation(n){return $(this,UE,n),{path:{transform:this.rotationTransform}}}get viewBox(){return y(this,Ja).map(at.svgRound).join(" ")}get defaultProperties(){const[n,r]=y(this,Ja);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${at.svgRound(n)} ${at.svgRound(r)}`}}}get rotationTransform(){const[,,n,r]=y(this,Ja);let s=0,i=0,o=0,l=0,c=0,u=0;switch(y(this,UE)){case 90:i=r/n,o=-n/r,c=n;break;case 180:s=-1,l=-1,c=n,u=r;break;case 270:i=-r/n,o=n/r,u=r;break;default:return""}return`matrix(${s} ${i} ${o} ${l} ${at.svgRound(c)} ${at.svgRound(u)})`}getPathResizingSVGProperties([n,r,s,i]){const[o,l]=V(this,Li,Fh).call(this),[c,u,d,h]=y(this,Ja);if(Math.abs(d-o)<=at.PRECISION||Math.abs(h-l)<=at.PRECISION){const x=n+s/2-(c+d/2),g=r+i/2-(u+h/2);return{path:{"transform-origin":`${at.svgRound(n)} ${at.svgRound(r)}`,transform:`${this.rotationTransform} translate(${x} ${g})`}}}const f=(s-2*o)/(d-2*o),p=(i-2*l)/(h-2*l),m=d/s,v=h/i;return{path:{"transform-origin":`${at.svgRound(c)} ${at.svgRound(u)}`,transform:`${this.rotationTransform} scale(${m} ${v}) translate(${at.svgRound(o)} ${at.svgRound(l)}) scale(${f} ${p}) translate(${at.svgRound(-o)} ${at.svgRound(-l)})`}}}getPathResizedSVGProperties([n,r,s,i]){const[o,l]=V(this,Li,Fh).call(this),c=y(this,Ja),[u,d,h,f]=c;if(c[0]=n,c[1]=r,c[2]=s,c[3]=i,Math.abs(h-o)<=at.PRECISION||Math.abs(f-l)<=at.PRECISION){const g=n+s/2-(u+h/2),w=r+i/2-(d+f/2);for(const{line:_,points:j}of y(this,vl))at._translate(_,g,w,_),at._translate(j,g,w,j);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${at.svgRound(n)} ${at.svgRound(r)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}
910const p=(s-2*o)/(h-2*o),m=(i-2*l)/(f-2*l),v=-p*(u+o)+n+o,x=-m*(d+l)+r+l;if(p!==1||m!==1||v!==0||x!==0)for(const{line:g,points:w}of y(this,vl))at._rescale(g,v,x,p,m,g),at._rescale(w,v,x,p,m,w);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${at.svgRound(n)} ${at.svgRound(r)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([n,r],s){const[i,o]=s,l=y(this,Ja),c=n-l[0],u=r-l[1];if(y(this,Md)===i&&y(this,Rd)===o)for(const{line:d,points:h}of y(this,vl))at._translate(d,c,u,d),at._translate(h,c,u,h);else{const d=y(this,Md)/i,h=y(this,Rd)/o;$(this,Md,i),$(this,Rd,o);for(const{line:f,points:p}of y(this,vl))at._rescale(f,c,u,d,h,f),at._rescale(p,c,u,d,h,p);l[2]*=d,l[3]*=h}return l[0]=n,l[1]=r,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${at.svgRound(n)} ${at.svgRound(r)}`}}}get defaultSVGProperties(){const n=y(this,Ja);return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${at.svgRound(n[0])} ${at.svgRound(n[1])}`,transform:this.rotationTransform||null},bbox:n}}}Ja=new WeakMap,UE=new WeakMap,qE=new WeakMap,vl=new WeakMap,Md=new WeakMap,Rd=new WeakMap,__=new WeakMap,j_=new WeakMap,Ay=new WeakMap,Li=new WeakSet,Fh=function(n=y(this,Ay)){const r=y(this,qE)+n/2*y(this,__);return y(this,j_)%180===0?[r/y(this,Md),r/y(this,Rd)]:[r/y(this,Rd),r/y(this,Md)]},Iwe=function(){const[n,r,s,i]=y(this,Ja),[o,l]=V(this,Li,Fh).call(this,0);return[n+o,r+l,s-2*o,i-2*l]},Dwe=function(){const n=$(this,Ja,new Float32Array([1/0,1/0,-1/0,-1/0]));for(const{line:i}of y(this,vl)){if(i.length<=12){for(let c=4,u=i.length;c<u;c+=6)ot.pointBoundingBox(i[c],i[c+1],n);continue}let o=i[4],l=i[5];for(let c=6,u=i.length;c<u;c+=6){const[d,h,f,p,m,v]=i.subarray(c,c+6);ot.bezierBoundingBox(o,l,d,h,f,p,m,v,n),o=m,l=v}}const[r,s]=V(this,Li,Fh).call(this);n[0]=va(n[0]-r,0,1),n[1]=va(n[1]-s,0,1),n[2]=va(n[2]+r,0,1),n[3]=va(n[3]+s,0,1),n[2]-=n[0],n[3]-=n[1]},Lwe=function(n){const[r,s]=V(this,Li,Fh).call(this);$(this,Ay,n);const[i,o]=V(this,Li,Fh).call(this),[l,c]=[i-r,o-s],u=y(this,Ja);return u[0]-=l,u[1]-=c,u[2]+=2*l,u[3]+=2*c,u};class e4 extends Rwe{constructor(e){super(),this._viewParameters=e,super.updateProperties({fill:"none",stroke:cr._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-miterlimit":10})}updateSVGProperty(e,n){e==="stroke-width"&&(n??(n=this["stroke-width"]),n*=this._viewParameters.realScale),super.updateSVGProperty(e,n)}clone(){const e=new e4(this._viewParameters);return e.updateAll(this),e}}var SL,Fwe;const ww=class ww extends dI{constructor(n){super({...n,name:"inkEditor"});q(this,SL);this._willKeepAspectRatio=!0,this.defaultL10nId="pdfjs-editor-ink-editor"}static initialize(n,r){cr.initialize(n,r),this._defaultDrawingOptions=new e4(r.viewParameters)}static getDefaultDrawingOptions(n){const r=this._defaultDrawingOptions.clone();return r.updateProperties(n),r}static get supportMultipleDrawings(){return!0}static get typesMap(){return Gt(this,"typesMap",new Map([[sn.INK_THICKNESS,"stroke-width"],[sn.INK_COLOR,"stroke"],[sn.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance(n,r,s,i,o){return new $et(n,r,s,i,o,this._defaultDrawingOptions["stroke-width"])}static deserializeDraw(n,r,s,i,o,l){return E2.deserialize(n,r,s,i,o,l)}static async deserialize(n,r,s){let i=null;if(n instanceof R7){const{data:{inkLists:l,rect:c,rotation:u,id:d,color:h,opacity:f,borderStyle:{rawWidth:p},popupRef:m,richText:v,contentsObj:x,creationDate:g,modificationDate:w},parent:{page:{pageNumber:_}}}=n;i=n={annotationType:Bt.INK,color:Array.from(h),thickness:p,opacity:f,paths:{points:l},boxes:null,pageIndex:_-1,rect:c.slice(0),rotation:u,annotationElementId:d,id:d,deleted:!1,popupRef:m,richText:v,comment:(x==null?void 0:x.str)||null,creationDate:g,modificationDate:w}}const o=await super.deserialize(n,r,s);return o._initialData=i,n.comment&&o.setCommentData(n),o}get toolbarButtons(){return this._colorPicker||(this._colorPicker=new lI(this)),[["colorPicker",this._colorPicker]]}get colorType(){return sn.INK_COLOR}get color(){return this._drawingOptions.stroke}get opacity(){return this._drawingOptions["stroke-opacity"]}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();const{_drawId:n,_drawingOptions:r,parent:s}=this;r.updateSVGProperty("stroke-width"),s.drawLayer.updateProperties(n,r.toSVGProperties())}static onScaleChangingWhenDrawing(){const n=this._currentParent;n&&(super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty("stroke-width"),n.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}createDrawingOptions({color:n,thickness:r,opacity:s}){this._drawingOptions=ww.getDefaultDrawingOptions({stroke:ot.makeHexColor(...n),"stroke-width":r,"stroke-opacity":s})}serialize(n=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const{lines:r,points:s}=this.serializeDraw(n),{_drawingOptions:{stroke:i,"stroke-opacity":o,"stroke-width":l}}=this,c=Object.assign(super.serialize(n),{color:cr._colorManager.convert(i),opacity:o,thickness:l,paths:{lines:r,points:s}});return this.addComment(c),n?(c.isCopy=!0,c):this.annotationElementId&&!V(this,SL,Fwe).call(this,c)?null:(c.id=this.annotationElementId,c)}renderAnnotationElement(n){if(this.deleted)return n.hide(),null;const{points:r,rect:s}=this.serializeDraw(!1);return n.updateEdited({rect:s,thickness:this._drawingOptions["stroke-width"],points:r,popup:this.comment}),null}};SL=new WeakSet,Fwe=function(n){const{color:r,thickness:s,opacity:i,pageIndex:o}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized||n.c
910olor.some((l,c)=>l!==r[c])||n.thickness!==s||n.opacity!==i||n.pageIndex!==o},Te(ww,"_type","ink"),Te(ww,"_editorType",Bt.INK),Te(ww,"_defaultDrawingOptions",null);let KU=ww;class GU extends E2{toSVGPath(){let e=super.toSVGPath();return e.endsWith("Z")||(e+="Z"),e}}const xP=8,ES=3;var Ey,Pn,YU,pu,$we,zwe,XU,vR,Bwe,Uwe,qwe,JU,QU,Vwe;class qd{static extractContoursFromText(e,{fontFamily:n,fontStyle:r,fontWeight:s},i,o,l,c){let u=new OffscreenCanvas(1,1),d=u.getContext("2d",{alpha:!1});const h=200,f=d.font=`${r} ${s} ${h}px ${n}`,{actualBoundingBoxLeft:p,actualBoundingBoxRight:m,actualBoundingBoxAscent:v,actualBoundingBoxDescent:x,fontBoundingBoxAscent:g,fontBoundingBoxDescent:w,width:_}=d.measureText(e),j=1.5,N=Math.ceil(Math.max(Math.abs(p)+Math.abs(m)||0,_)*j),S=Math.ceil(Math.max(Math.abs(v)+Math.abs(x)||h,Math.abs(g)+Math.abs(w)||h)*j);u=new OffscreenCanvas(N,S),d=u.getContext("2d",{alpha:!0,willReadFrequently:!0}),d.font=f,d.filter="grayscale(1)",d.fillStyle="white",d.fillRect(0,0,N,S),d.fillStyle="black",d.fillText(e,N*(j-1)/2,S*(3-j)/2);const C=V(this,Pn,JU).call(this,d.getImageData(0,0,N,S).data),k=V(this,Pn,qwe).call(this,C),E=V(this,Pn,QU).call(this,k),P=V(this,Pn,XU).call(this,C,N,S,E);return this.processDrawnLines({lines:{curves:P,width:N,height:S},pageWidth:i,pageHeight:o,rotation:l,innerMargin:c,mustSmooth:!0,areContours:!0})}static process(e,n,r,s,i){const[o,l,c]=V(this,Pn,Vwe).call(this,e),[u,d]=V(this,Pn,Uwe).call(this,o,l,c,Math.hypot(l,c)*y(this,Ey).sigmaSFactor,y(this,Ey).sigmaR,y(this,Ey).kernelSize),h=V(this,Pn,QU).call(this,d),f=V(this,Pn,XU).call(this,u,l,c,h);return this.processDrawnLines({lines:{curves:f,width:l,height:c},pageWidth:n,pageHeight:r,rotation:s,innerMargin:i,mustSmooth:!0,areContours:!0})}static processDrawnLines({lines:e,pageWidth:n,pageHeight:r,rotation:s,innerMargin:i,mustSmooth:o,areContours:l}){s%180!==0&&([n,r]=[r,n]);const{curves:c,width:u,height:d}=e,h=e.thickness??0,f=[],p=Math.min(n/u,r/d),m=p/n,v=p/r,x=[];for(const{points:w}of c){const _=o?V(this,Pn,Bwe).call(this,w):w;if(!_)continue;x.push(_);const j=_.length,N=new Float32Array(j),S=new Float32Array(3*(j===2?2:j-2));if(f.push({line:S,points:N}),j===2){N[0]=_[0]*m,N[1]=_[1]*v,S.set([NaN,NaN,NaN,NaN,N[0],N[1]],0);continue}let[C,k,E,P]=_;C*=m,k*=v,E*=m,P*=v,N.set([C,k,E,P],0),S.set([NaN,NaN,NaN,NaN,C,k],0);for(let T=4;T<j;T+=2){const M=N[T]=_[T]*m,R=N[T+1]=_[T+1]*v;S.set(at.createBezierPoints(C,k,E,P,M,R),(T-2)*3),[C,k,E,P]=[E,P,M,R]}}if(f.length===0)return null;const g=l?new GU:new E2;return g.build(f,n,r,1,s,l?0:h,i),{outline:g,newCurves:x,areContours:l,thickness:h,width:u,height:d}}static async compressSignature({outlines:e,areContours:n,thickness:r,width:s,height:i}){let o=1/0,l=-1/0,c=0;for(const _ of e){c+=_.length;for(let j=2,N=_.length;j<N;j++){const S=_[j]-_[j-2];o=Math.min(o,S),l=Math.max(l,S)}}let u;o>=-128&&l<=127?u=Int8Array:o>=-32768&&l<=32767?u=Int16Array:u=Int32Array;const d=e.length,h=xP+ES*d,f=new Uint32Array(h);let p=0;f[p++]=h*Uint32Array.BYTES_PER_ELEMENT+(c-2*d)*u.BYTES_PER_ELEMENT,f[p++]=0,f[p++]=s,f[p++]=i,f[p++]=n?0:1,f[p++]=Math.max(0,Math.floor(r??0)),f[p++]=d,f[p++]=u.BYTES_PER_ELEMENT;for(const _ of e)f[p++]=_.length-2,f[p++]=_[0],f[p++]=_[1];const m=new CompressionStream("deflate-raw"),v=m.writable.getWriter();await v.ready,v.write(f);const x=u.prototype.constructor;for(const _ of e){const j=new x(_.length-2);for(let N=2,S=_.length;N<S;N++)j[N-2]=_[N]-_[N-2];v.write(j)}v.close();const g=await new Response(m.readable).arrayBuffer(),w=new Uint8Array(g);return B0e(w)}static async decompressSignature(e){try{const n=oZe(e),{readable:r,writable:s}=new DecompressionStream("deflate-raw"),i=s.getWriter();await i.ready,i.write(n).then(async()=>{await i.ready,await i.close()}).catch(()=>{});let o=null,l=0;for await(const _ of r)o||(o=new Uint8Array(new Uint32Array(_.buffer,0,4)[0])),o.set(_,l),l+=_.length;const c=new Uint32Array(o.buffer,0,o.length>>2),u=c[1];if(u!==0)throw new Error(`Invalid version: ${u}`);const d=c[2],h=c[3],f=c[4]===0,p=c[5],m=c[6],v=c[7],x=[],g=(xP+ES*m)*Uint32Array.BYTES_PER_ELEMENT;let w;switch(v){case Int8Array.BYTES_PER_ELEMENT:w=new Int8Array(o.buffer,g);break;case Int16Array.BYTES_PER_ELEMENT:w=new Int16Array(o.buffer,g);break;case Int32Array.BYTES_PER_ELEMENT:w=new Int32Array(o.buffer,g);break}l=0;for(let _=0;_<m;_++){const j=c[ES*_+xP],N=new Float32Array(j+2);x.push(N);for(let S=0;S<ES-1;S++)N[S]=c[ES*_+xP+S+1];for(let S=0;S<j;S++)N[S+2]=N[S]+w[l++]}return{areContours:f,thickness:p,outlines:x,width:d,height:h}}catch(n){return Ut(`decompressSignature: ${n}`),null}}}
910Ey=new WeakMap,Pn=new WeakSet,YU=function(e,n,r,s){return r-=e,s-=n,r===0?s>0?0:4:r===1?s+6:2-s},pu=new WeakMap,$we=function(e,n,r,s,i,o,l){const c=V(this,Pn,YU).call(this,r,s,i,o);for(let u=0;u<8;u++){const d=(-u+c-l+16)%8,h=y(this,pu)[2*d],f=y(this,pu)[2*d+1];if(e[(r+h)*n+(s+f)]!==0)return d}return-1},zwe=function(e,n,r,s,i,o,l){const c=V(this,Pn,YU).call(this,r,s,i,o);for(let u=0;u<8;u++){const d=(u+c+l+16)%8,h=y(this,pu)[2*d],f=y(this,pu)[2*d+1];if(e[(r+h)*n+(s+f)]!==0)return d}return-1},XU=function(e,n,r,s){const i=e.length,o=new Int32Array(i);for(let d=0;d<i;d++)o[d]=e[d]<=s?1:0;for(let d=1;d<r-1;d++)o[d*n]=o[d*n+n-1]=0;for(let d=0;d<n;d++)o[d]=o[n*r-1-d]=0;let l=1,c;const u=[];for(let d=1;d<r-1;d++){c=1;for(let h=1;h<n-1;h++){const f=d*n+h,p=o[f];if(p===0)continue;let m=d,v=h;if(p===1&&o[f-1]===0)l+=1,v-=1;else if(p>=1&&o[f+1]===0)l+=1,v+=1,p>1&&(c=p);else{p!==1&&(c=Math.abs(p));continue}const x=[h,d],g=v===h+1,w={isHole:g,points:x,id:l,parent:0};u.push(w);let _;for(const T of u)if(T.id===c){_=T;break}_?_.isHole?w.parent=g?_.parent:c:w.parent=g?c:_.parent:w.parent=g?c:0;const j=V(this,Pn,$we).call(this,o,n,d,h,m,v,0);if(j===-1){o[f]=-l,o[f]!==1&&(c=Math.abs(o[f]));continue}let N=y(this,pu)[2*j],S=y(this,pu)[2*j+1];const C=d+N,k=h+S;m=C,v=k;let E=d,P=h;for(;;){const T=V(this,Pn,zwe).call(this,o,n,E,P,m,v,1);N=y(this,pu)[2*T],S=y(this,pu)[2*T+1];const M=E+N,R=P+S;x.push(R,M);const A=E*n+P;if(o[A+1]===0?o[A]=-l:o[A]===1&&(o[A]=l),M===d&&R===h&&E===C&&P===k){o[f]!==1&&(c=Math.abs(o[f]));break}else m=E,v=P,E=M,P=R}}}return u},vR=function(e,n,r,s){if(r-n<=4){for(let C=n;C<r-2;C+=2)s.push(e[C],e[C+1]);return}const i=e[n],o=e[n+1],l=e[r-4]-i,c=e[r-3]-o,u=Math.hypot(l,c),d=l/u,h=c/u,f=d*o-h*i,p=c/l,m=1/u,v=Math.atan(p),x=Math.cos(v),g=Math.sin(v),w=m*(Math.abs(x)+Math.abs(g)),_=m*(1-w+w**2),j=Math.max(Math.atan(Math.abs(g+x)*_),Math.atan(Math.abs(g-x)*_));let N=0,S=n;for(let C=n+2;C<r-2;C+=2){const k=Math.abs(f-d*e[C+1]+h*e[C]);k>N&&(S=C,N=k)}N>(u*j)**2?(V(this,Pn,vR).call(this,e,n,S+2,s),V(this,Pn,vR).call(this,e,S,r,s
910)):s.push(i,o)},Bwe=function(e){const n=[],r=e.length;return V(this,Pn,vR).call(this,e,0,r,n),n.push(e[r-2],e[r-1]),n.length<=4?null:n},Uwe=function(e,n,r,s,i,o){const l=new Float32Array(o**2),c=-2*s**2,u=o>>1;for(let v=0;v<o;v++){const x=(v-u)**2;for(let g=0;g<o;g++)l[v*o+g]=Math.exp((x+(g-u)**2)/c)}const d=new Float32Array(256),h=-2*i**2;for(let v=0;v<256;v++)d[v]=Math.exp(v**2/h);const f=e.length,p=new Uint8Array(f),m=new Uint32Array(256);for(let v=0;v<r;v++)for(let x=0;x<n;x++){const g=v*n+x,w=e[g];let _=0,j=0;for(let S=0;S<o;S++){const C=v+S-u;if(!(C<0||C>=r))for(let k=0;k<o;k++){const E=x+k-u;if(E<0||E>=n)continue;const P=e[C*n+E],T=l[S*o+k]*d[Math.abs(P-w)];_+=P*T,j+=T}}const N=p[g]=Math.round(_/j);m[N]++}return[p,m]},qwe=function(e){const n=new Uint32Array(256);for(const r of e)n[r]++;return n},JU=function(e){const n=e.length,r=new Uint8ClampedArray(n>>2);let s=-1/0,i=1/0;for(let l=0,c=r.length;l<c;l++){const u=r[l]=e[l<<2];s=Math.max(s,u),i=Math.min(i,u)}const o=255/(s-i);for(let l=0,c=r.length;l<c;l++)r[l]=(r[l]-i)*o;return r},QU=function(e){let n,r=-1/0,s=-1/0;const i=e.findIndex(c=>c!==0);let o=i,l=i;for(n=i;n<256;n++){const c=e[n];c>r&&(n-o>s&&(s=n-o,l=n-1),r=c,o=n)}for(n=l-1;n>=0&&!(e[n]>e[n+1]);n--);return n},Vwe=function(e){const n=e,{width:r,height:s}=e,{maxDim:i}=y(this,Ey);let o=r,l=s;if(r>i||s>i){let f=r,p=s,m=Math.log2(Math.max(r,s)/i);const v=Math.floor(m);m=m===v?v-1:v;for(let g=0;g<m;g++){o=Math.ceil(f/2),l=Math.ceil(p/2);const w=new OffscreenCanvas(o,l);w.getContext("2d").drawImage(e,0,0,f,p,0,0,o,l),f=o,p=l,e!==n&&e.close(),e=w.transferToImageBitmap()}const x=Math.min(i/o,i/l);o=Math.round(o*x),l=Math.round(l*x)}const u=new OffscreenCanvas(o,l).getContext("2d",{willReadFrequently:!0});u.fillStyle="white",u.fillRect(0,0,o,l),u.filter="grayscale(1)",u.drawImage(e,0,0,e.width,e.height,0,0,o,l);const d=u.getImageData(0,0,o,l).data;return[V(this,Pn,JU).call(this,d),o,l]},q(qd,Pn),q(qd,Ey,{maxDim:512,sigmaSFactor:.02,sigmaR:25,kernelSize:16}),q(qd,pu,new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1]));class I7 extends Rwe{constructor(){super(),super.updateProperties({fill:cr._defaultLineColor,"stroke-width":0})}clone(){const e=new I7;return e.updateAll(this),e}}class D7 extends e4{constructor(e){super(e),super.updateProperties({stroke:cr._defaultLineColor,"stroke-width":1})}clone(){const e=new D7(this._viewParameters);return e.updateAll(this),e}}var Zm,Od,eg,Ty;const tl=class tl extends dI{constructor(n){super({...n,mustBeCommitted:!0,name:"signatureEditor"});q(this,Zm,!1);q(this,Od,null);q(this,eg,null);q(this,Ty,null);this._willKeepAspectRatio=!0,$(this,eg,n.signatureData||null),$(this,Od,null),this.defaultL10nId="pdfjs-editor-signature-editor1"}static initialize(n,r){cr.initialize(n,r),this._defaultDrawingOptions=new I7,this._defaultDrawnSignatureOptions=new D7(r.viewParameters)}static getDefaultDrawingOptions(n){const r=this._defaultDrawingOptions.clone();return r.updateProperties(n),r}static get supportMultipleDrawings(){return!1}static get typesMap(){return Gt(this,"typesMap",new Map)}static get isDrawer(){return!1}get telemetryFinalData(){return{type:"signature",hasDescription:!!y(this,Od)}}static computeTelemetryFinalData(n){const r=n.get("hasDescription");return{hasAltText:r.get(!0)??0,hasNoAltText:r.get(!1)??0}}get isResizable(){return!0}onScaleChanging(){this._drawId!==null&&super.onScaleChanging()}render(){if(this.div)return this.div;let n,r;const{_isCopy:s}=this;if(s&&(this._isCopy=!1,n=this.x,r=this.y),super.render(),this._drawId===null)if(y(this,eg)){const{lines:i,mustSmooth:o,areContours:l,description:c,uuid:u,heightInPage:d}=y(this,eg),{rawDims:{pageWidth:h,pageHeight:f},rotation:p}=this.parent.viewport,m=qd.processDrawnLines({lines:i,pageWidth:h,pageHeight:f,rotation:p,innerMargin:tl._INNER_MARGIN,mustSmooth:o,areContours:l});this.addSignature(m,d,c,u)}else this.div.setAttribute("data-l10n-args",JSON.stringify({description:""})),this.div.hidden=!0,this._uiManager.getSignature(this);else this.div.setAttribute("data-l10n-args",JSON.stringify({description:y(this,Od)||""}));return s&&(this._isCopy=!0,this._moveAfterPaste(n,r)),this.div}setUuid(n){$(this,Ty,n),this.addEditToolbar()}getUuid(){return y(this,Ty)}get description(){return y(this,Od)}set description(n){$(this,Od,n),this.div&&(this.div.setAttribute("data-l10n-args",JSON.stringify({description:n})),super.addEditToolbar().then(r=>{r==null||r.updateEditSignatureButton(n)}))}getSignaturePreview(){const{newCurves:n,areContours:r,thickness:s,width:i,height:o}=y(this,eg),l=Math.max(i,o),c=qd.processDrawnLines({lines:{curves:n.map(u=>({points:u})),thickness:s,width:i,height:o},pageWidth:l,pageHeight:l,rotation:0,innerMargin:0,mustSmooth:!1,areContours:r});return{areContours:r,outline:c.outline}}get toolbarButtons(){return this._uiManager.signatureManager?[["editSignature",this._uiManager.signatureManager]]:super.toolbarButtons}addSignature(n,r,s,i){const{x:o,y:l}=this,{outline:c}=$(this,eg,n);$(this,Zm,c instanceof GU),this.description=s;let u;y(this,Zm)?u=tl.getDefaultDrawingOptions():(u=tl._defaultDrawnSignatureOptions.clone(),u.updateProperties({"stroke-width":c.thickness})),this._addOutlines({drawOutlines:c,drawingOptions:u});const[,d]=this.pageDimensions;let h=r/d;h=h>=1?.5:h,this.width*=h/this.height,this.width>=1&&(h*=.9/this.width,this.width=.9),this.height=h,this.setDims(),this.x=o,this.y=l,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(i),this._reportTelemetry({action:"pdfjs.signature.inserted",data:{hasBeenSaved:!!i,hasDescription:!!s}}),this.div.hidden=!1}getFromImage(n){const{rawDims:{pageWidth:r,pageHeight:s},rotation:i}=this.parent.viewport;return qd.process(n,r,s,i,tl._INNER_MARGIN)}getFromText(n,r){const{rawDims:{pageWidth:s,pageHeight:i},rotation:o}=this.parent.viewport;return qd.extractContoursFromText(n,r,s,i,o,tl._INNER_MARGIN)}getDrawnSignature(n){const{rawDims:{pageWidth:r,pageHeight:s},rotation:i}=this.parent.viewport;return qd.processDrawnLines({lines:n,pageWidth:r,pageHeight:s,rotation:i,innerMargin:tl._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:n,thickness:r}){n?this._drawingOptions=tl.getDefaultDrawingOptions():(this._drawingOptions=tl._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":r}))}serialize(n=!1){if(this.isEmpty())return null;const{lines:r,points:s}=this.serializeDraw(n),{_drawingOptions:{"stroke-width":i}}=this,o=Object.assign(super.serialize(n),{isSignature:!0,areContours:y(this,Zm),color:[0,0,0],thickness:y(this,Zm)?0:i});return this.addComment(o),n?(o.paths={lines:r,points:s},o.uuid=y(this,Ty),o.isCopy=!0):o.lines=r,y(this,Od)&&(o.accessibilityData={type:"Figure",alt:y(this,Od)}),o}static deserializeDraw(n,r,s,i,o,l){return l.areContours?GU.deserialize(n,r,s,i,o,l):E2.deserialize(n,r,s,i,o,l)}static async deserialize(n,r,s){var o;const i=await super.deserialize(n,r,s);
910return $(i,Zm,n.areContours),i.description=((o=n.accessibilityData)==null?void 0:o.alt)||"",$(i,Ty,n.uuid),i}};Zm=new WeakMap,Od=new WeakMap,eg=new WeakMap,Ty=new WeakMap,Te(tl,"_type","signature"),Te(tl,"_editorType",Bt.SIGNATURE),Te(tl,"_defaultDrawingOptions",null);let ZU=tl;var kr,oi,tg,kf,ng,S_,Af,Py,Id,xl,N_,yn,EN,TN,xR,yR,bR,tq,wR,Hwe;class eq extends cr{constructor(n){super({...n,name:"stampEditor"});q(this,yn);q(this,kr,null);q(this,oi,null);q(this,tg,null);q(this,kf,null);q(this,ng,null);q(this,S_,"");q(this,Af,null);q(this,Py,!1);q(this,Id,null);q(this,xl,!1);q(this,N_,!1);$(this,kf,n.bitmapUrl),$(this,ng,n.bitmapFile),this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(n,r){cr.initialize(n,r)}static isHandlingMimeForPasting(n){return rI.includes(n)}static paste(n,r){r.pasteEditor({mode:Bt.STAMP},{bitmapFile:n.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){var n;return{type:"stamp",hasAltText:!!((n=this.altTextData)!=null&&n.altText)}}static computeTelemetryFinalData(n){const r=n.get("hasAltText");return{hasAltText:r.get(!0)??0,hasNoAltText:r.get(!1)??0}}async mlGuessAltText(n=null,r=!0){if(this.hasAltTextData())return null;const{mlManager:s}=this._uiManager;if(!s)throw new Error("No ML.");if(!await s.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");const{data:i,width:o,height:l}=n||this.copyCanvas(null,null,!0).imageData,c=await s.guess({name:"altText",request:{data:i,width:o,height:l,channels:i.length/(o*l)}});if(!c)throw new Error("No response from the AI service.");if(c.error)throw new Error("Error from the AI service.");if(c.cancel)return null;if(!c.output)throw new Error("No valid response from the AI service.");const u=c.output;return await this.setGuessedAltText(u),r&&!this.hasAltTextData()&&(this.altTextData={alt:u,decorative:!1}),u}remove(){var n;y(this,oi)&&($(this,kr,null),this._uiManager.imageManager.deleteId(y(this,oi)),(n=y(this,Af))==null||n.remove(),$(this,Af,null),y(this,Id)&&(clearTimeout(y(this,Id)),$(this,Id,null))),super.remove()}rebuild(){if(!this.parent){y(this,oi)&&V(this,yn,xR).call(this);return}super.rebuild(),this.div!==null&&(y(this,oi)&&y(this,Af)===null&&V(this,yn,xR).call(this),this.isAttachedToDOM||this.parent.add(this))}onceAdded(n){this._isDraggable=!0,n&&this.div.focus()}isEmpty(){return!(y(this,tg)||y(this,kr)||y(this,kf)||y(this,ng)||y(this,oi)||y(this,Py))}get toolbarButtons(){return[["altText",this.createAltText()]]}get isResizable(){return!0}render(){if(this.div)return this.div;let n,r;return this._isCopy&&(n=this.x,r=this.y),super.render(),this.div.hidden=!0,this.createAltText(),y(this,Py)||(y(this,kr)?V(this,yn,yR).call(this):V(this,yn,xR).call(this)),this._isCopy&&this._moveAfterPaste(n,r),this._uiManager.addShouldRescale(this),this.div}setCanvas(n,r){const{id:s,bitmap:i}=this._uiManager.imageManager.getFromCanvas(n,r);r.remove(),s&&this._uiManager.imageManager.isValidId(s)&&($(this,oi,s),i&&$(this,kr,i),$(this,Py,!1),V(this,yn,yR).call(this))}_onResized(){this.onScaleChanging()}onScaleChanging(){if(!this.parent)return;y(this,Id)!==null&&clearTimeout(y(this,Id)),$(this,Id,setTimeout(()=>{$(this,Id,null),V(this,yn,tq).call(this)},200))}copyCanvas(n,r,s=!1){n||(n=224);const{width:i,height:o}=y(this,kr),l=new $u;let c=y(this,kr),u=i,d=o,h=null;if(r){if(i>r||o>r){const C=Math.min(r/i,r/o);u=Math.floor(i*C),d=Math.floor(o*C)}h=document.createElement("canvas");const p=h.width=Math.ceil(u*l.sx),m=h.height=Math.ceil(d*l.sy);y(this,xl)||(c=V(this,yn,bR).call(this,p,m));const v=h.getContext("2d");v.filter=this._uiManager.hcmFilter;let x="white",g="#cfcfd8";this._uiManager.hcmFilter!=="none"?g="black":uZe.isDarkMode&&(x="#8f8f9d",g="#42414d");const w=15,_=w*l.sx,j=w*l.sy,N=new OffscreenCanvas(_*2,j*2),S=N.getContext("2d");S.fillStyle=x,S.fillRect(0,0,_*2,j*2),S.fillStyle=g,S.fillRect(0,0,_,j),S.fillRect(_,j,_,j),v.fillStyle=v.createPattern(N,"repeat"),v.fillRect(0,0,p,m),v.drawImage(c,0,0,c.width,c.height,0,0,p,m)}let f=null;if(s){let p,m;if(l.symmetric&&c.width<n&&c.height<n)p=c.width,m=c.height;else if(c=y(this,kr),i>n||o>n){const g=Math.min(n/i,n/o);p=Math.floor(i*g),m=Math.floor(o*g),y(this,xl)||(c=V(this,yn,bR).call(this,p,m))}const x=new OffscreenCanvas(p,m).getContext("2d",{willReadFrequently:!0});x.drawImage(c,0,0,c.width,c.height,0,0,p,m),f={width:p,height:m,data:x.getImageData(0,0,p,m).data}}return{canvas:h,width:u,height:d,imageData:f}}static async deserialize(n,r,s){var x;let i=null,o=!1;if(n instanceof owe){const{data:{rect:g,rotation:w,id:_,structParent:j,popupRef:N,richText:S,contentsObj:C,creationDate:k,modificationDate:E},container:P,parent:{page:{pageNumber:T}},canvas:M}=n;let R,A;M?(delete n.canvas,{id:R,bitmap:A}=s.imageManager.getFromCanvas(P.id,M),M.remove()):(o=!0,n._hasNoCanvas=!0);const I=((x=await r._structTree.getAriaAttributes(`${S7}${_}`))==null?void 0:x.get("aria-label"))||"";i=n={annotationType:Bt.STAMP,bitmapId:R,bitmap:A,pageIndex:T-1,rect:g.slice(0),rotation:w,annotationElementId:_,id:_,deleted:!1,accessibilityData:{decorative:!1,altText:I},isSvg:!1,structParent:j,popupRef:N,richText:S,comment:(C==null?void 0:C.str)||null,creationDate:k,modificationDate:E}}const l=await super.deserialize(n,r,s),{rect:c,bitmap:u,bitmapUrl:d,bitmapId:h,isSvg:f,accessibilityData:p}=n;o?(s.addMissingCanvas(n.id,l),$(l,Py,!0)):h&&s.imageManager.isValidId(h)?($(l,oi,h),u&&$(l,kr,u)):$(l,kf,d),$(l,xl,f);const[m,v]=l.pageDimensions;return l.width=(c[2]-c[0])/m,l.height=(c[3]-c[1])/v,p&&(l.altTextData=p),l._initialData=i,n.comment&&l.setCommentData(n),$(l,N_,!!i),l}serialize(n=!1,r=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const s=Object.assign(super.serialize(n),{bitmapId:y(this,oi),isSvg:y(this,xl)});if(this.addComment(s),n)return s.bitmapUrl=V(this,yn,wR).call(this,!0),s.accessibilityData=this.serializeAltText(!0),s.isCopy=!0,s;const{decorative:i,altText:o}=this.serializeAltText(!1);if(!i&&o&&(s.accessibilityData={type:"Figure",alt:o}),this.annotationElementId){const c=V(this,yn,Hwe).call(this,s);return c.isSame?null:(c.isSameAltText?delete s.accessibilityData:s.accessibilityData.structParent=this._initialData.structParent??-1,s.id=this.annotationElementId,delete s.bitmapId,s)}if(r===null)return s;r.stamps||(r.stamps=new Map);const l=y(this,xl)?(s.rect[2]-s.rect[0])*(s.rect[3]-s.rect[1]):null;if(!r.stamps.has(y(this,oi)))r.stamps.set(y(this,oi),{area:l,serialized:s}),s.bitmap=V(this,yn,wR).call(this,!1);else if(y(this,xl)){const c=r.stamps.get(y(this,oi));l>c.area&&(c.area=l,c.serialized.bitmap.close(),c.serialized.bitmap=V(this,yn,wR).call(this,!1))}return s}renderAnnotationElement(n){return this.deleted?(n.hide(),null):(n.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}}
910kr=new WeakMap,oi=new WeakMap,tg=new WeakMap,kf=new WeakMap,ng=new WeakMap,S_=new WeakMap,Af=new WeakMap,Py=new WeakMap,Id=new WeakMap,xl=new WeakMap,N_=new WeakMap,yn=new WeakSet,EN=function(n,r=!1){if(!n){this.remove();return}$(this,kr,n.bitmap),r||($(this,oi,n.id),$(this,xl,n.isSvg)),n.file&&$(this,S_,n.file.name),V(this,yn,yR).call(this)},TN=function(){if($(this,tg,null),this._uiManager.enableWaiting(!1),!!y(this,Af)){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&y(this,kr)){this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&y(this,kr)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}},xR=function(){if(y(this,oi)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(y(this,oi)).then(s=>V(this,yn,EN).call(this,s,!0)).finally(()=>V(this,yn,TN).call(this));return}if(y(this,kf)){const s=y(this,kf);$(this,kf,null),this._uiManager.enableWaiting(!0),$(this,tg,this._uiManager.imageManager.getFromUrl(s).then(i=>V(this,yn,EN).call(this,i)).finally(()=>V(this,yn,TN).call(this)));return}if(y(this,ng)){const s=y(this,ng);$(this,ng,null),this._uiManager.enableWaiting(!0),$(this,tg,this._uiManager.imageManager.getFromFile(s).then(i=>V(this,yn,EN).call(this,i)).finally(()=>V(this,yn,TN).call(this)));return}const n=document.createElement("input");n.type="file",n.accept=rI.join(",");const r=this._uiManager._signal;$(this,tg,new Promise(s=>{n.addEventListener("change",async()=>{if(!n.files||n.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);const i=await this._uiManager.imageManager.getFromFile(n.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),V(this,yn,EN).call(this,i)}s()},{signal:r}),n.addEventListener("cancel",()=>{this.remove(),s()},{signal:r})}).finally(()=>V(this,yn,TN).call(this))),n.click()},yR=function(){var u;const{div:n}=this;let{width:r,height:s}=y(this,kr);const[i,o]=this.pageDimensions,l=.75;if(this.width)r=this.width*i,s=this.height*o;else if(r>l*i||s>l*o){const d=Math.min(l*i/r,l*o/s);r*=d,s*=d}this._uiManager.enableWaiting(!1);const c=$(this,Af,document.createElement("canvas"));c.setAttribute("role","img"),this.addContainer(c),this.width=r/i,this.height=s/o,this.setDims(),(u=this._initialOptions)!=null&&u.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,(!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)&&(n.hidden=!1),V(this,yn,tq).call(this),y(this,N_)||(this.parent.addUndoableEditor(this),$(this,N_,!0)),this._reportTelemetry({action:"inserted_image"}),y(this,S_)&&this.div.setAttribute("aria-description",y(this,S_)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-stamp-added-alert")},bR=function(n,r){const{width:s,height:i}=y(this,kr);let o=s,l=i,c=y(this,kr);for(;o>2*n||l>2*r;){const u=o,d=l;o>2*n&&(o=o>=16384?Math.floor(o/2)-1:Math.ceil(o/2)),l>2*r&&(l=l>=16384?Math.floor(l/2)-1:Math.ceil(l/2));const h=new OffscreenCanvas(o,l);h.getContext("2d").drawImage(c,0,0,u,d,0,0,o,l),c=h.transferToImageBitmap()}return c},tq=function(){const[n,r]=this.parentDimensions,{width:s,height:i}=this,o=new $u,l=Math.ceil(s*n*o.sx),c=Math.ceil(i*r*o.sy),u=y(this,Af);if(!u||u.width===l&&u.height===c)return;u.width=l,u.height=c;const d=y(this,xl)?y(this,kr):V(this,yn,bR).call(this,l,c),h=u.getContext("2d");h.filter=this._uiManager.hcmFilter,h.drawImage(d,0,0,d.width,d.height,0,0,l,c)},wR=function(n){if(n){if(y(this,xl)){const i=this._uiManager.imageManager.getSvgUrl(y(this,oi));if(i)return i}const r=document.createElement("canvas");return{width:r.width,height:r.height}=y(this,kr),r.getContext("2d").drawImage(y(this,kr),0,0),r.toDataURL()}if(y(this,xl)){const[r,s]=this.pageDimensions,i=Math.round(this.width*r*tp.PDF_TO_CSS_UNITS),o=Math.round(this.height*s*tp.PDF_TO_CSS_UNITS),l=new OffscreenCanvas(i,o);return l.getContext("2d").drawImage(y(this,kr),0,0,y(this,kr).width,y(this,kr).height,0,0,i,o),l.transferToImageBitmap()}return structuredClone(y(this,kr))},Hwe=function(n){var l;const{pageIndex:r,accessibilityData:{altText:s}}=this._initialData,i=n.pageIndex===r,o=(((l=n.accessibilityData)==null?void 0:l.alt)||"")===s;return{isSame:!this.hasEditedComment&&!this._hasBeenMoved&&!this._hasBeenResized&&i&&o,isSameAltText:o}},Te(eq,"_type","stamp"),Te(eq,"_editorType",Bt.STAMP);var My,C_,rg,sg,Ef,Io,ig,k_,A_,mu,Tf,li,Pf,ag,E_,xt,og,Xn,nq,Wwe,sd,rq,sq,_R;const Zc=class Zc{constructor({uiManager:e,pageIndex:n,div:r,structTreeLayer:s,accessibilityManager:i,annotationLayer:o,drawLayer:l,textLayer:c,viewport:u,l10n:d}){q(this,Xn);q(this,My);q(this,C_,!1);q(this,rg,null);q(this,sg,null);q(this,Ef,null);q(this,Io,new Map);q(this,ig,!1);q(this,k_,!1);q(this,A_,!1);q(this,mu,null);q(this,Tf,null);q(this,li,null);q(this,Pf,null);q(this,ag,null);q(this,E_,-1);q(this,xt);
910const h=[...y(Zc,og).values()];if(!Zc._initialized){Zc._initialized=!0;for(const f of h)f.initialize(d,e)}e.registerEditorTypes(h),$(this,xt,e),this.pageIndex=n,this.div=r,$(this,My,i),$(this,rg,o),this.viewport=u,$(this,li,c),this.drawLayer=l,this._structTree=s,y(this,xt).addLayer(this)}get isEmpty(){return y(this,Io).size===0}get isInvisible(){return this.isEmpty&&y(this,xt).getMode()===Bt.NONE}updateToolbar(e){y(this,xt).updateToolbar(e)}updateMode(e=y(this,xt).getMode()){switch(V(this,Xn,_R).call(this),e){case Bt.NONE:this.div.classList.toggle("nonEditing",!0),this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case Bt.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case Bt.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);const{classList:n}=this.div;if(n.toggle("nonEditing",!1),e===Bt.POPUP)n.toggle("commentEditing",!0);else{n.toggle("commentEditing",!1);for(const r of y(Zc,og).values())n.toggle(`${r._type}Editing`,e===r._editorType)}this.div.hidden=!1}hasTextLayer(e){var n;return e===((n=y(this,li))==null?void 0:n.div)}setEditingState(e){y(this,xt).setEditingState(e)}addCommands(e){y(this,xt).addCommands(e)}cleanUndoStack(e){y(this,xt).cleanUndoStack(e)}toggleDrawing(e=!1){this.div.classList.toggle("drawing",!e)}togglePointerEvents(e=!1){this.div.classList.toggle("disabled",!e)}toggleAnnotationLayerPointerEvents(e=!1){var n;(n=y(this,rg))==null||n.div.classList.toggle("disabled",!e)}async enable(){var r;$(this,A_,!0),this.div.tabIndex=0,this.togglePointerEvents(!0),this.div.classList.toggle("nonEditing",!1),(r=y(this,ag))==null||r.abort(),$(this,ag,null);const e=new Set;for(const s of y(this,Xn,nq))s.enableEditing(),s.show(!0),s.annotationElementId&&(y(this,xt).removeChangedExistingAnnotation(s),e.add(s.annotationElementId));const n=y(this,rg);if(n)for(const s of n.getEditableAnnotations()){if(s.hide(),y(this,xt).isDeletedAnnotationElement(s.data.id)||e.has(s.data.id))continue;const i=await this.deserialize(s);i&&(this.addOrRebuild(i),i.enableEditing())}$(this,A_,!1),y(this,xt)._eventBus.dispatch("editorsrendered",{source:this,pageNumber:this.pageIndex+1})}disable(){var r;if($(this,k_,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1),this.div.classList.toggle("nonEditing",!0),y(this,li)&&!y(this,ag)){$(this,ag,new AbortController);const s=y(this,xt).combinedSignal(y(this,ag));y(this,li).div.addEventListener("pointerdown",i=>{const{clientX:l,clientY:c,timeStamp:u}=i,d=y(this,E_);if(u-d>500){$(this,E_,u);return}$(this,E_,-1);const{classList:h}=this.div;h.toggle("getElements",!0);const f=document.elementsFromPoint(l,c);if(h.toggle("getElements",!1),!this.div.contains(f[0]))return;let p;const m=new RegExp(`^${jk}[0-9]+$`);for(const x of f)if(m.test(x.id)){p=x.id;break}if(!p)return;const v=y(this,Io).get(p);(v==null?void 0:v.annotationElementId)===null&&(i.stopPropagation(),i.preventDefault(),v.dblclick(i))},{signal:s,capture:!0})}const e=y(this,rg);if(e){const s=new Map,i=new Map;for(const l of y(this,Xn,nq)){if(l.disableEditing(),!l.annotationElementId){l.updateFakeAnnotationElement(e);continue}if(l.serialize()!==null){s.set(l.annotationElementId,l);continue}else i.set(l.annotationElementId,l);(r=this.getEditableAnnotation(l.annotationElementId))==null||r.show(),l.remove()}const o=e.getEditableAnnotations();for(const l of o){const{id:c}=l.data;if(y(this,xt).isDeletedAnnotationElement(c)){l.updateEdited({deleted:!0});continue}let u=i.get(c);if(u){u.resetAnnotationElement(l),u.show(!1),l.show();continue}u=s.get(c),u&&(y(this,xt).addChangedExistingAnnotation(u),u.renderAnnotationElement(l)&&u.show(!1)),l.show()}}V(this,Xn,_R).call(this),this.isEmpty&&(this.div.hidden=!0);const{classList:n}=this.div;for(const s of y(Zc,og).values())n.remove(`${s._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),$(this,k_,!1)}getEditableAnnotation(e){var n;return((n=y(this,rg))==null?void 0:n.getEditableAnnotation(e))||null}setActiveEditor(e){y(this,xt).getActive()!==e&&y(this,xt).setActiveEditor(e)}enableTextSelection(){var e;if(this.div.tabIndex=-1,(e=y(this,li))!=null&&e.div&&!y(this,Pf)){$(this,Pf,new AbortController);const n=y(this,xt).combinedSignal(y(this,Pf));y(this,li).div.addEventListener("pointerdown",V(this,Xn,Wwe).bind(this),{signal:n}),y(this,li).div.classList.add("highlighting")}}disableTextSelection(){var e;this.div.tabIndex=0,(e=y(this,li))!=null&&e.div&&y(this,Pf)&&(y(this,Pf).abort(),$(this,Pf,null),y(this,li).div.classList.remove("highlighting"))}enableClick(){if(y(this,sg))return;$(this,sg,new AbortController);const e=y(this,xt).combinedSignal(y(this,sg));this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:e});const n=this.pointerup.bind(this);this.div.addEventListener("pointerup",n,{signal:e}),this.div.addEventListener("pointercancel",n,{signal:e})}disableClick(){var e;(e=y(this,sg))==null||e.abort(),$(this,sg,null)}
910attach(e){y(this,Io).set(e.id,e);const{annotationElementId:n}=e;n&&y(this,xt).isDeletedAnnotationElement(n)&&y(this,xt).removeDeletedAnnotationElement(e)}detach(e){var n;y(this,Io).delete(e.id),(n=y(this,My))==null||n.removePointerInTextLayer(e.contentDiv),!y(this,k_)&&e.annotationElementId&&y(this,xt).addDeletedAnnotationElement(e)}remove(e){this.detach(e),y(this,xt).removeEditor(e),e.div.remove(),e.isAttachedToDOM=!1}changeParent(e){var n;e.parent!==this&&(e.parent&&e.annotationElementId&&(y(this,xt).addDeletedAnnotationElement(e.annotationElementId),cr.deleteAnnotationElement(e),e.annotationElementId=null),this.attach(e),(n=e.parent)==null||n.detach(e),e.setParent(this),e.div&&e.isAttachedToDOM&&(e.div.remove(),this.div.append(e.div)))}add(e){if(!(e.parent===this&&e.isAttachedToDOM)){if(this.changeParent(e),y(this,xt).addEditor(e),this.attach(e),!e.isAttachedToDOM){const n=e.render();this.div.append(n),e.isAttachedToDOM=!0}e.fixAndSetPosition(),e.onceAdded(!y(this,A_)),y(this,xt).addToAnnotationStorage(e),e._reportTelemetry(e.telemetryInitialData)}}moveEditorInDOM(e){var r;if(!e.isAttachedToDOM)return;const{activeElement:n}=document;e.div.contains(n)&&!y(this,Ef)&&(e._focusEventsAllowed=!1,$(this,Ef,setTimeout(()=>{$(this,Ef,null),e.div.contains(document.activeElement)?e._focusEventsAllowed=!0:(e.div.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:y(this,xt)._signal}),n.focus())},0))),e._structTreeParentId=(r=y(this,My))==null?void 0:r.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addOrRebuild(e){e.needsToBeRebuilt()?(e.parent||(e.parent=this),e.rebuild(),e.show()):this.add(e)}addUndoableEditor(e){const n=()=>e._uiManager.rebuild(e),r=()=>{e.remove()};this.addCommands({cmd:n,undo:r,mustExec:!1})}getEditorByUID(e){for(const n of y(this,Io).values())if(n.uid===e)return n;return null}getNextId(){return y(this,xt).getId()}combinedSignal(e){return y(this,xt).combinedSignal(e)}canCreateNewEmptyEditor(){var e;return(e=y(this,Xn,sd))==null?void 0:e.canCreateNewEmptyEditor()}async pasteEditor(e,n){this.updateToolbar(e),await y(this,xt).updateMode(e.mode);const{offsetX:r,offsetY:s}=V(this,Xn,sq).call(this),i=this.getNextId(),o=V(this,Xn,rq).call(this,{parent:this,id:i,x:r,y:s,uiManager:y(this,xt),isCentered:!0,...n});o&&this.add(o)}async deserialize(e){var n;return await((n=y(Zc,og).get(e.annotationType??e.annotationEditorType))==null?void 0:n.deserialize(e,this,y(this,xt)))||null}createAndAddNewEditor(e,n,r={}){const s=this.getNextId(),i=V(this,Xn,rq).call(this,{parent:this,id:s,x:e.offsetX,y:e.offsetY,uiManager:y(this,xt),isCentered:n,...r});return i&&this.add(i),i}get boundingClientRect(){return this.div.getBoundingClientRect()}addNewEditor(e={}){this.createAndAddNewEditor(V(this,Xn,sq).call(this),!0,e)}setSelected(e){y(this,xt).setSelected(e)}toggleSelected(e){y(this,xt).toggleSelected(e)}unselect(e){y(this,xt).unselect(e)}pointerup(e){var s;const{isMac:n}=yi.platform;if(e.button!==0||e.ctrlKey&&n||e.target!==this.div||!y(this,ig)||($(this,ig,!1),(s=y(this,Xn,sd))!=null&&s.isDrawer&&y(this,Xn,sd).supportMultipleDrawings))return;if(!y(this,C_)){$(this,C_,!0);return}const r=y(this,xt).getMode();if(r===Bt.STAMP||r===Bt.SIGNATURE){y(this,xt).unselectAll();return}this.createAndAddNewEditor(e,!1)}pointerdown(e){var s;if(y(this,xt).getMode()===Bt.HIGHLIGHT&&this.enableTextSelection(),y(this,ig)){$(this,ig,!1);return}const{isMac:n}=yi.platform;if(e.button!==0||e.ctrlKey&&n||e.target!==this.div)return;if($(this,ig,!0),(s=y(this,Xn,sd))!=null&&s.isDrawer){this.startDrawingSession(e);return}const r=y(this,xt).getActive();$(this,C_,!r||r.isEmpty())}startDrawingSession(e){if(this.div.focus({preventScroll:!0}),y(this,mu)){y(this,Xn,sd).startDrawing(this,y(this,xt),!1,e);return}y(this,xt).setCurrentDrawingSession(this),$(this,mu,new AbortController);const n=y(this,xt).combinedSignal(y(this,mu));this.div.addEventListener("blur",({relatedTarget:r})=>{r&&!this.div.contains(r)&&($(this,Tf,null),this.commitOrRemove())},{signal:n}),y(this,Xn,sd).startDrawing(this,y(this,xt),!1,e)}pause(e){if(e){const{activeElement:n}=document;this.div.contains(n)&&$(this,Tf,n);return}y(this,Tf)&&setTimeout(()=>{var n;(n=y(this,Tf))==null||n.focus(),$(this,Tf,null)},0)}endDrawingSession(e=!1){return y(this,mu)?(y(this,xt).setCurrentDrawingSession(null),y(this,mu).abort(),$(this,mu,null),$(this,Tf,null),y(this,Xn,sd).endDrawing(e)):null}findNewParent(e,n,r){const s=y(this,xt).findParent(n,r);return s===null||s===this?!1:(s.changeParent(e),!0)}commitOrRemove(){return y(this,mu)?(this.endDrawingSession(),!0):!1}onScaleChanging(){y(this,mu)&&y(this,Xn,sd).onScaleChangingWhenDrawing(this)}destroy(){var e,n;this.commitOrRemove(),((e=y(this,xt).getActive())==null?void 0:e.parent)===this&&(y(this,xt).commitOrRemove(),y(this,xt).setActiveEditor(null)),y(this,Ef)&&(clearTimeout(y(this,Ef)),$(this,Ef,null));for(const r of y(this,Io).values())(n=y(this,My))==null||n.removePointerInTextLayer(r.contentDiv),r.setParent(null),r.isAttachedToDOM=!1,r.div.remove();this.div=null,y(this,Io).clear(),y(this,xt).removeLayer(this)}render({viewport:e}){this.viewport=e,$g(this.div,e);for(const n of y(this,xt).getEditors(this.pageIndex))this.add(n),n.rebuild();this.updateMode()}update({viewport:e}){y(this,xt).commitOrRemove(),V(this,Xn,_R).call(this);const n=this.viewport.rotation,r=e.rotation;if(this.viewport=e,$g(this.div,{rotation:r}),n!==r)for(const s of y(this,Io).values())s.rotate(r)}get pageDimensions(){const{pageWidth:e,pageHeight:n}=this.viewport.rawDims;return[e,n]}get scale(){return y(this,xt).viewParameters.realScale}};My=new WeakMap,C_=new WeakMap,rg=new WeakMap,sg=new WeakMap,Ef=new WeakMap,Io=new WeakMap,ig=new WeakMap,k_=new WeakMap,A_=new WeakMap,mu=new WeakMap,Tf=new WeakMap,li=new WeakMap,Pf=new WeakMap,ag=new WeakMap,E_=new WeakMap,xt=new WeakMap,og=new WeakMap,Xn=new WeakSet,nq=function(){return y(this,Io).size!==0?y(this,Io).values():y(this,xt).getEditors(this.pageIndex)},Wwe=function(e){y(this,xt).unselectAll();const{target:n}=e;if(n===y(this,li).div||(n.getAttribute("role")==="img"||n.classList.contains("endOfContent"))&&y(this,li).div.contains(n)){const{isMac:r}=yi.platform;if(e.button!==0||e.ctrlKey&&r)return;y(this,xt).showAllEditors("highlight",!0,!0),y(this,li).div.classList.add("free"),this.toggleDrawing(),uI.startHighlighting(this,y(this,xt).direction==="ltr",{target:y(this,li).div,x:e.x,y:e.y}),y(this,li).div.addEventListener("pointerup",()=>{y(this,li).div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:y(this,xt)._signal}),e.preventDefault()}},sd=function(){return y(Zc,og).get(y(this,xt).getMode())},rq=function(e){const n=y(this,Xn,sd);return n?new n.prototype.constructor(e):null},sq=function(){const{x:e,y:n,width:r,height:s}=this.boundingClientRect,i=Math.max(0,e),o=Math.max(0,n),l=Math.min(window.innerWidth,e+r),c=Math.min(window.innerHeight,n+s),u=(i+l)/2-e,d=(o+c)/2-n,[h,f]=this.viewport.rotation%180===0?[u,d]:[d,u];return{offsetX:h,offsetY:f}},_R=function(){for(const e of y(this,Io).values())e.isEmpty()&&e.remove()},Te(Zc,"_initialized",!1),q(Zc,og,new Map([LU,KU,eq,uI,ZU].map(e=>[e._editorType,e])));let hI=Zc;var gu,Qa,Ry,VE,NL,Kwe,xh,iq,Gwe,aq;const Ls=class Ls{constructor({pageIndex:e}){q(this,xh);q(this,gu,null);q(this,Qa,new Map);q(this,Ry,new Map);this.pageIndex=e}setParent(e){if(!y(this,gu)){$(this,gu,e);return}if(y(this,gu)!==e){if(y(this,Qa).size>0)for(const n of y(this,Qa).values())n.remove(),e.append(n);$(this,gu,e)}}static get _svgFactory(){return Gt(this,"_svgFactory",new Tk)}draw(e,n=!1,r=!1){const s=Vr(Ls,VE)._++,i=V(this,xh,iq).call(this),o=Ls._svgFactory.createElement("defs");i.append(o);const l=Ls._svgFactory.createElement("path");o.append(l);const c=`path_p${this.pageIndex}_${s}`;l.setAttribute("id",c),l.setAttribute("vector-effect","non-scaling-stroke"),n&&y(this,Ry).set(s,l);const u=r?V(this,xh,Gwe).call(this,o,c):null,d=Ls._svgFactory.createElement("use");return i.append(d),d.setAttribute("href",`#${c}`),this.updateProperties(i,e),y(this,Qa).set(s,i),{id:s,clipPathId:`url(#${u})`}}drawOutline(e,n){const r=Vr(Ls,VE)._++,s=V(this,xh,iq).call(this),i=Ls._svgFactory.createElement("defs");s.append(i);const o=Ls._svgFactory.createElement("path");i.append(o);const l=`path_p${this.pageIndex}_${r}`;o.setAttribute("id",l),o.setAttribute("vector-effect","non-scaling-stroke");let c;if(n){const h=Ls._svgFactory.createElement("mask");i.append(h),c=`mask_p${this.pageIndex}_${r}`,h.setAttribute("id",c),h.setAttribute("maskUnits","objectBoundingBox");const f=Ls._svgFactory.createElement("rect");h.append(f),f.setAttribute("width","1"),f.setAttribute("height","1"),f.setAttribute("fill","white");const p=Ls._svgFactory.createElement("use");h.append(p),p.setAttribute("href",`#${l}`),p.setAttribute("stroke","none"),p.setAttribute("fill","black"),p.setAttribute("fill-rule","nonzero"),p.classList.add("mask")}const u=Ls._svgFactory.createElement("use");s.append(u),u.setAttribute("href",`#${l}`),c&&u.setAttribute("mask",`url(#${c})`);const d=u.cloneNode();return s.append(d),u.classList.add("mainOutline"),d.classList.add("secondaryOutline"),this.updateProperties(s,e),y(this,Qa).set(r,s),r}finalizeDraw(e,n){y(this,Ry).delete(e),this.updateProperties(e,n)}updateProperties(e,n){var c;if(!n)return;const{root:r,bbox:s,rootClass:i,path:o}=n,l=typeof e=="number"?y(this,Qa).get(e):e;if(l){if(r&&V(this,xh,aq).call(this,l,r),s&&V(c=Ls,NL,Kwe).call(c,l,
910s),i){const{classList:u}=l;for(const[d,h]of Object.entries(i))u.toggle(d,h)}if(o){const d=l.firstChild.firstChild;V(this,xh,aq).call(this,d,o)}}}updateParent(e,n){if(n===this)return;const r=y(this,Qa).get(e);r&&(y(n,gu).append(r),y(this,Qa).delete(e),y(n,Qa).set(e,r))}remove(e){y(this,Ry).delete(e),y(this,gu)!==null&&(y(this,Qa).get(e).remove(),y(this,Qa).delete(e))}destroy(){$(this,gu,null);for(const e of y(this,Qa).values())e.remove();y(this,Qa).clear(),y(this,Ry).clear()}};gu=new WeakMap,Qa=new WeakMap,Ry=new WeakMap,VE=new WeakMap,NL=new WeakSet,Kwe=function(e,[n,r,s,i]){const{style:o}=e;o.top=`${100*r}%`,o.left=`${100*n}%`,o.width=`${100*s}%`,o.height=`${100*i}%`},xh=new WeakSet,iq=function(){const e=Ls._svgFactory.create(1,1,!0);return y(this,gu).append(e),e.setAttribute("aria-hidden",!0),e},Gwe=function(e,n){const r=Ls._svgFactory.createElement("clipPath");e.append(r);const s=`clip_${n}`;r.setAttribute("id",s),r.setAttribute("clipPathUnits","objectBoundingBox");const i=Ls._svgFactory.createElement("use");return r.append(i),i.setAttribute("href",`#${n}`),i.classList.add("clip"),s},aq=function(e,n){for(const[r,s]of Object.entries(n))s===null?e.removeAttribute(r):e.setAttribute(r,s)},q(Ls,NL),q(Ls,VE,0);let fI=Ls;globalThis._pdfjsTestingUtils={HighlightOutliner:$U};globalThis.pdfjsLib={AbortException:ep,AnnotationEditorLayer:hI,AnnotationEditorParamsType:sn,AnnotationEditorType:Bt,AnnotationEditorUIManager:zg,AnnotationLayer:O7,AnnotationMode:Ud,AnnotationType:ds,applyOpacity:W0e,build:Ybe,ColorPicker:Ek,createValidAbsoluteUrl:w7,CSSConstants:H0e,DOMSVGFactory:Tk,DrawLayer:fI,FeatureTest:yi,fetchData:Bj,findContrastColor:K0e,getDocument:T7,getFilenameFromUrl:U0e,getPdfFilenameFromUrl:q0e,getRGB:Uj,getUuid:j7,getXfaPageViewport:V0e,GlobalWorkerOptions:Nl,ImageKind:bC,InvalidPDFException:nI,isDataScheme:C2,isPdfFile:J3,isValidExplicitDest:Cbe,MathClamp:va,noContextMenu:$l,normalizeUnicode:z0e,OPS:Y_,OutputScale:$u,PasswordResponses:F0e,PDFDataRangeTransport:P7,PDFDateString:Ck,PDFWorker:X_,PermissionFlag:L0e,PixelsPerInch:tp,RenderingCancelledException:X3,renderRichText:C7,ResponseException:Sk,setLayerDimensions:$g,shadow:Gt,SignatureExtractor:qd,stopEvent:Dr,SupportedImageMimeTypes:rI,TextLayer:Ak,TouchManager:kk,updateUrlHash:_7,Util:ot,VerbosityLevel:j2,version:Z3,XfaLayer:N7};const zet=Object.freeze(Object.defineProperty({__proto__:null,AbortException:ep,AnnotationEditorLayer:hI,AnnotationEditorParamsType:sn,AnnotationEditorType:Bt,AnnotationEditorUIManager:zg,AnnotationLayer:O7,AnnotationMode:Ud,AnnotationType:ds,CSSConstants:H0e,ColorPicker:Ek,DOMSVGFactory:Tk,DrawLayer:fI,FeatureTest:yi,GlobalWorkerOptions:Nl,ImageKind:bC,InvalidPDFException:nI,MathClamp:va,OPS:Y_,OutputScale:$u,PDFDataRangeTransport:P7,PDFDateString:Ck,PDFWorker:X_,PasswordResponses:F0e,PermissionFlag:L0e,PixelsPerInch:tp,RenderingCancelledException:X3,ResponseException:Sk,SignatureExtractor:qd,SupportedImageMimeTypes:rI,TextLayer:Ak,TouchManager:kk,Util:ot,VerbosityLevel:j2,XfaLayer:N7,applyOpacity:W0e,build:Ybe,createValidAbsoluteUrl:w7,fetchData:Bj,findContrastColor:K0e,getDocument:T7,getFilenameFromUrl:U0e,getPdfFilenameFromUrl:q0e,getRGB:Uj,getUuid:j7,getXfaPageViewport:V0e,isDataScheme:C2,isPdfFile:J3,isValidExplicitDest:Cbe,noContextMenu:$l,normalizeUnicode:z0e,renderRichText:C7,setLayerDimensions:$g,shadow:Gt,stopEvent:Dr,updateUrlHash:_7,version:Z3},Symbol.toStringTag,{value:"Module"}));var Wte=Object.prototype.hasOwnProperty;function Kte(t,e,n){for(n of t.keys())if($w(n,e))return n}function $w(t,e){var n,r,s;if(t===e)return!0;if(t&&e&&(n=t.constructor)===e.constructor){if(n===Date)return t.getTime()===e.getTime();if(n===RegExp)return t.toString()===e.toString();if(n===Array){if((r=t.length)===e.length)for(;r--&&$w(t[r],e[r]););return r===-1}if(n===Set){if(t.size!==e.size)return!1;for(r of t)if(s=r,s&&typeof s=="object"&&(s=Kte(e,s),!s)||!e.has(s))return!1;return!0}if(n===Map){if(t.size!==e.size)return!1;for(r of t)if(s=r[0],s&&typeof s=="object"&&(s=Kte(e,s),!s)||!$w(r[1],e.get(s)))return!1;return!0}if(n===ArrayBuffer)t=new Uint8Array(t),e=new Uint8Array(e);else if(n===DataView){if((r=t.byteLength)===e.byteLength)for(;r--&&t.getInt8(r)===e.getInt8(r););return r===-1}if(ArrayBuffer.isView(t)){if((r=t.byteLength)===e.byteLength)for(;r--&&t[r]===e[r];);return r===-1}if(!n||typeof t=="object"){r=0;for(n in t)if(Wte.call(t,n)&&++r&&!Wte.call(e,n)||!(n in e)||!$w(t[n],e[n]))return!1;return Object.keys(e).length===r}}return t!==t&&e!==e}function T2(t){let e=!1;return{promise:new Promise((r,s)=>{t.then(i=>!e&&r(i)).catch(i=>!e&&s(i))}),cancel(){e=!0}}}const Bet=["onCopy","onCut","onPaste"],Uet=["onCompositionEnd","onCompositionStart","onCompositionUpdate"],qet=["onFocus","onBlur"],Vet=["onInput","onInvalid","onReset","onSubmit"],Het=["onLoad","onError"],Wet=["onKeyDown","onKeyPress","onKeyUp"],Ket=["onAbort","onCanPlay","onCanPlayThrough","onDurationChange","onEmptied","onEncrypted","onEnded","onError","onLoadedData","onLoadedMetadata","onLoadStart","onPause","onPlay","onPlaying","onProgress","onRateChange","onSeeked","onSeeking","onStalled","onSuspend","onTimeUpdate","onVolumeChange","onWaiting"],Get=["onClick","onContextMenu","onDoubleClick","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp"],Yet=["onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop"],Xet=["onSelect"],Jet=["onTouchCancel","onTouchEnd","onTouchMove","onTouchStart"],Qet=["onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onGotPointerCapture","onLostPointerCapture","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut"],Zet=["onScroll"],ett=["onWheel"],ttt=["onAnimationStart","onAnimationEnd","onAnimationIteration"],ntt=["onTransitionEnd"],rtt=["onToggle"],stt=["onChange"],itt=[...Bet,...
910Uet,...qet,...Vet,...Het,...Wet,...Ket,...Get,...Yet,...Xet,...Jet,...Qet,...Zet,...ett,...ttt,...ntt,...stt,...rtt];function Ywe(t,e){const n={};for(const r of itt){const s=t[r];s&&(e?n[r]=i=>s(i,e(r)):n[r]=s)}return n}var att="Invariant failed";function Vn(t,e){if(!t)throw new Error(att)}var ott=function(){},ltt=ott;const wa=cp(ltt),Xwe=b.createContext(null),ctt="noopener noreferrer nofollow";class utt{constructor(){this.externalLinkEnabled=!0,this.externalLinkRel=void 0,this.externalLinkTarget=void 0,this.isInPresentationMode=!1,this.pdfDocument=void 0,this.pdfViewer=void 0}setDocument(e){this.pdfDocument=e}setViewer(e){this.pdfViewer=e}setExternalLinkRel(e){this.externalLinkRel=e}setExternalLinkTarget(e){this.externalLinkTarget=e}setHash(){}setHistory(){}get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0}get page(){return Vn(this.pdfViewer),this.pdfViewer.currentPageNumber||0}set page(e){Vn(this.pdfViewer),this.pdfViewer.currentPageNumber=e}get rotation(){return 0}set rotation(e){}addLinkAttributes(e,n,r){e.href=n,e.rel=this.externalLinkRel||ctt,e.target=r?"_blank":this.externalLinkTarget||""}goToDestination(e){return new Promise(n=>{Vn(this.pdfDocument),Vn(e),typeof e=="string"?this.pdfDocument.getDestination(e).then(n):Array.isArray(e)?n(e):e.then(n)}).then(n=>{Vn(Array.isArray(n));const r=n[0];new Promise(s=>{Vn(this.pdfDocument),r instanceof Object?this.pdfDocument.getPageIndex(r).then(i=>{s(i)}).catch(()=>{Vn(!1)}):typeof r=="number"?s(r):Vn(!1)}).then(s=>{const i=s+1;Vn(this.pdfViewer),Vn(i>=1&&i<=this.pagesCount),this.pdfViewer.scrollPageIntoView({dest:n,pageIndex:s,pageNumber:i})})})}goToPage(e){const n=e-1;Vn(this.pdfViewer),Vn(e>=1&&e<=this.pagesCount),this.pdfViewer.scrollPageIntoView({pageIndex:n,pageNumber:e})}goToXY(){}cachePageRef(){}getDestinationHash(){return"#"}getAnchorUrl(){return"#"}executeNamedAction(){}executeSetOCGState(){}isPageVisible(){return!0}isPageCached(){return!0}navigateTo(e){this.goToDestination(e)}}function zw({children:t,type:e}){return a.jsx("div",{className:`react-pdf__message react-pdf__message--${e}`,children:t})}const Gte={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};function dtt(t,e){switch(e.type){case"RESOLVE":return{value:e.value,error:void 0};case"REJECT":return{value:!1,error:e.error};case"RESET":return{value:void 0,error:void 0};default:return t}}function J_(){return b.useReducer(dtt,{value:void 0,error:void 0})}const t4=typeof window<"u",Jwe=t4&&window.location.protocol==="file:";function htt(t){return typeof t<"u"}function bv(t){return htt(t)&&t!==null}function ftt(t){return typeof t=="string"}function ptt(t){return t instanceof ArrayBuffer}function mtt(t){return Vn(t4),t instanceof Blob}function oq(t){return ftt(t)&&/^data:/.test(t)}function Yte(t){Vn(oq(t));const[e="",n=""]=t.split(",");return e.split(";").indexOf("base64")!==-1?atob(n):unescape(n)}function gtt(){return t4&&window.devicePixelRatio||1}const Qwe="On Chromium based browsers, you can use --allow-file-access-from-files flag for debugging purposes.";function Xte(){wa(!Jwe,`Loading PDF as base64 strings/URLs may not work on protocols other than HTTP/HTTPS. ${Qwe}`)}function vtt(){wa(!Jwe,`Loading PDF.js worker may not work on protocols other than HTTP/HTTPS. ${Qwe}`)}function l0(t){t!=null&&t.cancel&&t.cancel()}function lq(t,e){return Object.defineProperty(t,"width",{get(){return this.getViewport({scale:e}).width},configurable:!0}),Object.defineProperty(t,"height",{get(){return this.getViewport({scale:e}).height},configurable:!0}),Object.defineProperty(t,"originalWidth",{get(){return this.getViewport({scale:1}).width},configurable:!0}),Object.defineProperty(t,"originalHeight",{get(){return this.getViewport({scale:1}).height},configurable:!0}),t}function Zwe(t){return t.name==="AbortException"||t.name==="RenderingCancelledException"}function xtt(t){return new Promise((e,n)=>{const r=new FileReader;r.onload=()=>{if(!r.result)return n(new Error("Error while reading a file."));e(r.result)},r.onerror=s=>{if(!s.target)return n(new Error("Error while reading a file."));const{error:i}=s.target;if(!i)return n(new Error("Error while reading a file."));switch(i.code){case i.NOT_FOUND_ERR:return n(new Error("Error while reading a file: File not found."));case i.SECURITY_ERR:return n(new Error("Error while reading a file: Security error."));case i.ABORT_ERR:return n(new Error("Error while reading a file: Aborted."));default:return n(new Error("Error while reading a file."))}},r.readAsArrayBuffer(t)})}const{PDFDataRangeTransport:ytt}=zet,btt=(t,e)=>{switch(e){case Gte.NEED_PASSWORD:{const n=prompt("Enter the password to open this PDF file.");t(n);break}case Gte.INCORRECT_PASSWORD:{const n=prompt("Invalid password. Please try again.");t(n);break}}};function Jte(t){return typeof t=="object"&&t!==null&&("data"in t||"range"in t||"url"in t)}const cq=b.forwardRef(function({children:e,className:n,error:r="Failed to load PDF file.",externalLinkRel:s,externalLinkTarget:i,file:o,inputRef:l,imageResourcesPath:c,loading:u="Loading PDFâ¦",noData:d="No PDF file specified.",onItemClick:h,onLoadError:f,onLoadProgress:p,onLoadSuccess:m,onPassword:v=btt,onSourceError:x,onSourceSuccess:g,options:w,renderMode:_,rotate:j,scale:N,...S},C){const[k,E]=J_(),{value:P,error:T}=k,[M,R]=J_(),{value:A,error:I}=M,D=b.useRef(new utt),O=b.useRef([]),z=b.useRef(void 0),B=b.useRef(void 0);o&&o!==z.current&&Jte(o)&&(wa(!$w(o,z.current),`File prop passed to <Document /> changed, but it's equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "file" prop.`),z.current=o),w&&w!==B.current&&(wa(!$w(w,B.current),`Options prop passed to <Document /> changed, but it's equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "options" prop.`),B.current=w);const G=b.useRef({scrollPageIntoView:re=>{const{dest:L,pageNumber:X,pageIndex:ne=X-1}=re;if(h){h({dest:L,pageIndex:ne,pageNumber:X});return}const Y=O.current[ne];if(Y){Y.scrollIntoView();return}wa(!1,`An internal link leading to page ${X} was clicked, but neither <Document> was provided with onItemClick nor it was able to find the page within itself. Either provide onItemClick to <Document>
910 and handle navigating by yourself or ensure that all pages are rendered within <Document>.`)}});b.useImperativeHandle(C,()=>({linkService:D,pages:O,viewer:G}),[]);function U(){g&&g()}function F(){T&&(wa(!1,T.toString()),x&&x(T))}function W(){E({type:"RESET"})}b.useEffect(W,[o,E]);const Q=b.useCallback(async()=>{if(!o)return null;if(typeof o=="string")return oq(o)?{data:Yte(o)}:(Xte(),{url:o});if(o instanceof ytt)return{range:o};if(ptt(o))return{data:o};if(t4&&mtt(o))return{data:await xtt(o)};if(Vn(typeof o=="object"),Vn(Jte(o)),"url"in o&&typeof o.url=="string"){if(oq(o.url)){const{url:re,...L}=o;return{data:Yte(re),...L}}Xte()}return o},[o]);b.useEffect(()=>{const re=T2(Q());return re.promise.then(L=>{E({type:"RESOLVE",value:L})}).catch(L=>{E({type:"REJECT",error:L})}),()=>{l0(re)}},[Q,E]),b.useEffect(()=>{if(!(typeof P>"u")){if(P===!1){F();return}U()}},[P]);function K(){A&&(m&&m(A),O.current=new Array(A.numPages),D.current.setDocument(A))}function fe(){I&&(wa(!1,I.toString()),f&&f(I))}b.useEffect(function(){R({type:"RESET"})},[R,P]),b.useEffect(function(){if(!P)return;const L=w?{...P,...w}:P,X=T7(L);p&&(X.onProgress=p),v&&(X.onPassword=v);const ne=X;return ne.promise.then(Y=>{ne.destroyed||R({type:"RESOLVE",value:Y})}).catch(Y=>{ne.destroyed||R({type:"REJECT",error:Y})}),()=>{ne.destroy()}},[w,R,P]),b.useEffect(()=>{if(!(typeof A>"u")){if(A===!1){fe();return}K()}},[A]),b.useEffect(function(){D.current.setViewer(G.current),D.current.setExternalLinkRel(s),D.current.setExternalLinkTarget(i)},[s,i]);const oe=b.useCallback((re,L)=>{O.current[re]=L},[]),ye=b.useCallback(re=>{delete O.current[re]},[]),le=b.useMemo(()=>({imageResourcesPath:c,linkService:D.current,onItemClick:h,pdf:A,registerPage:oe,renderMode:_,rotate:j,scale:N,unregisterPage:ye}),[c,h,A,oe,_,j,N,ye]),me=b.useMemo(()=>Ywe(S,()=>A),[S,A]);function he(){function re(X){return!!(X!=null&&X.pdf)}if(!re(le))throw new Error("pdf is undefined");const L=typeof e=="function"?e(le):e;return a.jsx(Xwe.Provider,{value:le,children:L})}function ae(){return o?A==null?a.jsx(zw,{type:"loading",children:typeof u=="function"?u():u}):A===!1?a.jsx(zw,{type:"error",children:typeof r=="function"?r():r}):he():a.jsx(zw,{type:"no-data",children:typeof d=="function"?d():d})}return a.jsx("div",{className:mn("react-pdf__Document",n),ref:l,...me,children:ae()})});function e1e(){return b.useContext(Xwe)}function t1e(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=t.filter(Boolean);if(n.length<=1){var r=n[0];return r||null}return function(i){for(var o=0,l=n;o<l.length;o++){var c=l[o];typeof c=="function"?c(i):c&&(c.current=i)}}}const n1e=b.createContext(null);function n4(){return b.useContext(n1e)}function wtt(){const t=e1e(),e=n4();Vn(e);const n={...t,...e},{filterAnnotations:r,imageResourcesPath:s,linkService:i,onGetAnnotationsError:o,onGetAnnotationsSuccess:l,onRenderAnnotationLayerError:c,onRenderAnnotationLayerSuccess:u,page:d,pdf:h,renderForms:f,rotate:p,scale:m=1}=n;Vn(h),Vn(d),Vn(i);const[v,x]=J_(),{value:g,error:w}=v,_=b.useRef(null);wa(Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-annotation-layer"),10)===1,"AnnotationLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-annotations");function j(){g&&l&&l(g)}function N(){w&&(wa(!1,w.toString()),o&&o(w))}b.useEffect(function(){x({type:"RESET"})},[x,d]),b.useEffect(function(){if(!d)return;const P=T2(d.getAnnotations()),T=P;return P.promise.then(M=>{x({type:"RESOLVE",value:M})}).catch(M=>{x({type:"REJECT",error:M})}),()=>{l0(T)}},[x,d]),b.useEffect(()=>{if(g!==void 0){if(g===!1){N();return}j()}},[g]);function S(){u&&u()}function C(E){wa(!1,`${E}`),c&&c(E)}const k=b.useMemo(()=>d.getViewport({scale:m,rotation:p}),[d,p,m]);return b.useEffect(function(){if(!h||!d||!i||!g)return;const{current:P}=_;if(!P)return;const T=k.clone({dontFlip:!0}),M={accessibilityManager:null,annotationCanvasMap:null,annotationEditorUIManager:null,annotationStorage:h.annotationStorage,commentManager:null,div:P,l10n:null,linkService:i,page:d,structTreeLayer:null,viewport:T},R={annotations:r?r({annotations:g}):g,annotationStorage:h.annotationStorage,div:P,imageResourcesPath:s,linkService:i,page:d,renderForms:f,viewport:T};P.innerHTML="";try{new O7(M).render(R),S()}catch(A){C(A)}return()=>{}},[g,r,s,i,d,h,f,k]),a.jsx("div",{className:mn("react-pdf__Page__annotations","annotationLayer"),ref:_})}const r1e={Document:null,DocumentFragment:null,Part:"group",Sect:"group",Div:"group",Aside:"note",NonStruct:"none",P
910:null,H:"heading",Title:null,FENote:"note",Sub:"group",Lbl:null,Span:null,Em:null,Strong:null,Link:"link",Annot:"note",Form:"form",Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:"list",LI:"listitem",LBody:null,Table:"table",TR:"row",TH:"columnheader",TD:"cell",THead:"columnheader",TBody:null,TFoot:null,Caption:null,Figure:"figure",Formula:null,Artifact:null},_tt=/^H(\d+)$/;function jtt(t){return t in r1e}function r4(t){return"children"in t}function s1e(t){return r4(t)?t.children.length===1&&0 in t.children&&"id"in t.children[0]:!1}function Stt(t){const e={};if(r4(t)){const{role:n}=t,r=n.match(_tt);if(r)e.role="heading",e["aria-level"]=Number(r[1]);else if(jtt(n)){const s=r1e[n];s&&(e.role=s)}}return e}function i1e(t){const e={};if(r4(t)){if(t.alt!==void 0&&(e["aria-label"]=t.alt),t.lang!==void 0&&(e.lang=t.lang),s1e(t)){const[n]=t.children;if(n){const r=i1e(n);return{...e,...r}}}}else"id"in t&&(e["aria-owns"]=t.id);return e}function Ntt(t){return t?{...Stt(t),...i1e(t)}:null}function a1e({className:t,node:e}){const n=b.useMemo(()=>Ntt(e),[e]),r=b.useMemo(()=>!r4(e)||s1e(e)?null:e.children.map((s,i)=>a.jsx(a1e,{node:s},i)),[e]);return a.jsx("span",{className:t,...n,children:r})}function Ctt(){const t=n4();Vn(t);const{onGetStructTreeError:e,onGetStructTreeSuccess:n}=t,[r,s]=J_(),{value:i,error:o}=r,{customTextRenderer:l,page:c}=t;function u(){i&&n&&n(i)}function d(){o&&(wa(!1,o.toString()),e&&e(o))}return b.useEffect(function(){s({type:"RESET"})},[s,c]),b.useEffect(function(){if(l||!c)return;const f=T2(c.getStructTree()),p=f;return f.promise.then(m=>{s({type:"RESOLVE",value:m})}).catch(m=>{s({type:"REJECT",error:m})}),()=>l0(p)},[l,c,s]),b.useEffect(()=>{if(i!==void 0){if(i===!1){d();return}u()}},[i]),i?a.jsx(a1e,{className:"react-pdf__Page__structTree structTree",node:i}):null}const Qte=Ud;function ktt(t){const e=n4();Vn(e);const n={...e,...t},{_className:r,canvasBackground:s,devicePixelRatio:i=gtt(),onRenderError:o,onRenderSuccess:l,page:c,renderForms:u,renderTextLayer:d,pageColors:h,rotate:f,scale:p}=n,{canvasRef:m}=t;Vn(c);const v=b.useRef(null);function x(){c&&l&&l(lq(c,p))}function g(N){Zwe(N)||(wa(!1,N.toString()),o&&o(N))}const w=b.useMemo(()=>c.getViewport({scale:p*i,rotation:f}),[i,c,f,p]),_=b.useMemo(()=>c.getViewport({scale:p,rotation:f}),[c,f,p]);b.useEffect(function(){if(!c)return;c.cleanup();const{current:S}=v;if(!S)return;S.width=w.width,S.height=w.height,S.style.width=`${Math.floor(_.width)}
910px`,S.style.height=`${Math.floor(_.height)}px`,S.style.visibility="hidden";const C={annotationMode:u?Qte.ENABLE_FORMS:Qte.ENABLE,canvas:S,canvasContext:S.getContext("2d",{alpha:!1}),pageColors:h,viewport:w};s&&(C.background=s);const k=c.render(C),E=k;return k.promise.then(()=>{S.style.visibility="",x()}).catch(g),()=>l0(E)},[s,c,h,u,w,_]);const j=b.useCallback(()=>{const{current:N}=v;N&&(N.width=0,N.height=0)},[]);return b.useEffect(()=>j,[j]),a.jsx("canvas",{className:`${r}__canvas`,dir:"ltr",ref:t1e(m,v),style:{display:"block",userSelect:"none"},children:d?a.jsx(Ctt,{}):null})}function Att(t){return"str"in t}const Ett=new Set(["base","embed","iframe","link","meta","object","script","style","template"]),Ttt=new Set(["action","formaction","href","poster","src","xlink:href"]);function Ptt(t){let e="";for(const n of t){const r=n.charCodeAt(0);r<=32||r===127||(e+=n.toLowerCase())}return e.startsWith("javascript:")||e.startsWith("vbscript:")}function Mtt(t){return t.nodeType===Node.ELEMENT_NODE}function o1e(t){return Mtt(t)&&t instanceof HTMLElement}function Rtt(t){return o1e(t)&&Ett.has(t.tagName.toLowerCase())}function Ott(t){const e=document.createElement(t.tagName.toLowerCase());return Array.from(t.attributes).forEach(n=>{const r=n.name.toLowerCase();r.startsWith("on")||r==="srcdoc"||Ttt.has(r)&&Ptt(n.value)||e.setAttribute(n.name,n.value)}),Array.from(t.childNodes).forEach(n=>{e.append(l1e(n))}),e}function l1e(t){var e;return o1e(t)&&!Rtt(t)?Ott(t):document.createTextNode((e=t.textContent)!==null&&e!==void 0?e:"")}function Itt(t,e){const n=document.createElement("template");n.innerHTML=e;const r=document.createDocumentFragment();Array.from(n.content.childNodes).forEach(s=>{r.append(l1e(s))}),t.replaceChildren(r)}function Dtt(){const t=n4();Vn(t);const{customTextRenderer:e,onGetTextError:n,onGetTextSuccess:r,onRenderTextLayerError:s,onRenderTextLayerSuccess:i,page:o,pageIndex:l,pageNumber:c,rotate:u,scale:d}=t;Vn(o);const[h,f]=J_(),{value:p,error:m}=h,v=b.useRef(null);wa(Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-text-layer"),10)===1,"TextLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-text-layer");function x(){p&&r&&r(p)}function g(){m&&(wa(!1,m.toString()),n&&n(m))}b.useEffect(function(){f({type:"RESET"})},[o,f]),b.useEffect(function(){if(!o)return;const k=T2(o.getTextContent()),E=k;return k.promise.then(P=>{f({type:"RESOLVE",value:P})}).catch(P=>{f({type:"REJECT",error:P})}),()=>l0(E)},[o,f]),b.useEffect(()=>{if(p!==void 0){if(p===!1){g();return}x()}},[p]);const w=b.useCallback(()=>{i&&i()},[i]),_=b.useCallback(C=>{Zwe(C)||(wa(!1,C.toString()),s&&s(C))},[s]);function j(){const C=v.current;C&&C.classList.add("selecting")}function N(){const C=v.current;C&&C.classList.remove("selecting")}const S=b.useMemo(()=>o.getViewport({scale:d,rotation:u}),[o,u,d]);return b.useLayoutEffect(function(){if(!o||!p)return;const{current:k}=v;if(!k)return;k.innerHTML="";const E=o.streamTextContent({includeMarkedContent:!0}),P={container:k,textContentSource:E,viewport:S},T=new Ak(P),M=T;return T.render().then(()=>{const R=document.createElement("div");R.className="endOfContent",k.append(R);const A=k.querySelectorAll('[role="presentation"]');if(e){let I=0;p.items.forEach((D,O)=>{if(!Att(D))return;const z=A[I];if(!z)return;const B=e({pageIndex:l,pageNumber:c,itemIndex:O,...D});Itt(z,B),I+=D.str&&D.hasEOL?2:1})}w()}).catch(_),()=>l0(M)},[e,_,w,o,l,c,p,S]),a.jsx("div",{className:mn("react-pdf__Page__textContent","textLayer"),onMouseUp:N,onMouseDown:j,ref:v})}const Zte=1;function jR(t){const n={...e1e(),...t},{_className:r="react-pdf__Page",_enableRegisterUnregisterPage:s=!0,canvasBackground:i,canvasRef:o,children:l,className:c,customRenderer:u,customTextRenderer:d,devicePixelRatio:h,error:f="Failed to load the page.",filterAnnotations:p,height:m,inputRef:v,loading:x="Loading pageâ¦",noData:g="No page specified.",onGetAnnotationsError:w,onGetAnnotationsSuccess:_,onGetStructTreeError:j,onGetStructTreeSuccess:N,onGetTextError:S,onGetTextSuccess:C,onLoadError:k,onLoadSuccess:E,onRenderAnnotationLayerError:P,onRenderAnnotationLayerSuccess:T,onRenderError:M,onRenderSuccess:R,onRenderTextLayerError:A,onRenderTextLayerSuccess:I,pageColors:D,pageIndex:O,pageNumber:z,pdf:B,registerPage:G,renderAnnotationLayer:U=!0,renderForms:F=!1,renderMode:W="canvas",renderTextLayer:Q=!0,rotate:K,scale:fe=Zte,unregisterPage:oe,width:ye,...le}=n,[me,he]=J_(),{value:ae,error:re}=me,L=b.useRef(null);Vn(B);const X=bv(z)?z-1:O??null,ne=z??(bv(O)?O+1:null),Y=K??(ae?ae.rotate:null),J=b.useMemo(()=>
910{if(!ae)return null;let st=1;const Ye=fe??Zte;if(ye||m){const gt=ae.getViewport({scale:1,rotation:Y});ye?st=ye/gt.width:m&&(st=m/gt.height)}return Ye*st},[m,ae,Y,fe,ye]);b.useEffect(function(){return()=>{bv(X)&&s&&oe&&oe(X)}},[s,B,X,oe]);function se(){if(E){if(!ae||!J)return;E(lq(ae,J))}if(s&&G){if(!bv(X)||!L.current)return;G(X,L.current)}}function ge(){re&&(wa(!1,re.toString()),k&&k(re))}b.useEffect(function(){he({type:"RESET"})},[he,B,X]),b.useEffect(function(){if(!B||!ne)return;const Ye=T2(B.getPage(ne)),gt=Ye;return Ye.promise.then(At=>{he({type:"RESOLVE",value:At})}).catch(At=>{he({type:"REJECT",error:At})}),()=>l0(gt)},[he,B,ne]),b.useEffect(()=>{if(ae!==void 0){if(ae===!1){ge();return}se()}},[ae,J]);const de=b.useMemo(()=>bv(X)&&ne&&bv(Y)&&bv(J)?{_className:r,canvasBackground:i,customTextRenderer:d,devicePixelRatio:h,filterAnnotations:p,onGetAnnotationsError:w,onGetAnnotationsSuccess:_,onGetStructTreeError:j,onGetStructTreeSuccess:N,onGetTextError:S,onGetTextSuccess:C,onRenderAnnotationLayerError:P,onRenderAnnotationLayerSuccess:T,onRenderError:M,onRenderSuccess:R,onRenderTextLayerError:A,onRenderTextLayerSuccess:I,page:ae,pageColors:D,pageIndex:X,pageNumber:ne,renderForms:F,renderTextLayer:Q,rotate:Y,scale:J}:null,[r,i,d,h,p,w,_,j,N,S,C,P,T,M,R,A,I,ae,D,X,ne,F,Q,Y,J]),ce=b.useMemo(()=>Ywe(le,()=>ae&&(J?lq(ae,J):void 0)),[le,ae,J]),xe=`${X}@${J}/${Y}`;function je(){switch(W){case"custom":return Vn(u),a.jsx(u,{},`${xe}_custom`);case"none":return null;case"canvas":default:return a.jsx(ktt,{canvasRef:o},`${xe}_canvas`)}}function be(){return Q?a.jsx(Dtt,{},`${xe}_text`):null}function Ee(){return U?a.jsx(wtt,{},`${xe}_annotations`):null}function Me(){function st(gt){return!!(gt!=null&>.page)}if(!st(de))throw new Error("page is undefined");const Ye=typeof l=="function"?l(de):l;return a.jsxs(n1e.Provider,{value:de,children:[je(),be(),Ee(),Ye]})}function Oe(){return ne?B===null||ae===void 0||ae===null?a.jsx(zw,{type:"loading",children:typeof x=="function"?x():x}):B===!1||ae===!1?a.jsx(zw,{type:"error",children:typeof f=="function"?f():f}):Me():a.jsx(zw,{type:"no-data",children:typeof g=="function"?g():g})}return a.jsx("div",{className:mn(r,c),"data-page-number":ne,ref:t1e(v,L),style:{"--scale-round-x":"1px","--scale-round-y":"1px","--scale-factor":"1","--user-unit":`${J}`,"--total-scale-factor":"calc(var(--scale-factor) * var(--user-unit))",backgroundColor:i||"white",position:"relative",minWidth:"min-content",minHeight:"min-content"},...ce,children:Oe()})}vtt();Nl.workerSrc="pdf.worker.mjs";var c1e=["PageUp","PageDown"],u1e=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],d1e={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},qj="Slider",[uq,Ltt,Ftt]=Cj(qj),[h1e,ULt]=Ys(qj,[Ftt]),[$tt,s4]=h1e(qj),f1e=b.forwardRef((t,e)=>{const{name:n,min:r=0,max:s=100,step:i=1,orientation:o="horizontal",disabled:l=!1,minStepsBetweenThumbs:c=0,defaultValue:u=[r],value:d,onValueChange:h=()=>{},onValueCommit:f=()=>{},inverted:p=!1,form:m,...v}=t,x=b.useRef(new Set),g=b.useRef(0),_=o==="horizontal"?ztt:Btt,[j=[],N]=Xo({prop:d,defaultProp:u,onChange:T=>{var R;(R=[...x.current][g.current])==null||R.focus(),h(T)}}),S=b.useRef(j);function C(T){const M=Wtt(j,T);P(T,M)}function k(T){P(T,g.current)}function E(){const T=S.current[g.current];j[g.current]!==T&&f(j)}function P(T,M,{commit:R}={commit:!1}){const A=Xtt(i),I=Jtt(Math.round((T-r)/i)*i+r,A),D=BO(I,[r,s]);N((O=[])=>{const z=Vtt(O,D,M);if(Ytt(z,c*i)){g.current=z.indexOf(D);const B=String(z)!==String(O);return B&&R&&f(z),B?z:O}else return O})}return a.jsx($tt,{scope:t.__scopeSlider,name:n,disabled:l,min:r,max:s,valueIndexToChangeRef:g,thumbs:x.current,values:j,orientation:o,form:m,children:a.jsx(uq.Provider,{scope:t.__scopeSlider,children:a.jsx(uq.Slot,{scope:t.__scopeSlider,children:a.jsx(_,{"aria-disabled":l,"data-disabled":l?"":void 0,...v,ref:e,onPointerDown:ze(v.onPointerDown,()=>{l||(S.current=j)}),min:r,max:s,inverted:p,onSlideStart:l?void 0:C,onSlideMove:l?void 0:k,onSlideEnd:l?void 0:E,on
910HomeKeyDown:()=>!l&&P(r,0,{commit:!0}),onEndKeyDown:()=>!l&&P(s,j.length-1,{commit:!0}),onStepKeyDown:({event:T,direction:M})=>{if(!l){const I=c1e.includes(T.key)||T.shiftKey&&u1e.includes(T.key)?10:1,D=g.current,O=j[D],z=i*I*M;P(O+z,D,{commit:!0})}}})})})})});f1e.displayName=qj;var[p1e,m1e]=h1e(qj,{startEdge:"left",endEdge:"right",size:"width",direction:1}),ztt=b.forwardRef((t,e)=>{const{min:n,max:r,dir:s,inverted:i,onSlideStart:o,onSlideMove:l,onSlideEnd:c,onStepKeyDown:u,...d}=t,[h,f]=b.useState(null),p=$t(e,_=>f(_)),m=b.useRef(void 0),v=Lj(s),x=v==="ltr",g=x&&!i||!x&&i;function w(_){const j=m.current||h.getBoundingClientRect(),N=[0,j.width],C=L7(N,g?[n,r]:[r,n]);return m.current=j,C(_-j.left)}return a.jsx(p1e,{scope:t.__scopeSlider,startEdge:g?"left":"right",endEdge:g?"right":"left",direction:g?1:-1,size:"width",children:a.jsx(g1e,{dir:v,"data-orientation":"horizontal",...d,ref:p,style:{...d.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:_=>{const j=w(_.clientX);o==null||o(j)},onSlideMove:_=>{const j=w(_.clientX);l==null||l(j)},onSlideEnd:()=>{m.current=void 0,c==null||c()},onStepKeyDown:_=>{const N=d1e[g?"from-left":"from-right"].includes(_.key);u==null||u({event:_,direction:N?-1:1})}})})}),Btt=b.forwardRef((t,e)=>{const{min:n,max:r,inverted:s,onSlideStart:i,onSlideMove:o,onSlideEnd:l,onStepKeyDown:c,...u}=t,d=b.useRef(null),h=$t(e,d),f=b.useRef(void 0),p=!s;function m(v){const x=f.current||d.current.getBoundingClientRect(),g=[0,x.height],_=L7(g,p?[r,n]:[n,r]);return f.current=x,_(v-x.top)}return a.jsx(p1e,{scope:t.__scopeSlider,startEdge:p?"bottom":"top",endEdge:p?"top":"bottom",size:"height",direction:p?1:-1,children:a.jsx(g1e,{"data-orientation":"vertical",...u,ref:h,style:{...u.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:v=>{const x=m(v.clientY);i==null||i(x)},onSlideMove:v=>{const x=m(v.clientY);o==null||o(x)},onSlideEnd:()=>{f.current=void 0,l==null||l()},onStepKeyDown:v=>{const g=d1e[p?"from-bottom":"from-top"].includes(v.key);c==null||c({event:v,direction:g?-1:1})}})})}),g1e=b.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:s,onSlideEnd:i,onHomeKeyDown:o,onEndKeyDown:l,onStepKeyDown:c,...u}=t,d=s4(qj,n);return a.jsx(et.span,{...u,ref:e,onKeyDown:ze(t.onKeyDown,h=>{h.key==="Home"?(o(h),h.preventDefault()):h.key==="End"?(l(h),h.preventDefault()):c1e.concat(u1e).includes(h.key)&&(c(h),h.preventDefault())}),onPointerDown:ze(t.onPointerDown,h=>{const f=h.target;f.setPointerCapture(h.pointerId),h.preventDefault(),d.thumbs.has(f)?f.focus():r(h)}),onPointerMove:ze(t.onPointerMove,h=>{h.target.hasPointerCapture(h.pointerId)&&s(h)}),onPointerUp:ze(t.onPointerUp,h=>{const f=h.target;f.hasPointerCapture(h.pointerId)&&(f.releasePointerCapture(h.pointerId),i(h))})})}),v1e="SliderTrack",x1e=b.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,s=s4(v1e,n);return a.jsx(et.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...r,ref:e})});x1e.displayName=v1e;var dq="SliderRange",y1e=b.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,s=s4(dq,n),i=m1e(dq,n),o=b.useRef(null),l=$t(e,o),c=s.values.length,u=s.values.map(f=>_1e(f,s.min,s.max)),d=c>1?Math.min(...u):0,h=100-Math.max(...u);return a.jsx(et.span,{"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,...r,ref:l,style:{...t.style,[i.startEdge]:d+"%",[i.endEdge]:h+"%"}})});y1e.displayName=dq;var hq="SliderThumb",b1e=b.forwardRef((t,e)=>{const n=Ltt(t.__scopeSlider),[r,s]=b.useState(null),i=$t(e,l=>s(l)),o=b.useMemo(()=>r?n().findIndex(l=>l.ref.current===r):-1,[n,r]);return a.jsx(Utt,{...t,ref:i,index:o})}),Utt=b.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:s,...i}=t,o=s4(hq,n),l=m1e(hq,n),[c,u]=b.useState(null),d=$t(e,w=>u(w)),h=c?o.form||!!c.closest("form"):!0,f=a3(c),p=o.values[r],m=p===void 0?0:_1e(p,o.min,o.max),v=Htt(r,o.values.length),x=f==null?void 0:f[l.size],g=x?Ktt(x,m,l.direction):0;return b.useEffect(()=>{if(c)return o.thumbs.add(c),()=>{o.thumbs.delete(c)}},[c,o.thumbs]),a.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[l.startEdge]:`calc(${m}% + ${g}px)`},children:[a.jsx(uq.ItemSlot,{scope:t.__scopeSlider,children:a.jsx(et.span,{role:"slider","aria-label":t["aria-label"]||v,"aria-valuemin":o.min,"aria-valuenow":p,"aria-valuemax":o.max,"aria-orientation":o.orientation,"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,tabIndex:o.disabled?void 0:0,...i,ref:d,style:p===void 0?{display:"none"}:t.style,onFocus:ze(t.onFocus,()=>{o.valueIndexToChangeRef.current=r})})}),h&&a.jsx(w1e,{name:s??(o.name?o.name+(o.values.length>1?"[]":""):void 0),form:o.form,value:p},r)]})});b1e.displayName=hq;var qtt="RadioBubbleInput",w1e=b.forwardRef(({__scopeSlider:t,value:e,...n},r)=>{const s=b.useRef(null),i=$t(s,r),o=_3(e);return b.useEffect(()=>{const l=s.current;if(!l)return;const c=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(o!==e&&d){const h=new Event("input",{bubbles:!0});d.call(l,e),l.dispatchEvent(h)}},[o,e]),a.jsx(et.input,{style:{display:"none"},...n,ref:i,defaultValue:e})});w1e.displayName=qtt;function Vtt(t=[],e,n){const r=[...t];return r[n]=e,r.sort((s,i)=>s-i)}function _1e(t,e,n){const i=100/(n-e)*(t-e);return BO(i,[0,100])}function Htt(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function Wtt(t,e){if(t.length===1)return 0;const n=t.map(s=>Math.abs(s-e)),r=Math.min(...n);return n.indexOf(r)}function Ktt(t,e,n){const r=t/2,i=L7([0,50],[0,r]);return(r-i(e)*n)*n}function Gtt(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function Ytt(t,e){if(e>0){const n=Gtt(t);return Math.min(...n)>=e}return!0}function L7(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function Xtt(t){return(String(t).split(".")[1]||"").length}function Jtt(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var j1e=f1e,Qtt=x1e,Ztt=y1e,ent=b1e;const dg=b.forwardRef(({className:t,...e},n)=>a.jsxs(j1e,{ref:n,className:Fe("relative flex w-full touch-none select-none items-center",t),...e,children:[a.jsx(Qtt,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:a.jsx(Ztt,{className:"absolute h-full bg-primary"})}),a.jsx(ent,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));dg.displayName=j1e.displayName;const ene="/assets/hero-andalusia-CpaZfUaF.jpg";Nl.workerSrc=`https://unpkg.com/pdfjs-dist@${Z3}/build/pdf.worker.min.mjs`;function tnt(t){const e=[/\/file\/d\/([a-zA-Z0-9_-]+)/,/[?&]id=([a-zA-Z0-9_-]+)/];for(const n of e){const r=t.match(n);if(r)return r[1]}return null}const nnt=()=>{var U;const{issueNumber:t}=Xi(),e=Gs(),[n]=Zg(),r=Math.max(1,Number(n.get("page"))||1),{data:s,isLoading:i}=Ne({queryKey:["magazine-issue-number",t],queryFn:async()=>{const{data:F,error:W}=await Z.from("magazine_issues").select("*").eq("issue_number",Number(t)).maybeSingle();if(W)throw W;return F},enabled:!!t}),o=(s==null?void 0:s.pdf_digital_url)??"",l=o.includes("drive.google.com"),c=o.includes("calameo.com"),u=l?tnt(o):null,d=c?((U=o.match(/\/(?:read|books)\/([a-zA-Z0-9]+)/))==null?void 0:U[1])??null:null,h=o.includes("supabase.co/storage")||o.startsWith("/__l5e/"),f=l||c||o&&!h,p=l&&u?`https://drive.google.com/file/d/${u}/preview`:c&&d?`https://v.calameo.com/?bkcode=${d}`:o,[m,v]=b.useState(0),[x,g]=b.useState(r),[w,_]=b.useState(1),[j,N]=b.useState(typeof window<"u"&&window.innerWidth>=1024),[S,C]=b.useState(!0),[k,E]=b.useState({w:800,h:600}),P=b.useRef(null),T=b.useRef(null),M=b.useRef(null);b.useEffect(()=>{const F=()=>{N(window.innerWidth>=1024),P.current&&E({w:P.current.clientWidth,h:P.current.clientHeight})};return F(),window.addEventListener("resize",F),()=>window.removeEventListener("resize",F)},[]);const R=b.useCallback(()=>{C(!0),T.current&&window.clearTimeout(T.current),T.current=window.setTimeout(()=>C(!1),3e3)},[]);b.useEffect(()=>{R()},[R]);const A=b.useCallback(()=>{g(F=>Math.max(1,j&&F>2?F-2:F-1)),R()},[j,R]),I=b.useCallback(()=>{g(F=>{const W=j&&F>1?2:1;return Math.min(m||1,F+W)}),R()},[j,m,R]);b.useEffect(()=>{const F=W=>{W.key==="ArrowLeft"||W.key==="PageUp"?A():W.key==="ArrowRight"||W.key==="PageDown"?I():W.key==="Escape"&&e("/nos-magazines")};return window.addEventListener("keydown",F),()=>window.removeEventListener("keydown",F)},[A,I,e]);const D=({numPages:F})=>v(F),O=b.useMemo(()=>{const W=(k.w-32)*w;return j?Math.min(W/2,700):Math.min(W,900)},[k.w,j,w]),z=F=>
910{M.current=F.touches[0].clientX},B=F=>{if(M.current==null)return;const W=F.changedTouches[0].clientX-M.current;Math.abs(W)>50&&(W>0?A:I)(),M.current=null},G=()=>{document.fullscreenElement?document.exitFullscreen():document.documentElement.requestFullscreen()};return i?a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-[#1a1a1a] text-white",children:a.jsx(Je,{className:"h-12 w-12 animate-spin"})}):s?o?a.jsxs("div",{className:"fixed inset-0 z-50 flex flex-col bg-[#1a1a1a] text-white",onMouseMove:R,children:[a.jsx(Fn,{title:`N°${s.issue_number} - ${s.title} | Lecteur`,description:s.theme||`Lisez le numéro ${s.issue_number} d'Esprit Sud Magazine en ligne.`,path:`/nos-magazines/${s.issue_number}`,image:s.cover_image_url}),a.jsxs("header",{className:`absolute top-0 left-0 right-0 z-10 flex items-center justify-between gap-3 px-4 py-3 bg-gradient-to-b from-black/80 to-transparent transition-opacity duration-300 ${S?"opacity-100":"opacity-0 pointer-events-none"}`,children:[a.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[a.jsx("img",{src:ene,alt:"Esprit Sud",className:"h-8 w-8 rounded object-cover"}),a.jsxs("h1",{className:"font-heading text-sm md:text-base truncate",children:["N°",s.issue_number," â ",s.title]})]}),a.jsx(H,{variant:"ghost",size:"sm",onClick:()=>e("/nos-magazines"),className:"text-white hover:bg-white/10",children:a.jsx(ks,{className:"h-5 w-5"})})]}),a.jsx("div",{ref:P,className:"flex-1 relative flex items-center justify-center overflow-hidden",onTouchStart:z,onTouchEnd:B,children:f?a.jsx("iframe",{src:p,className:"h-full w-full border-0",allow:"autoplay; fullscreen",allowFullScreen:!0,title:`Magazine N°${s.issue_number}`}):a.jsxs(a.Fragment,{children:[a.jsx("button",{"aria-label":"Page précédente",onClick:A,className:"absolute left-0 top-0 bottom-0 w-1/4 z-[5] group",children:a.jsx(V6,{className:"absolute left-2 md:left-4 top-1/2 -translate-y-1/2 h-10 w-10 md:h-14 md:w-14 text-white/70 group-hover:text-white/90 transition-colors"})}),a.jsx("button",{"aria-label":"Page suivante",onClick:I,className:"absolute right-0 top-0 bottom-0 w-1/4 z-[5] group",children:a.jsx(PO,{className:"absolute right-2 md:right-4 top-1/2 -translate-y-1/2 h-10 w-10 md:h-14 md:w-14 text-white/70 group-hover:text-white/90 transition-colors"})}),a.jsx(cq,{file:o,onLoadSuccess:D,loading:a.jsxs("div",{className:"flex flex-col items-center gap-4",children:[a.jsx("img",{src:ene,alt:"",className:"h-16 w-16 rounded-full object-cover opacity-60"}),a.jsx(Je,{className:"h-8 w-8 animate-spin"}),a.jsx("p",{className:"text-sm text-white/80",children:"Chargement du magazineâ¦"})]}),error:a.jsx("p",{className:"text-red-400",children:"Impossible de charger le PDF."}),children:a.jsxs("div",{className:"flex gap-1 items-start shadow-2xl",children:[a.jsx(jR,{pageNumber:x,width:O,renderTextLayer:!1,renderAnnotationLayer:!1,loading:a.jsx("div",{className:"bg-white/5",style:{width:O,height:O*1.4}})}),j&&x+1<=m&&a.jsx(jR,{pageNumber:x+1,width:O,renderTextLayer:!1,renderAnnotationLayer:!1,loading:a.jsx("div",{className:"bg-white/5",style:{width:O,height:O*1.4}})})]})})]})}),!f&&a.jsx("div",{className:`absolute bottom-0 left-0 right-0 z-10 px-3 md:px-6 py-3 bg-gradient-to-t from-black/90 to-transparent transition-opacity duration-300 ${S?"opacity-100":"opacity-0 pointer-events-none"}`,children:a.jsxs("div",{className:"flex flex-col gap-2 max-w-5xl mx-auto",children:[a.jsxs("div",{className:"flex items-center gap-2 md:gap-3",children:[a.jsx(H,{variant:"ghost",size:"icon",onClick:A,className:"text-white hover:bg-white/10 shrink-0",children:a.jsx(V6,{className:"h-5 w-5"})}),a.jsxs("span",{className:"text-xs md:text-sm tabular-nums whitespace-nowrap min-w-[80px] text-center",children:["Page ",x,j&&x+1<=m?`â${x+1}`:""," / ",m||"â¦"]}),a.jsx("div",{className:"flex-1 px-2",children:a.jsx(dg,{value:[x],min:1,max:Math.max(m,1),step:1,onValueChange:F=>g(F[0])})}),a.jsx(H,{variant:"ghost",size:"icon",onClick:I,className:"text-white hover:bg-white/10 shrink-0",children:a.jsx(PO,{className:"h-5 w-5"})})]}),a.jsxs("div",{className:"flex items-center justify-center gap-1 flex-wrap",children:[a.jsx(H,{variant:"ghost",size:"sm",onClick:()=>_(F=>Math.max(.5,F-.25)),className:"text-white hover:bg-white/10",children:a.jsx(M5e,{className:"h-4 w-4"})}),a.jsxs("span",{className:"text-xs tabular-nums w-12 text-center",children:[Math.round(w*100),"%"]}),a.jsx(H,{variant:"ghost",size:"sm",onClick:()=>_(F=>Math.min(2.5,F+.25)),className:"text-white hover:bg-white/10",children:a.jsx(P5e,{className:"h-4 w-4"})}),a.jsxs(Dj,{children:[a.jsx(XW,{asChild:!0,children:a.jsxs(H,{variant:"ghost",size:"sm",className:"text-white hover:bg-white/10",children:[a.jsx(Z$e,{className:"h-4 w-4 mr-1"})," Sommaire"]})}),a.jsxs(P0,{side:"right",className:"w-[320px] sm:w-[400px] overflow-y-auto bg-[#1a1a1a] text-white border-white/10",children:[a.jsx(l2,{children:a.jsx(c2,{className:"text-white",children:"Sommaire"})}),a.jsx("div",{className:"grid grid-cols-3 gap-2 mt-4",children:Array.from({length:m},(F,W)=>W+1).map(F=>
910a.jsxs("button",{onClick:()=>g(F),className:`relative rounded overflow-hidden border-2 transition-colors ${F===x||j&&F===x+1?"border-[#E74C3C]":"border-transparent hover:border-white/30"}`,children:[a.jsx(cq,{file:o,loading:"",error:"",children:a.jsx(jR,{pageNumber:F,width:90,renderTextLayer:!1,renderAnnotationLayer:!1})}),a.jsx("span",{className:"absolute bottom-0 left-0 right-0 text-[10px] text-center bg-black/60 py-0.5",children:F})]},F))})]})]}),a.jsx(H,{variant:"ghost",size:"sm",onClick:G,className:"text-white hover:bg-white/10",children:a.jsx(s5e,{className:"h-4 w-4"})}),a.jsx(H,{variant:"ghost",size:"sm",asChild:!0,className:"text-white hover:bg-white/10",children:a.jsxs("a",{href:o,download:!0,target:"_blank",rel:"noopener noreferrer",children:[a.jsx(Ts,{className:"h-4 w-4 mr-1"})," PDF"]})})]})]})}),f&&!c&&a.jsx("div",{className:`absolute bottom-4 right-4 z-10 transition-opacity ${S?"opacity-100":"opacity-0"}`,children:a.jsx(H,{asChild:!0,variant:"secondary",size:"sm",children:a.jsxs("a",{href:o,target:"_blank",rel:"noopener noreferrer",children:[a.jsx(Ts,{className:"h-4 w-4 mr-1"})," Télécharger"]})})})]}):a.jsxs("div",{className:"fixed inset-0 z-50 flex flex-col items-center justify-center bg-[#1a1a1a] text-white",children:[a.jsx("p",{children:"Ce numéro n'est pas encore disponible en version numérique."}),a.jsx(H,{asChild:!0,className:"mt-4",children:a.jsx(_e,{to:"/nos-magazines",children:"Retour"})})]}):a.jsxs("div",{className:"fixed inset-0 z-50 flex flex-col items-center justify-center bg-[#1a1a1a] text-white",children:[a.jsx("p",{children:"Numéro introuvable."}),a.jsx(H,{asChild:!0,className:"mt-4",children:a.jsx(_e,{to:"/nos-magazines",children:"Retour"})})]})};Nl.workerSrc=`https://unpkg.com/pdfjs-dist@${Z3}/build/pdf.worker.min.mjs`;const rnt=["Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre"];function snt(t){if(!t)return"";const e=new Date(t);return isNaN(e.getTime())?"":`${rnt[e.getMonth()]} ${e.getFullYear()}`}const int=()=>{const{issueNumber:t}=Xi(),[e,n]=b.useState(0),{data:r,isLoading:s}=Ne({queryKey:["magazine-issue-page",t],queryFn:async()=>{const{data:c,error:u}=await Z.from("magazine_issues").select("*").eq("issue_number",Number(t)).maybeSingle();if(u)throw u;return c},enabled:!!t}),{data:i=[]}=Ne({queryKey:["magazine-sommaire",r==null?void 0:r.id],queryFn:async()=>{if(!(r!=null&&r.id))return[];const{data:c,error:u}=await Z.from("magazine_pages").select("page_number, page_type, articles(title, slug, excerpt)").eq("issue_id",r.id).order("page_number");if(u)throw u;return c??[]},enabled:!!(r!=null&&r.id)});if(s)return a.jsxs("div",{className:"container py-16",children:[a.jsx(Xt,{className:"h-12 w-2/3 mb-6"}),a.jsxs("div",{className:"grid gap-8 md:grid-cols-2",children:[a.jsx(Xt,{className:"aspect-[3/4] rounded"}),a.jsx(Xt,{className:"h-64 rounded"})]})]});if(!r)return a.jsxs("div",{className:"container py-20 text-center",children:[a.jsx("h1",{className:"font-heading text-3xl mb-4",children:"Numéro introuvable"}),a.jsx(H,{asChild:!0,children:a.jsxs(_e,{to:"/nos-magazines",children:[a.jsx(jr,{className:"mr-2 h-4 w-4"}),"Retour aux magazines"]})})]});const o=r.pdf_digital_url??"",l=i.filter(c=>c.articles);return a.jsxs("div",{className:"min-h-screen bg-gradient-to-b from-background via-muted/30 to-background",children:[a.jsx(Fn,{title:`N°${r.issue_number} â ${r.title} | Esprit Sud Magazine`,description:r.theme||`Découvrez le numéro ${r.issue_number} d'Esprit Sud Magazine.`,path:`/nos-magazines/${r.issue_number}`,image:r.cover_image_url}),a.jsxs("div",{className:"container py-10 md:py-16",children:[a.jsx(H,{asChild:!0,variant:"ghost",size:"sm",className:"mb-6",children:a.jsxs(_e,{to:"/nos-magazines",children:[a.jsx(jr,{className:"mr-2 h-4 w-4"}),"Tous les numéros"]})}),a.jsxs("section",{className:"grid gap-10 md:grid-cols-2 items-center",children:[a.jsx("div",{className:"flex justify-center md:justify-end",children:a.jsx("div",{className:"relative w-full max-w-[400px] aspect-[3/4] rounded shadow-2xl overflow-hidden",style:{boxShadow:"0 25px 50px -12px rgba(0,0,0,0.35)"},children:r.cover_image_url?a.jsx("img",{src:r.cover_image_url,alt:`Esprit Sud Magazine N°${r.issue_number} â ${r.title}`,className:"h-full w-full object-cover"}):a.jsx("div",{className:"h-full w-full bg-muted flex items-center justify-center",children:a.jsx(TO,{className:"h-16 w-16 text-muted-foreground"})})})}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs(ke,{className:"text-white border-0",style:{backgroundColor:"#E74C3C"},children:["N°",r.issue_number]}),a.jsx("h1",{className:"font-heading text-3xl md:text-5xl font-bold",style:{color:"#1B4F72"},children:r.title}),r.publication_date&&a.jsx("p",{className:"text-muted-foreground",children:snt(r.publication_date)}),r.theme&&a.jsx("p",{className:"text-base italic text-muted-foreground",children:r.theme}
910),r.description&&a.jsx("p",{className:"text-foreground/80",children:r.description}),a.jsxs("div",{className:"flex flex-wrap gap-3 pt-2",children:[o?a.jsx(H,{asChild:!0,size:"lg",style:{backgroundColor:"#1B4F72"},className:"text-white hover:opacity-90",children:a.jsxs(_e,{to:`/nos-magazines/${r.issue_number}/lire`,children:[a.jsx(Pu,{className:"mr-2 h-4 w-4"}),"Lire le magazine"]})}):a.jsxs(H,{size:"lg",disabled:!0,className:"text-white opacity-60",style:{backgroundColor:"#1B4F72"},children:[a.jsx(Pu,{className:"mr-2 h-4 w-4"}),"Bientôt disponible"]}),o&&a.jsx(H,{asChild:!0,size:"lg",variant:"outline",children:a.jsxs("a",{href:o,target:"_blank",rel:"noopener noreferrer",download:!0,children:[a.jsx(Ts,{className:"mr-2 h-4 w-4"}),"Télécharger le PDF"]})}),a.jsx(H,{asChild:!0,size:"lg",variant:"outline",style:{borderColor:"#E74C3C",color:"#E74C3C"},children:a.jsxs(_e,{to:"/boutique",children:[a.jsx(Wi,{className:"mr-2 h-4 w-4"}),"Version papier"]})}),a.jsx(H,{asChild:!0,size:"lg",variant:"ghost",children:a.jsxs(_e,{to:"/points-de-depot",children:[a.jsx(_r,{className:"mr-2 h-4 w-4"}),"Où le trouver ?"]})})]})]})]}),l.length>0&&a.jsxs("section",{className:"mt-16",children:[a.jsx("h2",{className:"font-heading text-2xl md:text-3xl font-bold mb-6",style:{color:"#1B4F72"},children:"Au sommaire"}),a.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:l.map(c=>a.jsxs(_e,{to:c.articles.slug?`/actualites/${c.articles.slug}`:`/nos-magazines/${r.issue_number}/lire?page=${c.page_number}`,className:"flex gap-4 p-4 rounded-lg border bg-card hover:shadow-md transition-shadow",children:[a.jsx("div",{className:"shrink-0 w-12 h-12 rounded-full flex items-center justify-center font-heading font-bold",style:{backgroundColor:"#1B4F72",color:"white"},children:c.page_number}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-heading font-semibold",children:c.articles.title}),c.articles.excerpt&&a.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mt-1",children:c.articles.excerpt})]})]},c.page_number))})]}),o&&a.jsxs("section",{className:"mt-16",children:[a.jsx("h2",{className:"font-heading text-2xl md:text-3xl font-bold mb-6",style:{color:"#1B4F72"},children:"Feuilleter page par page"}),a.jsx(cq,{file:o,onLoadSuccess:({numPages:c})=>n(c),loading:a.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground",children:[a.jsx(Je,{className:"h-5 w-5 animate-spin"}),"Chargement des pagesâ¦"]}),error:a.jsx("p",{className:"text-destructive",children:"Impossible de charger l'aperçu du PDF."}),children:a.jsx("div",{className:"grid grid-cols-3 sm:grid-cols-4 md:grid-cols-6 lg:grid-cols-8 gap-3",children:Array.from({length:e},(c,u)=>u+1).map(c=>a.jsx(_e,{to:`/nos-magazines/${r.issue_number}/lire?page=${c}`,className:"group block rounded overflow-hidden border bg-white hover:shadow-lg transition-all hover:-translate-y-0.5",children:a.jsxs("div",{className:"relative",children:[a.jsx(jR,{pageNumber:c,width:140,renderTextLayer:!1,renderAnnotationLayer:!1}),a.jsxs("span",{className:"absolute bottom-0 left-0 right-0 text-[10px] text-center bg-black/60 text-white py-0.5",children:["Page ",c]})]})},c))})})]})]})]})},ant=b.lazy(()=>Ac(()=>import("./DistributionMap-Cwnl1xfv.js"),[])),tne={restaurant:"Restaurant",hotel:"Hôtel",commerce:"Commerce",office_tourisme:"Office de tourisme"},ont=()=>{const[t,e]=b.useState(""),[n,r]=b.useState("all"),{data:s,isLoading:i}=Ne({queryKey:["distribution-points",n],queryFn:async()=>{let c=await(async()=>{let u=Z.from("distribution_points_public").select("*").order("city").order("name");return n!=="all"&&(u=u.eq("type",n)),await u})();if(c.error){let u=Z.from("distribution_points").select("id, name, address, city, latitude, longitude, point_type").eq("is_active",!0).order("city").order("name");if(n!=="all"&&(u=u.eq("point_type",n)),c=await u,c.error)throw c.error;return(c.data??[]).map(d=>({...d,type:d.point_type}))}return c.data??[]}}),o=(s??[]).filter(c=>{var u,d;return!t||((u=c.city)==null?void 0:u.toLowerCase().includes(t.toLowerCase()))||((d=c.name)==null?void 0:d.toLowerCase().includes(t.toLowerCase()))}),l=o.reduce((c,u)=>{const d=u.city||"Autre";return c[d]||(c[d]=[]),c[d].push(u),c},{});return a.jsxs("div",{className:"container py-10 md:py-16",children:[a.jsx(Fn,{title:"Où trouver le magazine Esprit Sud en Andalousie ?",description:"Tous les points de dépôt où récupérer gratuitement le magazine Esprit Sud en Andalousie.",path:"/points-de-depot"}),a.jsx("h1",{className:"font-heading text-3xl font-bold md:text-4xl",children:"Points de dépôt"}),a.jsx("p",{className:"mt-2 text-muted-foreground",children:"Où trouver Esprit Sud Magazine ?"}),a.jsxs("div",{className:"mt-6 flex flex-col gap-3 sm:flex-row",children:[a.jsxs("div",{className:"relative max-w-sm",children:[a.jsx(is,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(ue,{placeholder:"Rechercher par ville...",value:t,onChange:c=>e(c.target.value),className:"pl-9"})]}),a.jsxs(lt,{value:n,onValueChange:r,children:[a.jsx(nt,{className:"w-44",children:a.jsx(ct,{placeholder:"Tous les types"})}),a.jsxs(rt,{children:[a.jsx(Ae,{value:"all",children:"Tous les types"}
910),Object.entries(tne).map(([c,u])=>a.jsx(Ae,{value:c,children:u},c))]})]})]}),i?a.jsx("div",{className:"mt-8 space-y-4",children:Array.from({length:4}).map((c,u)=>a.jsx(Xt,{className:"h-20 rounded-lg"},u))}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"mt-8",children:a.jsx(b.Suspense,{fallback:a.jsx(Xt,{className:"h-[480px] w-full rounded-lg"}),children:a.jsx(ant,{points:o})})}),a.jsx("div",{className:"mt-8 space-y-6",children:Object.entries(l).map(([c,u])=>a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsx(_r,{className:"h-5 w-5 text-primary"}),a.jsx("h2",{className:"font-heading text-xl font-semibold",children:c})]}),a.jsx("div",{className:"grid gap-2 sm:grid-cols-2 lg:grid-cols-3",children:u.map(d=>a.jsxs("div",{className:"rounded-lg border border-border bg-card p-4",children:[a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-sm font-medium",children:d.name}),d.address&&a.jsx("button",{type:"button",onClick:()=>Lw(A0e(`${d.address} ${c??""}`.trim())),className:"block text-left text-xs text-muted-foreground mt-0.5 hover:text-primary hover:underline",children:d.address})]}),a.jsx(ke,{variant:"secondary",className:"text-xs shrink-0 ml-2",children:tne[d.type]||d.type})]}),d.latitude&&d.longitude&&a.jsxs("button",{type:"button",onClick:()=>Lw(E0e(d.latitude,d.longitude)),className:"mt-2 inline-flex items-center gap-1 text-xs text-primary hover:underline",children:[a.jsx(Gi,{className:"h-3 w-3"})," Voir sur Google Maps"]})]},d.id))})]},c))})]})]})};var i4="Tabs",[lnt,qLt]=Ys(i4,[x3]),S1e=x3(),[cnt,F7]=lnt(i4),N1e=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:i,orientation:o="horizontal",dir:l,activationMode:c="automatic",...u}=t,d=Lj(l),[h,f]=Xo({prop:r,onChange:s,defaultProp:i??"",caller:i4});return a.jsx(cnt,{scope:n,baseId:Ml(),value:h,onValueChange:f,orientation:o,dir:d,activationMode:c,children:a.jsx(et.div,{dir:d,"data-orientation":o,...u,ref:e})})});N1e.displayName=i4;var C1e="TabsList",k1e=b.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...s}=t,i=F7(C1e,n),o=S1e(n);return a.jsx(mme,{asChild:!0,...o,orientation:i.orientation,dir:i.dir,loop:r,children:a.jsx(et.div,{role:"tablist","aria-orientation":i.orientation,...s,ref:e})})});k1e.displayName=C1e;var A1e="TabsTrigger",E1e=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...i}=t,o=F7(A1e,n),l=S1e(n),c=M1e(o.baseId,r),u=R1e(o.baseId,r),d=r===o.value;return a.jsx(gme,{asChild:!0,...l,focusable:!s,active:d,children:a.jsx(et.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:c,...i,ref:e,onMouseDown:ze(t.onMouseDown,h=>{!s&&h.button===0&&h.ctrlKey===!1?o.onValueChange(r):h.preventDefault()}),onKeyDown:ze(t.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&o.onValueChange(r)}),onFocus:ze(t.onFocus,()=>{const h=o.activationMode!=="manual";!d&&!s&&h&&o.onValueChange(r)})})})});E1e.displayName=A1e;var T1e="TabsContent",P1e=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:s,children:i,...o}=t,l=F7(T1e,n),c=M1e(l.baseId,r),u=R1e(l.baseId,r),d=r===l.value,h=b.useRef(d);return b.useEffect(()=>{const f=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(f)},[]),a.jsx(yo,{present:s||d,children:({present:f})=>a.jsx(et.div,{"data-state":d?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!f,id:u,tabIndex:0,...o,ref:e,style:{...t.style,animationDuration:h.current?"0s":void 0},children:f&&i})})});P1e.displayName=T1e;function M1e(t,e){return`${t}-trigger-${e}`}function R1e(t,e){return`${t}-content-${e}`}var unt=N1e,O1e=k1e,I1e=E1e,D1e=P1e;const Qi=unt,wi=b.forwardRef(({className:t,...e},n)=>a.jsx(O1e,{ref:n,className:Fe("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...e}));wi.displayName=O1e.displayName;const wt=b.forwardRef(({className:t,...e},n)=>a.jsx(I1e,{ref:n,className:Fe("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",t),...e}));wt.displayName=I1e.displayName;
910const kt=b.forwardRef(({className:t,...e},n)=>a.jsx(D1e,{ref:n,className:Fe("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));kt.displayName=D1e.displayName;const dnt=()=>{const{user:t,profile:e}=Ji(),n=e&&(`${e.first_name||""} ${e.last_name||""}`.trim()||e.full_name)||(t==null?void 0:t.email),{data:r=[]}=Ne({queryKey:["my_orders",t==null?void 0:t.id],enabled:!!t,queryFn:async()=>{const{data:s}=await Z.from("orders").select("*").eq("user_id",t.id).order("created_at",{ascending:!1}).limit(10);return s??[]}});return a.jsxs("div",{className:"container py-10 md:py-16",children:[a.jsx("h1",{className:"font-heading text-3xl font-bold md:text-4xl",children:"Mon compte"}),a.jsxs("p",{className:"mt-2 text-muted-foreground",children:["Bienvenue, ",n]}),a.jsxs(Qi,{defaultValue:"profil",className:"mt-8",children:[a.jsxs(wi,{className:"flex w-full justify-start overflow-x-auto whitespace-nowrap md:w-auto",children:[a.jsxs(wt,{value:"profil",children:[a.jsx(qv,{className:"mr-1.5 h-4 w-4"})," Profil"]}),a.jsxs(wt,{value:"carte",children:[a.jsx(Jo,{className:"mr-1.5 h-4 w-4"})," Carte Privilège"]}),a.jsxs(wt,{value:"favoris",children:[a.jsx(e3,{className:"mr-1.5 h-4 w-4"})," Favoris"]}),a.jsxs(wt,{value:"commandes",children:[a.jsx(Wi,{className:"mr-1.5 h-4 w-4"})," Commandes"]}),a.jsxs(wt,{value:"parametres",children:[a.jsx(MW,{className:"mr-1.5 h-4 w-4"})," Paramètres"]})]}),a.jsx(kt,{value:"profil",className:"mt-6",children:a.jsxs("div",{className:"max-w-lg rounded-xl border border-border bg-card p-6",children:[a.jsx("h2",{className:"font-heading text-lg font-semibold",children:"Informations personnelles"}),a.jsxs("div",{className:"mt-4 space-y-3 text-sm",children:[a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-muted-foreground",children:"Nom"}),a.jsx("span",{children:n})]}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-muted-foreground",children:"Email"}),a.jsx("span",{children:t==null?void 0:t.email})]}),(e==null?void 0:e.phone)&&a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-muted-foreground",children:"Téléphone"}),a.jsx("span",{children:e.phone})]})]})]})}),a.jsx(kt,{value:"carte",className:"mt-6",children:a.jsxs("div",{className:"max-w-lg rounded-xl border border-border bg-gradient-to-br from-primary/5 to-accent/5 p-6",children:[a.jsx("h2",{className:"font-heading text-lg font-semibold",children:"Ma Carte Privilège"}),a.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Accédez à votre carte digitale, téléchargez-la en PDF ou image, et ajoutez-la à Apple Wallet."}),a.jsx(H,{asChild:!0,className:"mt-4 w-full sm:w-auto",children:a.jsxs(_e,{to:"/carte-privilege/mon-espace",children:[a.jsx(Jo,{className:"mr-2 h-4 w-4"})," Accéder à mon espace"]})})]})}),a.jsx(kt,{value:"favoris",className:"mt-6",children:a.jsx("p",{className:"text-muted-foreground",children:"Vos articles favoris apparaîtront ici."})}),a.jsx(kt,{value:"commandes",className:"mt-6",children:r.length===0?a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"text-muted-foreground",children:"Aucune commande pour le moment."}),a.jsx(H,{asChild:!0,className:"mt-4",children:a.jsx(_e,{to:"/boutique",children:"Découvrir la boutique"})})]}):a.jsx("div",{className:"space-y-3",children:r.map(s=>{var i;return a.jsxs("div",{className:"flex items-center justify-between rounded-xl border border-border bg-card p-4",children:[a.jsxs("div",{children:[a.jsx("span",{className:"font-mono text-xs",children:s.order_number||s.id.slice(0,8)}),a.jsx("p",{className:"text-xs text-muted-foreground",children:new Date(s.created_at).toLocaleDateString("fr-FR")})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("span",{className:"text-sm font-semibold",children:[(i=s.total)==null?void 0:i.toFixed(2)," â¬"]}),a.jsx(ke,{variant:"outline",className:"text-xs",children:s.status}),s.status==="paid"||s.status==="shipped"||s.status==="delivered"?a.jsx(H,{variant:"ghost",size:"icon",className:"h-8 w-8",title:"Télécharger la facture",onClick:async()=>{const{data:{session:o}}=await Z.auth.getSession(),l=`https://aanjkhoyzcvhokzsmifu.supabase.co/functions/v1/generate-invoice?order_id=${s.id}`,c=await fetch(l,{headers:{Authorization:`Bearer ${o==null?void 0:o.access_token}`,apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImFhbmpraG95emN2aG9renNtaWZ1Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzU0ODIxMTgsImV4cCI6MjA5MTA1ODExOH0.FZffw1trnRiA182HIsLL4uQALqBG6SHIIttPS-tq-Qo"}});if(!c.ok)return;const u=await c.blob(),d=URL.createObjectURL(u);window.open(d,"_blank")},children:a.jsx(dp,{className:"h-4 w-4"})}):null]})]},s.id)})})}),a.jsx(kt,{value:"parametres",className:"mt-6",children:a.jsx("p",{className:"text-muted-foreground",children:"Gérez vos préférences de newsletter et notifications."})})]})]})};function hnt(){const{user:t,loading:e}=Ji(),n=Gs(),[r]=Zg(),s=r.get("redirect")||"/mon-compte",[i,o]=b.useState(""),[l,c]=b.useState(""),[u,d]=b.useState(!1),[h,f]=b.useState(""),[p,m]=b.useState(!1),[v,x]=b.useState(!1),[g,w]=b.useState(!1);b.useEffect(()=>{t&&!e&&n(s,{replace:!0})},[t,e,n,s]);const _=async N=>{if(N.preventDefault(),f(""),!i||!l){f("Veuillez remplir tous les champs.");return}d(!0);const{error:S}=await Z.auth.signInWithPassword({email:i,password:l});d(!1),S&&f("Email ou mot de passe incorrect.")},j=async N=>{if(N.preventDefault(),!i){f("Veuillez entrer votre email.");return}d(!0);const{error:S}=await Z.functions.invoke("request-password-reset",{body:{email:i.trim(),redirectTo:`${window.location.origin}/reset-password`}});if(d(!1),S){f("Erreur lors de l'envoi. Vérifiez votre email.");return}x(!0),ee.success("Email de réinitialisation envoyé !")};return t?null:a.jsx("div",{className:"container flex min-h-[70vh] items-center justify-center py-10",children:a.jsx("div",{className:"w-full max-w-md",children:a.jsxs("div",{className:"rounded-2xl border border-border bg-card p-8 shadow-sm",children:[a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-xl bg-primary/10",children:a.jsx(n5e,{className:"h-6 w-6 text-primary"})}),a.jsx("h1",{className:"mt-4 font-heading text-2xl font-bold",children:p?"Mot de passe oublié":"Connexion"}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:p?"Entrez votre email pour réinitialiser":"Accédez à votre espace Esprit Sud"})]}),p&&v?a.jsxs("div",{className:"mt-6 rounded-lg bg-green-50 p-4 text-center text-sm text-green-700",children:["Un email de réinitialisation a été envoyé à ",a.jsx("strong",{children:i}),". Vérifiez votre boîte de réception.",a.jsx(H,{variant:"link",className:"mt-2",onClick:()=>{m(!1),x(!1)},children:"Retour à la connexion"})]}):a.jsx(a.Fragment,{children:a.jsxs("form",{onSubmit:p?j:_,className:"mt-4 space-y-4",children:[a.jsxs("div",{children:[a.jsx(te,{htmlFor:"email",children:"Email"}),a.jsxs("div",{className:"relative mt-1",children:[a.jsx(Ru,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(ue,{id:"email",type:"email",placeholder:"[email protected]",value:i,onChange:N=>o(N.target.value),className:"pl-10"})]})]}),!p&&a.jsxs("div",{children:[a.jsx(te,{htmlFor:"password",children:"Mot de passe"}),a.jsxs("div",{className:"relative mt-1",children:[a.jsx(dk,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(ue,{id:"password",type:g?"text":"password",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢",value:l,onCh
910ange:N=>c(N.target.value),className:"pl-10 pr-10"}),a.jsx("button",{type:"button",onClick:()=>w(N=>!N),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground","aria-label":g?"Masquer le mot de passe":"Afficher le mot de passe",children:g?a.jsx(Zy,{className:"h-4 w-4"}):a.jsx(Mu,{className:"h-4 w-4"})})]})]}),h&&a.jsx("p",{className:"text-sm text-destructive",children:h}),a.jsx(H,{type:"submit",className:"w-full",disabled:u,children:u?"Chargementâ¦":p?"Envoyer le lien":"Se connecter"}),!p&&a.jsx("button",{type:"button",onClick:()=>{m(!0),f("")},className:"block w-full text-center text-sm text-primary hover:underline",children:"Mot de passe oublié ?"}),p&&a.jsx("button",{type:"button",onClick:()=>{m(!1),f("")},className:"block w-full text-center text-sm text-primary hover:underline",children:"Retour à la connexion"})]})}),!p&&a.jsxs("p",{className:"mt-6 text-center text-sm text-muted-foreground",children:["Pas encore inscrit ?"," ",a.jsx(_e,{to:`/signup${s!=="/mon-compte"?`?redirect=${encodeURIComponent(s)}`:""}`,className:"font-medium text-primary hover:underline",children:"Créer un compte"})]})]})})})}function fnt(){const{user:t}=Ji(),e=Gs(),[n]=Zg(),r=n.get("redirect")||"/mon-compte",[s,i]=b.useState(""),[o,l]=b.useState(""),[c,u]=b.useState(""),[d,h]=b.useState(""),[f,p]=b.useState(!1),[m,v]=b.useState(""),[x,g]=b.useState(!1),[w,_]=b.useState(!1);b.useEffect(()=>{t&&e(r,{replace:!0})},[t,e,r]);const j=async N=>{if(N.preventDefault(),v(""),!s||!o||!c||!d){v("Veuillez remplir tous les champs.");return}if(c.length<6){v("Le mot de passe doit contenir au moins 6 caractères.");return}if(c!==d){v("Les mots de passe ne correspondent pas.");return}p(!0);const{error:S}=await Z.auth.signUp({email:o,password:c,options:{data:{full_name:s}}});if(p(!1),S){S.message.includes("already registered")?v("Cet email est déjà utilisé. Essayez de vous connecter."):v("Erreur lors de l'inscription. Veuillez réessayer.");return}ee.success("Bienvenue chez Esprit Sud !",{description:"Votre compte a été créé avec succès."}),e(r,{replace:!0})};return t?null:a.jsx("div",{className:"container flex min-h-[70vh] items-center justify-center py-10",children:a.jsx("div",{className:"w-full max-w-md",children:a.jsxs("div",{className:"rounded-2xl border border-border bg-card p-8 shadow-sm",children:[a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-xl bg-primary/10",children:a.jsx(C5e,{className:"h-6 w-6 text-primary"})}),a.jsx("h1",{className:"mt-4 font-heading text-2xl font-bold",children:"Créer un compte"}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Rejoignez la communauté Esprit Sud"})]}),a.jsxs("form",{onSubmit:j,className:"mt-4 space-y-4",children:[a.jsxs("div",{children:[a.jsx(te,{htmlFor:"name",children:"Nom complet"}),a.jsxs("div",{className:"relative mt-1",children:[a.jsx(qv,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(ue,{id:"name",placeholder:"Jean Dupont",value:s,onChange:N=>i(N.target.value),className:"pl-10"})]})]}),a.jsxs("div",{children:[a.jsx(te,{htmlFor:"email",children:"Email"}),a.jsxs("div",{className:"relative mt-1",children:[a.jsx(Ru,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(ue,{id:"email",type:"email",placeholder:"[email protected]",value:o,onChange:N=>l(N.target.value),className:"pl-10"})]})]}),a.jsxs("div",{children:[a.jsx(te,{htmlFor:"password",children:"Mot de passe"}),a.jsxs("div",{className:"relative mt-1",children:[a.jsx(dk,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(ue,{id:"password",type:x?"text":"password",placeholder:"6 caractères minimum",value:c,onChange:N=>u(N.target.value),className:"pl-10 pr-10"}),a.jsx("button",{type:"button",onClick:()=>g(N=>!N),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground","aria-label":x?"Masquer le mot de passe":"Afficher le mot de passe",children:x?a.jsx(Zy,{className:"h-4 w-4"}):a.jsx(Mu,{className:"h-4 w-4"})})]})]}),a.jsxs("div",{children:[a.jsx(te,{htmlFor:"confirm",children:"Confirmer le mot de passe"}),a.jsxs("div",{className:"relative mt-1",children:[a.jsx(dk,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(ue,{id:"confirm",type:w?"text":"password",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢",value:d,onChange:N=>h(N.target.value),className:"pl-10 pr-10"}),a.jsx("button",{type:"button",onClick:()=>_(N=>!N),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground","aria-label":w?"Masquer le mot de passe":"Afficher le mot de passe",children:w?a.jsx(Zy,{className:"h-4 w-4"}):a.jsx(Mu,{className:"h-4 w-4"})})]})]}),m&&a.jsx("p",{className:"text-sm text-destructive",children:m}),a.jsx(H,{type:"submit",className:"w-full",disabled:f,children:f?"Créationâ¦":"Créer mon compte"})]}),a.jsxs("p",{className:"mt-6 text-center text-sm text-muted-foreground",children:["Déjà inscrit ?"," ",a.jsx(_e,{to:`/login${r!=="/mon-compte"?`?redirect=${encodeURIComponent(r)}`:""}`,className:"font-medium text-primary hover:underline",children:"Se connecter"})]})]})})})}function pnt(){const t=Gs(),[e,n]=b.useState(""),[r,s]=b.useState(""),[i,o]=b.useState(!1),[l,c]=b.useState(!1),[u,d]=b.useState(!1),[h,f]=b.useState("");b.useEffect(()=>{const{data:m}=Z.auth.onAuthStateChange(v=>{(v==="PASSWORD_RECOVERY"||v==="SIGNED_IN")&&d(!0)});return Z.auth.getSession().then(({data:v})=>{v.session&&d(!0)}),()=>m.subscription.unsubscribe()},[]);const p=async m=>{if(m.preventDefault(),f(""),e.length<8){f("Le mot de passe doit contenir au moins 8 caractères.");return}if(e!==r){f("Les mots de passe ne correspondent pas.");return}c(!0);const{error:v}=await Z.auth.updateUser({password:e});if(c(!1),v){f(v.message);return}ee.success("Mot de passe mis à jour !"),t("/mon-compte",{replace:!0})};return a.jsx("div",{className:"container flex min-h-[70vh] items-center justify-center py-10",children:a.jsx("div",{className:"w-full max-w-md",children:a.jsxs("div",{className:"rounded-2xl border border-border bg-card p-8 shadow-sm",children:[a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-xl bg-primary/10",children:a.jsx(G6,{className:"h-6 w-6 text-primary"})}),a.jsx("h1",{className:"mt-4 font-heading text-2xl font-bold",children:"Nouveau mot de passe"}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Choisissez un nouveau mot de passe pour votre compte Esprit Sud"})]}),u?a.jsxs("form",{onSubmit:p,className:"mt-6 space-y-4",children:[a.jsxs("div",{children:[a.jsx(te,{htmlFor:"password",children:"Nouveau mot de passe"}),a.jsxs("div",{className:"relative mt-1",children:[a.jsx(dk,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(ue,{id:"password",type:i?"text":"password",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢",value:e,onCh
910ange:m=>n(m.target.value),className:"pl-10 pr-10"}),a.jsx("button",{type:"button",onClick:()=>o(m=>!m),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground","aria-label":i?"Masquer":"Afficher",children:i?a.jsx(Zy,{className:"h-4 w-4"}):a.jsx(Mu,{className:"h-4 w-4"})})]})]}),a.jsxs("div",{children:[a.jsx(te,{htmlFor:"confirm",children:"Confirmer le mot de passe"}),a.jsxs("div",{className:"relative mt-1",children:[a.jsx(dk,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(ue,{id:"confirm",type:i?"text":"password",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢",value:r,onChange:m=>s(m.target.value),className:"pl-10"})]})]}),h&&a.jsx("p",{className:"text-sm text-destructive",children:h}),a.jsx(H,{type:"submit",className:"w-full",disabled:l,children:l?"Enregistrementâ¦":"Mettre à jour le mot de passe"})]}):a.jsx("p",{className:"mt-6 text-center text-sm text-muted-foreground",children:"Vérification du lien de réinitialisationâ¦"})]})})})}const L1e="26 mai 2026",mnt=` 911<h2 id="identification">Identification du responsable</h2> 912<ul> 913 <li><strong>Raison sociale :</strong> [à COMPLÃTER]</li> 914 <li><strong>CIF/NIF :</strong> [à COMPLÃTER]</li> 915 <li><strong>Domicile social :</strong> [à COMPLÃTER], Andalousie, Espagne</li> 916 <li><strong>E-mail :</strong> <a href="mailto:[email protected]">[email protected]</a></li> 917 <li><strong>Activité :</strong> Ãdition de presse, vente en ligne, services numériques</li> 918 <li>Inscrit au Registro Mercantil de Málaga (ou auto-entrepreneur)</li> 919</ul> 920 921<h2 id="objet">Objet du site</h2> 922<p>Esprit Sud Magazine est un média francophone dédié à l'Andalousie. Le site propose des actualités, des guides de voyage, une boutique en ligne, une Carte Privilège avec réseau de partenaires, et un magazine papier trimestriel.</p> 923 924<h2 id="propriete">Propriété intellectuelle</h2> 925<p>Tous les contenus (textes, images, logos, design) sont la propriété d'Esprit Sud Magazine sauf mention contraire. Toute reproduction sans autorisation est interdite.</p> 926 927<h2 id="responsabilite">Responsabilité</h2> 928<p>Esprit Sud Magazine s'efforce de fournir des informations exactes mais ne peut garantir l'absence d'erreurs. Les liens vers des sites tiers n'engagent pas la responsabilité d'Esprit Sud Magazine.</p> 929 930<h2 id="loi">Loi applicable</h2> 931<p>Le présent site est soumis à la législation espagnole. Tout litige sera soumis aux tribunaux de Málaga.</p> 932`,gnt=` 933<h2 id="responsable">Responsable du traitement</h2> 934<ul> 935 <li><strong>Identité :</strong> [à COMPLÃTER] (même que mentions légales)</li> 936 <li><strong>Contact DPO :</strong> <a href="mailto:[email protected]">[email protected]</a></li> 937</ul> 938 939<h2 id="donnees">Données collectées et finalités</h2> 940<table> 941 <thead><tr><th>Donnée</th><th>Finalité</th><th>Base légale</th><th>Conservation</th></tr></thead> 942 <tbody> 943 <tr><td>Nom, email, mot de passe</td><td>Création de compte utilisateur</td><td>Consentement</td><td>Jusqu'à suppression du compte</td></tr> 944 <tr><td>Nom, email, adresse postale</td><td>Traitement des commandes boutique</td><td>Exécution du contrat</td><td>5 ans (obligations fiscales)</td></tr> 945 <tr><td>Nom, email, photo</td><td>Carte Privilège</td><td>Exécution du contrat</td><td>Durée de l'abonnement + 1 an</td></tr> 946 <tr><td>Email</td><td>Newsletter</td><td>Consentement</td><td>Jusqu'au désabonnement</td></tr> 947 <tr><td>Données de navigation (cookies)</td><td>Statistiques, amélioration du site</td><td>Consentement</td><td>13 mois maximum</td></tr> 948 <tr><td>Données de paiement</td><td>Paiement sécurisé</td><td>Exécution du contrat</td><td>Non stockées (gérées par Stripe)</td></tr> 949 </tbody> 950</table> 951 952<h2 id="destinataires">Destinataires des données</h2> 953<ul> 954 <li>Stripe (paiements) â certifié PCI DSS</li> 955 <li>Supabase (hébergement des données) â serveurs UE</li> 956 <li>Brevo (e-mails transactionnels) â certifié RGPD</li> 957 <li>Google Analytics (si activé) â avec anonymisation IP</li> 958</ul> 959 960<h2 id="droits">Droits des utilisateurs</h2> 961<p>
961Conformément au RGPD, vous disposez des droits suivants :</p> 962<ul> 963 <li>Droit d'accès à vos données personnelles</li> 964 <li>Droit de rectification</li> 965 <li>Droit à l'effacement ("droit à l'oubli")</li> 966 <li>Droit à la limitation du traitement</li> 967 <li>Droit à la portabilité des données</li> 968 <li>Droit d'opposition</li> 969</ul> 970<p>Pour exercer vos droits : <a href="mailto:[email protected]">[email protected]</a>. Délai de réponse : 30 jours. Vous pouvez aussi déposer une réclamation auprès de l'AEPD (Agencia Española de Protección de Datos).</p> 971 972<h2 id="transferts">Transferts internationaux</h2> 973<p>Vos données sont hébergées dans l'Union Européenne. En cas de transfert hors UE (ex : services Google), des garanties appropriées sont mises en place (clauses contractuelles types).</p> 974`,vnt=` 975<h2 id="art1">Article 1 â Objet</h2> 976<p>Les présentes CGV régissent les ventes réalisées via la boutique en ligne d'Esprit Sud Magazine.</p> 977 978<h2 id="art2">Article 2 â Produits</h2> 979<p>La boutique propose : magazines papier, guides de voyage, produits dérivés, produits numériques (PDF), expériences. Les photos sont non contractuelles.</p> 980 981<h2 id="art3">Article 3 â Prix</h2> 982<p>Les prix sont indiqués en euros TTC (TVA espagnole incluse). Les frais de livraison sont indiqués avant la validation de la commande.</p> 983 984<h2 id="art4">Article 4 â Commande</h2> 985<p>La validation du paiement constitue l'acceptation des CGV. Un e-mail de confirmation est envoyé.</p> 986 987<h2 id="art5">Article 5 â Paiement</h2> 988<p>Le paiement est sécurisé via Stripe. Modes acceptés : carte bancaire (Visa, Mastercard). Les données bancaires ne sont pas stockées sur notre site.</p> 989 990<h2 id="art6">Article 6 â Livraison</h2> 991<ul> 992 <li>Espagne : Correos, 4,95 â¬, 2-5 jours ouvrés</li> 993 <li>Europe : InPost (point relais) 4,95 ⬠(5-10 jours) ou Correos 13 ⬠(7-14 jours)</li> 994 <li>Produits numériques : téléchargement immédiat après paiement</li> 995</ul> 996<p>Les délais sont indicatifs et non contractuels.</p> 997 998<h2 id="art7">Article 7 â Droit de rétractation</h2> 999<p>Conformément à la législation européenne, vous disposez d'un délai de 14 jours à compter de la réception pour retourner un produit physique. Les produits numériques téléchargés et les expériences consommées ne sont pas remboursables. Contactez <a href="mailto:[email protected]">[email protected]</a> pour initier un retour.</p> 1000 1001<h2 id="art8">Article 8 â Carte Privilège</h2> 1002<p>L'abonnement Carte Privilège est un abonnement annuel à 75 â¬. Il est renouvelé automatiquement sauf annulation depuis l'espace membre ou le portail Stripe. L'annulation prend effet à la fin de la période en cours.</p> 1003 1004<h2 id="art9">Article 9 â Garantie</h2> 1005<p>Les produits physiques bénéficient de la garantie légale de conformité (3 ans en Espagne).</p> 1006 1007<h2 id="art10">Article 10 â Réclamations</h2> 1008<p>Pour toute réclamation : <a href="mailto:[email protected]">[email protected]</a>. Plateforme européenne de règlement des litiges : <a href="https://ec.europa.eu/consumers/odr" target="_blank" rel="noopener">https://ec.europa.eu/consumers/odr</a></p> 1009 1010<h2 id="art11">Article 11 â Loi applicable</h2> 1011<p>Loi espagnole. Tribunaux de Málaga compétents.</p> 1012`,xnt=` 1013<h2 id="quest">Qu'est-ce qu'un cookie ?</h2> 1014<p>Un cookie est un petit fichier texte stocké sur votre appareil lors de la visite d'un site web.</p> 1015 1016<h2 id="utilises">Cookies utilisés</h2> 1017<table> 1018 <thead><tr><th>Cookie</th><th>Type</th><th>Finalité</th><th>Durée</th><th>Obligatoire</th></tr></thead> 1019 <tbody> 1020 <tr><td>sb-auth-token</td><td>Technique</td><td>Session utilisateur Supabase</td><td>Session</td><td>Oui</td></tr> 1021 <tr><td>cart</td><td>Technique</td><td>Panier d'achat</td><td>30 jours</td><td>Oui</td></tr> 1022 <tr><td>cookie_consent</td><td>Technique</td><td>Mémoriser votre choix cookies</td><td>12 mois</td><td>Oui</td></tr> 1023 <tr><td>_ga, _gid</td><td>Analytique</td><td>Google Analytics â statistiques de fréquentation</td><td>13 mois</td><td>Non</td></tr> 1024 </tbody> 1025</table> 1026 1027<h2 id="gestion">Gestion des cookies</h2> 1028<p>Vous pouvez à tout moment modifier vos préférences en cliquant sur "Gérer les cookies" dans le pied de page, ou en configurant votre navigateur.</p> 1029`,wC={legal_mentions:{title:"Mentions légales",defaultContent:mnt,description:"Mentions légales d'Esprit Sud Magazine : responsable de publication, propriété intellectuelle et conditions d'utilisation du site."},privacy_policy:{title:"Politique de confidentialité",defaultContent:gnt,description:"Politique de confidentialité d'Esprit Sud Magazine : données collectées, cookies et vos droits RGPD."},terms_of_sale:{title:"Conditions générales de vente",defaultContent:vnt,description:"Conditions générales de vente de la boutique Esprit Sud Magazine : commandes, paiements, livraisons et rétractation."},cookie_policy:{title:"Politique de cookies",defaultContent:xnt,description:"Politique de cookies d'Esprit Sud Magazine : types de cookies utilisés et comment gérer vos préférences."}};function ynt(t){if(typeof window>"u")return[];const e=document.createElement("div");return e.innerHTML=t,Array.from(e.querySelectorAll("h2[id]")).map(n=>({id:n.id,text:n.textContent||""}))}function a4({settingsKey:t}){const e=wC[t],[n,r]=b.useState(e.defaultContent);b.useEffect(()=>{let i=!1;return(async()=>{const{data:o}=await Mt.from("site_settings_public").select("value").eq("key",t).maybeSingle();if(i)return;const l=o==null?void 0:o.value,c=typeof l=="string"?l:l==null?void 0:l.html;c&&typeof c=="string"&&r(c)})(),()=>{i=!0}},[t]);const s=b.useMemo(()=>ynt(n),[n]);
1029return a.jsxs(a.Fragment,{children:[a.jsx(Fn,{title:e.title,description:e.description}),a.jsx("div",{className:"border-b border-border bg-muted/30",children:a.jsx("div",{className:"container py-12 md:py-20",children:a.jsxs("div",{className:"mx-auto max-w-3xl text-center",children:[a.jsxs("div",{className:"mb-4 inline-flex items-center gap-2 rounded-full border border-border bg-background px-3 py-1 text-xs font-medium uppercase tracking-wider text-muted-foreground shadow-sm",children:[a.jsx(Pu,{className:"h-3.5 w-3.5"}),"Informations légales"]}),a.jsx("h1",{className:"font-heading text-3xl font-bold tracking-tight md:text-4xl lg:text-5xl",children:e.title}),a.jsx("div",{className:"mx-auto mt-4 h-1 w-16 rounded-full bg-primary/80"})]})})}),a.jsx("div",{className:"container py-10 md:py-16",children:a.jsxs("div",{className:"mx-auto max-w-3xl",children:[s.length>2&&a.jsxs("nav",{"aria-label":"Sommaire",className:"mb-10 overflow-hidden rounded-xl border border-border bg-muted/40 shadow-sm",children:[a.jsx("div",{className:"border-b border-border bg-muted/60 px-5 py-3",children:a.jsx("p",{className:"text-xs font-semibold uppercase tracking-widest text-muted-foreground",children:"Sommaire"})}),a.jsx("ul",{className:"divide-y divide-border px-5 py-2 text-sm",children:s.map((i,o)=>a.jsxs("li",{className:"flex items-center gap-3 py-2.5",children:[a.jsx("span",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-md bg-primary/10 text-xs font-semibold text-primary",children:o+1}),a.jsx("a",{href:`#${i.id}`,className:"text-foreground transition-colors hover:text-primary hover:underline",children:i.text})]},i.id))})]}),a.jsx("article",{className:"legal-article",dangerouslySetInnerHTML:{__html:n}}),a.jsxs("div",{className:"mt-16 flex flex-col items-center gap-3 border-t border-border pt-8 text-center",children:[a.jsx("div",{className:"h-px w-12 bg-primary/30"}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:["Dernière mise à jour : ",a.jsx("span",{className:"font-medium text-foreground",children:L1e})]})]})]})})]})}const bnt=()=>a.jsx(a4,{settingsKey:"legal_mentions"}),wnt=()=>a.jsx(a4,{settingsKey:"privacy_policy"}),_nt=()=>a.jsx(a4,{settingsKey:"terms_of_sale"}),jnt=()=>a.jsx(a4,{settingsKey:"cookie_policy"}),Snt=()=>a.jsxs(a.Fragment,{children:[a.jsx(Fn,{title:"Conditions Carte Privilège",description:"Conditions de l'abonnement Carte Privilège Esprit Sud Magazine : durée, renouvellement automatique et résiliation."}),a.jsx("div",{className:"border-b border-border bg-muted/30",children:a.jsx("div",{className:"container py-12 md:py-20",children:a.jsxs("div",{className:"mx-auto max-w-3xl text-center",children:[a.jsxs("div",{className:"mb-4 inline-flex items-center gap-2 rounded-full border border-border bg-background px-3 py-1 text-xs font-medium uppercase tracking-wider text-muted-foreground shadow-sm",children:[a.jsx(Pu,{className:"h-3.5 w-3.5"}),"Informations légales"]}),a.jsx("h1",{className:"font-heading text-3xl font-bold tracking-tight md:text-4xl lg:text-5xl",children:"Conditions Carte Privilège"}),a.jsx("div",{className:"mx-auto mt-4 h-1 w-16 rounded-full bg-primary/80"})]})})}),a.jsx("div",{className:"container py-10 md:py-16",children:a.jsxs("div",{className:"mx-auto max-w-3xl",children:[a.jsx("div",{className:"legal-article text-muted-foreground",children:a.jsx("p",{children:"L'abonnement à la Carte Privilège est annuel et renouvelable. Il peut être résilié à tout moment depuis votre espace membre ou le portail Stripe. L'annulation prend effet à la fin de la période en cours."})}),a.jsxs("div",{className:"mt-16 flex flex-col items-center gap-3 border-t border-border pt-8 text-center",children:[a.jsx("div",{className:"h-px w-12 bg-primary/30"}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:["Dernière mise à jour : ",a.jsx("span",{className:"font-medium text-foreground",children:L1e})]})]})]})})]}),Nnt=["Actualités Andalousie","Bons plans Carte Privilège","Ãvénements à venir","Gratuit et sans spam"];function Cnt(){return a.jsxs("div",{className:"container max-w-2xl py-16 md:py-24",children:[a.jsx(Fn,{title:"Newsletter Esprit Sud",description:"Recevez chaque mois nos dernières actualités, bons plans et événements en Andalousie.",path:"/newsletter"}),a.jsx("h1",{className:"font-heading text-4xl font-bold md:text-5xl",children:"Newsletter Esprit Sud"}),a.jsx("p",{className:"mt-4 text-lg text-muted-foreground",children:"Recevez chaque mois nos dernières actualités, bons plans et événements en Andalousie."}),a.jsx("ul",{className:"mt-8 grid gap-2 text-sm sm:grid-cols-2",children:Nnt.map(t=>a.jsxs("li",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-accent",children:"â"}),t]},t))}),a.jsx("div",{className:"mt-10 rounded-2xl border border-border bg-card p-6 md:p-8",children:a.jsx(tve,{source:"newsletter_page",variant:"full",showFirstName:!0})})]})}function knt(){var u;const[t]=Zg(),[e,n]=b.useState(((u=t.get("email"))==null?void 0:u.toLowerCase())??""),[r,s]=b.useState("idle"),[i,o]=b.useState(!1);b.useEffect(()=>{const d=t.get("email");d&&n(d.toLowerCase())},[t]);const l=async()=>
1029{if(!e)return;o(!0);const{error:d}=await Z.from("newsletter_subscribers").update({is_active:!1,unsubscribed_at:new Date().toISOString()}).eq("email",e.trim().toLowerCase());if(o(!1),d){ee.error("Une erreur est survenue");return}s("done")},c=async()=>{o(!0);const{error:d}=await Z.from("newsletter_subscribers").update({is_active:!0,unsubscribed_at:null}).eq("email",e.trim().toLowerCase());if(o(!1),d){ee.error("Une erreur est survenue");return}s("resubscribed")};return a.jsxs("div",{className:"container max-w-xl py-16 md:py-24",children:[a.jsx(Fn,{title:"Désabonnement Newsletter",description:"Gérez votre abonnement à la newsletter Esprit Sud Magazine.",path:"/newsletter/desabonnement"}),a.jsx("h1",{className:"font-heading text-3xl font-bold md:text-4xl",children:"Désabonnement Newsletter"}),r==="idle"&&a.jsxs("div",{className:"mt-8 space-y-4 rounded-2xl border border-border bg-card p-6",children:[a.jsx("p",{children:"Voulez-vous vraiment vous désabonner de notre newsletter ?"}),a.jsx(ue,{type:"email",value:e,onChange:d=>n(d.target.value),placeholder:"[email protected]"}),a.jsx(H,{onClick:l,disabled:i||!e,variant:"destructive",children:i?"...":"Me désabonner"})]}),r==="done"&&a.jsxs("div",{className:"mt-8 space-y-4 rounded-2xl border border-border bg-card p-6",children:[a.jsx("p",{children:"Vous avez été désabonné. Vous ne recevrez plus notre newsletter."}),a.jsx(H,{onClick:c,disabled:i,variant:"outline",children:"Je me suis trompé, me réinscrire"})]}),r==="resubscribed"&&a.jsx("div",{className:"mt-8 rounded-2xl border border-border bg-card p-6",children:a.jsx("p",{children:"Vous êtes de nouveau inscrit à notre newsletter. Merci !"})})]})}const Ant=/\.(js|css|map|png|jpe?g|gif|svg|ico|webp|avif|woff2?|ttf|otf|txt|xml|json)$/i,Ent=/bot|crawl|spider|slurp|bingpreview|facebookexternalhit|whatsapp|telegram|preview|fetch/i;function F1e(t){return!(!t||Ant.test(t)||typeof navigator<"u"&&Ent.test(navigator.userAgent||""))}async function $1e(t){if(F1e(t))try{await Z.rpc("log_404",{_url:t,_referrer:typeof document<"u"&&document.referrer||null,_user_agent:typeof navigator<"u"?navigator.userAgent:null})}catch(e){console.warn("404 log failed",e)}}async function z1e(t){try{const e=Z,{data:n}=await e.rpc("get_404_redirect",{_url:t}),r=typeof n=="string"?n:null;if(r)return r;let s=null;const i=t.match(/\/i\/\d+\/([^/?#]+)\/?$/);if(i)s=i[1];else{const l=t.match(/^\/(?:actualites|carnet-adresses|destinations|evenements)\/([^/?#]+)\/?$/);l&&(s=l[1])}if(!s)return null;const{data:o}=await e.rpc("resolve_legacy_slug",{_slug:s});return(typeof o=="string"?o:null)||null}catch{return null}}const Tnt=Object.freeze(Object.defineProperty({__proto__:null,check404Redirect:z1e,log404:$1e,shouldLog404:F1e},Symbol.toStringTag,{value:"Module"})),Pnt=[{to:"/",label:"Accueil",icon:Ife},{to:"/actualites",label:"Actualités",icon:PW},{to:"/destinations",label:"Destinations",icon:_r},{to:"/carnet-adresses",label:"Carnet d'adresses",icon:Pu},{to:"/boutique",label:"Boutique",icon:Wi},{to:"/carte-privilege",label:"Carte Privilège",icon:Jo}],Mnt=()=>{const t=xo(),e=Gs(),{redirects:n,loaded:r}=Ope(),[s,i]=b.useState(!0);return b.useEffect(()=>{let o=!1;const l=t.pathname;return(async()=>{const c=n.get(l);if(c){const d=(await Ac(async()=>{const{supabase:h}=await Promise.resolve().then(()=>O4e);return{supabase:h}},void 0)).supabase;d.from("custom_redirects").update({hit_count:(c.hit_count,void 0),last_used_at:new Date().toISOString()}).eq("id",c.id).then(()=>{}),d.rpc,e(c.target_url,{replace:!0});return}const u=await z1e(l);if(!o){if(u){e(u,{replace:!0});return}$1e(l),i(!1)}})(),()=>{o=!0}},[t.pathname,n,r,e]),s?a.jsx("div",{className:"container py-20 text-center text-muted-foreground",children:"Chargementâ¦"}):a.jsxs("div",{className:"container py-20 md:py-28",children:[a.jsx(Fn,{title:"Page introuvable | Esprit Sud Magazine",description:"La page que vous cherchez n'existe plus ou a été déplacée.",noIndex:!0}),a.jsxs("div",{className:"mx-auto max-w-2xl text-center",children:[a.jsx("p",{className:"font-heading text-7xl font-bold text-primary md:text-9xl",children:"404"}),a.jsx("h1",{className:"mt-4 font-heading text-3xl font-bold md:text-4xl",children:"Page introuvable"}),a.jsx("p",{className:"mt-3 text-muted-foreground",children:"La page que vous cherchez n'existe plus ou a été déplacée. Retrouvez vite l'And
1029alousie en français via l'une de nos sections."}),a.jsx("div",{className:"mt-10 grid grid-cols-2 gap-3 sm:grid-cols-3",children:Pnt.map(({to:o,label:l,icon:c})=>a.jsx(H,{asChild:!0,variant:"outline",className:"h-auto justify-start gap-3 rounded-xl py-3",children:a.jsxs(_e,{to:o,children:[a.jsx(c,{className:"h-4 w-4 text-primary"}),a.jsx("span",{children:l})]})},o))}),a.jsx("div",{className:"mt-10",children:a.jsx(H,{asChild:!0,size:"lg",className:"rounded-xl",children:a.jsx(_e,{to:"/",children:"Retour à l'accueil"})})})]})]})};function Rnt(){const t=Gs(),{user:e,loading:n}=Ji(),[r,s]=b.useState(""),[i,o]=b.useState(""),[l,c]=b.useState(!1);b.useEffect(()=>{!n&&!e&&(window.location.hash.includes("access_token")||(ee.info("Connectez-vous pour activer votre carte."),t("/login",{replace:!0})))},[n,e,t]);const u=async d=>{if(d.preventDefault(),r.length<8)return ee.error("Mot de passe : 8 caractères minimum.");if(r!==i)return ee.error("Les mots de passe ne correspondent pas.");c(!0);try{const{error:h}=await Z.auth.updateUser({password:r});if(h)throw h;ee.success("Compte activé !"),t("/carte-privilege/mon-espace",{replace:!0})}catch(h){ee.error((h==null?void 0:h.message)||"Impossible d'activer votre compte.")}finally{c(!1)}};return a.jsxs("div",{className:"container max-w-xl py-16",children:[a.jsx(Fn,{title:"Bienvenue â Esprit Sud Magazine",description:"Activez votre Carte Privilège sur la nouvelle plateforme.",path:"/bienvenue",noIndex:!0}),a.jsxs("div",{className:"rounded-2xl border border-border bg-card p-8 shadow-sm",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(sh,{className:"h-8 w-8 text-green-600"}),a.jsx("h1",{className:"font-heading text-2xl font-bold",children:"Bienvenue sur le nouveau site Esprit Sud Magazine !"})]}),a.jsx("p",{className:"mt-4 text-muted-foreground",children:"Votre Carte Privilège a été transférée sur notre nouvelle plateforme. Définissez votre mot de passe pour activer votre compte."}),a.jsxs("form",{onSubmit:u,className:"mt-6 space-y-4",children:[a.jsxs("div",{children:[a.jsx(te,{htmlFor:"password",children:"Nouveau mot de passe"}),a.jsx(ue,{id:"password",type:"password",value:r,onChange:d=>s(d.target.value),required:!0,minLength:8,autoComplete:"new-password"})]}),a.jsxs("div",{children:[a.jsx(te,{htmlFor:"confirm",children:"Confirmer le mot de passe"}),a.jsx(ue,{id:"confirm",type:"password",value:i,onChange:d=>o(d.target.value),required:!0,minLength:8,autoComplete:"new-password"})]}),a.jsx(H,{type:"submit",disabled:l||!e,className:"w-full",children:l?a.jsxs(a.Fragment,{children:[a.jsx(Je,{className:"mr-2 h-4 w-4 animate-spin"})," Activationâ¦"]}):"Activer mon compte"}),!e&&!n&&a.jsx("p",{className:"text-center text-xs text-muted-foreground",children:"Lien expiré ou invalide ? Demandez un nouveau lien à [email protected]"})]})]})]})}const Ont="https://aanjkhoyzcvhokzsmifu.supabase.co/functions/v1/list-directory-profiles",nne="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImFhbmpraG95emN2aG9renNtaWZ1Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzU0ODIxMTgsImV4cCI6MjA5MTA1ODExOH0.FZffw1trnRiA182HIsLL4uQALqBG6SHIIttPS-tq-Qo";async function B1e(t){const e=new URL(Ont);Object.entries(t).forEach(([r,s])=>{s&&e.searchParams.set(r,s)});const n=await fetch(e.toString(),{headers:{apikey:nne,Authorization:`Bearer ${nne}`}});if(!n.ok)throw new Error(`Annuaire indisponible (${n.status})`);return n.json()}async function U1e(t){const e=await B1e({action:"list",search:t.search,city:t.city,category_id:t.categoryId,language:t.language,limit:"100"});return{data:e.data??[],total:e.total??0}}async function Int(t){return(await B1e({action:"get",slug:t})).data??null}async function $7(){const{data:t,error:e}=await Z.from("business_categories").select("id, name, name_es, name_en, emoji, sort_order").eq("is_active",!0).order("sort_order",{ascending:!0});if(e)throw e;return t??[]}async function q1e(){const{data:t,error:e}=await Z.from("cities").select("id, name, province").eq("is_active",!0).order("name",{ascending:!0});if(e)throw e;return t??[]}
1029function z7(t,e){return t?e==="es"?t.name_es||t.name:e==="en"&&t.name_en||t.name:""}const B7=[{value:"fr",label:"Français"},{value:"es",label:"Español"},{value:"en",label:"English"},{value:"de",label:"Deutsch"},{value:"nl",label:"Nederlands"}],U7=[{key:"monday",label:"Lundi"},{key:"tuesday",label:"Mardi"},{key:"wednesday",label:"Mercredi"},{key:"thursday",label:"Jeudi"},{key:"friday",label:"Vendredi"},{key:"saturday",label:"Samedi"},{key:"sunday",label:"Dimanche"}];function Dnt({profile:t,categories:e,lang:n}){var i,o;const r=e.find(l=>l.id===(t.business_category_id||t.category_id)),s=((i=t.photos)==null?void 0:i[0])||t.logo_url;return a.jsxs(_e,{to:`/annuaire/${t.slug}`,className:"group flex flex-col overflow-hidden rounded-xl border bg-card transition-shadow hover:shadow-lg",children:[a.jsx("div",{className:"aspect-[4/3] overflow-hidden bg-muted",children:s?a.jsx("img",{src:s,alt:t.organization_name,loading:"lazy",className:"h-full w-full object-cover transition-transform duration-300 group-hover:scale-105"}):a.jsx("div",{className:"flex h-full w-full items-center justify-center text-4xl",children:(r==null?void 0:r.emoji)??"ð"})}),a.jsxs("div",{className:"flex flex-1 flex-col gap-2 p-4",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsx("h3",{className:"font-serif text-lg font-semibold leading-tight",children:t.organization_name}),t.is_verified&&a.jsx(EW,{className:"mt-1 h-5 w-5 shrink-0 text-primary","aria-label":"Fiche vérifiée"})]}),r&&a.jsxs(ke,{variant:"secondary",className:"w-fit",children:[r.emoji," ",z7(r,n)]}),t.description&&a.jsx("p",{className:"line-clamp-3 text-sm text-muted-foreground",children:t.description}),a.jsxs("div",{className:"mt-auto flex flex-wrap items-center gap-3 pt-2 text-xs text-muted-foreground",children:[t.city&&a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx(_r,{className:"h-3.5 w-3.5"})," ",t.city]}),(o=t.languages_spoken)!=null&&o.length?a.jsx("span",{className:"uppercase tracking-wide",children:t.languages_spoken.join(" · ")}):null,t.esprit_sud_partner&&a.jsx(ke,{variant:"outline",className:"text-[10px]",children:"Partenaire Esprit Sud"})]})]})]})}const Lnt="https://aanjkhoyzcvhokzsmifu.supabase.co/functions/v1/submit-recommendation-request",rne="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImFhbmpraG95emN2aG9renNtaWZ1Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzU0ODIxMTgsImV4cCI6MjA5MTA1ODExOH0.FZffw1trnRiA182HIsLL4uQALqBG6SHIIttPS-tq-Qo";function pI({categories:t,cities:e,trigger:n}){const[r,s]=b.useState(!1),[i,o]=b.useState(!1),[l,c]=b.useState({first_name:"",email:"",phone:"",city_id:"",category_id:"",preferred_language:"fr",description:"",budget:"",urgency:"normal",consent:!1}),u=(h,f)=>c(p=>({...p,[h]:f})),d=async()=>{if(!l.consent)return ee.error("Merci d'accepter le traitement de vos données.");o(!0);try{const h=await fetch(Lnt,{method:"POST",headers:{"Content-Type":"application/json",apikey:rne,Authorization:`Bearer ${rne}`},body:JSON.stringify({...l,source_page:window.location.pathname})}),f=await h.json();if(!h.ok)throw new Error(f.error||"Envoi impossible");ee.success("Demande envoyée ! Nous revenons vers vous rapidement."),s(!1),c({first_name:"",email:"",phone:"",city_id:"",category_id:"",preferred_language:"fr",description:"",budget:"",urgency:"normal",consent:!1})}catch(h){ee.error(h.message)}finally{o(!1)}};return a.jsxs(an,{open:r,onOpenChange:s,children:[a.jsx(W_,{asChild:!0,children:n??a.jsx(H,{size:"lg",children:"Demander une recommandation"})}),a.jsxs(nn,{className:"max-h-[90vh] overflow-y-auto sm:max-w-lg",children:[a.jsxs(on,{children:[a.jsx(ln,{children:"Vous cherchez le bon professionnel ?"}),a.jsx(Eu,{children:"Décrivez votre besoin, l'équipe Esprit Sud vous oriente vers un pro francophone de confiance."})]}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(te,{htmlFor:"rec-name",children:"Prénom *"}),a.jsx(ue,{id:"rec-name",value:l.first_name,onChange:h=>u("first_name",h.target.value)})]}),a.jsxs("div",{children:[a.jsx(te,{htmlFor:"rec-email",children:"E-mail *"}),a.jsx(ue,{id:"rec-email",type:"email",value:l.email,onChange:h=>u("email",h.target.value)})]})]}),a.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(te,{htmlFor:"rec-phone",children:"Téléphone"}),a.jsx(ue,{id:"rec-phone",value:l.phone,onChange:h=>u("phone",h.target.value)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Langue préférée"}),a.jsxs(lt,{value:l.preferred_language,onValueChange:h=>u("preferred_language",h),children:[a.jsx(nt,{children:a.jsx(ct,{})}),a.jsxs(rt,{children:[a.jsx(Ae,{value:"fr",children:"Français"}),a.jsx(Ae,{value:"es",children:"Español"}),a.jsx(Ae,{value:"en",children:"English"})]})]})]})]}),a.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(te,{children:"Ville"}),a.jsxs(lt,{value:l.city_id,onValueChange:h=>u("city_id",h),children:[a.jsx(nt,{children:a.jsx(ct,{placeholder:"Choisir une ville"})}),a.jsx(rt,{children:e.map(h=>a.jsx(Ae,{value:h.id,children:h.name},h.id))})]})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Catégorie"}),a.jsxs(lt,{value:l.category_id,onValueChange:h=>u("category_id",h),children:[a.jsx(nt,{children:a.jsx(ct,{placeholder:"Choisir une catégorie"})}),a.jsx(rt,{children:t.map(h=>a.jsxs(Ae,{value:h.id,children:[h.emoji," ",h.name]},h.id))})]})]})]}),a.jsxs("div",{children:[a.jsx(te,{htmlFor:"rec-desc",children:"Votre besoin *"}),a.jsx(fn,{id:"rec-desc",rows:4,value:l.description,onChange:h=>u("description",h.target.value)})]}),a.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(te,{htmlFor:"rec-budget",children:"Budget indicatif"}),a.jsx(ue,{id:"rec-budget",value:l.budget,onChange:h=>u("budget",h.target.value)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Urgence"}),a.jsxs(lt,{value:l.urgency,onValueChange:h=>u("urgency",h),children:[a.jsx(nt,{children:a.jsx(ct,{})}),a.jsxs(rt,{children:[a.jsx(Ae,{value:"flexible",children:"Pas pressé"}),a.jsx(Ae,{value:"normal",children:"Normal"}),a.jsx(Ae,{value:"urgent",children:"Urgent"})]})]})]})]}),a.jsxs("label",{className:"flex items-start gap-2 text-sm text-muted-foreground",children:[a.jsx(wr,{checked:l.consent,onCheckedChange:h=>u("consent",h===!0)}),a.jsx("span",{children:"J'accepte que mes données soient transmises à Esprit Sud pour traiter ma demande."})]})]}),a.jsx(ss,{children:a.jsx(H,{onClick:d,disabled:i,children:i?"Envoi...":"Envoyer ma demande"})})]})]})}function V1e({categories:t,cities:e,className:n}){return a.jsx("section",{className:`rounded-2xl border-2 p-6 sm:p-8 ${n??""}`,style:{borderColor:"#C8962E",backgroundColor:"#FBF6EC"},children:a.jsxs("div",{className:"flex flex-col items-start gap-5 sm:flex-row sm:items-center sm:justify-between",children:[a.jsxs("div",{className:"max-w-xl",children:[a.jsx("h2",{className:"font-serif text-xl font-bold text-foreground sm:text-2xl",children:"ð¤ Vous ne trouvez pas le bon professionnel ?"}),a.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Décrivez votre besoin, on vous aide à trouver la perle rare dans notre réseau."})]}),a.jsx(pI,{categories:t,cities:e,trigger:a.jsx(H,{size:"lg",className:"shrink-0 text-white hover:opacity-90",style:{backgroundColor:"#C8962E"},children:"Faire une demande de recommandation â"})})]})})}function Fnt(t){if(typeof document>"u")return;let e=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",e.appendChild(n),n.styleSheet?n.styleSheet.cssText=t:n.appendChild(document.createTextNode(t))}const H1e=ve.createContext({drawerRef:{current:null},overlayRef:{current:null},onPress:()=>{},onRelease:()=>{},onDrag:()=>{},onNestedDrag:()=>{},onNestedOpenChange:()=>{},onNestedRelease:()=>{}
1029,openProp:void 0,dismissible:!1,isOpen:!1,isDragging:!1,keyboardIsOpen:{current:!1},snapPointsOffset:null,snapPoints:null,handleOnly:!1,modal:!1,shouldFade:!1,activeSnapPoint:null,onOpenChange:()=>{},setActiveSnapPoint:()=>{},closeDrawer:()=>{},direction:"bottom",shouldScaleBackground:!1,setBackgroundColorOnScale:!0,noBodyStyles:!1,container:null,autoFocus:!1}),Vj=()=>{const t=ve.useContext(H1e);if(!t)throw new Error("useDrawerContext must be used within a Drawer.Root");return t};Fnt(`[data-vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1);animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=open]{animation-name:slideFromBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=closed]{animation-name:slideToBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=open]{animation-name:slideFromTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=closed]{animation-name:slideToTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=open]{animation-name:slideFromLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=closed]{animation-name:slideToLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=open]{animation-name:slideFromRight}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=closed]{animation-name:slideToRight}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,100%,0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,-100%,0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(-100%,0,0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(100%,0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-overlay][data-vaul-snap-points=false]{animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-overlay][data-vaul-snap-points=false][data-state=open]{animation-name:fadeIn}[data-vaul-overlay][data-state=closed]{animation-name:fadeOut}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:1}[data-vaul-drawer]:not([data-vaul-custom-container=true])::after{content:'';position:absolute;background:inherit;background-color:inherit}[data-vaul-drawer][data-vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[data-vaul-drawer][data-vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[data-vaul-overlay][data-vaul-snap-points=true]:not([data-vaul-snap-points-overlay=true]):not( 1030[data-state=closed] 1031){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;
1031left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,100%,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,100%,0)}}@keyframes slideFromTop{from{transform:translate3d(0,-100%,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,-100%,0)}}@keyframes slideFromLeft{from{transform:translate3d(-100%,0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(-100%,0,0)}}@keyframes slideFromRight{from{transform:translate3d(100%,0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(100%,0,0)}}`);const $nt=24,znt=typeof window<"u"?b.useLayoutEffect:b.useEffect;function sne(...t){return(...e)=>{for(let n of t)typeof n=="function"&&n(...e)}}function Bnt(){return q7(/^Mac/)}function Unt(){return q7(/^iPhone/)}function ine(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function qnt(){return q7(/^iPad/)||Bnt()&&navigator.maxTouchPoints>1}function W1e(){return Unt()||qnt()}function q7(t){return typeof window<"u"&&window.navigator!=null?t.test(window.navigator.platform):void 0}const R5=typeof document<"u"&&window.visualViewport;function ane(t){let e=window.getComputedStyle(t);return/(auto|scroll)/.test(e.overflow+e.overflowX+e.overflowY)}function K1e(t){for(ane(t)&&(t=t.parentElement);t&&!ane(t);)t=t.parentElement;return t||document.scrollingElement||document.documentElement}const Vnt=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);let yP=0,O5;function Hnt(t={}){let{isDisabled:e}=t;znt(()=>{if(!e)return yP++,yP===1&&W1e()&&(O5=Wnt()),()=>{yP--,yP===0&&(O5==null||O5())}},[e])}function Wnt(){let t,e=0,n=h=>{t=K1e(h.target),!(t===document.documentElement&&t===document.body)&&(e=h.changedTouches[0].pageY)},r=h=>{if(!t||t===document.documentElement||t===document.body){h.preventDefault();return}let f=h.changedTouches[0].pageY,p=t.scrollTop,m=t.scrollHeight-t.clientHeight;m!==0&&((p<=0&&f>e||p>=m&&f<e)&&h.preventDefault(),e=f)},s=h=>{let f=h.target;fq(f)&&f!==document.activeElement&&(h.preventDefault(),f.style.transform="translateY(-2000px)",f.focus(),requestAnimationFrame(()=>{f.style.transform=""}))},i=h=>{let f=h.target;fq(f)&&(f.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{f.style.transform="",R5&&(R5.height<window.innerHeight?requestAnimationFrame(()=>{one(f)}):R5.addEventListener("resize",()=>one(f),{once:!0}))}))},o=()=>{window.scrollTo(0,0)},l=window.pageXOffset,c=window.pageYOffset,u=sne(Knt(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let d=sne(TS(document,"touchstart",n,{passive:!1,capture:!0}),TS(document,"touchmove",r,{passive:!1,capture:!0}),TS(document,"touchend",s,{passive:!1,capture:!0}),TS(document,"focus",i,!0),TS(window,"scroll",o));return()=>{u(),d(),window.scrollTo(l,c)}}function Knt(t,e,n){let r=t.style[e];return t.style[e]=n,()=>{t.style[e]=r}}function TS(t,e,n,r){return t.addEventListener(e,n,r),()=>{t.removeEventListener(e,n,r)}}function one(t){let e=document.scrollingElement||document.documentElement;for(;t&&t!==e;){let n=K1e(t);if(n!==document.documentElement&&n!==document.body&&n!==t){let r=n.getBoundingClientRect().top,s=t.getBoundingClientRect().top,i=t.getBoundingClientRect().bottom;const o=n.getBoundingClientRect().bottom+$nt;i>o&&(n.scrollTop+=s-r)}t=n.parentElement}}function fq(t){return t instanceof HTMLInputElement&&!Vnt.has(t.type)||t instanceof HTMLTextAreaElement||t instanceof HTMLElement&&t.isContentEditable}function Gnt(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function Ynt(...t){return e=>t.forEach(n=>Gnt(n,e))}function G1e(...t){return b.useCallback(Ynt(...t),t)}const Y1e=new WeakMap;function zs(t,e,n=!1){if(!t||!(t instanceof HTMLElement))return;let r={};Object.entries(e).forEach(([s,i])=>{if(s.startsWith("--")){t.style.setProperty(s,i);return}r[s]=t.style[s],t.style[s]=i}),!n&&Y1e.set(t,r)}function Xnt(t,e){if(!t||!(t instanceof HTMLElement))return;let n=Y1e.get(t);n&&(t.style[e]=n[e])}const Bs=t=>{switch(t){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return t}};function bP(t,e){if(!t)return null;const n=window.getComputedStyle(t),r=n.transform||n.webkitTransform||n.mozTransform;let s=r.match(/^matrix3d\((.+)\)$/);return s?parseFloat(s[1].split(", ")[Bs(e)?13:12]):(s=r.match(/^matrix\((.+)\)$/),s?parseFloat(s[1].split(", ")[Bs(e)?5:4]):null)}function Jnt(t){return 8*(Math.log(t+1)-2)}function I5(t,e){if(!t)return()=>{};const n=t.style.cssText;return Object.assign(t.style,e),()=>{t.style.cssText=n}}function Qnt(...t){return(...e)=>{for(const n of t)typeof n=="function"&&n(...e)}}const Or={DURATION:.5,EASE:[.32,.72,0,1]}
1031,X1e=.4,Znt=.25,ert=100,J1e=8,wv=16,pq=26,D5="vaul-dragging";function Q1e(t){const e=ve.useRef(t);return ve.useEffect(()=>{e.current=t}),ve.useMemo(()=>(...n)=>e.current==null?void 0:e.current.call(e,...n),[])}function trt({defaultProp:t,onChange:e}){const n=ve.useState(t),[r]=n,s=ve.useRef(r),i=Q1e(e);return ve.useEffect(()=>{s.current!==r&&(i(r),s.current=r)},[r,s,i]),n}function Z1e({prop:t,defaultProp:e,onChange:n=()=>{}}){const[r,s]=trt({defaultProp:e,onChange:n}),i=t!==void 0,o=i?t:r,l=Q1e(n),c=ve.useCallback(u=>{if(i){const h=typeof u=="function"?u(t):u;h!==t&&l(h)}else s(u)},[i,t,s,l]);return[o,c]}function nrt({activeSnapPointProp:t,setActiveSnapPointProp:e,snapPoints:n,drawerRef:r,overlayRef:s,fadeFromIndex:i,onSnapPointChange:o,direction:l="bottom",container:c,snapToSequentialPoint:u}){const[d,h]=Z1e({prop:t,defaultProp:n==null?void 0:n[0],onChange:e}),[f,p]=ve.useState(typeof window<"u"?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);ve.useEffect(()=>{function C(){p({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener("resize",C),()=>window.removeEventListener("resize",C)},[]);const m=ve.useMemo(()=>d===(n==null?void 0:n[n.length-1])||null,[n,d]),v=ve.useMemo(()=>n==null?void 0:n.findIndex(C=>C===d),[n,d]),x=n&&n.length>0&&(i||i===0)&&!Number.isNaN(i)&&n[i]===d||!n,g=ve.useMemo(()=>{const C=c?{width:c.getBoundingClientRect().width,height:c.getBoundingClientRect().height}:typeof window<"u"?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};var k;return(k=n==null?void 0:n.map(E=>{const P=typeof E=="string";let T=0;if(P&&(T=parseInt(E,10)),Bs(l)){const R=P?T:f?E*C.height:0;return f?l==="bottom"?C.height-R:-C.height+R:R}const M=P?T:f?E*C.width:0;return f?l==="right"?C.width-M:-C.width+M:M}))!=null?k:[]},[n,f,c]),w=ve.useMemo(()=>v!==null?g==null?void 0:g[v]:null,[g,v]),_=ve.useCallback(C=>{var k;const E=(k=g==null?void 0:g.findIndex(P=>P===C))!=null?k:null;o(E),zs(r.current,{transition:`transform ${Or.DURATION}s cubic-bezier(${Or.EASE.join(",")})`,transform:Bs(l)?`translate3d(0, ${C}px, 0)`:`translate3d(${C}px, 0, 0)`}),g&&E!==g.length-1&&E!==i&&E<i?zs(s.current,{transition:`opacity ${Or.DURATION}s cubic-bezier(${Or.EASE.join(",")})`,opacity:"0"}):zs(s.current,{transition:`opacity ${Or.DURATION}s cubic-bezier(${Or.EASE.join(",")})`,opacity:"1"}),h(n==null?void 0:n[Math.max(E,0)])},[r.current,n,g,i,s,h]);ve.useEffect(()=>{if(d||t){var C;const k=(C=n==null?void 0:n.findIndex(E=>E===t||E===d))!=null?C:-1;g&&k!==-1&&typeof g[k]=="number"&&_(g[k])}},[d,t,n,g,_]);function j({draggedDistance:C,closeDrawer:k,velocity:E,dismissible:P}){if(i===void 0)return;const T=l==="bottom"||l==="right"?(w??0)-C:(w??0)+C,M=v===i-1,R=v===0,A=C>0;if(M&&zs(s.current,{transition:`opacity ${Or.DURATION}s cubic-bezier(${Or.EASE.join(",")})`}),!u&&E>2&&!A){P?k():_(g[0]);return}if(!u&&E>2&&A&&g&&n){_(g[n.length-1]);return}const I=g==null?void 0:g.reduce((O,z)=>typeof O!="number"||typeof z!="number"?O:Math.abs(z-T)<Math.abs(O-T)?z:O),D=Bs(l)?window.innerHeight:window.innerWidth;if(E>X1e&&Math.abs(C)<D*.4){const O=A?1:-1;if(O>0&&m){_(g[n.length-1]);return}if(R&&O<0&&P&&k(),v===null)return;_(g[v+O]);return}_(I)}function N({draggedDistance:C}){if(w===null)return;const k=l==="bottom"||l==="right"?w-C:w+C;(l==="bottom"||l==="right")&&k<g[g.length-1]||(l==="top"||l==="left")&&k>g[g.length-1]||zs(r.current,{transform:Bs(l)?`translate3d(0, ${k}px, 0)`:`translate3d(${k}px, 0, 0)`})}function S(C,k){if(!n||typeof v!="number"||!g||i===void 0)return null;const E=v===i-1;if(v>=i&&k)return 0;if(E&&!k)return 1;if(!x&&!E)return null;const T=E?v+1:v-1,M=E?g[T]-g[T-1]:g[T+1]-g[T],R=C/Math.abs(M);return E?1-R:R}return{isLastSnapPoint:m,activeSnapPoint:d,shouldFade:x,getPercentageDragged:S,setActiveSnapPoint:h,activeSnapPointIndex:v,onRelease:j,onDrag:N,snapPointsOffset:g}}const rrt=()=>()=>{};function srt(){const{direction:t,isOpen:e,shouldScaleBackground:n,setBackgroundColorOnScale:r,noBodyStyles:s}=Vj(),i=ve.useRef(null),o=b.useMemo(()=>document.body.style.backgroundColor,[]);function l(){return(window.innerWidth-pq)/window.innerWidth}ve.useEffect(()=>{if(e&&n){i.current&&clearTimeout(i.current);const c=document.querySelector("[data-vaul-drawer-wrapper]")||document.querySelector("[vaul-drawer-wrapper]");if(!c)return;Qnt(r&&!s?I5(document.body,{background:"black"}):rrt,I5(c,{transformOrigin:Bs(t)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:`${Or.DURATION}s`,transitionTimingFunction:`cubic-bezier(${Or.EASE.join(",")})`}));const u=I5(c,{borderRadius:`${J1e}px`,overflow:"hidden",...Bs(t)?{transform:`scale(${l()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`}:{transform:`scale(${l()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`}}
1031);return()=>{u(),i.current=window.setTimeout(()=>{o?document.body.style.background=o:document.body.style.removeProperty("background")},Or.DURATION*1e3)}}},[e,n,o])}let PS=null;function irt({isOpen:t,modal:e,nested:n,hasBeenOpened:r,preventScrollRestoration:s,noBodyStyles:i}){const[o,l]=ve.useState(()=>typeof window<"u"?window.location.href:""),c=ve.useRef(0),u=ve.useCallback(()=>{if(ine()&&PS===null&&t&&!i){PS={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:"unset"};const{scrollX:h,innerHeight:f}=window;document.body.style.setProperty("position","fixed","important"),Object.assign(document.body.style,{top:`${-c.current}px`,left:`${-h}px`,right:"0px",height:"auto"}),window.setTimeout(()=>window.requestAnimationFrame(()=>{const p=f-window.innerHeight;p&&c.current>=f&&(document.body.style.top=`${-(c.current+p)}px`)}),300)}},[t]),d=ve.useCallback(()=>{if(ine()&&PS!==null&&!i){const h=-parseInt(document.body.style.top,10),f=-parseInt(document.body.style.left,10);Object.assign(document.body.style,PS),window.requestAnimationFrame(()=>{if(s&&o!==window.location.href){l(window.location.href);return}window.scrollTo(f,h)}),PS=null}},[o]);return ve.useEffect(()=>{function h(){c.current=window.scrollY}return h(),window.addEventListener("scroll",h),()=>{window.removeEventListener("scroll",h)}},[]),ve.useEffect(()=>{n||!r||(t?(!window.matchMedia("(display-mode: standalone)").matches&&u(),e||window.setTimeout(()=>{d()},500)):d())},[t,r,o,e,n,u,d]),{restorePositionSetting:d}}function e_e({open:t,onOpenChange:e,children:n,onDrag:r,onRelease:s,snapPoints:i,shouldScaleBackground:o=!1,setBackgroundColorOnScale:l=!0,closeThreshold:c=Znt,scrollLockTimeout:u=ert,dismissible:d=!0,handleOnly:h=!1,fadeFromIndex:f=i&&i.length-1,activeSnapPoint:p,setActiveSnapPoint:m,fixed:v,modal:x=!0,onClose:g,nested:w,noBodyStyles:_,direction:j="bottom",defaultOpen:N=!1,disablePreventScroll:S=!0,snapToSequentialPoint:C=!1,preventScrollRestoration:k=!1,repositionInputs:E=!0,onAnimationEnd:P,container:T,autoFocus:M=!1}){var R,A;const[I=!1,D]=Z1e({defaultProp:N,prop:t,onChange:it=>{e==null||e(it),!it&&!w&&Ee(),setTimeout(()=>{P==null||P(it)},Or.DURATION*1e3),it&&!x&&typeof window<"u"&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),it||(document.body.style.pointerEvents="auto")}}),[O,z]=ve.useState(!1),[B,G]=ve.useState(!1),[U,F]=ve.useState(!1),W=ve.useRef(null),Q=ve.useRef(null),K=ve.useRef(null),fe=ve.useRef(null),oe=ve.useRef(null),ye=ve.useRef(!1),le=ve.useRef(null),me=ve.useRef(0),he=ve.useRef(!1),ae=ve.useRef(0),re=ve.useRef(null),L=ve.useRef(((R=re.current)==null?void 0:R.getBoundingClientRect().height)||0),X=ve.useRef(((A=re.current)==null?void 0:A.getBoundingClientRect().width)||0),ne=ve.useRef(0),Y=ve.useCallback(it=>{i&&it===ce.length-1&&(Q.current=new Date)},[]),{activeSnapPoint:J,activeSnapPointIndex:se,setActiveSnapPoint:ge,onRelease:de,snapPointsOffset:ce,onDrag:xe,shouldFade:je,getPercentageDragged:be}=nrt({snapPoints:i,activeSnapPointProp:p,setActiveSnapPointProp:m,drawerRef:re,fadeFromIndex:f,overlayRef:W,onSnapPointChange:Y,direction:j,container:T,snapToSequentialPoint:C});Hnt({isDisabled:!I||B||!x||U||!O||!E||!S});const{restorePositionSetting:Ee}=irt({isOpen:I,modal:x,nested:w,hasBeenOpened:O,preventScrollRestoration:k,noBodyStyles:_});function Me(){return(window.innerWidth-pq)/window.innerWidth}function Oe(it){var pe,Pe;!d&&!i||re.current&&!re.current.contains(it.target)||(L.current=((pe=re.current)==null?void 0:pe.getBoundingClientRect().height)||0,X.current=((Pe=re.current)==null?void 0:Pe.getBoundingClientRect().width)||0,G(!0),K.current=new Date,W1e()&&window.addEventListener("touchend",()=>ye.current=!1,{once:!0}),it.target.setPointerCapture(it.pointerId),me.current=Bs(j)?it.pageY:it.pageX)}function st(it,pe){var Pe,Ze;let qe=it;const Ve=(Pe=window.getSelection())==null?void 0:Pe.toString(),bt=re.current?bP(re.current,j):null,Be=new Date;if(qe.hasAttribute("data-vaul-no-drag")||qe.closest("[data-vaul-no-drag]"))return!1;if(j==="right"||j==="left")return!0;
1031if(Q.current&&Be.getTime()-Q.current.getTime()<500)return!1;if(bt!==null&&(j==="bottom"?bt>0:bt<0))return!0;if(Ve&&Ve.length>0)return!1;if(Be.getTime()-((Ze=oe.current)==null?void 0:Ze.getTime())<u&&bt===0||pe)return oe.current=Be,!1;for(;qe;){if(qe.scrollHeight>qe.clientHeight){if(qe.scrollTop!==0)return oe.current=new Date,!1;if(qe.getAttribute("role")==="dialog")return!0}qe=qe.parentNode}return!0}function Ye(it){if(re.current&&B){const pe=j==="bottom"||j==="right"?1:-1,Pe=(me.current-(Bs(j)?it.pageY:it.pageX))*pe,Ze=Pe>0,qe=i&&!d&&!Ze;if(qe&&se===0)return;const Ve=Math.abs(Pe),bt=document.querySelector("[data-vaul-drawer-wrapper]"),Be=j==="bottom"||j==="top"?L.current:X.current;let Nt=Ve/Be;const Xe=be(Ve,Ze);if(Xe!==null&&(Nt=Xe),qe&&Nt>=1||!ye.current&&!st(it.target,Ze))return;if(re.current.classList.add(D5),ye.current=!0,zs(re.current,{transition:"none"}),zs(W.current,{transition:"none"}),i&&xe({draggedDistance:Pe}),Ze&&!i){const Zt=Jnt(Pe),Sr=Math.min(Zt*-1,0)*pe;zs(re.current,{transform:Bs(j)?`translate3d(0, ${Sr}px, 0)`:`translate3d(${Sr}px, 0, 0)`});return}const Ft=1-Nt;if((je||f&&se===f-1)&&(r==null||r(it,Nt),zs(W.current,{opacity:`${Ft}`,transition:"none"},!0)),bt&&W.current&&o){const Zt=Math.min(Me()+Nt*(1-Me()),1),Sr=8-Nt*8,Ur=Math.max(0,14-Nt*14);zs(bt,{borderRadius:`${Sr}px`,transform:Bs(j)?`scale(${Zt}) translate3d(0, ${Ur}px, 0)`:`scale(${Zt}) translate3d(${Ur}px, 0, 0)`,transition:"none"},!0)}if(!i){const Zt=Ve*pe;zs(re.current,{transform:Bs(j)?`translate3d(0, ${Zt}px, 0)`:`translate3d(${Zt}px, 0, 0)`})}}}ve.useEffect(()=>{var it;function pe(){if(!re.current||!E)return;const Pe=document.activeElement;if(fq(Pe)||he.current){var Ze;const qe=((Ze=window.visualViewport)==null?void 0:Ze.height)||0,Ve=window.innerHeight;let bt=Ve-qe;const Be=re.current.getBoundingClientRect().height||0,Nt=Be>Ve*.8;ne.current||(ne.current=Be);const Xe=re.current.getBoundingClientRect().top;if(Math.abs(ae.current-bt)>60&&(he.current=!he.current),i&&i.length>0&&ce&&se){const Ft=ce[se]||0;bt+=Ft}if(ae.current=bt,Be>qe||he.current){const Ft=re.current.getBoundingClientRect().height;let Zt=Ft;Ft>qe&&(Zt=qe-(Nt?Xe:pq)),v?re.current.style.height=`${Ft-Math.max(bt,0)}px`:re.current.style.height=`${Math.max(Zt,qe-Xe)}px`}else re.current.style.height=`${ne.current}px`;i&&i.length>0&&!he.current?re.current.style.bottom="0px":re.current.style.bottom=`${Math.max(bt,0)}px`}}return(it=window.visualViewport)==null||it.addEventListener("resize",pe),()=>{var Pe;return(Pe=window.visualViewport)==null?void 0:Pe.removeEventListener("resize",pe)}},[se,i,ce]);function gt(it){yt(),g==null||g(),it||D(!1),setTimeout(()=>{i&&ge(i[0])},Or.DURATION*1e3)}function At(){if(!re.current)return;const it=document.querySelector("[data-vaul-drawer-wrapper]"),pe=bP(re.current,j);zs(re.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${Or.DURATION}s cubic-bezier(${Or.EASE.join(",")})`}),zs(W.current,{transition:`opacity ${Or.DURATION}s cubic-bezier(${Or.EASE.join(",")})`,opacity:"1"}),o&&pe&&pe>0&&I&&zs(it,{borderRadius:`${J1e}px`,overflow:"hidden",...Bs(j)?{transform:`scale(${Me()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${Me()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${Or.DURATION}s`,transitionTimingFunction:`cubic-bezier(${Or.EASE.join(",")})`},!0)}function yt(){!B||!re.current||(re.current.classList.remove(D5),ye.current=!1,G(!1),fe.current=new Date)}function Qt(it){if(!B||!re.current)return;re.current.classList.remove(D5),ye.current=!1,G(!1),fe.current=new Date;const pe=bP(re.current,j);
1031if(!st(it.target,!1)||!pe||Number.isNaN(pe)||K.current===null)return;const Pe=fe.current.getTime()-K.current.getTime(),Ze=me.current-(Bs(j)?it.pageY:it.pageX),qe=Math.abs(Ze)/Pe;if(qe>.05&&(F(!0),setTimeout(()=>{F(!1)},200)),i){de({draggedDistance:Ze*(j==="bottom"||j==="right"?1:-1),closeDrawer:gt,velocity:qe,dismissible:d}),s==null||s(it,!0);return}if(j==="bottom"||j==="right"?Ze>0:Ze<0){At(),s==null||s(it,!0);return}if(qe>X1e){gt(),s==null||s(it,!1);return}var Ve;const bt=Math.min((Ve=re.current.getBoundingClientRect().height)!=null?Ve:0,window.innerHeight);var Be;const Nt=Math.min((Be=re.current.getBoundingClientRect().width)!=null?Be:0,window.innerWidth),Xe=j==="left"||j==="right";if(Math.abs(pe)>=(Xe?Nt:bt)*c){gt(),s==null||s(it,!1);return}s==null||s(it,!0),At()}ve.useEffect(()=>(I&&(zs(document.documentElement,{scrollBehavior:"auto"}),Q.current=new Date),()=>{Xnt(document.documentElement,"scrollBehavior")}),[I]);function nr(it){const pe=it?(window.innerWidth-wv)/window.innerWidth:1,Pe=it?-wv:0;le.current&&window.clearTimeout(le.current),zs(re.current,{transition:`transform ${Or.DURATION}s cubic-bezier(${Or.EASE.join(",")})`,transform:`scale(${pe}) translate3d(0, ${Pe}px, 0)`}),!it&&re.current&&(le.current=setTimeout(()=>{const Ze=bP(re.current,j);zs(re.current,{transition:"none",transform:Bs(j)?`translate3d(0, ${Ze}px, 0)`:`translate3d(${Ze}px, 0, 0)`})},500))}function wn(it,pe){if(pe<0)return;const Pe=(window.innerWidth-wv)/window.innerWidth,Ze=Pe+pe*(1-Pe),qe=-wv+pe*wv;zs(re.current,{transform:Bs(j)?`scale(${Ze}) translate3d(0, ${qe}px, 0)`:`scale(${Ze}) translate3d(${qe}px, 0, 0)`,transition:"none"})}function Si(it,pe){const Pe=Bs(j)?window.innerHeight:window.innerWidth,Ze=pe?(Pe-wv)/Pe:1,qe=pe?-wv:0;pe&&zs(re.current,{transition:`transform ${Or.DURATION}s cubic-bezier(${Or.EASE.join(",")})`,transform:Bs(j)?`scale(${Ze}) translate3d(0, ${qe}px, 0)`:`scale(${Ze}) translate3d(${qe}px, 0, 0)`})}return ve.createElement(m3,{defaultOpen:N,onOpenChange:it=>{!d&&!it||(it?z(!0):gt(!0),D(it))},open:I},ve.createElement(H1e.Provider,{value:{activeSnapPoint:J,snapPoints:i,setActiveSnapPoint:ge,drawerRef:re,overlayRef:W,onOpenChange:e,onPress:Oe,onRelease:Qt,onDrag:Ye,dismissible:d,handleOnly:h,isOpen:I,isDragging:B,shouldFade:je,closeDrawer:gt,onNestedDrag:wn,onNestedOpenChange:nr,onNestedRelease:Si,keyboardIsOpen:he,modal:x,snapPointsOffset:ce,direction:j,shouldScaleBackground:o,setBackgroundColorOnScale:l,noBodyStyles:_,container:T,autoFocus:M}},n))}const t_e=ve.forwardRef(function({...t},e){const{overlayRef:n,snapPoints:r,onRelease:s,shouldFade:i,isOpen:o,modal:l}=Vj(),c=G1e(e,n),u=r&&r.length>0;return l?ve.createElement(Mj,{onMouseUp:s,ref:c,"data-vaul-overlay":"","data-vaul-snap-points":o&&u?"true":"false","data-vaul-snap-points-overlay":o&&i?"true":"false",...t}):(typeof window<"u"&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),null)});t_e.displayName="Drawer.Overlay";const n_e=ve.forwardRef(function({onPointerDownOutside:t,style:e,onOpenAutoFocus:n,...r},s){const{drawerRef:i,onPress:o,onRelease:l,onDrag:c,keyboardIsOpen:u,snapPointsOffset:d,modal:h,isOpen:f,direction:p,snapPoints:m,container:v,handleOnly:x,autoFocus:g}=Vj(),[w,_]=ve.useState(!1),j=G1e(s,i),N=ve.useRef(null),S=ve.useRef(null),C=ve.useRef(!1),k=m&&m.length>0;srt();const E=(T,M,R=0)=>{if(C.current)return!0;const A=Math.abs(T.y),I=Math.abs(T.x),D=I>A,O=["bottom","right"].includes(M)?1:-1;if(M==="left"||M==="right"){if(!(T.x*O<0)&&I>=0&&I<=R)return D}else if(!(T.y*O<0)&&A>=0&&A<=R)return!D;return C.current=!0,!0};ve.useEffect(()=>{k&&window.requestAnimationFrame(()=>{_(!0)})},[]);function P(T){N.current=null,C.current=!1,l(T)}return ve.createElement(Rj,{"data-vaul-drawer-direction":p,"data-vaul-drawer":"","data-vaul-delayed-snap-points":w?"true":"false","data-vaul-snap-points":f&&k?"true":"false","data-vaul-custom-container":v?"true":"false",...r,ref:j,style:d&&d.length>0?{"--snap-point-height":`${d[0]}px`,...e}:e,onPointerDown:T=>{x||(r.onPointerDown==null||r.onPointerDown.call(r,T),N.current={x:T.pageX,y:T.pageY},o(T))},onOpenAutoFocus:T=>{n==null||n(T),g||T.preventDefault()},onPointerDownOutside:T=>{if(t==null||t(T),!h||T.defaultPrevented){T.preventDefault();return}u.current&&(u.current=!1)},onFocusOutside:T=>{if(!h){T.preventDefault();return}},onPointerMove:T=>{if(S.current=T,x||(r.onPointerMove==null||r.onPointerMove.call(r,T),!N.current))return;const M=T.pageY-N.current.y,R=T.pageX-N.current.x,A=T.pointerType==="touch"?10:2;E({x:R,y:M},p,A)?c(T):(Math.abs(R)>A||Math.abs(M)>A)&&(N.current=null)},onPointerUp:T=>{r.onPointerUp==null||r.onPointerUp.call(r,T),N.current=null,C.current=!1,l(T)},onPointerOut:T=>{r.onPointerOut==null||r.onPointerOut.call(r,T),P(S.current)},onContextMenu:T=>{r.onContextMenu==null||r.onContextMenu.call(r,T),P(S.current)}})});n_e.displayName="Drawer.Content";const art=250,ort=120,r_e=ve.forwardRef(function({preventCycle:t=!1,children:e,...n},r){const{closeDrawer:s,isDragging:i,snapPoints:o,activeSnapPoint:l,setActiveSnapPoint:c,dismissible:u,handleOnly:d,isOpen:h,onPress:f,onDrag:p}=Vj(),m=ve.useRef(null),v=ve.useRef(!1);function x(){if(v.current){_();return}window.setTimeout(()=>{g()},ort)}function g(){if(i||t||v.current){_();return}if(_(),(!o||o.length===0)&&u){s();return}if(l===o[o.length-1]&&u){s();return}const N=o.findIndex(C=>C===l);if(N===-1)return;const S=o[N+1];c(S)}function w(){m.current=window.setTimeout(()=>{v.current=!0},art)}function _(){window.clearTimeout(m.current),v.current=!1}return ve.createElement("div",{onClick:x,onPointerCancel:_,onPointerDown:j=>{d&&f(j),w()},onPointerMove:j=>{d&&p(j)},ref:r,"data-vaul-drawer-visible":h?"true":"false","data-vaul-handle":"","aria-hidden":"true",...n},ve.createElement("span",{"data-vaul-handle-hitarea":"","aria-hidden":"true"},e))});r_e.displayName="Drawer.Handle";function lrt({onDrag:t,onOpenChange:e,...n}){const{onNestedDrag:r,onNestedOpenChange:s,onNestedRelease:i}=Vj();if(!r)throw new Error("Drawer.NestedRoot must be placed in another drawer");return ve.createElement(e_e,{nested:!0,onClose:()=>{s(!1)},onDrag:(o,l)=>{r(o,l),t==null||t(o,l)},onOpenChange:o=>{o&&s(o)},onRelease:i,...n})}function crt(t){const e=Vj(),{container:n=e.container,...r}=t;return ve.createElement(v3,{container:n,...r})}const Hu={Root:e_e,NestedRoot:lrt,Content:n_e,Overlay:t_e,Trigger:g3,Portal:crt,Handle:r_e,Close:o2,Title:Oj,Description:Ij}
1031,s_e=({shouldScaleBackground:t=!0,...e})=>a.jsx(Hu.Root,{shouldScaleBackground:t,...e});s_e.displayName="Drawer";const urt=Hu.Trigger,drt=Hu.Portal,hrt=Hu.Close,i_e=b.forwardRef(({className:t,...e},n)=>a.jsx(Hu.Overlay,{ref:n,className:Fe("fixed inset-0 z-50 bg-black/80",t),...e}));i_e.displayName=Hu.Overlay.displayName;const a_e=b.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(drt,{children:[a.jsx(i_e,{}),a.jsxs(Hu.Content,{ref:r,className:Fe("fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background",t),...n,children:[a.jsx("div",{className:"mx-auto mt-4 h-2 w-[100px] rounded-full bg-muted"}),e]})]}));a_e.displayName="DrawerContent";const o_e=({className:t,...e})=>a.jsx("div",{className:Fe("grid gap-1.5 p-4 text-center sm:text-left",t),...e});o_e.displayName="DrawerHeader";const l_e=({className:t,...e})=>a.jsx("div",{className:Fe("mt-auto flex flex-col gap-2 p-4",t),...e});l_e.displayName="DrawerFooter";const c_e=b.forwardRef(({className:t,...e},n)=>a.jsx(Hu.Title,{ref:n,className:Fe("text-lg font-semibold leading-none tracking-tight",t),...e}));c_e.displayName=Hu.Title.displayName;const frt=b.forwardRef(({className:t,...e},n)=>a.jsx(Hu.Description,{ref:n,className:Fe("text-sm text-muted-foreground",t),...e}));frt.displayName=Hu.Description.displayName;function prt({categories:t,cities:e,value:n,onApply:r,onReset:s}){const[i,o]=b.useState(!1),[l,c]=b.useState(n);b.useEffect(()=>{i&&c(n)},[i,n]);const u=[n.city,n.categoryId,n.language].filter(d=>d!=="all").length;return a.jsxs(s_e,{open:i,onOpenChange:o,children:[a.jsx(urt,{asChild:!0,children:a.jsxs(H,{size:"lg",className:"fixed bottom-4 left-1/2 z-40 -translate-x-1/2 shadow-lg md:hidden",children:[a.jsx(v5e,{className:"mr-2 h-4 w-4"}),"Filtrer & Trier",u?` (${u})`:""]})}),a.jsxs(a_e,{children:[a.jsx(o_e,{children:a.jsx(c_e,{className:"font-serif",children:"Filtrer & Trier"})}),a.jsxs("div",{className:"space-y-4 px-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"mb-1 block text-sm font-medium",children:"Ville"}),a.jsxs(lt,{value:l.city,onValueChange:d=>c({...l,city:d}),children:[a.jsx(nt,{children:a.jsx(ct,{})}),a.jsxs(rt,{children:[a.jsx(Ae,{value:"all",children:"Toutes les villes"}),e.map(d=>a.jsx(Ae,{value:d.name,children:d.name},d.id))]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"mb-1 block text-sm font-medium",children:"Catégorie"}),a.jsxs(lt,{value:l.categoryId,onValueChange:d=>c({...l,categoryId:d}),children:[a.jsx(nt,{children:a.jsx(ct,{})}),a.jsxs(rt,{children:[a.jsx(Ae,{value:"all",children:"Toutes les catégories"}),t.map(d=>a.jsxs(Ae,{value:d.id,children:[d.emoji," ",d.name]},d.id))]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"mb-1 block text-sm font-medium",children:"Langue parlée"}),a.jsxs(lt,{value:l.language,onValueChange:d=>c({...l,language:d}),children:[a.jsx(nt,{children:a.jsx(ct,{})}),a.jsxs(rt,{children:[a.jsx(Ae,{value:"all",children:"Toutes les langues"}),B7.map(d=>a.jsx(Ae,{value:d.value,children:d.label},d.value))]})]})]})]}),a.jsxs(l_e,{children:[a.jsx(H,{onClick:()=>{r(l),o(!1)},children:"Appliquer les filtres"}),a.jsx(hrt,{asChild:!0,children:a.jsx(H,{variant:"ghost",onClick:s,children:"Réinitialiser"})})]})]})]})}const mrt=b.lazy(()=>Ac(()=>import("./BusinessMap-CkCkF-bE.js"),__vite__mapDeps([0,1])));function grt(){const[t,e]=b.useState(""),[n,r]=b.useState("all"),[s,i]=b.useState("all"),[o,l]=b.useState("all"),[c,u]=b.useState("fr"),[d,h]=b.useState("list"),{data:f=[]}=Ne({queryKey:["business-categories"],queryFn:$7}),{data:p=[]}=Ne({queryKey:["directory-cities"],queryFn:q1e}),m=b.useMemo(()=>({search:t.trim()||void 0,city:n==="all"?void 0:n,categoryId:s==="all"?void 0:s,language:o==="all"?void 0:o}),[t,n,s,o]),{data:v,isLoading:x}=Ne({queryKey:["directory-profiles",m],queryFn:()=>U1e(m)}
1031),g=(v==null?void 0:v.data)??[],w=()=>{e(""),r("all"),i("all"),l("all")};return a.jsxs(a.Fragment,{children:[a.jsx(Fn,{title:"Carnet d'adresses des Pros â Annuaire francophone en Andalousie",description:"Trouvez un professionnel francophone en Andalousie : immobilier, santé, travaux, juridique, restauration. Fiches vérifiées par Esprit Sud Magazine.",path:"/annuaire"}),a.jsx("section",{className:"bg-primary/5 py-12",children:a.jsxs("div",{className:"container",children:[a.jsx("h1",{className:"font-serif text-4xl font-bold",children:"Carnet d'adresses des Pros"}),a.jsx("p",{className:"mt-3 max-w-2xl text-muted-foreground",children:"L'annuaire des professionnels francophones d'Andalousie, sélectionnés et vérifiés par la rédaction d'Esprit Sud Magazine."}),a.jsxs("div",{className:"mt-6 flex flex-wrap gap-3",children:[a.jsx(pI,{categories:f,cities:p}),a.jsx(H,{variant:"outline",asChild:!0,children:a.jsx("a",{href:"/espace-pro/ma-fiche",children:"Inscrire mon entreprise"})})]})]})}),a.jsxs("section",{className:"container py-8 pb-24 md:pb-8",children:[a.jsx(Qi,{value:d,onValueChange:_=>h(_),className:"mb-5",children:a.jsxs(wi,{children:[a.jsxs(wt,{value:"list",className:"gap-2",children:[a.jsx(Lfe,{className:"h-4 w-4"})," Liste"]}),a.jsxs(wt,{value:"map",className:"gap-2",children:[a.jsx(r5e,{className:"h-4 w-4"})," Carte"]})]})}),a.jsxs("div",{className:"grid gap-3 md:grid-cols-5",children:[a.jsxs("div",{className:"relative md:col-span-2",children:[a.jsx(is,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(ue,{className:"pl-9",placeholder:"Rechercher un pro, un service...",value:t,onChange:_=>e(_.target.value)})]}),a.jsxs(lt,{value:s,onValueChange:i,children:[a.jsx(nt,{className:"hidden md:flex",children:a.jsx(ct,{placeholder:"Choisir une catégorie"})}),a.jsxs(rt,{children:[a.jsx(Ae,{value:"all",children:"Choisir une catégorie"}),f.map(_=>a.jsxs(Ae,{value:_.id,children:[_.emoji," ",_.name]},_.id))]})]}),a.jsxs(lt,{value:n,onValueChange:r,children:[a.jsx(nt,{className:"hidden md:flex",children:a.jsx(ct,{placeholder:"Toutes les villes"})}),a.jsxs(rt,{children:[a.jsx(Ae,{value:"all",children:"Toutes les villes"}),p.map(_=>a.jsx(Ae,{value:_.name,children:_.name},_.id))]})]}),a.jsxs(lt,{value:o,onValueChange:l,children:[a.jsx(nt,{className:"hidden md:flex",children:a.jsx(ct,{placeholder:"Toutes les langues"})}),a.jsxs(rt,{children:[a.jsx(Ae,{value:"all",children:"Toutes les langues"}),B7.map(_=>a.jsx(Ae,{value:_.value,children:_.label},_.value))]})]})]}),a.jsxs("div",{className:"mt-4 flex flex-wrap items-center justify-between gap-3 text-sm text-muted-foreground",children:[a.jsx("span",{children:x?"Chargement...":`${(v==null?void 0:v.total)??0} professionnel(s)`}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(H,{variant:"ghost",size:"sm",className:"hidden md:inline-flex",onClick:w,children:"Réinitialiser"}),a.jsxs(lt,{value:c,onValueChange:_=>u(_),children:[a.jsx(nt,{className:"h-8 w-[130px]",children:a.jsx(ct,{})}),a.jsxs(rt,{children:[a.jsx(Ae,{value:"fr",children:"ð«ð· Français"}),a.jsx(Ae,{value:"es",children:"ðªð¸ Español"}),a.jsx(Ae,{value:"en",children:"ð¬ð§ English"})]})]})]})]}),d==="map"?a.jsxs("div",{className:"fixed inset-0 z-50 bg-background p-3 pt-16 md:static md:mt-6 md:p-0",children:[a.jsx(H,{variant:"secondary",size:"sm",className:"absolute left-3 top-3 z-[1000] md:hidden",onClick:()=>h("list"),children:"â Retour à la liste"}),a.jsx(b.Suspense,{fallback:a.jsx(Xt,{className:"h-full w-full rounded-xl md:h-[600px]"}),children:a.jsx(mrt,{profiles:g,categories:f,lang:c,className:"h-full w-full md:h-[600px]"})})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"mt-6 grid gap-6 sm:grid-cols-2 lg:grid-cols-3",children:x?Array.from({length:6}).map((_,j)=>a.jsx(Xt,{className:"h-80 rounded-xl"},j)):g.map(_=>a.jsx(Dnt,{profile:_,categories:f,lang:c},_.id))}),!x&&g.length===0&&a.jsxs("div",{className:"rounded-xl border border-dashed p-10 text-center",children:[a.jsx("p",{className:"text-muted-foreground",children:"Aucun professionnel ne correspond à votre recherche."}),a.jsx("div",{className:"mt-4",children:a.jsx(pI,{categories:f,cities:p})})]}),a.jsx(V1e,{categories:f,cities:p,className:"mt-12"})]}),d==="list"&&a.jsx(prt,{categories:f,cities:p,value:{city:n,categoryId:s,language:o},onApply:_=>{r(_.city),i(_.categoryId),l(_.language)},onReset:w})]})]})}const Ke=b.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:Fe("rounded-lg border bg-card text-card-foreground shadow-sm",t),...e}));
1031Ke.displayName="Card";const Vt=b.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:Fe("flex flex-col space-y-1.5 p-6",t),...e}));Vt.displayName="CardHeader";const Ht=b.forwardRef(({className:t,...e},n)=>a.jsx("h3",{ref:n,className:Fe("text-2xl font-semibold leading-none tracking-tight",t),...e}));Ht.displayName="CardTitle";const mi=b.forwardRef(({className:t,...e},n)=>a.jsx("p",{ref:n,className:Fe("text-sm text-muted-foreground",t),...e}));mi.displayName="CardDescription";const ut=b.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:Fe("p-6 pt-0",t),...e}));ut.displayName="CardContent";const vrt=b.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:Fe("flex items-center p-6 pt-0",t),...e}));vrt.displayName="CardFooter";const u_e="carousel",V7="controller",xrt="navigation",yrt="no-scroll",H7="portal",brt="root",d_e="toolbar",wrt="counter",L5="loading",F5="error",$5="complete",_rt="placeholder",jrt=t=>`active-slide-${t}`,h_e="flex_center",Srt="no_scroll",f_e="no_scroll_padding",W7="slide",Nrt="slide_wrapper",Hv="prev",Wv="next",lne="swipe",Q_="close",p_e="onPointerDown",m_e="onPointerMove",g_e="onPointerUp",v_e="onPointerLeave",x_e="onPointerCancel",y_e="onKeyDown",Crt="onKeyUp",b_e="onWheel",krt="Escape",Art="ArrowLeft",Ert="ArrowRight",Trt="button",mq="icon",w_e="contain",cne="cover",Prt="Unknown action type",__e="yarl__";function th(...t){return t.filter(Boolean).join(" ")}function Nn(t){return`${__e}${t}`}function Fo(t){return`--${__e}${t}`}function P2(t,e){return`${t}${e?`_${e}`:""}`}function K7(t){return e=>P2(t,e)}function Z_(t,e){var n;return(n=t==null?void 0:t[e])!==null&&n!==void 0?n:e}function Mrt(t,e,n){return Z_(t,"{index} of {total}").replace(/\{index}/g,`${G7(n,e.length)+1}`).replace(/\{total}/g,`${e.length}`)}function j_e(...t){return()=>{t.forEach(e=>{e()})}}function pp(t,e,n){return()=>{const r=b.useContext(n);if(!r)throw new Error(`${t} must be used within a ${e}.Provider`);return r}}function S_e(){return typeof window<"u"}function Rrt(t,e=0){const n=10**e;return Math.round((t+Number.EPSILON)*n)/n}function N_e(t){return t.type===void 0||t.type==="image"}function Ort(t,e){return t.imageFit===cne||t.imageFit!==w_e&&e===cne}function o4(t){return typeof t=="string"?Number.parseInt(t,10):t}function mI(t){if(typeof t=="number")return{pixel:t};if(typeof t=="string"){const e=o4(t);return t.endsWith("%")?{percent:e}:{pixel:e}}return{pixel:0}}function Irt(t,e){const n=mI(e),r=n.percent!==void 0?t.width/100*n.percent:n.pixel;return{width:Math.max(t.width-2*r,0),height:Math.max(t.height-2*r,0)}}function G7(t,e){return e>0?(t%e+e)%e:0}function C_e(t){return t.length>0}function k_e(t,e){return t[G7(e,t.length)]}function gq(t,e){return C_e(t)?k_e(t,e):void 0}function Drt(t){return N_e(t)?t.src:void 0}function Lrt(t,e,n=0){return Math.min(t.preload,Math.max(t.finite?e.length-1:Math.floor(e.length/2),n))}const Frt=Number(b.version.split(".")[0])>=19;function $rt(t){return{inert:Frt?t:t?"":void 0}}function zrt(t){t.scrollTop}const vq={open:!1,close:()=>{},index:0,slides:[],render:{},plugins:[],toolbar:{buttons:[Q_]},labels:{},animation:{fade:250,swipe:500,easing:{fade:"ease",swipe:"ease-out",navigation:"ease-in-out"}},carousel:{finite:!1,preload:2,padding:"16px",spacing:"30%",imageFit:w_e,imageProps:{}},controller:{ref:null,focus:!0,aria:!1,touchAction:"none",closeOnPullUp:!1,closeOnPullDown:!1,closeOnBackdropClick:!1,closeOnEscape:!0,preventDefaultWheelX:!0,preventDefaultWheelY:!1,disableSwipeNavigation:!1},portal:{},noScroll:{disabled:!1},on:{},styles:{},className:""};function av(t,e){return{name:t,component:e}}function di(t,e){return{module:t,children:e}}function A_e(t,e,n){return t.module.name===e?n(t):t.children?[di(t.module,t.children.flatMap(r=>{var s;return(s=A_e(r,e,n))!==null&&s!==void 0?s:[]}))]:[t]}function db(t,e,n){return t.flatMap(r=>{var s;return(s=A_e(r,e,n))!==null&&s!==void 0?s:[]})}function Brt(t,e=[],n=[]){let r=t;const s=p=>{const m=[...r];for(;m.length>0;){const v=m.pop();if((v==null?void 0:v.module.name)===p)return!0;v!=null&&v.children&&m.push(...v.children)}return!1},i=(p,m)=>{if(p===""){r=[di(m,r)];return}r=db(r,p,v=>[di(m,[v])])},o=(p,m)=>{r=db(r,p,v=>[di(v.module,[di(m,v.children)])])},l=(p,m,v)=>{r=db(r,p,x=>{var g;return[di(x.module,[...v?[di(m)]:[],...(g=x.children)!==null&&g!==void 0?g:[],...v?[]:[di(m)]])]})},c=(p,m,v)=>{r=db(r,p,x=>[...v?[di(m)]:[],x,...v?[]:[di(m)]])},u=p=>{o(V7,p)},d=(p,m)=>{r=db(r,p,v=>[di(m,v.children)])},h=p=>{r=db(r,p,m=>m.children)},f=p=>{n.push(p)};return e.forEach(p=>{p({contains:s,addParent:i,append:o,addChild:l,addSibling:c,addM
1031odule:u,replace:d,remove:h,augment:f})}),{config:r,augmentation:p=>n.reduce((m,v)=>v(m),p)}}const E_e=b.createContext(null),T_e=pp("useA11yContext","A11yContext",E_e);function Urt({children:t}){const[e,n]=b.useState(!1),[r,s]=b.useState(!1),i=b.useMemo(()=>({focusWithin:e,trackFocusWithin:(l,c)=>{const u=d=>h=>{var f;h.currentTarget.contains(h.relatedTarget)||n(d),(f=d?l:c)===null||f===void 0||f(h)};return{onFocus:u(!0),onBlur:u(!1)}},autoPlaying:r,setAutoPlaying:s}),[e,r]);return b.createElement(E_e.Provider,{value:i},t)}const P_e=b.createContext(null),Y7=pp("useDocument","DocumentContext",P_e);function qrt({nodeRef:t,children:e}){const n=b.useMemo(()=>{const r=i=>{var o;return((o=i||t.current)===null||o===void 0?void 0:o.ownerDocument)||document};return{getOwnerDocument:r,getOwnerWindow:i=>{var o;return((o=r(i))===null||o===void 0?void 0:o.defaultView)||window}}},[t]);return b.createElement(P_e.Provider,{value:n},e)}const M_e=b.createContext(null),l4=pp("useEvents","EventsContext",M_e);function Vrt({children:t}){const[e]=b.useState({});b.useEffect(()=>()=>{Object.keys(e).forEach(r=>delete e[r])},[e]);const n=b.useMemo(()=>{const r=(o,l)=>{var c;(c=e[o])===null||c===void 0||c.splice(0,e[o].length,...e[o].filter(u=>u!==l))};return{publish:(...[o,l])=>{var c;(c=e[o])===null||c===void 0||c.forEach(u=>u(l))},subscribe:(o,l)=>(e[o]||(e[o]=[]),e[o].push(l),()=>r(o,l)),unsubscribe:r}},[e]);return b.createElement(M_e.Provider,{value:n},t)}const R_e=b.createContext(null),M2=pp("useLightboxProps","LightboxPropsContext",R_e);function Hrt({children:t,...e}){return b.createElement(R_e.Provider,{value:e},t)}const O_e=b.createContext(null),R2=pp("useLightboxState","LightboxStateContext",O_e),I_e=b.createContext(null),Wrt=pp("useLightboxDispatch","LightboxDispatchContext",I_e);function Krt(t,e){switch(e.type){case"swipe":{const{slides:n}=t,r=(e==null?void 0:e.increment)||0,s=t.globalIndex+r,i=G7(s,n.length),o=gq(n,i),l=r||e.duration!==void 0?{increment:r,duration:e.duration,easing:e.easing}:void 0;return{slides:n,currentIndex:i,globalIndex:s,currentSlide:o,animation:l}}case"update":return e.slides!==t.slides||e.index!==t.currentIndex?{slides:e.slides,currentIndex:e.index,globalIndex:e.index,currentSlide:gq(e.slides,e.index)}:t;default:throw new Error(Prt)}}function Grt({slides:t,index:e,children:n}){const[r,s]=b.useReducer(Krt,{slides:t,currentIndex:e,globalIndex:e,currentSlide:gq(t,e)}),[i,o]=b.useState(t),[l,c]=b.useState(e);(t!==i||e!==l)&&(o(t),c(e),s({type:"update",slides:t,index:e}));const u=b.useMemo(()=>({...r,state:r,dispatch:s}),[r,s]);return b.createElement(I_e.Provider,{value:s},b.createElement(O_e.Provider,{value:u},n))}const D_e=b.createContext(null),Yrt=pp("useRTLContext","RTLContext",D_e);function Xrt({isRTL:t,children:e}){const n=b.useMemo(()=>({isRTL:t}),[t]);return b.createElement(D_e.Provider,{value:n},e)}const L_e=b.createContext(null),c4=pp("useTimeouts","TimeoutsContext",L_e);function Jrt({children:t}){const[e]=b.useState([]);b.useEffect(()=>()=>{e.forEach(r=>window.clearTimeout(r)),e.splice(0,e.length)},[e]);const n=b.useMemo(()=>{const r=o=>{e.splice(0,e.length,...e.filter(l=>l!==o))};return{setTimeout:(o,l)=>{const c=window.setTimeout(()=>{r(c),o()},l);return e.push(c),c},clearTimeout:o=>{o!==void 0&&(r(o),window.clearTimeout(o))}}},[e]);return b.createElement(L_e.Provider,{value:n},t)}const F_e=b.forwardRef(function({label:e,className:n,icon:r,renderIcon:s,onClick:i,style:o,...l},c){const{styles:u,labels:d}=M2(),h=Z_(d,e);return b.createElement("button",{ref:c,type:"button",title:h,"aria-label":h,className:th(Nn(Trt),n),onClick:i,style:{...o,...u.button},...l},s?s():b.createElement(r,{className:Nn(mq),style:u.icon}))});function Qrt(t,e){const n=r=>b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":"true",focusable:"false",...r},e);return n.displayName=t,n}function O2(t,e){return Qrt(t,b.createElement("g",{fill:"currentColor"},b.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),e))}const Zrt=O2("Close",b.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})),est=O2("Previous",b.createElement("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})),tst=O2("Next",b.createElement("path",{d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})),nst=O2("Loading",b.createElement(b.Fragment,null,Array.from({length:8}).map((t,e,n)=>b.createElement("line",{key:e,x1:"12",y1:"6.5",x2:"12",y2:"1.8",strokeLinecap:"round",strokeWidth:"2.6",stroke:"currentColor",strokeOpacity:1/n.length*(e+1),transform:`rotate(${360/n.length*e}, 12, 12)`})))),rst=O2("Error",b.createElement("path",{d:"M21.9,21.9l-8.49-8.49l0,0L3.59,3.59l0,0L2.1,2.1L0.69,3.51L3,5.83V19c0,1.1,0.9,2,2,2h13.17l2.31,2.31L21.9,21.9z M5,18 l3.5-4.5l2.5,3.01L12.17,15l3,3H5z M21,18.17L5.83,3H19c1.1,0,2,0.9,2,2V18.17z"})),u4=S_e()?b.useLayoutEffect:b.useEffect;function $_e(){const[t,e]=b.useState(!1);return b.useEffect(()=>{var n,r;const s=(n=window.matchMedia)===null||n===void 0?void 0:n.call(window,"(prefers-reduced-motion: reduce)");e(s==null?void 0:s.matches);const i=o=>e(o.matches);return(r=s==null?void 0:s.addEventListener)===null||r===void 0||r.call(s,"change",i
1031),()=>{var o;return(o=s==null?void 0:s.removeEventListener)===null||o===void 0?void 0:o.call(s,"change",i)}},[]),t}function sst(t){let e=0,n=0,r=0;const i=window.getComputedStyle(t).transform.match(/matrix.*\((.+)\)/);if(i){const o=i[1].split(",").map(o4);o.length===6?(e=o[4],n=o[5]):o.length===16&&(e=o[12],n=o[13],r=o[14])}return{x:e,y:n,z:r}}function une(t,e){const n=b.useRef(void 0),r=b.useRef(void 0),s=$_e();return u4(()=>{var i,o,l;if(t.current&&n.current!==void 0&&!s){const{keyframes:c,duration:u,easing:d,onfinish:h}=e(n.current,t.current.getBoundingClientRect(),sst(t.current))||{};if(c&&u){(i=r.current)===null||i===void 0||i.cancel(),r.current=void 0;try{r.current=(l=(o=t.current).animate)===null||l===void 0?void 0:l.call(o,c,{duration:u,easing:d})}catch(f){console.error(f)}r.current&&(r.current.onfinish=()=>{r.current=void 0,h==null||h()})}}n.current=void 0}),{prepareAnimation:i=>{n.current=i},isAnimationPlaying:()=>{var i;return((i=r.current)===null||i===void 0?void 0:i.playState)==="running"}}}function z_e(){const t=b.useRef(null),e=b.useRef(void 0),[n,r]=b.useState();return{setContainerRef:b.useCallback(i=>{t.current=i,e.current&&(e.current.disconnect(),e.current=void 0);const o=()=>{if(i){const l=window.getComputedStyle(i),c=u=>parseFloat(u)||0;r({width:Math.round(i.clientWidth-c(l.paddingLeft)-c(l.paddingRight)),height:Math.round(i.clientHeight-c(l.paddingTop)-c(l.paddingBottom))})}else r(void 0)};o(),i&&typeof ResizeObserver<"u"&&(e.current=new ResizeObserver(o),e.current.observe(i))},[]),containerRef:t,containerRect:n}}function SR(){const t=b.useRef(void 0),{setTimeout:e,clearTimeout:n}=c4();return b.useCallback((r,s)=>{n(t.current),t.current=e(r,s>0?s:0)},[e,n])}function vs(t){const e=b.useRef(t);return u4(()=>{e.current=t}),b.useCallback((...n)=>{var r;return(r=e.current)===null||r===void 0?void 0:r.call(e,...n)},[])}function dne(t,e){typeof t=="function"?t(e):t&&(t.current=e)}function xq(t,e){return b.useMemo(()=>t==null&&e==null?null:n=>{dne(t,n),dne(e,n)},[t,e])}function ist(t,e=!1){const n=b.useRef(!1);u4(()=>{e&&n.current&&(n.current=!1,t())},[e,t]);const r=b.useCallback(()=>{n.current=!0},[]),s=b.useCallback(()=>{n.current=!1},[]);return{onFocus:r,onBlur:s}}function X7(){return Yrt().isRTL}function ast(){const[t]=b.useState({}),e=b.useCallback((s,i)=>{var o;(o=t[s])===null||o===void 0||o.forEach(l=>{i.isPropagationStopped()||l(i)})},[t]),n=b.useMemo(()=>({onPointerDown:s=>e(p_e,s),onPointerMove:s=>e(m_e,s),onPointerUp:s=>e(g_e,s),onPointerLeave:s=>e(v_e,s),onPointerCancel:s=>e(x_e,s),onKeyDown:s=>e(y_e,s),onKeyUp:s=>e(Crt,s),onWheel:s=>e(b_e,s)}),[e]),r=b.useCallback((s,i)=>(t[s]||(t[s]=[]),t[s].unshift(i),()=>{const o=t[s];o&&o.splice(0,o.length,...o.filter(l=>l!==i))}),[t]);return{registerSensors:n,subscribeSensors:r}}function hne(t,e){const n=b.useRef(0),r=SR(),s=vs((...i)=>{n.current=Date.now(),t(...i)});return b.useCallback((...i)=>{r(()=>{s(...i)},e-(Date.now()-n.current))},[e,s,r])}const z5=K7("slide"),B5=K7("slide_image");function ost({slide:t,offset:e,render:n,rect:r,imageFit:s,imageProps:i,onClick:o,onLoad:l,onError:c,style:u}){var d,h,f,p,m,v,x,g;const[w,_]=b.useState(L5),{publish:j}=l4(),{setTimeout:N}=c4(),S=b.useRef(null);b.useEffect(()=>{e===0&&j(jrt(w))},[e,w,j]);const C=vs(F=>{("decode"in F?F.decode():Promise.resolve()).catch(()=>{}).then(()=>{F.parentNode&&(_($5),N(()=>{l==null||l(F)},0))})}),k=b.useCallback(F=>{S.current=F,F!=null&&F.complete&&C(F)},[C]),E=b.useCallback(F=>{C(F.currentTarget)},[C]),P=vs(()=>{_(F5),c==null||c()}),T=Ort(t,s),M=(F,W)=>Number.isFinite(F)?F:W,R=M(Math.max(...((h=(d=t.srcSet)===null||d===void 0?void 0:d.map(F=>F.width))!==null&&h!==void 0?h:[]).concat(t.width?[t.width]:[]).filter(Boolean)),((f=S.current)===null||f===void 0?void 0:f.naturalWidth)||0),A=M(Math.max(...((m=(p=t.srcSet)===null||p===void 0?void 0:p.map(F=>F.height))!==null&&m!==void 0?m:[]).concat(t.height?[t.height]:[]).filter(Boolean)),((v=S.current)===null||v===void 0?void 0:v.naturalHeight)||0),I=R&&A?{maxWidth:`min(${R}px, 100%)`,maxHeight:`min(${A}px, 100%)`}:{maxWidth:"100%",maxHeight:"100%"},D=(x=t.srcSet)===null||x===void 0?void 0:x.slice().sort((F,W)=>F.width-W.width).map(F=>`${F.src} ${F.width}w`).join(", "),O=()=>r&&!T&&t.width&&t.height?r.height/t.height*t.width:Number.MAX_VALUE,z=D&&r&&S_e()?`${Math.round(Math.min(O(),r.width))}px`:void 0,{style:B,className:G,...U}=(typeof i=="function"?i(t):i)||{};return b.createElement(b.Fragment,null,b.createElement("img",{ref:k,onLoad:E,onError:P,onClick:o,draggable:!1,
1031className:th(Nn(B5()),T&&Nn(B5("cover")),w!==$5&&Nn(B5("loading")),G),style:{...I,...u,...B},...U,alt:(g=t.alt)!==null&&g!==void 0?g:"",sizes:z,srcSet:D,src:t.src}),w!==$5&&b.createElement("div",{className:Nn(z5(_rt))},w===L5&&(n!=null&&n.iconLoading?n.iconLoading():b.createElement(nst,{className:th(Nn(mq),Nn(z5(L5)))})),w===F5&&(n!=null&&n.iconError?n.iconError():b.createElement(rst,{className:th(Nn(mq),Nn(z5(F5)))}))))}const lst=b.forwardRef(function({className:e,children:n,onFocus:r,onBlur:s,...i},o){const l=b.useRef(null),[c,u]=b.useState(!1),{trackFocusWithin:d}=T_e(),h=vs(()=>{if(l.current){const f=window.getComputedStyle(l.current).direction==="rtl";f!==c&&u(f)}});return b.useEffect(h),b.createElement(qrt,{nodeRef:l},b.createElement(Xrt,{isRTL:c},b.createElement("div",{ref:xq(o,l),className:th(Nn("root"),e),...d(r,s),...i},n)))});var ma;(function(t){t[t.NONE=0]="NONE",t[t.SWIPE=1]="SWIPE",t[t.PULL=2]="PULL",t[t.ANIMATION=3]="ANIMATION"})(ma||(ma={}));function cst(t,e,n,r,s){b.useEffect(()=>j_e(t(p_e,e),t(m_e,n),t(g_e,r),t(v_e,r),t(x_e,r)),[t,e,n,r,s])}var Qc;(function(t){t[t.NONE=0]="NONE",t[t.SWIPE=1]="SWIPE",t[t.PULL=2]="PULL"})(Qc||(Qc={}));const U5=30;function ust({disableSwipeNavigation:t,closeOnBackdropClick:e},n,r,s,i,o,l,c,u,d,h,f,p,m,v,x){const g=b.useRef(0),w=b.useRef([]),_=b.useRef(void 0),j=b.useRef(0),N=b.useRef(Qc.NONE),S=b.useCallback(R=>{_.current===R.pointerId&&(_.current=void 0,N.current=Qc.NONE);const A=w.current;A.splice(0,A.length,...A.filter(I=>I.pointerId!==R.pointerId))},[]),C=b.useCallback(R=>{S(R),R.persist(),w.current.push(R)},[S]),k=b.useCallback(R=>w.current.find(({pointerId:A})=>R.pointerId===A),[]),E=vs(R=>{C(R)}),P=(R,A)=>h&&R>A||d&&R<-A,T=vs(R=>{const A=k(R);if(A)if(_.current===R.pointerId){const I=Date.now()-j.current,D=g.current;N.current===Qc.SWIPE?Math.abs(D)>.3*s||Math.abs(D)>5&&I<i?c(D,I):u(D):N.current===Qc.PULL&&(P(D,2*U5)?m(D,I):v(D)),g.current=0,N.current=Qc.NONE}else{const{target:I}=R;e&&I instanceof HTMLElement&&I===A.target&&(I.classList.contains(Nn(W7))||I.classList.contains(Nn(Nrt)))&&x()}S(R)}),M=vs(R=>{const A=k(R);if(A){const I=_.current===R.pointerId;if(R.buttons===0){I&&g.current!==0?T(R):S(A);return}const D=R.clientX-A.clientX,O=R.clientY-A.clientY;if(_.current===void 0){const z=B=>{C(R),_.current=R.pointerId,j.current=Date.now(),N.current=B};Math.abs(D)>Math.abs(O)&&Math.abs(D)>U5&&r(D)?t||(z(Qc.SWIPE),o()):Math.abs(O)>Math.abs(D)&&P(O,U5)&&(z(Qc.PULL),f())}else I&&(N.current===Qc.SWIPE?(g.current=D,l(D)):N.current===Qc.PULL&&(g.current=O,p(O)))}});cst(n,E,M,T)}function dst({preventDefaultWheelX:t,preventDefaultWheelY:e}){const n=b.useRef(null),r=vs(s=>{const i=Math.abs(s.deltaX)>Math.abs(s.deltaY);(i&&t||!i&&e||s.ctrlKey)&&s.preventDefault()});return b.useCallback(s=>{var i;s?s.addEventListener("wheel",r,{passive:!1}):(i=n.current)===null||i===void 0||i.removeEventListener("wheel",r),n.current=s},[r])}function hst(t,e,n,r,s,i,o,l,c){const u=b.useRef(0),d=b.useRef(0),h=b.useRef(void 0),f=b.useRef(void 0),p=b.useRef(0),m=b.useRef(void 0),v=b.useRef(0),{setTimeout:x,clearTimeout:g}=c4(),w=b.useCallback(()=>{h.current&&(g(h.current),h.current=void 0)},[g]),_=b.useCallback(()=>{f.current&&(g(f.current),f.current=void 0)},[g]),j=vs(()=>{t!==ma.SWIPE&&(u.current=0,v.current=0,w(),_())});b.useEffect(j,[t,j]);const N=vs(C=>{f.current=void 0,u.current===C&&c(u.current)}),S=vs(C=>{if(C.ctrlKey||Math.abs(C.deltaY)>Math.abs(C.deltaX))return;const k=E=>{p.current=E,g(m.current),m.current=E>0?x(()=>{p.current=0,m.current=void 0},300):void 0};if(t===ma.NONE){if(Math.abs(C.deltaX)<=1.2*Math.abs(p.current)){k(C.deltaX);return}if(!n(-C.deltaX))return;if(d.current+=C.deltaX,w(),Math.abs(d.current)>30)d.current=0,k(0),v.current=Date.now(),i();else{const E=d.current;h.current=x(()=>{h.current=void 0,E===d.current&&(d.current=0)},s)}}else if(t===ma.SWIPE){let E=u.current-C.deltaX;if(E=Math.min(Math.abs(E),r)*Math.sign(E),u.current=E,o(E),_(),Math.abs(E)>.2*r){k(C.deltaX),l(E,Date.now()-v.current);return}f.current=x(()=>N(E),2*s)}else k(C.deltaX)});b.useEffect(()=>
1031e(b_e,S),[e,S])}const fne=K7("container"),B_e=b.createContext(null),I2=pp("useController","ControllerContext",B_e);function fst({children:t,...e}){var n;const{carousel:r,animation:s,controller:i,on:o,styles:l,render:c}=e,{closeOnPullUp:u,closeOnPullDown:d,preventDefaultWheelX:h,preventDefaultWheelY:f}=i,[p,m]=b.useState(),v=R2(),x=Wrt(),[g,w]=b.useState(ma.NONE),_=b.useRef(0),j=b.useRef(0),N=b.useRef(1),{registerSensors:S,subscribeSensors:C}=ast(),{subscribe:k,publish:E}=l4(),P=SR(),T=SR(),M=SR(),{containerRef:R,setContainerRef:A,containerRect:I}=z_e(),D=xq(dst({preventDefaultWheelX:h,preventDefaultWheelY:f}),A),O=b.useRef(null),z=xq(O,void 0),{getOwnerDocument:B}=Y7(),G=X7(),U=de=>(G?-1:1)*(typeof de=="number"?de:1),F=vs(()=>{var de;return(de=R.current)===null||de===void 0?void 0:de.focus()}),W=vs(()=>e),Q=vs(()=>v),K=b.useCallback(de=>E(Hv,de),[E]),fe=b.useCallback(de=>E(Wv,de),[E]),oe=b.useCallback(()=>E(Q_),[E]),ye=de=>!(r.finite&&(U(de)>0&&v.currentIndex===0||U(de)<0&&v.currentIndex===v.slides.length-1)),le=de=>{var ce;_.current=de,(ce=R.current)===null||ce===void 0||ce.style.setProperty(Fo("swipe_offset"),`${Math.round(de)}px`)},me=de=>{var ce,xe;j.current=de,N.current=(()=>{const Ee=d&&de>0?de:u&&de<0?-de:0;return Math.min(Math.max(Rrt(1-Ee/60*(1-.5),2),.5),1)})(),(ce=R.current)===null||ce===void 0||ce.style.setProperty(Fo("pull_offset"),`${Math.round(de)}px`),(xe=R.current)===null||xe===void 0||xe.style.setProperty(Fo("pull_opacity"),`${N.current}`)},{prepareAnimation:he}=une(O,(de,ce,xe)=>{if(O.current&&I)return{keyframes:[{transform:`translate(0, ${de.rect.y-ce.y+xe.y}px)`,opacity:de.opacity},{transform:"translate(0, 0)",opacity:1}],duration:de.duration,easing:s.easing.fade}}),ae=(de,ce)=>{if(u||d){me(de);let xe=0;O.current&&(xe=s.fade*(ce?2:1),he({rect:O.current.getBoundingClientRect(),opacity:N.current,duration:xe})),M(()=>{me(0),w(ma.NONE)},xe),w(ma.ANIMATION),ce||oe()}},{prepareAnimation:re,isAnimationPlaying:L}=une(O,(de,ce,xe)=>{var je;if(O.current&&I&&(!((je=v.animation)===null||je===void 0)&&je.duration)){const be=mI(r.spacing),Ee=(be.percent?be.percent*I.width/100:be.pixel)||0;return{keyframes:[{transform:`translate(${U(v.globalIndex-de.index)*(I.width+Ee)+de.rect.x-ce.x+xe.x}px, 0)`},{transform:"translate(0, 0)"}],duration:v.animation.duration,easing:v.animation.easing}}}),X=vs(de=>{var ce,xe;const je=de.offset||0,be=je?s.swipe:(ce=s.navigation)!==null&&ce!==void 0?ce:s.swipe,Ee=!je&&!L()?s.easing.navigation:s.easing.swipe;let{direction:Me}=de;const Oe=(xe=de.count)!==null&&xe!==void 0?xe:1;let st=ma.ANIMATION,Ye=be*Oe;if(!Me){const At=I==null?void 0:I.width,yt=de.duration||0,Qt=At?be/At*Math.abs(je):be;Oe!==0?(yt<Qt?Ye=Ye/Qt*Math.max(yt,Qt/5):At&&(Ye=be/At*(At-Math.abs(je))),Me=U(je)>0?Hv:Wv):Ye=be/2}let gt=0;Me===Hv?ye(U(1))?gt=-Oe:(st=ma.NONE,Ye=be):Me===Wv&&(ye(U(-1))?gt=Oe:(st=ma.NONE,Ye=be)),Ye=Math.round(Ye),T(()=>{le(0),w(ma.NONE)},Ye),O.current&&re({rect:O.current.getBoundingClientRect(),index:v.globalIndex}),w(st),E(lne,{type:"swipe",increment:gt,duration:Ye,easing:Ee})});b.useEffect(()=>{var de,ce;!((de=v.animation)===null||de===void 0)&&de.increment&&(!((ce=v.animation)===null||ce===void 0)&&ce.duration)&&P(()=>x({type:"swipe",increment:0}),v.animation.duration)},[v.animation,x,P]);const ne=[C,ye,(I==null?void 0:I.width)||0,s.swipe,()=>w(ma.SWIPE),de=>le(de),(de,ce)=>X({offset:de,duration:ce,count:1}),de=>X({offset:de,count:0})],Y=[()=>{d&&w(ma.PULL)},de=>me(de),de=>ae(de),de=>ae(de,!0)];ust(i,...ne,u,d,...Y,oe),hst(g,...ne);const J=vs(()=>{i.focus&&B().querySelector(`.${Nn(H7)} .${Nn(fne())}`)&&F()});b.useEffect(J,[J]);const se=vs(()=>{var de;(de=o.view)===null||de===void 0||de.call(o,{index:v.currentIndex})});b.useEffect(se,[v.globalIndex,se]),b.useEffect(()=>j_e(k(Hv,de=>X({direction:Hv,...de})),k(Wv,de=>X({direction:Wv,...de})),k(lne,de=>x(de))),[k,X,x]);const ge=b.useMemo(()=>({prev:K,next:fe,close:oe,focus:F,slideRect:I?Irt(I,r.padding):{width:0,height:0},containerRect:I||{width:0,height:0},subscribeSensors:C,containerRef:R,setCarouselRef:z,toolbarWidth:p,setToolbarWidth:m}),[K,fe,oe,F,C,I,R,z,p,m,r.padding]);return b.useImperativeHandle(i.ref,()=>({prev:K,next:fe,close:oe,focus:F,getLightboxProps:W,getLightboxState:Q}),[K,fe,oe,F,W,Q]),b.createElement("div",{ref:D,className:th(Nn(fne()),Nn(h_e)),style:{...g===ma.SWIPE?{[Fo("swipe_offset")]:`${Math.round(_.current)}px`}:null,...g===ma.PULL?{[Fo("pull_offset")]:`${Math.round(j.current)}px`,[Fo("pull_opacity")]:`${N.current}`}:null,...i.touchAction!=="none"?{[Fo("controller_touch_action")]:i.touchAction}:null,...l.container},tabIndex:-1,...S},I&&b.createElement(B_e.Provider,{value:ge},t,(n=c.controls)===null||n===void 0?void 0:n.call(c)))}const pst=av(V7,fst);function _v(t){return P2(u_e,t)}function pne(t){return P2(W7,t)}function mst({slide:t,offset:e}){const n=b.useRef(null),{currentIndex:r,slides:s}=R2(),{slideRect:i,focus:o}=I2(),{render:l,carousel:{imageFit:c,imageProps:u},on:{click:d},styles:{slide:h},labels:f}=M2(),{getOwnerDocument:p}=Y7(),m=e!==0;b.useEffect(()=>{var x;m&&(!((x=n.current)===null||x===void 0)&&x.contains(p().activeElement))&&o()},[m,o,p]);const v=()=>{var x,g,w,_;let j=(x=l.slide)===null||x===void 0?void 0:x.call(l,{slide:t,offset:e,rect:i});return!j&&N_e(t)&&(j=b.createElement(ost,{slide:t,offset:e,render:l,rect:i,imageFit:c,imageProps:u,onClick:m?void 0:()=>d==null?void 0:d({index:r})})),j?b.createElement(b.Fragment,null,(g=l.slideHeader)===null||g===void 0?void 0:g.call(l,{slide:t}),((w=l.slideContainer)!==null&&w!==void 0?w:({children:N})=>N)({slide:t,children:j}),(_=l.slideFooter)===null||_===void 0?void 0:_.call(l,{slide:t})):null};return b.createElement("div",{ref:n,className:th(Nn(pne()),!m&&Nn(pne("current")),Nn(h_e)),...$rt(m),style:h,role:"group","aria-roledescription":Z_(f,"Slide"),"aria-label":Mrt(f,s,r+e)},v())}function gst(){const t=M2().styles.slide;return b.createElement("div",{className:Nn(W7),style:t})}function vst({carousel:t,labels:e}){const{slides:n,currentIndex:r,globalIndex:s}=R2(),{setCarouselRef:i}=I2(),{autoPlaying:o,focusWithin:l}=T_e(),c=mI(t.spacing),u=mI(t.padding),d=Lrt(t,n,1),h=[];if(C_e(n))for(let f=r-d;f<=r+d;f+=1){const p=k_e(n,f),m=s-r+f,v=t.finite&&(f<0||f>n.length-1);h.push(v?{key:m}:{key:[`${m}
1031`,Drt(p)].filter(Boolean).join("|"),offset:f-r,slide:p})}return b.createElement("div",{ref:i,className:th(Nn(_v()),h.length>0&&Nn(_v("with_slides"))),style:{[`${Fo(_v("slides_count"))}`]:h.length,[`${Fo(_v("spacing_px"))}`]:c.pixel||0,[`${Fo(_v("spacing_percent"))}`]:c.percent||0,[`${Fo(_v("padding_px"))}`]:u.pixel||0,[`${Fo(_v("padding_percent"))}`]:u.percent||0},role:"region","aria-live":o&&!l?"off":"polite","aria-roledescription":Z_(e,"Carousel"),"aria-label":Z_(e,"Photo gallery")},h.map(({key:f,slide:p,offset:m})=>p?b.createElement(mst,{key:f,slide:p,offset:m}):b.createElement(gst,{key:f})))}const xst=av(u_e,vst);function U_e(){const{carousel:t}=M2(),{slides:e,currentIndex:n}=R2(),r=e.length===0||t.finite&&n===0,s=e.length===0||t.finite&&n===e.length-1;return{prevDisabled:r,nextDisabled:s}}function yst(t){var e;const n=X7(),{publish:r}=l4(),{animation:s,controller:i}=M2(),{prevDisabled:o,nextDisabled:l}=U_e(),c=((e=s.navigation)!==null&&e!==void 0?e:s.swipe)/2,u=hne(()=>r(Hv),c),d=hne(()=>r(Wv),c),h=vs(f=>{switch(f.key){case krt:if(!i.closeOnEscape)return;r(Q_);break;case Art:(n?l:o)||(n?d:u)();break;case Ert:(n?o:l)||(n?u:d)();break;default:return}f.stopPropagation()});b.useEffect(()=>t(y_e,h),[t,h])}function mne({label:t,icon:e,renderIcon:n,action:r,onClick:s,disabled:i,style:o}){return b.createElement(F_e,{label:t,icon:e,renderIcon:n,className:Nn(`navigation_${r}`),disabled:i,onClick:s,style:o,...ist(I2().focus,i)})}function bst({render:{buttonPrev:t,buttonNext:e,iconPrev:n,iconNext:r},styles:s}){const{prev:i,next:o,subscribeSensors:l}=I2(),{prevDisabled:c,nextDisabled:u}=U_e();return yst(l),b.createElement(b.Fragment,null,t?t():b.createElement(mne,{label:"Previous",action:Hv,icon:est,renderIcon:n,style:s.navigationPrev,disabled:c,onClick:i}),e?e():b.createElement(mne,{label:"Next",action:Wv,icon:tst,renderIcon:r,style:s.navigationNext,disabled:u,onClick:o}))}const wst=av(xrt,bst),gne=Nn(Srt),_st=Nn(f_e);function jst(t){return"style"in t}function vne(t,e,n){const r=window.getComputedStyle(t),s=n?"padding-left":"padding-right",i=n?r.paddingLeft:r.paddingRight,o=t.style.getPropertyValue(s);return t.style.setProperty(s,`${(o4(i)||0)+e}px`),()=>{o?t.style.setProperty(s,o):t.style.removeProperty(s)}}function Sst({noScroll:{disabled:t},children:e}){const n=X7(),{getOwnerDocument:r,getOwnerWindow:s}=Y7();return b.useEffect(()=>{if(t)return()=>{};const i=[],o=s(),{body:l,documentElement:c}=r(),u=Math.round(o.innerWidth-c.clientWidth);if(u>0){i.push(vne(l,u,n));const d=l.getElementsByTagName("*");for(let h=0;h<d.length;h+=1){const f=d[h];jst(f)&&o.getComputedStyle(f).getPropertyValue("position")==="fixed"&&!f.classList.contains(_st)&&i.push(vne(f,u,n))}}return l.classList.add(gne),()=>{l.classList.remove(gne),i.forEach(d=>d())}},[n,t,r,s]),b.createElement(b.Fragment,null,e)}const Nst=av(yrt,Sst);function xne(t){return P2(H7,t)}function yne(t,e,n){const r=t.getAttribute(e);return t.setAttribute(e,n),()=>{r?t.setAttribute(e,r):t.removeAttribute(e)}}function Cst({portal:{root:t,container:{className:e,style:n,...r}={}},animation:s,styles:i,className:o,on:l,close:c,labels:u,children:d}){const[h,f]=b.useState(!1),[p,m]=b.useState(!1),v=b.useRef([]),x=b.useRef(null),{setTimeout:g}=c4(),{subscribe:w}=l4(),j=$_e()?0:s.fade;b.useEffect(()=>(f(!0),()=>{f(!1),m(!1)}),[]);const N=vs(()=>{v.current.forEach(E=>E()),v.current=[]}),S=vs(()=>{var E;m(!1),N(),(E=l.exiting)===null||E===void 0||E.call(l),g(()=>{var P;(P=l.exited)===null||P===void 0||P.call(l),c()},j)});b.useEffect(()=>w(Q_,S),[w,S]);const C=vs(E=>{var P,T,M;zrt(E),m(!0),(P=l.entering)===null||P===void 0||P.call(l);const R=(M=(T=E.parentNode)===null||T===void 0?void 0:T.children)!==null&&M!==void 0?M:[];for(let A=0;A<R.length;A+=1){const I=R[A];["TEMPLATE","SCRIPT","STYLE"].indexOf(I.tagName)===-1&&I!==E&&(v.current.push(yne(I,"inert","")),v.current.push(yne(I,"aria-hidden","true")))}v.current.push(()=>{var A,I;(I=(A=x.current)===null||A===void 0?void 0:A.focus)===null||I===void 0||I.call(A)}),g(()=>{var A;(A=l.entered)===null||A===void 0||A.call(l)},j)}),k=b.useCallback(E=>{E?C(E):N()},[C,N]);return h?Lc.createPortal(b.createElement(lst,{ref:k,className:th(o,e,Nn(xne()),Nn(f_e),p&&Nn(xne("open"))),"aria-modal":!0,role:"dialog","aria-label":Z_(u,"Lightbox"),style:{...s.fade!==vq.animation.fade?{[Fo("fade_animation_duration")]:`${j}ms`}:null,...s.easing.fade!==vq.animation.easing.fade?{[Fo("fade_animation_timing_function")]:s.easing.fade}:null,...i.root,...n},onFocus:E=>{x.current||(x.current=E.relatedTarget)},...r},d),(typeof t=="function"?t():t)||document.body):null}const kst=av(H7,Cst);function Ast({children:t}){return b.createElement(b.Fragment,null,t)}const Est=av(brt,Ast);function Tst(t){return P2(d_e,t)}function Pst({toolbar:{buttons:t},render:{buttonClose:e,iconClose:n},styles:r}){const{close:s,setToolbarWidth:i}=I2(),{setContainerRef:o,containerRect:l}=z_e();u4(()=>{i(l==null?void 0:l.width)},[i,l==null?void 0:l.width]);const c=()=>e?e():b.createElement(F_e,{key:Q_,label:"Close",icon:Zrt,renderIcon:n,onClick:s});return b.createElement("div",{ref:o,style:r.toolbar,className:Nn(Tst())},t==null?void 0:t.map(u=>u===Q_?c():u))}const Mst=av(d_e,Pst);function q_e(t,e){var n;return b.createElement(t.module.component,{key:t.module.name,...e},(n=t.children)===null||n===void 0?void 0:n.map(r=>q_e(r,e)))}function Rst(t,e={}){const{easing:n,...r}=t,{easing:s,...i}=e;return{easing:{...n,...s},...r,...i}}function Ost({carousel:t,animation:e,render:n,toolbar:r,controller:s,noScroll:i,on:o,plugins:l,slides:c,index:u,...d}){const{animation:h,carousel:f,render:p,toolbar:m,controller:v,noScroll:x,on:g,slides:w,index:_,plugins:j,...N}=vq,{config:S,augmentation:C}=Brt([di(kst,[di(Nst,[di(pst,[di(xst),di(Mst),di(wst)])])])],l||j),k=C({animation:Rst(h,e),carousel:{...f,...t},render:{...p,...n},toolbar:{...m,...r},controller:{...v,...s},noScroll:{...x,...i},on:{...g,...o},...N,...d});return k.open?b.createElement(Hrt,{...k},b.createElement(Grt,{slides:c||w,index:o4(u||_)},b.createElement(Jrt,null,b.createElement(Vrt,null,b.createElement(Urt,null,q_e(di(Est,S),k)))))):null}const Ist={separator:"/",container:{}},V_e=t=>({...Ist,...t});function Dst({counter:t}){const{slides:e,currentIndex:n}=R2(),{separator:r,container:{className:s,...i},className:o,...l}=V_e(t);return e.length===0?null:b.createElement("div",{className:th(Nn("counter"),s||o),...l,...i,"aria-hidden":!0},n+1," ",r," ",e.length)}function Lst({augment:t,addChild:e}){t(({counter:n,...r})=>({counter:V_e(n),...r})),e(V7,av(wrt,Dst))}function Fst({photos:t,alt:e}){const[n,r]=b.useState(-1);if(!t.length)return null;const[s,...i]=t;return a.jsxs("div",{className:"mt-6",children:[a.jsx("button",{type:"button",onClick:()=>r(0),className:"block w-full overflow-hidden rounded-xl","aria-label":"Agrandir la photo principale",children:a.jsx("img",{src:s,alt:`${e} â photo principale`,className:"aspect-[16/10] w-full object-cover transition-transform duration-300 hover:scale-[1.02]"})}),i.length>0&&a.jsx("div",{className:"mt-3 flex gap-3 overflow-x-auto pb-2",children:i.map((o,l)=>a.jsx("button",{type:"button",onClick:()=>r(l+1),className:"h-20 w-28 shrink-0 overflow-hidden rounded-lg border","aria-label":`Agrandir la photo ${l+2}`,children:a.jsx("img",{src:o,alt:`${e} ${l+2}`,loading:"lazy",className:"h-full w-full object-cover"})},o+l))}),a.jsx(Ost,{open:n>=0,index:Math.max(n,0),close:()=>r(-1),slides:t.map(o=>({src:o})),plugins:[Lst],controller:{closeOnBackdropClick:!0},styles:{container:{backgroundColor:"rgba(0,0,0,.9)"}}})]})}function $st(t){const e=t.filter(s=>s.curated_by_admin),n=t.filter(s=>!s.curated_by_admin),r=s=>[...s].sort(()=>Math.random()-.5);return[...r(e),...r(n)].slice(0,3)}function zst({categoryId:t,currentId:e,categories:n,lang:r}){const{data:s}=Ne({queryKey:["directory-similar",t],queryFn:()=>U1e({categoryId:t}),enabled:!!t}),i=$st(((s==null?void 0:s.data)??[]).filter(o=>o.id!==e));return i.length?a.jsxs("section",{className:"mt-12",children:[a.jsx("h2",{className:"font-serif text-2xl font-bold",children:"Ils pourraient aussi vous intéresser"}),a.jsx("div",{className:"mt-5 grid gap-5 sm:grid-cols-2 lg:grid-cols-3",children:i.map(o=>{var u;const l=n.find(d=>d.id===(o.business_category_id||o.category_id)),c=((u=o.photos)==null?void 0:u[0])||o.logo_url;return a.jsxs(_e,{to:`/annuaire/${o.slug}`,className:"group flex gap-3 overflow-hidden rounded-xl border bg-card p-3 transition-shadow hover:shadow-md",children:[a.jsx("div",{className:"h-20 w-20 shrink-0 overflow-hidden rounded-lg bg-muted",children:c?a.jsx("img",{src:c,alt:o.organization_name,loading:"lazy",className:"h-full w-full object-cover transition-transform group-hover:scale-105"}):a.jsx("div",{className:"flex h-full w-full items-center justify-center text-2xl",children:(l==null?void 0:l.emoji)??"ð"})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"font-serif text-sm font-semibold leading-tight",children:o.organization_name}),l&&a.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:[l.emoji," ",z7(l,r)]}),o.city&&a.jsxs("p",{className:"mt-1 inline-flex items-center gap-1 text-xs text-muted-foreground",children:[a.jsx(_r,{className:"h-3 w-3"})," ",o.city]})]})]},o.id)})})]}):null}function Bst(){var m,v,x,g,w;const{slug:t=""}=Xi(),e=St(),{lang:n}=Uu(),r=n==="en",s=b.useRef(!1),i=_=>r&&_.organization_name_en||_.organization_name,o=_=>r&&_.description_en||_.description,{data:l,isLoading:c}=Ne({queryKey:["directory-profile",t],queryFn:()=>Int(t),enabled:!!t}),{data:u=[]}=Ne({queryKey:["business-categories"],queryFn:$7}),{data:d=[]}=Ne({queryKey:["directory-cities"],queryFn:q1e}),h=r&&!!(l!=null&&l.id)&&!l.description_en;if(b.useEffect(()=>{!h||s.current||(s.current=!0,(async()=>{try{await Z.functions.invoke("translate-to-english",{body:{type:"partner_profile",id:l.id}}
1031),e.invalidateQueries({queryKey:["directory-profile",t]})}catch(_){console.warn("[i18n] traduction de la fiche pro échouée",_)}})())},[h,l==null?void 0:l.id,t,e]),c)return a.jsx("div",{className:"container py-12",children:a.jsx(Xt,{className:"h-96 w-full rounded-xl"})});if(!l)return a.jsxs("div",{className:"container py-16 text-center",children:[a.jsx("h1",{className:"font-serif text-3xl font-bold",children:"Fiche introuvable"}),a.jsx("p",{className:"mt-2 text-muted-foreground",children:"Cette fiche n'est pas (ou plus) publiée dans notre annuaire."}),a.jsx(H,{className:"mt-6",asChild:!0,children:a.jsx(_e,{to:"/annuaire",children:"Retour à l'annuaire"})})]});const f=u.find(_=>_.id===(l.business_category_id||l.category_id)),p=l.opening_hours??null;return a.jsxs(a.Fragment,{children:[a.jsx(Fn,{title:`${i(l)} â Carnet d'adresses des Pros`,description:((m=o(l))==null?void 0:m.slice(0,155))||`${i(l)}, professionnel francophone en Andalousie.`,path:`/annuaire/${l.slug}`,image:((v=l.photos)==null?void 0:v[0])||l.logo_url,jsonLd:{"@context":"https://schema.org","@type":"LocalBusiness",name:i(l),description:o(l)??void 0,image:((x=l.photos)==null?void 0:x[0])||l.logo_url||void 0,url:l.website??void 0,telephone:l.phone??void 0,address:l.city?{"@type":"PostalAddress",streetAddress:l.address??void 0,postalCode:l.postal_code??void 0,addressLocality:l.city,addressCountry:l.country??"ES"}:void 0}}),a.jsxs("div",{className:"container py-8",children:[a.jsxs(_e,{to:"/annuaire",className:"mb-6 inline-flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground",children:[a.jsx(jr,{className:"h-4 w-4"})," Retour à l'annuaire"]}),a.jsxs("div",{className:"grid gap-8 lg:grid-cols-[2fr_1fr]",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[a.jsx("h1",{className:"font-serif text-3xl font-bold",children:i(l)}),l.is_verified&&a.jsxs(ke,{className:"gap-1",children:[a.jsx(EW,{className:"h-4 w-4"})," Vérifié"]}),l.esprit_sud_partner&&a.jsx(ke,{variant:"outline",children:"Partenaire Esprit Sud"})]}),a.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[f&&a.jsxs(ke,{variant:"secondary",children:[f.emoji," ",z7(f,r?"en":"fr")]}),(g=l.languages_spoken)==null?void 0:g.map(_=>a.jsx(ke,{variant:"outline",className:"uppercase",children:_},_))]}),(w=l.photos)!=null&&w.length?a.jsx(Fst,{photos:l.photos,alt:i(l)}):null,o(l)&&a.jsx("div",{className:"prose mt-6 max-w-none",children:o(l).split(` 1032`).map((_,j)=>a.jsx("p",{children:_},j))}),l.video_embed_code&&a.jsx("div",{className:"mt-6 [&_iframe]:aspect-video [&_iframe]:w-full [&_iframe]:rounded-lg",dangerouslySetInnerHTML:{__html:a0(l.video_embed_code)}})]}),a.jsxs("aside",{className:"space-y-4",children:[a.jsx(Ke,{children:a.jsxs(ut,{className:"space-y-3 p-5 text-sm",children:[a.jsx("h2",{className:"font-serif text-lg font-semibold",children:"Contact"}),l.phone&&a.jsxs("a",{href:`tel:${l.phone}`,className:"flex items-center gap-2 hover:text-primary",children:[a.jsx(hk,{className:"h-4 w-4"})," ",l.phone]}),l.phone2&&a.jsxs("a",{href:`tel:${l.phone2}`,className:"flex items-center gap-2 hover:text-primary",children:[a.jsx(hk,{className:"h-4 w-4"})," ",l.phone2]}),l.contact_email&&a.jsxs("a",{href:`mailto:${l.contact_email}`,className:"flex items-center gap-2 hover:text-primary",children:[a.jsx(Ru,{className:"h-4 w-4"})," ",l.contact_email]}),l.website&&a.jsxs("a",{href:l.website,target:"_blank",rel:"noopener noreferrer nofollow",className:"flex items-center gap-2 hover:text-primary",children:[a.jsx(ZL,{className:"h-4 w-4"})," Site web"]}),(l.address||l.city)&&a.jsxs("p",{className:"flex items-start gap-2",children:[a.jsx(_r,{className:"mt-0.5 h-4 w-4 shrink-0"}),a.jsxs("span",{children:[l.address&&a.jsxs(a.Fragment,{children:[l.address,a.jsx("br",{})]}),[l.postal_code,l.city].filter(Boolean).join(" ")]})]}),l.no_physical_office&&l.service_area&&a.jsxs("p",{className:"text-muted-foreground",children:["Zone d'intervention : ",l.service_area]}),!l.phone&&!l.contact_email&&!l.website&&a.jsx("p",{className:"text-muted-foreground",children:"Ce professionnel ne diffuse pas ses coordonnées publiquement. Demandez une mise en relation."})]})}),p&&a.jsx(Ke,{children:a.jsxs(ut,{className:"space-y-1 p-5 text-sm",children:[a.jsx("h2",{className:"mb-2 font-serif text-lg font-semibold",children:"Horaires"}),U7.map(({key:_,label:j})=>{const N=p[_];return a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{children:j}),a.jsx("span",{className:"text-muted-foreground",children:!N||N.closed?"Fermé":`${N.open??"â"} â ${N.close??"â"}`})]},_)})]})}),a.jsx(Ke,{children:a.jsxs(ut,{className:"space-y-3 p-5",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Besoin d'aide pour choisir ? La rédaction vous oriente gratuitement."}),a.jsx(pI,{categories:u,cities:d,trigger:a.jsx(H,{className:"w-full",children:"Ãtre mis en relation"})})]})})]})]}),a.jsx(zst,{categoryId:l.business_category_id||l.category_id,currentId:l.id,categories:u,lang:r?"en":"fr"}),a.jsx(V1e,{categories:u,cities:d,className:"mt-12"})]})]})}function Ust(t,e){return e.forEach(function(n){n&&typeof n!="str
1032ing"&&!Array.isArray(n)&&Object.keys(n).forEach(function(r){if(r!=="default"&&!(r in t)){var s=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:function(){return n[r]}})}})}),Object.freeze(t)}function H_e(t,e){return new Promise(function(n,r){let s;return qst(t).then(function(i){try{return s=i,n(new Blob([e.slice(0,2),s,e.slice(2)],{type:"image/jpeg"}))}catch(o){return r(o)}},r)})}const qst=t=>new Promise((e,n)=>{const r=new FileReader;r.addEventListener("load",({target:{result:s}})=>{const i=new DataView(s);let o=0;if(i.getUint16(o)!==65496)return n("not a valid JPEG");for(o+=2;;){const l=i.getUint16(o);if(l===65498)break;const c=i.getUint16(o+2);if(l===65505&&i.getUint32(o+4)===1165519206){const u=o+10;let d;switch(i.getUint16(u)){case 18761:d=!0;break;case 19789:d=!1;break;default:return n("TIFF header contains invalid endian")}if(i.getUint16(u+2,d)!==42)return n("TIFF header contains invalid version");const h=i.getUint32(u+4,d),f=u+h+2+12*i.getUint16(u+h,d);for(let p=u+h+2;p<f;p+=12)if(i.getUint16(p,d)==274){if(i.getUint16(p+2,d)!==3)return n("Orientation data type is invalid");if(i.getUint32(p+4,d)!==1)return n("Orientation data count is invalid");i.setUint16(p+8,1,d);break}return e(s.slice(o,o+2+c))}o+=2+c}return e(new Blob)}),r.readAsArrayBuffer(t)});var gI={},Vst={get exports(){return gI},set exports(t){gI=t}};(function(t){var e,n,r={};Vst.exports=r,r.parse=function(s,i){for(var o=r.bin.readUshort,l=r.bin.readUint,c=0,u={},d=new Uint8Array(s),h=d.length-4;l(d,h)!=101010256;)h--;c=h,c+=4;var f=o(d,c+=4);o(d,c+=2);var p=l(d,c+=2),m=l(d,c+=4);c+=4,c=m;for(var v=0;v<f;v++){l(d,c),c+=4,c+=4,c+=4,l(d,c+=4),p=l(d,c+=4);var x=l(d,c+=4),g=o(d,c+=4),w=o(d,c+2),_=o(d,c+4);c+=6;var j=l(d,c+=8);c+=4,c+=g+w+_,r._readLocal(d,j,u,p,x,i)}return u},r._readLocal=function(s,i,o,l,c,u){var d=r.bin.readUshort,h=r.bin.readUint;h(s,i),d(s,i+=4),d(s,i+=2);var f=d(s,i+=2);h(s,i+=2),h(s,i+=4),i+=4;var p=d(s,i+=8),m=d(s,i+=2);i+=2;var v=r.bin.readUTF8(s,i,p);if(i+=p,i+=m,u)o[v]={size:c,csize:l};else{var x=new Uint8Array(s.buffer,i);if(f==0)o[v]=new Uint8Array(x.buffer.slice(i,i+l));else{if(f!=8)throw"unknown compression method: "+f;var g=new Uint8Array(c);r.inflateRaw(x,g),o[v]=g}}},r.inflateRaw=function(s,i){return r.F.inflate(s,i)},r.inflate=function(s,i){return s[0],s[1],r.inflateRaw(new Uint8Array(s.buffer,s.byteOffset+2,s.length-6),i)},r.deflate=function(s,i){i==null&&(i={level:6});var o=0,l=new Uint8Array(50+Math.floor(1.1*s.length));l[o]=120,l[o+1]=156,o+=2,o=r.F.deflateRaw(s,l,o,i.level);var c=r.adler(s,0,s.length);return l[o+0]=c>>>24&255,l[o+1]=c>>>16&255,l[o+2]=c>>>8&255,l[o+3]=c>>>0&255,new Uint8Array(l.buffer,0,o+4)},r.deflateRaw=function(s,i){i==null&&(i={level:6});var o=new Uint8Array(50+Math.floor(1.1*s.length)),l=r.F.deflateRaw(s,o,l,i.level);return new Uint8Array(o.buffer,0,l)},r.encode=function(s,i){i==null&&(i=!1);var o=0,l=r.bin.writeUint,c=r.bin.writeUshort,u={};for(var d in s){var h=!r._noNeed(d)&&!i,f=s[d],p=r.crc.crc(f,0,f.length);u[d]={cpr:h,usize:f.length,crc:p,file:h?r.deflateRaw(f):f}}for(var d in u)o+=u[d].file.length+30+46+2*r.bin.sizeUTF8(d);o+=22;var m=new Uint8Array(o),v=0,x=[];for(var d in u){var g=u[d];x.push(v),v=r._writeHeader(m,v,d,g,0)}var w=0,_=v;for(var d in u)g=u[d],x.push(v),v=r._writeHeader(m,v,d,g,1,x[w++]);var j=v-_;return l(m,v,101010256),v+=4,c(m,v+=4,w),c(m,v+=2,w),l(m,v+=2,j),l(m,v+=4,_),v+=4,v+=2,m.buffer},r._noNeed=function(s){var i=s.split(".").pop().toLowerCase();return"png,jpg,jpeg,zip".indexOf(i)!=-1},r._writeHeader=function(s,i,o,l,c,u){var d=r.bin.writeUint,h=r.bin.writeUshort,f=l.file;return d(s,i,c==0?67324752:33639248),i+=4,c==1&&(i+=2),h(s,i,20),h(s,i+=2,0),h(s,i+=2,l.cpr?8:0),d(s,i+=2,0),d(s,i+=4,l.crc),d(s,i+=4,f.length),d(s,i+=4,l.usize),h(s,i+=4,r.bin.sizeUTF8(o)),h(s,i+=2,0),i+=2,c==1&&(i+=2,i+=2,d(s,i+=6,u),i+=4),i+=r.bin.writeUTF8(s,i,o),c==0&&(s.set(f,i),i+=f.length),i},r.crc={table:function(){for(var s=new Uint32Array(256),i=0;i<256;i++){for(var o=i,l=0;l<8;l++)1&o?o=3988292384^o>>>1:o>>>=1;s[i]=o}return s}(),update:function(s,i,o,l){for(var c=0;c<l;c++)s=r.crc.table[255&(s^i[o+c])]^s>>>8;return s},crc:function(s,i,o){return 4294967295^r.crc.update(4294967295,s,i,o)}},r.adler=function(s,i,o){for(var l=1,c=0,u=i,d=i+o;u<d;){for(var h=Math.min(u+5552,d);u<h;)c+=l+=s[u++];l%=65521,c%=65521}return c<<16|l}
1032,r.bin={readUshort:function(s,i){return s[i]|s[i+1]<<8},writeUshort:function(s,i,o){s[i]=255&o,s[i+1]=o>>8&255},readUint:function(s,i){return 16777216*s[i+3]+(s[i+2]<<16|s[i+1]<<8|s[i])},writeUint:function(s,i,o){s[i]=255&o,s[i+1]=o>>8&255,s[i+2]=o>>16&255,s[i+3]=o>>24&255},readASCII:function(s,i,o){for(var l="",c=0;c<o;c++)l+=String.fromCharCode(s[i+c]);return l},writeASCII:function(s,i,o){for(var l=0;l<o.length;l++)s[i+l]=o.charCodeAt(l)},pad:function(s){return s.length<2?"0"+s:s},readUTF8:function(s,i,o){for(var l,c="",u=0;u<o;u++)c+="%"+r.bin.pad(s[i+u].toString(16));try{l=decodeURIComponent(c)}catch{return r.bin.readASCII(s,i,o)}return l},writeUTF8:function(s,i,o){for(var l=o.length,c=0,u=0;u<l;u++){var d=o.charCodeAt(u);if(!(4294967168&d))s[i+c]=d,c++;else if(!(4294965248&d))s[i+c]=192|d>>6,s[i+c+1]=128|d>>0&63,c+=2;else if(!(4294901760&d))s[i+c]=224|d>>12,s[i+c+1]=128|d>>6&63,s[i+c+2]=128|d>>0&63,c+=3;else{if(4292870144&d)throw"e";s[i+c]=240|d>>18,s[i+c+1]=128|d>>12&63,s[i+c+2]=128|d>>6&63,s[i+c+3]=128|d>>0&63,c+=4}}return c},sizeUTF8:function(s){for(var i=s.length,o=0,l=0;l<i;l++){var c=s.charCodeAt(l);if(!(4294967168&c))o++;else if(!(4294965248&c))o+=2;else if(!(4294901760&c))o+=3;else{if(4292870144&c)throw"e";o+=4}}return o}},r.F={},r.F.deflateRaw=function(s,i,o,l){var c=[[0,0,0,0,0],[4,4,8,4,0],[4,5,16,8,0],[4,6,16,16,0],[4,10,16,32,0],[8,16,32,32,0],[8,16,128,128,0],[8,32,128,256,0],[32,128,258,1024,1],[32,258,258,4096,1]][l],u=r.F.U,d=r.F._goodIndex;r.F._hash;var h=r.F._putsE,f=0,p=o<<3,m=0,v=s.length;if(l==0){for(;f<v;)h(i,p,f+(T=Math.min(65535,v-f))==v?1:0),p=r.F._copyExact(s,f,T,i,p+8),f+=T;return p>>>3}var x=u.lits,g=u.strt,w=u.prev,_=0,j=0,N=0,S=0,C=0,k=0;for(v>2&&(g[k=r.F._hash(s,0)]=0),f=0;f<v;f++){if(C=k,f+1<v-2){k=r.F._hash(s,f+1);var E=f+1&32767;w[E]=g[k],g[k]=E}if(m<=f){(_>14e3||j>26697)&&v-f>100&&(m<f&&(x[_]=f-m,_+=2,m=f),p=r.F._writeBlock(f==v-1||m==v?1:0,x,_,S,s,N,f-N,i,p),_=j=S=0,N=f);var P=0;f<v-2&&(P=r.F._bestMatch(s,f,w,C,Math.min(c[2],v-f),c[3]));var T=P>>>16,M=65535&P;if(P!=0){M=65535&P;var R=d(T=P>>>16,u.of0);u.lhst[257+R]++;var A=d(M,u.df0);u.dhst[A]++,S+=u.exb[R]+u.dxb[A],x[_]=T<<23|f-m,x[_+1]=M<<16|R<<8|A,_+=2,m=f+T}else u.lhst[s[f]]++;j++}}for(N==f&&s.length!=0||(m<f&&(x[_]=f-m,_+=2,m=f),p=r.F._writeBlock(1,x,_,S,s,N,f-N,i,p),_=0,j=0,_=j=S=0,N=f);7&p;)p++;return p>>>3},r.F._bestMatch=function(s,i,o,l,c,u){var d=32767&i,h=o[d],f=d-h+32768&32767;if(h==d||l!=r.F._hash(s,i-f))return 0;
vendor: 4,540 bytes, line 1032
1032for(var p=0,m=0,v=Math.min(32767,i);f<=v&&--u!=0&&h!=d;){if(p==0||s[i+p]==s[i+p-f]){var x=r.F._howLong(s,i,f);if(x>p){if(m=f,(p=x)>=c)break;f+2<x&&(x=f+2);for(var g=0,w=0;w<x-2;w++){var _=i-f+w+32768&32767,j=_-o[_]+32768&32767;j>g&&(g=j,h=_)}}}f+=(d=h)-(h=o[d])+32768&32767}return p<<16|m},r.F._howLong=function(s,i,o){if(s[i]!=s[i-o]||s[i+1]!=s[i+1-o]||s[i+2]!=s[i+2-o])return 0;var l=i,c=Math.min(s.length,i+258);for(i+=3;i<c&&s[i]==s[i-o];)i++;return i-l},r.F._hash=function(s,i){return(s[i]<<8|s[i+1])+(s[i+2]<<4)&65535},r.saved=0,r.F._writeBlock=function(s,i,o,l,c,u,d,h,f){var p,m,v,x,g,w,_,j,N,S=r.F.U,C=r.F._putsF,k=r.F._putsE;S.lhst[256]++,m=(p=r.F.getTrees())[0],v=p[1],x=p[2],g=p[3],w=p[4],_=p[5],j=p[6],N=p[7];var E=32+(f+3&7?8-(f+3&7):0)+(d<<3),P=l+r.F.contSize(S.fltree,S.lhst)+r.F.contSize(S.fdtree,S.dhst),T=l+r.F.contSize(S.ltree,S.lhst)+r.F.contSize(S.dtree,S.dhst);T+=14+3*_+r.F.contSize(S.itree,S.ihst)+(2*S.ihst[16]+3*S.ihst[17]+7*S.ihst[18]);for(var M=0;M<286;M++)S.lhst[M]=0;for(M=0;M<30;M++)S.dhst[M]=0;for(M=0;M<19;M++)S.ihst[M]=0;var R=E<P&&E<T?0:P<T?1:2;if(C(h,f,s),C(h,f+1,R),f+=3,R==0){for(;7&f;)f++;f=r.F._copyExact(c,u,d,h,f)}else{var A,I;if(R==1&&(A=S.fltree,I=S.fdtree),R==2){r.F.makeCodes(S.ltree,m),r.F.revCodes(S.ltree,m),r.F.makeCodes(S.dtree,v),r.F.revCodes(S.dtree,v),r.F.makeCodes(S.itree,x),r.F.revCodes(S.itree,x),A=S.ltree,I=S.dtree,k(h,f,g-257),k(h,f+=5,w-1),k(h,f+=5,_-4),f+=4;for(var D=0;D<_;D++)k(h,f+3*D,S.itree[1+(S.ordr[D]<<1)]);f+=3*_,f=r.F._codeTiny(j,S.itree,h,f),f=r.F._codeTiny(N,S.itree,h,f)}for(var O=u,z=0;z<o;z+=2){for(var B=i[z],G=B>>>23,U=O+(8388607&B);O<U;)f=r.F._writeLit(c[O++],A,h,f);if(G!=0){var F=i[z+1],W=F>>16,Q=F>>8&255,K=255&F;k(h,f=r.F._writeLit(257+Q,A,h,f),G-S.of0[Q]),f+=S.exb[Q],C(h,f=r.F._writeLit(K,I,h,f),W-S.df0[K]),f+=S.dxb[K],O+=G}}f=r.F._writeLit(256,A,h,f)}return f},r.F._copyExact=function(s,i,o,l,c){var u=c>>>3;return l[u]=o,l[u+1]=o>>>8,l[u+2]=255-l[u],l[u+3]=255-l[u+1],u+=4,l.set(new Uint8Array(s.buffer,i,o),u),c+(o+4<<3)},r.F.getTrees=function(){for(var s=r.F.U,i=r.F._hufTree(s.lhst,s.ltree,15),o=r.F._hufTree(s.dhst,s.dtree,15),l=[],c=r.F._lenCodes(s.ltree,l),u=[],d=r.F._lenCodes(s.dtree,u),h=0;h<l.length;h+=2)s.ihst[l[h]]++;for(h=0;h<u.length;h+=2)s.ihst[u[h]]++;for(var f=r.F._hufTree(s.ihst,s.itree,7),p=19;p>4&&s.itree[1+(s.ordr[p-1]<<1)]==0;)p--;return[i,o,f,c,d,p,l,u]},r.F.getSecond=function(s){for(var i=[],o=0;o<s.length;o+=2)i.push(s[o+1]);return i},r.F.nonZero=function(s){for(var i="",o=0;o<s.length;o+=2)s[o+1]!=0&&(i+=(o>>1)+",");return i},r.F.contSize=function(s,i){for(var o=0,l=0;l<i.length;l++)o+=i[l]*s[1+(l<<1)];return o},r.F._codeTiny=function(s,i,o,l){for(var c=0;c<s.length;c+=2){var u=s[c],d=s[c+1];l=r.F._writeLit(u,i,o,l);var h=u==16?2:u==17?3:7;u>15&&(r.F._putsE(o,l,d,h),l+=h)}return l},r.F._lenCodes=function(s,i){for(var o=s.length;o!=2&&s[o-1]==0;)o-=2;for(var l=0;l<o;l+=2){var c=s[l+1],u=l+3<o?s[l+3]:-1,d=l+5<o?s[l+5]:-1,h=l==0?-1:s[l-1];if(c==0&&u==c&&d==c){for(var f=l+5;f+2<o&&s[f+2]==c;)f+=2;(p=Math.min(f+1-l>>>1,138))<11?i.push(17,p-3):i.push(18,p-11),l+=2*p-2}else if(c==h&&u==c&&d==c){for(f=l+5;f+2<o&&s[f+2]==c;)f+=2;var p=Math.min(f+1-l>>>1,6);i.push(16,p-3),l+=2*p-2}else i.push(c,0)}return o>>>1},r.F._hufTree=function(s,i,o){var l=[],c=s.length,u=i.length,d=0;for(d=0;d<u;d+=2)i[d]=0,i[d+1]=0;for(d=0;d<c;d++)s[d]!=0&&l.push({lit:d,f:s[d]});var h=l.length,f=l.slice(0);if(h==0)return 0;if(h==1){var p=l[0].lit;return f=p==0?1:0,i[1+(p<<1)]=1,i[1+(f<<1)]=1,1}l.sort(function(j,N){return j.f-N.f});var m=l[0],v=l[1],x=0,g=1,w=2;for(l[0]={lit:-1,f:m.f+v.f,l:m,r:v,d:0};g!=h-1;)m=x!=g&&(w==h||l[x].f<l[w].f)?l[x++]:l[w++],v=x!=g&&(w==h||l[x].f<l[w].f)?l[x++]:l[w++],l[g++]={lit:-1,f:m.f+v.f,l:m,r:v};var _=r.F.setDepth(l[g-1],0);for(_>o&&(r.F.restrictDepth(f,o,_),_=o),d=0;d<h;d++)i[1+(f[d].lit<<1)]=f[d].d;return _},r.F.setDepth=function(s,i){return s.lit!=-1?(s.d=i,i):Math.max(r.F.setDepth(s.l,i+1),r.F.setDepth(s.r,i+1))},r.F.restrictDepth=function(s,i,o){var l=0,c=1<<o-i,u=0;for(s.sort(function(h,f){return f.d==h.d?h.f-f.f:f.d-h.d}),l=0;l<s.length&&s[l].d>i;l++){var d=s[l].d;s[l].d=i,u+=c-(1<<o-d)}for(u>>>=o-i;u>0;)(d=s[l].d)<i?(s[l].d++,u-=1<<i-d-1):l++;for(;l>=0;l--)s[l].d==i&&u<0&&(s[l].d--,u++);u!=0&&console.log("debt left")},r.F._goodIndex=function(s,i){var o=0;return i[16|o]<=s&&(o|=16),i[8|o]<=s&&(o|=8),i[4|o]<=s&&(o|=4),i[2|o]<=s&&(o|=2),i[1|o]<=s&&(o|=1),o},r.F._writeLit=function(s,i,o,l){return r.F._putsF(o,l,i[s<<1]),l+i[1+(s<<1)]},r.F.inflate=function(s,i){var o=Uint8Array;
1032if(s[0]==3&&s[1]==0)return i||new o(0);var l=r.F,c=l._bitsF,u=l._bitsE,d=l._decodeTiny,h=l.makeCodes,f=l.codes2map,p=l._get17,m=l.U,v=i==null;v&&(i=new o(s.length>>>2<<3));for(var x,g,w=0,_=0,j=0,N=0,S=0,C=0,k=0,E=0,P=0;w==0;)if(w=c(s,P,1),_=c(s,P+1,2),P+=3,_!=0){if(v&&(i=r.F._check(i,E+(1<<17))),_==1&&(x=m.flmap,g=m.fdmap,C=511,k=31),_==2){j=u(s,P,5)+257,N=u(s,P+5,5)+1,S=u(s,P+10,4)+4,P+=14;for(var T=0;T<38;T+=2)m.itree[T]=0,m.itree[T+1]=0;var M=1;for(T=0;T<S;T++){var R=u(s,P+3*T,3);m.itree[1+(m.ordr[T]<<1)]=R,R>M&&(M=R)}P+=3*S,h(m.itree,M),f(m.itree,M,m.imap),x=m.lmap,g=m.dmap,P=d(m.imap,(1<<M)-1,j+N,s,P,m.ttree);var A=l._copyOut(m.ttree,0,j,m.ltree);C=(1<<A)-1;var I=l._copyOut(m.ttree,j,N,m.dtree);k=(1<<I)-1,h(m.ltree,A),f(m.ltree,A,x),h(m.dtree,I),f(m.dtree,I,g)}for(;;){var D=x[p(s,P)&C];P+=15&D;var O=D>>>4;if(!(O>>>8))i[E++]=O;else{if(O==256)break;var z=E+O-254;if(O>264){var B=m.ldef[O-257];z=E+(B>>>3)+u(s,P,7&B),P+=7&B}var G=g[p(s,P)&k];P+=15&G;var U=G>>>4,F=m.ddef[U],W=(F>>>4)+c(s,P,15&F);for(P+=15&F,v&&(i=r.F._check(i,E+(1<<17)));E<z;)i[E]=i[E++-W],i[E]=i[E++-W],i[E]=i[E++-W],i[E]=i[E++-W];E=z}}}else{7&P&&(P+=8-(7&P));var Q=4+(P>>>3),K=s[Q-4]|s[Q-3]<<8;v&&(i=r.F._check(i,E+K)),i.set(new o(s.buffer,s.byteOffset+Q,K),E),P=Q+K<<3,E+=K}return i.length==E?i:i.slice(0,E)},r.F._check=function(s,i){var o=s.length;if(i<=o)return s;var l=new Uint8Array(Math.max(o<<1,i));return l.set(s,0),l},r.F._decodeTiny=function(s,i,o,l,c,u){for(var d=r.F._bitsE,h=r.F._get17,f=0;f<o;){var p=s[h(l,c)&i];c+=15&p;var m=p>>>4;if(m<=15)u[f]=m,f++;else{var v=0,x=0;m==16?(x=3+d(l,c,2),c+=2,v=u[f-1]):m==17?(x=3+d(l,c,3),c+=3):m==18&&(x=11+d(l,c,7),c+=7);for(var g=f+x;f<g;)u[f]=v,f++}}return c},r.F._copyOut=function(s,i,o,l){for(var c=0,u=0,d=l.length>>>1;u<o;){var h=s[u+i];l[u<<1]=0,l[1+(u<<1)]=h,h>c&&(c=h),u++}for(;u<d;)l[u<<1]=0,l[1+(u<<1)]=0,u++;return c},r.F.makeCodes=function(s,i){for(var o,l,c,u,d=r.F.U,h=s.length,f=d.bl_count,p=0;p<=i;p++)f[p]=0;for(p=1;p<h;p+=2)f[s[p]]++;var m=d.next_code;for(o=0,f[0]=0,l=1;l<=i;l++)o=o+f[l-1]<<1,m[l]=o;for(c=0;c<h;c+=2)(u=s[c+1])!=0&&(s[c]=m[u],m[u]++)},r.F.codes2map=function(s,i,o){for(var l=s.length,c=r.F.U.rev15,u=0;u<l;u+=2)if(s[u+1]!=0)for(var d=u>>1,h=s[u+1],f=d<<4|h,p=i-h,m=s[u]<<p,v=m+(1<<p);m!=v;)o[c[m]>>>15-i]=f,m++},r.F.revCodes=function(s,i){for(var o=r.F.U.rev15,l=15-i,c=0;c<s.length;c+=2){var u=s[c]<<i-s[c+1];s[c]=o[u]>>>l}},r.F._putsE=function(s,i,o){o<<=7&i;var l=i>>>3;s[l]|=o,s[l+1]|=o>>>8},r.F._putsF=function(s,i,o){o<<=7&i;var l=i>>>3;s[l]|=o,s[l+1]|=o>>>8,s[l+2]|=o>>>16},r.F._bitsE=function(s,i,o){return(s[i>>>3]|s[1+(i>>>3)]<<8)>>>(7&i)&(1<<o)-1},r.F._bitsF=function(s,i,o){return(s[i>>>3]|s[1+(i>>>3)]<<8|s[2+(i>>>3)]<<16)>>>(7&i)&(1<<o)-1},r.F._get17=function(s,i){return(s[i>>>3]|s[1+(i>>>3)]<<8|s[2+(i>>>3)]<<16)>>>(7&i)},r.F._get25=function(s,i){return(s[i>>>3]|s[1+(i>>>3)]<<8|s[2+(i>>>3)]<<16|s[3+(i>>>3)]<<24)>>>(7&i)},r.F.U=(e=Uint16Array,n=Uint32Array,{next_code:new e(16),bl_count:new e(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[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,999,999,999],exb:[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],ldef:new e(32),df0:[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,65535,65535],dxb:[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],ddef:new n(32),flmap:new e(512),fltree:[],fdmap:new e(32),fdtree:[],lmap:new e(32768),ltree:[],ttree:[],dmap:new e(32768),dtree:[],imap:new e(512),itree:[],rev15:new e(32768),lhst:new n(286),dhst:new n(30),ihst:new n(19),lits:new n(15e3),strt:new e(65536),prev:new e(32768)}),function(){for(var s=r.F.U,i=0;i<32768;i++){var o=i;o=(4278255360&(o=(4042322160&(o=(3435973836&(o=(2863311530&o)>>>1|(1431655765&o)<<1))>>>2|(858993459&o)<<2))>>>4|(252645135&o)<<4))>>>8|(16711935&o)<<8,s.rev15[i]=(o>>>16|o<<16)>>>17}function l(c,u,d){for(;u--!=0;)c.push(0,d)}for(i=0;i<32;i++)s.ldef[i]=s.of0[i]<<3|s.exb[i],s.ddef[i]=s.df0[i]<<4|s.dxb[i];l(s.fltree,144,8),l(s.fltree,112,9),l(s.fltree,24,7),l(s.fltree,8,8),r.F.makeCodes(s.fltree,9),r.F.codes2map(s.fltree,9,s.flmap),r.F.revCodes(s.fltree,9),l(s.fdtree,32,5),r.F.makeCodes(s.fdtree,5),r.F.codes2map(s.fdtree,5,s.fdmap),r.F.revCodes(s.fdtree,5),l(s.itree,19,0),l(s.ltree,286,0),l(s.dtree,30,0),l(s.ttree,320,0)}()})();var Hst=Ust({__proto__:null,default:gI},[gI]);const Gc=function(){var t={nextZero(d,h){for(;d[h]!=0;)h++;return h},readUshort:(d,h)=>d[h]<<8|d[h+1],writeUshort(d,h,f){d[h]=f>>8&255,d[h+1]=255&f},readUint:(d,h)=>16777216*d[h]+(d[h+1]<<16|d[h+2]<<8|d[h+3]),writeUint(d,h,f){d[h]=f>>24&255,d[h+1]=f>>16&255,d[h+2]=f>>8&255,d[h+3]=255&f},readASCII(d,h,f){let p="";for(let m=0;m<f;m++)p+=String.fromCharCode(d[h+m]);return p},writeASCII(d,h,f){for(let p=0;p<f.length;p++)d[h+p]=f.charCodeAt(p)},readBytes(d,h,f){const p=[];for(let m=0;m<f;m++)p.push(d[h+m]);return p},pad:d=>d.length<2?`0${d}`:d,readUTF8(d,h,f){let p,m="";for(let v=0;v<f;v++)m+=`%${t.pad(d[h+v].toString(16))}`;try{p=decodeURIComponent(m)}catch{return t.readASCII(d,h,f)}return p}};function e(d,h,f,p){const m=h*f,v=i(p),x=Math.ceil(h*v/8),g=new Uint8Array(4*m),w=new Uint32Array(g.buffer),{ctype:_}=p,{depth:j}=p,N=t.readUshort;if(_==6){const B=m<<2;if(j==8)for(var S=0;S<B;S+=4)g[S]=d[S],g[S+1]=d[S+1],g[S+2]=d[S+2],g[S+3]=d[S+3];if(j==16)for(S=0;S<B;S++)g[S]=d[S<<1]}else if(_==2){const B=p.tabs.tRNS;if(B==null){if(j==8)for(S=0;S<m;S++){var C=3*S;w[S]=255<<24|d[C+2]<<16|d[C+1]<<8|d[C]}if(j==16)for(S=0;S<m;S++)C=6*S,w[S]=255<<24|d[C+4]<<16|d[C+2]<<8|d[C]}else{var k=B[0];const G=B[1],U=B[2];if(j==8)for(S=0;S<m;S++){var E=S<<2;C=3*S,w[S]=255<<24|d[C+2]<<16|d[C+1]<<8|d[C],d[C]==k&&d[C+1]==G&&d[C+2]==U&&(g[E+3]=0)}if(j==16)for(S=0;S<m;S++)E=S<<2,C=6*S,w[S]=255<<24|d[C+4]<<16|d[C+2]<<8|d[C],N(d,C)==k&&N(d,C+2)==G&&N(d,C+4)==U&&(g[E+3]=0)}}else if(_==3){const B=p.tabs.PLTE,G=p.tabs.tRNS,U=G?G.length:0;if(j==1)for(var P=0;P<f;P++){var T=P*x,M=P*h;for(S=0;S<h;
1032S++){E=M+S<<2;var R=3*(A=d[T+(S>>3)]>>7-((7&S)<<0)&1);g[E]=B[R],g[E+1]=B[R+1],g[E+2]=B[R+2],g[E+3]=A<U?G[A]:255}}if(j==2)for(P=0;P<f;P++)for(T=P*x,M=P*h,S=0;S<h;S++)E=M+S<<2,R=3*(A=d[T+(S>>2)]>>6-((3&S)<<1)&3),g[E]=B[R],g[E+1]=B[R+1],g[E+2]=B[R+2],g[E+3]=A<U?G[A]:255;if(j==4)for(P=0;P<f;P++)for(T=P*x,M=P*h,S=0;S<h;S++)E=M+S<<2,R=3*(A=d[T+(S>>1)]>>4-((1&S)<<2)&15),g[E]=B[R],g[E+1]=B[R+1],g[E+2]=B[R+2],g[E+3]=A<U?G[A]:255;if(j==8)for(S=0;S<m;S++){var A;E=S<<2,R=3*(A=d[S]),g[E]=B[R],g[E+1]=B[R+1],g[E+2]=B[R+2],g[E+3]=A<U?G[A]:255}}else if(_==4){if(j==8)for(S=0;S<m;S++){E=S<<2;var I=d[D=S<<1];g[E]=I,g[E+1]=I,g[E+2]=I,g[E+3]=d[D+1]}if(j==16)for(S=0;S<m;S++){var D;E=S<<2,I=d[D=S<<2],g[E]=I,g[E+1]=I,g[E+2]=I,g[E+3]=d[D+2]}}else if(_==0)for(k=p.tabs.tRNS?p.tabs.tRNS:-1,P=0;P<f;P++){const B=P*x,G=P*h;if(j==1)for(var O=0;O<h;O++){var z=(I=255*(d[B+(O>>>3)]>>>7-(7&O)&1))==255*k?0:255;w[G+O]=z<<24|I<<16|I<<8|I}else if(j==2)for(O=0;O<h;O++)z=(I=85*(d[B+(O>>>2)]>>>6-((3&O)<<1)&3))==85*k?0:255,w[G+O]=z<<24|I<<16|I<<8|I;else if(j==4)for(O=0;O<h;O++)z=(I=17*(d[B+(O>>>1)]>>>4-((1&O)<<2)&15))==17*k?0:255,w[G+O]=z<<24|I<<16|I<<8|I;else if(j==8)for(O=0;O<h;O++)z=(I=d[B+O])==k?0:255,w[G+O]=z<<24|I<<16|I<<8|I;else if(j==16)for(O=0;O<h;O++)I=d[B+(O<<1)],z=N(d,B+(O<<1))==k?0:255,w[G+O]=z<<24|I<<16|I<<8|I}return g}function n(d,h,f,p){const m=i(d),v=Math.ceil(f*m/8),x=new Uint8Array((v+1+d.interlace)*p);return h=d.tabs.CgBI?s(h,x):r(h,x),d.interlace==0?h=o(h,d,0,f,p):d.interlace==1&&(h=function(w,_){const j=_.width,N=_.height,S=i(_),C=S>>3,k=Math.ceil(j*S/8),E=new Uint8Array(N*k);let P=0;const T=[0,0,4,0,2,0,1],M=[0,4,0,2,0,1,0],R=[8,8,8,4,4,2,2],A=[8,8,4,4,2,2,1];let I=0;for(;I<7;){const O=R[I],z=A[I];let B=0,G=0,U=T[I];for(;U<N;)U+=O,G++;let F=M[I];for(;F<j;)F+=z,B++;const W=Math.ceil(B*S/8);o(w,_,P,B,G);let Q=0,K=T[I];for(;K<N;){let fe=M[I],oe=P+Q*W<<3;for(;fe<j;){var D;if(S==1&&(D=(D=w[oe>>3])>>7-(7&oe)&1,E[K*k+(fe>>3)]|=D<<7-((7&fe)<<0)),S==2&&(D=(D=w[oe>>3])>>6-(7&oe)&3,E[K*k+(fe>>2)]|=D<<6-((3&fe)<<1)),S==4&&(D=(D=w[oe>>3])>>4-(7&oe)&15,E[K*k+(fe>>1)]|=D<<4-((1&fe)<<2)),S>=8){const ye=K*k+fe*C;for(let le=0;le<C;le++)E[ye+le]=w[(oe>>3)+le]}oe+=S,fe+=z}Q++,K+=O}B*G!=0&&(P+=G*(1+W)),I+=1}return E}(h,d)),h}function r(d,h){return s(new Uint8Array(d.buffer,2,d.length-6),h)}var s=function(){const d={H:{}};return d.H.N=function(h,f){const p=Uint8Array;let m,v,x=0,g=0,w=0,_=0,j=0,N=0,S=0,C=0,k=0;if(h[0]==3&&h[1]==0)return f||new p(0);const E=d.H,P=E.b,T=E.e,M=E.R,R=E.n,A=E.A,I=E.Z,D=E.m,O=f==null;for(O&&(f=new p(h.length>>>2<<5));x==0;)if(x=P(h,k,1),g=P(h,k+1,2),k+=3,g!=0){if(O&&(f=d.H.W(f,C+(1<<17))),g==1&&(m=D.J,v=D.h,N=511,S=31),g==2){w=T(h,k,5)+257,_=T(h,k+5,5)+1,j=T(h,k+10,4)+4,k+=14;let B=1;for(var z=0;z<38;z+=2)D.Q[z]=0,D.Q[z+1]=0;for(z=0;z<j;z++){const F=T(h,k+3*z,3);D.Q[1+(D.X[z]<<1)]=F,F>B&&(B=F)}k+=3*j,R(D.Q,B),A(D.Q,B,D.u),m=D.w,v=D.d,k=M(D.u,(1<<B)-1,w+_,h,k,D.v);const G=E.V(D.v,0,w,D.C);N=(1<<G)-1;const U=E.V(D.v,w,_,D.D);S=(1<<U)-1,R(D.C,G),A(D.C,G,m),R(D.D,U),A(D.D,U,v)}for(;;){const B=m[I(h,k)&N];k+=15&B;const G=B>>>4;if(!(G>>>8))f[C++]=G;else{if(G==256)break;{let U=C+G-254;if(G>264){const fe=D.q[G-257];U=C+(fe>>>3)+T(h,k,7&fe),k+=7&fe}const F=v[I(h,k)&S];k+=15&F;const W=F>>>4,Q=D.c[W],K=(Q>>>4)+P(h,k,15&Q);for(k+=15&Q;C<U;)f[C]=f[C++-K],f[C]=f[C++-K],f[C]=f[C++-K],f[C]=f[C++-K];C=U}}}}else{7&k&&(k+=8-(7&k));const B=4+(k>>>3),G=h[B-4]|h[B-3]<<8;O&&(f=d.H.W(f,C+G)),f.set(new p(h.buffer,h.byteOffset+B,G),C),k=B+G<<3,C+=G}return f.length==C?f:f.slice(0,C)},d.H.W=function(h,f){const p=h.length;if(f<=p)return h;const m=new Uint8Array(p<<1);return m.set(h,0),m},d.H.R=function(h,f,p,m,v,x){const g=d.H.e,w=d.H.Z;let _=0;for(;_<p;){const j=h[w(m,v)&f];v+=15&j;const N=j>>>4;if(N<=15)x[_]=N,_++;else{let S=0,C=0;N==16?(C=3+g(m,v,2),v+=2,S=x[_-1]):N==17?(C=3+g(m,v,3),v+=3):N==18&&(C=11+g(m,v,7),v+=7);const k=_+C;for(;_<k;)x[_]=S,_++}}return v},d.H.V=function(h,f,p,m){let v=0,x=0;const g=m.length>>>1;for(;x<p;){const w=h[x+f];m[x<<1]=0,m[1+(x<<1)]=w,w>v&&(v=w),x++}for(;x<g;)m[x<<1]=0,m[1+(x<<1)]=0,x++;return v},d.H.n=function(h,f){const p=d.H.m,m=h.length;let v,x,g,w;const _=p.j;for(var j=0;j<=f;j++)_[j]=0;for(j=1;j<m;j+=2)_[h[j]]++;const N=p.K;for(v=0,_[0]=0,x=1;x<=f;x++)v=v+_[x-1]<<1,N[x]=v;for(g=0;g<m;g+=2)w=h[g+1],w!=0&&(h[g]=N[w],N[w]++)},d.H.A=function(h,f,p){const m=h.length,v=d.H.m.r;for(let x=0;x<m;x+=2)if(h[x+1]!=0){const g=x>>1,w=h[x+1],_=g<<4|w,j=f-w;let N=h[x]<<j;const S=N+(1<<j);for(;N!=S;)p[v[N]>>>15-f]=_,N++}},d.H.l=function(h,f){const p=d.H.m.r,m=15-f;for(let v=0;v<h.length;v+=2){const x=h[v]<<f-h[v+1];h[v]=p[x]>>>m}},d.H.M=function(h,f,p){p<<=7&f;const m=f>>>3;h[m]|=p,h[m+1]|=p>>>8},d.H.I=function(h,f,p){p<<=7&f;const m=f>>>3;h[m]|=p,h[m+1]|=p>>>8,h[m+2]|=p>>>16}
1032,d.H.e=function(h,f,p){return(h[f>>>3]|h[1+(f>>>3)]<<8)>>>(7&f)&(1<<p)-1},d.H.b=function(h,f,p){return(h[f>>>3]|h[1+(f>>>3)]<<8|h[2+(f>>>3)]<<16)>>>(7&f)&(1<<p)-1},d.H.Z=function(h,f){return(h[f>>>3]|h[1+(f>>>3)]<<8|h[2+(f>>>3)]<<16)>>>(7&f)},d.H.i=function(h,f){return(h[f>>>3]|h[1+(f>>>3)]<<8|h[2+(f>>>3)]<<16|h[3+(f>>>3)]<<24)>>>(7&f)},d.H.m=function(){const h=Uint16Array,f=Uint32Array;return{K:new h(16),j:new h(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[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,999,999,999],T:[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],q:new h(32),p:[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,65535,65535],z:[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],c:new f(32),J:new h(512),_:[],h:new h(32),$:[],w:new h(32768),C:[],v:[],d:new h(32768),D:[],u:new h(512),Q:[],r:new h(32768),s:new f(286),Y:new f(30),a:new f(19),t:new f(15e3),k:new h(65536),g:new h(32768)}}(),function(){const h=d.H.m;for(var f=0;f<32768;f++){let m=f;m=(2863311530&m)>>>1|(1431655765&m)<<1,m=(3435973836&m)>>>2|(858993459&m)<<2,m=(4042322160&m)>>>4|(252645135&m)<<4,m=(4278255360&m)>>>8|(16711935&m)<<8,h.r[f]=(m>>>16|m<<16)>>>17}function p(m,v,x){for(;v--!=0;)m.push(0,x)}for(f=0;f<32;f++)h.q[f]=h.S[f]<<3|h.T[f],h.c[f]=h.p[f]<<4|h.z[f];p(h._,144,8),p(h._,112,9),p(h._,24,7),p(h._,8,8),d.H.n(h._,9),d.H.A(h._,9,h.J),d.H.l(h._,9),p(h.$,32,5),d.H.n(h.$,5),d.H.A(h.$,5,h.h),d.H.l(h.$,5),p(h.Q,19,0),p(h.C,286,0),p(h.D,30,0),p(h.v,320,0)}(),d.H.N}();function i(d){return[1,null,3,1,2,null,4][d.ctype]*d.depth}function o(d,h,f,p,m){let v=i(h);const x=Math.ceil(p*v/8);let g,w;v=Math.ceil(v/8);let _=d[f],j=0;if(_>1&&(d[f]=[0,0,1][_-2]),_==3)for(j=v;j<x;j++)d[j+1]=d[j+1]+(d[j+1-v]>>>1)&255;for(let N=0;N<m;N++)if(g=f+N*x,w=g+N+1,_=d[w-1],j=0,_==0)for(;j<x;j++)d[g+j]=d[w+j];else if(_==1){for(;j<v;j++)d[g+j]=d[w+j];for(;j<x;j++)d[g+j]=d[w+j]+d[g+j-v]}else if(_==2)for(;j<x;j++)d[g+j]=d[w+j]+d[g+j-x];else if(_==3){for(;j<v;j++)d[g+j]=d[w+j]+(d[g+j-x]>>>1);for(;j<x;j++)d[g+j]=d[w+j]+(d[g+j-x]+d[g+j-v]>>>1)}else{for(;j<v;j++)d[g+j]=d[w+j]+l(0,d[g+j-x],0);for(;j<x;j++)d[g+j]=d[w+j]+l(d[g+j-v],d[g+j-x],d[g+j-v-x])}return d}function l(d,h,f){const p=d+h-f,m=p-d,v=p-h,x=p-f;return m*m<=v*v&&m*m<=x*x?d:v*v<=x*x?h:f}function c(d,h,f){f.width=t.readUint(d,h),h+=4,f.height=t.readUint(d,h),h+=4,f.depth=d[h],h++,f.ctype=d[h],h++,f.compress=d[h],h++,f.filter=d[h],h++,f.interlace=d[h],h++}function u(d,h,f,p,m,v,x,g,w){const _=Math.min(h,m),j=Math.min(f,v);let N=0,S=0;for(let I=0;I<j;I++)for(let D=0;D<_;D++)if(x>=0&&g>=0?(N=I*h+D<<2,S=(g+I)*m+x+D<<2):(N=(-g+I)*h-x+D<<2,S=I*m+D<<2),w==0)p[S]=d[N],p[S+1]=d[N+1],p[S+2]=d[N+2],p[S+3]=d[N+3];else if(w==1){var C=d[N+3]*.00392156862745098,k=d[N]*C,E=d[N+1]*C,P=d[N+2]*C,T=p[S+3]*(1/255),M=p[S]*T,R=p[S+1]*T,A=p[S+2]*T;const O=1-C,z=C+T*O,B=z==0?0:1/z;p[S+3]=255*z,p[S+0]=(k+M*O)*B,p[S+1]=(E+R*O)*B,p[S+2]=(P+A*O)*B}else if(w==2)C=d[N+3],k=d[N],E=d[N+1],P=d[N+2],T=p[S+3],M=p[S],R=p[S+1],A=p[S+2],C==T&&k==M&&E==R&&P==A?(p[S]=0,p[S+1]=0,p[S+2]=0,p[S+3]=0):(p[S]=k,p[S+1]=E,p[S+2]=P,p[S+3]=C);else if(w==3){if(C=d[N+3],k=d[N],E=d[N+1],P=d[N+2],T=p[S+3],M=p[S],R=p[S+1],A=p[S+2],C==T&&k==M&&E==R&&P==A)continue;if(C<220&&T>20)return!1}return!0}return{decode:function(h){const f=new Uint8Array(h);let p=8;const m=t,v=m.readUshort,x=m.readUint,g={tabs:{},frames:[]},w=new Uint8Array(f.length);let _,j=0,N=0;const S=[137,80,78,71,13,10,26,10];for(var C=0;C<8;C++)if(f[C]!=S[C])throw"The input is not a PNG file!";for(;p<f.length;){const I=m.readUint(f,p);p+=4;const D=m.readASCII(f,p,4);if(p+=4,D=="IHDR")c(f,p,g);else if(D=="iCCP"){for(var k=p;f[k]!=0;)k++;m.readASCII(f,p,k-p),f[k+1];const O=f.slice(k+2,p+I);let z=null;try{z=r(O)}catch{z=s(O)}g.tabs[D]=z}else if(D=="CgBI")g.tabs[D]=f.slice(p,p+4);else if(D=="IDAT"){for(C=0;C<I;C++)w[j+C]=f[p+C];j+=I}else if(D=="acTL")g.tabs[D]={num_frames:x(f,p),num_plays:x(f,p+4)},_=new Uint8Array(f.length);else if(D=="fcTL"){N!=0&&((A=g.frames[g.frames.length-1]).data=n(g,_.slice(0,N),A.rect.width,A.rect.height),N=0);const O={x:x(f,p+12),y:x(f,p+16),width:x(f,p+4),height:x(f,p+8)};let z=v(f,p+22);z=v(f,p+20)/(z==0?100:z);const B={rect:O,delay:Math.round(1e3*z),dispose:f[p+24],blend:f[p+25]};g.frames.push(B)}else if(D=="fdAT"){for(C=0;C<I-4;C++)_[N+C]=f[p+C+4];N+=I-4}else if(D=="pHYs")g.tabs[D]=[m.readUint(f,p),m.readUint(f,p+4),f[p+8]];else if(D=="cHRM")for(g.tabs[D]=[],C=0;C<8;C++)g.tabs[D].push(m.readUint(f,p+4*C));else if(D=="tEXt"||D=="zTXt"){g.tabs[D]==null&&(g.tabs[D]={});var E=m.nextZero(f,p),P=m.readASCII(f,p,E-p),T=p+I-E-1;if(D=="tEXt")R=m.readASCII(f,E+1,T);else{var M=r(f.slice(E+2,E+2+T));R=m.readUTF8(M,0,M.length)}g.tabs[D][P]=R}else if(D=="iTXt"){g.tabs[D]==null&&(g.tabs[D]={}),E=0,k=p,E=m.nextZero(f,k),P=m.readASCII(f,k,E-k);const O=f[k=E+1];var R;f[k+1],k+=2,E=m.nextZero(f,k),m.readASCII(f,k,E-k),k=E+1,E=m.nextZero(f,k),m.readUTF8(f,k,E-k),T=I-((k=E+1)-p),O==0?R=m.readUTF8(f,k,T):(M=r(f.slice(k,k+T)),R=m.readUTF8(M,0,M.length)),g.tabs[D][P]=R}else if(D=="PLTE")g.tabs[D]=m.readBytes(f,p,I);else if(D=="hIST"){const O=g.tabs.PLTE.length/3;for(g.tabs[D]=[],C=0;C<O;C++)g.tabs[D].push(v(f,p+2*C))}else if(D=="tRNS")g.ctype==3?g.tabs[D]=m.readBytes(f,p,I):g.ctype==0?g.tabs[D]=v(f,p):g.ctype==2&&(g.tabs[D]=[v(f,p),v(f,p+2),v(f,p+4)]);else if(D=="gAMA")g.tabs[D]=m.readUint(f,p)/1e5;else if(D=="sRGB")g.tabs[D]=f[p];else if(D=="bKGD")g.ctype==0||g.ctype==4?g.tabs[D]=[v(f,p)]:g.ctype==2||g.ctype==6?g.tabs[D]=[v(f,p),v(f,p+2),v(f,p+4)]:g.ctype==3&&(g.tabs[D]=f[p]);else if(D=="IEND")break;p+=I,m.readUint(f,p),p+=4}var A;return N!=0&&((A=g.frames[g.frames.length-1]).data=n(g,_.slice(0,N),A.rect.width,A.rect.height)),g.data=n(g,w,g.width,g.height),delete g.compress,delete g.interlace,delete g.filter,g},toRGBA8:function(h){const f=h.width,p=h.height;if(h.tabs.acTL==null)return[e(h.data,f,p,h).buffer];const m=[];h.frames[0].data==null&&(h.frames[0].data=h.data);const v=f*p*4,x=new Uint8Array(v),g=new Uint8Array(v),w=new Uint8Array(v);for(let j=0;j<h.frames.length;j++){const N=h.frames[j],S=N.rect.x,C=N.rect.y,k=N.rect.width,E=N.rect.height,P=e(N.data,k,E,h);if(j!=0)for(var _=0;_<v;_++)w[_]=x[_];if(N.blend==0?u(P,k,E,x,f,p,S,C,0):N.blend==1&&u(P,k,E,x,f,p,S,C,1),m.push(x.buffer.slice(0)),N.dispose!=0){if(N.dispose==1)u(g,k,E,x,f,p,S,C,0);else if(N.dispose==2)for(_=0;_<v;
1032_++)x[_]=w[_]}}return m},_paeth:l,_copyTile:u,_bin:t}}();(function(){const{_copyTile:t}=Gc,{_bin:e}=Gc,n=Gc._paeth;var r={table:function(){const k=new Uint32Array(256);for(let E=0;E<256;E++){let P=E;for(let T=0;T<8;T++)1&P?P=3988292384^P>>>1:P>>>=1;k[E]=P}return k}(),update(k,E,P,T){for(let M=0;M<T;M++)k=r.table[255&(k^E[P+M])]^k>>>8;return k},crc:(k,E,P)=>4294967295^r.update(4294967295,k,E,P)};function s(k,E,P,T){E[P]+=k[0]*T>>4,E[P+1]+=k[1]*T>>4,E[P+2]+=k[2]*T>>4,E[P+3]+=k[3]*T>>4}function i(k){return Math.max(0,Math.min(255,k))}function o(k,E){const P=k[0]-E[0],T=k[1]-E[1],M=k[2]-E[2],R=k[3]-E[3];return P*P+T*T+M*M+R*R}function l(k,E,P,T,M,R,A){A==null&&(A=1);const I=T.length,D=[];for(var O=0;O<I;O++){const K=T[O];D.push([K>>>0&255,K>>>8&255,K>>>16&255,K>>>24&255])}for(O=0;O<I;O++){let K=4294967295;for(var z=0,B=0;B<I;B++){var G=o(D[O],D[B]);B!=O&&G<K&&(K=G,z=B)}}const U=new Uint32Array(M.buffer),F=new Int16Array(E*P*4),W=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];for(O=0;O<W.length;O++)W[O]=255*((W[O]+.5)/16-.5);for(let K=0;K<P;K++)for(let fe=0;fe<E;fe++){var Q;O=4*(K*E+fe),A!=2?Q=[i(k[O]+F[O]),i(k[O+1]+F[O+1]),i(k[O+2]+F[O+2]),i(k[O+3]+F[O+3])]:(G=W[4*(3&K)+(3&fe)],Q=[i(k[O]+G),i(k[O+1]+G),i(k[O+2]+G),i(k[O+3]+G)]),z=0;let oe=16777215;for(B=0;B<I;B++){const me=o(Q,D[B]);me<oe&&(oe=me,z=B)}const ye=D[z],le=[Q[0]-ye[0],Q[1]-ye[1],Q[2]-ye[2],Q[3]-ye[3]];A==1&&(fe!=E-1&&s(le,F,O+4,7),K!=P-1&&(fe!=0&&s(le,F,O+4*E-4,3),s(le,F,O+4*E,5),fe!=E-1&&s(le,F,O+4*E+4,1))),R[O>>2]=z,U[O>>2]=T[z]}}function c(k,E,P,T,M){M==null&&(M={});const{crc:R}=r,A=e.writeUint,I=e.writeUshort,D=e.writeASCII;let O=8;const z=k.frames.length>1;let B,G=!1,U=33+(z?20:0);if(M.sRGB!=null&&(U+=13),M.pHYs!=null&&(U+=21),M.iCCP!=null&&(B=pako.deflate(M.iCCP),U+=21+B.length+4),k.ctype==3){for(var F=k.plte.length,W=0;W<F;W++)k.plte[W]>>>24!=255&&(G=!0);U+=8+3*F+4+(G?8+1*F+4:0)}for(var Q=0;Q<k.frames.length;Q++)z&&(U+=38),U+=(ye=k.frames[Q]).cimg.length+12,Q!=0&&(U+=4);U+=12;const K=new Uint8Array(U),fe=[137,80,78,71,13,10,26,10];for(W=0;W<8;W++)K[W]=fe[W];if(A(K,O,13),O+=4,D(K,O,"IHDR"),O+=4,A(K,O,E),O+=4,A(K,O,P),O+=4,K[O]=k.depth,O++,K[O]=k.ctype,O++,K[O]=0,O++,K[O]=0,O++,K[O]=0,O++,A(K,O,R(K,O-17,17)),O+=4,M.sRGB!=null&&(A(K,O,1),O+=4,D(K,O,"sRGB"),O+=4,K[O]=M.sRGB,O++,A(K,O,R(K,O-5,5)),O+=4),M.iCCP!=null){const le=13+B.length;A(K,O,le),O+=4,D(K,O,"iCCP"),O+=4,D(K,O,"ICC profile"),O+=11,O+=2,K.set(B,O),O+=B.length,A(K,O,R(K,O-(le+4),le+4)),O+=4}if(M.pHYs!=null&&(A(K,O,9),O+=4,D(K,O,"pHYs"),O+=4,A(K,O,M.pHYs[0]),O+=4,A(K,O,M.pHYs[1]),O+=4,K[O]=M.pHYs[2],O++,A(K,O,R(K,O-13,13)),O+=4),z&&(A(K,O,8),O+=4,D(K,O,"acTL"),O+=4,A(K,O,k.frames.length),O+=4,A(K,O,M.loop!=null?M.loop:0),O+=4,A(K,O,R(K,O-12,12)),O+=4),k.ctype==3){for(A(K,O,3*(F=k.plte.length)),O+=4,D(K,O,"PLTE"),O+=4,W=0;W<F;W++){const le=3*W,me=k.plte[W],he=255&me,ae=me>>>8&255,re=me>>>16&255;K[O+le+0]=he,K[O+le+1]=ae,K[O+le+2]=re}if(O+=3*F,A(K,O,R(K,O-3*F-4,3*F+4)),O+=4,G){for(A(K,O,F),O+=4,D(K,O,"tRNS"),O+=4,W=0;W<F;W++)K[O+W]=k.plte[W]>>>24&255;O+=F,A(K,O,R(K,O-F-4,F+4)),O+=4}}let oe=0;for(Q=0;Q<k.frames.length;Q++){var ye=k.frames[Q];z&&(A(K,O,26),O+=4,D(K,O,"fcTL"),O+=4,A(K,O,oe++),O+=4,A(K,O,ye.rect.width),O+=4,A(K,O,ye.rect.height),O+=4,A(K,O,ye.rect.x),O+=4,A(K,O,ye.rect.y),O+=4,I(K,O,T[Q]),O+=2,I(K,O,1e3),O+=2,K[O]=ye.dispose,O++,K[O]=ye.blend,O++,A(K,O,R(K,O-30,30)),O+=4);const le=ye.cimg;A(K,O,(F=le.length)+(Q==0?0:4)),O+=4;const me=O;D(K,O,Q==0?"IDAT":"fdAT"),O+=4,Q!=0&&(A(K,O,oe++),O+=4),K.set(le,O),O+=F,A(K,O,R(K,me,O-me)),O+=4}return A(K,O,0),O+=4,D(K,O,"IEND"),O+=4,A(K,O,R(K,O-4,4)),O+=4,K.buffer}function u(k,E,P){for(let T=0;T<k.frames.length;T++){const M=k.frames[T];M.rect.width;const R=M.rect.height,A=new Uint8Array(R*M.bpl+R);M.cimg=p(M.img,R,M.bpp,M.bpl,A,E,P)}}function d(k,E,P,T,M){const R=M[0],A=M[1],I=M[2],D=M[3],O=M[4],z=M[5];let B=6,G=8,U=255;for(var F=0;F<k.length;F++){const ne=new Uint8Array(k[F]);for(var W=ne.length,Q=0;Q<W;Q+=4)U&=ne[Q+3]}const K=U!=255,fe=function(Y,J,se,ge,de,ce){const xe=[];for(var je=0;je<Y.length;je++){const Ye=new Uint8Array(Y[je]),gt=new Uint32Array(Ye.buffer);var be;let At=0,yt=0,Qt=J,nr=se,wn=ge?1:0;if(je!=0){const Si=ce||ge||je==1||xe[je-2].dispose!=0?1:2;let it=0,pe=1e9;for(let Pe=0;Pe<Si;Pe++){var Ee=new Uint8Array(Y[je-1-Pe]);
1032const Ze=new Uint32Array(Y[je-1-Pe]);let qe=J,Ve=se,bt=-1,Be=-1;for(let Xe=0;Xe<se;Xe++)for(let Ft=0;Ft<J;Ft++)gt[Oe=Xe*J+Ft]!=Ze[Oe]&&(Ft<qe&&(qe=Ft),Ft>bt&&(bt=Ft),Xe<Ve&&(Ve=Xe),Xe>Be&&(Be=Xe));bt==-1&&(qe=Ve=bt=Be=0),de&&((1&qe)==1&&qe--,(1&Ve)==1&&Ve--);const Nt=(bt-qe+1)*(Be-Ve+1);Nt<pe&&(pe=Nt,it=Pe,At=qe,yt=Ve,Qt=bt-qe+1,nr=Be-Ve+1)}Ee=new Uint8Array(Y[je-1-it]),it==1&&(xe[je-1].dispose=2),be=new Uint8Array(Qt*nr*4),t(Ee,J,se,be,Qt,nr,-At,-yt,0),wn=t(Ye,J,se,be,Qt,nr,-At,-yt,3)?1:0,wn==1?f(Ye,J,se,be,{x:At,y:yt,width:Qt,height:nr}):t(Ye,J,se,be,Qt,nr,-At,-yt,0)}else be=Ye.slice(0);xe.push({rect:{x:At,y:yt,width:Qt,height:nr},img:be,blend:wn,dispose:0})}if(ge)for(je=0;je<xe.length;je++){if((st=xe[je]).blend==1)continue;const Ye=st.rect,gt=xe[je-1].rect,At=Math.min(Ye.x,gt.x),yt=Math.min(Ye.y,gt.y),Qt={x:At,y:yt,width:Math.max(Ye.x+Ye.width,gt.x+gt.width)-At,height:Math.max(Ye.y+Ye.height,gt.y+gt.height)-yt};xe[je-1].dispose=1,je-1!=0&&h(Y,J,se,xe,je-1,Qt,de),h(Y,J,se,xe,je,Qt,de)}let Me=0;if(Y.length!=1)for(var Oe=0;Oe<xe.length;Oe++){var st;Me+=(st=xe[Oe]).rect.width*st.rect.height}return xe}(k,E,P,R,A,I),oe={},ye=[],le=[];if(T!=0){const ne=[];for(Q=0;Q<fe.length;Q++)ne.push(fe[Q].img.buffer);const Y=function(de){let ce=0;for(var xe=0;xe<de.length;xe++)ce+=de[xe].byteLength;const je=new Uint8Array(ce);let be=0;for(xe=0;xe<de.length;xe++){const Ee=new Uint8Array(de[xe]),Me=Ee.length;for(let Oe=0;Oe<Me;Oe+=4){let st=Ee[Oe],Ye=Ee[Oe+1],gt=Ee[Oe+2];const At=Ee[Oe+3];At==0&&(st=Ye=gt=0),je[be+Oe]=st,je[be+Oe+1]=Ye,je[be+Oe+2]=gt,je[be+Oe+3]=At}be+=Me}return je.buffer}(ne),J=v(Y,T);for(Q=0;Q<J.plte.length;Q++)ye.push(J.plte[Q].est.rgba);let se=0;for(Q=0;Q<fe.length;Q++){const ge=(he=fe[Q]).img.length;var me=new Uint8Array(J.inds.buffer,se>>2,ge>>2);le.push(me);const de=new Uint8Array(J.abuf,se,ge);z&&l(he.img,he.rect.width,he.rect.height,ye,de,me),he.img.set(de),se+=ge}}else for(F=0;F<fe.length;F++){var he=fe[F];const ne=new Uint32Array(he.img.buffer);var ae=he.rect.width;for(W=ne.length,me=new Uint8Array(W),le.push(me),Q=0;Q<W;Q++){const Y=ne[Q];if(Q!=0&&Y==ne[Q-1])me[Q]=me[Q-1];else if(Q>ae&&Y==ne[Q-ae])me[Q]=me[Q-ae];else{let J=oe[Y];if(J==null&&(oe[Y]=J=ye.length,ye.push(Y),ye.length>=300))break;me[Q]=J}}}const re=ye.length;for(re<=256&&O==0&&(G=re<=2?1:re<=4?2:re<=16?4:8,G=Math.max(G,D)),F=0;F<fe.length;F++){(he=fe[F]).rect.x,he.rect.y,ae=he.rect.width;const ne=he.rect.height;let Y=he.img;new Uint32Array(Y.buffer);let J=4*ae,se=4;if(re<=256&&O==0){J=Math.ceil(G*ae/8);var L=new Uint8Array(J*ne);const ge=le[F];for(let de=0;de<ne;de++){Q=de*J;const ce=de*ae;if(G==8)for(var X=0;X<ae;X++)L[Q+X]=ge[ce+X];else if(G==4)for(X=0;X<ae;X++)L[Q+(X>>1)]|=ge[ce+X]<<4-4*(1&X);else if(G==2)for(X=0;X<ae;X++)L[Q+(X>>2)]|=ge[ce+X]<<6-2*(3&X);else if(G==1)for(X=0;X<ae;X++)L[Q+(X>>3)]|=ge[ce+X]<<7-1*(7&X)}Y=L,B=3,se=1}else if(K==0&&fe.length==1){L=new Uint8Array(ae*ne*3);const ge=ae*ne;for(Q=0;Q<ge;Q++){const de=3*Q,ce=4*Q;L[de]=Y[ce],L[de+1]=Y[ce+1],L[de+2]=Y[ce+2]}Y=L,B=2,se=3,J=3*ae}he.img=Y,he.bpl=J,he.bpp=se}return{ctype:B,depth:G,plte:ye,frames:fe}}function h(k,E,P,T,M,R,A){const I=Uint8Array,D=Uint32Array,O=new I(k[M-1]),z=new D(k[M-1]),B=M+1<k.length?new I(k[M+1]):null,G=new I(k[M]),U=new D(G.buffer);let F=E,W=P,Q=-1,K=-1;for(let oe=0;oe<R.height;oe++)for(let ye=0;ye<R.width;ye++){const le=R.x+ye,me=R.y+oe,he=me*E+le,ae=U[he];ae==0||T[M-1].dispose==0&&z[he]==ae&&(B==null||B[4*he+3]!=0)||(le<F&&(F=le),le>Q&&(Q=le),me<W&&(W=me),me>K&&(K=me))}Q==-1&&(F=W=Q=K=0),A&&((1&F)==1&&F--,(1&W)==1&&W--),R={x:F,y:W,width:Q-F+1,height:K-W+1};const fe=T[M];fe.rect=R,fe.blend=1,fe.img=new Uint8Array(R.width*R.height*4),T[M-1].dispose==0?(t(O,E,P,fe.img,R.width,R.height,-R.x,-R.y,0),f(G,E,P,fe.img,R)):t(G,E,P,fe.img,R.width,R.height,-R.x,-R.y,0)}function f(k,E,P,T,M){t(k,E,P,T,M.width,M.height,-M.x,-M.y,2)}function p(k,E,P,T,M,R,A){const I=[];let D,O=[0,1,2,3,4];R!=-1?O=[R]:(E*T>5e5||P==1)&&(O=[0]),A&&(D={level:0});const z=Hst;for(var B=0;B<O.length;B++){for(let F=0;F<E;F++)m(M,k,F,T,P,O[B]);I.push(z.deflate(M,D))}let G,U=1e9;for(B=0;B<I.length;B++)I[B].length<U&&(G=B,U=I[B].length);return I[G]}function m(k,E,P,T,M,R){const A=P*T;let I=A+P;if(k[I]=R,I++,R==0)if(T<500)for(var D=0;D<T;D++)k[I+D]=E[A+D];else k.set(new Uint8Array(E.buffer,A,T),I);else if(R==1){for(D=0;D<M;D++)k[I+D]=E[A+D];for(D=M;D<T;D++)k[I+D]=E[A+D]-E[A+D-M]+256&255}else if(P==0){for(D=0;D<M;D++)k[I+D]=E[A+D];if(R==2)for(D=M;D<T;D++)k[I+D]=E[A+D];if(R==3)for(D=M;D<T;D++)k[I+D]=E[A+D]-(E[A+D-M]>>1)+256&255;if(R==4)for(D=M;D<T;D++)k[I+D]=E[A+D]-n(E[A+D-M],0,0)+256&255}else{if(R==2)for(D=0;D<T;D++)k[I+D]=E[A+D]+256-E[A+D-T]&255;if(R==3){for(D=0;D<M;D++)k[I+D]=E[A+D]+256-(E[A+D-T]>>1)&255;for(D=M;D<T;D++)k[I+D]=E[A+D]+256-(E[A+D-T]+E[A+D-M]>>1)&255}if(R==4){for(D=0;D<M;D++)k[I+D]=E[A+D]+256-n(0,E[A+D-T],0)&255;for(D=M;D<T;D++)k[I+D]=E[A+D]+256-n(E[A+D-M],E[A+D-T],E[A+D-M-T])&255}}}
vendor: 5,378 bytes, line 1032
1032function v(k,E){const P=new Uint8Array(k),T=P.slice(0),M=new Uint32Array(T.buffer),R=x(T,E),A=R[0],I=R[1],D=P.length,O=new Uint8Array(D>>2);let z;if(P.length<2e7)for(var B=0;B<D;B+=4)z=g(A,G=P[B]*(1/255),U=P[B+1]*(1/255),F=P[B+2]*(1/255),W=P[B+3]*(1/255)),O[B>>2]=z.ind,M[B>>2]=z.est.rgba;else for(B=0;B<D;B+=4){var G=P[B]*.00392156862745098,U=P[B+1]*(1/255),F=P[B+2]*(1/255),W=P[B+3]*(1/255);for(z=A;z.left;)z=w(z.est,G,U,F,W)<=0?z.left:z.right;O[B>>2]=z.ind,M[B>>2]=z.est.rgba}return{abuf:T.buffer,inds:O,plte:I}}function x(k,E,P){P==null&&(P=1e-4);const T=new Uint32Array(k.buffer),M={i0:0,i1:k.length,bst:null,est:null,tdst:0,left:null,right:null};M.bst=N(k,M.i0,M.i1),M.est=S(M.bst);const R=[M];for(;R.length<E;){let I=0,D=0;for(var A=0;A<R.length;A++)R[A].est.L>I&&(I=R[A].est.L,D=A);if(I<P)break;const O=R[D],z=_(k,T,O.i0,O.i1,O.est.e,O.est.eMq255);if(O.i0>=z||O.i1<=z){O.est.L=0;continue}const B={i0:O.i0,i1:z,bst:null,est:null,tdst:0,left:null,right:null};B.bst=N(k,B.i0,B.i1),B.est=S(B.bst);const G={i0:z,i1:O.i1,bst:null,est:null,tdst:0,left:null,right:null};for(G.bst={R:[],m:[],N:O.bst.N-B.bst.N},A=0;A<16;A++)G.bst.R[A]=O.bst.R[A]-B.bst.R[A];for(A=0;A<4;A++)G.bst.m[A]=O.bst.m[A]-B.bst.m[A];G.est=S(G.bst),O.left=B,O.right=G,R[D]=B,R.push(G)}for(R.sort((I,D)=>D.bst.N-I.bst.N),A=0;A<R.length;A++)R[A].ind=A;return[M,R]}function g(k,E,P,T,M){if(k.left==null)return k.tdst=function(B,G,U,F,W){const Q=G-B[0],K=U-B[1],fe=F-B[2],oe=W-B[3];return Q*Q+K*K+fe*fe+oe*oe}(k.est.q,E,P,T,M),k;const R=w(k.est,E,P,T,M);let A=k.left,I=k.right;R>0&&(A=k.right,I=k.left);const D=g(A,E,P,T,M);if(D.tdst<=R*R)return D;const O=g(I,E,P,T,M);return O.tdst<D.tdst?O:D}function w(k,E,P,T,M){const{e:R}=k;return R[0]*E+R[1]*P+R[2]*T+R[3]*M-k.eMq}function _(k,E,P,T,M,R){for(T-=4;P<T;){for(;j(k,P,M)<=R;)P+=4;for(;j(k,T,M)>R;)T-=4;if(P>=T)break;const A=E[P>>2];E[P>>2]=E[T>>2],E[T>>2]=A,P+=4,T-=4}for(;j(k,P,M)>R;)P-=4;return P+4}function j(k,E,P){return k[E]*P[0]+k[E+1]*P[1]+k[E+2]*P[2]+k[E+3]*P[3]}function N(k,E,P){const T=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],M=[0,0,0,0],R=P-E>>2;for(let A=E;A<P;A+=4){const I=k[A]*.00392156862745098,D=k[A+1]*(1/255),O=k[A+2]*(1/255),z=k[A+3]*(1/255);M[0]+=I,M[1]+=D,M[2]+=O,M[3]+=z,T[0]+=I*I,T[1]+=I*D,T[2]+=I*O,T[3]+=I*z,T[5]+=D*D,T[6]+=D*O,T[7]+=D*z,T[10]+=O*O,T[11]+=O*z,T[15]+=z*z}return T[4]=T[1],T[8]=T[2],T[9]=T[6],T[12]=T[3],T[13]=T[7],T[14]=T[11],{R:T,m:M,N:R}}function S(k){const{R:E}=k,{m:P}=k,{N:T}=k,M=P[0],R=P[1],A=P[2],I=P[3],D=T==0?0:1/T,O=[E[0]-M*M*D,E[1]-M*R*D,E[2]-M*A*D,E[3]-M*I*D,E[4]-R*M*D,E[5]-R*R*D,E[6]-R*A*D,E[7]-R*I*D,E[8]-A*M*D,E[9]-A*R*D,E[10]-A*A*D,E[11]-A*I*D,E[12]-I*M*D,E[13]-I*R*D,E[14]-I*A*D,E[15]-I*I*D],z=O,B=C;let G=[Math.random(),Math.random(),Math.random(),Math.random()],U=0,F=0;if(T!=0)for(let Q=0;Q<16&&(G=B.multVec(z,G),F=Math.sqrt(B.dot(G,G)),G=B.sml(1/F,G),!(Q!=0&&Math.abs(F-U)<1e-9));Q++)U=F;const W=[M*D,R*D,A*D,I*D];return{Cov:O,q:W,e:G,L:U,eMq255:B.dot(B.sml(255,W),G),eMq:B.dot(G,W),rgba:(Math.round(255*W[3])<<24|Math.round(255*W[2])<<16|Math.round(255*W[1])<<8|Math.round(255*W[0])<<0)>>>0}}var C={multVec:(k,E)=>[k[0]*E[0]+k[1]*E[1]+k[2]*E[2]+k[3]*E[3],k[4]*E[0]+k[5]*E[1]+k[6]*E[2]+k[7]*E[3],k[8]*E[0]+k[9]*E[1]+k[10]*E[2]+k[11]*E[3],k[12]*E[0]+k[13]*E[1]+k[14]*E[2]+k[15]*E[3]],dot:(k,E)=>k[0]*E[0]+k[1]*E[1]+k[2]*E[2]+k[3]*E[3],sml:(k,E)=>[k*E[0],k*E[1],k*E[2],k*E[3]]};Gc.encode=function(E,P,T,M,R,A,I){M==null&&(M=0),I==null&&(I=!1);const D=d(E,P,T,M,[!1,!1,!1,0,I,!1]);return u(D,-1),c(D,P,T,R,A)},Gc.encodeLL=function(E,P,T,M,R,A,I,D){const O={ctype:0+(M==1?0:2)+(R==0?0:4),depth:A,frames:[]},z=(M+R)*A,B=z*P;for(let G=0;G<E.length;G++)O.frames.push({rect:{x:0,y:0,width:P,height:T},img:new Uint8Array(E[G]),blend:0,dispose:1,bpp:Math.ceil(z/8),bpl:Math.ceil(B/8)});return u(O,0,!0),c(O,P,T,I,D)},Gc.encode.compress=d,Gc.encode.dither=l,Gc.quantize=v,Gc.quantize.getKDtree=x,Gc.quantize.getNearest=g})();const W_e={toArrayBuffer(t,e){const n=t.width,r=t.height,s=n<<2,i=t.getContext("2d").getImageData(0,0,n,r),o=new Uint32Array(i.data.buffer),l=(32*n+31)/32<<2,c=l*r,u=122+c,d=new ArrayBuffer(u),h=new DataView(d),f=1<<20;let p,m,v,x,g=f,w=0,_=0,j=0;function N(k){h.setUint16(_,k,!0),_+=2}function S(k){h.setUint32(_,k,!0),_+=4}function C(k){_+=k}N(19778),S(u),C(4),S(122),S(108),S(n),S(-r>>>0),N(1),N(32),S(3),S(c),S(2835),S(2835),C(8),S(16711680),S(65280),S(255),S(4278190080),S(1466527264),function k(){for(;w<r&&g>0;){for(x=122+w*l,p=0;p<s;)g--,m=o[j++],v=m>>>24,h.setUint32(x+p,m<<8|v),p+=4;w++}j<o.length?(g=f,setTimeout(k,W_e._dly)):e(d)}()},toBlob(t,e){this.toArrayBuffer(t,n=>{e(new Blob([n],{type:"image/bmp"}))})},_dly:9};var zo={CHROME:"CHROME",FIREFOX:"FIREFOX",DESKTOP_SAFARI:"DESKTOP_SAFARI",IE:"IE",IOS:"IOS",ETC:"ETC"},Wst={[zo.CHROME]:16384,[zo.FIREFOX]:11180,[zo.DESKTOP_SAFARI]:16384,[zo.IE]:8192,[zo.IOS]:4096,[zo.ETC]:8192};const J7=typeof window<"u",K_e=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,vI=J7&&window.cordova&&window.cordova.require&&window.cordova.require("cordova/modulemapper"),Kst=(J7||K_e)&&(vI&&vI.getOriginalSymbol(window,"File")||typeof File<"u"&&File),G_e=(J7||K_e)&&(vI&&vI.getOriginalSymbol(window,"FileReader")||typeof FileReader<"u"&&FileReader);function Q7(t,e,n=Date.now()){return new Promise(r=>{const s=t.split(","),i=s[0].match(/:(.*?);/)[1],o=globalThis.atob(s[1]);let l=o.length;const c=new Uint8Array(l);for(;l--;
1032)c[l]=o.charCodeAt(l);const u=new Blob([c],{type:i});u.name=e,u.lastModified=n,r(u)})}function Y_e(t){return new Promise((e,n)=>{const r=new G_e;r.onload=()=>e(r.result),r.onerror=s=>n(s),r.readAsDataURL(t)})}function X_e(t){return new Promise((e,n)=>{const r=new Image;r.onload=()=>e(r),r.onerror=s=>n(s),r.src=t})}function nx(){if(nx.cachedResult!==void 0)return nx.cachedResult;let t=zo.ETC;const{userAgent:e}=navigator;return/Chrom(e|ium)/i.test(e)?t=zo.CHROME:/iP(ad|od|hone)/i.test(e)&&/WebKit/i.test(e)?t=zo.IOS:/Safari/i.test(e)?t=zo.DESKTOP_SAFARI:/Firefox/i.test(e)?t=zo.FIREFOX:(/MSIE/i.test(e)||document.documentMode)&&(t=zo.IE),nx.cachedResult=t,nx.cachedResult}function J_e(t,e){const n=nx(),r=Wst[n];let s=t,i=e,o=s*i;const l=s>i?i/s:s/i;for(;o>r*r;){const c=(r+s)/2,u=(r+i)/2;c<u?(i=u,s=u*l):(i=c*l,s=c),o=s*i}return{width:s,height:i}}function d4(t,e){let n,r;try{if(n=new OffscreenCanvas(t,e),r=n.getContext("2d"),r===null)throw new Error("getContext of OffscreenCanvas returns null")}catch{n=document.createElement("canvas"),r=n.getContext("2d")}return n.width=t,n.height=e,[n,r]}function Q_e(t,e){const{width:n,height:r}=J_e(t.width,t.height),[s,i]=d4(n,r);return e&&/jpe?g/.test(e)&&(i.fillStyle="white",i.fillRect(0,0,s.width,s.height)),i.drawImage(t,0,0,s.width,s.height),s}function NR(){return NR.cachedResult!==void 0||(NR.cachedResult=["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&typeof document<"u"&&"ontouchend"in document),NR.cachedResult}function xI(t,e={}){return new Promise(function(n,r){let s,i;var o=function(){try{return i=Q_e(s,e.fileType||t.type),n([s,i])}catch(c){return r(c)}},l=function(c){try{var u=function(d){try{throw d}catch(h){return r(h)}};try{let d;return Y_e(t).then(function(h){try{return d=h,X_e(d).then(function(f){try{return s=f,function(){try{return o()}catch(p){return r(p)}}()}catch(p){return u(p)}},u)}catch(f){return u(f)}},u)}catch(d){u(d)}}catch(d){return r(d)}};try{if(NR()||[zo.DESKTOP_SAFARI,zo.MOBILE_SAFARI].includes(nx()))throw new Error("Skip createImageBitmap on IOS and Safari");return createImageBitmap(t).then(function(c){try{return s=c,o()}catch{return l()}},l)}catch{l()}})}function yI(t,e,n,r,s=1){return new Promise(function(i,o){let l;if(e==="image/png"){let u,d,h;return u=t.getContext("2d"),{data:d}=u.getImageData(0,0,t.width,t.height),h=Gc.encode([d.buffer],t.width,t.height,4096*s),l=new Blob([h],{type:e}),l.name=n,l.lastModified=r,c.call(this)}{let u=function(){return c.call(this)};if(e==="image/bmp")return new Promise(d=>W_e.toBlob(t,d)).then((function(d){try{return l=d,l.name=n,l.lastModified=r,u.call(this)}catch(h){return o(h)}}).bind(this),o);{let d=function(){return u.call(this)};if(typeof OffscreenCanvas=="function"&&t instanceof OffscreenCanvas)return t.convertToBlob({type:e,quality:s}).then((function(h){try{return l=h,l.name=n,l.lastModified=r,d.call(this)}catch(f){return o(f)}}).bind(this),o);{let h;return h=t.toDataURL(e,s),Q7(h,n,r).then((function(f){try{return l=f,d.call(this)}catch(p){return o(p)}}).bind(this),o)}}}function c(){return i(l)}})}function Ld(t){t.width=0,t.height=0}function fw(){return new Promise(function(t,e){let n,r,s,i;return fw.cachedResult!==void 0?t(fw.cachedResult):Q7("data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==","test.jpg",Date.now()).then(function(o){try{return n=o,xI(n).then(function(l){try{return r=l[1],yI(r,n.type,n.name,n.lastModified).then(function(c){try{return s=c,Ld(r),xI(s).then(function(u){try{return i=u[0],fw.cachedResult=i.width===1&&i.height===2,t(fw.cachedResult)}catch(d){return e(d)}},e)}catch(u){return e(u)}},e)}catch(c){return e(c)}},e)}catch(l){return e(l)}},e)})}
1032function Z_e(t){return new Promise((e,n)=>{const r=new G_e;r.onload=s=>{const i=new DataView(s.target.result);if(i.getUint16(0,!1)!=65496)return e(-2);const o=i.byteLength;let l=2;for(;l<o;){if(i.getUint16(l+2,!1)<=8)return e(-1);const c=i.getUint16(l,!1);if(l+=2,c==65505){if(i.getUint32(l+=2,!1)!=1165519206)return e(-1);const u=i.getUint16(l+=6,!1)==18761;l+=i.getUint32(l+4,u);const d=i.getUint16(l,u);l+=2;for(let h=0;h<d;h++)if(i.getUint16(l+12*h,u)==274)return e(i.getUint16(l+12*h+8,u))}else{if((65280&c)!=65280)break;l+=i.getUint16(l,!1)}}return e(-1)},r.onerror=s=>n(s),r.readAsArrayBuffer(t)})}function eje(t,e){const{width:n}=t,{height:r}=t,{maxWidthOrHeight:s}=e;let i,o=t;return isFinite(s)&&(n>s||r>s)&&([o,i]=d4(n,r),n>r?(o.width=s,o.height=r/n*s):(o.width=n/r*s,o.height=s),i.drawImage(t,0,0,o.width,o.height),Ld(t)),o}function tje(t,e){const{width:n}=t,{height:r}=t,[s,i]=d4(n,r);switch(e>4&&e<9?(s.width=r,s.height=n):(s.width=n,s.height=r),e){case 2:i.transform(-1,0,0,1,n,0);break;case 3:i.transform(-1,0,0,-1,n,r);break;case 4:i.transform(1,0,0,-1,0,r);break;case 5:i.transform(0,1,1,0,0,0);break;case 6:i.transform(0,1,-1,0,r,0);break;case 7:i.transform(0,-1,-1,0,r,n);break;case 8:i.transform(0,-1,1,0,0,n)}return i.drawImage(t,0,0,n,r),Ld(t),s}function bne(t,e,n=0){return new Promise(function(r,s){let i,o,l,c,u,d,h,f,p,m,v,x,g,w,_,j,N,S,C,k;function E(T=5){if(e.signal&&e.signal.aborted)throw e.signal.reason;i+=T,e.onProgress(Math.min(i,100))}function P(T){if(e.signal&&e.signal.aborted)throw e.signal.reason;i=Math.min(Math.max(T,i),100),e.onProgress(i)}return i=n,o=e.maxIteration||10,l=1024*e.maxSizeMB*1024,E(),xI(t,e).then((function(T){try{return[,c]=T,E(),u=eje(c,e),E(),new Promise(function(M,R){var A;if(!(A=e.exifOrientation))return Z_e(t).then((function(D){try{return A=D,I.call(this)}catch(O){return R(O)}}).bind(this),R);function I(){return M(A)}return I.call(this)}).then((function(M){try{return d=M,E(),fw().then((function(R){try{return h=R?u:tje(u,d),E(),f=e.initialQuality||1,p=e.fileType||t.type,yI(h,p,t.name,t.lastModified,f).then((function(A){try{{let D=function(){if(o--&&(_>l||_>g)){let z,B;return z=k?.95*C.width:C.width,B=k?.95*C.height:C.height,[N,S]=d4(z,B),S.drawImage(C,0,0,z,B),f*=p==="image/png"?.85:.95,yI(N,p,t.name,t.lastModified,f).then(function(G){try{return j=G,Ld(C),C=N,_=j.size,P(Math.min(99,Math.floor((w-_)/(w-l)*100))),D}catch(U){return s(U)}},s)}return[1]},O=function(){return Ld(C),Ld(N),Ld(u),Ld(h),Ld(c),P(100),r(j)};if(m=A,E(),v=m.size>l,x=m.size>t.size,!v&&!x)return P(100),r(m);var I;return g=t.size,w=m.size,_=w,C=h,k=!e.alwaysKeepResolution&&v,(I=(function(z){for(;z;){if(z.then)return void z.then(I,s);try{if(z.pop){if(z.length)return z.pop()?O.call(this):z;z=D}else z=z.call(this)}catch(B){return s(B)}}}).bind(this))(D)}}catch(D){return s(D)}}).bind(this),s)}catch(A){return s(A)}}).bind(this),s)}catch(R){return s(R)}}).bind(this),s)}catch(M){return s(M)}}).bind(this),s)})}const Gst=` 1033let scriptImported = false 1034self.addEventListener('message', async (e) => { 1035 const { file, id, imageCompressionLibUrl, options } = e.data 1036 options.onProgress = (progress) => self.postMessage({ progress, id }) 1037 try { 1038 if (!scriptImported) { 1039 // console.log('[worker] importScripts', imageCompressionLibUrl) 1040 self.importScripts(imageCompressionLibUrl) 1041 scriptImported = true 1042 } 1043 // console.log('[worker] self', self) 1044 const compressedFile = await imageCompression(file, options) 1045 self.postMessage({ file: compressedFile, id }) 1046 } catch (e) { 1047 // console.error('[worker] error', e) 1048 self.postMessage({ error: e.message + '\\n' + e.stack, id }) 1049 } 1050}) 1051`;let q5;function Yst(t,e){return new Promise((n,r)=>{q5||(q5=function(o){const l=[];return l.push(o),URL.createObjectURL(new Blob(l))}(Gst));const s=new Worker(q5);s.addEventListener("message",function(o){if(e.signal&&e.signal.aborted)s.terminate();else if(o.data.progress===void 0){if(o.data.error)return r(new Error(o.data.error)),void s.terminate();n(o.data.file),s.terminate()}else e.onProgress(o.data.progress)}),s.addEventListener("error",r),e.signal&&e.signal.addEventListener("abort",()=>{r(e.signal.reason),s.terminate()}),s.postMessage({file:t,imageCompressionLibUrl:e.libURL,options:{...e,onProgress:void 0,signal:void 0}})})}function aa(t,e){return new Promise(function(n,r){let s,i,o,l,c,u;if(s={...e},o=0,{onProgress:l}=s,s.maxSizeMB=s.maxSizeMB||Number.POSITIVE_INFINITY,c=typeof s.useWebWorker!="boolean"||s.useWebWorker,delete s.useWebWorker,s.onProgress=p=>{o=p,typeof l=="function"&&l(o)},!(t instanceof Blob||t instanceof Kst))return r(new Error("The file given is not an instance of Blob or File"));if(!/^image/.test(t.type))return r(new Error("The file given is not an image"));if(u=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,!c||typeof Worker!="function"||u)return bne(t,s).then((function(p){try{return i=p,f.call(this)}catch(m){return r(m)}}).bind(this),r);var d=(function(){try{return f.call(this)}catch(p){return r(p)}}).bind(this),h=function(p){try{return bne(t,s).then(function(m){try{return i=m,d()}catch(v){return r(v)}},r)}catch(m){return r(m)}};try{return s.libURL=s.libURL||"https://cdn.jsdelivr.net/npm/[email protected]/dist/browser-image-compression.js",Yst(t,s).then(function(p){try{return i=p,d()}catch{return h()}},h)}catch{h()}function f(){try{i.name=t.name,i.lastModified=t.lastModified}catch{}try{s.preserveExif&&t.type==="image/jpeg"&&(!s.fileType||s.fileType&&s.fileType===t.type)&&(i=H_e(t,i))}catch{}return n(i)}})}aa.getDataUrlFromFile=Y_e,aa.getFilefromDataUrl=Q7,aa.loadImage=X_e,aa.drawImageInCanvas=Q_e,aa.drawFileInCanvas=xI,aa.canvasToFile=yI,aa.getExifOrientation=Z_e,aa.handleMaxWidthOrHeight=eje,aa.followExifOrientation=tje,aa.cleanupCanvasMemory=Ld,aa.isAutoOrientationInBrowser=fw,aa.approximateBelowMaximumCanvasSizeOfBrowser=J_e,aa.copyExifWithoutOrientation=H_e,aa.getBrowserName=nx,aa.version="2.0.2";const V5=10,Xst=5*1024*1024,Jst=["image/jpeg","image/jpg","image/png","image/webp"],Qst=t=>
1051new Promise((e,n)=>{const r=new FileReader;r.onload=()=>e(String(r.result).split(",")[1]),r.onerror=n,r.readAsDataURL(t)});function Zst({profileId:t,photos:e,onChange:n}){const r=b.useRef(null),[s,i]=b.useState(!1),[o,l]=b.useState({done:0,total:0}),[c,u]=b.useState(!1),[d,h]=b.useState(null),f=async x=>{const{data:g,error:w}=await Z.functions.invoke("partner-photos",{body:{profile_id:t,...x}});if(w)throw new Error(w.message);if(g!=null&&g.error)throw new Error(g.error);return g},p=async x=>{if(!t)return ee.error("Enregistrez d'abord votre fiche avant d'ajouter des photos.");const g=[];for(const _ of x){if(!Jst.includes(_.type)){ee.error(`${_.name} : format non supporté (jpg, png ou webp).`);continue}if(_.size>Xst){ee.error(`${_.name} : fichier trop lourd (5 Mo max).`);continue}g.push(_)}if(!g.length)return;if(e.length+g.length>V5)return ee.error(`Maximum ${V5} photos par fiche.`);i(!0),l({done:0,total:g.length});let w=e;try{for(let _=0;_<g.length;_++){const j=w.length===0&&_===0,N=await aa(g[_],{maxWidthOrHeight:j?1200:1e3,maxSizeMB:1.5,useWebWorker:!0,fileType:g[_].type==="image/png"?"image/png":"image/jpeg"});w=(await f({action:"upload",filename:g[_].name,content_type:N.type,data_base64:await Qst(N)})).photos,n(w),l({done:_+1,total:g.length})}ee.success("Photos ajoutées.")}catch(_){ee.error(_.message)}finally{i(!1),l({done:0,total:0}),r.current&&(r.current.value="")}},m=async x=>{try{const g=await f({action:"delete",url:x});n(g.photos),ee.success("Photo supprimée.")}catch(g){ee.error(g.message)}},v=async(x,g)=>{if(x===g)return;const w=[...e],[_]=w.splice(x,1);w.splice(g,0,_),n(w);try{await f({action:"reorder",photos:w})}catch(j){ee.error(j.message)}};return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{onDragOver:x=>{x.preventDefault(),u(!0)},onDragLeave:()=>u(!1),onDrop:x=>{x.preventDefault(),u(!1),d===null&&p(Array.from(x.dataTransfer.files))},className:`flex flex-col items-center justify-center gap-3 rounded-lg border-2 border-dashed p-8 text-center transition-colors ${c?"border-primary bg-primary/5":"border-muted-foreground/25"}`,children:[a.jsx(Oa,{className:"h-8 w-8 text-muted-foreground"}),a.jsxs("div",{className:"text-sm text-muted-foreground",children:["Glissez-déposez vos photos ici â jpg, png ou webp, 5 Mo max, ",V5," photos maximum."]}),a.jsx(H,{type:"button",variant:"outline",disabled:s,onClick:()=>{var x;return(x=r.current)==null?void 0:x.click()},children:s?a.jsxs(a.Fragment,{children:[a.jsx(Je,{className:"mr-2 h-4 w-4 animate-spin"}),"Envoi ",o.done,"/",o.total,"..."]}):"Parcourir"}),a.jsx("input",{ref:r,type:"file",multiple:!0,accept:".jpg,.jpeg,.png,.webp,image/jpeg,image/png,image/webp",className:"hidden",onChange:x=>p(Array.from(x.target.files??[]))})]}),e.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-xs text-muted-foreground",children:"Glissez les miniatures pour réordonner â la première photo est la photo principale."}),a.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3 md:grid-cols-4",children:e.map((x,g)=>a.jsxs("div",{draggable:!0,onDragStart:()=>h(g),onDragOver:w=>w.preventDefault(),onDrop:w=>{w.preventDefault(),d!==null&&v(d,g),h(null)},onDragEnd:()=>h(null),className:"group relative aspect-[4/3] overflow-hidden rounded-lg border bg-muted",children:[a.jsx("img",{src:x,alt:`Photo ${g+1}`,loading:"lazy",className:"h-full w-full object-cover"}),g===0&&a.jsxs("span",{className:"absolute left-2 top-2 flex items-center gap-1 rounded bg-primary px-2 py-0.5 text-[11px] text-primary-foreground",children:[a.jsx(X6,{className:"h-3 w-3"})," Principale"]}),a.jsx(V$e,{className:"absolute bottom-2 left-2 h-4 w-4 text-background opacity-0 transition-opacity group-hover:opacity-100"}),a.jsx("button",{type:"button","aria-label":"Supprimer la photo",onClick:()=>m(x),className:"absolute right-2 top-2 rounded-full bg-background/90 p-1 text-destructive shadow",children:a.jsx(ks,{className:"h-4 w-4"})})]},x))})]})]})}const wne=Object.fromEntries(U7.map(t=>[t.key,{closed:!0}])),eit={draft:"Brouillon",pending:"En attente de validation",published:"Publiée",rejected:"Refusée"};function tit(){const{user:t}=Ji(),e=St(),[n,r]=b.useState(null),[s,i]=b.useState(!1),[o,l]=b.useState(!1),[c,u]=b.useState("idle"),[d,h]=b.useState(""),{data:f=[]}=Ne({queryKey:["business-categories"],queryFn:$7}),{data:p,isLoading:m}=Ne({queryKey:["my-partner-profile",t==null?void 0:t.id],enabled:!!t,queryFn:async()=>{const{data:C,error:k}=await Z.from("partner_profiles").select("*").eq("user_id",t.id).maybeSingle();if(k)throw k;return C}}),{data:v}=Ne({queryKey:["my-directory-subscription",p==null?void 0:p.id],enabled:!!(p!=null&&p.id),queryFn:async()=>{const{data:C}=await Z.from("subscriptions").select("*").eq("business_profile_id",p.id).order("created_at",{ascending:!1}).limit(1).maybeSingle();return C}});b.useEffect(()=>{p?r({...p,opening_hours:p.opening_hours??wne}):t&&!m&&r({user_id:t.id,organization_name:"",organization_type:"",description:"",website:"",phone:"",ph
1051one2:"",contact_email:t.email,address:"",postal_code:"",city:"",country:"Espagne",no_physical_office:!1,service_area:"",business_category_id:null,languages_spoken:["fr"],opening_hours:wne,photos:[],logo_url:"",facebook_url:"",instagram_url:"",public_contact_enabled:!0,show_phone:!0,show_email:!0,show_address:!0,show_postal_code:!0,status:"draft",is_active:!0})},[p,t,m]);const x=(C,k)=>r(E=>({...E,[C]:k})),g=(C,k)=>r(E=>{var P;return{...E,opening_hours:{...E.opening_hours,[C]:{...(P=E.opening_hours)==null?void 0:P[C],...k}}}}),w=b.useMemo(()=>!!v&&["active","gifted","trial"].includes(v.status)&&(!v.end_date||new Date(v.end_date)>new Date),[v]),_=async C=>{u("loading");try{const{data:k,error:E}=await Z.functions.invoke("geocode-business",{body:{partner_id:C,address:n.address,city:n.city,postal_code:n.postal_code,country:"España"}});if(E)throw E;k!=null&&k.success?(u("ok"),h(k.display_name??"")):(u("error"),h((k==null?void 0:k.error)??"Adresse non trouvée"))}catch{u("error"),h("Géolocalisation impossible")}},j=async()=>{var C;if(!((C=n==null?void 0:n.organization_name)!=null&&C.trim()))return ee.error("Le nom de l'entreprise est obligatoire.");i(!0);try{const k={...n};delete k.id,delete k.created_at,delete k.updated_at,delete k.is_verified,delete k.verified_at,delete k.curated_by_admin,delete k.esprit_sud_partner,delete k.trial_end_date,delete k.slug,delete k.lat,delete k.lng;const E=!p||p.address!==n.address||p.city!==n.city||p.postal_code!==n.postal_code;let P=p==null?void 0:p.id;if(P){const{error:T}=await Z.from("partner_profiles").update(k).eq("id",P);if(T)throw T}else{const{data:T,error:M}=await Z.from("partner_profiles").insert(k).select("id").single();if(M)throw M;P=T==null?void 0:T.id}ee.success("Fiche enregistrée."),P&&E&&(n.address||n.city)&&await _(P),e.invalidateQueries({queryKey:["my-partner-profile"]})}catch(k){ee.error(k.message)}finally{i(!1)}},N=async C=>{if(!(p!=null&&p.id))return ee.error("Enregistrez d'abord votre fiche.");l(!0);try{const{data:k,error:E}=await Z.functions.invoke("create-directory-checkout",{body:{plan:C,profile_id:p.id}});if(E)throw E;k!=null&&k.url&&window.open(k.url,"_blank")}catch(k){ee.error(k.message)}finally{l(!1)}},S=async()=>{l(!0);try{const{data:C,error:k}=await Z.functions.invoke("directory-customer-portal",{});if(k)throw k;C!=null&&C.url&&window.open(C.url,"_blank")}catch(C){ee.error(C.message)}finally{l(!1)}};return n?a.jsxs(a.Fragment,{children:[a.jsx(Fn,{title:"Ma fiche professionnelle â Espace Pro",description:"Gérez votre fiche du Carnet d'adresses des Pros d'Esprit Sud.",noIndex:!0}),a.jsxs("div",{className:"container py-10",children:[a.jsxs("div",{className:"mb-6 flex flex-wrap items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"font-serif text-3xl font-bold",children:"Ma fiche professionnelle"}),a.jsx("p",{className:"text-muted-foreground",children:"Carnet d'adresses des Pros â Esprit Sud Magazine"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ke,{variant:n.status==="published"?"default":"secondary",children:eit[n.status]??n.status}),w&&a.jsxs(ke,{variant:"outline",children:["Abonnement ",v==null?void 0:v.plan]})]})]}),a.jsxs(Qi,{defaultValue:"infos",children:[a.jsxs(wi,{className:"flex-wrap",children:[a.jsx(wt,{value:"infos",children:"Informations"}),a.jsx(wt,{value:"contact",children:"Contact & visibilité"}),a.jsx(wt,{value:"photos",children:"Photos"}),a.jsx(wt,{value:"horaires",children:"Horaires"}),a.jsx(wt,{value:"abonnement",children:"Abonnement"})]}),a.jsx(kt,{value:"infos",className:"space-y-4 pt-6",children:a.jsx(Ke,{children:a.jsxs(ut,{className:"grid gap-4 p-6 md:grid-cols-2",children:[a.jsxs("div",{className:"md:col-span-2",children:[a.jsx(te,{children:"Nom de l'entreprise *"}),a.jsx(ue,{value:n.organization_name??"",onChange:C=>x("organization_name",C.target.value)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Type d'activité"}),a.jsx(ue,{value:n.organization_type??"",onChange:C=>x("organization_type",C.target.value)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Catégorie"}),a.jsxs(lt,{value:n.business_category_id??"",onValueChange:C=>x("business_category_id",C),children:[a.jsx(nt,{children:a.jsx(ct,{placeholder:"Choisir une catégorie"})}),a.jsx(rt,{children:f.map(C=>a.jsxs(Ae,{value:C.id,children:[C.emoji," ",C.name]},C.id))})]})]}),a.jsxs("div",{className:"md:col-span-2",children:[a.jsx(te,{children:"Description"}),a.jsx(fn,{rows:6,value:n.description??"",onChange:C=>x("description",C.target.value)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Logo (URL)"}),a.jsx(ue,{value:n.logo_url??"",onChange:C=>x("logo_url",C.target.value)})]}),a.jsx("div",{className:"hidden"}),a.jsxs("div",{className:"md:col-span-2",children:[a.jsx(te,{children:"Langues parlées"}),a.jsx("div",{className:"mt-2 flex flex-wrap gap-3",children:B7.map(C=>{const k=(n.languages_spoken??[]).includes(C.value);return a.jsx(H,{type:"button",size:"sm",variant:k?"default":"outline",onClick:()=>x("languages_spoken",k?(n.languages_spoken??[]).filter(E=>E!==C.value):[...n.languages_spoken??[],C.value]),children:C.label},C.value)})})]})]})})}),a.jsx(kt,{value:"contact",className:"space-y-4 pt-6",children:a.jsx(Ke,{children:a.jsxs(ut,{className:"grid gap-4 p-6 md:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(te,{children:"Téléphone"}),a.jsx(ue,{value:n.phone??"",onChange:C=>x("phone",C.target.value)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Téléphone 2"}),a.jsx(ue,{value:n.phone2??"",onChange:C=>x("phone2",C.target.value)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"E-mail de contact"}),a.jsx(ue,{value:n.contact_email??"",onChange:C=>x("contact_email",C.target.value)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Site web"}),a.jsx(ue,{value:n.website??"",onChange:C=>x("website",C.target.value)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Facebook"}),a.jsx(ue,{value:n.facebook_url??"",onChange:C=>x("facebook_url",C.target.value)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Instagram"}),a.jsx(ue,{value:n.instagram_url??"",onChange:C=>x("instagram_url",C.target.value)})]}),a.jsxs("div",{className:"md:col-span-2",children:[a.jsx(te,{children:"Adresse"}),a.jsx(ue,{value:n.address??"",onChange:C=>x("address",C.target.value)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Code postal"}),a.jsx(ue,{value:n.postal_code??"",onChange:C=>x("postal_code",C.target.value)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Ville"}),a.jsx(ue,{value:n.city??"",onChange:C=>x("city",C.target.value)})]}),a.jsxs("div",{className:"md:col-span-2 space-y-3 rounded-lg border p-4",children:[a.jsx("p",{className:"text-sm font-medium",children:"Ce que le public peut voir"}),[["public_contact_enabled","Afficher un bloc contact public"],["show_phone","Afficher mon téléphone"],["show_email","Afficher mon e-mail"],["show_address","Afficher mon adresse"],["show_postal_code","Afficher mon code postal"],["no_physical_office","Je n'ai pas de local (intervention à domicile)"]].map(([C,k])=>
1051a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{htmlFor:C,className:"font-normal",children:k}),a.jsx(_n,{id:C,checked:!!n[C],onCheckedChange:E=>x(C,E)})]},C)),n.no_physical_office&&a.jsxs("div",{children:[a.jsx(te,{children:"Zone d'intervention"}),a.jsx(ue,{value:n.service_area??"",onChange:C=>x("service_area",C.target.value)})]})]})]})})}),a.jsx(kt,{value:"photos",className:"pt-6",children:a.jsx(Ke,{children:a.jsxs(ut,{className:"space-y-4 p-6",children:[a.jsx(Zst,{profileId:(p==null?void 0:p.id)??null,photos:n.photos??[],onChange:C=>x("photos",C)}),!(p!=null&&p.id)&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"Enregistrez d'abord votre fiche pour pouvoir ajouter des photos."})]})})}),a.jsx(kt,{value:"horaires",className:"pt-6",children:a.jsx(Ke,{children:a.jsx(ut,{className:"space-y-3 p-6",children:U7.map(({key:C,label:k})=>{var P;const E=((P=n.opening_hours)==null?void 0:P[C])??{};return a.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[a.jsx("span",{className:"w-28 text-sm",children:k}),a.jsx(_n,{checked:!E.closed,onCheckedChange:T=>g(C,{closed:!T})}),!E.closed&&a.jsxs(a.Fragment,{children:[a.jsx(ue,{type:"time",className:"w-32",value:E.open??"",onChange:T=>g(C,{open:T.target.value})}),a.jsx("span",{children:"â"}),a.jsx(ue,{type:"time",className:"w-32",value:E.close??"",onChange:T=>g(C,{close:T.target.value})})]})]},C)})})})}),a.jsx(kt,{value:"abonnement",className:"pt-6",children:a.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[a.jsxs(Ke,{children:[a.jsx(Vt,{children:a.jsx(Ht,{children:"Offre Pro"})}),a.jsxs(ut,{className:"space-y-3 text-sm",children:[a.jsx("p",{className:"text-muted-foreground",children:"Fiche publiée dans l'annuaire, coordonnées, photos, horaires, référencement Google."}),a.jsx(H,{disabled:o||w,onClick:()=>N("pro"),children:w?"Abonnement actif":"S'abonner (annuel)"})]})]}),a.jsxs(Ke,{children:[a.jsx(Vt,{children:a.jsx(Ht,{children:"Offre Pro Plus"})}),a.jsxs(ut,{className:"space-y-3 text-sm",children:[a.jsx("p",{className:"text-muted-foreground",children:"Tout Pro + mise en avant, vidéo, priorité sur les demandes de recommandation."}),a.jsx(H,{variant:"secondary",disabled:o||w,onClick:()=>N("pro_plus"),children:w?"Abonnement actif":"S'abonner (annuel)"})]})]}),w&&a.jsx(Ke,{className:"md:col-span-2",children:a.jsxs(ut,{className:"flex flex-wrap items-center justify-between gap-3 p-6",children:[a.jsxs("p",{className:"text-sm text-muted-foreground",children:["Abonnement ",v==null?void 0:v.plan," â valable jusqu'au"," ",v!=null&&v.end_date?new Date(v.end_date).toLocaleDateString("fr-FR"):"â"]}),a.jsx(H,{variant:"outline",onClick:S,disabled:o,children:"Gérer mon abonnement"})]})})]})})]}),a.jsxs("div",{className:"mt-8 flex flex-wrap items-center justify-end gap-4",children:[c==="loading"&&a.jsx("span",{className:"text-sm text-muted-foreground",children:"Géolocalisation en cours..."}),c==="ok"&&a.jsxs("span",{className:"text-sm text-muted-foreground",children:["â
Adresse géolocalisée â ",d]}),c==="error"&&a.jsx("span",{className:"text-sm text-destructive",children:"â ï¸ Adresse non trouvée â vérifiez l'adresse"}),a.jsx(H,{size:"lg",onClick:j,disabled:s,children:s?"Enregistrement...":"Enregistrer ma fiche"})]})]})]}):a.jsx("div",{className:"container py-12 text-muted-foreground",children:"Chargement..."})}const Z7=nye,eK=J9,tK=Z9,_ne=[{title:"Boutique",items:[{label:"Produits",href:"/admin/produits",icon:L_},{label:"Commandes",href:"/admin/commandes",icon:Wi},{label:"Codes promo",href:"/admin/codes-promo",icon:Vfe},{label:"Paramètres boutique",href:"/admin/parametres-boutique",icon:y5e}]},{title:"Contenu",items:[{label:"Articles",href:"/admin/articles",icon:dp},{label:"Veille Presse",href:"/admin/veille-presse",icon:PW},{label:"Commentaires",href:"/admin/commentaires",icon:t3,badgeKey:"comments"},{label:"Catégories",href:"/admin/categories",icon:Ofe},{label:"Destinations",href:"/admin/destinations",icon:ZL},{label:"Ãvénements",href:"/admin/evenements",icon:Aj},{label:"Magazine",href:"/admin/magazine",icon:Pu,badgeKey:"magazine"}]},{title:"Partenaires",items:[{label:"Partenaires",href:"/admin/partenaires",icon:qfe},{label:"Points de dépôt",href:"/admin/points-de-depot",icon:_r},{label:"Carte Privilège",href:"/admin/carte-privilege",icon:Jo},{label:"Annuaire des Pros",href:"/admin/annuaire",icon:T$e},{label:"Recommandations",href:"/admin/recommandations",icon:H$e}]},{title:"Régie pub",items:[{label:"Annonceurs",href:"/admin/annonceurs",icon:Ffe,badgeKey:"leads"}]},{title:"Communication",items:[{label:"E-mails",href:"/admin/emails",icon:Ru},{label:"Newsletter",href:"/admin/newsletter",icon:Ru},{label:"Pages légales",href:"/admin/pages-legales",icon:Bfe}]},{title:"Administration",items:[{label:"Utilisateurs",href:"/admin/utilisateurs",icon:RW},{label:"Candidatures",href:"/admin/candidatures",icon:P$e}]},{title:"Site",items:[{label:"Redirections",href:"/admin/redirections",icon:Tfe},{label:"Audit SEO",href:"/admin/seo-audit",icon:is},{label:"Stats audio",href:"/admin/audio-stats",icon:K6},{label:"Paramètres",href:"/admin/parametres",icon:MW}]}];function jne(t,e){return t.items.some(n=>e===n.href||e.startsWith(n.href+"/"))}function Sne({onNavigate:t}){const e=xo(),[n,r]=b.useState(()=>{const u=new Set;return _ne.forEach(d=>{jne(d,e.pathname)&&u.add(d.title)}),u}),{data:s=0}=Ne({queryKey:["sidebar_magazine_in_prep"],queryFn:async()=>{const{count:u}=await Z.from("magazine_issues").select("id",{count:"exact",head:!0}).in("status",["planning","in_progress","review"]);return u??0}}),{data:i=0}=Ne({queryKey:["sidebar_flagged_comments"],queryFn:async()=>{const{count:u}=await Z.from("comments").select("id",{count:"exact",head:!0}).eq("is_flagged",!0);return u??0}}),{data:o=0}=Ne({queryKey:["sidebar_new_leads"],queryFn:async()=>{const{count:u}=await Z.from("advertiser_leads").select("id",{count:"exact",head:!0}).eq("status","new");return u??0}}),l=u=>{r(d=>{const h=new Set(d);return h.has(u)?h.delete(u):h.add(u),h})},c=u=>u==="/admin"?e.pathname==="/admin":e.pathname===u||e.pathname.startsWith(u+"/");return a.jsxs("nav",{className:"flex flex-col gap-1 px-3",children:[a.jsxs(_e,{to:"/admin",onClick:t,className:`flex items-center gap-3 rounded-lg px-3 py-2.5 text-sm font-medium transition-colors ${e.pathname==="/admin"?"bg-white/10 text-white":"text-white/60 hover:bg-white/5 hover:text-white/80"}`,children:[a.jsx(Q$e,{className:"h-4 w-4 shrink-0"}),a.jsx("span",{className:"flex-1",children:"Tableau de bord"})]}),_ne.map(u=>{const d=jne(u,e.pathname),h=n.has(u.title);return a.jsxs(Z7,{open:h,onOpenChange:()=>l(u.title),children:[a.jsx(eK,{asChild:!0,children:a.jsxs("button",{className:`flex w-full items-center gap-3 rounded-lg px-3 py-2 text-xs font-semibold uppercase tracking-wider transition-colors ${d?"text-white":"text-white/40 hover:text-white/70"}`,children:[a.jsx("span",{className:"flex-1 text-left",children:u.title}),a.jsx(wh,{className:`h-3.5 w-3.5 shrink-0 transition-transform duration-200 ${h?"rotate-180":""}`})]})}),a.jsx(tK,{children:a.jsx("div",{className:"flex flex-col gap-0.5 pb-1 pl-2",children:u.items.map(f=>{const p=c(f.href),m=f.badgeKey==="magazine"&&s>0?s:f.badgeKey==="comments"&&i>0?i:f.badgeKey==="leads"&&o>0?o:null;return a.jsxs(_e,{to:f.href,onClick:t,className:`flex items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium transition-colors ${p?"bg-white/10 text-white":"text-white/60 hover:bg-white/5 hover:text-white/80"}`,children:[a.jsx(f.icon,{className:"h-4 w-4 shrink-0"}),a.jsx("span",{className:"flex-1",children:f.label}),m!==null&&a.jsx("span",{className:"rounded-full bg-orange-500 px-1.5 py-0.5 text-[10px] font-semibold text-white",children:m})]},f.href)})})})]},u.title)})]})}function nit(){const{user:t,profile:e}=Ji(),[n,r]=b.useState(!1),s=e&&`${e.first_name||""} ${e.last_name||""}`.trim()||(t==null?void 0:t.email);return a.jsxs("div",{className:"flex h-screen bg-muted/40",children:[a.jsxs("aside",{className:"hidden w-[250px] shrink-0 flex-col bg-[#1B2A3D] lg:flex",children:[a.jsxs("div",{className:"flex h-16 items-center px-6",children:[a.jsx(_e,{to:"/admin",className:"font-heading text-lg font-bold text-white",children:"Esprit Sud"}
1051),a.jsx("span",{className:"ml-2 rounded bg-white/20 px-1.5 py-0.5 text-[10px] font-medium text-white",children:"Admin"})]}),a.jsx("div",{className:"flex-1 overflow-y-auto py-4",children:a.jsx(Sne,{})}),a.jsx("div",{className:"border-t border-white/10 p-4",children:a.jsxs("a",{href:"/",target:"_blank",rel:"noopener",className:"flex items-center gap-2 text-xs text-white/50 hover:text-white/70",children:[a.jsx(Gi,{className:"h-3.5 w-3.5"})," Voir le site"]})})]}),a.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[a.jsxs("header",{className:"flex h-14 items-center justify-between border-b border-border bg-card px-4 lg:px-6",children:[a.jsxs(Dj,{open:n,onOpenChange:r,children:[a.jsx(XW,{asChild:!0,children:a.jsx(H,{variant:"ghost",size:"icon",className:"lg:hidden",children:a.jsx($fe,{className:"h-5 w-5"})})}),a.jsx(P0,{side:"left",className:"w-[250px] bg-[#1B2A3D] p-0 pt-12",children:a.jsx(Sne,{onNavigate:()=>r(!1)})})]}),a.jsxs("div",{className:"flex items-center gap-3 ml-auto",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:s}),a.jsx(H,{variant:"outline",size:"sm",asChild:!0,children:a.jsxs("a",{href:"/",target:"_blank",rel:"noopener",children:[a.jsx(Gi,{className:"mr-1.5 h-3.5 w-3.5"})," Voir le site"]})})]})]}),a.jsx("main",{className:"flex-1 overflow-y-auto p-3 sm:p-4 lg:p-6",children:a.jsx(Ahe,{})})]})]})}var nK="Progress",rK=100,[rit,VLt]=Ys(nK),[sit,iit]=rit(nK),nje=b.forwardRef((t,e)=>{const{__scopeProgress:n,value:r=null,max:s,getValueLabel:i=ait,...o}=t;(s||s===0)&&!Nne(s)&&console.error(oit(`${s}`,"Progress"));const l=Nne(s)?s:rK;r!==null&&!Cne(r,l)&&console.error(lit(`${r}`,"Progress"));const c=Cne(r,l)?r:null,u=bI(c)?i(c,l):void 0;return a.jsx(sit,{scope:n,value:c,max:l,children:a.jsx(et.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":bI(c)?c:void 0,"aria-valuetext":u,role:"progressbar","data-state":ije(c,l),"data-value":c??void 0,"data-max":l,...o,ref:e})})});nje.displayName=nK;var rje="ProgressIndicator",sje=b.forwardRef((t,e)=>{const{__scopeProgress:n,...r}=t,s=iit(rje,n);return a.jsx(et.div,{"data-state":ije(s.value,s.max),"data-value":s.value??void 0,"data-max":s.max,...r,ref:e})});sje.displayName=rje;function ait(t,e){return`${Math.round(t/e*100)}%`}function ije(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function bI(t){return typeof t=="number"}function Nne(t){return bI(t)&&!isNaN(t)&&t>0}function Cne(t,e){return bI(t)&&!isNaN(t)&&t<=e&&t>=0}function oit(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${rK}\`.`}function lit(t,e){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${e}\`. The \`value\` prop must be: 1052 - a positive number 1053 - less than the value passed to \`max\` (or ${rK} if no \`max\` prop is set) 1054 - \`null\` or \`undefined\` if the progress is indeterminate. 1055 1056Defaulting to \`null\`.`}var aje=nje,cit=sje;const Bg=b.forwardRef(({className:t,value:e,...n},r)=>a.jsx(aje,{ref:r,className:Fe("relative h-4 w-full overflow-hidden rounded-full bg-secondary",t),...n,children:a.jsx(cit,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(e||0)}%)`}})}));Bg.displayName=aje.displayName;const uit={pending:"bg-yellow-100 text-yellow-800",paid:"bg-blue-100 text-blue-800",shipped:"bg-purple-100 text-purple-800",delivered:"bg-green-100 text-green-800",cancelled:"bg-gray-100 text-gray-800",refunded:"bg-red-100 text-red-800"},dit={draft:"bg-gray-100 text-gray-800",review:"bg-yellow-100 text-yellow-800",published:"bg-green-100 text-green-800",archived:"bg-red-100 text-red-800"};function hit(){const t=new Date(new Date().getFullYear(),new Date().getMonth(),1).toISOString(),{data:e}=Ne({queryKey:["admin_dashboard_stats"],queryFn:async()=>{const[o,l,c,u,d,h,f]=await Promise.all([Z.from("products").select("id",{count:"exact",head:!0}).eq("is_active",!0),Z.from("orders").select("id",{count:"exact",head:!0}).gte("created_at",t),Z.from("partners").select("id",{count:"exact",head:!0}).eq("is_carte_privilege",!0),Z.from("carte_privilege").select("id",{count:"exact",head:!0}).eq("status","active"),Z.from("newsletter_subscribers").select("id",{count:"exact",head:!0}).eq("is_active",!0),Z.from("newsletter_subscribers").select("id",{count:"exact",head:!0}).eq("is_active",!0).gte("created_at",t),Z.from("profiles").select("id",{count:"exact",head:!0})]);return{products:o.count??0,orders:l.count??0,partners:c.count??0,cartes:u.count??0,newsActive:d.count??0,newsMonth:h.count??0,users:f.count??0}}}),{data:n=[]}=Ne({queryKey:["admin_recent_orders"],queryFn:async()=>{const{data:o}=await Z.from("orders").select("*").order("created_at",{ascending:!1}).limit(5);return o??[]}}),{data:r=[]}=Ne({queryKey:["admin_recent_articles"],queryFn:async()=>{const{data:o}=await Z.from("articles").select("*").order("created_at",{ascending:!1}).limit(5);return o??[]}}),{data:s}=Ne({queryKey:["admin_current_magazine"],queryFn:async()=>{const{data:o}=await Z.from("magazine_issues").select("*").in("status",["planning","in_progress","review"]).order("issue_number",{ascending:!1}).limit(1),l=o==null?void 0:o[0];if(!l)return null;const[{data:c},{data:u}]=await Promise.all([Z.from("articles").select("id, status").eq("magazine_issue_id",l.id),Z.from("magazine_pages").select("id, page_type, ad_file_received").eq("issue_id",l.id)]),d=(c||[]).filter(m=>m.status==="validated").length,h=(c||[]).length,f=(u||[]).filter(m=>m.page_type==="ad"),p=f.filter(m=>m.ad_file_received).length;return{issue:l,validated:d,total:h,adsReceived:p,adsTotal:f.length}}}),i=[{label:"Produits actifs",value:(e==null?void 0:e.products)??"â",icon:L_,color:"text-blue-600 bg-blue-50"},{label:"Commandes ce mois",value:(e==null?void 0:e.orders)??"â",icon:Wi,color:"text-purple-600 bg-purple-50"},{label:"Partenaires Carte",value:(e==null?void 0:e.partners)??"â",icon:_r,color:"text-green-600 bg-green-50"},{label:"Abonnés actifs",value:(e==null?void 0:e.cartes)??"â",icon:Jo,color:"text-amber-600 bg-amber-50"}];return a.jsxs("div",{children:[a.jsx("h1",{className:"font-heading text-2xl font-bold",children:"Tableau de bord"}),a.jsx(fit,{}),a.jsx("div",{className:"mt-6 grid gap-4 sm:grid-cols-2 xl:grid-cols-4",children:i.map(o=>a.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:o.label}),a.jsx("div",{className:`flex h-9 w-9 items-center justify-center rounded-lg ${o.color}`,children:a.jsx(o.icon,{className:"h-4 w-4"})})]}),a.jsx("div",{className:"mt-2 font-heading text-3xl font-bold",children:o.value})]},o.label))}),s&&a.jsxs(_e,{to:`/admin/magazine/${s.issue.id}
1056`,className:"mt-6 flex items-center gap-4 rounded-xl border border-orange-200 bg-orange-50 p-5 hover:bg-orange-100 transition",children:[a.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-lg bg-orange-200 text-orange-700",children:a.jsx(Pu,{className:"h-6 w-6"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"font-heading text-lg font-semibold",children:["Magazine N°",s.issue.issue_number," en préparation",s.issue.title&&a.jsxs("span",{className:"text-muted-foreground",children:[" â ",s.issue.title]})]}),a.jsxs("div",{className:"text-sm text-muted-foreground mt-1",children:[a.jsx("strong",{children:s.validated}),"/",s.total," article(s) validé(s) ·"," ",a.jsx("strong",{children:s.adsReceived}),"/",s.adsTotal," publicité(s) reçue(s)"]}),a.jsx(Bg,{value:s.total?s.validated/s.total*100:0,className:"mt-2 h-1.5"})]}),a.jsx(Au,{className:"h-5 w-5 text-orange-600"})]}),a.jsxs(_e,{to:"/admin/newsletter",className:"mt-6 flex items-center gap-4 rounded-xl border border-border bg-card p-5 hover:bg-muted/40 transition",children:[a.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-lg bg-blue-100 text-blue-700",children:a.jsx(L_,{className:"h-6 w-6"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("div",{className:"font-heading text-lg font-semibold",children:"Newsletter"}),a.jsxs("div",{className:"text-sm text-muted-foreground",children:[a.jsx("strong",{children:(e==null?void 0:e.newsActive)??0})," abonnés actifs · ",a.jsxs("span",{className:"text-green-600",children:["+",(e==null?void 0:e.newsMonth)??0]})," ce mois"]})]}),a.jsx(Au,{className:"h-5 w-5 text-muted-foreground"})]}),a.jsxs(_e,{to:"/admin/utilisateurs",className:"mt-4 flex items-center gap-4 roun
1056ded-xl border border-border bg-card p-5 hover:bg-muted/40 transition",children:[a.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-lg bg-indigo-100 text-indigo-700",children:a.jsx(RW,{className:"h-6 w-6"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("div",{className:"font-heading text-lg font-semibold",children:"Utilisateurs"}),a.jsxs("div",{className:"text-sm text-muted-foreground",children:[a.jsx("strong",{children:(e==null?void 0:e.users)??0})," comptes créés · accès rapide à la liste complète"]})]}),a.jsx(Au,{className:"h-5 w-5 text-muted-foreground"})]}),a.jsxs("div",{className:"mt-8 grid gap-6 lg:grid-cols-2",children:[a.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h2",{className:"font-heading text-lg font-semibold",children:"Dernières commandes"}),a.jsx(_e,{to:"/admin/commandes",className:"text-sm text-primary hover:underline",children:"Voir tout"})]}),n.length===0?a.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:"Aucune commande"}):a.jsx("div",{className:"mt-4 space-y-3",children:n.map(o=>{var l;return a.jsxs(_e,{to:`/admin/commandes/${o.id}`,className:"flex items-center justify-between rounded-lg p-2 hover:bg-muted transition-colors",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-sm font-medium",children:o.order_number||o.id.slice(0,8)}),a.jsx("div",{className:"text-xs text-muted-foreground",children:new Date(o.created_at).toLocaleDateString("fr-FR")})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("span",{className:"text-sm font-semibold",children:[(l=o.total)==null?void 0:l.toFixed(2).replace(".",",")," â¬"]}),a.jsx(ke,{className:`text-xs ${uit[o.status]||""}`,children:o.status})]})]},o.id)})})]}),a.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h2",{className:"font-heading text-lg font-semibold",children:"Derniers articles"}),a.jsx(_e,{to:"/admin/articles",className:"text-sm text-primary hover:underline",children:"Voir tout"})]}),r.length===0?a.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:"Aucun article"}):a.jsx("div",{className:"mt-4 space-y-3",children:r.map(o=>a.jsxs(_e,{to:`/admin/articles/${o.id}/modifier`,className:"flex items-center justify-between rounded-lg p-2 hover:bg-muted transition-colors",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-sm font-medium",children:o.title}),a.jsx("div",{className:"text-xs text-muted-foreground",children:new Date(o.created_at).toLocaleDateString("fr-FR")})]}),a.jsx(ke,{className:`text-xs ${dit[o.status]||""}`,children:o.status})]},o.id))})]})]})]})}function fit(){const t=new Date(Date.now()-6048e5).toISOString(),{data:e=0}=Ne({queryKey:["dashboard_404_count"],queryFn:async()=>{const{count:n}=await Z.from("error_logs_404").select("id",{count:"exact",head:!0}).eq("is_resolved",!1).gte("last_seen_at",t);return n??0}});return e===0?null:a.jsxs(_e,{to:"/admin/redirections",className:"mt-4 flex items-center gap-3 rounded-xl border border-orange-200 bg-orange-50 p-4 transition-colors hover:bg-orange-100",children:[a.jsx(F_,{className:"h-5 w-5 text-orange-600 shrink-0"}),a.jsxs("div",{className:"flex-1 text-sm",children:[a.jsxs("span",{className:"font-semibold text-orange-900",children:[e," erreur",e>1?"s":""," 404 non résolue",e>1?"s":""]})," ",a.jsx("span",{className:"text-orange-700",children:"cette semaine"})]}),a.jsx(Au,{className:"h-4 w-4 text-orange-600"})]})}function pit(){const t=St(),[e,n]=b.useState(""),[r,s]=b.useState("all"),[i,o]=b.useState("all"),{data:l=[],isLoading:c}=Ne({queryKey:["admin_products"],queryFn:async()=>{const{data:p,error:m}=await Z.from("products").select("*, product_categories(name)").order("created_at",{ascending:!1});if(m)throw m;return p}}),{data:u=[]}=Ne({queryKey:["product_categories"],queryFn:async()=>{const{data:p}=await Z.from("product_categories").select("*").order("sort_order");return p??[]}}),d=Qe({mutationFn:async({id:p,active:m})=>{const{error:v}=await Z.from("products").update({is_active:m}).eq("id",p);if(v)throw v},onSuccess:()=>
1056t.invalidateQueries({queryKey:["admin_products"]})}),h=Qe({mutationFn:async p=>{const{error:m}=await Z.from("products").delete().eq("id",p);if(m)throw m},onSuccess:()=>{t.invalidateQueries({queryKey:["admin_products"]}),ee.success("Produit supprimé")}}),f=l.filter(p=>!e||p.name.toLowerCase().includes(e.toLowerCase())).filter(p=>r==="all"||p.category_id===r).filter(p=>i==="all"||p.product_type===i);return a.jsxs("div",{children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[a.jsx("h1",{className:"font-heading text-2xl font-bold",children:"Produits"}),a.jsx(H,{asChild:!0,children:a.jsxs(_e,{to:"/admin/produits/nouveau",children:[a.jsx(dr,{className:"mr-2 h-4 w-4"})," Nouveau produit"]})})]}),a.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[a.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[a.jsx(is,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(ue,{placeholder:"Rechercherâ¦",value:e,onChange:p=>n(p.target.value),className:"pl-9 h-9"})]}),a.jsxs("select",{className:"rounded-lg border border-border bg-card px-3 py-1.5 text-sm",value:r,onChange:p=>s(p.target.value),children:[a.jsx("option",{value:"all",children:"Toutes catégories"}),u.map(p=>a.jsx("option",{value:p.id,children:p.name},p.id))]}),a.jsxs("select",{className:"rounded-lg border border-border bg-card px-3 py-1.5 text-sm",value:i,onChange:p=>o(p.target.value),children:[a.jsx("option",{value:"all",children:"Tous types"}),a.jsx("option",{value:"physical",children:"Physique"}),a.jsx("option",{value:"digital",children:"Numérique"}),a.jsx("option",{value:"experience",children:"Expérience"})]})]}),c?a.jsx("div",{className:"mt-8 space-y-3",children:[1,2,3].map(p=>a.jsx("div",{className:"h-16 animate-pulse rounded-lg bg-muted"},p))}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"mt-6 hidden overflow-x-auto rounded-xl border border-border bg-card md:block",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"border-b border-border bg-muted/50",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Image"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Nom"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Catégorie"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Type"}),a.jsx("th",{className:"px-4 py-3 text-right font-medium",children:"Prix"}),a.jsx("th",{className:"px-4 py-3 text-right font-medium",children:"Stock"}),a.jsx("th",{className:"px-4 py-3 text-center font-medium",children:"Actif"}),a.jsx("th",{className:"px-4 py-3 text-right font-medium",children:"Actions"})]})}),a.jsx("tbody",{children:f.map(p=>{var m,v,x;return a.jsxs("tr",{className:"border-b border-border last:border-0",children:[a.jsx("td",{className:"px-4 py-2",children:a.jsx("div",{className:"h-10 w-10 overflow-hidden rounded bg-muted",children:((m=p.images)==null?void 0:m[0])&&a.jsx("img",{src:p.images[0],alt:"",className:"h-full w-full object-cover"})})}),a.jsx("td",{className:"px-4 py-2 font-medium",children:p.name}),a.jsx("td",{className:"px-4 py-2 text-muted-foreground",children:((v=p.product_categories)==null?void 0:v.name)||"â"}),a.jsx("td",{className:"px-4 py-2",children:a.jsx(ke,{variant:"outline",className:"text-xs",children:p.product_type})}),a.jsxs("td",{className:"px-4 py-2 text-right",children:[(x=p.price)==null?void 0:x.toFixed(2)," â¬"]}),a.jsx("td",{className:"px-4 py-2 text-right",children:p.stock??"â"}),a.jsx("td",{className:"px-4 py-2 text-center",children:a.jsx(_n,{checked:p.is_active,onCheckedChange:g=>d.mutate({id:p.id,active:g})})}),a.jsx("td",{className:"px-4 py-2 text-right",children:a.jsxs("div",{className:"flex justify-end gap-1",children:[a.jsx(H,{variant:"ghost",size:"icon",className:"h-8 w-8",asChild:!0,children:a.jsx(_e,{to:`/admin/produits/${p.id}/modifier`,children:a.jsx(Oc,{className:"h-3.5 w-3.5"})})}),a.jsxs(ro,{children:[a.jsx(U3,{asChild:!0,children:a.jsx(H,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive",children:a.jsx(tr,{className:"h-3.5 w-3.5"})})}),a.jsxs(ja,{children:[a.jsxs(Sa,{children:[a.jsx(Ca,{children:"Supprimer ce produit ?"}),a.jsx(ka,{children:"Cette action est irréversible."})]}),a.jsxs(Na,{children:[a.jsx(Ea,{children:"Annuler"}),a.jsx(Aa,{onClick:()=>h.mutate(p.id),children:"Supprimer"})]})]})]})]})})]}
1056,p.id)})})]})}),a.jsx("div",{className:"mt-6 space-y-3 md:hidden",children:f.map(p=>{var m,v,x;return a.jsx("div",{className:"rounded-xl border border-border bg-card p-4",children:a.jsxs("div",{className:"flex gap-3",children:[a.jsx("div",{className:"h-14 w-14 shrink-0 overflow-hidden rounded-lg bg-muted",children:((m=p.images)==null?void 0:m[0])&&a.jsx("img",{src:p.images[0],alt:"",className:"h-full w-full object-cover"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h3",{className:"font-medium",children:p.name}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[(v=p.product_categories)==null?void 0:v.name," · ",p.product_type]}),a.jsxs("div",{className:"mt-1 flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm font-semibold",children:[(x=p.price)==null?void 0:x.toFixed(2)," â¬"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(_n,{checked:p.is_active,onCheckedChange:g=>d.mutate({id:p.id,active:g})}),a.jsx(H,{variant:"ghost",size:"icon",className:"h-8 w-8",asChild:!0,children:a.jsx(_e,{to:`/admin/produits/${p.id}/modifier`,children:a.jsx(Oc,{className:"h-3.5 w-3.5"})})})]})]})]})]})},p.id)})}),f.length===0&&a.jsx("p",{className:"mt-8 text-center text-muted-foreground",children:"Aucun produit trouvé."})]})]})}function c0({value:t=[],onChange:e,bucket:n="images",folder:r="uploads",max:s=10,single:i=!1}){const[o,l]=b.useState(!1),c=b.useRef(null),u=async h=>{if(!(h!=null&&h.length))return;const f=["image/jpeg","image/png","image/webp"],p=5*1024*1024;l(!0);const m=[];for(const v of Array.from(h)){if(!f.includes(v.type)){ee.error(`Format non supporté : ${v.name}`);continue}if(v.size>p){ee.error(`Fichier trop volumineux : ${v.name}`);continue}const x=v.name.split(".").pop(),g=`${r}/${Date.now()}-${Math.random().toString(36).slice(2)}.${x}`,{error:w}=await Z.storage.from(n).upload(g,v);if(w){ee.error(`Erreur upload : ${w.message}`);continue}const{data:_}=Z.storage.from(n).getPublicUrl(g);m.push(_.publicUrl)}m.length&&e(i?m.slice(0,1):[...t,...m].slice(0,s)),l(!1),c.current&&(c.current.value="")},d=h=>{e(t.filter((f,p)=>p!==h))};return a.jsxs("div",{children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[t.map((h,f)=>a.jsxs("div",{className:"relative h-20 w-20 overflow-hidden rounded-lg border border-border",children:[a.jsx("img",{src:h,alt:"",className:"h-full w-full object-cover"}),a.jsx("button",{type:"button","aria-label":"Supprimer l'image",onClick:()=>d(f),className:"absolute right-0.5 top-0.5 rounded-full bg-destructive p-1 text-destructive-foreground shadow",children:a.jsx(ks,{className:"h-3 w-3"})})]},f)),(i?t.length===0:t.length<s)&&a.jsx("button",{type:"button",onClick:()=>{var h;return(h=c.current)==null?void 0:h.click()},disabled:o,className:"flex h-20 w-20 items-center justify-center rounded-lg border-2 border-dashed border-border text-muted-foreground hover:border-primary hover:text-primary transition-colors",children:o?a.jsx(Je,{className:"h-5 w-5 animate-spin"}):a.jsx(Oa,{className:"h-5 w-5"})}),i&&t.length>0&&a.jsxs(H,{type:"button",variant:"outline",size:"sm",disabled:o,onClick:()=>{var h;return(h=c.current)==null?void 0:h.click()},children:[o?a.jsx(Je,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(Oa,{className:"mr-2 h-4 w-4"}),"Remplacer"]})]}),a.jsx("input",{ref:c,type:"file",accept:"image/jpeg,image/png,image/webp",multiple:!i,className:"hidden",onChange:h=>u(h.target.files)})]})}function kne(t){return t.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}const Ane={name:"",slug:"",short_description:"",description:"",category_id:"",product_type:"physical",price:0,promo_price:null,carte_privilege_discount_percent:0,stock:0,images:[],digital_file_url:"",experience_duration_minutes:null,experience_location:"",experience_provider:"",experience_commission_percent:null,has_variants:!1,is_featured:!1,is_active:!0,seo_title:"",seo_description:""};function Ene(){const{id:t}=Xi(),e=!!t,n=Gs(),r=St(),[s,i]=b.useState(Ane),[o,l]=b.useState([]),[c,u]=b.useState({name:"",sku:"",price_override:"",stock:0}),{data:d=[]}=Ne({queryKey:["product_categories"],queryFn:async()=>{const{data:g}=await Z.from("product_categories").select("*").order("sort_order");return g??[]}}),{data:h}=Ne({queryKey:["admin_product",t],enabled:e,queryFn:async()=>{const{data:g}=await Z.from("products").select("*").eq("id",t).single();return g}}),{data:f=[]}=Ne({queryKey:["admin_product_variants",t],enabled:e,queryFn:async()=>{const{data:g}=await Z.from("product_variants").select("*").eq("product_id",t).order("sort_order");return g??[]}});b.useEffect(()=>{h&&i({...Ane,...h,promo_price:h.promo_price??null,digital_file_url:h.digital_file_url??""})}
1056,[h]),b.useEffect(()=>{l(f)},[f]);const p=(g,w)=>i(_=>({..._,[g]:w})),m=Qe({mutationFn:async()=>{const g={...s,slug:s.slug||kne(s.name),promo_price:s.promo_price||null};if(e){const{error:w}=await Z.from("products").update(g).eq("id",t);if(w)throw w}else{const{error:w}=await Z.from("products").insert(g);if(w)throw w}},onSuccess:()=>{r.invalidateQueries({queryKey:["admin_products"]}),ee.success(e?"Produit mis à jour":"Produit créé"),n("/admin/produits")},onError:g=>ee.error(g.message)}),v=async()=>{if(!c.name||!t)return;const{error:g}=await Z.from("product_variants").insert({product_id:t,name:c.name,sku:c.sku||null,price_override:c.price_override?parseFloat(c.price_override):null,stock:c.stock,sort_order:o.length+1});if(g){ee.error(g.message);return}r.invalidateQueries({queryKey:["admin_product_variants",t]}),u({name:"",sku:"",price_override:"",stock:0}),ee.success("Variante ajoutée")},x=async g=>{await Z.from("product_variants").delete().eq("id",g),r.invalidateQueries({queryKey:["admin_product_variants",t]})};return a.jsxs("div",{className:"mx-auto max-w-3xl",children:[a.jsx("h1",{className:"font-heading text-2xl font-bold",children:e?"Modifier le produit":"Nouveau produit"}),a.jsxs("div",{className:"mt-6 space-y-5 rounded-xl border border-border bg-card p-6",children:[a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(te,{children:"Nom *"}),a.jsx(ue,{value:s.name,onChange:g=>{p("name",g.target.value),e||p("slug",kne(g.target.value))}})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Slug"}),a.jsx(ue,{value:s.slug,onChange:g=>p("slug",g.target.value)})]})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Description courte"}),a.jsx(fn,{value:s.short_description,onChange:g=>p("short_description",g.target.value),rows:2})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Description complète"}),a.jsx(fn,{value:s.description,onChange:g=>p("description",g.target.value),rows:5})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[a.jsxs("div",{children:[a.jsx(te,{children:"Catégorie"}),a.jsxs("select",{className:"w-full rounded-lg border border-border px-3 py-2 text-sm",value:s.category_id,onChange:g=>p("category_id",g.target.value),children:[a.jsx("option",{value:"",children:"â Choisir â"}),d.map(g=>a.jsx("option",{value:g.id,children:g.name},g.id))]})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Type"}),a.jsxs("select",{className:"w-full rounded-lg border border-border px-3 py-2 text-sm",value:s.product_type,onChange:g=>p("product_type",g.target.value),children:[a.jsx("option",{value:"physical",children:"Physique"}),a.jsx("option",{value:"digital",children:"Numérique"}),a.jsx("option",{value:"experience",children:"Expérience"})]})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Stock"}),a.jsx(ue,{type:"number",value:s.stock,onChange:g=>p("stock",parseInt(g.target.value)||0)})]})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[a.jsxs("div",{children:[a.jsx(te,{children:"Prix (â¬)"}),a.jsx(ue,{type:"number",step:"0.01",value:s.price,onChange:g=>p("price",parseFloat(g.target.value)||0)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Prix promo (â¬)"}),a.jsx(ue,{type:"number",step:"0.01",value:s.promo_price??"",onChange:g=>p("promo_price",g.target.value?parseFloat(g.target.value):null)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Réduction Carte Privilège %"}),a.jsx(ue,{type:"number",value:s.carte_privilege_discount_percent,onChange:g=>p("carte_privilege_discount_percent",parseInt(g.target.value)||0)})]})]}),s.product_type==="digital"&&a.jsxs("div",{children:[a.jsx(te,{children:"URL fichier digital"}),a.jsx(ue,{value:s.digital_file_url,onChange:g=>p("digital_file_url",g.target.value),placeholder:"URL ou upload"})]}),s.product_type==="experience"&&a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(te,{children:"Durée (min)"}),a.jsx(ue,{type:"number",value:s.experience_duration_minutes??"",onChange:g=>p("experience_duration_minutes",parseInt(g.target.value)||null)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Lieu"}),a.jsx(ue,{value:s.experience_location,onChange:g=>p("experience_location",g.target.value)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Prestataire"}
1056),a.jsx(ue,{value:s.experience_provider,onChange:g=>p("experience_provider",g.target.value)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Commission %"}),a.jsx(ue,{type:"number",value:s.experience_commission_percent??"",onChange:g=>p("experience_commission_percent",parseFloat(g.target.value)||null)})]})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Images"}),a.jsx(c0,{value:s.images,onChange:g=>p("images",g),folder:"products"})]}),a.jsxs("div",{className:"flex flex-wrap gap-6",children:[a.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[a.jsx(wr,{checked:s.is_featured,onCheckedChange:g=>p("is_featured",!!g)})," Mis en avant"]}),a.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[a.jsx(wr,{checked:s.is_active,onCheckedChange:g=>p("is_active",!!g)})," Actif"]}),a.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[a.jsx(wr,{checked:s.has_variants,onCheckedChange:g=>p("has_variants",!!g)})," A des variantes"]})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(te,{children:"SEO Titre"}),a.jsx(ue,{value:s.seo_title,onChange:g=>p("seo_title",g.target.value)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"SEO Description"}),a.jsx(ue,{value:s.seo_description,onChange:g=>p("seo_description",g.target.value)})]})]}),a.jsxs("div",{className:"flex gap-3 pt-2",children:[a.jsx(H,{onClick:()=>m.mutate(),disabled:m.isPending,children:m.isPending?"Enregistrementâ¦":"Enregistrer"}),a.jsx(H,{variant:"outline",onClick:()=>n("/admin/produits"),children:"Annuler"})]})]}),e&&s.has_variants&&a.jsxs("div",{className:"mt-6 rounded-xl border border-border bg-card p-6",children:[a.jsx("h2",{className:"font-heading text-lg font-semibold",children:"Variantes"}),o.length>0&&a.jsx("div",{className:"mt-4 space-y-2",children:o.map(g=>a.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border p-3 text-sm",children:[a.jsxs("div",{children:[a.jsx("span",{className:"font-medium",children:g.name}),g.sku&&a.jsxs("span",{className:"ml-2 text-muted-foreground",children:["SKU: ",g.sku]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[g.price_override&&a.jsxs("span",{children:[g.price_override," â¬"]}),a.jsxs("span",{className:"text-muted-foreground",children:["Stock: ",g.stock]}),a.jsx(H,{variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive",onClick:()=>x(g.id),children:a.jsx(tr,{className:"h-3.5 w-3.5"})})]})]},g.id))}),a.jsxs("div",{className:"mt-4 flex flex-wrap gap-2 items-end",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-xs",children:"Nom"}),a.jsx(ue,{className:"h-8 w-32",value:c.name,onChange:g=>u({...c,name:g.target.value})})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-xs",children:"SKU"}),a.jsx(ue,{className:"h-8 w-24",value:c.sku,onChange:g=>u({...c,sku:g.target.value})})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-xs",children:"Prix"}),a.jsx(ue,{className:"h-8 w-20",value:c.price_override,onChange:g=>u({...c,price_override:g.target.value})})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-xs",children:"Stock"}),a.jsx(ue,{type:"number",className:"h-8 w-16",value:c.stock,onChange:g=>u({...c,stock:parseInt(g.target.value)||0})})]}),a.jsxs(H,{size:"sm",onClick:v,children:[a.jsx(dr,{className:"mr-1 h-3 w-3"})," Ajouter"]})]})]})]})}const mit={paid:{label:"à expédier",color:"bg-orange-100 text-orange-800 border-orange-200"},shipped:{label:"Expédié",color:"bg-blue-100 text-blue-800 border-blue-200"},delivered:{label:"Livré",color:"bg-green-100 text-green-800 border-green-200"},cancelled:{label:"Annulé",color:"bg-red-100 text-red-800 border-red-200"},pending:{label:"En attente",color:"bg-yellow-100 text-yellow-800 border-yellow-200"},refunded:{label:"Remboursé",color:"bg-gray-100 text-gray-800 border-gray-200"}},git=[{label:"Moins de 500g",value:"0.5"},{label:"500g - 1kg",value:"1.0"},{label:"1kg - 2kg",value:"2.0"}];function H5({status:t}){const e=mit[t]||{label:t,color:"bg-muted text-muted-foreground"};return a.jsx(ke,{variant:"outline",className:`text-xs font-medium ${e.color}`,children:e.label})}function W5({hasPhysical:t}){return t?a.jsxs(ke,{variant:"outline",className:"text-xs bg-amber-50 text-amber-700 border-amber-200",children:[a.jsx(L_,{className:"mr-1 h-3 w-3"}),"Physique"]}):a.jsxs(ke,{variant:"outline",className:"text-xs bg-indigo-50 text-indigo-700 border-indigo-200",children:[a.jsx(dp,{className:"mr-1 h-3 w-3"}),"PDF"]})}function K5(t){return t?[t.shipping_name,t.shipping_address,[t.shipping_postal_code,t.shipping_city].filter(
1056Boolean).join(" "),t.shipping_country,t.shipping_phone].filter(e=>e&&String(e).trim()):[]}function vit(t){return t?[t.billing_name,t.billing_address,[t.billing_zip,t.billing_city].filter(Boolean).join(" "),t.billing_country].filter(e=>e&&String(e).trim()):[]}function Tne({title:t,lines:e,empty:n}){const r=e.join(` 1057`);return a.jsxs("div",{className:"rounded-lg border border-border p-3 space-y-1.5 text-sm",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsx("p",{className:"font-medium",children:t}),e.length>0&&a.jsxs(H,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{navigator.clipboard.writeText(r),ee.success(`${t} copiée`)},children:[a.jsx(Pl,{className:"mr-1 h-3.5 w-3.5"}),"Copier"]})]}),e.length>0?a.jsx("p",{className:"text-muted-foreground whitespace-pre-line leading-relaxed",children:r}):a.jsx("p",{className:"text-muted-foreground italic",children:n||"Non renseignée"})]})}function na({label:t,value:e}){return a.jsxs("div",{className:"flex justify-between gap-3",children:[a.jsx("span",{className:"text-muted-foreground",children:t}),a.jsx("span",{className:"text-right",children:e})]})}function xit(t){const e=["Date","Numéro","Nom","Email","Articles","Montant","Status","Tracking","Livraison nom","Livraison adresse","Livraison CP","Livraison ville","Livraison pays","Livraison téléphone","Facturation nom","Facturation adresse","Facturation CP","Facturation ville","Facturation pays"],n=t.map(l=>{var u,d;const c=(l.items_summary||[]).map(h=>`${h.product_name} x${h.quantity}`).join("; ");return[new Date(l.created_at).toLocaleDateString("fr-FR"),l.order_number||((u=l.id)==null?void 0:u.slice(0,8)),l.customer_name||l.shipping_name||"",l.guest_email||l.customer_email||"",c,(d=l.total)==null?void 0:d.toFixed(2),l.status,l.tracking_number||"",l.shipping_name||"",l.shipping_address||"",l.shipping_postal_code||"",l.shipping_city||"",l.shipping_country||"",l.shipping_phone||"",l.billing_name||"",l.billing_address||"",l.billing_zip||"",l.billing_city||"",l.billing_country||""]}
1057),r=[e,...n].map(l=>l.map(c=>`"${(c||"").replace(/"/g,'""')}"`).join(",")).join(` 1058`),s=new Blob(["\uFEFF"+r],{type:"text/csv;charset=utf-8"}),i=URL.createObjectURL(s),o=document.createElement("a");o.href=i,o.download=`commandes-espritsud-${new Date().toISOString().slice(0,10)}.csv`,o.click(),URL.revokeObjectURL(i)}function yit(){var P,T,M;const t=St(),[e,n]=b.useState(""),[r,s]=b.useState("all"),[i,o]=b.useState("all"),[l,c]=b.useState(null),[u,d]=b.useState("0.5"),[h,f]=b.useState(null),[p,m]=b.useState(null),{data:v=[],isLoading:x}=Ne({queryKey:["admin_orders_full"],queryFn:async()=>{const{data:R,error:A}=await Z.from("orders").select("*").order("created_at",{ascending:!1});if(A)throw A;const I=(R||[]).map(O=>O.id);if(I.length===0)return[];const{data:D}=await Z.from("order_items").select("*").in("order_id",I);return(R||[]).map(O=>{const z=(D||[]).filter(G=>G.order_id===O.id),B=z.some(G=>G.format==="papier"||G.format==="physical"||!G.format);return{...O,items_summary:z,has_physical:O.has_physical??B}})}}),{data:g=[]}=Ne({queryKey:["sendcloud_shipping_methods"],queryFn:async()=>{const{data:{session:R}}=await Z.auth.getSession(),D=await(await fetch("https://aanjkhoyzcvhokzsmifu.supabase.co/functions/v1/sendcloud-shipping?action=shipping_methods",{headers:{Authorization:`Bearer ${R==null?void 0:R.access_token}`,apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImFhbmpraG95emN2aG9renNtaWZ1Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzU0ODIxMTgsImV4cCI6MjA5MTA1ODExOH0.FZffw1trnRiA182HIsLL4uQALqBG6SHIIttPS-tq-Qo"}})).json();return(D==null?void 0:D.shipping_methods)||[]},staleTime:1e3*60*30});function w(R){const A=R.shipping_method||"";return A.startsWith("relay")?"mondial_relay":A.startsWith("correos")||(R.shipping_country||"").toUpperCase()==="ES"?"correos":"colissimo"}function _(R){c(R),d("0.5");const A=w(R),I=g.find(D=>{var O;return(O=D.carrier)==null?void 0:O.toLowerCase().includes(A)});f((I==null?void 0:I.id)||null)}const j=Qe({mutationFn:async R=>{const{data:A,error:I}=await Z.functions.invoke("sync-order-address",{body:{order_id:R}});if(I)throw I;if(A!=null&&A.error)throw new Error(A.error);return A},onSuccess:async R=>{const A=(R==null?void 0:R.items_created)??0;ee.success(A>0?`Adresses resynchronisées et ${A} article(s) restauré(s)`:"Adresses resynchronisées depuis Stripe"),await t.invalidateQueries({queryKey:["admin_orders_full"]}),m(null)},onError:R=>ee.error(R.message||"Ãchec de la synchronisation")}),N=Qe({mutationFn:async R=>{const{data:A,error:I}=await Z.functions.invoke("resend-order-confirmation",{body:{order_id:R}});if(I)throw I;if(A!=null&&A.error)throw new Error(A.error);return A},onSuccess:R=>ee.success(`Confirmation renvoyée à ${R==null?void 0:R.sent_to}`),onError:R=>ee.error(R.message||"Ãchec de l'envoi")}),S=Qe({mutationFn:async()=>{if(!l||!h)throw new Error("Missing data");const{data:{session:R}}=await Z.auth.getSession(),I=await fetch("https://aanjkhoyzcvhokzsmifu.supabase.co/functions/v1/sendcloud-shipping?action=create_parcel",{method:"POST",headers:{Authorization:`Bearer ${R==null?void 0:R.access_token}`,apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImFhbmpraG95emN2aG9renNtaWZ1Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzU0ODIxMTgsImV4cCI6MjA5MTA1ODExOH0.FZffw1trnRiA182HIsLL4uQALqBG6SHIIttPS-tq-Qo","Content-Type":"application/json"},body:JSON.stringify({order_id:l.id,shipment_id:h,weight:u})}),D=await I.json();if(!I.ok)throw new Error(D.error||"Sendcloud error");return D},onSuccess:R=>{ee.success(`Expédition créée â Suivi: ${R.tracking_number}`),t.invalidateQueries({queryKey:["admin_orders_full"]}),c(null),R.label_url&&window.open(R.label_url,"_blank")},onError:R=>ee.error(R.message)}),C=Qe({mutationFn:async R=>{const{data:{session:A}}=await Z.auth.getSession(),D=await fetch("https://aanjkhoyzcvhokzsmifu.supabase.co/functions/v1/sendcloud-shipping?action=resend_email",{method:"POST",headers:{Authorization:`Bearer ${A==null?void 0:A.access_token}`,apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImFhbmpraG95emN2aG9renNtaWZ1Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzU0ODIxMTgsImV4cCI6MjA5MTA1ODExOH0.FZffw1trnRiA182HIsLL4uQALqBG6SHIIttPS-tq-Qo","Content-Type":"application/json"},body:JSON.stringify({order_id:R})});if(!D.ok){const O=await D.json();throw new Error(O.error||"Error")}},onSuccess:()=>ee.success("Email renvoyé"),onError:R=>ee.error(R.message)}),k=Qe({mutationFn:async R=>{const{error:A}=await Z.from("orders").update({status:"delivered"}).eq("id",R);if(A)throw A},onSuccess:()=>{ee.success("Commande marquée comme livrée"),t.invalidateQueries({queryKey:["admin_orders_full"]})},onError:R=>ee.error(R.message)}),E=b.useMemo(()=>v.filter(R=>r==="all"||R.status===r).filter(R=>i==="all"?!0:i==="physical"?R.has_physical:!R.has_physical).filter(R=>{if(!e)return!0;const A=e.toLowerCase();return(R.order_number||R.id||"").toLowerCase().includes(A)||(R.guest_email||R.customer_email||"").toLowerCase().includes(A)||(R.customer_name||"").toLowerCase().includes(A)}),[v,r,i,e]);return a.jsxs("div",{children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[a.jsx("h1",{className:"font-heading text-2xl font-bold",children:"Commandes"}),a.jsxs(H,{variant:"outline",size:"sm",onClick:()=>xit(E),children:[a.jsx(Ts,{className:"mr-1.5 h-3.5 w-3.5"}),"Exporter CSV"]})]}),a.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[a.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[a.jsx(is,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(ue,{placeholder:"Recherche email, n° commande, nomâ¦",value:e,onCh
1058ange:R=>n(R.target.value),className:"pl-9 h-9"})]}),a.jsxs("select",{className:"rounded-lg border border-border bg-card px-3 py-1.5 text-sm",value:r,onChange:R=>s(R.target.value),children:[a.jsx("option",{value:"all",children:"Tous statuts"}),a.jsx("option",{value:"paid",children:"à expédier"}),a.jsx("option",{value:"shipped",children:"Expédié"}),a.jsx("option",{value:"delivered",children:"Livré"}),a.jsx("option",{value:"cancelled",children:"Annulé"})]}),a.jsxs("select",{className:"rounded-lg border border-border bg-card px-3 py-1.5 text-sm",value:i,onChange:R=>o(R.target.value),children:[a.jsx("option",{value:"all",children:"Tous types"}),a.jsx("option",{value:"physical",children:"ð¦ Physique"}),a.jsx("option",{value:"pdf",children:"ð PDF"})]})]}),a.jsxs("div",{className:"mt-3 flex flex-wrap gap-4 text-sm text-muted-foreground",children:[a.jsxs("span",{children:[E.length," commande",E.length!==1?"s":""]}),a.jsxs("span",{className:"text-orange-600 font-medium",children:[v.filter(R=>R.status==="paid"&&R.has_physical).length," à expédier"]})]}),x?a.jsx("div",{className:"mt-8 space-y-3",children:[1,2,3,4].map(R=>a.jsx("div",{className:"h-16 animate-pulse rounded-lg bg-muted"},R))}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"mt-5 hidden overflow-x-auto rounded-xl border border-border bg-card md:block",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"border-b border-border bg-muted/50",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Date"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"N° Commande"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Client"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Articles"}),a.jsx("th",{className:"px-4 py-3 text-right font-medium",children:"Montant"}),a.jsx("th",{className:"px-4 py-3 text-center font-medium",children:"Type"}),a.jsx("th",{className:"px-4 py-3 text-center font-medium",children:"Statut"}),a.jsx("th",{className:"px-4 py-3 text-right font-medium",children:"Actions"})]})}),a.jsx("tbody",{children:E.map(R=>{var A,I;return a.jsxs("tr",{className:"border-b border-border last:border-0 hover:bg-muted/30 transition-colors",children:[a.jsx("td",{className:"px-4 py-3 text-muted-foreground whitespace-nowrap",children:new Date(R.created_at).toLocaleDateString("fr-FR")}),a.jsx("td",{className:"px-4 py-3 font-mono text-xs",children:R.order_number||((A=R.id)==null?void 0:A.slice(0,8))}),a.jsxs("td",{className:"px-4 py-3",children:[a.jsx("div",{className:"font-medium",children:R.customer_name||"â"}),a.jsx("div",{className:"text-xs text-muted-foreground",children:R.guest_email||R.customer_email||""})]}),a.jsx("td",{className:"px-4 py-3 max-w-[200px]",children:a.jsx("div",{className:"text-xs text-muted-foreground truncate",children:(R.items_summary||[]).map(D=>`${D.product_name||"Produit"} Ã${D.quantity}`).join(", ")||"â"})}),a.jsxs("td",{className:"px-4 py-3 text-right font-semibold",children:[(I=R.total)==null?void 0:I.toFixed(2)," â¬"]}),a.jsx("td",{className:"px-4 py-3 text-center",children:a.jsx(W5,{hasPhysical:R.has_physical})}),a.jsx("td",{className:"px-4 py-3 text-center",children:a.jsx(H5,{status:R.status})}),a.jsx("td",{className:"px-4 py-3 text-right",children:a.jsxs("div",{className:"flex items-center justify-end gap-1",children:[a.jsx(H,{variant:"ghost",size:"icon",className:"h-8 w-8",title:"Voir détail",onClick:()=>m(R),children:a.jsx(Mu,{className:"h-3.5 w-3.5"})}),R.has_physical&&R.status==="paid"&&a.jsx(H,{variant:"ghost",size:"icon",className:"h-8 w-8 text-orange-600",title:"Expédier",onClick:()=>_(R),children:a.jsx(Pw,{className:"h-3.5 w-3.5"})}),!R.has_physical&&a.jsx(H,{variant:"ghost",size:"icon",className:"h-8 w-8",title:"Renvoyer email",onClick:()=>C.mutate(R.id),disabled:C.isPending,children:a.jsx(Jf,{className:"h-3.5 w-3.5"})}),R.status==="shipped"&&a.jsx(H,{variant:"ghost",size:"icon",className:"h-8 w-8 text-green-600",title:"Marquer livré",onClick:()=>k.mutate(R.id),disabled:k.isPending,children:a.jsx(uk,{className:"h-3.5 w-3.5"})})]})})]},R.id)})})]})}),a.jsx("div",{className:"mt-5 space-y-3 md:hidden",children:E.map(R=>{var A,I;return a.jsxs("div",{className:"rounded-xl border border-border bg-card p-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"font-mono text-xs",children:R.order_number||((A=
1058R.id)==null?void 0:A.slice(0,8))}),a.jsx(H5,{status:R.status})]}),a.jsxs("div",{className:"mt-1.5 flex items-center gap-2",children:[a.jsx("span",{className:"text-sm font-medium",children:R.customer_name||"â"}),a.jsx(W5,{hasPhysical:R.has_physical})]}),a.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:R.guest_email||R.customer_email||""}),a.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:new Date(R.created_at).toLocaleDateString("fr-FR")}),a.jsxs("span",{className:"font-semibold",children:[(I=R.total)==null?void 0:I.toFixed(2)," â¬"]})]}),a.jsxs("div",{className:"mt-3 flex gap-2",children:[a.jsxs(H,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>m(R),children:[a.jsx(Mu,{className:"mr-1 h-3 w-3"}),"Détail"]}),R.has_physical&&R.status==="paid"&&a.jsxs(H,{size:"sm",className:"flex-1 bg-orange-500 hover:bg-orange-600",onClick:()=>_(R),children:[a.jsx(Pw,{className:"mr-1 h-3 w-3"}),"Expédier"]}),!R.has_physical&&a.jsxs(H,{variant:"outline",size:"sm",onClick:()=>C.mutate(R.id),disabled:C.isPending,children:[a.jsx(Jf,{className:"mr-1 h-3 w-3"}),"Email"]}),R.status==="shipped"&&a.jsxs(H,{variant:"outline",size:"sm",className:"text-green-600",onClick:()=>k.mutate(R.id),children:[a.jsx(uk,{className:"mr-1 h-3 w-3"}),"Livré"]})]})]},R.id)})}),E.length===0&&a.jsx("p",{className:"mt-8 text-center text-muted-foreground",children:"Aucune commande trouvée."})]}),a.jsx(an,{open:!!l,onOpenChange:R=>!R&&c(null),children:a.jsxs(nn,{className:"sm:max-w-lg",children:[a.jsxs(on,{children:[a.jsx(ln,{children:"Expédier la commande"}),a.jsxs(Eu,{children:["Commande ",(l==null?void 0:l.order_number)||((P=l==null?void 0:l.id)==null?void 0:P.slice(0,8))]})]}),l&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-3 text-sm space-y-1",children:[a.jsx("p",{className:"font-medium",children:l.shipping_name||l.customer_name||"Client"}),K5(l).length>0&&a.jsx("p",{className:"text-muted-foreground whitespace-pre-line",children:K5(l).slice(1).join(` 1059`)}),(l.shipping_method||l.shipping_method_name)&&a.jsxs("div",{className:"mt-2 pt-2 border-t border-border",children:[a.jsx("p",{className:"text-xs text-muted-foreground",children:"Mode choisi par le client :"}),a.jsx("p",{className:"font-medium",children:l.shipping_method_name||l.shipping_method}),l.shipping_cost!=null&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Frais payés : ",(T=l.shipping_cost)==null?void 0:T.toFixed(2)," â¬"]})]}),a.jsx("div",{className:"mt-2 pt-2 border-t border-border",children:(l.items_summary||[]).map(R=>a.jsxs("p",{children:[R.product_name," ",R.variant_name?`(${R.variant_name})`:""," à ",R.quantity]},R.id))})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-sm font-medium",children:"Transporteur"}),a.jsxs("select",{className:"mt-1 w-full rounded-lg border border-border bg-card px-3 py-2 text-sm",value:h||"",onChange:R=>f(Number(R.target.value)),children:[a.jsx("option",{value:"",children:"Sélectionnerâ¦"}),g.map(R=>{var A;return a.jsxs("option",{value:R.id,children:[R.carrier," â ",R.name," (",(A=R.countries)==null?void 0:A.map(I=>I.iso_2).join(", "),")"]},R.id)})]}),a.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Suggestion : ",(()=>{const R=w(l);return R==="correos"?"Correos":R==="mondial_relay"?"Mondial Relay / Point relais":"Colissimo (France/Europe)"})()]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-sm font-medium",children:"Poids estimé"}),a.jsx("select",{className:"mt-1 w-full rounded-lg border border-border bg-card px-3 py-2 text-sm",value:u,onChange:R=>d(R.target.value),children:git.map(R=>a.jsx("option",{value:R.value,children:R.label},R.value))})]})]}),a.jsxs(ss,{children:[a.jsx(H,{variant:"outline",onClick:()=>c(null),children:"Annuler"}),a.jsxs(H,{onClick:()=>S.mutate(),disabled:!h||S.isPending,className:"bg-[#C8962E] hover:bg-[#B0842A] text-white",children:[S.isPending?a.jsx(Ig,{className:"mr-1.5 h-4 w-4 animate-spin"}):a.jsx(Pw,{className:"mr-1.5 h-4 w-4"}),"Créer l'expédition Sendcloud"]})]})]})}),a.jsx(Dj,{open:!!p,onOpenChange:R=>!R&&m(null),children:a.jsxs(P0,{className:"overflow-y-auto sm:max-w-xl w-full",children:[a.jsx(l2,{children:a.jsxs(c2,{children:["Commande ",(p==null?void 0:p.order_number)||((M=p==null?void 0:p.id)==null?void 0:M.slice(0,8))]})}),p&&a.jsxs("div",{className:"mt-4 space-y-5",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx(H5,{status:p.status}),a.jsx(W5,{hasPhysical:p.has_physical}),a.jsxs(H,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>
1059{navigator.clipboard.writeText(p.order_number||p.id),ee.success("Numéro de commande copié")},children:[a.jsx(Pl,{className:"mr-1 h-3.5 w-3.5"}),"N° commande"]})]}),a.jsxs("div",{className:"rounded-lg border border-border p-3 space-y-1.5 text-sm",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsx("p",{className:"font-medium",children:"Client"}),a.jsxs(H,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{navigator.clipboard.writeText(p.guest_email||p.customer_email||""),ee.success("E-mail copié")},children:[a.jsx(Pl,{className:"mr-1 h-3.5 w-3.5"}),"E-mail"]})]}),a.jsx("p",{children:p.customer_name||p.shipping_name||p.billing_name||"â"}),a.jsx("p",{className:"text-muted-foreground",children:p.guest_email||p.customer_email||"â"}),(p.customer_phone||p.shipping_phone)&&a.jsx("p",{className:"text-muted-foreground",children:p.customer_phone||p.shipping_phone}),a.jsx("p",{className:"text-xs text-muted-foreground",children:p.user_id?"Compte client":"Commande invité"})]}),a.jsx(Tne,{title:"Adresse de livraison",lines:K5(p)}),a.jsx(Tne,{title:"Adresse de facturation",lines:vit(p),empty:"Identique à la livraison / non renseignée"}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[p.stripe_checkout_session_id&&a.jsxs(H,{variant:"outline",size:"sm",onClick:()=>j.mutate(p.id),disabled:j.isPending,children:[a.jsx(Ig,{className:`mr-1.5 h-4 w-4 ${j.isPending?"animate-spin":""}`}),"Resynchroniser depuis Stripe"]}),a.jsxs(H,{variant:"outline",size:"sm",onClick:()=>N.mutate(p.id),disabled:N.isPending,children:[a.jsx(Ru,{className:"mr-1.5 h-4 w-4"}),"Renvoyer la confirmation"]})]}),a.jsxs("div",{className:"rounded-lg border border-border p-3 space-y-1.5 text-sm",children:[a.jsx("p",{className:"font-medium",children:"Livraison"}),a.jsx(na,{label:"Mode",value:p.shipping_method_name||p.shipping_method||"â"}),a.jsx(na,{label:"Frais facturés",value:p.shipping_cost!=null?`${Number(p.shipping_cost).toFixed(2)} â¬`:"â"}),p.shipping_cost_paid!=null&&a.jsx(na,{label:"Coût réel",value:`${Number(p.shipping_cost_paid).toFixed(2)} â¬`}),p.total_weight_grams!=null&&a.jsx(na,{label:"Poids",value:`${p.total_weight_grams} g`}),p.tracking_number&&a.jsx(na,{label:"Suivi",value:a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx("span",{className:"font-mono",children:p.tracking_number}),a.jsx(H,{variant:"ghost",size:"sm",className:"h-6 px-1",onClick:()=>{navigator.clipboard.writeText(p.tracking_number),ee.success("N° de suivi copié")},children:a.jsx(Pl,{className:"h-3.5 w-3.5"})})]})})]}),a.jsxs("div",{className:"space-y-2 text-sm",children:[a.jsx("p",{className:"font-medium",children:"Articles commandés"}),(p.items_summary||[]).length===0&&a.jsx("p",{className:"text-muted-foreground italic",children:"Aucun article enregistré"}),(p.items_summary||[]).map(R=>a.jsxs("div",{className:"rounded-lg border border-border p-3 space-y-1",children:[a.jsxs("div",{className:"flex justify-between gap-3",children:[a.jsx("span",{className:"font-medium",children:R.product_name||"Produit"}),a.jsxs("span",{className:"font-semibold whitespace-nowrap",children:[Number(R.total_price??R.unit_price*R.quantity).toFixed(2)," â¬"]})]}),a.jsxs("div",{className:"text-xs text-muted-foreground space-y-0.5",children:[a.jsxs("p",{children:[Number(R.unit_price).toFixed(2)," ⬠à ",R.quantity,R.variant_name&&a.jsxs(a.Fragment,{children:[" · ",R.variant_name]}),R.format&&a.jsxs(a.Fragment,{children:[" · ",R.format]})]}),(R.experience_date||R.experience_time_slot)&&a.jsxs("p",{children:["Réservation : ",R.experience_date,R.experience_time_slot&&` â ${R.experience_time_slot}`]}),R.download_url&&a.jsxs("p",{children:["Téléchargement numérique",R.download_count!=null&&` · ${R.download_count} téléchargement(s)`]})]})]},R.id))]}),a.jsxs("div",{className:"rounded-lg border border-border p-3 space-y-1 text-sm",children:[p.subtotal!=null&&a.jsx(na,{label:"Sous-total",value:`${Number(p.subtotal).toFixed(2)} â¬`}),p.shipping_cost!=null&&a.jsx(na,{label:"Livraison",value:`${Number(p.shipping_cost).toFixed(2)} â¬`}),Number(p.discount_amount)>0&&a.jsx(na,{label:"Remise",value:`â ${Number(p.discount_amount).toFixed(2)} â¬`}),Number(p.carte_privilege_discount)>0&&a.jsx(na,{label:"Remise Carte Privilège",value:`â ${Number(p.carte_privilege_discount).toFixed(2)} â¬`}),Number(p.tax_amount)>0&&a.jsx(na,{label:"TVA",value:`${Number(p.tax_amount).toFixed(2)} â¬`}),a.jsxs("div",{className:"flex justify-between pt-2 border-t border-border font-bold text-base",children:[a.jsx("span",{children:"Total"}),a.jsxs("span",{children:[Number(p.total).toFixed(2)," â¬"]})]})]}),a.jsxs("div",{className:"rounded-lg border border-border p-3 space-y-1 text-sm",children:[a.jsx("p",{className:"font-medium",children:"Paiement & suivi"}),a.jsx(na,{label:"Créée le",value:new Date(p.created_at).toLocaleStr
1059ing("fr-FR")}),p.paid_at&&a.jsx(na,{label:"Payée le",value:new Date(p.paid_at).toLocaleString("fr-FR")}),p.shipped_at&&a.jsx(na,{label:"Expédiée le",value:new Date(p.shipped_at).toLocaleString("fr-FR")}),p.delivered_at&&a.jsx(na,{label:"Livrée le",value:new Date(p.delivered_at).toLocaleString("fr-FR")}),p.stripe_payment_intent_id&&a.jsx(na,{label:"Paiement Stripe",value:a.jsx("span",{className:"font-mono text-xs break-all",children:p.stripe_payment_intent_id})}),p.stripe_checkout_session_id&&a.jsx(na,{label:"Session Stripe",value:a.jsx("span",{className:"font-mono text-xs break-all",children:p.stripe_checkout_session_id})})]})]})]})})]})}const bit={pending:"bg-yellow-100 text-yellow-800",paid:"bg-blue-100 text-blue-800",shipped:"bg-purple-100 text-purple-800",delivered:"bg-green-100 text-green-800",cancelled:"bg-gray-100 text-gray-800",refunded:"bg-red-100 text-red-800"},wit=["pending","paid","shipped","delivered","cancelled","refunded"];function _it(t){if(!t)return"europe";const e=t.trim().toLowerCase();return e==="es"||e==="espagne"||e==="spain"||e==="españa"?"spain":e==="fr"||e==="france"?"france":"europe"}function jit(t,e){return t.replace(/\{tracking\}/g,encodeURIComponent(e))}function Sit(){var g,w,_,j,N;const{id:t}=Xi(),e=St(),[n,r]=b.useState(""),[s,i]=b.useState(""),[o,l]=b.useState(""),{data:c,isLoading:u}=Ne({queryKey:["admin_order",t],queryFn:async()=>{const{data:S,error:C}=await Mt.from("orders").select("*").eq("id",t).single();if(C)throw C;return S}}),{data:d=[]}=Ne({queryKey:["admin_order_items",t],enabled:!!t,queryFn:async()=>{const{data:S}=await Mt.from("order_items").select("*").eq("order_id",t);return S??[]}}),{data:h=[]}=Ne({queryKey:["site_settings","shipping_carriers"],queryFn:async()=>{const{data:S}=await Mt.from("site_settings").select("value").eq("key","shipping_carriers").maybeSingle();return(S==null?void 0:S.value)??[]}});b.useEffect(()=>{if(c){const S=_it(c.shipping_country);l(C=>C||S),i(C=>C||c.tracking_number||"")}},[c]);const f=s||(c==null?void 0:c.tracking_number)||"",p=b.useMemo(()=>h.find(S=>{var C;return((C=S.zone)==null?void 0:C.toLowerCase())===(o==null?void 0:o.toLowerCase())}),[h,o]),m=b.useMemo(()=>p!=null&&p.tracking_url&&f?jit(p.tracking_url,f):"",[p,f]),v=Qe({mutationFn:async()=>{const S=c==null?void 0:c.status,C=n||S,k={status:C};s&&(k.tracking_number=s),C==="delivered"&&!(c!=null&&c.delivered_at)&&(k.delivered_at=new Date().toISOString());const{error:E}=await Mt.from("orders").update(k).eq("id",t);if(E)throw E;if(C==="delivered"&&S!=="delivered"){const P=c.guest_email||c.customer_email;P&&await Mt.functions.invoke("send-app-email",{body:{template_key:"order_delivered",to_email:P,to_name:c.shipping_name||c.customer_name||void 0,vars:{order_number:c.order_number||(t==null?void 0:t.slice(0,8)),customer_name:c.shipping_name||c.customer_name||void 0}}})}},onSuccess:()=>{e.invalidateQueries({queryKey:["admin_order",t]}),ee.success("Commande mise à jour")},onError:S=>ee.error(S.message)}),x=Qe({mutationFn:async()=>{if(!f)throw new Error("Numéro de suivi requis");if(!m)throw new Error("Aucun transporteur configuré pour cette zone");const{data:{session:S}}=await Mt.auth.getSession(),k=await fetch("https://aanjkhoyzcvhokzsmifu.supabase.co/functions/v1/sendcloud-shipping?action=send_shipping_email",{method:"POST",headers:{Authorization:`Bearer ${S==null?void 0:S.access_token}`,apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImFhbmpraG95emN2aG9renNtaWZ1Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzU0ODIxMTgsImV4cCI6MjA5MTA1ODExOH0.FZffw1trnRiA182HIsLL4uQALqBG6SHIIttPS-tq-Qo","Content-Type":"application/json"},body:JSON.stringify({order_id:t,tracking_number:f,tracking_url:m,carrier_name:p==null?void 0:p.name,mark_shipped:!0})}),E=await k.json();if(!k.ok)throw new Error(E.error||"Erreur d'envoi");return E},onSuccess:()=>{e.invalidateQueries({queryKey:["admin_order",t]}),ee.success("E-mail d'expédition envoyé")},onError:S=>ee.error(S.message)});return u?a.jsx("div",{className:"py-10 text-center text-muted-foreground",children:"Chargement..."}):c?a.jsxs("div",{className:"mx-auto max-w-3xl",children:[a.jsx(H,{variant:"ghost",size:"sm",asChild:!0,className:"mb-4",children:a.jsxs(_e,{to:"/admin/commandes",children:[a.jsx(jr,{className:"mr-2 h-4 w-4"})," Retour"]}
1059)}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("h1",{className:"font-heading text-2xl font-bold",children:["Commande ",c.order_number||c.id.slice(0,8)]}),a.jsx(ke,{className:bit[c.status]||"",children:c.status})]}),a.jsxs("div",{className:"mt-6 grid gap-6 lg:grid-cols-2",children:[a.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[a.jsx("h2",{className:"font-semibold",children:"Client"}),a.jsxs("div",{className:"mt-3 space-y-1 text-sm",children:[a.jsx("p",{children:c.shipping_name||c.billing_name||"â"}),a.jsx("p",{className:"text-muted-foreground",children:c.guest_email}),c.shipping_phone&&a.jsx("p",{className:"text-muted-foreground",children:c.shipping_phone})]}),c.shipping_address&&a.jsxs(a.Fragment,{children:[a.jsx("h3",{className:"mt-4 text-sm font-medium",children:"Adresse de livraison"}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground whitespace-pre-line",children:`${c.shipping_address||""} 1060${c.shipping_postal_code||""} ${c.shipping_city||""} 1061${c.shipping_country||""}`.trim()})]})]}),a.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[a.jsx("h2",{className:"font-semibold",children:"Expédition"}),a.jsxs("div",{className:"mt-3 space-y-3",children:[a.jsxs("div",{children:[a.jsx(te,{children:"Statut"}),a.jsx("select",{className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm",value:n||c.status,onChange:S=>r(S.target.value),children:wit.map(S=>a.jsx("option",{value:S,children:S},S))})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Zone / Transporteur"}),a.jsxs("select",{className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm",value:o,onChange:S=>l(S.target.value),children:[h.length===0&&a.jsx("option",{value:"",children:"Aucun transporteur configuré"}),h.map((S,C)=>a.jsxs("option",{value:S.zone,children:[S.zone," â ",S.name]},C))]}),p&&a.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Modèle : ",a.jsx("code",{className:"rounded bg-muted px-1",children:p.tracking_url})]})]}),a.jsxs("div",{children:[a.jsx(te,{children:"N° de suivi"}),a.jsx(ue,{value:s,onChange:S=>i(S.target.value),placeholder:(p==null?void 0:p.tracking_format)||"Numéro de suivi"})]}),m&&a.jsxs("div",{className:"rounded-md border border-border bg-muted/40 p-3 text-xs",children:[a.jsx("div",{className:"mb-1 font-medium text-foreground",children:"Lien de suivi généré"}),a.jsxs("a",{href:m,target:"_blank",rel:"noreferrer",className:"break-all text-primary hover:underline inline-flex items-start gap-1",children:[m," ",a.jsx(Gi,{className:"mt-0.5 h-3 w-3 shrink-0"})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-2 pt-1",children:[a.jsx(H,{onClick:()=>v.mutate(),disabled:v.isPending,variant:"outline",children:"Enregistrer"}),a.jsxs(H,{onClick:()=>x.mutate(),disabled:x.isPending||!f||!m,children:[a.jsx(Ru,{className:"mr-2 h-4 w-4"}),x.isPending?"Envoiâ¦":"Marquer expédiée + e-mail"]})]})]})]})]}),a.jsxs("div",{className:"mt-6 rounded-xl border border-border bg-card p-5",children:[a.jsx("h2",{className:"font-semibold",children:"Articles commandés"}),d.length===0?a.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:"Aucun article"}):a.jsx("div",{className:"mt-3 space-y-2",children:d.map(S=>a.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border p-3 text-sm",children:[a.jsxs("div",{children:[a.jsx("span",{className:"font-medium",children:S.product_name||"Produit"}),S.variant_name&&a.jsxs("span",{className:"ml-2 text-muted-foreground",children:["(",S.variant_name,")"]}),a.jsxs("span",{className:"ml-2 text-muted-foreground",children:["à ",S.quantity]})]}),a.jsxs("span",{className:"font-semibold",children:[(S.unit_price*S.quantity).toFixed(2)," â¬"]})]},S.id))}),a.jsx("hr",{className:"my-4"}),a.jsxs("div",{className:"space-y-1 text-sm",children:[c.subtotal!=null&&a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-muted-foreground",children:"Sous-total"}),a.jsxs("span",{children:[(g=c.subtotal)==null?void 0:g.toFixed(2)," â¬"]})]}),c.discount_amount>0&&a.jsxs("div",{className:"flex justify-between text-green-600",children:[a.jsx("span",{children:"Réduction promo"}),a.jsxs("span",{children:["-",(w=c.discount_amount)==null?void 0:w.toFixed(2)," â¬"]})]}),c.carte_privilege_discount>0&&a.jsxs("div",{className:"flex justify-between text-green-600",children:[a.jsx("span",{children:"Carte Privilège"}),a.jsxs("span",{children:["-",(_=c.carte_privilege_discount)==null?void 0:_.toFixed(2)," â¬"]})]}),c.shipping_cost!=null&&a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-muted-foreground",children:"Livraison"}),a.jsxs("span",{children:[(j=c.shipping_cost)==null?void 0:j.toFixed(2)," â¬"]})]}),a.jsxs("div",{className:"flex justify-between pt-2 font-heading text-lg font-bold",children:[a.jsx("span",{children:"Total"}),a.jsxs("span",{children:[(N=c.total)==null?void 0:N.toFixed(2)," â¬"]})]})]})]})]}):a.jsx("div",{className:"py-10 text-center",children:"Commande introuvable"})}const CR={restaurant:"Restaurant",hotel:"Hôtel",activite:"Activité",commerce:"Commerce",service:"Service",immobilier:"Immobilier",golf:"Golf",sante:"Santé",artisanat:"Artisanat",conciergerie:"Conciergerie",gestion:"Gestion",assurance:"Assurance",services_juridiques:"Services Juridiques",maison_travaux:"Maison & Travaux",sante_bien_etre:"Santé & Bien-être",voyages_logement:"Voyages & Logement",transports:"Transports",apprentissage_formation:"Apprentissage & Formation",photographie:"Photographie",mode_decoration:"Mode & Décoration"},Nit={restaurant:"bg-orange-100 text-orange-800 border-orange-200",hotel:"bg-blue-100 text-blue-800 border-blue-200",activite:"bg-purple-100 text-purple-800 border-purple-200",commerce:"bg-green-100 text-green-800 border-green-200",service:"bg-slate-100 text-slate-800 border-slate-200",immobilier:"bg-indigo-100 text-indigo-800 border-indigo-200",golf:"bg-emerald-100 text-emerald-800 border-emerald-200",sante:"bg-red-100 text-red-800 border-red-200",artisanat:"bg-
1061amber-100 text-amber-800 border-amber-200",conciergerie:"bg-teal-100 text-teal-800 border-teal-200",gestion:"bg-cyan-100 text-cyan-800 border-cyan-200",assurance:"bg-sky-100 text-sky-800 border-sky-200",services_juridiques:"bg-violet-100 text-violet-800 border-violet-200",maison_travaux:"bg-stone-100 text-stone-800 border-stone-200",sante_bien_etre:"bg-rose-100 text-rose-800 border-rose-200",voyages_logement:"bg-lime-100 text-lime-800 border-lime-200",transports:"bg-gray-100 text-gray-800 border-gray-200",apprentissage_formation:"bg-fuchsia-100 text-fuchsia-800 border-fuchsia-200",photographie:"bg-pink-100 text-pink-800 border-pink-200",mode_decoration:"bg-yellow-100 text-yellow-800 border-yellow-200"},Cit=t=>t==="agent_immobilier"?"immobilier":t,Pne=({category:t})=>{const e=Cit(t);return a.jsx(ke,{variant:"outline",className:`text-xs font-medium ${Nit[e]||"bg-muted text-muted-foreground border-border"}`,children:CR[e]||e})};function kit(){const t=St(),[e,n]=b.useState(""),[r,s]=b.useState("all"),[i,o]=b.useState("all"),[l,c]=b.useState(new Set),[u,d]=b.useState(!1),{data:h=[],isLoading:f}=Ne({queryKey:["admin_partners"],queryFn:async()=>{const{data:k,error:E}=await Z.from("partners").select("*").eq("is_carte_privilege",!0).order("name");if(E)throw E;return k}}),p=Qe({mutationFn:async({id:k,active:E})=>{await Z.from("partners").update({is_active:E}).eq("id",k)},onSuccess:()=>t.invalidateQueries({queryKey:["admin_partners"]})}),m=[...new Set(h.map(k=>k.city))].filter(Boolean).sort(),v=[...new Set(h.map(k=>k.category))].filter(Boolean).sort(),x=h.filter(k=>!e||k.name.toLowerCase().includes(e.toLowerCase())).filter(k=>r==="all"||k.city===r).filter(k=>i==="all"||k.category===i),g=Array.from(l),w=x.length>0&&x.every(k=>l.has(k.id)),_=()=>{const k=new Set(l);w?x.forEach(E=>k.delete(E.id)):x.forEach(E=>k.add(E.id)),c(k)},j=k=>{const E=new Set(l);E.has(k)?E.delete(k):E.add(k),c(E)},N=()=>c(new Set),S=Qe({mutationFn:async()=>{const{error:k}=await Z.from("partners").delete().in("id",g);if(k)throw k},onSuccess:()=>{ee.success(`${g.length} partenaire(s) supprimé(s)`),t.invalidateQueries({queryKey:["admin_partners"]}),N(),d(!1)},onError:k=>{ee.error(k.message),d(!1)}}),C=Qe({mutationFn:async k=>{const{error:E}=await Z.from("partners").update({category:k}).in("id",g);if(E)throw E},onSuccess:(k,E)=>{ee.success(`${g.length} partenaire(s) déplacé(s) vers « ${CR[E]||E} »`),t.invalidateQueries({queryKey:["admin_partners"]}),N()},onError:k=>ee.error(k.message)});return a.jsxs("div",{children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[a.jsxs("h1",{className:"font-heading text-2xl font-bold",children:["Partenaires Carte Privilège ",a.jsxs("span",{className:"text-sm font-normal text-muted-foreground",children:["(",h.length,")"]})]}),a.jsx(H,{asChild:!0,children:a.jsxs(_e,{to:"/admin/partenaires/nouveau",children:[a.jsx(dr,{className:"mr-2 h-4 w-4"})," Nouveau partenaire"]})})]}),a.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[a.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[a.jsx(is,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(ue,{placeholder:"Rechercherâ¦",value:e,onChange:k=>n(k.target.value),className:"pl-9 h-9"})]}),a.jsxs("select",{className:"rounded-lg border border-border bg-card px-3 py-1.5 text-sm",value:r,onChange:k=>s(k.target.value),children:[a.jsx("option",{value:"all",children:"Toutes villes"}),m.map(k=>a.jsx("option",{value:k,children:k},k))]}),a.jsxs("select",{className:"rounded-lg border border-border bg-card px-3 py-1.5 text-sm",value:i,onChange:k=>o(k.target.value),children:[a.jsx("option",{value:"all",children:"Toutes catégories"}),v.map(k=>a.jsx("option",{value:k,children:CR[k]||k},k))]})]}),l.size>0&&a.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2 rounded-lg border border-primary/30 bg-primary/5 px-4 py-2.5 text-sm",children:[a.jsxs("span",{className:"font-medium",children:[l.size," sélectionné(s)"]}),a.jsxs("div",{className:"ml-auto flex flex-wrap items-center gap-2",children:[a.jsxs("select",{className:"rounded-lg border border-border bg-card px-3 py-1.5 text-sm",value:"",disabled:C.isPending,onChange:k=>{k.target.value&&C.mutate(k.target.value)},children:[a.jsx("option",{value:"",children:"Assigner une catégorieâ¦"}),Object.entries(CR).sort((k,E)=>k[1].localeCompare(E[1],"fr")).map(([k,E])=>a.jsx("option",{value:k,children:E},k))]}),a.jsxs(H,{size:"sm",variant:"destructive",onClick:()=>d(!0),children:[a.jsx(tr,{className:"mr-1.5 h-3.5 w-3.5"})," Supprimer"]}),a.jsx(H,{size:"sm",variant:"ghost",onClick:N,children:"Annuler"})]})]}),f?a.jsx("div",{className:"mt-8 space-y-3",children:[1,2,3].map(k=>a.jsx("div",{className:"h-14 animate-pulse rounded-lg bg-muted"},k))}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"mt-6 hidden overflow-x-auto rounded-xl border border-border bg-card md:block",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"border-b border-border bg-muted/50",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-3 py-3 w-10",children:a.jsx(wr,{checked:w,onCheckedChange:_})}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Image"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Nom"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Ville"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Catégorie"}),a.jsx("th",{className:"px-4 py-3 text-center font-medium",children:"Carte"}),a.jsx("th",{className:"px-4 py-3 text-center font-medium",children:"Premium"}),a.jsx("th",{className:"px-4 py-3 text-center font-medium",children:"Actif"}),a.jsx("th",{className:"px-4 py-3 text-right font-medium",children:"Actions"})]})}),a.jsx("tbody",{children:x.map(k=>{var E;return a.jsxs("tr",{className:"border-b border-border last:border-0",children:[a.jsx("td",{className:"px-3 py-2",children:a.jsx(wr,{checked:l.has(k.id),onCheckedChange:()=>j(k.id)})}),a.jsx("td",{className:"px-4 py-2",children:a.jsx("div",{className:"h-10 w-10 overflow-hidden rounded bg-muted",children:((E=k.images)==null?void 0:E[0])&&a.jsx("img",{src:k.images[0],alt:"",className:"h-full w-full object-cover"})})}),a.jsx("td",{className:"px-4 py-2 font-medium",children:k.name}),a.jsx("td",{className:"px-4 py-2 text-muted-foreground",children:k.city}),a.jsx("td",{className:"px-4 py-2",children:a.jsx(Pne,{category:k.category})}),a.jsx("td",{className:"px-4 py-2 text-center",children:k.is_carte_privilege?a.jsx(ke,{className:"bg-green-100 text-green-800 text-xs",children:"Oui"}):a.jsx("span",{className:"text-muted-foreground",children:"â"})}),a.jsx("td",{className:"px-4 py-2 text-center",children:k.is_premium?a.jsx(ke,{className:"bg-amber-100 text-amber-800 text-xs",children:"Premium"}):"â"}),a.jsx("td",{className:"px-4 py-2 text-center",children:a.jsx(_n,{checked:k.is_active,onCheckedChange:P=>p.mutate({id:k.id,active:P})})}),a.jsx("td",{className:"px-4 py-2 text-right",children:a.jsxs("div",{className:"flex items-center justify-end gap-1",children:[a.jsx(H,{variant:"ghost",size:"icon",className:"h-8 w-8",asChild:!0,children:a.jsx(_e,{to:`/admin/partenaires/${k.id}/modifier`,children:a.jsx(Oc,{className:"h-3.5 w-3.5"})})}),a.jsx(H,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>{c(new Set([k.id])),d(!0)},title:"Supprimer",children:a.jsx(tr,{className:"h-3.5 w-3.5 text-destructive"})})]})})]},k.id)})})]})}),a.jsx("div",{className:"mt-6 space-y-3 md:hidden",children:x.map(k=>{var E;return a.jsx("div",{className:"rounded-xl border border-border bg-card p-4",children:a.jsxs("div",{className:"flex gap-3",children:[a.jsx(wr,{checked:l.has(k.id),onCheckedChange:()=>j(k.id),className:"mt-1"}),a.jsxs(_e,{to:`/admin/partenaires/${k.id}/modifier`,className:"flex-1 flex gap-3",children:[a.jsx("div",{className:"h-12 w-12 shrink-0 overflow-hidden rounded-lg bg-muted",children:((E=k.images)==null?void 0:E[0])&&a.jsx("img",{src:k.images[0],alt:"",className:"h-full w-full object-cover"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h3",{className:"font-medium",children:k.name}),a.jsx("p",{className:"text-xs text-muted-foreground",children:k.city}),a.jsx("div",{className:"mt-1",children:a.jsx(Pne,{category:k.category})}),a.jsxs("div",{className:"mt-1 flex gap-2",children:[k.is_carte_privilege&&a.jsx(ke,{className:"bg-green-100 text-green-800 text-xs",children:"Carte"}),k.is_premium&&a.jsx(ke,{className:"bg-amber-100 text-amber-800 text-xs",children:"Premium"})]})]})]}),a.jsx(H,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>{c(new Set([k.id])),d(!0)},children:a.jsx(tr,{className:"h-3.5 w-3.5 text-destructive"})})]})},k.id)})}),x.length===0&&a.jsx("p",{className:"mt-8 text-center text-muted-foreground",children:"Aucun partenaire trouvé."})]}),a.jsx(ro,{open:u,onOpenChange:d,children:a.jsxs(ja,{children:[a.jsxs(Sa,{children:[a.jsxs(Ca,{children:["Supprimer ",g.length," partenaire(s) ?"]}),a.jsx(ka,{children:"Cette action est irréversible. Les partenaires sélectionnés seront définitivement supprimés."})]}),a.jsxs(Na,{children:[a.jsx(Ea,{children:"Annuler"}),a.jsx(Aa,{onClick:()=>S.mutate(),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Supprimer"})]})]})})]})}function Ri(t){this.content=t}Ri.prototype={constructor:Ri,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,s=r.find(t),i=r.content.slice();return s==-1?i.push(n||t,e):(i[s+1]=e,n&&(i[s]=n)),new Ri(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Ri(n)},addToStart:function(t,e){return new Ri([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Ri(n)},addBefore:function(t,e,n){var r=this.remove(e),s=r.content.slice(),i=r.find(t);return s.splice(i==-1?s.length:i,0,e,n),new Ri(s)}
vendor: 13,280 bytes, line 1061
1061,forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=Ri.from(t),t.size?new Ri(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Ri.from(t),t.size?new Ri(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Ri.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};Ri.from=function(t){if(t instanceof Ri)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Ri(e)};function oje(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let s=t.child(r),i=e.child(r);if(s==i){n+=s.nodeSize;continue}if(!s.sameMarkup(i))return n;if(s.isText&&s.text!=i.text){for(let o=0;s.text[o]==i.text[o];o++)n++;return n}if(s.content.size||i.content.size){let o=oje(s.content,i.content,n+1);if(o!=null)return o}n+=s.nodeSize}}function lje(t,e,n,r){for(let s=t.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:n,b:r};let o=t.child(--s),l=e.child(--i),c=o.nodeSize;if(o==l){n-=c,r-=c;continue}if(!o.sameMarkup(l))return{a:n,b:r};if(o.isText&&o.text!=l.text){let u=0,d=Math.min(o.text.length,l.text.length);for(;u<d&&o.text[o.text.length-u-1]==l.text[l.text.length-u-1];)u++,n--,r--;return{a:n,b:r}}if(o.content.size||l.content.size){let u=lje(o.content,l.content,n-1,r-1);if(u)return u}n-=c,r-=c}}let De=class Va{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,s=0,i){for(let o=0,l=0;l<n;o++){let c=this.content[o],u=l+c.nodeSize;if(u>e&&r(c,s+l,i||null,o)!==!1&&c.content.size){let d=l+1;c.nodesBetween(Math.max(0,e-d),Math.min(c.content.size,n-d),r,s+d)}l=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,s){let i="",o=!0;return this.nodesBetween(e,n,(l,c)=>{let u=l.isText?l.text.slice(Math.max(e,c)-c,n-c):l.isLeaf?s?typeof s=="function"?s(l):s:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&u||l.isTextblock)&&r&&(o?o=!1:i+=r),i+=u},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(s[s.length-1]=n.withText(n.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new Va(s,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],s=0;if(n>e)for(let i=0,o=0;o<n;i++){let l=this.content[i],c=o+l.nodeSize;c>e&&((o<e||c>n)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,n-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,n-o-1))),r.push(l),s+=l.nodeSize),o=c}return new Va(r,s)}cutByIndex(e,n){return e==n?Va.empty:e==0&&n==this.content.length?this:new Va(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let s=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return s[e]=n,new Va(s,i)}addToStart(e){return new Va([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Va(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let s=this.content[n];e(s,r,n),r+=s.nodeSize}}findDiffStart(e,n=0){return oje(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return lje(this,e,n,r)}findIndex(e){if(e==0)return wP(0,e);if(e==this.size)return wP(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let s=this.child(n),i=r+s.nodeSize;if(i>=e)return i==e?wP(n+1,i):wP(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return Va.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new Va(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Va.empty;let n,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(n||(n=e.slice(0,s)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new Va(n||e,r)}static from(e){if(!e)return Va.empty;if(e instanceof Va)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new Va([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};De.empty=new De([],0);const G5={index:0,offset:0};function wP(t,e){return G5.index=t,G5.offset=e,G5}function wI(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!wI(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!wI(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let Jn=class yq{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,s)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&wI(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let s=r.create(n.attrs);return r.checkAttrs(s.attrs),s}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return yq.none;if(e instanceof yq)return[e];let n=e.slice();return n.sort((r,s)=>r.type.rank-s.type.rank),n}};Jn.none=[];let _I=class extends Error{},Ge=class Fb{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=uje(this.content,e+this.openStart,n);return r&&new Fb(r,this.openStart,this.openEnd)}removeBetween(e,n){return new Fb(cje(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return Fb.empty;let r=n.openStart||0,s=n.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Fb(De.fromJSON(e,n.content),r,s)}static maxOpen(e,n=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)s++;return new Fb(e,r,s)}};Ge.empty=new Ge(De.empty,0,0);function cje(t,e,n){let{index:r,offset:s}=t.findIndex(e),i=t.maybeChild(r),{index:o,offset:l}=t.findIndex(n);if(s==e||i.isText){if(l!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(cje(i.content,e-s-1,n-s-1)))}function uje(t,e,n,r){let{index:s,offset:i}=t.findIndex(e),o=t.maybeChild(s);if(i==e||o.isText)return r&&!r.canReplace(s,s,n)?null:t.cut(0,e).append(n).append(t.cut(e));let l=uje(o.content,e-i-1,n,o);return l&&t.replaceChild(s,o.copy(l))}function Ait(t,e,n){if(n.openStart>t.depth)throw new _I("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new _I("Inconsistent open depths");return dje(t,e,n,0)}function dje(t,e,n,r){let s=t.index(r),i=t.node(r);if(s==e.index(r)&&r<t.depth-n.openStart){let o=dje(t,e,n,r+1);return i.copy(i.content.replaceChild(s,o))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let o=t.parent,l=o.content;return Fy(o,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=Eit(n,t);return Fy(i,fje(t,o,l,e,r))}else return Fy(i,jI(t,e,r))}function hje(t,e){if(!e.type.compatibleContent(t.type))throw new _I("Cannot join "+e.type.name+" onto "+t.type.name)}function bq(t,e,n){let r=t.node(n);return hje(r,e.node(n)),r}function Ly(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function _C(t,e,n,r){let s=(e||t).node(n),i=0,o=e?e.index(n):s.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(Ly(t.nodeAfter,r),i++));for(let l=i;l<o;l++)Ly(s.child(l),r);e&&e.depth==n&&e.textOffset&&Ly(e.nodeBefore,r)}function Fy(t,e){return t.type.checkContent(e),t.copy(e)}function fje(t,e,n,r,s){let i=t.depth>s&&bq(t,e,s+1),o=r.depth>s&&bq(n,r,s+1),l=[];return _C(null,t,s,l),i&&o&&e.index(s)==n.index(s)?(hje(i,o),Ly(Fy(i,fje(t,e,n,r,s+1)),l)):(i&&Ly(Fy(i,jI(t,e,s+1)),l),_C(e,n,s,l),o&&Ly(Fy(o,jI(n,r,s+1)),l)),_C(r,null,s,l),new De(l)}function jI(t,e,n){let r=[];if(_C(null,t,n,r),t.depth>n){let s=bq(t,e,n+1);Ly(Fy(s,jI(t,e,n+1)),r)}return _C(e,null,n,r),new De(r)}function Eit(t,e){let n=e.depth-t.openStart,s=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)s=e.node(i).copy(De.from(s));return{start:s.resolveNoCache(t.openStart+n),end:s.resolveNoCache(s.content.size-t.openEnd-n)}}class Pk{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(n);return r?e.child(n).cut(r):s}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],s=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)s+=r.child(i).nodeSize;return s}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Jn.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),s=e.maybeChild(n);if(!r){let l=r;r=s,s=l}let i=r.marks;for(var o=0;o<i.length;o++)i[o].type.spec.inclusive===!1&&(!s||!i[o].isInSet(s.marks))&&(i=i[o--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,s=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!s||!r[i].isInSet(s.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new SI(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],s=0,i=n;for(let o=e;;){let{index:l,offset:c}=o.content.findIndex(i),u=i-c;if(r.push(o,l,s+c),!u||(o=o.child(l),o.isText))break;i=u-1,s+=c+1}return new Pk(n,r,i)}
vendor: 4,396 bytes, line 1061
1061static resolveCached(e,n){let r=Mne.get(e);if(r)for(let i=0;i<r.elts.length;i++){let o=r.elts[i];if(o.pos==n)return o}else Mne.set(e,r=new Tit);let s=r.elts[r.i]=Pk.resolve(e,n);return r.i=(r.i+1)%Pit,s}}class Tit{constructor(){this.elts=[],this.i=0}}const Pit=12,Mne=new WeakMap;class SI{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Mit=Object.create(null);let Ng=class wq{constructor(e,n,r,s=Jn.none){this.type=e,this.attrs=n,this.marks=s,this.content=r||De.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,s=0){this.content.nodesBetween(e,n,r,s,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,s){return this.content.textBetween(e,n,r,s)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&wI(this.attrs,n||e.defaultAttrs||Mit)&&Jn.sameSet(this.marks,r||Jn.none)}copy(e=null){return e==this.content?this:new wq(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new wq(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return Ge.empty;let s=this.resolve(e),i=this.resolve(n),o=r?0:s.sharedDepth(n),l=s.start(o),u=s.node(o).content.cut(s.pos-l,i.pos-l);return new Ge(u,s.depth-o,i.depth-o)}replace(e,n,r){return Ait(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:s}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(s==e||n.isText)return n;e-=s+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let s=this.content.child(n-1);return{node:s,index:n-1,offset:r-s.nodeSize}}resolve(e){return Pk.resolveCached(this,e)}resolveNoCache(e){return Pk.resolve(this,e)}rangeHasMark(e,n,r){let s=!1;return n>e&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),pje(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=De.empty,s=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,i),l=o&&o.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let c=s;c<i;c++)if(!this.type.allowsMarks(r.child(c).marks))return!1;return!0}canReplaceWith(e,n,r,s){if(s&&!this.type.allowsMarks(s))return!1;let i=this.contentMatchAt(e).matchType(r),o=i&&i.matchFragment(this.content,n);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Jn.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!Jn.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}
1061`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let s=De.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,s,r);return i.type.checkAttrs(i.attrs),i}};Ng.prototype.text=void 0;class NI extends Ng{constructor(e,n,r,s){if(super(e,n,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):pje(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new NI(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new NI(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function pje(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class u0{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new Rit(e,n);if(r.next==null)return u0.empty;let s=mje(r);r.next&&r.err("Unexpected trailing text");let i=zit($it(s));return Bit(i,r),i}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let s=this;for(let i=n;s&&i<r;i++)s=s.matchType(e.child(i).type);return s}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let s=[this];function i(o,l){let c=o.matchFragment(e,r);if(c&&(!n||c.validEnd))return De.from(l.map(u=>u.createAndFill()));for(let u=0;u<o.next.length;u++){let{type:d,next:h}=o.next[u];if(!(d.isText||d.hasRequiredAttrs())&&s.indexOf(h)==-1){s.push(h);let f=i(h,l.concat(d));if(f)return f}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),i=s.match;if(i.matchType(e)){let o=[];for(let l=s;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<i.next.length;o++){let{type:l,next:c}=i.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in n)&&(!s.type||c.validEnd)&&(r.push({match:l.contentMatch,type:l,via:s}),n[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&n(r.next[s].next)}return n(this),e.map((r,s)=>{let i=s+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)i+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return i}).join(` 1062`)}}u0.empty=new u0(!0);class Rit{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function mje(t){let e=[];do e.push(Oit(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Oit(t){let e=[];do e.push(Iit(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Iit(t){let e=Fit(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=Dit(t,e);else break;return e}function Rne(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");
vendor: 9,018 bytes, line 1062
1062let e=Number(t.next);return t.pos++,e}function Dit(t,e){let n=Rne(t),r=n;return t.eat(",")&&(t.next!="}"?r=Rne(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function Lit(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let s=[];for(let i in n){let o=n[i];o.isInGroup(e)&&s.push(o)}return s.length==0&&t.err("No node type or group '"+e+"' found"),s}function Fit(t){if(t.eat("(")){let e=mje(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=Lit(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function $it(t){let e=[[]];return s(i(t,0),n()),e;function n(){return e.push([])-1}function r(o,l,c){let u={term:c,to:l};return e[o].push(u),u}function s(o,l){o.forEach(c=>c.to=l)}function i(o,l){if(o.type=="choice")return o.exprs.reduce((c,u)=>c.concat(i(u,l)),[]);if(o.type=="seq")for(let c=0;;c++){let u=i(o.exprs[c],l);if(c==o.exprs.length-1)return u;s(u,l=n())}else if(o.type=="star"){let c=n();return r(l,c),s(i(o.expr,c),c),[r(c)]}else if(o.type=="plus"){let c=n();return s(i(o.expr,l),c),s(i(o.expr,c),c),[r(c)]}else{if(o.type=="opt")return[r(l)].concat(i(o.expr,l));if(o.type=="range"){let c=l;for(let u=0;u<o.min;u++){let d=n();s(i(o.expr,c),d),c=d}if(o.max==-1)s(i(o.expr,c),c);else for(let u=o.min;u<o.max;u++){let d=n();r(c,d),s(i(o.expr,c),d),c=d}return[r(c)]}else{if(o.type=="name")return[r(l,void 0,o.value)];throw new Error("Unknown expr type")}}}}function gje(t,e){return e-t}function One(t,e){let n=[];return r(e),n.sort(gje);function r(s){let i=t[s];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(s);for(let o=0;o<i.length;o++){let{term:l,to:c}=i[o];!l&&n.indexOf(c)==-1&&r(c)}}}function zit(t){let e=Object.create(null);return n(One(t,0));function n(r){let s=[];r.forEach(o=>{t[o].forEach(({term:l,to:c})=>{if(!l)return;let u;for(let d=0;d<s.length;d++)s[d][0]==l&&(u=s[d][1]);One(t,c).forEach(d=>{u||s.push([l,u=[]]),u.indexOf(d)==-1&&u.push(d)})})});let i=e[r.join(",")]=new u0(r.indexOf(t.length-1)>-1);for(let o=0;o<s.length;o++){let l=s[o][1].sort(gje);i.next.push({type:s[o][0],next:e[l.join(",")]||n(l)})}return i}}function Bit(t,e){for(let n=0,r=[t];n<r.length;n++){let s=r[n],i=!s.validEnd,o=[];for(let l=0;l<s.next.length;l++){let{type:c,next:u}=s.next[l];o.push(c.name),i&&!(c.isText||c.hasRequiredAttrs())&&(i=!1),r.indexOf(u)==-1&&r.push(u)}i&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function vje(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function xje(t,e){let n=Object.create(null);for(let r in t){let s=e&&e[r];if(s===void 0){let i=t[r];if(i.hasDefault)s=i.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=s}return n}function yje(t,e,n,r){for(let s in e)if(!(s in t))throw new RangeError(`Unsupported attribute ${s} for ${n} of type ${s}`);for(let s in t){let i=t[s];i.validate&&i.validate(e[s])}}function bje(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new qit(t,r,e[r]);return n}let Ine=class wje{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=bje(e,r.attrs),this.defaultAttrs=vje(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==u0.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:xje(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Ng(this,this.computeAttrs(e),De.from(n),Jn.setFrom(r))}createChecked(e=null,n,r){return n=De.from(n),this.checkContent(n),new Ng(this,this.computeAttrs(e),n,Jn.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=De.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let s=this.contentMatch.matchFragment(n),i=s&&s.fillBefore(De.empty,!0);return i?new Ng(this,e,n.append(i),Jn.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){yje(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:Jn.none:e}static compile(e,n){let r=Object.create(null);e.forEach((i,o)=>r[i]=new wje(i,n,o));let s=n.spec.topNode||"doc";if(!r[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function Uit(t,e,n){let r=n.split("|");return s=>{let i=s===null?"null":typeof s;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${i}`)}}class qit{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?Uit(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class h4{constructor(e,n,r,s){this.name=e,this.rank=n,this.schema=r,this.spec=s,this.attrs=bje(e,s.attrs),this.excluded=null;let i=vje(this.attrs);this.instance=i?new Jn(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Jn(this,xje(this.attrs,e))}static compile(e,n){let r=Object.create(null),s=0;return e.forEach((i,o)=>r[i]=new h4(i,s++,n,o)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){yje(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class _je{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let s in e)n[s]=e[s];n.nodes=Ri.from(e.nodes),n.marks=Ri.from(e.marks||{}),this.nodes=Ine.compile(this.spec.nodes,this),this.marks=h4.compile(this.spec.marks,this);let r=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let i=this.nodes[s],o=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=r[o]||(r[o]=u0.parse(o,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=l=="_"?null:l?Dne(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let s in this.marks){let i=this.marks[s],o=i.spec.excludes;i.excluded=o==null?[i]:o==""?[]:Dne(this,o.split(" "))}this.nodeFromJSON=s=>Ng.fromJSON(this,s),this.markFromJSON=s=>Jn.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Ine){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,s)}text(e,n){let r=this.nodes.text;return new NI(r,r.defaultAttrs,e,Jn.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function Dne(t,e){let n=[];for(let r=0;r<e.length;r++){let s=e[r],i=t.marks[s],o=i;if(i)n.push(i);else for(let l in t.marks){let c=t.marks[l];(s=="_"||c.spec.group&&c.spec.group.split(" ").indexOf(s)>-1)&&n.push(o=c)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function Vit(t){return t.tag!=null}function Hit(t){return t.style!=null}let jC=class _q{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];
vendor: 5,344 bytes, lines 1062-1063
1062n.forEach(s=>{if(Vit(s))this.tags.push(s);else if(Hit(s)){let i=/[^=]*/.exec(s.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let i=e.nodes[s.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new Fne(this,n,!1);return r.addAll(e,Jn.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new Fne(this,n,!0);return r.addAll(e,Jn.none,n.from,n.to),Ge.maxOpen(r.finish())}matchTag(e,n,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){let i=this.tags[s];if(Git(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let o=i.getAttrs(e);if(o===!1)continue;i.attrs=o||void 0}return i}}}matchStyle(e,n,r,s){for(let i=s?this.styles.indexOf(s)+1:0;i<this.styles.length;i++){let o=this.styles[i],l=o.style;if(!(l.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=n))){if(o.getAttrs){let c=o.getAttrs(n);if(c===!1)continue;o.attrs=c||void 0}return o}}}static schemaRules(e){let n=[];function r(s){let i=s.priority==null?50:s.priority,o=0;for(;o<n.length;o++){let l=n[o];if((l.priority==null?50:l.priority)<i)break}n.splice(o,0,s)}for(let s in e.marks){let i=e.marks[s].spec.parseDOM;i&&i.forEach(o=>{r(o=$ne(o)),o.mark||o.ignore||o.clearMark||(o.mark=s)})}for(let s in e.nodes){let i=e.nodes[s].spec.parseDOM;i&&i.forEach(o=>{r(o=$ne(o)),o.node||o.ignore||o.mark||(o.node=s)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new _q(e,_q.schemaRules(e)))}};const jje={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Wit={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Sje={ol:!0,ul:!0},Mk=1,jq=2,SC=4;function Lne(t,e,n){return e!=null?(e?Mk:0)|(e==="full"?jq:0):t&&t.whitespace=="pre"?Mk|jq:n&~SC}class _P{constructor(e,n,r,s,i,o){this.type=e,this.attrs=n,this.marks=r,this.solid=s,this.options=o,this.content=[],this.activeMarks=Jn.none,this.match=i||(o&SC?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(De.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(e.type))?(this.match=r,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Mk)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-s[0].length))}}let n=De.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(De.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!jje.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Fne{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=n.topNode,i,o=Lne(null,n.preserveWhitespace,0)|(r?SC:0);s?i=new _P(s.type,s.attrs,Jn.none,!0,n.topMatch||s.type.contentMatch,o):r?i=new _P(null,null,Jn.none,!0,null,o):i=new _P(e.schema.topNodeType,null,Jn.none,!0,null,o),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,s=this.top,i=s.options&jq?"full":this.localPreserveWS||(s.options&Mk)>0,{schema:o}=this.parser;if(i==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,` 1063`);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let c=0;c<l.length;c++)c&&this.insertNode(o.linebreakReplacement.create(),n,!0),l[c]&&this.insertNode(o.text(l[c]),n,!/\S/.test(l[c]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let l=s.content[s.content.length-1],c=e.previousSibling;(!l||c&&c.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let s=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),l;Sje.hasOwnProperty(o)&&this.parser.normalizeLists&&Kit(e);let c=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(c?c.ignore:Wit.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,n);else if(!c||c.skip||c.closeParent){c&&c.closeParent?this.open=Math.max(0,this.open-1):c&&c.skip.nodeType&&(e=c.skip);let u,d=this.needsBlock;if(jje.hasOwnProperty(o))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),u=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}
vendor: 4,923 bytes, lines 1063-1064
1063let h=c&&c.skip?n:this.readStyles(e,n);h&&this.addAll(e,h),u&&this.sync(i),this.needsBlock=d}else{let u=this.readStyles(e,n);u&&this.addElementByRule(e,c,u,c.consuming===!1?l:void 0)}this.localPreserveWS=s}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(` 1064`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let s=0;s<this.parser.matchedStyles.length;s++){let i=this.parser.matchedStyles[s],o=r.getPropertyValue(i);if(o)for(let l=void 0;;){let c=this.parser.matchStyle(i,o,this,l);if(!c)break;if(c.ignore)return null;if(c.clearMark?n=n.filter(u=>!c.clearMark(u)):n=n.concat(this.parser.schema.marks[c.mark].create(c.attrs)),c.consuming===!1)l=c;else break}}return n}addElementByRule(e,n,r,s){let i,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let c=this.enter(o,n.attrs||null,r,n.preserveWhitespace);c&&(i=!0,r=c)}else{let c=this.parser.schema.marks[n.mark];r=r.concat(c.create(n.attrs))}let l=this.top;if(o&&o.isLeaf)this.findInside(e);else if(s)this.addElement(e,r,s);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(c=>this.insertNode(c,r,!1));else{let c=e;typeof n.contentElement=="string"?c=e.querySelector(n.contentElement):typeof n.contentElement=="function"?c=n.contentElement(e):n.contentElement&&(c=n.contentElement),this.findAround(e,c,!0),this.addAll(c,r),this.findAround(e,c,!1)}i&&this.sync(l)&&this.open--}addAll(e,n,r,s){let i=r||0;for(let o=r?e.childNodes[r]:e.firstChild,l=s==null?null:e.childNodes[s];o!=l;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,n);this.findAtPoint(e,i)}findPlace(e,n,r){let s,i;for(let o=this.open,l=0;o>=0;o--){let c=this.nodes[o],u=c.findWrapping(e);if(u&&(!s||s.length>u.length+l)&&(s=u,i=c,!u.length))break;if(c.solid){if(r)break;l+=2}}if(!s)return null;this.sync(i);for(let o=0;o<s.length;o++)n=this.enterInner(s[o],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let s=this.findPlace(e,n,r);if(s){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let o=Jn.none;for(let l of s.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):zne(l.type,e.type))&&(o=l.addToSet(o));return i.content.push(e.mark(o)),!0}return!1}enter(e,n,r,s){let i=this.findPlace(e.create(n),r,!1);return i&&(i=this.enterInner(e,n,r,!0,s)),i}enterInner(e,n,r,s=!1,i){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let l=Lne(e,i,o.options);o.options&SC&&o.content.length==0&&(l|=SC);let c=Jn.none;return r=r.filter(u=>(o.type?o.type.allowsMarkType(u.type):zne(u.type,e))?(c=u.addToSet(c),!1):!0),this.nodes.push(new _P(e,n,c,s,null,l)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Mk)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let s=r.length-1;s>=0;s--)e+=r[s].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let s=0;s<this.find.length;s++)this.find[s].pos==null&&e.nodeType==1&&e.contains(this.find[s].node)&&n.compareDocumentPosition(this.find[s].node)&(r?2:4)&&(this.find[s].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(s?0:1),o=(l,c)=>{for(;l>=0;l--){let u=n[l];if(u==""){if(l==n.length-1||l==0)continue;for(;c>=i;c--)if(o(l-1,c))return!0;return!1}else{let d=c>0||c==0&&s?this.nodes[c].type:r&&c>=i?r.node(c-i).type:null;if(!d||d.name!=u&&!d.isInGroup(u))return!1;c--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;
vendor: 4,534 bytes, line 1064
1064if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function Kit(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Sje.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function Git(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function $ne(t){let e={};for(let n in t)e[n]=t[n];return e}function zne(t,e){let n=e.schema.nodes;for(let r in n){let s=n[r];if(!s.allowsMarkType(t))continue;let i=[],o=l=>{i.push(l);for(let c=0;c<l.edgeCount;c++){let{type:u,next:d}=l.edge(c);if(u==e||i.indexOf(d)<0&&o(d))return!0}};if(o(s.contentMatch))return!0}}class L0{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=Y5(n).createDocumentFragment());let s=r,i=[];return e.forEach(o=>{if(i.length||o.marks.length){let l=0,c=0;for(;l<i.length&&c<o.marks.length;){let u=o.marks[c];if(!this.marks[u.type.name]){c++;continue}if(!u.eq(i[l][0])||u.type.spec.spanning===!1)break;l++,c++}for(;l<i.length;)s=i.pop()[1];for(;c<o.marks.length;){let u=o.marks[c++],d=this.serializeMark(u,o.isInline,n);d&&(i.push([u,s]),s.appendChild(d.dom),s=d.contentDOM||d.dom)}}s.appendChild(this.serializeNodeInner(o,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:s}=kR(Y5(n),this.nodes[e.type.name](e),null,e.attrs);if(s){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,s)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let s=e.marks.length-1;s>=0;s--){let i=this.serializeMark(e.marks[s],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,n,r={}){let s=this.marks[e.type.name];return s&&kR(Y5(r),s(e,n),null,e.attrs)}static renderSpec(e,n,r=null,s){return kR(e,n,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new L0(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=Bne(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return Bne(e.marks)}}function Bne(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Y5(t){return t.document||window.document}const Une=new WeakMap;function Yit(t){let e=Une.get(t);return e===void 0&&Une.set(t,e=Xit(t)),e}function Xit(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let s=0;s<r.length;s++)n(r[s]);else for(let s in r)n(r[s])}return n(t),e}function kR(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let s=e[0],i;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=Yit(r))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=s.indexOf(" ");o>0&&(n=s.slice(0,o),s=s.slice(o+1));let l,c=n?t.createElementNS(n,s):t.createElement(s),u=e[1],d=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){d=2;for(let h in u)if(u[h]!=null){let f=h.indexOf(" ");f>0?c.setAttributeNS(h.slice(0,f),h.slice(f+1),u[h]):h=="style"&&c.style?c.style.cssText=u[h]:c.setAttribute(h,u[h])}}for(let h=d;h<e.length;h++){let f=e[h];if(f===0){if(h<e.length-1||h>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:c,contentDOM:c}}else{let{dom:p,contentDOM:m}=kR(t,f,n,r);if(c.appendChild(p),m){if(l)throw new RangeError("Multiple content holes");l=m}}}return{dom:c,contentDOM:l}}const Nje=65535,Cje=Math.pow(2,16);function Jit(t,e){return t+e*Cje}function qne(t){return t&Nje}function Qit(t){return(t-(t&Nje))/Cje}const kje=1,Aje=2,AR=4,Eje=8;let Sq=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Eje)>0}get deletedBefore(){return(this.delInfo&(kje|AR))>0}get deletedAfter(){return(this.delInfo&(Aje|AR))>0}get deletedAcross(){return(this.delInfo&AR)>0}},d0=class $b{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&$b.empty)return $b.empty}recover(e){let n=0,r=qne(e);if(!this.inverted)for(let s=0;s<r;s++)n+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+n+Qit(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let s=0,i=this.inverted?2:1,o=this.inverted?1:2;
vendor: 5,331 bytes, line 1064
1064for(let l=0;l<this.ranges.length;l+=3){let c=this.ranges[l]-(this.inverted?s:0);if(c>e)break;let u=this.ranges[l+i],d=this.ranges[l+o],h=c+u;if(e<=h){let f=u?e==c?-1:e==h?1:n:n,p=c+s+(f<0?0:d);if(r)return p;let m=e==(n<0?c:h)?null:Jit(l/3,e-c),v=e==c?Aje:e==h?kje:AR;return(n<0?e!=c:e!=h)&&(v|=Eje),new Sq(p,v,m)}s+=d-u}return r?e+s:new Sq(e+s,0,null)}touches(e,n){let r=0,s=qne(n),i=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let c=this.ranges[l]-(this.inverted?r:0);if(c>e)break;let u=this.ranges[l+i],d=c+u;if(e<=d&&l==s*3)return!0;r+=this.ranges[l+o]-u}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,i=0;s<this.ranges.length;s+=3){let o=this.ranges[s],l=o-(this.inverted?i:0),c=o+(this.inverted?0:i),u=this.ranges[s+n],d=this.ranges[s+r];e(l,l+u,c,c+d),i+=d-u}}invert(){return new $b(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?$b.empty:new $b(e<0?[0,-e,0]:[0,0,e])}};d0.empty=new d0([]);class Rk{constructor(e,n,r=0,s=e?e.length:0){this.mirror=n,this.from=r,this.to=s,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new Rk(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let s=e.getMirror(n);this.appendMap(e._maps[n],s!=null&&s<n?r+s:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let s=e.getMirror(n);this.appendMap(e._maps[n].invert(),s!=null&&s>n?r-s-1:void 0)}}invert(){let e=new Rk;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let s=0;for(let i=this.from;i<this.to;i++){let o=this._maps[i],l=o.mapResult(e,n);if(l.recover!=null){let c=this.getMirror(i);if(c!=null&&c>i&&c<this.to){i=c,e=this._maps[c].recover(l.recover);continue}}s|=l.delInfo,e=l.pos}return r?e:new Sq(e,s,null)}}const X5=Object.create(null);let Fa=class{getMap(){return d0.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=X5[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in X5)throw new RangeError("Duplicate use of step JSON ID "+e);return X5[e]=n,n.prototype.jsonID=e,n}},so=class PN{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new PN(e,null)}static fail(e){return new PN(null,e)}static fromReplace(e,n,r,s){try{return PN.ok(e.replace(n,r,s))}catch(i){if(i instanceof _I)return PN.fail(i.message);throw i}}};function sK(t,e,n){let r=[];for(let s=0;s<t.childCount;s++){let i=t.child(s);i.content.size&&(i=i.copy(sK(i.content,e,i))),i.isInline&&(i=e(i,n,s)),r.push(i)}return De.fromArray(r)}let iK=class MN extends Fa{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),s=r.node(r.sharedDepth(this.to)),i=new Ge(sK(n.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),s),n.openStart,n.openEnd);return so.fromReplace(e,this.from,this.to,i)}invert(){return new Hj(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new MN(n.pos,r.pos,this.mark)}merge(e){return e instanceof MN&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new MN(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new MN(n.from,n.to,e.markFromJSON(n.mark))}};Fa.jsonID("addMark",iK);let Hj=class RN extends Fa{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new Ge(sK(n.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),n.openStart,n.openEnd);return so.fromReplace(e,this.from,this.to,r)}invert(){return new iK(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new RN(n.pos,r.pos,this.mark)}merge(e){return e instanceof RN&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new RN(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new RN(n.from,n.to,e.markFromJSON(n.mark))}};Fa.jsonID("removeMark",Hj);let aK=class ON extends Fa{constructor(e,n){super(),this.pos=e,this.mark=n}
vendor: 5,662 bytes, line 1064
1064apply(e){let n=e.nodeAt(this.pos);if(!n)return so.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return so.fromReplace(e,this.pos,this.pos+1,new Ge(De.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let s=0;s<n.marks.length;s++)if(!n.marks[s].isInSet(r))return new ON(this.pos,n.marks[s]);return new ON(this.pos,this.mark)}}return new CI(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new ON(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new ON(n.pos,e.markFromJSON(n.mark))}};Fa.jsonID("addNodeMark",aK);let CI=class Nq extends Fa{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return so.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return so.fromReplace(e,this.pos,this.pos+1,new Ge(De.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new aK(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Nq(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Nq(n.pos,e.markFromJSON(n.mark))}};Fa.jsonID("removeNodeMark",CI);let Ic=class zp extends Fa{constructor(e,n,r,s=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=s}apply(e){return this.structure&&Cq(e,this.from,this.to)?so.fail("Structure replace would overwrite content"):so.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new d0([this.from,this.to-this.from,this.slice.size])}invert(e){return new zp(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.to,-1),r=this.from==this.to&&zp.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new zp(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof zp)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?Ge.empty:new Ge(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new zp(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?Ge.empty:new Ge(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new zp(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new zp(n.from,n.to,Ge.fromJSON(e,n.slice),!!n.structure)}};Ic.MAP_BIAS=1;Fa.jsonID("replace",Ic);let Qo=class ER extends Fa{constructor(e,n,r,s,i,o,l=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=s,this.slice=i,this.insert=o,this.structure=l}apply(e){if(this.structure&&(Cq(e,this.from,this.gapFrom)||Cq(e,this.gapTo,this.to)))return so.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return so.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?so.fromReplace(e,this.from,this.to,r):so.fail("Content does not fit in gap")}getMap(){return new d0([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new ER(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),s=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||s<n.pos||i>r.pos?null:new ER(n.pos,r.pos,s,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new ER(n.from,n.to,n.gapFrom,n.gapTo,Ge.fromJSON(e,n.slice),n.insert,!!n.structure)}};Fa.jsonID("replaceAround",Qo);function Cq(t,e,n){let r=t.resolve(e),s=n-e,i=r.depth;for(;s>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,s--;if(s>0){let o=r.node(i).maybeChild(r.indexAfter(i));for(;s>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,s--}}return!1}function Zit(t,e,n,r){let s=[],i=[],o,l;t.doc.nodesBetween(e,n,(c,u,d)=>{if(!c.isInline)return;let h=c.marks;if(!r.isInSet(h)&&d.type.allowsMarkType(r.type)){let f=Math.max(u,e),p=Math.min(u+c.nodeSize,n),m=r.addToSet(h);for(let v=0;v<h.length;v++)h[v].isInSet(m)||(o&&o.to==f&&o.mark.eq(h[v])?o.to=p:s.push(o=new Hj(f,p,h[v])));l&&l.to==f?l.to=p:i.push(l=new iK(f,p,r))}}
vendor: 5,932 bytes, lines 1064-1065
1064),s.forEach(c=>t.step(c)),i.forEach(c=>t.step(c))}function eat(t,e,n,r){let s=[],i=0;t.doc.nodesBetween(e,n,(o,l)=>{if(!o.isInline)return;i++;let c=null;if(r instanceof h4){let u=o.marks,d;for(;d=r.isInSet(u);)(c||(c=[])).push(d),u=d.removeFromSet(u)}else r?r.isInSet(o.marks)&&(c=[r]):c=o.marks;if(c&&c.length){let u=Math.min(l+o.nodeSize,n);for(let d=0;d<c.length;d++){let h=c[d],f;for(let p=0;p<s.length;p++){let m=s[p];m.step==i-1&&h.eq(s[p].style)&&(f=m)}f?(f.to=u,f.step=i):s.push({style:h,from:Math.max(l,e),to:u,step:i})}}}),s.forEach(o=>t.step(new Hj(o.from,o.to,o.style)))}function oK(t,e,n,r=n.contentMatch,s=!0){let i=t.doc.nodeAt(e),o=[],l=e+1;for(let c=0;c<i.childCount;c++){let u=i.child(c),d=l+u.nodeSize,h=r.matchType(u.type);if(!h)o.push(new Ic(l,d,Ge.empty));else{r=h;for(let f=0;f<u.marks.length;f++)n.allowsMarkType(u.marks[f].type)||t.step(new Hj(l,d,u.marks[f]));if(s&&u.isText&&n.whitespace!="pre"){let f,p=/\r?\n|\r/g,m;for(;f=p.exec(u.text);)m||(m=new Ge(De.from(n.schema.text(" ",n.allowedMarks(u.marks))),0,0)),o.push(new Ic(l+f.index,l+f.index+f[0].length,m))}}l=d}if(!r.validEnd){let c=r.fillBefore(De.empty,!0);t.replace(l,l,new Ge(c,0,0))}for(let c=o.length-1;c>=0;c--)t.step(o[c])}function tat(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Wj(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,s=0,i=0;;--r){let o=t.$from.node(r),l=t.$from.index(r)+s,c=t.$to.indexAfter(r)-i;if(r<t.depth&&o.canReplace(l,c,n))return r;if(r==0||o.type.spec.isolating||!tat(o,l,c))break;l&&(s=1),c<o.childCount&&(i=1)}return null}function nat(t,e,n){let{$from:r,$to:s,depth:i}=e,o=r.before(i+1),l=s.after(i+1),c=o,u=l,d=De.empty,h=0;for(let m=i,v=!1;m>n;m--)v||r.index(m)>0?(v=!0,d=De.from(r.node(m).copy(d)),h++):c--;let f=De.empty,p=0;for(let m=i,v=!1;m>n;m--)v||s.after(m+1)<s.end(m)?(v=!0,f=De.from(s.node(m).copy(f)),p++):u++;t.step(new Qo(c,u,o,l,new Ge(d.append(f),h,p),d.size-h,!0))}function lK(t,e,n=null,r=t){let s=rat(t,e),i=s&&sat(r,e);return i?s.map(Vne).concat({type:e,attrs:n}).concat(i.map(Vne)):null}function Vne(t){return{type:t,attrs:null}}function rat(t,e){let{parent:n,startIndex:r,endIndex:s}=t,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;let o=i.length?i[0]:e;return n.canReplaceWith(r,s,o)?i:null}function sat(t,e){let{parent:n,startIndex:r,endIndex:s}=t,i=n.child(r),o=e.contentMatch.findWrapping(i.type);if(!o)return null;let c=(o.length?o[o.length-1]:e).contentMatch;for(let u=r;c&&u<s;u++)c=c.matchType(n.child(u).type);return!c||!c.validEnd?null:o}function iat(t,e,n){let r=De.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let l=n[o].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=De.from(n[o].type.create(n[o].attrs,r))}let s=e.start,i=e.end;t.step(new Qo(s,i,s,i,new Ge(r,0,0),n.length,!0))}function aat(t,e,n,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(o,l)=>{let c=typeof s=="function"?s(o):s;if(o.isTextblock&&!o.hasMarkup(r,c)&&oat(t.doc,t.mapping.slice(i).map(l),r)){let u=null;if(r.schema.linebreakReplacement){let p=r.whitespace=="pre",m=!!r.contentMatch.matchType(r.schema.linebreakReplacement);p&&!m?u=!1:!p&&m&&(u=!0)}u===!1&&Pje(t,o,l,i),oK(t,t.mapping.slice(i).map(l,1),r,void 0,u===null);let d=t.mapping.slice(i),h=d.map(l,1),f=d.map(l+o.nodeSize,1);return t.step(new Qo(h,f,h+1,f-1,new Ge(De.from(r.create(c,null,o.marks)),0,0),1,!0)),u===!0&&Tje(t,o,l,i),!1}})}function Tje(t,e,n,r){e.forEach((s,i)=>{if(s.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(s.text);){let c=t.mapping.slice(r).map(n+1+i+o.index);t.replaceWith(c,c+1,e.type.schema.linebreakReplacement.create())}}})}function Pje(t,e,n,r){e.forEach((s,i)=>{if(s.type==s.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+i);t.replaceWith(o,o+1,e.type.schema.text(` 1065`))}})}function oat(t,e,n){let r=t.resolve(e),s=r.index();return r.parent.canReplaceWith(s,s+1,n)}function lat(t,e,n,r,s){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let o=n.create(r,null,s||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,o);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Qo(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new Ge(De.from(o),0,0),1,!0))}function Bw(t,e,n=1,r){let s=t.resolve(e),i=s.depth-n,o=r&&r[r.length-1]||s.parent;if(i<0||s.parent.type.spec.isolating||!s.parent.canReplace(s.index(),s.parent.childCount)||!o.type.validContent(s.parent.content.cutByIndex(s.index(),s.parent.childCount)))return!1;for(let u=s.depth-1,d=n-2;u>i;u--,d--){let h=s.node(u),f=s.index(u);if(h.type.spec.isolating)return!1;let p=h.content.cutByIndex(f,h.childCount),m=r&&r[d+1];m&&(p=p.replaceChild(0,m.type.create(m.attrs)));let v=r&&r[d]||h;if(!h.canReplace(f+1,h.childCount)||!v.type.validContent(p))return!1}let l=s.indexAfter(i),c=r&&r[0];return s.node(i).canReplaceWith(l,l,c?c.type:s.node(i+1).type)}function cat(t,e,n=1,r){let s=t.doc.resolve(e),i=De.empty,o=De.empty;for(let l=s.depth,c=s.depth-n,u=n-1;l>c;l--,u--){i=De.from(s.node(l).copy(i));let d=r&&r[u];o=De.from(d?d.type.create(d.attrs,o):s.node(l).copy(o))}t.step(new Ic(e,e,new Ge(i.append(o),n,n),!0))}function ov(t,e){let n=t.resolve(e),r=n.index();return Mje(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function uat(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let s=0;s<e.childCount;s++){let i=e.child(s),o=i.type==r?t.type.schema.nodes.text:i.type;if(n=n.matchType(o),!n||!t.type.allowsMarks(i.marks))return!1}return n.validEnd}function Mje(t,e){return!!(t&&e&&!t.isLeaf&&uat(t,e))}function f4(t,e,n=-1){let r=t.resolve(e);for(let s=r.depth;;
vendor: 15,949 bytes, line 1065
1065s--){let i,o,l=r.index(s);if(s==r.depth?(i=r.nodeBefore,o=r.nodeAfter):n>0?(i=r.node(s+1),l++,o=r.node(s).maybeChild(l)):(i=r.node(s).maybeChild(l-1),o=r.node(s+1)),i&&!i.isTextblock&&Mje(i,o)&&r.node(s).canReplace(l,l+1))return e;if(s==0)break;e=n<0?r.before(s):r.after(s)}}function dat(t,e,n){let r=null,{linebreakReplacement:s}=t.doc.type.schema,i=t.doc.resolve(e-n),o=i.node().type;if(s&&o.inlineContent){let d=o.whitespace=="pre",h=!!o.contentMatch.matchType(s);d&&!h?r=!1:!d&&h&&(r=!0)}let l=t.steps.length;if(r===!1){let d=t.doc.resolve(e+n);Pje(t,d.node(),d.before(),l)}o.inlineContent&&oK(t,e+n-1,o,i.node().contentMatchAt(i.index()),r==null);let c=t.mapping.slice(l),u=c.map(e-n);if(t.step(new Ic(u,c.map(e+n,-1),Ge.empty,!0)),r===!0){let d=t.doc.resolve(u);Tje(t,d.node(),d.before(),t.steps.length)}return t}function hat(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let s=r.depth-1;s>=0;s--){let i=r.index(s);if(r.node(s).canReplaceWith(i,i,n))return r.before(s+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let s=r.depth-1;s>=0;s--){let i=r.indexAfter(s);if(r.node(s).canReplaceWith(i,i,n))return r.after(s+1);if(i<r.node(s).childCount)return null}return null}function Rje(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let s=n.content;for(let i=0;i<n.openStart;i++)s=s.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let o=r.depth;o>=0;o--){let l=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,c=r.index(o)+(l>0?1:0),u=r.node(o),d=!1;if(i==1)d=u.canReplace(c,c,s);else{let h=u.contentMatchAt(c).findWrapping(s.firstChild.type);d=h&&u.canReplaceWith(c,c,h[0])}if(d)return l==0?r.pos:l<0?r.before(o+1):r.after(o+1)}return null}function p4(t,e,n=e,r=Ge.empty){if(e==n&&!r.size)return null;let s=t.resolve(e),i=t.resolve(n);return Oje(s,i,r)?new Ic(e,n,r):new fat(s,i,r).fit()}function Oje(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class fat{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=De.empty;for(let s=0;s<=e.depth;s++){let i=e.node(s);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(s))})}for(let s=e.depth;s>0;s--)this.placed=De.from(e.node(s).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,s=this.close(e<0?this.$to:r.doc.resolve(e));if(!s)return null;let i=this.placed,o=r.depth,l=s.depth;for(;o&&l&&i.childCount==1;)i=i.firstChild.content,o--,l--;let c=new Ge(i,o,l);return e>-1?new Qo(r.pos,e,this.$to.pos,this.$to.end(),c,n):c.size||r.pos!=this.$to.pos?new Ic(r.pos,s.pos,c):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,s=this.unplaced.openEnd;r<e;r++){let i=n.firstChild;if(n.childCount>1&&(s=0),i.type.spec.isolating&&s<=r){e=r;break}n=i.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let s,i=null;r?(i=J5(this.unplaced.content,r-1).firstChild,s=i.content):s=this.unplaced.content;let o=s.firstChild;for(let l=this.depth;l>=0;l--){let{type:c,match:u}=this.frontier[l],d,h=null;if(n==1&&(o?u.matchType(o.type)||(h=u.fillBefore(De.from(o),!1)):i&&c.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:l,parent:i,inject:h};if(n==2&&o&&(d=u.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:l,parent:i,wrap:d};if(i&&u.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,s=J5(e,n);return!s.childCount||s.firstChild.isLeaf?!1:(this.unplaced=new Ge(e,n+1,Math.max(r,s.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,s=J5(e,n);if(s.childCount<=1&&n>0){let i=e.size-n<=n+s.size;this.unplaced=new Ge(IN(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new Ge(IN(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:s,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let v=0;v<i.length;v++)this.openFrontierNode(i[v]);let o=this.unplaced,l=r?r.content:o.content,c=o.openStart-e,u=0,d=[],{match:h,type:f}=this.frontier[n];if(s){for(let v=0;v<s.childCount;v++)d.push(s.child(v));h=h.matchFragment(s)}let p=l.size+e-(o.content.size-o.openEnd);for(;u<l.childCount;){let v=l.child(u),x=h.matchType(v.type);if(!x)break;u++,(u>1||c==0||v.content.size)&&(h=x,d.push(Ije(v.mark(f.allowedMarks(v.marks)),u==1?c:0,u==l.childCount?p:-1)))}let m=u==l.childCount;m||(p=-1),this.placed=DN(this.placed,n,De.from(d)),this.frontier[n].match=h,m&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let v=0,x=l;v<p;v++){let g=x.lastChild;this.frontier.push({type:g.type,match:g.contentMatchAt(g.childCount)}),x=g.content}this.unplaced=m?e==0?Ge.empty:new Ge(IN(o.content,e-1,1),e-1,p<0?o.openEnd:e-1):new Ge(IN(o.content,e,u),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Q5(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,s=this.$to.after(r);for(;r>1&&s==this.$to.end(--r);)++s;return s}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:s}=this.frontier[n],i=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),o=Q5(e,n,s,r,i);if(o){for(let l=n-1;l>=0;l--){let{match:c,type:u}=this.frontier[l],d=Q5(e,l,u,c,!0);if(!d||d.childCount)continue e}return{depth:n,fit:o,move:i?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=DN(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let s=e.node(r),i=s.type.contentMatch.fillBefore(s.content,!0,e.index(r));this.openFrontierNode(s.type,s.attrs,i)}return e}openFrontierNode(e,n=null,r){let s=this.frontier[this.depth];s.match=s.match.matchType(e),this.placed=DN(this.placed,this.depth,De.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(De.empty,!0);n.childCount&&(this.placed=DN(this.placed,this.frontier.length,n))}}function IN(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(IN(t.firstChild.content,e-1,n)))}function DN(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(DN(t.lastChild.content,e-1,n)))}function J5(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function Ije(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,Ije(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(De.empty,!0)))),t.copy(r)}function Q5(t,e,n,r,s){let i=t.node(e),o=s?t.indexAfter(e):t.index(e);if(o==i.childCount&&!n.compatibleContent(i.type))return null;let l=r.fillBefore(i.content,!0,o);return l&&!pat(n,i.content,o)?l:null}function pat(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function mat(t){return t.spec.defining||t.spec.definingForContent}function gat(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let s=t.doc.resolve(e),i=t.doc.resolve(n);if(Oje(s,i,r))return t.step(new Ic(e,n,r));let o=Lje(s,i);o[o.length-1]==0&&o.pop();let l=-(s.depth+1);o.unshift(l);for(let f=s.depth,p=s.pos-1;f>0;f--,p--){let m=s.node(f).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;o.indexOf(f)>-1?l=f:s.before(f)==p&&o.splice(1,0,-f)}let c=o.indexOf(l),u=[],d=r.openStart;for(let f=r.content,p=0;;p++){let m=f.firstChild;if(u.push(m),p==r.openStart)break;f=m.content}for(let f=d-1;f>=0;f--){let p=u[f],m=mat(p.type);if(m&&!p.sameMarkup(s.node(Math.abs(l)-1)))d=f;else if(m||!p.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let p=(f+d+1)%(r.openStart+1),m=u[p];if(m)for(let v=0;v<o.length;v++){let x=o[(v+c)%o.length],g=!0;x<0&&(g=!1,x=-x);let w=s.node(x-1),_=s.index(x-1);if(w.canReplaceWith(_,_,m.type,m.marks))return t.replace(s.before(x),g?i.after(x):n,new Ge(Dje(r.content,0,r.openStart,p),p,r.openEnd))}}let h=t.steps.length;for(let f=o.length-1;f>=0&&(t.replace(e,n,r),!(t.steps.length>h));f--){let p=o[f];p<0||(e=s.before(p),n=i.after(p))}}function Dje(t,e,n,r,s){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(Dje(i.content,e+1,n,r,i)))}if(e>r){let i=s.contentMatchAt(0),o=i.fillBefore(t).append(t);t=o.append(i.matchFragment(o).fillBefore(De.empty,!0))}return t}function vat(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let s=hat(t.doc,e,r.type);s!=null&&(e=n=s)}t.replaceRange(e,n,new Ge(De.from(r),0,0))}function xat(t,e,n){let r=t.doc.resolve(e),s=t.doc.resolve(n);if(r.parent.isTextblock&&s.parent.isTextblock&&r.start()!=s.start()&&r.parentOffset==0&&s.parentOffset==0){let o=r.sharedDepth(n),l=!1;for(let c=r.depth;c>o;c--)r.node(c).type.spec.isolating&&(l=!0);for(let c=s.depth;c>o;c--)s.node(c).type.spec.isolating&&(l=!0);if(!l){for(let c=r.depth;c>0&&e==r.start(c);c--)e=r.before(c);for(let c=s.depth;c>0&&n==s.start(c);c--)n=s.before(c);r=t.doc.resolve(e),s=t.doc.resolve(n)}}let i=Lje(r,s);for(let o=0;o<i.length;o++){let l=i[o],c=o==i.length-1;if(c&&l==0||r.node(l).type.contentMatch.validEnd)return t.delete(r.start(l),s.end(l));if(l>0&&(c||r.node(l-1).canReplace(r.index(l-1),s.indexAfter(l-1))))return t.delete(r.before(l),s.after(l))}for(let o=1;o<=r.depth&&o<=s.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&s.end(o)-n!=s.depth-o&&r.start(o-1)==s.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),s.index(o-1)))return t.delete(r.before(o),n);t.delete(e,n)}function Lje(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let s=r;s>=0;s--){let i=t.start(s);if(i<t.pos-(t.depth-s)||e.end(s)>e.pos+(e.depth-s)||t.node(s).type.spec.isolating||e.node(s).type.spec.isolating)break;(i==e.start(s)||s==t.depth&&s==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&s&&e.start(s-1)==i-1)&&n.push(s)}return n}let Fje=class TR extends Fa{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return so.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let s=n.type.create(r,null,n.marks);return so.fromReplace(e,this.pos,this.pos+1,new Ge(De.from(s),0,n.isLeaf?0:1))}getMap(){return d0.empty}invert(e){return new TR(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new TR(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new TR(n.pos,n.attr,n.value)}};Fa.jsonID("attr",Fje);let $je=class kq extends Fa{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let s in e.attrs)n[s]=e.attrs[s];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return so.ok(r)}getMap(){return d0.empty}invert(e){return new kq(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new kq(n.attr,n.value)}};Fa.jsonID("docAttr",$je);let ej=class extends Error{};ej=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};ej.prototype=Object.create(Error.prototype);ej.prototype.constructor=ej;ej.prototype.name="TransformError";class cK{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Rk}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new ej(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let s=this.mapping.maps[r];r&&(e=s.map(e,1),n=s.map(n,-1)),s.forEach((i,o,l,c)=>{e=Math.min(e,l),n=Math.max(n,c)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=Ge.empty){let s=p4(this.doc,e,n,r);return s&&this.step(s),this}replaceWith(e,n,r){return this.replace(e,n,new Ge(De.from(r),0,0))}delete(e,n){return this.replace(e,n,Ge.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return gat(this,e,n,r),this}replaceRangeWith(e,n,r){return vat(this,e,n,r),this}deleteRange(e,n){return xat(this,e,n),this}lift(e,n){return nat(this,e,n),this}join(e,n=1){return dat(this,e,n),this}wrap(e,n){return iat(this,e,n),this}setBlockType(e,n=e,r,s=null){return aat(this,e,n,r,s),this}setNodeMarkup(e,n,r=null,s){return lat(this,e,n,r,s),this}setNodeAttribute(e,n,r){return this.step(new Fje(e,n,r)),this}setDocAttribute(e,n){return this.step(new $je(e,n)),this}addNodeMark(e,n){return this.step(new aK(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof Jn)n.isInSet(r.marks)&&this.step(new CI(e,n));else{let s=r.marks,i,o=[];for(;i=n.isInSet(s);)o.push(new CI(e,i)),s=i.removeFromSet(s);for(let l=o.length-1;l>=0;l--)this.step(o[l])}return this}split(e,n=1,r){return cat(this,e,n,r),this}addMark(e,n,r){return Zit(this,e,n,r),this}removeMark(e,n,r){return eat(this,e,n,r),this}clearIncompatible(e,n,r){return oK(this,e,n,r),this}}const Z5=Object.create(null);let Ot=class{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new zje(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=Ge.empty){let r=n.content.lastChild,s=null;for(let l=0;l<n.openEnd;l++)s=r,r=r.lastChild;let i=e.steps.length,o=this.ranges;for(let l=0;l<o.length;l++){let{$from:c,$to:u}=o[l],d=e.mapping.slice(i);e.replaceRange(d.map(c.pos),d.map(u.pos),l?Ge.empty:n),l==0&&Kne(e,i,(r?r.isInline:s&&s.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,s=this.ranges;for(let i=0;i<s.length;i++){let{$from:o,$to:l}=s[i],c=e.mapping.slice(r),u=c.map(o.pos),d=c.map(l.pos);i?e.deleteRange(u,d):(e.replaceRangeWith(u,d,n),Kne(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let s=e.parent.inlineContent?new It(e):zb(e.node(0),e.parent,e.pos,e.index(),n,r);if(s)return s;for(let i=e.depth-1;i>=0;i--){let o=n<0?zb(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):zb(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Cg(e.node(0))}static atStart(e){return zb(e,e,0,0,1)||new Cg(e)}static atEnd(e){return zb(e,e,e.content.size,e.childCount,-1)||new Cg(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Z5[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Z5)throw new RangeError("Duplicate use of selection JSON ID "+e);return Z5[e]=n,n.prototype.jsonID=e,n}getBookmark(){return It.between(this.$anchor,this.$head).getBookmark()}};Ot.prototype.visible=!0;let zje=class{constructor(e,n){this.$from=e,this.$to=n}},Hne=!1;function Wne(t){!Hne&&!t.parent.inlineContent&&(Hne=!0,console.warn("TextSelection endpoint not pointing into a
1065node with inline content ("+t.parent.type.name+")"))}let It=class LN extends Ot{constructor(e,n=e){Wne(e),Wne(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return Ot.near(r);let s=e.resolve(n.map(this.anchor));return new LN(s.parent.inlineContent?s:r,r)}replace(e,n=Ge.empty){if(super.replace(e,n),n==Ge.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof LN&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Bje(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new LN(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let s=e.resolve(n);return new this(s,r==n?s:e.resolve(r))}static between(e,n,r){let s=e.pos-n.pos;if((!r||s)&&(r=s>=0?1:-1),!n.parent.inlineContent){let i=Ot.findFrom(n,r,!0)||Ot.findFrom(n,-r,!0);if(i)n=i.$head;else return Ot.near(n,r)}return e.parent.inlineContent||(s==0?e=n:(e=(Ot.findFrom(e,-r,!0)||Ot.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=s<0&&(e=n))),new LN(e,n)}};Ot.jsonID("text",It);let Bje=class Uje{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Uje(e.map(this.anchor),e.map(this.head))}resolve(e){return It.between(e.resolve(this.anchor),e.resolve(this.head))}},Dt=class FN extends Ot{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:s}=n.mapResult(this.anchor),i=e.resolve(s);return r?Ot.near(i):new FN(i)}content(){return new Ge(De.from(this.node),0,0)}eq(e){return e instanceof FN&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new yat(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new FN(e.resolve(n.anchor))}static create(e,n){return new FN(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};Dt.prototype.visible=!1;Ot.jsonID("node",Dt);let yat=class qje{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Bje(r,r):new qje(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&Dt.isSelectable(r)?new Dt(n):Ot.near(n)}},Cg=class PR extends Ot{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=Ge.empty){if(n==Ge.empty){e.delete(0,e.doc.content.size);let r=Ot.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new PR(e)}map(e){return new PR(e)}eq(e){return e instanceof PR}getBookmark(){return bat}};Ot.jsonID("all",Cg);const bat={map(){return this},resolve(t){return new Cg(t)}};function zb(t,e,n,r,s,i=!1){if(e.inlineContent)return It.create(t,n);for(let o=r-(s>0?0:1);s>0?o<e.childCount:o>=0;o+=s){let l=e.child(o);if(l.isAtom){if(!i&&Dt.isSelectable(l))return Dt.create(t,n-(s<0?l.nodeSize:0))}else{let c=zb(t,l,n+s,s<0?l.childCount:0,s,i);if(c)return c}n+=l.nodeSize*s}return null}function Kne(t,e,n){let r=t.steps.length-1;if(r<e)return;let s=t.steps[r];if(!(s instanceof Ic||s instanceof Qo))return;let i=t.mapping.maps[r],o;i.forEach((l,c,u,d)=>{o==null&&(o=d)}),t.setSelection(Ot.near(t.doc.resolve(o),n))}const Gne=1,jP=2,Yne=4;class wat extends cK{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|Gne)&~jP,this.storedMarks=null,this}get selectionSet(){return(this.updated&Gne)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=jP,this}ensureMarks(e){return Jn.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&jP)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~jP,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Jn.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let s=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(s.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let o=this.doc.resolve(n);i=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,s.text(e,i)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(Ot.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Yne,this}get scrolledIntoView(){return(this.updated&Yne)>0}}function Xne(t,e){return!e||!t?t:t.bind(e)}let $N=class{constructor(e,n,r){this.name=e,this.init=Xne(n.init,r),this.apply=Xne(n.apply,r)}};const _at=[new $N("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new $N("selection",{init(t,e){return t.selection||Ot.atStart(e.doc)},apply(t){return t.selection}}),new $N("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new $N("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class ez{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=_at.slice(),n&&n.forEac
vendor: 14,438 bytes, lines 1065-1066
1065h(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new $N(r.key,r.spec.state,r))})}}class pw{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let s=this.config.plugins[r];if(s.spec.filterTransaction&&!s.spec.filterTransaction.call(s,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),s=null;for(;;){let i=!1;for(let o=0;o<this.config.plugins.length;o++){let l=this.config.plugins[o];if(l.spec.appendTransaction){let c=s?s[o].n:0,u=s?s[o].state:this,d=c<n.length&&l.spec.appendTransaction.call(l,c?n.slice(c):n,u,r);if(d&&r.filterTransaction(d,o)){if(d.setMeta("appendedTransaction",e),!s){s=[];for(let h=0;h<this.config.plugins.length;h++)s.push(h<o?{state:r,n:n.length}:{state:this,n:0})}n.push(d),r=r.applyInner(d),i=!0}s&&(s[o]={state:r,n:n.length})}}if(!i)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new pw(this.config),r=this.config.fields;for(let s=0;s<r.length;s++){let i=r[s];n[i.name]=i.apply(e,this[i.name],this,n)}return n}get tr(){return new wat(this)}static create(e){let n=new ez(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new pw(n);for(let s=0;s<n.fields.length;s++)r[n.fields[s].name]=n.fields[s].init(e,r);return r}reconfigure(e){let n=new ez(this.schema,e.plugins),r=n.fields,s=new pw(n);for(let i=0;i<r.length;i++){let o=r[i].name;s[o]=this.hasOwnProperty(o)?this[o]:r[i].init(e,s)}return s}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let s=e[r],i=s.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(s,this[s.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let s=new ez(e.schema,e.plugins),i=new pw(s);return s.fields.forEach(o=>{if(o.name=="doc")i.doc=Ng.fromJSON(e.schema,n.doc);else if(o.name=="selection")i.selection=Ot.fromJSON(i.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let c=r[l],u=c.spec.state;if(c.key==o.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(n,l)){i[o.name]=u.fromJSON.call(c,e,n[l],i);return}}i[o.name]=o.init(e,i)}}),i}}function Vje(t,e,n){for(let r in t){let s=t[r];s instanceof Function?s=s.bind(e):r=="handleDOMEvents"&&(s=Vje(s,e,{})),n[r]=s}return n}class fr{constructor(e){this.spec=e,this.props={},e.props&&Vje(e.props,this,this.props),this.key=e.key?e.key.key:Hje("plugin")}getState(e){return e[this.key]}}const tz=Object.create(null);function Hje(t){return t in tz?t+"$"+ ++tz[t]:(tz[t]=0,t+"$")}class as{constructor(e="key"){this.key=Hje(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}function Wje(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const jat=(t,e,n)=>{let r=Wje(t,n);if(!r)return!1;let s=uK(r);if(!s){let o=r.blockRange(),l=o&&Wj(o);return l==null?!1:(e&&e(t.tr.lift(o,l).scrollIntoView()),!0)}let i=s.nodeBefore;if(Xje(t,s,e,-1))return!0;if(r.parent.content.size==0&&(tj(i,"end")||Dt.isSelectable(i)))for(let o=r.depth;;o--){let l=p4(t.doc,r.before(o),r.after(o),Ge.empty);if(l&&l.slice.size<l.to-l.from){if(e){let c=t.tr.step(l);c.setSelection(tj(i,"end")?Ot.findFrom(c.doc.resolve(c.mapping.map(s.pos,-1)),-1):Dt.create(c.doc,s.pos-i.nodeSize)),e(c.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return i.isAtom&&s.depth==r.depth-1?(e&&e(t.tr.delete(s.pos-i.nodeSize,s.pos).scrollIntoView()),!0):!1},Sat=(t,e,n)=>{let r=Wje(t,n);if(!r)return!1;let s=uK(r);return s?Kje(t,s,e):!1},Nat=(t,e,n)=>{let r=Gje(t,n);if(!r)return!1;let s=dK(r);return s?Kje(t,s,e):!1};function Kje(t,e,n){let r=e.nodeBefore,s=r,i=e.pos-1;for(;!s.isTextblock;i--){if(s.type.spec.isolating)return!1;let d=s.lastChild;if(!d)return!1;s=d}let o=e.nodeAfter,l=o,c=e.pos+1;for(;!l.isTextblock;c++){if(l.type.spec.isolating)return!1;let d=l.firstChild;if(!d)return!1;l=d}let u=p4(t.doc,i,c,Ge.empty);if(!u||u.from!=i||u instanceof Ic&&u.slice.size>=c-i)return!1;if(n){let d=t.tr.step(u);d.setSelection(It.create(d.doc,i)),n(d.scrollIntoView())}return!0}function tj(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const Cat=(t,e,n)=>{let{$head:r,empty:s}=t.selection,i=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;i=uK(r)}let o=i&&i.nodeBefore;return!o||!Dt.isSelectable(o)?!1:(e&&e(t.tr.setSelection(Dt.create(t.doc,i.pos-o.nodeSize)).scrollIntoView()),!0)};function uK(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function Gje(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const kat=(t,e,n)=>{let r=Gje(t,n);if(!r)return!1;let s=dK(r);if(!s)return!1;let i=s.nodeAfter;if(Xje(t,s,e,1))return!0;if(r.parent.content.size==0&&(tj(i,"start")||Dt.isSelectable(i))){let o=p4(t.doc,r.before(),r.after(),Ge.empty);if(o&&o.slice.size<o.to-o.from){if(e){let l=t.tr.step(o);l.setSelection(tj(i,"start")?Ot.findFrom(l.doc.resolve(l.mapping.map(s.pos)),1):Dt.create(l.doc,l.mapping.map(s.pos))),e(l.scrollIntoView())}return!0}}return i.isAtom&&s.depth==r.depth-1?(e&&e(t.tr.delete(s.pos,s.pos+i.nodeSize).scrollIntoView()),!0):!1},Aat=(t,e,n)=>{let{$head:r,empty:s}=t.selection,i=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;i=dK(r)}let o=i&&i.nodeAfter;return!o||!Dt.isSelectable(o)?!1:(e&&e(t.tr.setSelection(Dt.create(t.doc,i.pos)).scrollIntoView()),!0)};function dK(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const Eat=(t,e)=>{let n=t.selection,r=n instanceof Dt,s;if(r){if(n.node.isTextblock||!ov(t.doc,n.from))return!1;s=n.from}else if(s=f4(t.doc,n.from,-1),s==null)return!1;if(e){let i=t.tr.join(s);r&&i.setSelection(Dt.create(i.doc,s-t.doc.resolve(s).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},Tat=(t,e)=>{let n=t.selection,r;if(n instanceof Dt){if(n.node.isTextblock||!ov(t.doc,n.to))return!1;r=n.to}else if(r=f4(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},Pat=(t,e)=>{let{$from:n,$to:r}=t.selection,s=n.blockRange(r),i=s&&Wj(s);return i==null?!1:(e&&e(t.tr.lift(s,i).scrollIntoView()),!0)},Mat=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(` 1066`).scrollIntoView()),!0)};function Yje(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const Rat=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let s=n.node(-1),i=n.indexAfter(-1),o=Yje(s.contentMatchAt(i));if(!o||!s.canReplaceWith(i,i,o))return!1;if(e){let l=n.after(),c=t.tr.replaceWith(l,l,o.createAndFill());c.setSelection(Ot.near(c.doc.resolve(l),1)),e(c.scrollIntoView())}return!0},Oat=(t,e)=>{let n=t.selection,{$from:r,$to:s}=n;if(n instanceof Cg||r.parent.inlineContent||s.parent.inlineContent)return!1;let i=Yje(s.parent.contentMatchAt(s.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let o=(!r.parentOffset&&s.index()<s.parent.childCount?r:s).pos,l=t.tr.insert(o,i.createAndFill());l.setSelection(It.create(l.doc,o+1)),e(l.scrollIntoView())}return!0},Iat=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(Bw(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),s=r&&Wj(r);return s==null?!1:(e&&e(t.tr.lift(r,s).scrollIntoView()),!0)},Dat=(t,e)=>{let{$from:n,to:r}=t.selection,s,i=n.sharedDepth(r);return i==0?!1:(s=n.before(i),e&&e(t.tr.setSelection(Dt.create(t.doc,s))),!0)};function Lat(t,e,n){let r=e.nodeBefore,s=e.nodeAfter,i=e.index();return!r||!s||!r.type.compatibleContent(s.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(s.isTextblock||ov(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function Xje(t,e,n,r){let s=e.nodeBefore,i=e.nodeAfter,o,l,c=s.type.spec.isolating||i.type.spec.isolating;if(!c&&Lat(t,e,n))return!0;let u=!c&&e.parent.canReplace(e.index(),e.index()+1);if(u&&(o=(l=s.contentMatchAt(s.childCount)).findWrapping(i.type))&&l.matchType(o[0]||i.type).validEnd){if(n){let p=e.pos+i.nodeSize,m=De.empty;for(let g=o.length-1;g>=0;g--)m=De.from(o[g].create(null,m));m=De.from(s.copy(m));let v=t.tr.step(new Qo(e.pos-1,p,e.pos,p,new Ge(m,1,0),o.length,!0)),x=v.doc.resolve(p+2*o.length);x.nodeAfter&&x.nodeAfter.type==s.type&&ov(v.doc,x.pos)&&v.join(x.pos),n(v.scrollIntoView())}return!0}let d=i.type.spec.isolating||r>0&&c?null:Ot.findFrom(e,1),h=d&&d.$from.blockRange(d.$to),f=h&&Wj(h);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(h,f).scrollIntoView()),!0;if(u&&tj(i,"start",!0)&&tj(s,"end")){let p=s,m=[];for(;m.push(p),!p.isTextblock;)p=p.lastChild;let v=i,x=1;for(;!v.isTextblock;v=v.firstChild)x++;if(p.canReplace(p.childCount,p.childCount,v.content)){if(n){let g=De.empty;for(let _=m.length-1;_>=0;_--)g=De.from(m[_].copy(g));let w=t.tr.step(new Qo(e.pos-m.length,e.pos+i.nodeSize,e.pos+x,e.pos+i.nodeSize-x,new Ge(g,m.length,0),0,!0));n(w.scrollIntoView())}return!0}}return!1}function Jje(t){return function(e,n){let r=e.selection,s=t<0?r.$from:r.$to,i=s.depth;for(;s.node(i).isInline;){if(!i)return!1;i--}return s.node(i).isTextblock?(n&&n(e.tr.setSelection(It.create(e.doc,t<0?s.start(i):s.end(i)))),!0):!1}}const Fat=Jje(-1),$at=Jje(1);function zat(t,e=null){return function(n,r){let{$from:s,$to:i}=n.selection,o=s.blockRange(i),l=o&&lK(o,t,e);return l?(r&&r(n.tr.wrap(o,l).scrollIntoView()),!0):!1}}function Jne(t,e=null){return function(n,r){let s=!1;for(let i=0;i<n.selection.ranges.length&&!s;i++){let{$from:{pos:o},$to:{pos:l}}=n.selection.ranges[i];n.doc.nodesBetween(o,l,(c,u)=>{if(s)return!1;if(!(!c.isTextblock||c.hasMarkup(t,e)))if(c.type==t)s=!0;else{let d=n.doc.resolve(u),h=d.index();s=d.parent.canReplaceWith(h,h+1,t)}})}if(!s)return!1;if(r){let i=n.tr;for(let o=0;o<n.selection.ranges.length;o++){let{$from:{pos:l},$to:{pos:c}}=n.selection.ranges[o];i.setBlockType(l,c,t,e)}r(i.scrollIntoView())}return!0}}typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function Bat(t,e=null){return function(n,r){let{$from:s,$to:i}=n.selection,o=s.blockRange(i);if(!o)return!1;let l=r?n.tr:null;return Uat(l,o,t,e)?(r&&r(l.scrollIntoView()),!0):!1}}function Uat(t,e,n,r=null){let s=!1,i=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let c=o.resolve(e.start-2);i=new SI(c,c,e.depth),e.endIndex<e.parent.childCount&&(e=new SI(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),s=!0}let l=lK(i,n,r,e);return l?(t&&qat(t,e,l,s,n),!0):!1}function qat(t,e,n,r,s){let i=De.empty;for(let d=n.length-1;d>=0;d--)i=De.from(n[d].type.create(n[d].attrs,i));t.step(new Qo(e.start-(r?2:0),e.end,e.start,e.end,new Ge(i,0,0),n.length,!0));let o=0;for(let d=0;d<n.length;d++)n[d].type==s&&(o=d+1);let l=n.length-o,c=e.start+n.length-(r?2:0),u=e.parent;for(let d=e.startIndex,h=e.endIndex,f=!0;d<h;d++,f=!1)!f&&Bw(t.doc,c,l)&&(t.split(c,l),c+=2*l),c+=u.child(d).nodeSize;return t}function Vat(t){return function(e,n){let{$from:r,$to:s}=e.selection,i=r.blockRange(s,o=>o.childCount>0&&o.firstChild.type==t);return i?n?r.node(i.depth-1).type==t?Hat(e,n,t,i):Wat(e,n,i):!0:!1}}function Hat(t,e,n,r){let s=t.tr,i=r.end,o=r.$to.end(r.depth);i<o&&(s.step(new Qo(i-1,o,i,o,new Ge(De.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new SI(s.doc.resolve(r.$from.pos),s.doc.resolve(o),r.depth));const l=Wj(r);if(l==null)return!1;s.lift(r,l);let c=s.doc.resolve(s.mapping.map(i,-1)-1);return ov(s.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&s.join(c.pos),e(s.scrollIntoView()),!0}function Wat(t,e,n){let r=t.tr,s=n.parent;for(let p=n.end,m=n.endIndex-1,v=n.startIndex;m>v;m--)p-=s.child(m).nodeSize,r.delete(p-1,p+1);let i=r.doc.resolve(n.start),o=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,c=n.endIndex==s.childCount,u=i.node(-1),d=i.index(-1);if(!u.canReplace(d+(l?0:1),d+1,o.content.append(c?De.empty:De.from(s))))return!1;let h=i.pos,f=h+o.nodeSize;return r.step(new Qo(h-(l?1:0),f+(c?1:0),h+1,f-1,new Ge((l?De.empty:De.from(s.copy(De.empty))).append(c?De.empty:De.from(s.copy(De.empty))),l?0:1,c?0:1),l?0:1)),e(r.scrollIntoView()),!0}function Kat(t){return function(e,n){let{$from:r,$to:s}=e.selection,i=r.blockRange(s,u=>u.childCount>0&&u.firstChild.type==t);if(!i)return!1;let o=i.startIndex;if(o==0)return!1;let l=i.parent,c=l.child(o-1);if(c.type!=t)return!1;if(n){let u=c.lastChild&&c.lastChild.type==l.type,d=De.from(u?t.create():null),h=new Ge(De.from(t.create(null,De.from(l.type.create(null,d)))),u?3:1,0),f=i.start,p=i.end;n(e.tr.step(new Qo(f-(u?3:1),p,f,p,h,1,!0)).scrollIntoView())}return!0}}const Fi=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},nj=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Aq=null;const Hh=function(t,e,n){let r=Aq||(Aq=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},Gat=function(){Aq=null},h0=function(t,e,n,r){return n&&(Qne(t,e,n,r,-1)||Qne(t,e,n,r,1))},Yat=/^(img|br|input|textarea|hr)$/i;function Qne(t,e,n,r,s){for(var i;;){if(t==n&&e==r)return!0;
vendor: 6,650 bytes, line 1066
1066if(e==(s<0?0:yc(t))){let o=t.parentNode;if(!o||o.nodeType!=1||D2(t)||Yat.test(t.nodeName)||t.contentEditable=="false")return!1;e=Fi(t)+(s<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(s<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((i=o.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=s;else return!1;else t=o,e=s<0?yc(t):0}else return!1}}function yc(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Xat(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=yc(t)}else if(t.parentNode&&!D2(t))e=Fi(t),t=t.parentNode;else return null}}function Jat(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!D2(t))e=Fi(t)+1,t=t.parentNode;else return null}}function Qat(t,e,n){for(let r=e==0,s=e==yc(t);r||s;){if(t==n)return!0;let i=Fi(t);if(t=t.parentNode,!t)return!1;r=r&&i==0,s=s&&i==yc(t)}}function D2(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const m4=function(t){return t.focusNode&&h0(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Kv(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function Zat(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function eot(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(yc(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(yc(r.startContainer),r.startOffset)}}}const ch=typeof navigator<"u"?navigator:null,Zne=typeof document<"u"?document:null,lv=ch&&ch.userAgent||"",Eq=/Edge\/(\d+)/.exec(lv),Qje=/MSIE \d/.exec(lv),Tq=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(lv),Yo=!!(Qje||Tq||Eq),kg=Qje?document.documentMode:Tq?+Tq[1]:Eq?+Eq[1]:0,Ec=!Yo&&/gecko\/(\d+)/i.test(lv);Ec&&+(/Firefox\/(\d+)/.exec(lv)||[0,0])[1];const Pq=!Yo&&/Chrome\/(\d+)/.exec(lv),Ui=!!Pq,Zje=Pq?+Pq[1]:0,Ia=!Yo&&!!ch&&/Apple Computer/.test(ch.vendor),rj=Ia&&(/Mobile\/\w+/.test(lv)||!!ch&&ch.maxTouchPoints>2),gc=rj||(ch?/Mac/.test(ch.platform):!1),eSe=ch?/Win/.test(ch.platform):!1,If=/Android \d/.test(lv),L2=!!Zne&&"webkitFontSmoothing"in Zne.documentElement.style,tot=L2?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function not(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function Ph(t,e){return typeof t=="number"?t:t[e]}function rot(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function ere(t,e,n){let r=t.someProp("scrollThreshold")||0,s=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(o.nodeType!=1){o=nj(o);continue}let l=o,c=l==i.body,u=c?not(i):rot(l),d=0,h=0;if(e.top<u.top+Ph(r,"top")?h=-(u.top-e.top+Ph(s,"top")):e.bottom>u.bottom-Ph(r,"bottom")&&(h=e.bottom-e.top>u.bottom-u.top?e.top+Ph(s,"top")-u.top:e.bottom-u.bottom+Ph(s,"bottom")),e.left<u.left+Ph(r,"left")?d=-(u.left-e.left+Ph(s,"left")):e.right>u.right-Ph(r,"right")&&(d=e.right-u.right+Ph(s,"right")),d||h)if(c)i.defaultView.scrollBy(d,h);else{let p=l.scrollLeft,m=l.scrollTop;h&&(l.scrollTop+=h),d&&(l.scrollLeft+=d);let v=l.scrollLeft-p,x=l.scrollTop-m;e={left:e.left-v,top:e.top-x,right:e.right-v,bottom:e.bottom-x}}let f=c?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(f))break;o=f=="absolute"?o.offsetParent:nj(o)}}function sot(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,s;for(let i=(e.left+e.right)/2,o=n+1;o<Math.min(innerHeight,e.bottom);o+=5){let l=t.root.elementFromPoint(i,o);if(!l||l==t.dom||!t.dom.contains(l))continue;let c=l.getBoundingClientRect();if(c.top>=n-20){r=l,s=c.top;break}}return{refDOM:r,refTop:s,stack:tSe(t.dom)}}function tSe(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=nj(r));return e}function iot({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;nSe(n,r==0?0:r-e)}function nSe(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:s,left:i}=t[n];r.scrollTop!=s+e&&(r.scrollTop=s+e),r.scrollLeft!=i&&(r.scrollLeft=i)}}let hb=null;function aot(t){if(t.setActive)return t.setActive();if(hb)return t.focus(hb);let e=tSe(t);t.focus(hb==null?{get preventScroll(){return hb={preventScroll:!0},!0}}:void 0),hb||(hb=!1,nSe(e,0))}function rSe(t,e){let n,r=2e8,s,i=0,o=e.top,l=e.top,c,u;for(let d=t.firstChild,h=0;d;d=d.nextSibling,h++){let f;if(d.nodeType==1)f=d.getClientRects();else if(d.nodeType==3)f=Hh(d).getClientRects();else continue;for(let p=0;p<f.length;p++){let m=f[p];if(m.top<=o&&m.bottom>=l){o=Math.max(m.bottom,o),l=Math.min(m.top,l);let v=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(v<r){n=d,r=v,s=v&&n.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,d.nodeType==1&&v&&(i=h+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!c&&m.left<=e.left&&m.right>=e.left&&(c=d,u={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!n&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(i=h+1)}}return!n&&c&&(n=c,s=u,r=0),n&&n.nodeType==3?oot(n,s):!n||r&&n.nodeType==1?{node:t,offset:i}:rSe(n,s)}function oot(t,e){let n=t.nodeValue.length,r=document.createRange(),s;for(let i=0;i<n;i++){r.setEnd(t,i+1),r.setStart(t,i);let o=Bp(r,1);if(o.top!=o.bottom&&hK(e,o)){s={node:t,offset:i+(e.left>=(o.left+o.right)/2?1:0)};break}}return r.detach(),s||{node:t,offset:0}}function hK(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function lot(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function cot(t,e,n){let{node:r,offset:s}=rSe(e,n),i=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();i=o.left!=o.right&&n.left>(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,s,i)}function uot(t,e,n,r){let s=-1;for(let i=e,o=!1;i!=t.dom;){let l=t.docView.nearestDesc(i,!0),c;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((c=l.dom.getBoundingClientRect()).width||c.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!o&&c.left>r.left||c.top>
vendor: 11,505 bytes, lines 1066-1067
1066r.top?s=l.posBefore:(!o&&c.right<r.left||c.bottom<r.top)&&(s=l.posAfter),o=!0),!l.contentDOM&&s<0&&!l.node.isText))return(l.node.isBlock?r.top<(c.top+c.bottom)/2:r.left<(c.left+c.right)/2)?l.posBefore:l.posAfter;i=l.dom.parentNode}return s>-1?s:t.docView.posFromDOM(e,n,-1)}function sSe(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let s=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),i=s;;){let o=t.childNodes[i];if(o.nodeType==1){let l=o.getClientRects();for(let c=0;c<l.length;c++){let u=l[c];if(hK(e,u))return sSe(o,e,u)}}if((i=(i+1)%r)==s)break}return t}function dot(t,e){let n=t.dom.ownerDocument,r,s=0,i=eot(n,e.left,e.top);i&&({node:r,offset:s}=i);let o=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),l;if(!o||!t.dom.contains(o.nodeType!=1?o.parentNode:o)){let u=t.dom.getBoundingClientRect();if(!hK(e,u)||(o=sSe(t.dom,e,u),!o))return null}if(Ia)for(let u=o;r&&u;u=nj(u))u.draggable&&(r=void 0);if(o=lot(o,e),r){if(Ec&&r.nodeType==1&&(s=Math.min(s,r.childNodes.length),s<r.childNodes.length)){let d=r.childNodes[s],h;d.nodeName=="IMG"&&(h=d.getBoundingClientRect()).right<=e.left&&h.bottom>e.top&&s++}let u;L2&&s&&r.nodeType==1&&(u=r.childNodes[s-1]).nodeType==1&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=e.top&&s--,r==t.dom&&s==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:(s==0||r.nodeType!=1||r.childNodes[s-1].nodeName!="BR")&&(l=uot(t,r,s,e))}l==null&&(l=cot(t,o,e));let c=t.docView.nearestDesc(o,!0);return{pos:l,inside:c?c.posAtStart-c.border:-1}}function tre(t){return t.top<t.bottom||t.left<t.right}function Bp(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(tre(r))return r}return Array.prototype.find.call(n,tre)||t.getBoundingClientRect()}const hot=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function iSe(t,e,n){let{node:r,offset:s,atom:i}=t.docView.domFromPos(e,n<0?-1:1),o=L2||Ec;if(r.nodeType==3)if(o&&(hot.test(r.nodeValue)||(n<0?!s:s==r.nodeValue.length))){let c=Bp(Hh(r,s,s),n);if(Ec&&s&&/\s/.test(r.nodeValue[s-1])&&s<r.nodeValue.length){let u=Bp(Hh(r,s-1,s-1),-1);if(u.top==c.top){let d=Bp(Hh(r,s,s+1),-1);if(d.top!=c.top)return MS(d,d.left<u.left)}}return c}else{let c=s,u=s,d=n<0?1:-1;return n<0&&!s?(u++,d=-1):n>=0&&s==r.nodeValue.length?(c--,d=1):n<0?c--:u++,MS(Bp(Hh(r,c,u),d),d<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&s&&(n<0||s==yc(r))){let c=r.childNodes[s-1];if(c.nodeType==1)return nz(c.getBoundingClientRect(),!1)}if(i==null&&s<yc(r)){let c=r.childNodes[s];if(c.nodeType==1)return nz(c.getBoundingClientRect(),!0)}return nz(r.getBoundingClientRect(),n>=0)}if(i==null&&s&&(n<0||s==yc(r))){let c=r.childNodes[s-1],u=c.nodeType==3?Hh(c,yc(c)-(o?0:1)):c.nodeType==1&&(c.nodeName!="BR"||!c.nextSibling)?c:null;if(u)return MS(Bp(u,1),!1)}if(i==null&&s<yc(r)){let c=r.childNodes[s];for(;c.pmViewDesc&&c.pmViewDesc.ignoreForCoords;)c=c.nextSibling;let u=c?c.nodeType==3?Hh(c,0,o?0:1):c.nodeType==1?c:null:null;if(u)return MS(Bp(u,-1),!0)}return MS(Bp(r.nodeType==3?Hh(r):r,-n),n>=0)}function MS(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function nz(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function aSe(t,e,n){let r=t.state,s=t.root.activeElement;r!=e&&t.updateState(e),s!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),s!=t.dom&&s&&s.focus()}}function fot(t,e,n){let r=e.selection,s=n=="up"?r.$from:r.$to;return aSe(t,e,()=>{let{node:i}=t.docView.domFromPos(s.pos,n=="up"?-1:1);for(;;){let l=t.docView.nearestDesc(i,!0);if(!l)break;if(l.node.isBlock){i=l.contentDOM||l.dom;break}i=l.dom.parentNode}let o=iSe(t,s.pos,1);for(let l=i.firstChild;l;l=l.nextSibling){let c;if(l.nodeType==1)c=l.getClientRects();else if(l.nodeType==3)c=Hh(l,0,l.nodeValue.length).getClientRects();else continue;for(let u=0;u<c.length;u++){let d=c[u];if(d.bottom>d.top+1&&(n=="up"?o.top-d.top>(d.bottom-o.top)*2:d.bottom-o.bottom>(o.bottom-d.top)*2))return!1}}return!0})}const pot=/[\u0590-\u08ac]/;function mot(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let s=r.parentOffset,i=!s,o=s==r.parent.content.size,l=t.domSelection();return l?!pot.test(r.parent.textContent)||!l.modify?n=="left"||n=="backward"?i:o:aSe(t,e,()=>{let{focusNode:c,focusOffset:u,anchorNode:d,anchorOffset:h}=t.domSelectionRange(),f=l.caretBidiLevel;l.modify("move",n,"character");let p=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:m,focusOffset:v}=t.domSelectionRange(),x=m&&!p.contains(m.nodeType==1?m:m.parentNode)||c==m&&u==v;try{l.collapse(d,h),c&&(c!=d||u!=h)&&l.extend&&l.extend(c,u)}catch{}return f!=null&&(l.caretBidiLevel=f),x}):r.pos==r.start()||r.pos==r.end()}let nre=null,rre=null,sre=!1;function got(t,e,n){return nre==e&&rre==n?sre:(nre=e,rre=n,sre=n=="up"||n=="down"?fot(t,e,n):mot(t,e,n))}const Tc=0,ire=1,rx=2,uh=3;class F2{constructor(e,n,r,s){this.parent=e,this.children=n,this.dom=r,this.contentDOM=s,this.dirty=Tc,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let s=this.children[n];if(s==e)return r;r+=s.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let i,o;if(e==this.contentDOM)i=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((o=i.pmViewDesc)&&o.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(o)+o.size:this.posAtStart}else{let i,o;if(e==this.contentDOM)i=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((o=i.pmViewDesc)&&o.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(o):this.posAtEnd}let s;if(e==this.dom&&this.contentDOM)s=n>Fi(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){s=!1;break}if(i.previousSibling)break}if(s==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){s=!0;break}if(i.nextSibling)break}}return s??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,s=e;s;s=s.parentNode){let i=this.getDesc(s),o;if(i&&(!n||i.node))if(r&&(o=i.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return i}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let s=e;s;s=s.parentNode){let i=this.getDesc(s);if(i)return i.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let s=this.children[n],i=r+s.size;if(r==e&&i!=r){for(;!s.border&&s.children.length;)for(let o=0;o<s.children.length;o++){let l=s.children[o];if(l.size){s=l;break}}return s}if(e<i)return s.descAt(e-r-s.border);r=i}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,s=0;for(let i=0;r<this.children.length;r++){let o=this.children[r],l=i+o.size;if(l>e||o instanceof lSe){s=e-i;break}i=l}if(s)return this.children[r].domFromPos(s-this.children[r].border,n);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof oSe&&i.side>=0;r--);if(n<=0){let i,o=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,o=!1);return i&&n&&o&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?Fi(i.dom)+1:0}}else{let i,o=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,o=!1);return i&&o&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?Fi(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let s=-1,i=-1;for(let o=r,l=0;;l++){let c=this.children[l],u=o+c.size;if(s==-1&&e<=u){let d=o+c.border;if(e>=d&&n<=u-c.border&&c.node&&c.contentDOM&&this.contentDOM.contains(c.contentDOM))return c.parseRange(e,n,d);e=o;for(let h=l;h>0;h--){let f=this.children[h-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){s=Fi(f.dom)+1;break}e-=f.size}s==-1&&(s=0)}if(s>-1&&(u>n||l==this.children.length-1)){n=u;for(let d=l+1;d<this.children.length;d++){let h=this.children[d];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(-1)){i=Fi(h.dom);break}n+=h.size}i==-1&&(i=this.contentDOM.childNodes.length);break}o=u}return{node:this.contentDOM,from:e,to:n,fromOffset:s,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,s=!1){let i=Math.min(e,n),o=Math.max(e,n);for(let p=0,m=0;p<this.children.length;p++){let v=this.children[p],x=m+v.size;if(i>m&&o<x)return v.setSelection(e-m-v.border,n-m-v.border,r,s);m=x}let l=this.domFromPos(e,e?-1:1),c=n==e?l:this.domFromPos(n,n?-1:1),u=r.root.getSelection(),d=r.domSelectionRange(),h=!1;if((Ec||Ia)&&e==n){let{node:p,offset:m}=l;if(p.nodeType==3){if(h=!!(m&&p.nodeValue[m-1]==` 1067`),h&&m==p.nodeValue.length)for(let v=p,x;v;v=v.parentNode){if(x=v.nextSibling){x.nodeName=="BR"&&(l=c={node:x.parentNode,offset:Fi(x)+1});break}let g=v.pmViewDesc;if(g&&g.node&&g.node.isBlock)break}}else{let v=p.childNodes[m-1];h=v&&(v.nodeName=="BR"||v.contentEditable=="false")}}if(Ec&&d.focusNode&&d.focusNode!=c.node&&d.focusNode.nodeType==1){let p=d.focusNode.childNodes[d.focusOffset];p&&p.contentEditable=="false"&&(s=!0)}if(!(s||h&&Ia)&&h0(l.node,l.offset,d.anchorNode,d.anchorOffset)&&h0(c.node,c.offset,d.focusNode,d.focusOffset))return;let f=!1;if((u.extend||e==n)&&!(h&&Ec)){u.collapse(l.node,l.offset);try{e!=n&&u.extend(c.node,c.offset),f=!0}catch{}}if(!f){if(e>n){let m=l;l=c,c=m}let p=document.createRange();p.setEnd(c.node,c.offset),p.setStart(l.node,l.offset),u.removeAllRanges(),u.addRange(p)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,s=0;s<this.children.length;s++){let i=this.children[s],o=r+i.size;if(r==o?e<=o&&n>=r:e<o&&n>r){let l=r+i.border,c=o-i.border;if(e>=l&&n<=c){this.dirty=e==r||n==o?rx:ire,e==l&&n==c&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=uh:i.markDirty(e-l,n-l);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?rx:uh}r=o}this.dirty=rx}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?rx:ire;n.dirty<r&&(n.dirty=r)}
vendor: 3,742 bytes, line 1067
1067}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class oSe extends F2{constructor(e,n,r,s){let i,o=n.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!i)return s;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(o.nodeType!=1){let l=document.createElement("span");l.appendChild(o),o=l}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,i=this}matchesWidget(e){return this.dirty==Tc&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class vot extends F2{constructor(e,n,r,s){super(e,[],n,null),this.textDOM=r,this.text=s}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class f0 extends F2{constructor(e,n,r,s,i){super(e,[],r,s),this.mark=n,this.spec=i}static create(e,n,r,s){let i=s.nodeViews[n.type.name],o=i&&i(n,s,r);return(!o||!o.dom)&&(o=L0.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new f0(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&uh||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=uh&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Tc){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Tc}}slice(e,n,r){let s=f0.create(this.parent,this.mark,!0,r),i=this.children,o=this.size;n<o&&(i=Rq(i,n,o,r)),e>0&&(i=Rq(i,0,e,r));for(let l=0;l<i.length;l++)i[l].parent=s;return s.children=i,s}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Ag extends F2{constructor(e,n,r,s,i,o,l,c,u){super(e,[],i,o),this.node=n,this.outerDeco=r,this.innerDeco=s,this.nodeDOM=l}static create(e,n,r,s,i,o){let l=i.nodeViews[n.type.name],c,u=l&&l(n,i,()=>{if(!c)return o;if(c.parent)return c.parent.posBeforeChild(c)},r,s),d=u&&u.dom,h=u&&u.contentDOM;if(n.isText){if(!d)d=document.createTextNode(n.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:h}=L0.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!h&&!n.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),n.type.spec.draggable&&(d.draggable=!0));let f=d;return d=dSe(d,r,n),u?c=new xot(e,n,r,s,d,h||null,f,u,i,o+1):n.isText?new g4(e,n,r,s,d,f,i):new Ag(e,n,r,s,d,h||null,f,i,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>De.empty)}return e}matchesNode(e,n,r){return this.dirty==Tc&&e.eq(this.node)&&kI(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}
vendor: 26,189 bytes, lines 1067-1070
1067updateChildren(e,n){let r=this.node.inlineContent,s=n,i=e.composing?this.localCompositionInfo(e,n):null,o=i&&i.pos>-1?i:null,l=i&&i.pos<0,c=new bot(this,o&&o.node,e);jot(this.node,this.innerDeco,(u,d,h)=>{u.spec.marks?c.syncToMarks(u.spec.marks,r,e,d):u.type.side>=0&&!h&&c.syncToMarks(d==this.node.childCount?Jn.none:this.node.child(d).marks,r,e,d),c.placeWidget(u,e,s)},(u,d,h,f)=>{c.syncToMarks(u.marks,r,e,f);let p;c.findNodeMatch(u,d,h,f)||l&&e.state.selection.from>s&&e.state.selection.to<s+u.nodeSize&&(p=c.findIndexWithChild(i.node))>-1&&c.updateNodeAt(u,d,h,p,e)||c.updateNextNode(u,d,h,e,f,s)||c.addNode(u,d,h,e,s),s+=u.nodeSize}),c.syncToMarks([],r,e,0),this.node.isTextblock&&c.addTextblockHacks(),c.destroyRest(),(c.changed||this.dirty==rx)&&(o&&this.protectLocalComposition(e,o),cSe(this.contentDOM,this.children,e),rj&&Sot(this.dom))}localCompositionInfo(e,n){let{from:r,to:s}=e.state.selection;if(!(e.state.selection instanceof It)||r<n||s>n+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let o=i.nodeValue,l=Not(this.node.content,o,r-n,s-n);return l<0?null:{node:i,pos:l,text:o}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:s}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let o=new vot(this,i,n,s);e.input.compositionNodes.push(o),this.children=Rq(this.children,r,r+s.length,e,o)}update(e,n,r,s){return this.dirty==uh||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,s),!0)}updateInner(e,n,r,s){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(s,this.posAtStart),this.dirty=Tc}updateOuterDeco(e){if(kI(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=uSe(this.dom,this.nodeDOM,Mq(this.outerDeco,this.node,n),Mq(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function are(t,e,n,r,s){dSe(r,e,t);let i=new Ag(void 0,t,e,n,r,r,r,s,0);return i.contentDOM&&i.updateChildren(s,0),i}class g4 extends Ag{constructor(e,n,r,s,i,o,l){super(e,n,r,s,i,null,o,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,s){return this.dirty==uh||this.dirty!=Tc&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Tc||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,s.trackWrites==this.nodeDOM&&(s.trackWrites=null)),this.node=e,this.dirty=Tc,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let s=this.node.cut(e,n),i=document.createTextNode(s.text);return new g4(this.parent,s,this.outerDeco,this.innerDeco,i,i,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=uh)}get domAtom(){return!1}isText(e){return this.node.text==e}}class lSe extends F2{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Tc&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class xot extends Ag{constructor(e,n,r,s,i,o,l,c,u,d){super(e,n,r,s,i,o,l,u,d),this.spec=c}update(e,n,r,s){if(this.dirty==uh)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,n,r);return i&&this.updateInner(e,n,r,s),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,s)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,s){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,s)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function cSe(t,e,n){let r=t.firstChild,s=!1;for(let i=0;i<e.length;i++){let o=e[i],l=o.dom;if(l.parentNode==t){for(;l!=r;)r=ore(r),s=!0;r=r.nextSibling}else s=!0,t.insertBefore(l,r);if(o instanceof f0){let c=r?r.previousSibling:t.lastChild;cSe(o.contentDOM,o.children,n),r=c?c.nextSibling:t.firstChild}}for(;r;)r=ore(r),s=!0;s&&n.trackWrites==t&&(n.trackWrites=null)}const NC=function(t){t&&(this.nodeName=t)};NC.prototype=Object.create(null);const sx=[new NC];function Mq(t,e,n){if(t.length==0)return sx;let r=n?sx[0]:new NC,s=[r];for(let i=0;i<t.length;i++){let o=t[i].type.attrs;if(o){o.nodeName&&s.push(r=new NC(o.nodeName));for(let l in o){let c=o[l];c!=null&&(n&&s.length==1&&s.push(r=new NC(e.isInline?"span":"div")),l=="class"?r.class=(r.class?r.class+" ":"")+c:l=="style"?r.style=(r.style?r.style+";":"")+c:l!="nodeName"&&(r[l]=c))}}}return s}function uSe(t,e,n,r){if(n==sx&&r==sx)return e;let s=e;for(let i=0;i<r.length;i++){let o=r[i],l=n[i];if(i){let c;l&&l.nodeName==o.nodeName&&s!=t&&(c=s.parentNode)&&c.nodeName.toLowerCase()==o.nodeName||(c=document.createElement(o.nodeName),c.pmIsDeco=!0,c.appendChild(s),l=sx[0]),s=c}yot(s,l||sx[0],o)}return s}function yot(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],s=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)s.indexOf(r[i])==-1&&t.classList.remove(r[i]);for(let i=0;i<s.length;i++)r.indexOf(s[i])==-1&&t.classList.add(s[i]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,s;for(;s=r.exec(e.style);)t.style.removeProperty(s[1])}n.style&&(t.style.cssText+=n.style)}}function dSe(t,e,n){return uSe(t,t,sx,Mq(e,n,t.nodeType!=1))}function kI(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function ore(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class bot{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=wot(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r,s){let i=0,o=this.stack.length>>1,l=Math.min(o,e.length);for(;i<l&&(i==o-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<o;)this.destroyRest(),this.top.dirty=Tc,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let c=-1,u=this.top.children.length;s<this.preMatch.index&&(u=Math.min(this.index+3,u));for(let d=this.index;d<u;d++){let h=this.top.children[d];if(h.matchesMark(e[o])&&!this.isLocked(h.dom)){c=d;break}}if(c>-1)c>this.index&&(this.changed=!0,this.destroyBetween(this.index,c)),this.top=this.top.children[this.index];else{let d=f0.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,d),this.top=d,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,s){let i=-1,o;if(s>=this.preMatch.index&&(o=this.preMatch.matches[s-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))i=this.top.children.indexOf(o,this.index);else for(let l=this.index,c=Math.min(this.top.children.length,l+5);l<c;l++){let u=this.top.children[l];if(u.matchesNode(e,n,r)&&!this.preMatch.matched.has(u)){i=l;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,n,r,s,i){let o=this.top.children[s];return o.dirty==uh&&o.dom==o.contentDOM&&(o.dirty=rx),o.update(e,n,r,i)?(this.destroyBetween(this.index,s),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let s=this.index;s<this.top.children.length;s++)if(this.top.children[s]==r)return s}return-1}e=n}}updateNextNode(e,n,r,s,i,o){for(let l=this.index;l<this.top.children.length;l++){let c=this.top.children[l];if(c instanceof Ag){let u=this.preMatch.matched.get(c);if(u!=null&&u!=i)return!1;let d=c.dom,h,f=this.isLocked(d)&&!(e.isText&&c.node&&c.node.isText&&c.nodeDOM.nodeValue==e.text&&c.dirty!=uh&&kI(n,c.outerDeco));if(!f&&c.update(e,n,r,s))return this.destroyBetween(this.index,l),c.dom!=d&&(this.changed=!0),this.index++,!0;if(!f&&(h=this.recreateWrapper(c,e,n,r,s,o)))return this.destroyBetween(this.index,l),this.top.children[this.index]=h,h.contentDOM&&(h.dirty=rx,h.updateChildren(s,o+1),h.dirty=Tc),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,s,i,o){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!kI(r,e.outerDeco)||!s.eq(e.innerDeco))return null;let l=Ag.create(this.top,n,r,s,i,o);if(l.contentDOM){l.children=e.children,e.children=[];for(let c of l.children)c.parent=l}return e.destroy(),l}addNode(e,n,r,s,i){let o=Ag.create(this.top,e,n,r,s,i);o.contentDOM&&o.updateChildren(s,i+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,n,r){let s=this.index<this.top.children.length?this.top.children[this.index]:null;if(s&&s.matchesWidget(e)&&(e==s.widget||!s.widget.type.toDOM.parentNode))this.index++;else{let i=new oSe(this.top,e,n,r);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof f0;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof g4)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Ia||Ui)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let s=new lSe(this.top,[],r,null);n!=this.top?n.children.push(s):n.children.splice(this.index++,0,s),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function wot(t,e){let n=e,r=n.children.length,s=t.childCount,i=new Map,o=[];e:for(;s>0;){let l;for(;;)if(r){let u=n.children[r-1];if(u instanceof f0)n=u,r=u.children.length;else{l=u,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let c=l.node;if(c){if(c!=t.child(s-1))break;--s,i.set(l,s),o.push(l)}}return{index:s,matched:i,matches:o.reverse()}}function _ot(t,e){return t.type.side-e.type.side}function jot(t,e,n,r){let s=e.locals(t),i=0;if(s.length==0){for(let u=0;u<t.childCount;u++){let d=t.child(u);r(d,s,e.forChild(i,d),u),i+=d.nodeSize}return}let o=0,l=[],c=null;for(let u=0;;){let d,h;for(;o<s.length&&s[o].to==i;){let x=s[o++];x.widget&&(d?(h||(h=[d])).push(x):d=x)}if(d)if(h){h.sort(_ot);for(let x=0;x<h.length;x++)n(h[x],u,!!c)}else n(d,u,!!c);let f,p;if(c)p=-1,f=c,c=null;else if(u<t.childCount)p=u,f=t.child(u++);else break;for(let x=0;x<l.length;x++)l[x].to<=i&&l.splice(x--,1);for(;o<s.length&&s[o].from<=i&&s[o].to>i;)l.push(s[o++]);let m=i+f.nodeSize;if(f.isText){let x=m;o<s.length&&s[o].from<x&&(x=s[o].from);for(let g=0;g<l.length;g++)l[g].to<x&&(x=l[g].to);x<m&&(c=f.cut(x-i),f=f.cut(0,x-i),m=x,p=-1)}else for(;o<s.length&&s[o].to<m;)o++;let v=f.isInline&&!f.isLeaf?l.filter(x=>!x.inline):l.slice();r(f,v,e.forChild(i,f),p),i=m}}function Sot(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function Not(t,e,n,r){for(let s=0,i=0;s<t.childCount&&i<=r;){let o=t.child(s++),l=i;if(i+=o.nodeSize,!o.isText)continue;let c=o.text;for(;s<t.childCount;){let u=t.child(s++);if(i+=u.nodeSize,!u.isText)break;c+=u.text}if(i>=n){if(i>=r&&c.slice(r-e.length-l,r-l)==e)return r-e.length;let u=l<r?c.lastIndexOf(e,r-l-1):-1;if(u>=0&&u+e.length+l>=n)return l+u;if(n==r&&c.length>=r+e.length-l&&c.slice(r-l,r-l+e.length)==e)return r}}return-1}function Rq(t,e,n,r,s){let i=[];for(let o=0,l=0;o<t.length;o++){let c=t[o],u=l,d=l+=c.size;u>=n||d<=e?i.push(c):(u<e&&i.push(c.slice(0,e-u,r)),s&&(i.push(s),s=void 0),d>n&&i.push(c.slice(n-u,c.size,r)))}return i}function fK(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let s=t.docView.nearestDesc(n.focusNode),i=s&&s.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let l=r.resolve(o),c,u;if(m4(n)){for(c=o;s&&!s.node;)s=s.parent;let h=s.node;if(s&&h.isAtom&&Dt.isSelectable(h)&&s.parent&&!(h.isInline&&Qat(n.focusNode,n.focusOffset,s.dom))){let f=s.posBefore;u=new Dt(o==f?l:r.resolve(f))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let h=o,f=o;for(let p=0;p<n.rangeCount;p++){let m=n.getRangeAt(p);h=Math.min(h,t.docView.posFromDOM(m.startContainer,m.startOffset,1)),f=Math.max(f,t.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(h<0)return null;[c,o]=f==t.state.selection.anchor?[f,h]:[h,f],l=r.resolve(o)}else c=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null}let d=r.resolve(c);if(!u){let h=e=="pointer"||t.state.selection.head<l.pos&&!i?1:-1;u=pK(t,d,l,h)}return u}function hSe(t){return t.editable?t.hasFocus():pSe(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Uf(t,e=!1){let n=t.state.selection;if(fSe(t,n),!!hSe(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Ui){let r=t.domSelectionRange(),s=t.domObserver.currentSelection;if(r.anchorNode&&s.anchorNode&&h0(r.anchorNode,r.anchorOffset,s.anchorNode,s.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)kot(t);else{let{anchor:r,head:s}=n,i,o;lre&&!(n instanceof It)&&(n.$from.parent.inlineContent||(i=cre(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=cre(t,n.to))),t.docView.setSelection(r,s,t,e),lre&&(i&&ure(i),o&&ure(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Cot(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const lre=Ia||Ui&&Zje<63;function cre(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),s=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(Ia&&s&&s.contentEditable=="false")return rz(s);if((!s||s.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(s)return rz(s);if(i)return rz(i)}}function rz(t){return t.contentEditable="true",Ia&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function ure(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function Cot(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,s=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=s)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!hSe(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function kot(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Fi(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&Yo&&kg<=11&&(n.disabled=!0,n.disabled=!1)}function fSe(t,e){if(e instanceof Dt){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(dre(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else dre(t)}function dre(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function pK(t,e,n,r){return t.someProp("createSelectionBetween",s=>s(t,e,n))||It.between(e,n,r)}function hre(t){return t.editable&&!t.hasFocus()?!1:pSe(t)}function pSe(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Aot(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return h0(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Oq(t,e){let{$anchor:n,$head:r}=t.selection,s=e>0?n.max(r):n.min(r),i=s.parent.inlineContent?s.depth?t.doc.resolve(e>0?s.after():s.before()):null:s;return i&&Ot.findFrom(i,e)}function Hp(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function fre(t,e,n){let r=t.state.selection;if(r instanceof It)if(n.indexOf("s")>-1){let{$head:s}=r,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=t.state.doc.resolve(s.pos+i.nodeSize*(e<0?-1:1));return Hp(t,new It(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let s=Oq(t.state,e);return s&&s instanceof Dt?Hp(t,s):!1}else if(!(gc&&n.indexOf("m")>-1)){let s=r.$head,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter,o;if(!i||i.isText)return!1;let l=e<0?s.pos-i.nodeSize:s.pos;return i.isAtom||(o=t.docView.descAt(l))&&!o.contentDOM?Dt.isSelectable(i)?Hp(t,new Dt(e<0?t.state.doc.resolve(s.pos-i.nodeSize):s)):L2?Hp(t,new It(t.state.doc.resolve(e<0?l:l+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Dt&&r.node.isInline)return Hp(t,new It(e>0?r.$to:r.$from));{let s=Oq(t.state,e);return s?Hp(t,s):!1}}}function AI(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function CC(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function fb(t,e){return e<0?Eot(t):Tot(t)}function Eot(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s,i,o=!1;for(Ec&&n.nodeType==1&&r<AI(n)&&CC(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let l=n.childNodes[r-1];if(CC(l,-1))s=n,i=--r;else if(l.nodeType==3)n=l,r=n.nodeValue.length;else break}}else{if(mSe(n))break;{let l=n.previousSibling;for(;l&&CC(l,-1);)s=n.parentNode,i=Fi(l),l=l.previousSibling;if(l)n=l,r=AI(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?Iq(t,n,r):s&&Iq(t,s,i)}function Tot(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s=AI(n),i,o;for(;;)if(r<s){if(n.nodeType!=1)break;let l=n.childNodes[r];if(CC(l,1))i=n,o=++r;else break}else{if(mSe(n))break;{let l=n.nextSibling;for(;l&&CC(l,1);)i=l.parentNode,o=Fi(l)+1,l=l.nextSibling;if(l)n=l,r=0,s=AI(n);else{if(n=n.parentNode,n==t.dom)break;r=s=0}}}i&&Iq(t,i,o)}function mSe(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function Pot(t,e){for(;t&&e==t.childNodes.length&&!D2(t);)e=Fi(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function Mot(t,e){for(;t&&!e&&!D2(t);)e=Fi(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function Iq(t,e,n){if(e.nodeType!=3){let i,o;(o=Pot(e,n))?(e=o,n=0):(i=Mot(e,n))&&(e=i,n=i.nodeValue.length)}let r=t.domSelection();if(!r)return;if(m4(r)){let i=document.createRange();i.setEnd(e,n),i.setStart(e,n),r.removeAllRanges(),r.addRange(i)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:s}=t;setTimeout(()=>{t.state==s&&Uf(t)},50)}function pre(t,e){let n=t.state.doc.resolve(e);if(!(Ui||eSe)&&n.parent.inlineContent){let s=t.coordsAtPos(e);if(e>n.start()){let i=t.coordsAtPos(e-1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left<s.left?"ltr":"rtl"}if(e<n.end()){let i=t.coordsAtPos(e+1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left>s.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function mre(t,e,n){let r=t.state.selection;if(r instanceof It&&!r.empty||n.indexOf("s")>-1||gc&&n.indexOf("m")>-1)return!1;let{$from:s,$to:i}=r;if(!s.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=Oq(t.state,e);if(o&&o instanceof Dt)return Hp(t,o)}if(!s.parent.inlineContent){let o=e<0?s:i,l=r instanceof Cg?Ot.near(o,e):Ot.findFrom(o,e);return l?Hp(t,l):!1}return!1}function gre(t,e){if(!(t.state.selection instanceof It))return!0;let{$head:n,$anchor:r,empty:s}=t.state.selection;if(!n.sameParent(r))return!0;if(!s)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let o=t.state.tr;return e<0?o.delete(n.pos-i.nodeSize,n.pos):o.delete(n.pos,n.pos+i.nodeSize),t.dispatch(o),!0}return!1}function vre(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Rot(t){if(!Ia||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;vre(t,r,"true"),setTimeout(()=>vre(t,r,"false"),20)}return!1}function Oot(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function Iot(t,e){let n=e.keyCode,r=Oot(e);if(n==8||gc&&n==72&&r=="c")return gre(t,-1)||fb(t,-1);if(n==46&&!e.shiftKey||gc&&n==68&&r=="c")return gre(t,1)||fb(t,1);if(n==13||n==27)return!0;if(n==37||gc&&n==66&&r=="c"){let s=n==37?pre(t,t.state.selection.from)=="ltr"?-1:1:-1;return fre(t,s,r)||fb(t,s)}else if(n==39||gc&&n==70&&r=="c"){let s=n==39?pre(t,t.state.selection.from)=="ltr"?1:-1:1;return fre(t,s,r)||fb(t,s)}else{if(n==38||gc&&n==80&&r=="c")return mre(t,-1,r)||fb(t,-1);if(n==40||gc&&n==78&&r=="c")return Rot(t)||mre(t,1,r)||fb(t,1);if(r==(gc?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function mK(t,e){t.someProp("transformCopied",p=>{e=p(e,t)});let n=[],{content:r,openStart:s,openEnd:i}=e;for(;s>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){s--,i--;let p=r.firstChild;n.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let o=t.someProp("clipboardSerializer")||L0.fromSchema(t.state.schema),l=wSe(),c=l.createElement("div");c.appendChild(o.serializeFragment(r,{document:l}));let u=c.firstChild,d,h=0;for(;u&&u.nodeType==1&&(d=bSe[u.nodeName.toLowerCase()]);){for(let p=d.length-1;p>=0;p--){let m=l.createElement(d[p]);for(;c.firstChild;)m.appendChild(c.firstChild);c.appendChild(m),h++}u=c.firstChild}u&&u.nodeType==1&&u.setAttribute("data-pm-slice",`${s} ${i}${h?` -${h}`:""} ${JSON.stringify(n)}`);let f=t.someProp("clipboardTextSerializer",p=>p(e,t))||e.content.textBetween(0,e.content.size,` 1068 1069`);return{dom:c,text:f,slice:e}}function gSe(t,e,n,r,s){let i=s.parent.type.spec.code,o,l;if(!n&&!e)return null;let c=!!e&&(r||i||!n);if(c){if(t.someProp("transformPastedText",f=>{e=f(e,i||r,t)}),i)return l=new Ge(De.from(t.state.schema.text(e.replace(/\r\n?/g,` 1070`))),0,0),t.someProp("transformPasted",f=>{l=f(l,t,!0)}),l;let h=t.someProp("clipboardTextParser",f=>f(e,s,r,t));if(h)l=h;else{let f=s.marks(),{schema:p}=t.state,m=L0.fromSchema(p);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(v=>{let x=o.appendChild(document.createElement("p"));v&&x.appendChild(m.serializeNode(p.text(v,f)))})}}else t.someProp("transformPastedHTML",h=>{n=h(n,t)}),o=$ot(n),L2&&zot(o);let u=o&&o.querySelector("[data-pm-slice]"),d=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let h=+d[3];h>0;h--){let f=o.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;o=f}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||jC.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||d),context:s,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!Dot.test(f.parentNode.nodeName)?{ignore:!0}:null}})),d)l=Bot(xre(l,+d[1],+d[2]),d[4]);else if(l=Ge.maxOpen(Lot(l.content,s),!0),l.openStart||l.openEnd){let h=0,f=0;for(let p=l.content.firstChild;h<l.openStart&&!p.type.spec.isolating;h++,p=p.firstChild);for(let p=l.content.lastChild;f<l.openEnd&&!p.type.spec.isolating;f++,p=p.lastChild);l=xre(l,h,f)}return t.someProp("transformPasted",h=>{l=h(l,t,c)}),l}const Dot=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Lot(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let s=e.node(n).contentMatchAt(e.index(n)),i,o=[];if(t.forEach(l=>{if(!o)return;let c=s.findWrapping(l.type),u;if(!c)return o=null;if(u=o.length&&i.length&&xSe(c,i,l,o[o.length-1],0))o[o.length-1]=u;else{o.length&&(o[o.length-1]=ySe(o[o.length-1],i.length));let d=vSe(l,c);o.push(d),s=s.matchType(d.type),i=c}}),o)return De.from(o)}return t}function vSe(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,De.from(t));return t}function xSe(t,e,n,r,s){if(s<t.length&&s<e.length&&t[s]==e[s]){let i=xSe(t,e,n,r.lastChild,s+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(s==t.length-1?n.type:t[s+1]))return r.copy(r.content.append(De.from(vSe(n,t,s+1))))}}function ySe(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,ySe(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(De.empty,!0);return t.copy(n.append(r))}
vendor: 4,801 bytes, line 1070
1070function Dq(t,e,n,r,s,i){let o=e<0?t.firstChild:t.lastChild,l=o.content;return t.childCount>1&&(i=0),s<r-1&&(l=Dq(l,e,n,r,s+1,i)),s>=n&&(l=e<0?o.contentMatchAt(0).fillBefore(l,i<=s).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(De.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(l))}function xre(t,e,n){return e<t.openStart&&(t=new Ge(Dq(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new Ge(Dq(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const bSe={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let yre=null;function wSe(){return yre||(yre=document.implementation.createHTMLDocument("title"))}let sz=null;function Fot(t){let e=window.trustedTypes;return e?(sz||(sz=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),sz.createHTML(t)):t}function $ot(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=wSe().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),s;if((s=r&&bSe[r[1].toLowerCase()])&&(t=s.map(i=>"<"+i+">").join("")+t+s.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=Fot(t),s)for(let i=0;i<s.length;i++)n=n.querySelector(s[i])||n;return n}function zot(t){let e=t.querySelectorAll(Ui?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent=="Â "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function Bot(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:s,openStart:i,openEnd:o}=t;for(let l=r.length-2;l>=0;l-=2){let c=n.nodes[r[l]];if(!c||c.hasRequiredAttrs())break;s=De.from(c.create(r[l+1],s)),i++,o++}return new Ge(s,i,o)}const fo={},po={},Uot={touchstart:!0,touchmove:!0};class qot{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Vot(t){for(let e in fo){let n=fo[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{Wot(t,r)&&!gK(t,r)&&(t.editable||!(r.type in po))&&n(t,r)},Uot[e]?{passive:!0}:void 0)}Ia&&t.dom.addEventListener("input",()=>null),Lq(t)}function hg(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function Hot(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Lq(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>gK(t,r))})}function gK(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function Wot(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function Kot(t,e){!gK(t,e)&&fo[e.type]&&(t.editable||!(e.type in po))&&fo[e.type](t,e)}po.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!jSe(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(If&&Ui&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),rj&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",s=>s(t,Kv(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||Iot(t,n)?n.preventDefault():hg(t,"key")};po.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};po.keypress=(t,e)=>{let n=e;if(jSe(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||gc&&n.metaKey)return;if(t.someProp("handleKeyPress",s=>s(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof It)||!r.$from.sameParent(r.$to)){let s=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(s).scrollIntoView();!/[\r\n]/.test(s)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,s,i))&&t.dispatch(i()),n.preventDefault()}};function v4(t){return{left:t.clientX,top:t.clientY}}function Got(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}
vendor: 21,090 bytes, line 1070
1070function vK(t,e,n,r,s){if(r==-1)return!1;let i=t.state.doc.resolve(r);for(let o=i.depth+1;o>0;o--)if(t.someProp(e,l=>o>i.depth?l(t,n,i.nodeAfter,i.before(o),s,!0):l(t,n,i.node(o),i.before(o),s,!1)))return!0;return!1}function Uw(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function Yot(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&Dt.isSelectable(r)?(Uw(t,new Dt(n)),!0):!1}function Xot(t,e){if(e==-1)return!1;let n=t.state.selection,r,s;n instanceof Dt&&(r=n.node);let i=t.state.doc.resolve(e);for(let o=i.depth+1;o>0;o--){let l=o>i.depth?i.nodeAfter:i.node(o);if(Dt.isSelectable(l)){r&&n.$from.depth>0&&o>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?s=i.before(n.$from.depth):s=i.before(o);break}}return s!=null?(Uw(t,Dt.create(t.state.doc,s)),!0):!1}function Jot(t,e,n,r,s){return vK(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(s?Xot(t,n):Yot(t,n))}function Qot(t,e,n,r){return vK(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",s=>s(t,e,r))}function Zot(t,e,n,r){return vK(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",s=>s(t,e,r))||elt(t,n,r)}function elt(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Uw(t,It.create(r,0,r.content.size)),!0):!1;let s=r.resolve(e);for(let i=s.depth+1;i>0;i--){let o=i>s.depth?s.nodeAfter:s.node(i),l=s.before(i);if(o.inlineContent)Uw(t,It.create(r,l+1,l+1+o.content.size));else if(Dt.isSelectable(o))Uw(t,Dt.create(r,l));else continue;return!0}}function xK(t){return EI(t)}const _Se=gc?"metaKey":"ctrlKey";fo.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=xK(t),s=Date.now(),i="singleClick";s-t.input.lastClick.time<500&&Got(n,t.input.lastClick)&&!n[_Se]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:s,x:n.clientX,y:n.clientY,type:i,button:n.button};let o=t.posAtCoords(v4(n));o&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new tlt(t,o,n,!!r)):(i=="doubleClick"?Qot:Zot)(t,o.pos,o.inside,n)?n.preventDefault():hg(t,"pointer"))};class tlt{constructor(e,n,r,s){this.view=e,this.pos=n,this.event=r,this.flushed=s,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[_Se],this.allowDefault=r.shiftKey;let i,o;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),o=n.inside;else{let d=e.state.doc.resolve(n.pos);i=d.parent,o=d.depth?d.before():0}const l=s?null:r.target,c=l?e.docView.nearestDesc(l,!0):null;this.target=c&&c.nodeDOM.nodeType==1?c.nodeDOM:null;let{selection:u}=e.state;r.button==0&&(i.type.spec.draggable&&i.type.spec.selectable!==!1||u instanceof Dt&&u.from<=o&&u.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Ec&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),hg(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Uf(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(v4(e))),this.updateAllowDefault(e),this.allowDefault||!n?hg(this.view,"pointer"):Jot(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Ia&&this.mightDrag&&!this.mightDrag.node.isAtom||Ui&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Uw(this.view,Ot.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):hg(this.view,"pointer")}move(e){this.updateAllowDefault(e),hg(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}fo.touchstart=t=>{t.input.lastTouch=Date.now(),xK(t),hg(t,"pointer")};fo.touchmove=t=>{t.input.lastTouch=Date.now(),hg(t,"pointer")};fo.contextmenu=t=>xK(t);function jSe(t,e){return t.composing?!0:Ia&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const nlt=If?5e3:-1;po.compositionstart=po.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof It&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Ui&&eSe&&rlt(t)))t.markCursor=t.state.storedMarks||n.marks(),EI(t,!0),t.markCursor=null;else if(EI(t,!e.selection.empty),Ec&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let s=r.focusNode,i=r.focusOffset;s&&s.nodeType==1&&i!=0;){let o=i<0?s.lastChild:s.childNodes[i-1];if(!o)break;if(o.nodeType==3){let l=t.domSelection();l&&l.collapse(o,o.nodeValue.length);break}else s=o,i=-1}}t.input.composing=!0}SSe(t,nlt)};function rlt(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}po.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,SSe(t,20))};function SSe(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>EI(t),e))}function NSe(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=ilt());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function slt(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=Xat(e.focusNode,e.focusOffset),r=Jat(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let s=r.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!s||!s.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function ilt(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function EI(t,e=!1){if(!(If&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),NSe(t),e||t.docView&&t.docView.dirty){let n=fK(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function alt(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),s=document.createRange();s.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(s),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Ok=Yo&&kg<15||rj&&tot<604;fo.copy=po.cut=(t,e)=>{let n=e,r=t.state.selection,s=n.type=="cut";if(r.empty)return;let i=Ok?null:n.clipboardData,o=r.content(),{dom:l,text:c}=mK(t,o);i?(n.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",c)):alt(t,l),s&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function olt(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function llt(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let s=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Ik(t,r.value,null,s,e):Ik(t,r.textContent,r.innerHTML,s,e)},50)}function Ik(t,e,n,r,s){let i=gSe(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",c=>c(t,s,i||Ge.empty)))return!0;if(!i)return!1;let o=olt(i),l=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(i);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function CSe(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}po.paste=(t,e)=>{let n=e;if(t.composing&&!If)return;let r=Ok?null:n.clipboardData,s=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Ik(t,CSe(r),r.getData("text/html"),s,n)?n.preventDefault():llt(t,n)};class kSe{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const clt=gc?"altKey":"ctrlKey";function ASe(t,e){let n;return t.someProp("dragCopies",r=>{n=n||r(e)}),n!=null?!n:!e[clt]}fo.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let s=t.state.selection,i=s.empty?null:t.posAtCoords(v4(n)),o;if(!(i&&i.pos>=s.from&&i.pos<=(s instanceof Dt?s.to-1:s.to))){if(r&&r.mightDrag)o=Dt.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let h=t.docView.nearestDesc(n.target,!0);h&&h.node.type.spec.draggable&&h!=t.docView&&(o=Dt.create(t.state.doc,h.posBefore))}}let l=(o||t.state.selection).content(),{dom:c,text:u,slice:d}=mK(t,l);(!n.dataTransfer.files.length||!Ui||Zje>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Ok?"Text":"text/html",c.innerHTML),n.dataTransfer.effectAllowed="copyMove",Ok||n.dataTransfer.setData("text/plain",u),t.dragging=new kSe(d,ASe(t,n),o)};fo.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};po.dragover=po.dragenter=(t,e)=>e.preventDefault();po.drop=(t,e)=>{try{ult(t,e,t.dragging)}finally{t.dragging=null}};function ult(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(v4(e));if(!r)return;let s=t.state.doc.resolve(r.pos),i=n&&n.slice;i?t.someProp("transformPasted",p=>{i=p(i,t,!1)}):i=gSe(t,CSe(e.dataTransfer),Ok?null:e.dataTransfer.getData("text/html"),!1,s);let o=!!(n&&ASe(t,e));if(t.someProp("handleDrop",p=>p(t,e,i||Ge.empty,o))){e.preventDefault();return}if(!i)return;e.preventDefault();let l=i?Rje(t.state.doc,s.pos,i):s.pos;l==null&&(l=s.pos);let c=t.state.tr;if(o){let{node:p}=n;p?p.replace(c):c.deleteSelection()}let u=c.mapping.map(l),d=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,h=c.doc;if(d?c.replaceRangeWith(u,u,i.content.firstChild):c.replaceRange(u,u,i),c.doc.eq(h))return;let f=c.doc.resolve(u);if(d&&Dt.isSelectable(i.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(i.content.firstChild))c.setSelection(new Dt(f));else{let p=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((m,v,x,g)=>p=g),c.setSelection(pK(t,f,c.doc.resolve(p)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))}fo.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Uf(t)},20))};fo.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};fo.beforeinput=(t,e)=>{if(Ui&&If&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",i=>i(t,Kv(8,"Backspace")))))return;let{$cursor:s}=t.state.selection;s&&s.pos>0&&t.dispatch(t.state.tr.delete(s.pos-1,s.pos).scrollIntoView())},50)}};for(let t in po)fo[t]=po[t];function Dk(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class TI{constructor(e,n){this.toDOM=e,this.spec=n||$y,this.side=this.spec.side||0}map(e,n,r,s){let{pos:i,deleted:o}=e.mapResult(n.from+s,this.side<0?-1:1);return o?null:new gi(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof TI&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Dk(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Eg{constructor(e,n){this.attrs=e,this.spec=n||$y}map(e,n,r,s){let i=e.map(n.from+s,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+s,this.spec.inclusiveEnd?1:-1)-r;return i>=o?null:new gi(i,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof Eg&&Dk(this.attrs,e.attrs)&&Dk(this.spec,e.spec)}static is(e){return e.type instanceof Eg}destroy(){}}class yK{constructor(e,n){this.attrs=e,this.spec=n||$y}map(e,n,r,s){let i=e.mapResult(n.from+s,1);if(i.deleted)return null;let o=e.mapResult(n.to+s,-1);return o.deleted||o.pos<=i.pos?null:new gi(i.pos-r,o.pos-r,this)}valid(e,n){let{index:r,offset:s}=e.content.findIndex(n.from),i;return s==n.from&&!(i=e.child(r)).isText&&s+i.nodeSize==n.to}eq(e){return this==e||e instanceof yK&&Dk(this.attrs,e.attrs)&&Dk(this.spec,e.spec)}destroy(){}}class gi{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new gi(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new gi(e,e,new TI(n,r))}static inline(e,n,r,s){return new gi(e,n,new Eg(r,s))}static node(e,n,r,s){return new gi(e,n,new yK(r,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof Eg}get widget(){return this.type instanceof TI}}const Bb=[],$y={};class or{constructor(e,n){this.local=e.length?e:Bb,this.children=n.length?n:Bb}static create(e,n){return n.length?PI(n,e,0,$y):xa}find(e,n,r){let s=[];return this.findInner(e??0,n??1e9,s,0,r),s}findInner(e,n,r,s,i){for(let o=0;o<this.local.length;o++){let l=this.local[o];l.from<=n&&l.to>=e&&(!i||i(l.spec))&&r.push(l.copy(l.from+s,l.to+s))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let l=this.children[o]+1;this.children[o+2].findInner(e-l,n-l,r,s+l,i)}}map(e,n,r){return this==xa||e.maps.length==0?this:this.mapInner(e,n,0,0,r||$y)}mapInner(e,n,r,s,i){let o;for(let l=0;l<this.local.length;l++){let c=this.local[l].map(e,r,s);c&&c.type.valid(n,c)?(o||(o=[])).push(c):i.onRemove&&i.onRemove(this.local[l].spec)}return this.children.length?dlt(this.children,o||[],e,n,r,s,i):o?new or(o.sort(zy),Bb):xa}add(e,n){return n.length?this==xa?or.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let s,i=0;e.forEach((l,c)=>{let u=c+r,d;if(d=TSe(n,l,u)){for(s||(s=this.children.slice());i<s.length&&s[i]<c;)i+=3;s[i]==c?s[i+2]=s[i+2].addInner(l,d,u+1):s.splice(i,0,c,c+l.nodeSize,PI(d,l,u+1,$y)),i+=3}});let o=ESe(i?PSe(n):n,-r);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||o.splice(l--,1);return new or(o.length?this.local.concat(o).sort(zy):this.local,s||this.children)}remove(e){return e.length==0||this==xa?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,s=this.local;for(let i=0;i<r.length;i+=3){let o,l=r[i]+n,c=r[i+1]+n;for(let d=0,h;d<e.length;d++)(h=e[d])&&h.from>l&&h.to<c&&(e[d]=null,(o||(o=[])).push(h));if(!o)continue;r==this.children&&(r=this.children.slice());let u=r[i+2].removeInner(o,l+1);u!=xa?r[i+2]=u:(r.splice(i,3),i-=3)}if(s.length){for(let i=0,o;i<e.length;i++)if(o=e[i])for(let l=0;l<s.length;l++)s[l].eq(o,n)&&(s==this.local&&(s=this.local.slice()),s.splice(l--,1))}return r==this.children&&s==this.local?this:s.length||r.length?new or(s,r):xa}forChild(e,n){if(this==xa)return this;if(n.isLeaf)return or.empty;let r,s;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(r=this.children[l+2]);break}let i=e+1,o=i+n.content.size;for(let l=0;l<this.local.length;l++){let c=this.local[l];if(c.from<o&&c.to>i&&c.type instanceof Eg){let u=Math.max(i,c.from)-i,d=Math.min(o,c.to)-i;u<d&&(s||(s=[])).push(c.copy(u,d))}}if(s){let l=new or(s.sort(zy),Bb);return r?new tm([l,r]):l}return r||xa}eq(e){if(this==e)return!0;if(!(e instanceof or)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return bK(this.localsInner(e))}localsInner(e){if(this==xa)return Bb;if(e.inlineContent||!this.local.some(Eg.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Eg||n.push(this.local[r]);return n}forEachSet(e){e(this)}}or.empty=new or([],[]);or.removeOverlap=bK;const xa=or.empty;class tm{constructor(e){this.members=e}map(e,n){const r=this.members.map(s=>s.map(e,n,$y));return tm.from(r)}forChild(e,n){if(n.isLeaf)return or.empty;let r=[];for(let s=0;s<this.members.length;s++){let i=this.members[s].forChild(e,n);i!=xa&&(i instanceof tm?r=r.concat(i.members):r.push(i))}return tm.from(r)}eq(e){if(!(e instanceof tm)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let s=0;s<this.members.length;s++){let i=this.members[s].localsInner(e);if(i.length)if(!n)n=i;else{r&&(n=n.slice(),r=!1);for(let o=0;o<i.length;o++)n.push(i[o])}}return n?bK(r?n:n.sort(zy)):Bb}static from(e){switch(e.length){case 0:return xa;case 1:return e[0];default:return new tm(e.every(n=>n instanceof or)?e:e.reduce((n,r)=>n.concat(r instanceof or?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function dlt(t,e,n,r,s,i,o){let l=t.slice();for(let u=0,d=i;u<n.maps.length;u++){let h=0;n.maps[u].forEach((f,p,m,v)=>{let x=v-m-(p-f);for(let g=0;g<l.length;g+=3){let w=l[g+1];if(w<0||f>w+d-h)continue;let _=l[g]+d-h;p>=_?l[g+1]=f<=_?-2:-1:f>=d&&x&&(l[g]+=x,l[g+1]+=x)}h+=x}),d=n.maps[u].map(d,-1)}let c=!1;for(let u=0;u<l.length;u+=3)if(l[u+1]<0){if(l[u+1]==-2){c=!0,l[u+1]=-1;continue}let d=n.map(t[u]+i),h=d-s;if(h<0||h>=r.content.size){c=!0;continue}let f=n.map(t[u+1]+i,-1),p=f-s,{index:m,offset:v}=r.content.findIndex(h),x=r.maybeChild(m);if(x&&v==h&&v+x.nodeSize==p){let g=l[u+2].mapInner(n,x,d+1,t[u]+i+1,o);g!=xa?(l[u]=h,l[u+1]=p,l[u+2]=g):(l[u+1]=-2,c=!0)}else c=!0}if(c){let u=hlt(l,t,e,n,s,i,o),d=PI(u,r,0,o);e=d.local;for(let h=0;h<l.length;h+=3)l[h+1]<0&&(l.splice(h,3),h-=3);for(let h=0,f=0;h<d.children.length;h+=3){let p=d.children[h];for(;f<l.length&&l[f]<p;)f+=3;l.splice(f,0,d.children[h],d.children[h+1],d.children[h+2])}}return new or(e.sort(zy),l)}function ESe(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let s=t[r];n.push(new gi(s.from+e,s.to+e,s.type))}return n}function hlt(t,e,n,r,s,i,o){function l(c,u){for(let d=0;d<c.local.length;d++){let h=c.local[d].map(r,s,u);h?n.push(h):o.onRemove&&o.onRemove(c.local[d].spec)}for(let d=0;d<c.children.length;d+=3)l(c.children[d+2],c.children[d]+u+1)}for(let c=0;c<t.length;c+=3)t[c+1]==-1&&l(t[c+2],e[c]+i+1);return n}function TSe(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,s=null;for(let i=0,o;i<t.length;i++)(o=t[i])&&o.from>n&&o.to<r&&((s||(s=[])).push(o),t[i]=null);return s}function PSe(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function PI(t,e,n,r){let s=[],i=!1;e.forEach((l,c)=>{let u=TSe(t,l,c+n);if(u){i=!0;let d=PI(u,l,n+c+1,r);d!=xa&&s.push(c,c+l.nodeSize,d)}});let o=ESe(i?PSe(t):t,-n).sort(zy);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||(r.onRemove&&r.onRemove(o[l].spec),o.splice(l--,1));return o.length||s.length?new or(o,s):xa}function zy(t,e){return t.from-e.from||t.to-e.to}function bK(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let s=n+1;s<e.length;s++){let i=e[s];if(i.from==r.from){i.to!=r.to&&(e==t&&(e=t.slice()),e[s]=i.copy(i.from,r.to),bre(e,s+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,i.from),bre(e,s,r.copy(i.from,r.to)));break}}}return e}function bre(t,e,n){for(;e<t.length&&zy(n,t[e])>0;)e++;t.splice(e,0,n)}function iz(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=xa&&e.push(r)}
vendor: 4,354 bytes, line 1070
1070),t.cursorWrapper&&e.push(or.create(t.state.doc,[t.cursorWrapper.deco])),tm.from(e)}const flt={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},plt=Yo&&kg<=11;class mlt{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class glt{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new mlt,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let s=0;s<r.length;s++)this.queue.push(r[s]);Yo&&kg<=11&&r.some(s=>s.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():Ia&&e.composing&&r.some(s=>s.type=="childList"&&s.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),plt&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,flt)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(hre(this.view)){if(this.suppressingSelectionUpdates)return Uf(this.view);if(Yo&&kg<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&h0(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let i=e.focusNode;i;i=nj(i))n.add(i);for(let i=e.anchorNode;i;i=nj(i))if(n.has(i)){r=i;break}let s=r&&this.view.docView.nearestDesc(r);if(s&&s.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),s=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&hre(e)&&!this.ignoreSelectionChange(r),i=-1,o=-1,l=!1,c=[];if(e.editable)for(let d=0;d<n.length;d++){let h=this.registerMutation(n[d],c);h&&(i=i<0?h.from:Math.min(h.from,i),o=o<0?h.to:Math.max(h.to,o),h.typeOver&&(l=!0))}if(c.some(d=>d.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let d of c)if(d.nodeName=="BR"&&d.parentNode){let h=d.nextSibling;for(;h&&h.nodeType==1;){if(h.contentEditable=="false"){d.parentNode.removeChild(d);break}h=h.firstChild}}}else if(Ec&&c.length){let d=c.filter(h=>h.nodeName=="BR");if(d.length==2){let[h,f]=d;h.parentNode&&h.parentNode.parentNode==f.parentNode?f.remove():h.remove()}else{let{focusNode:h}=this.currentSelection;for(let f of d){let p=f.parentNode;p&&p.nodeName=="LI"&&(!h||ylt(e,h)!=p)&&f.remove()}}}let u=null;i<0&&s&&e.input.lastFocus>
vendor: 1,588 bytes, line 1070
1070Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&m4(r)&&(u=fK(e))&&u.eq(Ot.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Uf(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||s)&&(i>-1&&(e.docView.markDirty(i,o),vlt(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,blt(e,c)),this.handleDOMChange(i,o,l,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Uf(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let d=0;d<e.addedNodes.length;d++){let h=e.addedNodes[d];n.push(h),h.nodeType==3&&(this.lastChangedTextNode=h)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let s=e.previousSibling,i=e.nextSibling;if(Yo&&kg<=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:h,nextSibling:f}=e.addedNodes[d];(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(s=h),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f)}let o=s&&s.parentNode==e.target?Fi(s)+1:0,l=r.localPosFromDOM(e.target,o,-1),c=i&&i.parentNode==e.target?Fi(i):e.target.childNodes.length,u=r.localPosFromDOM(e.target,c,1);return{from:l,to:u}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAt
vendor: 8,597 bytes, line 1070
1070End+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let wre=new WeakMap,_re=!1;function vlt(t){if(!wre.has(t)&&(wre.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Ec,_re)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),_re=!0}}function jre(t,e){let n=e.startContainer,r=e.startOffset,s=e.endContainer,i=e.endOffset,o=t.domAtPos(t.state.selection.anchor);return h0(o.node,o.offset,s,i)&&([n,r,s,i]=[s,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}}function xlt(t,e){if(e.getComposedRanges){let s=e.getComposedRanges(t.root)[0];if(s)return jre(t,s)}let n;function r(s){s.preventDefault(),s.stopImmediatePropagation(),n=s.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?jre(t,n):null}function ylt(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function blt(t,e){var n;let{focusNode:r,focusOffset:s}=t.domSelectionRange();for(let i of e)if(((n=i.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let o=i.nextSibling;for(;o&&o.nodeName!="TD"&&o.nodeName!="TH";)o=o.nextSibling;if(o){let l=o;for(;;){let c=l.firstChild;if(!c||c.nodeType!=1||c.contentEditable=="false"||/^(BR|IMG)$/.test(c.nodeName))break;l=c}l.insertBefore(i,l.firstChild),r==i&&t.domSelection().collapse(i,s)}else i.parentNode.removeChild(i)}}function wlt(t,e,n){let{node:r,fromOffset:s,toOffset:i,from:o,to:l}=t.docView.parseRange(e,n),c=t.domSelectionRange(),u,d=c.anchorNode;if(d&&t.dom.contains(d.nodeType==1?d:d.parentNode)&&(u=[{node:d,offset:c.anchorOffset}],m4(c)||u.push({node:c.focusNode,offset:c.focusOffset})),Ui&&t.input.lastKeyCode===8)for(let x=i;x>s;x--){let g=r.childNodes[x-1],w=g.pmViewDesc;if(g.nodeName=="BR"&&!w){i=x;break}if(!w||w.size)break}let h=t.state.doc,f=t.someProp("domParser")||jC.fromSchema(t.state.schema),p=h.resolve(o),m=null,v=f.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:s,to:i,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:_lt,context:p});if(u&&u[0].pos!=null){let x=u[0].pos,g=u[1]&&u[1].pos;g==null&&(g=x),m={anchor:x+o,head:g+o}}return{doc:v,sel:m,from:o,to:l}}function _lt(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Ia&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||Ia&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const jlt=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Slt(t,e,n,r,s){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let C=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,k=fK(t,C);if(k&&!t.state.selection.eq(k)){if(Ui&&If&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",P=>P(t,Kv(13,"Enter"))))return;let E=t.state.tr.setSelection(k);C=="pointer"?E.setMeta("pointer",!0):C=="key"&&E.scrollIntoView(),i&&E.setMeta("composition",i),t.dispatch(E)}return}let o=t.state.doc.resolve(e),l=o.sharedDepth(n);e=o.before(l+1),n=t.state.doc.resolve(n).after(l+1);let c=t.state.selection,u=wlt(t,e,n),d=t.state.doc,h=d.slice(u.from,u.to),f,p;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(f=t.state.selection.to,p="end"):(f=t.state.selection.from,p="start"),t.input.lastKeyCode=null;let m=klt(h.content,u.doc.content,u.from,f,p);if(m&&t.input.domChangeCount++,(rj&&t.input.lastIOSEnter>Date.now()-225||If)&&s.some(C=>C.nodeType==1&&!jlt.test(C.nodeName))&&(!m||m.endA>=m.endB)&&t.someProp("handleKeyDown",C=>C(t,Kv(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!m)if(r&&c instanceof It&&!c.empty&&c.$head.sameParent(c.$anchor)&&!t.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(u.sel){let C=Sre(t,t.state.doc,u.sel);if(C&&!C.eq(t.state.selection)){let k=t.state.tr.setSelection(C);i&&k.setMeta("composition",i),t.dispatch(k)}}return}t.state.selection.from<t.state.selection.to&&m.start==m.endB&&t.state.selection instanceof It&&(m.start>t.state.selection.from&&m.start<=t.state.selection.from+2&&t.state.selection.from>=u.from?m.start=t.state.selection.from:m.endA<t.state.selection.to&&m.endA>=t.state.selection.to-2&&t.state.selection.to<=u.to&&(m.endB+=t.state.selection.to-m.endA,m.endA=t.state.selection.to)),Yo&&kg<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>u.from&&u.doc.textBetween(m.start-u.from-1,m.start-u.from+1)==" Â "&&(m.start--,m.endA--,m.endB--);let v=u.doc.resolveNoCache(m.start-u.from),x=u.doc.resolveNoCache(m.endB-u.from),g=d.resolve(m.start),w=v.sameParent(x)&&v.parent.inlineContent&&g.end()>=m.endA;if((rj&&t.input.lastIOSEnter>Date.now()-225&&(!w||s.some(C=>C.nodeName=="DIV"||C.nodeName=="P"))||!w&&v.pos<u.doc.content.size&&(!v.sameParent(x)||!v.parent.inlineContent)&&v.pos<x.pos&&!/\S/.test(u.doc.textBetween(v.pos,x.pos,"","")))&&t.someProp("handleKeyDown",C=>C(t,Kv(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>m.start&&Clt(d,m.start,m.endA,v,x)&&t.someProp("handleKeyDown",C=>C(t,Kv(8,"Backspace")))){If&&Ui&&t.domObserver.suppressSelectionUpdates();return}Ui&&m.endB==m.start&&(t.input.lastChromeDelete=Date.now()),If&&!w&&v.start()!=x.start()&&x.parentOffset==0&&v.depth==x.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==m.endA&&(m.endB-=2,x=u.doc.resolveNoCache(m.endB-u.from),setTimeout(()=>{t.someProp("handleKeyDown",function(C){return C(t,Kv(13,"Enter"))})},20));let _=m.start,j=m.endA,N=C=>{let k=C||t.state.tr.replace(_,j,u.doc.slice(m.start-u.from,m.endB-u.from));if(u.sel){let E=Sre(t,k.doc,u.sel);E&&!(Ui&&t.composing&&E.empty&&(m.start!=m.endB||t.input.lastChromeDelete<Date.now()-100)&&(E.head==_||E.head==k.mapping.map(j)-1)||Yo&&E.empty&&E.head==_)&&k.setSelection(E)}return i&&k.setMeta("composition",i),k.scrollIntoView()},S;if(w)if(v.pos==x.pos){Yo&&kg<=11&&v.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Uf(t),20));let C=N(t.state.tr.delete(_,j)),k=d.resolve(m.start).marksAcross(d.resolve(m.endA));k&&C.ensureMarks(k),t.dispatch(C)}else if(m.endA==m.endB&&(S=Nlt(v.parent.content.cut(v.parentOffset,x.parentOffset),g.parent.content.cut(g.parentOffset,m.endA-g.start())))){let C=N(t.state.tr);S.type=="add"?C.addMark(_,j,S.mark):C.removeMark(_,j,S.mark),t.dispatch(C)}else if(v.parent.child(v.index()).isText&&v.index()==x.index()-(x.textOffset?0:1)){let C=v.parent.textBetween(v.parentOffset,x.parentOffset),k=()=>N(t.state.tr.insertText(C,_,j));t.someProp("handleTextInput",E=>E(t,_,j,C,k))||t.dispatch(k())}else t.dispatch(N());else t.dispatch(N())}function Sre(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:pK(t,e.resolve(n.anchor),e.resolve(n.head))}function Nlt(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,s=n,i=r,o,l,c;for(let d=0;d<r.length;d++)s=r[d].removeFromSet(s);for(let d=0;d<n.length;d++)i=n[d].removeFromSet(i);if(s.length==1&&i.length==0)l=s[0],o="add",c=d=>d.mark(l.addToSet(d.marks));else if(s.length==0&&i.length==1)l=i[0],o="remove",c=d=>d.mark(l.removeFromSet(d.marks));else return null;let u=[];for(let d=0;d<e.childCount;d++)u.push(c(e.child(d)));if(De.from(u).eq(t))return{mark:l,type:o}}function Clt(t,e,n,r,s){if(n-e<=s.pos-r.pos||az(r,!0,!1)<s.pos)return!1;let i=t.resolve(e);if(!r.parent.isTextblock){let l=i.nodeAfter;return l!=null&&n==e+l.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let o=t.resolve(az(i,!0,!0));return!o.parent.isTextblock||o.pos>n||az(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function az(t,e,n){let r=t.depth,s=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,s++,e=!1;if(n){let i=t.node(r).maybeChild(t.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,s++}return s}function klt(t,e,n,r,s){let i=t.findDiffStart(e,n);if(i==null)return null;let{a:o,b:l}=t.findDiffEnd(e,n+t.size,n+e.size);
vendor: 4,479 bytes, line 1070
1070if(s=="end"){let c=Math.max(0,i-Math.min(o,l));r-=o+c-i}if(o<i&&t.size<e.size){let c=r<=i&&r>=o?i-r:0;i-=c,i&&i<e.size&&Nre(e.textBetween(i-1,i+1))&&(i+=c?1:-1),l=i+(l-o),o=i}else if(l<i){let c=r<=i&&r>=l?i-r:0;i-=c,i&&i<t.size&&Nre(t.textBetween(i-1,i+1))&&(i+=c?1:-1),o=i+(o-l),l=i}return{start:i,endA:o,endB:l}}function Nre(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class MSe{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new qot,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Tre),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Are(this),kre(this),this.nodeViews=Ere(this),this.docView=are(this.state.doc,Cre(this),iz(this),this.dom,this),this.domObserver=new glt(this,(r,s,i,o)=>Slt(this,r,s,i,o)),this.domObserver.start(),Vot(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Lq(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Tre),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let s=this.state,i=!1,o=!1;e.storedMarks&&this.composing&&(NSe(this),o=!0),this.state=e;let l=s.plugins!=e.plugins||this._props.plugins!=n.plugins;if(l||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let p=Ere(this);Elt(p,this.nodeViews)&&(this.nodeViews=p,i=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&Lq(this),this.editable=Are(this),kre(this);let c=iz(this),u=Cre(this),d=s.plugins!=e.plugins&&!s.doc.eq(e.doc)?"reset":e.scrollToSelection>s.scrollToSelection?"to selection":"preserve",h=i||!this.docView.matchesNode(e.doc,u,c);(h||!e.selection.eq(s.selection))&&(o=!0);let f=d=="preserve"&&o&&this.dom.style.overflowAnchor==null&&sot(this);if(o){this.domObserver.stop();let p=h&&(Yo||Ui)&&!this.composing&&!s.selection.empty&&!e.selection.empty&&Alt(s.selection,e.selection);if(h){let m=Ui?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=slt(this)),(i||!this.docView.update(e.doc,u,c,this))&&(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=are(e.doc,u,c,this.dom,this)),m&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Aot(this))?Uf(this,p):(fSe(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(s),!((r=this.dragging)===null||r===void 0)&&r.node&&!s.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,s),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():f&&iot(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof Dt){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&ere(this,n.getBoundingClientRect(),e)}else ere(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,s=-1;
vendor: 5,693 bytes, line 1070
1070if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)s=r.from;else{let i=r.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&i<this.state.doc.content.size&&this.state.doc.nodeAt(i))==r.node&&(s=i)}this.dragging=new kSe(e.slice,e.move,s<0?void 0:Dt.create(this.state.doc,s))}someProp(e,n){let r=this._props&&this._props[e],s;if(r!=null&&(s=n?n(r):r))return s;for(let o=0;o<this.directPlugins.length;o++){let l=this.directPlugins[o].props[e];if(l!=null&&(s=n?n(l):l))return s}let i=this.state.plugins;if(i)for(let o=0;o<i.length;o++){let l=i[o].props[e];if(l!=null&&(s=n?n(l):l))return s}}hasFocus(){if(Yo){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&aot(this.dom),Uf(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return dot(this,e)}coordsAtPos(e,n=1){return iSe(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let s=this.docView.posFromDOM(e,n,r);if(s==null)throw new RangeError("DOM position not inside the editor");return s}endOfTextblock(e,n){return got(this,n||this.state,e)}pasteHTML(e,n){return Ik(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Ik(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return mK(this,e)}destroy(){this.docView&&(Hot(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],iz(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Gat())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Kot(this,e)}domSelectionRange(){let e=this.domSelection();return e?Ia&&this.root.nodeType===11&&Zat(this.dom.ownerDocument)==this.dom&&xlt(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}MSe.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function Cre(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[gi.node(0,t.state.doc.content.size,e)]}function kre(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:gi.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function Are(t){return!t.someProp("editable",e=>e(t.state)===!1)}function Alt(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function Ere(t){let e=Object.create(null);function n(r){for(let s in r)Object.prototype.hasOwnProperty.call(e,s)||(e[s]=r[s])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function Elt(t,e){let n=0,r=0;for(let s in t){if(t[s]!=e[s])return!0;n++}for(let s in e)r++;return n!=r}function Tre(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Ug={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},MI={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Tlt=typeof navigator<"u"&&/Mac/.test(navigator.platform),Plt=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var $i=0;$i<10;$i++)Ug[48+$i]=Ug[96+$i]=String($i);for(var $i=1;$i<=24;$i++)Ug[$i+111]="F"+$i;for(var $i=65;$i<=90;$i++)Ug[$i]=String.fromCharCode($i+32),MI[$i]=String.fromCharCode($i);for(var oz in Ug)MI.hasOwnProperty(oz)||(MI[oz]=Ug[oz]);function Mlt(t){var e=Tlt&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Plt&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?MI:Ug)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const Rlt=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Olt=typeof navigator<"u"&&/Win/.test(navigator.platform);function Ilt(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,s,i,o;for(let l=0;l<e.length-1;l++){let c=e[l];
vendor: 4,497 bytes, line 1070
1070if(/^(cmd|meta|m)$/i.test(c))o=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))s=!0;else if(/^s(hift)?$/i.test(c))i=!0;else if(/^mod$/i.test(c))Rlt?o=!0:s=!0;else throw new Error("Unrecognized modifier name: "+c)}return r&&(n="Alt-"+n),s&&(n="Ctrl-"+n),o&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function Dlt(t){let e=Object.create(null);for(let n in t)e[Ilt(n)]=t[n];return e}function lz(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function Llt(t){return new fr({props:{handleKeyDown:wK(t)}})}function wK(t){let e=Dlt(t);return function(n,r){let s=Mlt(r),i,o=e[lz(s,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(s.length==1&&s!=" "){if(r.shiftKey){let l=e[lz(s,r,!1)];if(l&&l(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(Olt&&r.ctrlKey&&r.altKey)&&(i=Ug[r.keyCode])&&i!=s){let l=e[lz(i,r)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}var Flt=Object.defineProperty,_K=(t,e)=>{for(var n in e)Flt(t,n,{get:e[n],enumerable:!0})};function x4(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:s}=n,{storedMarks:i}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return r},get doc(){return s},get tr(){return r=n.selection,s=n.doc,i=n.storedMarks,n}}}var y4=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:s}=n,i=this.buildProps(s);return Object.fromEntries(Object.entries(t).map(([o,l])=>[o,(...u)=>{const d=l(...u)(i);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(s),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:s}=this,{view:i}=r,o=[],l=!!t,c=t||s.tr,u=()=>(!l&&e&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(c),o.every(h=>h===!0)),d={...Object.fromEntries(Object.entries(n).map(([h,f])=>[h,(...m)=>{const v=this.buildProps(c,e),x=f(...m)(v);return o.push(x),d}])),run:u};return d}createCan(t){const{rawCommands:e,state:n}=this,r=!1,s=t||n.tr,i=this.buildProps(s,r);return{...Object.fromEntries(Object.entries(e).map(([l,c])=>[l,(...u)=>c(...u)({...i,dispatch:void 0})])),chain:()=>this.createChain(s,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:s}=this,{view:i}=r,o={tr:t,editor:r,view:i,state:x4({state:s,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([l,c])=>[l,(...u)=>c(...u)(o)]))}};return o}},RSe={};_K(RSe,{blur:()=>$lt,clearContent:()=>zlt,clearNodes:()=>Blt,command:()=>Ult,createParagraphNear:()=>qlt,cut:()=>Vlt,deleteCurrentNode:()=>Hlt,deleteNode:()=>Wlt,deleteRange:()=>Klt,deleteSelection:()=>Xlt,enter:()=>Jlt,exitCode:()=>Qlt,extendMarkRange:()=>Zlt,first:()=>ect,focus:()=>nct,forEach:()=>rct,insertContent:()=>sct,insertContentAt:()=>oct,joinBackward:()=>uct,joinDown:()=>cct,joinForward:()=>dct,joinItemBackward:()=>hct,joinItemForward:()=>fct,joinTextblockBackward:()=>pct,joinTextblockForward:()=>mct,joinUp:()=>lct,keyboardShortcut:()=>vct,lift:()=>xct,liftEmptyBlock:()=>yct,liftListItem:()=>bct,newlineInCode:()=>wct,resetAttributes:()=>_ct,scrollIntoView:()=>jct,selectAll:()=>Sct,selectNodeBackward:()=>Nct,selectNodeForward:()=>Cct,selectParentNode:()=>kct,selectTextblockEnd:()=>Act,selectTextblockStart:()=>Ect,setContent:()=>Tct,setMark:()=>Xct,setMeta:()=>Jct,setNode:()=>Qct,setNodeSelection:()=>Zct,setTextDirection:()=>eut,setTextSelection:()=>tut,sinkListItem:()=>nut,splitBlock:()=>rut,splitListItem:()=>sut,toggleList:()=>aut,toggleMark:()=>out,toggleNode:()=>lut,toggleWrap:()=>cut,undoInputRule:()=>uut,unsetAllMarks:()=>dut,unsetMark:()=>hut,unsetTextDirection:()=>fut,updateAttributes:()=>put,wrapIn:()=>mut,wrapInList:()=>gut});var $lt=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),zlt=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),Blt=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:s}=r;
vendor: 4,302 bytes, line 1070
1070return n&&s.forEach(({$from:i,$to:o})=>{t.doc.nodesBetween(i.pos,o.pos,(l,c)=>{if(l.type.isText)return;const{doc:u,mapping:d}=e,h=u.resolve(d.map(c)),f=u.resolve(d.map(c+l.nodeSize)),p=h.blockRange(f);if(!p)return;const m=Wj(p);if(l.type.isTextblock){const{defaultType:v}=h.parent.contentMatchAt(h.index());e.setNodeMarkup(p.start,v)}(m||m===0)&&e.lift(p,m)})}),!0},Ult=t=>e=>t(e),qlt=()=>({state:t,dispatch:e})=>Oat(t,e),Vlt=(t,e)=>({editor:n,tr:r})=>{const{state:s}=n,i=s.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,i.content),r.setSelection(new It(r.doc.resolve(Math.max(o-1,0)))),!0},Hlt=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const s=t.selection.$anchor;for(let i=s.depth;i>0;i-=1)if(s.node(i).type===r.type){if(e){const l=s.before(i),c=s.after(i);t.delete(l,c).scrollIntoView()}return!0}return!1};function Ms(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var Wlt=t=>({tr:e,state:n,dispatch:r})=>{const s=Ms(t,n.schema),i=e.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===s){if(r){const c=i.before(o),u=i.after(o);e.delete(c,u).scrollIntoView()}return!0}return!1},Klt=t=>({tr:e,dispatch:n})=>{const{from:r,to:s}=t;return n&&e.delete(r,s),!0},Glt=t=>t.content?/^text(\*|\+)/.test(t.content):!1,Pre=(t,e,n)=>{if(!t.parent.isInline||n==="left"&&t.pos>t.start()||n==="right"&&t.pos<t.end())return t.pos;const r=e.nodes[t.parent.type.name].spec;return Glt(r)?n==="left"?t.start()-1:t.end()+1:t.pos},Ylt=(t,e,n)=>{const r=Pre(t,n,"left"),s=Pre(e,n,"right");return{from:r,to:s}},Xlt=()=>({state:t,dispatch:e})=>{const{$from:n,$to:r}=t.selection;if(t.selection.empty)return!1;const{from:s,to:i}=Ylt(n,r,t.schema);return e&&(t.tr.deleteRange(s,i).scrollIntoView(),e(t.tr)),!0},Jlt=()=>({commands:t})=>t.keyboardShortcut("Enter"),Qlt=()=>({state:t,dispatch:e})=>Rat(t,e);function jK(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function RI(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(s=>n.strict?e[s]===t[s]:jK(e[s])?e[s].test(t[s]):e[s]===t[s]):!0}function OSe(t,e,n={}){return t.find(r=>r.type===e&&RI(Object.fromEntries(Object.keys(n).map(s=>[s,r.attrs[s]])),n))}function Mre(t,e,n={}){return!!OSe(t,e,n)}function SK(t,e,n){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if((!r.node||!r.node.marks.some(u=>u.type===e))&&(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(u=>u.type===e))return;if(!n){const u=r.node.marks.find(d=>d.type===e);u&&(n=u.attrs)}if(!OSe([...r.node.marks],e,n))return;let i=r.index,o=t.start()+r.offset,l=i+1,c=o+r.node.nodeSize;for(;i>0&&Mre([...t.parent.child(i-1).marks],e,n);)i-=1,o-=t.parent.child(i).nodeSize;for(;l<t.parent.childCount&&Mre([...t.parent.child(l).marks],e,n);)c+=t.parent.child(l).nodeSize,l+=1;return{from:o,to:c}}function mp(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}var Zlt=(t,e)=>({tr:n,state:r,dispatch:s})=>{const i=mp(t,r.schema),{doc:o,selection:l}=n,{$from:c,from:u,to:d}=l;if(s){const h=SK(c,i,e);if(h&&h.from<=u&&h.to>=d){const f=It.create(o,h.from,h.to);n.setSelection(f)}}return!0},ect=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function ISe(t){return t instanceof It}function ix(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function DSe(t,e=null){if(!e)return null;const n=Ot.atStart(t),r=Ot.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const s=n.from,i=r.to;return e==="all"?It.create(t,ix(0,s,i),ix(t.content.size,s,i)):It.create(t,ix(e,s,i),ix(e,s,i))}function Rre(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function OI(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function tct(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var nct=(t=null,e={})=>({editor:n,view:r,tr:s,dispatch:i})=>{e={scrollIntoView:!0,...e};const o=()=>
vendor: 8,976 bytes, line 1070
1070{(OI()||Rre())&&r.dom.focus(),tct()&&!OI()&&!Rre()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&t===null||t===!1)return!0}catch{return!1}if(i&&t===null&&!ISe(n.state.selection))return o(),!0;const l=DSe(s.doc,t)||n.state.selection,c=n.state.selection.eq(l);return i&&(c||s.setSelection(l),c&&s.storedMarks&&s.setStoredMarks(s.storedMarks),o()),!0},rct=(t,e)=>n=>t.every((r,s)=>e(r,{...n,index:s})),sct=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),LSe=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&LSe(r)}return t};function SP(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return LSe(n)}function Lk(t,e,n){if(t instanceof Ng||t instanceof De)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,s=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return De.fromArray(t.map(l=>e.nodeFromJSON(l)));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}catch(i){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",i),Lk("",e,n)}if(s){if(n.errorOnInvalidContent){let o=!1,l="";const c=new _je({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:u=>(o=!0,l=typeof u=="string"?u:u.outerHTML,null)}]}})});if(n.slice?jC.fromSchema(c).parseSlice(SP(t),n.parseOptions):jC.fromSchema(c).parse(SP(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const i=jC.fromSchema(e);return n.slice?i.parseSlice(SP(t),n.parseOptions).content:i.parse(SP(t),n.parseOptions)}return Lk("",e,n)}function ict(t,e,n){const r=t.steps.length-1;if(r<e)return;const s=t.steps[r];if(!(s instanceof Ic||s instanceof Qo))return;const i=t.mapping.maps[r];let o=0;i.forEach((l,c,u,d)=>{o===0&&(o=d)}),t.setSelection(Ot.near(t.doc.resolve(o),n))}var act=t=>!("type"in t),oct=(t,e,n)=>({tr:r,dispatch:s,editor:i})=>{var o;if(s){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let l;const c=x=>{i.emit("contentError",{editor:i,error:x,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},u={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{Lk(e,i.schema,{parseOptions:u,errorOnInvalidContent:!0})}catch(x){c(x)}try{l=Lk(e,i.schema,{parseOptions:u,errorOnInvalidContent:(o=n.errorOnInvalidContent)!=null?o:i.options.enableContentCheck})}catch(x){return c(x),!1}let{from:d,to:h}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},f=!0,p=!0;if((act(l)?l:[l]).forEach(x=>{x.check(),f=f?x.isText&&x.marks.length===0:!1,p=p?x.isBlock:!1}),d===h&&p){const{parent:x}=r.doc.resolve(d);x.isTextblock&&!x.type.spec.code&&!x.childCount&&(d-=1,h+=1)}let v;if(f){if(Array.isArray(e))v=e.map(x=>x.text||"").join("");else if(e instanceof De){let x="";e.forEach(g=>{g.text&&(x+=g.text)}),v=x}else typeof e=="object"&&e&&e.text?v=e.text:v=e;r.insertText(v,d,h)}else{v=l;const x=r.doc.resolve(d),g=x.node(),w=x.parentOffset===0,_=g.isText||g.isTextblock,j=g.content.size>0;w&&_&&j&&p&&(d=Math.max(0,d-1)),r.replaceWith(d,h,v)}n.updateSelection&&ict(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:d,text:v}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:d,text:v})}return!0},lct=()=>({state:t,dispatch:e})=>Eat(t,e),cct=()=>({state:t,dispatch:e})=>Tat(t,e),uct=()=>({state:t,dispatch:e})=>jat(t,e),dct=()=>({state:t,dispatch:e})=>kat(t,e),hct=()=>({state:t,dispatch:e,tr:n})=>{try{const r=f4(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},fct=()=>({state:t,dispatch:e,tr:n})=>{try{const r=f4(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},pct=()=>({state:t,dispatch:e})=>Sat(t,e),mct=()=>({state:t,dispatch:e})=>Nat(t,e);function FSe(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function gct(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,s,i,o;for(let l=0;l<e.length-1;l+=1){const c=e[l];if(/^(cmd|meta|m)$/i.test(c))o=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))s=!0;else if(/^s(hift)?$/i.test(c))i=!0;else if(/^mod$/i.test(c))OI()||FSe()?o=!0:s=!0;else throw new Error(`Unrecognized modifier name: ${c}`)}return r&&(n=`Alt-${n}`),s&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),i&&(n=`Shift-${n}`),n}var vct=t=>({editor:e,view:n,tr:r,dispatch:s})=>{const i=gct(t).split(/-(?!$)/),o=i.find(u=>!["Alt","Ctrl","Meta","Shift"].includes(u)),l=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),c=e.captureTransaction(()=>{n.someProp("handleKeyDown",u=>u(n,l))});return c==null||c.steps.forEach(u=>{const d=u.map(r.mapping);d&&s&&r.maybeStep(d)}),!0};function qg(t,e,n={}){const{from:r,to:s,empty:i}=t.selection,o=e?Ms(e,t.schema):null,l=[];t.doc.nodesBetween(r,s,(h,f)=>{if(h.isText)return;const p=Math.max(r,f),m=Math.min(s,f+h.nodeSize);l.push({node:h,from:p,to:m})});const c=s-r,u=l.filter(h=>o?o.name===h.node.type.name:!0).filter(h=>RI(h.node.attrs,n,{strict:!1}));return i?!!u.length:u.reduce((h,f)=>h+f.to-f.from,0)>=c}var xct=(t,e={})=>({state:n,dispatch:r})=>{const s=Ms(t,n.schema);return qg(n,s,e)?Pat(n,r):!1},yct=()=>({state:t,dispatch:e})=>Iat(t,e),bct=t=>({state:e,dispatch:n})=>{const r=Ms(t,e.schema);return Vat(r)(e,n)},wct=()=>({state:t,dispatch:e})=>Mat(t,e);function b4(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function Ore(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,s)=>(n.includes(s)||(r[s]=t[s]),r),{})}var _ct=(t,e)=>({tr:n,state:r,dispatch:s})=>{let i=null,o=null;const l=b4(typeof t=="string"?t:t.name,r.schema);if(!l)return!1;l==="node"&&(i=Ms(t,r.schema)),l==="mark"&&(o=mp(t,r.schema));let c=!1;return n.selection.ranges.forEach(u=>{r.doc.nodesBetween(u.$from.pos,u.$to.pos,(d,h)=>{i&&i===d.type&&(c=!0,s&&n.setNodeMarkup(h,void 0,Ore(d.attrs,e))),o&&d.marks.length&&d.marks.forEach(f=>{o===f.type&&(c=!0,s&&n.addMark(h,h+d.nodeSize,o.create(Ore(f.attrs,e))))})})}),c},jct=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),Sct=()=>({tr:t,dispatch:e})=>{if(e){const n=new Cg(t.doc);t.setSelection(n)}return!0},Nct=()=>({state:t,dispatch:e})=>Cat(t,e),Cct=()=>({state:t,dispatch:e})=>Aat(t,e),kct=()=>({state:t,dispatch:e})=>Dat(t,e),Act=()=>({state:t,dispatch:e})=>$at(t,e),Ect=()=>({state:t,dispatch:e})=>Fat(t,e);function Fq(t,e,n={},r={}){return Lk(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var Tct=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:s,tr:i,dispatch:o,commands:l})=>{const{doc:c}=i;if(r.preserveWhitespace!=="full"){const u=Fq(t,s.schema,r,{errorOnInvalidContent:e??s.options.enableContentCheck});return o&&i.replaceWith(0,c.content.size,u).setMeta("preventUpdate",!n),!0}return o&&i.setMeta("preventUpdate",!n),l.insertContentAt({from:0,to:c.content.size},t,{parseOptions:r,errorOnInvalidContent:e??s.options.enableContentCheck})};function $Se(t,e){const n=mp(e,t.schema),{from:r,to:s,empty:i}=t.selection,o=[];i?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,s,c=>{o.push(...c.marks)});const l=o.find(c=>c.type.name===n.name);return l?{...l.attrs}:{}}function zSe(t,e){const n=new cK(t);return e.forEach(r=>{r.steps.forEach(s=>{n.step(s)})}),n}function Pct(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function Mct(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(s,i)=>{n(s)&&r.push({node:s,pos:i})}),r}function BSe(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function w4(t){return e=>BSe(e.$from,t)}function jt(t,e,n){return t.config[e]===void 0&&t.parent?jt(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?jt(t.parent,e,n):null}):t.config[e]}function NK(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=jt(e,"addExtensions",n);return r?[e,...NK(r())]:e}).flat(10)}
1070function CK(t,e){const n=L0.fromSchema(e).serializeFragment(t),s=document.implementation.createHTMLDocument().createElement("div");return s.appendChild(n),s.innerHTML}function USe(t){return typeof t=="function"}function gn(t,e=void 0,...n){return USe(t)?e?t.bind(e)(...n):t(...n):t}function Rct(t={}){return Object.keys(t).length===0&&t.constructor===Object}function sj(t){const e=t.filter(s=>s.type==="extension"),n=t.filter(s=>s.type==="node"),r=t.filter(s=>s.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function qSe(t){const e=[],{nodeExtensions:n,markExtensions:r}=sj(t),s=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(u=>u.name!=="text").map(u=>u.name),l=r.map(u=>u.name),c=[...o,...l];return t.forEach(u=>{const d={name:u.name,options:u.options,storage:u.storage,extensions:s},h=jt(u,"addGlobalAttributes",d);if(!h)return;h().forEach(p=>{let m;Array.isArray(p.types)?m=p.types:p.types==="*"?m=c:p.types==="nodes"?m=o:p.types==="marks"?m=l:m=[],m.forEach(v=>{Object.entries(p.attributes).forEach(([x,g])=>{e.push({type:v,name:x,attribute:{...i,...g}})})})})}),s.forEach(u=>{const d={name:u.name,options:u.options,storage:u.storage},h=jt(u,"addAttributes",d);if(!h)return;const f=h();Object.entries(f).forEach(([p,m])=>{const v={...i,...m};typeof(v==null?void 0:v.default)=="function"&&(v.default=v.default()),v!=null&&v.isRequired&&(v==null?void 0:v.default)===void 0&&delete v.default,e.push({type:u.name,name:p,attribute:v})})}),e}function Oct(t){const e=[];let n="",r=!1,s=!1,i=0;const o=t.length;for(let l=0;l<o;l+=1){const c=t[l];if(c==="'"&&!s){r=!r,n+=c;continue}if(c==='"'&&!r){s=!s,n+=c;continue}if(!r&&!s){if(c==="("){i+=1,n+=c;continue}if(c===")"&&i>0){i-=1,n+=c;continue}if(c===";"&&i===0){e.push(n),n="";continue}}n+=c}return n&&e.push(n),e}function Ire(t){const e=[],n=Oct(t||""),r=n.length;for(let s=0;s<r;s+=1){const i=n[s],o=i.indexOf(":");if(o===-1)continue;const l=i.slice(0,o).trim(),c=i.slice(o+1).trim();l&&c&&e.push([l,c])}return e}function Mn(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([s,i])=>{if(!r[s]){r[s]=i;return}if(s==="class"){const l=i?String(i).split(" "):[],c=r[s]?r[s].split(" "):[],u=l.filter(d=>!c.includes(d));r[s]=[...c,...u].join(" ")}else if(s==="style"){const l=new Map([...Ire(r[s]),...Ire(i)]);r[s]=Array.from(l.entries()).map(([c,u])=>`${c}: ${u}`).join("; ")}else r[s]=i}),r},{})}function Fk(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>Mn(n,r),{})}function Ict(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function Dre(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const s=e.reduce((i,o)=>{const l=o.attribute.parseHTML?o.attribute.parseHTML(n):Ict(n.getAttribute(o.name));return l==null?i:{...i,[o.name]:l}},{});return{...r,...s}}}}function Lre(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&Rct(n)?!1:n!=null))}function Fre(t){var e,n;const r={};return!((e=t==null?void 0:t.attribute)!=null&&e.isRequired)&&"default"in((t==null?void 0:t.attribute)||{})&&(r.default=t.attribute.default),((n=t==null?void 0:t.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=t.attribute.validate),[t.name,r]}function Dct(t,e){var n;const r=qSe(t),{nodeExtensions:s,markExtensions:i}=sj(t),o=(n=s.find(u=>jt(u,"topNode")))==null?void 0:n.name,l=Object.fromEntries(s.map(u=>{const d=r.filter(g=>g.type===u.name),h={name:u.name,options:u.options,storage:u.storage,editor:e},f=t.reduce((g,w)=>{const _=jt(w,"extendNodeSchema",h);return{...g,..._?_(u):{}}},{}),p=Lre({...f,content:gn(jt(u,"content",h)),marks:gn(jt(u,"marks",h)),group:gn(jt(u,"group",h)),inline:gn(jt(u,"inline",h)),atom:gn(jt(u,"atom",h)),selectable:gn(jt(u,"selectable",h)),draggable:gn(jt(u,"draggable",h)),code:gn(jt(u,"code",h)),whitespace:gn(jt(u,"whitespace",h)),linebreakReplacement:gn(jt(u,"linebreakReplacement",h)),defining:gn(jt(u,"defining",h)),isolating:gn(jt(u,"isolating",h)),attrs:Object.fromEntries(d.map(Fre))}),m=gn(jt(u,"parseHTML",h));m&&(p.parseDOM=m.map(g=>Dre(g,d)));const v=jt(u,"renderHTML",h);v&&(p.toDOM=g=>v({node:g,HTMLAttributes:Fk(g,d)}));const x=jt(u,"renderText",h);return x&&(p.toText=x),[u.name,p]})),c=Object.fromEntries(i.map(u=>{const d=r.filter(x=>x.type===u.name),h={name:u.name,options:u.options,storage:u.storage,editor:e},f=t.reduce((x,g)=>{const w=jt(g,"extendMarkSchema",h);return{...x,...w?w(u):{}}},{}),p=Lre({...f,inclusive:gn(jt(u,"inclusive",h)),excludes:gn(jt(u,"excludes",h)),group:gn(jt(u,"group",h)),spanning:gn(jt(u,"spanning",h)),code:gn(jt(u,"code",h)),attrs:Object.fromEntries(d.map(Fre))}),m=gn(jt(u,"parseHTML",h));m&&(p.parseDOM=m.map(x=>Dre(x,d)));const v=jt(u,"renderHTML",h);return v&&(p.toDOM=x=>v({mark:x,HTMLAttributes:Fk(x,d)})),[u.name,p]}));return new _je({topNode:o,nodes:l,marks:c})}function Lct(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function kC(t){return t.sort((n,r)=>{const s=jt(n,"priority")||100,i=jt(r,"priority")||100;return s>i?-1:s<i?1:0})}function VSe(t){const e=kC(NK(t)),n=Lct(e.map(r=>r.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function HSe(t,e,n){const{from:r,to:s}=e,{blockSeparator:i=` 1071
1072`,textSerializers:o={}}=n||{};let l="";return t.nodesBetween(r,s,(c,u,d,h)=>{var f;c.isBlock&&u>r&&(l+=i);const p=o==null?void 0:o[c.type.name];if(p)return d&&(l+=p({node:c,pos:u,parent:d,index:h,range:e})),!1;c.isText&&(l+=(f=c==null?void 0:c.text)==null?void 0:f.slice(Math.max(r,u)-u,s-u))}),l}function Fct(t,e){const n={from:0,to:t.content.size};return HSe(t,n,e)}function WSe(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function $ct(t,e){const n=Ms(e,t.schema),{from:r,to:s}=t.selection,i=[];t.doc.nodesBetween(r,s,l=>{i.push(l)});const o=i.reverse().find(l=>l.type.name===n.name);return o?{...o.attrs}:{}}function KSe(t,e){const n=b4(typeof e=="string"?e:e.name,t.schema);return n==="node"?$ct(t,e):n==="mark"?$Se(t,e):{}}function zct(t,e=JSON.stringify){const n={};return t.filter(r=>{const s=e(r);return Object.prototype.hasOwnProperty.call(n,s)?!1:n[s]=!0})}function Bct(t){const e=zct(t);return e.length===1?e:e.filter((n,r)=>!e.filter((i,o)=>o!==r).some(i=>n.oldRange.from>=i.oldRange.from&&n.oldRange.to<=i.oldRange.to&&n.newRange.from>=i.newRange.from&&n.newRange.to<=i.newRange.to))}function GSe(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((s,i)=>{const o=[];if(s.ranges.length)s.forEach((l,c)=>{o.push({from:l,to:c})});else{const{from:l,to:c}=n[i];if(l===void 0||c===void 0)return;o.push({from:l,to:c})}o.forEach(({from:l,to:c})=>{const u=e.slice(i).map(l,-1),d=e.slice(i).map(c),h=e.invert().map(u,-1),f=e.invert().map(d);r.push({oldRange:{from:h,to:f},newRange:{from:u,to:d}})})}),Bct(r)}function kK(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(s=>{const i=n.resolve(t),o=SK(i,s.type);o&&r.push({mark:s,...o})}):n.nodesBetween(t,e,(s,i)=>{!s||(s==null?void 0:s.nodeSize)===void 0||r.push(...s.marks.map(o=>({from:i,to:i+s.nodeSize,mark:o})))}),r}var Uct=(t,e,n,r=20)=>{const s=t.doc.resolve(n);let i=r,o=null;for(;i>0&&o===null;){const l=s.node(i);(l==null?void 0:l.type.name)===e?o=l:i-=1}return[o,i]};function RS(t,e){return e.nodes[t]||e.marks[t]||null}function MR(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const s=t.find(i=>i.type===e&&i.name===r);return s?s.attribute.keepOnSplit:!1}))}var qct=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(s,i,o,l)=>{var c,u;const d=((u=(c=s.type.spec).toText)==null?void 0:u.call(c,{node:s,pos:i,parent:o,index:l}))||s.textContent||"%leaf%";n+=s.isAtom&&!s.isText?d:d.slice(0,Math.max(0,r-i))}),n};function $q(t,e,n={}){const{empty:r,ranges:s}=t.selection,i=e?mp(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(h=>i?i.name===h.type.name:!0).find(h=>RI(h.attrs,n,{strict:!1}));let o=0;const l=[];if(s.forEach(({$from:h,$to:f})=>{const p=h.pos,m=f.pos;t.doc.nodesBetween(p,m,(v,x)=>{if(i&&v.inlineContent&&!v.type.allowsMarkType(i))return!1;if(!v.isText&&!v.marks.length)return;const g=Math.max(p,x),w=Math.min(m,x+v.nodeSize),_=w-g;o+=_,l.push(...v.marks.map(j=>({mark:j,from:g,to:w})))})}),o===0)return!1;const c=l.filter(h=>i?i.name===h.mark.type.name:!0).filter(h=>RI(h.mark.attrs,n,{strict:!1})).reduce((h,f)=>h+f.to-f.from,0),u=l.filter(h=>i?h.mark.type!==i&&h.mark.type.excludes(i):!0).reduce((h,f)=>h+f.to-f.from,0);return(c>0?c+u:c)>=o}function Vct(t,e,n={}){if(!e)return qg(t,null,n)||$q(t,null,n);const r=b4(e,t.schema);return r==="node"?qg(t,e,n):r==="mark"?$q(t,e,n):!1}var Hct=(t,e)=>{const{$from:n,$to:r,$anchor:s}=t.selection;if(e){const i=w4(l=>l.type.name===e)(t.selection);if(!i)return!1;const o=t.doc.resolve(i.pos+1);return s.pos+1===o.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},Wct=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function $re(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function cz(t,e){const{nodeExtensions:n}=sj(e),r=n.find(o=>o.name===t);if(!r)return!1;const s={name:r.name,options:r.options,storage:r.storage},i=gn(jt(r,"group",s));return typeof i!="string"?!1:i.split(" ").includes("list")}function $k(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;
vendor: 4,220 bytes, line 1072
1072if(t.isText)return!/\S/.test((r=t.text)!=null?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let s=!0;return t.content.forEach(i=>{s!==!1&&($k(i,{ignoreWhitespace:n,checkChildren:e})||(s=!1))}),s}return!1}function YSe(t){return t instanceof Dt}var XSe=class JSe{constructor(e){this.position=e}static fromJSON(e){return new JSe(e.position)}toJSON(){return{position:this.position}}};function Kct(t,e){const n=e.mapping.mapResult(t.position);return{position:new XSe(n.pos),mapResult:n}}function Gct(t){return new XSe(t)}function Yct(t,e,n){var r;const{selection:s}=e;let i=null;if(ISe(s)&&(i=s.$cursor),i){const l=(r=t.storedMarks)!=null?r:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(l)||!l.some(u=>u.type.excludes(n)))}const{ranges:o}=s;return o.some(({$from:l,$to:c})=>{let u=l.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(l.pos,c.pos,(d,h,f)=>{if(u)return!1;if(d.isInline){const p=!f||f.type.allowsMarkType(n),m=!!n.isInSet(d.marks)||!d.marks.some(v=>v.type.excludes(n));u=p&&m}return!u}),u})}var Xct=(t,e={})=>({tr:n,state:r,dispatch:s})=>{const{selection:i}=n,{empty:o,ranges:l}=i,c=mp(t,r.schema);if(s)if(o){const u=$Se(r,c);n.addStoredMark(c.create({...u,...e}))}else l.forEach(u=>{const d=u.$from.pos,h=u.$to.pos;r.doc.nodesBetween(d,h,(f,p)=>{const m=Math.max(p,d),v=Math.min(p+f.nodeSize,h);f.marks.find(g=>g.type===c)?f.marks.forEach(g=>{c===g.type&&n.addMark(m,v,c.create({...g.attrs,...e}))}):n.addMark(m,v,c.create(e))})});return Yct(r,n,c)},Jct=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),Qct=(t,e={})=>({state:n,dispatch:r,chain:s})=>{const i=Ms(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),i.isTextblock?s().command(({commands:l})=>Jne(i,{...o,...e})(n)?!0:l.clearNodes()).command(({state:l})=>Jne(i,{...o,...e})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Zct=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,s=ix(t,0,r.content.size),i=Dt.create(r,s);e.setSelection(i)}return!0},eut=(t,e)=>({tr:n,state:r,dispatch:s})=>{const{selection:i}=r;let o,l;return typeof e=="number"?(o=e,l=e):e&&"from"in e&&"to"in e?(o=e.from,l=e.to):(o=i.from,l=i.to),s&&n.doc.nodesBetween(o,l,(c,u)=>{c.isText||n.setNodeMarkup(u,void 0,{...c.attrs,dir:t})}),!0},tut=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:s,to:i}=typeof t=="number"?{from:t,to:t}:t,o=It.atStart(r).from,l=It.atEnd(r).to,c=ix(s,o,l),u=ix(i,o,l),d=It.create(r,c,u);e.setSelection(d)}return!0},nut=t=>({state:e,dispatch:n})=>{const r=Ms(t,e.schema);return Kat(r)(e,n)};function zre(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(s=>e==null?void 0:e.includes(s.type.name));t.tr.ensureMarks(r)}}var rut=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:s})=>{const{selection:i,doc:o}=e,{$from:l,$to:c}=i,u=s.extensionManager.attributes,d=MR(u,l.node().type.name,l.node().attrs);if(i instanceof Dt&&i.node.isBlock)return!l.parentOffset||!Bw(o,l.pos)?!1:(r&&(t&&zre(n,s.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const h=c.parentOffset===c.parent.content.size,f=l.depth===0?void 0:Pct(l.node(-1).contentMatchAt(l.indexAfter(-1)));let p=h&&f?[{type:f,attrs:d}]:void 0,m=Bw(e.doc,e.mapping.map(l.pos),1,p);if(!p&&!m&&Bw(e.doc,e.mapping.map(l.pos),1,f?[{type:f}]:void 0)&&(m=!0,p=f?[{type:f,attrs:d}]:void 0),r){if(m&&(i instanceof It&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,p),f&&!h&&!l.parentOffset&&l.parent.type!==f)){const v=e.mapping.map(l.before()),x=e.doc.resolve(v);l.node(-1).canReplaceWith(x.index(),x.index()+1,f)&&e.setNodeMarkup(e.mapping.map(l.before()),f)}t&&zre(n,s.extensionManager.splittableMarks),e.scrollIntoView()}return m},sut=(t,e={})=>({tr:n,state:r,dispatch:s,editor:i})=>{var o;const l=Ms(t,r.schema),{$from:c,$to:u}=r.selection,d=r.selection.node;if(d&&d.isBlock||c.depth<2||!c.sameParent(u))return!1;const h=c.node(-1);if(h.type!==l)return!1;const f=i.extensionManager.attributes;if(c.parent.content.size===0&&c.node(-1).childCount===c.indexAfter(-1)){if
1072(c.depth===2||c.node(-3).type!==l||c.index(-2)!==c.node(-2).childCount-1)return!1;if(s){let g=De.empty;const w=c.index(-1)?1:c.index(-2)?2:3;for(let k=c.depth-w;k>=c.depth-3;k-=1)g=De.from(c.node(k).copy(g));const _=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,j={...MR(f,c.node().type.name,c.node().attrs),...e},N=((o=l.contentMatch.defaultType)==null?void 0:o.createAndFill(j))||void 0;g=g.append(De.from(l.createAndFill(null,N)||void 0));const S=c.before(c.depth-(w-1));n.replace(S,c.after(-_),new Ge(g,4-w,0));let C=-1;n.doc.nodesBetween(S,n.doc.content.size,(k,E)=>{if(C>-1)return!1;k.isTextblock&&k.content.size===0&&(C=E+1)}),C>-1&&n.setSelection(It.near(n.doc.resolve(C))),n.scrollIntoView()}return!0}const p=u.pos===c.end()?h.contentMatchAt(0).defaultType:null,m={...MR(f,h.type.name,h.attrs),...e},v={...MR(f,c.node().type.name,c.node().attrs),...e};n.delete(c.pos,u.pos);const x=p?[{type:l,attrs:m},{type:p,attrs:v}]:[{type:l,attrs:m}];if(!Bw(n.doc,c.pos,2))return!1;if(s){const{selection:g,storedMarks:w}=r,{splittableMarks:_}=i.extensionManager,j=w||g.$to.parentOffset&&g.$from.marks();if(n.split(c.pos,2,x).scrollIntoView(),!j||!s)return!0;const N=j.filter(S=>_.includes(S.type.name));n.ensureMarks(N)}return!0};function Bre(t){return!t||t==="1"?null:t}function QSe(t,e){return Bre(t)===Bre(e)}var uz=(t,e)=>{const n=w4(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const s=t.doc.nodeAt(r);return!(n.node.type===(s==null?void 0:s.type)&&ov(t.doc,n.pos))||!QSe(n.node.attrs.type,s==null?void 0:s.attrs.type)||t.join(n.pos),!0},dz=(t,e)=>{const n=w4(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const s=t.doc.nodeAt(r);return!(n.node.type===(s==null?void 0:s.type)&&ov(t.doc,r))||!QSe(n.node.attrs.type,s==null?void 0:s.attrs.type)||t.join(r),!0};function iut(t){const e=t.doc,n=e.firstChild;if(!n)return null;const r=e.resolve(1),s=e.resolve(n.nodeSize-1);return It.between(r,s)}var aut=(t,e,n,r={})=>({editor:s,tr:i,state:o,dispatch:l,chain:c,commands:u,can:d})=>{const{extensions:h,splittableMarks:f}=s.extensionManager,p=Ms(t,o.schema),m=Ms(e,o.schema),{selection:v,storedMarks:x}=o,{$from:g,$to:w}=v,_=g.blockRange(w),j=x||v.$to.parentOffset&&v.$from.marks();if(!_)return!1;const N=w4(R=>cz(R.type.name,h))(v),S=v.from===0&&v.to===o.doc.content.size,C=o.doc.content.content,k=C.length===1?C[0]:null,E=S&&k&&cz(k.type.name,h)?{node:k,pos:0,depth:0}:null,P=N??E,T=!!N&&_.depth>=1&&_.depth-N.depth<=1,M=!!E;if((T||M)&&P){if(P.node.type===p)return S&&M?c().command(({tr:R,dispatch:A})=>{const I=iut(R);return I?(R.setSelection(I),A&&A(R),!0):!1}).liftListItem(m).run():u.liftListItem(m);if(cz(P.node.type.name,h)&&p.validContent(P.node.content))return c().command(()=>(i.setNodeMarkup(P.pos,p),!0)).command(()=>uz(i,p)).command(()=>dz(i,p)).run()}return!n||!j||!l?c().command(()=>d().wrapInList(p,r)?!0:u.clearNodes()).wrapInList(p,r).command(()=>uz(i,p)).command(()=>dz(i,p)).run():c().command(()=>{const R=d().wrapInList(p,r),A=j.filter(I=>f.includes(I.type.name));return i.ensureMarks(A),R?!0:u.clearNodes()}).wrapInList(p,r).command(()=>uz(i,p)).command(()=>dz(i,p)).run()},out=(t,e={},n={})=>({state:r,commands:s})=>{const{extendEmptyMarkRange:i=!1}=n,o=mp(t,r.schema);return $q(r,o,e)?s.unsetMark(o,{extendEmptyMarkRange:i}):s.setMark(o,e)},lut=(t,e,n={})=>({state:r,commands:s})=>{const i=Ms(t,r.schema),o=Ms(e,r.schema),l=qg(r,i,n);let c;return r.selection.$anchor.sameParent(r.selection.$head)&&(c=r.selection.$anchor.parent.attrs),l?s.setNode(o,c):s.setNode(i,{...c,...n})},cut=(t,e={})=>({state:n,commands:r})=>{const s=Ms(t,n.schema);return qg(n,s,e)?r.lift(s):r.wrapIn(s,e)},uut=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const s=n[r];let i;if(s.spec.isInputRules&&(i=s.getState(t))){if(e){const o=t.tr,l=i.transform;for(let c=l.steps.length-1;c>=0;c-=1)o.step(l.steps[c].invert(l.docs[c]));if(i.text){const c=o.doc.resolve(i.from).marks();o.replaceWith(i.from,i.to,t.schema.text(i.text,c))}else o.delete(i.from,i.to)}return!0}}return!1},dut=(t={})=>({tr:e,dispatch:n,editor:r})=>{const{ignoreClearable:s=!1}=t,{selection:i}=e,{empty:o,ranges:l}=i;if(o)return!0;const{nonClearableMarks:c}=r.extensionManager;if(n){const u=Object.values(r.schema.marks).filter(d=>s||!c.includes(d.name));l.forEach(d=>{for(const h of u)e.removeMark(d.$from.pos,d.$to.pos,h)})}return!0},hut=(t,e={})=>({tr:n,state:r,dispatch:s})=>{var i;const{extendEmptyMarkRange:o=!1}=e,{selection:l}=n,c=mp(t,r.schema),{$from:u,empty:d,ranges:h}=l;if(!s)return!0;
vendor: 19,312 bytes, lines 1072-1090
1072if(d&&o){let{from:f,to:p}=l;const m=(i=u.marks().find(x=>x.type===c))==null?void 0:i.attrs,v=SK(u,c,m);v&&(f=v.from,p=v.to),n.removeMark(f,p,c)}else h.forEach(f=>{n.removeMark(f.$from.pos,f.$to.pos,c)});return n.removeStoredMark(c),!0},fut=t=>({tr:e,state:n,dispatch:r})=>{const{selection:s}=n;let i,o;return typeof t=="number"?(i=t,o=t):t&&"from"in t&&"to"in t?(i=t.from,o=t.to):(i=s.from,o=s.to),r&&e.doc.nodesBetween(i,o,(l,c)=>{if(l.isText)return;const u={...l.attrs};delete u.dir,e.setNodeMarkup(c,void 0,u)}),!0},put=(t,e={})=>({tr:n,state:r,dispatch:s})=>{let i=null,o=null;const l=b4(typeof t=="string"?t:t.name,r.schema);if(!l)return!1;l==="node"&&(i=Ms(t,r.schema)),l==="mark"&&(o=mp(t,r.schema));let c=!1;return n.selection.ranges.forEach(u=>{const d=u.$from.pos,h=u.$to.pos;let f,p,m,v;n.selection.empty?r.doc.nodesBetween(d,h,(x,g)=>{i&&i===x.type&&(c=!0,m=Math.max(g,d),v=Math.min(g+x.nodeSize,h),f=g,p=x)}):r.doc.nodesBetween(d,h,(x,g)=>{g<d&&i&&i===x.type&&(c=!0,m=Math.max(g,d),v=Math.min(g+x.nodeSize,h),f=g,p=x),g>=d&&g<=h&&(i&&i===x.type&&(c=!0,s&&n.setNodeMarkup(g,void 0,{...x.attrs,...e})),o&&x.marks.length&&x.marks.forEach(w=>{if(o===w.type&&(c=!0,s)){const _=Math.max(g,d),j=Math.min(g+x.nodeSize,h);n.addMark(_,j,o.create({...w.attrs,...e}))}}))}),p&&(f!==void 0&&s&&n.setNodeMarkup(f,void 0,{...p.attrs,...e}),o&&p.marks.length&&p.marks.forEach(x=>{o===x.type&&s&&n.addMark(m,v,o.create({...x.attrs,...e}))}))}),c},mut=(t,e={})=>({state:n,dispatch:r})=>{const s=Ms(t,n.schema);return zat(s,e)(n,r)},gut=(t,e={})=>({state:n,dispatch:r})=>{const s=Ms(t,n.schema);return Bat(s,e)(n,r)},vut=class{constructor(){this.callbacks={}}on(e,n){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(n),this}emit(e,...n){const r=this.callbacks[e];return r&&r.forEach(s=>s.apply(this,n)),this}off(e,n){const r=this.callbacks[e];return r&&(n?this.callbacks[e]=r.filter(s=>s!==n):delete this.callbacks[e]),this}once(e,n){const r=(...s)=>{this.off(e,r),n.apply(this,s)};return this.on(e,r)}removeAllListeners(){this.callbacks={}}};function xut(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof Dt){const i=r.index();return r.parent.canReplaceWith(i,i+1,e)}let s=r.depth;for(;s>=0;){const i=r.index(s);if(r.node(s).contentMatchAt(i).matchType(e))return!0;s-=1}return!1}function ZSe(t,e,n){const r=document.querySelector(`style[data-tiptap-style${n?`-${n}`:""}]`);if(r!==null)return r;const s=document.createElement("style");return e&&s.setAttribute("nonce",e),s.setAttribute(`data-tiptap-style${n?`-${n}`:""}`,""),s.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(s),s}function Kj(t,e){const n=t.getAttribute("style");if(!n)return null;const r=n.split(";").map(i=>i.trim()).filter(Boolean),s=e.toLowerCase();for(let i=r.length-1;i>=0;i-=1){const o=r[i],l=o.indexOf(":");if(l===-1)continue;if(o.slice(0,l).trim().toLowerCase()===s)return o.slice(l+1).trim()}return null}function yut(t){return typeof t=="number"}function but(t){return Object.prototype.toString.call(t).slice(8,-1)}function NP(t){return but(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}var wut={};_K(wut,{createAtomBlockMarkdownSpec:()=>eNe,createBlockMarkdownSpec:()=>_ut,createInlineMarkdownSpec:()=>Nut,parseAttributes:()=>AK,parseIndentedBlocks:()=>zq,renderNestedMarkdownContent:()=>TK,serializeAttributes:()=>EK});function AK(t){if(!(t!=null&&t.trim()))return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,u=>(n.push(u),`__QUOTED_${n.length-1}__`)),s=r.match(/(?:^|\s)\.([\w-]+)/g);if(s){const u=s.map(d=>d.trim().slice(1));e.class=u.join(" ")}const i=r.match(/(?:^|\s)#([\w-]+)/);i&&(e.id=i[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(o)).forEach(([,u,d])=>{var h;const f=parseInt(((h=d.match(/__QUOTED_(\d+)__/))==null?void 0:h[1])||"0",10),p=n[f];p&&(e[u]=p.slice(1,-1))});const c=r.replace(/(?:^|\s)\.([\w-]+)/g,"").replace(/(?:^|\s)#([\w-]+)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return c&&c.split(/\s+/).filter(Boolean).forEach(d=>{d.match(/^[a-zA-Z][\w-]*$/)&&(e[d]=!0)}),e}function EK(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?e.push(n):r!==!1&&r!=null&&e.push(`${n}="${String(r)}"`))}),e.join(" ")}function eNe(t){const{nodeName:e,name:n,parseAttributes:r=AK,serializeAttributes:s=EK,defaultAttributes:i={},requiredAttributes:o=[],allowedAttributes:l}=t,c=n||e,u=d=>{if(!l)return d;const h={};return l.forEach(f=>{f in d&&(h[f]=d[f])}),h};return{parseMarkdown:(d,h)=>{const f={...i,...d.attributes};return h.createNode(e,f,[])},markdownTokenizer:{name:e,level:"block",start(d){var h;const f=new RegExp(`^:::${c}(?:\\s|$)`,"m"),p=(h=d.match(f))==null?void 0:h.index;return p!==void 0?p:-1},tokenize(d,h,f){const p=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),m=d.match(p);if(!m)return;const v=m[1]||"",x=r(v);if(!o.find(w=>!(w in x)))return{type:e,raw:m[0],attributes:x}}},renderMarkdown:d=>{const h=u(d.attrs||{}),f=s(h),p=f?` {${f}}`:"";return`:::${c}${p} :::`}}}function _ut(t){const{nodeName:e,name:n,getContent:r,parseAttributes:s=AK,serializeAttributes:i=EK,defaultAttributes:o={},content:l="block",allowedAttributes:c}=t,u=n||e,d=h=>{if(!c)return h;const f={};return c.forEach(p=>{p in h&&(f[p]=h[p])}),f};return{parseMarkdown:(h,f)=>{let p;if(r){const v=r(h);p=typeof v=="string"?[{type:"text",text:v}]:v}else l==="block"?p=f.parseChildren(h.tokens||[]):p=f.parseInline(h.tokens||[]);const m={...o,...h.attributes};return f.createNode(e,m,p)},markdownTokenizer:{name:e,level:"block",start(h){var f;const p=new RegExp(`^:::${u}`,"m"),m=(f=h.match(p))==null?void 0:f.index;return m!==void 0?m:-1},tokenize(h,f,p){var m;const v=new RegExp(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),x=h.match(v);if(!x)return;const[g,w=""]=x,_=s(w);let j=1;const N=g.length;let S="";const C=/^:::([\w-]*)(\s.*)?/gm,k=h.slice(N);for(C.lastIndex=0;;){const E=C.exec(k);if(E===null)break;const P=E.index,T=E[1];if(!((m=E[2])!=null&&m.endsWith(":::"))){if(T)j+=1;else if(j-=1,j===0){const M=k.slice(0,P);S=M.trim();const R=h.slice(0,N+P+E[0].length);let A=[];if(S)if(l==="block")for(A=p.blockTokens(M),A.forEach(I=>{I.text&&(!I.tokens||I.tokens.length===0)&&(I.tokens=p.inlineTokens(I.text))});A.length>0;){const I=A[A.length-1];if(I.type==="paragraph"&&(!I.text||I.text.trim()===""))A.pop();else break}else A=p.inlineTokens(S);return{type:e,raw:R,attributes:_,content:S,tokens:A}}}}}},renderMarkdown:(h,f)=>{const p=d(h.attrs||{}),m=i(p),v=m?` {${m}}`:"",x=f.renderChildren(h.content||[],` 1073 1074`);return`:::${u}${v} 1075 1076${x} 1077 1078:::`}}}function jut(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,s,i,o]=r;e[s]=i||o,r=n.exec(t)}return e}function Sut(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function Nut(t){const{nodeName:e,name:n,getContent:r,parseAttributes:s=jut,serializeAttributes:i=Sut,defaultAttributes:o={},selfClosing:l=!1,allowedAttributes:c}=t,u=n||e,d=f=>{if(!c)return f;const p={};return c.forEach(m=>{const v=typeof m=="string"?m:m.name,x=typeof m=="string"?void 0:m.skipIfDefault;if(v in f){const g=f[v];if(x!==void 0&&g===x)return;p[v]=g}}),p},h=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(f,p)=>{const m={...o,...f.attributes};if(l)return p.createNode(e,m);const v=r?r(f):f.content||"";return v?p.createNode(e,m,[p.createTextNode(v)]):p.createNode(e,m,[])},markdownTokenizer:{name:e,level:"inline",start(f){const p=l?new RegExp(`\\[${h}\\s*[^\\]]*\\]`):new RegExp(`\\[${h}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${h}\\]`),m=f.match(p),v=m==null?void 0:m.index;return v!==void 0?v:-1},tokenize(f,p,m){const v=l?new RegExp(`^\\[${h}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${h}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${h}\\]`),x=f.match(v);if(!x)return;let g="",w="";if(l){const[,j]=x;w=j}else{const[,j,N]=x;w=j,g=N||""}const _=s(w.trim());return{type:e,raw:x[0],content:g.trim(),attributes:_}}},renderMarkdown:f=>{let p="";r?p=r(f):f.content&&f.content.length>0&&(p=f.content.filter(g=>g.type==="text").map(g=>g.text).join(""));const m=d(f.attrs||{}),v=i(m),x=v?` ${v}`:"";return l?`[${u}${x}]`:`[${u}${x}]${p}[/${u}]`}}}function zq(t,e,n){var r,s,i,o;const l=t.split(` 1079`),c=[];let u="",d=0;const h=e.baseIndentSize||2;for(;d<l.length;){const f=l[d],p=f.match(e.itemPattern);if(!p){if(c.length>0)break;if(f.trim()===""){d+=1,u=`${u}${f} 1080`;continue}else return}const m=e.extractItemData(p),{indentLevel:v,mainContent:x}=m;u=`${u}${f} 1081`;const g=[x];for(d+=1;d<l.length;){const N=l[d];if(N.trim()===""){const C=l.slice(d+1).findIndex(P=>P.trim()!=="");if(C===-1)break;if((((s=(r=l[d+1+C].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:s.length)||0)>v){g.push(N),u=`${u}${N} 1082`,d+=1;continue}else break}if((((o=(i=N.match(/^(\s*)/))==null?void 0:i[1])==null?void 0:o.length)||0)>v)g.push(N),u=`${u}${N} 1083`,d+=1;else break}let w;const _=g.slice(1);if(_.length>0){const N=_.map(S=>S.slice(v+h)).join(` 1084`);N.trim()&&(e.customNestedParser?w=e.customNestedParser(N):w=n.blockTokens(N))}const j=e.createToken(m,w);c.push(j)}if(c.length!==0)return{items:c,raw:u}}function TK(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const s=typeof n=="function"?n(r):n,[i,...o]=t.content,l=e.renderChildren([i]);let c=`${s}${l}`;return o&&o.length>0&&o.forEach((u,d)=>{var h,f;const p=(f=(h=e.renderChild)==null?void 0:h.call(e,u,d+1))!=null?f:e.renderChildren([u]);if(p!=null){const m=p.split(` 1085`).map(v=>v?e.indent(v):e.indent("")).join(` 1086`);c+=u.type==="paragraph"?` 1087 1088${m}`:` 1089${m}`}}),c}function tNe(t,e){const n={...t};return NP(t)&&NP(e)&&Object.keys(e).forEach(r=>{NP(e[r])&&NP(t[r])?n[r]=tNe(t[r],e[r]):n[r]=e[r]}),n}function Cut(t,e,n={}){const{state:r}=e,{doc:s,tr:i}=r,o=t;s.descendants((l,c)=>{const u=i.mapping.map(c),d=i.mapping.map(c)+l.nodeSize;let h=null;if(l.marks.forEach(p=>{if(p!==o)return!1;h=p}),!h)return;let f=!1;if(Object.keys(n).forEach(p=>{n[p]!==h.attrs[p]&&(f=!0)}),f){const p=t.type.create({...t.attrs,...n});i.removeMark(u,d,t.type),i.addMark(u,d,p)}}),i.docChanged&&e.view.dispatch(i)}var _4=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},kut=(t,e)=>{if(jK(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function CP(t){var e;const{editor:n,from:r,to:s,text:i,rules:o,plugin:l}=t,{view:c}=n;if(c.composing)return!1;const u=c.state.doc.resolve(r);if(u.parent.type.spec.code||(e=u.nodeBefore||u.nodeAfter)!=null&&e.marks.find(f=>f.type.spec.code))return!1;let d=!1;const h=qct(u)+i;return o.forEach(f=>{if(d)return;const p=kut(h,f.find);if(!p)return;const m=c.state.tr,v=x4({state:c.state,transaction:m}),x={from:r-(p[0].length-i.length),to:s},{commands:g,chain:w,can:_}=new y4({editor:n,state:v});f.handler({state:v,range:x,match:p,commands:g,chain:w,can:_})===null||!m.steps.length||(f.undoable&&m.setMeta(l,{transform:m,from:r,to:s,text:i}),c.dispatch(m),d=!0)}),d}function Aut(t){const{editor:e,rules:n}=t,r=new fr({state:{init(){return null},apply(s,i,o){const l=s.getMeta(r);if(l)return l;const c=s.getMeta("applyInputRules");return!!c&&setTimeout(()=>{let{text:d}=c;typeof d=="string"?d=d:d=CK(De.from(d),o.schema);const{from:h}=c,f=h+d.length;CP({editor:e,from:h,to:f,text:d,rules:n,plugin:r})}),s.selectionSet||s.docChanged?null:i}},props:{handleTextInput(s,i,o,l){return CP({editor:e,from:i,to:o,text:l,rules:n,plugin:r})},handleDOMEvents:{compositionend:s=>(setTimeout(()=>{const{$cursor:i}=s.state.selection;i&&CP({editor:e,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(s,i){if(i.key!=="Enter")return!1;const{$cursor:o}=s.state.selection;return o?CP({editor:e,from:o.pos,to:o.pos,text:` 1090`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}var PK=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...gn(jt(this,"addOptions",{name:this.name}))}}get storage(){return{...gn(jt(this,"addStorage",{name:this.name,options:this.options}))}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>tNe(this.options,t)});return e.name=this.name,e.parent=this.parent,this.child=null,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},gp=class nNe extends PK{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new nNe(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,s=e.state.selection.$from;if(s.pos===s.end()){const o=s.marks();if(!!!o.find(u=>(u==null?void 0:u.type.name)===n.name))return!1;const c=o.find(u=>(u==null?void 0:u.type.name)===n.name);return c&&r.removeStoredMark(c),r.insertText(" ",s.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},rNe=class{constructor(t){this.find=t.find,this.handler=t.handler}},Eut=(t,e,n)=>{if(jK(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(s=>{const i=[s.text];return i.index=s.index,i.input=t,i.data=s.data,s.replaceWith&&(s.text.includes(s.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(s.replaceWith)),i}):[]};function Tut(t){const{editor:e,state:n,from:r,to:s,rule:i,pasteEvent:o,dropEvent:l}=t,{commands:c,chain:u,can:d}=new y4({editor:e,state:n}),h=[];return n.doc.nodesBetween(r,s,(p,m)=>{var v,x,g,w,_;if((x=(v=p.type)==null?void 0:v.spec)!=null&&x.code||!(p.isText||p.isTextblock||p.isInline))return;const j=(_=(w=(g=p.content)==null?void 0:g.size)!=null?w:p.nodeSize)!=null?_:0,N=Math.max(r,m),S=Math.min(s,m+j);if(N>=S)return;const C=p.isText?p.text||"":p.textBetween(N-m,S-m,void 0,"");Eut(C,i.find,o).forEach(E=>{if(E.index===void 0)return;const P=N+E.index+1,T=P+E[0].length,M={from:n.tr.mapping.map(P),to:n.tr.mapping.map(T)},R=i.handler({state:n,range:M,match:E,commands:c,chain:u,can:d,pasteEvent:o,dropEvent:l});h.push(R)})}),h.every(p=>p!==null)}var kP=null,Put=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function Mut(t){const{editor:e,rules:n}=t;let r=null,s=!1,i=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const c=({state:d,from:h,to:f,rule:p,pasteEvt:m})=>{const v=d.tr,x=x4({state:d,transaction:v});if(!(!Tut({editor:e,state:x,from:Math.max(h-1,0),to:f.b-1,rule:p,pasteEvent:m,dropEvent:l})||!v.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,v}};return n.map(d=>new fr({view(h){const f=m=>{var v;r=(v=h.dom.parentElement)!=null&&v.contains(m.target)?h.dom.parentElement:null,r&&(kP=e)},p=()=>{kP&&(kP=null)};return window.addEventListener("dragstart",f),window.addEventListener("dragend",p),{destroy(){window.removeEventListener("dragstart",f),window.removeEventListener("dragend",p)}}},props:{handleDOMEvents:{drop:(h,f)=>{if(i=r===h.dom.parentElement,l=f,!i){const p=kP;p!=null&&p.isEditable&&setTimeout(()=>{const m=p.state.selection;m&&p.commands.deleteRange({from:m.from,to:m.to})},10)}return!1},paste:(h,f)=>{var p;const m=(p=f.clipboardData)==null?void 0:p.getData("text/html");return o=f,s=!!(m!=null&&m.includes("data-pm-slice")),!1}}},appendTransaction:(h,f,p)=>{const m=h[0],v=m.getMeta("uiEvent")==="paste"&&!s,x=m.getMeta("uiEvent")==="drop"&&!i,g=m.getMeta("applyPasteRules"),w=!!g;if(!v&&!x&&!w)return;if(w){let{text:N}=g;typeof N=="string"?N=N:N=CK(De.from(N),p.schema);const{from:S}=g,C=S+N.length,k=Put(N);return c({rule:d,state:p,from:S,to:{b:C},pasteEvt:k})}const _=f.doc.content.findDiffStart(p.doc.content),j=f.doc.content.findDiffEnd(p.doc.content);if(!(!yut(_)||!j||_===j.b))return c({rule:d,state:p,from:_,to:j,pasteEvt:o})}}))}var j4=class{constructor(t,e){this.splittableMarks=[],this.nonClearableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=VSe(t),this.schema=Dct(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:RS(e.name,this.schema)},r=jt(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return kC([...this.extensions].reverse()).flatMap(r=>{const s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:RS(r.name,this.schema)},i=[],o=jt(r,"addKeyboardShortcuts",s);let l={};if(r.type==="mark"&&jt(r,"exitable",s)&&(l.ArrowRight=()=>gp.handleExit({editor:t,mark:r})),o){const f=Object.fromEntries(Object.entries(o()).map(([p,m])=>[p,()=>m({editor:t})]));l={...l,...f}}const c=Llt(l);i.push(c);const u=jt(r,"addInputRules",s);if($re(r,t.options.enableInputRules)&&u){const f=u();if(f&&f.length){const p=Aut({editor:t,rules:f}),m=Array.isArray(p)?p:[p];i.push(...m)}}const d=jt(r,"addPasteRules",s);if($re(r,t.options.enablePasteRules)&&d){const f=d();if(f&&f.length){const p=Mut({editor:t,rules:f});i.push(...p)}}const h=jt(r,"addProseMirrorPlugins",s);if(h){const f=h();i.push(...f)}return i})}get attributes(){return qSe(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=sj(this.extensions);return Object.fromEntries(e.filter(n=>!!jt(n,"addNodeView")).map(n=>{const r=this.attributes.filter(c=>c.type===n.name),s={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Ms(n.name,this.schema)},i=jt(n,"addNodeView",s);if(!i)return[];const o=i();if(!o)return[];const l=(c,u,d,h,f)=>{const p=Fk(c,r);return o({node:c,view:u,getPos:d,decorations:h,innerDecorations:f,editor:t,extension:n,HTMLAttributes:p})};return[n.name,l]}))}dispatchTransaction(t){const{editor:e}=this;return kC([...this.extensions].reverse()).reduceRight((r,s)=>{const i={name:s.name,options:s.options,storage:this.editor.extensionStorage[s.name],editor:e,type:RS(s.name,this.schema)},o=jt(s,"dispatchTransaction",i);return o?l=>{o.call(i,{transaction:l,next:r})}:r},t)}transformPastedHTML(t){const{editor:e}=this;return kC([...this.extensions]).reduce((r,s)=>{const i={name:s.name,options:s.options,storage:this.editor.extensionStorage[s.name],editor:e,type:RS(s.name,this.schema)},o=jt(s,"transformPastedHTML",i);return o?(l,c)=>{const u=r(l,c);return o.call(i,u)}:r},t||(r=>r))}get markViews(){const{editor:t}=this,{markExtensions:e}=sj(this.extensions);return Object.fromEntries(e.filter(n=>!!jt(n,"addMarkView")).map(n=>{const r=this.attributes.filter(l=>l.type===n.name),s={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:mp(n.name,this.schema)},i=jt(n,"addMarkView",s);if(!i)return[];const o=(l,c,u)=>{const d=Fk(l,r);
1090return i()({mark:l,view:c,inline:u,editor:t,extension:n,HTMLAttributes:d,updateAttributes:h=>{Cut(l,t,h)}})};return[n.name,o]}))}destroy(){this.extensions.forEach(t=>{let e=t;for(;e.parent;){const n=e.parent;n.child===e&&(n.child=null),e=n}}),this.extensions=[],this.baseExtensions=[],this.schema=null,this.editor=null}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n,r;const s={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:RS(e.name,this.schema)};e.type==="mark"&&(((n=gn(jt(e,"keepOnSplit",s)))==null||n)&&this.splittableMarks.push(e.name),(r=gn(jt(e,"clearable",s)))==null||r||this.nonClearableMarks.push(e.name));const i=jt(e,"onBeforeCreate",s),o=jt(e,"onCreate",s),l=jt(e,"onUpdate",s),c=jt(e,"onSelectionUpdate",s),u=jt(e,"onTransaction",s),d=jt(e,"onFocus",s),h=jt(e,"onBlur",s),f=jt(e,"onDestroy",s);i&&this.editor.on("beforeCreate",i),o&&this.editor.on("create",o),l&&this.editor.on("update",l),c&&this.editor.on("selectionUpdate",c),u&&this.editor.on("transaction",u),d&&this.editor.on("focus",d),h&&this.editor.on("blur",h),f&&this.editor.on("destroy",f)})}};j4.resolve=VSe;j4.sort=kC;j4.flatten=NK;var Rut={};_K(Rut,{ClipboardTextSerializer:()=>iNe,Commands:()=>aNe,Delete:()=>oNe,Drop:()=>lNe,Editable:()=>cNe,FocusEvents:()=>dNe,Keymap:()=>hNe,Paste:()=>fNe,Tabindex:()=>pNe,TextDirection:()=>mNe,focusEventsPluginKey:()=>uNe});var En=class sNe extends PK{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new sNe(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},iNe=En.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new fr({key:new as("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:s}=e,i=WSe(n),{blockSeparator:o}=this.options,l={...o!==void 0?{blockSeparator:o}:{},textSerializers:i};return[...s.ranges].sort((u,d)=>u.$from.pos-d.$from.pos).map(({$from:u,$to:d})=>HSe(r,{from:u.pos,to:d.pos},l)).join(o??` 1091 1092`)}}})]}}),aNe=En.create({name:"commands",addCommands(){return{...RSe}}}),oNe=En.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,s;const i=()=>{var o,l,c,u;if((u=(c=(l=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:l.filterTransaction)==null?void 0:c.call(l,t))!=null?u:t.getMeta("y-sync$"))return;const d=zSe(t.before,[t,...e]);GSe(d).forEach(p=>{d.mapping.mapResult(p.oldRange.from).deletedAfter&&d.mapping.mapResult(p.oldRange.to).deletedBefore&&d.before.nodesBetween(p.oldRange.from,p.oldRange.to,(m,v)=>{const x=v+m.nodeSize-2,g=p.oldRange.from<=v&&x<=p.oldRange.to;this.editor.emit("delete",{type:"node",node:m,from:v,to:x,newFrom:d.mapping.map(v),newTo:d.mapping.map(x),deletedRange:p.oldRange,newRange:p.newRange,partial:!g,editor:this.editor,transaction:t,combinedTransform:d})})});const f=d.mapping;d.steps.forEach((p,m)=>{var v,x;if(p instanceof Hj){const g=f.slice(m).map(p.from,-1),w=f.slice(m).map(p.to),_=f.invert().map(g,-1),j=f.invert().map(w),N=g>0?(v=d.doc.nodeAt(g-1))==null?void 0:v.marks.some(C=>C.eq(p.mark)):!1,S=(x=d.doc.nodeAt(w))==null?void 0:x.marks.some(C=>C.eq(p.mark));this.editor.emit("delete",{type:"mark",mark:p.mark,from:p.from,to:p.to,deletedRange:{from:_,to:j},newRange:{from:g,to:w},partial:!!(S||N),editor:this.editor,transaction:t,combinedTransform:d})}})};(s=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||s?setTimeout(i,0):i()}}),lNe=En.create({name:"drop",addProseMirrorPlugins(){return[new fr({key:new as("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),cNe=En.create({name:"editable",addProseMirrorPlugins(){return[new fr({key:new as("editable"),props:{editable:()=>this.editor.options.editable}})]}}
vendor: 19,852 bytes, lines 1092-1164
1092),uNe=new as("focusEvents"),dNe=En.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new fr({key:uNe,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),hNe=En.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:l})=>{const{selection:c,doc:u}=l,{empty:d,$anchor:h}=c,{pos:f,parent:p}=h,m=h.parent.isTextblock&&f>0?l.doc.resolve(f-1):h,v=m.parent.type.spec.isolating,x=h.pos-h.parentOffset,g=v&&m.parent.childCount===1?x===h.pos:Ot.atStart(u).from===f;return!d||!p.type.isTextblock||p.textContent.length||!g||g&&h.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},s={...r},i={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return OI()||FSe()?i:s},addProseMirrorPlugins(){return[new fr({key:new as("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(v=>v.getMeta("composition")))return;const r=t.some(v=>v.docChanged)&&!e.doc.eq(n.doc),s=t.some(v=>v.getMeta("preventClearDocument"));if(!r||s)return;const{empty:i,from:o,to:l}=e.selection,c=Ot.atStart(e.doc).from,u=Ot.atEnd(e.doc).to;if(i||!(o===c&&l===u)||!$k(n.doc))return;const f=n.tr,p=x4({state:n,transaction:f}),{commands:m}=new y4({editor:this.editor,state:p});if(m.clearNodes(),!!f.steps.length)return f}})]}}),fNe=En.create({name:"paste",addProseMirrorPlugins(){return[new fr({key:new as("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),pNe=En.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new fr({key:new as("tabindex"),props:{attributes:()=>{var t;return!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:(t=this.options.value)!=null?t:"0"}}}})]}}),mNe=En.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=sj(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new fr({key:new as("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),Out=class zN{constructor(e,n,r=!1,s=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=s}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You canât set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new zN(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new zN(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new zN(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const s=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,o=n.isInline,l=this.pos+r+(i?0:1);if(l<0||l>this.resolvedPos.doc.nodeSize-2)return;const c=this.resolvedPos.doc.resolve(l);if(!s&&!o&&c.depth<=this.depth)return;const u=new zN(c,this.editor,s,s||o?n:null);s&&(u.actualDepth=this.depth+1),e.push(u)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,s=this.parent;for(;s&&!r;){if(s.node.type.name===e)if(Object.keys(n).length>0){const i=s.node.attrs,o=Object.keys(n);for(let l=0;l<o.length;l+=1){const c=o[l];if(i[c]!==n[c])break}}else r=s;s=s.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let s=[];if(!this.children||this.children.length===0)return s;const i=Object.keys(n);return this.children.forEach(o=>{r&&s.length>0||(o.node.type.name===e&&i.every(c=>n[c]===o.node.attrs[c])&&s.push(o),!(r&&s.length>0)&&(s=s.concat(o.querySelectorAll(e,n,r))))}),s}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},Iut=`.ProseMirror { 1093 position: relative; 1094} 1095 1096.ProseMirror { 1097 word-wrap: break-word; 1098 white-space: pre-wrap; 1099 white-space: break-spaces; 1100 -webkit-font-variant-ligatures: none; 1101 font-variant-ligatures: none; 1102 font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */ 1103} 1104 1105.ProseMirror [contenteditable="false"] { 1106 white-space: normal; 1107} 1108 1109.ProseMirror [contenteditable="false"] [contenteditable="true"] { 1110 white-space: pre-wrap; 1111} 1112 1113.ProseMirror pre { 1114 white-space: pre-wrap; 1115} 1116 1117img.ProseMirror-separator { 1118 display: inline !important; 1119 border: none !important; 1120 margin: 0 !important; 1121 width: 0 !important; 1122 height: 0 !important; 1123} 1124 1125.ProseMirror-gapcursor { 1126 display: none; 1127 pointer-events: none; 1128 position: absolute; 1129 margin: 0; 1130} 1131 1132.ProseMirror-gapcursor:after { 1133 content: ""; 1134 display: block; 1135 position: absolute; 1136 top: -2px; 1137 width: 20px; 1138 border-top: 1px solid black; 1139 animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite; 1140} 1141 1142@keyframes ProseMirror-cursor-blink { 1143 to { 1144 visibility: hidden; 1145 } 1146} 1147 1148.ProseMirror-hideselection *::selection { 1149 background: transparent; 1150} 1151 1152.ProseMirror-hideselection *::-moz-selection { 1153 background: transparent; 1154} 1155 1156.ProseMirror-hideselection * { 1157 caret-color: transparent; 1158} 1159 1160.ProseMirror-focused .ProseMirror-gapcursor { 1161 display: block; 1162}`,Dut=class extends vut{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:Kct,createMappablePosition:Gct},this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:s,moved:i})=>this.options.onDrop(r,s,i)),this.on("paste",({event:r,slice:s})=>this.options.onPaste(r,s)),this.on("delete",this.options.onDelete);const e=this.createDoc(),n=DSe(e,this.options.autofocus);this.editorState=pw.create({doc:e,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const t=this.editorView.dom;t!=null&&t.editor&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=ZSe(Iut,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){const n=USe(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(s=>{const i=typeof s=="string"?`${s}$`:s.key;n=n.filter(o=>!o.key.startsWith(i))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e,n,r;const i=[...this.options.enableCoreExtensions?[cNe,iNe.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),aNe,dNe,hNe,pNe.configure({value:(r=(n=this.options.coreExtensionOptions)==null?void 0:n.tabindex)==null?void 0:r.value}),lNe,fNe,oNe,mNe.configure({direction:this.options.textDirection})].filter(o=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[o.name]!==!1:!0):[],...this.options.extensions].filter(o=>["extension","node","mark"].includes(o==null?void 0:o.type));this.extensionManager=new j4(i,this)}createCommandManager(){this.commandManager=new y4({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=Fq(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(n=>n.name!=="collaboration"),this.createExtensionManager()}}),t=Fq(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return t}createView(t){const{editorProps:e,enableExtensionDispatchTransaction:n}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),s=n?this.extensionManager.dispatchTransaction(r):r,i=e.transformPastedHTML,o=this.extensionManager.transformPastedHTML(i);this.editorView=new MSe(t,{...e,attributes:{role:"textbox",...e==null?void 0:e.attributes},dispatchTransaction:s,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const l=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(l),this.prependClass(),this.injectCSS();const c=this.view.dom;c.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(u=>{var d;return(d=this.capturedTransaction)==null?void 0:d.step(u)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),s=n.includes(t),i=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!s)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const o=n.findLast(u=>u.getMeta("focus")||u.getMeta("blur")),l=o==null?void 0:o.getMeta("focus"),c=o==null?void 0:o.getMeta("blur");l&&this.emit("focus",{editor:this,event:l.event,transaction:o}),c&&this.emit("blur",{editor:this,event:c.event,transaction:o}),!(t.getMeta("preventUpdate")||!n.some(u=>u.docChanged)||i.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return KSe(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return Vct(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return CK(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=` 1163 1164`,textSerializers:n={}}=t||{};return Fct(this.state.doc,{blockSeparator:e,textSerializers:{...WSe(this.schema),...n}})}get isEmpty(){return $k(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit("destroy"),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){var t,e;return(e=(t=this.editorView)==null?void 0:t.isDestroyed)!=null?e:!0}$node(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t),n=t>0&&e.nodeAfter&&!e.nodeAfter.isText?e.nodeAfter:null;return new Out(e,this,!1,n)}get $doc(){return this.$pos(0)}};function p0(t){return new _4({find:t.find,handler:({state:e,range:n,match:r})=>{const s=gn(t.getAttributes,void 0,r);if(s===!1||s===null)return null;const{tr:i}=e,o=r[r.length-1],l=r[0];if(o){const c=l.search(/\S/),u=n.from+l.indexOf(o),d=u+o.length;if(kK(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(v=>v===t.type&&v!==p.mark.type)).filter(p=>p.to>u).length)return null;d<n.to&&i.delete(d,n.to),u>n.from&&i.delete(n.from+c,u);const f=n.from+c+o.length;i.addMark(n.from+c,f,t.type.create(s||{})),i.removeStoredMark(t.type)}},undoable:t.undoable})}function gNe(t){return new _4({find:t.find,handler:({state:e,range:n,match:r})=>{const s=gn(t.getAttributes,void 0,r)||{},{tr:i}=e,o=n.from;let l=n.to;const c=t.type.create(s);if(r[1]){const u=r[0].lastIndexOf(r[1]);let d=o+u;d>l?d=l:l=d+r[1].length;const h=r[0][r[0].length-1];i.insertText(h,o+r[0].length-1),i.replaceWith(d,l,c)}else if(r[0]){const u=t.type.isInline?o:o-1;i.insert(u,t.type.create(s)).delete(i.mapping.map(o),i.mapping.map(l))}i.scrollIntoView()},undoable:t.undoable})}function Bq(t){return new _4({find:t.find,handler:({state:e,range:n,match:r})=>{const s=e.doc.resolve(n.from),i=gn(t.getAttributes,void 0,r)||{};if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,i)},undoable:t.undoable})}function ij(t){return new _4({find:t.find,handler:({state:e,range:n,match:r,chain:s})=>{const i=gn(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),c=o.doc.resolve(n.from).blockRange(),u=c&&lK(c,t.type,i);if(!u)return null;if(o.wrap(c,u),t.keepMarks&&t.editor){const{selection:h,storedMarks:f}=e,{splittableMarks:p}=t.editor.extensionManager,m=f||h.$to.parentOffset&&h.$from.marks();if(m){const v=m.filter(x=>p.includes(x.type.name));o.ensureMarks(v)}}if(t.keepAttributes){const h=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";s().updateAttributes(h,i).run()}const d=o.doc.resolve(n.from-1).nodeBefore;d&&d.type===t.type&&ov(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,d))&&o.join(n.from-1)},undoable:t.undoable})}var Lut=t=>"touches"in t,Fut=class{constructor(t){this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=l=>{if(!this.isResizing||!this.activeHandle)return;const c=l.clientX-this.startX,u=l.clientY-this.startY;this.handleResize(c,u)},this.handleTouchMove=l=>{if(!this.isResizing||!this.activeHandle)return;const c=l.touches[0];if(!c)return;const u=c.clientX-this.startX,d=c.clientY-this.startY;this.handleResize(u,d)},this.handleMouseUp=()=>
1164{if(!this.isResizing)return;const l=this.element.offsetWidth,c=this.element.offsetHeight;this.onCommit(l,c),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)},this.handleKeyDown=l=>{l.key==="Shift"&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=l=>{l.key==="Shift"&&(this.isShiftKeyPressed=!1)};var e,n,r,s,i,o;this.node=t.node,this.editor=t.editor,this.element=t.element,this.element.draggable=!1,this.contentElement=t.contentElement,this.getPos=t.getPos,this.onResize=t.onResize,this.onCommit=t.onCommit,this.onUpdate=t.onUpdate,(e=t.options)!=null&&e.min&&(this.minSize={...this.minSize,...t.options.min}),(n=t.options)!=null&&n.max&&(this.maxSize=t.options.max),(r=t==null?void 0:t.options)!=null&&r.directions&&(this.directions=t.options.directions),(s=t.options)!=null&&s.preserveAspectRatio&&(this.preserveAspectRatio=t.options.preserveAspectRatio),(i=t.options)!=null&&i.className&&(this.classNames={container:t.options.className.container||"",wrapper:t.options.className.wrapper||"",handle:t.options.className.handle||"",resizing:t.options.className.resizing||""}),(o=t.options)!=null&&o.createCustomHandle&&(this.createCustomHandle=t.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on("update",this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){var t;return(t=this.contentElement)!=null?t:null}handleEditorUpdate(){const t=this.editor.isEditable;t!==this.lastEditableState&&(this.lastEditableState=t,t?t&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(t,e,n){return t.type!==this.node.type?!1:(this.node=t,this.onUpdate?this.onUpdate(t,e,n):!0)}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off("update",this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){const t=document.createElement("div");return t.dataset.resizeContainer="",t.dataset.node=this.node.type.name,t.style.display=this.node.type.isInline?"inline-flex":"flex",this.classNames.container&&(t.className=this.classNames.container),t.appendChild(this.wrapper),t}createWrapper(){const t=document.createElement("div");return t.style.position="relative",t.style.display="block",t.dataset.resizeWrapper="",this.classNames.wrapper&&(t.className=this.classNames.wrapper),t.appendChild(this.element),t}createHandle(t){const e=document.createElement("div");return e.dataset.resizeHandle=t,e.style.position="absolute",this.classNames.handle&&(e.className=this.classNames.handle),e}positionHandle(t,e){const n=e.includes("top"),r=e.includes("bottom"),s=e.includes("left"),i=e.includes("right");n&&(t.style.top="0"),r&&(t.style.bottom="0"),s&&(t.style.left="0"),i&&(t.style.right="0"),(e==="top"||e==="bottom")&&(t.style.left="0",t.style.right="0"),(e==="left"||e==="right")&&(t.style.top="0",t.style.bottom="0")}attachHandles(){this.directions.forEach(t=>{let e;this.createCustomHandle?e=this.createCustomHandle(t):e=this.createHandle(t),e instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${t}") did not return an HTMLElement. Falling back to default handle.`),e=this.createHandle(t)),this.createCustomHandle||this.positionHandle(e,t),e.addEventListener("mousedown",n=>this.handleResizeStart(n,t)),e.addEventListener("touchstart",n=>this.handleResizeStart(n,t)),this.handleMap.set(t,e),this.wrapper.appendChild(e)})}
1164removeHandles(){this.handleMap.forEach(t=>t.remove()),this.handleMap.clear()}applyInitialSize(){const t=this.node.attrs.width,e=this.node.attrs.height;t?(this.element.style.width=`${t}px`,this.initialWidth=t):this.initialWidth=this.element.offsetWidth,e?(this.element.style.height=`${e}px`,this.initialHeight=e):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(t,e){t.preventDefault(),t.stopPropagation(),this.isResizing=!0,this.activeHandle=e,Lut(t)?(this.startX=t.touches[0].clientX,this.startY=t.touches[0].clientY):(this.startX=t.clientX,this.startY=t.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(t,e){if(!this.activeHandle)return;const n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:s}=this.calculateNewDimensions(this.activeHandle,t,e),i=this.applyConstraints(r,s,n);this.element.style.width=`${i.width}px`,this.element.style.height=`${i.height}px`,this.onResize&&this.onResize(i.width,i.height)}calculateNewDimensions(t,e,n){let r=this.startWidth,s=this.startHeight;const i=t.includes("right"),o=t.includes("left"),l=t.includes("bottom"),c=t.includes("top");return i?r=this.startWidth+e:o&&(r=this.startWidth-e),l?s=this.startHeight+n:c&&(s=this.startHeight-n),(t==="right"||t==="left")&&(r=this.startWidth+(i?e:-e)),(t==="top"||t==="bottom")&&(s=this.startHeight+(l?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,s,t):{width:r,height:s}}applyConstraints(t,e,n){var r,s,i,o;if(!n){let u=Math.max(this.minSize.width,t),d=Math.max(this.minSize.height,e);return(r=this.maxSize)!=null&&r.width&&(u=Math.min(this.maxSize.width,u)),(s=this.maxSize)!=null&&s.height&&(d=Math.min(this.maxSize.height,d)),{width:u,height:d}}let l=t,c=e;return l<this.minSize.width&&(l=this.minSize.width,c=l/this.aspectRatio),c<this.minSize.height&&(c=this.minSize.height,l=c*this.aspectRatio),(i=this.maxSize)!=null&&i.width&&l>this.maxSize.width&&(l=this.maxSize.width,c=l/this.aspectRatio),(o=this.maxSize)!=null&&o.height&&c>this.maxSize.height&&(c=this.maxSize.height,l=c*this.aspectRatio),{width:l,height:c}}applyAspectRatio(t,e,n){const r=n==="left"||n==="right",s=n==="top"||n==="bottom";return r?{width:t,height:t/this.aspectRatio}:s?{width:e*this.aspectRatio,height:e}:{width:t,height:t/this.aspectRatio}}},Rs=class vNe extends PK{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new vNe(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function Vg(t){return new rNe({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:s})=>{const i=gn(t.getAttributes,void 0,r,s);if(i===!1||i===null)return null;const{tr:o}=e,l=r[r.length-1],c=r[0];let u=n.to;if(l){const d=c.search(/\S/),h=n.from+c.indexOf(l),f=h+l.length;if(kK(n.from,n.to,e.doc).filter(v=>v.mark.type.excluded.find(g=>g===t.type&&g!==v.mark.type)).filter(v=>v.to>h).length)return null;f<n.to&&o.delete(f,n.to),h>n.from&&o.delete(n.from+d,h),u=n.from+d+l.length,o.addMark(n.from+d,u,t.type.create(i||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(t.type)}}})}function $ut(t){return new rNe({find:t.find,handler({match:e,chain:n,range:r,pasteEvent:s}){const i=gn(t.getAttributes,void 0,e,s),o=gn(t.getContent,void 0,i);if(i===!1||i===null)return null;const l={type:t.type.name,attrs:i};o&&(l.content=o),e.input&&n().deleteRange(r).insertContentAt(r.from,l)}})}const{getOwnPropertyNames:zut,getOwnPropertySymbols:But}=Object,{hasOwnProperty:Uut}=Object.prototype;function hz(t,e){return function(r,s,i){return t(r,s,i)&&e(r,s,i)}}function AP(t){return function(n,r,s){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,s);const{cache:i}
1164=s,o=i.get(n),l=i.get(r);if(o&&l)return o===r&&l===n;i.set(n,r),i.set(r,n);const c=t(n,r,s);return i.delete(n),i.delete(r),c}}function qut(t){return t!=null?t[Symbol.toStringTag]:void 0}function Ure(t){return zut(t).concat(But(t))}const Vut=Object.hasOwn||((t,e)=>Uut.call(t,e));function F0(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const Hut="__v",Wut="__o",Kut="_owner",{getOwnPropertyDescriptor:qre,keys:Vre}=Object;function Gut(t,e){return t.byteLength===e.byteLength&&II(new Uint8Array(t),new Uint8Array(e))}function Yut(t,e,n){let r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function Xut(t,e){return t.byteLength===e.byteLength&&II(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function Jut(t,e){return F0(t.getTime(),e.getTime())}function Qut(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function Zut(t,e){return t===e}function Hre(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const s=new Array(r),i=t.entries();let o,l,c=0;for(;(o=i.next())&&!o.done;){const u=e.entries();let d=!1,h=0;for(;(l=u.next())&&!l.done;){if(s[h]){h++;continue}const f=o.value,p=l.value;if(n.equals(f[0],p[0],c,h,t,e,n)&&n.equals(f[1],p[1],f[0],p[0],t,e,n)){d=s[h]=!0;break}h++}if(!d)return!1;c++}return!0}const edt=F0;function tdt(t,e,n){const r=Vre(t);let s=r.length;if(Vre(e).length!==s)return!1;for(;s-- >0;)if(!xNe(t,e,n,r[s]))return!1;return!0}function OS(t,e,n){const r=Ure(t);let s=r.length;if(Ure(e).length!==s)return!1;let i,o,l;for(;s-- >0;)if(i=r[s],!xNe(t,e,n,i)||(o=qre(t,i),l=qre(e,i),(o||l)&&(!o||!l||o.configurable!==l.configurable||o.enumerable!==l.enumerable||o.writable!==l.writable)))return!1;return!0}function ndt(t,e){return F0(t.valueOf(),e.valueOf())}function rdt(t,e){return t.source===e.source&&t.flags===e.flags}function Wre(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const s=new Array(r),i=t.values();let o,l;for(;(o=i.next())&&!o.done;){const c=e.values();let u=!1,d=0;for(;(l=c.next())&&!l.done;){if(!s[d]&&n.equals(o.value,l.value,o.value,l.value,t,e,n)){u=s[d]=!0;break}d++}if(!u)return!1}return!0}function II(t,e){let n=t.byteLength;if(e.byteLength!==n||t.byteOffset!==e.byteOffset)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function sdt(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function xNe(t,e,n,r){return(r===Kut||r===Wut||r===Hut)&&(t.$$typeof||e.$$typeof)?!0:Vut(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const idt="[object ArrayBuffer]",adt="[object Arguments]",odt="[object Boolean]",ldt="[object DataView]",cdt="[object Date]",udt="[object Error]",ddt="[object Map]",hdt="[object Number]",fdt="[object Object]",pdt="[object RegExp]",mdt="[object Set]",gdt="[object String]",vdt={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},xdt="[object URL]",ydt=Object.prototype.toString;function bdt({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:s,areFunctionsEqual:i,areMapsEqual:o,areNumbersEqual:l,areObjectsEqual:c,arePrimitiveWrappersEqual:u,areRegExpsEqual:d,areSetsEqual:h,areTypedArraysEqual:f,areUrlsEqual:p,unknownTagComparators:m}){return function(x,g,w){if(x===g)return!0;if(x==null||g==null)return!1;const _=typeof x;if(_!==typeof g)return!1;if(_!=="object")return _==="number"?l(x,g,w):_==="function"?i(x,g,w):!1;const j=x.constructor;if(j!==g.constructor)return!1;if(j===Object)return c(x,g,w);if(Array.isArray(x))return e(x,g,w);if(j===Date)return r(x,g,w);if(j===RegExp)return d(x,g,w);if(j===Map)return o(x,g,w);if(j===Set)return h(x,g,w);const N=ydt.call(x);if(N===cdt)return r(x,g,w);if(N===pdt)return d(x,g,w);if(N===ddt)return o(x,g,w);if(N===mdt)return h(x,g,w);if(N===fdt)return typeof x.then!="function"&&typeof g.then!="function"&&c(x,g,w);if(N===xdt)return p(x,g,w);if(N===udt)return s(x,g,w);if(N===adt)return c(x,g,w);if(vdt[N])return f(x,g,w);if(N===idt)return t(x,g,w);if(N===ldt)return n(x,g,w);
1164if(N===odt||N===hdt||N===gdt)return u(x,g,w);if(m){let S=m[N];if(!S){const C=qut(x);C&&(S=m[C])}if(S)return S(x,g,w)}return!1}}function wdt({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:Gut,areArraysEqual:n?OS:Yut,areDataViewsEqual:Xut,areDatesEqual:Jut,areErrorsEqual:Qut,areFunctionsEqual:Zut,areMapsEqual:n?hz(Hre,OS):Hre,areNumbersEqual:edt,areObjectsEqual:n?OS:tdt,arePrimitiveWrappersEqual:ndt,areRegExpsEqual:rdt,areSetsEqual:n?hz(Wre,OS):Wre,areTypedArraysEqual:n?hz(II,OS):II,areUrlsEqual:sdt,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const s=AP(r.areArraysEqual),i=AP(r.areMapsEqual),o=AP(r.areObjectsEqual),l=AP(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:s,areMapsEqual:i,areObjectsEqual:o,areSetsEqual:l})}return r}function _dt(t){return function(e,n,r,s,i,o,l){return t(e,n,l)}}function jdt({circular:t,comparator:e,createState:n,equals:r,strict:s}){if(n)return function(l,c){const{cache:u=t?new WeakMap:void 0,meta:d}=n();return e(l,c,{cache:u,equals:r,meta:d,strict:s})};if(t)return function(l,c){return e(l,c,{cache:new WeakMap,equals:r,meta:void 0,strict:s})};const i={cache:void 0,equals:r,meta:void 0,strict:s};return function(l,c){return e(l,c,i)}}const Sdt=cv();cv({strict:!0});cv({circular:!0});cv({circular:!0,strict:!0});cv({createInternalComparator:()=>F0});cv({strict:!0,createInternalComparator:()=>F0});cv({circular:!0,createInternalComparator:()=>F0});cv({circular:!0,createInternalComparator:()=>F0,strict:!0});function cv(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:s=!1}=t,i=wdt(t),o=bdt(i),l=n?n(o):_dt(o);return jdt({circular:e,comparator:o,createState:r,equals:l,strict:s})}var yNe={exports:{}},bNe={};/** 1165 * @license React 1166 * use-sync-external-store-shim/with-selector.production.js 1167 * 1168 * Copyright (c) Meta Platforms, Inc. and affiliates. 1169 * 1170 * This source code is licensed under the MIT license found in the 1171 * LICENSE file in the root directory of this source tree. 1172 */var S4=b,Ndt=q3;function Cdt(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var kdt=typeof Object.is=="function"?Object.is:Cdt,Adt=Ndt.useSyncExternalStore,Edt=S4.useRef,Tdt=S4.useEffect,Pdt=S4.useMemo,Mdt=S4.useDebugValue;bNe.useSyncExternalStoreWithSelector=function(t,e,n,r,s){var i=Edt(null);if(i.current===null){var o={hasValue:!1,value:null};i.current=o}else o=i.current;i=Pdt(function(){function c(p){if(!u){if(u=!0,d=p,p=r(p),s!==void 0&&o.hasValue){var m=o.value;if(s(m,p))return h=m}return h=p}if(m=h,kdt(d,p))return m;var v=r(p);return s!==void 0&&s(m,v)?(d=p,m):(d=p,h=v)}var u=!1,d,h,f=n===void 0?null:n;return[function(){return c(e())},f===null?void 0:function(){return c(f())}]},[e,n,r,s]);var l=Adt(t,i[0],i[1]);return Tdt(function(){o.hasValue=!0,o.value=l},[l]),Mdt(l),l};yNe.exports=bNe;var wNe=yNe.exports,Rdt=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},Odt=({contentComponent:t})=>{const e=q3.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return a.jsx(a.Fragment,{children:Object.values(e)})};function Idt(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,r){e={...e,[n]:dW.createPortal(r.reactElement,r.element,n)},t.forEach(s=>s())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(s=>s())}}}var Ddt=class extends ve.Component{constructor(t){super(t),this.editorContentRef=ve.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const e=this.props.editor;if(e&&!e.isDestroyed&&((t=e.view.dom)!=null&&t.parentNode)){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n}),e.contentComponent=Idt(),e.createNodeViews(),e.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){var t;const e=this.props.editor;if(e){e.isEditorContentInitialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),e.contentComponent=null;try{if(!((t=e.view.dom)!=null&&t.parentNode))return;const n=document.createElement("div");n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return a.jsxs(a.Fragment,{children:[a.jsx("div",{ref:Rdt(e,this.editorContentRef),...n}),(t==null?void 0:t.contentComponent)&&a.jsx(Odt,{contentComponent:t.contentComponent})]})}},Ldt=b.forwardRef((t,e)=>{const n=ve.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return ve.createElement(Ddt,{key:n,innerRef:e,...t})}),_Ne=ve.memo(Ldt),Fdt=typeof window<"u"?b.useLayoutEffect:b.useEffect,$dt=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0}
1172,this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},n=this.editor;return n.on("transaction",e),()=>{n.off("transaction",e)}}}};function zdt(t){var e;const[n]=b.useState(()=>new $dt(t.editor)),r=wNe.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:Sdt);return Fdt(()=>n.watch(t.editor),[t.editor,n]),b.useDebugValue(r),r}var Bdt=!1,jNe=typeof window>"u",Udt=jNe||!!(typeof window<"u"&&window.next),qdt=class SNe{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){const e=this.options.current.immediatelyRender;let n=e??!0;
1172return jNe?(n&&Bdt&&console.warn("SSR detected. `immediatelyRender` has been set to false to avoid hydration mismatches"),n=!1):Udt&&e===void 0&&(n=!1),n?this.createEditor():null}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var s,i;return(i=(s=this.options.current).onBeforeCreate)==null?void 0:i.call(s,...r)},onBlur:(...r)=>{var s,i;return(i=(s=this.options.current).onBlur)==null?void 0:i.call(s,...r)},onCreate:(...r)=>{var s,i;return(i=(s=this.options.current).onCreate)==null?void 0:i.call(s,...r)},onDestroy:(...r)=>{var s,i;return(i=(s=this.options.current).onDestroy)==null?void 0:i.call(s,...r)},onFocus:(...r)=>{var s,i;return(i=(s=this.options.current).onFocus)==null?void 0:i.call(s,...r)},onSelectionUpdate:(...r)=>{var s,i;return(i=(s=this.options.current).onSelectionUpdate)==null?void 0:i.call(s,...r)},onTransaction:(...r)=>{var s,i;return(i=(s=this.options.current).onTransaction)==null?void 0:i.call(s,...r)},onUpdate:(...r)=>{var s,i;return(i=(s=this.options.current).onUpdate)==null?void 0:i.call(s,...r)},onContentError:(...r)=>{var s,i;return(i=(s=this.options.current).onContentError)==null?void 0:i.call(s,...r)},onDrop:(...r)=>{var s,i;return(i=(s=this.options.current).onDrop)==null?void 0:i.call(s,...r)},onPaste:(...r)=>{var s,i;return(i=(s=this.options.current).onPaste)==null?void 0:i.call(s,...r)},onDelete:(...r)=>{var s,i;return(i=(s=this.options.current).onDelete)==null?void 0:i.call(s,...r)}};return new Dut(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((s,i)=>{var o;return s===((o=n.extensions)==null?void 0:o[i])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?SNe.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,s)=>r===e[s]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function Vdt(t={},e=[]){const n=b.useRef(t);n.current=t;const[r]=b.useState(()=>new qdt(n)),s=q3.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return b.useDebugValue(s),b.useEffect(r.onRender(e)),zdt({editor:s,selector:({transactionNumber:i})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&i===0?0:i+1}),s}var NNe=b.createContext({editor:null});NNe.Consumer;var Hdt=b.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),Wdt=()=>b.useContext(Hdt);ve.forwardRef((t,e)=>{const{onDragStart:n}=Wdt(),r=t.as||"div";return a.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});ve.createContext({markViewContentRef:()=>{}});var MK=b.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});MK.displayName="TiptapContext";var Kdt=()=>b.useContext(MK);function CNe({editor:t,instance:e,children:n}){const r=t??e;if(!r)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const s=b.useMemo(()=>({editor:r}),[r]),i=b.useMemo(()=>({editor:r}),[r]);return a.jsx(NNe.Provider,{value:i,children:a.jsx(MK.Provider,{value:s,children:n})})}CNe.displayName="Tiptap";function kNe({...t}){const{editor:e}=Kdt();return a.jsx(_Ne,{editor:e,...t})}kNe.displayName="Tiptap.Content";Object.assign(CNe,{Content:kNe});var DI=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,r,n]};function ANe(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let s=t.child(r),i=e.child(r);if(s==i){n+=s.nodeSize;continue}if(!s.sameMarkup(i))return n;if(s.isText&&s.text!=i.text){for(let o=0;s.text[o]==i.text[o];o++)n++;return n}if(s.content.size||i.content.size){let o=ANe(s.content,i.content,n+1);if(o!=null)return o}n+=s.nodeSize}}function ENe(t,e,n,r){for(let s=t.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:n,b:r};let o=t.child(--s),l=e.child(--i),c=o.nodeSize;if(o==l){n-=c,r-=c;continue}if(!o.sameMarkup(l))return{a:n,b:r};if(o.isText&&o.text!=l.text){let u=0,d=Math.min(o.text.length,l.text.length);for(;u<d&&o.text[o.text.length-u-1]==l.text[l.text.length-u-1];)u++,n--,r--;return{a:n,b:r}}if(o.content.size||l.content.size){let u=ENe(o.content,l.content,n-1,r-1);if(u)return u}n-=c,r-=c}}var np=class Ha{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,s=0,i){for(let o=0,l=0;l<n;o++){let c=this.content[o],u=l+c.nodeSize;if(u>e&&r(c,s+l,i||null,o)!==!1&&c.content.size){let d=l+1;c.nodesBetween(Math.max(0,e-d),Math.min(c.content.size,n-d),r,s+d)}l=u}}descendants(e){this.nodesBetween(0,this.size,e)}
vendor: 25,625 bytes, lines 1172-1176
1172textBetween(e,n,r,s){let i="",o=!0;return this.nodesBetween(e,n,(l,c)=>{let u=l.isText?l.text.slice(Math.max(e,c)-c,n-c):l.isLeaf?s?typeof s=="function"?s(l):s:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&u||l.isTextblock)&&r&&(o?o=!1:i+=r),i+=u},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(s[s.length-1]=n.withText(n.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new Ha(s,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],s=0;if(n>e)for(let i=0,o=0;o<n;i++){let l=this.content[i],c=o+l.nodeSize;c>e&&((o<e||c>n)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,n-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,n-o-1))),r.push(l),s+=l.nodeSize),o=c}return new Ha(r,s)}cutByIndex(e,n){return e==n?Ha.empty:e==0&&n==this.content.length?this:new Ha(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let s=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return s[e]=n,new Ha(s,i)}addToStart(e){return new Ha([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Ha(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let s=this.content[n];e(s,r,n),r+=s.nodeSize}}findDiffStart(e,n=0){return ANe(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return ENe(this,e,n,r)}findIndex(e){if(e==0)return EP(0,e);if(e==this.size)return EP(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let s=this.child(n),i=r+s.nodeSize;if(i>=e)return i==e?EP(n+1,i):EP(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return Ha.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return Ha.fromArray(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Ha.empty;let n,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(n||(n=e.slice(0,s)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new Ha(n||e,r)}static from(e){if(!e)return Ha.empty;if(e instanceof Ha)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new Ha([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};np.empty=new np([],0);var fz={index:0,offset:0};function EP(t,e){return fz.index=t,fz.offset=e,fz}var Gdt=class extends Error{},Ns=class Ub{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=PNe(this.content,e+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new Ub(r,this.openStart,this.openEnd)}removeBetween(e,n){return new Ub(TNe(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return Ub.empty;let r=n.openStart||0,s=n.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Ub(np.fromJSON(e,n.content),r,s)}static maxOpen(e,n=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)s++;return new Ub(e,r,s)}};Ns.empty=new Ns(np.empty,0,0);function TNe(t,e,n){let{index:r,offset:s}=t.findIndex(e),i=t.maybeChild(r),{index:o,offset:l}=t.findIndex(n);if(s==e||i.isText){if(l!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(TNe(i.content,e-s-1,n-s-1)))}function PNe(t,e,n,r,s,i){let{index:o,offset:l}=t.findIndex(e),c=t.maybeChild(o);if(l==e||c.isText)return i&&r<=0&&s<=0&&!i.canReplace(o,o,n)?null:t.cut(0,e).append(n).append(t.cut(e));let u=PNe(c.content,e-l-1,n,o==0?r-1:0,o==t.childCount-1?s-1:0,c);return u&&t.replaceChild(o,c.copy(u))}var MNe=65535,RNe=Math.pow(2,16);function Ydt(t,e){return t+e*RNe}function Kre(t){return t&MNe}function Xdt(t){return(t-(t&MNe))/RNe}var ONe=1,INe=2,RR=4,DNe=8,Gre=class{constructor(t,e,n){this.pos=t,this.delInfo=e,this.recover=n}get deleted(){return(this.delInfo&DNe)>0}get deletedBefore(){return(this.delInfo&(ONe|RR))>0}get deletedAfter(){return(this.delInfo&(INe|RR))>0}get deletedAcross(){return(this.delInfo&RR)>0}},m0=class qb{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&qb.empty)return qb.empty}recover(e){let n=0,r=Kre(e);if(!this.inverted)for(let s=0;s<r;s++)n+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+n+Xdt(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let s=0,i=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let c=this.ranges[l]-(this.inverted?s:0);if(c>e)break;let u=this.ranges[l+i],d=this.ranges[l+o],h=c+u;if(e<=h){let f=u?e==c?-1:e==h?1:n:n,p=c+s+(f<0?0:d);if(r)return p;let m=e==(n<0?c:h)?null:Ydt(l/3,e-c),v=e==c?INe:e==h?ONe:RR;return(n<0?e!=c:e!=h)&&(v|=DNe),new Gre(p,v,m)}s+=d-u}return r?e+s:new Gre(e+s,0,null)}touches(e,n){let r=0,s=Kre(n),i=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let c=this.ranges[l]-(this.inverted?r:0);if(c>e)break;let u=this.ranges[l+i],d=c+u;if(e<=d&&l==s*3)return!0;r+=this.ranges[l+o]-u}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,i=0;s<this.ranges.length;s+=3){let o=this.ranges[s],l=o-(this.inverted?i:0),c=o+(this.inverted?0:i),u=this.ranges[s+n],d=this.ranges[s+r];e(l,l+u,c,c+d),i+=d-u}}invert(){return new qb(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?qb.empty:new qb(e<0?[0,-e,0]:[0,0,e])}};m0.empty=new m0([]);var pz=Object.create(null),$a=class{getMap(){return m0.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=pz[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in pz)throw new RangeError("Duplicate use of step JSON ID "+e);return pz[e]=n,n.prototype.jsonID=e,n}},io=class BN{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new BN(e,null)}static fail(e){return new BN(null,e)}static fromReplace(e,n,r,s){try{return BN.ok(e.replace(n,r,s))}catch(i){if(i instanceof Gdt)return BN.fail(i.message);throw i}}};function RK(t,e,n){let r=[];for(let s=0;s<t.childCount;s++){let i=t.child(s);i.content.size&&(i=i.copy(RK(i.content,e,i))),i.isInline&&(i=e(i,n,s)),r.push(i)}return np.fromArray(r)}var LNe=class UN extends $a{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),s=r.node(r.sharedDepth(this.to)),i=new Ns(RK(n.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),s),n.openStart,n.openEnd);return io.fromReplace(e,this.from,this.to,i)}invert(){return new FNe(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new UN(n.pos,r.pos,this.mark)}merge(e){return e instanceof UN&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new UN(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new UN(n.from,n.to,e.markFromJSON(n.mark))}};$a.jsonID("addMark",LNe);var FNe=class qN extends $a{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new Ns(RK(n.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),n.openStart,n.openEnd);return io.fromReplace(e,this.from,this.to,r)}invert(){return new LNe(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new qN(n.pos,r.pos,this.mark)}merge(e){return e instanceof qN&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new qN(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new qN(n.from,n.to,e.markFromJSON(n.mark))}};$a.jsonID("removeMark",FNe);var $Ne=class VN extends $a{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return io.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return io.fromReplace(e,this.pos,this.pos+1,new Ns(np.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let s=0;s<n.marks.length;s++)if(!n.marks[s].isInSet(r))return new VN(this.pos,n.marks[s]);return new VN(this.pos,this.mark)}}return new zNe(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new VN(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new VN(n.pos,e.markFromJSON(n.mark))}};$a.jsonID("addNodeMark",$Ne);var zNe=class Uq extends $a{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return io.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return io.fromReplace(e,this.pos,this.pos+1,new Ns(np.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new $Ne(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Uq(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Uq(n.pos,e.markFromJSON(n.mark))}};$a.jsonID("removeNodeMark",zNe);var OK=class Up extends $a{constructor(e,n,r,s=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=s}apply(e){return this.structure&&qq(e,this.from,this.to)?io.fail("Structure replace would overwrite content"):io.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new m0([this.from,this.to-this.from,this.slice.size])}invert(e){return new Up(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.to,-1),r=this.from==this.to&&Up.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new Up(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Up)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?Ns.empty:new Ns(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Up(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?Ns.empty:new Ns(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Up(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Up(n.from,n.to,Ns.fromJSON(e,n.slice),!!n.structure)}};OK.MAP_BIAS=1;$a.jsonID("replace",OK);var BNe=class OR extends $a{constructor(e,n,r,s,i,o,l=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=s,this.slice=i,this.insert=o,this.structure=l}apply(e){if(this.structure&&(qq(e,this.from,this.gapFrom)||qq(e,this.gapTo,this.to)))return io.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return io.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?io.fromReplace(e,this.from,this.to,r):io.fail("Content does not fit in gap")}getMap(){return new m0([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new OR(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),s=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||s<n.pos||i>r.pos?null:new OR(n.pos,r.pos,s,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new OR(n.from,n.to,n.gapFrom,n.gapTo,Ns.fromJSON(e,n.slice),n.insert,!!n.structure)}};$a.jsonID("replaceAround",BNe);function qq(t,e,n){let r=t.resolve(e),s=n-e,i=r.depth;for(;s>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,s--;if(s>0){let o=r.node(i).maybeChild(r.indexAfter(i));for(;s>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,s--}}return!1}var Jdt=class IR extends $a{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return io.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let s=n.type.create(r,null,n.marks);return io.fromReplace(e,this.pos,this.pos+1,new Ns(np.from(s),0,n.isLeaf?0:1))}getMap(){return m0.empty}invert(e){return new IR(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new IR(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new IR(n.pos,n.attr,n.value)}};$a.jsonID("attr",Jdt);var Qdt=class Vq extends $a{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let s in e.attrs)n[s]=e.attrs[s];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return io.ok(r)}getMap(){return m0.empty}invert(e){return new Vq(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Vq(n.attr,n.value)}};$a.jsonID("docAttr",Qdt);var zk=class extends Error{};zk=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};zk.prototype=Object.create(Error.prototype);zk.prototype.constructor=zk;zk.prototype.name="TransformError";var mz=Object.create(null),pi=class{constructor(t,e,n){this.$anchor=t,this.$head=e,this.ranges=n||[new Zdt(t.min(e),t.max(e))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let t=this.ranges;for(let e=0;e<t.length;e++)if(t[e].$from.pos!=t[e].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(t,e=Ns.empty){let n=e.content.lastChild,r=null;for(let o=0;o<e.openEnd;o++)r=n,n=n.lastChild;let s=t.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){let{$from:l,$to:c}=i[o],u=t.mapping.slice(s);t.replaceRange(u.map(l.pos),u.map(c.pos),o?Ns.empty:e),o==0&&Jre(t,s,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(t,e){let n=t.steps.length,r=this.ranges;for(let s=0;s<r.length;s++){let{$from:i,$to:o}=r[s],l=t.mapping.slice(n),c=l.map(i.pos),u=l.map(o.pos);s?t.deleteRange(c,u):(t.replaceRangeWith(c,u,e),Jre(t,n,e.isInline?-1:1))}}static findFrom(t,e,n=!1){let r=t.parent.inlineContent?new aj(t):Vb(t.node(0),t.parent,t.pos,t.index(),e,n);if(r)return r;for(let s=t.depth-1;s>=0;s--){let i=e<0?Vb(t.node(0),t.node(s),t.before(s+1),t.index(s),e,n):Vb(t.node(0),t.node(s),t.after(s+1),t.index(s)+1,e,n);if(i)return i}return null}static near(t,e=1){return this.findFrom(t,e)||this.findFrom(t,-e)||new AC(t.node(0))}static atStart(t){return Vb(t,t,0,0,1)||new AC(t)}static atEnd(t){return Vb(t,t,t.content.size,t.childCount,-1)||new AC(t)}static fromJSON(t,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=mz[e.type];if(!n)throw new RangeError(`No selection type ${e.type} defined`);return n.fromJSON(t,e)}static jsonID(t,e){if(t in mz)throw new RangeError("Duplicate use of selection JSON ID "+t);return mz[t]=e,e.prototype.jsonID=t,e}getBookmark(){return aj.between(this.$anchor,this.$head).getBookmark()}};pi.prototype.visible=!0;var Zdt=class{constructor(t,e){this.$from=t,this.$to=e}},Yre=!1;function Xre(t){!Yre&&!t.parent.inlineContent&&(Yre=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}var aj=class HN extends pi{constructor(e,n=e){Xre(e),Xre(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return pi.near(r);let s=e.resolve(n.map(this.anchor));return new HN(s.parent.inlineContent?s:r,r)}replace(e,n=Ns.empty){if(super.replace(e,n),n==Ns.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof HN&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new UNe(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new HN(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let s=e.resolve(n);return new this(s,r==n?s:e.resolve(r))}static between(e,n,r){let s=e.pos-n.pos;if((!r||s)&&(r=s>=0?1:-1),!n.parent.inlineContent){let i=pi.findFrom(n,r,!0)||pi.findFrom(n,-r,!0);if(i)n=i.$head;else return pi.near(n,r)}return e.parent.inlineContent||(s==0?e=n:(e=(pi.findFrom(e,-r,!0)||pi.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=s<0&&(e=n))),new HN(e,n)}};pi.jsonID("text",aj);var UNe=class qNe{constructor(e,n){this.anchor=e,this.head=n}map(e){return new qNe(e.map(this.anchor),e.map(this.head))}resolve(e){return aj.between(e.resolve(this.anchor),e.resolve(this.head))}},oj=class WN extends pi{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:s}=n.mapResult(this.anchor),i=e.resolve(s);return r?pi.near(i):new WN(i)}content(){return new Ns(np.from(this.node),0,0)}eq(e){return e instanceof WN&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new eht(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new WN(e.resolve(n.anchor))}static create(e,n){return new WN(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};oj.prototype.visible=!1;pi.jsonID("node",oj);var eht=class VNe{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new UNe(r,r):new VNe(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&oj.isSelectable(r)?new oj(n):pi.near(n)}},AC=class DR extends pi{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=Ns.empty){if(n==Ns.empty){e.delete(0,e.doc.content.size);let r=pi.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new DR(e)}map(e){return new DR(e)}eq(e){return e instanceof DR}getBookmark(){return tht}};pi.jsonID("all",AC);var tht={map(){return this},resolve(t){return new AC(t)}};function Vb(t,e,n,r,s,i=!1){if(e.inlineContent)return aj.create(t,n);for(let o=r-(s>0?0:1);s>0?o<e.childCount:o>=0;o+=s){let l=e.child(o);if(l.isAtom){if(!i&&oj.isSelectable(l))return oj.create(t,n-(s<0?l.nodeSize:0))}else{let c=Vb(t,l,n+s,s<0?l.childCount:0,s,i);if(c)return c}n+=l.nodeSize*s}return null}function Jre(t,e,n){let r=t.steps.length-1;if(r<e)return;let s=t.steps[r];if(!(s instanceof OK||s instanceof BNe))return;let i=t.mapping.maps[r],o;i.forEach((l,c,u,d)=>{o==null&&(o=d)}),t.setSelection(pi.near(t.doc.resolve(o),n))}function Qre(t,e){return!e||!t?t:t.bind(e)}var TP=class{constructor(t,e,n){this.name=t,this.init=Qre(e.init,n),this.apply=Qre(e.apply,n)}};new TP("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new TP("selection",{init(t,e){return t.selection||pi.atStart(e.doc)},apply(t){return t.selection}}),new TP("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new TP("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}});var nht=(t,e)=>{var n;const{state:r,view:s}=t,{selection:i}=r;if(!i.empty)return!1;const{$from:o}=i;if(o.parentOffset!==0)return!1;const l=o.depth-1,c=o.node(l),u=o.index(l);if(u===0)return!1;if(c.type===e)return t.commands.lift(e.name);const d=c.child(u-1);if(d.type!==e||!((n=d.lastChild)!=null&&n.isTextblock))return!1;const h=o.before(),p=h-1-1,{tr:m}=r;return m.delete(h,o.after()).insert(p,o.parent.content),m.setSelection(aj.create(m.doc,p)),s.dispatch(m.scrollIntoView()),!0},rht=/^\s*>\s$/,sht=Rs.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return DI("blockquote",{...Mn(this.options.HTMLAttributes,t),children:DI("slot",{})})},parseMarkdown:(t,e)=>{var n;const r=(n=e.parseBlockChildren)!=null?n:e.parseChildren;return e.createNode("blockquote",void 0,r(t.tokens||[]))},renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",r=[];return t.content.forEach((s,i)=>{var o,l;const d=((l=(o=e.renderChild)==null?void 0:o.call(e,s,i))!=null?l:e.renderChildren([s])).split(` 1173`).map(h=>h.trim()===""?n:`${n} ${h}`);r.push(d.join(` 1174`))}),r.join(` 1175${n} 1176`)},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote(),Backspace:()=>nht(this.editor,this.type)}},addInputRules(){return[ij({find:rht,type:this.type})]}}),iht=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,aht=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,oht=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,lht=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,cht=gp.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return DI("strong",{...Mn(this.options.HTMLAttributes,t),children:DI("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}}
vendor: 8,102 bytes, lines 1176-1197
1176,addInputRules(){return[p0({find:iht,type:this.type}),p0({find:oht,type:this.type})]},addPasteRules(){return[Vg({find:aht,type:this.type}),Vg({find:lht,type:this.type})]}}),uht=t=>{const e=/`([^`]+)`(?!`)$/.exec(t);return!e||e.index>0&&t[e.index-1]==="`"?null:{index:e.index,text:e[0],replaceWith:e[1]}},dht=t=>{const e=/`([^`]+)`(?!`)/g,n=[];let r;for(;(r=e.exec(t))!==null;)r.index>0&&t[r.index-1]==="`"||n.push({index:r.index,text:r[0],replaceWith:r[1]});return n},hht=gp.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Mn(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[p0({find:uht,type:this.type})]},addPasteRules(){return[Vg({find:dht,type:this.type})]}}),gz=4,fht=/^```([a-z]+)?[\s\n]$/,pht=/^~~~([a-z]+)?[\s\n]$/,mht=Rs.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:gz,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options;if(!n)return null;const i=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(o=>o.startsWith(n)).map(o=>o.replace(n,""))[0];return i||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",Mn(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n,r;return((n=t.raw)==null?void 0:n.startsWith("```"))===!1&&((r=t.raw)==null?void 0:r.startsWith("~~~"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var n;let r="";const s=((n=t.attrs)==null?void 0:n.language)||"";return t.content?r=[`\`\`\`${s}`,e.renderChildren(t.content),"```"].join(` 1177`):r=`\`\`\`${s} 1178 1179\`\`\``,r},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:gz,{state:r}=t,{selection:s}=r,{$from:i,empty:o}=s;if(i.parent.type!==this.type)return!1;const l=" ".repeat(n);return o?t.commands.insertContent(l):t.commands.command(({tr:c})=>{const{from:u,to:d}=s,p=r.doc.textBetween(u,d,` 1180`,` 1181`).split(` 1182`).map(m=>l+m).join(` 1183`);return c.replaceWith(u,d,r.schema.text(p)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:gz,{state:r}=t,{selection:s}=r,{$from:i,empty:o}=s;return i.parent.type!==this.type?!1:o?t.commands.command(({tr:l})=>{var c;const{pos:u}=i,d=i.start(),h=i.end(),p=r.doc.textBetween(d,h,` 1184`,` 1185`).split(` 1186`);let m=0,v=0;const x=u-d;for(let S=0;S<p.length;S+=1){if(v+p[S].length>=x){m=S;break}v+=p[S].length+1}const w=((c=p[m].match(/^ */))==null?void 0:c[0])||"",_=Math.min(w.length,n);if(_===0)return!0;let j=d;for(let S=0;S<m;S+=1)j+=p[S].length+1;return l.delete(j,j+_),u-j<=_&&l.setSelection(It.create(l.doc,j)),!0}):t.commands.command(({tr:l})=>{const{from:c,to:u}=s,f=r.doc.textBetween(c,u,` 1187`,` 1188`).split(` 1189`).map(p=>{var m;const v=((m=p.match(/^ */))==null?void 0:m[0])||"",x=Math.min(v.length,n);return p.slice(x)}).join(` 1190`);return l.replaceWith(c,u,r.schema.text(f)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:s}=n;if(!s||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(` 1191 1192`);return!i||!o?!1:t.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:s,empty:i}=n;if(!i||s.parent.type!==this.type||!(s.parentOffset===s.parent.nodeSize-2))return!1;const l=s.after();return l===void 0?!1:r.nodeAt(l)?t.commands.command(({tr:u})=>(u.setSelection(Ot.near(r.resolve(l))),!0)):t.commands.exitCode()}}},addInputRules(){return[Bq({find:fht,type:this.type,getAttributes:t=>({language:t[1]})}),Bq({find:pht,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new fr({key:new as("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),s=r?JSON.parse(r):void 0,i=s==null?void 0:s.mode;if(!n||!i)return!1;const{tr:o,schema:l}=t.state,c=l.text(n.replace(/\r\n?/g,` 1193`));return o.replaceSelectionWith(this.type.create({language:i},c)),o.selection.$from.parent.type!==this.type&&o.setSelection(It.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),ght=Rs.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` 1194 1195`):""}),vht=Rs.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",Mn(this.options.HTMLAttributes,t)]},renderText(){return` 1196`},renderMarkdown:()=>` 1197`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:s,storedMarks:i}=n;if(s.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:l}=r.extensionManager,c=i||s.$to.parentOffset&&s.$from.marks();return e().insertContent({type:this.name}).command(({tr:u,dispatch:d})=>{if(d&&c&&o){const h=c.filter(f=>l.includes(f.type.name));u.ensureMarks(h)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),xht=Rs.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,Mn(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const r=(n=t.attrs)!=null&&n.level?parseInt(t.attrs.level,10):1,s="#".repeat(r);return t.content?`${s} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>Bq({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}}
1197)\\s$`),type:this.type,getAttributes:{level:t}}))}}),yht=Rs.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Mn(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!xut(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,s=t();return YSe(n)?s.insertContentAt(r.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({state:i,tr:o,dispatch:l})=>{if(l){const{$to:c}=o.selection,u=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?o.setSelection(It.create(o.doc,c.pos+1)):c.nodeAfter.isBlock?o.setSelection(Dt.create(o.doc,c.pos)):o.setSelection(It.create(o.doc,c.pos));else{const d=i.schema.nodes[this.options.nextNodeType]||c.parent.type.contentMatch.defaultType,h=d==null?void 0:d.create();h&&(o.insert(u,h),o.setSelection(It.create(o.doc,u+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[gNe({find:/^(?:---|â-|___\s|\*\*\*\s)$/,type:this.t
vendor: 4,515 bytes, line 1197
1197ype})]}}),bht=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,wht=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,_ht=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,jht=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Sht=gp.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",Mn(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<em>",close:"</em>"}},renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[p0({find:bht,type:this.type}),p0({find:_ht,type:this.type})]},addPasteRules(){return[Vg({find:wht,type:this.type}),Vg({find:jht,type:this.type})]}});const Nht="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2
1197ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Cht="ελ1Ï
2бг1ел3деÑи4еÑ2каÑолик6ом3мÐ
1197ºÐ´2он1Ñква6онлайн5Ñг3ÑÑÑ2Ñ2ÑайÑ3Ñб3ÑкÑ3Òаз3Õ°Õ¡Õµ3×שר××5×§××3Ø§Ø¨ÙØ¸Ø¨Ù5راÙ
ÙÙ5ÙØ§Ø±Ø¯Ù4Ø¨ØØ±ÙÙ5جزائر5Ø³Ø¹ÙØ¯ÙØ©6عÙÙØ§Ù5Ù
غرب5Ù
ارات5ÛØ±Ø§Ù5بارت2زار4ÙØªÙ3ھارت5تÙÙØ³4Ø³ÙØ¯Ø§Ù3Ø±ÙØ©5Ø´Ø¨ÙØ©4عراÙ2ب2Ù
اÙ4ÙÙØ³Ø·ÙÙ6ÙØ·Ø±3ÙØ§Ø«ÙÙÙÙ6ÙÙ
3Ù
صر2ÙÙØ³Ùا5ÙØ±ÙتاÙÙØ§7ÙØ¹4ÙÙ
راÙ5پاکستاÙ7ÚØ§Ø±Øª4à¤à¥à¤®3नà¥à¤3à¤à¤¾à¤°à¤¤0मà¥3à¥à¤¤5सà¤à¤à¤ न5বাà¦à¦²à¦¾5à¦à¦¾à¦°à¦¤2ৰত4à¨à¨¾à¨°à¨¤4àªàª¾àª°àª¤4à¬à¬¾à¬°à¬¤4à®à®¨à¯à®¤à®¿à®¯à®¾6லà®à¯à®à¯6à®à®¿à®à¯à®à®ªà¯à®ªà¯à®°à¯11à°à°¾à°°à°¤à±5à²à²¾à²°à²¤4à´à´¾à´°à´¤à´5à¶½à¶à¶à·4à¸à¸à¸¡3à¹à¸à¸¢3ລາວ3áá2ã¿ããª3ã¢ãã¾ã³4ã¯ã©ã¦ã4ã°ã¼ã°ã«4ã³ã 2ã¹ãã¢3ã»ã¼ã«3ãã¡ãã·ã§ã³6ãã¤ã³ã4ä¸ç2ä¸ä¿¡1å½1å1æç½3äºé©¬é3ä¼ä¸2ä½å±±2ä¿¡æ¯2å¥åº·2å
«å¦2å
¬å¸1ç2å°æ¹¾1ç£2åå1åº1æ 2åé0大é
åº5å¨çº¿2大æ¿2天主æ3娱ä¹2å®¶é»2广ä¸2å¾®å2æ
å2æç±ä½ 3ææº2æè2æ¿å¡1åº2æ°å å¡2é»2æ¶å°2æ¸ç±2æºæ2淡马é¡3游æ2æ¾³é2ç¹ç2ç§»å¨2ç»ç»æºæ4ç½å1åº1ç«1ç»2èé2è°·æ2è´ç©2é販2éå¢2é»è¨çç§4é£å©æµ¦3é£å2é¤å
2馿 ¼éæ3港2ë·ë·1ì»´2ì¼ì±2íêµ2",Hq="numeric",Wq="ascii",Kq="alpha",EC="asciinumeric",KN="alphanumeric",Gq="domain",HNe="emoji",kht="scheme",Aht="slashscheme",vz="whitespace";function Eht(t,e){return t in e||(e[t]=[]),e[t]}function ax(t,e,n){e[Hq]&&(e[EC]=!0,e[KN]=!0),e[Wq]&&(e[EC]=!0,e[Kq]=!0),e[EC]&&(e[KN]=!0),e[Kq]&&(e[KN]=!0),e[KN]&&(e[Gq]=!0),e[HNe]&&(e[Gq]=!0);for(const r in e){const s=Eht(r,n);s.indexOf(t)<0&&s.push(t)}}function Tht(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function Bo(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Bo.groups={};Bo.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){const s=e.jr[r][0],i=e.jr[r][1];if(i&&s.test(t))return i}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let s=0;s<t.length;s++)this.tt(t[s],e,n,r)},tr(t,e,n,r){r=r||Bo.groups;let s;return e&&e.j?s=e:(s=new Bo(e),n&&r&&ax(e,n,r)),this.jr.push([t,s]),s},ts(t,e,n,r){let s=this;const i=t.length;if(!i)return s;for(let o=0;o<i-1;o++)s=s.tt(t[o]);return s.tt(t[i-1],e,n,r)},tt(t,e,n,r){r=r||Bo.groups;const s=this;if(e&&e.j)return s.j[t]=e,e;const i=e;let o,l=s.go(t);if(l?(o=new Bo,Object.assign(o.j,l.j),o.jr.push.apply(o.jr,l.jr),o.jd=l.jd,o.t=l.t):o=new Bo,i){if(r)if(o.t&&typeof o.t=="string"){const c=Object.assign(Tht(o.t,r),n);ax(i,c,r)}else n&&ax(i,n,r);o.t=i}return s.j[t]=o,o}};const en=(t,e,n,r,s)=>t.ta(e,n,r,s),Hr=(t,e,n,r,s)=>t.tr(e,n,r,s),Zre=(t,e,n,r,s)=>t.ts(e,n,r,s),$e=(t,e,n,r,s)=>t.tt(e,n,r,s),$h="WORD",Yq="UWORD",WNe="ASCIINUMERICAL",KNe="ALPHANUMERICAL",Bk="LOCALHOST",Xq="TLD",Jq="UTLD",LR="SCHEME",Hb="SLASH_SCHEME",IK="NUM",Qq="WS",DK="NL",TC="OPENBRACE",PC="CLOSEBRACE",LI="OPENBRACKET",FI="CLOSEBRACKET",$I="OPENPAREN",zI="CLOSEPAREN",BI="OPENANGLEBRACKET",UI="CLOSEANGLEBRACKET",qI="FULLWIDTHLEFTPAREN",VI="FULLWIDTHRIGHTPAREN",HI="LEFTCORNERBRACKET",WI="RIGHTCORNERBRACKET",KI="LEFTWHITECORNERBRACKET",GI="RIGHTWHITECORNERBRACKET",YI="FULLWIDTHLESSTHAN",XI="FULLWIDTHGREATERTHAN",JI="AMPERSAND",QI="APOSTROPHE",ZI="ASTERISK",Wp="AT",eD="BACKSLASH",tD="BACKTICK",nD="CARET",ox="COLON",LK="COMMA",rD="DOLLAR",ad="DOT",sD="EQUALS",FK="EXCLAMATION",ec="HYPHEN",MC="PERCENT",iD="PIPE",aD="PLUS",oD="POUND",RC="QUERY",$K="QUOTE",GNe="FULLWIDTHMIDDLEDOT",zK="SEMI",od="SLASH",OC="TILDE",lD="UNDERSCORE",YNe="EMOJI",cD="SYM";var XNe=Object.freeze({__proto__:null,ALPHANUMERICAL:KNe,AMPERSAND:JI,APOSTROPHE:QI,ASCIINUMERICAL:WNe,ASTERISK:ZI,AT:Wp,BACKSLASH:eD,BACKTICK:tD,CARET:nD,CLOSEANGLEBRACKET:UI,CLOSEBRACE:PC,CLOSEBRACKET:FI,CLOSEPAREN:zI,COLON:ox,COMMA:LK,DOLLAR:rD,DOT:ad,EMOJI:YNe,EQUALS:sD,EXCLAMATION:FK,FULLWIDTHGREATERTHAN:XI,FULLWIDTHLEFTPAREN:qI,FULLWIDTHLESSTHAN:YI,FULLWIDTHMIDDLEDOT:GNe,FULLWIDTHRIGHTPAREN:VI,HYPHEN:ec,LEFTCORNERBRACKET:HI,LEFTWHITECORNERBRACKET:KI,LOCALHOST:Bk,NL:DK,NUM:IK,OP
vendor: 14,853 bytes, lines 1197-1201
1197ENANGLEBRACKET:BI,OPENBRACE:TC,OPENBRACKET:LI,OPENPAREN:$I,PERCENT:MC,PIPE:iD,PLUS:aD,POUND:oD,QUERY:RC,QUOTE:$K,RIGHTCORNERBRACKET:WI,RIGHTWHITECORNERBRACKET:GI,SCHEME:LR,SEMI:zK,SLASH:od,SLASH_SCHEME:Hb,SYM:cD,TILDE:OC,TLD:Xq,UNDERSCORE:lD,UTLD:Jq,UWORD:Yq,WORD:$h,WS:Qq});const Mh=/[a-z]/,IS=new RegExp("\\p{L}","u"),xz=new RegExp("\\p{Emoji}","u"),Rh=/\d/,yz=/\s/,ese="\r",bz=` 1198`,Pht="ï¸",Mht="â",wz="";let PP=null,MP=null;function Rht(t=[]){const e={};Bo.groups=e;const n=new Bo;PP==null&&(PP=tse(Nht)),MP==null&&(MP=tse(Cht)),$e(n,"'",QI),$e(n,"{",TC),$e(n,"}",PC),$e(n,"[",LI),$e(n,"]",FI),$e(n,"(",$I),$e(n,")",zI),$e(n,"<",BI),$e(n,">",UI),$e(n,"ï¼",qI),$e(n,"ï¼",VI),$e(n,"ã",HI),$e(n,"ã",WI),$e(n,"ã",KI),$e(n,"ã",GI),$e(n,"ï¼",YI),$e(n,"ï¼",XI),$e(n,"&",JI),$e(n,"*",ZI),$e(n,"@",Wp),$e(n,"`",tD),$e(n,"^",nD),$e(n,":",ox),$e(n,",",LK),$e(n,"$",rD),$e(n,".",ad),$e(n,"=",sD),$e(n,"!",FK),$e(n,"-",ec),$e(n,"%",MC),$e(n,"|",iD),$e(n,"+",aD),$e(n,"#",oD),$e(n,"?",RC),$e(n,'"',$K),$e(n,"/",od),$e(n,";",zK),$e(n,"~",OC),$e(n,"_",lD),$e(n,"\\",eD),$e(n,"ã»",GNe);const r=Hr(n,Rh,IK,{[Hq]:!0});Hr(r,Rh,r);const s=Hr(r,Mh,WNe,{[EC]:!0}),i=Hr(r,IS,KNe,{[KN]:!0}),o=Hr(n,Mh,$h,{[Wq]:!0});Hr(o,Rh,s),Hr(o,Mh,o),Hr(s,Rh,s),Hr(s,Mh,s);const l=Hr(n,IS,Yq,{[Kq]:!0});Hr(l,Mh),Hr(l,Rh,i),Hr(l,IS,l),Hr(i,Rh,i),Hr(i,Mh),Hr(i,IS,i);const c=$e(n,bz,DK,{[vz]:!0}),u=$e(n,ese,Qq,{[vz]:!0}),d=Hr(n,yz,Qq,{[vz]:!0});$e(n,wz,d),$e(u,bz,c),$e(u,wz,d),Hr(u,yz,d),$e(d,ese),$e(d,bz),Hr(d,yz,d),$e(d,wz,d);const h=Hr(n,xz,YNe,{[HNe]:!0});$e(h,"#"),Hr(h,xz,h),$e(h,Pht,h);const f=$e(h,Mht);$e(f,"#"),Hr(f,xz,h);const p=[[Mh,o],[Rh,s]],m=[[Mh,null],[IS,l],[Rh,i]];for(let v=0;v<PP.length;v++)Ep(n,PP[v],Xq,$h,p);for(let v=0;v<MP.length;v++)Ep(n,MP[v],Jq,Yq,m);ax(Xq,{tld:!0,ascii:!0},e),ax(Jq,{utld:!0,alpha:!0},e),Ep(n,"file",LR,$h,p),Ep(n,"mailto",LR,$h,p),Ep(n,"http",Hb,$h,p),Ep(n,"https",Hb,$h,p),Ep(n,"ftp",Hb,$h,p),Ep(n,"ftps",Hb,$h,p),ax(LR,{scheme:!0,ascii:!0},e),ax(Hb,{slashscheme:!0,ascii:!0},e),t=t.sort((v,x)=>v[0]>x[0]?1:-1);for(let v=0;v<t.length;v++){const x=t[v][0],w=t[v][1]?{[kht]:!0}:{[Aht]:!0};x.indexOf("-")>=0?w[Gq]=!0:Mh.test(x)?Rh.test(x)?w[EC]=!0:w[Wq]=!0:w[Hq]=!0,Zre(n,x,x,w)}return Zre(n,"localhost",Bk,{ascii:!0}),n.jd=new Bo(cD),{start:n,tokens:Object.assign({groups:e},XNe)}}function JNe(t,e){const n=Oht(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=n.length,s=[];let i=0,o=0;for(;o<r;){let l=t,c=null,u=0,d=null,h=-1,f=-1;for(;o<r&&(c=l.go(n[o]));)l=c,l.accepts()?(h=0,f=0,d=l):h>=0&&(h+=n[o].length,f++),u+=n[o].length,i+=n[o].length,o++;i-=h,o-=f,u-=h,s.push({t:d.t,v:e.slice(i-u,i),s:i-u,e:i})}return s}function Oht(t){const e=[],n=t.length;let r=0;for(;r<n;){let s=t.charCodeAt(r),i,o=s<55296||s>56319||r+1===n||(i=t.charCodeAt(r+1))<56320||i>57343?t[r]:t.slice(r,r+2);e.push(o),r+=o.length}return e}function Ep(t,e,n,r,s){let i;const o=e.length;for(let l=0;l<o-1;l++){const c=e[l];t.j[c]?i=t.j[c]:(i=new Bo(r),i.jr=s.slice(),t.j[c]=i),t=i}return i=new Bo(n),i.jr=s.slice(),t.j[e[o-1]]=i,i}function tse(t){const e=[],n=[];let r=0,s="0123456789";for(;r<t.length;){let i=0;for(;s.indexOf(t[r+i])>=0;)i++;if(i>0){e.push(n.join(""));for(let o=parseInt(t.substring(r,r+i),10);o>0;o--)n.pop();r+=i}else n.push(t[r]),r++}return e}const Uk={defaultProtocol:"http",events:null,format:nse,formatHref:nse,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function BK(t,e=null){let n=Object.assign({},Uk);t&&(n=Object.assign(n,t instanceof BK?t.o:t));const r=n.ignoreTags,s=[];for(let i=0;i<r.length;i++)s.push(r[i].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=s}BK.prototype={o:Uk,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let s=this.o[t];return s&&(typeof s=="object"?(s=n.t in s?s[n.t]:Uk[t],typeof s=="function"&&r&&(s=s(e,n))):typeof s=="function"&&r&&(s=s(e,n.t,n)),s)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function nse(t){return t}function QNe(t,e){this.t="token",this.v=t,this.tk=e}QNe.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"â¦":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=Uk.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),s=t.get("tagName",n,e),i=this.toFormattedString(t),o={},l=t.get("className",n,e),c=t.get("target",n,e),u=t.get("rel",n,e),d=t.getObj("attributes",n,e),h=t.getObj("events",n,e);return o.href=r,l&&(o.class=l),c&&(o.target=c),u&&(o.rel=u),d&&Object.assign(o,d),{tagName:s,attributes:o,content:i,eventListeners:h}}};function N4(t,e){class n extends QNe{constructor(s,i){super(s,i),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const Iht=N4("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),rse=N4("text"),Dht=N4("nl"),RP=N4("url",{isLink:!0,toHref(t=Uk.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==Bk&&t[1].t===ox}}),Gl=t=>new Bo(t);function Lht({groups:t}){const e=t.domain.concat([JI,ZI,Wp,eD,tD,nD,rD,sD,ec,IK,MC,iD,aD,oD,od,cD,OC,lD]),n=[QI,ox,LK,ad,FK,MC,RC,$K,zK,BI,UI,TC,PC,FI,LI,$I,zI,qI,VI,HI,WI,KI,GI,YI,XI],r=[JI,QI,ZI,eD,tD,nD,rD,sD,ec,TC,PC,MC,iD,aD,oD,RC,od,cD,OC,lD],s=Gl(),i=$e(s,OC);en(i,r,i),en(i,t.domain,i);const o=Gl(),l=Gl(),c=Gl();en(s,t.domain,o),en(s,t.scheme,l),en(s,t.slashscheme,c),en(o,r,i),en(o,t.domain,o);const u=$e(o,Wp);$e(i,Wp,u),$e(l,Wp,u),$e(c,Wp,u);const d=$e(i,ad);en(d,r,i),en(d,t.domain,i);const h=Gl();en(u,t.domain,h),en(h,t.domain,h);const f=$e(h,ad);en(f,t.domain,h);const p=Gl(Iht);en(f,t.tld,p),en(f,t.utld,p),$e(u,Bk,p);const m=$e(h,ec);$e(m,ec,m),en(m,t.domain,h),en(p,t.domain,h),$e(p,ad,f),$e(p,ec,m);const v=$e(o,ec),x=$e(o,ad);$e(v,ec,v),en(v,t.domain,o),en(x,r,i),en(x,t.domain,o);const g=Gl(RP);en(x,t.tld,g),en(x,t.utld,g),en(g,t.domain,o),en(g,r,i),$e(g,ad,x),$e(g,ec,v),$e(g,Wp,u);const w=$e(g,ox),_=Gl(RP);en(w,t.numeric,_);const j=Gl(RP),N=Gl();en(j,e,j),en(j,n,N),en(N,e,j),en(N,n,N),$e(g,od,j),$e(_,od,j);const S=$e(l,ox),C=$e(c,ox),k=$e(C,od),E=$e(k,od);en(l,t.domain,o),$e(l,ad,x),$e(l,ec,v),en(c,t.domain,o),$e(c,ad,x),$e(c,ec,v),en(S,t.domain,j),$e(S,od,j),$e(S,RC,j),en(E,t.domain,j),en(E,e,j),$e(E,od,j);const P=[[TC,PC],[LI,FI],[$I,zI],[BI,UI],[qI,VI],[HI,WI],[KI,GI],[YI,XI]];for(let T=0;T<P.length;T++){const[M,R]=P[T],A=$e(j,M);$e(N,M,A);const I=Gl(RP);en(A,e,I);const D=Gl();en(A,n,D),$e(A,R,j),en(I,e,I),en(I,n,D),en(D,e,I),en(D,n,D),$e(I,R,j),$e(D,R,j)}return $e(s,Bk,g),$e(s,DK,Dht),{start:s,tokens:XNe}}function Fht(t,e,n){let r=n.length,s=0,i=[],o=[];for(;s<r;){let l=t,c=null,u=null,d=0,h=null,f=-1;for(;s<r&&!(c=l.go(n[s].t));)o.push(n[s++]);for(;s<r&&(u=c||l.go(n[s].t));)c=null,l=u,l.accepts()?(f=0,h=l):f>=0&&f++,s++,d++;if(f<0)s-=d,s<r&&(o.push(n[s]),s++);else{o.length>0&&(i.push(_z(rse,e,o)),o=[]),s-=f,d-=f;const p=h.t,m=n.slice(s-d,s);i.push(_z(p,e,m))}}return o.length>0&&i.push(_z(rse,e,o)),i}function _z(t,e,n){const r=n[0].s,s=n[n.length-1].e,i=e.slice(r,s);return new t(i,n)}const $ht=typeof console<"u"&&console&&console.warn||(()=>{}),zht="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",vr={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Bht(){return Bo.groups={},vr.scanner=null,vr.parser=null,vr.tokenQueue=[],vr.pluginQueue=[],vr.customSchemes=[],vr.initialized=!1,vr}function sse(t,e=!1){if(vr.initialized&&$ht(`linkifyjs: already initialized - will not register custom scheme "${t}" ${zht}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format. 11991. Must only contain digits, lowercase ASCII letters or "-" 12002. Cannot start or end with "-" 12013. "-" cannot repeat`);vr.customSchemes.push([t,e])}function Uht(){vr.scanner=Rht(vr.customSchemes);for(let t=0;t<vr.tokenQueue.length;t++)vr.tokenQueue[t][1]({scanner:vr.scanner});vr.parser=Lht(vr.scanner.tokens);for(let t=0;t<vr.pluginQueue.length;t++)vr.pluginQueue[t][1]({scanner:vr.scanner,parser:vr.parser});return vr.initialized=!0,vr}function UK(t){return vr.initialized||Uht(),Fht(vr.parser.start,t,JNe(vr.scanner.start,t))}UK.scan=JNe;function ZNe(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new BK(n),s=UK(t),i=[];for(let o=0;o<s.length;o++){const l=s[o];l.isLink&&(!e||l.t===e)&&r.check(l)&&i.push(l.toFormattedObject(r))}return i}var qK="[\0-  áá â-\u2029âã]",qht=new RegExp(qK),Vht=new RegExp(`${qK}$`),Hht=new RegExp(qK,"g");function Wht(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function Kht(t){return new fr({key:new as("autolink"),appendTransaction:(e,n,r)=>{const s=e.some(u=>u.docChanged)&&!n.doc.eq(r.doc),i=e.some(u=>u.getMeta("preventAutolink"));if(!s||i)return;const{tr:o}=r,l=zSe(n.doc,[...e]);if(GSe(l).forEach(({newRange:u})=>{const d=Mct(r.doc,u,p=>p.isTextblock);let h,f;if(d.length>1)h=d[0],f=r.doc.textBetween(h.pos,h.pos+h.node.nodeSize,void 0," ");else if(d.length){const p=r.doc.textBetween(u.from,u.to," "," ");if(!Vht.test(p))return;h=d[0],f=r.doc.textBetween(h.pos,u.to,void 0," ")}if(h&&f){const p=f.split(qht).filter(Boolean);if(p.length<=0)return!1;const m=p[p.length-1],v=h.pos+f.lastIndexOf(m);if(!m)return!1;const x=UK(m).map(g=>g.toObject(t.defaultProtocol));if(!Wht(x))return!1;x.filter(g=>g.isLink).map(g=>({...g,from:v+g.start+1,to:v+g.end+1})).filter(g=>r.schema.marks.code?!r.doc.rangeHasMark(g.from,g.to,r.schema.marks.code):!0).filter(g=>t.validate(g.value)).filter(g=>t.shouldAutoLink(g.value)).forEach(g=>{kK(g.from,g.to,r.doc).some(w=>w.mark.type===t.type)||o.addMark(g.from,g.to,t.type.create({href:g.href}))})}}),!!o.steps.length)return o}})}function Ght(t){return new fr({key:new as("handleClickLink"),props:{handleClick:(e,n,r)=>{var s,i;if(r.button!==0||!e.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{const c=r.target;if(!c)return!1;const u=t.editor.view.dom;o=c.closest("a"),o&&!u.contains(o)&&(o=null)}if(!o)return!1;let l=!1;if(t.enableClickSelection&&(l=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){const c=KSe(e.state,t.type.name),u=(s=o.href)!=null?s:c.href,d=(i=o.target)!=null?i:c.target;u&&(window.open(u,d),l=!0)}return l}}})}function Yht(t){return new fr({key:new as("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:s}=t,{state:i}=e,{selection:o}=i,{empty:l}=o;if(l)return!1;let c="";r.content.forEach(d=>{c+=d.textContent});const u=ZNe(c,{defaultProtocol:t.defaultProtocol}).find(d=>d.isLink&&d.value===c);return!c||!u||s!==void 0&&!s(u.value)?!1:t.editor.commands.setMark(t.type,{href:u.href})}}})}function jv(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const s=typeof r=="string"?r:r.scheme;s&&n.push(s)}),!t||t.replace(Hht,"").match(new RegExp(`^(?:(?:${n.map(r=>r.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join("|")}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`,"i"))}var eCe=gp.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){sse(t);return}sse(t.scheme,t.optionalSlashes)})},onDestroy(){Bht()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!jv(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),n=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||n&&!t.includes("@"))return!0;const s=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(s)||!/\./.test(s))}}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!jv(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!jv(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Mn(this.options.HTMLAttributes,t),0]:["a",Mn(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n,r,s,i;const o=(r=(n=t.attrs)==null?void 0:n.href)!=null?r:"",l=(i=(s=t.attrs)==null?void 0:s.title)!=null?i:"",c=e.renderChildren(t);return l?`[${c}](${o} "${l}")`:`[${c}](${o})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!jv(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!jv(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Vg({find:t=>{const e=[];
1201if(t){const{protocols:n,defaultProtocol:r}=this.options,s=ZNe(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:o=>!!jv(o,n),protocols:n,defaultProtocol:r}));s.length&&s.forEach(i=>{this.options.shouldAutoLink(i.value)&&e.push({text:i.value,data:{href:i.href},index:i.start})})}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(Kht({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:s=>!!jv(s,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(Ght({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(Yht({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),Xht=eCe,Jht=Object.defineProperty,Qht=(t,e)=>{for(var n in e)Jht(t,n,{get:e[n],enumerable:!0})},Zht="listItem",ise="textStyle",ase=/^\s*([-+*])\s$/,tCe=Rs.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",Mn(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` 1202`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Zht,this.editor.getAttributes(ise)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=ij({find:ase,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=ij({find:ase,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(ise),editor:this.editor})),[t]}}),eft=(t,e,n)=>{const{selection:r}=t;if(!r.empty)return null;const{$from:s}=r;if(!s.parent.isTextblock||s.parentOffset!==s.parent.content.size)return null;let i=-1;for(let p=s.depth;p>0;p-=1)if(s.node(p).type.name===e){i=p;break}if(i<0)return null;const o=s.node(i),l=s.index(i);if(l+1>=o.childCount)return null;const c=o.child(l+1);if(!n.includes(c.type.name))return null;const u=t.schema.nodes[e];let d=!1;if(c.forEach(p=>{p.type===u&&p.childCount>1&&(d=!0)}),!d)return null;const h=t.doc.resolve(s.after()).nodeAfter;if(!h||!n.includes(h.type.name))return null;const f=[];return h.forEach(p=>{f.push(p)}),f.length===0?null:{listItemDepth:i,nestedList:h,nestedListPos:s.after(),insertPos:s.after(i),items:f}},tft=(t,e,n,r)=>{const s=eft(t,n,r);if(!s)return!1;const{selection:i}=t,{nestedList:o,nestedListPos:l,insertPos:c,items:u}=s,d=t.tr;d.delete(l,l+o.nodeSize);const h=d.mapping.map(c);return d.insert(h,De.from(u)),d.setSelection(i.map(d.doc,d.mapping)),e&&e(d),!0},nft=(t,e,n)=>tft(t.state,t.view.dispatch,e,n),nCe=(t,e)=>En.create({name:`${t}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){const n=()=>nft(this.editor,t,e);return{Delete:n,"Mod-Delete":n}}}),rCe=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]],OP="abcdefghijklmnopqrstuvwxyz",rft="[a-zA-Z]{1,2}",VK=String.raw`\d+|[ivxlcdmIVXLCDM]+|${rft}`;function C4(t){let e=t,n="";for(const[r,s]of rCe)for(;e>=r;)n+=s,e-=r;return n}function HK(t){return C4(t).toUpperCase()}function sCe(t){const e=t.toLowerCase();let n=0,r=0;for(;n<e.length;){let s=!1;for(const[i,o]of rCe)if(e.startsWith(o,n)){r+=i,n+=o.length,s=!0;break}if(!s)return 0}return r}function sft(t){if(!/^[ivxlcdmIVXLCDM]+$/.test(t))return!1;const e=sCe(t);return e<=0?!1:(t===t.toLowerCase()?C4(e):HK(e))===t}function ift(t){const e=t.toLowerCase();if(e.length===1)return e.charCodeAt(0)-97+1;if(e.length===2){const n=e.charCodeAt(0)-97,r=e.charCodeAt(1)-97;return(n+1)*26+r+1}return 0}function uD(t){if(t<=26)return OP[t-1];const e=Math.floor((t-1)/26)-1,n=(t-1)%26;return e<0?OP[n]:OP[e]+OP[n]}
1202function k4(t){if(!(!t||/^\d+$/.test(t))){if(sft(t))return t===t.toLowerCase()?"i":"I";if(/^[a-z]{1,2}$/.test(t))return"a";if(/^[A-Z]{1,2}$/.test(t))return"A"}}function WK(t){if(/^\d+$/.test(t))return parseInt(t,10);const e=k4(t);if(e==="i"||e==="I")return sCe(t);if(e==="a"||e==="A"){const r=ift(t);return r>0?r:1}const n=parseInt(t,10);return Number.isNaN(n)?1:n}function aft(t,e){if(t==="numeric")return String(e);switch(t){case"a":return uD(e);case"A":return uD(e).toUpperCase();case"i":return C4(e);case"I":return HK(e);default:return String(e)}}function oft(t){var e;if(t.length===0)return!1;const n=(e=k4(t[0]))!=null?e:"numeric",r=WK(t[0]);if(r<1)return!1;for(let s=0;s<t.length;s++){const i=aft(n,r+s);if(t[s]!==i)return!1}return!0}function lft(t){return{type:k4(t),start:WK(t)}}function cft(t){const{type:e,start:n}=lft(t),r={};return e&&(r.type=e),n!==1&&(r.start=n),r}function uft(t,e,n=". "){const r=e+1;if(!t||t==="1")return`${r}${n}`;switch(t){case"a":return`${uD(r)}${n}`;case"A":return`${uD(r).toUpperCase()}${n}`;case"i":return`${C4(r)}${n}`;case"I":return`${HK(r)}${n}`;default:return`${r}${n}`}}function dft(t){var e,n;const r=(e=t.tokens)==null?void 0:e[0];return!!(t.text&&((n=t.tokens)==null?void 0:n.length)===1&&(r==null?void 0:r.type)==="list"&&r.ordered&&r.raw===t.text)}function hft(t,e){return e.tokenizeInline?e.parseInline(e.tokenizeInline(t)):e.parseInline([{type:"text",raw:t,text:t}])}var iCe=Rs.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Mn(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{var n;if(t.type!=="list_item")return[];const r=(n=e.parseBlockChildren)!=null?n:e.parseChildren;let s=[];if(t.tokens&&t.tokens.length>0){if(dft(t))return{type:"listItem",content:[{type:"paragraph",content:hft(t.text||"",e)}]};if(t.tokens.some(o=>o.type==="paragraph"))s=r(t.tokens);else{const o=t.tokens[0];if(o&&o.type==="text"&&o.tokens&&o.tokens.length>0){if(s=[{type:"paragraph",content:e.parseInline(o.tokens)}],t.tokens.length>1){const c=t.tokens.slice(1),u=r(c);s.push(...u)}}else s=r(t.tokens)}}return s.length===0&&(s=[{type:"paragraph",content:[]}]),{type:"listItem",content:s}},renderMarkdown:(t,e,n)=>TK(t,e,r=>{var s,i,o,l;if(r.parentType==="bulletList")return"- ";if(r.parentType==="orderedList"){const c=((i=(s=r.meta)==null?void 0:s.parentAttrs)==null?void 0:i.start)||1,u=(l=(o=r.meta)==null?void 0:o.parentAttrs)==null?void 0:l.type,d=c-1+(r.index||0);return uft(u,d,". ")}return"- "},n),addExtensions(){return[nCe(this.name,[this.options.bulletListTypeName,this.options.orderedListTypeName])]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),fft={};Qht(fft,{findListItemPos:()=>A4,getNextListDepth:()=>KK,handleBackspace:()=>Zq,handleDelete:()=>eV,hasListBefore:()=>aCe,hasListItemAfter:()=>pft,hasListItemBefore:()=>mft,listItemHasSubList:()=>gft,nextListIsDeeper:()=>oCe,nextListIsHigher:()=>lCe});var A4=(t,e)=>{const{$from:n}=e.selection,r=Ms(t,e.schema);let s=null,i=n.depth,o=n.pos,l=null;for(;i>0&&l===null;)s=n.node(i),s.type===r?l=i:(i-=1,o-=1);return l===null?null:{$pos:e.doc.resolve(o),depth:l}},KK=(t,e)=>{const n=A4(t,e);if(!n)return!1;const[,r]=Uct(e,t,n.$pos.pos+4);return r},aCe=(t,e,n)=>{const{$anchor:r}=t.selection,s=Math.max(0,r.pos-2),i=t.doc.resolve(s).node();return!(!i||!n.includes(i.type.name))},Zq=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!qg(t.state,e)&&aCe(t.state,e,n)){const{$anchor:r}=t.state.selection,s=t.state.doc.resolve(r.before()-1),i=[];s.node().descendants((c,u)=>{c.type.name===e&&i.push({node:c,pos:u})});const o=i.at(-1);if(!o)return!1;const l=t.state.doc.resolve(s.start()+o.pos+1);return t.chain().cut({from:r.start()-1,to:r.end()+1},l.end()).joinForward().run()}return!qg(t.state,e)||!Wct(t.state)?!1:t.chain().liftListItem(e).run()},oCe=(t,e)=>{const n=KK(t,e),r=A4(t,e);return!r||!n?!1:n>r.depth},lCe=(t,e)=>{const n=KK(t,e),r=A4(t,e);return!r||!n?!1:n<r.depth},eV=(t,e)=>{if(!qg(t.state,e)||!Hct(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:s}=n;return!n.empty&&r.sameParent(s)?!1:oCe(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():lCe(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},pft=(t,e)=>{var n;const{$anchor:r}=e.selection,s=e.doc.resolve(r.pos-r.parentOffset-2);return!(s.index()===s.parent.childCount-1||((n=s.nodeAfter)==null?void 0:n.type.name)!==t)},mft=(t,e)=>{var n;const{$anchor:r}=e.selection,s=e.doc.resolve(r.pos-2);return!(s.index()===0||((n=s.nodeBefore)==null?void 0:n.type.name)!==t)},gft=(t,e,n)=>{if(!n)return!1;const r=Ms(t,e.schema);let s=!1;return n.descendants(i=>{i.type===r&&(s=!0)}),s},cCe=En.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;
1202return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&eV(t,n)&&(e=!0)}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&eV(t,n)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&Zq(t,n,r)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&Zq(t,n,r)&&(e=!0)}),e}}}}),tV=new RegExp(`^(\\s*)(${VK})([.)])\\s+(.*)$`),vft=new RegExp(`^(\\s*)(${VK})([.)])\\s+`),xft=/^\s/;function yft(t){return tV.test(t.trimStart())}function bft(t){const e=t.trimStart();return/^[-+*]\s+/.test(e)||yft(e)||/^>\s?/.test(e)||/^```/.test(e)||/^~~~/.test(e)}function wft(t){const e=[],n=[];let r=!1;return t.forEach(s=>{if(r){n.push(s);return}if(s.trim()===""){r=!0,n.push(s);return}if(e.length>0&&bft(s)){r=!0,n.push(s);return}e.push(s)}),{paragraphLines:e,blockLines:n}}function _ft(t){const e=[];let n=0,r=0;for(;n<t.length;){const s=t[n],i=s.match(tV);if(!i)break;const[,o,l,c,u]=i,d=o.length,h=parseInt(l,10),f=isNaN(h)?k4(l):void 0,p=isNaN(h)?WK(l):h,m=[u];let v=n+1;const x=[s];let g=!1;for(;v<t.length;){const w=t[v];if(w.match(tV))break;if(w.trim()==="")x.push(w),m.push(""),g=!0,v+=1;else if(w.match(xft)){const j=w.length-w.trimStart().length,N=d+l.length+1;x.push(w),m.push(w.slice(Math.min(j,N))),v+=1}else{if(g)break;x.push(w),m.push(w),v+=1}}e.push({indent:d,number:p,type:f,content:m.join(` 1203`).trim(),contentLines:m,raw:x.join(` 1204`)}),r=v,n=v}return[e,r]}var jft=new RegExp(`^(${VK})([.)])\\s+(.+)$`);function Sft(t){const e=t.split(` 1205`).filter(i=>i.trim().length>0);if(e.length===0)return null;const n=[];for(const i of e){const o=i.trim().match(jft);if(!o)return null;n.push({marker:o[1],content:o[3]})}const r=n.map(i=>i.marker);return oft(r)?{type:"orderedList",attrs:cft(n[0].marker),content:n.map(i=>({type:"listItem",content:[{type:"paragraph",content:[{type:"text",text:i.content}]}]}))}:null}function uCe(t,e,n){const r=[];let s=0;for(;s<t.length;){const i=t[s];if(i.indent===e){const{paragraphLines:o,blockLines:l}=wft(i.contentLines),c=o.join(` 1206`).trim(),u=[];c&&u.push({type:"paragraph",raw:c,tokens:n.inlineTokens(c)});const d=l.join(` 1207`).trim();if(d){const p=n.blockTokens(d);u.push(...p)}let h=s+1;const f=[];for(;h<t.length&&t[h].indent>e;)f.push(t[h]),h+=1;if(f.length>0){const p=Math.min(...f.map(v=>v.indent)),m=uCe(f,p,n);u.push({type:"list",ordered:!0,start:f[0].number,typeMarker:f[0].type,items:m,raw:f.map(v=>v.raw).join(` 1208`)})}r.push({type:"list_item",raw:i.raw,tokens:u}),s=h}else s+=1}return r}function Nft(t,e){return t.map(n=>{if(n.type!=="list_item")return e.parseChildren([n])[0];const r=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(s=>{if(s.type==="paragraph"||s.type==="list"||s.type==="blockquote"||s.type==="code")r.push(...e.parseChildren([s]));else if(s.type==="text"&&s.tokens){const i=e.parseChildren([s]);r.push({type:"paragraph",content:i})}else{const i=e.parseChildren([s]);i.length>0&&r.push(...i)}}),{type:"listItem",content:r}})}var Cft="listItem",ose="textStyle",lse=/^(\d+)\.\s$/;function cse(t){const e=t.match(/list-style-type\s*:\s*([^;]+)/i);if(!e)return null;switch(e[1].trim().toLowerCase()){case"upper-roman":return"I";case"lower-roman":return"i";case"upper-alpha":case"upper-latin":return"A";case"lower-alpha":case"lower-latin":return"a";default:return null}}var dCe=Rs.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>{const e=t.getAttribute("type");if(e)return e;const n=t.getAttribute("style");if(n){const s=cse(n);if(s)return s}const r=t.querySelector("li");if(r){const s=r.getAttribute("style");if(s){const i=cse(s);if(i)return i}}return null}}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,type:n,...r}=t,s=Mn(this.options.HTMLAttributes,r);return e!==1&&(s.start=e),n&&n!=="1"&&(s.type=n),["ol",s,0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const n=t.start||1,r=t.typeMarker,s=t.items?Nft(t.items,e):[],i={};return n!==1&&(i.start=n),r&&(i.type=r),Object.keys(i).length>0?{type:"orderedList",attrs:i,content:s}:{type:"orderedList",content:s}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` 1209`):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{const e=t.match(vft),n=e==null?void 0:e.index;return n!==void 0?n:-1},tokenize:(t,e,n)=>{var r,s;const i=t.split(` 1210`),[o,l]=_ft(i);if(o.length===0)return;const c=uCe(o,0,n);if(c.length===0)return;const u=((r=o[0])==null?void 0:r.number)||1,d=(s=o[0])==null?void 0:s.type;return{type:"list",ordered:!0,start:u,typeMarker:d,items:c,raw:i.slice(0,l).join(` 1211`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Cft,this.editor.getAttributes(ose)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}}
1211,addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins(){return[new fr({props:{handlePaste:(t,e)=>{var n,r;const s=(n=e.clipboardData)==null?void 0:n.getData("text/html");if(s!=null&&s.trim())return!1;const i=(r=e.clipboardData)==null?void 0:r.getData("text/plain");if(!i)return!1;const o=Sft(i);if(!o)return!1;try{const l=t.state.schema.nodeFromJSON(o),c=t.state.tr.replaceSelectionWith(l);return t.dispatch(c),!0}catch{return!1}}}})]},addInputRules(){const t=(n,r)=>(!r.attrs.type||r.attrs.type==="1")&&r.childCount+r.attrs.start===+n[1];let e=ij({find:lse,type:this.type,getAttributes:n=>({start:+n[1]}),joinPredicate:t});return(this.options.keepMarks||this.options.keepAttributes)&&(e=ij({find:lse,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:n=>({start:+n[1],...this.editor.getAttributes(ose)}),joinPredicate:t,editor:this.editor})),[e]}}),kft=/^\s*(\[([( |x])?\])\s$/,Aft=Rs.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",Mn(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const s=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return TK(t,e,s)},addExtensions(){return this.options.nested?[nCe(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const s=document.createElement("li"),i=document.createElement("label"),o=document.createElement("span"),l=document.createElement("input"),c=document.createElement("div"),u=h=>{var f,p;l.ariaLabel=((p=(f=this.options.a11y)==null?void 0:f.checkboxLabel)==null?void 0:p.call(f,h,l.checked))||`Task item checkbox for ${h.textContent||"empty task item"}`};u(t),i.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",h=>h.preventDefault()),l.addEventListener("change",h=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:f}=h.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:p})=>{const m=n();if(typeof m!="number")return!1;const v=p.doc.nodeAt(m);return p.setNodeMarkup(m,void 0,{...v==null?void 0:v.attrs,checked:f}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,f)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([h,f])=>{s.setAttribute(h,f)}),s.dataset.checked=t.attrs.checked,l.checked=t.attrs.checked,i.append(l,o),s.append(i,c),Object.entries(e).forEach(([h,f])=>{s.setAttribute(h,f)});let d=new Set(Object.keys(e));return{dom:s,contentDOM:c,update:h=>{if(h.type!==this.type)return!1;s.dataset.checked=h.attrs.checked,l.checked=h.attrs.checked,u(h);const f=r.extensionManager.attributes,p=Fk(h,f),m=new Set(Object.keys(p)),v=this.options.HTMLAttributes;return d.forEach(x=>{m.has(x)||(x in v?s.setAttribute(x,v[x]):s.removeAttribute(x))}
1211),Object.entries(p).forEach(([x,g])=>{g==null?x in v?s.setAttribute(x,v[x]):s.removeAttribute(x):s.setAttribute(x,g)}),d=m,!0}}}},addInputRules(){return[ij({find:kft,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),Eft=Rs.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",Mn(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` 1212`):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=i=>{const o=zq(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,c)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:n.inlineTokens(l.mainContent),nestedTokens:c}),customNestedParser:r},n);return o?[{type:"taskList",raw:o.raw,items:o.items}]:n.blockTokens(i)},s=zq(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,o)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:n.inlineTokens(i.mainContent),nestedTokens:o}),customNestedParser:r},n);if(s)return{type:"taskList",raw:s.raw,items:s.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});En.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(tCe.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(iCe.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(cCe.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(dCe.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(Aft.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(Eft.configure(this.options.taskList)),t}});var IP=" ",jz="Â ",Tft=Rs.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Mn(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);const r=e.parseInline(n);return n.length===1&&n[0].type==="text"&&(n[0].raw===IP||n[0].text===IP||n[0].raw===jz||n[0].text===jz)&&r.length===1&&r[0].type==="text"&&(r[0].text===IP||r[0].text===jz)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e,n)=>{var r,s;if(!t)return"";const i=Array.isArray(t.content)?t.content:[];if(i.length===0){const o=Array.isArray((r=n==null?void 0:n.previousNode)==null?void 0:r.content)?n.previousNode.content:[];return((s=n==null?void 0:n.previousNode)==null?void 0:s.type)==="paragraph"&&o.length===0?IP:""}return e.renderChildren(i)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Pft=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Mft=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Rft=gp.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",Mn(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>
vendor: 5,408 bytes, line 1212
1212e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[p0({find:Pft,type:this.type})]},addPasteRules(){return[Vg({find:Mft,type:this.type})]}}),Oft=Rs.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),hCe=gp.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",Mn(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const s=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!s)return;const i=s[2].trim();return{type:"underline",raw:s[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),Ift=hCe;function Dft(t={}){return new fr({view(e){return new Lft(e,t)}})}class Lft{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(s=>{let i=o=>{this[s](o)};return e.dom.addEventListener(s,i),{name:s,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,s=this.editorView.dom,i=s.getBoundingClientRect(),o=i.width/s.offsetWidth,l=i.height/s.offsetHeight;if(n){let h=e.nodeBefore,f=e.nodeAfter;if(h||f){let p=this.editorView.nodeDOM(this.cursorPos-(h?h.nodeSize:0));if(p){let m=p.getBoundingClientRect(),v=h?m.bottom:m.top;h&&f&&(v=(v+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let x=this.width/2*l;r={left:m.left,right:m.right,top:v-x,bottom:v+x}}}}if(!r){let h=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*o;r={left:h.left-f,right:h.left+f,top:h.top,bottom:h.bottom}}let c=this.editorView.dom.offsetParent;this.element||(this.element=c.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let u,d;if(!c||c==document.body&&getComputedStyle(c).position=="static")u=-pageXOffset,d=-pageYOffset;else{let h=c.getBoundingClientRect(),f=h.width/c.offsetWidth,p=h.height/c.offsetHeight;u=h.left-c.scrollLeft*f,d=h.top-c.scrollTop*p}this.element.style.left=(r.left-u)/o+"px",this.element.style.top=(r.top-d)/l+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),s=r&&r.type.spec.disableDropCursor,i=typeof s=="function"?s(this.editorView,n,e):s;if(n&&!i){let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=Rje(this.editorView.state.doc,o,this.editorView.dragging.slice);l!=null&&(o=l)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class ns extends Ot{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return ns.valid(r)?new ns(r):Ot.near(r)}content(){return Ge.empty}eq(e){return e instanceof ns&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new ns(e.resolve(n.pos))}getBookmark(){return new GK(this.anchor)}static valid(e){let n=e.parent;if(n.inlineContent||!Fft(e)||!$ft(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let s=n.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&ns.valid(e))return e;let s=e.pos,i=null;for(let o=e.depth;;o--){let l=e.node(o);if(n>
vendor: 14,892 bytes, line 1212
12120?e.indexAfter(o)<l.childCount:e.index(o)>0){i=l.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;s+=n;let c=e.doc.resolve(s);if(ns.valid(c))return c}for(;;){let o=n>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!Dt.isSelectable(i)){e=e.doc.resolve(s+i.nodeSize*n),r=!1;continue e}break}i=o,s+=n;let l=e.doc.resolve(s);if(ns.valid(l))return l}return null}}}ns.prototype.visible=!1;ns.findFrom=ns.findGapCursorFrom;Ot.jsonID("gapcursor",ns);class GK{constructor(e){this.pos=e}map(e){return new GK(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return ns.valid(n)?new ns(n):Ot.near(n)}}function fCe(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function Fft(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||fCe(s.type))return!0;if(s.inlineContent)return!1}}return!0}function $ft(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||fCe(s.type))return!0;if(s.inlineContent)return!1}}return!0}function zft(){return new fr({props:{decorations:Vft,createSelectionBetween(t,e,n){return e.pos==n.pos&&ns.valid(n)?new ns(n):null},handleClick:Uft,handleKeyDown:Bft,handleDOMEvents:{beforeinput:qft}}})}const Bft=wK({ArrowLeft:DP("horiz",-1),ArrowRight:DP("horiz",1),ArrowUp:DP("vert",-1),ArrowDown:DP("vert",1)});function DP(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,s,i){let o=r.selection,l=e>0?o.$to:o.$from,c=o.empty;if(o instanceof It){if(!i.endOfTextblock(n)||l.depth==0)return!1;c=!1,l=r.doc.resolve(e>0?l.after():l.before())}let u=ns.findGapCursorFrom(l,e,c);return u?(s&&s(r.tr.setSelection(new ns(u))),!0):!1}}function Uft(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!ns.valid(r))return!1;let s=t.posAtCoords({left:n.clientX,top:n.clientY});return s&&s.inside>-1&&Dt.isSelectable(t.state.doc.nodeAt(s.inside))?!1:(t.dispatch(t.state.tr.setSelection(new ns(r))),!0)}function qft(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof ns))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let s=De.empty;for(let o=r.length-1;o>=0;o--)s=De.from(r[o].createAndFill(null,s));let i=t.state.tr.replace(n.pos,n.pos,new Ge(s,0,0));return i.setSelection(It.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function Vft(t){if(!(t.selection instanceof ns))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",or.create(t.doc,[gi.widget(t.selection.head,e,{key:"gapcursor"})])}var dD=200,bi=function(){};bi.prototype.append=function(e){return e.length?(e=bi.from(e),!this.length&&e||e.length<dD&&this.leafAppend(e)||this.length<dD&&e.leafPrepend(this)||this.appendInner(e)):this};bi.prototype.prepend=function(e){return e.length?bi.from(e).append(this):this};bi.prototype.appendInner=function(e){return new Hft(this,e)};bi.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?bi.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};bi.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};bi.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};bi.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var s=[];return this.forEach(function(i,o){return s.push(e(i,o))},n,r),s};bi.from=function(e){return e instanceof bi?e:e&&e.length?new pCe(e):bi.empty};var pCe=function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(s,i){return s==0&&i==this.length?this:new e(this.values.slice(s,i))},e.prototype.getInner=function(s){return this.values[s]},e.prototype.forEachInner=function(s,i,o,l){for(var c=i;c<o;c++)if(s(this.values[c],l+c)===!1)return!1},e.prototype.forEachInvertedInner=function(s,i,o,l){for(var c=i-1;c>=o;c--)if(s(this.values[c],l+c)===!1)return!1},e.prototype.leafAppend=function(s){if(this.length+s.length<=dD)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=dD)return new e(s.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(bi);bi.empty=new pCe([]);var Hft=function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,s,i,o){var l=this.left.length;if(s<l&&this.left.forEachInner(r,s,Math.min(i,l),o)===!1||i>l&&this.right.forEachInner(r,Math.max(s-l,0),Math.min(this.length,i)-l,o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,s,i,o){var l=this.left.length;if(s>l&&this.right.forEachInvertedInner(r,s-l,Math.max(i,l)-l,o+l)===!1||i<l&&this.left.forEachInvertedInner(r,Math.min(s,l),i,o)===!1)return!1},e.prototype.sliceInner=function(r,s){if(r==0&&s==this.length)return this;var i=this.left.length;return s<=i?this.left.slice(r,s):r>=i?this.right.slice(r-i,s-i):this.left.slice(r,i).append(this.right.slice(0,s-i))},e.prototype.leafAppend=function(r){var s=this.right.leafAppend(r);if(s)return new e(this.left,s)},e.prototype.leafPrepend=function(r){var s=this.left.leafPrepend(r);if(s)return new e(s,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(bi);const Wft=500;class bu{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let s,i;n&&(s=this.remapping(r,this.items.length),i=s.maps.length);let o=e.tr,l,c,u=[],d=[];return this.items.forEach((h,f)=>{if(!h.step){s||(s=this.remapping(r,f+1),i=s.maps.length),i--,d.push(h);return}if(s){d.push(new ld(h.map));let p=h.step.map(s.slice(i)),m;p&&o.maybeStep(p).doc&&(m=o.mapping.maps[o.mapping.maps.length-1],u.push(new ld(m,void 0,void 0,u.length+d.length))),i--,m&&s.appendMap(m,i)}else o.maybeStep(h.step);if(h.selection)return l=s?h.selection.map(s.slice(i)):h.selection,c=new bu(this.items.slice(0,r).append(d.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:o,selection:l}}addTransform(e,n,r,s){let i=[],o=this.eventCount,l=this.items,c=!s&&l.length?l.get(l.length-1):null;for(let d=0;d<e.steps.length;d++){let h=e.steps[d].invert(e.docs[d]),f=new ld(e.mapping.maps[d],h,n),p;(p=c&&c.merge(f))&&(f=p,d?i.pop():l=l.slice(0,l.length-1)),i.push(f),n&&(o++,n=void 0),s||(c=f)}let u=o-r.depth;return u>Gft&&(l=Kft(l,u),o-=u),new bu(l.append(i),o)}remapping(e,n){let r=new Rk;return this.items.forEach((s,i)=>{let o=s.mirrorOffset!=null&&i-s.mirrorOffset>=e?r.maps.length-s.mirrorOffset:void 0;r.appendMap(s.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new bu(this.items.append(e.map(n=>new ld(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],s=Math.max(0,this.items.length-n),i=e.mapping,o=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},s);let c=n;this.items.forEach(f=>{let p=i.getMirror(--c);if(p==null)return;o=Math.min(o,p);let m=i.maps[p];if(f.step){let v=e.steps[p].invert(e.docs[p]),x=f.selection&&f.selection.map(i.slice(c+1,p));x&&l++,r.push(new ld(m,v,x))}else r.push(new ld(m))},s);let u=[];for(let f=n;f<o;f++)u.push(new ld(i.maps[f]));let d=this.items.slice(0,s).append(u).append(r),h=new bu(d,l);return h.emptyItemCount()>Wft&&(h=h.compress(this.items.length-r.length)),h}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,s=[],i=0;return this.items.forEach((o,l)=>{if(l>=e)s.push(o),o.selection&&i++;else if(o.step){let c=o.step.map(n.slice(r)),u=c&&c.getMap();if(r--,u&&n.appendMap(u,r),c){let d=o.selection&&o.selection.map(n.slice(r));d&&i++;let h=new ld(u.invert(),c,d),f,p=s.length-1;(f=s.length&&s[p].merge(h))?s[p]=f:s.push(h)}}else o.map&&r--},this.items.length,0),new bu(bi.from(s.reverse()),i)}}bu.empty=new bu(bi.empty,0);function Kft(t,e){let n;return t.forEach((r,s)=>{if(r.selection&&e--==0)return n=s,!1}),t.slice(n)}class ld{constructor(e,n,r,s){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new ld(n.getMap().invert(),n,this.selection)}}}class Kp{constructor(e,n,r,s,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=s,this.prevComposition=i}}const Gft=20;function Yft(t,e,n,r){let s=n.getMeta(By),i;if(s)return s.historyState;n.getMeta(Qft)&&(t=new Kp(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(By))return o.getMeta(By).redo?new Kp(t.done.addTransform(n,void 0,r,FR(e)),t.undone,use(n.mapping.maps),t.prevTime,t.prevComposition):new Kp(t.done,t.undone.addTransform(n,void 0,r,FR(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),c=t.prevTime==0||!o&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-r.newGroupDelay||!Xft(n,t.prevRanges)),u=o?Sz(t.prevRanges,n.mapping):use(n.mapping.maps);return new Kp(t.done.addTransform(n,c?e.selection.getBookmark():void 0,r,FR(e)),bu.empty,u,n.time,l??t.prevComposition)}else return(i=n.getMeta("rebased"))?new Kp(t.done.rebased(n,i),t.undone.rebased(n,i),Sz(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Kp(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Sz(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function Xft(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,s)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&s>=e[i]&&(n=!0)}),n}function use(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,s,i,o)=>e.push(i,o));return e}function Sz(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let s=e.map(t[r],1),i=e.map(t[r+1],-1);s<=i&&n.push(s,i)}return n}function Jft(t,e,n){let r=FR(e),s=By.get(e).spec.config,i=(n?t.undone:t.done).popEvent(e,r);if(!i)return null;let o=i.selection.resolve(i.transform.doc),l=(n?t.done:t.undone).addTransform(i.transform,e.selection.getBookmark(),s,r),c=new Kp(n?l:i.remaining,n?i.remaining:l,null,0,-1);return i.transform.setSelection(o).setMeta(By,{redo:n,historyState:c})}let Nz=!1,dse=null;function FR(t){let e=t.plugins;if(dse!=e){Nz=!1,dse=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Nz=!0;break}}return Nz}const By=new as("history"),Qft=new as("closeHistory");function Zft(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new fr({key:By,state:{init(){return new Kp(bu.empty,bu.empty,null,0,-1)},apply(e,n,r){return Yft(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,s=r=="historyUndo"?gCe:r=="historyRedo"?vCe:null;return!s||!e.editable?!1:(n.preventDefault(),s(e.state,e.dispatch))}}}})}function mCe(t,e){return(n,r)=>{let s=By.getState(n);if(!s||(t?s.undone:s.done).eventCount==0)return!1;if(r){let i=Jft(s,n,t);i&&r(e?i.scrollIntoView():i)}return!0}}const gCe=mCe(!1,!0),vCe=mCe(!0,!0);En.create({name:"characterCount",addOptions(){return{limit:null,autoTrim:!0,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc;if(((t==null?void 0:t.mode)||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new fr({key:new as("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const s=this.options.limit,i=this.options.autoTrim;if(s==null||s===0||i===!1){t=!0;return}const o=this.storage.characters({node:r.doc});if(o>s){const l=o-s,c=0,u=l;console.warn(`[CharacterCount] Initial content exceeded limit of ${s} characters. Content was automatically trimmed.`);const d=r.tr.deleteRange(c,u);return t=!0,d}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const s=this.storage.characters({node:n.doc}),i=this.storage.characters({node:e.doc});if(i<=r||s>r&&i>r&&i<=s)return!0;if(s>r&&i>r&&i>s||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,c=i-r,u=l-c,d=l;return e.deleteRange(u,d),!(this.storage.characters({node:e.doc})>r)}})]}});var ept=En.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Dft(this.options)]}});En.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new fr({key:new as("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:s}=e,i=[];if(!n||!r)return or.create(t,[]);let o=0;this.options.mode==="deepest"&&t.descendants((c,u)=>{if(c.isText)return;if(!(s>=u&&s<=u+c.nodeSize-1))return!1;o+=1});let l=0;return t.descendants((c,u)=>{if(c.isText||!(s>=u&&s<=u+c.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&o-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";i.push(gi.node(u,u+c.nodeSize,{class:this.options.className}))}),or.create(t,i)}}})]}});var tpt=En.create({name:"gapCursor",addProseMirrorPlugins(){return[zft()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=gn(jt(t,"allowGapCursor",n)))!=null?e:null}}}),xCe="placeholder",qk=new as("tiptap__placeholder"),hse=200;function fse(t){const{editor:e,placeholder:n,dataAttribute:r,pos:s,node:i,isEmptyDoc:o,hasAnchor:l,classes:{emptyNode:c,emptyEditor:u}}=t,d=[c];return o&&d.push(u),gi.node(s,s+i.nodeSize,{class:d.join(" "),[r]:typeof n=="function"?n({editor:e,node:i,pos:s,hasAnchor:l}):n}
1212)}function pse(t,e){return typeof t=="function"?t(e):t}function npt({editor:t,options:e,dataAttribute:n,doc:r,selection:s}){var i,o;if(!(t.isEditable||!e.showOnlyWhenEditable))return null;const{anchor:c}=s,u=[],d=t.isEmpty;if(e.showOnlyCurrent&&!e.includeChildren){const f=r.resolve(c),p=f.depth>0?f.node(1):f.nodeAfter,m=f.depth>0?f.before(1):c;if(p&&p.type.isTextblock&&$k(p)){const v=c>=m&&c<=m+p.nodeSize;u.push(fse({editor:t,isEmptyDoc:d,dataAttribute:n,hasAnchor:v,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:pse(e.emptyNodeClass,{editor:t,node:p,pos:m,hasAnchor:v})},node:p,pos:m}))}}else{const f=qk.getState(t.state),p=(i=f==null?void 0:f.topPos)!=null?i:0,m=(o=f==null?void 0:f.bottomPos)!=null?o:r.content.size;r.nodesBetween(p,m,(v,x)=>{const g=c>=x&&c<=x+v.nodeSize,w=!v.isLeaf&&$k(v);return v.type.isTextblock&&(g||!e.showOnlyCurrent)&&w&&u.push(fse({editor:t,isEmptyDoc:d,dataAttribute:n,hasAnchor:g,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:pse(e.emptyNodeClass,{editor:t,node:v,pos:x,hasAnchor:g})},node:v,pos:x})),e.includeChildren})}return or.create(r,u)}function rpt(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}function spt(t){const e=getComputedStyle(t),n=`${e.overflow} ${e.overflowY} ${e.overflowX}`;return/auto|scroll|overlay/.test(n)}function ipt(t){let e=t;for(;e;){if(spt(e))return e;const n=e.parentElement;if(!n){const r=e.getRootNode();if(r instanceof ShadowRoot){e=r.host;continue}return window}e=n}return window}function apt(t){return t===window?{top:0,bottom:window.innerHeight}:t.getBoundingClientRect()}function opt({view:t,scrollContainer:e}){const n=t.dom.getBoundingClientRect();if(n.width<=0||n.height<=0)return null;const r=e?apt(e):{top:0,bottom:window.innerHeight},s=Math.max(n.top,r.top)-hse,i=Math.min(n.bottom,r.bottom)+hse;if(s>=i)return null;const o=n.left+1,l=n.right-1;if(o>l)return null;const u=getComputedStyle(t.dom).direction==="rtl"?n.right-2:n.left+2,d=Math.min(Math.max(u,o),l),h=Math.max(s+2,n.top+1),f=Math.min(i-2,n.bottom-1);if(h>f)return null;const p=t.posAtCoords({left:d,top:h}),m=t.posAtCoords({left:d,top:f});return!p||!m?null:{top:p.pos,bottom:m.pos}}
1212var lpt={init(){return{topPos:null,bottomPos:null}},apply(t,e){const n=t.getMeta(qk);return n!=null&&n.positions?{topPos:n.positions.top,bottomPos:n.positions.bottom}:t.docChanged?{topPos:e.topPos!==null?t.mapping.map(e.topPos):null,bottomPos:e.bottomPos!==null?t.mapping.map(e.bottomPos):null}:e}};function cpt(t){const e=ipt(t.dom),n=()=>{const u=opt({view:t,scrollContainer:e});if(u===null)return;const d=qk.getState(t.state);if((d==null?void 0:d.topPos)===u.top&&(d==null?void 0:d.bottomPos)===u.bottom)return;const h=t.state.tr.setMeta(qk,{positions:u});t.dispatch(h)};let r=null,s=0;const i=150,o=()=>{r===null&&(r=requestAnimationFrame(()=>{r=null;const u=performance.now();u-s>=i?(s=u,n()):o()}))};e.addEventListener("scroll",o,{passive:!0});const l=typeof ResizeObserver<"u"?new ResizeObserver(o):null;l==null||l.observe(t.dom);const c=typeof IntersectionObserver<"u"?new IntersectionObserver(o):null;return c==null||c.observe(t.dom),t.dom.addEventListener("focus",o),n(),{update(u,d){t.state.doc.content.size!==d.doc.content.size&&o()},destroy:()=>{r!==null&&cancelAnimationFrame(r),e.removeEventListener("scroll",o),l==null||l.disconnect(),c==null||c.disconnect(),t.dom.removeEventListener("focus",o)}}}function upt({editor:t,options:e}){const n=e.dataAttribute?`data-${rpt(e.dataAttribute)}`:`data-${xCe}`;return new fr({key:qk,state:lpt,view:cpt,props:{decorations:({doc:r,selection:s})=>npt({editor:t,options:e,dataAttribute:n,doc:r,selection:s})}})}var dpt=En.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:xCe,placeholder:"Write something â¦",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[upt({editor:this.editor,options:this.options})]}}),hpt=`.ProseMirror:not(.ProseMirror-focused) *::selection { 1213 background: transparent; 1214} 1215 1216.ProseMirror:not(.ProseMirror-focused) *::-moz-selection { 1217 background: transparent; 1218}`;En.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return t.options.injectCSS&&typeof document<"u"&&ZSe(hpt,t.options.injectNonce,"selection"),[new fr({key:new as("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||YSe(n.selection)||t.view.dragging?null:or.create(n.doc,[gi.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});var fpt="skipTrailingNode";function mse({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||(e==null?void 0:e.type)===t}var ppt=En.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new as(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,s])=>s).filter(s=>(this.options.notAfter||[]).concat(n).includes(s.name));return[new fr({key:e,appendTransaction:(s,i,o)=>{const{doc:l,tr:c,schema:u}=o,d=e.getState(o),h=l.content.size,f=u.nodes[n];if(!s.some(p=>p.getMeta(fpt))&&d)return c.insert(h,f.create())},state:{init:(s,i)=>{const o=i.tr.doc.lastChild;return!mse({node:o,types:r})},apply:(s,i)=>{if(!s.docChanged||s.getMeta("__uniqueIDTransaction"))return i;const o=s.doc.lastChild;return!mse({node:o,types:r})}}})]}}),mpt=En.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>gCe(t,e),redo:()=>({state:t,dispatch:e})=>vCe(t,e)}},addProseMirrorPlugins(){return[Zft(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-Ñ":()=>this.editor.commands.undo(),"Shift-Mod-Ñ":()=>this.editor.commands.redo()}}}),gpt=En.create({name:"starterKit",addExtensions(){var t,e,n,r;const s=[];return this.options.bold!==!1&&s.push(cht.configure(this.options.bold)),this.options.blockquote!==!1&&s.push(sht.configure(this.options.blockquote)),this.options.bulletList!==!1&&s.push(tCe.configure(this.options.bulletList)),this.options.code!==!1&&s.push(hht.configure(this.options.code)),this.options.codeBlock!==!1&&s.push(mht.configure(this.options.codeBlock)),this.options.document!==!1&&s.push(ght.configure(this.options.document)),this.options.dropcursor!==!1&&s.push(ept.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&s.push(tpt.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&s.push(vht.configure(this.options.hardBreak)),this.options.heading!==!1&&s.push(xht.configure(this.options.heading)),this.options.undoRedo!==!1&&s.push(mpt.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&s.push(yht.configure(this.options.horizontalRule)),this.options.italic!==!1&&s.push(Sht.configure(this.options.italic)),this.options.listItem!==!1&&s.push(iCe.configure(this.options.listItem)),this.options.listKeymap!==!1&&s.push(cCe.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&s.push(eCe.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&s.push(dCe.configure(this.options.orderedList)),this.options.paragraph!==!1&&s.push(Tft.configure(this.options.paragraph)),this.options.strike!==!1&&s.push(Rft.configure(this.options.strike)),this.options.text!==!1&&s.push(Oft.configure(this.options.text)),this.options.underline!==!1&&s.push(hCe.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&s.push(ppt.configure((r=this.options)==null?void 0:r.trailingNode)),s}}),vpt=gpt,xpt=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,ypt=Rs.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",Mn(this.options.HTMLAttributes,t)]},parseMarkdown:(t,e)=>e.createNode("image",{src:t.href,title:t.title,alt:t.text}),renderMarkdown:t=>{var e,n,r,s,i,o;const l=(n=(e=t.attrs)==null?void 0:e.src)!=null?n:"",c=(s=(r=t.attrs)==null?void 0:r.alt)!=null?s:"",u=(o=(i=t.attrs)==null?void 0:i.title)!=null?o:"";return u?``:``}
1218,addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:t,minWidth:e,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:s,getPos:i,HTMLAttributes:o,editor:l})=>{const c=document.createElement("img");c.draggable=!1;const u=Mn(this.options.HTMLAttributes,o);Object.entries(u).forEach(([f,p])=>{if(p!=null)switch(f){case"width":case"height":break;default:c.setAttribute(f,p);break}}),u.src!==null&&(c.src=u.src);const d=new Fut({element:c,editor:l,node:s,getPos:i,onResize:(f,p)=>{c.style.width=`${f}px`,c.style.height=`${p}px`},onCommit:(f,p)=>{const m=i();m!==void 0&&this.editor.chain().setNodeSelection(m).updateAttributes(this.name,{width:f,height:p}).run()},onUpdate:(f,p,m)=>f.type===s.type,options:{directions:t,min:{width:e,height:n},preserveAspectRatio:r===!0}}),h=d.dom;return h.style.visibility="hidden",h.style.pointerEvents="none",c.onload=()=>{h.style.visibility="",h.style.pointerEvents=""},d}},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[gNe({find:xpt,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),bpt=ypt,wpt=En.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).some(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).some(e=>e),toggleTextAlign:t=>({editor:e,commands:n})=>this.options.alignments.includes(t)?e.isActive({textAlign:t})?n.unsetTextAlign():n.setTextAlign(t):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),_pt=wpt,jpt=20,yCe=(t,e=0)=>{const n=[];return!t.children.length||e>jpt||Array.from(t.children).forEach(r=>{r.tagName==="SPAN"?n.push(r):r.children.length&&n.push(...yCe(r,e+1))}),n},Spt=t=>{if(!t.children.length)return;const e=yCe(t);e&&e.forEach(n=>{var r,s;const i=n.getAttribute("style"),o=(s=(r=n.parentElement)==null?void 0:r.closest("span"))==null?void 0:s.getAttribute("style");n.setAttribute("style",`${o};${i}`)})},bCe=gp.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&Spt(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",Mn(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleTextStyle:t=>({commands:e})=>e.toggleMark(this.name,t),removeEmptyTextStyle:()=>({tr:t})=>{const{selection:e}=t;return t.doc.nodesBetween(e.from,e.to,(n,r)=>{if(n.isTextblock)return!0;n.marks.filter(s=>s.type===this.type).some(s=>Object.values(s.attrs).some(i=>!!i))||t.removeMark(r,r+n.nodeSize,this.type)}),!0}}}}),Npt=En.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:t=>{var e;const n=(e=Kj(t,"background-color"))!=null?e:t.style.backgroundColor;return n==null?void 0:n.replace(/['"]+/g,"")},renderHTML:t=>t.backgroundColor?{style:`background-color: ${t.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:t=>({chain:e})=>e().setMark("textStyle",{backgroundColor:t}).run(),unsetBackgroundColor:()=>({chain:t})=>t().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),wCe=En.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;const n=(e=Kj(t,"color"))!=null?e:t.style.color;return n==null?void 0:n.replace(/['"]+/g,"")},renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return{setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),Cpt=En.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>{var e;return(e=Kj(t,"font-family"))!=null?e:t.style.fontFamily},renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),kpt=En.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:t=>{var e;return(e=Kj(t,"font-size"))!=null?e:t.style.fontSize},renderHTML:t=>t.fontSize?{style:`font-size: ${t.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:t=>({chain:e})=>e().setMark("textStyle",{fontSize:t}).run(),unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),Apt=En.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:t=>{var e;return(e=Kj(t,"line-height"))!=null?e:t.style.lineHeight},renderHTML:t=>t.lineHeight?{style:`line-height: ${t.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:t=>({chain:e})=>e().setMark("textStyle",{lineHeight:t}).run(),unsetLineHeight:()=>({chain:t})=>t().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}});En.create({name:"textStyleKit",addExtensions(){const t=[];return this.options.backgroundColor!==!1&&t.push(Npt.configure(this.options.backgroundColor)),this.options.color!==!1&&t.push(wCe.configure(this.options.color)),this.options.fontFamily!==!1&&t.push(Cpt.configure(this.options.fontFamily)),this.options.fontSize!==!1&&t.push(kpt.configure(this.options.fontSize)),this.options.lineHeight!==!1&&t.push(Apt.configure(this.options.lineHeight)),this.options.textStyle!==!1&&t.push(bCe.configure(this.options.textStyle)),t}});var Ept=wCe,Tpt=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,Ppt=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,Mpt=gp.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:t=>t.getAttribute("data-color")||Kj(t,"background-color")||t.style.backgroundColor,renderHTML:t=>t.color?{"data-color":t.color,style:`background-color: ${t.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:t}){return["mark",Mn(this.options.HTMLAttributes,t),0]},renderMarkdown:(t,e)=>`==${e.renderChildren(t)}==`,parseMarkdown:(t,e)=>
1218e.applyMark("highlight",e.parseInline(t.tokens||[])),markdownTokenizer:{name:"highlight",level:"inline",start:t=>t.indexOf("=="),tokenize(t,e,n){const s=/^(==)([^=]+)(==)/.exec(t);if(s){const i=s[2].trim(),o=n.inlineTokens(i);return{type:"highlight",raw:s[0],text:i,tokens:o}}}},addCommands(){return{setHighlight:t=>({commands:e})=>e.setMark(this.name,t),toggleHighlight:t=>({commands:e})=>e.toggleMark(this.name,t),unsetHighlight:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[p0({find:Tpt,type:this.type})]},addPasteRules(){return[Vg({find:Ppt,type:this.type})]}}),Rpt=Mpt,Opt=dpt,Ipt=/^((?:https?:)?\/\/)?((?:www|m|music)\.)?((?:youtube\.com|youtu\.be|youtube-nocookie\.com))(\/(?:[\w-]+\?v=|embed\/|v\/)?)([\w-]+)(\S+)?$/,Dpt=/^((?:https?:)?\/\/)?((?:www|m|music)\.)?((?:youtube\.com|youtu\.be|youtube-nocookie\.com))(\/(?:[\w-]+\?v=|embed\/|v\/)?)([\w-]+)(\S+)?$/g,YK=t=>t.match(Ipt),gse=(t,e)=>e?"https://www.youtube-nocookie.com/embed/videoseries?list=":t?"https://www.youtube-nocookie.com/embed/":"https://www.youtube.com/embed/",Lpt=t=>{const{url:e,allowFullscreen:n,autoplay:r,ccLanguage:s,ccLoadPolicy:i,controls:o,disableKBcontrols:l,enableIFrameApi:c,endTime:u,interfaceLanguage:d,ivLoadPolicy:h,loop:f,modestBranding:p,nocookie:m,origin:v,playlist:x,progressBarColor:g,startAt:w,rel:_}=t;if(!YK(e))return null;if(e.includes("/embed/"))return e;if(e.includes("youtu.be")){const k=e.split("/").pop();return k?`${gse(m)}${k}`:null}const N=/(?:(v|list)=|shorts\/)([-\w]+)/gm.exec(e);if(!N||!N[2])return null;let S=`${gse(m,N[1]==="list")}${N[2]}`;const C=[];return n===!1&&C.push("fs=0"),r&&C.push("autoplay=1"),s&&C.push(`cc_lang_pref=${s}`),i&&C.push("cc_load_policy=1"),o||C.push("controls=0"),l&&C.push("disablekb=1"),c&&C.push("enablejsapi=1"),u&&C.push(`end=${u}`),d&&C.push(`hl=${d}`),h&&C.push(`iv_load_policy=${h}`),f&&C.push("loop=1"),p&&C.push("modestbranding=1"),v&&C.push(`origin=${v}`),x&&C.push(`playlist=${x}`),w&&C.push(`start=${w}`),g&&C.push(`color=${g}`),_!==void 0&&C.push(`rel=${_}`),C.length&&(S+=`${N[1]==="list"?"&":"?"}${C.join("&")}`),S},Fpt=t=>{let e;try{e=new URL(t)}catch{return null}const n=e.hostname.replace(/^www\./,"");if(n!=="youtube.com"&&n!=="youtube-nocookie.com")return null;let r=null;if(e.pathname==="/embed/videoseries"){const o=e.searchParams.get("list");if(!o)return null;r=`https://www.youtube.com/playlist?list=${o}`}else{const o=e.pathname.match(/^\/embed\/([\w-]+)$/);if(!(o!=null&&o[1]))return null;r=`https://www.youtube.com/watch?v=${o[1]}`}if(!YK(r))return null;const s={src:r},i=e.searchParams.get("start");if(i){const o=Number.parseInt(i,10);Number.isNaN(o)||(s.start=o)}return s},vse=t=>{if(!t)return null;const e=Number.parseInt(t,10);return Number.isNaN(e)?null:e},xse=t=>{const e=t.getAttribute("src");if(!e)return null;const n=Fpt(e);return n||{src:e}},$pt=Rs.create({name:"youtube",addOptions(){return{addPasteHandler:!0,allowFullscreen:!0,autoplay:!1,ccLanguage:void 0,ccLoadPolicy:void 0,controls:!0,disableKBcontrols:!1,enableIFrameApi:!1,endTime:0,height:480,interfaceLanguage:void 0,ivLoadPolicy:0,loop:!1,modestBranding:!1,HTMLAttributes:{},inline:!1,nocookie:!1,origin:"",playlist:"",progressBarColor:void 0,width:640,rel:1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null,parseHTML:t=>{var e;return(e=xse(t))==null?void 0:e.src}},start:{default:0,parseHTML:t=>{var e;return(e=xse(t))==null?void 0:e.start}},width:{default:this.options.width,parseHTML:t=>vse(t.getAttribute("width"))},height:{default:this.options.height,parseHTML:t=>vse(t.getAttribute("height"))}}},parseHTML(){return[{tag:"div[data-youtube-video] iframe"}]},addCommands(){return{setYoutubeVideo:t=>({commands:e})=>YK(t.src)?e.insertContent({type:this.name,attrs:t}):!1}},addPasteRules(){return this.options.addPasteHandler?[$ut({find:Dpt,type:this.type,getAttributes:t=>({src:t.input})})]:[]},renderHTML({HTMLAttributes:t}){const e=Lpt({url:t.src,allowFullscreen:this.options.allowFullscreen,autoplay:this.options.autoplay,ccLanguage:this.options.ccLanguage,ccLoadPolicy:this.options.ccLoadPolicy,controls:this.options.controls,disableKBcontrol
1218s:this.options.disableKBcontrols,enableIFrameApi:this.options.enableIFrameApi,endTime:this.options.endTime,interfaceLanguage:this.options.interfaceLanguage,ivLoadPolicy:this.options.ivLoadPolicy,loop:this.options.loop,modestBranding:this.options.modestBranding,nocookie:this.options.nocookie,origin:this.options.origin,playlist:this.options.playlist,progressBarColor:this.options.progressBarColor,startAt:t.start||0,rel:this.options.rel});return t.src=e,["div",{"data-youtube-video":""},["iframe",Mn(this.options.HTMLAttributes,{width:this.options.width,height:this.options.height,allowfullscreen:this.options.allowFullscreen,autoplay:this.options.autoplay,ccLanguage:this.options.ccLanguage,ccLoadPolicy:this.options.ccLoadPolicy,disableKBcontrols:this.options.disableKBcontrols,enableIFrameApi:this.options.enableIFrameApi,endTime:this.options.endTime,interfaceLanguage:this.options.interfaceLanguage,ivLoadPolicy:this.options.ivLoadPolicy,loop:this.options.loop,modestBranding:this.options.modestBranding,origin:this.options.origin,playlist:this.options.playlist,progressBarColor:this.options.progressBarColor,rel:this.options.rel},t)]]},...eNe({nodeName:"youtube",allowedAttributes:["src","width","height","start"]})}),zpt=$pt;let nV,rV;if(typeof WeakMap<"u"){let t=new WeakMap;nV=e=>t.get(e),rV=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;nV=r=>{for(let s=0;s<t.length;s+=2)if(t[s]==r)return t[s+1]},rV=(r,s)=>(n==10&&(n=0),t[n++]=r,t[n++]=s)}var rs=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const r=e%this.width,s=e/this.width|0;let i=r+1,o=s+1;for(let l=1;i<this.width&&this.map[e+l]==n;l++)i++;for(let l=1;o<this.height&&this.map[e+this.width*l]==n;l++)o++;return{left:r,top:s,right:i,bottom:o}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){const{left:r,right:s,top:i,bottom:o}=this.findCell(t);return e=="horiz"?(n<0?r==0:s==this.width)?null:this.map[i*this.width+(n<0?r-1:s)]:(n<0?i==0:o==this.height)?null:this.map[r+this.width*(n<0?i-1:o)]}rectBetween(t,e){const{left:n,right:r,top:s,bottom:i}=this.findCell(t),{left:o,right:l,top:c,bottom:u}=this.findCell(e);return{left:Math.min(n,o),top:Math.min(s,c),right:Math.max(r,l),bottom:Math.max(i,u)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let s=t.left;s<t.right;s++){const i=r*this.width+s,o=this.map[i];n[o]||(n[o]=!0,!(s==t.left&&s&&this.map[i-1]==o||r==t.top&&r&&this.map[i-this.width]==o)&&e.push(o))}return e}positionAt(t,e,n){for(let r=0,s=0;;r++){const i=s+n.child(r).nodeSize;if(r==t){let o=e+t*this.width;const l=(t+1)*this.width;for(;o<l&&this.map[o]<s;)o++;return o==l?i-1:this.map[o]}s=i}}static get(t){return nV(t)||rV(t,Bpt(t))}};function Bpt(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=Upt(t),n=t.childCount,r=[];let s=0,i=null;const o=[];for(let u=0,d=e*n;u<d;u++)r[u]=0;for(let u=0,d=0;u<n;u++){const h=t.child(u);d++;for(let m=0;;m++){for(;s<r.length&&r[s]!=0;)s++;if(m==h.childCount)break;const v=h.child(m),{colspan:x,rowspan:g,colwidth:w}=v.attrs;for(let _=0;_<g;_++){if(_+u>=n){(i||(i=[])).push({type:"overlong_rowspan",pos:d,n:g-_});break}const j=s+_*e;for(let N=0;N<x;N++){r[j+N]==0?r[j+N]=d:(i||(i=[])).push({type:"collision",row:u,pos:d,n:x-N});const S=w&&w[N];if(S){const C=(j+N)%e*2,k=o[C];k==null||k!=S&&o[C+1]==1?(o[C]=S,o[C+1]=1):k==S&&o[C+1]++}}}s+=x,d+=v.nodeSize}const f=(u+1)*e;let p=0;for(;s<f;)r[s++]==0&&p++;p&&(i||(i=[])).push({type:"missing",row:u,n:p}),d++}(e===0||n===0)&&(i||(i=[])).push({type:"zero_sized"});const l=new rs(e,n,r,i);let c=!1;for(let u=0;!c&&u<o.length;u+=2)o[u]!=null&&o[u+1]<n&&(c=!0);return c&&qpt(l,o,t),l}function Upt(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const s=t.child(r);let i=0;if(n)for(let o=0;o<r;o++){const l=t.child(o);for(let c=0;c<l.childCount;c++){const u=l.child(c);o+u.attrs.rowspan>r&&(i+=u.attrs.colspan)}}for(let o=0;o<s.childCount;o++){const l=s.child(o);i+=l.attrs.colspan,l.attrs.rowspan>1&&(n=!0)}e==-1?e=i:e!=i&&(e=Math.max(e,i))}return e}function qpt(t,e,n){t.problems||(t.problems=[]);const r={};for(let s=0;s<t.map.length;s++){const i=t.map[s];if(r[i])continue;
1218r[i]=!0;const o=n.nodeAt(i);if(!o)throw new RangeError(`No cell with offset ${i} found`);let l=null;const c=o.attrs;for(let u=0;u<c.colspan;u++){const d=e[(s+u)%t.width*2];d!=null&&(!c.colwidth||c.colwidth[u]!=d)&&((l||(l=Vpt(c)))[u]=d)}l&&t.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:l})}}function Vpt(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function Da(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const r=t.nodes[n],s=r.spec.tableRole;s&&(e[s]=r)}}return e}const nm=new as("selectingCells");function g0(t){for(let e=t.depth-1;e>0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function Hpt(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function Wu(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function E4(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const n=g0(e.$head)||Wpt(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function Wpt(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function sV(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function Kpt(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function XK(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function _Ce(t,e,n){const r=t.node(-1),s=rs.get(r),i=t.start(-1),o=s.nextCell(t.pos-i,e,n);return o==null?null:t.node(0).resolve(i+o)}function v0(t,e,n=1){const r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(s=>s>0)||(r.colwidth=null)),r}function jCe(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let s=0;s<n;s++)r.colwidth.splice(e,0,0)}return r}function Gpt(t,e,n){const r=Da(e.type.schema).header_cell;for(let s=0;s<t.height;s++)if(e.nodeAt(t.map[n+s*t.width]).type!=r)return!1;return!0}var ur=class zh extends Ot{constructor(e,n=e){const r=e.node(-1),s=rs.get(r),i=e.start(-1),o=s.rectBetween(e.pos-i,n.pos-i),l=e.node(0),c=s.cellsInRect(o).filter(d=>d!=n.pos-i);c.unshift(n.pos-i);const u=c.map(d=>{const h=r.nodeAt(d);if(!h)throw new RangeError(`No cell with offset ${d} found`);const f=i+d+1;return new zje(l.resolve(f),l.resolve(f+h.content.size))});super(u[0].$from,u[0].$to,u),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),s=e.resolve(n.map(this.$headCell.pos));if(sV(r)&&sV(s)&&XK(r,s)){const i=this.$anchorCell.node(-1)!=r.node(-1);return i&&this.isRowSelection()?zh.rowSelection(r,s):i&&this.isColSelection()?zh.colSelection(r,s):new zh(r,s)}return It.between(r,s)}content(){const e=this.$anchorCell.node(-1),n=rs.get(e),r=this.$anchorCell.start(-1),s=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),i={},o=[];for(let c=s.top;c<s.bottom;c++){const u=[];for(let d=c*n.width+s.left,h=s.left;h<s.right;h++,d++){const f=n.map[d];if(i[f])continue;i[f]=!0;const p=n.findCell(f);let m=e.nodeAt(f);if(!m)throw new RangeError(`No cell with offset ${f} found`);const v=s.left-p.left,x=p.right-s.right;if(v>0||x>0){let g=m.attrs;if(v>0&&(g=v0(g,0,v)),x>0&&(g=v0(g,g.colspan-x,x)),p.left<s.left){if(m=m.type.createAndFill(g),!m)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(g)}`)}else m=m.type.create(g,m.content)}if(p.top<s.top||p.bottom>s.bottom){const g={...m.attrs,rowspan:Math.min(p.bottom,s.bottom)-Math.max(p.top,s.top)};p.top<s.top?m=m.type.createAndFill(g):m=m.type.create(g,m.content)}u.push(m)}o.push(e.child(c).copy(De.from(u)))}const l=this.isColSelection()&&this.isRowSelection()?e:o;return new Ge(De.from(l),1,1)}replace(e,n=Ge.empty){const r=e.steps.length,s=this.ranges;for(let o=0;o<s.length;o++){const{$from:l,$to:c}=s[o],u=e.mapping.slice(r);e.replace(u.map(l.pos),u.map(c.pos),o?Ge.empty:n)}const i=Ot.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,n){this.replace(e,new Ge(De.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=rs.get(n),s=this.$anchorCell.start(-1),i=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-s,this.$headCell.pos-s));for(let o=0;o<i.length;o++)e(n.nodeAt(i[o]),s+i[o])}isColSelection(){const e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,s=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,s)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),s=rs.get(r),i=e.start(-1),o=s.findCell(e.pos-i),l=s.findCell(n.pos-i),c=e.node(0);return o.top<=l.top?(o.top>0&&(e=c.resolve(i+s.map[o.left])),l.bottom<s.height&&(n=c.resolve(i+s.map[s.width*(s.height-1)+l.right-1]))):(l.top>0&&(n=c.resolve(i+s.map[l.left])),o.bottom<s.height&&(e=c.resolve(i+s.map[s.width*(s.height-1)+o.right-1]))),new zh(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=rs.get(e),r=this.$anchorCell.start(-1),s=n.colCount(this.$anchorCell.pos-r),i=n.colCount(this.$headCell.pos-r);if(Math.min(s,i)>0)return!1;const o=s+this.$anchorCell.nodeAfter.attrs.colspan,l=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,l)==n.width}eq(e){return e instanceof zh&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),s=rs.get(r),i=e.start(-1),o=s.findCell(e.pos-i),l=s.findCell(n.pos-i),c=e.node(0);return o.left<=l.left?(o.left>0&&(e=c.resolve(i+s.map[o.top*s.width])),l.right<s.width&&(n=c.resolve(i+s.map[s.width*(l.top+1)-1]))):(l.left>0&&(n=c.resolve(i+s.map[l.top*s.width])),o.right<s.width&&(e=c.resolve(i+s.map[s.width*(o.top+1)-1]))),new zh(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new zh(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new zh(e.resolve(n),e.resolve(r))}getBookmark(){return new Ypt(this.$anchorCell.pos,this.$headCell.pos)}};ur.prototype.visible=!1;Ot.jsonID("cell",ur);var Ypt=class SCe{constructor(e,n){this.anchor=e,this.head=n}map(e){return new SCe(e.map(this.anchor),e.map(this.head))}resolve(e){const n=e.resolve(this.anchor),r=e.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&r.index()<r.parent.childCount&&XK(n,r)?new ur(n,r):Ot.near(r,1)}};function Xpt(t){if(!(t.selection instanceof ur))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(gi.node(r,r+n.nodeSize,{class:"selectedCell"}))}),or.create(t.doc,e)}function Jpt({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,r=e.pos,s=t.depth;for(;s>=0&&!(t.after(s+1)<t.end(s));s--,n++);for(let i=e.depth;i>=0&&!(e.before(i+1)>e.start(i));i--,r--);
1218return n==r&&/row|table/.test(t.node(s).type.spec.tableRole)}function Qpt({$from:t,$to:e}){let n,r;for(let s=t.depth;s>0;s--){const i=t.node(s);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){n=i;break}}for(let s=e.depth;s>0;s--){const i=e.node(s);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){r=i;break}}return n!==r&&e.parentOffset===0}function Zpt(t,e,n){const r=(e||t).selection,s=(e||t).doc;let i,o;if(r instanceof Dt&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")i=ur.create(s,r.from);else if(o=="row"){const l=s.resolve(r.from+1);i=ur.rowSelection(l,l)}else if(!n){const l=rs.get(r.node),c=r.from+1,u=c+l.map[l.width*l.height-1];i=ur.create(s,c+1,u)}}else r instanceof It&&Jpt(r)?i=It.create(s,r.from):r instanceof It&&Qpt(r)&&(i=It.create(s,r.$from.start(),r.$from.end()));return i&&(e||(e=t.tr)).setSelection(i),e}const emt=new as("fix-tables");function NCe(t,e,n,r){const s=t.childCount,i=e.childCount;e:for(let o=0,l=0;o<i;o++){const c=e.child(o);for(let u=l,d=Math.min(s,o+3);u<d;u++)if(t.child(u)==c){l=u+1,n+=c.nodeSize;continue e}r(c,n),l<s&&t.child(l).sameMarkup(c)?NCe(t.child(l),c,n+1,r):c.nodesBetween(0,c.content.size,r,n+1),n+=c.nodeSize}}function CCe(t,e){let n;const r=(s,i)=>{s.type.spec.tableRole=="table"&&(n=tmt(t,s,i,n))};return e?e.doc!=t.doc&&NCe(e.doc,t.doc,0,r):t.doc.descendants(r),n}function tmt(t,e,n,r){const s=rs.get(e);if(!s.problems)return r;r||(r=t.tr);const i=[];for(let c=0;c<s.height;c++)i.push(0);for(let c=0;c<s.problems.length;c++){const u=s.problems[c];if(u.type=="collision"){const d=e.nodeAt(u.pos);if(!d)continue;const h=d.attrs;for(let f=0;f<h.rowspan;f++)i[u.row+f]+=u.n;r.setNodeMarkup(r.mapping.map(n+1+u.pos),null,v0(h,h.colspan-u.n,u.n))}else if(u.type=="missing")i[u.row]+=u.n;else if(u.type=="overlong_rowspan"){const d=e.nodeAt(u.pos);if(!d)continue;r.setNodeMarkup(r.mapping.map(n+1+u.pos),null,{...d.attrs,rowspan:d.attrs.rowspan-u.n})}else if(u.type=="colwidth mismatch"){const d=e.nodeAt(u.pos);if(!d)continue;r.setNodeMarkup(r.mapping.map(n+1+u.pos),null,{...d.attrs,colwidth:u.colwidth})}else if(u.type=="zero_sized"){const d=r.mapping.map(n);r.delete(d,d+e.nodeSize)}}let o,l;for(let c=0;c<i.length;c++)i[c]&&(o==null&&(o=c),l=c);for(let c=0,u=n+1;c<s.height;c++){const d=e.child(c),h=u+d.nodeSize,f=i[c];if(f>0){let p="cell";d.firstChild&&(p=d.firstChild.type.spec.tableRole);const m=[];for(let x=0;x<f;x++){const g=Da(t.schema)[p].createAndFill();g&&m.push(g)}const v=(c==0||o==c-1)&&l==c?u+1:h-1;r.insert(r.mapping.map(v),m)}u=h}return r.setMeta(emt,{fixTables:!0})}function jh(t){const e=t.selection,n=E4(t),r=n.node(-1),s=n.start(-1),i=rs.get(r);return{...e instanceof ur?i.rectBetween(e.$anchorCell.pos-s,e.$headCell.pos-s):i.findCell(n.pos-s),tableStart:s,map:i,table:r}}function kCe(t,{map:e,tableStart:n,table:r},s){let i=s>0?-1:0;Gpt(e,r,s+i)&&(i=s==0||s==e.width?null:0);for(let o=0;o<e.height;o++){const l=o*e.width+s;if(s>0&&s<e.width&&e.map[l-1]==e.map[l]){const c=e.map[l],u=r.nodeAt(c);t.setNodeMarkup(t.mapping.map(n+c),null,jCe(u.attrs,s-e.colCount(c))),o+=u.attrs.rowspan-1}else{const c=i==null?Da(r.type.schema).cell:r.nodeAt(e.map[l+i]).type,u=e.positionAt(o,s,r);t.insert(t.mapping.map(n+u),c.createAndFill())}}return t}function nmt(t,e){if(!Wu(t))return!1;if(e){const n=jh(t);e(kCe(t.tr,n,n.left))}return!0}function rmt(t,e){if(!Wu(t))return!1;if(e){const n=jh(t);e(kCe(t.tr,n,n.right))}return!0}function smt(t,{map:e,table:n,tableStart:r},s){const i=t.mapping.maps.length;for(let o=0;o<e.height;){const l=o*e.width+s,c=e.map[l],u=n.nodeAt(c),d=u.attrs;if(s>0&&e.map[l-1]==c||s<e.width-1&&e.map[l+1]==c)t.setNodeMarkup(t.mapping.slice(i).map(r+c),null,v0(d,s-e.colCount(c)));else{const h=t.mapping.slice(i).map(r+c);t.delete(h,h+u.nodeSize)}o+=d.rowspan}}function imt(t,e){if(!Wu(t))return!1;if(e){const n=jh(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let s=n.right-1;smt(r,n,s),s!=n.left;s--){const i=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!i)throw new RangeError("No table found");n.table=i,n.map=rs.get(i)}e(r)}return!0}function amt(t,e,n){var r;const s=Da(e.type.schema).header_cell;for(let i=0;i<t.width;i++)if(((r=e.nodeAt(t.map[i+n*t.width]))===null||r===void 0?void 0:r.type)!=s)return!1;return!0}function ACe(t,{map:e,tableStart:n,table:r},s){let i=n;for(let u=0;u<s;u++)i+=r.child(u).nodeSize;const o=[];let l=s>0?-1:0;amt(e,r,s+l)&&(l=s==0||s==e.height?null:0);for(let u=0,d=e.width*s;u<e.width;u++,d++)if(s>0&&s<e.height&&e.map[d]==e.map[d-e.width]){const h=e.map[d],f=r.nodeAt(h).attrs;t.setNodeMarkup(n+h,null,{...f,rowspan:f.rowspan+1}),u+=f.colspan-1}else{var c;
vendor: 5,055 bytes, line 1218
1218const h=l==null?Da(r.type.schema).cell:(c=r.nodeAt(e.map[d+l*e.width]))===null||c===void 0?void 0:c.type,f=h==null?void 0:h.createAndFill();f&&o.push(f)}return t.insert(i,Da(r.type.schema).row.create(null,o)),t}function omt(t,e){if(!Wu(t))return!1;if(e){const n=jh(t);e(ACe(t.tr,n,n.top))}return!0}function lmt(t,e){if(!Wu(t))return!1;if(e){const n=jh(t);e(ACe(t.tr,n,n.bottom))}return!0}function cmt(t,{map:e,table:n,tableStart:r},s){let i=0;for(let u=0;u<s;u++)i+=n.child(u).nodeSize;const o=i+n.child(s).nodeSize,l=t.mapping.maps.length;t.delete(i+r,o+r);const c=new Set;for(let u=0,d=s*e.width;u<e.width;u++,d++){const h=e.map[d];if(!c.has(h)){if(c.add(h),s>0&&h==e.map[d-e.width]){const f=n.nodeAt(h).attrs;t.setNodeMarkup(t.mapping.slice(l).map(h+r),null,{...f,rowspan:f.rowspan-1}),u+=f.colspan-1}else if(s<e.height&&h==e.map[d+e.width]){const f=n.nodeAt(h),p=f.attrs,m=f.type.create({...p,rowspan:f.attrs.rowspan-1},f.content),v=e.positionAt(s+1,u,n);t.insert(t.mapping.slice(l).map(r+v),m),u+=p.colspan-1}}}}function umt(t,e){if(!Wu(t))return!1;if(e){const n=jh(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let s=n.bottom-1;cmt(r,n,s),s!=n.top;s--){const i=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!i)throw new RangeError("No table found");n.table=i,n.map=rs.get(n.table)}e(r)}return!0}function yse(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function dmt({width:t,height:e,map:n},r){let s=r.top*t+r.left,i=s,o=(r.bottom-1)*t+r.left,l=s+(r.right-r.left-1);for(let c=r.top;c<r.bottom;c++){if(r.left>0&&n[i]==n[i-1]||r.right<t&&n[l]==n[l+1])return!0;i+=t,l+=t}for(let c=r.left;c<r.right;c++){if(r.top>0&&n[s]==n[s-t]||r.bottom<e&&n[o]==n[o+t])return!0;s++,o++}return!1}function bse(t,e){const n=t.selection;if(!(n instanceof ur)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=jh(t),{map:s}=r;if(dmt(s,r))return!1;if(e){const i=t.tr,o={};let l=De.empty,c,u;for(let d=r.top;d<r.bottom;d++)for(let h=r.left;h<r.right;h++){const f=s.map[d*s.width+h],p=r.table.nodeAt(f);if(!(o[f]||!p))if(o[f]=!0,c==null)c=f,u=p;else{yse(p)||(l=l.append(p.content));const m=i.mapping.map(f+r.tableStart);i.delete(m,m+p.nodeSize)}}if(c==null||u==null)return!0;if(i.setNodeMarkup(c+r.tableStart,null,{...jCe(u.attrs,u.attrs.colspan,r.right-r.left-u.attrs.colspan),rowspan:r.bottom-r.top}),l.size>0){const d=c+1+u.content.size,h=yse(u)?c+1:d;i.replaceWith(h+r.tableStart,d+r.tableStart,l)}i.setSelection(new ur(i.doc.resolve(c+r.tableStart))),e(i)}return!0}function wse(t,e){const n=Da(t.schema);return hmt(({node:r})=>n[r.type.spec.tableRole])(t,e)}function hmt(t){return(e,n)=>{const r=e.selection;let s,i;if(r instanceof ur){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;s=r.$anchorCell.nodeAfter,i=r.$anchorCell.pos}else{var o;if(s=Hpt(r.$from),!s)return!1;i=(o=g0(r.$from))===null||o===void 0?void 0:o.pos}if(s==null||i==null||s.attrs.colspan==1&&s.attrs.rowspan==1)return!1;if(n){let l=s.attrs;const c=[],u=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});const d=jh(e),h=e.tr;for(let p=0;p<d.right-d.left;p++)c.push(u?{...l,colwidth:u&&u[p]?[u[p]]:null}:l);let f;for(let p=d.top;p<d.bottom;p++){let m=d.map.positionAt(p,d.left,d.table);p==d.top&&(m+=s.nodeSize);for(let v=d.left,x=0;v<d.right;v++,x++)v==d.left&&p==d.top||h.insert(f=h.mapping.map(m+d.tableStart,1),t({node:s,row:p,col:v}).createAndFill(c[x]))}h.setNodeMarkup(i,t({node:s,row:d.top,col:d.left}),c[0]),r instanceof ur&&h.setSelection(new ur(h.doc.resolve(r.$anchorCell.pos),f?h.doc.resolve(f):void 0)),n(h)}return!0}}function fmt(t,e){return function(n,r){if(!Wu(n))return!1;const s=E4(n);if(s.nodeAfter.attrs[t]===e)return!1;if(r){const i=n.tr;n.selection instanceof ur?n.selection.forEachCell((o,l)=>{o.attrs[t]!==e&&i.setNodeMarkup(l,null,{...o.attrs,[t]:e})}):i.setNodeMarkup(s.pos,null,{...s.nodeAfter.attrs,[t]:e}),r(i)}return!0}}function pmt(t){return function(e,n){if(!Wu(e))return!1;if(n){const r=Da(e.schema),s=jh(e),i=e.tr,o=s.map.cellsInRect(t=="column"?{left:s.left,top:0,right:s.right,bottom:s.map.height}:t=="row"?{left:0,top:s.top,right:s.map.width,bottom:s.bottom}:s),l=o.map(c=>s.table.nodeAt(c));for(let c=0;c<o.length;c++)l[c].type==r.header_cell&&i.setNodeMarkup(s.tableStart+o[c],r.cell,l[c].attrs);if(i.steps.length===0)for(let c=0;c<o.length;c++)i.setNodeMarkup(s.tableStart+o[c],r.header_cell,l[c].attrs);n(i)}return!0}}function _se(t,e,n){const r=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let s=0;s<r.length;s++){const i=e.table.nodeAt(r[s]);if(i&&i.type!==n.header_cell)return!1}return!0}function Vk(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?pmt(t):function(n,r){if(!Wu(n))return!1;if(r){const s=Da(n.schema),i=jh(n),o=n.tr,l=_se("row",i,s),c=_se("column",i,s),u=(t==="column"?l:t==="row"&&c)?1:0,d=t=="column"?{left:0,top:u,right:1,bottom:i.map.height}:t=="row"?{left:u,top:0,right:i.map.width,bottom:1}:i,h=t=="column"?c?s.cell:s.header_cell:t=="row"?l?s.cell:s.header_cell:s.cell;
1218i.map.cellsInRect(d).forEach(f=>{const p=f+i.tableStart,m=o.doc.nodeAt(p);m&&o.setNodeMarkup(p,h,m.attrs)}),r(o)}return!0}}Vk("row",{useDeprecatedLogic:!0});Vk("column",{useDeprecatedLogic:!0});const mmt=Vk("cell",{useDeprecatedLogic:!0});function gmt(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,s=t.before();r>=0;r--){const i=t.node(-1).child(r),o=i.lastChild;if(o)return s-1-o.nodeSize;s-=i.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;const n=t.node(-1);for(let r=t.indexAfter(-1),s=t.after();r<n.childCount;r++){const i=n.child(r);if(i.childCount)return s+1;s+=i.nodeSize}}return null}function jse(t){return function(e,n){if(!Wu(e))return!1;const r=gmt(E4(e),t);if(r==null)return!1;if(n){const s=e.doc.resolve(r);n(e.tr.setSelection(It.between(s,Kpt(s))).scrollIntoView())}return!0}}function vmt(t,e){const n=t.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function LP(t,e){const n=t.selection;if(!(n instanceof ur))return!1;if(e){const r=t.tr,s=Da(t.schema).cell.createAndFill().content;n.forEachCell((i,o)=>{i.content.eq(s)||r.replace(r.mapping.map(o+1),r.mapping.map(o+i.nodeSize-1),new Ge(s,0,0))}),r.docChanged&&e(r)}return!0}function xmt(t){if(t.size===0)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;const s=e.child(0),i=s.type.spec.tableRole,o=s.type.schema,l=[];if(i=="row")for(let c=0;c<e.childCount;c++){let u=e.child(c).content;const d=c?0:Math.max(0,n-1),h=c<e.childCount-1?0:Math.max(0,r-1);(d||h)&&(u=iV(Da(o).row,new Ge(u,d,h)).content),l.push(u)}else if(i=="cell"||i=="header_cell")l.push(n||r?iV(Da(o).row,new Ge(e,n,r)).content:e);else return null;return ymt(o,l)}function ymt(t,e){const n=[];for(let s=0;s<e.length;s++){const i=e[s];for(let o=i.childCount-1;o>=0;o--){const{rowspan:l,colspan:c}=i.child(o).attrs;for(let u=s;u<s+l;u++)n[u]=(n[u]||0)+c}}let r=0;for(let s=0;s<n.length;s++)r=Math.max(r,n[s]);for(let s=0;s<n.length;s++)if(s>=e.length&&e.push(De.empty),n[s]<r){const i=Da(t).cell.createAndFill(),o=[];for(let l=n[s];l<r;l++)o.push(i);e[s]=e[s].append(De.from(o))}return{height:e.length,width:r,rows:e}}function iV(t,e){const n=t.createAndFill();return new cK(n).replace(0,n.content.size,e).doc}function bmt({width:t,height:e,rows:n},r,s){if(t!=r){const i=[],o=[];for(let l=0;l<n.length;l++){const c=n[l],u=[];for(let d=i[l]||0,h=0;d<r;h++){let f=c.child(h%c.childCount);d+f.attrs.colspan>r&&(f=f.type.createChecked(v0(f.attrs,f.attrs.colspan,d+f.attrs.colspan-r),f.content)),u.push(f),d+=f.attrs.colspan;for(let p=1;p<f.attrs.rowspan;p++)i[l+p]=(i[l+p]||0)+f.attrs.colspan}o.push(De.from(u))}n=o,t=r}if(e!=s){const i=[];for(let o=0,l=0;o<s;o++,l++){const c=[],u=n[l%e];for(let d=0;d<u.childCount;d++){let h=u.child(d);o+h.attrs.rowspan>s&&(h=h.type.create({...h.attrs,rowspan:Math.max(1,s-h.attrs.rowspan)},h.content)),c.push(h)}i.push(De.from(c))}n=i,e=s}return{width:t,height:e,rows:n}}function wmt(t,e,n,r,s,i,o){const l=t.doc.type.schema,c=Da(l);let u,d;if(s>e.width)for(let h=0,f=0;h<e.height;h++){const p=n.child(h);f+=p.nodeSize;const m=[];let v;p.lastChild==null||p.lastChild.type==c.cell?v=u||(u=c.cell.createAndFill()):v=d||(d=c.header_cell.createAndFill());for(let x=e.width;x<s;x++)m.push(v);t.insert(t.mapping.slice(o).map(f-1+r),m)}if(i>e.height){const h=[];for(let m=0,v=(e.height-1)*e.width;m<Math.max(e.width,s);m++){const x=m>=e.width?!1:n.nodeAt(e.map[v+m]).type==c.header_cell;h.push(x?d||(d=c.header_cell.createAndFill()):u||(u=c.cell.createAndFill()))}const f=c.row.create(null,De.from(h)),p=[];for(let m=e.height;m<i;m++)p.push(f);t.insert(t.mapping.slice(o).map(r+n.nodeSize-2),p)}return!!(u||d)}function Sse(t,e,n,r,s,i,o,l){if(o==0||o==e.height)return!1;let c=!1;for(let u=s;u<i;u++){const d=o*e.width+u,h=e.map[d];if(e.map[d-e.width]==h){c=!0;const f=n.nodeAt(h),{top:p,left:m}=e.findCell(h);t.setNodeMarkup(t.mapping.slice(l).map(h+r),null,{...f.attrs,rowspan:o-p}),t.insert(t.mapping.slice(l).map(e.positionAt(o,m,n)),f.type.createAndFill({...f.attrs,rowspan:p+f.attrs.rowspan-o})),u+=f.attrs.colspan-1}}return c}function Nse(t,e,n,r,s,i,o,l){if(o==0||o==e.width)return!1;let c=!1;for(let u=s;u<i;u++){const d=u*e.width+o,h=e.map[d];if(e.map[d-1]==h){c=!0;const f=n.nodeAt(h),p=e.colCount(h),m=t.mapping.slice(l).map(h+r);t.setNodeMarkup(m,null,v0(f.attrs,o-p,f.attrs.colspan-(o-p))),t.insert(m+f.nodeSize,f.type.createAndFill(v0(f.attrs,0,o-p))),u+=f.attrs.rowspan-1}}return c}function Cse(t,e,n,r,s){let i=n?t.doc.nodeAt(n-1):t.doc;if(!i)throw new Error("No table found");let o=rs.get(i);const{top:l,left:c}=r,u=c+s.width,d=l+s.height,h=t.tr;let f=0;function p(){if(i=n?h.doc.nodeAt(n-1):h.doc,!i)throw new Error("No table found");o=rs.get(i),f=h.mapping.maps.length}wmt(h,o,i,n,u,d,f)&&p(),Sse(h,o,i,n,c,u,l,f)&&p(),Sse(h,o,i,n,c,u,d,f)&&p(),Nse(h,o,i,n,l,d,c,f)&&p(),Nse(h,o,i,n,l,d,u,f)&&p();for(let m=l;m<d;m++){const v=o.positionAt(m,c,i),x=o.positionAt(m,u,i);h.replace(h.mapping.slice(f).map(v+n),h.mapping.slice(f).map(x+n),new Ge(s.rows[m-l],0,0))}p(),h.setSelection(new ur(h.doc.resolve(n+o.positionAt(l,c,i)),h.doc.resolve(n+o.positionAt(d-1,u-1,i)))),e(h)}const _mt=wK({ArrowLeft:FP("horiz",-1),ArrowRight:FP("horiz",1),ArrowUp:FP("vert",
1218-1),ArrowDown:FP("vert",1),"Shift-ArrowLeft":$P("horiz",-1),"Shift-ArrowRight":$P("horiz",1),"Shift-ArrowUp":$P("vert",-1),"Shift-ArrowDown":$P("vert",1),Backspace:LP,"Mod-Backspace":LP,Delete:LP,"Mod-Delete":LP});function $R(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function FP(t,e){return(n,r,s)=>{if(!s)return!1;const i=n.selection;if(i instanceof ur)return $R(n,r,Ot.near(i.$headCell,e));if(t!="horiz"&&!i.empty)return!1;const o=ECe(s,t,e);if(o==null)return!1;if(t=="horiz")return $R(n,r,Ot.near(n.doc.resolve(i.head+e),e));{const l=n.doc.resolve(o),c=_Ce(l,t,e);let u;return c?u=Ot.near(c,1):e<0?u=Ot.near(n.doc.resolve(l.before(-1)),-1):u=Ot.near(n.doc.resolve(l.after(-1)),1),$R(n,r,u)}}}function $P(t,e){return(n,r,s)=>{if(!s)return!1;const i=n.selection;let o;if(i instanceof ur)o=i;else{const c=ECe(s,t,e);if(c==null)return!1;o=new ur(n.doc.resolve(c))}const l=_Ce(o.$headCell,t,e);return l?$R(n,r,new ur(o.$anchorCell,l)):!1}}function jmt(t,e){const n=t.state.doc,r=g0(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new ur(r))),!0):!1}function Smt(t,e,n){if(!Wu(t.state))return!1;let r=xmt(n);const s=t.state.selection;if(s instanceof ur){r||(r={width:1,height:1,rows:[De.from(iV(Da(t.state.schema).cell,n))]});const i=s.$anchorCell.node(-1),o=s.$anchorCell.start(-1),l=rs.get(i).rectBetween(s.$anchorCell.pos-o,s.$headCell.pos-o);return r=bmt(r,l.right-l.left,l.bottom-l.top),Cse(t.state,t.dispatch,o,l,r),!0}else if(r){const i=E4(t.state),o=i.start(-1);return Cse(t.state,t.dispatch,o,rs.get(i.node(-1)).findCell(i.pos-o),r),!0}else return!1}function Nmt(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=kse(t,e.target);let s;if(e.shiftKey&&t.state.selection instanceof ur)i(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(s=g0(t.state.selection.$anchor))!=null&&((n=Cz(t,e))===null||n===void 0?void 0:n.pos)!=s.pos)i(s,e),e.preventDefault();else if(!r)return;function i(c,u){let d=Cz(t,u);const h=nm.getState(t.state)==null;
1218if(!d||!XK(c,d))if(h)d=c;else return;const f=new ur(c,d);if(h||!t.state.selection.eq(f)){const p=t.state.tr.setSelection(f);h&&p.setMeta(nm,c.pos),t.dispatch(p)}}function o(){t.root.removeEventListener("mouseup",o),t.root.removeEventListener("dragstart",o),t.root.removeEventListener("mousemove",l),nm.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(nm,-1))}function l(c){const u=c,d=nm.getState(t.state);let h;if(d!=null)h=t.state.doc.resolve(d);else if(kse(t,u.target)!=r&&(h=Cz(t,e),!h))return o();h&&i(h,u)}t.root.addEventListener("mouseup",o),t.root.addEventListener("dragstart",o),t.root.addEventListener("mousemove",l)}function ECe(t,e,n){if(!(t.state.selection instanceof It))return null;const{$head:r}=t.state.selection;for(let s=r.depth-1;s>=0;s--){const i=r.node(s);if((n<0?r.index(s):r.indexAfter(s))!=(n<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){const o=r.before(s),l=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(l)?o:null}}return null}function kse(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Cz(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;let{inside:r,pos:s}=n;return r>=0&&g0(t.state.doc.resolve(r))||g0(t.state.doc.resolve(s))}var Cmt=class{constructor(e,n){this.node=e,this.defaultCellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),aV(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,aV(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function aV(t,e,n,r,s,i){let o=0,l=!0,c=e.firstChild;const u=t.firstChild;if(u){for(let h=0,f=0;h<u.childCount;h++){const{colspan:p,colwidth:m}=u.child(h).attrs;for(let v=0;v<p;v++,f++){const x=s==f?i:m&&m[v],g=x?x+"px":"";if(o+=x||r,x||(l=!1),c)c.style.width!=g&&(c.style.width=g),c=c.nextSibling;else{const w=document.createElement("col");w.style.width=g,e.appendChild(w)}}}for(;c;){var d;const h=c.nextSibling;(d=c.parentNode)===null||d===void 0||d.removeChild(c),c=h}l?(n.style.width=o+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=o+"px")}}const Cl=new as("tableColumnResizing");function kmt({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=Cmt,lastColumnResizable:s=!0}={}){const i=new fr({key:Cl,state:{init(o,l){var c;const u=(c=i.spec)===null||c===void 0||(c=c.props)===null||c===void 0?void 0:c.nodeViews,d=Da(l.schema).table.name;return r&&u&&(u[d]=(h,f)=>new r(h,n,f)),new Amt(-1,!1)},apply(o,l){return l.apply(o)}},props:{attributes:o=>{const l=Cl.getState(o);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,l)=>{Emt(o,l,t,s)},mouseleave:o=>{Tmt(o)},mousedown:(o,l)=>{Pmt(o,l,e,n)}},decorations:o=>{const l=Cl.getState(o);if(l&&l.activeHandle>-1)return Dmt(o,l.activeHandle)},nodeViews:{}}});return i}var Amt=class zR{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(Cl);if(r&&r.setHandle!=null)return new zR(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new zR(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let s=e.mapping.map(n.activeHandle,-1);return sV(e.doc.resolve(s))||(s=-1),new zR(s,n.dragging)}return n}};function Emt(t,e,n,r){if(!t.editable)return;const s=Cl.getState(t.state);if(s&&!s.dragging){const i=Rmt(e.target);let o=-1;if(i){const{left:l,right:c}=i.getBoundingClientRect();e.clientX-l<=n?o=Ase(t,e,"left",n):c-e.clientX<=n&&(o=Ase(t,e,"right",n))}if(o!=s.activeHandle){if(!r&&o!==-1){const l=t.state.doc.resolve(o),c=l.node(-1),u=rs.get(c),d=l.start(-1);if(u.colCount(l.pos-d)+l.nodeAfter.attrs.colspan-1==u.width-1)return}TCe(t,o)}}}function Tmt(t){if(!t.editable)return;const e=Cl.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&TCe(t,-1)}function Pmt(t,e,n,r){var s;if(!t.editable)return!1;const i=(s=t.dom.ownerDocument.defaultView)!==null&&s!==void 0?s:window,o=Cl.getState(t.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const l=t.state.doc.nodeAt(o.activeHandle),c=Mmt(t,o.activeHandle,l.attrs);t.dispatch(t.state.tr.setMeta(Cl,{setDragging:{startX:e.clientX,startWidth:c}}));function u(h){i.removeEventListener("mouseup",u),i.removeEventListener("mousemove",d);const f=Cl.getState(t.state);f!=null&&f.dragging&&(Omt(t,f.activeHandle,Ese(f.dragging,h,n)),t.dis
1218patch(t.state.tr.setMeta(Cl,{setDragging:null})))}function d(h){if(!h.which)return u(h);const f=Cl.getState(t.state);if(f&&f.dragging){const p=Ese(f.dragging,h,n);Tse(t,f.activeHandle,p,r)}}return Tse(t,o.activeHandle,c,r),i.addEventListener("mouseup",u),i.addEventListener("mousemove",d),e.preventDefault(),!0}function Mmt(t,e,{colspan:n,colwidth:r}){const s=r&&r[r.length-1];if(s)return s;const i=t.domAtPos(e);let o=i.node.childNodes[i.offset].offsetWidth,l=n;if(r)for(let c=0;c<n;c++)r[c]&&(o-=r[c],l--);return o/l}function Rmt(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function Ase(t,e,n,r){const s=n=="right"?-r:r,i=t.posAtCoords({left:e.clientX+s,top:e.clientY});if(!i)return-1;const{pos:o}=i,l=g0(t.state.doc.resolve(o));if(!l)return-1;if(n=="right")return l.pos;const c=rs.get(l.node(-1)),u=l.start(-1),d=c.map.indexOf(l.pos-u);return d%c.width==0?-1:u+c.map[d-1]}function Ese(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function TCe(t,e){t.dispatch(t.state.tr.setMeta(Cl,{setHandle:e}))}function Omt(t,e,n){const r=t.state.doc.resolve(e),s=r.node(-1),i=rs.get(s),o=r.start(-1),l=i.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,c=t.state.tr;for(let u=0;u<i.height;u++){const d=u*i.width+l;if(u&&i.map[d]==i.map[d-i.width])continue;const h=i.map[d],f=s.nodeAt(h).attrs,p=f.colspan==1?0:l-i.colCount(h);if(f.colwidth&&f.colwidth[p]==n)continue;const m=f.colwidth?f.colwidth.slice():Imt(f.colspan);m[p]=n,c.setNodeMarkup(o+h,null,{...f,colwidth:m})}c.docChanged&&t.dispatch(c)}function Tse(t,e,n,r){const s=t.state.doc.resolve(e),i=s.node(-1),o=s.start(-1),l=rs.get(i).colCount(s.pos-o)+s.nodeAfter.attrs.colspan-1;let c=t.domAtPos(s.start(-1)).node;for(;c&&c.nodeName!="TABLE";)c=c.parentNode;c&&aV(i,c.firstChild,c,r,l,n)}function Imt(t){return Array(t).fill(0)}function Dmt(t,e){const n=[],r=t.doc.resolve(e),s=r.node(-1);if(!s)return or.empty;const i=rs.get(s),o=r.start(-1),l=i.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;for(let u=0;u<i.height;u++){const d=l+u*i.width;if((l==i.width-1||i.map[d]!=i.map[d+1])&&(u==0||i.map[d]!=i.map[d-i.width])){var c;const h=i.map[d],f=o+h+s.nodeAt(h).nodeSize-1,p=document.createElement("div");p.className="column-resize-handle",!((c=Cl.getState(t))===null||c===void 0)&&c.dragging&&n.push(gi.node(o+h,o+h+s.nodeAt(h).nodeSize,{class:"column-resize-dragging"})),n.push(gi.widget(f,p))}}return or.create(t.doc,n)}function Lmt({allowTableNodeSelection:t=!1}={}){return new fr({key:nm,state:{init(){return null},apply(e,n){const r=e.getMeta(nm);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;const{deleted:s,pos:i}=e.mapping.mapResult(n);return s?null:i}},props:{decorations:Xpt,handleDOMEvents:{mousedown:Nmt},createSelectionBetween(e){return nm.getState(e.state)!=null?e.state.selection:null},handleTripleClick:jmt,handleKeyDown:_mt,handlePaste:Smt},appendTransaction(e,n,r){return Zpt(r,CCe(r,n),t)}})}function hD(t){return t==="left"||t==="right"||t==="center"?t:null}function Fmt(t){const e=(t.style.textAlign||"").trim().toLowerCase(),n=(t.getAttribute("align")||"").trim().toLowerCase();return hD(e||n)}function $mt(t){return hD(t==null?void 0:t.align)}function PCe(){return{default:null,parseHTML:t=>Fmt(t),renderHTML:t=>t.align?{style:`text-align: ${t.align}`}:{}}}var MCe=Rs.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{var e,n;const r=t.getAttribute("colwidth"),s=r?r.split(",").map(i=>parseInt(i,10)):null;if(!s){const i=(e=t.closest("table"))==null?void 0:e.querySelectorAll("colgroup > col"),o=Array.from(((n=t.parentElement)==null?void 0:n.children)||[]).indexOf(t);if(o&&o>-1&&i&&i[o]){const l=i[o].getAttribute("width");return l?[parseInt(l,10)]:null}}return s}},align:PCe()}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",Mn(this.options.HTMLAttributes,t),0]}}),RCe=Rs.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}},align:PCe()}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",Mn(this.options.HTMLAttributes,t),0]}}),OCe=Rs.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",Mn(this.options.HTMLAttributes,t),0]}});function oV(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function Pse(t,e,n,r,s,i){var o;let l=0,c=!0,u=e.firstChild;const d=t.firstChild;if(d!==null)for(let f=0,p=0;f<d.childCount;f+=1){const{colspan:m,colwidth:v}=d.child(f).attrs;for(let x=0;x<m;x+=1,p+=1){const g=s===p?i:v&&v[x],w=g?`${g}px`:"";if(l+=g||r,g||(c=!1),u){if(u.style.width!==w){const[_,j]=oV(r,g);u.style.setProperty(_,j)}u=u.nextSibling}else{const _=document.createElement("col"),[j,N]=oV(r,g);_.style.setProperty(j,N),e.appendChild(_)}}}for(;u;){const f=u.nextSibling;(o=u.parentNode)==null||o.removeChild(u),u=f}const h=t.attrs.style&&typeof t.attrs.style=="string"&&/\bwidth\s*:/i.test(t.attrs.style);c&&!h?(n.style.width=`${l}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${l}px`)}var zmt=class{constructor(t,e,n,r={}){this.node=t,this.cellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table"));for(const[s,i]of Object.entries(r))i!=null&&(s==="style"?this.table.style.cssText=String(i):this.table.setAttribute(s,Str
1218ing(i)));t.attrs.style&&(this.table.style.cssText=t.attrs.style),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Pse(t,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!==this.node.type?!1:(this.node=t,Pse(t,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(t){const e=t.target,n=this.dom.contains(e),r=this.contentDOM.contains(e);return!!(n&&!r&&(t.type==="attributes"||t.type==="childList"||t.type==="characterData"))}};function Bmt(t,e,n,r){let s=0,i=!0;const o=[],l=t.firstChild;if(!l)return{};for(let h=0,f=0;h<l.childCount;h+=1){const{colspan:p,colwidth:m}=l.child(h).attrs;for(let v=0;v<p;v+=1,f+=1){const x=n===f?r:m&&m[v];s+=x||e,x||(i=!1);const[g,w]=oV(e,x);o.push(["col",{style:`${g}: ${w}`}])}}const c=i?`${s}px`:"",u=i?"":`${s}px`;return{colgroup:["colgroup",{},...o],tableWidth:c,tableMinWidth:u}}function Mse(t,e){return t.createAndFill()}function Umt(t){if(t.cached.tableNodeTypes)return t.cached.tableNodeTypes;const e={};return Object.keys(t.nodes).forEach(n=>{const r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function qmt(t,e,n,r,s){const i=Umt(t),o=[],l=[];for(let u=0;u<n;u+=1){const d=Mse(i.cell);if(d&&l.push(d),r){const h=Mse(i.header_cell);h&&o.push(h)}}const c=[];for(let u=0;u<e;u+=1)c.push(i.row.createChecked(null,r&&u===0?o:l));return i.table.createChecked(null,c)}function Vmt(t){return t instanceof ur}var zP=({editor:t})=>{const{selection:e}=t.state;if(!Vmt(e))return!1;let n=0;const r=BSe(e.ranges[0].$from,i=>i.type.name==="table");return r==null||r.node.descendants(i=>{if(i.type.name==="table")return!1;["tableCell","tableHeader"].includes(i.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},Hmt="�";function Wmt(t){return(t||"").replace(/\s+/g," ").trim()}function Kmt(t,e,n={}){var r;const s=(r=n.cellLineSeparator)!=null?r:Hmt;if(!t||!t.content||t.content.length===0)return"";const i=[];t.content.forEach(v=>{const x=[];v.content&&v.content.forEach(g=>{let w="";g.content&&Array.isArray(g.content)&&g.content.length>1?w=g.content.map(C=>e.renderChildren(C)).join(s):w=g.content?e.renderChildren(g.content):"";const _=Wmt(w),j=g.type==="tableHeader",N=$mt(g.attrs);x.push({text:_,isHeader:j,align:N})}),i.push(x)});const o=i.reduce((v,x)=>Math.max(v,x.length),0);if(o===0)return"";const l=Array.from({length:o}).fill(0);i.forEach(v=>{var x;for(let g=0;g<o;g+=1){const _=(((x=v[g])==null?void 0:x.text)||"").length;_>l[g]&&(l[g]=_),l[g]<3&&(l[g]=3)}});const c=(v,x)=>v+" ".repeat(Math.max(0,x-v.length)),u=i[0],d=u.some(v=>v.isHeader),h=Array.from({length:o}).fill(null);i.forEach(v=>{var x;for(let g=0;g<o;g+=1)!h[g]&&((x=v[g])!=null&&x.align)&&(h[g]=v[g].align)});let f=` 1219`;const p=Array.from({length:o}).map((v,x)=>d&&u[x]&&u[x].text||"");return f+=`| ${p.map((v,x)=>c(v,l[x])).join(" | ")} | 1220`,f+=`| ${l.map((v,x)=>{const g=Math.max(3,v),w=h[x];return w==="left"?`:${"-".repeat(g)}`:w==="right"?`${"-".repeat(g)}:`:w==="center"?`:${"-".repeat(g)}:`:"-".repeat(g)}).join(" | ")} | 1221`,(d?i.slice(1):i).forEach(v=>{f+=`| ${Array.from({length:o}).fill(0).map((x,g)=>c(v[g]&&v[g].text||"",l[g])).join(" | ")} | 1222`}),f}var Gmt=Kmt,ICe=Rs.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:zmt,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:r,tableMinWidth:s}=Bmt(t,this.options.cellMinWidth),i=e.style;function o(){return i||(r?`width: ${r}`:`min-width: ${s}`)}const l=["table",Mn(this.options.HTMLAttributes,e,{style:o()}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},l]:l},parseMarkdown:(t,e)=>{const n=[],r=Array.isArray(t.align)?t.align:[];if(t.header){const s=[];t.header.forEach((i,o)=>{var l;const c=hD((l=r[o])!=null?l:i.align),u=c?{align:c}:{};s.push(e.createNode("tableHeader",u,[{type:"paragraph",content:e.parseInline(i.tokens)}
1222]))}),n.push(e.createNode("tableRow",{},s))}return t.rows&&t.rows.forEach(s=>{const i=[];s.forEach((o,l)=>{var c;const u=hD((c=r[l])!=null?c:o.align),d=u?{align:u}:{};i.push(e.createNode("tableCell",d,[{type:"paragraph",content:e.parseInline(o.tokens)}]))}),n.push(e.createNode("tableRow",{},i))}),e.createNode("table",void 0,n)},renderMarkdown:(t,e)=>Gmt(t,e),addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:s,editor:i})=>{const o=qmt(i.schema,t,e,n);if(s){const l=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(It.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>nmt(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>rmt(t,e),deleteColumn:()=>({state:t,dispatch:e})=>imt(t,e),addRowBefore:()=>({state:t,dispatch:e})=>omt(t,e),addRowAfter:()=>({state:t,dispatch:e})=>lmt(t,e),deleteRow:()=>({state:t,dispatch:e})=>umt(t,e),deleteTable:()=>({state:t,dispatch:e})=>vmt(t,e),mergeCells:()=>({state:t,dispatch:e})=>bse(t,e),splitCell:()=>({state:t,dispatch:e})=>wse(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>Vk("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>Vk("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>mmt(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>bse(t,e)?!0:wse(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>fmt(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>jse(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>jse(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&CCe(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=ur.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:zP,"Mod-Backspace":zP,Delete:zP,"Mod-Delete":zP}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[kmt({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],Lmt({allowTableNodeSelection:this.options.allowTableNodeSelection})]},addNodeView(){const t=this.options.resizable&&this.editor.isEditable,e=this.options.View;return t||!e?null:({node:n,view:r,HTMLAttributes:s})=>{const i=Mn(this.options.HTMLAttributes,s);return new e(n,this.options.cellMinWidth,r,i)}},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:gn(jt(t,"tableRole",e))}}});En.create({name:"tableKit",addExtensions(){const t=[];return this.options.table!==!1&&t.push(ICe.configure(this.options.table)),this.options.tableCell!==!1&&t.push(MCe.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(RCe.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(OCe.configure(this.options.tableRow)),t}});var Ymt=OCe,Xmt=MCe,Jmt=RCe;const Qmt=[{label:"Bleu",value:"#1B4F72"},{label:"Rouge",value:"#E74C3C"},{label:"Vert",value:"#27AE60"},{label:"Orange",value:"#F39C12"},{label:"Noir",value:"#1A1A1A"},{label:"Gris",value:"#666666"}];function Kn({active:t,onClick:e,children:n,title:r}){return a.jsx("button",{type:"button",onClick:e,title:r,"aria-label":r,className:`flex h-11 w-11 sm:h-8 sm:w-8 items-center justify-center rounded-md transition-colors shrink-0 touch-manipulation ${t?"bg-[#EBF5FB] text-[#1B4F72]":"text-muted-foreground hover:bg-muted active:bg-muted"}`,children:n})}function Tp(){return a.jsx("div",{className:"mx-1 sm:mx-1 h-7 sm:h-6 w-px bg-border/70 shrink-0"})}function Oh({children:t,label:e}){return a.jsx("div",{className:"flex items-center gap-1 sm:gap-0.5 shrink-0",role:"group","aria-label":e,children:t})}function Zmt({editor:t}){const[e,n]=b.useState(!1),[r,s]=b.useState(!1),[i,o]=b.useState(""),[l,c]=b.useState(!0),[u,d]=b.useState(!1),[h,f]=b.useState("upload"),[p,m]=b.useState(""),[v,x]=b.useState(!1),[g,w]=b.useState(""),[_,j]=b.useState(!1),[N,S]=b.useState("");
1222if(!t)return null;const C=()=>{i?t.chain().focus().extendMarkRange("link").setLink({href:i,target:l?"_blank":null}).run():t.chain().focus().unsetLink().run(),s(!1),o(""),c(!0)},k=A=>{A&&(t.isActive("image")?t.chain().focus().updateAttributes("image",{src:A}).run():t.chain().focus().setImage({src:A}).run()),d(!1),m("")},E=()=>{g&&t.commands.setYoutubeVideo({src:g,width:640,height:360}),x(!1),w("")},P=A=>{t.chain().focus().insertContent({type:"callout",attrs:{type:A},content:[{type:"paragraph",content:[{type:"text",text:A==="privilege"?"ð Avantage Carte Privilège":A==="alert"?"â ï¸ Attention":"â¹ï¸ Information"}]}]}).run()},T=A=>{t.chain().focus().setColor(A).run(),j(!1)},M=()=>{const A=t.getAttributes("link").href||"";o(A),s(!0)},R=18;return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"sticky top-0 z-10 rounded-t-lg border-b border-border bg-white shadow-sm [&_svg]:sm:!h-4 [&_svg]:sm:!w-4",children:[a.jsxs("div",{className:"flex items-center gap-1 sm:gap-0.5 px-2 sm:px-1.5 py-1.5 sm:py-1 overflow-x-auto scrollbar-hide",children:[a.jsxs(Oh,{label:"Format",children:[a.jsx(Kn,{active:t.isActive("bold"),onClick:()=>t.chain().focus().toggleBold().run(),title:"Gras",children:a.jsx(Pfe,{size:R})}),a.jsx(Kn,{active:t.isActive("italic"),onClick:()=>t.chain().focus().toggleItalic().run(),title:"Italique",children:a.jsx(Dfe,{size:R})}),a.jsx(Kn,{active:t.isActive("underline"),onClick:()=>t.chain().focus().toggleUnderline().run(),title:"Souligné",children:a.jsx(j5e,{size:R})})]}),a.jsx(Tp,{}),a.jsxs(Oh,{label:"Titres",children:[a.jsx(Kn,{active:t.isActive("heading",{level:2}),onClick:()=>t.chain().focus().toggleHeading({level:2}).run(),title:"H2",children:a.jsx(W$e,{size:R})}),a.jsx(Kn,{active:t.isActive("heading",{level:3}),onClick:()=>t.chain().focus().toggleHeading({level:3}).run(),title:"H3",children:a.jsx(K$e,{size:R})})]}),a.jsx(Tp,{}),a.jsxs(Oh,{label:"Listes",children:[a.jsx(Kn,{active:t.isActive("bulletList"),onClick:()=>t.chain().focus().toggleBulletList().run(),title:"Puces",children:a.jsx(Lfe,{size:R})}),a.jsx(Kn,{active:t.isActive("orderedList"),onClick:()=>t.chain().focus().toggleOrderedList().run(),title:"Numéros",children:a.jsx(t5e,{size:R})})]}),a.jsx(Tp,{}),a.jsxs(Oh,{label:"Insert",children:[a.jsx(Kn,{active:t.isActive("link"),onClick:M,title:"Lien",children:a.jsx(TW,{size:R})}),a.jsx(Kn,{active:t.isActive("image"),onClick:()=>{f("upload"),d(!0)},title:t.isActive("image")?"Remplacer l'image sélectionnée":"Image",children:a.jsx(MO,{size:R})}),t.isActive("image")&&a.jsx(Kn,{onClick:()=>t.chain().focus().deleteSelection().run(),title:"Supprimer l'image sélectionnée",children:a.jsx(ks,{size:R})})]}),a.jsx(Tp,{}),a.jsxs(Oh,{label:"Historique",children:[a.jsx(Kn,{onClick:()=>t.chain().focus().undo().run(),title:"Annuler",children:a.jsx(S5e,{size:R})}),a.jsx(Kn,{onClick:()=>t.chain().focus().redo().run(),title:"Refaire",children:a.jsx(d5e,{size:R})})]}),a.jsx("div",{className:"ml-auto shrink-0 sm:hidden",children:a.jsxs("button",{type:"button",onClick:()=>n(!e),"aria-expanded":e,className:`flex h-11 items-center gap-1 rounded-md px-3 text-sm font-medium transition-colors touch-manipulation ${e?"bg-[#EBF5FB] text-[#1B4F72]":"text-muted-foreground hover:bg-muted"}`,children:["Plus ",a.jsx(wh,{size:16,className:`transition-transform ${e?"rotate-180":""}`})]})})]}),a.jsxs("div",{className:`${e?"flex":"hidden"} sm:flex items-center gap-1 sm:gap-0.5 border-t border-border/50 px-2 sm:px-1.5 py-1.5 sm:py-1 overflow-x-auto scrollbar-hide`,children:[a.jsxs(Oh,{label:"Format+",children:[a.jsx(Kn,{active:t.isActive("strike"),onClick:()=>t.chain().focus().toggleStrike().run(),title:"Barré",children:a.jsx(b5e,{size:R})}),a.jsx(Kn,{active:t.isActive("highlight"),onClick:()=>t.chain().focus().toggleHighlight({color:"#FDEF02"}).run(),title:"Surligner",children:a.jsx(Y$e,{size:R})}),a.jsx(Kn,{active:t.isActive("heading",{level:4}),onClick:()=>t.chain().focus().toggleHeading({level:4}).run(),title:"H4",children:a.jsx(G$e,{size:R})}),a.jsx(Kn,{active:t.isActive("paragraph"),onClick:()=>t.chain().focus().setParagraph().run(),title:"Paragraphe",children:a.jsx(_5e,{size:R})})]}),a.jsx(Tp,{}),a.jsxs(Oh,{label:"Alignement",children:[a.jsx(Kn,{active:t.isActive({textAlign:"left"}),onClick:()=>t.chain().focus().setTextAlign("left").run(),title:"Gauche",children:a.jsx(k$e,{size:R})}),a.jsx(Kn,{active:t.isActive({textAlign:"center"}),onClick:()=>t.chain().focus().setTextAlign("center").run(),title:"Centrer",children:a.jsx(N$e,{size:R})}),a.jsx(Kn,{active:t.isActive({textAlign:"right"}),onClick:()=>t.chain().focus().setTextAlign("right").run(),title:"Droite",children:a.jsx(A$e,{size:R})}),a.jsx(Kn,{active:t.isActive({textAlign:"justify"}),onClick:()=>t.chain().focus().setTextAlign("justify").run(),title:"Justifier",children:a.jsx(C$e,{size:R})})]}),a.jsx(Tp,{}),a.jsxs(Oh,{label:"Insertion",children:[a.jsx(Kn,{onClick:()=>x(!0),title:"YouTube",children:a.jsx(T5e,{size:R})}),a.jsx(Kn,{onClick:()=>t.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),title:"Tableau",children:a.jsx(w5e,{size:R})}),a.jsx(Kn,{onClick:()=>t.chain().focus().setHorizontalRule().run(),title:"Séparateur",children:a.jsx(n3,{size:R})}),a.jsx(Kn,{active:t.isActive("blockquote"),onClick:()=>t.chain().focus().toggleBlockquote().run(),title:"Citation",children:a.jsx(u5e,{size:R})})]}),a.jsx(Tp,{}),a.jsxs(Oh,{label:"Encadrés",children:[a.jsx(Kn,{onClick:()=>P("info"),title:"Info",children:a.jsx(n2,{size:R})}),a.jsx(Kn,{onClick:()=>P("alert"),title:"Alerte",children:a.jsx(F_,{size:R})}),a.jsx(Kn,{onClick:()=>P("privilege"),title:"Carte Privilège",children:a.jsx(Jo,{size:R})})]}),a.jsx(Tp,{}),a.jsxs(p7,{open:_,onOpenChange:j,children:[a.jsx(m7,{asChild:!0,children:a.jsx("button",{type:"button",title:"Couleur du texte","aria-label":"Couleur du texte",className:"flex h-11 w-11 sm:h-8 sm:w-8 items-center justify-center rounded-md text-muted-foreground hover:bg-muted shrink-0 touch-manipulation",children:a.jsx(RO,{size:R})})}),a.jsxs(B3,{className:"w-48 p-3",children:[a.jsx("div",{className:"grid grid-cols-3 gap-2 mb-2",children:Qmt.map(A=>a.jsxs("button",{type:"button",onClick:()=>T(A.value),className:"flex flex-col items-center gap-1",children:[a.jsx("div",{className:"h-6 w-6 rounded-full border border-border",style:{backgroundColor:A.value}}),a.jsx("span",{className:"text-[10px]",children:A.label})]},A.value))}),a.jsxs("div",{className:"flex gap-1",children:[a.jsx(ue,{value:N,onChange:A=>S(A.target.value),placeholder:"#hex",className:"h-7 text-xs"}),a.jsx(H,{size:"sm",variant:"outline",className:"h-7 text-xs px-2",onClick:()=>{N&&T(N)},children:"OK"})]}),a.jsx(H,{size:"sm",variant:"ghost",className:"mt-1 h-6 w-full text-xs",onClick:()=>{t.chain().focus().unsetColor().run(),j(!1)},children:"Réinitialiser"})]})]})]})]}),a.jsx(an,{open:r,onOpenChange:s,children:a.jsxs(nn,{className:"max-w-sm",children:[a.jsx(on,{children:a.jsx(ln,{children:"Insérer un lien"})}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx(te,{children:"URL"}),a.jsx(ue,{value:i,onChange:A=>o(A.target.value),placeholder:"https://..."})]}),a.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[a.jsx(wr,{checked:l,onCheckedChange:A=>c(!!A)})," Ouvrir dans un nouvel onglet"]}
1222),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(H,{onClick:C,children:i?"Appliquer":"Supprimer le lien"}),a.jsx(H,{variant:"outline",onClick:()=>s(!1),children:"Annuler"})]})]})]})}),a.jsx(an,{open:u,onOpenChange:d,children:a.jsxs(nn,{className:"max-w-md",children:[a.jsx(on,{children:a.jsx(ln,{children:"Insérer une image"})}),a.jsxs("div",{className:"flex gap-2 mb-3",children:[a.jsx(H,{variant:h==="upload"?"default":"outline",size:"sm",onClick:()=>f("upload"),children:"Uploader"}),a.jsx(H,{variant:h==="url"?"default":"outline",size:"sm",onClick:()=>f("url"),children:"URL externe"})]}),h==="upload"?a.jsx(c0,{value:[],onChange:A=>{A[0]&&k(A[0])},folder:"articles",single:!0}):a.jsxs("div",{className:"space-y-3",children:[a.jsx(ue,{value:p,onChange:A=>m(A.target.value),placeholder:"https://..."}),a.jsx(H,{onClick:()=>k(p),children:"Insérer"})]})]})}),a.jsx(an,{open:v,onOpenChange:x,children:a.jsxs(nn,{className:"max-w-sm",children:[a.jsx(on,{children:a.jsx(ln,{children:"Insérer une vidéo YouTube"})}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(ue,{value:g,onChange:A=>w(A.target.value),placeholder:"https://www.youtube.com/watch?v=..."}),a.jsx(H,{onClick:E,children:"Insérer"})]})]})})]})}function egt({editor:t}){const[e,n]=b.useState(!1),[r,s]=b.useState([]),[i,o]=b.useState(""),[l,c]=b.useState(!1),u=async()=>{const{data:f}=await Z.storage.from("images").list("articles",{limit:20,sortBy:{column:"created_at",order:"desc"}});f&&s(f.filter(p=>p.name&&!p.name.startsWith(".")).map(p=>({name:p.name,url:Z.storage.from("images").getPublicUrl(`articles/${p.name}`).data.publicUrl})))};b.useEffect(()=>
1222{e&&u()},[e]);const d=r.filter(f=>f.name.toLowerCase().includes(i.toLowerCase())),h=f=>{t&&(t.isActive("image")?t.chain().focus().updateAttributes("image",{src:f}).run():t.chain().focus().setImage({src:f}).run())};return e?a.jsxs("div",{className:"fixed right-0 top-0 z-30 flex h-full w-72 flex-col border-l border-border bg-white shadow-lg",children:[a.jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-2",children:[a.jsx("span",{className:"text-sm font-semibold",children:"Médiathèque"}),a.jsx("button",{type:"button",onClick:()=>n(!1),children:a.jsx(ks,{size:18})})]}),a.jsxs("div",{className:"px-3 py-2 space-y-2",children:[a.jsxs("div",{className:"relative",children:[a.jsx(is,{size:14,className:"absolute left-2 top-2.5 text-muted-foreground"}),a.jsx(ue,{value:i,onChange:f=>o(f.target.value),placeholder:"Rechercher...",className:"pl-7 h-8 text-xs"})]}),a.jsxs(H,{size:"sm",variant:"outline",className:"w-full text-xs",onClick:()=>c(!l),children:[a.jsx(Oa,{size:14,className:"mr-1"})," ",l?"Masquer":"Uploader"]}),l&&a.jsx(c0,{value:[],onChange:f=>{f[0]&&h(f[0]),c(!1),u()},folder:"articles",single:!0})]}),a.jsx("div",{className:"flex-1 overflow-y-auto px-3 py-2",children:a.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[d.map(f=>a.jsxs("button",{type:"button",onClick:()=>h(f.url),className:"group relative aspect-square overflow-hidden rounded border border-border hover:border-primary",children:[a.jsx("img",{src:f.url,alt:f.name,className:"h-full w-full object-cover"}),a.jsx("div",{className:"absolute inset-0 flex items-end bg-black/0 group-hover:bg-black/40 transition-colors",children:a.jsx("span",{className:"hidden group-hover:block w-full truncate px-1 pb-1 text-[9px] text-white",children:f.name})})]},f.name)),d.length===0&&a.jsx("p",{className:"col-span-3 text-center text-xs text-muted-foreground py-4",children:"Aucune image"})]})})]}):a.jsx("button",{type:"button",onClick:()=>n(!0),className:"fixed right-2 top-1/2 z-20 flex items-center gap-1 rounded-l-lg border border-r-0 border-border bg-white px-2 py-3 text-xs text-muted-foreground shadow hover:text-primary",title:"Médiathèque",children:a.jsx(a5e,{size:16})})}const tgt=Rs.create({name:"callout",group:"block",content:"block+",defining:!0,addAttributes(){return{type:{default:"info",parseHTML:t=>t.getAttribute("data-callout-type")||"info",renderHTML:t=>({"data-callout-type":t.type})}}},parseHTML(){return[{tag:"div[data-callout-type]"}]},renderHTML({node:t,HTMLAttributes:e}){const n=t.attrs.type,r={info:"border-l-4 border-[#2E86C1] bg-[#EBF5FB] p-4 rounded-r-lg my-4",alert:"border-l-4 border-[#F39C12] bg-[#FEF9E7] p-4 rounded-r-lg my-4",privilege:"border-l-4 border-[#D4AC0D] bg-[#FEF9E7] p-4 rounded-r-lg my-4"};return["div",Mn(e,{class:r[n]||r.info}),0]}}),kz="    ",ngt=En.create({name:"tabHandler",addKeyboardShortcuts(){return{Tab:()=>this.editor.isActive("table")?this.editor.commands.goToNextCell():this.editor.isActive("listItem")?this.editor.can().sinkListItem("listItem")?this.editor.commands.sinkListItem("listItem"):!0:this.editor.commands.insertContent(kz),"Shift-Tab":()=>{if(this.editor.isActive("table"))return this.editor.commands.goToPreviousCell();if(this.editor.isActive("listItem"))return this.editor.commands.liftListItem("listItem");const{state:t}=this.editor,{from:e,empty:n}=t.selection;if(!n)return!0;const r=Math.max(0,e-kz.length);return t.doc.textBetween(r,e,` 1223`,`
1224`)===kz?this.editor.commands.deleteRange({from:r,to:e}):!0}}}});function lV({value:t,onChange:e,onReadingTime:n,onAutoSave:r}){const[s,i]=b.useState(!1),[o,l]=b.useState(null),c=b.useRef(null),u=b.useRef(t),d=b.useRef(t),h=Vdt({extensions:[vpt.configure({heading:{levels:[2,3,4]}}),Ift,bCe,Ept,Rpt.configure({multicolor:!0}),_pt.configure({types:["heading","paragraph"],defaultAlignment:"justify"}),Xht.configure({openOnClick:!1}),bpt.configure({inline:!1,allowBase64:!0}),Opt.configure({placeholder:"Commencez à rédiger votre article..."}),zpt.configure({inline:!1,ccLanguage:"fr"}),ICe.configure({resizable:!0}),Ymt,Xmt,Jmt,tgt,ngt],content:t,onUpdate:({editor:x})=>{const g=x.getHTML();d.current=g,e(g)}});b.useEffect(()=>{!h||t===d.current||h.getHTML()===t||(h.commands.setContent(t||"",{emitUpdate:!1}),d.current=t)},[h,t]);const f=(h==null?void 0:h.getText())||"",p=f.trim()?f.trim().split(/\s+/).length:0,m=f.length,v=Math.max(1,Math.round(p/200));return b.useEffect(()=>{n==null||n(v)},[v,n]),b.useEffect(()=>{if(r)return c.current=setInterval(()=>{const x=(h==null?void 0:h.getHTML())||"";x!==u.current&&x!=="<p></p>"&&(r(x),u.current=x,l("Sauvegardé"),setTimeout(()=>l(null),3e3))},6e4),()=>{c.current&&clearInterval(c.current)}},[h,r]),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("button",{type:"button",onClick:()=>i(!1),className:`flex items-center gap-1 rounded-md px-3 py-1.5 text-sm transition-colors ${s?"bg-muted text-muted-foreground hover:bg-muted/80":"bg-primary text-primary-foreground"}`,children:[a.jsx(Oc,{size:14})," Ãditer"]}),a.jsxs("button",{type:"button",onClick:()=>i(!0),className:`flex items-center gap-1 rounded-md px-3 py-1.5 text-sm transition-colors ${s?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-muted/80"}`,children:[a.jsx(Mu,{size:14})," Prévisualiser"]})]}),s?a.jsx("div",{className:"prose prose-lg max-w-none rounded-lg border border-border bg-white p-6",style:{minHeight:500},dangerouslySetInnerHTML:{__html:(h==null?void 0:h.getHTML())||""}}):a.jsxs("div",{className:"rounded-lg border border-border bg-white",children:[a.jsx(Zmt,{editor:h}),a.jsx(_Ne,{editor:h,className:"prose prose-base md:prose-lg max-w-none px-3 py-3 md:px-6 md:py-4 focus:outline-none [&_.ProseMirror]:min-h-[400px] md:[&_.ProseMirror]:min-h-[500px] [&_.ProseMirror]:outline-none [&_.ProseMirror_table]:border-collapse [&_.ProseMirror_td]:border [&_.ProseMirror_td]:border-border [&_.ProseMirror_td]:p-2 [&_.ProseMirror_th]:border [&_.ProseMirror_th]:border-border [&_.ProseMirror_th]:bg-muted [&_.ProseMirror_th]:p-2 [&_.ProseMirror_th]:font-semibold [&_.ProseMirror_img]:max-w-full [&_.ProseMirror_img]:rounded-lg [&_.ProseMirror_img.ProseMirror-selectednode]:ring-2 [&_.ProseMirror_img.ProseMirror-selectednode]:ring-primary [&_.ProseMirror_.is-empty]:before:content-[attr(data-placeholder)] [&_.ProseMirror_.is-empty]:before:text-muted-foreground [&_.ProseMirror_.is-empty]:before:float-left [&_.ProseMirror_.is-empty]:before:pointer-events-none [&_.ProseMirror_iframe]:w-full [&_.ProseMirror_iframe]:aspect-video [&_.ProseMirror_iframe]:rounded-lg"}),a.jsx(egt,{editor:h})]}),a.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground px-1",children:[a.jsxs("div",{className:"flex gap-4",children:[a.jsxs("span",{children:[p," mots"]}),a.jsxs("span",{children:[m," caractères"]}),a.jsxs("span",{children:["~",v," min de lecture"]})]}),o&&a.jsx("span",{className:"text-green-600 font-medium",children:o})]})]})}function Rse(t){return t.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}const rgt=["Malaga","Sevilla","Cadiz","Granada","Cordoba","Almeria","Huelva","Jaen"],sgt=["immobilier","apprentissage_formation","assurance","commerce","conciergerie","gestion","golf","maison_travaux","mode_decoration","photographie","restaurant","sante_bien_etre","service","services_juridiques","transports","voyages_logement","activite"],Ose={name:"",slug:"",category:"restaurant",subcategory:"",description:"",short_description:"",address:"",city:"",province:"Malaga",postal_code:"",country:"Espagne",latitude:null,longitude:null,phone:"",email:"",website:"",opening_hours:"",images:[],logo_url:"",is_carte_privilege:!0,carte_discount_percent:0,carte_discount_conditions:"",is_premium:!1,is_esprit_golf:!1,is_active:!0,seo_title:"",seo_description:""};function Ise(){const{id:t}=Xi(),e=!!t,n=Gs(),r=St(),[s,i]=b.useState(Ose),{data:o}=Ne({queryKey:["admin_partner",t],enabled:e,queryFn:async()=>{const{data:u}=await Z.from("partners").select("*").eq("id",t).single();return u}});b.useEffect(()=>{o&&i({...Ose,...o,logo_url:o.logo_url??""})},[o]);const l=(u,d)=>i(h=>({...h,[u]:d})),c=Qe({mutationFn:async()=>{const u={...s,slug:s.slug||Rse(s.name)};if(e){const{error:d}=await Z.from("partners").update(u).eq("id",t);if(d)throw d}else{const{error:d}=await Z.from("partners").insert(u);
1224if(d)throw d}},onSuccess:()=>{r.invalidateQueries({queryKey:["admin_partners"]}),ee.success(e?"Partenaire mis à jour":"Partenaire créé"),n("/admin/partenaires")},onError:u=>ee.error(u.message)});return a.jsxs("div",{className:"mx-auto max-w-3xl",children:[a.jsx("h1",{className:"font-heading text-2xl font-bold",children:e?"Modifier le partenaire":"Nouveau partenaire"}),a.jsxs("div",{className:"mt-6 space-y-5 rounded-xl border border-border bg-card p-6",children:[a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(te,{children:"Nom *"}),a.jsx(ue,{value:s.name,onChange:u=>{l("name",u.target.value),e||l("slug",Rse(u.target.value))}})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Slug"}),a.jsx(ue,{value:s.slug,onChange:u=>l("slug",u.target.value)})]})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(te,{children:"Catégorie"}),a.jsx("select",{className:"w-full rounded-lg border border-border px-3 py-2 text-sm",value:s.category,onChange:u=>l("category",u.target.value),children:sgt.map(u=>a.jsx("option",{value:u,children:u},u))})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Sous-catégorie"}),a.jsx(ue,{value:s.subcategory,onChange:u=>l("subcategory",u.target.value)})]})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Description courte"}),a.jsx(fn,{value:s.short_description,onChange:u=>l("short_description",u.target.value),rows:2})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Description complète"}),a.jsx(fn,{value:s.description,onChange:u=>l("description",u.target.value),rows:5})]}),a.jsx("h3",{className:"font-semibold pt-2",children:"Adresse"}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(te,{children:"Adresse"}),a.jsx(ue,{value:s.address,onChange:u=>l("address",u.target.value)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Ville"}),a.jsx(ue,{value:s.city,onChange:u=>l("city",u.target.value)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Province"}),a.jsx("select",{className:"w-full rounded-lg border border-border px-3 py-2 text-sm",value:s.province,onChange:u=>l("province",u.target.value),children:rgt.map(u=>a.jsx("option",{value:u,children:u},u))})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Code postal"}),a.jsx(ue,{value:s.postal_code,onChange:u=>l("postal_code",u.target.value)})]})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(te,{children:"Latitude"}),a.jsx(ue,{type:"number",step:"0.0001",value:s.latitude??"",onChange:u=>l("latitude",u.target.value?parseFloat(u.target.value):null)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Longitude"}),a.jsx(ue,{type:"number",step:"0.0001",value:s.longitude??"",onChange:u=>l("longitude",u.target.value?parseFloat(u.target.value):null)})]})]}),a.jsx("h3",{className:"font-semibold pt-2",children:"Contact"}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[a.jsxs("div",{children:[a.jsx(te,{children:"Téléphone"}),a.jsx(ue,{value:s.phone,onChange:u=>l("phone",u.target.value)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Email"}),a.jsx(ue,{value:s.email,onChange:u=>l("email",u.target.value)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Site web"}),a.jsx(ue,{value:s.website,onChange:u=>l("website",u.target.value)})]})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Horaires d'ouverture"}),a.jsx(fn,{value:s.opening_hours,onChange:u=>l("opening_hours",u.target.value),rows:2})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Images"}),a.jsx(c0,{value:s.images,onChange:u=>l("images",u),folder:"partners"})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Logo"}),a.jsx(c0,{value:s.logo_url?[s.logo_url]:[],onChange:u=>l("logo_url",u[0]||""),folder:"partners/logos",single:!0})]}),a.jsx("h3",{className:"font-semibold pt-2",children:"Carte Privilège"}),a.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[a.jsx(wr,{checked:s.is_carte_privilege,onCheckedChange:u=>l("is_carte_privilege",!!u)})," Partenaire Carte Privilège"]}),s.is_carte_privilege&&a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 pl-6",children:[a.jsxs("div",{children:[a.jsx(te,{children:"% de réduction"}),a.jsx(ue,{type:"number",value:s.carte_discount_percent,onChange:u=>l("carte_discount_percent",parseInt(u.target.value)||0)})]}),a.jsxs("div",{className:"sm:col-span-2",children:[a.jsx(te,{children:"Conditions / avantages"}),a.jsx(lV,{value:s.carte_discount_conditions||"",onChange:u=>l("carte_discount_conditions",u)})]})]}),a.jsx("h3",{className:"font-semibold pt-2",children:"Visibilité"}),a.jsxs("div",{className:"flex flex-wrap gap-6",children:[a.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[a.jsx(wr,{checked:s.is_premium,onCheckedChange:u=>l("is_premium",!!u)})," Fiche premium"]}),a.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[a.jsx(wr,{checked:s.is_esprit_golf,onCheckedChange:u=>l("is_esprit_golf",!!u)})," Esprit Golf"]}),a.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[a.jsx(wr,{checked:s.is_active,onCheckedChange:u=>l("is_active",!!u)})," Actif"]})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(te,{children:"SEO Titre"}),a.jsx(ue,{value:s.seo_title,onChange:u=>l("seo_title",u.target.value)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"SEO Description"}),a.jsx(ue,{value:s.seo_description,onChange:u=>l("seo_description",u.target.value)})]})]}),a.jsxs("div",{className:"flex gap-3 pt-2",children:[a.jsx(H,{onClick:()=>c.mutate(),disabled:c.isPending,children:c.isPending?"Enregistrementâ¦":"Enregistrer"}),a.jsx(H,{variant:"outline",onClick:()=>n("/admin/partenaires"),children:"Annuler"})]})]})]})}var DCe={exports:{}};/* @license
1225Papa Parse 1226v5.5.4 1227https://github.com/mholt/PapaParse 1228License: MIT 1229*/(function(t,e){((n,r)=>{t.exports=r()})(YS,function n(){var r=typeof self<"u"?self:typeof window<"u"?window:r!==void 0?r:{},s,i=!r.document&&!!r.postMessage,o=r.IS_PAPA_WORKER||!1,l={},c=0,u={};function d(E){return E.charCodeAt(0)===65279?E.slice(1):E}function h(E){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(P){var T=S(P);T.chunkSize=parseInt(T.chunkSize),P.step||P.chunk||(T.chunkSize=null),this._handle=new x(T),(this._handle.streamer=this)._config=T}).call(this,E),this.parseChunk=function(P,T){var M=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<M){let A=this._config.newline;A||(R=this._config.quoteChar||'"',A=this._handle.guessLineEndings(P,R)),P=[...P.split(A).slice(M)].join(A)}this.isFirstChunk&&k(this._config.beforeFirstChunk)&&(R=this._config.beforeFirstChunk(P))!==void 0&&(P=R),this.isFirstChunk=!1,this._halted=!1;var M=this._partialLine+P,R=(this._partialLine="",this._handle.parse(M,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(P=R.meta.cursor,M=(this._finished||(this._partialLine=M.substring(P-this._baseIndex),this._baseIndex=P),R&&R.data&&(this._rowCount+=R.data.length),this._finished||this._config.preview&&this._rowCount>=this._config.preview),o)r.postMessage({results:R,workerId:u.WORKER_ID,finished:M});else if(k(this._config.chunk)&&!T){if(this._config.chunk(R,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=R=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(R.data),this._completeResults.errors=this._completeResults.errors.concat(R.errors),this._completeResults.meta=R.meta),this._completed||!M||!k(this._config.complete)||R&&R.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),M||R&&R.meta.paused||this._nextChunk(),R}this._halted=!0},this._sendError=function(P){k(this._config.error)?this._config.error(P):o&&this._config.error&&r.postMessage({workerId:u.WORKER_ID,error:P,finished:!1})}}function f(E){var P;(E=E||{}).chunkSize||(E.chunkSize=u.RemoteChunkSize),h.call(this,E),this._nextChunk=i?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(T){this._input=T,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(P=new XMLHttpRequest,this._config.withCredentials&&(P.withCredentials=this._config.withCredentials),i||(P.onload=C(this._chunkLoaded,this),P.onerror=C(this._chunkError,this)),P.open(this._config.downloadRequestBody?"POST":"GET",this._input,!i),this._config.downloadRequestHeaders){var T,M=this._config.downloadRequestHeaders;for(T in M)P.setRequestHeader(T,M[T])}var R;this._config.chunkSize&&(R=this._start+this._config.chunkSize-1,P.setRequestHeader("Range","bytes="+this._start+"-"+R));try{P.send(this._config.downloadRequestBody)}catch(A){this._chunkError(A.message)}i&&P.status===0&&this._chunkError()}},this._chunkLoaded=function(){P.readyState===4&&(P.status<200||400<=P.status?this._chunkError():(this._start+=this._config.chunkSize||P.responseText.length,this._finished=!this._config.chunkSize||this._start>=(T=>(T=T.getResponseHeader("Content-Range"))!==null?parseInt(T.substring(T.lastIndexOf("/")+1)):-1)(P),this.parseChunk(P.responseText)))},this._chunkError=function(T){T=P.statusText||T,this._sendError(new Error(T))}}function p(E){(E=E||{}).chunkSize||(E.chunkSize=u.LocalChunkSize),h.call(this,E);var P,T,M=typeof FileReader<"u";this.stream=function(R){this._input=R,T=R.slice||R.webkitSlice||R.mozSlice,M?((P=new FileReader).onload=C(this._chunkLoaded,this),P.onerror=C(this._chunkError,this)):P=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var R=this._input,A=(this._config.chunkSize&&(A=Math.min(this._start+this._config.chunkSize,this._input.size),R=T.call(R,this._start,A)),P.readAsText(R,this._config.encoding));M||this._chunkLoaded({target:{result:A}})},this._chunkLoaded=function(R){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(R.target.result)},this._chunkError=function(){this._sendError(P.error)}}function m(E){var P;h.call(this,E=E||{}),this.stream=function(T){return P=T,this._nextChunk()},this._nextChunk=function(){var T,M;if(!this._finished)return T=this._config.chunkSize,P=T?(M=P.substring(0,T),P.substring(T)):(M=P,""),this._finished=!P,this.parseChunk(M)}}function v(E){h.call(this,E=E||{});var P=[],T=!0,M=!1;this.pause=function(){h.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){h.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(R){this._input=R,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){M&&P.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),P.length?this.parseChunk(P.shift()):T=!0}
1229,this._streamData=C(function(R){try{P.push(typeof R=="string"?R:R.toString(this._config.encoding)),T&&(T=!1,this._checkIsFinished(),this.parseChunk(P.shift()))}catch(A){this._streamError(A)}},this),this._streamError=C(function(R){this._streamCleanUp(),this._sendError(R)},this),this._streamEnd=C(function(){this._streamCleanUp(),M=!0,this._streamData("")},this),this._streamCleanUp=C(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function x(E){var P,T,M,R,A=Math.pow(2,53),I=-A,D=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,O=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,z=this,B=0,G=0,U=!1,F=!1,W=[],Q={data:[],errors:[],meta:{}};function K(le){return E.skipEmptyLines==="greedy"?le.join("").trim()==="":le.length===1&&le[0].length===0}function fe(){if(Q&&M&&(ye("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+u.DefaultDelimiter+"'"),M=!1),E.skipEmptyLines&&(Q.data=Q.data.filter(function(ae){return!K(ae)})),oe()){let ae=function(re,L){re=d(re),k(E.transformHeader)&&(re=E.transformHeader(re,L)),W.push(re)};if(Q)if(Array.isArray(Q.data[0])){for(var le=0;oe()&&le<Q.data.length;le++)Q.data[le].forEach(ae);Q.data.splice(0,1)}else Q.data.forEach(ae)}function me(ae,re){for(var L=E.header?{}:[],X=0;X<ae.length;X++){var ne=X,Y=ae[X],Y=((J,se)=>(ge=>(E.dynamicTypingFunction&&E.dynamicTyping[ge]===void 0&&(E.dynamicTyping[ge]=E.dynamicTypingFunction(ge)),(E.dynamicTyping[ge]||E.dynamicTyping)===!0))(J)?se==="true"||se==="TRUE"||se!=="false"&&se!=="FALSE"&&((ge=>{if(D.test(ge)&&(ge=parseFloat(ge),I<ge&&ge<A))return 1})(se)?parseFloat(se):O.test(se)?new Date(se):se===""?null:se):se)(ne=E.header?X>=W.length?"__parsed_extra":W[X]:ne,Y=E.transform?E.transform(Y,ne):Y);ne==="__parsed_extra"?(L[ne]=L[ne]||[],L[ne].push(Y)):L[ne]=Y}return E.header&&(X>W.length?ye("FieldMismatch","TooManyFields","Too many fields: expected "+W.length+" fields but parsed "+X,G+re):X<W.length&&ye("FieldMismatch","TooFewFields","Too few fields: expected "+W.length+" fields but parsed "+X,G+re)),L}var he;Q&&(E.header||E.dynamicTyping||E.transform)&&(he=1,!Q.data.length||Array.isArray(Q.data[0])?(Q.data=Q.data.map(me),he=Q.data.length):Q.data=me(Q.data,0),E.header&&Q.meta&&(Q.meta.fields=W),G+=he)}function oe(){return E.header&&W.length===0}function ye(le,me,he,ae){le={type:le,code:me,message:he},ae!==void 0&&(le.row=ae),Q.errors.push(le)}k(E.step)&&(R=E.step,E.step=function(le){Q=le,oe()?fe():(fe(),Q.data.length!==0&&(B+=le.data.length,E.preview&&B>E.preview?T.abort():(Q.data=Q.data[0],R(Q,z))))}),this.parse=function(le,me,he){var ae=E.quoteChar||'"',ae=(E.newline||(E.newline=this.guessLineEndings(le,ae)),M=!1,E.delimiter?k(E.delimiter)&&(E.delimiter=E.delimiter(le),Q.meta.delimiter=E.delimiter):((ae=((re,L,X,ne,Y)=>{var J,se,ge,de;Y=Y||[","," ","|",";",u.RECORD_SEP,u.UNIT_SEP];for(var ce=0;ce<Y.length;ce++){for(var xe,je=Y[ce],be=0,Ee=0,Me=0,Oe=(ge=void 0,new w({comments:ne,delimiter:je,newline:L,preview:10}).parse(re)),st=0;st<Oe.data.length;st++)X&&K(Oe.data[st])?Me++:(xe=Oe.data[st].length,Ee+=xe,ge===void 0?ge=xe:0<xe&&(be+=Math.abs(xe-ge),ge=xe));0<Oe.data.length&&(Ee/=Oe.data.length-Me),(se===void 0||be<=se)&&(de===void 0||de<Ee)&&1.99<Ee&&(se=be,J=je,de=Ee)}return{successful:!!(E.delimiter=J),bestDelimiter:J}})(le,E.newline,E.skipEmptyLines,E.comments,E.delimitersToGuess)).successful?E.delimiter=ae.bestDelimiter:(M=!0,E.delimiter=u.DefaultDelimiter),Q.meta.delimiter=E.delimiter),S(E));return E.preview&&E.header&&ae.preview++,P=le,T=new w(ae),Q=T.parse(P,me,he),fe(),U?{meta:{paused:!0}}:Q||{meta:{paused:!1}}},this.paused=function(){return U},this.pause=function(){U=!0,T.abort(),P=k(E.chunk)?"":P.substring(T.getCharIndex())},this.resume=function(){z.streamer._halted?(U=!1,z.streamer.parseChunk(P,!0)):setTimeout(z.resume,3)},this.aborted=function(){return F},this.abort=function(){F=!0,T.abort(),Q.meta.aborted=!0,k(E.complete)&&E.complete(Q),P=""},this.guessLineEndings=function(re,ae){re=re.substring(0,1048576);var ae=new RegExp(g(ae)+"([^]*?)"+g(ae),"gm"),he=(re=re.replace(ae,"")).split("\r"),ae=re.split(` 1230`),re=1<ae.length&&ae[0].length<he[0].length;if(he.length===1||re)return` 1231`;for(var L=0,X=0;X<he.length;X++)he[X][0]===` 1232`&&L++;return L>=he.length/2?`\r 1233`:"\r"}}function g(E){return E.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function w(E){var P=(E=E||{}).delimiter,T=E.newline,M=E.comments,R=E.step,A=E.preview,I=E.fastMode,D=null,O=!1,z=E.quoteChar==null?'"':E.quoteChar,B=z;if(E.escapeChar!==void 0&&(B=E.escapeChar),(typeof P!="string"||-1<u.BAD_DELIMITERS.indexOf(P))&&(P=","),M===P)throw new Error("Comment character same as delimiter");M===!0?M="#":(typeof M!="string"||-1<u.BAD_DELIMITERS.indexOf(M))&&(M=!1),T!==` 1234`&&T!=="\r"&&T!==`\r 1235`&&(T=` 1236`);var G=0,U=!1;this.parse=function(F,W,Q){if(typeof F!="string")throw new Error("Input must be a string");var K=F.length,fe=P.length,oe=T.length,ye=M.length,le=k(R),me=[],he=[],ae=[],re=G=0;if(!F)return be();if(I||I!==!1&&F.indexOf(z)===-1){for(var L=F.split(T),X=0;X<L.length;X++){if(ae=L[X],G+=ae.length,X!==L.length-1)G+=T.length;else if(Q)return be();if(!M||ae.substring(0,ye)!==M){if(le){if(me=[],de(ae.split(P)),Ee(),U)return be()}else de(ae.split(P));if(A&&A<=X)return me=me.slice(0,A),be(!0)}}return be()}for(var ne=F.indexOf(P,G),Y=F.indexOf(T,G),J=new RegExp(g(B)+g(z),"g"),se=F.indexOf(z,G);;)if(F[G]===z)for(se=G,G++;;
1236){if((se=F.indexOf(z,se+1))===-1)return Q||he.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:me.length,index:G}),xe();if(se===K-1)return xe(F.substring(G,se).replace(J,z));if(z===B&&F[se+1]===B)se++;else if(z===B||se===0||F[se-1]!==B){ne!==-1&&ne<se+1&&(ne=F.indexOf(P,se+1));var ge=ce((Y=Y!==-1&&Y<se+1?F.indexOf(T,se+1):Y)===-1?ne:Math.min(ne,Y));if(F.substr(se+1+ge,fe)===P){ae.push(F.substring(G,se).replace(J,z)),F[G=se+1+ge+fe]!==z&&(se=F.indexOf(z,G)),ne=F.indexOf(P,G),Y=F.indexOf(T,G);break}if(ge=ce(Y),F.substring(se+1+ge,se+1+ge+oe)===T){if(ae.push(F.substring(G,se).replace(J,z)),je(se+1+ge+oe),ne=F.indexOf(P,G),se=F.indexOf(z,G),le&&(Ee(),U))return be();if(A&&me.length>=A)return be(!0);break}he.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:me.length,index:G}),se++}}else if(M&&ae.length===0&&F.substring(G,G+ye)===M){if(Y===-1)return be();G=Y+oe,Y=F.indexOf(T,G),ne=F.indexOf(P,G)}else if(ne!==-1&&(ne<Y||Y===-1))ae.push(F.substring(G,ne)),G=ne+fe,ne=F.indexOf(P,G);else{if(Y===-1)break;if(ae.push(F.substring(G,Y)),je(Y+oe),le&&(Ee(),U))return be();if(A&&me.length>=A)return be(!0)}return xe();function de(Me){me.push(Me),re=G}function ce(Me){var Oe=0;return Oe=Me!==-1&&(Me=F.substring(se+1,Me))&&Me.trim()===""?Me.length:Oe}function xe(Me){return Q||(Me===void 0&&(Me=F.substring(G)),ae.push(Me),G=K,de(ae),le&&Ee()),be()}function je(Me){G=Me,de(ae),ae=[],Y=F.indexOf(T,G)}function be(Me){if(E.header&&!W&&me.length&&!O){var Oe=me[0],st=Object.create(null),Ye=new Set(Oe);let gt=!1;for(let At=0;At<Oe.length;At++){let yt=d(Oe[At]);if(st[yt=k(E.transformHeader)?E.transformHeader(yt,At):yt]){let Qt,nr=st[yt];for(;Qt=yt+"_"+nr,nr++,Ye.has(Qt););Ye.add(Qt),Oe[At]=Qt,st[yt]++,gt=!0,(D=D===null?{}:D)[Qt]=yt}else st[yt]=1,Oe[At]=yt;Ye.add(yt)}gt&&console.warn("Duplicate headers found and renamed."),O=!0}return{data:me,errors:he,meta:{delimiter:P,linebreak:T,aborted:U,truncated:!!Me,cursor:re+(W||0),renamedHeaders:D}}}function Ee(){R(be()),me=[],he=[]}},this.abort=function(){U=!0},this.getCharIndex=function(){return G}}function _(E){var P=E.data,T=l[P.workerId],M=!1;if(P.error)T.userError(P.error,P.file);else if(P.results&&P.results.data){var R={abort:function(){M=!0,j(P.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:N,resume:N};if(k(T.userStep)){for(var A=0;A<P.results.data.length&&(T.userStep({data:P.results.data[A],errors:P.results.errors,meta:P.results.meta},R),!M);A++);delete P.results}else k(T.userChunk)&&(T.userChunk(P.results,R,P.file),delete P.results)}P.finished&&!M&&j(P.workerId,P.results)}function j(E,P){var T=l[E];k(T.userComplete)&&T.userComplete(P),T.terminate(),delete l[E]}function N(){throw new Error("Not implemented.")}function S(E){if(typeof E!="object"||E===null)return E;var P,T=Array.isArray(E)?[]:{};for(P in E)T[P]=S(E[P]);return T}function C(E,P){return function(){E.apply(P,arguments)}}function k(E){return typeof E=="function"}return u.parse=function(E,P){var T=(P=P||{}).dynamicTyping||!1;if(k(T)&&(P.dynamicTypingFunction=T,T={}),P.dynamicTyping=T,P.transform=!!k(P.transform)&&P.transform,!P.worker||!u.WORKERS_SUPPORTED)return T=null,u.NODE_STREAM_INPUT,typeof E=="string"?(E=d(E),T=new(P.download?f:m)(P)):E.readable===!0&&k(E.read)&&k(E.on)?T=new v(P):(r.File&&E instanceof File||E instanceof Object)&&(T=new p(P)),T.stream(E);(T=(()=>{var M;return!!u.WORKERS_SUPPORTED&&(M=(()=>{var R=r.URL||r.webkitURL||null,A=n.toString();return u.BLOB_URL||(u.BLOB_URL=R.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",A,")();"],{type:"text/javascript"})))})(),(M=new r.Worker(M)).onmessage=_,M.id=c++,l[M.id]=M)})()).userStep=P.step,T.userChunk=P.chunk,T.userComplete=P.complete,T.userError=P.error,P.step=k(P.step),P.chunk=k(P.chunk),P.complete=k(P.complete),P.error=k(P.error),delete P.worker,T.postMessage({input:E,config:P,workerId:T.id})},u.unparse=function(E,P){var T=!1,M=!0,R=",",A=`\r 1237`,I='"',D=I+I,O=!1,z=null,B=!1,G=((()=>
1237{if(typeof P=="object"){if(typeof P.delimiter!="string"||u.BAD_DELIMITERS.filter(function(W){return P.delimiter.indexOf(W)!==-1}).length||(R=P.delimiter),typeof P.quotes!="boolean"&&typeof P.quotes!="function"&&!Array.isArray(P.quotes)||(T=P.quotes),typeof P.skipEmptyLines!="boolean"&&typeof P.skipEmptyLines!="string"||(O=P.skipEmptyLines),typeof P.newline=="string"&&(A=P.newline),typeof P.quoteChar=="string"&&(I=P.quoteChar,D=I+I),typeof P.header=="boolean"&&(M=P.header),Array.isArray(P.columns)){if(P.columns.length===0)throw new Error("Option columns is empty");z=P.columns}P.escapeChar!==void 0&&(D=P.escapeChar+I),P.escapeFormulae instanceof RegExp?B=P.escapeFormulae:typeof P.escapeFormulae=="boolean"&&P.escapeFormulae&&(B=/^[=+\-@\t\r].*$/)}})(),new RegExp(g(I),"g"));if(typeof E=="string"&&(E=JSON.parse(E)),Array.isArray(E)){if(!E.length||Array.isArray(E[0]))return U(null,E,O);if(typeof E[0]=="object")return U(z||Object.keys(E[0]),E,O)}else if(typeof E=="object")return typeof E.data=="string"&&(E.data=JSON.parse(E.data)),Array.isArray(E.data)&&(E.fields||(E.fields=E.meta&&E.meta.fields||z),E.fields||(E.fields=Array.isArray(E.data[0])?E.fields:typeof E.data[0]=="object"?Object.keys(E.data[0]):[]),Array.isArray(E.data[0])||typeof E.data[0]=="object"||(E.data=[E.data])),U(E.fields||[],E.data||[],O);throw new Error("Unable to serialize unrecognized input");function U(W,Q,K){var fe="",oe=(typeof W=="string"&&(W=JSON.parse(W)),typeof Q=="string"&&(Q=JSON.parse(Q)),Array.isArray(W)&&0<W.length),ye=!Array.isArray(Q[0]);if(oe&&M){for(var le=0;le<W.length;le++)0<le&&(fe+=R),fe+=F(W[le],le);0<Q.length&&(fe+=A)}for(var me=0;me<Q.length;me++){var he=(oe?W:Q[me]).length,ae=!1,re=oe?Object.keys(Q[me]).length===0:Q[me].length===0;if(K&&!oe&&(ae=K==="greedy"?Q[me].join("").trim()==="":Q[me].length===1&&Q[me][0].length===0),K==="greedy"&&oe){for(var L=[],X=0;X<he;X++){var ne=ye?W[X]:X;L.push(Q[me][ne])}ae=L.join("").trim()===""}if(!ae){for(var Y=0;Y<he;Y++){0<Y&&!re&&(fe+=R);var J=oe&&ye?W[Y]:Y;fe+=F(Q[me][J],Y)}me<Q.length-1&&(!K||0<he&&!re)&&(fe+=A)}}return fe}function F(W,Q){var K,fe,oe;return W==null?"":W.constructor===Date?JSON.stringify(W).slice(1,25):(oe=!1,B&&typeof W=="string"&&B.test(W)&&(W="'"+W,oe=!0),fe=(K=W.toString()).replace(G,D),(oe=oe||T===!0||typeof T=="function"&&T(W,Q)||Array.isArray(T)&&T[Q]||((ye,le)=>{for(var me=0;me<le.length;me++)if(-1<ye.indexOf(le[me]))return!0;return!1})(fe,u.BAD_DELIMITERS)||-1<fe.indexOf(R)||-1<K.indexOf(I)||fe.charAt(0)===" "||fe.charAt(fe.length-1)===" ")?I+fe+I:fe)}},u.RECORD_SEP="�",u.UNIT_SEP="�",u.BYTE_ORDER_MARK="\uFEFF",u.BAD_DELIMITERS=["\r",` 1238`,'"',u.BYTE_ORDER_MARK],u.WORKERS_SUPPORTED=!i&&!!r.Worker,u.NODE_STREAM_INPUT=1,u.LocalChunkSize=10485760,u.RemoteChunkSize=5242880,u.DefaultDelimiter=",",u.Parser=w,u.ParserHandle=x,u.NetworkStreamer=f,u.FileStreamer=p,u.StringStreamer=m,u.ReadableStreamStreamer=v,r.jQuery&&((s=r.jQuery).fn.parse=function(E){var P=E.config||{},T=[];return this.each(function(A){if(!(s(this).prop("tagName").toUpperCase()==="INPUT"&&s(this).attr("type").toLowerCase()==="file"&&r.FileReader)||!this.files||this.files.length===0)return!0;for(var I=0;I<this.files.length;I++)T.push({file:this.files[I],inputElem:this,instanceConfig:s.extend({},P)})}),M(),this;function M(){if(T.length===0)k(E.complete)&&E.complete();else{var A,I,D,O,z=T[0];if(k(E.before)){var B=E.before(z.file,z.inputElem);if(typeof B=="object"){if(B.action==="abort")return A="AbortError",I=z.file,D=z.inputElem,O=B.reason,void(k(E.error)&&E.error({name:A},I,D,O));if(B.action==="skip")return void R();typeof B.config=="object"&&(z.instanceConfig=s.extend(z.instanceConfig,B.config))}else if(B==="skip")return void R()}var G=z.instanceConfig.complete;z.instanceConfig.complete=function(U){k(G)&&G(U,z.file,z.inputElem),R()},u.parse(z.file,z.instanceConfig)}}function R(){T.splice(0,1),M()}}),o&&(r.onmessage=function(E){E=E.data,u.WORKER_ID===void 0&&E&&(u.WORKER_ID=E.workerId),typeof E.input=="string"?r.postMessage({workerId:u.WORKER_ID,results:u.parse(E.input,E.config),finished:!0}):(r.File&&E.input instanceof File||E.input instanceof Object)&&(E=u.parse(E.input,E.config))&&r.postMessage({workerId:u.WORKER_ID,results:E,finished:!0})}),(f.prototype=Object.create(h.prototype)).constructor=f,(p.prototype=Object.create(h.prototype)).constructor=p,(m.prototype=Object.create(m.prototype)).constructor=m,(v.prototype=Object.create(h.prototype)).constructor=v,u})})(DCe);var igt=DCe.exports;const agt=cp(igt),ogt="https://aanjkhoyzcvhokzsmifu.supabase.co/functions/v1/create-migrated-user";async function Dse(t){const{data:{session:e}}=await Z.auth.getSession(),n=await fetch(ogt,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e==null?void 0:e.access_token}`},body:JSON.stringify(t)}),r=await n.json().catch(()=>({}));if(!n.ok||r!=null&&r.error)throw new Error((r==null?void 0:r.error)||`HTTP ${n.status}`);return r}function lgt(t){if(!t)return"";const e=t.trim(),n=e.match(/^(\d{2})\/(\d{2})\/(\d{4})$/);return n?`${n[3]}-${n[2]}-${n[1]}`:e}function cgt(){const t=b.useRef(null),[e,n]=b.useState([]),[r,s]=b.useState(!1),[i,o]=b.useState({done:0,total:0}),l=m=>{var x;const v=(x=m.target.files)==null?void 0:x[0];v&&(agt.parse(v,{header:!0,skipEmptyLines:!0,transformHeader:g=>g.trim().toLowerCase().replace(/\s+/g,"_").replace(/[^a-z_]/g,""),complete:g=>{const w=(g.data||[]).map(_=>({nom:_.nom||_.name||"",email:(_.email||"").trim().toLowerCase(),date_expiration:lgt(_.date_expiration||_.expiration||""),numero_carte:_.numero_carte||_.card_number||"",type:(_.type||"individuel").toLowerCase()==="couple"?"couple":"individuel",accompagnant:_.accompagnant||_.companion||"",_status:"pending"}));n(w),ee.success(`${w.length} ligne(s) chargée(s).`)},error:g=>ee.error(`Erreur CSV : ${g.message}`)}),t.current&&(t.current.value=""))},c=async()=>
1238{if(!e.length)return;s(!0),o({done:0,total:e.length});const m=[...e];for(let x=0;x<m.length;x++){const g=m[x];if(!g.email||!g.numero_carte){m[x]={...g,_status:"error",_error:"Email et numéro de carte requis"},n([...m]),o({done:x+1,total:m.length});continue}try{const w=await Dse({action:"create",email:g.email,full_name:g.nom||g.email.split("@")[0],card_number:g.numero_carte,valid_until:g.date_expiration||null,is_couple:g.type==="couple",companion_name:g.accompagnant||null,send_invitation:!1});m[x]={...g,_status:"ok",_user_id:w.user_id,_card_id:w.card_id}}catch(w){m[x]={...g,_status:"error",_error:(w==null?void 0:w.message)||"Erreur inconnue"}}n([...m]),o({done:x+1,total:m.length})}s(!1);const v=m.filter(x=>x._status==="ok").length;ee.success(`Import terminé : ${v}/${m.length} réussis.`)},u=async m=>{const v=e[m];if(v!=null&&v.email)try{await Dse({action:"invite",email:v.email,card_id:v._card_id});const x=[...e];x[m]={...v,_invited:!0},n(x),ee.success(`Invitation envoyée à ${v.email}`)}catch(x){ee.error((x==null?void 0:x.message)||"Erreur invitation")}},d=async()=>{const m=e.map((v,x)=>({r:v,i:x})).filter(({r:v})=>v._status==="ok"&&!v._invited);if(!m.length)return ee.info("Aucune invitation à envoyer.");s(!0);for(const{i:v}of m)await u(v);s(!1)},h=()=>{n([]),o({done:0,total:0})},f=e.filter(m=>m._status==="ok").length,p=e.filter(m=>m._status==="error").length;return a.jsxs("div",{className:"space-y-6",children:[a.jsx("div",{className:"rounded-xl border border-dashed border-border bg-card p-6",children:a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx($$e,{className:"h-10 w-10 text-primary"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h3",{className:"font-heading text-lg font-semibold",children:"Importer un fichier CSV"}),a.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:["Colonnes attendues : ",a.jsx("code",{children:"nom, email, date_expiration, numero_carte, type, accompagnant"}),". Le type doit valoir ",a.jsx("code",{children:"individuel"})," ou ",a.jsx("code",{children:"couple"}),". Date au format ",a.jsx("code",{children:"JJ/MM/AAAA"})," ou ISO."]}),a.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[a.jsxs(H,{onClick:()=>{var m;return(m=t.current)==null?void 0:m.click()},variant:"outline",children:[a.jsx(Oa,{className:"mr-2 h-4 w-4"})," Choisir un fichier CSV"]}),e.length>0&&a.jsxs(a.Fragment,{children:[a.jsx(H,{onClick:c,disabled:r,children:r?a.jsxs(a.Fragment,{children:[a.jsx(Je,{className:"mr-2 h-4 w-4 animate-spin"})," Import en coursâ¦"]}):a.jsxs(a.Fragment,{children:[a.jsx(Oa,{className:"mr-2 h-4 w-4"})," Importer ",e.length," abonné(s)"]})}),a.jsxs(H,{onClick:d,disabled:r||!f,variant:"secondary",children:[a.jsx(Jf,{className:"mr-2 h-4 w-4"})," Envoyer toutes les invitations"]}),a.jsxs(H,{onClick:h,variant:"ghost",disabled:r,children:[a.jsx(tr,{className:"mr-2 h-4 w-4"})," Vider"]})]})]}),a.jsx("input",{ref:t,type:"file",accept:".csv,text/csv",onChange:l,className:"hidden"})]})]})}),r&&a.jsxs("div",{className:"rounded-xl border border-border bg-card p-4",children:[a.jsxs("div",{className:"flex items-center justify-between text-sm",children:[a.jsx("span",{children:"Progression"}),a.jsxs("span",{className:"font-mono",children:[i.done," / ",i.total]})]}),a.jsx("div",{className:"mt-2 h-2 overflow-hidden rounded-full bg-muted",children:a.jsx("div",{className:"h-full bg-primary transition-all",style:{width:`${i.total?i.done/i.total*100:0}%`}})})]}),e.length>0&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex flex-wrap gap-4 text-sm",children:[a.jsxs("span",{children:["Total : ",a.jsx("strong",{children:e.length})]}),f>0&&a.jsxs("span",{className:"text-green-700",children:["â Réussis : ",a.jsx("strong",{children:f})]}),p>0&&a.jsxs("span",{className:"text-red-700",children:["â Erreurs : ",a.jsx("strong",{children:p})]})]}),a.jsx("div",{className:"overflow-x-auto rounded-xl border border-border bg-card",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"border-b border-border bg-muted/50",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Statut"}),a.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Nom"}),a.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Email"}),a.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"N° Carte"}),a.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Type"}),a.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Accompagnant"}),a.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Expiration"}),a.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Invitation"}),a.jsx("th",{className:"px-3 py-2"})]})}),a.jsx("tbody",{children:e.map((m,v)=>a.jsxs("tr",{className:"border-b border-border last:border-0",children:[a.jsxs("td",{className:"px-3 py-2",children:[m._status==="ok"?a.jsx(Ma,{className:"h-4 w-4 text-green-600"}):m._status==="error"?a.jsx(Rfe,{className:"h-4 w-4 text-red-600"}):a.jsx("span",{className:"text-xs text-muted-foreground",children:"â"}),m._error&&a.jsx("div",{className:"mt-0.5 text-[10px] text-red-600",children:m._error})]}),a.jsx("td",{className:"px-3 py-2 font-medium",children:m.nom}),a.jsx("td",{className:"px-3 py-2 text-muted-foreground",children:m.email}),a.jsx("td",{className:"px-3 py-2 font-mono text-xs",children:m.numero_carte}),a.jsx("td",{className:"px-3 py-2",children:a.jsx(ke,{variant:m.type==="couple"?"default":"outline",className:m.type==="couple"?"bg-purple-600":"",children:m.type==="couple"?"Couple":"Individuel"})}),a.jsx("td",{className:"px-3 py-2 text-muted-foreground",children:m.accompagnant||"â"}),a.jsx("td",{className:"px-3 py-2 text-muted-foreground",children:m.date_expiration||"â"}),a.jsx("td",{className:"px-3 py-2",children:m._invited?a.jsx(Ma,{className:"h-4 w-4 text-green-600"}):a.jsx("span",{className:"text-xs text-muted-foreground",children:"â"})}),a.jsx("td",{className:"px-3 py-2 text-right",children:m._status==="ok"&&!m._invited&&a.jsxs(H,{size:"sm",variant:"ghost",onClick:()=>u(v),children:[a.jsx(Jf,{className:"mr-1 h-3.5 w-3.5"})," Inviter"]})})]},v))})]})})]})]})}const ugt="https://aanjkhoyzcvhokzsmifu.supabase.co/functions/v1/create-migrated-user";async function dgt(t,e){const{data:{session:n}}=await Z.auth.getSession(),r=await fetch(ugt,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n==null?void 0:n.access_token}`},body:JSON.stringify({action:"invite",email:t,card_id:e})}),s=await r.json().catch(()=>({}));if(!r.ok||s!=null&&s.error)throw new Error((s==null?void 0:s.error)||`HTTP ${r.status}`);return s}function hgt(){const[t,e]=b.useState(""),[n,r]=b.useState(null),{data:s=[],isLoading:i,refetch:o}=Ne({queryKey:["migrated_cards"],queryFn:async()=>{const{data:v,error:x}=await Z.from("carte_privilege").select("id, card_number, status, valid_until, subscribed_at, invitation_sent_at, is_companion, companion_name, parent_card_id, user_id, profiles!carte_privilege_user_id_fkey(email, full_name)").eq("migrated_from_legacy",!0).order("subscribed_at",{ascending:!1});if(x)throw x;return v||[]}}),{data:l={}}=Ne({queryKey:["migration_account_status"],queryFn:async()=>{const{data:{session:v}}=await Z.auth.getSession(),g=await(await fetch("https://aanjkhoyzcvhokzsmifu.supabase.co/functions/v1/migration-account-status",{method:"POST",headers:{Authorization:`Bearer ${v==null?void 0:v.access_token}`}})).json().catch(()=>({}));return(g==null?void 0:g.users)||{}}}),c=s.reduce((v,x)=>(x.is_companion&&x.parent_card_id?v[x.parent_card_id]&&(v[x.parent_card_id].c
1238ompanion=x):v[x.id]={...v[x.id]||{},...x},v),{}),u=Object.values(c).filter(v=>{var g,w;return t?`${((g=v.profiles)==null?void 0:g.full_name)||""} ${((w=v.profiles)==null?void 0:w.email)||""} ${v.card_number||""}`.toLowerCase().includes(t.toLowerCase()):!0}),d=u.length,h=u.filter(v=>v.invitation_sent_at).length,f=u.filter(v=>{const x=v.user_id?l[v.user_id]:null;return x&&x.last_sign_in_at}).length,p=d-h,m=async v=>{var x;if(!((x=v.profiles)!=null&&x.email))return ee.error("Email manquant");r(v.id);try{await dgt(v.profiles.email,v.id),ee.success(`Invitation envoyée à ${v.profiles.email}`),o()}catch(g){ee.error((g==null?void 0:g.message)||"Erreur")}finally{r(null)}};return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid gap-3 sm:grid-cols-4",children:[a.jsxs("div",{className:"rounded-xl border border-border bg-card p-4 text-center",children:[a.jsx("div",{className:"font-heading text-2xl font-bold",children:d}),a.jsx("div",{className:"text-xs text-muted-foreground",children:"Abonnés migrés"})]}),a.jsxs("div",{className:"rounded-xl border border-border bg-card p-4 text-center",children:[a.jsx("div",{className:"font-heading text-2xl font-bold text-green-600",children:h}),a.jsx("div",{className:"text-xs text-muted-foreground",children:"Invitations envoyées"})]}),a.jsxs("div",{className:"rounded-xl border border-border bg-card p-4 text-center",children:[a.jsx("div",{className:"font-heading text-2xl font-bold text-blue-600",children:f}),a.jsx("div",{className:"text-xs text-muted-foreground",children:"Comptes activés"})]}),a.jsxs("div",{className:"rounded-xl border border-border bg-card p-4 text-center",children:[a.jsx("div",{className:"font-heading text-2xl font-bold text-orange-600",children:p}),a.jsx("div",{className:"text-xs text-muted-foreground",children:"En attente"})]})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[a.jsx(is,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(ue,{placeholder:"Rechercher nom, email ou n° carteâ¦",value:t,onChange:v=>e(v.target.value),className:"pl-9 h-9"})]}),a.jsxs(H,{variant:"outline",size:"sm",onClick:()=>o(),children:[a.jsx(Ig,{className:"mr-2 h-4 w-4"})," Rafraîchir"]})]}),i?a.jsx("div",{className:"space-y-2",children:[1,2,3].map(v=>a.jsx("div",{className:"h-12 animate-pulse rounded-lg bg-muted"},v))}):u.length===0?a.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"Aucun abonné migré pour le moment."}):a.jsx("div",{className:"overflow-x-auto rounded-xl border border-border bg-card",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"border-b border-border bg-muted/50",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Nom"}),a.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Email"}),a.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"N° Carte"}),a.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Type"}),a.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Expiration"}),a.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Invitation"}),a.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Compte"}),a.jsx("th",{className:"px-3 py-2"})]})}),a.jsx("tbody",{children:u.map(v=>{var x,g;return a.jsxs("tr",{className:"border-b border-border last:border-0",children:[a.jsxs("td",{className:"px-3 py-2 font-medium",children:[((x=v.profiles)==null?void 0:x.full_name)||"â",v.companion&&a.jsxs("div",{className:"text-xs text-muted-foreground",children:["+ ",v.companion.companion_name]})]}),a.jsx("td",{className:"px-3 py-2 text-muted-foreground",children:(g=v.profiles)==null?void 0:g.email}),a.jsx("td",{className:"px-3 py-2 font-mono text-xs",children:v.card_number}),a.jsx("td",{className:"px-3 py-2",children:v.companion?a.jsx(ke,{className:"bg-purple-600 text-white",children:"Couple"}):a.jsx(ke,{variant:"outline",children:"Individuel"})}),a.jsx("td",{className:"px-3 py-2 text-muted-foreground",children:v.valid_until?new Date(v.valid_until).toLocaleDateString("fr-FR"):"â"}),a.jsx("td",{className:"px-3 py-2",children:v.invitation_sent_at?a.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-green-700",children:[a.jsx(Ma,{className:"h-3.5 w-3.5"}),new Date(v.invitation_sent_at).toLocaleDateString("fr-FR")]}):a.jsx("span",{className:"text-xs text-muted-foreground",children:"â"})}),a.jsx("td",{className:"px-3 py-2",children:(()=>{const w=v.user_id?l[v.user_id]:null;return w!=null&&w.last_sign_in_at?a.jsxs(ke,{className:"bg-blue-600 text-white gap-1",children:[a.jsx(Ma,{className:"h-3 w-3"})," Créé"]}):w!=null&&w.email_confirmed_at?a.jsx(ke,{variant:"outline",className:"text-amber-700 border-amber-300",children:"Confirmé"}):a.jsx("span",{className:"text-xs text-muted-foreground",children:"Non créé"})})()}),a.jsx("td",{className:"px-3 py-2 text-right",children:a.jsx(H,{size:"sm",variant:"ghost",disabled:n===v.id,onClick:()=>m(v),children:n===v.id?a.jsx(Je,{className:"h-3.5 w-3.5 animate-spin"}):a.jsxs(a.Fragment,{children:[a.jsx(Jf,{className:"mr-1 h-3.5 w-3.5"}),v.invitation_sent_at?"Renvoyer":"Inviter"]})})})]},v.id)})})]})})]})}function fgt(){const t=St(),[e,n]=b.useState(""),[r,s]=b.useState(null),[i,o]=b.useState("individual"),[l,c]=b.useState("active"),[u,d]=b.useState(Uxe(new Date,1)),[h,f]=b.useState(""),[p,m]=b.useState(""),[v,x]=b.useState(""),[g,w]=b.useState(!1),{data:_=[],isFetching:j}=Ne({queryKey:["provision_profile_search",e],enabled:e.trim().length>=2&&!r,queryFn:async()=>{const S=`%${e.trim()}%`,{data:C,error:k}=await Z.from("profiles").select("id, email, full_name").or(`email.ilike.${S},full_name.ilike.${S}`).limit(10);if(k)throw k;return C||[]}});async function N(){if(!r)return ee.error("Sélectionner un utilisateur");if(!u)return ee.error("Choisir une date de validité");if(i==="couple"&&!p.trim())return ee.error("Nom de l'accompagnant requis");w(!0);const{data:S,error:C}=await Z.functions.invoke("provision-carte",{body:{user_id:r.id,plan_type:i,status:l,valid_until:u.toISOString(),card_number:h.trim()||void 0,companion_name:i==="couple"?p.trim():void 0,companion_email:i==="couple"&&v.trim()||void 0}});if(w(!1),C||S!=null&&S.error){ee.error("Erreur",{description:(S==null?void 0:S.error)||(C==null?void 0:C.message)});return}ee.success(`Carte ${S.card_number} provisionnée`),t.invalidateQueries({queryKey:["admin_cartes"]}),t.invalidateQueries({queryKey:["admin_carte_stats"]}),s(null),n(""),f(""),m(""),x("")}return a.jsxs("div",{className:"max-w-2xl space-y-6 rounded-xl border border-border bg-card p-6",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"font-heading text-lg font-semibold",children:"Provisionner une Carte Privilège"}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Créer ou mettre à jour manuellement la carte d'un utilisateur (paiement hors ligne, offre offerte, migrationâ¦)."})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"Utilisateur"}),r?a.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border bg-muted/40 px-3 py-2",children:[a.jsxs("div",{children:[a.jsx("div",{className:"font-medium",children:r.full_name||"â"}),a.jsx("div",{className:"text-xs text-muted-foreground",children:r.email})]}),a.jsx(H,{variant:"ghost",size:"sm",onClick:()=>s(null),children:"Changer"})]}):a.jsxs(a.Fragment,{children:[a.jsx(ue,{placeholder:"Rechercher par email ou nomâ¦",value:e,onCh
1238ange:S=>n(S.target.value)}),e.trim().length>=2&&a.jsx("div",{className:"max-h-56 overflow-y-auto rounded-lg border border-border",children:j?a.jsx("div",{className:"p-3 text-sm text-muted-foreground",children:"Rechercheâ¦"}):_.length===0?a.jsx("div",{className:"p-3 text-sm text-muted-foreground",children:"Aucun utilisateur."}):_.map(S=>a.jsxs("button",{type:"button",onClick:()=>s(S),className:"flex w-full flex-col items-start border-b border-border px-3 py-2 text-left text-sm last:border-0 hover:bg-muted/60",children:[a.jsx("span",{className:"font-medium",children:S.full_name||"â"}),a.jsx("span",{className:"text-xs text-muted-foreground",children:S.email})]},S.id))})]})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"Formule"}),a.jsxs("select",{value:i,onChange:S=>o(S.target.value),className:"h-9 w-full rounded-md border border-input bg-background px-3 text-sm",children:[a.jsx("option",{value:"individual",children:"Individuelle (75 â¬)"}),a.jsx("option",{value:"couple",children:"Couple (125 â¬)"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"Statut"}),a.jsxs("select",{value:l,onChange:S=>c(S.target.value),className:"h-9 w-full rounded-md border border-input bg-background px-3 text-sm",children:[a.jsx("option",{value:"active",children:"Active"}),a.jsx("option",{value:"expired",children:"Expirée"}),a.jsx("option",{value:"cancelled",children:"Annulée"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"Valable jusqu'au"}),a.jsxs(p7,{children:[a.jsx(m7,{asChild:!0,children:a.jsxs(H,{variant:"outline",className:Fe("w-full justify-start text-left font-normal",!u&&"text-muted-foreground"),children:[a.jsx(Aj,{className:"mr-2 h-4 w-4"}),u?lh(u,"PPP",{locale:Qxe}):"Choisir une date"]})}),a.jsx(B3,{className:"w-auto p-0",align:"start",children:a.jsx(h7,{mode:"single",selected:u,onSelect:S=>S&&d(S),initialFocus:!0,className:Fe("p-3 pointer-events-auto")})})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"N° de carte (optionnel)"}),a.jsx(ue,{placeholder:"ESP-XXXX (auto si vide)",value:h,onChange:S=>f(S.target.value)})]})]}),i==="couple"&&a.jsxs("div",{className:"grid gap-4 rounded-lg border border-dashed border-border p-4 sm:grid-cols-2",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"Nom de l'accompagnant *"}),a.jsx(ue,{value:p,onChange:S=>m(S.target.value)})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"Email accompagnant"}),a.jsx(ue,{type:"email",value:v,onChange:S=>x(S.target.value)})]})]}),a.jsx("div",{className:"flex justify-end",children:a.jsxs(H,{onClick:N,disabled:g||!r,children:[g&&a.jsx(Je,{className:"mr-2 h-4 w-4 animate-spin"}),"Provisionner la carte"]})})]})}const Lse={active:"bg-green-100 text-green-800",expired:"bg-red-100 text-red-800",cancelled:"bg-gray-100 text-gray-800"};function pgt(){const[t,e]=b.useState(""),[n,r]=b.useState("all"),{data:s}=Ne({queryKey:["admin_carte_stats"],queryFn:async()=>{const[u,d]=await Promise.all([Z.from("carte_privilege").select("id",{count:"exact",head:!0}).eq("status","active"),Z.from("carte_privilege").select("id",{count:"exact",head:!0}).eq("status","expired")]);return{active:u.count??0,expired:d.count??0}}}),{data:i=[],isLoading:o}=Ne({queryKey:["admin_cartes"],queryFn:async()=>{const{data:u,error:d}=await Z.from("carte_privilege").select("*, profiles!carte_privilege_user_id_fkey(email, full_name)").order("subscribed_at",{ascending:!1});if(d)throw d;return u}}),l=i.reduce((u,d)=>{if(d.is_companion){const h=d.parent_card_id;h&&u[h]?u[h].companion=d:u[d.id]={...d,_orphan_companion:!0}}else u[d.id]={...u[d.id]||{},...d};return u},{}),c=Object.values(l).filter(u=>{var f,p,m,v,x;return t?`${((f=u.profiles)==null?void 0:f.full_name)||`${((p=u.profiles)==null?void 0:p.first_name)||""} ${((m=u.profiles)==null?void 0:m.last_name)||""}`} ${((v=u.profiles)==null?void 0:v.email)||""} ${u.card_number||""} ${((x=u.companion)==null?void 0:x.companion_name)||""}`.toLowerCase().includes(t.toLowerCase()):!0}).filter(u=>n==="all"||u.status===n);return a.jsxs("div",{children:[a.jsx("h1",{className:"font-heading text-2xl font-bold",children:"Carte Privilège"}),a.jsxs(Qi,{defaultValue:"abonnes",className:"mt-6",children:[a.jsxs(wi,{children:[a.jsx(wt,{value:"abonnes",children:"Abonnés"}),a.jsx(wt,{value:"provision",children:"Provisionner"}),a.jsx(wt,{value:"migration",children:"Migration"}),a.jsx(wt,{value:"suivi",children:"Suivi migration"})]}),a.jsxs(kt,{value:"abonnes",className:"mt-6",children:[a.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[a.jsxs("div",{className:"rounded-xl border border-border bg-card p-5 text-center",children:[a.jsx("div",{className:"font-heading text-3xl font-bold text-green-600",children:(s==null?void 0:s.active)??"â"}),a.jsx("div",{className:"text-sm text-muted-foreground",children:"Actifs"})]}),a.jsxs("div",{className:"rounded-xl border border-border bg-card p-5 text-center",children:[a.jsx("div",{className:"font-heading text-3xl font-bold text-red-600",children:(s==null?void 0:s.expired)??"â"}),a.jsx("div",{className:"text-sm text-muted-foreground",children:"Expirés"})]}),a.jsxs("div",{className:"rounded-xl border border-border bg-card p-5 text-center",children:[a.jsxs("div",{className:"font-heading text-3xl font-bold text-primary",children:[(((s==null?void 0:s.active)??0)*39.9).toFixed(0)," â¬"]}),a.jsx("div",{className:"text-sm text-muted-foreground",children:"Revenus estimés"})]})]}),a.jsxs("div",{className:"mt-6 flex flex-wrap gap-2",children:[a.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[a.jsx(is,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(ue,{placeholder:"Nom, email ou n° carteâ¦",value:t,onChange:u=>e(u.target.value),className:"pl-9 h-9"})]}),a.jsxs("select",{className:"rounded-lg border border-border bg-card px-3 py-1.5 text-sm",value:n,onChange:u=>r(u.target.value),children:[a.jsx("option",{value:"all",children:"Tous statuts"}),a.jsx("option",{value:"active",children:"Active"}),a.jsx("option",{value:"expired",children:"Expirée"}),a.jsx("option",{value:"cancelled",children:"Annulée"})]})]}),o?a.jsx("div",{className:"mt-8 space-y-3",children:[1,2,3].map(u=>a.jsx("div",{className:"h-14 animate-pulse rounded-lg bg-muted"},u))}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"mt-6 hidden overflow-x-auto rounded-xl border border-border bg-card md:block",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"border-b border-border bg-muted/50",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Nom"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Email"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"N° Carte"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Type"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Souscription"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Expiration"}),a.jsx("th",{className:"px-4 py-3 text-center font-medium",children:"Statut"})]})}),a.jsx("tbody",{children:c.map(u=>{var d,h,f,p;return a.jsxs("tr",{className:"border-b border-border last:border-0",children:[a.jsxs("td",{className:"px-4 py-3 font-medium",children:[((d=u.profiles)==null?void 0:d.full_name)||`${((h=u.profiles)==null?void 0:h.first_name)||""} ${((f=u.profiles)==null?void 0:f.last_name)||""}`,u.companion&&a.jsxs("div",{className:"text-xs text-muted-foreground",children:["+ ",u.companion.companion_name]})]}),a.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:(p=u.profiles)==null?void 0:p.email}),a.jsxs("td",{className:"px-4 py-3 font-mono text-xs",children:[u.card_number||"â",u.companion&&a.jsx("div",{className:"text-[10px] text-muted-foreground",children:u.companion.card_number})]}),a.jsx("td",{className:"px-4 py-3",children:u.companion?a.jsx(ke,{className:"bg-purple-600 text-white",children:"Couple"}):a.jsx(ke,{variant:"outline",children:"Individuel"})}),a.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:u.subscribed_at?new Date(u.subscribed_at).toLocaleDateString("fr-FR"):"â"}),a.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:u.valid_until?new Date(u.valid_until).toLocaleDateString("fr-FR"):"â"}),a.jsx("td",{className:"px-4 py-3 text-center",children:a.jsx(ke,{className:`text-xs ${Lse[u.status]||""}`,children:u.status})})]},u.id)})})]})}),a.jsx("div",{className:"mt-6 space-y-3 md:hidden",children:c.map(u=>{var d,h,f,p;return a.jsxs("div",{className:"rounded-xl border border-border bg-card p-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"font-medium",children:((d=u.profiles)==null?void 0:d.full_name)||`${((h=u.profiles)==null?void 0:h.first_name)||""} ${((f=u.profiles)==null?void 0:f.last_name)||""}`}),a.jsxs("div",{className:"flex gap-1",children:[u.companion&&a.jsx(ke,{className:"bg-purple-600 text-white text-xs",children:"Couple"}),a.jsx(ke,{className:`text-xs ${Lse[u.status]||""}`,children:u.status})]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:(p=u.profiles)==null?void 0:p.email}),a.jsx("p",{className:"mt-1 font-mono text-xs",children:u.card_number}),u.companion&&a.jsxs("p",{className:"font-mono text-[10px] text-muted-foreground",children:["+ ",u.companion.card_number," (",u.companion.companion_name,")"]})]},u.id)})}),c.length===0&&a.jsx("p",{className:"mt-8 text-center text-muted-foreground",children:"Aucun abonné trouvé."})]})]}),a.jsx(kt,{value:"provision",className:"mt-6",children:a.jsx(fgt,{})}),a.jsx(kt,{value:"migration",className:"mt-6",children:a.jsx(cgt,{})}),a.jsx(kt,{value:"suivi",className:"mt-6",children:a.jsx(hgt,{})})]})]})}const mgt=new Set(["le","la","les","l","un","une","des","de","du","d","et","ou","ni","mais","donc","or","car","à ","a","au","aux","en","dans","sur","sous","avec","sans","pour","par","ver
1238s","chez","entre","ce","cet","cette","ces","son","sa","ses","leur","leurs","mon","ma","mes","ton","ta","tes","notre","nos","votre","vos","est","sont","été","être","qui","que","quoi","où","dont","plus","moins","très","tres","il","elle","ils","elles","on","nous","vous","je","tu","se","s"]);function T4(t){return(t||"").toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"")}function ggt(t){const e=T4(t).replace(/<[^>]*>/g," ");return[...new Set(e.split(/[^a-z0-9]+/i).map(n=>n.trim()).filter(n=>n.length>=4&&!mgt.has(n)))]}function vgt(t){const e=T4(t);return e.length<=4?e:e.slice(0,Math.max(4,e.length-3))}function JK(t,e){if(!t||!e)return!1;const n=vgt(t);if(n.length<3)return!1;const r=T4(e).replace(/<[^>]*>/g," ");return new RegExp(`\\b${n.replace(/[.*+?^${}()|[\\]\\\\]/g,"\\$&")}[a-z0-9]*`,"i").test(r)}function LCe(t,e,n=[]){const r=new Set(n),s=[];for(const i of t)r.has(i.id)||JK(i.name,e)&&s.push({id:i.id,name:i.name,score:i.name.length});return s.sort((i,o)=>o.score-i.score||i.name.localeCompare(o.name)),s.map(({id:i,name:o})=>({id:i,name:o}))}function xgt(t,e){const r=l=>l*Math.PI/180,s=r(e.lat-t.lat),i=r(e.lng-t.lng),o=Math.sin(s/2)**2+Math.cos(r(t.lat))*Math.cos(r(e.lat))*Math.sin(i/2)**2;return 2*6371*Math.asin(Math.sqrt(o))}const FCe=Object.freeze(Object.defineProperty({__proto__:null,distanceKm:xgt,extractKeywords:ggt,normalize:T4,suggestTagIds:LCe,tagMatchesText:JK},Symbol.toStringTag,{value:"Module"})),ygt=1,bgt="cbd6ec5b-94b0-4b1a-9e1b-02b207aeb9e4",wgt="ab1ba921-4002-41a2-9867-95476dda0aeb",_gt="/__l5e/assets-v1/cbd6ec5b-94b0-4b1a-9e1b-02b207aeb9e4/logo-esprit-sud.png",jgt="a/v1/ab1ba921-4002-41a2-9867-95476dda0aeb/cbd6ec5b-94b0-4b1a-9e1b-02b207aeb9e4/logo-esprit-sud.png",Sgt="logo-esprit-sud.png",Ngt=31398,Cgt="image/png",kgt="2026-09-01T11:08:19Z",fD={version:ygt,asset_id:bgt,project_id:wgt,url:_gt,r2_key:jgt,original_filename:Sgt,size:Ngt,content_type:Cgt,created_at:kgt};function BP(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var $Ce={exports:{}};/*! 1239 1240JSZip v3.10.1 - A JavaScript class for generating and reading zip files 1241<http://stuartk.com/jszip> 1242 1243(c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com> 1244Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown. 1245 1246JSZip uses the library pako released under the MIT license : 1247https://github.com/nodeca/pako/blob/main/LICENSE 1248*/(function(t,e){(function(n){t.exports=n()})(function(){return function n(r,s,i){function o(u,d){if(!s[u]){if(!r[u]){var h=typeof BP=="function"&&BP;if(!d&&h)return h(u,!0);if(l)return l(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var p=s[u]={exports:{}};r[u][0].call(p.exports,function(m){var v=r[u][1][m];return o(v||m)},p,p.exports,n,r,s,i)}return s[u].exports}for(var l=typeof BP=="function"&&BP,c=0;c<i.length;c++)o(i[c]);return o}({1:[function(n,r,s){var i=n("./utils"),o=n("./support"),l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";s.encode=function(c){for(var u,d,h,f,p,m,v,x=[],g=0,w=c.length,_=w,j=i.getTypeOf(c)!=="string";g<c.length;)_=w-g,h=j?(u=c[g++],d=g<w?c[g++]:0,g<w?c[g++]:0):(u=c.charCodeAt(g++),d=g<w?c.charCodeAt(g++):0,g<w?c.charCodeAt(g++):0),f=u>>2,p=(3&u)<<4|d>>4,m=1<_?(15&d)<<2|h>>6:64,v=2<_?63&h:64,x.push(l.charAt(f)+l.charAt(p)+l.charAt(m)+l.charAt(v));return x.join("")},s.decode=function(c){var u,d,h,f,p,m,v=0,x=0,g="data:";if(c.substr(0,g.length)===g)throw new Error("Invalid base64 input, it looks like a data url.");var w,_=3*(c=c.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(c.charAt(c.length-1)===l.charAt(64)&&_--,c.charAt(c.length-2)===l.charAt(64)&&_--,_%1!=0)throw new Error("Invalid base64 input, bad content length.");for(w=o.uint8array?new Uint8Array(0|_):new Array(0|_);v<c.length;)u=l.indexOf(c.charAt(v++))<<2|(f=l.indexOf(c.charAt(v++)))>>4,d=(15&f)<<4|(p=l.indexOf(c.charAt(v++)))>>2,h=(3&p)<<6|(m=l.indexOf(c.charAt(v++))),w[x++]=u,p!==64&&(w[x++]=d),m!==64&&(w[x++]=h);return w}},{"./support":30,"./utils":32}],2:[function(n,r,s){var i=n("./external"),o=n("./stream/DataWorker"),l=n("./stream/Crc32Probe"),c=n("./stream/DataLengthProbe");function u(d,h,f,p,m){this.compressedSize=d,this.uncompressedSize=h,this.crc32=f,this.compression=p,this.compressedContent=m}u.prototype={getContentWorker:function(){var d=new o(i.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new c("data_length")),h=this;return d.on("end",function(){if(this.streamInfo.data_length!==h.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,h,f){return d.pipe(new l).pipe(new c("uncompressedSize")).pipe(h.compressWorker(f)).pipe(new c("compressedSize")).withStreamInfo("compression",h)},r.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,r,s){var i=n("./stream/GenericWorker");s.STORE={magic:"\0\0",compressWorker:function(){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},s.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,r,s){var i=n("./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}();
vendor: 35,033 bytes, lines 1248-1249
1248r.exports=function(l,c){return l!==void 0&&l.length?i.getTypeOf(l)!=="string"?function(u,d,h,f){var p=o,m=f+h;u^=-1;for(var v=f;v<m;v++)u=u>>>8^p[255&(u^d[v])];return-1^u}(0|c,l,l.length,0):function(u,d,h,f){var p=o,m=f+h;u^=-1;for(var v=f;v<m;v++)u=u>>>8^p[255&(u^d.charCodeAt(v))];return-1^u}(0|c,l,l.length,0):0}},{"./utils":32}],5:[function(n,r,s){s.base64=!1,s.binary=!1,s.dir=!1,s.createFolders=!0,s.date=null,s.compression=null,s.compressionOptions=null,s.comment=null,s.unixPermissions=null,s.dosPermissions=null},{}],6:[function(n,r,s){var i=null;i=typeof Promise<"u"?Promise:n("lie"),r.exports={Promise:i}},{lie:37}],7:[function(n,r,s){var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",o=n("pako"),l=n("./utils"),c=n("./stream/GenericWorker"),u=i?"uint8array":"array";function d(h,f){c.call(this,"FlateWorker/"+h),this._pako=null,this._pakoAction=h,this._pakoOptions=f,this.meta={}}s.magic="\b\0",l.inherits(d,c),d.prototype.processChunk=function(h){this.meta=h.meta,this._pako===null&&this._createPako(),this._pako.push(l.transformTo(u,h.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 h=this;this._pako.onData=function(f){h.push({data:f,meta:h.meta})}},s.compressWorker=function(h){return new d("Deflate",h)},s.uncompressWorker=function(){return new d("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,s){function i(p,m){var v,x="";for(v=0;v<m;v++)x+=String.fromCharCode(255&p),p>>>=8;return x}function o(p,m,v,x,g,w){var _,j,N=p.file,S=p.compression,C=w!==u.utf8encode,k=l.transformTo("string",w(N.name)),E=l.transformTo("string",u.utf8encode(N.name)),P=N.comment,T=l.transformTo("string",w(P)),M=l.transformTo("string",u.utf8encode(P)),R=E.length!==N.name.length,A=M.length!==P.length,I="",D="",O="",z=N.dir,B=N.date,G={crc32:0,compressedSize:0,uncompressedSize:0};m&&!v||(G.crc32=p.crc32,G.compressedSize=p.compressedSize,G.uncompressedSize=p.uncompressedSize);var U=0;m&&(U|=8),C||!R&&!A||(U|=2048);var F=0,W=0;z&&(F|=16),g==="UNIX"?(W=798,F|=function(K,fe){var oe=K;return K||(oe=fe?16893:33204),(65535&oe)<<16}(N.unixPermissions,z)):(W=20,F|=function(K){return 63&(K||0)}(N.dosPermissions)),_=B.getUTCHours(),_<<=6,_|=B.getUTCMinutes(),_<<=5,_|=B.getUTCSeconds()/2,j=B.getUTCFullYear()-1980,j<<=4,j|=B.getUTCMonth()+1,j<<=5,j|=B.getUTCDate(),R&&(D=i(1,1)+i(d(k),4)+E,I+="up"+i(D.length,2)+D),A&&(O=i(1,1)+i(d(T),4)+M,I+="uc"+i(O.length,2)+O);var Q="";return Q+=` 1249\0`,Q+=i(U,2),Q+=S.magic,Q+=i(_,2),Q+=i(j,2),Q+=i(G.crc32,4),Q+=i(G.compressedSize,4),Q+=i(G.uncompressedSize,4),Q+=i(k.length,2),Q+=i(I.length,2),{fileRecord:h.LOCAL_FILE_HEADER+Q+k+I,dirRecord:h.CENTRAL_FILE_HEADER+i(W,2)+Q+i(T.length,2)+"\0\0\0\0"+i(F,4)+i(x,4)+k+I+T}}var l=n("../utils"),c=n("../stream/GenericWorker"),u=n("../utf8"),d=n("../crc32"),h=n("../signature");function f(p,m,v,x){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=m,this.zipPlatform=v,this.encodeFileName=x,this.streamFiles=p,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}l.inherits(f,c),f.prototype.push=function(p){var m=p.meta.percent||0,v=this.entriesCount,x=this._sources.length;this.accumulate?this.contentBuffer.push(p):(this.bytesWritten+=p.data.length,c.prototype.push.call(this,{data:p.data,meta:{currentFile:this.currentFile,percent:v?(m+100*(v-x-1))/v:100}}))},f.prototype.openedSource=function(p){this.currentSourceOffset=this.bytesWritten,this.currentFile=p.file.name;var m=this.streamFiles&&!p.file.dir;if(m){var v=o(p,m,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:v.fileRecord,meta:{percent:0}})}else this.accumulate=!0},f.prototype.closedSource=function(p){this.accumulate=!1;var m=this.streamFiles&&!p.file.dir,v=o(p,m,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(v.dirRecord),m)this.push({data:function(x){return h.DATA_DESCRIPTOR+i(x.crc32,4)+i(x.compressedSize,4)+i(x.uncompressedSize,4)}(p),meta:{percent:100}});else for(this.push({data:v.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},f.prototype.flush=function(){for(var p=this.bytesWritten,m=0;m<this.dirRecords.length;m++)this.push({data:this.dirRecords[m],meta:{percent:100}});var v=this.bytesWritten-p,x=function(g,w,_,j,N){var S=l.transformTo("string",N(j));return h.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(g,2)+i(g,2)+i(w,4)+i(_,4)+i(S.length,2)+S}(this.dirRecords.length,v,p,this.zipComment,this.encodeFileName);this.push({data:x,meta:{percent:100}})},f.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},f.prototype.registerPrevious=function(p){this._sources.push(p);var m=this;return p.on("data",function(v){m.processChunk(v)}),p.on("end",function(){m.closedSource(m.previous.streamInfo),m._sources.length?m.prepareNextSource():m.end()}),p.on("error",function(v){m.error(v)}),this},f.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))},f.prototype.error=function(p){var m=this._sources;if(!c.prototype.error.call(this,p))return!1;for(var v=0;v<m.length;v++)try{m[v].error(p)}catch{}return!0},f.prototype.lock=function(){c.prototype.lock.call(this);for(var p=this._sources,m=0;m<p.length;m++)p[m].lock()},r.exports=f},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(n,r,s){var i=n("../compressions"),o=n("./ZipFileWorker");s.generateWorker=function(l,c,u){var d=new o(c.streamFiles,u,c.platform,c.encodeFileName),h=0;try{l.forEach(function(f,p){h++;var m=function(w,_){var j=w||_,N=i[j];if(!N)throw new Error(j+" is not a valid compression method !");return N}(p.options.compression,c.compression),v=p.options.compressionOptions||c.compressionOptions||{},x=p.dir,g=p.date;p._compressWorker(m,v).withStreamInfo("file",{name:f,dir:x,date:g,comment:p.comment||"",unixPermissions:p.unixPermissions,dosPermissions:p.dosPermissions}).pipe(d)}),d.entriesCount=h}catch(f){d.error(f)}return d}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(n,r,s){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=n("./object")).loadAsync=n("./load"),i.support=n("./support"),i.defaults=n("./defaults"),i.version="3.10.1",i.loadAsync=function(o,l){return new i().loadAsync(o,l)},i.external=n("./external"),r.exports=i},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(n,r,s){var i=n("./utils"),o=n("./external"),l=n("./utf8"),c=n("./zipEntries"),u=n("./stream/Crc32Probe"),d=n("./nodejsUtils");function h(f){return new o.Promise(function(p,m){var v=f.decompressed.getContentWorker().pipe(new u);v.on("error",function(x){m(x)}).on("end",function(){v.streamInfo.crc32!==f.decompressed.crc32?m(new Error("Corrupted zip : CRC32 mismatch")):p()}).resume()})}r.exports=function(f,p){var m=this;return p=i.extend(p||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:l.utf8decode}),d.isNode&&d.isStream(f)?o.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):i.prepareContent("the loaded zip file",f,!0,p.optimizedBinaryString,p.base64).then(function(v){var x=new c(p);return x.load(v),x}).then(function(v){var x=[o.Promise.resolve(v)],g=v.files;if(p.checkCRC32)for(var w=0;w<g.length;w++)x.push(h(g[w]));return o.Promise.all(x)}).then(function(v){for(var x=v.shift(),g=x.files,w=0;w<g.length;w++){var _=g[w],j=_.fileNameStr,N=i.resolve(_.fileNameStr);m.file(N,_.decompressed,{binary:!0,optimizedBinaryString:!0,date:_.date,dir:_.dir,comment:_.fileCommentStr.length?_.fileCommentStr:null,unixPermissions:_.unixPermissions,dosPermissions:_.dosPermissions,createFolders:p.createFolders}),_.dir||(m.file(N).unsafeOriginalName=j)}return x.zipComment.length&&(m.comment=x.zipComment),m})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(n,r,s){var i=n("../utils"),o=n("../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)},r.exports=l},{"../stream/GenericWorker":28,"../utils":32}],13:[function(n,r,s){var i=n("readable-stream").Readable;function o(l,c,u){i.call(this,c),this._helper=l;var d=this;l.on("data",function(h,f){d.push(h)||d._helper.pause(),u&&u(f)}).on("error",function(h){d.emit("error",h)}).on("end",function(){d.push(null)})}n("../utils").inherits(o,i),o.prototype._read=function(){this._helper.resume()},r.exports=o},{"../utils":32,"readable-stream":16}],14:[function(n,r,s){r.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(n,r,s){function i(N,S,C){var k,E=l.getTypeOf(S),P=l.extend(C||{},d);P.date=P.date||new Date,P.compression!==null&&(P.compression=P.compression.toUpperCase()),typeof P.unixPermissions=="string"&&(P.unixPermissions=parseInt(P.unixPermissions,8)),P.unixPermissions&&16384&P.unixPermissions&&(P.dir=!0),P.dosPermissions&&16&P.dosPermissions&&(P.dir=!0),P.dir&&(N=g(N)),P.createFolders&&(k=x(N))&&w.call(this,k,!0);var T=E==="string"&&P.binary===!1&&P.base64===!1;C&&C.binary!==void 0||(P.binary=!T),(S instanceof h&&S.uncompressedSize===0||P.dir||!S||S.length===0)&&(P.base64=!1,P.binary=!0,S="",P.compression="STORE",E="string");var M=null;M=S instanceof h||S instanceof c?S:m.isNode&&m.isStream(S)?new v(N,S):l.prepareContent(N,S,P.binary,P.optimizedBinaryString,P.base64);var R=new f(N,M,P);this.files[N]=R}var o=n("./utf8"),l=n("./utils"),c=n("./stream/GenericWorker"),u=n("./stream/StreamHelper"),d=n("./defaults"),h=n("./compressedObject"),f=n("./zipObject"),p=n("./generate"),m=n("./nodejsUtils"),v=n("./nodejs/NodejsStreamInputAdapter"),x=function(N){N.slice(-1)==="/"&&(N=N.substring(0,N.length-1));var S=N.lastIndexOf("/");return 0<S?N.substring(0,S):""},g=function(N){return N.slice(-1)!=="/"&&(N+="/"),N},w=function(N,S){return S=S!==void 0?S:d.createFolders,N=g(N),this.files[N]||i.call(this,N,null,{dir:!0,createFolders:S}),this.files[N]};function _(N){return Object.prototype.toString.call(N)==="[object RegExp]"}var j={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(N){var S,C,k;for(S in this.files)k=this.files[S],(C=S.slice(this.root.length,S.length))&&S.slice(0,this.root.length)===this.root&&N(C,k)},filter:function(N){var S=[];return this.forEach(function(C,k){N(C,k)&&S.push(k)}),S},file:function(N,S,C){if(arguments.length!==1)return N=this.root+N,i.call(this,N,S,C),this;if(_(N)){var k=N;return this.filter(function(P,T){return!T.dir&&k.test(P)})}var E=this.files[this.root+N];return E&&!E.dir?E:null},folder:function(N){if(!N)return this;if(_(N))return this.filter(function(E,P){return P.dir&&N.test(E)});var S=this.root+N,C=w.call(this,S),k=this.clone();return k.root=C.name,k},remove:function(N){N=this.root+N;var S=this.files[N];if(S||(N.slice(-1)!=="/"&&(N+="/"),S=this.files[N]),S&&!S.dir)delete this.files[N];else for(var C=this.filter(function(E,P){return P.name.slice(0,N.length)===N}),k=0;k<C.length;k++)delete this.files[C[k].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(N){var S,C={};try{if((C=l.extend(N||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:o.utf8encode})).type=C.type.toLowerCase(),C.compression=C.compression.toUpperCase(),C.type==="binarystring"&&(C.type="string"),!C.type)throw new Error("No output type specified.");l.checkSupport(C.type),C.platform!=="darwin"&&C.platform!=="freebsd"&&C.platform!=="linux"&&C.platform!=="sunos"||(C.platform="UNIX"),C.platform==="win32"&&(C.platform="DOS");var k=C.comment||this.comment||"";S=p.generateWorker(this,C,k)}catch(E){(S=new c("error")).error(E)}return new u(S,C.type||"string",C.mimeType)},generateAsync:function(N,S){return this.generateInternalStream(N).accumulate(S)},generateNodeStream:function(N,S){return(N=N||{}).type||(N.type="nodebuffer"),this.generateInternalStream(N).toNodejsStream(S)}};r.exports=j},{"./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(n,r,s){r.exports=n("stream")},{stream:void 0}],17:[function(n,r,s){var i=n("./DataReader");function o(l){i.call(this,l);for(var c=0;c<this.data.length;c++)l[c]=255&l[c]}n("../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),h=l.charCodeAt(3),f=this.length-4;0<=f;--f)if(this.data[f]===c&&this.data[f+1]===u&&this.data[f+2]===d&&this.data[f+3]===h)return f-this.zero;return-1},o.prototype.readAndCheckSignature=function(l){var c=l.charCodeAt(0),u=l.charCodeAt(1),d=l.charCodeAt(2),h=l.charCodeAt(3),f=this.readData(4);return c===f[0]&&u===f[1]&&d===f[2]&&h===f[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},r.exports=o},{"../utils":32,"./DataReader":18}],18:[function(n,r,s){var i=n("../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))}},r.exports=o},{"../utils":32}],19:[function(n,r,s){var i=n("./Uint8ArrayReader");function o(l){i.call(this,l)}n("../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},r.exports=o},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,s){var i=n("./DataReader");function o(l){i.call(this,l)}n("../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},r.exports=o},{"../utils":32,"./DataReader":18}],21:[function(n,r,s){var i=n("./ArrayReader");function o(l){i.call(this,l)}n("../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},r.exports=o},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,s){var i=n("../utils"),o=n("../support"),l=n("./ArrayReader"),c=n("./StringReader"),u=n("./NodeBufferReader"),d=n("./Uint8ArrayReader");r.exports=function(h){var f=i.getTypeOf(h);return i.checkSupport(f),f!=="string"||o.uint8array?f==="nodebuffer"?new u(h):o.uint8array?new d(i.transformTo("uint8array",h)):new l(i.transformTo("array",h)):new c(h)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,r,s){s.LOCAL_FILE_HEADER="PK��",s.CENTRAL_FILE_HEADER="PK��",s.CENTRAL_DIRECTORY_END="PK��",s.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK�\x07",s.ZIP64_CENTRAL_DIRECTORY_END="PK��",s.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,r,s){var i=n("./GenericWorker"),o=n("../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})},r.exports=l},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,s){var i=n("./GenericWorker"),o=n("../crc32");function l(){i.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(l,i),l.prototype.processChunk=function(c){this.streamInfo.crc32=o(c.data,this.streamInfo.crc32||0),this.push(c)},r.exports=l},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,s){var i=n("../utils"),o=n("./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)},r.exports=l},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,s){var i=n("../utils"),o=n("./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}})},r.exports=l},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,s){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}},r.exports=i},{}],29:[function(n,r,s){var i=n("../utils"),o=n("./ConvertWorker"),l=n("./GenericWorker"),c=n("../base64"),u=n("../support"),d=n("../external"),h=null;if(u.nodestream)try{h=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function f(m,v){return new d.Promise(function(x,g){var w=[],_=m._internalType,j=m._outputType,N=m._mimeType;m.on("data",function(S,C){w.push(S),v&&v(C)}).on("error",function(S){w=[],g(S)}).on("end",function(){try{var S=function(C,k,E){switch(C){case"blob":return i.newBlob(i.transformTo("arraybuffer",k),E);case"base64":return c.encode(k);default:return i.transformTo(C,k)}}(j,function(C,k){var E,P=0,T=null,M=0;for(E=0;E<k.length;E++)M+=k[E].length;switch(C){case"string":return k.join("");case"array":return Array.prototype.concat.apply([],k);case"uint8array":for(T=new Uint8Array(M),E=0;E<k.length;E++)T.set(k[E],P),P+=k[E].length;return T;case"nodebuffer":return Buffer.concat(k);default:throw new Error("concat : unsupported type '"+C+"'")}}(_,w),N);x(S)}catch(C){g(C)}w=[]}).resume()})}function p(m,v,x){var g=v;switch(v){case"blob":case"arraybuffer":g="uint8array";break;case"base64":g="string"}try{this._internalType=g,this._outputType=v,this._mimeType=x,i.checkSupport(g),this._worker=m.pipe(new o(g)),m.lock()}catch(w){this._worker=new l("error"),this._worker.error(w)}}p.prototype={accumulate:function(m){return f(this,m)},on:function(m,v){var x=this;return m==="data"?this._worker.on(m,function(g){v.call(x,g.data,g.meta)}):this._worker.on(m,function(){i.delay(v,arguments,x)}),this},resume:function(){return i.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(m){if(i.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new h(this,{objectMode:this._outputType!=="nodebuffer"},m)}},r.exports=p},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(n,r,s){if(s.base64=!0,s.array=!0,s.string=!0,s.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",s.nodebuffer=typeof Buffer<"u",s.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")s.blob=!1;else{var i=new ArrayBuffer(0);try{s.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),s.blob=o.getBlob("application/zip").size===0}catch{s.blob=!1}}}try{s.nodestream=!!n("readable-stream").Readable}catch{s.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,s){for(var i=n("./utils"),o=n("./support"),l=n("./nodejsUtils"),c=n("./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 h(){c.call(this,"utf-8 decode"),this.leftOver=null}function f(){c.call(this,"utf-8 encode")}s.utf8encode=function(p){return o.nodebuffer?l.newBufferFrom(p,"utf-8"):function(m){var v,x,g,w,_,j=m.length,N=0;for(w=0;w<j;w++)(64512&(x=m.charCodeAt(w)))==55296&&w+1<j&&(64512&(g=m.charCodeAt(w+1)))==56320&&(x=65536+(x-55296<<10)+(g-56320),w++),N+=x<128?1:x<2048?2:x<65536?3:4;for(v=o.uint8array?new Uint8Array(N):new Array(N),w=_=0;_<N;w++)(64512&(x=m.charCodeAt(w)))==55296&&w+1<j&&(64512&(g=m.charCodeAt(w+1)))==56320&&(x=65536+(x-55296<<10)+(g-56320),w++),x<128?v[_++]=x:(x<2048?v[_++]=192|x>>>6:(x<65536?v[_++]=224|x>>>12:(v[_++]=240|x>>>18,v[_++]=128|x>>>12&63),v[_++]=128|x>>>6&63),v[_++]=128|63&x);return v}(p)},s.utf8decode=function(p){return o.nodebuffer?i.transformTo("nodebuffer",p).toString("utf-8"):function(m){var v,x,g,w,_=m.length,j=new Array(2*_);for(v=x=0;v<_;)if((g=m[v++])<128)j[x++]=g;else if(4<(w=u[g]))j[x++]=65533,v+=w-1;else{for(g&=w===2?31:w===3?15:7;1<w&&v<_;)g=g<<6|63&m[v++],w--;1<w?j[x++]=65533:g<65536?j[x++]=g:(g-=65536,j[x++]=55296|g>>10&1023,j[x++]=56320|1023&g)}return j.length!==x&&(j.subarray?j=j.subarray(0,x):j.length=x),i.applyFromCharCode(j)}(p=i.transformTo(o.uint8array?"uint8array":"array",p))},i.inherits(h,c),h.prototype.processChunk=function(p){var m=i.transformTo(o.uint8array?"uint8array":"array",p.data);if(this.leftOver&&this.leftOver.length){if(o.uint8array){var v=m;(m=new Uint8Array(v.length+this.leftOver.length)).set(this.leftOver,0),m.set(v,this.leftOver.length)}else m=this.leftOver.concat(m);this.leftOver=null}var x=function(w,_){var j;for((_=_||w.length)>w.length&&(_=w.length),j=_-1;0<=j&&(192&w[j])==128;)j--;return j<0||j===0?_:j+u[w[j]]>_?j:_}(m),g=m;x!==m.length&&(o.uint8array?(g=m.subarray(0,x),this.leftOver=m.subarray(x,m.length)):(g=m.slice(0,x),this.leftOver=m.slice(x,m.length))),this.push({data:s.utf8decode(g),meta:p.meta})},h.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:s.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},s.Utf8DecodeWorker=h,i.inherits(f,c),f.prototype.processChunk=function(p){this.push({data:s.utf8encode(p.data),meta:p.meta})},s.Utf8EncodeWorker=f},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,s){var i=n("./support"),o=n("./base64"),l=n("./nodejsUtils"),c=n("./external");function u(v){return v}function d(v,x){for(var g=0;g<v.length;++g)x[g]=255&v.charCodeAt(g);return x}n("setimmediate"),s.newBlob=function(v,x){s.checkSupport("blob");try{return new Blob([v],{type:x})}catch{try{var g=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return g.append(v),g.getBlob(x)}catch{throw new Error("Bug : can't construct the Blob.")}}};var h={stringifyByChunk:function(v,x,g){var w=[],_=0,j=v.length;if(j<=g)return String.fromCharCode.apply(null,v);for(;_<j;)x==="array"||x==="nodebuffer"?w.push(String.fromCharCode.apply(null,v.slice(_,Math.min(_+g,j)))):w.push(String.fromCharCode.apply(null,v.subarray(_,Math.min(_+g,j)))),_+=g;return w.join("")},stringifyByChar:function(v){for(var x="",g=0;g<v.length;g++)x+=String.fromCharCode(v[g]);return x},applyCanBeUsed:{uint8array:function(){try{return i.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}}(),nodebuffer:function(){try{return i.nodebuffer&&String.fromCharCode.apply(null,l.allocBuffer(1)).length===1}catch{return!1}}()}};function f(v){var x=65536,g=s.getTypeOf(v),w=!0;if(g==="uint8array"?w=h.applyCanBeUsed.uint8array:g==="nodebuffer"&&(w=h.applyCanBeUsed.nodebuffer),w)for(;1<x;)try{return h.stringifyByChunk(v,g,x)}catch{x=Math.floor(x/2)}return h.stringifyByChar(v)}function p(v,x){for(var g=0;g<v.length;g++)x[g]=v[g];return x}s.applyFromCharCode=f;var m={};m.string={string:u,array:function(v){return d(v,new Array(v.length))},arraybuffer:function(v){return m.string.uint8array(v).buffer},uint8array:function(v){return d(v,new Uint8Array(v.length))},nodebuffer:function(v){return d(v,l.allocBuffer(v.length))}},m.array={string:f,array:u,arraybuffer:function(v){return new Uint8Array(v).buffer},uint8array:function(v){return new Uint8Array(v)},nodebuffer:function(v){return l.newBufferFrom(v)}},m.arraybuffer={string:function(v){return f(new Uint8Array(v))},array:function(v){return p(new Uint8Array(v),new Array(v.byteLength))},arraybuffer:u,uint8array:function(v){return new Uint8Array(v)},nodebuffer:function(v){return l.newBufferFrom(new Uint8Array(v))}},m.uint8array={string:f,array:function(v){return p(v,new Array(v.length))},arraybuffer:function(v){return v.buffer},uint8array:u,nodebuffer:function(v){return l.newBufferFrom(v)}},m.nodebuffer={string:f,array:function(v){return p(v,new Array(v.length))},arraybuffer:function(v){return m.nodebuffer.uint8array(v).buffer},uint8array:function(v){return p(v,new Uint8Array(v.length))},nodebuffer:u},s.transformTo=function(v,x){if(x=x||"",!v)return x;s.checkSupport(v);var g=s.getTypeOf(x);return m[g][v](x)},s.resolve=function(v){for(var x=v.split("/"),g=[],w=0;w<x.length;w++){var _=x[w];_==="."||_===""&&w!==0&&w!==x.length-1||(_===".."?g.pop():g.push(_))}return g.join("/")},s.getTypeOf=function(v){return typeof v=="string"?"string":Object.prototype.toString.call(v)==="[object Array]"?"array":i.nodebuffer&&l.isBuffer(v)?"nodebuffer":i.uint8array&&v instanceof Uint8Array?"uint8array":i.arraybuffer&&v instanceof ArrayBuffer?"arraybuffer":void 0},s.checkSupport=function(v){if(!i[v.toLowerCase()])throw new Error(v+" is not supported by this platform")},s.MAX_VALUE_16BITS=65535,s.MAX_VALUE_32BITS=-1,s.pretty=function(v){var x,g,w="";for(g=0;g<(v||"").length;g++)w+="\\x"+((x=v.charCodeAt(g))<16?"0":"")+x.toString(16).toUpperCase();return w},s.delay=function(v,x,g){setImmediate(function(){v.apply(g||null,x||[])})},s.inherits=function(v,x){function g(){}g.prototype=x.prototype,v.prototype=new g},s.extend=function(){var v,x,g={};for(v=0;v<arguments.length;v++)for(x in arguments[v])Object.prototype.hasOwnProperty.call(arguments[v],x)&&g[x]===void 0&&(g[x]=arguments[v][x]);return g},s.prepareContent=function(v,x,g,w,_){return c.Promise.resolve(x).then(function(j){return i.blob&&(j instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(j))!==-1)&&typeof FileReader<"u"?new c.Promise(function(N,S){var C=new FileReader;C.onload=function(k){N(k.target.result)},C.onerror=function(k){S(k.target.error)},C.readAsArrayBuffer(j)}):j}).then(function(j){var N=s.getTypeOf(j);return N?(N==="arraybuffer"?j=s.transformTo("uint8array",j):N==="string"&&(_?j=o.decode(j):g&&w!==!0&&(j=function(S){return d(S,i.uint8array?new Uint8Array(S.length):new Array(S.length))}(j))),j):c.Promise.reject(new Error("Can't read the data of '"+v+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(n,r,s){var i=n("./reader/readerFor"),o=n("./utils"),l=n("./signature"),c=n("./zipEntry"),u=n("./support");function d(h){this.files=[],this.loadOptions=h}d.prototype={checkSignature:function(h){if(!this.reader.readAndCheckSignature(h)){this.reader.index-=4;var f=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+o.pretty(f)+", expected "+o.pretty(h)+")")}},isSignature:function(h,f){var p=this.reader.index;this.reader.setIndex(h);var m=this.reader.readString(4)===f;return this.reader.setIndex(p),m},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 h=this.reader.readData(this.zipCommentLength),f=u.uint8array?"uint8array":"array",p=o.transformTo(f,h);this.zipComment=this.loadOptions.decodeFileName(p)},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 h,f,p,m=this.zip64EndOfCentralSize-44;0<m;)h=this.reader.readInt(2),f=this.reader.readInt(4),p=this.reader.readData(f),this.zip64ExtensibleData[h]={id:h,length:f,value:p}},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 h,f;for(h=0;h<this.files.length;h++)f=this.files[h],this.reader.setIndex(f.localHeaderOffset),this.checkSignature(l.LOCAL_FILE_HEADER),f.readLocalPart(this.reader),f.handleUTF8(),f.processAttributes()},readCentralDir:function(){var h;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(l.CENTRAL_FILE_HEADER);)(h=new c({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(h);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 h=this.reader.lastIndexOfSignature(l.CENTRAL_DIRECTORY_END);if(h<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 f
1249ile ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(h);var f=h;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,(h=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(h),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 p=this.centralDirOffset+this.centralDirSize;this.zip64&&(p+=20,p+=12+this.zip64EndOfCentralSize);var m=f-p;if(0<m)this.isSignature(f,l.CENTRAL_FILE_HEADER)||(this.reader.zero=m);else if(m<0)throw new Error("Corrupted zip: missing "+Math.abs(m)+" bytes.")},prepareReader:function(h){this.reader=i(h)},load:function(h){this.prepareReader(h),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},r.exports=d},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(n,r,s){var i=n("./reader/readerFor"),o=n("./utils"),l=n("./compressedObject"),c=n("./crc32"),u=n("./utf8"),d=n("./compressions"),h=n("./support");function f(p,m){this.options=p,this.loadOptions=m}f.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(p){var m,v;if(p.skip(22),this.fileNameLength=p.readInt(2),v=p.readInt(2),this.fileName=p.readData(this.fileNameLength),p.skip(v),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((m=function(x){for(var g in d)if(Object.prototype.hasOwnProperty.call(d,g)&&d[g].magic===x)return d[g];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,m,p.readData(this.compressedSize))},readCentralPart:function(p){this.versionMadeBy=p.readInt(2),p.skip(2),this.bitFlag=p.readInt(2),this.compressionMethod=p.readString(2),this.date=p.readDate(),this.crc32=p.readInt(4),this.compressedSize=p.readInt(4),this.uncompressedSize=p.readInt(4);var m=p.readInt(2);if(this.extraFieldsLength=p.readInt(2),this.fileCommentLength=p.readInt(2),this.diskNumberStart=p.readInt(2),this.internalFileAttributes=p.readInt(2),this.externalFileAttributes=p.readInt(4),this.localHeaderOffset=p.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");p.skip(m),this.readExtraFields(p),this.parseZIP64ExtraField(p),this.fileComment=p.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var p=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),p==0&&(this.dosPermissions=63&this.externalFileAttributes),p==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var p=i(this.extraFields[1].value);this.uncompressedSize===o.MAX_VALUE_32BITS&&(this.uncompressedSize=p.readInt(8)),this.compressedSize===o.MAX_VALUE_32BITS&&(this.compressedSize=p.readInt(8)),this.localHeaderOffset===o.MAX_VALUE_32BITS&&
vendor: 54,661 bytes, line 1249
1249(this.localHeaderOffset=p.readInt(8)),this.diskNumberStart===o.MAX_VALUE_32BITS&&(this.diskNumberStart=p.readInt(4))}},readExtraFields:function(p){var m,v,x,g=p.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});p.index+4<g;)m=p.readInt(2),v=p.readInt(2),x=p.readData(v),this.extraFields[m]={id:m,length:v,value:x};p.setIndex(g)},handleUTF8:function(){var p=h.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=u.utf8decode(this.fileName),this.fileCommentStr=u.utf8decode(this.fileComment);else{var m=this.findExtraFieldUnicodePath();if(m!==null)this.fileNameStr=m;else{var v=o.transformTo(p,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(v)}var x=this.findExtraFieldUnicodeComment();if(x!==null)this.fileCommentStr=x;else{var g=o.transformTo(p,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(g)}}},findExtraFieldUnicodePath:function(){var p=this.extraFields[28789];if(p){var m=i(p.value);return m.readInt(1)!==1||c(this.fileName)!==m.readInt(4)?null:u.utf8decode(m.readData(p.length-5))}return null},findExtraFieldUnicodeComment:function(){var p=this.extraFields[25461];if(p){var m=i(p.value);return m.readInt(1)!==1||c(this.fileComment)!==m.readInt(4)?null:u.utf8decode(m.readData(p.length-5))}return null}},r.exports=f},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,r,s){function i(m,v,x){this.name=m,this.dir=x.dir,this.date=x.date,this.comment=x.comment,this.unixPermissions=x.unixPermissions,this.dosPermissions=x.dosPermissions,this._data=v,this._dataBinary=x.binary,this.options={compression:x.compression,compressionOptions:x.compressionOptions}}var o=n("./stream/StreamHelper"),l=n("./stream/DataWorker"),c=n("./utf8"),u=n("./compressedObject"),d=n("./stream/GenericWorker");i.prototype={internalStream:function(m){var v=null,x="string";try{if(!m)throw new Error("No output type specified.");var g=(x=m.toLowerCase())==="string"||x==="text";x!=="binarystring"&&x!=="text"||(x="string"),v=this._decompressWorker();var w=!this._dataBinary;w&&!g&&(v=v.pipe(new c.Utf8EncodeWorker)),!w&&g&&(v=v.pipe(new c.Utf8DecodeWorker))}catch(_){(v=new d("error")).error(_)}return new o(v,x,"")},async:function(m,v){return this.internalStream(m).accumulate(v)},nodeStream:function(m,v){return this.internalStream(m||"nodebuffer").toNodejsStream(v)},_compressWorker:function(m,v){if(this._data instanceof u&&this._data.compression.magic===m.magic)return this._data.getCompressedWorker();var x=this._decompressWorker();return this._dataBinary||(x=x.pipe(new c.Utf8EncodeWorker)),u.createWorkerFrom(x,m,v)},_decompressWorker:function(){return this._data instanceof u?this._data.getContentWorker():this._data instanceof d?this._data:new l(this._data)}};for(var h=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],f=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},p=0;p<h.length;p++)i.prototype[h[p]]=f;r.exports=i},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(n,r,s){(function(i){var o,l,c=i.MutationObserver||i.WebKitMutationObserver;if(c){var u=0,d=new c(m),h=i.document.createTextNode("");d.observe(h,{characterData:!0}),o=function(){h.data=u=++u%2}}else if(i.setImmediate||i.MessageChannel===void 0)o="document"in i&&"onreadystatechange"in i.document.createElement("script")?function(){var v=i.document.createElement("script");v.onreadystatechange=function(){m(),v.onreadystatechange=null,v.parentNode.removeChild(v),v=null},i.document.documentElement.appendChild(v)}:function(){setTimeout(m,0)};else{var f=new i.MessageChannel;f.port1.onmessage=m,o=function(){f.port2.postMessage(0)}}var p=[];function m(){var v,x;l=!0;for(var g=p.length;g;){for(x=p,p=[],v=-1;++v<g;)x[v]();g=p.length}l=!1}r.exports=function(v){p.push(v)!==1||l||o()}}).call(this,typeof YS<"u"?YS:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(n,r,s){var i=n("immediate");function o(){}var l={},c=["REJECTED"],u=["FULFILLED"],d=["PENDING"];function h(g){if(typeof g!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,g!==o&&v(this,g)}function f(g,w,_){this.promise=g,typeof w=="function"&&(this.onFulfilled=w,this.callFulfilled=this.otherCallFulfilled),typeof _=="function"&&(this.onRejected=_,this.callRejected=this.otherCallRejected)}function p(g,w,_){i(function(){var j;try{j=w(_)}catch(N){return l.reject(g,N)}j===g?l.reject(g,new TypeError("Cannot resolve promise with itself")):l.resolve(g,j)})}function m(g){var w=g&&g.then;if(g&&(typeof g=="object"||typeof g=="function")&&typeof w=="function")return function(){w.apply(g,arguments)}}function v(g,w){var _=!1;function j(C){_||(_=!0,l.reject(g,C))}function N(C){_||(_=!0,l.resolve(g,C))}var S=x(function(){w(N,j)});S.status==="error"&&j(S.value)}function x(g,w){var _={};try{_.value=g(w),_.status="success"}catch(j){_.status="error",_.value=j}return _}(r.exports=h).prototype.finally=function(g){if(typeof g!="function")return this;var w=this.constructor;return this.then(function(_){return w.resolve(g()).then(function(){return _})},function(_){return w.resolve(g()).then(function(){throw _})})},h.prototype.catch=function(g){return this.then(null,g)},h.prototype.then=function(g,w){if(typeof g!="function"&&this.state===u||typeof w!="function"&&this.state===c)return this;var _=new this.constructor(o);return this.state!==d?p(_,this.state===u?g:w,this.outcome):this.queue.push(new f(_,g,w)),_},f.prototype.callFulfilled=function(g){l.resolve(this.promise,g)},f.prototype.otherCallFulfilled=function(g){p(this.promise,this.onFulfilled,g)},f.prototype.callRejected=function(g){l.reject(this.promise,g)},f.prototype.otherCallRejected=function(g){p(this.promise,this.onRejected,g)},l.resolve=function(g,w){var _=x(m,w);if(_.status==="error")return l.reject(g,_.value);var j=_.value;if(j)v(g,j);else{g.state=u,g.outcome=w;for(var N=-1,S=g.queue.length;++N<S;)g.queue[N].callFulfilled(w)}return g},l.reject=function(g,w){g.state=c,g.outcome=w;for(var _=-1,j=g.queue.length;++_<j;)g.queue[_].callRejected(w);return g},h.resolve=function(g){return g instanceof this?g:l.resolve(new this(o),g)},h.reject=function(g){var w=new this(o);return l.reject(w,g)},h.all=function(g){var w=this;if(Object.prototype.toString.call(g)!=="[object Array]")return this.reject(new TypeError("must be an array"));var _=g.length,j=!1;if(!_)return this.resolve([]);for(var N=new Array(_),S=0,C=-1,k=new this(o);++C<_;)E(g[C],C);return k;function E(P,T){w.resolve(P).then(function(M){N[T]=M,++S!==_||j||(j=!0,l.resolve(k,N))},function(M){j||(j=!0,l.reject(k,M))})}},h.race=function(g){var w=this;if(Object.prototype.toString.call(g)!=="[object Array]")return this.reject(new TypeError("must be an array"));var _=g.length,j=!1;if(!_)return this.resolve([]);for(var N=-1,S=new this(o);++N<_;)C=g[N],w.resolve(C).then(function(k){j||(j=!0,l.resolve(S,k))},function(k){j||(j=!0,l.reject(S,k))});var C;return S}},{immediate:36}],38:[function(n,r,s){var i={};(0,n("./lib/utils/common").assign)(i,n("./lib/deflate"),n("./lib/inflate"),n("./lib/zlib/constants")),r.exports=i},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(n,r,s){var i=n("./zlib/deflate"),o=n("./utils/common"),l=n("./utils/strings"),c=n("./zlib/messages"),u=n("./zlib/zstream"),d=Object.prototype.toString,h=0,f=-1,p=0,m=8;function v(g){if(!(this instanceof v))return new v(g);this.options=o.assign({level:f,method:m,chunkSize:16384,windowBits:15,memLevel:8,strategy:p,to:""},g||{});var w=this.options;w.raw&&0<w.windowBits?w.windowBits=-w.windowBits:w.gzip&&0<w.windowBits&&w.windowBits<16&&(w.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var _=i.deflateInit2(this.strm,w.level,w.method,w.windowBits,w.memLevel,w.strategy);if(_!==h)throw new Error(c[_]);if(w.header&&i.deflateSetHeader(this.strm,w.header),w.dictionary){var j;if(j=typeof w.dictionary=="string"?l.string2buf(w.dictionary):d.call(w.dictionary)==="[object ArrayBuffer]"?new Uint8Array(w.dictionary):w.dictionary,(_=i.deflateSetDictionary(this.strm,j))!==h)throw new Error(c[_]);this._dict_set=!0}}function x(g,w){var _=new v(w);if(_.push(g,!0),_.err)throw _.msg||c[_.err];return _.result}v.prototype.push=function(g,w){var _,j,N=this.strm,S=this.options.chunkSize;if(this.ended)return!1;j=w===~~w?w:w===!0?4:0,typeof g=="string"?N.input=l.string2buf(g):d.call(g)==="[object ArrayBuffer]"?N.input=new Uint8Array(g):N.input=g,N.next_in=0,N.avail_in=N.input.length;do{if(N.avail_out===0&&(N.output=new o.Buf8(S),N.next_out=0,N.avail_out=S),(_=i.deflate(N,j))!==1&&_!==h)return this.onEnd(_),!(this.ended=!0);N.avail_out!==0&&(N.avail_in!==0||j!==4&&j!==2)||(this.options.to==="string"?this.onData(l.buf2binstring(o.shrinkBuf(N.output,N.next_out))):this.onData(o.shrinkBuf(N.output,N.next_out)))}while((0<N.avail_in||N.avail_out===0)&&_!==1);return j===4?(_=i.deflateEnd(this.strm),this.onEnd(_),this.ended=!0,_===h):j!==2||(this.onEnd(h),!(N.avail_out=0))},v.prototype.onData=function(g){this.chunks.push(g)},v.prototype.onEnd=function(g){g===h&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=g,this.msg=this.strm.msg},s.Deflate=v,s.deflate=x,s.deflateRaw=function(g,w){return(w=w||{}).raw=!0,x(g,w)},s.gzip=function(g,w){return(w=w||{}).gzip=!0,x(g,w)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(n,r,s){var i=n("./zlib/inflate"),o=n("./utils/common"),l=n("./utils/strings"),c=n("./zlib/constants"),u=n("./zlib/messages"),d=n("./zlib/zstream"),h=n("./zlib/gzheader"),f=Object.prototype.toString;function p(v){if(!(this instanceof p))return new p(v);this.options=o.assign({chunkSize:16384,windowBits:0,to:""},v||{});var x=this.options;x.raw&&0<=x.windowBits&&x.windowBits<16&&(x.windowBits=-x.windowBits,x.windowBits===0&&(x.windowBits=-15)),!(0<=x.windowBits&&x.windowBits<16)||v&&v.windowBits||(x.windowBits+=32),15<x.windowBits&&x.windowBits<48&&!(15&x.windowBits)&&(x.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var g=i.inflateInit2(this.strm,x.windowBits);if(g!==c.Z_OK)throw new Error(u[g]);this.header=new h,i.inflateGetHeader(this.strm,this.header)}function m(v,x){var g=new p(x);if(g.push(v,!0),g.err)throw g.msg||u[g.err];return g.result}p.prototype.push=function(v,x){var g,w,_,j,N,S,C=this.strm,k=this.options.chunkSize,E=this.options.dictionary,P=!1;if(this.ended)return!1;w=x===~~x?x:x===!0?c.Z_FINISH:c.Z_NO_FLUSH,typeof v=="string"?C.input=l.binstring2buf(v):f.call(v)==="[object ArrayBuffer]"?C.input=new Uint8Array(v):C.input=v,C.next_in=0,C.avail_in=C.input.length;do{if(C.avail_out===0&&(C.output=new o.Buf8(k),C.next_out=0,C.avail_out=k),(g=i.inflate(C,c.Z_NO_FLUSH))===c.Z_NEED_DICT&&E&&(S=typeof E=="string"?l.string2buf(E):f.call(E)==="[object ArrayBuffer]"?new Uint8Array(E):E,g=i.inflateSetDictionary(this.strm,S)),g===c.Z_BUF_ERROR&&P===!0&&(g=c.Z_OK,P=!1),g!==c.Z_STREAM_END&&g!==c.Z_OK)return this.onEnd(g),!(this.ended=!0);C.next_out&&(C.avail_out!==0&&g!==c.Z_STREAM_END&&(C.avail_in!==0||w!==c.Z_FINISH&&w!==c.Z_SYNC_FLUSH)||(this.options.to==="string"?(_=l.utf8border(C.output,C.next_out),j=C.next_out-_,N=l.buf2string(C.output,_),C.next_out=j,C.avail_out=k-j,j&&o.arraySet(C.output,C.output,_,j,0),this.onData(N)):this.onData(o.shrinkBuf(C.output,C.next_out)))),C.avail_in===0&&C.avail_out===0&&(P=!0)}while((0<C.avail_in||C.avail_out===0)&&g!==c.Z_STREAM_END);return g===c.Z_STREAM_END&&(w=c.Z_FINISH),w===c.Z_FINISH?(g=i.inflateEnd(this.strm),this.onEnd(g),this.ended=!0,g===c.Z_OK):w!==c.Z_SYNC_FLUSH||(this.onEnd(c.Z_OK),!(C.avail_out=0))},p.prototype.onData=function(v){this.chunks.push(v)},p.prototype.onEnd=function(v){v===c.Z_OK&&(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},s.Inflate=p,s.inflate=m,s.inflateRaw=function(v,x){return(x=x||{}).raw=!0,m(v,x)},s.ungzip=m},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(n,r,s){var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";s.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 h in d)d.hasOwnProperty(h)&&(c[h]=d[h])}}return c},s.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,h,f){if(u.subarray&&c.subarray)c.set(u.subarray(d,d+h),f);else for(var p=0;p<h;p++)c[f+p]=u[d+p]},flattenChunks:function(c){var u,d,h,f,p,m;for(u=h=0,d=c.length;u<d;u++)h+=c[u].length;for(m=new Uint8Array(h),u=f=0,d=c.length;u<d;u++)p=c[u],m.set(p,f),f+=p.length;return m}},l={arraySet:function(c,u,d,h,f){for(var p=0;p<h;p++)c[f+p]=u[d+p]},flattenChunks:function(c){return[].concat.apply([],c)}};s.setTyped=function(c){c?(s.Buf8=Uint8Array,s.Buf16=Uint16Array,s.Buf32=Int32Array,s.assign(s,o)):(s.Buf8=Array,s.Buf16=Array,s.Buf32=Array,s.assign(s,l))},s.setTyped(i)},{}],42:[function(n,r,s){var i=n("./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(h,f){if(f<65537&&(h.subarray&&l||!h.subarray&&o))return String.fromCharCode.apply(null,i.shrinkBuf(h,f));for(var p="",m=0;m<f;m++)p+=String.fromCharCode(h[m]);return p}c[254]=c[254]=1,s.string2buf=function(h){var f,p,m,v,x,g=h.length,w=0;for(v=0;v<g;v++)(64512&(p=h.charCodeAt(v)))==55296&&v+1<g&&(64512&(m=h.charCodeAt(v+1)))==56320&&(p=65536+(p-55296<<10)+(m-56320),v++),w+=p<128?1:p<2048?2:p<65536?3:4;for(f=new i.Buf8(w),v=x=0;x<w;v++)(64512&(p=h.charCodeAt(v)))==55296&&v+1<g&&(64512&(m=h.charCodeAt(v+1)))==56320&&(p=65536+(p-55296<<10)+(m-56320),v++),p<128?f[x++]=p:(p<2048?f[x++]=192|p>>>6:(p<65536?f[x++]=224|p>>>12:(f[x++]=240|p>>>18,f[x++]=128|p>>>12&63),f[x++]=128|p>>>6&63),f[x++]=128|63&p);return f},s.buf2binstring=function(h){return d(h,h.length)},s.binstring2buf=function(h){for(var f=new i.Buf8(h.length),p=0,m=f.length;p<m;p++)f[p]=h.charCodeAt(p);return f},s.buf2string=function(h,f){var p,m,v,x,g=f||h.length,w=new Array(2*g);for(p=m=0;p<g;)if((v=h[p++])<128)w[m++]=v;else if(4<(x=c[v]))w[m++]=65533,p+=x-1;else{for(v&=x===2?31:x===3?15:7;1<x&&p<g;)v=v<<6|63&h[p++],x--;1<x?w[m++]=65533:v<65536?w[m++]=v:(v-=65536,w[m++]=55296|v>>10&1023,w[m++]=56320|1023&v)}return d(w,m)},s.utf8border=function(h,f){var p;for((f=f||h.length)>h.length&&(f=h.length),p=f-1;0<=p&&(192&h[p])==128;)p--;return p<0||p===0?f:p+c[h[p]]>f?p:f}},{"./common":41}],43:[function(n,r,s){r.exports=function(i,o,l,c){for(var u=65535&i|0,d=i>>>16&65535|0,h=0;l!==0;){for(l-=h=2e3<l?2e3:l;d=d+(u=u+o[c++]|0)|0,--h;);u%=65521,d%=65521}return u|d<<16|0}},{}],44:[function(n,r,s){r.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(n,r,s){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}();r.exports=function(o,l,c,u){var d=i,h=u+c;o^=-1;for(var f=u;f<h;f++)o=o>>>8^d[255&(o^l[f])];return-1^o}},{}],46:[function(n,r,s){var i,o=n("../utils/common"),l=n("./trees"),c=n("./adler32"),u=n("./crc32"),d=n("./messages"),h=0,f=4,p=0,m=-2,v=-1,x=4,g=2,w=8,_=9,j=286,N=30,S=19,C=2*j+1,k=15,E=3,P=258,T=P+E+1,M=42,R=113,A=1,I=2,D=3,O=4;function z(L,X){return L.msg=d[X],X}function B(L){return(L<<1)-(4<L?9:0)}function G(L){for(var X=L.length;0<=--X;)L[X]=0}function U(L){var X=L.state,ne=X.pending;ne>L.avail_out&&(ne=L.avail_out),ne!==0&&(o.arraySet(L.output,X.pending_buf,X.pending_out,ne,L.next_out),L.next_out+=ne,X.pending_out+=ne,L.total_out+=ne,L.avail_out-=ne,X.pending-=ne,X.pending===0&&(X.pending_out=0))}function F(L,X){l._tr_flush_block(L,0<=L.block_start?L.block_start:-1,L.strstart-L.block_start,X),L.block_start=L.strstart,U(L.strm)}function W(L,X){L.pending_buf[L.pending++]=X}function Q(L,X){L.pending_buf[L.pending++]=X>>>8&255,L.pending_buf[L.pending++]=255&X}function K(L,X){var ne,Y,J=L.max_chain_length,se=L.strstart,ge=L.prev_length,de=L.nice_match,ce=L.strstart>L.w_size-T?L.strstart-(L.w_size-T):0,xe=L.window,je=L.w_mask,be=L.prev,Ee=L.strstart+P,Me=xe[se+ge-1],Oe=xe[se+ge];L.prev_length>=L.good_match&&(J>>=2),de>L.lookahead&&(de=L.lookahead);do if(xe[(ne=X)+ge]===Oe&&xe[ne+ge-1]===Me&&xe[ne]===xe[se]&&xe[++ne]===xe[se+1]){se+=2,ne++;do;while(xe[++se]===xe[++ne]&&xe[++se]===xe[++ne]&&xe[++se]===xe[++ne]&&xe[++se]===xe[++ne]&&xe[++se]===xe[++ne]&&xe[++se]===xe[++ne]&&xe[++se]===xe[++ne]&&xe[++se]===xe[++ne]&&se<Ee);if(Y=P-(Ee-se),se=Ee-P,ge<Y){if(L.match_start=X,de<=(ge=Y))break;Me=xe[se+ge-1],Oe=xe[se+ge]}}while((X=be[X&je])>ce&&--J!=0);return ge<=L.lookahead?ge:L.lookahead}function fe(L){var X,ne,Y,J,se,ge,de,ce,xe,je,be=L.w_size;do{if(J=L.window_size-L.lookahead-L.strstart,L.strstart>=be+(be-T)){for(o.arraySet(L.window,L.window,be,be,0),L.match_start-=be,L.strstart-=be,L.block_start-=be,X=ne=L.hash_size;Y=L.head[--X],L.head[X]=be<=Y?Y-be:0,--ne;);for(X=ne=be;Y=L.prev[--X],L.prev[X]=be<=Y?Y-be:0,--ne;);J+=be}if(L.strm.avail_in===0)break;if(ge=L.strm,de=L.window,ce=L.strstart+L.lookahead,xe=J,je=void 0,je=ge.avail_in,xe<je&&(je=xe),ne=je===0?0:(ge.avail_in-=je,o.arraySet(de,ge.input,ge.next_in,je,ce),ge.state.wrap===1?ge.adler=c(ge.adler,de,je,ce):ge.state.wrap===2&&(ge.adler=u(ge.adler,de,je,ce)),ge.next_in+=je,ge.total_in+=je,je),L.lookahead+=ne,L.lookahead+L.insert>=E)for(se=L.strstart-L.insert,L.ins_h=L.window[se],L.ins_h=(L.ins_h<<L.hash_shift^L.window[se+1])&L.hash_mask;L.insert&&(L.ins_h=(L.ins_h<<L.hash_shift^L.window[se+E-1])&L.hash_mask,L.prev[se&L.w_mask]=L.head[L.ins_h],L.head[L.ins_h]=se,se++,L.insert--,!(L.lookahead+L.insert<E)););}while(L.lookahead<T&&L.strm.avail_in!==0)}function oe(L,X){for(var ne,Y;;){if(L.lookahead<T){if(fe(L),L.lookahead<T&&X===h)return A;if(L.lookahead===0)break}if(ne=0,L.lookahead>=E&&(L.ins_h=(L.ins_h<<L.hash_shift^L.window[L.strstart+E-1])&L.hash_mask,ne=L.prev[L.strstart&L.w_mask]=L.head[L.ins_h],L.head[L.ins_h]=L.strstart),ne!==0&&L.strstart-ne<=L.w_size-T&&(L.match_length=K(L,ne)),L.match_length>=E)if(Y=l._tr_tally(L,L.strstart-L.match_start,L.match_length-E),L.lookahead-=L.match_length,L.match_length<=L.max_lazy_match&&L.lookahead>=E){for(L.match_length--;L.strstart++,L.ins_h=(L.ins_h<<L.hash_shift^L.window[L.strstart+E-1])&L.hash_mask,ne=L.prev[L.strstart&L.w_mask]=L.head[L.ins_h],L.head[L.ins_h]=L.strstart,--L.match_length!=0;);L.strstart++}else L.strstart+=L.match_length,L.match_length=0,L.ins_h=L.window[L.strstart],L.ins_h=(L.ins_h<<L.hash_shift^L.window[L.strstart+1])&L.hash_mask;else Y=l._tr_tally(L,0,L.window[L.strstart]),L.lookahead--,L.strstart++;if(Y&&(F(L,!1),L.strm.avail_out===0))return A}return L.insert=L.strstart<E-1?L.strstart:E-1,X===f?(F(L,!0),L.strm.avail_out===0?D:O):L.last_lit&&(F(L,!1),L.strm.avail_out===0)?A:I}function ye(L,X){for(var ne,Y,J;;){if(L.lookahead<T){if(fe(L),L.lookahead<T&&X===h)return A;if(L.lookahead===0)break}if(ne=0,L.lookahead>=E&&(L.ins_h=(L.ins_h<<L.hash_shift^L.window[L.strstart+E-1])&L.hash_mask,ne=L.prev[L.strstart&L.w_mask]=L.head[L.ins_h],L.head[L.ins_h]=L.strstart),L.prev_length=L.match_length,L.prev_match=L.match_start,L.match_length=E-1,ne!==0&&L.prev_length<L.max_lazy_match&&L.strstart-ne<=L.w_size-T&&(L.match_length=K(L,ne),L.match_length<=5&&(L.strategy===1||L.match_length===E&&4096<L.strstart-L.match_start)&&(L.match_length=E-1)),L.prev_length>=E&&L.match_length<=L.prev_length){for(J=L.strstart+L.lookahead-E,Y=l._tr_tally(L,L.strstart-1-L.prev_match,L.prev_length-E),L.lookahead-=L.prev_length-1,L.prev_length-=2;++L.strstart<=J&&(L.ins_h=(L.ins_h<<L.hash_shift^L.window[L.strstart+E-1])&L.hash_mask,ne=L.prev[L.strstart&L.w_mask]=L.head[L.ins_h],L.head[L.ins_h]=L.strstart),--L.prev_length!=0;);if(L.match_available=0,L.match_length=E-1,L.strstart++,Y&&(F(L,!1),L.strm.avail_out===0))return A}else if(L.match_available){if((Y=l._tr_tally(L,0,L.window[L.strstart-1]))&&F(L,!1),L.strstart++,L.lookahead--,L.strm.avail_out===0)return A}else L.match_available=1,L.strstart++,L.lookahead--}return L.match_available&&(Y=l._tr_tally(L,0,L.window[L.strstart-1]),L.match_available=0),L.insert=L.strstart<E-1?L.strstart:E-1,X===f?(F(L,!0),L.strm.avail_out===0?D:O):L.last_lit&&(F(L,!1),L.strm.avail_out===0)?A:I}function le(L,X,ne,Y,J){this.good_length=L,this.max_lazy=X,this.nice_length=ne,this.max_chain=Y,this.func=J}function me(){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=w,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*C),this.dyn_dtree=new o.Buf16(2*(2*N+1)),this.bl_tree=new o.Buf16(2*(2*S+1)),G(this.dyn_ltree),G(this.dyn_dtree),G(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new o.Buf16(k+1),this.heap=new o.Buf16(2*j+1),G(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new o.Buf16(2*j+1),G(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 he(L){var X;return L&&L.state?(L.total_in=L.total_out=0,L.data_type=g,(X=L.state).pending=0,X.pending_out=0,X.wrap<0&&(X.wrap=-X.wrap),X.status=X.wrap?M:R,L.adler=X.wrap===2?0:1,X.last_flush=h,l._tr_init(X),p):z(L,m)}function ae(L){var X=he(L);return X===p&&function(ne){ne.window_size=2*ne.w_size,G(ne.head),ne.max_lazy_match=i[ne.level].max_lazy,ne.good_match=i[ne.level].good_length,ne.nice_match=i[ne.level].nice_length,ne.max_chain_length=i[ne.level].max_chain,ne.strstart=0,ne.block_start=0,ne.lookahead=0,ne.insert=0,ne.match_length=ne.prev_length=E-1,ne.match_available=0,ne.ins_h=0}(L.state),X}function re(L,X,ne,Y,J,se){if(!L)return m;var ge=1;if(X===v&&(X=6),Y<0?(ge=0,Y=-Y):15<Y&&(ge=2,Y-=16),J<1||_<J||ne!==w||Y<8||15<Y||X<0||9<X||se<0||x<se)return z(L,m);Y===8&&(Y=9);var de=new me;return(L.state=de).strm=L,de.wrap=ge,de.gzhead=null,de.w_bits=Y,de.w_size=1<<de.w_bits,de.w_mask=de.w_size-1,de.hash_bits=J+7,de.hash_size=1<<de.hash_bits,de.hash_mask=de.hash_size-1,de.hash_shift=~~((de.hash_bits+E-1)/E),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<<J+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=X,de.strategy=se,de.method=ne,ae(L)}i=[new le(0,0,0,0,function(L,X){var ne=65535;for(ne>L.pending_buf_size-5&&(ne=L.pending_buf_size-5);;){if(L.lookahead<=1){if(fe(L),L.lookahead===0&&X===h)return A;if(L.lookahead===0)break}L.strstart+=L.lookahead,L.lookahead=0;var Y=L.block_start+ne;if((L.strstart===0||L.strstart>=Y)&&(L.lookahead=L.strstart-Y,L.strstart=Y,F(L,!1),L.strm.avail_out===0)||L.strstart-L.block_start>=L.w_size-T&&(F(L,!1),L.strm.avail_out===0))return A}return L.insert=0,X===f?(F(L,!0),L.strm.avail_out===0?D:O):(L.strstart>L.block_start&&(F(L,!1),L.strm.avail_out),A)}),new le(4,4,8,4,oe),new le(4,5,16,8,oe),new le(4,6,32,32,oe),new le(4,4,16,16,ye),new le(8,16,32,32,ye),new le(8,16,128,128,ye),new le(8,32,128,256,ye),new le(32,128,258,1024,ye),new le(32,258,258,4096,ye)],s.deflateInit=function(L,X){return re(L,X,w,15,8,0)},s.deflateInit2=re,s.deflateReset=ae,s.deflateResetKeep=he,s.deflateSetHeader=function(L,X){return L&&L.state?L.state.wrap!==2?m:(L.state.gzhead=X,p):m},s.deflate=function(L,X){var ne,Y,J,se;if(!L||!L.state||5<X||X<0)return L?z(L,m):m;if(Y=L.state,!L.output||!L.input&&L.avail_in!==0||Y.status===666&&X!==f)return z(L,L.avail_out===0?-5:m);if(Y.strm=L,ne=Y.last_flush,Y.last_flush=X,Y.status===M)if(Y.wrap===2)L.adler=0,W(Y,31),W(Y,139),W(Y,8),Y.gzhead?(W(Y,(Y.gzhead.text?1:0)+(Y.gzhead.hcrc?2:0)+(Y.gzhead.extra?4:0)+(Y.gzhead.name?8:0)+(Y.gzhead.comment?16:0)),W(Y,255&Y.gzhead.time),W(Y,Y.gzhead.time>>8&255),W(Y,Y.gzhead.time>>16&255),W(Y,Y.gzhead.time>>24&255),W(Y,Y.level===9?2:2<=Y.strategy||Y.level<2?4:0),W(Y,255&Y.gzhead.os),Y.gzhead.extra&&Y.gzhead.extra.length&&(W(Y,255&Y.gzhead.extra.length),W(Y,Y.gzhead.extra.length>>8&255)),Y.gzhead.hcrc&&(L.adler=u(L.adler,Y.pending_buf,Y.pending,0)),Y.gzindex=0,Y.status=69):(W(Y,0),W(Y,0),W(Y,0),W(Y,0),W(Y,0),W(Y,Y.level===9?2:2<=Y.strategy||Y.level<2?4:0),W(Y,3),Y.status=R);else{var ge=w+(Y.w_bits-8<<4)<<8;ge|=(2<=Y.strategy||Y.level<2?0:Y.level<6?1:Y.level===6?2:3)<<6,Y.strstart!==0&&(ge|=32),ge+=31-ge%31,Y.status=R,Q(Y,ge),Y.strstart!==0&&(Q(Y,L.adler>>>16),Q(Y,65535&L.adler)),L.adler=1}if(Y.status===69)if(Y.gzhead.extra){for(J=Y.pending;Y.gzindex<(65535&Y.gzhead.extra.length)&&(Y.pending!==Y.pending_buf_size||(Y.gzhead.hcrc&&Y.pending>J&&(L.adler=u(L.adler,Y.pending_buf,Y.pending-J,J)),U(L),J=Y.pending,Y.pending!==Y.pending_buf_size));)W(Y,255&Y.gzhead.extra[Y.gzindex]),Y.gzindex++;Y.gzhead.hcrc&&Y.pending>J&&(L.adler=u(L.adler,Y.pending_buf,Y.pending-J,J)),Y.gzindex===Y.gzhead.extra.length&&(Y.gzindex=0,Y.status=73)}else Y.status=73;if(Y.status===73)if(Y.gzhead.name){J=Y.pending;do{if(Y.pending===Y.pending_buf_size&&(Y.gzhead.hcrc&&Y.pending>J&&(L.adler=u(L.adler,Y.pending_buf,Y.pending-J,J)),U(L),J=Y.pending,Y.pending===Y.pending_buf_size)){se=1;break}se=Y.gzindex<Y.gzhead.name.length?255&Y.gzhead.name.charCodeAt(Y.gzindex++):0,W(Y,se)}while(se!==0);Y.gzhead.hcrc&&Y.pending>J&&(L.adler=u(L.adler,Y.pending_buf,Y.pending-J,J)),se===0&&(Y.gzindex=0,Y.status=91)}else Y.status=91;if(Y.status===91)if(Y.gzhead.comment){J=Y.pending;do{if(Y.pending===Y.pending_buf_size&&(Y.gzhead.hcrc&&Y.pending>J&&(L.adler=u(L.adler,Y.pending_buf,Y.pending-J,J)),U(L),J=Y.pending,Y.pending===Y.pending_buf_size)){se=1;break}se=Y.gzindex<Y.gzhead.comment.length?255&Y.gzhead.comment.charCodeAt(Y.gzindex++):0,W(Y,se)}while(se!==0);Y.gzhead.hcrc&&Y.pending>J&&(L.adler=u(L.adler,Y.pending_buf,Y.pending-J,J)),se===0&&(Y.status=103)}else Y.status=103;if(Y.status===103&&(Y.gzhead.hcrc?(Y.pending+2>Y.pending_buf_size&&U(L),Y.pending+2<=Y.pending_buf_size&&(W(Y,255&L.adler),W(Y,L.adler>>8&255),L.adler=0,Y.status=R)):Y.status=R),Y.pending!==0){if(U(L),L.avail_out===0)return Y.last_flush=-1,p}else if(L.avail_in===0&&B(X)<=B(ne)&&X!==f)return z(L,-5);if(Y.status===666&&L.avail_in!==0)return z(L,-5);if(L.avail_in!==0||Y.lookahead!==0||X!==h&&Y.status!==666){var de=Y.strategy===2?function(ce,xe){for(var je;;){if(ce.lookahead===0&&(fe(ce),ce.lookahead===0)){if(xe===h)return A;break}if(ce.match_length=0,je=l._tr_tally(ce,0,ce.window[ce.strstart]),ce.lookahead--,ce.strstart++,je&&(F(ce,!1),ce.strm.avail_out===0))return A}return ce.insert=0,xe===f?(F(ce,!0),ce.strm.avail_out===0?D:O):ce.last_lit&&(F(ce,!1),ce.strm.avail_out===0)?A:I}(Y,X):Y.strategy===3?function(ce,xe){for(var je,be,Ee,Me,Oe=ce.window;;){if(ce.lookahead<=P){if(fe(ce),ce.lookahead<=P&&xe===h)return A;if(ce.lookahead===0)break}if(ce.match_length=0,ce.lookahead>=E&&0<ce.strstart&&(be=Oe[Ee=ce.strstart-1])===Oe[++Ee]&&be===Oe[++Ee]&&be===Oe[++Ee]){Me=ce.strstart+P;do;while(be===Oe[++Ee]&&be===Oe[++Ee]&&be===Oe[++Ee]&&be===Oe[++Ee]&&be===Oe[++Ee]&&be===Oe[++Ee]&&be===Oe[++Ee]&&be===Oe[++Ee]&&Ee<Me);ce.match_length=P-(Me-Ee),ce.match_length>ce.lookahead&&(ce.match_length=ce.lookahead)}if(ce.match_length>=E?(je=l._tr_tally(ce,1,ce.match_length-E),ce.lookahead-=ce.match_length,ce.strstart+=ce.match_length,ce.match_length=0):(je=l._tr_tally(ce,0,ce.window[ce.strstart]),ce.lookahead--,ce.strstart++),je&&(F(ce,!1),ce.strm.avail_out===0))return A}return ce.insert=0,xe===f?(F(ce,!0),ce.strm.avail_out===0?D:O):ce.last_lit&&(F(ce,!1),ce.strm.avail_out===0)?A:I}(Y,X):i[Y.level].func(Y,X);if(de!==D&&de!==O||(Y.status=666),de===A||de===D)return L.avail_out===0&&(Y.last_flush=-1),p;if(de===I&&(X===1?l._tr_align(Y):X!==5&&(l._tr_stored_block(Y,0,0,!1),X===3&&(G(Y.head),Y.lookahead===0&&(Y.strstart=0,Y.block_start=0,Y.insert=0))),U(L),L.avail_out===0))return Y.last_flush=-1,p}return X!==f?p:Y.wrap<=0?1:(Y.wrap===2?(W(Y,255&L.adler),W(Y,L.adler>>8&255),W(Y,L.adler>>16&255),W(Y,L.adler>>24&255),W(Y,255&L.total_in),W(Y,L.total_in>>8&255),W(Y,L.total_in>>16&255),W(Y,L.total_in>>24&255)):(Q(Y,L.adler>>>16),Q(Y,65535&L.adler)),U(L),0<Y.wrap&&(Y.wrap=-Y.wrap),Y.pending!==0?p:1)},s.deflateEnd=function(L){var X;return L&&L.state?(X=L.state.status)!==M&&X!==69&&X!==73&&X!==91&&X!==103&&X!==R&&X!==666?z(L,m):(L.state=null,X===R?z(L,-3):p):m},s.deflateSetDictionary=function(L,X){var ne,Y,J,se,ge,de,ce,xe,je=X.length;if(!L||!L.state||(se=(ne=L.state).wrap)===2||se===1&&ne.status!==M||ne.lookahead)return m;for(se===1&&(L.adler=c(L.adler,X,je,0)),ne.wrap=0,je>=ne.w_size&&(se===0&&(G(ne.head),ne.strstart=0,ne.block_start=0,ne.insert=0),xe=new o.Buf8(ne.w_size),o.arraySet(xe,X,je-ne.w_size,ne.w_size,0),X=xe,je=ne.w_size),ge=L.avail_in,de=L.next_in,ce=L.input,L.avail_in=je,L.next_in=0,L.input=X,fe(ne);ne.lookahead>=E;){for(Y=ne.strstart,J=ne.lookahead-(E-1);ne.ins_h=(ne.ins_h<<ne.hash_shift^ne.window[Y+E-1])&ne.hash_mask,ne.prev[Y&ne.w_mask]=ne.head[ne.ins_h],ne.head[ne.ins_h]=Y,Y++,--J;);ne.strstart=Y,ne.lookahead=E-1,fe(ne)}return ne.strstart+=ne.lookahead,ne.block_start=ne.strstart,ne.insert=ne.lookahead,ne.lookahead=0,ne.match_length=ne.prev_length=E-1,ne.match_available=0,L.next_in=de,L.input=ce,L.avail_in=ge,ne.wrap=se,p},s.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(n,r,s){r.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(n,r,s){r.exports=function(i,o){var l,c,u,d,h,f,p,m,v,x,g,w,_,j,N,S,C,k,E,P,T,M,R,A,I;l=i.state,c=i.next_in,A=i.input,u=c+(i.avail_in-5),d=i.next_out,I=i.output,h=d-(o-i.avail_out),f=d+(i.avail_out-257),p=l.dmax,m=l.wsize,v=l.whave,x=l.wnext,g=l.window,w=l.hold,_=l.bits,j=l.lencode,N=l.distcode,S=(1<<l.lenbits)-1,C=(1<<l.distbits)-1;e:do{_<15&&(w+=A[c++]<<_,_+=8,w+=A[c++]<<_,_+=8),k=j[w&S];t:for(;;){if(w>>>=E=k>>>24,_-=E,(E=k>>>16&255)===0)I[d++]=65535&k;else{if(!(16&E)){if(!(64&E)){k=j[(65535&k)+(w&(1<<E)-1)];continue t}if(32&E){l.mode=12;break e}i.msg="invalid literal/length code",l.mode=30;break e}P=65535&k,(E&=15)&&(_<E&&(w+=A[c++]<<_,_+=8),P+=w&(1<<E)-1,w>>>=E,_-=E),_<15&&(w+=A[c++]<<_,_+=8,w+=A[c++]<<_,_+=8),k=N[w&C];n:for(;;){if(w>>>=E=k>>>24,_-=E,!(16&(E=k>>>16&255))){if(!(64&E)){k=N[(65535&k)+(w&(1<<E)-1)];continue n}i.msg="invalid distance code",l.mode=30;break e}if(T=65535&k,_<(E&=15)&&(w+=A[c++]<<_,(_+=8)<E&&(w+=A[c++]<<_,_+=8)),p<(T+=w&(1<<E)-1)){i.msg="invalid distance too far back",l.mode=30;break e}if(w>>>=E,_-=E,(E=d-h)<T){if(v<(E=T-E)&&l.sane){i.msg="invalid distance too far back",l.mode=30;break e}if(R=g,(M=0)===x){if(M+=m-E,E<P){for(P-=E;I[d++]=g[M++],--E;);M=d-T,R=I}}else if(x<E){if(M+=m+x-E,(E-=x)<P){for(P-=E;I[d++]=g[M++],--E;);if(M=0,x<P){for(P-=E=x;I[d++]=g[M++],--E;);M=d-T,R=I}}}else if(M+=x-E,E<P){for(P-=E;I[d++]=g[M++],--E;);M=d-T,R=I}for(;2<P;)I[d++]=R[M++],I[d++]=R[M++],I[d++]=R[M++],P-=3;P&&(I[d++]=R[M++],1<P&&(I[d++]=R[M++]))}else{for(M=d-T;I[d++]=I[M++],I[d++]=I[M++],I[d++]=I[M++],2<(P-=3););P&&(I[d++]=I[M++],1<P&&(I[d++]=I[M++]))}break}}break}}while(c<u&&d<f);c-=P=_>>3,w&=(1<<(_-=P<<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<f?f-d+257:257-(d-f),l.hold=w,l.bits=_}},{}],49:[function(n,r,s){var i=n("../utils/common"),o=n("./adler32"),l=n("./crc32"),c=n("./inffast"),u=n("./inftrees"),d=1,h=2,f=0,p=-2,m=1,v=852,x=592;function g(M){return(M>>>24&255)+(M>>>8&65280)+((65280&M)<<8)+((255&M)<<24)}function w(){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 _(M){var R;return M&&M.state?(R=M.state,M.total_in=M.total_out=R.total=0,M.msg="",R.wrap&&(M.adler=1&R.wrap),R.mode=m,R.last=0,R.havedict=0,R.dmax=32768,R.head=null,R.hold=0,R.bits=0,R.lencode=R.lendyn=new i.Buf32(v),R.distcode=R.distdyn=new i.Buf32(x),R.sane=1,R.back=-1,f):p}function j(M){var R;return M&&M.state?((R=M.state).wsize=0,R.whave=0,R.wnext=0,_(M)):p}function N(M,R){var A,I;return M&&M.state?(I=M.state,R<0?(A=0,R=-R):(A=1+(R>>4),R<48&&(R&=15)),R&&(R<8||15<R)?p:(I.window!==null&&I.wbits!==R&&(I.window=null),I.wrap=A,I.wbits=R,j(M))):p}function S(M,R){var A,I;return M?(I=new w,(M.state=I).window=null,(A=N(M,R))!==f&&(M.state=null),A):p}var C,k,E=!0;function P(M){if(E){var R;for(C=new i.Buf32(512),k=new i.Buf32(32),R=0;R<144;)M.lens[R++]=8;for(;R<256;)M.lens[R++]=9;for(;R<280;)M.lens[R++]=7;for(;R<288;)M.lens[R++]=8;for(u(d,M.lens,0,288,C,0,M.work,{bits:9}),R=0;R<32;)M.lens[R++]=5;u(h,M.lens,0,32,k,0,M.work,{bits:5}),E=!1}M.lencode=C,M.lenbits=9,M.distcode=k,M.distbits=5}function T(M,R,A,I){var D,O=M.state;return O.window===null&&(O.wsize=1<<O.wbits,O.wnext=0,O.whave=0,O.window=new i.Buf8(O.wsize)),I>=O.wsize?(i.arraySet(O.window,R,A-O.wsize,O.wsize,0),O.wnext=0,O.whave=O.wsize):(I<(D=O.wsize-O.wnext)&&(D=I),i.arraySet(O.window,R,A-I,D,O.wnext),(I-=D)?(i.arraySet(O.window,R,A-I,I,0),O.wnext=I,O.whave=O.wsize):(O.wnext+=D,O.wnext===O.wsize&&(O.wnext=0),O.whave<O.wsize&&(O.whave+=D))),0}s.inflateReset=j,s.inflateReset2=N,s.inflateResetKeep=_,s.inflateInit=function(M){return S(M,15)},s.inflateInit2=S,s.inflate=function(M,R){var A,I,D,O,z,B,G,U,F,W,Q,K,fe,oe,ye,le,me,he,ae,re,L,X,ne,Y,J=0,se=new i.Buf8(4),ge=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!M||!M.state||!M.output||!M.input&&M.avail_in!==0)return p;(A=M.state).mode===12&&(A.mode=13),z=M.next_out,D=M.output,G=M.avail_out,O=M.next_in,I=M.input,B=M.avail_in,U=A.hold,F=A.bits,W=B,Q=G,X=f;e:for(;;)switch(A.mode){case m:if(A.wrap===0){A.mode=13;break}for(;F<16;){if(B===0)break e;B--,U+=I[O++]<<F,F+=8}if(2&A.wrap&&U===35615){se[A.check=0]=255&U,se[1]=U>>>8&255,A.check=l(A.check,se,2,0),F=U=0,A.mode=2;break}if(A.flags=0,A.head&&(A.head.done=!1),!(1&A.wrap)||(((255&U)<<8)+(U>>8))%31){M.msg="incorrect header check",A.mode=30;break}if((15&U)!=8){M.msg="unknown compression method",A.mode=30;break}if(F-=4,L=8+(15&(U>>>=4)),A.wbits===0)A.wbits=L;else if(L>A.wbits){M.msg="invalid window size",A.mode=30;break}A.dmax=1<<L,M.adler=A.check=1,A.mode=512&U?10:12,F=U=0;break;case 2:for(;F<16;){if(B===0)break e;B--,U+=I[O++]<<F,F+=8}if(A.flags=U,(255&A.flags)!=8){M.msg="unknown compression method",A.mode=30;break}if(57344&A.flags){M.msg="unknown header flags set",A.mode=30;break}A.head&&(A.head.text=U>>8&1),512&A.flags&&(se[0]=255&U,se[1]=U>>>8&255,A.check=l(A.check,se,2,0)),F=U=0,A.mode=3;case 3:for(;F<32;){if(B===0)break e;B--,U+=I[O++]<<F,F+=8}A.head&&(A.head.time=U),512&A.flags&&(se[0]=255&U,se[1]=U>>>8&255,se[2]=U>>>16&255,se[3]=U>>>24&255,A.check=l(A.check,se,4,0)),F=U=0,A.mode=4;case 4:for(;F<16;){if(B===0)break e;B--,U+=I[O++]<<F,F+=8}A.head&&(A.head.xflags=255&U,A.head.os=U>>8),512&A.flags&&(se[0]=255&U,se[1]=U>>>8&255,A.check=l(A.check,se,2,0)),F=U=0,A.mode=5;case 5:if(1024&A.flags){for(;F<16;){if(B===0)break e;B--,U+=I[O++]<<F,F+=8}A.length=U,A.head&&(A.head.extra_len=U),512&A.flags&&(se[0]=255&U,se[1]=U>>>8&255,A.check=l(A.check,se,2,0)),F=U=0}else A.head&&(A.head.extra=null);A.mode=6;case 6:if(1024&A.flags&&(B<(K=A.length)&&(K=B),K&&(A.head&&(L=A.head.extra_len-A.length,A.head.extra||(A.head.extra=new Array(A.head.extra_len)),i.arraySet(A.head.extra,I,O,K,L)),512&A.flags&&(A.check=l(A.check,I,K,O)),B-=K,O+=K,A.length-=K),A.length))break e;A.length=0,A.mode=7;case 7:if(2048&A.flags){if(B===0)break e;for(K=0;L=I[O+K++],A.head&&L&&A.length<65536&&(A.head.name+=String.fromCharCode(L)),L&&K<B;);if(512&A.flags&&(A.check=l(A.check,I,K,O)),B-=K,O+=K,L)break e}else A.head&&(A.head.name=null);A.length=0,A.mode=8;case 8:if(4096&A.flags){if(B===0)break e;for(K=0;L=I[O+K++],A.head&&L&&A.length<65536&&(A.head.comment+=String.fromCharCode(L)),L&&K<B;);if(512&A.flags&&(A.check=l(A.check,I,K,O)),B-=K,O+=K,L)break e}else A.head&&(A.head.comment=null);A.mode=9;case 9:if(512&A.flags){for(;F<16;){if(B===0)break e;B--,U+=I[O++]<<F,F+=8}if(U!==(65535&A.check)){M.msg="header crc mismatch",A.mode=30;break}F=U=0}A.head&&(A.head.hcrc=A.flags>>9&1,A.head.done=!0),M.adler=A.check=0,A.mode=12;break;case 10:for(;F<32;){if(B===0)break e;B--,U+=I[O++]<<F,F+=8}M.adler=A.check=g(U),F=U=0,A.mode=11;case 11:if(A.havedict===0)return M.next_out=z,M.avail_out=G,M.next_in=O,M.avail_in=B,A.hold=U,A.bits=F,2;M.adler=A.check=1,A.mode=12;case 12:if(R===5||R===6)break e;case 13:if(A.last){U>>>=7&F,F-=7&F,A.mode=27;break}for(;F<3;){if(B===0)break e;B--,U+=I[O++]<<F,F+=8}switch(A.last=1&U,F-=1,3&(U>>>=1)){case 0:A.mode=14;break;case 1:if(P(A),A.mode=20,R!==6)break;U>>>=2,F-=2;break e;case 2:A.mode=17;break;case 3:M.msg="invalid block type",A.mode=30}U>>>=2,F-=2;break;case 14:for(U>>>=7&F,F-=7&F;F<32;){if(B===0)break e;B--,U+=I[O++]<<F,F+=8}if((65535&U)!=(U>>>16^65535)){M.msg="invalid stored block lengths",A.mode=30;break}if(A.length=65535&U,F=U=0,A.mode=15,R===6)break e;case 15:A.mode=16;case 16:if(K=A.length){if(B<K&&(K=B),G<K&&(K=G),K===0)break e;i.arraySet(D,I,O,K,z),B-=K,O+=K,G-=K,z+=K,A.length-=K;break}A.mode=12;break;case 17:for(;F<14;){if(B===0)break e;B--,U+=I[O++]<<F,F+=8}if(A.nlen=257+(31&U),U>>>=5,F-=5,A.ndist=1+(31&U),U>>>=5,F-=5,A.ncode=4+(15&U),U>>>=4,F-=4,286<A.nlen||30<A.ndist){M.msg="too many length or distance symbols",A.mode=30;break}A.have=0,A.mode=18;case 18:for(;A.have<A.ncode;){for(;F<3;){if(B===0)break e;B--,U+=I[O++]<<F,F+=8}A.lens[ge[A.have++]]=7&U,U>>>=3,F-=3}for(;A.have<19;)A.lens[ge[A.have++]]=0;if(A.lencode=A.lendyn,A.lenbits=7,ne={bits:A.lenbits},X=u(0,A.lens,0,19,A.lencode,0,A.work,ne),A.lenbits=ne.bits,X){M.msg="invalid code lengths set",A.mode=30;break}A.have=0,A.mode=19;case 19:for(;A.have<A.nlen+A.ndist;){for(;le=(J=A.lencode[U&(1<<A.lenbits)-1])>>>16&255,me=65535&J,!((ye=J>>>24)<=F);){if(B===0)break e;B--,U+=I[O++]<<F,F+=8}if(me<16)U>>>=ye,F-=ye,A.lens[A.have++]=me;else{if(me===16){for(Y=ye+2;F<Y;){if(B===0)break e;B--,U+=I[O++]<<F,F+=8}if(U>>>=ye,F-=ye,A.have===0){M.msg="invalid bit length repeat",A.mode=30;break}L=A.lens[A.have-1],K=3+(3&U),U>>>=2,F-=2}else if(me===17){for(Y=ye+3;F<Y;){if(B===0)break e;B--,U+=I[O++]<<F,F+=8}F-=ye,L=0,K=3+(7&(U>>>=ye)),U>>>=3,F-=3}else{for(Y=ye+7;F<Y;){if(B===0)break e;B--,U+=I[O++]<<F,F+=8}F-=ye,L=0,K=11+(127&(U>>>=ye)),U>>>=7,F-=7}if(A.have+K>A.nlen+A.ndist){M.msg="invalid bit length repeat",A.mode=30;break}for(;K--;)A.lens[A.have++]=L}}if(A.mode===30)break;if(A.lens[256]===0){M.msg="invalid code -- missing end-of-block",A.mode=30;break}if(A.lenbits=9,ne={bits:A.lenbits},X=u(d,A.lens,0,A.nlen,A.lencode,0,A.work,ne),A.lenbits=ne.bits,X){M.msg="invalid literal/lengths set",A.mode=30;break}if(A.distbits=6,A.distcode=A.distdyn,ne={bits:A.distbits},X=u(h,A.lens,A.nlen,A.ndist,A.distcode,0,A.work,ne),A.distbits=ne.bits,X){M.msg="invalid distances set",A.mode=30;break}if(A.mode=20,R===6)break e;case 20:A.mode=21;case 21:if(6<=B&&258<=G){M.next_out=z,M.avail_out=G,M.next_in=O,M.avail_in=B,A.hold=U,A.bits=F,c(M,Q),z=M.next_out,D=M.output,G=M.avail_out,O=M.next_in,I=M.input,B=M.avail_in,U=A.hold,F=A.bits,A.mode===12&&(A.back=-1);break}for(A.back=0;le=(J=A.lencode[U&(1<<A.lenbits)-1])>>>16&255,me=65535&J,!((ye=J>>>24)<=F);){if(B===0)break e;B--,U+=I[O++]<<F,F+=8}if(le&&!(240&le)){for(he=ye,ae=le,re=me;le=(J=A.lencode[re+((U&(1<<he+ae)-1)>>he)])>>>16&255,me=65535&J,!(he+(ye=J>>>24)<=F);){if(B===0)break e;B--,U+=I[O++]<<F,F+=8}U>>>=he,F-=he,A.back+=he}if(U>>>=ye,F-=ye,A.back+=ye,A.length=me,le===0){A.mode=26;break}if(32&le){A.back=-1,A.mode=12;break}if(64&le){M.msg="invalid literal/length code",A.mode=30;break}A.extra=15&le,A.mode=22;case 22:if(A.extra){for(Y=A.extra;F<Y;){if(B===0)break e;B--,U+=I[O++]<<F,F+=8}A.length+=U&(1<<A.extra)-1,U>>>=A.extra,F-=A.extra,A.back+=A.extra}A.was=A.length,A.mode=23;case 23:for(;le=(J=A.distcode[U&(1<<A.distbits)-1])>>>16&255,me=65535&J,!((ye=J>>>24)<=F);){if(B===0)break e;B--,U+=I[O++]<<F,F+=8}if(!(240&le)){for(he=ye,ae=le,re=me;le=(J=A.distcode[re+((U&(1<<he+ae)-1)>>he)])>>>16&255,me=65535&J,!(he+(ye=J>>>24)<=F);){if(B===0)break e;B--,U+=I[O++]<<F,F+=8}U>>>=he,F-=he,A.back+=he}if(U>>>=ye,F-=ye,A.back+=ye,64&le){M.msg="invalid distance code",A.mode=30;break}A.offset=me,A.extra=15&le,A.mode=24;case 24:if(A.extra){for(Y=A.extra;F<Y;){if(B===0)break e;B--,U+=I[O++]<<F,F+=8}A.offset+=U&(1<<A.extra)-1,U>>>=A.extra,F-=A.extra,A.back+=A.extra}if(A.offset>A.dmax){M.msg="invalid distance too far back",A.mode=30;break}A.mode=25;case 25:if(G===0)break e;if(K=Q-G,A.offset>K){if((K=A.offset-K)>A.whave&&A.sane){M.msg="invalid distance too far back",A.mode=30;break}fe=K>A.wnext?(K-=A.wnext,A.wsize-K):A.wnext-K,K>A.length&&(K=A.length),oe=A.window}else oe=D,fe=z-A.offset,K=A.length;for(G<K&&(K=G),G-=K,A.length-=K;D[z++]=oe[fe++],--K;);A.length===0&&(A.mode=21);break;case 26:if(G===0)break e;D[z++]=A.length,G--,A.mode=21;break;case 27:if(A.wrap){for(;F<32;){if(B===0)break e;B--,U|=I[O++]<<F,F+=8}if(Q-=G,M.total_out+=Q,A.total+=Q,Q&&(M.adler=A.check=A.flags?l(A.check,D,Q,z-Q):o(A.check,D,Q,z-Q)),Q=G,(A.flags?U:g(U))!==A.check){M.msg="incorrect data check",A.mode=30;break}F=U=0}A.mode=28;case 28:if(A.wrap&&A.flags){for(;F<32;){if(B===0)break e;B--,U+=I[O++]<<F,F+=8}if(U!==(4294967295&A.total)){M.msg="incorrect length check",A.mode=30;break}F=U=0}A.mode=29;case 29:X=1;break e;case 30:X=-3;break e;case 31:return-4;case 32:default:return p}return M.next_out=z,M.avail_out=G,M.next_in=O,M.avail_in=B,A.hold=U,A.bits=F,(A.wsize||Q!==M.avail_out&&A.mode<30&&(A.mode<27||R!==4))&&T(M,M.output,M.next_out,Q-M.avail_out)?(A.mode=31,-4):(W-=M.avail_in,Q-=M.avail_out,M.total_in+=W,M.total_out+=Q,A.total+=Q,A.wrap&&Q&&(M.adler=A.check=A.flags?l(A.check,D,Q,M.next_out-Q):o(A.check,D,Q,M.next_out-Q)),M.data_type=A.bits+(A.last?64:0)+(A.mode===12?128:0)+(A.mode===20||A.mode===15?256:0),(W==0&&Q===0||R===4)&&X===f&&(X=-5),X)},s.inflateEnd=function(M){if(!M||!M.state)return p;var R=M.state;return R.window&&(R.window=null),M.state=null,f},s.inflateGetHeader=function(M,R){var A;return M&&M.state&&2&(A=M.state).wrap?((A.head=R).done=!1,f):p},s.inflateSetDictionary=function(M,R){var A,I=R.length;return M&&M.state?(A=M.state).wrap!==0&&A.mode!==11?p:A.mode===11&&o(1,R,I,0)!==A.check?-3:T(M,R,I,I)?(A.mode=31,-4):(A.havedict=1,f):p},s.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(n,r,s){var i=n("../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];r.exports=function(d,h,f,p,m,v,x,g){var w,_,j,N,S,C,k,E,P,T=g.bits,M=0,R=0,A=0,I=0,D=0,O=0,z=0,B=0,G=0,U=0,F=null,W=0,Q=new i.Buf16(16),K=new i.Buf16(16),fe=null,oe=0;for(M=0;M<=15;M++)Q[M]=0;for(R=0;R<p;R++)Q[h[f+R]]++;for(D=T,I=15;1<=I&&Q[I]===0;I--);if(I<D&&(D=I),I===0)return m[v++]=20971520,m[v++]=20971520,g.bits=1,0;for(A=1;A<I&&Q[A]===0;A++);for(D<A&&(D=A),M=B=1;M<=15;M++)if(B<<=1,(B-=Q[M])<0)return-1;if(0<B&&(d===0||I!==1))return-1;for(K[1]=0,M=1;M<15;M++)K[M+1]=K[M]+Q[M];for(R=0;R<p;R++)h[f+R]!==0&&(x[K[h[f+R]]++]=R);if(C=d===0?(F=fe=x,19):d===1?(F=o,W-=257,fe=l,oe-=257,256):(F=c,fe=u,-1),M=A,S=v,z=R=U=0,j=-1,N=(G=1<<(O=D))-1,d===1&&852<G||d===2&&592<G)return 1;for(;;){for(k=M-z,P=x[R]<C?(E=0,x[R]):x[R]>C?(E=fe[oe+x[R]],F[W+x[R]]):(E=96,0),w=1<<M-z,A=_=1<<O;m[S+(U>>z)+(_-=w)]=k<<24|E<<16|P|0,_!==0;);for(w=1<<M-1;U&w;)w>>=1;if(w!==0?(U&=w-1,U+=w):U=0,R++,--Q[M]==0){if(M===I)break;M=h[f+x[R]]}if(D<M&&(U&N)!==j){for(z===0&&(z=D),S+=A,B=1<<(O=M-z);O+z<I&&!((B-=Q[O+z])<=0);)O++,B<<=1;if(G+=1<<O,d===1&&852<G||d===2&&592<G)return 1;m[j=U&N]=D<<24|O<<16|S-v|0}}return U!==0&&(m[S+U]=M-z<<24|64<<16|0),g.bits=D,0}},{"../utils/common":41}],51:[function(n,r,s){r.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(n,r,s){var i=n("../utils/common"),o=0,l=1;function c(J){for(var se=J.length;0<=--se;)J[se]=0}var u=0,d=29,h=256,f=h+1+d,p=30,m=19,v=2*f+1,x=15,g=16,w=7,_=256,j=16,N=17,S=18,C=[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],k=[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],E=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],P=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],T=new Array(2*(f+2));c(T);var M=new Array(2*p);c(M);var R=new Array(512);c(R);var A=new Array(256);c(A);var I=new Array(d);c(I);var D,O,z,B=new Array(p);function G(J,se,ge,de,ce){this.static_tree=J,this.extra_bits=se,this.extra_base=ge,this.elems=de,this.max_length=ce,this.has_stree=J&&J.length}function U(J,se){this.dyn_tree=J,this.max_code=0,this.stat_desc=se}function F(J){return J<256?R[J]:R[256+(J>>>7)]}function W(J,se){J.pending_buf[J.pending++]=255&se,J.pending_buf[J.pending++]=se>>>8&255}function Q(J,se,ge){J.bi_valid>g-ge?(J.bi_buf|=se<<J.bi_valid&65535,W(J,J.bi_buf),J.bi_buf=se>>g-J.bi_valid,J.bi_valid+=ge-g):(J.bi_buf|=se<<J.bi_valid&65535,J.bi_valid+=ge)}function K(J,se,ge){Q(J,ge[2*se],ge[2*se+1])}function fe(J,se){for(var ge=0;ge|=1&J,J>>>=1,ge<<=1,0<--se;);return ge>>>1}function oe(J,se,ge){var de,ce,xe=new Array(x+1),je=0;for(de=1;de<=x;de++)xe[de]=je=je+ge[de-1]<<1;for(ce=0;ce<=se;ce++){var be=J[2*ce+1];be!==0&&(J[2*ce]=fe(xe[be]++,be))}}function ye(J){var se;for(se=0;se<f;se++)J.dyn_ltree[2*se]=0;for(se=0;se<p;se++)J.dyn_dtree[2*se]=0;for(se=0;se<m;se++)J.bl_tree[2*se]=0;J.dyn_ltree[2*_]=1,J.opt_len=J.static_len=0,J.last_lit=J.matches=0}function le(J){8<J.bi_valid?W(J,J.bi_buf):0<J.bi_valid&&(J.pending_buf[J.pending++]=J.bi_buf),J.bi_buf=0,J.bi_valid=0}function me(J,se,ge,de){var ce=2*se,xe=2*ge;return J[ce]<J[xe]||J[ce]===J[xe]&&de[se]<=de[ge]}function he(J,se,ge){for(var de=J.heap[ge],ce=ge<<1;ce<=J.heap_len&&(ce<J.heap_len&&me(se,J.heap[ce+1],J.heap[ce],J.depth)&&ce++,!me(se,de,J.heap[ce],J.depth));)J.heap[ge]=J.heap[ce],ge=ce,ce<<=1;J.heap[ge]=de}function ae(J,se,ge){var de,ce,xe,je,be=0;if(J.last_lit!==0)for(;de=J.pending_buf[J.d_buf+2*be]<<8|J.pending_buf[J.d_buf+2*be+1],ce=J.pending_buf[J.l_buf+be],be++,de===0?K(J,ce,se):(K(J,(xe=A[ce])+h+1,se),(je=C[xe])!==0&&Q(J,ce-=I[xe],je),K(J,xe=F(--de),ge),(je=k[xe])!==0&&Q(J,de-=B[xe],je)),be<J.last_lit;);K(J,_,se)}function re(J,se){var ge,de,ce,xe=se.dyn_tree,je=se.stat_desc.static_tree,be=se.stat_desc.has_stree,Ee=se.stat_desc.elems,Me=-1;for(J.heap_len=0,J.heap_max=v,ge=0;ge<Ee;ge++)xe[2*ge]!==0?(J.heap[++J.heap_len]=Me=ge,J.depth[ge]=0):xe[2*ge+1]=0;for(;J.heap_len<2;)xe[2*(ce=J.heap[++J.heap_len]=Me<2?++Me:0)]=1,J.depth[ce]=0,J.opt_len--,be&&(J.static_len-=je[2*ce+1]);for(se.max_code=Me,ge=J.heap_len>>1;1<=ge;ge--)he(J,xe,ge);for(ce=Ee;ge=J.heap[1],J.heap[1]=J.heap[J.heap_len--],he(J,xe,1),de=J.heap[1],J.heap[--J.heap_max]=ge,J.heap[--J.heap_max]=de,xe[2*ce]=xe[2*ge]+xe[2*de],J.depth[ce]=(J.depth[ge]>=J.depth[de]?J.depth[ge]:J.depth[de])+1,xe[2*ge+1]=xe[2*de+1]=ce,J.heap[1]=ce++,he(J,xe,1),2<=J.heap_len;);J.heap[--J.heap_max]=J.heap[1],function(Oe,st){var Ye,gt,At,yt,Qt,nr,wn=st.dyn_tree,Si=st.max_code,it=st.stat_desc.static_tree,pe=st.stat_desc.has_stree,Pe=st.stat_desc.extra_bits,Ze=st.stat_desc.extra_base,qe=st.stat_desc.max_length,Ve=0;for(yt=0;yt<=x;yt++)Oe.bl_count[yt]=0;for(wn[2*Oe.heap[Oe.heap_max]+1]=0,Ye=Oe.heap_max+1;Ye<v;Ye++)qe<(yt=wn[2*wn[2*(gt=Oe.heap[Ye])+1]+1]+1)&&(yt=qe,Ve++),wn[2*gt+1]=yt,Si<gt||(Oe.bl_count[yt]++,Qt=0,Ze<=gt&&(Qt=Pe[gt-Ze]),nr=wn[2*gt],Oe.opt_len+=nr*(yt+Qt),pe&&(Oe.static_len+=nr*(it[2*gt+1]+Qt)));if(Ve!==0){do{for(yt=qe-1;Oe.bl_count[yt]===0;)yt--;Oe.bl_count[yt]--,Oe.bl_count[yt+1]+=2,Oe.bl_count[qe]--,Ve-=2}while(0<Ve);for(yt=qe;yt!==0;yt--)for(gt=Oe.bl_count[yt];gt!==0;)Si<(At=Oe.heap[--Ye])||(wn[2*At+1]!==yt&&(Oe.opt_len+=(yt-wn[2*At+1])*wn[2*At],wn[2*At+1]=yt),gt--)}}(J,se),oe(xe,Me,J.bl_count)}function L(J,se,ge){var de,ce,xe=-1,je=se[1],be=0,Ee=7,Me=4;for(je===0&&(Ee=138,Me=3),se[2*(ge+1)+1]=65535,de=0;de<=ge;de++)ce=je,je=se[2*(de+1)+1],++be<Ee&&ce===je||(be<Me?J.bl_tree[2*ce]+=be:ce!==0?(ce!==xe&&J.bl_tree[2*ce]++,J.bl_tree[2*j]++):be<=10?J.bl_tree[2*N]++:J.bl_tree[2*S]++,xe=ce,Me=(be=0)===je?(Ee=138,3):ce===je?(Ee=6,3):(Ee=7,4))}function X(J,se,ge){var de,ce,xe=-1,je=se[1],be=0,Ee=7,Me=4;for(je===0&&(Ee=138,Me=3),de=0;de<=ge;de++)if(ce=je,je=se[2*(de+1)+1],!(++be<Ee&&ce===je)){if(be<Me)for(;K(J,ce,J.bl_tree),--be!=0;);else ce!==0?(ce!==xe&&(K(J,ce,J.bl_tree),be--),K(J,j,J.bl_tree),Q(J,be-3,2)):be<=10?(K(J,N,J.bl_tree),Q(J,be-3,3)):(K(J,S,J.bl_tree),Q(J,be-11,7));xe=ce,Me=(be=0)===je?(Ee=138,3):ce===je?(Ee=6,3):(Ee=7,4)}}c(B);var ne=!1;function Y(J,se,ge,de){Q(J,(u<<1)+(de?1:0),3),function(ce,xe,je,be){le(ce),W(ce,je),W(ce,~je),i.arraySet(ce.pending_buf,ce.window,xe,je,ce.pending),ce.pending+=je}(J,se,ge)}s._tr_init=function(J){ne||(function(){var se,ge,de,ce,xe,je=new Array(x+1);for(ce=de=0;ce<d-1;ce++)for(I[ce]=de,se=0;se<1<<C[ce];se++)A[de++]=ce;for(A[de-1]=ce,ce=xe=0;ce<16;ce++)for(B[ce]=xe,se=0;se<1<<k[ce];se++)R[xe++]=ce;for(xe>>=7;ce<p;ce++)for(B[ce]=xe<<7,se=0;se<1<<k[ce]-7;se++)R[256+xe++]=ce;for(ge=0;ge<=x;ge++)je[ge]=0;for(se=0;se<=143;)T[2*se+1]=8,se++,je[8]++;for(;se<=255;)T[2*se+1]=9,se++,je[9]++;for(;se<=279;)T[2*se+1]=7,se++,je[7]++;for(;se<=287;)T[2*se+1]=8,se++,je[8]++;for(oe(T,f+1,je),se=0;se<p;se++)M[2*se+1]=5,M[2*se]=fe(se,5);D=new G(T,C,h+1,f,x),O=new G(M,k,0,p,x),z=new G(new Array(0),E,0,m,w)}(),ne=!0),J.l_desc=new U(J.dyn_ltree,D),J.d_desc=new U(J.dyn_dtree,O),J.bl_desc=new U(J.bl_tree,z),J.bi_buf=0,J.bi_valid=0,ye(J)},s._tr_stored_block=Y,s._tr_flush_block=function(J,se,ge,de){var ce,xe,je=0;0<J.level?(J.strm.data_type===2&&(J.strm.data_type=function(be){var Ee,Me=4093624447;for(Ee=0;Ee<=31;Ee++,Me>>>=1)if(1&Me&&be.dyn_ltree[2*Ee]!==0)return o;if(be.dyn_ltree[18]!==0||be.dyn_ltree[20]!==0||be.dyn_ltree[26]!==0)return l;for(Ee=32;Ee<h;Ee++)if(be.dyn_ltree[2*Ee]!==0)return l;return o}(J)),re(J,J.l_desc),re(J,J.d_desc),je=function(be){var Ee;for(L(be,be.dyn_ltree,be.l_desc.max_code),L(be,be.dyn_dtree,be.d_desc.max_code),re(be,be.bl_desc),Ee=m-1;3<=Ee&&be.bl_tree[2*P[Ee]+1]===0;Ee--);return be.opt_len+=3*(Ee+1)+5+5+4,Ee}(J),ce=J.opt_len+3+7>>>3,(xe=J.static_len+3+7>>>3)<=ce&&(ce=xe)):ce=xe=ge+5,ge+4<=ce&&se!==-1?Y(J,se,ge,de):J.strategy===4||xe===ce?(Q(J,2+(de?1:0),3),ae(J,T,M)):(Q(J,4+(de?1:0),3),function(be,Ee,Me,Oe){var st;for(Q(be,Ee-257,5),Q(be,Me-1,5),Q(be,Oe-4,4),st=0;st<Oe;st++)Q(be,be.bl_tree[2*P[st]+1],3);X(be,be.dyn_ltree,Ee-1),X(be,be.dyn_dtree,Me-1)}(J,J.l_desc.max_code+1,J.d_desc.max_code+1,je+1),ae(J,J.dyn_ltree,J.dyn_dtree)),ye(J),de&&le(J)},s._tr_tally=function(J,se,ge){return J.pending_buf[J.d_buf+2*J.last_lit]=se>>>8&255,J.pending_buf[J.d_buf+2*J.last_lit+1]=255&se,J.pending_buf[J.l_buf+J.last_lit]=255&ge,J.last_lit++,se===0?J.dyn_ltree[2*ge]++:(J.matches++,se--,J.dyn_ltree[2*(A[ge]+h+1)]++,J.dyn_dtree[2*F(se)]++),J.last_lit===J.lit_bufsize-1},s._tr_align=function(J){Q(J,2,3),K(J,_,T),function(se){se.bi_valid===16?(W(se,se.bi_buf),se.bi_buf=0,se.bi_valid=0):8<=se.bi_valid&&(se.pending_buf[se.pending++]=255&se.bi_buf,se.bi_buf>>=8,se.bi_valid-=8)}(J)}},{"../utils/common":41}],53:[function(n,r,s){r.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(n,r,s){(function(i){(function(o,l){if(!o.setImmediate){var c,u,d,h,f=1,p={},m=!1,v=o.document,x=Object.getPrototypeOf&&Object.getPrototypeOf(o);x=x&&x.setTimeout?x:o,c={}.toString.call(o.process)==="[object process]"?function(j){process.nextTick(function(){w(j)})}:function(){if(o.postMessage&&!o.importScripts){var j=!0,N=o.onmessage;return o.onmessage=function(){j=!1},o.postMessage("","*"),o.onmessage=N,j}}()?(h="setImmediate$"+Math.random()+"$",o.addEventListener?o.addEventListener("message",_,!1):o.attachEvent("onmessage",_),function(j){o.postMessage(h+j,"*")}):o.MessageChannel?((d=new MessageChannel).port1.onmessage=function(j){w(j.data)},function(j){d.port2.postMessage(j)}):v&&"onreadystatechange"in v.createElement("script")?(u=v.documentElement,function(j){var N=v.createElement("script");N.onreadystatechange=function(){w(j),N.onreadystatechange=null,u.removeChild(N),N=null},u.appendChild(N)}):function(j){setTimeout(w,0,j)},x.setImmediate=function(j){typeof j!="function"&&(j=new Function(""+j));for(var N=new Array(arguments.length-1),S=0;S<N.length;S++)N[S]=arguments[S+1];var C={callback:j,args:N};return p[f]=C,c(f),f++},x.clearImmediate=g}function g(j){delete p[j]}function w(j){if(m)setTimeout(w,0,j);else{var N=p[j];if(N){m=!0;try{(function(S){var C=S.callback,k=S.args;switch(k.length){case 0:C();break;case 1:C(k[0]);break;case 2:C(k[0],k[1]);break;case 3:C(k[0],k[1],k[2]);break;default:C.apply(l,k)}})(N)}finally{g(j),m=!1}}}}
1249function _(j){j.source===o&&typeof j.data=="string"&&j.data.indexOf(h)===0&&w(+j.data.slice(h.length))}})(typeof self>"u"?i===void 0?this:i:self)}).call(this,typeof YS<"u"?YS:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})($Ce);var Agt=$Ce.exports;const Egt=cp(Agt),Az=[{key:"instagram",label:"ð· Instagram",max:10},{key:"facebook",label:"ð¥ Facebook",max:10},{key:"linkedin",label:"ð¼ LinkedIn",max:9}];function zCe(t){return new Intl.DateTimeFormat("sv-SE",{timeZone:"Europe/Madrid",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1}).format(t).replace(" ","T")}function Ez(t){const e=new Date,n=new Date(e.getTime()+24*3600*1e3);return`${zCe(n).slice(0,10)}T${String(t).padStart(2,"0")}:00`}function Tgt(t){var o;const e=new Date(`${t}:00Z`),n=((o=new Intl.DateTimeFormat("en-US",{timeZone:"Europe/Madrid",timeZoneName:"longOffset"}).formatToParts(e).find(l=>l.type==="timeZoneName"))==null?void 0:o.value)||"GMT+00:00",r=n.includes("-")?"-":"+",[s="0",i="0"]=n.replace(/GMT[+-]?/,"").split(":");return new Date(`${t}:00${r}${s.padStart(2,"0")}:${i.padStart(2,"0")}`).toISOString()}function Pgt(t){return new Intl.DateTimeFormat("fr-FR",{timeZone:"Europe/Madrid",day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"}).format(new Date(t))}function BCe({captions:t,slug:e,postType:n,getImages:r}){const[s,i]=b.useState([]),[o,l]=b.useState(!0),[c,u]=b.useState([]),[d,h]=b.useState(()=>Ez(10)),[f,p]=b.useState(!1),[m,v]=b.useState([]),[x,g]=b.useState(t);b.useEffect(()=>{g(t)},[t.instagram,t.facebook,t.linkedin]);const w=b.useMemo(()=>zCe(new Date),[]),[_,j]=b.useState(null),N=async()=>{l(!0),j(null);try{const{data:P,error:T}=await Z.functions.invoke("init-buffer-channels",{body:{}});if(T)throw T;const M=P==null?void 0:P.error;if(M)throw new Error(M);const R=(P==null?void 0:P.channels)||[],A=R.map(D=>{const O=Az.find(z=>(D.service||"").toLowerCase().includes(z.key));return O?{id:D.id,name:D.name,network:O.key}:null}).filter(D=>!!D);i(A);const I=A.find(D=>D.network==="instagram");u(I?[I.id]:A[0]?[A[0].id]:[]),!A.length&&R.length?j(`Aucune chaîne Instagram/Facebook/LinkedIn parmi les ${R.length} chaîne(s) Buffer.`):R.length||j("Buffer n'a renvoyé aucune chaîne pour cette organisation.")}catch(P){const T=P.message;j(T),ee.error(`Chaînes Buffer indisponibles : ${T}`)}finally{l(!1)}};b.useEffect(()=>{N()},[]);const S=s.filter(P=>c.includes(P.id)),C=Array.from(new Set(S.map(P=>P.network))),k=P=>u(T=>T.includes(P)?T.filter(M=>M!==P):[...T,P]),E=async()=>{if(!S.length)return ee.error("Sélectionnez au moins une page");if(!d)return ee.error("Choisissez une date de publication");p(!0),v([]);const P=ee.loading("Upload de l'image⦠Planification sur Bufferâ¦");try{const T=await r();if(!T.length)throw new Error("Aucune image à publier");const{data:M,error:R}=await Z.functions.invoke("schedule-to-buffer",{body:{post_type:n,slug:e||void 0,image_base64:n==="single"?T[0]:void 0,slides_base64:n==="carousel"?T:void 0,caption_instagram:x.instagram,caption_facebook:x.facebook,caption_linkedin:x.linkedin,networks:C,targets:S.map(D=>({network:D.network,channel_id:D.id,channel_name:D.name})),scheduled_at:Tgt(d)}});if(R)throw R;const A=M;if(A.error)throw new Error(A.error);v(A.posts||[]),(A.warnings||[]).forEach(D=>ee.warning(D));const I=(A.posts||[]).filter(D=>D.status!=="error").length;ee.success(`${I} publication(s) planifiée(s) sur Buffer`,{id:P})}catch(T){ee.error(`Planification impossible : ${T.message}`,{id:P})}finally{p(!1)}};return a.jsxs("div",{className:"space-y-4 rounded-lg border border-border p-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(q6,{className:"h-4 w-4 text-muted-foreground"}),a.jsx(te,{className:"text-base",children:"Planifier sur Buffer"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{className:"text-xs text-muted-foreground",children:"Pages / comptes à publier"}),o?a.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[a.jsx(Je,{className:"h-4 w-4 animate-spin"})," Chargement des chaînes Bufferâ¦"]}):s.length===0?a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:_||"Aucune chaîne Buffer connectée."}),a.jsx(H,{type:"button",size:"sm",variant:"outline",onClick:N,children:"Réessayer"})]}):Az.map(P=>{const T=s.filter(M=>M.network===P.key);return T.length?a.jsxs("div",{className:"space-y-1",children:[a.jsx("span",{className:"text-sm font-medium",children:P.label}),a.jsx("div",{className:"flex flex-col gap-1 pl-1",children:T.map(M=>a.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[a.jsx(wr,{checked:c.includes(M.id),onCheckedChange:()=>k(M.id)}),M.name]},M.id))})]},P.key):null})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-xs text-muted-foreground",children:"Date et heure (Europe/Madrid)"}),a.jsx(ue,{type:"datetime-local",value:d,min:w,onChange:P=>h(P.target.value)}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(H,{type:"button",size:"sm",variant:"outline",onClick:()=>h(Ez(10)),children:"Demain 10h"}),a.jsx(H,{type:"button",size:"sm",variant:"outline",onClick:()=>h(Ez(18)),children:"Demain 18h"})]})]}),C.map(P=>{const T=Az.find(M=>M.key===P);return a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{className:"text-xs text-muted-foreground",children:T.label}),a.jsx(fn,{value:x[P],onChange:M=>g(R=>({...R,[P]:M.target.value})),rows:4,className:"text-xs"}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[x[P].length," caractères"]})]},P)}),a.jsxs(H,{onClick:E,disabled:f,className:"w-full",children:[f?a.jsx(Je,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(q6,{className:"mr-2 h-4 w-4"}),"Planifier sur Buffer"]}),m.length>0&&a.jsxs("div",{className:"space-y-1 text-sm",children:[m.map((P,T)=>a.jsx("div",{children:P.status==="error"?a.jsxs("span",{className:"text-destructive",children:["â ",P.network," â ",P.error]}):a.jsxs("span",{children:["â
Planifié sur ",P.network," â ",P.scheduled_at?Pgt(P.scheduled_at):""]})},`${P.network}-${T}`)),a.jsxs("a",{href:"https://buffer.com",target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-primary hover:underline",children:["Voir dans Buffer ",a.jsx(Gi,{className:"h-3 w-3"})]})]})]})}const cV="#C8962E",No=1080,ra=1350,_t=No/432,UCe=432,Fse=UCe/No,Mgt=10,Tz=[{label:"Bleu nuit",color:"#1a1a2e"},{label:"Vert andalou",color:"#2d4a22"},{label:"Terracotta",color:"#4a2d1a"},{label:"Méditerranée",color:"#1a3a4a"},{label:"Doré",color:cV},{label:"Noir",color:"#111111"}],$se=[{key:"instagram",label:"ð· Instagram"},{key:"facebook",label:"ð¥ Facebook"},{key:"linkedin",label:"ð¼ LinkedIn"}];async function zse(t){if(!t||t.startsWith("data:")||t.startsWith("blob:"))return t;try{const e=await fetch(t,{mode:"cors"});if(!e.ok)throw new Error;const n=await e.blob();return await new Promise((r,s)=>{const i=new FileReader;i.onload=()=>r(String(i.result)),i.onerror=()=>s(i.error),i.readAsDataURL(n)})}catch{return t}}function Bse(t){return new Promise(e=>{if(!t)return e(null);const n=new Image;n.crossOrigin="anonymous",n.onload=()=>e(n),n.onerror=()=>e(null),n.src=t})}function Rgt({target:t}){const e=b.useRef(null),[n,r]=b.useState([]),[s,i]=b.useState(0),[o,l]=b.useState(fD.url),[c,u]=b.useState(""),[d,h]=b.useState({instagram:"",facebook:"",linkedin:""}),[f,p]=b.useState("instagram"),[m,v]=b.useState(null),x=n[s],g=(t.category||"Andalousie").toUpperCase();b.useEffect(()=>{zse(fD.url).then(l)},[]),b.useEffect(()=>{t.imageUrl&&zse(t.imageUrl).then(u)},[t.imageUrl]);const w=(A,I)=>r(D=>D.map((O,z)=>
1249z===A?{...O,...I}:O)),_=b.useCallback(async()=>{v("slides");try{const{data:A,error:I}=await Z.functions.invoke("generate-carousel",{body:{mode:"full",table:t.table,id:t.id,title:t.title,category:t.category||"Andalousie",excerpt:t.excerpt||""}});if(I)throw I;const D=A.slides||[];r(D.map(O=>({type:O.type||"content",headline:O.headline||"",subtext:O.subtext||"",background_color:O.background_color||Tz[0].color,photoBg:!1,brightness:.7,position:50,photoOpacity:.15}))),i(0)}catch(A){ee.error(`Génération impossible : ${A.message}`)}finally{v(null)}},[t]),j=b.useCallback(async()=>{v("captions");try{const{data:A,error:I}=await Z.functions.invoke("social-visual-ai",{body:{mode:"captions",carousel:!0,lang:"fr",title:t.title,category:t.category||"Andalousie",excerpt:t.excerpt||""}});if(I)throw I;const D=A;h({instagram:D.instagram||"",facebook:D.facebook||"",linkedin:D.linkedin||""})}catch(A){ee.error(`IA indisponible : ${A.message}`)}finally{v(null)}},[t]);b.useEffect(()=>{_(),j()},[t.id]);const N=async A=>{v(A==="add"?"add":"slide");try{const{data:I,error:D}=await Z.functions.invoke("generate-carousel",{body:{mode:A,table:t.table,id:t.id,title:t.title,category:t.category||"Andalousie",excerpt:t.excerpt||"",slide_number:s+1,slides:n.map((z,B)=>({slide_number:B+1,type:z.type,headline:z.headline,subtext:z.subtext}))}});if(D)throw D;const O=I;if(A==="regenerate")w(s,{headline:O.headline,subtext:O.subtext});else{const z=Math.max(1,n.findIndex(G=>G.type==="cta")),B=[...n];B.splice(z<1?B.length:z,0,{type:"content",headline:O.headline,subtext:O.subtext,background_color:O.background_color||Tz[0].color,photoBg:!1,brightness:.7,position:50,photoOpacity:.15}),r(B),i(z<1?B.length-1:z)}}catch(I){ee.error(`IA indisponible : ${I.message}`)}finally{v(null)}},S=A=>{const I=s+A;if(I<0||I>=n.length)return;const D=[...n];[D[s],D[I]]=[D[I],D[s]],r(D),i(I)},C=()=>{if(n.length<=3){ee.error("Un carrousel doit garder au moins 3 slides");return}r(A=>A.filter((I,D)=>D!==s)),i(A=>Math.max(0,A-1))},k=async(A,I)=>{const D=document.createElement("canvas");D.width=No,D.height=ra;const O=D.getContext("2d");if(!O)return null;try{await Promise.all([document.fonts.load(`700 ${Math.round(28*_t)}px "Playfair Display"`),document.fonts.load(`400 ${Math.round(16*_t)}px "DM Sans"`)])}catch{}O.fillStyle=A.type==="cover"?"#111":A.background_color,O.fillRect(0,0,No,ra);const z=A.image||c;if((A.type==="cover"||A.photoBg)&&z){const Q=await Bse(z);if(Q){const K=Math.max(No/Q.width,ra/Q.height),fe=Q.width*K,oe=Q.height*K;O.save(),A.type!=="cover"&&(O.globalAlpha=A.photoOpacity??.15),O.filter=`brightness(${A.brightness})`,O.drawImage(Q,(No-fe)/2,(ra-oe)*(A.position/100),fe,oe),O.restore(),O.filter="none"}}const G=32*_t,U=No-64*_t,F=(Q,K)=>{O.font=K;const fe=[];let oe="";for(const ye of Q.split(/\s+/).filter(Boolean)){const le=oe?`${oe} ${ye}`:ye;oe&&O.measureText(le).width>U?(fe.push(oe),oe=ye):oe=le}return oe&&fe.push(oe),fe},W=await Bse(o);if(O.textBaseline="alphabetic",A.type==="cover"){const Q=ra*.55,K=O.createLinearGradient(0,ra-Q,0,ra);if(K.addColorStop(0,"rgba(0,0,0,0)"),K.addColorStop(1,"rgba(0,0,0,0.85)"),O.fillStyle=K,O.fillRect(0,ra-Q,No,Q),W){const be=78*_t;O.drawImage(W,No-24*_t-be,24*_t,be,be*(W.height/W.width||1))}const fe=`400 ${16*_t}px "DM Sans", sans-serif`,oe=28*_t,ye=oe*1.25,le=F(A.subtext,fe),me=F(A.headline,`700 ${oe}px "Playfair Display", Georgia, serif`),he=ra-36*_t,ae=le.length*22*_t,re=he-ae-(le.length?12*_t:0)-me.length*ye,L=13*_t,X=14*_t,ne=6*_t,Y=2*_t;O.font=`700 ${L}px "DM Sans", sans-serif`;const J=g,se=[...J].reduce((be,Ee)=>be+O.measureText(Ee).width+Y,-Y),ge=L+ne*2,de=re-16*_t-ge;O.fillStyle=cV,O.fillRect(G,de,se+X*2,ge),O.fillStyle="#fff";const ce=O.measureText(J),xe=de+(ge-(ce.actualBoundingBoxAscent+ce.actualBoundingBoxDescent))/2+ce.actualBoundingBoxAscent;let je=G+X;for(const be of J)O.fillText(be,je,xe),je+=O.measureText(be).width+Y;O.fillStyle="#fff",O.font=`700 ${oe}px "Playfair Display", Georgia, serif`,me.forEach((be,Ee)=>O.fillText(be,G,re+oe+Ee*ye)),O.font=fe,O.fillStyle="rgba(255,255,255,0.88)",le.forEach((be,Ee)=>O.fillText(be,G,he-ae+16*_t+Ee*22*_t))}else{const Q=A.type==="cta";O.textAlign="center";const K=30*_t,fe=K*1.25,oe=F(A.headline,`700 ${K}px "Playfair Display", Georgia, serif`),ye=`400 ${17*_t}px "DM Sans", sans-serif`,le=F(A.subtext,ye);if(Q&&W){const ae=150*_t,re=ae*(W.height/W.width||1);O.drawImage(W,(No-ae)/2,ra/2-re-40*_t,ae,re)}const me=oe.length*fe+(le.length?18*_t+le.length*26*_t:0);let he=Q?ra/2+20*_t:(ra-me)/2;if(O.fillStyle="#fff",O.font=`700 ${K}px "Playfair Display", Georgia, serif`,oe.forEach((ae,re)=>O.fillText(ae,No/2,he+K+re*fe)),he+=oe.length*fe+18*_t,O.font=ye,O.fillStyle="rgba(255,255,255,0.88)",le.forEach((ae,re)=>O.fillText(ae,No/2,he+re*26*_t)),O.textAlign="left",!Q&&W){const ae=60*_t;O.drawImage(W,No-28*_t-ae,ra-28*_t-ae*(W.height/W.width||1),ae,ae*(W.height/W.width||1))}}return A.type!=="cta"&&(O.font=`700 ${12*_t}px "DM Sans", sans-serif`,O.fillStyle="rgba(255,255,255,0.7)",O.textAlign="left",O.fillText(`${I+1}
1249/${n.length}`,G,ra-16*_t)),D},E=b.useMemo(()=>`esprit-sud-carrousel-${t.slug||t.title.toLowerCase().replace(/[^a-z0-9]+/g,"-").slice(0,50)||"carrousel"}-${new Date().toISOString().slice(0,10)}`,[t]),P=async()=>{v("zip");try{const A=new Egt;for(let O=0;O<n.length;O++){const z=await k(n[O],O);if(!z)continue;const B=await new Promise(G=>z.toBlob(U=>G(U),"image/png"));B&&A.file(`slide-${String(O+1).padStart(2,"0")}.png`,B)}const I=await A.generateAsync({type:"blob"}),D=document.createElement("a");D.download=`${E}.zip`,D.href=URL.createObjectURL(I),D.click(),URL.revokeObjectURL(D.href)}catch(A){ee.error(`Export impossible : ${A.message}`)}finally{v(null)}},T=async()=>{v("save");try{const{error:A}=await Z.from(t.table).update({social_caption:d.instagram,caption_instagram:d.instagram,caption_facebook:d.facebook,caption_linkedin:d.linkedin,carousel_generated:!0}).eq("id",t.id);if(A)throw A;ee.success("Carrousel enregistré")}catch(A){ee.error(`Enregistrement impossible : ${A.message}`)}finally{v(null)}};if(m==="slides"&&n.length===0)return a.jsxs("div",{className:"flex items-center gap-2 py-16 text-muted-foreground",children:[a.jsx(Je,{className:"h-4 w-4 animate-spin"}),"Génération du carrousel par l'IAâ¦"]});if(!x)return a.jsx("div",{className:"py-16 text-center",children:a.jsxs(H,{onClick:_,children:[a.jsx(hp,{className:"mr-2 h-4 w-4"}
1249),"Générer le carrousel"]})});const M=x.image||c,R=x.type==="cover"||x.photoBg;return a.jsxs("div",{className:"space-y-6",children:[n.length>Mgt&&a.jsx("div",{className:"rounded-lg border border-destructive/40 bg-destructive/10 px-4 py-2 text-sm",children:"Instagram limite les carrousels à 10 slides. Seules les 10 premières seront publiées."}),a.jsxs("div",{className:"flex gap-2 overflow-x-auto pb-2",children:[n.map((A,I)=>a.jsxs("button",{type:"button",onClick:()=>i(I),className:`flex h-20 w-16 shrink-0 flex-col items-center justify-center rounded-md border p-1 text-[10px] leading-tight ${I===s?"border-primary ring-2 ring-primary/40":"border-border"}`,style:{background:A.type==="cover"?"#222":A.background_color,color:"#fff"},children:[a.jsx("span",{className:"line-clamp-3",children:A.headline||`Slide ${I+1}`}),a.jsx("span",{className:"mt-1 opacity-70",children:I+1})]},I)),a.jsx("button",{type:"button",onClick:()=>N("add"),disabled:m==="add",className:"flex h-20 w-16 shrink-0 items-center justify-center rounded-md border border-dashed border-border text-muted-foreground hover:bg-muted",children:m==="add"?a.jsx(Je,{className:"h-4 w-4 animate-spin"}):a.jsx(dr,{className:"h-4 w-4"})})]}),a.jsxs("div",{className:"grid gap-8 lg:grid-cols-[auto,1fr]",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"overflow-hidden rounded-xl border border-border shadow-lg",style:{width:UCe,height:ra*Fse},children:a.jsxs("div",{style:{width:No,height:ra,transform:`scale(${Fse})`,transformOrigin:"top left",position:"relative",overflow:"hidden",backgroundColor:x.type==="cover"?"#111":x.background_color},children:[R&&M&&a.jsx("img",{src:M,alt:"",crossOrigin:"anonymous",style:{position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"cover",objectPosition:`center ${x.position}%`,filter:`brightness(${x.brightness})`,opacity:x.type==="cover"?1:x.photoOpacity??.15}}),x.type==="cover"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:{position:"absolute",inset:"45% 0 0 0",background:"linear-gradient(transparent, rgba(0,0,0,0.85))"}}),a.jsx("img",{src:o,alt:"",style:{position:"absolute",top:24*_t,right:24*_t,width:78*_t}}),a.jsxs("div",{style:{position:"absolute",left:32*_t,right:32*_t,bottom:36*_t},children:[a.jsx("span",{style:{display:"inline-block",background:cV,color:"#fff",padding:`${6*_t}px ${14*_t}px`,fontSize:13*_t,lineHeight:1,letterSpacing:2*_t,fontWeight:700},children:g}),a.jsx("div",{style:{color:"#fff",fontWeight:700,fontSize:28*_t,lineHeight:1.25,marginTop:16*_t,fontFamily:"'Playfair Display', Georgia, serif"},children:x.headline}),a.jsx("div",{style:{color:"rgba(255,255,255,0.88)",fontSize:16*_t,lineHeight:1.35,marginTop:12*_t,fontFamily:"'DM Sans', sans-serif"},children:x.subtext})]})]}),x.type!=="cover"&&a.jsxs("div",{style:{position:"absolute",inset:`0 ${32*_t}px`,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center"},children:[x.type==="cta"&&a.jsx("img",{src:o,alt:"",style:{width:150*_t,marginBottom:40*_t}}),a.jsx("div",{style:{color:"#fff",fontWeight:700,fontSize:30*_t,lineHeight:1.25,fontFamily:"'Playfair Display', Georgia, serif"},children:x.headline}),a.jsx("div",{style:{color:"rgba(255,255,255,0.88)",fontSize:17*_t,lineHeight:1.5,marginTop:18*_t,fontFamily:"'DM Sans', sans-serif"},children:x.subtext})]}),x.type==="content"&&a.jsx("img",{src:o,alt:"",style:{position:"absolute",right:28*_t,bottom:28*_t,width:60*_t}}),x.type!=="cta"&&a.jsxs("div",{style:{position:"absolute",left:32*_t,bottom:16*_t,color:"rgba(255,255,255,0.7)",fontSize:12*_t,fontWeight:700,fontFamily:"'DM Sans', sans-serif",transform:"translateY(-25%)"},children:[s+1,"/",n.length]})]})}),a.jsxs("div",{className:"flex items-center justify-center gap-1",children:[a.jsx(H,{size:"icon",variant:"ghost",onClick:()=>i(A=>Math.max(0,A-1)),children:a.jsx(jr,{className:"h-4 w-4"})}),n.map((A,I)=>a.jsx("button",{type:"button",onClick:()=>i(I),className:`h-7 w-7 rounded-md border text-xs ${I===s?"border-primary bg-primary text-primary-foreground":"border-border"}`,children:I+1},I)),a.jsx(H,{size:"icon",variant:"ghost",onClick:()=>i(A=>Math.min(n.length-1,A+1)),children:a.jsx(Au,{className:"h-4 w-4"})})]}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[a.jsxs(H,{onClick:P,disabled:m==="zip",children:[m==="zip"?a.jsx(Je,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(Ts,{className:"mr-2 h-4 w-4"}
1249),"Télécharger le carrousel"]}),a.jsxs(H,{variant:"secondary",onClick:T,disabled:m==="save",children:[m==="save"?a.jsx(Je,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(Ra,{className:"mr-2 h-4 w-4"}),"Enregistrer"]})]}),a.jsx(BCe,{captions:d,slug:t.slug||void 0,postType:"carousel",getImages:async()=>{const A=[];for(let I=0;I<n.length;I++){const D=await k(n[I],I);D&&A.push(D.toDataURL("image/png"))}return A}})]}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsxs(te,{children:["ð Contenu de la slide ",s+1]}),a.jsx(ue,{value:x.headline,maxLength:100,onChange:A=>w(s,{headline:A.target.value}),placeholder:"Titre principal"}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[x.headline.length,"/100"]}),a.jsx(fn,{value:x.subtext,maxLength:200,rows:3,onChange:A=>w(s,{subtext:A.target.value}),placeholder:"Texte secondaire"}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-xs text-muted-foreground",children:[x.subtext.length,"/200"]}),a.jsxs(H,{size:"sm",variant:"outline",onClick:()=>N("regenerate"),disabled:m==="slide",children:[m==="slide"?a.jsx(Je,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(Ig,{className:"mr-2 h-4 w-4"}),"Regénérer cette slide"]})]})]}),x.type!=="cover"&&a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{children:"ð¨ Style"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:Tz.map(A=>a.jsxs("button",{type:"button",onClick:()=>w(s,{background_color:A.color}),className:`rounded-full border px-3 py-1 text-xs ${x.background_color===A.color?"border-primary":"border-border"}`,children:[a.jsx("span",{className:"mr-2 inline-block h-3 w-3 rounded-full align-middle",style:{background:A.color}}),A.label]},A.color))}),a.jsx(ue,{type:"color",value:x.background_color,onChange:A=>w(s,{background_color:A.target.value}),className:"h-10 w-24 p-1"}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(_n,{checked:x.photoBg,onCheckedChange:A=>w(s,{photoBg:A}),id:`photo-${s}`}),a.jsx(te,{htmlFor:`photo-${s}`,className:"text-sm font-normal",children:"Fond photo"})]}),x.photoBg&&a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsxs("span",{className:"text-xs text-muted-foreground",children:["Intensité de la photo (",Math.round((x.photoOpacity??.15)*100),"%)"]}),a.jsx(dg,{value:[x.photoOpacity??.15],min:.05,max:1,step:.05,onValueChange:([A])=>w(s,{photoOpacity:A})})]}),a.jsxs("div",{children:[a.jsxs("span",{className:"text-xs text-muted-foreground",children:["Luminosité (",x.brightness.toFixed(2),")"]}),a.jsx(dg,{value:[x.brightness],min:.3,max:1,step:.05,onValueChange:([A])=>w(s,{brightness:A})})]})]})]}),(x.type==="cover"||x.photoBg)&&a.jsxs("div",{className:"space-y-3",children:[a.jsxs(te,{children:["ð¼ï¸ Image de la slide ",s+1]}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[a.jsxs(H,{type:"button",variant:"outline",size:"sm",onClick:()=>{var A;return(A=e.current)==null?void 0:A.click()},children:[a.jsx(Oa,{className:"mr-2 h-4 w-4"}),x.image?"Remplacer la photo":"Ajouter une photo"]}),x.image&&a.jsxs(H,{type:"button",variant:"ghost",size:"sm",onClick:()=>w(s,{image:void 0}),children:[a.jsx(tr,{className:"mr-2 h-4 w-4"}),"Revenir à la photo de l'article"]})]}),a.jsx("input",{ref:e,type:"file",accept:"image/*",className:"hidden",onChange:A=>{var O;const I=(O=A.target.files)==null?void 0:O[0];if(!I)return;const D=new FileReader;D.onload=()=>w(s,{image:String(D.result)}),D.readAsDataURL(I)}}),a.jsxs("div",{children:[a.jsxs("span",{className:"text-xs text-muted-foreground",children:["Position verticale (",x.position,"%)"]}),a.jsx(dg,{value:[x.position],min:0,max:100,step:5,onValueChange:([A])=>w(s,{position:A})})]}),a.jsxs("div",{children:[a.jsxs("span",{className:"text-xs text-muted-foreground",children:["Luminosité (",x.brightness.toFixed(2),")"]}),a.jsx(dg,{value:[x.brightness],min:.3,max:1,step:.05,onValueChange:([A])=>w(s,{brightness:A})})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"ð Ordre"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(H,{size:"sm",variant:"outline",onClick:()=>S(-1),disabled:s===0,children:a.jsx(jr,{className:"h-4 w-4"})}),a.jsx(H,{size:"sm",variant:"outline",onClick:()=>S(1),disabled:s===n.length-1,children:a.jsx(Au,{className:"h-4 w-4"})}),a.jsx(H,{size:"sm",variant:"outline",onClick:C,children:a.jsx(tr,{className:"h-4 w-4"})}),a.jsxs(H,{size:"sm",variant:"outline",onClick:()=>N("add"),disabled:m==="add",children:[a.jsx(dr,{className:"mr-2 h-4 w-4"}),"Ajouter une slide"]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"âï¸ Légendes du carrousel"}),a.jsxs(Qi,{value:f,onValueChange:A=>p(A),children:[a.jsx(wi,{className:"grid w-full grid-cols-3",children:$se.map(A=>a.jsx(wt,{value:A.key,children:A.label},A.key))}),$se.map(A=>a.jsxs(kt,{value:A.key,className:"space-y-2",children:[a.jsx(fn,{value:d[A.key],rows:12,onChange:I=>h(D=>({...D,[A.key]:I.target.value}))}),a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[a.jsxs("span",{className:"text-xs text-muted-foreground",children:[d[A.key].length," caractères"]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(H,{size:"sm",variant:"outline",onClick:()=>{navigator.clipboard.writeText(d[A.key]),ee.success("Légende copiée")},children:[a.jsx(Pl,{className:"mr-2 h-4 w-4"}),"Copier"]}),a.jsxs(H,{size:"sm",variant:"outline",onClick:j,disabled:m==="captions",children:[m==="captions"?a.jsx(Je,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(Ig,{className:"mr-2 h-4 w-4"}),"Regénérer"]})]})]})]},A.key))]})]})]})]})]})}const Use=[{key:"single",label:"ð¸ Visuel simple"},{key:"carousel",label:"ð Carrousel"}],Pz={feed:{label:"Instagram Feed 4:5",w:1080,h:1350},story:{label:"Instagram Story 9:16",w:1080,h:1920},facebook:{label:"Facebook 1.91:1",w:1200,h:630},linkedin:{label:"LinkedIn 1.91:1",w:1200,h:630},square:{label:"Carré universel 1:1",w:1080,h:1080}},qse=[{key:"instagram",label:"ð· Instagram"},{key:"facebook",label:"ð¥ Facebook"},{key:"linkedin",label:"ð¼ LinkedIn"}],qCe=["ANDALOUSIE","TOURISME","GASTRONOMIE","ART DE VIVRE","IMMOBILIER","CULTURE","MÃTÃO"],Ogt=["ANDALUSIA","TRAVEL","FOOD & DRINK","LIFESTYLE","REAL ESTATE","CULTURE","WEATHER"],Vse="#C8962E",rr=1080/432;function Igt(t){if(!t)return"ANDALOUSIE";const e=t.toUpperCase();return qCe.find(r=>e.includes(r)||r.includes(e))||e.slice(0,24)}function VCe({target:t,open:e,onOpenChange:n}){const r=b.useRef(null),s=b.useRef(null),[i,o]=b.useState("single"),[l,c]=b.useState("feed"),[u,d]=b.useState(""),[h,f]=b.useState(fD.url),[p,m]=b.useState(.7),[v,x]=b.useState(50),[g,w]=b.useState("fr"),[_,j]=b.useState({fr:"ANDALOUSIE",en:""}),[N,S]=b.useState({fr:"",en:""}),[C,k]=b.useState({fr:{instagram:"",facebook:"",linkedin:""},en:{instagram:"",facebook:"",linkedin:""}}),[E,P]=b.useState("instagram"),[T,M]=b.useState(null),[R,A]=b.useState([]),I=_[g],D=g==="en"?Ogt:qCe,O=N[g],z=C[g],B=L=>j(X=>({...X,[g]:L})),G=L=>S(X=>({...X,[g]:L})),U=L=>k(X=>({...X,[g]:L(X[g])})),F=async L=>{if(!L||L.startsWith("data:")||L.startsWith("blob:"))return L;try{const X=await fetch(L,{mode:"cors"});if(!X.ok)throw new Error(`HTTP ${X.status}`);const ne=await X.blob();return await new Promise((Y,J)=>{const se=new FileReader;se.onload=()=>Y(String(se.result)),se.onerror=()=>
1249J(se.error),se.readAsDataURL(ne)})}catch{return L}};b.useEffect(()=>{F(fD.url).then(f)},[]),b.useEffect(()=>{!t||!e||(o("single"),c("feed"),d(t.imageUrl||""),t.imageUrl&&F(t.imageUrl).then(d),m(.7),x(50),w("fr"),j({fr:Igt(t.category),en:""}),S({fr:t.title.slice(0,80),en:""}),k({fr:{instagram:t.caption||"",facebook:"",linkedin:""},en:{instagram:"",facebook:"",linkedin:""}}),P("instagram"),A([]))},[t,e]);const W=Pz[l],Q=432,K=Q/W.w,fe=async(L,X,ne=g)=>{if(t){M(L);try{const{data:Y,error:J}=await Z.functions.invoke("social-visual-ai",{body:{mode:L,lang:ne,network:X,title:L==="titles"&&N[ne]||t.title,category:_[ne]||_.fr,excerpt:t.excerpt||""}});if(J)throw J;if(L==="titles")A(Y.titles||[]);else{const se=Y;k(ge=>({...ge,[ne]:X?{...ge[ne],[X]:se[X]||ge[ne][X]}:{instagram:se.instagram||"",facebook:se.facebook||"",linkedin:se.linkedin||""}}))}}catch(Y){ee.error(`IA indisponible : ${Y.message}`)}finally{M(null)}}},oe=async L=>{if(w(L),A([]),!(L!=="en"||!t)&&!(N.en&&C.en.instagram)){if(!N.en){M("translate");try{const{data:X,error:ne}=await Z.functions.invoke("social-visual-ai",{body:{mode:"translate",title:N.fr||t.title,category:_.fr}});if(ne)throw ne;const Y=X;S(J=>({...J,en:(Y.title||J.fr).slice(0,80)})),j(J=>({...J,en:(Y.badge||J.fr).toUpperCase()}))}catch(X){ee.error(`Traduction indisponible : ${X.message}`),S(ne=>({...ne,en:ne.fr})),j(ne=>({...ne,en:ne.fr}))}finally{M(null)}}C.en.instagram||await fe("captions",void 0,"en")}};b.useEffect(()=>{e&&t&&fe("captions",void 0,"fr")},[e,t==null?void 0:t.id]);const ye=L=>{if(!L)return;const X=new FileReader;X.onload=()=>d(String(X.result)),X.readAsDataURL(L)},le=async()=>{const L=document.createElement("canvas");L.width=W.w,L.height=W.h;const X=L.getContext("2d");if(!X)return null;const ne=Ve=>new Promise(bt=>{if(!Ve)return bt(null);const Be=new Image;Be.crossOrigin="anonymous",Be.onload=()=>bt(Be),Be.onerror=()=>bt(null),Be.src=Ve});try{await Promise.all([document.fonts.load(`700 ${Math.round(28*rr)}px "Playfair Display"`),document.fonts.load(`700 ${Math.round(13*rr)}px "DM Sans"`)])}catch{}X.fillStyle="#111",X.fillRect(0,0,W.w,W.h);const Y=await ne(u);if(Y){const Ve=Math.max(W.w/Y.width,W.h/Y.height),bt=Y.width*Ve,Be=Y.height*Ve,Nt=(W.w-bt)/2,Xe=(W.h-Be)*(v/100);X.filter=`brightness(${p})`,X.drawImage(Y,Nt,Xe,bt,Be),X.filter="none"}const J=W.h*(l==="facebook"||l==="linkedin"?.7:.55),se=X.createLinearGradient(0,W.h-J,0,W.h);se.addColorStop(0,"rgba(0,0,0,0)"),se.addColorStop(1,"rgba(0,0,0,0.85)"),X.fillStyle=se,X.fillRect(0,W.h-J,W.w,J);const ge=await ne(h);if(ge){const Ve=78*rr,bt=Ve*(ge.height/ge.width||1);X.drawImage(ge,W.w-24*rr-Ve,24*rr,Ve,bt)}const de=32*rr,ce=W.w-64*rr,xe=W.h-36*rr,je=28*rr,be=je*1.25;X.font=`700 ${je}px "Playfair Display", Georgia, serif`;const Ee=O.split(/\s+/).filter(Boolean),Me=[];let Oe="";for(const Ve of Ee){const bt=Oe?`${Oe} ${Ve}`:Ve;Oe&&X.measureText(bt).width>ce?(Me.push(Oe),Oe=Ve):Oe=bt}Oe&&Me.push(Oe);const st=13*rr,Ye=14*rr,gt=6*rr,At=2*rr,yt=I.toUpperCase();X.font=`700 ${st}px "DM Sans", sans-serif`;const nr=[...yt].reduce((Ve,bt)=>Ve+X.measureText(bt).width+At,-At)+Ye*2,wn=st+gt*2,Si=xe-Me.length*be,it=Si-16*rr-wn;X.fillStyle=Vse,X.fillRect(de,it,nr,wn),X.fillStyle="#fff",X.textBaseline="alphabetic";const pe=X.measureText(yt),Pe=pe.actualBoundingBoxAscent+pe.actualBoundingBoxDescent,Ze=it+(wn-Pe)/2+pe.actualBoundingBoxAscent;let qe=de+Ye;for(const Ve of yt)X.fillText(Ve,qe,Ze),qe+=X.measureText(Ve).width+At;return X.font=`700 ${je}px "Playfair Display", Georgia, serif`,X.textBaseline="alphabetic",Me.forEach((Ve,bt)=>{X.fillText(Ve,de,Si+je+bt*be)}),L},me=b.useMemo(()=>{var ne;return`esprit-sud-${(t==null?void 0:t.slug)||((ne=t==null?void 0:t.title)==null?void 0:ne.toLowerCase().replace(/[^a-z0-9]+/g,"-").slice(0,50))||"visuel"}${g==="en"?"-en":""}-${new Date().toISOString().slice(0,10)}.png`},[t,g]),he=async()=>{M("png");try{const L=await le();if(!L)return;const X=document.createElement("a");X.download=me,X.href=L.toDataURL("image/png"),X.click()}catch(L){ee.error(`Export impossible : ${L.message}`)}finally{M(null)}},ae=async()=>{if(t){M("save");try{let L=null;const X=await le(),ne=X?await new Promise(de=>X.toBlob(ce=>de(ce),"image/png")):null;if(ne){const de=`social/${t.id}-${g}-${Date.now()}.png`,{error:ce}=await Z.storage.from("images").upload(de,ne,{contentType:"image/png"});ce||(L=Z.storage.from("images").getPublicUrl(de).data.publicUrl)}const Y=C.fr,J=C.en,se={social_caption:Y.instagram,caption_instagram:Y.instagram,caption_facebook:Y.facebook,caption_linkedin:Y.linkedin,caption_instagram_en:J.instagram,caption_facebook_en:J.facebook,caption_linkedin_en:J.linkedin,visual_generated:!0};L&&(se.image_generated_url=L);const{error:ge}=await Z.from(t.table).update(se).eq("id",t.id);if(ge)throw ge;ee.success("Visuel et légende enregistrés"),n(!1)}catch(L){ee.error(`Enregistrement impossible : ${L.message}`)}finally{M(null)}}},re=l==="facebook"||l==="linkedin"?"70%":"55%";return t?i==="carousel"?a.jsx(an,{open:e,onOpenChange:n,children:a.jsxs(nn,{className:"max-h-[92vh] max-w-6xl overflow-y-auto",children:[a.jsx(on,{children:a.jsx(ln,{className:"font-serif",children:"ð¨ Créer le visuel"})}),a.jsx("div",{className:"flex items-center gap-2",children:Use.map(L=>a.jsx("button",{type:"button",onClick:()=>o(L.key),className:`rounded-full border px-4 py-1.5 text-sm transition-colors ${i===L.key?"border-primary bg-primary text-primary-foreground":"border-border bg-background text-muted-foreground hover:bg-muted"}`,children:L.label},L.key))}),t&&a.jsx(Rgt,{target:t})]})}):a.jsx(an,{open:e,onOpenChange:n,children:a.jsxs(nn,{className:"max-h-[92vh] max-w-6xl overflow-y-auto",children:[a.jsx(on,{children:a.jsx(ln,{className:"font-serif",children:"ð¨ Créer le visuel"})}),a.jsx("div",{className:"flex items-center gap-2",children:Use.map(L=>a.jsx("button",{type:"button",onClick:()=>o(L.key),className:`rounded-full border px-4 py-1.5 text-sm transition-colors ${i===L.key?"border-primary bg-primary text-primary-foreground":"border-border bg-background text-muted-foreground hover:bg-muted"}`,children:L.label},L.key))}),a.jsxs("div",{className:"flex items-center gap-2",children:[[{key:"fr",label:"ð«ð· Version française"},{key:"en",label:"ð¬ð§ English version"}].map(L=>a.jsx("button",{type:"button",onClick:()=>oe(L.key),className:`rounded-full border px-4 py-1.5 text-sm transition-colors ${g===L.key?"border-primary bg-primary text-primary-foreground":"border-border bg-background text-muted-foreground hover:bg-muted"}`,children:L.label},L.key)),T==="translate"&&a.jsxs("span",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[a.jsx(Je,{className:"h-3 w-3 animate-spin"}),"Traduction en coursâ¦"]})]}),a.jsxs("div",{className:"grid gap-8 lg:grid-cols-[auto,1fr]",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"overflow-hidden rounded-xl border border-border shadow-lg",style:{width:Q,height:W.h*K}
1249,children:a.jsxs("div",{ref:r,style:{width:W.w,height:W.h,transform:`scale(${K})`,transformOrigin:"top left",position:"relative",overflow:"hidden",backgroundColor:"#111"},children:[u&&a.jsx("img",{src:u,alt:"",crossOrigin:"anonymous",style:{position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"cover",objectPosition:`center ${v}%`,filter:`brightness(${p})`}}),a.jsx("div",{style:{position:"absolute",left:0,right:0,bottom:0,height:re,background:"linear-gradient(transparent, rgba(0,0,0,0.85))"}}),a.jsx("img",{src:h,alt:"Esprit Sud Magazine",style:{position:"absolute",top:24*rr,right:24*rr,width:78*rr,height:"auto"}}),a.jsxs("div",{style:{position:"absolute",left:32*rr,right:32*rr,bottom:36*rr},children:[a.jsx("span",{style:{display:"inline-block",background:Vse,color:"#fff",textTransform:"uppercase",padding:`${6*rr}px ${14*rr}px`,fontSize:13*rr,lineHeight:1,letterSpacing:2*rr,fontWeight:700},children:I}),a.jsx("div",{style:{color:"#fff",fontWeight:700,fontSize:28*rr,lineHeight:1.25,marginTop:16*rr,fontFamily:"'Playfair Display', Georgia, serif"},children:O})]})]})}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[a.jsxs(H,{onClick:he,disabled:T==="png",children:[T==="png"?a.jsx(Je,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(Ts,{className:"mr-2 h-4 w-4"}),"Télécharger le visuel PNG"]}),a.jsxs(H,{variant:"outline",onClick:()=>{navigator.clipboard.writeText(z[E]),ee.success("Légende copiée")},children:[a.jsx(Pl,{className:"mr-2 h-4 w-4"}),"Copier la légende"]}),a.jsxs(H,{variant:"secondary",onClick:ae,disabled:T==="save",children:[T==="save"?a.jsx(Je,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(Ra,{className:"mr-2 h-4 w-4"}),"Enregistrer dans l'article"]})]}),a.jsx(BCe,{captions:z,slug:t.slug||void 0,postType:"single",getImages:async()=>{const L=await le();return L?[L.toDataURL("image/png")]:[]}})]}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{children:"ð· Image de fond"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(H,{type:"button",variant:"outline",size:"sm",onClick:()=>{var L;return(L=s.current)==null?void 0:L.click()},children:[a.jsx(Oa,{className:"mr-2 h-4 w-4"}),"Changer l'image"]}),a.jsx("input",{ref:s,type:"file",accept:"image/*",className:"hidden",onChange:L=>{var X;return ye((X=L.target.files)==null?void 0:X[0])}})]}),a.jsxs("div",{children:[a.jsxs("span",{className:"text-xs text-muted-foreground",children:["Luminosité (",p.toFixed(2),")"]}),a.jsx(dg,{value:[p],min:.3,max:1,step:.05,onValueChange:([L])=>m(L)})]}),a.jsxs("div",{children:[a.jsxs("span",{className:"text-xs text-muted-foreground",children:["Position verticale (",v,"%)"]}),a.jsx(dg,{value:[v],min:0,max:100,step:5,onValueChange:([L])=>x(L)})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs(te,{children:["ð·ï¸ ",g==="en"?"Topic":"Thématique"]}),a.jsxs(lt,{value:D.includes(I)?I:"custom",onValueChange:L=>L!=="custom"&&B(L),children:[a.jsx(nt,{children:a.jsx(ct,{placeholder:"Thématique"})}),a.jsxs(rt,{children:[D.map(L=>a.jsx(Ae,{value:L,children:L},L)),a.jsx(Ae,{value:"custom",children:"Personnaliséâ¦"})]})]}),a.jsx(ue,{value:I,onChange:L=>B(L.target.value.toUpperCase()),placeholder:"Texte du badge"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"ð Titre"}),a.jsx(fn,{value:O,maxLength:80,rows:3,onChange:L=>G(L.target.value)}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-xs text-muted-foreground",children:[O.length,"/80"]}),a.jsxs(H,{size:"sm",variant:"outline",onClick:()=>fe("titles"),disabled:T==="titles",children:[T==="titles"?a.jsx(Je,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(hp,{className:"mr-2 h-4 w-4"}),"Raccourcir avec l'IA"]})]}),R.length>0&&a.jsx("div",{className:"space-y-1",children:R.map(L=>a.jsx("button",{type:"button",onClick:()=>G(L.slice(0,80)),className:"block w-full rounded-md border border-border px-3 py-2 text-left text-sm hover:bg-muted",children:L},L))})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"ð² Format"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:Object.keys(Pz).map(L=>a.jsx("button",{type:"button",onClick:()=>c(L),className:`rounded-full border px-3 py-1 text-sm transition-colors ${l===L?"border-primary bg-primary text-primary-foreground":"border-border bg-background text-muted-foreground hover:bg-muted"}`,children:Pz[L].label},L))})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"âï¸ Légendes par réseau"}),a.jsxs(Qi,{value:E,onValueChange:L=>P(L),children:[a.jsx(wi,{className:"grid w-full grid-cols-3",children:qse.map(L=>a.jsx(wt,{value:L.key,children:L.label},L.key))}),qse.map(L=>a.jsxs(kt,{value:L.key,className:"space-y-2",children:[a.jsx(fn,{value:z[L.key],rows:12,onChange:X=>U(ne=>({...ne,[L.key]:X.target.value}))}),a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[a.jsxs("span",{className:"text-xs text-muted-foreground",children:[z[L.key].length," caractères"]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(H,{size:"sm",variant:"outline",onClick:()=>{navigator.clipboard.writeText(z[L.key]),ee.success("Légende copiée")},children:[a.jsx(Pl,{className:"mr-2 h-4 w-4"}),"Copier la légende"]}),a.jsxs(H,{size:"sm",variant:"outline",onClick:()=>fe("captions",L.key),disabled:T==="captions",children:[T==="captions"?a.jsx(Je,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(Ig,{className:"mr-2 h-4 w-4"}),"Regénérer"]})]})]})]},L.key))]})]})]})]})]})}):null}const Dgt={draft:"Brouillon",review:"En relecture",validated:"Validé",published:"Publié",archived:"Archivé"},Lgt={draft:"bg-gray-200 text-gray-800",review:"bg-yellow-100 text-yellow-800",validated:"bg-green-100 text-green-800",published:"bg-blue-100 text-blue-800",archived:"bg-red-100 text-red-800"},Fgt={web_only:"Web",paper_only:"Magazine",web_and_paper:"Web + Magazine"},$gt={web_only:"bg-blue-100 text-blue-800",paper_only:"bg-orange-100 text-orange-800",web_and_paper:"bg-purple-100 text-purple-800"};function zgt(){const t=St(),{profile:e,user:n}=Ji(),r=(e==null?void 0:e.role)||"",s=r==="redacteur",[i,o]=b.useState(""),[l,c]=b.useState("all"),[u,d]=b.useState("all"),[h,f]=b.useState("all"),[p,m]=b.useState("all"),[v,x]=b.useState(!0),[g,w]=b.useState(new Set),[_,j]=b.useState(null),[N,S]=b.useState(!1),[C,k]=b.useState(null),[E,P]=b.useState(null),[T,M]=b.useState(""),[R,A]=b.useState(!1),[I,D]=b.useState(!1),[O,z]=b.useState(0),[B,G]=b.useState(0),[U,F]=b.useState(null),[W,Q]=b.useState(!1),[K,fe]=b.useState(!1),[oe,ye]=b.useState(0),[le,me]=b.useState(0),[he,ae]=b.useState(null),[re,L]=b.useState(new Set),[X,ne]=b.useState(!1),{data:Y=[],isLoading:J}=Ne({queryKey:["admin_articles",r,n==null?void 0:n.id],queryFn:async()=>{let pe=Z.from("articles").select("*, categories(name), magazine_issues(id, issue_number, title), author:profiles!articles_author_id_fkey(full_name)").order("created_at",{ascending:!1});s&&(n!=null&&n.id)&&(pe=pe.eq("author_id",n.id));const{data:Pe,error:Ze}=await pe;if(Ze){const{data:qe}=await Z.from("articles").select("*, categories(name), magazine_issues(id, issue_number, title)").order("created_at",{ascending:!1});return qe??[]}return Pe??[]}}),{data:se=[]}=Ne({queryKey:["categories"],queryFn:async()=>(await Z.from("categories").select("id, name").order("name")).data??[]}),{data:ge=[]}=Ne({queryKey:["magazine_issues"],queryFn:async()=>(await Z.from("magazine_issues").select("id, issue_number, title").order("issue_number",{ascending:!1})).data??[]}),de=b.useMemo(()=>{const pe=Y.filter(Pe=>!_||_.has(Pe.id)).filter(Pe=>{var Ze;return!i||((Ze=Pe.title)==null?void 0:Ze.toLowerCase().includes(i.toLowerCase()))}).filter(Pe=>l==="all"||Pe.status===l).filter(Pe=>u==="all"||Pe.destination===u).filter(Pe=>h==="all"||Pe.category_id===h).filter(Pe=>p==="all"?!0:p==="none"?!Pe.magazine_issue_id:Pe.magazine_issue_id===p);return pe.sort((Pe,Ze)=>{const qe=new Date(Pe.created_at).getTime(),Ve=new Date(Ze.created_at).getTime();return v?Ve-qe:qe-Ve}),pe},[Y,i,l,u,h,p,v,_]),ce=b.useMemo(()=>{const pe=new Map;for(const Pe of Y)if(Pe.status==="validated"&&Pe.magazine_issue_id&&Pe.magazine_issues){const Ze=Pe.magazine_issue_id;pe.has(Ze)||pe.set(Ze,{count:0,issue:Pe.magazine_issues}),pe.get(Ze).count++}return Array.from(pe.entries())},[Y]),xe=Array.from(g),je=de.length>0&&de.every(pe=>g.has(pe.id)),be=()=>{const pe=new Set(g);je?de.forEach(Pe=>pe.delete(Pe.id)):de.forEach(Pe=>pe.add(Pe.id)),w(pe)},Ee=pe=>{const Pe=new Set(g);Pe.has(pe)?Pe.delete(pe):Pe.add(pe),w(Pe)},Me=()=>w(new Set),Oe=Qe({mutationFn:async()=>{const{error:pe}=await Z.from("articles").update({status:"published",published_at:new Date().toISOString()}).in("id",xe);if(pe)throw pe},onSuccess:()=>{ee.success(`${xe.length} article(s) publié(s)`),t.invalidateQueries({queryKey:["admin_articles"]}),Me()},onError:pe=>ee.error(pe.message)}),st=Qe({mutationFn:async()=>{const{error:pe}=await Z.from("articles").update({status:"archived"}).in("id",xe);if(pe)throw pe},onSuccess:()=>{ee.success(`${xe.length} article(s) archivé(s)`),t.invalidateQueries({queryKey:["admin_articles"]}),Me()},onError:pe=>ee.error(pe.message)}),Ye=Qe({mutationFn:async()=>
1249{if(!T)return;const{error:pe}=await Z.from("articles").update({magazine_issue_id:T}).in("id",xe);if(pe)throw pe},onSuccess:()=>{ee.success(`${xe.length} article(s) assigné(s)`),t.invalidateQueries({queryKey:["admin_articles"]}),Me(),M("")},onError:pe=>ee.error(pe.message)}),gt=Qe({mutationFn:async()=>{await Z.from("article_tags").delete().in("article_id",xe);const{error:pe}=await Z.from("articles").delete().in("id",xe);if(pe)throw pe},onSuccess:()=>{ee.success(`${xe.length} article(s) supprimé(s)`),t.invalidateQueries({queryKey:["admin_articles"]}),Me(),S(!1)},onError:pe=>{ee.error(pe.message),S(!1)}}),At=Qe({mutationFn:async pe=>{const{error:Pe}=await Z.from("articles").update({status:"published",published_at:new Date().toISOString()}).eq("magazine_issue_id",pe).eq("status","validated");if(Pe)throw Pe},onSuccess:()=>{ee.success("Articles du magazine publiés en ligne"),t.invalidateQueries({queryKey:["admin_articles"]}),P(null)},onError:pe=>{ee.error(pe.message),P(null)}}),yt=async pe=>{const Pe={title:`${pe.title} (copie)`,slug:`${pe.slug}-copie-${Date.now().toString(36)}`,content:pe.content,excerpt:pe.excerpt,cover_image_url:pe.cover_image_url,category_id:pe.category_id,author_id:pe.author_id,status:"draft",destination:pe.destination,magazine_issue_id:pe.magazine_issue_id,seo_title:pe.seo_title,seo_description:pe.seo_description,is_sponsored:pe.is_sponsored,sponsor_name:pe.sponsor_name},{error:Ze}=await Z.from("articles").insert(Pe);Ze?ee.error(Ze.message):(ee.success("Article dupliqué"),t.invalidateQueries({queryKey:["admin_articles"]}))},Qt=async()=>{A(!1),D(!0),F(null),z(0);try{const{data:pe}=await Z.from("tags").select("id, name"),Pe=pe??[];if(Pe.length===0){ee.error("Aucun tag disponible. Créez d'abord des tags."),D(!1);return}const{data:Ze}=await Z.from("article_tags").select("article_id"),qe=new Set((Ze||[]).map(Ft=>Ft.article_id)),{data:Ve}=await Z.from("articles").select("id, title, excerpt").order("created_at",{ascending:!1}),bt=(Ve||[]).filter(Ft=>!qe.has(Ft.id));if(G(bt.length),bt.length===0){F({analyzed:0,tagged:0,links:0,ids:[]}),ee.info("Tous les articles sont déjà taggés");return}const Be=[];let Nt=0;const Xe=20;for(let Ft=0;Ft<bt.length;Ft+=Xe){const Zt=bt.slice(Ft,Ft+Xe),Sr=[];for(const Ur of Zt){const cs=`${Ur.title||""} ${Ur.excerpt||""}`,Os=Pe.filter(K0=>JK(K0.name,cs));if(Os.length>0){Be.push(Ur.id);for(const K0 of Os)Sr.push({article_id:Ur.id,tag_id:K0.id})}}if(Sr.length){const{error:Ur}=await Z.from("article_tags").insert(Sr);Ur?console.error("Insert article_tags failed:",Ur):Nt+=Sr.length}z(Math.min(Ft+Xe,bt.length))}F({analyzed:bt.length,tagged:Be.length,links:Nt,ids:Be}),ee.success(`${Be.length} article(s) taggé(s)`),t.invalidateQueries({queryKey:["admin_articles"]})}catch(pe){console.error("Auto-tag failed:",pe),ee.error(pe.message||"Erreur")}finally{D(!1)}},nr=[{slug:"semaine-sainte",keywords:["semaine sainte","semana santa","procession","pénitent","penitent","cofradÃa","cofradia","légion","legion","trône","trone","paso","hermandad"]},{slug:"sport-golf",keywords:["golf","green fee","parcours","fairway","buggy","handicap","birdie"]},{slug:"gastronomie",keywords:["restaurant","gastronomie","gastronomique","cuisine","tapas","recette"," vin ","bodega","huile d'olive","chef"," menu","dégustation","degustation"]},{slug:"culture",keywords:["musée","musee","exposition","flamenco","théâtre","theatre","cinéma","cinema","artiste","peintre","picasso","spectacle","concert","livre","auteur"]},{slug:"immobilier",keywords:["immobilier","acheter","louer","prix au m2","logement","hypothèque","hypotheque","notaire"]},{slug:"vie-pratique",keywords:["nie","impôt","impot","fiscal","administration","résidence","residence","sécurité sociale","securite sociale","beckham","autónomo","autonomo","passeport","consulat","visa","banque","heure","horaire"]},{slug:"tourisme",keywords:["voyage","visite","découvrir","decouvrir","escapade","destination","guide","tourisme","randonnée","randonnee","plage","sierra"]},{slug:"environnement",keywords:["environnement","écologie","ecologie","climat","recyclage","durable","aquaponie"," bio "]},{slug:"economie",keywords:["économie","economie","emploi","entreprise","business","startup","investir","pib"]},{slug:"societe",keywords:["société","societe","communauté","communaute","expatrié","expatrie","français","francais","francophone","association"]}],wn=pe=>{const Pe=` ${pe.toLowerCase()} `;for(const Ze of nr)if(Ze.keywords.some(qe=>Pe.includes(qe)))return Ze.slug;return"actualite"},Si=async()=>{Q(!1),fe(!0),ae(null),ye(0);try{const{data:pe}=await Z.from("categories").select("id, name, slug"),Pe=pe??[],Ze=new Map(Pe.map(Xe=>[Xe.slug,Xe])),qe=new Map(Pe.map(Xe=>[Xe.id,Xe])),{data:Ve}=await Z.from("articles").select("id, title, excerpt, category_id").order("created_at",{ascending:!1}),bt=Ve??[];me(bt.length);const Be=[],Nt=50;for(let Xe=0;Xe<bt.length;Xe+=Nt){const Ft=bt.slice(Xe,Xe+Nt);for(const Zt of Ft){const Sr=`${Zt.title||""} ${Zt.excerpt||""}`,Ur=wn(Sr),cs=Ze.get(Ur);if(!cs||Zt.category_id===cs.id)continue;const Os=Zt.category_id?qe.get(Zt.category_id):null;Be.push({article_id:Zt.id,title:Zt.title,current_cat_id:Zt.category_id,current_cat_name:(Os==null?void 0:Os.name)||"â",suggested_cat_id:cs.id,suggested_cat_name:cs.name})}ye(Math.min(Xe+Nt,bt.length)),await new Promise(Zt=>setTimeout(Zt,0))}ae(Be),L(new Set(Be.map(Xe=>Xe.article_id))),Be.length===0?ee.info("Aucune suggestion : toutes les catégories semblent correctes."):ee.success(`${Be.length} suggestion(s) trouvée(s)`)}catch(pe){console.error("Auto-categorize failed:",pe),ee.error(pe.message||"Erreur")}finally{fe(!1)}},it=async pe=>{if(!(!he||pe.length===0)){ne(!0);try{const Pe=new Map(he.map(qe=>[qe.article_id,qe.suggested_cat_id])),Ze=new Map;for(const qe of pe){const Ve=Pe.get(qe);Ve&&(Ze.has(Ve)||Ze.set(Ve,[]),Ze.get(Ve).push(qe))}for(const[qe,Ve]of Ze){const{error:bt}=await Z.from("articles").update({category_id:qe}).in("id",Ve);if(bt)throw bt}ee.success(`${pe.length} article(s) recatégorisé(s)`),ae(qe=>qe&&qe.filter(Ve=>!pe.includes(Ve.article_id))),L(qe=>{const Ve=new Set(qe);return pe.forEach(bt=>Ve.delete(bt)),Ve}),t.invalidateQueries({queryKey:["admin_articles"]})}catch(Pe){ee.error(Pe.message||"Erreur")}finally{ne(!1)}}};return a.jsxs("div",{children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[a.jsxs("h1",{className:"font-heading text-2xl font-bold",children:["Articles ",a.jsxs("span",{className:"text-sm font-normal text-muted-foreground",children:["(",Y.length,")"]})]}),a.jsx(H,{asChild:!0,children:a.jsxs(_e,{to:"/admin/articles/nouveau",children:[a.jsx(dr,{className:"mr-2 h-4 w-4"})," Nouvel article"]})})]}),ce.map(([pe,Pe])=>a.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-3 rounded-lg border border-orange-200 bg-orange-50 px-4 py-3",children:[a.jsx(PW,{className:"h-5 w-5 text-orange-600"}),a.jsxs("span",{className:"text-sm",children:[a.jsx("strong",{children:Pe.count}
1249)," article(s) du ",a.jsxs("strong",{children:["N°",Pe.issue.issue_number]})," (",Pe.issue.title,") prêts à être publiés en ligne"]}),a.jsxs(H,{size:"sm",className:"ml-auto",onClick:()=>P(pe),children:["Publier tous les articles du N°",Pe.issue.issue_number]})]},pe)),a.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[a.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[a.jsx(is,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(ue,{placeholder:"Rechercher un titreâ¦",value:i,onChange:pe=>o(pe.target.value),className:"pl-9 h-9"})]}),a.jsxs("select",{className:"rounded-lg border border-border bg-card px-3 py-1.5 text-sm",value:l,onChange:pe=>c(pe.target.value),children:[a.jsx("option",{value:"all",children:"Tous statuts"}),a.jsx("option",{value:"draft",children:"Brouillon"}),a.jsx("option",{value:"review",children:"En relecture"}),a.jsx("option",{value:"validated",children:"Validé"}),a.jsx("option",{value:"published",children:"Publié"}),a.jsx("option",{value:"archived",children:"Archivé"})]}),a.jsxs("select",{className:"rounded-lg border border-border bg-card px-3 py-1.5 text-sm",value:u,onChange:pe=>d(pe.target.value),children:[a.jsx("option",{value:"all",children:"Toutes destinations"}),a.jsx("option",{value:"web_only",children:"Web"}),a.jsx("option",{value:"paper_only",children:"Magazine"}),a.jsx("option",{value:"web_and_paper",children:"Web + Magazine"})]}),a.jsxs("select",{className:"rounded-lg border border-border bg-card px-3 py-1.5 text-sm",value:h,onChange:pe=>f(pe.target.value),children:[a.jsx("option",{value:"all",children:"Toutes catégories"}),se.map(pe=>a.jsx("option",{value:pe.id,children:pe.name},pe.id))]}),a.jsxs("select",{className:"rounded-lg border border-border bg-card px-3 py-1.5 text-sm",value:p,onChange:pe=>m(pe.target.value),children:[a.jsx("option",{value:"all",children:"Tous magazines"}),a.jsx("option",{value:"none",children:"Non assigné"}),ge.map(pe=>a.jsxs("option",{value:pe.id,children:["N°",pe.issue_number]},pe.id))]}),a.jsxs("select",{className:"rounded-lg border border-border bg-card px-3 py-1.5 text-sm",value:v?"desc":"asc",onChange:pe=>x(pe.target.value==="desc"),children:[a.jsx("option",{value:"desc",children:"Plus récent"}),a.jsx("option",{value:"asc",children:"Plus ancien"})]}),a.jsxs(H,{size:"sm",variant:"outline",className:"h-9",onClick:()=>A(!0),disabled:I,children:[a.jsx(hp,{className:"mr-1.5 h-4 w-4"})," Auto-tagger tous les articles"]}),a.jsxs(H,{size:"sm",variant:"outline",className:"h-9",onClick:()=>Q(!0),disabled:K,children:[a.jsx(U$e,{className:"mr-1.5 h-4 w-4"})," Auto-catégoriser les articles"]})]}),_&&a.jsxs("div",{className:"mt-3 flex items-center justify-between rounded-lg border border-primary/30 bg-primary/5 px-4 py-2 text-sm",children:[a.jsxs("span",{children:["Filtre actif : ",_.size," article(s) récemment taggés"]}),a.jsx(H,{size:"sm",variant:"ghost",onClick:()=>j(null),children:"Tout afficher"})]}),g.size>0&&a.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2 rounded-lg border border-primary/30 bg-primary/5 px-4 py-2.5 text-sm",children:[a.jsxs("span",{className:"font-medium",children:[g.size," sélectionné(s)"]}),a.jsxs("div",{className:"ml-auto flex flex-wrap items-center gap-2",children:[a.jsxs(H,{size:"sm",variant:"outline",onClick:()=>Oe.mutate(),disabled:Oe.isPending,children:[a.jsx(sh,{className:"mr-1.5 h-3.5 w-3.5"})," Publier"]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsxs("select",{className:"rounded-md border border-border bg-card px-2 py-1 text-sm",value:T,onChange:pe=>M(pe.target.value),children:[a.jsx("option",{value:"",children:"â Magazine â"}),ge.map(pe=>a.jsxs("option",{value:pe.id,children:["N°",pe.issue_number]},pe.id))]}),a.jsx(H,{size:"sm",variant:"outline",disabled:!T||Ye.isPending,onClick:()=>Ye.mutate(),children:"Assigner"})]}),a.jsxs(H,{size:"sm",variant:"outline",onClick:()=>st.mutate(),disabled:st.isPending,children:[a.jsx(Efe,{className:"mr-1.5 h-3.5 w-3.5"})," Archiver"]}),a.jsxs(H,{size:"sm",variant:"destructive",onClick:()=>S(!0),children:[a.jsx(tr,{className:"mr-1.5 h-3.5 w-3.5"})," Supprimer"]}),a.jsx(H,{size:"sm",variant:"ghost",onClick:Me,children:"Annuler"})]})]}),J?a.jsx("div",{className:"mt-8 space-y-3",children:[1,2,3].map(pe=>a.jsx("div",{className:"h-14 animate-pulse rounded-lg bg-muted"},pe))}):a.jsx("div",{className:"mt-6 overflow-x-auto rounded-xl border border-border bg-card",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"border-b border-border bg-muted/50",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-3 py-3 w-10",children:a.jsx(wr,{checked:je,onCheckedChange:be})}),a.jsx("th",{className:"px-3 py-3 w-[80px]"}),a.jsx("th",{className:"px-3 py-3 text-left font-medium",children:"Titre"}),a.jsx("th",{className:"px-3 py-3 text-left font-medium",children:"Catégorie"}),a.jsx("th",{className:"px-3 py-3 text-left font-medium",children:"Auteur"}),a.jsx("th",{className:"px-3 py-3 text-left font-medium",children:"Destination"}),a.jsx("th",{className:"px-3 py-3 text-left font-medium",children:"Statut"}),a.jsx("th",{className:"px-3 py-3 text-left font-medium",children:"Publication"}),a.jsx("th",{className:"px-3 py-3 text-right font-medium",children:"Actions"})]})}),a.jsxs("tbody",{children:[de.map(pe=>{var Pe,Ze;return a.jsxs("tr",{className:"border-b border-border last:border-0 hover:bg-muted/30",children:[a.jsx("td",{className:"px-3 py-2.5",children:a.jsx(wr,{checked:g.has(pe.id),onCheckedChange:()=>Ee(pe.id)})}),a.jsx("td",{className:"px-3 py-2.5",children:pe.cover_image_url?a.jsx("img",{src:pe.cover_image_url,alt:"",className:"h-10 w-16 rounded object-cover"}):a.jsx("div",{className:"h-10 w-16 rounded bg-muted"})}),a.jsx("td",{className:"px-3 py-2.5",children:a.jsx(_e,{to:`/admin/articles/${pe.id}/modifier`,className:"font-medium hover:text-primary",children:pe.title})}),a.jsx("td",{className:"px-3 py-2.5",children:((Pe=pe.categories)==null?void 0:Pe.name)&&a.jsx(ke,{variant:"outline",children:pe.categories.name})}),a.jsx("td",{className:"px-3 py-2.5 text-muted-foreground",children:((Ze=pe.author)==null?void 0:Ze.full_name)||pe.author_name||"â"}),a.jsx("td",{className:"px-3 py-2.5",children:pe.destination&&a.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[a.jsx(ke,{className:`${$gt[pe.destination]||""} text-xs`,children:Fgt[pe.destination]}),pe.magazine_issues&&a.jsxs("span",{className:"text-xs text-muted-foreground",children:["N°",pe.magazine_issues.issue_number]})]})}),a.jsx("td",{className:"px-3 py-2.5",children:a.jsx(ke,{className:`${Lgt[pe.status]||""} text-xs`,children:Dgt[pe.status]||pe.status})}),a.jsx("td",{className:"px-3 py-2.5 text-muted-foreground",children:pe.published_at?new Date(pe.published_at).toLocaleDateString("fr-FR"):a.jsx("span",{className:"text-xs",children:"Non publié"})}),a.jsx("td",{className:"px-3 py-2.5",children:a.jsxs("div",{className:"flex items-center justify-end gap-1",children:[a.jsx(H,{variant:"ghost",size:"icon",className:"h-8 w-8",asChild:!0,children:a.jsx(_e,{to:`/admin/articles/${pe.id}/modifier`,children:a.jsx(Oc,{className:"h-3.5 w-3.5"})})}),a.jsx(H,{variant:"ghost",size:"icon",className:"h-8 w-8",title:"Créer le visuel",onClick:()=>{var qe;return k({table:"articles",id:pe.id,slug:pe.slug,title:pe.title,category:(qe=pe.categories)==null?void 0:qe.name,excerpt:pe.excerpt,imageUrl:pe.cover_image_url,caption:pe.social_caption})},children:"ð¨"}),a.jsx(H,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>yt(pe),title:"Dupliquer",children:a.jsx(Pl,{className:"h-3.5 w-3.5"})}),a.jsx(H,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>{w(new Set([pe.id])),S(!0)},title:"Supprimer",children:a.jsx(tr,{className:"h-3.5 w-3.5 text-destructive"})})]})})]},pe.id)}),de.length===0&&a.jsx("tr",{children:a.jsx("td",{colSpan:9,className:"px-3 py-10 text-center text-muted-foreground",children:"Aucun article trouvé."})})]})]})}),a.jsx(VCe,{target:C,open:!!C,onOpenChange:pe=>!pe&&k(null)}),a.jsx(ro,{open:N,onOpenChange:S,children:a.jsxs(ja,{children:[a.jsxs(Sa,{children:[a.jsxs(Ca,{children:["Supprimer ",g.size," article
1249(s) ?"]}),a.jsx(ka,{children:"Cette action est définitive."})]}),a.jsxs(Na,{children:[a.jsx(Ea,{children:"Annuler"}),a.jsx(Aa,{onClick:()=>gt.mutate(),className:"bg-destructive hover:bg-destructive/90",children:gt.isPending?"Suppressionâ¦":"Supprimer"})]})]})}),a.jsx(ro,{open:!!E,onOpenChange:pe=>!pe&&P(null),children:a.jsxs(ja,{children:[a.jsxs(Sa,{children:[a.jsx(Ca,{children:"Publier tous les articles validés de ce magazine ?"}),a.jsx(ka,{children:"Les articles passeront en statut « Publié » avec la date du jour."})]}),a.jsxs(Na,{children:[a.jsx(Ea,{children:"Annuler"}),a.jsx(Aa,{onClick:()=>E&&At.mutate(E),children:"Publier"})]})]})}),a.jsx(ro,{open:R,onOpenChange:A,children:a.jsxs(ja,{children:[a.jsxs(Sa,{children:[a.jsx(Ca,{children:"Auto-tagger tous les articles ?"}),a.jsx(ka,{children:"Cette action va analyser tous les articles sans tags et leur assigner automatiquement des tags. Continuer ?"})]}),a.jsxs(Na,{children:[a.jsx(Ea,{children:"Annuler"}),a.jsx(Aa,{onClick:Qt,children:"Lancer"})]})]})}),a.jsx(an,{open:I||!!U,onOpenChange:pe=>{!pe&&!I&&F(null)},children:a.jsxs(nn,{children:[a.jsxs(on,{children:[a.jsx(ln,{children:I?"Auto-tagging en coursâ¦":"Auto-tagging terminé"}),a.jsx(Eu,{children:I?`${O} / ${B} articles analysés`:U?`${U.analyzed} articles analysés, ${U.tagged} articles taggés, ${U.links} tags assignés au total.`:""})]}),I&&B>0&&a.jsx(Bg,{value:Math.round(O/B*100)}),!I&&U&&U.ids.length>0&&a.jsxs(ss,{children:[a.jsx(H,{variant:"outline",onClick:()=>F(null),children:"Fermer"}),a.jsx(H,{onClick:()=>{j(new Set(U.ids)),F(null)},children:"Voir les résultats"})]})]})}),a.jsx(ro,{open:W,onOpenChange:Q,children:a.jsxs(ja,{children:[a.jsxs(Sa,{children:[a.jsx(Ca,{children:"Auto-catégoriser les articles ?"}),a.jsx(ka,{children:"Cette action va analyser le titre et l'extrait de chaque article pour lui assigner la catégorie la plus pertinente. Les articles dont la catégorie est déjà correcte ne seront pas modifiés. Continuer ?"})]}),a.jsxs(Na,{children:[a.jsx(Ea,{children:"Annuler"}),a.jsx(Aa,{onClick:Si,children:"Lancer l'analyse"})]})]})}),a.jsx(an,{open:K,onOpenChange:()=>{},children:a.jsxs(nn,{children:[a.jsxs(on,{children:[a.jsx(ln,{children:"Analyse des articles en coursâ¦"}),a.jsxs(Eu,{children:[oe," / ",le," articles analysés"]})]}),le>0&&a.jsx(Bg,{value:Math.round(oe/le*100)})]})}),a.jsx(an,{open:!K&&he!==null,onOpenChange:pe=>{pe||ae(null)},children:a.jsxs(nn,{className:"max-w-4xl max-h-[85vh] overflow-hidden flex flex-col",children:[a.jsxs(on,{children:[a.jsx(ln,{children:"Suggestions de catégorisation"}),a.jsxs(Eu,{children:[(he==null?void 0:he.length)||0," suggestion(s). Vérifiez puis acceptez ou ignorez chaque modification."]})]}),he&&he.length>0?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border pb-3",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx(wr,{checked:re.size===he.length,onCheckedChange:pe=>L(pe?new Set(he.map(Pe=>Pe.article_id)):new Set)}),a.jsxs("span",{children:[re.size," / ",he.length," sélectionné(s)"]})]}),a.jsxs(H,{size:"sm",disabled:X||re.size===0,onClick:()=>it(Array.from(re)),children:["Accepter la sélection (",re.size,")"]})]}),a.jsx("div",{className:"overflow-auto flex-1",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"sticky top-0 bg-card border-b border-border",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-2 py-2 w-10"}),a.jsx("th",{className:"px-2 py-2 text-left font-medium",children:"Article"}),a.jsx("th",{className:"px-2 py-2 text-left font-medium",children:"Actuelle"}),a.jsx("th",{className:"px-2 py-2 text-left font-medium",children:"Suggérée"}),a.jsx("th",{className:"px-2 py-2 text-right font-medium",children:"Actions"})]})}),a.jsx("tbody",{children:he.map(pe=>a.jsxs("tr",{className:"border-b border-border last:border-0",children:[a.jsx("td",{className:"px-2 py-2",children:a.jsx(wr,{checked:re.has(pe.article_id),onCheckedChange:()=>{const Pe=new Set(re);Pe.has(pe.article_id)?Pe.delete(pe.article_id):Pe.add(pe.article_id),L(Pe)}})}),a.jsx("td",{className:"px-2 py-2 max-w-xs truncate",title:pe.title,children:pe.title}),a.jsx("td",{className:"px-2 py-2",children:a.jsx(ke,{variant:"outline",children:pe.current_cat_name})}),a.jsx("td",{className:"px-2 py-2",children:a.jsx(ke,{children:pe.suggested_cat_name})}),a.jsx("td",{className:"px-2 py-2",children:a.jsxs("div",{className:"flex items-center justify-end gap-1",children:[a.jsx(H,{size:"sm",variant:"outline",disabled:X,onClick:()=>it([pe.article_id]),children:"Accepter"}),a.jsx(H,{size:"sm",variant:"ghost",onClick:()=>{ae(Pe=>Pe&&Pe.filter(Ze=>Ze.article_id!==pe.article_id)),L(Pe=>{const Ze=new Set(Pe);return Ze.delete(pe.article_id),Ze})},children:"Ignorer"})]})})]},pe.article_id))})]})})]}):a.jsx("div",{className:"py-8 text-center text-muted-foreground",children:"Aucune suggestion : toutes les catégories sont correctes."}),a.jsx(ss,{children:a.jsx(H,{variant:"outline",onClick:()=>ae(null),children:"Fermer"})})]})})]})}const Hse=[{key:"priority",label:"â Priorité haute"},{key:"all",label:"Tous"},{key:"tourisme",label:"Tourisme"},{key:"gastronomie",label:"Gastro"},{key:"art-de-vivre",label:"Art de vivre"},{key:"meteo",label:"Météo"},{key:"immobilier",label:"Immo"},{key:"nature",label:"Nature"}],Bgt={tourisme:"bg-primary/10 text-primary border-primary/20",gastronomie:"bg-accent/10 text-accent border-accent/20","art-de-vivre":"bg-secondary/10 text-secondary border-secondary/20",meteo:"bg-muted text-muted-foreground border-border",immobilier:"bg-primary/5 text-primary border-primary/20",nature:"bg-secondary/5 text-secondary border-secondary/20"};function Ugt(t){return t?new Date(t).toLocaleDateString("fr-FR",{day:"2-digit",month:"long",year:"numeric"}):""}function qgt(t){const e=t?new Date(t):new Date;return isNaN(e.getTime())?"â":e.toISOString().slice(0,10)}function Vgt(t,e){if(t===e)return"Aujourd'hui";const n=new Date(Date.now()-864e5).toISOString().slice(0,10);return t===n?"Hier":new Date(`${t}T12:00:00`).toLocaleDateString("fr-FR",{weekday:"long",day:"numeric",month:"long"})}function Hgt(t){return t>=70?{label:"ð´ Priorité haute",className:"border-accent/40 bg-accent/15 text-accent"}:t>=40?{label:"ð¡ Pertinent",className:"border-primary/30 bg-primary/10 text-primary"}:{label:"⪠à évaluer",className:"border-border bg-muted text-muted-foreground"}}function Wgt(t,e=220){if(!t)return"";const n=t.replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim();return n.length>e?`${n.slice(0,e)}â¦`:n}function Kgt(){const{toast:t}=QE(),e=St(),[n,r]=b.useState("new"),[s,i]=b.useState("all"),[o,l]=b.useState(null),[c,u]=b.useState(null),[d,h]=b.useState(!1),[f,p]=b.useState(""),{data:m=[],isLoading:v}=Ne({queryKey:["press-watch"],queryFn:async()=>{const{data:T,error:M}=await Z.from("press_watch").select("*").order("priority_score",{ascending:!1}).order("published_at",{ascending:!1}).limit(300);if(M)throw M;return T||[]}}),x=b.useMemo(()=>new Date().toISOString().slice(0,10),[]),g=b.useMemo(()=>m.filter(M=>{const R=M.priority_score??0;if(s==="priority"){if(R<70)return!1}else if(s!=="all"&&M.category!==s)return!1;return n==="new"?(M.status??"new")==="new":M.status==="selected"||M.status==="published"}).sort((M,R)=>{const A=(R.priority_score??0)-(M.priority_score??0);if(A!==0)return A;const I=new Date(M.published_at||M.fetched_at||0).getTime();return new Date(R.published_at||R.fetched_at||0).getTime()-I}),[m,s,n]),w=b.useMemo(()=>
1249{if(n!=="new")return[{key:"all",label:"",items:g}];const T=new Map;for(const M of g){const R=qgt(M.published_at||M.fetched_at),A=T.get(R);A?A.push(M):T.set(R,[M])}return[...T.entries()].sort((M,R)=>M[0]===x?-1:R[0]===x?1:R[0].localeCompare(M[0])).map(([M,R])=>({key:M,label:Vgt(M,x),items:R}))},[g,n,x]),_=m.filter(T=>(T.status??"new")==="new").length,j=Qe({mutationFn:async()=>{const{data:T,error:M}=await Z.functions.invoke("fetch-press-articles",{body:{}});if(M)throw M;return T},onSuccess:T=>{t({title:"Veille actualisée",description:`${(T==null?void 0:T.inserted)??0} nouvel(s) article(s) collecté(s).`}),e.invalidateQueries({queryKey:["press-watch"]})},onError:T=>t({title:"Erreur de collecte",description:T.message,variant:"destructive"})}),N=Qe({mutationFn:async T=>{const{data:M,error:R}=await Z.functions.invoke("add-press-url",{body:{url:T}});if(R){const A=M==null?void 0:M.error;throw new Error(A||R.message)}if(M!=null&&M.error)throw new Error(M.error);return M},onSuccess:T=>{t({title:T!=null&&T.duplicate?"Lien déjà dans la veille":"Article ajouté à la veille",description:T!=null&&T.duplicate?T.message??"Il a été remis dans les nouveaux.":`${(T==null?void 0:T.title)??"Article"} â ${(T==null?void 0:T.source_name)??""}`}),p(""),h(!1),r("new"),e.invalidateQueries({queryKey:["press-watch"]})},onError:T=>t({title:"Impossible d'ajouter ce lien",description:T.message,variant:"destructive"})}),S=Qe({mutationFn:async T=>{l(T);const{data:M,error:R}=await Z.functions.invoke("rewrite-article",{body:{press_watch_id:T}});if(R)throw R;return M},onSuccess:()=>{t({title:"Article réécrit",description:"Le brouillon est prêt."}),e.invalidateQueries({queryKey:["press-watch"]})},onError:T=>t({title:"Ãchec de la réécriture",description:T.message,variant:"destructive"}),onSettled:()=>l(null)}),C=Qe({mutationFn:async T=>{const{error:M}=await Z.from("press_watch").delete().eq("id",T);if(M)throw M},onSuccess:()=>e.invalidateQueries({queryKey:["press-watch"]}),onError:T=>t({title:"Erreur",description:T.message,variant:"destructive"})}),k=Qe({mutationFn:async T=>{if(T.draft_article_id){const{error:R}=await Z.from("articles").update({status:"published",published_at:new Date().toISOString()}).eq("id",T.draft_article_id);if(R)throw R}const{error:M}=await Z.from("press_watch").update({status:"published"}).eq("id",T.id);if(M)throw M},onSuccess:()=>{t({title:"Article publié"}),e.invalidateQueries({queryKey:["press-watch"]})},onError:T=>t({title:"Erreur de publication",description:T.message,variant:"destructive"})}),E=new Date().toLocaleDateString("fr-FR",{weekday:"long",day:"numeric",month:"long",year:"numeric"}),P=(T,M)=>{var z;if(o===T.id)return a.jsx(Ke,{className:"border-primary/40",children:a.jsxs(ut,{className:"space-y-3 py-6",children:[a.jsx("p",{className:"text-sm font-medium text-primary",children:"L'IA réécrit l'article à la sauce Esprit Sud⦠âï¸"}),a.jsx(Xt,{className:"h-4 w-3/4"}),a.jsx(Xt,{className:"h-4 w-full"}),a.jsx(Xt,{className:"h-4 w-5/6"})]})},T.id);const R=T.status==="selected"||T.status==="published",A=T.priority_score??0,I=Hgt(A),D=!T.title_fr,O=M||A<40;return a.jsx(Ke,{className:`${R?"border-secondary/40 bg-secondary/5":""} ${O?"opacity-70":""}`,children:a.jsxs(ut,{className:"space-y-3 p-4",children:[T.image_url&&a.jsx("img",{src:T.image_url,alt:T.title_fr||T.title,loading:"lazy",className:"h-40 w-full rounded-md object-cover"}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx(ke,{variant:"outline",className:I.className,children:I.label}),a.jsx(ke,{variant:"outline",children:T.source_name}),T.category&&a.jsx(ke,{variant:"outline",className:Bgt[T.category]||"",children:((z=Hse.find(B=>B.key===T.category))==null?void 0:z.label)||T.category}),D&&!R&&a.jsx(ke,{variant:"outline",className:"text-[10px] uppercase",children:"ES"}),a.jsx("span",{className:"text-xs text-muted-foreground",children:Ugt(T.published_at||T.fetched_at)})]}),a.jsx("h2",{className:"font-serif text-lg font-semibold leading-snug",children:R?T.rewritten_title||T.title_fr||T.title:T.title_fr||T.title}),a.jsx("p",{className:"line-clamp-3 text-sm text-muted-foreground",children:R?Wgt(T.rewritten_content):T.summary_fr||T.summary||""}),a.jsx("div",{className:"flex flex-wrap gap-2 pt-1",children:R?a.jsxs(a.Fragment,{children:[T.draft_article_id&&a.jsx(H,{asChild:!0,size:"sm",variant:"outline",children:a.jsxs(_e,{to:`/admin/articles/${T.draft_article_id}/modifier`,children:[a.jsx(Mu,{className:"mr-2 h-4 w-4"}),"Voir le brouillon"]})}),T.status!=="published"&&a.jsxs(H,{size:"sm",onClick:()=>k.mutate(T),disabled:k.isPending,children:[a.jsx(Jf,{className:"mr-2 h-4 w-4"}),"Publier maintenant"]}),a.jsxs(H,{size:"sm",variant:"outline",onClick:()=>u({table:T.draft_article_id?"articles":"press_watch",id:T.draft_article_id||T.id,slug:null,title:T.rewritten_title||T.title_fr||T.title,category:T.category,excerpt:T.summary_fr||T.summary||"",imageUrl:T.image_url}),children:[a.jsx(RO,{className:"mr-2 h-4 w-4"}),"ð¨ Créer le visuel"]}),T.status==="published"&&a.jsx(ke,{variant:"secondary",children:"Publié"})]}):a.jsxs(a.Fragment,{children:[a.jsxs(H,{size:"sm",onClick:()=>S.mutate(T.id),disabled:S.isPending,children:[a.jsx(hp,{className:"mr-2 h-4 w-4"}),"Réécrire pour Esprit Sud"]}),a.jsxs(H,{size:"sm",variant:"outline",onClick:()=>u({table:"press_watch",id:T.id,slug:null,title:T.title_fr||T.title,category:T.category,excerpt:T.summary_fr||T.summary||"",imageUrl:T.image_url}),children:[a.jsx(RO,{className:"mr-2 h-4 w-4"}),"ð¨ Créer le visuel"]}),a.jsx(H,{asChild:!0,size:"sm",variant:"outline",children:a.jsxs("a",{href:T.source_url,target:"_blank",rel:"noopener noreferrer",children:[a.jsx(Gi,{className:"mr-2 h-4 w-4"}),"Voir l'original"]})}),a.jsxs(H,{size:"sm",variant:"ghost",onClick:()=>C.mutate(T.id),disabled:C.isPending,children:[a.jsx(ks,{className:"mr-2 h-4 w-4"}),"Ignorer"]})]})})]})},T.id)};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("header",{className:"flex flex-wrap items-center justify-between gap-3",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"font-serif text-2xl font-bold text-foreground",children:["Veille Presse â ",E]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Andalousie et Costa del Sol, triées par pertinence et traduites en français."})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[a.jsxs(ke,{variant:"secondary",children:[_," nouveaux"]}),a.jsxs(H,{variant:"outline",onClick:()=>h(!0),children:[a.jsx(dr,{className:"mr-2 h-4 w-4"}),"Proposer un lien"]}),a.jsxs(H,{onClick:()=>j.mutate(),disabled:j.isPending,children:[a.jsx(Ig,{className:`mr-2 h-4 w-4 ${j.isPending?"animate-spin":""}`}),"Actualiser"]})]})]}),a.jsx(an,{open:d,onOpenChange:T=>!N.isPending&&h(T),children:a.jsxs(nn,{className:"sm:max-w-lg",children:[a.jsxs(on,{children:[a.jsx(ln,{children:"Proposer un lien d'article"}),a.jsx(Eu,{children:"Colle l'adresse d'un article repéré ailleurs : titre, résumé, image et traduction française sont récupérés automatiquement, puis il rejoint les nouveaux articles de la veille."})]}),a.jsxs("form",{onSubmit:T=>{T.preventDefault();const M=f.trim();M&&N.mutate(M)}
1249,className:"space-y-4",children:[a.jsx(ue,{autoFocus:!0,type:"url",placeholder:"https://www.diariosur.es/...",value:f,onChange:T=>p(T.target.value),disabled:N.isPending}),a.jsxs(ss,{children:[a.jsx(H,{type:"button",variant:"ghost",onClick:()=>h(!1),disabled:N.isPending,children:"Annuler"}),a.jsx(H,{type:"submit",disabled:!f.trim()||N.isPending,children:N.isPending?a.jsxs(a.Fragment,{children:[a.jsx(Je,{className:"mr-2 h-4 w-4 animate-spin"}),"Lecture de la pageâ¦"]}):"Ajouter à la veille"})]})]})]})}),a.jsx(VCe,{target:c,open:!!c,onOpenChange:T=>!T&&u(null)}),a.jsx(Qi,{value:n,onValueChange:T=>r(T),children:a.jsxs(wi,{children:[a.jsxs(wt,{value:"new",children:["ð Nouveaux (",_,")"]}),a.jsx(wt,{value:"selected",children:"â Sélectionnés"})]})}),a.jsx("div",{className:"flex flex-wrap gap-2",children:Hse.map(T=>a.jsx("button",{onClick:()=>i(T.key),className:`rounded-full border px-3 py-1 text-sm transition-colors ${s===T.key?"border-primary bg-primary text-primary-foreground":"border-border bg-background text-muted-foreground hover:bg-muted"}`,children:T.label},T.key))}),v?a.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:[0,1,2,3].map(T=>a.jsx(Xt,{className:"h-44 w-full"},T))}):g.length===0?a.jsx(Ke,{children:a.jsx(ut,{className:"py-12 text-center text-muted-foreground",children:"Aucun article dans cette vue."})}):a.jsx("div",{className:"space-y-8",children:w.map(T=>{const M=n==="new"&&T.key!==x;return a.jsxs("section",{className:"space-y-3",children:[T.label&&a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-muted-foreground",children:T.label}),a.jsx("span",{className:"h-px flex-1 bg-border"}),a.jsx("span",{className:"text-xs text-muted-foreground",children:T.items.length})]}),a.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:T.items.map(R=>P(R,M))})]},T.key)})})]})}const Wse="https://aanjkhoyzcvhokzsmifu.supabase.co",UP="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImFhbmpraG95emN2aG9renNtaWZ1Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzU0ODIxMTgsImV4cCI6MjA5MTA1ODExOH0.FZffw1trnRiA182HIsLL4uQALqBG6SHIIttPS-tq-Qo";function Ggt({onImport:t,onSplitReference:e}){const[n,r]=b.useState(!1),[s,i]=b.useState("url"),[o,l]=b.useState(""),[c,u]=b.useState(!1),[d,h]=b.useState(""),[f,p]=b.useState(!0),[m,v]=b.useState(!0),[x,g]=b.useState(null),w=()=>{g(null),l(""),h("")},_=async()=>{var k,E;if(o){u(!0);try{const{data:P}=await Z.auth.getSession(),T=await fetch(`${Wse}/functions/v1/scrape-url`,{method:"POST",headers:{"Content-Type":"application/json",apikey:UP,Authorization:`Bearer ${((k=P==null?void 0:P.session)==null?void 0:k.access_token)||UP}`},body:JSON.stringify({url:o})}),M=await T.json();if(!T.ok)throw new Error(M.error||"Ãchec du scraping");if(!M.content_html)throw new Error("Contenu vide");g({title:M.title,content_html:M.content_html,cover_image_url:(E=M.images)==null?void 0:E[0],source:M.source_url}),ee.success("Contenu importé")}catch(P){ee.error(P.message)}finally{u(!1)}}},j=async k=>{var E;u(!0),h("Lecture du PDFâ¦");try{const P=await k.arrayBuffer(),T=await Ac(()=>import("./pdf.min-xK_pe7Lz.js"),[]);T.GlobalWorkerOptions.workerSrc=(await Ac(async()=>{const{default:z}=await import("./pdf.worker.min-B7BB9YL5.js");return{default:z}},[])).default;const M=await T.getDocument({data:P}).promise,R=[],A=[];let I;for(let z=1;z<=M.numPages;z++){h(`Page ${z}/${M.numPages}â¦`);const B=await M.getPage(z),U=(await B.getTextContent()).items.map(F=>F.str).join(" ").replace(/\s+/g," ").trim();if(U&&R.push(U),m){const F=B.getViewport({scale:1.6}),W=document.createElement("canvas");W.width=F.width,W.height=F.height;const Q=W.getContext("2d");await B.render({canvasContext:Q,viewport:F}).promise;const K=await new Promise(fe=>W.toBlob(oe=>fe(oe),"image/jpeg",.85));if(K){const fe=`imports/${Date.now()}-${z}-${k.name.replace(/[^a-zA-Z0-9.]/g,"_")}.jpg`,{error:oe}=await Z.storage.from("images").upload(fe,K,{contentType:"image/jpeg"});if(!oe){const{data:{publicUrl:ye}}=Z.storage.from("images").getPublicUrl(fe);A.push(ye),I||(I=ye)}}}}const D=R.join(` 1250 1251`);let O=D.split(/\n{2,}/).map(z=>`<p>${z.replace(/</g,"<")}</p>`).join(` 1252`);if(f&&D.length>50){h("Mise en page par l'IAâ¦");const{data:z}=await Z.auth.getSession(),B=await fetch(`${Wse}/functions/v1/format-article`,{method:"POST",headers:{"Content-Type":"application/json",apikey:UP,Authorization:`Bearer ${((E=z==null?void 0:z.session)==null?void 0:E.access_token)||UP}`},body:JSON.stringify({text:D,images:A})}),G=await B.json();if(!B.ok)throw new Error(G.error||"Erreur de mise en page");G.html&&(O=G.html)}else A.length&&(O+=` 1253`+A.map(z=>`<figure><img src="${z}" alt="" /></figure>`).join(` 1254`));g({content_html:O,cover_image_url:I,source:k.name}),ee.success(`PDF importé (${M.numPages} page${M.numPages>1?"s":""}${A.length?`, ${A.length} image${A.length>
12541?"s":""}`:""})`)}catch(P){ee.error(`Erreur PDF : ${P.message}`)}finally{u(!1),h("")}},N=async k=>{u(!0);try{const E=`imports/${Date.now()}-${k.name.replace(/[^a-zA-Z0-9.]/g,"_")}`,{error:P}=await Z.storage.from("images").upload(E,k);if(P)throw P;const{data:{publicUrl:T}}=Z.storage.from("images").getPublicUrl(E);g({content_html:`<p><img src="${T}" alt="" /></p>`,cover_image_url:T,source:k.name}),ee.success("Image importée")}catch(E){ee.error(E.message)}finally{u(!1)}},S=()=>{x&&(t(x),w())},C=()=>{x&&(e(x.content_html),x.title&&t({title:x.title,content_html:"",cover_image_url:x.cover_image_url}),w())};return a.jsxs(Z7,{open:n,onOpenChange:r,className:"rounded-xl border border-border bg-muted/40 p-4",children:[a.jsxs(eK,{className:"flex w-full items-center justify-between text-left",children:[a.jsxs("div",{children:[a.jsx("div",{className:"font-semibold",children:"Importer du contenu"}),a.jsx("div",{className:"text-xs text-muted-foreground",children:"Démarrer à partir d'une URL, d'un PDF ou d'une image"})]}),a.jsx(wh,{className:`h-5 w-5 transition-transform ${n?"rotate-180":""}`})]}),a.jsxs(tK,{className:"mt-4 space-y-4",children:[a.jsxs("div",{className:"flex flex-wrap gap-2",children:[a.jsxs(H,{type:"button",size:"sm",variant:s==="url"?"default":"outline",onClick:()=>i("url"),children:[a.jsx(TW,{className:"mr-1.5 h-4 w-4"})," URL"]}),a.jsxs(H,{type:"button",size:"sm",variant:s==="pdf"?"default":"outline",onClick:()=>i("pdf"),children:[a.jsx(W6,{className:"mr-1.5 h-4 w-4"})," PDF"]}),a.jsxs(H,{type:"button",size:"sm",variant:s==="image"?"default":"outline",onClick:()=>i("image"),children:[a.jsx(MO,{className:"mr-1.5 h-4 w-4"})," Image"]})]}),s==="url"&&!x&&a.jsxs("div",{className:"flex gap-2",children:[a.jsx(ue,{type:"url",placeholder:"https://exemple.com/article",value:o,onChange:k=>l(k.target.value),onKeyDown:k=>k.key==="Enter"&&(k.preventDefault(),_())}),a.jsxs(H,{type:"button",onClick:_,disabled:c||!o,children:[c?a.jsx(Je,{className:"h-4 w-4 animate-spin"}):a.jsx(Ts,{className:"h-4 w-4"}),a.jsx("span",{className:"ml-1.5",children:"Récupérer"})]})]}),s==="pdf"&&!x&&a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"space-y-2 rounded-md border border-border bg-background p-3",children:[a.jsxs("label",{className:"flex items-start gap-2 text-sm cursor-pointer",children:[a.jsx(wr,{checked:f,onCheckedChange:k=>p(!!k),disabled:c}),a.jsxs("span",{className:"flex-1",children:[a.jsxs("span",{className:"flex items-center gap-1 font-medium",children:[a.jsx(hp,{className:"h-3.5 w-3.5 text-primary"})," Mise en page automatique (IA)"]}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"Recolle les mots césurés, structure en titres/paragraphes, intercale les images."})]})]}),a.jsxs("label",{className:"flex items-start gap-2 text-sm cursor-pointer",children:[a.jsx(wr,{checked:m,onCheckedChange:k=>v(!!k),disabled:c}),a.jsxs("span",{className:"flex-1",children:[a.jsx("span",{className:"font-medium",children:"Extraire les images des pages"}),a.jsx("span",{className:"block text-xs text-muted-foreground",children:"Chaque page du PDF est convertie en image et uploadée â réutilisable dans l'article."})]})]})]}),a.jsxs("label",{className:"flex cursor-pointer items-center justify-center gap-2 rounded-md border border-dashed border-border bg-background p-6 text-sm text-muted-foreground hover:bg-muted/50",children:[c?a.jsx(Je,{className:"h-4 w-4 animate-spin"}):a.jsx(W6,{className:"h-4 w-4"}),a.jsx("span",{children:c?d||"Extractionâ¦":"Cliquez pour uploader un PDF"}),a.jsx("input",{type:"file",accept:"application/pdf",className:"hidden",onChange:k=>{var E;return((E=k.target.files)==null?void 0:E[0])&&j(k.target.files[0])},disabled:c})]})]}),s==="image"&&!x&&a.jsxs("div",{className:"space-y-2",children:[a.jsxs("label",{className:"flex cursor-pointer items-center justify-center gap-2 rounded-md border border-dashed border-border bg-background p-6 text-sm text-muted-foreground hover:bg-muted/50",children:[c?a.jsx(Je,{className:"h-4 w-4 animate-spin"}):a.jsx(MO,{className:"h-4 w-4"}),a.jsx("span",{children:c?"Uploadâ¦":"Cliquez pour uploader une image"}),a.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:k=>{var E;return((E=k.target.files)==null?void 0:E[0])&&N(k.target.files[0])},disabled:c})]}),a.jsx(H,{type:"button",size:"sm",variant:"ghost",disabled:!0,onClick:()=>ee.info("Bientôt disponible"),children:"Extraire le texte (OCR) â bientôt disponible"})]}),x&&a.jsxs("div",{className:"rounded-lg border border-green-200 bg-green-50 p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"flex items-center gap-2 text-green-800",children:[a.jsx(sh,{className:"h-5 w-5"}),a.jsxs("div",{children:[a.jsx("div",{className:"font-medium",children:"Contenu importé avec succès"}),x.source&&a.jsxs("div",{className:"text-xs text-green-700/80 mt-0.5",children:["Source : ",x.source]})]})]}),a.jsx("button",{type:"button",onClick:w,className:"text-green-700 hover:text-green-900",children:a.jsx(ks,{className:"h-4 w-4"})})]}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[a.jsx(H,{type:"button",size:"sm",onClick:S,children:"Utiliser tel quel"}),a.jsx(H,{type:"button",size:"sm",variant:"outline",onClick:C,children:"Réécrire en article Esprit Sud"})]})]})]})]})}function qP(t){return t.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}const Ygt={draft:"Brouillon",review:"En relecture",validated:"Validé",published:"Publié",archived:"Archivé"},Xgt={draft:"bg-gray-200 text-gray-800",review:"bg-yellow-100 text-yellow-800",validated:"bg-green-100 text-green-800",published:"bg-blue-100 text-blue-800",archived:"bg-red-100 text-red-800"},Kse={title:"",slug:"",category_id:"",content:"",excerpt:"",cover_image_url:"",status:"draft",destination:"web_only",magazine_issue_id:"",pages_planned:"",author_id:"",author_name:"",is_sponsored:!1,sponsor_name:"",disable_adsense:!1,seo_title:"",seo_description:"",reading_time_minutes:null,published_at:""};function Gse(){var G,U;const{id:t}=Xi(),e=!!t,n=Gs(),r=St(),{user:s}=Ji(),[i,o]=b.useState(Kse),[l,c]=b.useState([]),[u,d]=b.useState(""),[h,f]=b.useState(null),[p,m]=b.useState([]),[v,x]=b.useState(!1),[g,w]=b.useState(null),_=b.useRef(null),[j,N]=b.useState(null),{data:S=[]}=Ne({queryKey:["categories"],queryFn:async()=>(await Z.from("categories").select("*").order("sort_order")).data??[]}),{data:C=[]}=Ne({queryKey:["tags"],queryFn:async()=>(await Z.from("tags").select("*").order("name")).data??[]}),{data:k=[]}=Ne({queryKey:["author_profiles"],queryFn:async()=>(await Z.from("profiles").select("id, full_name, email, role").in("role",["admin","redacteur","redacteur_chef"])).data??[]}),{data:E=[]}=Ne({queryKey:["magazine_issues"],queryFn:async()=>(await Z.from("magazine_issues").select("id, issue_number, title").order("issue_number",{ascending:!1})).data??[]}),{data:P}=Ne({queryKey:["admin_article",t],enabled:e,queryFn:async()=>(await Z.from("articles").select("*").eq("id",t).single()).data}),{data:T}=Ne({queryKey:["admin_article_tags",t],enabled:e,queryFn:async()=>(await Z.from("article_tags").select("tag_id").eq("article_id",t)).data??[]});b.useEffect(()=>{P?o({...Kse,...P,cover_image_url:P.cover_image_url??"",published_at:P.published_at?P.published_at.slice(0,16):"",magazine_issue_id:P.magazine_issue_id??"",author_id:P.author_id??"",author_name:P.author_name??"",pages_planned:P.pages_planned??"",destination:P.destination??"web_only"}):s!=null&&s.id&&o(F=>({...F,author_id:s.id}))},[P,s]),b.useEffect(()=>{T&&c(T.map(F=>F.tag_id))},[T]);const M=(F,W)=>{o(Q=>({...Q,[F]:W})),x(!0)};EDe(F=>{v&&(F.preventDefault(),F.returnValue="")}
1254);const R=Qe({mutationFn:async(F={})=>{var fe;const W={...i,...F},Q={title:W.title,slug:W.slug||qP(W.title),content:W.content,excerpt:W.excerpt,cover_image_url:W.cover_image_url||null,category_id:W.category_id||null,author_id:W.author_id||null,author_name:((fe=W.author_name)==null?void 0:fe.trim())||null,status:W.status,destination:W.destination,magazine_issue_id:W.magazine_issue_id||null,pages_planned:W.pages_planned||null,is_sponsored:W.is_sponsored,sponsor_name:W.sponsor_name||null,disable_adsense:!!W.disable_adsense,seo_title:W.seo_title||null,seo_description:W.seo_description||null,reading_time_minutes:W.reading_time_minutes||null,published_at:W.published_at?new Date(W.published_at).toISOString():null};let K=t;if(e){const{error:oe}=await Z.from("articles").update(Q).eq("id",t);if(oe)throw oe}else{const{data:oe,error:ye}=await Z.from("articles").insert(Q).select("id").single();if(ye)throw ye;K=oe.id}return K&&(await Z.from("article_tags").delete().eq("article_id",K),l.length&&await Z.from("article_tags").insert(l.map(oe=>({article_id:K,tag_id:oe})))),K},onSuccess:(F,W)=>{r.invalidateQueries({queryKey:["admin_articles"]}),r.invalidateQueries({queryKey:["admin_article",t]}),x(!1),w(new Date().toLocaleTimeString("fr-FR",{hour:"2-digit",minute:"2-digit"})),W!=null&&W.__navigate?(ee.success(e?"Article mis à jour":"Article créé"),n("/admin/articles")):(W==null?void 0:W.__silent)!==!0&&ee.success("Enregistré"),!e&&F&&n(`/admin/articles/${F}/modifier`,{replace:!0})},onError:F=>ee.error(F.message)});b.useEffect(()=>{if(e)return _.current=setInterval(()=>{v&&i.title&&R.mutate({__silent:!0})},6e4),()=>{_.current&&clearInterval(_.current)}},[e,v,i.title]);const A=async F=>{const W=F.trim();if(!W)return;const Q=C.find(K=>K.name.toLowerCase()===W.toLowerCase());if(Q)l.includes(Q.id)||c([...l,Q.id]);else{const{data:K,error:fe}=await Z.from("tags").insert({name:W,slug:qP(W)}).select("id").single();if(fe){ee.error(fe.message);return}r.invalidateQueries({queryKey:["tags"]}),c([...l,K.id])}d(""),x(!0)},I=(F,W={})=>{o(Q=>({...Q,status:F,...W})),setTimeout(()=>R.mutate({status:F,...W}),0)},D=60-(((G=i.seo_title)==null?void 0:G.length)||0),O=155-(((U=i.seo_description)==null?void 0:U.length)||0),z=b.useMemo(()=>{const F=(i.content||"").replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();return F?F.split(" ").length:0},[i.content]),B=i.destination==="paper_only"||i.destination==="web_and_paper";return a.jsxs("div",{className:"mx-auto w-full max-w-7xl px-0 pb-24 lg:pb-0",children:[a.jsxs("div",{className:"mb-4 flex flex-wrap items-center justify-between gap-3",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("h1",{className:"font-heading text-xl md:text-2xl font-bold truncate",children:e?"Modifier l'article":"Nouvel article"}),a.jsxs("p",{className:"text-xs md:text-sm text-muted-foreground",children:[g&&a.jsxs("span",{className:"text-green-600",children:["Sauvegardé à ",g," · "]}),v?a.jsx("span",{className:"text-orange-600",children:"Modifications non enregistrées"}):"Tout est à jour"]})]}),a.jsxs("div",{className:"hidden md:flex gap-2",children:[a.jsx(H,{variant:"outline",onClick:()=>n("/admin/articles"),children:"Retour"}),a.jsxs(H,{onClick:()=>R.mutate({}),disabled:R.isPending,children:[a.jsx(Ra,{className:"mr-1.5 h-4 w-4"})," ",R.isPending?"Enregistrementâ¦":"Enregistrer"]})]})]}),a.jsxs("div",{className:"grid gap-6 lg:grid-cols-[1fr_340px]",children:[a.jsxs("div",{className:"space-y-5",children:[a.jsx(Ggt,{onImport:({title:F,content_html:W,cover_image_url:Q})=>{o(K=>({...K,title:F||K.title,slug:!e&&F?qP(F):K.slug,content:W||K.content,cover_image_url:Q||K.cover_image_url})),x(!0)},onSplitReference:F=>N(F)}),a.jsxs("div",{className:"rounded-xl border border-border bg-card p-3 sm:p-5 space-y-3",children:[a.jsx("input",{className:"w-full min-w-0 border-none bg-transparent text-lg sm:text-2xl font-bold outline-none placeholder:text-muted-foreground",placeholder:"Titre de l'article",value:i.title,onChange:F=>{M("title",F.target.value),e||M("slug",qP(F.target.value))}}),a.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground min-w-0",children:[a.jsx("span",{className:"shrink-0",children:"URL :"}),a.jsx("input",{className:"flex-1 min-w-0 border-none bg-transparent outline-none truncate",value:i.slug,onChange:F=>M("slug",F.target.value),placeholder:"slug-de-larticle"})]})]}),a.jsxs("div",{className:"rounded-xl border border-border bg-card p-3 sm:p-5",children:[a.jsx(te,{className:"mb-2 block",children:"Image de couverture"}),a.jsx(c0,{value:i.cover_image_url?[i.cover_image_url]:[],onChange:F=>M("cover_image_url",F[0]||""),folder:"articles",single:!0}),a.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:"1200Ã630px recommandé"})]}),a.jsxs("div",{className:"rounded-xl border border-border bg-card p-3 sm:p-5",children:[a.jsx(te,{className:"mb-2 block",children:"Extrait"}),a.jsx("textarea",{className:"min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm",value:i.excerpt,onChange:F=>M("excerpt",F.target.value),rows:2})]}),a.jsxs("div",{className:"rounded-xl border border-border bg-card p-2 sm:p-5",children:[a.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[a.jsx(te,{children:"Contenu"}),j&&a.jsxs(H,{type:"button",size:"sm",variant:"ghost",onClick:()=>N(null),children:[a.jsx(ks,{className:"mr-1 h-3.5 w-3.5"})," Fermer la référence"]})]}),j?a.jsxs("div",{className:"grid gap-3 lg:grid-cols-2",children:[a.jsxs("div",{className:"rounded-md border border-border bg-muted/40 p-3 max-h-[600px] overflow-auto resize-x",children:[a.jsx("div",{className:"mb-2 text-xs font-semibold uppercase text-muted-foreground",children:"Référence (lecture seule)"}),a.jsx("div",{className:"prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:j}})]}),a.jsx(lV,{value:i.content,onChange:F=>M("content",F),onReadingTime:F=>o(W=>({...W,reading_time_minutes:F}))})]}):a.jsx(lV,{value:i.content,onChange:F=>M("content",F),onReadingTime:F=>o(W=>({...W,reading_time_minutes:F})),onAutoSave:e?async F=>{await Z.from("articles").update({content:F}).eq("id",t),w(new Date().toLocaleTimeString("fr-FR",{hour:"2-digit",minute:"2-digit"}))}:void 0})]}),a.jsxs("div",{className:"rounded-xl border border-border bg-card p-3 sm:p-5",children:[a.jsx(te,{className:"mb-2 block",children:"Images de l'article"}),a.jsx(c0,{value:p,onChange:m,folder:"articles/gallery",max:20}),a.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:"Cliquez sur une image puis copiez son URL pour l'insérer dans le contenu."})]})]}),a.jsxs("div",{id:"article-sidebar",className:"space-y-4 scroll-mt-4",children:[a.jsxs("div",{className:"rounded-xl border border-border bg-card p-3 sm:p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{className:"text-base font-semibold",children:"Publication"}),a.jsx(ke,{className:`${Xgt[i.status]||""} text-xs`,children:Ygt[i.status]||i.status})]}),a.jsxs("div",{className:"space-y-2",children:[i.status==="draft"&&a.jsxs(H,{size:"sm",className:"w-full",onClick:()=>I("review"),children:[a.jsx(Jf,{className:"mr-1.5 h-3.5 w-3.5"})," Soumettre en relecture"]}),i.status==="review"&&a.jsxs(a.Fragment,{children:[a.jsxs(H,{size:"sm",className:"w-full",onClick:()=>I("validated"),children:[a.jsx(sh,{className:"mr-1.5 h-3.5 w-3.5"})," Valider"]}),a.jsxs(H,{size:"sm",variant:"outline",className:"w-full",onClick:()=>I("draft"),children:[a.jsx(f5e,{className:"mr-1.5 h-3.5 w-3.5"})," Retourner en brouillon"]})]}),i.status==="validated"&&a.jsxs(a.Fragment,{children:[a.jsx(H,{size:"sm",className:"w-full",onClick:()=>I("published",{published_at:new Date().toISOString().slice(0,16)}),children:"Publier maintenant"}),a.jsxs("div",{children:[a.jsx(te,{className:"text-xs",children:"Programmer pour"}),a.jsx(ue,{type:"datetime-local",value:i.published_at,onChange:F=>M("published_at",F.target.value),className:"h-8 text-sm"}),a.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:[a.jsx(q6,{className:"inline h-3 w-3"})," Reste validé jusqu'à cette date."]})]})]}),i.status==="published"&&a.jsxs(a.Fragment,{children:[a.jsxs(H,{size:"sm",variant:"outline",className:"w-full",onClick:()=>I("validated"),children:[a.jsx(Zy,{className:"mr-1.5 h-3.5 w-3.5"})," Dépublier"]}),a.jsxs(H,{size:"sm",variant:"outline",className:"w-full",onClick:()=>I("archived"),children:[a.jsx(Efe,{className:"mr-1.5 h-3.5 w-3.5"})," Archiver"]})]}),i.status==="archived"&&a.jsx(H,{size:"sm",variant:"outline",className:"w-full",onClick:()=>I("draft"),children:"Restaurer en brouillon"})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-xs",children:"Date de publication"}),a.jsx(ue,{type:"datetime-local",value:i.published_at,onChange:F=>M("published_at",F.target.value),disabled:!["published","validated"].includes(i.status),className:"h-8 text-sm"})]})]}),a.jsxs("div",{className:"rounded-xl border border-border bg-card p-3 sm:p-4 space-y-3",children:[a.jsx(te,{className:"text-base font-semibold",children:"Destination"}),a.jsx("div",{className:"space-y-2 text-sm",children:[{v:"web_only",l:"Web uniquement",d:"Publication sur le site"},{v:"paper_only",l:"Magazine papier",d:"Réservé pour un numéro"},{v:"web_and_paper",l:"Web et papier",d:"En ligne ET dans le magazine"}].map(F=>
1254a.jsxs("label",{className:"flex cursor-pointer items-start gap-2 rounded-md border border-border p-2 hover:bg-muted/30",children:[a.jsx("input",{type:"radio",name:"destination",className:"mt-1",checked:i.destination===F.v,onChange:()=>M("destination",F.v)}),a.jsxs("div",{children:[a.jsx("div",{className:"font-medium",children:F.l}),a.jsx("div",{className:"text-xs text-muted-foreground",children:F.d})]})]},F.v))}),B&&a.jsxs("div",{className:"space-y-2 pt-1",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-xs",children:"Numéro de magazine"}),a.jsxs("select",{className:"w-full rounded-md border border-input bg-background px-2 py-1.5 text-sm",value:i.magazine_issue_id,onChange:F=>M("magazine_issue_id",F.target.value),children:[a.jsx("option",{value:"",children:"Non assigné"}),E.map(F=>a.jsxs("option",{value:F.id,children:["N°",F.issue_number," â ",F.title]},F.id))]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-xs",children:"Pages prévues"}),a.jsx(ue,{value:i.pages_planned,onChange:F=>M("pages_planned",F.target.value),placeholder:"p.24-27",className:"h-8 text-sm"})]})]})]}),a.jsxs("div",{className:"rounded-xl border border-border bg-card p-3 sm:p-4 space-y-3",children:[a.jsx(te,{className:"text-base font-semibold",children:"Catégorie & Tags"}),a.jsxs("div",{children:[a.jsx(te,{className:"text-xs",children:"Catégorie"}),a.jsxs("select",{className:"w-full rounded-md border border-input bg-background px-2 py-1.5 text-sm",value:i.category_id,onChange:F=>M("category_id",F.target.value),children:[a.jsx("option",{value:"",children:"â Choisir â"}),S.map(F=>a.jsx("option",{value:F.id,children:F.name},F.id))]})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{className:"text-xs",children:"Tags"}),a.jsxs(H,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{const F=`${i.title} ${i.excerpt}`,W=LCe(C,F,l).slice(0,12);f(W),W.length===0&&ee.info("Aucun tag pertinent trouvé")},children:[a.jsx(hp,{className:"mr-1 h-3 w-3"})," Suggérer"]})]}),a.jsxs("div",{className:"rounded-md border border-input p-2 space-y-2",children:[a.jsx("div",{className:"flex flex-wrap gap-1",children:l.map(F=>{const W=C.find(Q=>Q.id===F);return W?a.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-primary/10 text-primary px-2 py-0.5 text-xs",children:[W.name,a.jsx("button",{type:"button",onClick:()=>{c(l.filter(Q=>Q!==F)),x(!0)},children:a.jsx(ks,{className:"h-3 w-3"})})]},F):null})}),a.jsx(ue,{placeholder:"Ajouter un tag (Entrée)",value:u,onChange:F=>d(F.target.value),onKeyDown:F=>{F.key==="Enter"&&(F.preventDefault(),A(u))},list:"tag-suggestions",className:"h-8 text-sm"}),a.jsx("datalist",{id:"tag-suggestions",children:C.filter(F=>!l.includes(F.id)).map(F=>a.jsx("option",{value:F.name},F.id))})]}),h&&h.length>0&&a.jsxs("div",{className:"mt-2 rounded-md border border-dashed border-primary/40 bg-primary/5 p-2",children:[a.jsx("p",{className:"mb-1.5 text-xs font-medium text-muted-foreground",children:"Suggestions"}),a.jsx("div",{className:"flex flex-wrap gap-1",children:h.map(F=>a.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-card border border-border px-2 py-0.5 text-xs",children:[F.name,a.jsx("button",{type:"button",title:"Accepter",className:"text-green-600 hover:text-green-800",onClick:()=>{l.includes(F.id)||c([...l,F.id]),f(h.filter(W=>W.id!==F.id)),x(!0)},children:a.jsx(Ma,{className:"h-3 w-3"})}),a.jsx("button",{type:"button",title:"Ignorer",className:"text-muted-foreground hover:text-destructive",onClick:()=>f(h.filter(W=>W.id!==F.id)),children:a.jsx(ks,{className:"h-3 w-3"})})]},F.id))})]})]})]}),a.jsxs("div",{className:"rounded-xl border border-border bg-card p-3 sm:p-4 space-y-3",children:[a.jsx(te,{className:"text-base font-semibold",children:"Auteur"}),a.jsxs("div",{children:[a.jsx(te,{className:"text-xs text-muted-foreground",children:"Compte rédacteur (optionnel)"}),a.jsxs("select",{className:"w-full rounded-md border border-input bg-background px-2 py-1.5 text-sm",value:i.author_id,onChange:F=>M("author_id",F.target.value),children:[a.jsx("option",{value:"",children:"â Aucun â"}),k.map(F=>
1254a.jsx("option",{value:F.id,children:F.full_name||F.email},F.id))]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-xs text-muted-foreground",children:"Nom affiché (champ libre)"}),a.jsx(ue,{value:i.author_name,onChange:F=>M("author_name",F.target.value),placeholder:"Ex. Daniel Moineau, Rédaction Esprit Sudâ¦",maxLength:120}),a.jsx("p",{className:"text-[11px] text-muted-foreground mt-1",children:"Si renseigné, ce nom prévaut sur le compte rédacteur pour l'affichage public."})]})]}),a.jsxs(Z7,{className:"rounded-xl border border-border bg-card",children:[a.jsxs(eK,{className:"flex w-full items-center justify-between p-4",children:[a.jsx(te,{className:"text-base font-semibold cursor-pointer",children:"SEO"}),a.jsx(wh,{className:"h-4 w-4"})]}),a.jsxs(tK,{className:"space-y-3 px-4 pb-4",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{className:"text-xs",children:"Titre SEO"}),a.jsx("span",{className:`text-xs ${D<0?"text-destructive":"text-muted-foreground"}`,children:D})]}),a.jsx(ue,{value:i.seo_title,onChange:F=>M("seo_title",F.target.value),maxLength:70,className:"h-8 text-sm"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{className:"text-xs",children:"Description SEO"}),a.jsx("span",{className:`text-xs ${O<0?"text-destructive":"text-muted-foreground"}`,children:O})]}),a.jsx("textarea",{value:i.seo_description,onChange:F=>M("seo_description",F.target.value),maxLength:170,rows:3,className:"min-h-[60
1254px] w-full rounded-md border border-input bg-background px-2 py-1.5 text-sm"})]}),a.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3",children:[a.jsxs("div",{className:"truncate text-xs text-muted-foreground",children:["esprit-sud.es ⺠actualites ⺠",i.slug||"slug"]}),a.jsx("div",{className:"truncate text-base text-blue-700 mt-0.5",children:i.seo_title||i.title||"Titre de l'article"}),a.jsx("div",{className:"text-xs text-gray-600 line-clamp-2",children:i.seo_description||i.excerpt||"Descriptionâ¦"})]})]})]}),a.jsxs("div",{className:"rounded-xl border border-border bg-card p-3 sm:p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{className:"text-base font-semibold",children:"Article sponsorisé"}),a.jsx(_n,{checked:i.is_sponsored,onCheckedChange:F=>M("is_sponsored",F)})]}),i.is_sponsored&&a.jsx(ue,{placeholder:"Nom du sponsor",value:i.sponsor_name,onChange:F=>M("sponsor_name",F.target.value),className:"h-8 text-sm"})]}),a.jsxs("div",{className:"rounded-xl border border-border bg-card p-3 sm:p-4 space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{className:"text-base font-semibold",children:"Désactiver Google AdSense"}),a.jsx(_n,{checked:i.disable_adsense,onCheckedChange:F=>M("disable_adsense",F)})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Masque uniquement les pubs AdSense sur cet article. Les bannières de la régie interne restent affichées."})]}),e&&P&&a.jsxs("div",{className:"rounded-xl border border-border bg-card p-3 sm:p-4 space-y-2 text-sm",children:[a.jsx(te,{className:"text-base font-semibold",children:"Statistiques"}),a.jsxs("div",{className:"flex justify-between text-muted-foreground",children:[a.jsx("span",{children:"Vues"}),a.jsx("span",{children:P.views_count??0})]}),a.jsxs("div",{className:"flex justify-between text-muted-foreground",children:[a.jsx("span",{children:"Créé le"}),a.jsx("span",{children:new Date(P.created_at).toLocaleDateString("fr-FR")})]}),a.jsxs("div",{className:"flex justify-between text-muted-foreground",children:[a.jsx("span",{children:"Modifié le"}),a.jsx("span",{children:new Date(P.updated_at).toLocaleDateString("fr-FR")})]}),a.jsxs("div",{className:"flex justify-between text-muted-foreground",children:[a.jsx("span",{children:"Mots"}),a.jsx("span",{children:z})]}),a.jsxs("div",{className:"flex justify-between text-muted-foreground",children:[a.jsx("span",{children:"Temps de lecture"}),a.jsxs("span",{children:[i.reading_time_minutes||1," min"]})]})]})]})]}),a.jsxs("div",{className:"fixed bottom-0 left-0 right-0 z-40 flex items-center gap-2 border-t border-border bg-card/95 backdrop-blur px-3 py-2 shadow-lg lg:hidden",style:{paddingBottom:"calc(0.5rem + env(safe-area-inset-bottom))"},children:[a.jsx(H,{variant:"outline",size:"sm",onClick:()=>n("/admin/articles"),"aria-label":"Retour",className:"shrink-0",children:a.jsx(jr,{className:"h-4 w-4"})}),a.jsxs(H,{variant:"outline",size:"sm",onClick:()=>{var F;return(F=document.getElementById("article-sidebar"))==null?void 0:F.scrollIntoView({behavior:"smooth",block:"start"})},className:"shrink-0",children:[a.jsx(m5e,{className:"mr-1.5 h-4 w-4"})," Réglages"]}),a.jsxs(H,{size:"sm",onClick:()=>R.mutate({}),disabled:R.isPending,className:"flex-1",children:[a.jsx(Ra,{className:"mr-1.5 h-4 w-4"})," ",R.isPending?"â¦":"Enregistrer"]})]})]})}function Yse(t){return t.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}const Mz={title:"",slug:"",type:"",description:"",start_date:"",end_date:"",location:"",city:"",external_url:""};function Jgt(){const t=St(),[e,n]=b.useState(!1),[r,s]=b.useState(null),[i,o]=b.useState(Mz),{data:l=[],isLoading:c}=Ne({queryKey:["admin_events"],queryFn:async()=>{const{data:m,error:v}=await Z.from("events").select("*").order("start_date",{ascending:!1});if(v)throw v;return m}}),u=(m,v)=>o(x=>({...x,[m]:v})),d=()=>{o(Mz),s(null),n(!0)},h=m=>{o({...Mz,...m,start_date:m.start_date??"",end_date:m.end_date??"",external_url:m.external_url??""}),s(m.id),n(!0)},f=Qe({mutationFn:async()=>{const m={...i,slug:i.slug||Yse(i.title),start_date:i.start_date||null,end_date:i.end_date||null};if(r){const{error:v}=await Z.from("events").update(m).eq("id",r);
1254if(v)throw v}else{const{error:v}=await Z.from("events").insert(m);if(v)throw v}},onSuccess:()=>{t.invalidateQueries({queryKey:["admin_events"]}),ee.success(r?"Ãvénement mis à jour":"Ãvénement créé"),n(!1)},onError:m=>ee.error(m.message)}),p=Qe({mutationFn:async m=>{const{error:v}=await Z.from("events").delete().eq("id",m);if(v)throw v},onSuccess:()=>{t.invalidateQueries({queryKey:["admin_events"]}),ee.success("Ãvénement supprimé")}});return a.jsxs("div",{children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[a.jsx("h1",{className:"font-heading text-2xl font-bold",children:"Ãvénements"}),a.jsxs(H,{onClick:d,children:[a.jsx(dr,{className:"mr-2 h-4 w-4"})," Nouvel événement"]})]}),c?a.jsx("div",{className:"mt-8 space-y-3",children:[1,2,3].map(m=>a.jsx("div",{className:"h-14 animate-pulse rounded-lg bg-muted"},m))}):a.jsxs("div",{className:"mt-6 space-y-3",children:[l.map(m=>a.jsxs("div",{className:"flex items-center justify-between rounded-xl border border-border bg-card p-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium",children:m.title}),a.jsxs("div",{className:"mt-0.5 flex flex-wrap gap-2 text-xs text-muted-foreground",children:[m.type&&a.jsx(ke,{variant:"outline",className:"text-xs",children:m.type}),m.city&&a.jsx("span",{children:m.city}),m.start_date&&a.jsx("span",{children:new Date(m.start_date).toLocaleDateString("fr-FR")})]})]}),a.jsxs("div",{className:"flex gap-1",children:[a.jsx(H,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>h(m),children:a.jsx(Oc,{className:"h-3.5 w-3.5"})}),a.jsxs(ro,{children:[a.jsx(U3,{asChild:!0,children:a.jsx(H,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive",children:a.jsx(tr,{className:"h-3.5 w-3.5"})})}),a.jsxs(ja,{children:[a.jsxs(Sa,{children:[a.jsx(Ca,{children:"Supprimer cet événement ?"}),a.jsx(ka,{children:"Cette action est irréversible."})]}),a.jsxs(Na,{children:[a.jsx(Ea,{children:"Annuler"}),a.jsx(Aa,{onClick:()=>p.mutate(m.id),children:"Supprimer"})]})]})]})]})]},m.id)),l.length===0&&a.jsx("p",{className:"text-center text-muted-foreground",children:"Aucun événement."})]}),a.jsx(an,{open:e,onOpenChange:n,children:a.jsxs(nn,{className:"max-w-lg",children:[a.jsx(on,{children:a.jsx(ln,{children:r?"Modifier l'événement":"Nouvel événement"})}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(te,{children:"Titre *"}),a.jsx(ue,{value:i.title,onChange:m=>{u("title",m.target.value),r||u("slug",Yse(m.target.value))}})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Type"}),a.jsx(ue,{value:i.type,onChange:m=>u("type",m.target.value),placeholder:"festival, concertâ¦"})]})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Description"}),a.jsx(fn,{value:i.description,onChange:m=>u("description",m.target.value),rows:3})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(te,{children:"Date début"}),a.jsx(ue,{type:"date",value:i.start_date,onChange:m=>u("start_date",m.target.value)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Date fin"}),a.jsx(ue,{type:"date",value:i.end_date,onChange:m=>u("end_date",m.target.value)})]})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(te,{children:"Lieu"}),a.jsx(ue,{value:i.location,onChange:m=>u("location",m.target.value)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Ville"}),a.jsx(ue,{value:i.city,onChange:m=>u("city",m.target.value)})]})]}),a.jsxs("div",{children:[a.jsx(te,{children:"URL externe"}),a.jsx(ue,{value:i.external_url,onChange:m=>u("external_url",m.target.value)})]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx(H,{onClick:()=>f.mutate(),disabled:f.isPending,children:f.isPending?"â¦":"Enregistrer"}),a.jsx(H,{variant:"outline",onClick:()=>n(!1),children:"Annuler"})]})]})]})})]})}const Xse={enabled:!1,url:"https://tufaisquoi.com/api/partners"};async function HCe(t,e){const{data:n}=await Mt.from("site_settings").select("value").eq("key",t).maybeSingle();return(n==null?void 0:n.value)??e}async function WCe(t,e){const{error:n}=await Mt.from("site_settings").upsert({key:t,value:e,updated_at:new Date().toISOString()},{onConflict:"key"});if(n)throw n}function Qgt(){return a.jsxs("div",{className:"mx-auto max-w-3xl space-y-6",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"font-heading text-2xl font-bold",children:"Paramètres"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Paramètres généraux et intégrations."})]}),a.jsxs(Qi,{defaultValue:"general",children:[a.jsxs(wi,{children:[a.jsx(wt,{value:"general",children:"Général"}),a.jsx(wt,{value:"integrations",children:"Intégrations"}),a.jsx(wt,{value:"maps",children:"Google Maps"}),a.jsx(wt,{value:"social",children:"Réseaux sociaux"})]}),a.jsx(kt,{value:"general",className:"mt-6",children:a.jsxs(Ke,{children:[a.jsx(Vt,{children:a.jsx(Ht,{children:"Paramètres généraux"})}),a.jsx(ut,{children:a.jsx("p",{className:"text-sm text-muted-foreground",children:"Les paramètres avancés seront disponibles dans une prochaine version."})})]})}),a.jsx(kt,{value:"integrations",className:"mt-6",children:a.jsx(evt,{})}),a.jsx(kt,{value:"maps",className:"mt-6",children:a.jsx(Zgt,{})}),a.jsx(kt,{value:"social",className:"mt-6",children:a.jsx(tvt,{})})]})]})}const Jse={api_key:""};function Zgt(){const t=St(),{data:e,isLoading:n}=Ne({queryKey:["site_settings","google_maps_config"],queryFn:()=>HCe("google_maps_config",Jse)}),[r,s]=b.useState(Jse),[i,o]=b.useState(!1);b.useEffect(()=>{e&&s(e)},[e]);const l=async()=>{o(!0);try{await WCe("google_maps_config",r),t.invalidateQueries({queryKey:["site_settings","google_maps_config"]}),ee.success("Clé Google Maps enregistrée. Rechargez la page pour l'appliquer.")}catch(c){ee.error(c.message||"Erreur")}finally{o(!1)}};return n?a.jsx(Je,{className:"h-6 w-6 animate-spin"}):a.jsxs(Ke,{children:[a.jsxs(Vt,{children:[a.jsx(Ht,{children:"Clé Google Maps personnalisée"}),a.jsx(mi,{children:"Remplace la clé managée par Lovable (limitée à *.lovable.app) par votre propre clé Google Cloud, autorisée sur espritsud.es. Laissez vide pour revenir à la clé managée."})]}),a.jsxs(ut,{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{children:"Clé API navigateur (Maps JavaScript API)"}),a.jsx(ue,{value:r.api_key,onChange:c=>s({api_key:c.target.value}),placeholder:"AIzaSy...",autoComplete:"off",spellCheck:!1}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Créez la clé dans Google Cloud Console, activez ",a.jsx("strong",{children:"Maps JavaScript API"})," (+ Places / Geocoding si besoin), puis ajoutez ces referrers HTTP : ",a.jsx("code",{children:"https://espritsud.es/*"}),","," ",a.jsx("code",{children:"https://*.espritsud.es/*"}),", ",a.jsx("code",{children:"https://*.lovable.app/*"}),","," ",a.jsx("code",{children:"https://*.lovableproject.com/*"}),"."]})]}),a.jsx("div",{className:"flex justify-end",children:a.jsxs(H,{onClick:l,disabled:i,children:[i?a.jsx(Je,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(Ra,{className:"mr-2 h-4 w-4"}),"Enregistrer"]})})]})]})}function evt(){const t=St(),{data:e,isLoading:n}=Ne({queryKey:["site_settings","tfk_config"],queryFn:()=>HCe("tfk_config",Xse)}),[r,s]=b.useState(Xse),[i,o]=b.useState(!1);b.useEffect(()=>{e&&s(e)},[e]);const l=async()=>{o(!0);try{await WCe("tfk_config",r),t.invalidateQueries({queryKey:["site_settings","tfk_config"]}),t.invalidateQueries({queryKey:["tfk-partners"]}),ee.success("Intégration TuFaisQuoi enregistrée")}catch(c){ee.error(c.message||"Erreur")}finally{o(!1)}};return n?a.jsx(Je,{className:"h-6 w-6 animate-spin"}):a.jsxs(Ke,{children:[a.jsxs(Vt,{children:[a.jsx(Ht,{children:"TuFaisQuoi"}),a.jsx(mi,{children:"Fusionne le carnet d'adresses TuFaisQuoi avec celui d'Esprit Sud sur /carnet-adresses."})]}),a.jsxs(ut,{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(_n,{id:"tfk-enabled",checked:r.enabled,onCheckedChange:c=>s(u=>({...u,enabled:c}))}),a.jsx(te,{htmlFor:"tfk-enabled",children:"Activer l'intégration TuFaisQuoi"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{children:"URL carnet TuFaisQuoi"}),a.jsx(ue,{value:r.url,onChange:c=>s(u=>({...u,url:c.target.value})),placeholder:"https://tufaisquoi.com/api/partners"}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["La page doit contenir un ",a.jsx("code",{children:'<pre id="json-data">'})," avec le JSON des partenaires, ou retourner directement du JSON."]})]}),a.jsx("div",{className:"flex justify-end",children:a.jsxs(H,{onClick:l,disabled:i,children:[i?a.jsx(Je,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(Ra,{className:"mr-2 h-4 w-4"}),"Enregistrer"]})})]})]})}function tvt(){const[t,e]=b.useState(""),[n,r]=b.useState(!1),[s,i]=b.useState(!1),[o,l]=b.useState([]);b.useEffect(()=>{Mt.from("app_settings").select("value").eq("key","buffer_organization_id").maybeSingle().then(({data:d})=>e((d==null?void 0:d.value)||""))},[]);const c=async()=>{r(!0);try{const{error:d}=await Mt.from("app_settings").upsert({key:"buffer_organization_id",value:t,updated_at:new Date().toISOString()},{onConflict:"key"});if(d)throw d;ee.success("Organisation Buffer enregistrée")}catch(d){ee.error(d.message||"Erreur")}finally{r(!1)}},u=async()=>{var d;i(!0);try{const{data:h,error:f}=await Mt.functions.invoke("init-buffer-channels",{body:{}});if(f)throw f;const p=h;if(p.error)throw new Error(p.error);l(p.channels||[]),ee.success(`${((d=p.channels)==null?void 0:d.length)||0} chaîne(s) synchronisée(s)`)}catch(h){ee.error(h.message||"Erreur")}finally{i(!1)}};return a.jsxs(Ke,{children:[a.jsxs(Vt,{children:[a.jsx(Ht,{children:"Buffer"}),a.jsx(mi,{children:"Planification des publications Instagram, Facebook et LinkedIn depuis l'outil de création de visuels."})]}),a.jsxs(ut,{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{children:"Clé API Buffer"}),a.jsx(ue,{value:"â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢",readOnly:!0,t
1254ype:"password"}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["La clé ",a.jsx("code",{children:"BUFFER_API_KEY"})," est stockée dans les secrets Supabase (Buffer â Settings â API) et n'est jamais exposée au navigateur."]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{children:"Identifiant d'organisation Buffer"}),a.jsx(ue,{value:t,onChange:d=>e(d.target.value),placeholder:"org_...",spellCheck:!1})]}),a.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[a.jsxs(H,{variant:"outline",onClick:c,disabled:n,children:[n?a.jsx(Je,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(Ra,{className:"mr-2 h-4 w-4"}),"Enregistrer"]}),a.jsxs(H,{onClick:u,disabled:s,children:[s?a.jsx(Je,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Synchroniser les chaînes"]})]}),o.length>0&&a.jsx("div",{className:"space-y-1 text-sm",children:o.map(d=>a.jsxs("div",{children:["â
",d.service," â ",d.name]},d.id))})]})]})}const $0=b.forwardRef(({className:t,...e},n)=>a.jsx("div",{className:"relative w-full overflow-auto",children:a.jsx("table",{ref:n,className:Fe("w-full caption-bottom text-sm",t),...e})}));$0.displayName="Table";const z0=b.forwardRef(({className:t,...e},n)=>a.jsx("thead",{ref:n,className:Fe("[&_tr]:border-b",t),...e}));z0.displayName="TableHeader";const B0=b.forwardRef(({className:t,...e},n)=>a.jsx("tbody",{ref:n,className:Fe("[&_tr:last-child]:border-0",t),...e}));B0.displayName="TableBody";const nvt=b.forwardRef(({className:t,...e},n)=>a.jsx("tfoot",{ref:n,className:Fe("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...e}));nvt.displayName="TableFooter";const qi=b.forwardRef(({className:t,...e},n)=>a.jsx("tr",{ref:n,className:Fe("border-b transition-colors data-[state=selected]:bg-muted hover:bg-muted/50",t),...e}));qi.displayName="TableRow";const Cn=b.forwardRef(({className:t,...e},n)=>a.jsx("th",{ref:n,className:Fe("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t),...e}));Cn.displayName="TableHead";const hn=b.forwardRef(({className:t,...e},n)=>a.jsx("td",{ref:n,className:Fe("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...e}));hn.displayName="TableCell";const rvt=b.forwardRef(({className:t,...e},n)=>a.jsx("caption",{ref:n,className:Fe("mt-4 text-sm text-muted-foreground",t),...e}));rvt.displayName="TableCaption";var svt="Separator",Qse="horizontal",ivt=["horizontal","vertical"],KCe=b.forwardRef((t,e)=>{const{decorative:n,orientation:r=Qse,...s}=t,i=avt(r)?r:Qse,l=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return a.jsx(et.div,{"data-orientation":i,...l,...s,ref:e})});KCe.displayName=svt;function avt(t){return ivt.includes(t)}var GCe=KCe;const lj=b.forwardRef(({className:t,orientation:e="horizontal",decorative:n=!0,...r},s)=>a.jsx(GCe,{ref:s,decorative:n,orientation:e,className:Fe("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...r}));lj.displayName=GCe.displayName;async function $2(t,e){const{data:n,error:r}=await Mt.from("site_settings").select("value").eq("key",t).maybeSingle();return r?e:(n==null?void 0:n.value)??e}async function z2(t,e){const{error:n}=await Mt.from("site_settings").upsert({key:t,value:e,updated_at:new Date().toISOString()},{onConflict:"key"});if(n)throw n}const Zse={spain:{display_name:"Espagne",countries:"Espagne (péninsule + Baléares). Canaries, Ceuta et Melilla exclus.",is_active:!0},france:{display_name:"France",countries:"France métropolitaine, Monaco, Andorre",is_active:!0},europe:{display_name:"Europe",countries:"Allemagne, Belgique, Italie, Portugal, Pays-Bas, Luxembourg, Autriche, Suisse...",is_active:!0}},eie=[{zone:"spain",name:"Correos",tracking_format:"XX0000000000XX",tracking_url:"https://www.correos.es/es/es/herramientas/localizador/envios/detalle?tracking-number={tracking}",notes:""},{zone:"france",name:"Colissimo",tracking_format:"0A000000000X",tracking_url:"https://www.laposte.fr/outils/suivre-vos-envois?code={tracking}",notes:""},{zone:"europe",name:"DHL",tracking_format:"",tracking_url:"https://www.dhl.com/fr-fr/home/tracking.html?tracking-id={tracking}",notes:""}
1254],Rz={rates:[{country:"Espagne",standard:21,reduced:4,applies_to:"Livres, magazines, journaux"},{country:"France",standard:20,reduced:2.1,applies_to:"Presse / livres"},{country:"Europe",standard:21,reduced:6,applies_to:"Selon pays de destination"}],apply_destination:!1,display_with_tax:!0,vat_number:"",distance_sales_threshold:1e4},VP={order_confirmed:{active:!0,subject:"Merci pour votre commande #{order_number} - Esprit Sud",description:"Envoyé après paiement réussi"},order_shipped:{active:!0,subject:"Votre commande #{order_number} a été expédiée !",description:"Envoyé quand le statut passe à 'shipped'. Inclut le numéro et lien de suivi."},order_delivered:{active:!0,subject:"Votre commande #{order_number} a été livrée",description:"Envoyé quand le statut passe à 'delivered'"},carte_welcome:{active:!0,subject:"Bienvenue dans le club Esprit Sud ! Votre Carte Privilège est active",description:"Envoyé après souscription Carte Privilège"},carte_expiring:{active:!0,subject:"Votre Carte Privilège expire bientôt",description:"Envoyé 30 jours avant expiration"},new_partner:{active:!1,subject:"Nouveau partenaire Carte Privilège : {partner_name}",description:"Envoyé aux abonnés Carte quand un nouveau partenaire rejoint"}},DS={name:"Boutique Esprit Sud",email:"[email protected]",phone:"",address:{line1:"",line2:"",postal_code:"",city:"",country:"Espagne"},vat_number:"",return_policy:"Droit de rétractation de 14 jours à compter de la réception. Les produits numériques (PDF) ne sont pas remboursables une fois téléchargés. Les expériences sont annulables jusqu'à 48h avant la date réservée."};function ovt(){return a.jsxs("div",{className:"mx-auto max-w-6xl space-y-6",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"font-heading text-2xl font-bold",children:"Paramètres de la boutique"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Configurez la livraison, les taxes, les e-mails et les informations générales."})]}),a.jsxs(Qi,{defaultValue:"shipping",className:"w-full",children:[a.jsxs(wi,{className:"grid w-full grid-cols-2 md:grid-cols-5",children:[a.jsx(wt,{value:"shipping",children:"Livraison"}),a.jsx(wt,{value:"carriers",children:"Transporteurs"}),a.jsx(wt,{value:"tax",children:"TVA / Taxes"}),a.jsx(wt,{value:"emails",children:"E-mails"}),a.jsx(wt,{value:"general",children:"Général"})]}),a.jsx(kt,{value:"shipping",className:"mt-6",children:a.jsx(lvt,{})}),a.jsx(kt,{value:"carriers",className:"mt-6",children:a.jsx(cvt,{})}),a.jsx(kt,{value:"tax",className:"mt-6",children:a.jsx(uvt,{})}),a.jsx(kt,{value:"emails",className:"mt-6",children:a.jsx(dvt,{})}),a.jsx(kt,{value:"general",className:"mt-6",children:a.jsx(hvt,{})})]})]})}function lvt(){const t=St(),{data:e=[],isLoading:n}=Ne({queryKey:["admin_shipping_rates"],queryFn:async()=>{const{data:p,error:m}=await Mt.from("shipping_rates").select("*").order("zone");if(m)throw m;return p||[]}}),{data:r=Zse}=Ne({queryKey:["site_settings","shipping_meta"],queryFn:()=>$2("shipping_meta",Zse)}),[s,i]=b.useState([]),[o,l]=b.useState({}),[c,u]=b.useState(!1);b.useEffect(()=>{i(e)},[e]),b.useEffect(()=>{l(r)},[r]);const d=(p,m)=>i(v=>v.map((x,g)=>g===p?{...x,...m}:x)),h=(p,m)=>l(v=>({...v,[p]:{...v[p],...m}})),f=async()=>{u(!0);try{for(const p of s){const{error:m}=await Mt.from("shipping_rates").update({shipping_cost:Number(p.shipping_cost),estimated_days_min:Number(p.estimated_days_min),estimated_days_max:Number(p.estimated_days_max),free_above:p.free_above?Number(p.free_above):null}).eq("id",p.id);if(m)throw m}await z2("shipping_meta",o),ee.success("Paramètres de livraison enregistrés"),t.invalidateQueries({queryKey:["admin_shipping_rates"]}),t.invalidateQueries({queryKey:["shipping_rates"]})}catch(p){ee.error(p.message||"Erreur lors de la sauvegarde")}finally{u(!1)}};return n?a.jsx(Je,{className:"h-6 w-6 animate-spin"}):a.jsxs("div",{className:"space-y-6",children:[a.jsxs(Ke,{children:[a.jsxs(Vt,{children:[a.jsx(Ht,{children:"Zones de livraison"}),a.jsx(mi,{children:"Modifiez les frais et délais pour chaque zone. Les changements sont immédiats sur la boutique."})]}),a.jsxs(ut,{children:[a.jsxs($0,{children:[a.jsx(z0,{children:a.jsxs(qi,{children:[a.jsx(Cn,{children:"Zone"}),a.jsx(Cn,{children:"Nom affiché"}),a.jsx(Cn,{children:"Frais (â¬)"}),a.jsx(Cn,{children:"Délai min"}),a.jsx(Cn,{children:"Délai max"}),a.jsx(Cn,{children:"Gratuit dès (â¬)"}),a.jsx(Cn,{children:"Actif"})]})}),a.jsx(B0,{children:s.map((p,m)=>{var v,x;return a.jsxs(qi,{children:[a.jsx(hn,{className:"font-mono text-xs uppercase",children:p.zone}),a.jsx(hn,{children:a.jsx(ue,{value:((v=o[p.zone])==null?void 0:v.display_name)??"",onChange:g=>h(p.zone,{display_name:g.target.value}),className:"w-32"})}),a.jsx(hn,{children:a.jsx(ue,{type:"number",step:"0.01",value:p.shipping_cost??"",onChange:g=>d(m,{shipping_cost:g.target.value}),className:"w-24"})}),a.jsx(hn,{children:a.jsx(ue,{type:"number",value:p.estimated_days_min??"",onChange:g=>d(m,{estimated_days_min:g.target.value}),className:"w-20"})}),a.jsx(hn,{children:a.jsx(ue,{type:"number",value:p.estimated_days_max??"",onChange:g=>d(m,{estimated_days_max:g.target.value}),className:"w-20"})}),a.jsx(hn,{children:a.jsx(ue,{type:"number",step:"0.01",value:p.free_above??"",onChange:g=>d(m,{free_above:g.target.value}),className:"w-24"})}),a.jsx(hn,{children:a.jsx(_n,{checked:((x=o[p.zone])==null?void 0:x.is_active)??!0,onCheckedChange:g=>h(p.zone,{is_active:g})})})]}
1254,p.id)})})]}),a.jsx(lj,{className:"my-6"}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("h3",{className:"text-sm font-semibold",children:"Pays couverts par zone"}),s.map(p=>{var m;return a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{className:"text-xs uppercase text-muted-foreground",children:p.zone}),a.jsx(fn,{rows:2,value:((m=o[p.zone])==null?void 0:m.countries)??"",onChange:v=>h(p.zone,{countries:v.target.value})})]},p.id)})]})]})]}),a.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-border bg-muted/30 p-4 text-sm",children:[a.jsx(n2,{className:"mt-0.5 h-4 w-4 shrink-0 text-primary"}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{children:"Les produits numériques (PDF) et les expériences ne génèrent pas de frais de livraison."}),a.jsx("p",{children:"Si le panier ne contient que des produits numériques ou des expériences, les frais de livraison sont automatiquement à 0 â¬."})]})]}),a.jsx("div",{className:"flex justify-end",children:a.jsxs(H,{onClick:f,disabled:c,children:[c?a.jsx(Je,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(Ra,{className:"mr-2 h-4 w-4"}),"Enregistrer les modifications"]})})]})}function cvt(){const t=St(),{data:e=eie,isLoading:n}=Ne({queryKey:["site_settings","shipping_carriers"],queryFn:()=>$2("shipping_carriers",eie)}),[r,s]=b.useState([]),[i,o]=b.useState(!1);b.useEffect(()=>{s(e)},[e]);const l=(h,f)=>s(p=>p.map((m,v)=>v===h?{...m,...f}:m)),c=()=>s(h=>[...h,{zone:"",name:"",tracking_url:"",tracking_format:"",notes:""}]),u=h=>s(f=>f.filter((p,m)=>m!==h)),d=async()=>{o(!0);try{await z2("shipping_carriers",r),ee.success("Transporteurs enregistrés"),t.invalidateQueries({queryKey:["site_settings","shipping_carriers"]})}catch(h){ee.error(h.message)}finally{o(!1)}};return n?a.jsx(Je,{className:"h-6 w-6 animate-spin"}):a.jsxs("div",{className:"space-y-6",children:[a.jsxs(Ke,{children:[a.jsxs(Vt,{children:[a.jsx(Ht,{children:"Transporteurs par zone"}),a.jsxs(mi,{children:["Utilisez ",a.jsx("code",{className:"rounded bg-muted px-1",children:"{tracking}"})," dans l'URL pour insérer le numéro de suivi."]})]}),a.jsxs(ut,{className:"space-y-4",children:[r.map((h,f)=>a.jsxs("div",{className:"grid gap-3 rounded-lg border border-border p-4 md:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{children:"Zone"}),a.jsx(ue,{value:h.zone,onChange:p=>l(f,{zone:p.target.value}),placeholder:"spain / france / europe"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{children:"Transporteur"}),a.jsx(ue,{value:h.name,onChange:p=>l(f,{name:p.target.value}),placeholder:"Correos, Colissimo..."})]}),a.jsxs("div",{className:"space-y-1 md:col-span-2",children:[a.jsx(te,{children:"URL de suivi"}),a.jsx(ue,{value:h.tracking_url,onChange:p=>l(f,{tracking_url:p.target.value}),placeholder:"https://.../{tracking}"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{children:"Format n° de suivi"}),a.jsx(ue,{value:h.tracking_format??"",onChange:p=>l(f,{tracking_format:p.target.value}),placeholder:"XX0000000000XX"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{children:"Notes internes"}),a.jsx(ue,{value:h.notes??"",onChange:p=>l(f,{notes:p.target.value})})]}),a.jsx("div",{className:"md:col-span-2 flex justify-end",children:a.jsxs(H,{variant:"ghost",size:"sm",onClick:()=>u(f),children:[a.jsx(tr,{className:"mr-1 h-4 w-4"})," Supprimer"]})})]},f)),a.jsxs(H,{variant:"outline",onClick:c,children:[a.jsx(dr,{className:"mr-2 h-4 w-4"})," Ajouter un transporteur"]})]})]}),a.jsx("div",{className:"flex justify-end",children:a.jsxs(H,{onClick:d,disabled:i,children:[i?a.jsx(Je,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(Ra,{className:"mr-2 h-4 w-4"}),"Enregistrer"]})})]})}function uvt(){const t=St(),{data:e=Rz,isLoading:n}=Ne({queryKey:["site_settings","tax_config"],queryFn:()=>$2("tax_config",Rz)}),[r,s]=b.useState(Rz),[i,o]=b.useState(!1);b.useEffect(()=>{s(e)},[e]);const l=(u,d)=>s(h=>({...h,rates:h.rates.map((f,p)=>p===u?{...f,...d}:f)})),c=async()=>{o(!0);try{await z2("tax_config",r),ee.success("Configuration TVA enregistrée"),t.invalidateQueries({queryKey:["site_settings","tax_config"]})}catch(u){ee.error(u.message)}finally{o(!1)}};return n?a.jsx(Je,{className:"h-6 w-6 animate-spin"}):a.jsxs("div",{className:"space-y-6",children:[a.jsxs(Ke,{children:[a.jsx(Vt,{children:a.jsx(Ht,{children:"Taux de TVA applicables"})}),a.jsx(ut,{children:a.jsxs($0,{children:[a.jsx(z0,{children:a.jsxs(qi,{children:[a.jsx(Cn,{children:"Pays"}),a.jsx(Cn,{children:"Standard (%)"}),a.jsx(Cn,{children:"Réduit (%)"}),a.jsx(Cn,{children:"Appliqué sur"})]})}),a.jsx(B0,{children:r.rates.map((u,d)=>a.jsxs(qi,{children:[a.jsx(hn,{children:a.jsx(ue,{value:u.country,onChange:h=>l(d,{country:h.target.value}),className:"w-32"})}),a.jsx(hn,{children:a.jsx(ue,{type:"number",step:"0.1",value:u.standard,onChange:h=>l(d,{standard:Number(h.target.value)}),className:"w-24"})}),a.jsx(hn,{children:a.jsx(ue,{type:"number",step:"0.1",value:u.reduced,onChange:h=>l(d,{reduced:Number(h.target.value)}),className:"w-24"})}),a.jsx(hn,{children:a.jsx(ue,{value:u.applies_to,onChange:h=>l(d,{applies_to:h.target.value})})})]},d))})]})})]}),a.jsxs(Ke,{children:[a.jsx(Vt,{children:a.jsx(Ht,{children:"Configuration"})}),a.jsxs(ut,{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx(te,{children:"Appliquer la TVA du pays de destination"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Pour les ventes B2C intra-UE au-delà du seuil"})]}),a.jsx(_n,{checked:r.apply_destination,onCheckedChange:u=>s({...r,apply_destination:u})})]}),a.jsx(lj,{}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx(te,{children:"Prix affichés TTC"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Les prix sur le site incluent la TVA"})]}),a.jsx(_n,{checked:r.display_with_tax,onCheckedChange:u=>s({...r,display_with_tax:u})})]}),a.jsx(lj,{}),a.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{children:"Numéro de TVA / NIF"}),a.jsx(ue,{value:r.vat_number,onChange:u=>s({...r,vat_number:u.target.value}),placeholder:"ESB12345678"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{children:"Seuil ventes à distance (â¬)"}),a.jsx(ue,{type:"number",value:r.distance_sales_threshold,onChange:u=>s({...r,distance_sales_threshold:Number(u.target.value)})})]})]})]})]}),a.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-border bg-muted/30 p-4 text-sm",children:[a.jsx(n2,{className:"mt-0.5 h-4 w-4 shrink-0 text-primary"}),a.jsx("p",{children:"En tant qu'entreprise espagnole vendant à des particuliers en UE, la TVA espagnole (IVA) s'applique tant que le seuil de 10 000 ⬠de ventes annuelles vers un pays n'est pas dépassé."})]}),a.jsx("div",{className:"flex justify-end",children:a.jsxs(H,{onClick:c,disabled:i,children:[i?a.jsx(Je,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(Ra,{className:"mr-2 h-4 w-4"}),"Enregistrer"]})})]})}function dvt(){const t=St(),{data:e=VP,isLoading:n}=Ne({queryKey:["site_settings","email_config"],queryFn:()=>$2("email_config",VP)}),[r,s]=b.useState(VP),[i,o]=b.useState(!1);b.useEffect(()=>{s({...VP,...e})},[e]);const l=(u,d)=>s(h=>({...h,[u]:{...h[u],...d}})),c=async()=>{o(!0);try{await z2("email_config",r),ee.success("Configuration e-mail enregistrée"),t.invalidateQueries({queryKey:["site_settings","email_config"]})}catch(u){ee.error(u.message)}finally{o(!1)}};return n?a.jsx(Je,{className:"h-6 w-6 animate-spin"}):a.jsxs("div",{className:"space-y-6",children:[a.jsxs(Ke,{children:[a.jsxs(Vt,{children:[a.jsx(Ht,{children:"E-mail
1254s automatiques"}),a.jsx(mi,{children:"Activez/désactivez chaque e-mail et personnalisez l'objet."})]}),a.jsx(ut,{className:"space-y-4",children:Object.entries(r).map(([u,d])=>a.jsxs("div",{className:"rounded-lg border border-border p-4",children:[a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx("p",{className:"font-medium capitalize",children:u.replace(/_/g," ")}),a.jsx("p",{className:"text-xs text-muted-foreground",children:d.description})]}),a.jsx(_n,{checked:d.active,onCheckedChange:h=>l(u,{active:h})})]}),a.jsxs("div",{className:"mt-3 space-y-1",children:[a.jsx(te,{className:"text-xs",children:"Objet de l'e-mail"}),a.jsx(ue,{value:d.subject,onChange:h=>l(u,{subject:h.target.value})})]})]},u))})]}),a.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-border bg-muted/30 p-4 text-sm",children:[a.jsx(n2,{className:"mt-0.5 h-4 w-4 shrink-0 text-primary"}),a.jsx("p",{children:"Les e-mails sont envoyés automatiquement. La mise en page des e-mails sera personnalisable dans une future mise à jour."})]}),a.jsx("div",{className:"flex justify-end",children:a.jsxs(H,{onClick:c,disabled:i,children:[i?a.jsx(Je,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(Ra,{className:"mr-2 h-4 w-4"}),"Enregistrer"]})})]})}function hvt(){const t=St(),{data:e=DS,isLoading:n}=Ne({queryKey:["site_settings","store_info"],queryFn:()=>$2("store_info",DS)}),[r,s]=b.useState(DS),[i,o]=b.useState(!1);b.useEffect(()=>{s({...DS,...e,address:{...DS.address,...(e==null?void 0:e.address)||{}}})},[e]);const{data:l=[]}=Ne({queryKey:["active_promo_codes"],queryFn:async()=>{const{data:u,error:d}=await Mt.from("promo_codes").select("*").eq("is_active",!0).order("code");if(d)throw d;return u||[]}}),c=async()=>{o(!0);try{await z2("store_info",r),ee.success("Informations de la boutique enregistrées"),t.invalidateQueries({queryKey:["site_settings","store_info"]})}catch(u){ee.error(u.message)}finally{o(!1)}};return n?a.jsx(Je,{className:"h-6 w-6 animate-spin"}):a.jsxs("div",{className:"space-y-6",children:[a.jsxs(Ke,{children:[a.jsx(Vt,{children:a.jsx(Ht,{children:"Informations de la boutique"})}),a.jsxs(ut,{className:"space-y-4",children:[a.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{children:"Nom de la boutique"}),a.jsx(ue,{value:r.name,onChange:u=>s({...r,name:u.target.value})})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{children:"E-mail de contact"}),a.jsx(ue,{type:"email",value:r.email,onChange:u=>s({...r,email:u.target.value})})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{children:"Téléphone"}),a.jsx(ue,{value:r.phone,onChange:u=>s({...r,phone:u.target.value})})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{children:"Numéro de TVA / CIF"}),a.jsx(ue,{value:r.vat_number,onChange:u=>s({...r,vat_number:u.target.value})})]})]}),a.jsx(lj,{}),a.jsx("p",{className:"text-sm font-semibold",children:"Adresse de l'expéditeur"}),a.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1 md:col-span-2",children:[a.jsx(te,{children:"Ligne 1"}),a.jsx(ue,{value:r.address.line1,onChange:u=>s({...r,address:{...r.address,line1:u.target.value}})})]}),a.jsxs("div",{className:"space-y-1 md:col-span-2",children:[a.jsx(te,{children:"Ligne 2"}),a.jsx(ue,{value:r.address.line2,onChange:u=>s({...r,address:{...r.address,line2:u.target.value}})})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{children:"Code postal"}),a.jsx(ue,{value:r.address.postal_code,onChange:u=>s({...r,address:{...r.address,postal_code:u.target.value}})})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{children:"Ville"}),a.jsx(ue,{value:r.address.city,onChange:u=>s({...r,address:{...r.address,city:u.target.value}})})]}),a.jsxs("div",{className:"space-y-1 md:col-span-2",children:[a.jsx(te,{children:"Pays"}),a.jsx(ue,{value:r.address.country,onChange:u=>s({...r,address:{...r.address,country:u.target.value}})})]})]})]})]}),a.jsxs(Ke,{children:[a.jsx(Vt,{children:a.jsx(Ht,{children:"Devise"})}),a.jsx(ut,{children:a.jsx("p",{className:"text-sm",children:"EUR (â¬) â non modifiable pour l'instant."})})]}),a.jsxs(Ke,{children:[a.jsxs(Vt,{children:[a.jsx(Ht,{children:"Politique de retour"}),a.jsx(mi,{children:"Affichée sur chaque fiche produit et dans les CGV."})]}),a.jsx(ut,{children:a.jsx(fn,{rows:5,value:r.return_policy,onChange:u=>s({...r,return_policy:u.target.value})})})]}),a.jsxs(Ke,{children:[a.jsxs(Vt,{children:[a.jsx(Ht,{children:"Codes promo actifs"}),a.jsxs(mi,{children:[l.length," code",l.length>
12541?"s":""," actif",l.length>1?"s":""]})]}),a.jsx(ut,{children:l.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:"Aucun code promo actif."}):a.jsxs($0,{children:[a.jsx(z0,{children:a.jsxs(qi,{children:[a.jsx(Cn,{children:"Code"}),a.jsx(Cn,{children:"Type"}),a.jsx(Cn,{children:"Valeur"}),a.jsx(Cn,{children:"Utilisations"})]})}),a.jsx(B0,{children:l.map(u=>a.jsxs(qi,{children:[a.jsx(hn,{className:"font-mono font-semibold",children:u.code}),a.jsx(hn,{children:u.discount_type==="percent"?"%":"â¬"}),a.jsx(hn,{children:u.discount_value}),a.jsxs(hn,{children:[u.current_uses??0,u.max_uses?` / ${u.max_uses}`:""]})]},u.id))})]})})]}),a.jsx("div",{className:"flex justify-end",children:a.jsxs(H,{onClick:c,disabled:i,children:[i?a.jsx(Je,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(Ra,{className:"mr-2 h-4 w-4"}),"Enregistrer"]})})]})}function fvt(){const{user:t,profile:e,loading:n}=Ji(),r=e==null?void 0:e.role,i=!!r&&["admin","staff","redacteur","redacteur_chef","commercial","gestionnaire_boutique"].includes(r);return{user:t,profile:e,isAdmin:i,isLoading:n}}const pvt={"Actualités Esprit Sud Magazine":"actualite","Actualités Esprit Golf":"sport-golf","Actualités Semaine Sainte":"semaine-sainte","Esprit à table":"gastronomie","Esprit Livre":"culture","Une oeuvre, un artiste":"culture","Guides Voyage":"tourisme","Nos magazines":"actualite",Malaga:"tourisme",Almeria:"tourisme"};function HP(t){return(t||"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim().replace(/\s+/g," ")}function GN(t){return(t||"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-").replace(/-+/g,"-").slice(0,200)||`article-${Date.now()}`}function tie(t){if(!t)return null;try{const e=new URL(t).pathname.split("/").filter(Boolean),n=e[e.length-1];if(!n)return null;const r=GN(n);return r.length>=6?r:null}catch{return null}}function mvt(t){return t?t.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"").replace(/\s(style|class|id|target|rel)="[^"]*"/gi,"").replace(/\sdata-[a-z0-9-]+="[^"]*"/gi,"").replace(/<(div|span)>\s*<\/\1>/gi,"").replace(/\s{2,}/g," ").trim():""}function gvt(t){return(t||"").replace(/<[^>]+>/g," ").replace(/ /g," ").replace(/\s+/g," ").trim()}function vvt(){var ae;const{isAdmin:t,isLoading:e}=fvt(),n=b.useRef(null),[r,s]=b.useState([]),[i,o]=b.useState([]),[l,c]=b.useState(!1),[u,d]=b.useState(0),[h,f]=b.useState(0),[p,m]=b.useState(null),[v,x]=b.useState([]),[g,w]=b.useState([]),[_,j]=b.useState(new Set),[N,S]=b.useState({}),[C,k]=b.useState({}),[E,P]=b.useState("url_then_title"),[T,M]=b.useState("published"),[R,A]=b.useState("web_and_paper"),[I,D]=b.useState(!0),[O,z]=b.useState(new Set),[B,G]=b.useState(null);if(b.useEffect(()=>{(async()=>{const[re,L,X]=await Promise.all([Mt.from("categories").select("id, slug, name").order("name"),Mt.from("profiles").select("id, full_name, role"),Mt.from("articles").select("slug")]);x(re.data||[]),w(L.data||[]),j(new Set((X.data||[]).map(ne=>ne.slug)))})()},[]),e)return a.jsx("div",{className:"p-6",children:"Chargement..."});if(!t)return a.jsx(ms,{to:"/",replace:!0});const U=((ae=g.find(re=>re.role==="admin"))==null?void 0:ae.id)||"",F=b.useMemo(()=>{const re={};return v.forEach(L=>re[L.slug]=L.id),re},[v]),W=b.useMemo(()=>{const re={};return g.forEach(L=>L.full_name&&(re[HP(L.full_name)]=L.id)),re},[g]),Q=b.useMemo(()=>{const re={};return r.forEach(L=>{const X=(L.category||"â").trim()||"â";re[X]=re[X]||{count:0,sample_slug:L.category_slug,sample_name:L.category_name},re[X].count++}),Object.entries(re).sort((L,X)=>X[1].count-L[1].count)},[r]),K=b.useMemo(()=>{const re={};return r.forEach(L=>{const X=(L.author||"â").trim()||"â";re[X]=(re[X]||0)+1}),Object.entries(re).sort((L,X)=>X[1]-L[1])},[r]);b.useEffect(()=>{if(!r.length||!v.length)return;const re={};Q.forEach(([X,ne])=>{const Y=ne.sample_slug&&F[ne.sample_slug]?ne.sample_slug:pvt[X.trim()]||"actualite";re[X]=F[Y]||F.actualite||""}),S(re);const L={};K.forEach(([X])=>{const ne=HP(X);L[X]=W[ne]||U||""}),k(L)},[r,v,g]);const fe=async re=>{var ne;const L=(ne=re.target.files)==null?void 0:ne[0];if(!L)return;const X=await L.text();try{const Y=JSON.parse(X),J=Array.isArray(Y)?Y:[];s(J),o([`Fichier chargé : ${J.length} articles trouvés.`]),d(0),f(0),m(null),G(null)}catch(Y){o([`Erreur parsing JSON : ${Y.message}`])}},oe=(re,L,X,ne)=>{const Y=mvt(re.content_html||""),J=re.content_text&&String(re.content_text).trim()||gvt(Y),se=J.split(/\s+/).filter(
1254Boolean).length,ge=Math.max(2,Math.round(se/200)),de=(re.category||"â").trim()||"â",ce=N[de]&&N[de]!=="__skip"?N[de]:null,xe=(re.author||"â").trim()||"â",je=C[xe]&&C[xe]!=="__skip"?C[xe]:U,be=(re.title||"Sans titre").trim();let Ee;switch(E){case"title_only":Ee=GN(be);break;case"url_only":Ee=tie(re.url)||GN(be);break;case"id_prefix":Ee=`${re.article_id||L}-${GN(be)}`.slice(0,200);break;default:Ee=tie(re.url)||GN(be)}let Me=Ee,Oe=1;for(;ne.has(Me);)Me=`${Ee}-${++Oe}`;ne.add(Me);const st=re.summary&&String(re.summary).trim()||"",Ye=st||J.slice(0,250),gt=/sponsoris|publi[- ]reportage|partenaire/i.test(de);return{title:be,slug:Me,content:Y,excerpt:Ye,cover_image_url:re.image_hd||re.image_thumb||re.image_local||null,category_id:ce,author_id:je,status:T,destination:R,reading_time_minutes:ge,published_at:re.date_raw||re.date_iso||null,views_count:(X-L)*3,is_sponsored:gt,seo_title:be.slice(0,60),seo_description:(st||J).slice(0,155)}},ye=()=>{const re=new Set,L=r.length;let X=0,ne=0,Y=0,J=0,se=0,ge=0;const de=[],ce=[];r.forEach((je,be)=>{const Ee=(je.category||"â").trim()||"â";if(O.has(Ee)){Y++;return}const Me=oe(je,be,L,re);if(Me.category_id||J++,Me.author_id||se++,Me.cover_image_url||ge++,_.has(Me.slug)){if(I){Y++;return}ne++}else X++;de.length<5&&de.push({source:je,mapped:Me})});const xe=new Set;re.forEach(je=>xe.add(je)),G({total:L,toCreate:X,toUpdate:ne,skipped:Y,missingCat:J,missingAuthor:se,missingImage:ge,uniqueSlugs:re.size,samples:de,collisions:ce,catBreakdown:Object.entries(r.reduce((je,be)=>{var Ye;const Ee=(be.category||"â").trim()||"â",Me=N[Ee],Oe=Me==="__skip"?"(ignoré)":((Ye=v.find(gt=>gt.id===Me))==null?void 0:Ye.name)||"(?)",st=`${Ee} â ${Oe}`;return je[st]=(je[st]||0)+1,je},{})).sort((je,be)=>be[1]-je[1]),authorBreakdown:Object.entries(r.reduce((je,be)=>{var Ye;const Ee=(be.author||"â").trim()||"â",Me=C[Ee],Oe=Me==="__skip"?"(ignoré)":((Ye=g.find(gt=>gt.id===Me))==null?void 0:Ye.full_name)||"(?)",st=`${Ee||"(vide)"} â ${Oe}`;return je[st]=(je[st]||0)+1,je},{})).sort((je,be)=>be[1]-je[1])})},le=async()=>{c(!0),d(0),f(0),o(ce=>[...ce,"Démarrage de l'import..."]);const re=r.length,L=new Set,ne=r.filter(ce=>!O.has((ce.category||"â").trim()||"â")).map((ce,xe)=>oe(ce,xe,re,L)),Y=I?ne.filter(ce=>!_.has(ce.slug)):ne,J=25;let se=0,ge=0;for(let ce=0;ce<Y.length;ce+=J){const xe=Y.slice(ce,ce+J),{error:je}=await Mt.from("articles").upsert(xe,{onConflict:"slug"});je?(ge+=xe.length,o(be=>[...be,`Lot ${Math.floor(ce/J)+1} erreur : ${je.message}`])):se+=xe.length,d(se),f(ge)}const{count:de}=await Mt.from("articles").select("*",{count:"exact",head:!0});m(de||0),o(ce=>[...ce,`Import terminé. ${se} traités, ${ge} erreurs, ${re-Y.length} ignorés (déjà existants).`]),c(!1)},me=r.length,he=me?Math.round((u+h)/me*100):0;return a.jsxs("div",{className:"space-y-6 max-w-5xl",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-bold",children:"Import d'articles avancé"}),a.jsxs("p",{className:"text-muted-foreground text-sm",children:["Importer un fichier ",a.jsx("code",{children:"articles.json"}),", ajuster les mappings, prévisualiser puis écrire en base."]})]}),a.jsxs(Ke,{className:"p-6 space-y-4",children:[a.jsx("h2",{className:"font-semibold",children:"1. Fichier source"}),a.jsx("input",{ref:n,type:"file",accept:"application/json,.json",onChange:fe,className:"hidden"}),a.jsxs("div",{className:"flex gap-3 flex-wrap items-center",children:[a.jsx(H,{onClick:()=>{var re;return(re=n.current)==null?void 0:re.click()},variant:"outline",disabled:l,children:"Choisir un fichier"}),me>0&&a.jsxs("span",{className:"text-sm text-muted-foreground",children:[a.jsx("strong",{children:me})," articles détectés."]})]})]}),me>0&&a.jsxs(Ke,{className:"p-6 space-y-3",children:[a.jsx("h2",{className:"font-semibold",children:"2. Mapping des catégories"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Chaque catégorie source pointe vers une catégorie cible. « Retirer » exclut tous les articles de cette catégorie de l'import."}),O.size>0&&a.jsxs("button",{className:"text-xs underline text-muted-foreground self-start",onClick:()=>z(new Set),children:["Réintégrer les ",O.size," catégorie(s) retirée(s)"]}),a.jsx("div",{className:"overflow-auto rounded border",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"bg-muted",children:a.jsxs("tr",{children:[a.jsx("th",{className:"text-left px-3 py-2",children:"Catégorie source"}),a.jsx("th",{className:"text-left px-3 py-2",children:"Articles"}),a.jsx("th",{className:"text-left px-3 py-2",children:"Slug source"}),a.jsx("th",{className:"text-left px-3 py-2",children:"â Cible"}),a.jsx("th",{className:"px-3 py-2"})]})}),a.jsx("tbody",{children:Q.filter(([re])=>!O.has(re)).map(([re,L])=>
1254a.jsxs("tr",{className:"border-t",children:[a.jsx("td",{className:"px-3 py-2",children:re}),a.jsx("td",{className:"px-3 py-2",children:L.count}),a.jsx("td",{className:"px-3 py-2 text-muted-foreground",children:L.sample_slug||"â"}),a.jsx("td",{className:"px-3 py-2",children:a.jsxs("select",{className:"rounded border px-2 py-1 text-sm w-full",value:N[re]||"",onChange:X=>S({...N,[re]:X.target.value}),children:[a.jsx("option",{value:"__skip",children:"â Ignorer â"}),v.map(X=>a.jsx("option",{value:X.id,children:X.name},X.id))]})}),a.jsx("td",{className:"px-3 py-2",children:a.jsx("button",{className:"text-xs text-destructive hover:underline whitespace-nowrap",onClick:()=>{const X=new Set(O);X.add(re),z(X)},title:"Exclure tous les articles de cette catégorie",children:"Retirer"})})]},re))})]})})]}),me>0&&a.jsxs(Ke,{className:"p-6 space-y-3",children:[a.jsx("h2",{className:"font-semibold",children:"3. Mapping des auteurs"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Les auteurs sans correspondance sont assignés à l'admin par défaut."}),a.jsxs("div",{className:"overflow-auto rounded border max-h-96",children:[a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"bg-muted sticky top-0",children:a.jsxs("tr",{children:[a.jsx("th",{className:"text-left px-3 py-2",children:"Auteur source"}),a.jsx("th",{className:"text-left px-3 py-2",children:"Articles"}),a.jsx("th",{className:"text-left px-3 py-2",children:"â Profil cible"})]})}),a.jsx("tbody",{children:K.map(([re,L])=>{const X=C[re]||"",ne=g.find(Y=>Y.id===X);return a.jsxs("tr",{className:"border-t",children:[a.jsx("td",{className:"px-3 py-2",children:re||a.jsx("em",{className:"text-muted-foreground",children:"(vide)"})}),a.jsx("td",{className:"px-3 py-2",children:L}),a.jsxs("td",{className:"px-3 py-2",children:[a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{list:"profiles-datalist",className:"rounded border px-2 py-1 text-sm flex-1",placeholder:"Tape un nom d'auteurâ¦",defaultValue:(ne==null?void 0:ne.full_name)||re||"",onBlur:Y=>{const J=Y.target.value.trim();if(!J){k({...C,[re]:U});return}const se=g.find(ge=>HP(ge.full_name||"")===HP(J));k({...C,[re]:(se==null?void 0:se.id)||U})}},re),a.jsx("select",{className:"rounded border px-2 py-1 text-sm w-44",value:X,onChange:Y=>k({...C,[re]:Y.target.value}),children:g.map(Y=>a.jsxs("option",{value:Y.id,children:[Y.full_name||Y.id.slice(0,8)," ",Y.role==="admin"?"(admin)":""]},Y.id))})]}),X&&!ne&&a.jsx("div",{className:"text-xs text-destructive mt-1",children:"Profil introuvable"})]})]},re)})})]}),a.jsx("datalist",{id:"profiles-datalist",children:g.map(re=>re.full_name&&a.jsx("option",{value:re.full_name},re.id))})]})]}),me>0&&a.jsxs(Ke,{className:"p-6 space-y-4",children:[a.jsx("h2",{className:"font-semibold",children:"4. Options"}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-xs",children:"Stratégie de slug"}),a.jsxs("select",{className:"rounded border px-2 py-1 text-sm w-full mt-1",value:E,onChange:re=>P(re.target.value),children:[a.jsx("option",{value:"url_then_title",children:"URL source en priorité, sinon titre"}),a.jsx("option",{value:"url_only",children:"URL source uniquement"}),a.jsx("option",{value:"title_only",children:"Titre uniquement"}),a.jsx("option",{value:"id_prefix",children:"article_id + titre (toujours unique)"})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-xs",children:"Statut par défaut"}),a.jsxs("select",{className:"rounded border px-2 py-1 text-sm w-full mt-1",value:T,onChange:re=>M(re.target.value),children:[a.jsx("option",{value:"published",children:"Publié"}),a.jsx("option",{value:"draft",children:"Brouillon"})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-xs",children:"Destination"}),a.jsxs("select",{className:"rounded border px-2 py-1 text-sm w-full mt-1",value:R,onChange:re=>A(re.target.value),children:[a.jsx("option",{value:"web_and_paper",children:"Web + papier"}),a.jsx("option",{value:"web_only",children:"Web uniquement"})]})]}),a.jsxs("label",{className:"flex items-center gap-2 text-sm mt-6",children:[a.jsx("input",{type:"checkbox",checked:I,onChange:re=>D(re.target.checked)}),"Ignorer les articles dont le slug existe déjà (",_.size," en base)"]})]})]}),me>0&&a.jsxs(Ke,{className:"p-6 space-y-4",children:[a.jsx("h2",{className:"font-semibold",children:"5. Aperçu et import"}),a.jsxs("div",{className:"flex gap-3 flex-wrap",children:[a.jsx(H,{variant:"outline",onClick:ye,disabled:l,children:"Aperçu (dry run)"}),a.jsx(H,{onClick:le,disabled:l,children:l?"Import en coursâ¦":"Lancer l'import en base"})]}
1254),B&&a.jsxs("div",{className:"space-y-4 mt-2 text-sm",children:[a.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[a.jsx(Pp,{label:"Total",value:B.total}),a.jsx(Pp,{label:"à créer",value:B.toCreate,accent:!0}),a.jsx(Pp,{label:"à mettre à jour",value:B.toUpdate}),a.jsx(Pp,{label:"Ignorés (déjà en base)",value:B.skipped}),a.jsx(Pp,{label:"Sans catégorie",value:B.missingCat,warn:B.missingCat>0}),a.jsx(Pp,{label:"Sans auteur",value:B.missingAuthor,warn:B.missingAuthor>0}),a.jsx(Pp,{label:"Sans image",value:B.missingImage}),a.jsx(Pp,{label:"Slugs uniques",value:B.uniqueSlugs})]}),a.jsxs("details",{className:"rounded border p-3",children:[a.jsxs("summary",{className:"cursor-pointer font-medium",children:["Répartition catégories (",B.catBreakdown.length,")"]}),a.jsx("ul",{className:"mt-2 space-y-0.5 text-xs",children:B.catBreakdown.map(([re,L])=>a.jsxs("li",{className:"flex justify-between",children:[a.jsx("span",{children:re}),a.jsx("span",{className:"font-mono",children:L})]},re))})]}),a.jsxs("details",{className:"rounded border p-3",children:[a.jsxs("summary",{className:"cursor-pointer font-medium",children:["Répartition auteurs (",B.authorBreakdown.length,")"]}),a.jsx("ul",{className:"mt-2 space-y-0.5 text-xs max-h-72 overflow-auto",children:B.authorBreakdown.map(([re,L])=>a.jsxs("li",{className:"flex justify-between",children:[a.jsx("span",{children:re}),a.jsx("span",{className:"font-mono",children:L})]},re))})]}),a.jsxs("details",{className:"rounded border p-3",children:[a.jsx("summary",{className:"cursor-pointer font-medium",children:"5 exemples mappés"}),a.jsx("div",{className:"mt-2 space-y-3",children:B.samples.map((re,L)=>a.jsx("div",{className:"rounded bg-muted p-2 text-xs font-mono whitespace-pre-wrap break-all",children:JSON.stringify({slug:re.mapped.slug,title:re.mapped.title,category_id:re.mapped.category_id,author_id:re.mapped.author_id,published_at:re.mapped.published_at,cover:re.mapped.cover_image_url},null,2)},L))})]})]}),(l||u>0||h>0)&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(Bg,{value:he}),a.jsxs("div",{className:"text-sm text-muted-foreground",children:[u," importés · ",h," erreurs · ",me," total (",he,"%)"]})]}),p!==null&&a.jsxs("div",{className:"rounded-md bg-primary/10 text-primary p-4 text-sm",children:["â Import terminé. ",a.jsx("strong",{children:p})," articles en base au total."]})]}),i.length>0&&a.jsxs(Ke,{className:"p-4",children:[a.jsx("h2",{className:"font-semibold mb-2 text-sm",children:"Logs"}),a.jsx("div",{className:"bg-muted rounded p-3 text-xs font-mono max-h-80 overflow-y-auto space-y-1",children:i.map((re,L)=>a.jsx("div",{children:re},L))})]})]})}function Pp({label:t,value:e,accent:n,warn:r}){return a.jsxs("div",{className:`rounded border p-3 ${n?"border-primary bg-primary/5":r?"border-destructive/40 bg-destructive/5":""}`,children:[a.jsx("div",{className:"text-xs text-muted-foreground",children:t}),a.jsx("div",{className:"text-xl font-bold",children:e})]})}function uV(t){return(t||"").toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}
1254const xvt={name:"",slug:"",description:"",parent_id:null,sort_order:0};function yvt(){const t=St(),[e,n]=b.useState(null),[r,s]=b.useState(null),{data:i=[],isLoading:o}=Ne({queryKey:["admin_categories"],queryFn:async()=>{const{data:h,error:f}=await Z.from("categories").select("*").order("sort_order");if(f)throw f;return h}}),{data:l={}}=Ne({queryKey:["admin_category_counts"],queryFn:async()=>{const{data:h}=await Z.from("articles").select("category_id"),f={};return(h||[]).forEach(p=>{p.category_id&&(f[p.category_id]=(f[p.category_id]||0)+1)}),f}}),c=Qe({mutationFn:async h=>{const f={name:h.name,slug:h.slug||uV(h.name),description:h.description||null,parent_id:h.parent_id||null,sort_order:Number(h.sort_order)||0};if(h.id){const{error:p}=await Z.from("categories").update(f).eq("id",h.id);if(p)throw p}else{const{error:p}=await Z.from("categories").insert(f);if(p)throw p}},onSuccess:()=>{t.invalidateQueries({queryKey:["admin_categories"]}),t.invalidateQueries({queryKey:["categories"]}),ee.success("Catégorie enregistrée"),n(null)},onError:h=>ee.error(h.message)}),u=Qe({mutationFn:async h=>{const{error:f}=await Z.from("categories").delete().eq("id",h);if(f)throw f},onSuccess:()=>{t.invalidateQueries({queryKey:["admin_categories"]}),ee.success("Catégorie supprimée"),s(null)},onError:h=>ee.error(h.message)}),d=h=>{if((l[h.id]||0)>0){ee.error(`Impossible : ${l[h.id]} article(s) lié(s)`);return}s(h)};return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsxs("p",{className:"text-sm text-muted-foreground",children:[i.length," catégorie(s)"]}),a.jsxs(H,{onClick:()=>n({...xvt}),size:"sm",children:[a.jsx(dr,{className:"h-4 w-4"})," Nouvelle catégorie"]})]}),a.jsx("div",{className:"rounded-lg border border-border bg-card overflow-hidden",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"bg-muted/50 text-left",children:a.jsxs("tr",{children:[a.jsx("th",{className:"p-3",children:"Nom"}),a.jsx("th",{className:"p-3",children:"Slug"}),a.jsx("th",{className:"p-3 w-20",children:"Ordre"}),a.jsx("th",{className:"p-3 w-24",children:"Articles"}),a.jsx("th",{className:"p-3 w-28 text-right",children:"Actions"})]})}),a.jsxs("tbody",{children:[o&&a.jsx("tr",{children:a.jsx("td",{colSpan:5,className:"p-6 text-center text-muted-foreground",children:"Chargementâ¦"})}),!o&&i.length===0&&a.jsx("tr",{children:a.jsx("td",{colSpan:5,className:"p-6 text-center text-muted-foreground",children:"Aucune catégorie"})}),i.map(h=>a.jsxs("tr",{className:"border-t border-border",children:[a.jsx("td",{className:"p-3 font-medium",children:h.name}),a.jsx("td",{className:"p-3 text-muted-foreground font-mono text-xs",children:h.slug}),a.jsx("td",{className:"p-3",children:h.sort_order??0}),a.jsx("td",{className:"p-3",children:l[h.id]||0}),a.jsx("td",{className:"p-3",children:a.jsxs("div",{className:"flex gap-1 justify-end",children:[a.jsx(H,{variant:"ghost",size:"icon",onClick:()=>n(h),children:a.jsx(Oc,{className:"h-4 w-4"})}),a.jsx(H,{variant:"ghost",size:"icon",onClick:()=>d(h),children:a.jsx(tr,{className:"h-4 w-4"})})]})})]},h.id))]})]})}),a.jsx(an,{open:!!e,onOpenChange:h=>!h&&n(null),children:a.jsxs(nn,{children:[a.jsx(on,{children:a.jsx(ln,{children:e!=null&&e.id?"Modifier la catégorie":"Nouvelle catégorie"})}),e&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(te,{children:"Nom *"}),a.jsx(ue,{value:e.name||"",onChange:h=>n({...e,name:h.target.value,slug:e.id?e.slug:uV(h.target.value)})})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Slug"}),a.jsx(ue,{value:e.slug||"",onChange:h=>n({...e,slug:h.target.value})})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Description"}),a.jsx("textarea",{className:"flex min-h-[70px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm",value:e.description||"",onChange:h=>n({...e,description:h.target.value})})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx(te,{children:"Catégorie parente"}),a.jsxs("select",{className:"w-full rounded-lg border border-border px-3 py-2 text-sm",value:e.parent_id||"",onChange:h=>n({...e,parent_id:h.target.value||null}),children:[a.jsx("option",{value:"",children:"â Aucune â"}),i.filter(h=>h.id!==e.id).map(h=>a.jsx("option",{value:h.id,children:h.name},h.id))]})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Ordre d'affichage"}),a.jsx(ue,{type:"number",value:e.sort_order??0,onChange:h=>n({...e,sort_order:parseInt(h.target.value)||0})})]})]})]}),a.jsxs(ss,{children:[a.jsx(H,{variant:"outline",onClick:()=>n(null),children:"Annuler"}),a.jsx(H,{onClick:()=>e&&c.mutate(e),disabled:!(e!=null&&e.name)||c.isPending,children:c.isPending?"Enregistrementâ¦":"Enregistrer"})]})]})}),a.jsx(ro,{open:!!r,onOpenChange:h=>!h&&s(null),children:a.jsxs(ja,{children:[a.jsxs(Sa,{children:[a.jsx(Ca,{children:"Supprimer cette catégorie ?"}),a.jsxs(ka,{children:["Cette action est irréversible. La catégorie « ",r==null?void 0:r.name," » sera supprimée."]})]}),a.jsxs(Na,{children:[a.jsx(Ea,{children:"Annuler"}),a.jsx(Aa,{onClick:()=>r&&u.mutate(r.id),children:"Supprimer"})]})]})})]})}function bvt(){const t=St(),[e,n]=b.useState(""),[r,s]=b.useState(null),{data:i=[]}=Ne({queryKey:["admin_tags"],queryFn:async()=>{const{data:u}=await Z.from("tags").select("*").order("name");return u||[]}}),{data:o={}}=Ne({queryKey:["admin_tag_counts"],queryFn:async()=>{const{data:u}=await Z.from("article_tags").select("tag_id"),d={};
1254return(u||[]).forEach(h=>{d[h.tag_id]=(d[h.tag_id]||0)+1}),d}}),l=Qe({mutationFn:async u=>{const{error:d}=await Z.from("tags").insert({name:u,slug:uV(u)});if(d)throw d},onSuccess:()=>{t.invalidateQueries({queryKey:["admin_tags"]}),t.invalidateQueries({queryKey:["tags"]}),n(""),ee.success("Tag ajouté")},onError:u=>ee.error(u.message)}),c=Qe({mutationFn:async u=>{const{error:d}=await Z.from("tags").delete().eq("id",u);if(d)throw d},onSuccess:()=>{t.invalidateQueries({queryKey:["admin_tags"]}),ee.success("Tag supprimé"),s(null)},onError:u=>ee.error(u.message)});return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex gap-2",children:[a.jsx(ue,{placeholder:"Nom du tag",value:e,onChange:u=>n(u.target.value),onKeyDown:u=>{u.key==="Enter"&&e.trim()&&l.mutate(e.trim())}}),a.jsxs(H,{onClick:()=>e.trim()&&l.mutate(e.trim()),disabled:!e.trim()||l.isPending,children:[a.jsx(dr,{className:"h-4 w-4"})," Ajouter"]})]}),a.jsx("div",{className:"rounded-lg border border-border bg-card overflow-hidden",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"bg-muted/50 text-left",children:a.jsxs("tr",{children:[a.jsx("th",{className:"p-3",children:"Nom"}),a.jsx("th",{className:"p-3",children:"Slug"}),a.jsx("th",{className:"p-3 w-24",children:"Articles"}),a.jsx("th",{className:"p-3 w-20 text-right",children:"Actions"})]})}),a.jsxs("tbody",{children:[i.length===0&&a.jsx("tr",{children:a.jsx("td",{colSpan:4,className:"p-6 text-center text-muted-foreground",children:"Aucun tag"})}),i.map(u=>a.jsxs("tr",{className:"border-t border-border",children:[a.jsx("td",{className:"p-3 font-medium",children:u.name}),a.jsx("td",{className:"p-3 text-muted-foreground font-mono text-xs",children:u.slug}),a.jsx("td",{className:"p-3",children:o[u.id]||0}),a.jsx("td",{className:"p-3 text-right",children:a.jsx(H,{variant:"ghost",size:"icon",onClick:()=>s(u),children:a.jsx(tr,{className:"h-4 w-4"})})})]},u.id))]})]})}),a.jsx(ro,{open:!!r,onOpenChange:u=>!u&&s(null),children:a.jsxs(ja,{children:[a.jsxs(Sa,{children:[a.jsx(Ca,{children:"Supprimer ce tag ?"}),a.jsxs(ka,{children:["« ",r==null?void 0:r.name," » sera supprimé."]})]}),a.jsxs(Na,{children:[a.jsx(Ea,{children:"Annuler"}),a.jsx(Aa,{onClick:()=>r&&c.mutate(r.id),children:"Supprimer"})]})]})})]})}function wvt(){return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ofe,{className:"h-6 w-6"}),a.jsx("h1",{className:"font-heading text-2xl font-bold",children:"Catégories & Tags"})]}),a.jsxs(Qi,{defaultValue:"categories",children:[a.jsxs(wi,{children:[a.jsx(wt,{value:"categories",children:"Catégories"}),a.jsx(wt,{value:"tags",children:"Tags"})]}),a.jsx(kt,{value:"categories",className:"mt-4",children:a.jsx(yvt,{})}),a.jsx(kt,{value:"tags",className:"mt-4",children:a.jsx(bvt,{})})]})]})}const nie={planning:"Planification",in_progress:"En cours",review:"Relecture",ready_for_print:"Bon à tirer",printing:"Impression",distributed:"Distribué"},_vt={planning:"bg-gray-200 text-gray-800",in_progress:"bg-blue-100 text-blue-800",review:"bg-yellow-100 text-yellow-800",ready_for_print:"bg-orange-100 text-orange-800",printing:"bg-purple-100 text-purple-800",distributed:"bg-green-100 text-green-800"},rie={issue_number:1,title:"",publication_date:"",status:"planning",cover_image_url:"",pdf_digital_url:""};function jvt(){const t=St(),[e,n]=b.useState(!1),[r,s]=b.useState(null),[i,o]=b.useState(rie),[l,c]=b.useState(null),u=async x=>{if(x!=null&&x.id&&confirm(`Générer les brouillons d'articles du N°${x.issue_number} depuis le PDF via IA ? 1255 1256Les articles déjà existants pour ce numéro ne seront pas dupliqués. Le traitement peut prendre 1 à 2 minutes.`)){c(x.id);try{const{data:g,error:w}=await Z.functions.invoke("generate-magazine-articles",{body:{issue_id:x.id}});if(w)throw w;if(g!=null&&g.error)throw new Error(g.error);const _=(g==null?void 0:g.created)??0,j=(g==null?void 0:g.skipped)??0;ee.success(`${_} brouillon(s) créé(s)${j?`, ${j} ignoré(s)`:""}.`),t.invalidateQueries({queryKey:["admin_magazine_issues"]})}catch(g){ee.error((g==null?void 0:g.message)||"Génération impossible.")}finally{c(null)}}},{data:d=[],isLoading:h}=Ne({queryKey:["admin_magazine_issues"],queryFn:async()=>{const{data:x}=await Z.from("magazine_issues").select("*").order("issue_number",{ascending:!1}),{data:g}=await Z.from("articles").select("magazine_issue_id"),w=new Map;
1256return(g||[]).forEach(_=>{_.magazine_issue_id&&w.set(_.magazine_issue_id,(w.get(_.magazine_issue_id)||0)+1)}),(x||[]).map(_=>({..._,article_count:w.get(_.id)||0}))}}),f=()=>{const x=d.length?Math.max(...d.map(g=>g.issue_number||0))+1:1;o({...rie,issue_number:x}),s(null),n(!0)},p=x=>{o({issue_number:x.issue_number,title:x.title||"",publication_date:x.publication_date||"",status:x.status||"planning",cover_image_url:x.cover_image_url||"",pdf_digital_url:x.pdf_digital_url||""}),s(x.id),n(!0)},m=Qe({mutationFn:async()=>{const x={issue_number:i.issue_number,title:i.title,publication_date:i.publication_date||null,status:i.status,cover_image_url:i.cover_image_url||null,pdf_digital_url:i.pdf_digital_url||null};if(r){const{error:g}=await Z.from("magazine_issues").update(x).eq("id",r);if(g)throw g}else{const{error:g}=await Z.from("magazine_issues").insert(x);if(g)throw g}},onSuccess:()=>{t.invalidateQueries({queryKey:["admin_magazine_issues"]}),t.invalidateQueries({queryKey:["magazine_issues"]}),ee.success(r?"Magazine mis à jour":"Magazine créé"),n(!1)},onError:x=>ee.error(x.message)}),v=Qe({mutationFn:async x=>{const{error:g}=await Z.from("magazine_issues").delete().eq("id",x);if(g)throw g},onSuccess:()=>{t.invalidateQueries({queryKey:["admin_magazine_issues"]}),ee.success("Magazine supprimé")},onError:x=>ee.error(x.message)});return a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between gap-4",children:[a.jsxs("h1",{className:"font-heading text-2xl font-bold flex items-center gap-2",children:[a.jsx(Pu,{className:"h-6 w-6"})," Magazines",a.jsxs("span",{className:"text-sm font-normal text-muted-foreground",children:["(",d.length,")"]})]}),a.jsxs(H,{onClick:f,children:[a.jsx(dr,{className:"mr-2 h-4 w-4"})," Nouveau numéro"]})]}),h?a.jsx("div",{className:"mt-8 space-y-3",children:[1,2].map(x=>a.jsx("div",{className:"h-14 animate-pulse rounded-lg bg-muted"},x))}):a.jsx("div",{className:"mt-6 overflow-x-auto rounded-xl border border-border bg-card",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"border-b border-border bg-muted/50",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"N°"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Titre"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Publication"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Statut"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Articles"}),a.jsx("th",{className:"px-4 py-3 text-right font-medium",children:"Actions"})]})}),a.jsxs("tbody",{children:[d.map(x=>a.jsxs("tr",{className:"border-b border-border last:border-0 hover:bg-muted/30",children:[a.jsxs("td",{className:"px-4 py-3 font-medium",children:["N°",x.issue_number]}),a.jsx("td",{className:"px-4 py-3",children:a.jsx(_e,{to:`/admin/magazine/${x.id}`,className:"font-medium hover:text-primary",children:x.title||"â"})}),a.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:x.publication_date?new Date(x.publication_date).toLocaleDateString("fr-FR"):"â"}),a.jsx("td",{className:"px-4 py-3",children:a.jsx(ke,{className:`${_vt[x.status]||""} text-xs`,children:nie[x.status]||x.status})}),a.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:x.article_count}),a.jsxs("td",{className:"px-4 py-3 text-right",children:[x.pdf_digital_url&&a.jsx(H,{variant:"ghost",size:"sm",className:"h-8 mr-1 text-primary hover:bg-primary/10",disabled:l===x.id,onClick:()=>u(x),title:"Générer les articles depuis le PDF (IA)",children:l===x.id?a.jsxs(a.Fragment,{children:[a.jsx(Je,{className:"mr-1 h-3.5 w-3.5 animate-spin"})," Analyseâ¦"]}):a.jsxs(a.Fragment,{children:[a.jsx(hp,{className:"mr-1 h-3.5 w-3.5"})," Générer (IA)"]})}),a.jsx(H,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>p(x),children:a.jsx(Oc,{className:"h-3.5 w-3.5"})}),a.jsx(H,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>{confirm("Supprimer ce numéro ?")&&v.mutate(x.id)},children:a.jsx(tr,{className:"h-3.5 w-3.5 text-destructive"})})]})]},x.id)),d.length===0&&a.jsx("tr",{children:a.jsx("td",{colSpan:6,className:"px-4 py-10 text-center text-muted-foreground",children:"Aucun magazine. Créez le premier numéro."})})]})]})}),a.jsx(an,{open:e,onOpenChange:n,children:a.jsxs(nn,{children:[a.jsx(on,{children:a.jsx(ln,{children:r?"Modifier le numéro":"Nouveau numéro"})}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx(te,{children:"Numéro"}),a.jsx(ue,{type:"number",value:i.issue_number,onChange:x=>o({...i,issue_number:parseInt(x.target.value)||0})})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Titre"}),a.jsx(ue,{value:i.title,onChange:x=>o({...i,title:x.target.value}),placeholder:"Ex: Andalousie en hiver"})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Date de publication prévue"}),a.jsx(ue,{type:"date",value:i.publication_date,onChange:x=>o({...i,publication_date:x.target.value})})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Statut"}),a.jsx("select",{className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm",value:i.status,onChange:x=>o({...i,status:x.target.value}),children:Object.entries(nie).map(([x,g])=>a.jsx("option",{value:x,children:g},x))})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Image de couverture (URL)"}),a.jsx(ue,{value:i.cover_image_url,onChange:x=>o({...i,cover_image_url:x.target.value}),placeholder:"https://..."}),i.cover_image_url&&a.jsx("img",{src:i.cover_image_url,alt:"Aperçu couverture",className:"mt-2 h-32 rounded border border-border object-cover"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"Type de PDF"}),a.jsxs(lt,{value:i.pdf_digital_url?i.pdf_digital_url.includes("drive.google.com")?"drive":i.pdf_digital_url.includes("supabase")?"supabase":"hosted":"none",onValueChange:x=>{x==="none"&&o({...i,pdf_digital_url:""})},children:[a.jsx(nt,{children:a.jsx(ct,{})}),a.jsxs(rt,{children:[a.jsx(Ae,{value:"none",children:"Aucun"}),a.jsx(Ae,{value:"drive",children:"Google Drive"}),a.jsx(Ae,{value:"hosted",children:"Hébergé sur le site"}),a.jsx(Ae,{value:"supabase",children:"Supabase Storage"})]})]}),a.jsx(te,{className:"mt-2",children:"Lien PDF version numérique"}),a.jsx(ue,{type:"url",value:i.pdf_digital_url,onChange:x=>o({...i,pdf_digital_url:x.target.value}),placeholder:"https://..."}),a.jsxs("div",{children:[a.jsx(te,{className:"text-xs text-muted-foreground",children:'Ou uploader directement dans Supabase Storage (bucket "magazines")'}),a.jsx(ue,{type:"file",accept:"application/pdf",onChange:async x=>{var N;const g=(N=x.target.files)==null?void 0:N[0];if(!g)return;const w=`issue-${i.issue_number}-${Date.now()}.pdf`,{error:_}=await Z.storage.from("magazines").upload(w,g,{contentType:"application/pdf",upsert:!0});if(_){ee.error("Upload échoué : "+_.message);return}const{data:j}=Z.storage.from("magazines").getPublicUrl(w);o({...i,pdf_digital_url:j.publicUrl}),ee.success("PDF uploadé")}})]})]})]}),a.jsxs(ss,{children:[a.jsx(H,{variant:"outline",onClick:()=>n(!1),children:"Annuler"}),a.jsx(H,{onClick:()=>m.mutate(),disabled:m.isPending,children:"Enregistrer"})]})]})})]})}function Svt({issue:t,articles:e,pages:n}){const r=St(),[s,i]=b.useState(!1),o={validated:e.filter(p=>p.status==="validated").length,draft:e.filter(p=>
1256p.status==="draft").length,review:e.filter(p=>p.status==="review").length,total:e.length,pagesFilled:n.filter(p=>p.status!=="empty"&&p.page_type!=="blank").length,pagesTotal:t.page_count||n.length||0,adsReceived:n.filter(p=>p.page_type==="ad"&&p.ad_file_received).length,adsTotal:n.filter(p=>p.page_type==="ad").length},l=o.total?o.validated/o.total:0,c=o.pagesTotal?o.pagesFilled/o.pagesTotal:0,u=o.adsTotal?o.adsReceived/o.adsTotal:1,d=Math.round((l+c+u)/3*100),h=async p=>{i(!0);try{const m=p.name.split(".").pop(),v=`magazine/${t.id}/cover-${Date.now()}.${m}`,{error:x}=await Z.storage.from("images").upload(v,p,{upsert:!0});if(x)throw x;const{data:g}=Z.storage.from("images").getPublicUrl(v);await Z.from("magazine_issues").update({cover_image_url:g.publicUrl}).eq("id",t.id),r.invalidateQueries({queryKey:["magazine_issue",t.id]}),ee.success("Couverture mise à jour")}catch(m){ee.error(m.message)}finally{i(!1)}},f=Qe({mutationFn:async p=>{const{error:m}=await Z.from("magazine_issues").update(p).eq("id",t.id);if(m)throw m},onSuccess:()=>{r.invalidateQueries({queryKey:["magazine_issue",t.id]}),ee.success("Enregistré")},onError:p=>ee.error(p.message)});return a.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[a.jsxs("div",{className:"rounded-xl border border-border bg-card p-5 lg:col-span-1",children:[a.jsx("h3",{className:"font-heading font-semibold mb-3",children:"Couverture"}),a.jsx("div",{className:"aspect-[3/4] rounded-lg overflow-hidden bg-muted flex items-center justify-center",children:t.cover_image_url?a.jsx("img",{src:t.cover_image_url,alt:"",className:"h-full w-full object-cover"}):a.jsx("span",{className:"text-sm text-muted-foreground",children:"Aucune couverture"})}),a.jsxs("label",{className:"mt-3 block",children:[a.jsx("input",{type:"file",accept:"image/*",className:"hidden",disabled:s,onChange:p=>{var m;return((m=p.target.files)==null?void 0:m[0])&&h(p.target.files[0])}}),a.jsx(H,{asChild:!0,variant:"outline",size:"sm",className:"w-full",disabled:s,children:a.jsxs("span",{children:[a.jsx(Oa,{className:"mr-1.5 h-3.5 w-3.5"})," ",s?"Envoiâ¦":"Changer la couverture"]})})]}),a.jsxs("div",{className:"mt-4 space-y-2 text-sm",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"N°"})," ",a.jsx("strong",{children:t.issue_number})]}),t.theme&&a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"Thème :"})," ",t.theme]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"Pages prévues : "}),a.jsx("input",{type:"number",defaultValue:t.page_count||80,className:"w-20 rounded border border-input bg-background px-2 py-1 text-sm",onBlur:p=>{const m=parseInt(p.target.value);m&&m!==t.page_count&&f.mutate({page_count:m})}})]}),t.print_deadline&&a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"Bon à tirer :"})," ",new Date(t.print_deadline).toLocaleDateString("fr-FR")]})]})]}),a.jsxs("div",{className:"space-y-4 lg:col-span-2",children:[a.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"font-heading font-semibold",children:"Progression globale"}),a.jsxs("span",{className:"font-heading text-3xl font-bold",children:[d,"%"]})]}),a.jsx(Bg,{value:d,className:"mt-3 h-3"})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[a.jsx(Oz,{icon:dp,label:"Articles",value:`${o.validated} / ${o.total}`,sub:`${o.draft} brouillon · ${o.review} relecture`,color:"text-blue-600 bg-blue-50",progress:l}),a.jsx(Oz,{icon:o5e,label:"Pages remplies",value:`${o.pagesFilled} / ${o.pagesTotal}`,sub:`${o.pagesTotal-o.pagesFilled} vide(s)`,color:"text-purple-600 bg-purple-50",progress:c}),a.jsx(Oz,{icon:Ffe,label:"Publicités reçues",value:`${o.adsReceived} / ${o.adsTotal}`,sub:o.adsTotal===0?"Aucune planifiée":`${o.adsTotal-o.adsReceived} en attente`,color:"text-orange-600 bg-orange-50",progress:u})]}),o.validated===o.total&&o.total>0&&a.jsxs("div",{className:"rounded-xl border border-green-200 bg-green-50 p-4 flex items-center gap-3 text-sm",children:[a.jsx(sh,{className:"h-5 w-5 text-green-600"}),a.jsxs("span",{children:[a.jsx("strong",{children:"Tous les articles sont validés."})," Prêt pour la mise en page."]})]})]})]})}function Oz({icon:t,label:e,value:n,sub:r,color:s,progress:i}){return a.jsxs("div",{className:"rounded-xl border border-border bg-card p-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-xs text-muted-foreground",children:e}),a.jsx("div",{className:`flex h-8 w-8 items-center justify-center rounded-lg ${s}`,children:a.jsx(t,{className:"h-4 w-4"})})]}),a.jsx("div",{className:"mt-2 font-heading text-2xl font-bold",children:n}),a.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:r}),a.jsx(Bg,{value:i*100,className:"mt-2 h-1.5"})]})}function Nvt({article:t,onClose:e}){var i;if(!t)return null;
1256const n=[t.cover_image_url,...K_(t.content)].filter(Boolean),r=async()=>{await R8(O8(t)),ee.success("Texte copié dans le presse-papiers")},s=async()=>{if(!n.length)return ee.info("Aucune image");ee.info(`Téléchargement de ${n.length} image(s)â¦`),await c0e(n,`art-${(t.slug||t.id).slice(0,20)}`)};return a.jsx(an,{open:!!t,onOpenChange:o=>!o&&e(),children:a.jsxs(nn,{className:"max-w-4xl max-h-[90vh] overflow-y-auto p-0",children:[a.jsxs("div",{className:"sticky top-0 z-10 flex flex-wrap items-center justify-between gap-2 border-b border-border bg-card px-5 py-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ke,{className:`${d0e[t.status]||""} text-xs`,children:u0e[t.status]||t.status}),((i=t.categories)==null?void 0:i.name)&&a.jsx(ke,{variant:"outline",className:"text-xs",children:t.categories.name})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(H,{size:"sm",variant:"outline",onClick:r,children:[a.jsx(Pl,{className:"mr-1.5 h-3.5 w-3.5"})," Copier le texte brut"]}),a.jsxs(H,{size:"sm",variant:"outline",onClick:s,children:[a.jsx(Ts,{className:"mr-1.5 h-3.5 w-3.5"})," Télécharger images (",n.length,")"]}),a.jsx(H,{size:"icon",variant:"ghost",onClick:e,children:a.jsx(ks,{className:"h-4 w-4"})})]})]}),a.jsxs("div",{className:"px-6 py-5",children:[t.cover_image_url&&a.jsx("img",{src:t.cover_image_url,alt:"",className:"w-full rounded-lg mb-4 max-h-96 object-cover"}),a.jsx("h1",{className:"font-heading text-3xl font-bold",children:t.title}),t.author_name&&a.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:["Par ",t.author_name]}),t.excerpt&&a.jsx("p",{className:"mt-3 italic text-muted-foreground",children:t.excerpt}),t.pages_planned&&a.jsxs("p",{className:"mt-2 text-xs text-muted-foreground",children:["Pages prévues : ",a.jsx("strong",{children:t.pages_planned})]}),a.jsx("div",{className:"prose prose-sm sm:prose max-w-none mt-6",dangerouslySetInnerHTML:{__html:t.content||""}}),n.length>1&&a.jsxs("div",{className:"mt-8 border-t border-border pt-6",children:[a.jsx("h3",{className:"font-heading font-semibold mb-3",children:"Toutes les images"}),a.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:n.map((o,l)=>a.jsx("img",{src:o,alt:"",className:"w-full rounded-lg"},l))})]})]})]})})}const sie=[{key:"calling",label:"Envoi du PDF à l'IA",icon:dp},{key:"analyzing",label:"Analyse & extraction des articles",icon:hp},{key:"inserting",label:"Création des brouillons",icon:D$e}];function Cvt({phase:t,startedAt:e,result:n,errorMessage:r}){const[s,i]=b.useState(0);if(b.useEffect(()=>{if(!e||t==="done"||t==="error"||t==="idle")return;const c=setInterval(()=>i(Math.round((Date.now()-e)/1e3)),500);return()=>clearInterval(c)},[e,t]),t==="idle")return null;const o=sie.findIndex(c=>c.key===t),l=t==="calling"||t==="analyzing"||t==="inserting";return a.jsxs("div",{className:"mb-4 rounded-xl border-2 border-primary/30 bg-card overflow-hidden",children:[a.jsxs("div",{className:"border-b border-border bg-primary/5 px-4 py-3 flex items-center justify-between",children:[a.jsx("div",{className:"flex items-center gap-2 text-sm font-medium",children:l?a.jsxs(a.Fragment,{children:[a.jsx(Je,{className:"h-4 w-4 animate-spin text-primary"})," Génération en coursâ¦"]}):t==="done"?a.jsxs(a.Fragment,{children:[a.jsx(sh,{className:"h-4 w-4 text-green-600"})," Génération terminée"]}):a.jsxs(a.Fragment,{children:[a.jsx(H6,{className:"h-4 w-4 text-destructive"})," Génération échouée"]})}),e&&a.jsxs("span",{className:"text-xs text-muted-foreground tabular-nums",children:[s,"s"]})]}),a.jsx("div",{className:"p-4 space-y-2",children:sie.map((c,u)=>{const d=c.icon,h=t==="done"||l&&u<o||t==="error"&&u<o,f=l&&u===o,p=t==="error"&&u===o;return a.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[a.jsx("div",{className:`flex h-7 w-7 items-center justify-center rounded-full border-2 ${h?"border-green-500 bg-green-500/10 text-green-600":f?"border-primary bg-primary/10 text-primary":p?"border-destructive bg-destructive/10 text-destructive":"border-border bg-muted text-muted-foreground"}`,children:h?a.jsx(sh,{className:"h-4 w-4"}):f?a.jsx(Je,{className:"h-4 w-4 animate-spin"}):p?a.jsx(H6,{className:"h-4 w-4"}):a.jsx(d,{className:"h-3.5 w-3.5"})}),a.jsx("span",{className:h?"text-foreground":f?"text-foreground font-medium":p?"text-destructive":"text-muted-foreground",children:c.label})]},c.key)})}),t==="error"&&r&&a.jsx("div",{className:"border-t border-destructive/20 bg-destructive/5 px-4 py-3 text-sm text-destructive",children:a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx(F_,{className:"mt-0.5 h-4 w-4 shrink-0"}),a.jsxs("div",{children:[a.jsx("div",{className:"font-medium",children:"Erreur"}),a.jsx("div",{className:"mt-0.5 text-destructive/90",children:r})]})]})}),t==="done"&&n&&a.jsxs("div",{className:"border-t border-border bg-muted/30 px-4 py-3 space-y-3",children:[a.jsxs("div",{className:"flex flex-wrap gap-3 text-sm",children:[a.jsxs("span",{className:"rounded-full bg-green-100 text-green-800 px-3 py-1 font-medium",children:[n.created," créé",n.created>
12561?"s":""]}),n.skipped>0&&a.jsxs("span",{className:"rounded-full bg-gray-100 text-gray-700 px-3 py-1",children:[n.skipped," ignoré",n.skipped>1?"s":""," (déjà existants)"]}),n.errors.length>0&&a.jsxs("span",{className:"rounded-full bg-destructive/10 text-destructive px-3 py-1",children:[n.errors.length," erreur",n.errors.length>1?"s":""]}),a.jsxs("span",{className:"rounded-full bg-blue-100 text-blue-800 px-3 py-1",children:[n.total_detected," détecté",n.total_detected>1?"s":""," au total"]})]}),n.articles.length>0&&a.jsxs("details",{className:"text-sm",open:!0,children:[a.jsxs("summary",{className:"cursor-pointer font-medium text-foreground",children:["Articles créés (",n.articles.length,")"]}),a.jsx("ul",{className:"mt-2 space-y-1 max-h-64 overflow-y-auto rounded border border-border bg-card p-2",children:n.articles.map(c=>a.jsxs("li",{className:"flex items-center justify-between gap-2 px-2 py-1 hover:bg-muted/50 rounded",children:[a.jsxs("span",{className:"truncate",children:[c.pages_planned&&a.jsxs("span",{className:"text-xs text-muted-foreground mr-2",children:["p. ",c.pages_planned]}),c.title]}),a.jsx(_e,{to:`/admin/articles/${c.id}/modifier`,className:"text-xs text-primary hover:underline shrink-0",children:"Ãditer"})]},c.id))})]}),n.errors.length>0&&a.jsxs("details",{className:"text-sm",children:[a.jsxs("summary",{className:"cursor-pointer font-medium text-destructive",children:["Erreurs (",n.errors.length,")"]}),a.jsx("ul",{className:"mt-2 space-y-1 max-h-48 overflow-y-auto rounded border border-destructive/30 bg-destructive/5 p-2",children:n.errors.map((c,u)=>a.jsxs("li",{className:"px-2 py-1",children:[a.jsx("div",{className:"font-medium",children:c.title}),a.jsx("div",{className:"text-xs text-destructive/80",children:c.error})]},u))})]})]})]})}const iie=40;function kvt({articles:t,issueId:e,issueNumber:n}){const[r,s]=b.useState("all"),[i,o]=b.useState("order"),[l,c]=b.useState(null),[u,d]=b.useState(!1),[h,f]=b.useState(!1),[p,m]=b.useState("idle"),[v,x]=b.useState(null),[g,w]=b.useState(null),[_,j]=b.useState(null),N=b.useRef([]),S=b.useRef(null),C=St(),k=()=>{N.current.forEach(A=>clearTimeout(A)),N.current=[]},E=async A=>{k(),f(!0),w(null),j(null),x(Date.now()),m("calling"),N.current.push(window.setTimeout(()=>m(I=>
1256I==="calling"?"analyzing":I),3e3));try{const{data:I,error:D}=await Z.functions.invoke("generate-magazine-articles",{body:A});if(D)throw D;if(I!=null&&I.error)throw new Error(I.error);k(),m("inserting"),await new Promise(z=>setTimeout(z,400));const O={created:(I==null?void 0:I.created)??0,skipped:(I==null?void 0:I.skipped)??0,total_detected:(I==null?void 0:I.total_detected)??0,articles:(I==null?void 0:I.articles)??[],errors:(I==null?void 0:I.errors)??[]};w(O),m("done"),Ab({title:"Génération terminée",description:`${O.created} brouillon(s) créé(s)${O.skipped?`, ${O.skipped} ignoré(s)`:""}${O.errors.length?`, ${O.errors.length} erreur(s)`:""}.`}),C.invalidateQueries({queryKey:["magazine_articles_full",e]})}catch(I){k(),m("error"),j((I==null?void 0:I.message)||"Génération impossible."),Ab({title:"Erreur",description:(I==null?void 0:I.message)||"Génération impossible.",variant:"destructive"})}finally{f(!1)}},P=async()=>{e&&(d(!1),await E({issue_id:e}))},T=async A=>{if(!e)return;const I=A.size/(1024*1024);if(I>iie){Ab({title:"PDF trop volumineux",description:`${I.toFixed(1)} Mo. Compresse-le sous ${iie} Mo (Acrobat « Optimiser » ou ilovepdf.com).`,variant:"destructive"});return}if(A.type!=="application/pdf"&&!A.name.toLowerCase().endsWith(".pdf")){Ab({title:"Fichier invalide",description:"Le fichier doit être un PDF.",variant:"destructive"});return}const D=Date.now(),O=A.name.replace(/[^a-zA-Z0-9._-]/g,"_").slice(-60),z=`articles/mag${n||"x"}/${D}-${O}`,{error:B}=await Z.storage.from("magazines").upload(z,A,{contentType:"application/pdf",upsert:!1});if(B){Ab({title:"Upload échoué",description:B.message,variant:"destructive"});return}const{data:G}=Z.storage.from("magazines").getPublicUrl(z);await E({issue_id:e,pdf_url:G.publicUrl})},M=A=>{var D;const I=(D=A.target.files)==null?void 0:D[0];A.target.value="",I&&T(I)},R=b.useMemo(()=>{const A=t.filter(I=>r==="validated"?I.status==="validated":r==="pending"?I.status!=="validated":!0);return A.sort((I,D)=>{var B,G,U,F;if(i==="category")return(((B=I.categories)==null?void 0:B.name)||"").localeCompare(((G=D.categories)==null?void 0:G.name)||"");if(i==="date")return new Date(D.created_at).getTime()-new Date(I.created_at).getTime();const O=parseInt(((U=String(I.pages_planned||"999").match(/\d+/))==null?void 0:U[0])||"999"),z=parseInt(((F=String(D.pages_planned||"999").match(/\d+/))==null?void 0:F[0])||"999");return O!==z?O-z:(I.title||"").localeCompare(D.title||"")}),A},[t,r,i]);return a.jsxs("div",{children:[a.jsxs("div",{className:"flex flex-wrap gap-2 mb-4",children:[a.jsx("div",{className:"flex rounded-lg border border-border overflow-hidden",children:["all","validated","pending"].map(A=>a.jsx("button",{onClick:()=>s(A),className:`px-3 py-1.5 text-sm ${r===A?"bg-primary text-primary-foreground":"bg-card hover:bg-muted"}`,children:A==="all"?"Tous":A==="validated"?"Validés":"En attente"},A))}),a.jsxs("select",{className:"rounded-lg border border-border bg-card px-3 py-1.5 text-sm",value:i,onChange:A=>o(A.target.value),children:[a.jsx("option",{value:"order",children:"Tri : chemin de fer"}),a.jsx("option",{value:"category",children:"Tri : catégorie"}),a.jsx("option",{value:"date",children:"Tri : date"})]}),a.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[e&&a.jsxs(a.Fragment,{children:[a.jsx("input",{ref:S,type:"file",accept:"application/pdf,.pdf",className:"hidden",onChange:M}),a.jsxs(H,{size:"sm",variant:"outline",onClick:()=>{var A;return(A=S.current)==null?void 0:A.click()},disabled:h,children:[a.jsx(W6,{className:"mr-1.5 h-4 w-4"})," Importer un article (PDF)"]}),a.jsx(H,{size:"sm",onClick:()=>d(!0),disabled:h,className:"bg-gradient-to-r from-primary to-primary/80",children:h?a.jsxs(a.Fragment,{children:[a.jsx(Je,{className:"mr-1.5 h-4 w-4 animate-spin"})," Traitementâ¦"]}):a.jsxs(a.Fragment,{children:[a.jsx(hp,{className:"mr-1.5 h-4 w-4"})," Générer tout le numéro (IA)"]})})]}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[R.length," article(s)"]})]})]}),a.jsx(Cvt,{phase:p,startedAt:v,result:g,errorMessage:_}),a.jsx(ro,{open:u,onOpenChange:d,children:a.jsxs(ja,{children:[a.jsxs(Sa,{children:[a.jsx(Ca,{children:"Générer les articles depuis le PDF ?"}),a.jsxs(ka,{children:["L'IA va analyser le PDF du N°",n," et créer un brouillon par article détecté. Les articles déjà existants pour ce numéro ne seront pas dupliqués. Le traitement peut prendre 1 à 2 minutes."]})]}),a.jsxs(Na,{children:[a.jsx(Ea,{children:"Annuler"}),a.jsx(Aa,{onClick:P,children:"Lancer la génération"})]})]})}),R.length===0?a.jsx("p",{className:"rounded-lg border border-border bg-card p-10 text-center text-muted-foreground",children:"Aucun article dans cette catégorie."}):a.jsx("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:R.map(A=>{var B;
1256const I=o0e(eI(A.content)),O=K_(A.content).length+(A.cover_image_url?1:0),z=A.status==="validated";return a.jsxs("div",{className:`rounded-xl border-2 bg-card overflow-hidden transition ${z?"border-green-400":"border-border opacity-90"}`,children:[a.jsx("div",{className:"aspect-video bg-muted overflow-hidden",children:A.cover_image_url?a.jsx("img",{src:A.cover_image_url,alt:"",className:"h-full w-full object-cover"}):a.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground text-xs",children:"Pas de couverture"})}),a.jsxs("div",{className:"p-4",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 mb-2",children:[a.jsx(ke,{className:`${d0e[A.status]||""} text-xs`,children:u0e[A.status]||A.status}),((B=A.categories)==null?void 0:B.name)&&a.jsx(ke,{variant:"outline",className:"text-xs",children:A.categories.name}),A.pages_planned&&a.jsxs(ke,{variant:"secondary",className:"text-xs",children:["p. ",A.pages_planned]})]}),a.jsx("h3",{className:"font-heading font-semibold leading-tight line-clamp-2",children:A.title}),A.author_name&&a.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Par ",A.author_name]}),a.jsxs("div",{className:"mt-3 flex flex-wrap gap-3 text-xs text-muted-foreground",children:[a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(z$e,{className:"h-3 w-3"})," ",I," mots"]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(t2,{className:"h-3 w-3"})," ",mJe(eI(A.content))," min"]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(MO,{className:"h-3 w-3"})," ",O," image(s)"]})]}),a.jsxs(H,{size:"sm",variant:"outline",className:"w-full mt-4",onClick:()=>c(A),children:[a.jsx(Mu,{className:"mr-1.5 h-3.5 w-3.5"})," Voir l'article"]})]})]},A.id)})}),a.jsx(Nvt,{article:l,onClose:()=>c(null)})]})}const Avt=["article","ad","editorial","toc","cover","blank"];function Evt({issue:t,pages:e,articles:n,advertisers:r}){const s=St(),[i,o]=b.useState(null),[l,c]=b.useState({}),u=t.page_count||80,d=[...e].sort((g,w)=>g.page_number-w.page_number),h=new Map(d.map(g=>[g.page_number,g])),f=Array.from({length:u},(g,w)=>{const _=w+1;return h.get(_)||{id:null,page_number:_,page_type:"blank",status:"empty",issue_id:t.id}}),p=Qe({mutationFn:async g=>{const w={issue_id:t.id,page_number:g.page_number,page_type:g.page_type,status:g.status||(g.page_type==="blank"?"empty":"draft"),article_id:g.article_id||null,advertiser_id:g.advertiser_id||null,notes:g.notes||null,ad_file_received:g.ad_file_received||!1,ad_file_url:g.ad_file_url||null};if(g.id){const{error:_}=await Z.from("magazine_pages").update(w).eq("id",g.id);if(_)throw _}else{const{error:_}=await Z.from("magazine_pages").insert(w);if(_)throw _}},onSuccess:()=>{s.invalidateQueries({queryKey:["magazine_pages",t.id]}),ee.success("Page mise à jour"),o(null)},onError:g=>ee.error(g.message)}),m=Qe({mutationFn:async g=>{const{error:w}=await Z.from("magazine_pages").delete().eq("id",g);if(w)throw w},onSuccess:()=>{s.invalidateQueries({queryKey:["magazine_pages",t.id]}),ee.success("Page vidée"),o(null)},onError:g=>ee.error(g.message)}),v=Qe({mutationFn:async({a:g,b:w})=>{g.id&&w.id?(await Z.from("magazine_pages").update({page_number:-1}).eq("id",g.id),await Z.from("magazine_pages").update({page_number:g.page_number}).eq("id",w.id),await Z.from("magazine_pages").update({page_number:w.page_number}).eq("id",g.id)):g.id?await Z.from("magazine_pages").update({page_number:w.page_number}).eq("id",g.id):w.id&&await Z.from("magazine_pages").update({page_number:g.page_number}).eq("id",w.id)},onSuccess:()=>s.invalidateQueries({queryKey:["magazine_pages",t.id]}),onError:g=>ee.error(g.message)}),x=g=>{c({id:g.id,page_number:g.page_number,page_type:g.page_type||"blank",article_id:g.article_id||"",advertiser_id:g.advertiser_id||"",notes:g.notes||"",status:g.status}),o(g)};return a.jsxs("div",{children:[a.jsxs("p",{className:"text-sm text-muted-foreground mb-4",children:["Cliquez sur une page pour l'éditer. Utilisez les flèches pour réorganiser. Couleurs : ",a.jsx("span",{className:"px-1.5 rounded bg-blue-100",children:"Article"})," ",a.jsx("span",{className:"px-1.5 rounded bg-orange-100",children:"Pub"})," ",a.jsx("span",{className:"px-1.5 rounded bg-green-100",children:"Ãdito"})," ",a.jsx("span",{className:"px-1.5 rounded bg-purple-100",children:"Sommaire"})," ",a.jsx("span",{className:"px-1.5 rounded bg-gray-100",children:"Vide"})]}),a.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 md:grid-cols-6 lg:grid-cols-8 gap-2",children:f.map((g,w)=>{const _=g.article_id?n.find(N=>N.id===g.article_id):null,j=g.advertiser_id?r.find(N=>N.id===g.advertiser_id):null;return a.jsxs("div",{className:`relative aspect-[3/4] rounded-lg border-2 ${ete[g.page_type]||ete.blank} cursor-pointer hover:ring-2 hover:ring-primary transition flex flex-col`,onClick:()=>x(g),children:[a.jsxs("div",{className:"px-1.5 py-1 text-xs font-bold border-b border-current/20",children:["p. ",g.page_number]}),a.jsxs("div",{className:"flex-1 p-1.5 text-[10px] leading-tight overflow-hidden",children:[a.jsx("div",{className:"font-medium",children:I8[g.page_type]||g.page_type}),_&&a.jsx("div",{className:"line-clamp-3 mt-1",children:_.title}),j&&a.jsxs("div",{className:"mt-1",children:[a.jsx("div",{className:"line-clamp-2",children:j.company_name}),a.jsx("div",{className:"mt-0.5",children:g.ad_file_received?"â
reçu":"â attente"})]})]}),a.jsxs("div",{className:"absolute top-0.5 right-0.5 flex flex-col opacity-0 hover:opacity-100 transition",onClick:N=>N.stopPropagation(),children:[w>0&&a.jsx("button",{title:"Monter",className:"bg-white/80 rounded p-0.5",onClick:()=>v.mutate({a:g,b:f[w-1]}),children:a.jsx(Mfe,{className:"h-3 w-3"})}),w<f.length-1&&a.jsx("button",{title:"Descendre",className:"bg-white/80 rounded p-0.5",onClick:()=>v.mutate({a:g,b:f[w+1]}),children:a.jsx(wh,{className:"h-3 w-3"})})]})]},g.page_number)})}),a.jsx(an,{open:!!i,onOpenChange:g=>!g&&o(null),children:a.jsxs(nn,{children:[a.jsx(on,{children:a.jsxs(ln,{children:["Page ",l.page_number]})}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx(te,{children:"Type"}),a.jsx("select",{className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm",value:l.page_type,onCh
1256ange:g=>c({...l,page_type:g.target.value}),children:Avt.map(g=>a.jsx("option",{value:g,children:I8[g]},g))})]}),l.page_type==="article"&&a.jsxs("div",{children:[a.jsx(te,{children:"Article"}),a.jsxs("select",{className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm",value:l.article_id,onChange:g=>c({...l,article_id:g.target.value}),children:[a.jsx("option",{value:"",children:"â Choisir â"}),n.map(g=>a.jsx("option",{value:g.id,children:g.title},g.id))]})]}),l.page_type==="ad"&&a.jsxs("div",{children:[a.jsx(te,{children:"Annonceur"}),a.jsxs("select",{className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm",value:l.advertiser_id,onChange:g=>c({...l,advertiser_id:g.target.value}),children:[a.jsx("option",{value:"",children:"â Choisir â"}),r.map(g=>a.jsx("option",{value:g.id,children:g.company_name},g.id))]})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Notes"}),a.jsx("textarea",{className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm min-h-[60px]",value:l.notes,onChange:g=>c({...l,notes:g.target.value})})]})]}),a.jsxs(ss,{className:"gap-2",children:[l.id&&a.jsxs(H,{variant:"outline",onClick:()=>m.mutate(l.id),children:[a.jsx(tr,{className:"mr-1.5 h-3.5 w-3.5"})," Vider"]}),a.jsx(H,{variant:"outline",onClick:()=>o(null),children:"Annuler"}),a.jsx(H,{onClick:()=>p.mutate(l),disabled:p.isPending,children:"Enregistrer"})]})]})})]})}function Tvt({issue:t,articles:e,pages:n,advertisers:r}){const s=e.filter(i=>i.status==="validated");return a.jsxs("div",{children:[a.jsxs("div",{className:"rounded-lg border border-amber-200 bg-amber-50 px-4 py-2.5 mb-4 text-sm",children:[a.jsx("strong",{children:"Pour la graphiste :"}
1256)," ces vues sont conçues pour copier le texte et récupérer les images pour InDesign."]}),a.jsxs(Qi,{defaultValue:"a",children:[a.jsxs(wi,{children:[a.jsxs(wt,{value:"a",children:[a.jsx(dp,{className:"mr-1.5 h-3.5 w-3.5"})," Vue article par article"]}),a.jsxs(wt,{value:"b",children:[a.jsx(X$e,{className:"mr-1.5 h-3.5 w-3.5"})," Textes & images séparément"]}),a.jsxs(wt,{value:"c",children:[a.jsx(L_,{className:"mr-1.5 h-3.5 w-3.5"})," Dossier export complet"]})]}),a.jsx(kt,{value:"a",className:"mt-4",children:a.jsx(Pvt,{articles:s})}),a.jsx(kt,{value:"b",className:"mt-4",children:a.jsx(Mvt,{articles:e})}),a.jsx(kt,{value:"c",className:"mt-4",children:a.jsx(Rvt,{issue:t,articles:e,pages:n,advertisers:r})})]})]})}function YCe(){return a.jsxs(H,{onClick:()=>window.print(),children:[a.jsx(zfe,{className:"mr-1.5 h-3.5 w-3.5"})," Imprimer / PDF"]})}function Pvt({articles:t}){return a.jsxs("div",{children:[a.jsx("div",{className:"flex justify-end mb-4 print:hidden",children:a.jsx(YCe,{})}),t.length===0&&a.jsx("p",{className:"text-center text-muted-foreground py-8",children:"Aucun article validé."}),a.jsx("div",{className:"space-y-12 print:space-y-8",children:t.map(e=>{const n=[e.cover_image_url,...K_(e.content)].filter(Boolean);return a.jsxs("article",{className:"break-after-page",children:[e.cover_image_url&&a.jsx("img",{src:e.cover_image_url,alt:"",className:"w-full max-h-96 object-cover rounded-lg mb-4"}),a.jsx("h2",{className:"font-heading text-3xl font-bold",children:e.title}),e.author_name&&a.jsxs("p",{className:"text-muted-foreground mt-1",children:["Par ",e.author_name]}),e.excerpt&&a.jsx("p",{className:"italic mt-2",children:e.excerpt}),a.jsx("div",{className:"prose prose-sm max-w-none mt-4",dangerouslySetInnerHTML:{__html:e.content||""}}),n.length>1&&a.jsx("div",{className:"grid sm:grid-cols-2 gap-3 mt-4",children:n.slice(1).map((r,s)=>a.jsx("img",{src:r,alt:"",className:"w-full rounded"},s))}),a.jsx("hr",{className:"my-8 border-t-2 border-dashed"})]},e.id)})})]})}function Mvt({articles:t}){const e=t.flatMap(r=>[r.cover_image_url,...K_(r.content)].filter(Boolean).map(s=>({url:s,article:r.title}))),n=async()=>{const r=t.map(s=>O8(s)).join(` 1257 1258--- 1259 1260`);await R8(r),ee.success(`${t.length} article(s) copié(s)`)};return a.jsxs("div",{className:"space-y-8",children:[a.jsxs("section",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsxs("h3",{className:"font-heading text-lg font-semibold",children:["Textes (",t.length,")"]}),a.jsxs(H,{size:"sm",variant:"outline",onClick:n,children:[a.jsx(Pl,{className:"mr-1.5 h-3.5 w-3.5"})," Copier tous les textes"]})]}),a.jsx("div",{className:"space-y-2",children:t.map(r=>a.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border bg-card px-4 py-2.5",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("div",{className:"font-medium truncate",children:r.title}),a.jsxs("div",{className:"text-xs text-muted-foreground",children:[r.author_name||"â"," · ",r.status]})]}),a.jsxs(H,{size:"sm",variant:"ghost",onClick:async()=>{await R8(O8(r)),ee.success("Texte copié")},children:[a.jsx(Pl,{className:"mr-1.5 h-3.5 w-3.5"})," Copier"]})]},r.id))})]}),a.jsxs("section",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsxs("h3",{className:"font-heading text-lg font-semibold",children:["Images (",e.length,")"]}),a.jsxs(H,{size:"sm",variant:"outline",disabled:!e.length,onClick:async()=>{ee.info(`Téléchargement de ${e.length} image(s)â¦`),await c0e(e.map(r=>r.url),"magazine")},children:[a.jsx(Ts,{className:"mr-1.5 h-3.5 w-3.5"})," Tout télécharger"]})]}),a.jsx("div",{className:"grid gap-3 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4",children:e.map((r,s)=>{var i;return a.jsxs("div",{className:"rounded-lg border border-border bg-card overflow-hidden",children:[a.jsx("img",{src:r.url,alt:"",className:"w-full aspect-video object-cover"}),a.jsxs("div",{className:"p-2 text-xs",children:[a.jsx("div",{className:"truncate text-muted-foreground",children:r.article}),a.jsx("div",{className:"truncate font-mono text-[10px]",children:(i=r.url.split("/").pop())==null?void 0:i.split("?")[0]}),a.jsxs(H,{size:"sm",variant:"ghost",className:"w-full mt-1",onClick:()=>l0e(r.url),children:[a.jsx(Ts,{className:"mr-1 h-3 w-3"})," Télécharger"]})]})]},s)})})]})]})}function Rvt({issue:t,articles:e,pages:n,advertisers:r}){return a.jsxs("div",{children:[a.jsx("div",{className:"flex justify-end mb-4 print:hidden",children:a.jsx(YCe,{})}),a.jsxs("div",{className:"rounded-xl border border-border bg-card p-6 print:border-0 print:p-0",children:[a.jsxs("header",{className:"text-center border-b border-border pb-6 mb
1260-6",children:[t.cover_image_url&&a.jsx("img",{src:t.cover_image_url,alt:"",className:"mx-auto max-h-64 rounded mb-4"}),a.jsxs("h1",{className:"font-heading text-3xl font-bold",children:["N°",t.issue_number," â ",t.title]}),t.theme&&a.jsxs("p",{className:"text-muted-foreground mt-1",children:["Thème : ",t.theme]}),t.publication_date&&a.jsxs("p",{className:"text-sm mt-2",children:["Publication : ",new Date(t.publication_date).toLocaleDateString("fr-FR")]})]}),a.jsxs("section",{className:"mb-8 break-inside-avoid",children:[a.jsx("h2",{className:"font-heading text-xl font-semibold mb-3",children:"Chemin de fer"}),a.jsxs("table",{className:"w-full text-sm border-collapse",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border",children:[a.jsx("th",{className:"text-left py-2 px-2",children:"Page"}),a.jsx("th",{className:"text-left py-2 px-2",children:"Type"}),a.jsx("th",{className:"text-left py-2 px-2",children:"Contenu"}),a.jsx("th",{className:"text-left py-2 px-2",children:"Statut"})]})}),a.jsx("tbody",{children:n.sort((s,i)=>s.page_number-i.page_number).map(s=>{const i=e.find(l=>l.id===s.article_id),o=r.find(l=>l.id===s.advertiser_id);return a.jsxs("tr",{className:"border-b border-border",children:[a.jsx("td",{className:"py-2 px-2 font-mono",children:s.page_number}),a.jsx("td",{className:"py-2 px-2",children:I8[s.page_type]||s.page_type}),a.jsx("td",{className:"py-2 px-2",children:(i==null?void 0:i.title)||(o==null?void 0:o.company_name)||"â"}),a.jsx("td",{className:"py-2 px-2 text-xs",children:s.page_type==="ad"?s.ad_file_received?"â
Fichier reçu":"â En attente":s.status})]},s.id)})})]})]}),a.jsxs("section",{children:[a.jsx("h2",{className:"font-heading text-xl font-semibold mb-3",children:"Articles"}),e.map(s=>a.jsxs("div",{className:"mb-8 break-inside-avoid",children:[a.jsx("h3",{className:"font-heading text-lg font-bold",children:s.title}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[s.author_name||"â"," · ",s.status," · ",s.pages_planned?`p. ${s.pages_planned}`:"pages non assignées"]}),a.jsx("pre",{className:"whitespace-pre-wrap text-sm mt-2 font-sans",children:eI(s.content)}),(K_(s.content).length>0||s.cover_image_url)&&a.jsxs("div",{className:"mt-2 text-xs",children:[a.jsx("strong",{children:"Images :"}),a.jsx("ul",{className:"list-disc pl-5",children:[s.cover_image_url,...K_(s.content)].filter(Boolean).map((i,o)=>a.jsx("li",{className:"font-mono text-[11px] break-all",children:i},o))})]})]},s.id))]})]})]})}function Ovt({issue:t,pages:e,advertisers:n}){const r=St(),[s,i]=b.useState(null),o=e.filter(c=>c.page_type==="ad").sort((c,u)=>c.page_number-u.page_number),l=Qe({mutationFn:async({pageId:c,file:u})=>{i(c);const d=u.name.split(".").pop(),h=`magazine/${t.id}/ads/page-${c}-${Date.now()}.${d}`,{error:f}=await Z.storage.from("images").upload(h,u,{upsert:!0});if(f)throw f;const{data:p}=Z.storage.from("images").getPublicUrl(h),{error:m}=await Z.from("magazine_pages").update({ad_file_url:p.publicUrl,ad_file_received:!0}).eq("id",c);if(m)throw m},onSuccess:()=>{r.invalidateQueries({queryKey:["magazine_pages",t.id]}),ee.success("Fichier pub uploadé")},onError:c=>ee.error(c.message),onSettled:()=>i(null)});return o.length===0?a.jsx("p",{className:"rounded-lg border border-border bg-card p-10 text-center text-muted-foreground",children:'Aucune page publicitaire dans ce numéro. Définissez le type "Publicité" sur les pages voulues dans le chemin de fer.'}):a.jsx("div",{className:"overflow-x-auto rounded-xl border border-border bg-card",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"border-b border-border bg-muted/50",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Page"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Annonceur"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Statut"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Fichier"}),a.jsx("th",{className:"px-4 py-3 text-right font-medium",children:"Action"})]})}),a.jsx("tbody",{children:o.map(c=>{const u=n.find(d=>d.id===c.advertiser_id);return a.jsxs("tr",{className:"border-b border-border last:border-0",children:[a.jsxs("td",{className:"px-4 py-3 font-medium",children:["p. ",c.page_number]}),a.jsx("td",{className:"px-4 py-3",children:(u==null?void 0:u.company_name)||a.jsx("span",{className:"text-muted-foreground",children:"â non assigné â"})}),a.jsx("td",{className:"px-4 py-3",children:c.ad_file_received?a.jsxs(ke,{className:"bg-green-100 text-green-800",children:[a.jsx(sh,{className:"mr-1 h-3 w-3"})," Reçu"]}):a.jsxs(ke,{className:"bg-orange-100 text-orange-800",children:[a.jsx(Rfe,{className:"mr-1 h-3 w-3"})," En attente"]})}),a.jsx("td",{className:"px-4 py-3",children:c.ad_file_url&&a.jsxs("a",{href:c.ad_file_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline text-xs inline-flex items-center gap-1",children:[a.jsx(Gi,{className:"h-3 w-3"})," Voir le fichier"]}
1260)}),a.jsx("td",{className:"px-4 py-3 text-right",children:a.jsxs("label",{children:[a.jsx("input",{type:"file",className:"hidden",disabled:s===c.id,onChange:d=>{var h;return((h=d.target.files)==null?void 0:h[0])&&l.mutate({pageId:c.id,file:d.target.files[0]})}}),a.jsx(H,{asChild:!0,size:"sm",variant:"outline",disabled:s===c.id,children:a.jsxs("span",{children:[a.jsx(Oa,{className:"mr-1.5 h-3.5 w-3.5"})," ",s===c.id?"Envoiâ¦":c.ad_file_url?"Remplacer":"Upload"]})})]})})]},c.id)})})]})})}function Ivt({issue:t}){const e=St(),[n,r]=b.useState(null),s=async(o,l)=>{r(o);try{const c=l.name.split(".").pop(),u=`magazine/${t.id}/final-${o}-${Date.now()}.${c}`,{error:d}=await Z.storage.from("images").upload(u,l,{upsert:!0});if(d)throw d;const{data:h}=Z.storage.from("images").getPublicUrl(u),f=o==="print"?"pdf_print_url":"pdf_digital_url",{error:p}=await Z.from("magazine_issues").update({[f]:h.publicUrl}).eq("id",t.id);if(p)throw p;e.invalidateQueries({queryKey:["magazine_issue",t.id]}),ee.success("Fichier uploadé")}catch(c){ee.error(c.message)}finally{r(null)}},i=Qe({mutationFn:async()=>{const{error:o}=await Z.from("magazine_issues").update({status:"ready_for_print",print_sent_at:new Date().toISOString()}).eq("id",t.id);if(o)throw o},onSuccess:()=>{e.invalidateQueries({queryKey:["magazine_issue",t.id]}),e.invalidateQueries({queryKey:["admin_magazine_issues"]}),ee.success("Numéro marqué prêt pour impression")},onError:o=>ee.error(o.message)});return a.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[a.jsx(aie,{title:"PDF haute résolution (impression)",description:"Le PDF final destiné à l'imprimeur.",url:t.pdf_print_url,uploading:n==="print",onUpload:o=>s("print",o)}),a.jsx(aie,{title:"PDF basse résolution (numérique)",description:"Le PDF pour la version en ligne / liseuse.",url:t.pdf_digital_url,uploading:n==="digital",onUpload:o=>s("digital",o)}),a.jsxs("div",{className:"md:col-span-2 rounded-xl border border-border bg-card p-5",children:[a.jsx("h3",{className:"font-heading font-semibold",children:"Statut du numéro"}),a.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:["Statut actuel : ",a.jsx("strong",{children:t.status}),t.print_sent_at&&a.jsxs(a.Fragment,{children:[" · Envoyé le ",new Date(t.print_sent_at).toLocaleDateString("fr-FR")]})]}),t.status!=="ready_for_print"&&t.status!=="printing"&&t.status!=="distributed"&&a.jsxs(H,{className:"mt-4",onClick:()=>i.mutate(),disabled:i.isPending||!t.pdf_print_url,children:[a.jsx(sh,{className:"mr-1.5 h-4 w-4"})," Marquer comme prêt pour impression"]}),!t.pdf_print_url&&a.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Uploadez d'abord le PDF haute résolution."})]})]})}function aie({title:t,description:e,url:n,uploading:r,onUpload:s}){return a.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[a.jsx("h3",{className:"font-heading font-semibold",children:t}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:e}),n?a.jsx("div",{className:"mt-4",children:a.jsxs("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline text-sm inline-flex items-center gap-1",children:[a.jsx(Gi,{className:"h-3.5 w-3.5"})," Voir le fichier actuel"]})}):a.jsx("p",{className:"text-xs text-muted-foreground mt-4",children:"Aucun fichier uploadé."}),a.jsxs("label",{className:"block mt-4",children:[a.jsx("input",{type:"file",accept:"application/pdf",className:"hidden",disabled:r,onChange:i=>{var o;return((o=i.target.files)==null?void 0:o[0])&&s(i.target.files[0])}}),a.jsx(H,{asChild:!0,variant:"outline",className:"w-full",disabled:r,children:a.jsxs("span",{children:[a.jsx(Oa,{className:"mr-1.5 h-3.5 w-3.5"})," ",r?"Envoiâ¦":n?"Remplacer":"Uploader le PDF"]})})]})]})}function Dvt(){const{id:t}=Xi(),{data:e,isLoading:n}=Ne({queryKey:["magazine_issue",t],enabled:!!t,queryFn:async()=>(await Z.from("magazine_issues").select("*").eq("id",t).single()).data}),{data:r=[]}=Ne({queryKey:["magazine_articles_full",t],enabled:!!t,queryFn:async()=>{const{data:o}=await Z.from("articles").select("*, categories(name)").eq("magazine_issue_id",t).order("created_at",{ascending:!0});return o??[]}}),{data:s=[]}=Ne({queryKey:["magazine_pages",t],enabled:!!t,queryFn:async()=>{const{data:o}=await Z.from("magazine_pages").select("*").eq("issue_id",t).order("page_number",{ascending:!0});return o??[]}}),{data:i=[]}=Ne({queryKey:["advertisers_min"],queryFn:async()=>(await Z.from("advertisers").select("id, company_name").order("company_name")).data??[]});return n?a.jsxs("div",{className:"space-y-4",children:[a.jsx(Xt,{className:"h-8 w-64"}),a.jsx(Xt,{className:"h-12 w-full"}),a.jsx(Xt,{className:"h-96 w-full"})]}):e?a.jsxs("div",{children:[a.jsx("div",{className:"mb-4 flex items-center gap-2",children:a.jsx(H,{variant:"ghost",size:"sm",asChild:!0,children:a.jsxs(_e,{to:"/admin/magazine",children:[a.jsx(jr,{className:"mr-1.5 h-4 w-4"})," Retour"]}
1260)})}),a.jsxs("div",{className:"mb-6 flex flex-wrap items-center gap-3",children:[a.jsx(Pu,{className:"h-6 w-6 text-primary"}),a.jsxs("h1",{className:"font-heading text-2xl font-bold",children:["N°",e.issue_number," â ",e.title||"Sans titre"]}),a.jsx(ke,{className:`${vJe[e.status]||""}`,children:gJe[e.status]||e.status}),e.publication_date&&a.jsxs("span",{className:"text-sm text-muted-foreground",children:["Publication : ",new Date(e.publication_date).toLocaleDateString("fr-FR")]})]}),a.jsxs(Qi,{defaultValue:"overview",className:"w-full",children:[a.jsxs(wi,{className:"flex w-full flex-wrap h-auto",children:[a.jsx(wt,{value:"overview",children:"Vue d'ensemble"}),a.jsxs(wt,{value:"articles",children:["Articles (",r.length,")"]}),a.jsx(wt,{value:"flatplan",children:"Chemin de fer"}),a.jsx(wt,{value:"export",children:"Export InDesign"}),a.jsx(wt,{value:"ads",children:"Publicités"}),a.jsx(wt,{value:"final",children:"Fichier final"})]}),a.jsx(kt,{value:"overview",className:"mt-6",children:a.jsx(Svt,{issue:e,articles:r,pages:s})}),a.jsx(kt,{value:"articles",className:"mt-6",children:a.jsx(kvt,{articles:r,issueId:e.id,issueNumber:e.issue_number})}),a.jsx(kt,{value:"flatplan",className:"mt-6",children:a.jsx(Evt,{issue:e,pages:s,articles:r,advertisers:i})}),a.jsx(kt,{value:"export",className:"mt-6",children:a.jsx(Tvt,{issue:e,articles:r,pages:s,advertisers:i})}),a.jsx(kt,{value:"ads",className:"mt-6",children:a.jsx(Ovt,{issue:e,pages:s,advertisers:i})}),a.jsx(kt,{value:"final",className:"mt-6",children:a.jsx(Ivt,{issue:e})})]})]}):a.jsxs("div",{children:[a.jsx(H,{variant:"ghost",size:"sm",asChild:!0,children:a.jsxs(_e,{to:"/admin/magazine",children:[a.jsx(jr,{className:"mr-1.5 h-4 w-4"})," Retour"]})}),a.jsx("p",{className:"mt-6 text-muted-foreground",children:"Numéro introuvable."})]})}const LS=Object.keys(wC);function Lvt(){const[t,e]=b.useState(LS[0]),[n,r]=b.useState(()=>{const d={};return LS.forEach(h=>d[h]=wC[h].defaultContent),d}),[s,i]=b.useState(!0),[o,l]=b.useState(!1);b.useEffect(()=>{(async()=>{const{data:d}=await Mt.from("site_settings").select("key, value").in("key",LS);d&&r(h=>{const f={...h};for(const p of d){const m=p.value,v=typeof m=="string"?m:m==null?void 0:m.html;v&&(f[p.key]=v)}return f}),i(!1)})()},[]);const c=async()=>{l(!0);const{error:d}=await Mt.from("site_settings").upsert({key:t,value:{html:n[t]}},{onConflict:"key"});l(!1),d?ee.error("Erreur : "+d.message):ee.success("Page enregistrée")},u=()=>{r(d=>({...d,[t]:wC[t].defaultContent}))};return a.jsxs("div",{className:"mx-auto max-w-5xl",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Bfe,{className:"h-6 w-6 text-primary"}),a.jsx("h1",{className:"font-heading text-2xl font-bold",children:"Pages légales"})]}),a.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Ãditez le contenu HTML de chaque page légale. Les pages publiques chargent automatiquement la version enregistrée."}),a.jsxs(Qi,{value:t,onValueChange:d=>e(d),className:"mt-6",children:[a.jsx(wi,{className:"flex-wrap",children:LS.map(d=>a.jsx(wt,{value:d,children:wC[d].title},d))}),LS.map(d=>a.jsxs(kt,{value:d,className:"mt-4",children:[a.jsx(fn,{value:n[d],onChange:h=>r(f=>({...f,[d]:h.target.value})),disabled:s,rows:24,className:"font-mono text-xs"}),a.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:["Astuce : utilisez des balises ",a.jsx("code",{children:'<h2 id="...">'})," pour générer le sommaire automatique."]})]},d))]}),a.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[a.jsx(H,{variant:"outline",onClick:u,disabled:o,children:"Réinitialiser au contenu par défaut"}),a.jsx(H,{onClick:c,disabled:o||s,children:o?"Enregistrement...":"Enregistrer"})]})]})}const Fvt={homepage:"Accueil",footer:"Footer",newsletter_page:"Page newsletter",import:"Import",manual:"Ajout manuel",unknown:"â"};function $vt(){const t=St(),[e,n]=b.useState(""),[r,s]=b.useState("active"),[i,o]=b.useState("all"),{data:l=[],isLoading:c}=Ne({queryKey:["admin_newsletter_subs"],queryFn:async()=>{const{data:f,error:p}=await Z.from("newsletter_subscribers").select("id,email,first_name,source,is_active,created_at,unsubscribed_at").order("created_at",{ascending:!1}).limit(2e3);if(p)throw p;return f??[]}}),u=b.useMemo(()=>{const f=e.trim().toLowerCase();return l.filter(p=>!(r==="active"&&!p.is_active||r==="unsub"&&p.is_active||i!=="all"&&(p.source??"unknown")!==i||f&&!p.email.toLowerCase().includes(f)))},[l,e,r,i]),d=b.useMemo(()=>{const f=new Date(new Date().getFullYear(),new Date().getMonth(),1),p=l.filter(x=>x.is_active).length,m=l.filter(x=>x.is_active&&new Date(x.created_at)>=f).length,v=l.filter(x=>x.unsubscribed_at&&new Date(x.unsubscribed_at)>=f).length;return{active:p,newThisMonth:m,unsubThisMonth:v}},[l]),h=()=>{const p=["email,first_name,source,created_at",...l.filter(g=>g.is_active).map(g=>[g.email,g.first_name??"",g.source??"",g.created_at].map(w=>`"${String(w).replace(/"/g,'""')}"`).join(","))].join(` 1261`),m=new Blob([p],{type:"text/csv;charset=utf-8"}),v=URL.createObjectURL(m),x=document.createElement("a");x.href=v,x.download=`newsletter-${new Date().toISOString().slice(0,10)}.csv`,x.click(),URL.revokeObjectURL(v)};return a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Ru,{className:"h-6 w-6 text-muted-foreground"}),a.jsx("h1",{className:"font-heading text-2xl font-bold",children:"Newsletter"})]}),a.jsxs(Qi,{defaultValue:"subscribers",className:"mt-6",children:[a.jsxs(wi,{children:[a.jsx(wt,{value:"subscribers",children:"Abonnés"}),a.jsx(wt,{value:"send",children:"Envoyer"}),a.jsx(wt,{value:"settings",children:"Paramètres"})]}),a.jsxs(kt,{value:"subscribers",className:"space-y-4",children:[a.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[a.jsx(Iz,{label:"Abonnés actifs",value:d.active}),a.jsx(Iz,{label:"Nouveaux ce mois",value:d.newThisMonth,accent:"text-green-600"}),a.jsx(Iz,{label:"Désabonnés ce mois",value:d.unsubThisMonth,accent:"text-red-600"})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[a.jsx(ue,{placeholder:"Rechercher un emailâ¦",value:e,onCh
1261ange:f=>n(f.target.value),className:"max-w-xs"}),a.jsxs(lt,{value:r,onValueChange:f=>s(f),children:[a.jsx(nt,{className:"w-40",children:a.jsx(ct,{})}),a.jsxs(rt,{children:[a.jsx(Ae,{value:"active",children:"Actifs"}),a.jsx(Ae,{value:"unsub",children:"Désabonnés"}),a.jsx(Ae,{value:"all",children:"Tous"})]})]}),a.jsxs(lt,{value:i,onValueChange:o,children:[a.jsx(nt,{className:"w-44",children:a.jsx(ct,{placeholder:"Source"})}),a.jsxs(rt,{children:[a.jsx(Ae,{value:"all",children:"Toutes les sources"}),a.jsx(Ae,{value:"homepage",children:"Accueil"}),a.jsx(Ae,{value:"footer",children:"Footer"}),a.jsx(Ae,{value:"newsletter_page",children:"Page newsletter"}),a.jsx(Ae,{value:"manual",children:"Ajout manuel"}),a.jsx(Ae,{value:"import",children:"Import"}),a.jsx(Ae,{value:"unknown",children:"Inconnue"})]})]}),a.jsxs("div",{className:"ml-auto flex gap-2",children:[a.jsxs(H,{variant:"outline",onClick:h,children:[a.jsx(Ts,{className:"mr-2 h-4 w-4"}),"Exporter CSV"]}),a.jsx(zvt,{onAdded:()=>t.invalidateQueries({queryKey:["admin_newsletter_subs"]})})]})]}),a.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card",children:a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"bg-muted/50 text-left text-xs uppercase text-muted-foreground",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-4 py-3",children:"Email"}),a.jsx("th",{className:"px-4 py-3",children:"Prénom"}),a.jsx("th",{className:"px-4 py-3",children:"Source"}),a.jsx("th",{className:"px-4 py-3",children:"Inscrit le"}),a.jsx("th",{className:"px-4 py-3",children:"Statut"}),a.jsx("th",{className:"px-4 py-3 text-right",children:"Actions"})]})}),a.jsxs("tbody",{children:[c&&a.jsx("tr",{children:a.jsx("td",{colSpan:6,className:"p-6 text-center text-muted-foreground",children:"Chargementâ¦"})}),!c&&u.length===0&&a.jsx("tr",{children:a.jsx("td",{colSpan:6,className:"p-6 text-center text-muted-foreground",children:"Aucun abonné"})}),u.map(f=>a.jsxs("tr",{className:"border-t border-border",children:[a.jsx("td",{className:"px-4 py-3 font-medium",children:f.email}),a.jsx("td",{className:"px-4 py-3",children:f.first_name??"â"}),a.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:Fvt[f.source??"unknown"]??f.source}),a.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:new Date(f.created_at).toLocaleDateString("fr-FR")}),a.jsx("td",{className:"px-4 py-3",children:f.is_active?a.jsx(ke,{className:"bg-green-100 text-green-800",children:"Actif"}):a.jsx(ke,{variant:"secondary",children:"Désabonné"})}),a.jsx("td",{className:"px-4 py-3 text-right",children:a.jsx(H,{size:"sm",variant:"ghost",onClick:async()=>{const p=!f.is_active,{error:m}=await Z.from("newsletter_subscribers").update({is_active:p,unsubscribed_at:p?null:new Date().toISOString()}).eq("id",f.id);m?ee.error("Erreur"):(ee.success(p?"Réactivé":"Désabonné"),t.invalidateQueries({queryKey:["admin_newsletter_subs"]}))},children:f.is_active?"Désabonner":"Réactiver"})})]},f.id))]})]})})})]}),a.jsx(kt,{value:"send",children:a.jsxs("div",{className:"rounded-xl border border-border bg-card p-6 space-y-4",children:[a.jsx("h2",{className:"font-heading text-lg font-semibold",children:"Envoi de newsletters"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"L'envoi de newsletters se fait depuis Brevo (ex-Sendinblue). Connectez votre compte Brevo pour synchroniser automatiquement vos abonnés."}),a.jsxs("ol",{className:"list-decimal space-y-2 pl-5 text-sm",children:[a.jsx("li",{children:"Créez un compte Brevo (gratuit jusqu'à 300 emails/jour)"}),a.jsx("li",{children:"Récupérez votre clé API dans Brevo â Settings â API Keys"}),a.jsxs("li",{children:["Ajoutez-la dans les secrets Supabase Edge Functions : ",a.jsx("code",{className:"rounded bg-muted px-1.5 py-0.5",children:"BREVO_API_KEY"})]}),a.jsx("li",{children:"Les nouveaux abonnés seront synchronisés automatiquement"})]}),a.jsx(H,{asChild:!0,variant:"outline",children:a.jsxs("a",{href:"https://app.brevo.com",target:"_blank",rel:"noopener noreferrer",children:["Ouvrir Brevo ",a.jsx(Gi,{className:"ml-2 h-4 w-4"})]})})]})}),a.jsx(kt,{value:"settings",children:a.jsx(Bvt,{})})]})]})}function Iz({label:t,value:e,accent:n}){return a.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:t}),a.jsx("div",{className:`mt-2 font-heading text-3xl font-bold ${n??""}`,children:e})]})}function zvt({onAdded:t}){const[e,n]=b.useState(!1),[r,s]=b.useState(""),[i,o]=b.useState(""),[l,c]=b.useState(!1),u=async()=>
1261{if(!r)return;c(!0);const{error:d}=await Z.from("newsletter_subscribers").insert({email:r.trim().toLowerCase(),first_name:i.trim()||null,source:"manual",is_active:!0});if(c(!1),d){const h=(d.message||"").toLowerCase();h.includes("duplicate")||h.includes("unique")?ee.info("Cet email est déjà inscrit"):ee.error("Erreur");return}ee.success("Abonné ajouté"),s(""),o(""),n(!1),t()};return a.jsxs(an,{open:e,onOpenChange:n,children:[a.jsx(W_,{asChild:!0,children:a.jsxs(H,{children:[a.jsx(dr,{className:"mr-2 h-4 w-4"}),"Ajouter"]})}),a.jsxs(nn,{children:[a.jsx(on,{children:a.jsx(ln,{children:"Ajouter un abonné"})}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx(te,{children:"Prénom (optionnel)"}),a.jsx(ue,{value:i,onChange:d=>o(d.target.value)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Email"}),a.jsx(ue,{type:"email",value:r,onChange:d=>s(d.target.value)})]})]}),a.jsxs(ss,{children:[a.jsx(H,{variant:"outline",onClick:()=>n(!1),children:"Annuler"}),a.jsx(H,{onClick:u,disabled:l||!r,children:l?"...":"Ajouter"})]})]})]})}function Bvt(){var u,d;const t=St(),{data:e}=Ne({queryKey:["admin_brevo_settings"],queryFn:async()=>{const{data:h}=await Z.from("site_settings").select("key,value").in("key",["brevo_list_id","brevo_auto_sync"]),f={};return(h??[]).forEach(p=>{f[p.key]=p.value}),f}}),[n,r]=b.useState(""),[s,i]=b.useState(!1),[o,l]=b.useState(!1);e&&!o&&(r(typeof e.brevo_list_id=="string"?e.brevo_list_id:((u=e.brevo_list_id)==null?void 0:u.value)??""),i(e.brevo_auto_sync===!0||((d=e.brevo_auto_sync)==null?void 0:d.value)===!0),l(!0));const c=async()=>{const h=[{key:"brevo_list_id",value:n},{key:"brevo_auto_sync",value:s}],{error:f}=await Z.from("site_settings").upsert(h,{onConflict:"key"});f?ee.error("Erreur lors de la sauvegarde"):(ee.success("Paramètres sauvegardés"),t.invalidateQueries({queryKey:["admin_brevo_settings"]}))};return a.jsxs("div",{className:"rounded-xl border border-border bg-card p-6 space-y-5 max-w-2xl",children:[a.jsx("h2",{className:"font-heading text-lg font-semibold",children:"Intégration Brevo"}),a.jsxs("div",{className:"rounded-lg border border-border bg-muted/40 p-4 text-sm",children:[a.jsx("p",{className:"font-medium",children:"Clé API Brevo"}),a.jsxs("p",{className:"mt-1 text-muted-foreground",children:["Pour des raisons de sécurité, la clé API Brevo n'est plus stockée en base. Configurez-la uniquement comme secret Supabase : ",a.jsx("code",{className:"rounded bg-muted px-1 py-0.5",children:"BREVO_API_KEY"}),". Les edge functions la lisent automatiquement."]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"ID de la liste Brevo"}),a.jsx(ue,{value:n,onChange:h=>r(h.target.value),placeholder:"Ex: 12"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"ID numérique de la liste de contacts où synchroniser les abonnés."})]}),a.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border p-4",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-base",children:"Synchronisation automatique"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Ajoute chaque nouvel inscrit dans la liste Brevo."})]}),a.jsx(_n,{checked:s,onCheckedChange:i})]}),a.jsx(H,{onClick:c,children:"Enregistrer"})]})}const Sv=Z,oie=[{url:"/",label:"Accueil",type:"Page"},{url:"/actualites",label:"Actualités",type:"Page"},{url:"/destinations",label:"Destinations",type:"Page"},{url:"/carnet-adresses",label:"Carnet d'adresses",type:"Page"},{url:"/evenements",label:"Ãvénements",type:"Page"},{url:"/boutique",label:"Boutique",type:"Page"},{url:"/carte-privilege",label:"Carte Privilège",type:"Page"},{url:"/nos-magazines",label:"Nos magazines",type:"Page"},{url:"/points-de-depot",label:"Points de dépôt",type:"Page"},{url:"/contact",label:"Contact",type:"Page"},{url:"/mentions-legales",label:"Mentions légales",type:"Page"},{url:"/politique-confidentialite",label:"Politique de confidentialité",type:"Page"},{url:"/conditions-generales-vente",label:"CGV",type:"Page"}];function XCe({value:t,onChange:e,placeholder:n="Rechercher une page, un article, un partenaireâ¦"}){const[r,s]=b.useState(t),[i,o]=b.useState(!1),[l,c]=b.useState(!1),[u,d]=b.useState([]),h=b.useRef(null);b.useEffect(()=>s(t),[t]),b.useEffect(()=>{const p=m=>{h.current&&!h.current.contains(m.target)&&o(!1)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[]),b.useEffect(()=>{const p=r.trim();if(p.length<2&&!p.startsWith("/")){const x=oie.filter(g=>!p||g.label.toLowerCase().includes(p.toLowerCase())||g.url.includes(p));d(x.slice(0,8));return}let m=!1;c(!0);const v=setTimeout(async()=>{const x=`%${p.replace(/^\//,"")}%`,[g,w,_,j,N,S,C]=await Promise.all([Sv.from("articles").select("slug,title").eq("status","published").or(`title.ilike.${x},slug.ilike.${x}`).limit(6),Sv.from("partners").select("slug,name").eq("is_active",!0).or(`name.ilike.${x},slug.ilike.${x}`).limit(5),Sv.from("travel_guides").select("slug,city").eq("is_active",!0).or(`city.ilike.${x},slug.ilike.${x}`).limit(5),Sv.from("events").select("slug,title").eq("is_active",!0).or(`title.ilike.${x},slug.ilike.${x}`).limit(5),Sv.from("products").select("slug,name").eq("is_active",!0).or(`name.ilike.${x},slug.ilike.${x}`).limit(5),Sv.from("magazine_issues").select("id,issue_number,title").or(`title.ilike.${x}`).limit(3),Sv.from("categories").select("slug,name").or(`name.ilike.${x},slug.ilike.${x}`).limit(4)]);if(m)return;const k=[],E=p.toLowerCase();for(const P of oie)(P.label.toLowerCase().includes(E)||P.url.includes(E))&&k.push(P);for(const P of g.data??[])k.push({url:`/actualites/${P.slug}`,label:P.title,type:"Article"});for(const P of w.data??[])k.push({url:`/carnet-adresses/${P.slug}`,label:P.name,type:"Partenaire"});for(const P of _.data??[])k.push({url:`/destinations/${P.slug}`,label:P.city,type:"Guide"});for(const P of j.data??[])k.push({url:`/evenements/${P.slug}`,label:P.title,type:"Ãvénement"});for(const P of N.data??[])k.push({url:`/boutique/${P.slug}`,label:P.name,type:"Produit"});for(const P of S.data??[])k.push({url:`/nos-magazines/${P.issue_number}`,label:P.title||`N°${P.issue_number}`,type:"Magazine"});for(const P of C.data??[])k.push({url:`/actualites?categorie=${P.slug}`,label:P.name,type:"Catégorie"});d(k.slice(0,20)),c(!1)},200);return()=>{m=!0,clearTimeout(v)}},[r]);const f=p=>{e(p.url),s(p.url),o(!1)};return a.jsxs("div",{ref:h,className:"relative",children:[a.jsxs("div",{className:"relative",children:[a.jsx(is,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"}),a.jsx(ue,{className:"pl-9 pr-9",value:r,placeholder:n,onChange:p=>
1261{s(p.target.value),e(p.target.value),o(!0)},onFocus:()=>o(!0)}),r&&a.jsx("button",{type:"button",onClick:()=>{s(""),e(""),o(!0)},className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 text-muted-foreground hover:text-foreground",children:a.jsx(ks,{className:"h-3 w-3"})})]}),i&&a.jsxs("div",{className:"absolute z-50 mt-1 w-full rounded-md border bg-popover shadow-lg max-h-72 overflow-y-auto",children:[l&&a.jsxs("div",{className:"px-3 py-2 text-xs text-muted-foreground flex items-center gap-2",children:[a.jsx(Je,{className:"h-3 w-3 animate-spin"})," Rechercheâ¦"]}),!l&&u.length===0&&a.jsx("div",{className:"px-3 py-3 text-xs text-muted-foreground",children:"Aucun résultat. Vous pouvez saisir une URL manuellement."}),u.map(p=>a.jsxs("button",{type:"button",onClick:()=>f(p),className:"w-full text-left px-3 py-2 hover:bg-accent flex items-center justify-between gap-2 border-b last:border-0",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("div",{className:"text-sm truncate",children:p.label}),a.jsx("div",{className:"text-xs text-muted-foreground font-mono truncate",children:p.url})]}),a.jsx(ke,{variant:"outline",className:"shrink-0 text-[10px]",children:p.type})]},`${p.type}-${p.url}`))]})]})}const js=Z;function dV(t){return t?new Date(t).toLocaleString("fr-FR",{dateStyle:"short",timeStyle:"short"}):"â"}function Uvt(){return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"font-heading text-2xl font-bold flex items-center gap-2",children:[a.jsx(Tfe,{className:"h-6 w-6"})," Redirections & erreurs 404"]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Gérez les URLs introuvables et créez des redirections personnalisées."})]}),a.jsxs(Qi,{defaultValue:"errors",children:[a.jsxs(wi,{children:[a.jsx(wt,{value:"errors",children:"Erreurs 404"}),a.jsxs(wt,{value:"suggestions",children:[a.jsx(OW,{className:"h-3.5 w-3.5 mr-1"}),"Suggestions auto"]}),a.jsx(wt,{value:"redirects",children:"Redirections"}),a.jsx(wt,{value:"import",children:"Import en masse"})]}),a.jsx(kt,{value:"errors",className:"mt-6",children:a.jsx(qvt,{})}),a.jsx(kt,{value:"suggestions",className:"mt-6",children:a.jsx(Gvt,{})}),a.jsx(kt,{value:"redirects",className:"mt-6",children:a.jsx(Hvt,{})}),a.jsx(kt,{value:"import",className:"mt-6",children:a.jsx(Kvt,{})})]})]})}function qvt(){const t=St(),[e,n]=b.useState("unresolved"),[r,s]=b.useState(""),[i,o]=b.useState(null),{data:l=[],isLoading:c}=Ne({queryKey:["admin_404s",e],queryFn:async()=>{let f=js.from("error_logs_404").select("*").order("hit_count",{ascending:!1}).limit(500);e==="unresolved"&&(f=f.eq("is_resolved",!1)),e==="resolved"&&(f=f.eq("is_resolved",!0));const{data:p}=await f;return p??[]}}),u=b.useMemo(()=>l.filter(f=>!r||f.url.toLowerCase().includes(r.toLowerCase())),[l,r]),d=Qe({mutationFn:async f=>{await js.from("error_logs_404").update({is_resolved:!0}).eq("id",f)},onSuccess:()=>{t.invalidateQueries({queryKey:["admin_404s"]}),ee.success("Marqué résolu")}}),h=Qe({mutationFn:async f=>{await js.from("error_logs_404").delete().eq("id",f)},onSuccess:()=>{t.invalidateQueries({queryKey:["admin_404s"]}),ee.success("Supprimé")}});return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex flex-wrap gap-3 items-center",children:[a.jsxs(lt,{value:e,onValueChange:f=>n(f),children:[a.jsx(nt,{className:"w-48",children:a.jsx(ct,{})}),a.jsxs(rt,{children:[a.jsx(Ae,{value:"unresolved",children:"Non résolues"}),a.jsx(Ae,{value:"resolved",children:"Résolues"}),a.jsx(Ae,{value:"all",children:"Toutes"})]})]}),a.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[a.jsx(is,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(ue,{className:"pl-9",placeholder:"Rechercher une URLâ¦",value:r,onChange:f=>s(f.target.value)})]})]}),a.jsx("div",{className:"rounded-lg border bg-card overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"bg-muted/50",children:a.jsxs("tr",{children:[a.jsx("th",{className:"text-left p-3",children:"URL"}),a.jsx("th",{className:"text-left p-3",children:"Hits"}),a.jsx("th",{className:"text-left p-3",children:"Première"}),a.jsx("th",{className:"text-left p-3",children:"Dernière"}),a.jsx("th",{className:"text-left p-3",children:"Referrer"}),a.jsx("th",{className:"text-left p-3",children:"Statut"}),a.jsx("th",{className:"text-right p-3",children:"Actions"})]})}),a.jsx("tbody",{children:c?a.jsx("tr",{children:a.jsx("td",{colSpan:7,className:"p-6 text-center text-muted-foreground",children:"Chargementâ¦"})}):u.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:7,className:"p-6 text-center text-muted-foreground",children:"Aucune erreur 404"})}):u.map(f=>a.jsxs("tr",{className:"border-t",children:[a.jsx("td",{className:"p-3 font-mono text-xs max-w-xs truncate",title:f.url,children:f.url}),a.jsx("td",{className:"p-3",children:a.jsx(ke,{variant:"secondary",children:f.hit_count})}),a.jsx("td",{className:"p-3 text-xs text-muted-foreground",children:dV(f.first_seen_at)}),a.jsx("td",{className:"p-3 text-xs text-muted-foreground",children:dV(f.last_seen_at)}),a.jsx("td",{className:"p-3 text-xs text-muted-foreground max-w-[200px] truncate",title:f.referrer||"",children:f.referrer||"â"}),a.jsx("td",{className:"p-3",children:f.is_resolved?a.jsx(ke,{className:"bg-green-100 text-green-800",children:"Résolu"}):a.jsx(ke,{variant:"destructive",children:"404"})}),a.jsx("td",{className:"p-3",children:a.jsxs("div",{className:"flex gap-1 justify-end",children:[!f.is_resolved&&a.jsxs(a.Fragment,{children:[a.jsxs(H,{size:"sm",variant:"default",onClick:()=>o(f),children:[a.jsx(dr,{className:"h-3 w-3 mr-1"}),"Rediriger"]}),a.jsx(H,{size:"sm",variant:"outline",onClick:()=>d.mutate(f.id),children:"Ignorer"})]}),a.jsx(H,{size:"sm",variant:"ghost",onClick:()=>h.mutate(f.id),children:a.jsx(tr,{className:"h-3 w-3"})})]})})]},f.id))})]})}),i&&a.jsx(Vvt,{errorLog:i,onClose:()=>o(null),onSuccess:()=>{o(null),t.invalidateQueries({queryKey:["admin_404s"]}),t.invalidateQueries({queryKey:["admin_redirects"]})}})]})}function Vvt({errorLog:t,onClose:e,onSuccess:n}){const[r,s]=b.useState(""),[i,o]=b.useState(301),[l,c]=b.useState(null);b.useMemo(()=>
1261{const d=t.url.split("/").filter(Boolean).pop()||"";d&&(async()=>{var m,v,x;const[h,f,p]=await Promise.all([js.from("articles").select("slug, title").ilike("slug",`%${d}%`).limit(1),js.from("partners").select("slug, name").ilike("slug",`%${d}%`).limit(1),js.from("travel_guides").select("slug, city").ilike("slug",`%${d}%`).limit(1)]);(m=h.data)!=null&&m[0]?c(`/actualites/${h.data[0].slug}`):(v=f.data)!=null&&v[0]?c(`/carnet-adresses/${f.data[0].slug}`):(x=p.data)!=null&&x[0]&&c(`/destinations/${p.data[0].slug}`)})()},[t.url]);const u=async()=>{if(!r.startsWith("/")&&!r.startsWith("http")){ee.error("L'URL de destination doit commencer par / ou http");return}const{error:d}=await js.from("custom_redirects").insert({source_url:t.url,target_url:r,redirect_type:i,is_active:!0});if(d){ee.error(d.message);return}await js.from("error_logs_404").update({is_resolved:!0,redirect_to:r}).eq("id",t.id),ee.success("Redirection créée"),n()};return a.jsx(an,{open:!0,onOpenChange:e,children:a.jsxs(nn,{children:[a.jsx(on,{children:a.jsx(ln,{children:"Créer une redirection"})}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(te,{children:"URL source"}),a.jsx(ue,{value:t.url,disabled:!0})]}),l&&a.jsxs("div",{className:"rounded-lg border border-primary/30 bg-primary/5 p-3 text-sm",children:[a.jsx("p",{className:"mb-2",children:"Suggestion détectée :"}),a.jsx("code",{className:"text-xs",children:l}),a.jsx(H,{size:"sm",variant:"link",onClick:()=>s(l),children:"Utiliser"})]}),a.jsxs("div",{children:[a.jsx(te,{children:"URL de destination"}),a.jsx(XCe,{value:r,onChange:s})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Type"}),a.jsxs(lt,{value:String(i),onValueChange:d=>o(Number(d)),children:[a.jsx(nt,{children:a.jsx(ct,{})}),a.jsxs(rt,{children:[a.jsx(Ae,{value:"301",children:"301 â Permanent"}),a.jsx(Ae,{value:"302",children:"302 â Temporaire"})]})]})]})]}),a.jsxs(ss,{children:[a.jsx(H,{variant:"outline",onClick:e,children:"Annuler"}),a.jsx(H,{onClick:u,disabled:!r,children:"Enregistrer"})]})]})})}function Hvt(){const t=St(),[e,n]=b.useState(null),[r,s]=b.useState(!1),{data:i=[],isLoading:o}=Ne({queryKey:["admin_redirects"],queryFn:async()=>{const{data:u}=await js.from("custom_redirects").select("*").order("last_used_at",{ascending:!1,nullsFirst:!1});return u??[]}}),l=Qe({mutationFn:async u=>{await js.from("custom_redirects").update({is_active:!u.is_active}).eq("id",u.id)},onSuccess:()=>t.invalidateQueries({queryKey:["admin_redirects"]})}),c=Qe({mutationFn:async u=>{await js.from("custom_redirects").delete().eq("id",u)},onSuccess:()=>{t.invalidateQueries({queryKey:["admin_redirects"]}),ee.success("Supprimée")}});return a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"flex justify-end",children:a.jsxs(H,{onClick:()=>s(!0),children:[a.jsx(dr,{className:"h-4 w-4 mr-2"}),"Nouvelle redirection"]})}),a.jsx("div",{className:"rounded-lg border bg-card overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"bg-muted/50",children:a.jsxs("tr",{children:[a.jsx("th",{className:"text-left p-3",children:"Source"}),a.jsx("th",{className:"text-left p-3",children:"Destination"}),a.jsx("th",{className:"text-left p-3",children:"Type"}),a.jsx("th",{className:"text-left p-3",children:"Hits"}),a.jsx("th",{className:"text-left p-3",children:"Dernière"}),a.jsx("th",{className:"text-left p-3",children:"Actif"}),a.jsx("th",{className:"text-right p-3",children:"Actions"})]})}),a.jsx("tbody",{children:o?a.jsx("tr",{children:a.jsx("td",{colSpan:7,className:"p-6 text-center text-muted-foreground",children:"Chargementâ¦"})}):i.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:7,className:"p-6 text-center text-muted-foreground",children:"Aucune redirection"})}):i.map(u=>a.jsxs("tr",{className:"border-t",children:[a.jsx("td",{className:"p-3 font-mono text-xs",children:u.source_url}),a.jsx("td",{className:"p-3 font-mono text-xs",children:a.jsxs("span",{className:"inline-flex items-center gap-1",children:[u.target_url,a.jsx(Gi,{className:"h-3 w-3 opacity-50"})]})}),a.jsx("td",{className:"p-3",children:a.jsx(ke,{variant:"outline",children:u.redirect_type})}),a.jsx("td",{className:"p-3",children:a.jsx(ke,{variant:"secondary",children:u.hit_count})}),a.jsx("td",{className:"p-3 text-xs text-muted-foreground",children:dV(u.last_used_at)}),a.jsx("td",{className:"p-3",children:a.jsx(_n,{checked:u.is_active,onCheckedChange:()=>l.mutate(u)})}),a.jsx("td",{className:"p-3",children:a.jsxs("div",{className:"flex gap-1 justify-end",children:[a.jsx(H,{size:"sm",variant:"ghost",onClick:()=>n(u),children:a.jsx(l5e,{className:"h-3 w-3"})}),a.jsx(H,{size:"sm",variant:"ghost",onClick:()=>c.mutate(u.id),children:a.jsx(tr,{className:"h-3 w-3"})})]})})]},u.id))})]})}),(r||e)&&a.jsx(Wvt,{redirect:e,onClose:()=>{s(!1),n(null)},onSuccess:()=>{s(!1),n(null),t.invalidateQueries({queryKey:["admin_redirects"]})}})]})}function Wvt({redirect:t,onClose:e,onSuccess:n}){const[r,s]=b.useState((t==null?void 0:t.source_url)||""),[i,o]=b.useState((t==null?void 0:t.target_url)||""),[l,c]=b.useState((t==null?void 0:t.redirect_type)||301),[u,d]=b.useState((t==null?void 0:t.is_active)??!0),h=async()=>
1261{if(!r.startsWith("/")){ee.error("La source doit commencer par /");return}if(!i){ee.error("Destination requise");return}if(t){const{error:f}=await js.from("custom_redirects").update({source_url:r,target_url:i,redirect_type:l,is_active:u}).eq("id",t.id);if(f){ee.error(f.message);return}}else{const{error:f}=await js.from("custom_redirects").insert({source_url:r,target_url:i,redirect_type:l,is_active:u});if(f){ee.error(f.message);return}}ee.success("Enregistrée"),n()};return a.jsx(an,{open:!0,onOpenChange:e,children:a.jsxs(nn,{children:[a.jsx(on,{children:a.jsxs(ln,{children:[t?"Modifier":"Nouvelle"," redirection"]})}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(te,{children:"URL source"}),a.jsx(ue,{value:r,onChange:f=>s(f.target.value),placeholder:"/ancienne-url"})]}),a.jsxs("div",{children:[a.jsx(te,{children:"URL destination"}),a.jsx(XCe,{value:i,onChange:o})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Type"}),a.jsxs(lt,{value:String(l),onValueChange:f=>c(Number(f)),children:[a.jsx(nt,{children:a.jsx(ct,{})}),a.jsxs(rt,{children:[a.jsx(Ae,{value:"301",children:"301 â Permanent"}),a.jsx(Ae,{value:"302",children:"302 â Temporaire"})]})]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(_n,{checked:u,onCheckedChange:d}),a.jsx(te,{children:"Actif"})]})]}),a.jsxs(ss,{children:[a.jsx(H,{variant:"outline",onClick:e,children:"Annuler"}),a.jsx(H,{onClick:h,children:"Enregistrer"})]})]})})}function Kvt(){const[t,e]=b.useState(""),[n,r]=b.useState(null),s=St(),i=async()=>{const o=t.split(` 1262`).map(d=>d.trim()).filter(Boolean);let l=0,c=0;const u=[];for(const d of o){const h=d.split(/â|->|=>/);if(h.length!==2){c++,u.push(`Format invalide : ${d}`);continue}const f=h[0].trim(),p=h[1].trim();if(!f.startsWith("/")){c++,u.push(`Source invalide : ${f}`);continue}const{error:m}=await js.from("custom_redirects").upsert({source_url:f,target_url:p,redirect_type:301,is_active:!0},{onConflict:"source_url"});m?(c++,u.push(`${f} : ${m.message}`)):l++}r({ok:l,ko:c,errors:u}),s.invalidateQueries({queryKey:["admin_redirects"]}),ee.success(`${l} importées, ${c} erreurs`)};return a.jsxs("div",{className:"space-y-4 max-w-3xl",children:[a.jsxs("p",{className:"text-sm text-muted-foreground",children:["Une redirection par ligne, séparées par ",a.jsx("code",{children:"â"}),", ",a.jsx("code",{children:"->"})," ou ",a.jsx("code",{children:"=>"}),"."]}),a.jsx(fn,{rows:12,value:t,onChange:o=>e(o.target.value),placeholder:`/actualites/c/0/i/12345/mon-article â /actualites/mon-article 1263/les-avantages/i/67890/partenaire â /carnet-adresses/partenaire`,className:"font-mono text-xs"}),a.jsxs(H,{onClick:i,disabled:!t.trim(),children:[a.jsx(Oa,{className:"h-4 w-4 mr-2"}),"Importer"]}),n&&a.jsxs("div",{className:"rounded-lg border bg-card p-4 text-sm",children:[a.jsxs("p",{className:"flex items-center gap-2 text-green-700",children:[a.jsx(Ma,{className:"h-4 w-4"}),n.ok," redirections importées"]}),n.ko>0&&a.jsxs("p",{className:"flex items-center gap-2 text-destructive mt-1",children:[a.jsx(ks,{className:"h-4 w-4"}),n.ko," erreurs"]}),n.errors.length>0&&a.jsx("ul",{className:"mt-2 space-y-1 text-xs text-muted-foreground",children:n.errors.map((o,l)=>a.jsxs("li",{children:["⢠",o]},l))})]})]})}function Dz(t,e){if(!t||!e)return 0;let n=0;for(;n<t.length&&n<e.length&&t[n]===e[n];)n++;return Math.round(n/Math.max(t.length,e.length)*100)}function Gvt(){const t=St(),[e,n]=b.useState(!1),[r,s]=b.useState([]),[i,o]=b.useState(40),[l,c]=b.useState(!1),u=async()=>{n(!0);try{const{data:v}=await js.from("error_logs_404").select("id, url, hit_count").eq("is_resolved",!1).order("hit_count",{ascending:!1}).limit(200),x=[];for(const g of v??[]){const w=g.url.split("/").filter(Boolean),_=w[w.length-1]||"";if(!_||_.length<4)continue;const j=_.slice(0,Math.min(15,Math.max(8,Math.floor(_.length/2)))),[N,S,C]=await Promise.all([js.from("articles").select("slug, title").eq("status","published").ilike("slug",`${j}%`).limit(5),js.from("partners").select("slug, name").ilike("slug",`${j}%`).limit(5),js.from("travel_guides").select("slug, city").ilike("slug",`${j}%`).limit(5)]),k=[];
1263(N.data??[]).forEach(P=>k.push({url:`/actualites/${P.slug}`,label:P.title,score:Dz(_,P.slug)})),(S.data??[]).forEach(P=>k.push({url:`/carnet-adresses/${P.slug}`,label:P.name,score:Dz(_,P.slug)})),(C.data??[]).forEach(P=>k.push({url:`/destinations/${P.slug}`,label:P.city,score:Dz(_,P.slug)})),k.sort((P,T)=>T.score-P.score);const E=k.slice(0,3);E.length&&E[0].score>=30&&x.push({errorId:g.id,source:g.url,hits:g.hit_count,oldSlug:_,candidates:E,selected:E[0].score>=60,chosenTarget:E[0].url})}s(x),ee.success(`${x.length} suggestion(s) trouvée(s)`)}catch(v){ee.error(v.message||"Erreur lors du scan")}finally{n(!1)}},d=b.useMemo(()=>r.filter(v=>{var x;return(((x=v.candidates[0])==null?void 0:x.score)??0)>=i}),[r,i]),h=d.filter(v=>v.selected).length,f=v=>{s(x=>x.map(g=>{var w;return(((w=g.candidates[0])==null?void 0:w.score)??0)>=i?{...g,selected:v}:g}))},p=(v,x)=>{s(g=>g.map(w=>w.errorId===v?{...w,...x}:w))},m=async()=>{const v=d.filter(w=>w.selected&&w.chosenTarget);if(!v.length){ee.error("Aucune suggestion sélectionnée");return}c(!0);let x=0,g=0;for(const w of v){const{error:_}=await js.from("custom_redirects").upsert({source_url:w.source,target_url:w.chosenTarget,redirect_type:301,is_active:!0},{onConflict:"source_url"});if(_){g++;continue}await js.from("error_logs_404").update({is_resolved:!0,redirect_to:w.chosenTarget}).eq("id",w.errorId),x++}c(!1),s(w=>w.filter(_=>!v.find(j=>j.errorId===_.errorId))),t.invalidateQueries({queryKey:["admin_404s"]}),t.invalidateQueries({queryKey:["admin_redirects"]}),ee.success(`${x} redirection(s) créée(s)${g?`, ${g} erreur(s)`:""}`)};return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"rounded-lg border bg-muted/30 p-4 text-sm",children:[a.jsxs("p",{className:"mb-2",children:[a.jsx("strong",{children:"Suggestions automatiques :"})," scanne les erreurs 404 non résolues et propose la meilleure cible existante (articles, partenaires, guides) selon la similarité du slug."]}),a.jsx("p",{className:"text-muted-foreground text-xs",children:"Score = % de caractères en préfixe commun. Cochez les suggestions correctes puis appliquez en masse."})]}),a.jsxs("div",{className:"flex flex-wrap gap-3 items-center",children:[a.jsxs(H,{onClick:u,disabled:e,children:[e?a.jsx(Je,{className:"h-4 w-4 mr-2 animate-spin"}):a.jsx(OW,{className:"h-4 w-4 mr-2"}),"Scanner les 404"]}),r.length>0&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(te,{className:"text-xs",children:"Score min"}),a.jsxs(lt,{value:String(i),onValueChange:v=>o(Number(v)),children:[a.jsx(nt,{className:"w-24 h-9",children:a.jsx(ct,{})}),a.jsxs(rt,{children:[a.jsx(Ae,{value:"30",children:"30 %"}),a.jsx(Ae,{value:"40",children:"40 %"}),a.jsx(Ae,{value:"60",children:"60 %"}),a.jsx(Ae,{value:"80",children:"80 %"})]})]})]}),a.jsx(H,{size:"sm",variant:"outline",onClick:()=>f(!0),children:"Tout cocher"}),a.jsx(H,{size:"sm",variant:"outline",onClick:()=>f(!1),children:"Tout décocher"}),a.jsxs("div",{className:"ml-auto flex items-center gap-3",children:[a.jsxs("span",{className:"text-sm text-muted-foreground",children:[h," sélectionnée(s)"]}),a.jsxs(H,{onClick:m,disabled:!h||l,children:[l?a.jsx(Je,{className:"h-4 w-4 mr-2 animate-spin"}):a.jsx(Ma,{className:"h-4 w-4 mr-2"}),"Créer les redirections"]})]})]})]}),r.length===0?a.jsx("div",{className:"rounded-lg border bg-card p-8 text-center text-sm text-muted-foreground",children:e?"Analyse en coursâ¦":"Cliquez sur « Scanner les 404 » pour générer des suggestions."}):a.jsx("div",{className:"rounded-lg border bg-card overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"bg-muted/50",children:a.jsxs("tr",{children:[a.jsx("th",{className:"p-3 w-10"}),a.jsx("th",{className:"text-left p-3",children:"URL 404"}),a.jsx("th",{className:"text-left p-3",children:"Hits"}),a.jsx("th",{className:"text-left p-3",children:"Cible suggérée"}),a.jsx("th",{className:"text-left p-3",children:"Score"}),a.jsx("th",{className:"text-left p-3",children:"Alternatives"})]})}),a.jsx("tbody",{children:d.length===0?a.jsx("tr",{children:a.jsxs("td",{colSpan:6,className:"p-6 text-center text-muted-foreground",children:["Aucune suggestion ⥠",i," %"]})}):d.map(v=>{var x;return a.jsxs("tr",{className:"border-t align-top",children:[a.jsx("td",{className:"p-3",children:a.jsx(wr,{checked:v.selected,onCheckedChange:g=>p(v.errorId,{selected:!!g})})}),a.jsx("td",{className:"p-3 font-mono text-xs max-w-xs break-all",children:v.source}),a.jsx("td",{className:"p-3",children:a.jsx(ke,{variant:"secondary",children:v.hits})}),a.jsxs("td",{className:"p-3 min-w-[280px]",children:[a.jsx(ue,{value:v.chosenTarget,onCh
1263ange:g=>p(v.errorId,{chosenTarget:g.target.value}),className:"font-mono text-xs h-8"}),a.jsx("p",{className:"text-[11px] text-muted-foreground mt-1 truncate",children:(x=v.candidates.find(g=>g.url===v.chosenTarget))==null?void 0:x.label})]}),a.jsx("td",{className:"p-3",children:a.jsxs(ke,{variant:v.candidates[0].score>=80?"default":"outline",children:[v.candidates[0].score," %"]})}),a.jsx("td",{className:"p-3",children:a.jsx("div",{className:"flex flex-col gap-1",children:v.candidates.slice(1).map(g=>a.jsxs("button",{type:"button",onClick:()=>p(v.errorId,{chosenTarget:g.url}),className:"text-left text-[11px] font-mono text-muted-foreground hover:text-primary truncate max-w-[260px]",title:`${g.label} (${g.score} %)`,children:["â ",g.url," ",a.jsxs("span",{className:"opacity-60",children:["(",g.score,"%)"]})]},g.url))})})]},v.errorId)})})]})})]})}const lie=[{value:"commerce",label:"Commerce"},{value:"restaurant",label:"Restaurant"},{value:"hotel",label:"Hôtel"},{value:"office_tourisme",label:"Office de tourisme"}],cie={name:"",address:"",city:"",province:"",postal_code:"",contact_name:"",contact_phone:"",point_type:"commerce",latitude:null,longitude:null,is_active:!0};async function Yvt(t){var e;try{const n=await _2(["places"]),r=new n.maps.Geocoder,s=`${t.name}, ${t.address??""}, ${t.city??""}, AndalucÃa, España`,o=(e=(await r.geocode({address:s,region:"es"})).results)==null?void 0:e[0];if(o){const l=o.geometry.location;return{lat:l.lat(),lon:l.lng()}}}catch{}return null}const WP={south:35.9,west:-7.6,north:38.8,east:-1.6};async function Xvt(t,e){if(t.trim().length<2)return[];try{const n=await _2(["places"]),{AutocompleteSuggestion:r}=await n.maps.importLibrary("places"),{suggestions:s}=await r.fetchAutocompleteSuggestions({input:t,sessionToken:e,includedRegionCodes:["es"],locationBias:{south:WP.south,west:WP.west,north:WP.north,east:WP.east},language:"fr",region:"es"});return(s??[]).map(i=>{var l,c,u,d,h;const o=i.placePrediction;return o?{placeId:o.placeId,primaryText:((c=(l=o.structuredFormat)==null?void 0:l.mainText)==null?void 0:c.text)??((u=o.text)==null?void 0:u.text)??"",secondaryText:((h=(d=o.structuredFormat)==null?void 0:d.secondaryText)==null?void 0:h.text)??""}:null}).filter(Boolean)}catch(n){return console.error("[Places Autocomplete] failed:",n),ee.error(`Places API: ${(n==null?void 0:n.message)??"erreur"}`),[]}}async function Jvt(t,e){const n=await _2(["places"]),{Place:r}=await n.maps.importLibrary("places"),s=new r({id:t});return await s.fetchFields({fields:["displayName","formattedAddress","addressComponents","location","nationalPhoneNumber"],sessionToken:e}),s}function Qvt(){const t=St(),[e,n]=b.useState(""),[r,s]=b.useState("all"),[i,o]=b.useState(new Set),[l,c]=b.useState(!1),[u,d]=b.useState(!1),[h,f]=b.useState(cie),[p,m]=b.useState(!0),[v,x]=b.useState([]),[g,w]=b.useState(!1),[_,j]=b.useState(!1),N=b.useRef(null),S=b.useRef(!1),C=b.useRef(null);b.useEffect(()=>{if(!u){C.current=null;return}_2(["places"]).then(async U=>{const{AutocompleteSessionToken:F}=await U.maps.importLibrary("places");C.current=new F}).catch(()=>{})},[u]),b.useEffect(()=>{if(!u)return;if(S.current){S.current=!1;return}const U=h.name;if(!U||U.trim().length<2){x([]),w(!1);return}j(!0);const F=setTimeout(async()=>{const W=await Xvt(U,C.current);x(W),w(!0),j(!1)},350);return()=>clearTimeout(F)},[h.name,u]),b.useEffect(()=>{const U=F=>{N.current&&!N.current.contains(F.target)&&w(!1)};return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[]);const k=async U=>{var F;S.current=!0,w(!1),j(!0);try{const W=await Jvt(U.placeId,C.current);C.current=null;const Q=W.addressComponents??[],K=re=>{var L;return((L=Q.find(X=>{var ne;return(ne=X.types)==null?void 0:ne.includes(re)}))==null?void 0:L.longText)??""},fe=K("street_number"),oe=K("route"),ye=[fe,oe].filter(Boolean).join(" "),le=K("locality")||K("postal_town")||K("administrative_area_level_2"),me=K("postal_code"),he=K("administrative_area_level_2")||K("administrative_area_level_1"),ae=W.location;f({...h,name:W.displayName??U.primaryText,address:ye||((F=W.formattedAddress)==null?void 0:F.split(",")[0])||h.address,city:le||h.city,postal_code:me||h.postal_code,province:he||h.province,contact_phone:W.nationalPhoneNumber||h.contact_phone,latitude:(ae==null?void 0:ae.lat())??h.latitude,longitude:(ae==null?void 0:ae.lng())??h.longitude}),m(!1)}catch{ee.error("Impossible de charger les détails du lieu")}finally{j(!1)}},{data:E=[],isLoading:P}=Ne({queryKey:["admin_distribution_points"],queryFn:async()=>{const{data:U,error:F}=await Z.from("distribution_points").select("*").order("city").order("name");if(F)throw F;return U}}),T=[...new Set(E.map(U=>
1263U.city))].filter(Boolean).sort(),M=E.filter(U=>{var F,W;return!e||((F=U.name)==null?void 0:F.toLowerCase().includes(e.toLowerCase()))||((W=U.address)==null?void 0:W.toLowerCase().includes(e.toLowerCase()))}).filter(U=>r==="all"||U.city===r),R=M.length>0&&M.every(U=>i.has(U.id)),A=()=>{const U=new Set(i);R?M.forEach(F=>U.delete(F.id)):M.forEach(F=>U.add(F.id)),o(U)},I=U=>{const F=new Set(i);F.has(U)?F.delete(U):F.add(U),o(F)},D=Qe({mutationFn:async U=>{let F={...U};if(p&&(!F.latitude||!F.longitude)){const W=await Yvt(F);W&&(F.latitude=W.lat,F.longitude=W.lon)}if(U.id){const{id:W,...Q}=F,{error:K}=await Z.from("distribution_points").update(Q).eq("id",U.id);if(K)throw K}else{const{error:W}=await Z.from("distribution_points").insert(F);if(W)throw W}},onSuccess:()=>{ee.success(h.id?"Point modifié":"Point ajouté"),t.invalidateQueries({queryKey:["admin_distribution_points"]}),t.invalidateQueries({queryKey:["distribution-points"]}),d(!1)},onError:U=>ee.error(U.message)}),O=Qe({mutationFn:async({id:U,active:F})=>{const{error:W}=await Z.from("distribution_points").update({is_active:F}).eq("id",U);if(W)throw W},onSuccess:()=>t.invalidateQueries({queryKey:["admin_distribution_points"]})}),z=Qe({mutationFn:async()=>{const U=Array.from(i),{error:F}=await Z.from("distribution_points").delete().in("id",U);if(F)throw F},onSuccess:()=>{ee.success(`${i.size} point(s) supprimé(s)`),t.invalidateQueries({queryKey:["admin_distribution_points"]}),t.invalidateQueries({queryKey:["distribution-points"]}),o(new Set),c(!1)},onError:U=>{ee.error(U.message),c(!1)}}),B=()=>{f({...cie}),m(!0),d(!0)},G=U=>{f(U),m(!1),d(!0)};return a.jsxs("div",{children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[a.jsxs("h1",{className:"font-heading text-2xl font-bold",children:["Points de dépôt ",a.jsxs("span",{className:"text-sm font-normal text-muted-foreground",children:["(",E.length,")"]})]}),a.jsxs(H,{onClick:B,children:[a.jsx(dr,{className:"mr-2 h-4 w-4"})," Nouveau point"]})]}),a.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[a.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[a.jsx(is,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(ue,{placeholder:"Rechercherâ¦",value:e,onChange:U=>n(U.target.value),className:"pl-9 h-9"})]}),a.jsxs("select",{className:"rounded-lg border border-border bg-card px-3 py-1.5 text-sm",value:r,onChange:U=>s(U.target.value),children:[a.jsx("option",{value:"all",children:"Toutes villes"}),T.map(U=>a.jsx("option",{value:U,children:U},U))]})]}),i.size>0&&a.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2 rounded-lg border border-primary/30 bg-primary/5 px-4 py-2.5 text-sm",children:[a.jsxs("span",{className:"font-medium",children:[i.size," sélectionné(s)"]}),a.jsxs("div",{className:"ml-auto flex flex-wrap items-center gap-2",children:[a.jsxs(H,{size:"sm",variant:"destructive",onClick:()=>c(!0),children:[a.jsx(tr,{className:"mr-1.5 h-3.5 w-3.5"})," Supprimer"]}),a.jsx(H,{size:"sm",variant:"ghost",onClick:()=>o(new Set),children:"Annuler"})]})]}),P?a.jsx("div",{className:"mt-8 space-y-3",children:[1,2,3].map(U=>a.jsx("div",{className:"h-14 animate-pulse rounded-lg bg-muted"},U))}):a.jsxs("div",{className:"mt-6 overflow-x-auto rounded-xl border border-border bg-card",children:[a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"border-b border-border bg-muted/50",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-3 py-3 w-10",children:a.jsx(wr,{checked:R,onCheckedChange:A})}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Nom"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Adresse"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Ville"}),a.jsx("th",{className:"px-4 py-3 text-center font-medium",children:"Type"}),a.jsx("th",{className:"px-4 py-3 text-center font-medium",children:"Géo"}),a.jsx("th",{className:"px-4 py-3 text-center font-medium",children:"Actif"}),a.jsx("th",{className:"px-4 py-3 text-right font-medium",children:"Actions"})]})}),a.jsx("tbody",{children:M.map(U=>{var F;return a.jsxs("tr",{className:"border-b border-border last:border-0",children:[a.jsx("td",{className:"px-3 py-2",children:a.jsx(wr,{checked:i.has(U.id),onCheckedChange:()=>I(U.id)})}),a.jsx("td",{className:"px-4 py-2 font-medium",children:U.name}),a.jsx("td",{className:"px-4 py-2 text-muted-foreground text-xs",children:U.address}),a.jsx("td",{className:"px-4 py-2 text-muted-foreground",children:U.city}),a.jsx("td",{className:"px-4 py-2 text-center",children:a.jsx(ke,{variant:"outline",className:"text-xs",children:((F=lie.find(W=>W.value===U.point_type))==null?void 0:F.label)||U.point_type})}),a.jsx("td",{className:"px-4 py-2 text-center",children:U.latitude&&U.longitude?a.jsx(_r,{className:"h-4 w-4 text-green-600 inline"}):a.jsx("span",{className:"text-xs text-amber-600",children:"manquant"})}),a.jsx("td",{className:"px-4 py-2 text-center",children:a.jsx(_n,{checked:U.is_active,onCheckedChange:W=>O.mutate({id:U.id,active:W})})}),a.jsx("td",{className:"px-4 py-2 text-right",children:a.jsxs("div",{className:"flex items-center justify-end gap-1",children:[a.jsx(H,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>G(U),children:a.jsx(Oc,{className:"h-3.5 w-3.5"})}),a.jsx(H,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>{o(new Set([U.id])),c(!0)},children:a.jsx(tr,{className:"h-3.5 w-3.5 text-destructive"})})]})})]},U.id)})})]}),M.length===0&&a.jsx("p",{className:"py-8 text-center text-muted-foreground",children:"Aucun point trouvé."})]}),a.jsx(an,{open:u,onOpenChange:d,children:a.jsxs(nn,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[a.jsx(on,{children:a.jsx(ln,{children:h.id?"Modifier le point":"Nouveau point de dépôt"})}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 mt-2",children:[a.jsxs("div",{className:"sm:col-span-2",ref:N,children:[a.jsx(te,{children:"Nom *"}),a.jsxs("div",{className:"relative",children:[a.jsx(ue,{value:h.name,onChange:U=>f({...h,name:U.target.value}),onFocus:()=>{v.length>0&&w(!0)},placeholder:"Tapez le nom du commerceâ¦",autoComplete:"off"}),_&&a.jsx(Je,{className:"absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 animate-spin text-muted-foreground"}),g&&v.length>0&&a.jsx("div",{className:"absolute z-50 mt-1 max-h-72 w-full overflow-y-auto rounded-md border border-border bg-popover shadow-lg",children:v.map((U,F)=>a.jsxs("button",{type:"button",onClick:()=>k(U),className:"block w-full px-3 py-2 text-left text-sm hover:bg-accent",children:[a.jsx("div",{className:"font-medium",children:U.primaryText}),U.secondaryText&&a.jsx("div",{className:"text-xs text-muted-foreground line-clamp-1",children:U.secondaryText})]},U.placeId??F))})]}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Suggestions Google Places (Andalousie) â sélectionnez pour pré-remplir l'adresse, le téléphone et les coordonnées."})]}),a.jsxs("div",{className:"sm:col-span-2",children:[a.jsx(te,{children:"Adresse"}),a.jsx(fn,{rows:2,value:h.address??"",onChange:U=>f({...h,address:U.target.value})})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Ville *"}),a.jsx(ue,{value:h.city??"",onChange:U=>f({...h,city:U.target.value})})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Code postal"}),a.jsx(ue,{value:h.postal_code??"",onChange:U=>f({...h,postal_code:U.target.value})})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Province"}),a.jsx(ue,{value:h.province??"",onChange:U=>f({...h,province:U.target.value})})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Type"}),a.jsxs(lt,{value:h.point_type??"commerce",onValueChange:U=>f({...h,point_type:U}),children:[a.jsx(nt,{children:a.jsx(ct,{})}),a.jsx(rt,{children:lie.map(U=>a.jsx(Ae,{value:U.value,children:U.label},U.value))})]})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Contact"}),a.jsx(ue,{value:h.contact_name??"",onChange:U=>f({...h,contact_name:U.target.value})})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Téléphone"}),a.jsx(ue,{value:h.contact_phone??"",onChange:U=>f({...h,contact_phone:U.target.value})})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Latitude"}),a.jsx(ue,{type:"number",step:"any",value:h.latitude??"",onChange:U=>f({...h,latitude:U.target.value?parseFloat(U.target.value):null})})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Longitude"}),a.jsx(ue,{type:"number",step:"any",value:h.longitude??"",onChange:U=>f({...h,longitude:U.target.value?parseFloat(U.target.value):null})})]}),a.jsxs("div",{className:"sm:col-span-2 flex items-center gap-2 rounded-lg border border-border p-3",children:[a.jsx(_n,{checked:p,onCheckedChange:m,id:"geo"}),a.jsx(te,{htmlFor:"geo",className:"cursor-pointer",children:"Géocoder automatiquement l'adresse (Google Maps)"})]}),a.jsxs("div",{className:"sm:col-span-2 flex items-center gap-2",children:[a.jsx(_n,{checked:h.is_active??!0,onCheckedChange:U=>f({...h,is_active:U}),id:"active"}),a.jsx(te,{htmlFor:"active",className:"cursor-pointer",children:"Actif (visible sur le site)"})]})]}),a.jsxs(ss,{className:"mt-4",children:[a.jsx(H,{variant:"outline",onClick:()=>d(!1),children:"Annuler"}),a.jsx(H,{onClick:()=>D.mutate(h),disabled:!h.name||!h.city||D.isPending,children:D.isPending?"Enregistrementâ¦":"Enregistrer"})]})]})}),a.jsx(ro,{open:l,onOpenChange:c,children:a.jsxs(ja,{children:[a.jsxs(Sa,{children:[a.jsxs(Ca,{children:["Supprimer ",i.size," point(s) ?"]}),a.jsx(ka,{children:"Cette action est irréversible."})]}),a.jsxs(Na,{children:[a.jsx(Ea,{children:"Annuler"}),a.jsx(Aa,{onClick:()=>z.mutate(),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Supprimer"})]})]})})]})}const Zvt=["Malaga","Sevilla","Cadiz","Granada","Cordoba","Almeria","Huelva","Jaen"],JCe=[{value:"city",label:"Grande ville"},{value:"coastal",label:"Ville côtière"},{value:"white_village",label:"Village blanc"},{value:"nature",label:"Site naturel"},{value:"route",label:"Itinéraire"}],ext={city:"",slug:"",province:"Malaga",guide_type:"city",content:"",excerpt:"",cover_image_url:"",gallery:[],latitude:null,longitude:null,is_active:!0};function hV(t){return t.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,"").slice(0,80)}async function uie(t,e){const n=t.name.split(".").pop()||"jpg",r=`travel-guides/${e}-${crypto.randomUUID().slice(0,8)}.${n}`,{error:s}=await Z.storage.from("images").upload(r,t,{upsert:!0});if(s)return ee.error("Upload échoué: "+s.message),null;const{data:i}=Z.storage.from("images").getPublicUrl(r);return i.publicUrl}function txt(){const t=St(),[e,n]=b.useState(""),[r,s]=b.useState(null),[i,o]=b.useState(null),{data:l=[],isLoading:c}=Ne({queryKey:["admin-travel-guides"],queryFn:async()=>{const{data:p,error:m}=await Z.from("travel_guides").select("*").order("city");if(m)throw m;return p}}),u=b.useMemo(()=>{const p=e.trim().toLowerCase();return p?l.filter(m=>[m.city,m.province,m.slug].some(v=>v==null?void 0:v.toLowerCase().includes(p))):l},[l,e]),d=Qe({mutationFn:async p=>{const m={...p,slug:p.slug||hV(p.city)};if(p.id){const{error:v}=await Z.from("travel_guides").update(m).eq("id",p.id);if(v)throw v}else{const{error:v}=await Z.from("travel_guides").insert(m);if(v)throw v}},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-travel-guides"]}),ee.success("Guide enregistré"),s(null)},onError:p=>ee.error(p.message)}),h=Qe({mutationFn:async({id:p,value:m})=>{const{error:v}=await Z.from("travel_guides").update({is_active:m}).eq("id",p);if(v)throw v},onSuccess:()=>
1263t.invalidateQueries({queryKey:["admin-travel-guides"]})}),f=Qe({mutationFn:async p=>{const{error:m}=await Z.from("travel_guides").delete().eq("id",p);if(m)throw m},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-travel-guides"]}),ee.success("Guide supprimé"),o(null)}});return a.jsxs("div",{className:"space-y-6",children:[a.jsx(XE,{children:a.jsx("title",{children:"Destinations â Admin"})}),a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"font-heading text-2xl font-bold",children:"Destinations"}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:[l.length," guide(s) de voyage"]})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(H,{variant:"outline",asChild:!0,children:a.jsxs(_e,{to:"/admin/import-guides",children:[a.jsx(Ts,{className:"mr-2 h-4 w-4"})," Importer"]})}),a.jsxs(H,{onClick:()=>s({...ext}),children:[a.jsx(dr,{className:"mr-2 h-4 w-4"})," Nouveau guide"]})]})]}),a.jsxs("div",{className:"relative max-w-sm",children:[a.jsx(is,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(ue,{className:"pl-9",placeholder:"Rechercher...",value:e,onChange:p=>n(p.target.value)})]}),a.jsx("div",{className:"rounded-lg border border-border bg-card overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"bg-muted/40 text-left text-xs uppercase text-muted-foreground",children:a.jsxs("tr",{children:[a.jsx("th",{className:"p-3 w-20",children:"Image"}),a.jsx("th",{className:"p-3",children:"Ville"}),a.jsx("th",{className:"p-3",children:"Province"}),a.jsx("th",{className:"p-3",children:"Type"}),a.jsx("th",{className:"p-3 w-20",children:"Actif"}),a.jsx("th",{className:"p-3 w-24 text-right",children:"Actions"})]})}),a.jsxs("tbody",{className:"divide-y divide-border",children:[c&&a.jsx("tr",{children:a.jsx("td",{colSpan:6,className:"p-6 text-center text-muted-foreground",children:"Chargement..."})}),!c&&u.length===0&&a.jsx("tr",{children:a.jsx("td",{colSpan:6,className:"p-6 text-center text-muted-foreground",children:"Aucun guide"})}),u.map(p=>{var m;return a.jsxs("tr",{children:[a.jsx("td",{className:"p-3",children:p.cover_image_url?a.jsx("img",{src:p.cover_image_url,alt:p.city,className:"h-12 w-16 rounded object-cover"}):a.jsx("div",{className:"h-12 w-16 rounded bg-muted"})}),a.jsxs("td",{className:"p-3 font-medium",children:[p.city,a.jsxs("div",{className:"text-xs text-muted-foreground",children:["/",p.slug]})]}),a.jsx("td",{className:"p-3",children:p.province}),a.jsx("td",{className:"p-3",children:a.jsx(ke,{variant:"outline",children:((m=JCe.find(v=>v.value===p.guide_type))==null?void 0:m.label)??p.guide_type})}),a.jsx("td",{className:"p-3",children:a.jsx(_n,{checked:!!p.is_active,onCheckedChange:v=>h.mutate({id:p.id,value:v})})}),a.jsxs("td",{className:"p-3 text-right",children:[a.jsx(H,{variant:"ghost",size:"icon",onClick:()=>s(p),children:a.jsx(Oc,{className:"h-4 w-4"})}),a.jsx(H,{variant:"ghost",size:"icon",onClick:()=>o(p.id),children:a.jsx(tr,{className:"h-4 w-4"})})]})]},p.id)})]})]})}),r&&a.jsx(nxt,{guide:r,onClose:()=>s(null),onSave:p=>d.mutate(p),saving:d.isPending}),a.jsx(ro,{open:!!i,onOpenChange:p=>!p&&o(null),children:a.jsxs(ja,{children:[a.jsxs(Sa,{children:[a.jsx(Ca,{children:"Supprimer ce guide ?"}),a.jsx(ka,{children:"Cette action est irréversible."})]}),a.jsxs(Na,{children:[a.jsx(Ea,{children:"Annuler"}),a.jsx(Aa,{onClick:()=>i&&f.mutate(i),children:"Supprimer"})]})]})})]})}function nxt({guide:t,onClose:e,onSave:n,saving:r}){const[s,i]=b.useState({...t,gallery:t.gallery??[]}),[o,l]=b.useState(!1);function c(f,p){i(m=>({...m,[f]:p}))}async function u(f){var v;const p=(v=f.target.files)==null?void 0:v[0];if(!p)return;l(!0);const m=await uie(p,`${s.slug||"cover"}-cover`);l(!1),m&&c("cover_image_url",m)}async function d(f){const p=Array.from(f.target.files??[]);if(!p.length)return;l(!0);const m=[];for(const v of p){const x=await uie(v,`${s.slug||"img"}-gal`);x&&m.push(x)}l(!1),c("gallery",[...s.gallery??[],...m])}function h(f){c("gallery",(s.gallery??[]).filter((p,m)=>m!==f))}return a.jsx(an,{open:!0,onOpenChange:e,children:a.jsxs(nn,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[a.jsx(on,{children:a.jsx(ln,{children:s.id?"Modifier le guide":"Nouveau guide"})}),a.jsxs("div",{className:"grid gap-4 py-2",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx(te,{children:"Ville *"}),a.jsx(ue,{value:s.city,onChange:f=>{c("city",f.target.value),!s.id&&!s.slug&&c("slug",hV(f.target.value))}})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Slug *"}),a.jsx(ue,{value:s.slug,onChange:f=>c("slug",hV(f.target.value))})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx(te,{children:"Province *"}),a.jsxs(lt,{value:s.province,onValueChange:f=>c("province",f),children:[a.jsx(nt,{children:a.jsx(ct,{})}),a.jsx(rt,{children:Zvt.map(f=>a.jsx(Ae,{value:f,children:f},f))})]})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Type *"}),a.jsxs(lt,{value:s.guide_type,onValueChange:f=>c("guide_type",f),children:[a.jsx(nt,{children:a.jsx(ct,{})}),a.jsx(rt,{children:JCe.map(f=>a.jsx(Ae,{value:f.value,children:f.label},f.value))})]})]})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Extrait"}),a.jsx(fn,{rows:2,value:s.excerpt??"",onChange:f=>c("excerpt",f.target.value),maxLength:300})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Contenu (HTML)"}),a.jsx(fn,{rows:10,value:s.content??"",onChange:f=>c("content",f.target.value),className:"font-mono text-xs"})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx(te,{children:"Latitude"}),a.jsx(ue,{type:"number",step:"any",value:s.latitude??"",onChange:f=>c("latitude",f.target.value?Number(f.target.value):null)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Longitude"}),a.jsx(ue,{type:"number",step:"any",value:s.longitude??"",onChange:f=>c("longitude",f.target.value?Number(f.target.value):null)})]})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Image de couverture"}),a.jsxs("div",{className:"flex items-center gap-3 mt-2",children:[s.cover_image_url&&a.jsx("img",{src:s.cover_image_url,alt:"cover",className:"h-20 w-32 rounded object-cover"}),a.jsxs("label",{className:"cursor-pointer",children:[a.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:u}),a.jsxs("span",{className:"inline-flex items-center gap-2 rounded-md border border-border px-3 py-2 text-sm hover:bg-accent",children:[a.jsx(Oa,{className:"h-4 w-4"})," Uploader"]})]}),s.cover_image_url&&a.jsx(H,{variant:"ghost",size:"sm",onClick:()=>c("cover_image_url",""),children:"Retirer"})]})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Galerie photos"}),a.jsxs("div",{className:"grid grid-cols-4 gap-2 mt-2",children:[(s.gallery??[]).map((f,p)=>a.jsxs("div",{className:"relative group",children:[a.jsx("img",{src:f,alt:"",className:"aspect-square rounded object-cover"}),a.jsx("button",{type:"button",onClick:()=>h(p),className:"absolute top-1 right-1 rounded-full bg-black/70 p-1 text-white opacity-0 group-hover:opacity-100",children:a.jsx(ks,{className:"h-3 w-3"})})]},p)),a.jsxs("label",{className:"aspect-square cursor-pointer rounded border-2 border-dashed border-border flex items-center justify-center hover:bg-accent",children:[a.jsx("input",{type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:d}),a.jsx(dr,{className:"h-6 w-6 text-muted-foreground"})]})]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(_n,{checked:!!s.is_active,onCheckedChange:f=>c("is_active",f)}),a.jsx(te,{children:"Actif (visible sur le site)"})]})]}),a.jsxs(ss,{children:[a.jsx(H,{variant:"outline",onClick:e,children:"Annuler"}),a.jsx(H,{onClick:()=>n(s),disabled:r||o||!s.city||!s.slug,children:r?"Enregistrement...":"Enregistrer"})]})]})})}function rxt(){const[t,e]=b.useState(!1),[n,r]=b.useState(!1),[s,i]=b.useState(0),[o,l]=b.useState([]),[c,u]=b.useState([]);async function d(){r(!0);try{const{data:x,error:g}=await Z.functions.invoke("import-guides",{body:{action:"list"}});if(g)throw g;const w=(x==null?void 0:x.paths)??[];w.length?(l(w),u(w.map(_=>({path:_,status:"pending"}))),i(0),ee.success(`${w.length} guide(s) trouvé(s)`)):ee.error("Aucun guide trouvé sur la page source")}catch(x){ee.error((x==null?void 0:x.message)??String(x))}finally{r(!1)}}async function h(){if(!o.length){await d();return}e(!0),i(0),u(o.map(x=>({path:x,status:"pending"})));for(let x=0;x<o.length;x++){const g=o[x];try{const{data:w,error:_}=await Z.functions.invoke("import-guides",{body:{path:g}});if(_)throw _;if(w!=null&&w.error)throw new Error(w.error);u(j=>{const N=[...j];return N[x]={path:g,status:"ok",city:w.city,province:w.province,message:`${w.gallery_count??0} image(s)`},N})}catch(w){u(_=>{const j=[..._];return j[x]={path:g,status:"error",message:(w==null?void 0:w.message)??String(w)},j})}i(x+1)}e(!1),ee.success("Import terminé")}const f=o.length,p=f?s/f*100:0,m=c.filter(x=>x.status==="ok").length,v=c.filter(x=>x.status==="error").length;return a.jsxs("div",{className:"space-y-6",children:[a.jsx(XE,{children:a.jsx("title",{children:"Importer les guides â Admin"})}),a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"font-heading text-2xl font-bold",children:"Importer les guides Goodbarber"}),a.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:["Récupère automatiquement tous les guides depuis"," ",a.jsx("code",{children:"espritsud.es/guides-voyage/c/0"})," et les insère dans"," ",a.jsx("code",{children:"travel_guides"}),"."]})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(H,{variant:"outline",onClick:d,disabled:n||t,children:[n?a.jsx(Je,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(e5e,{className:"mr-2 h-4 w-4"}),"Lister les guides"]}),a.jsxs(H,{onClick:h,disabled:t||n||!o.length,size:"lg",children:[t?a.jsx(Je,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(Y6,{className:"mr-2 h-4 w-4"}),"Lancer l'import"]}
1263)]})]}),f>0&&a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between text-sm",children:[a.jsxs("span",{children:[s," / ",f," traité(s)"]}),a.jsxs("span",{className:"text-muted-foreground",children:[a.jsxs("span",{className:"text-green-600",children:[m," OK"]})," · ",a.jsxs("span",{className:"text-red-600",children:[v," erreur(s)"]})]})]}),a.jsx(Bg,{value:p})]}),!f&&!n&&a.jsx("div",{className:"rounded-lg border border-dashed border-border p-8 text-center text-sm text-muted-foreground",children:"Cliquez sur « Lister les guides » pour récupérer la liste depuis le site source."}),f>0&&a.jsx("div",{className:"rounded-lg border border-border bg-card divide-y divide-border max-h-[600px] overflow-y-auto",children:c.map((x,g)=>a.jsxs("div",{className:"flex items-start gap-3 p-3 text-sm",children:[a.jsxs("div",{className:"mt-0.5",children:[x.status==="ok"&&a.jsx(sh,{className:"h-4 w-4 text-green-600"}),x.status==="error"&&a.jsx(H6,{className:"h-4 w-4 text-red-600"}),x.status==="pending"&&a.jsx("div",{className:"h-4 w-4 rounded-full border-2 border-muted-foreground/30"})]}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"font-mono text-xs truncate",children:x.path}),x.status==="ok"&&a.jsxs("div",{className:"text-xs text-muted-foreground mt-0.5",children:[x.city," · ",x.province," · ",x.message]}),x.status==="error"&&a.jsx("div",{className:"text-xs text-red-600 mt-0.5",children:x.message})]})]},g))})]})}const sxt={code:"",discount_type:"percent",discount_value:10,min_order_amount:0,max_uses:null,valid_from:null,valid_until:null,is_active:!0};function ixt(t=8){const e="ABCDEFGHJKLMNPQRSTUVWXYZ23456789";let n="";for(let r=0;r<t;r++)n+=e[Math.floor(Math.random()*e.length)];return n}function die(t){return t?new Date(t).toISOString().slice(0,10):""}function axt(){const t=St(),[e,n]=b.useState(null),[r,s]=b.useState(null),{data:i=[],isLoading:o}=Ne({queryKey:["admin_promo_codes"],queryFn:async()=>{const{data:f,error:p}=await Z.from("promo_codes").select("*").order("code");if(p)throw p;return f}}),l=Qe({mutationFn:async f=>{const p={code:(f.code||"").trim().toUpperCase(),discount_type:f.discount_type,discount_value:Number(f.discount_value)||0,min_order_amount:f.min_order_amount===null||f.min_order_amount===void 0||f.min_order_amount===""?0:Number(f.min_order_amount),max_uses:f.max_uses===null||f.max_uses===void 0||f.max_uses===""?null:Number(f.max_uses),valid_from:f.valid_from||null,valid_until:f.valid_until||null,is_active:f.is_active??!0};if(!p.code)throw new Error("Code requis");if(f.id){const{error:m}=await Z.from("promo_codes").update(p).eq("id",f.id);if(m)throw m}else{const{error:m}=await Z.from("promo_codes").insert(p);if(m)throw m}},onSuccess:()=>{t.invalidateQueries({queryKey:["admin_promo_codes"]}),n(null),ee.success("Code promo enregistré")},onError:f=>ee.error(f.message||"Erreur lors de l'enregistrement")}),c=Qe({mutationFn:async f=>{const{error:p}=await Z.from("promo_codes").delete().eq("id",f);if(p)throw p},onSuccess:()=>{t.invalidateQueries({queryKey:["admin_promo_codes"]}),s(null),ee.success("Code promo supprimé")},onError:f=>ee.error(f.message||"Erreur")}),u=Qe({mutationFn:async({id:f,value:p})=>{const{error:m}=await Z.from("promo_codes").update({is_active:p}).eq("id",f);if(m)throw m},onSuccess:()=>t.invalidateQueries({queryKey:["admin_promo_codes"]})}),d=f=>f.discount_type==="percent"?`${f.discount_value} %`:`${Number(f.discount_value).toFixed(2)} â¬`,h=f=>f?new Date(f).toLocaleDateString("fr-FR"):"â";return a.jsxs("div",{className:"p-4 lg:p-8",children:[a.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"font-heading text-2xl font-bold flex items-center gap-2",children:[a.jsx(Vfe,{className:"h-6 w-6"})," Codes promo"]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Gérer les codes de réduction de la boutique"})]}),a.jsxs(H,{onClick:()=>n({...sxt}),children:[a.jsx(dr,{className:"mr-2 h-4 w-4"})," Nouveau code"]})]}),a.jsx("div",{className:"rounded-xl border border-border bg-card",children:a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"bg-muted/40 text-left text-xs uppercase text-muted-foreground",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-4 py-3",children:"Code"}),a.jsx("th",{className:"px-4 py-3",children:"Type"}),a.jsx("th",{className:"px-4 py-3",children:"Valeur"}),a.jsx("th",{className:"px-4 py-3",children:"Min."}),a.jsx("th",{className:"px-4 py-3",children:"Utilisations"}),a.jsx("th",{className:"px-4 py-3",children:"Validité"}),a.jsx("th",{className:"px-4 py-3",children:"Actif"}),a.jsx("th",{className:"px-4 py-3"})]})}),a.jsxs("tbody",{children:[o&&a.jsx("tr",{children:a.jsx("td",{colSpan:8,className:"px-4 py-8 text-center text-muted-foreground",children:"Chargementâ¦"})}),!o&&i.length===0&&a.jsx("tr",{children:a.jsx("td",{colSpan:8,className:"px-4 py-8 text-center text-muted-foreground",children:"Aucun code promo"})}),i.map(f=>a.jsxs("tr",{className:"border-t border-border",children:[a.jsx("td",{className:"px-4 py-3 font-mono font-semibold",children:f.code}),a.jsx("td",{className:"px-4 py-3",children:f.discount_type==="percent"?"Pourcentage":"Montant fixe"}),a.jsx("td",{className:"px-4 py-3",children:d(f)}),a.jsx("td",{className:"px-4 py-3",children:f.min_order_amount?`${Number(f.min_order_amount).toFixed(2)} â¬`:"â"}),a.jsxs("td",{className:"px-4 py-3",children:[f.current_uses??0," / ",f.max_uses??"â"]}),a.jsxs("td",{className:"px-4 py-3 text-xs",children:[h(f.valid_from)," â ",h(f.valid_until)]}),a.jsx("td",{className:"px-4 py-3",children:a.jsx(_n,{checked:f.is_active,onCheckedChange:p=>u.mutate({id:f.id,value:p})})}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex justify-end gap-1",children:[a.jsx(H,{variant:"ghost",size:"icon",onClick:()=>n(f),children:a.jsx(Oc,{className:"h-4 w-4"})}),a.jsx(H,{variant:"ghost",size:"icon",onClick:()=>s(f),children:a.jsx(tr,{className:"h-4 w-4 text-destructive"})})]})})]},f.id))]})]})})}),a.jsx(an,{open:!!e,onOpenChange:f=>!f&&n(null),children:a.jsxs(nn,{className:"max-w-lg",children:[a.jsx(on,{children:a.jsx(ln,{children:e!=null&&e.id?"Modifier le code":"Nouveau code promo"})}),e&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(te,{children:"Code"}),a.jsxs("div",{className:"mt-1 flex gap-2",children:[a.jsx(ue,{value:e.code||"",onChange:f=>n({...e,code:f.target.value.toUpperCase()}),placeholder:"BIENVENUE10",className:"font-mono uppercase"}),a.jsxs(H,{type:"button",variant:"outline",onClick:()=>n({...e,code:ixt()}),children:[a.jsx(OW,{className:"mr-1 h-4 w-4"})," Aléatoire"]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx(te,{children:"Type de réduction"}),a.jsxs(lt,{value:e.discount_type||"percent",onValueChange:f=>n({...e,discount_type:f}),children:[a.jsx(nt,{className:"mt-1",children:a.jsx(ct,{})}),a.jsxs(rt,{children:[a.jsx(Ae,{value:"percent",children:"Pourcentage"}),a.jsx(Ae,{value:"fixed",children:"Montant fixe"})]})]})]}),a.jsxs("div",{children:[a.jsxs(te,{children:["Valeur ",e.discount_type==="percent"?"(%)":"(â¬)"]}),a.jsx(ue,{type:"number",min:0,step:"0.01",value:e.discount_value??"",onChange:f=>n({...e,discount_value:Number(f.target.value)}),className:"mt-1"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx(te,{children:"Montant min. (â¬)"}),a.jsx(ue,{type:"number",min:0,step:"0.01",value:e.min_order_amount??"",onChange:f=>n({...e,min_order_amount:f.target.value===""?0:Number(f.target.value)}),className:"mt-1",placeholder:"0"})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Utilisations max."}),a.jsx(ue,{type:"number",min:1,value:e.max_uses??"",onChange:f=>n({...e,max_uses:f.target.value===""?null:Number(f.target.value)}),className:"mt-1",placeholder:"Illimité"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx(te,{children:"Date de début"}),a.jsx(ue,{type:"date",value:die(e.valid_from),onChange:f=>n({...e,valid_from:f.target.value||null}),className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Date de fin"}),a.jsx(ue,{type:"date",value:die(e.valid_until),onChange:f=>n({...e,valid_until:f.target.value||null}),className:"mt-1"})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(_n,{checked:e.is_active??!0,onCheckedChange:f=>n({...e,is_active:f})}),a.jsx(te,{children:"Actif"})]})]}),a.jsxs(ss,{children:[a.jsx(H,{variant:"outline",onClick:()=>n(null),children:"Annuler"}),a.jsx(H,{onClick:()=>e&&l.mutate(e),disabled:l.isPending,children:l.isPending?"Enregistrementâ¦":"Enregistrer"})]})]})}),a.jsx(ro,{open:!!r,onOpenChange:f=>!f&&s(null),children:a.jsxs(ja,{children:[a.jsxs(Sa,{children:[a.jsx(Ca,{children:"Supprimer ce code promo ?"}),a.jsxs(ka,{children:["Le code ",a.jsx("span",{className:"font-mono font-semibold",children:r==null?void 0:r.code})," sera définitivement supprimé."]}
1263)]}),a.jsxs(Na,{children:[a.jsx(Ea,{children:"Annuler"}),a.jsx(Aa,{onClick:()=>r&&c.mutate(r.id),children:"Supprimer"})]})]})})]})}const oxt=[{key:"prospect",label:"Prospect",color:"bg-slate-100 text-slate-700"},{key:"contacted",label:"Contacté",color:"bg-blue-100 text-blue-700"},{key:"quote_sent",label:"Devis envoyé",color:"bg-indigo-100 text-indigo-700"},{key:"negotiation",label:"Négociation",color:"bg-amber-100 text-amber-700"},{key:"signed",label:"Contrat signé",color:"bg-violet-100 text-violet-700"},{key:"active",label:"En diffusion",color:"bg-green-100 text-green-700"},{key:"completed",label:"Terminé",color:"bg-gray-100 text-gray-700"},{key:"lost",label:"Perdu",color:"bg-red-100 text-red-700"}];function lxt(){const t=St(),[e,n]=b.useState(null),{data:r=[]}=Ne({queryKey:["pipeline_advertisers"],queryFn:async()=>{const{data:i}=await Z.from("advertisers").select("id, company_name, contact_name, contact_phone, pipeline_status, next_followup_date, total_spent, ad_contracts(amount)").order("created_at",{ascending:!1});return i||[]}}),s=Qe({mutationFn:async({id:i,status:o})=>{const{error:l}=await Z.from("advertisers").update({pipeline_status:o}).eq("id",i);if(l)throw l},onSuccess:()=>{t.invalidateQueries({queryKey:["pipeline_advertisers"]}),ee.success("Statut mis à jour")},onError:i=>ee.error(i.message)});return a.jsx("div",{className:"flex gap-3 overflow-x-auto pb-4",children:oxt.map(i=>{const o=r.filter(l=>(l.pipeline_status||"prospect")===i.key);return a.jsxs("div",{className:"w-[260px] shrink-0 rounded-xl bg-muted/40 p-3",onDragOver:l=>l.preventDefault(),onDrop:()=>{e&&s.mutate({id:e,status:i.key}),n(null)},children:[a.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[a.jsx("span",{className:`rounded px-2 py-0.5 text-xs font-semibold ${i.color}`,children:i.label}),a.jsx("span",{className:"text-xs text-muted-foreground",children:o.length})]}),a.jsxs("div",{className:"space-y-2",children:[o.map(l=>{const c=(l.ad_contracts||[]).reduce((u,d)=>u+Number(d.amount||0),0);return a.jsxs("div",{draggable:!0,onDragStart:()=>n(l.id),onDragEnd:()=>n(null),className:"cursor-move rounded-lg border border-border bg-card p-3 text-sm shadow-sm hover:shadow",children:[a.jsx("div",{className:"font-medium",children:l.company_name}),l.contact_name&&a.jsx("div",{className:"text-xs text-muted-foreground",children:l.contact_name}),l.contact_phone&&a.jsx("div",{className:"text-xs text-muted-foreground",children:l.contact_phone}),a.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[a.jsxs("span",{className:"text-xs font-semibold",children:[c.toFixed(0)," â¬"]}),l.next_followup_date&&a.jsxs("span",{className:"text-xs text-amber-700",children:["ð
",new Date(l.next_followup_date).toLocaleDateString("fr-FR")]})]})]},l.id)}),o.length===0&&a.jsx("div",{className:"rounded-lg border border-dashed border-border p-4 text-center text-xs text-muted-foreground",children:"Glisser ici"})]})]},i.key)})})}const QCe=[{key:"prospect",label:"Prospect"},{key:"contacted",label:"Contacté"},{key:"quote_sent",label:"Devis envoyé"},{key:"negotiation",label:"Négociation"},{key:"signed",label:"Contrat signé"},{key:"active",label:"En diffusion"},{key:"completed",label:"Terminé"},{key:"lost",label:"Perdu"}];function cxt(){const t=St(),[e,n]=b.useState(null),[r,s]=b.useState(!1),[i,o]=b.useState(null),{data:l=[]}=Ne({queryKey:["advertisers_list"],queryFn:async()=>{const{data:d}=await Z.from("advertisers").select("*, ad_contracts(amount)").order("created_at",{ascending:!1});return d||[]}}),c=Qe({mutationFn:async d=>{const h={company_name:d.company_name,contact_name:d.contact_name||null,contact_email:d.contact_email||null,contact_phone:d.contact_phone||null,address:d.address||null,website:d.website||null,notes:d.notes||null,pipeline_status:d.pipeline_status,next_followup_date:d.next_followup_date||null};if(d.id){const{error:f}=await Z.from("advertisers").update(h).eq("id",d.id);if(f)throw f}else{const{error:f}=await Z.from("advertisers").insert(h);if(f)throw f}},onSuccess:()=>{t.invalidateQueries({queryKey:["advertisers_list"]}),t.invalidateQueries({queryKey:["pipeline_advertisers"]}),ee.success("Enregistré"),s(!1),n(null)},onError:d=>ee.error(d.message)}),u=Qe({mutationFn:async d=>{const{error:h}=await Z.from("advertisers").delete().eq("id",d);if(h)throw h},onSuccess:()=>{t.invalidateQueries({queryKey:["advertisers_list"]}),ee.success("Supprimé")},onError:d=>ee.error(d.message)});return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"flex justify-end",children:a.jsxs(H,{onClick:()=>{n({pipeline_status:"prospect"}),s(!0)},children:[a.jsx(dr,{className:"mr-1.5 h-4 w-4"})," Nouvel annonceur"]})}),a.jsx("div",{className:"mt-4 overflow-x-auto rounded-xl border border-border bg-card",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"border-b border-border bg-muted/40",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Entreprise"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Contact"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Téléphone"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Statut"}),a.jsx("th",{className:"px-4 py-3 text-right font-medium",children:"Contrats"}),a.jsx("th",{className:"px-4 py-3 text-right font-medium",children:"Actions"})]})}),a.jsxs("tbody",{children:[l.map(d=>{var f;const h=(d.ad_contracts||[]).reduce((p,m)=>p+Number(m.amount||0),0);return a.jsxs("tr",{className:"border-b border-border last:border-0",children:[a.jsx("td",{className:"px-4 py-3 font-medium",children:d.company_name}),a.jsxs("td",{className:"px-4 py-3",children:[d.contact_name||"â",a.jsx("div",{className:"text-xs text-muted-foreground",children:d.contact_email})]}),a.jsx("td",{className:"px-4 py-3",children:d.contact_phone||"â"}),a.jsx("td",{className:"px-4 py-3",children:a.jsx(ke,{variant:"outline",children:((f=QCe.find(p=>p.key===d.pipeline_status))==null?void 0:f.label)||d.pipeline_status})}),a.jsxs("td",{className:"px-4 py-3 text-right font-semibold",children:[h.toFixed(0)," â¬"]}),a.jsxs("td",{className:"px-4 py-3 text-right",children:[a.jsx(H,{variant:"ghost",size:"icon",onClick:()=>o(d),children:a.jsx(t3,{className:"h-4 w-4"})}),a.jsx(H,{variant:"ghost",size:"icon",onClick:()=>{n(d),s(!0)},children:a.jsx(Ufe,{className:"h-4 w-4"})}),a.jsx(H,{variant:"ghost",size:"icon",onClick:()=>{confirm("Supprimer ?")&&u.mutate(d.id)},children:a.jsx(tr,{className:"h-4 w-4"})})]})]},d.id)}),l.length===0&&a.jsx("tr",{children:a.jsx("td",{colSpan:6,className:"p-8 text-center text-muted-foreground",children:"Aucun annonceur"})})]})]})}),a.jsx(an,{open:r,onOpenChange:d=>{s(d),d||n(null)},children:a.jsxs(nn,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[a.jsx(on,{children:a.jsx(ln,{children:e!=null&&e.id?"Modifier":"Nouvel annonceur"})}),a.jsx(uxt,{initial:e||{},onSubmit:d=>c.mutate(d)})]})}),a.jsx(dxt,{advertiser:i,onClose:()=>o(null)})]})}function uxt({initial:t,onSubmit:e}){const[n,r]=b.useState(t),s=(i,o)=>r(l=>({...l,[i]:o}));return a.jsxs("form",{onSubmit:i=>{i.preventDefault(),e(n)},className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx(te,{children:"Nom de l'entreprise *"}),a.jsx(ue,{required:!0,value:n.company_name||"",onChange:i=>s("company_name",i.target.value)})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx(te,{children:"Contact"}),a.jsx(ue,{value:n.contact_name||"",onChange:i=>s("contact_name",i.target.value)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Email"}),a.jsx(ue,{type:"email",value:n.contact_email||"",onChange:i=>s("contact_email",i.target.value)})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx(te,{children:"Téléphone"}),a.jsx(ue,{value:n.contact_phone||"",onChange:i=>s("contact_phone",i.target.value)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Site web"}),a.jsx(ue,{value:n.website||"",onChange:i=>s("website",i.target.value)})]})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Adresse"}),a.jsx(ue,{value:n.address||"",onChange:i=>s("address",i.target.value)})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx(te,{children:"Statut pi
1263peline"}),a.jsxs(lt,{value:n.pipeline_status||"prospect",onValueChange:i=>s("pipeline_status",i),children:[a.jsx(nt,{children:a.jsx(ct,{})}),a.jsx(rt,{children:QCe.map(i=>a.jsx(Ae,{value:i.key,children:i.label},i.key))})]})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Prochaine relance"}),a.jsx(ue,{type:"date",value:n.next_followup_date||"",onChange:i=>s("next_followup_date",i.target.value)})]})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Notes internes"}),a.jsx(fn,{rows:4,value:n.notes||"",onChange:i=>s("notes",i.target.value)})]}),a.jsx(ss,{children:a.jsx(H,{type:"submit",children:"Enregistrer"})})]})}function dxt({advertiser:t,onClose:e}){const n=St(),[r,s]=b.useState(""),{data:i=[]}=Ne({queryKey:["advertiser_notes",t==null?void 0:t.id],queryFn:async()=>{const{data:l}=await Z.from("advertiser_notes").select("*").eq("advertiser_id",t.id).order("created_at",{ascending:!1});return l||[]},enabled:!!t}),o=Qe({mutationFn:async()=>{const{error:l}=await Z.from("advertiser_notes").insert({advertiser_id:t.id,note:r});if(l)throw l},onSuccess:()=>{n.invalidateQueries({queryKey:["advertiser_notes",t==null?void 0:t.id]}),s(""),ee.success("Note ajoutée")},onError:l=>ee.error(l.message)});return a.jsx(an,{open:!!t,onOpenChange:l=>!l&&e(),children:a.jsxs(nn,{className:"max-w-lg",children:[a.jsx(on,{children:a.jsxs(ln,{children:["Historique â ",t==null?void 0:t.company_name]})}),a.jsxs("div",{className:"space-y-2 max-h-[40vh] overflow-y-auto",children:[i.map(l=>a.jsxs("div",{className:"rounded border border-border p-2 text-sm",children:[a.jsx("div",{className:"text-xs text-muted-foreground",children:new Date(l.created_at).toLocaleString("fr-FR")}),a.jsx("div",{children:l.note})]},l.id)),i.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"Aucune note"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(fn,{placeholder:"Ex : Appelé, intéressé par un pack 3 mois",value:r,onChange:l=>s(l.target.value)}),a.jsx(H,{onClick:()=>o.mutate(),disabled:!r.trim(),className:"w-full",children:"Ajouter"})]})]})})}const fV=[{v:"web",label:"Web",color:"bg-blue-100 text-blue-700"},{v:"print",label:"Magazine",color:"bg-orange-100 text-orange-700"},{v:"web_and_print",label:"Web + Magazine",color:"bg-violet-100 text-violet-700"}],ZCe=[{v:"article_top",label:"Haut d'article"},{v:"article_middle",label:"Milieu d'article"},{v:"article_bottom",label:"Bas d'article"},{v:"sidebar",label:"Sidebar droite"},{v:"homepage",label:"Page d'accueil"}],hxt=[{v:"banner_article",label:"Bannière article"},{v:"sidebar",label:"Sidebar"},{v:"sponsored_article",label:"Article sponsorisé"}],eke=[{v:"full_page",label:"Pleine page"},{v:"half_page",label:"Demi-page"},{v:"quarter_page",label:"Quart de page"},{v:"double_page",label:"Double page"}],tke=[{v:"inside_cover",label:"Intérieur couverture"},{v:"back_cover",label:"4ème de couverture"},{v:"inner_pages",label:"Pages intérieures"},{v:"insert",label:"Encart"}],pV=[{v:"pending",label:"En attente de visuel"},{v:"visual_received",label:"Visuel reçu"},{v:"bat_sent",label:"BAT envoyé"},{v:"bat_validated",label:"BAT validé"},{v:"active",label:"Actif"},{v:"paused",label:"En pause"},{v:"expired",label:"Expiré"}];function fxt(){const t=St(),[e,n]=b.useState(!1),[r,s]=b.useState(null),[i,o]=b.useState("all"),[l,c]=b.useState("all"),[u,d]=b.useState("all"),{data:h=[]}=Ne({queryKey:["ad_contracts"],queryFn:async()=>{const{data:g}=await Z.from("ad_contracts").select("*, advertisers(company_name)").order("created_at",{ascending:!1});return g||[]}}),{data:f=[]}=Ne({queryKey:["all_advertisers_simple"],queryFn:async()=>(await Z.from("advertisers").select("id, company_name").order("company_name")).data||[]}),{data:p=[]}=Ne({queryKey:["all_magazine_issues_simple"],queryFn:async()=>(await Z.from("magazine_issues").select("id, issue_number, title").order("issue_number",{ascending:!1})).data||[]}),m=Qe({mutationFn:async g=>{var _;const w={advertiser_id:g.advertiser_id,support:g.support,ad_type:g.ad_type||null,position:g.position||null,print_format:g.print_format||null,print_position:g.print_position||null,magazine_issue_ids:(_=g.magazine_issue_ids)!=null&&_.length?g.magazine_issue_ids:null,image_url:g.image_url||null,print_file_url:g.print_file_url||null,destination_url:g.destination_url||null,alt_text:g.alt_text||null,start_date:g.start_date,end_date:g.end_date,amount:Number(g.amount)||0,status:g.status||"pending",file_received:!!g.file_received,bat_validated:!!g.bat_validated,notes:g.notes||null};
1263if(g.id){const{error:j}=await Z.from("ad_contracts").update(w).eq("id",g.id);if(j)throw j}else{const{error:j}=await Z.from("ad_contracts").insert(w);if(j)throw j}},onSuccess:()=>{t.invalidateQueries({queryKey:["ad_contracts"]}),ee.success("Enregistré"),n(!1),s(null)},onError:g=>ee.error(g.message)}),v=Qe({mutationFn:async g=>{const{error:w}=await Z.from("ad_contracts").delete().eq("id",g);if(w)throw w},onSuccess:()=>{t.invalidateQueries({queryKey:["ad_contracts"]}),ee.success("Supprimé")},onError:g=>ee.error(g.message)}),x=h.filter(g=>!(i!=="all"&&g.support!==i||l!=="all"&&g.status!==l||u!=="all"&&!(g.magazine_issue_ids||[]).includes(u)));return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-3",children:[a.jsxs("div",{className:"flex flex-wrap gap-2",children:[a.jsxs(lt,{value:i,onValueChange:o,children:[a.jsx(nt,{className:"w-[160px]",children:a.jsx(ct,{placeholder:"Support"})}),a.jsxs(rt,{children:[a.jsx(Ae,{value:"all",children:"Tous supports"}),fV.map(g=>a.jsx(Ae,{value:g.v,children:g.label},g.v))]})]}),a.jsxs(lt,{value:l,onValueChange:c,children:[a.jsx(nt,{className:"w-[180px]",children:a.jsx(ct,{placeholder:"Statut"})}),a.jsxs(rt,{children:[a.jsx(Ae,{value:"all",children:"Tous statuts"}),pV.map(g=>a.jsx(Ae,{value:g.v,children:g.label},g.v))]})]}),a.jsxs(lt,{value:u,onValueChange:d,children:[a.jsx(nt,{className:"w-[200px]",children:a.jsx(ct,{placeholder:"Numéro magazine"})}),a.jsxs(rt,{children:[a.jsx(Ae,{value:"all",children:"Tous numéros"}),p.map(g=>a.jsxs(Ae,{value:g.id,children:["N°",g.issue_number," ",g.title?`â ${g.title}`:""]},g.id))]})]})]}),a.jsxs(H,{onClick:()=>{s({support:"web",status:"pending",start_date:new Date().toISOString().slice(0,10),end_date:""}),n(!0)},children:[a.jsx(dr,{className:"mr-1.5 h-4 w-4"})," Nouveau contrat"]})]}),a.jsx("div",{className:"mt-4 overflow-x-auto rounded-xl border border-border bg-card",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"border-b border-border bg-muted/40",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-3 py-3 text-left font-medium",children:"Annonceur"}),a.jsx("th",{className:"px-3 py-3 text-left font-medium",children:"Support"}),a.jsx("th",{className:"px-3 py-3 text-left font-medium",children:"Format / Emplacement"}),a.jsx("th",{className:"px-3 py-3 text-left font-medium",children:"Dates"}),a.jsx("th",{className:"px-3 py-3 text-right font-medium",children:"Montant"}),a.jsx("th",{className:"px-3 py-3 text-center font-medium",children:"Fichier"}),a.jsx("th",{className:"px-3 py-3 text-center font-medium",children:"BAT"}),a.jsx("th",{className:"px-3 py-3 text-left font-medium",children:"Statut"}),a.jsx("th",{className:"px-3 py-3 text-right font-medium",children:"Actions"})]})}),a.jsxs("tbody",{children:[x.map(g=>{var _,j,N,S,C;const w=fV.find(k=>k.v===g.support);return a.jsxs("tr",{className:"border-b border-border last:border-0",children:[a.jsx("td",{className:"px-3 py-2 font-medium",children:((_=g.advertisers)==null?void 0:_.company_name)||"â"}),a.jsx("td",{className:"px-3 py-2",children:a.jsx(ke,{className:w==null?void 0:w.color,children:w==null?void 0:w.label})}),a.jsxs("td",{className:"px-3 py-2 text-xs",children:[g.position&&a.jsxs("div",{children:["Web : ",((j=ZCe.find(k=>k.v===g.position))==null?void 0:j.label)||g.position]}),g.print_format&&a.jsxs("div",{children:["Print : ",(N=eke.find(k=>k.v===g.print_format))==null?void 0:N.label," â ",((S=tke.find(k=>k.v===g.print_position))==null?void 0:S.label)||""]})]}),a.jsxs("td",{className:"px-3 py-2 text-xs",children:[g.start_date," â ",g.end_date]}),a.jsxs("td",{className:"px-3 py-2 text-right font-semibold",children:[Number(g.amount||0).toFixed(0)," â¬"]}),a.jsx("td",{className:"px-3 py-2 text-center",children:g.file_received?"â
":"â"}),a.jsx("td",{className:"px-3 py-2 text-center",children:g.bat_validated?"â
":"â"}),a.jsx("td",{className:"px-3 py-2",children:a.jsx(ke,{variant:"outline",children:((C=pV.find(k=>k.v===g.status))==null?void 0:C.label)||g.status})}),a.jsxs("td",{className:"px-3 py-2 text-right",children:[a.jsx(H,{variant:"ghost",size:"icon",onClick:()=>{s(g),n(!0)},children:a.jsx(Ufe,{className:"h-4 w-4"})}),a.jsx(H,{variant:"ghost",size:"icon",onClick:()=>{confirm("Supprimer ?")&&v.mutate(g.id)},children:a.jsx(tr,{className:"h-4 w-4"})})]})]},g.id)}),x.length===0&&a.jsx("tr",{children:a.jsx("td",{colSpan:9,className:"p-8 text-center text-muted-foreground",children:"Aucun contrat"})})]})]})}),a.jsx(an,{open:e,onOpenChange:g=>{n(g),g||s(null)},children:a.jsxs(nn,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[a.jsx(on,{children:a.jsxs(ln,{children:[r!=null&&r.id?"Modifier":"Nouveau"," contrat"]})}),a.jsx(mxt,{initial:r||{},advertisers:f,issues:p,onSubmit:g=>m.mutate(g)})]})})]})}async function pxt(t,e="web"){const n=t.name.split(".").pop(),r=`sponsors/${e}/${Date.now()}-${Math.random().toString(36).slice(2,8)}.${n}`,{error:s}=await Z.storage.from("images").upload(r,t,{upsert:!0});if(s)throw s;const{data:i}=Z.storage.from("images").getPublicUrl(r);return i.publicUrl}function mxt({initial:t,advertisers:e,issues:n,onSubmit:r}){const[s,i]=b.useState({magazine_issue_ids:[],...t}),[o,l]=b.useState(null),c=(f,p)=>i(m=>({...m,[f]:p})),u=s.support==="web"||s.support==="web_and_print",d=s.support==="print"||s.support==="web_and_print",h=async(f,p)=>
1263{l(p);try{const m=await pxt(f,p==="image_url"?"web":"print");c(p,m),ee.success("Upload OK")}catch(m){ee.error(m.message)}finally{l(null)}};return a.jsxs("form",{onSubmit:f=>{f.preventDefault(),r(s)},className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx(te,{children:"Annonceur *"}),a.jsxs(lt,{value:s.advertiser_id||"",onValueChange:f=>c("advertiser_id",f),children:[a.jsx(nt,{children:a.jsx(ct,{placeholder:"Choisir"})}),a.jsx(rt,{children:e.map(f=>a.jsx(Ae,{value:f.id,children:f.company_name},f.id))})]})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Support *"}),a.jsxs(lt,{value:s.support||"web",onValueChange:f=>c("support",f),children:[a.jsx(nt,{children:a.jsx(ct,{})}),a.jsx(rt,{children:fV.map(f=>a.jsx(Ae,{value:f.v,children:f.label},f.v))})]})]})]}),u&&a.jsxs("div",{className:"rounded-lg border border-blue-200 bg-blue-50/40 p-3 space-y-3",children:[a.jsx("div",{className:"text-sm font-semibold text-blue-900",children:"Web"}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx(te,{children:"Type"}),a.jsxs(lt,{value:s.ad_type||"",onValueChange:f=>c("ad_type",f),children:[a.jsx(nt,{children:a.jsx(ct,{placeholder:"â"})}),a.jsx(rt,{children:hxt.map(f=>a.jsx(Ae,{value:f.v,children:f.label},f.v))})]})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Emplacement"}),a.jsxs(lt,{value:s.position||"",onValueChange:f=>c("position",f),children:[a.jsx(nt,{children:a.jsx(ct,{placeholder:"â"})}),a.jsx(rt,{children:ZCe.map(f=>a.jsx(Ae,{value:f.v,children:f.label},f.v))})]})]})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Visuel web"}),a.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[s.image_url&&a.jsx("img",{src:s.image_url,alt:"",className:"h-12 rounded border"}),a.jsxs("label",{children:[a.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:f=>{var p;return((p=f.target.files)==null?void 0:p[0])&&h(f.target.files[0],"image_url")}}),a.jsx(H,{asChild:!0,variant:"outline",size:"sm",disabled:o==="image_url",children:a.jsxs("span",{children:[a.jsx(Oa,{className:"mr-1.5 h-3.5 w-3.5"})," ",o==="image_url"?"Envoiâ¦":s.image_url?"Remplacer":"Upload"]})})]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx(te,{children:"URL de destination"}),a.jsx(ue,{value:s.destination_url||"",onChange:f=>c("destination_url",f.target.value)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Alt text"}),a.jsx(ue,{value:s.alt_text||"",onChange:f=>c("alt_text",f.target.value)})]})]})]}),d&&a.jsxs("div",{className:"rounded-lg border border-orange-200 bg-orange-50/40 p-3 space-y-3",children:[a.jsx("div",{className:"text-sm font-semibold text-orange-900",children:"Magazine papier"}),a.jsxs("div",{children:[a.jsx(te,{children:"Numéros concernés"}),a.jsxs("div",{className:"mt-1 grid grid-cols-2 gap-2 max-h-40 overflow-y-auto rounded border border-border p-2",children:[n.map(f=>a.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[a.jsx(wr,{checked:(s.magazine_issue_ids||[]).includes(f.id),onCheckedChange:p=>{const m=s.magazine_issue_ids||[];c("magazine_issue_ids",p?[...m,f.id]:m.filter(v=>
1263v!==f.id))}}),"N°",f.issue_number,f.title?` â ${f.title}`:""]},f.id)),n.length===0&&a.jsx("span",{className:"text-xs text-muted-foreground",children:"Aucun numéro"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx(te,{children:"Format print"}),a.jsxs(lt,{value:s.print_format||"",onValueChange:f=>c("print_format",f),children:[a.jsx(nt,{children:a.jsx(ct,{placeholder:"â"})}),a.jsx(rt,{children:eke.map(f=>a.jsx(Ae,{value:f.v,children:f.label},f.v))})]})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Emplacement print"}),a.jsxs(lt,{value:s.print_position||"",onValueChange:f=>c("print_position",f),children:[a.jsx(nt,{children:a.jsx(ct,{placeholder:"â"})}),a.jsx(rt,{children:tke.map(f=>a.jsx(Ae,{value:f.v,children:f.label},f.v))})]})]})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Visuel HD (PDF, TIFF, JPG)"}),a.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[s.print_file_url&&a.jsxs("a",{href:s.print_file_url,target:"_blank",rel:"noreferrer",className:"text-xs text-primary underline flex items-center gap-1",children:[a.jsx(Gi,{className:"h-3 w-3"})," Voir"]}),a.jsxs("label",{children:[a.jsx("input",{type:"file",accept:".pdf,.tiff,.tif,.jpg,.jpeg,.png",className:"hidden",onChange:f=>{var p;return((p=f.target.files)==null?void 0:p[0])&&h(f.target.files[0],"print_file_url")}}),a.jsx(H,{asChild:!0,variant:"outline",size:"sm",disabled:o==="print_file_url",children:a.jsxs("span",{children:[a.jsx(Oa,{className:"mr-1.5 h-3.5 w-3.5"})," ",o==="print_file_url"?"Envoiâ¦":s.print_file_url?"Remplacer":"Upload"]})})]})]})]}),a.jsxs("div",{className:"flex gap-6",children:[a.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[a.jsx(_n,{checked:!!s.file_received,onCheckedChange:f=>c("file_received",f)})," Fichier reçu"]}),a.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[a.jsx(_n,{checked:!!s.bat_validated,onCheckedChange:f=>c("bat_validated",f)})," BAT validé"]})]})]}),a.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[a.jsxs("div",{children:[a.jsx(te,{children:"Début *"}),a.jsx(ue,{type:"date",required:!0,value:s.start_date||"",onChange:f=>c("start_date",f.target.value)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Fin *"}),a.jsx(ue,{type:"date",required:!0,value:s.end_date||"",onChange:f=>c("end_date",f.target.value)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Montant (â¬) *"}),a.jsx(ue,{type:"number",step:"0.01",required:!0,value:s.amount||"",onChange:f=>c("amount",f.target.value)})]})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Statut"}),a.jsxs(lt,{value:s.status||"pending",onValueChange:f=>c("status",f),children:[a.jsx(nt,{children:a.jsx(ct,{})}),a.jsx(rt,{children:pV.map(f=>a.jsx(Ae,{value:f.v,children:f.label},f.v))})]})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Notes internes"}),a.jsx(fn,{rows:2,value:s.notes||"",onChange:f=>c("notes",f.target.value)})]}),a.jsx(ss,{children:a.jsx(H,{type:"submit",disabled:!s.advertiser_id,children:"Enregistrer"})})]})}var gxt=["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","onTimeUpdate
1263Capture","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"];function QK(t){if(typeof t!="string")return!1;var e=gxt;return e.includes(t)}var vxt=["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"],xxt=new Set(vxt);function nke(t){return typeof t!="string"?!1:xxt.has(t)}function rke(t){return typeof t=="string"&&t.startsWith("data-")}function dh(t){if(typeof t!="object"||t===null)return{};var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(nke(n)||rke(n))&&(e[n]=t[n]);return e}function Hk(t){if(t==null)return null;if(b.isValidElement(t)&&typeof t.props=="object"&&t.props!==null){var e=t.props;return dh(e)}return typeof t=="object"&&!Array.isArray(t)?dh(t):null}function hh(t){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(nke(n)||rke(n)||QK(n))&&(e[n]=t[n]);return e}var yxt=["children","width","height","viewBox","className","style","title","desc"];
1263function mV(){return mV=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},mV.apply(null,arguments)}function bxt(t,e){if(t==null)return{};var n,r,s=wxt(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function wxt(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var ZK=b.forwardRef((t,e)=>{var n=t.children,r=t.width,s=t.height,i=t.viewBox,o=t.className,l=t.style,c=t.title,u=t.desc,d=bxt(t,yxt),h=i||{width:r,height:s,x:0,y:0},f=mn("recharts-surface",o);return b.createElement("svg",mV({},hh(d),{className:f,width:r,height:s,style:l,viewBox:"".concat(h.x," ").concat(h.y," ").concat(h.width," ").concat(h.height),ref:e}),b.createElement("title",null,c),b.createElement("desc",null,u),n)}),_xt=["children","className"];function gV(){return gV=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},gV.apply(null,arguments)}function jxt(t,e){if(t==null)return{};var n,r,s=Sxt(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function Sxt(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var La=b.forwardRef((t,e)=>{var n=t.children,r=t.className,s=jxt(t,_xt),i=mn("recharts-layer",r);return b.createElement("g",gV({className:i},hh(s),{ref:e}),n)}),ske=b.createContext(null),Nxt=()=>b.useContext(ske);function ar(t){return function(){return t}}const ike=Math.cos,pD=Math.sin,Ku=Math.sqrt,mD=Math.PI,P4=2*mD,vV=Math.PI,xV=2*vV,$v=1e-6,Cxt=xV-$v;function ake(t){this._+=t[0];for(let e=1,n=t.length;e<n;++e)this._+=arguments[e]+t[e]}function kxt(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return ake;const n=10**e;return function(r){this._+=r[0];for(let s=1,i=r.length;s<i;++s)this._+=Math.round(arguments[s]*n)/n+r[s]}}class Axt{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=e==null?ake:kxt(e)}moveTo(e,n){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,n){this._append`L${this._x1=+e},${this._y1=+n}`}
1263quadraticCurveTo(e,n,r,s){this._append`Q${+e},${+n},${this._x1=+r},${this._y1=+s}`}bezierCurveTo(e,n,r,s,i,o){this._append`C${+e},${+n},${+r},${+s},${this._x1=+i},${this._y1=+o}`}arcTo(e,n,r,s,i){if(e=+e,n=+n,r=+r,s=+s,i=+i,i<0)throw new Error(`negative radius: ${i}`);let o=this._x1,l=this._y1,c=r-e,u=s-n,d=o-e,h=l-n,f=d*d+h*h;if(this._x1===null)this._append`M${this._x1=e},${this._y1=n}`;else if(f>$v)if(!(Math.abs(h*c-u*d)>$v)||!i)this._append`L${this._x1=e},${this._y1=n}`;else{let p=r-o,m=s-l,v=c*c+u*u,x=p*p+m*m,g=Math.sqrt(v),w=Math.sqrt(f),_=i*Math.tan((vV-Math.acos((v+f-x)/(2*g*w)))/2),j=_/w,N=_/g;Math.abs(j-1)>$v&&this._append`L${e+j*d},${n+j*h}`,this._append`A${i},${i},0,0,${+(h*p>d*m)},${this._x1=e+N*c},${this._y1=n+N*u}`}}arc(e,n,r,s,i,o){if(e=+e,n=+n,r=+r,o=!!o,r<0)throw new Error(`negative radius: ${r}`);let l=r*Math.cos(s),c=r*Math.sin(s),u=e+l,d=n+c,h=1^o,f=o?s-i:i-s;this._x1===null?this._append`M${u},${d}`:(Math.abs(this._x1-u)>$v||Math.abs(this._y1-d)>$v)&&this._append`L${u},${d}`,r&&(f<0&&(f=f%xV+xV),f>Cxt?this._append`A${r},${r},0,1,${h},${e-l},${n-c}A${r},${r},0,1,${h},${this._x1=u},${this._y1=d}`:f>$v&&this._append`A${r},${r},0,${+(f>=vV)},${h},${this._x1=e+r*Math.cos(i)},${this._y1=n+r*Math.sin(i)}`)}rect(e,n,r,s){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}h${r=+r}v${+s}h${-r}Z`}toString(){return this._}}function eG(t){let e=3;return t.digits=function(n){if(!arguments.length)return e;if(n==null)e=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);e=r}return t},()=>new Axt(e)}function tG(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function oke(t){this._context=t}oke.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(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e);break}}};function M4(t){return new oke(t)}function lke(t){return t[0]}function cke(t){return t[1]}function uke(t,e){var n=ar(!0),r=null,s=M4,i=null,o=eG(l);t=typeof t=="function"?t:t===void 0?lke:ar(t),e=typeof e=="function"?e:e===void 0?cke:ar(e);function l(c){var u,d=(c=tG(c)).length,h,f=!1,p;for(r==null&&(i=s(p=o())),u=0;u<=d;++u)!(u<d&&n(h=c[u],u,c))===f&&((f=!f)?i.lineStart():i.lineEnd()),f&&i.point(+t(h,u,c),+e(h,u,c));if(p)return i=null,p+""||null}return l.x=function(c){return arguments.length?(t=typeof c=="function"?c:ar(+c),l):t},l.y=function(c){return arguments.length?(e=typeof c=="function"?c:ar(+c),l):e},l.defined=function(c){return arguments.length?(n=typeof c=="function"?c:ar(!!c),l):n},l.curve=function(c){return arguments.length?(s=c,r!=null&&(i=s(r)),l):s},l.context=function(c){return arguments.length?(c==null?r=i=null:i=s(r=c),l):r},l}function KP(t,e,n){var r=null,s=ar(!0),i=null,o=M4,l=null,c=eG(u);t=typeof t=="function"?t:t===void 0?lke:ar(+t),e=typeof e=="function"?e:ar(e===void 0?0:+e),n=typeof n=="function"?n:n===void 0?cke:ar(+n);function u(h){var f,p,m,v=(h=tG(h)).length,x,g=!1,w,_=new Array(v),j=new Array(v);for(i==null&&(l=o(w=c())),f=0;f<=v;++f){if(!(f<v&&s(x=h[f],f,h))===g)if(g=!g)p=f,l.areaStart(),l.lineStart();else{for(l.lineEnd(),l.lineStart(),m=f-1;m>=p;--m)l.point(_[m],j[m]);l.lineEnd(),l.areaEnd()}g&&(_[f]=+t(x,f,h),j[f]=+e(x,f,h),l.point(r?+r(x,f,h):_[f],n?+n(x,f,h):j[f]))}if(w)return l=null,w+""||null}function d(){return uke().defined(s).curve(o).context(i)}return u.x=function(h){return arguments.length?(t=typeof h=="function"?h:ar(+h),r=null,u):t},u.x0=function(h){return arguments.length?(t=typeof h=="function"?h:ar(+h),u):t},u.x1=function(h){return arguments.length?(r=h==null?null:typeof h=="function"?h:ar(+h),u):r},u.y=function(h){return arguments.length?(e=typeof h=="function"?h:ar(+h),n=null,u):e},u.y0=function(h){return arguments.length?(e=typeof h=="function"?h:ar(+h),u):e},u.y1=function(h){return arguments.length?(n=h==null?null:typeof h=="function"?h:ar(+h),u):n},u.lineX0=u.lineY0=function(){return d().x(t).y(e)},u.lineY1=function(){return d().x(t).y(n)},u.lineX1=function(){return d().x(r).y(e)},u.defined=function(h){return arguments.length?(s=typeof h=="function"?h:ar(!!h),u):s},u.curve=function(h){return arguments.length?(o=h,i!=null&&(l=o(i)),u):o},u.context=function(h){return arguments.length?(h==null?i=l=null:l=o(i=h),u):i},u}class dke{constructor(e,n){this._context=e,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,n){switch(e=+e,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(e,n):this._context.moveTo(e,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,n,e,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,e,this._y0,e,n);break}}this._x0=e,this._y0=n}}function Ext(t){return new dke(t,!0)}function Txt(t){return new dke(t,!1)}const nG={draw(t,e){const n=Ku(e/mD);t.moveTo(n,0),t.arc(0,0,n,0,P4)}},Pxt={draw(t,e){const n=Ku(e/5)/2;t.moveTo(-3*n,-n),t.lineTo(-n,-n),t.lineTo(-n,-3*n),t.lineTo(n,-3*n),t.lineTo(n,-n),t.lineTo(3*n,-n),t.lineTo(3*n,n),t.lineTo(n,n),t.lineTo(n,3*n),t.lineTo(-n,3*n),t.lineTo(-n,n),t.lineTo(-3*n,n),t.closePath()}},hke=Ku(1/3),Mxt=hke*2,Rxt={draw(t,e){const n=Ku(e/Mxt),r=n*hke;t.moveTo(0,-n),t.lineTo(r,0),t.lineTo(0,n),t.lineTo(-r,0),t.closePath()}},Oxt={draw(t,e){const n=Ku(e),r=-n/2;t.rect(r,r,n,n)}}
1263,Ixt=.8908130915292852,fke=pD(mD/10)/pD(7*mD/10),Dxt=pD(P4/10)*fke,Lxt=-ike(P4/10)*fke,Fxt={draw(t,e){const n=Ku(e*Ixt),r=Dxt*n,s=Lxt*n;t.moveTo(0,-n),t.lineTo(r,s);for(let i=1;i<5;++i){const o=P4*i/5,l=ike(o),c=pD(o);t.lineTo(c*n,-l*n),t.lineTo(l*r-c*s,c*r+l*s)}t.closePath()}},Lz=Ku(3),$xt={draw(t,e){const n=-Ku(e/(Lz*3));t.moveTo(0,n*2),t.lineTo(-Lz*n,-n),t.lineTo(Lz*n,-n),t.closePath()}},Yl=-.5,Xl=Ku(3)/2,yV=1/Ku(12),zxt=(yV/2+1)*3,Bxt={draw(t,e){const n=Ku(e/zxt),r=n/2,s=n*yV,i=r,o=n*yV+n,l=-i,c=o;t.moveTo(r,s),t.lineTo(i,o),t.lineTo(l,c),t.lineTo(Yl*r-Xl*s,Xl*r+Yl*s),t.lineTo(Yl*i-Xl*o,Xl*i+Yl*o),t.lineTo(Yl*l-Xl*c,Xl*l+Yl*c),t.lineTo(Yl*r+Xl*s,Yl*s-Xl*r),t.lineTo(Yl*i+Xl*o,Yl*o-Xl*i),t.lineTo(Yl*l+Xl*c,Yl*c-Xl*l),t.closePath()}};function Uxt(t,e){let n=null,r=eG(s);t=typeof t=="function"?t:ar(t||nG),e=typeof e=="function"?e:ar(e===void 0?64:+e);function s(){let i;if(n||(n=i=r()),t.apply(this,arguments).draw(n,+e.apply(this,arguments)),i)return n=null,i+""||null}return s.type=function(i){return arguments.length?(t=typeof i=="function"?i:ar(i),s):t},s.size=function(i){return arguments.length?(e=typeof i=="function"?i:ar(+i),s):e},s.context=function(i){return arguments.length?(n=i??null,s):n},s}function gD(){}function vD(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function pke(t){this._context=t}pke.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:vD(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(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);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:vD(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function qxt(t){return new pke(t)}function mke(t){this._context=t}mke.prototype={areaStart:gD,areaEnd:gD,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(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:vD(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function Vxt(t){return new mke(t)}function gke(t){this._context=t}gke.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(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:vD(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function Hxt(t){return new gke(t)}function vke(t){this._context=t}vke.prototype={areaStart:gD,areaEnd:gD,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}};function Wxt(t){return new vke(t)}function hie(t){return t<0?-1:1}function fie(t,e,n){var r=t._x1-t._x0,s=e-t._x1,i=(t._y1-t._y0)/(r||s<0&&-0),o=(n-t._y1)/(s||r<0&&-0),l=(i*s+o*r)/(r+s);
1263return(hie(i)+hie(o))*Math.min(Math.abs(i),Math.abs(o),.5*Math.abs(l))||0}function pie(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function Fz(t,e,n){var r=t._x0,s=t._y0,i=t._x1,o=t._y1,l=(i-r)/3;t._context.bezierCurveTo(r+l,s+l*e,i-l,o-l*n,i,o)}function xD(t){this._context=t}xD.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:Fz(this,this._t0,pie(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(t=+t,e=+e,!(t===this._x1&&e===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,Fz(this,pie(this,n=fie(this,t,e)),n);break;default:Fz(this,this._t0,n=fie(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}};function xke(t){this._context=new yke(t)}(xke.prototype=Object.create(xD.prototype)).point=function(t,e){xD.prototype.point.call(this,e,t)};function yke(t){this._context=t}yke.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,r,s,i){this._context.bezierCurveTo(e,t,r,n,i,s)}};function Kxt(t){return new xD(t)}function Gxt(t){return new xke(t)}function bke(t){this._context=t}bke.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),n===2)this._context.lineTo(t[1],e[1]);else for(var r=mie(t),s=mie(e),i=0,o=1;o<n;++i,++o)this._context.bezierCurveTo(r[0][i],s[0][i],r[1][i],s[1][i],t[o],e[o]);(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,e){this._x.push(+t),this._y.push(+e)}};function mie(t){var e,n=t.length-1,r,s=new Array(n),i=new Array(n),o=new Array(n);for(s[0]=0,i[0]=2,o[0]=t[0]+2*t[1],e=1;e<n-1;++e)s[e]=1,i[e]=4,o[e]=4*t[e]+2*t[e+1];for(s[n-1]=2,i[n-1]=7,o[n-1]=8*t[n-1]+t[n],e=1;e<n;++e)r=s[e]/i[e-1],i[e]-=r,o[e]-=r*o[e-1];for(s[n-1]=o[n-1]/i[n-1],e=n-2;e>=0;--e)s[e]=(o[e]-s[e+1])/i[e];for(i[n-1]=(t[n]+s[n-1])/2,e=0;e<n-1;++e)i[e]=2*t[e+1]-s[e+1];return[s,i]}function Yxt(t){return new bke(t)}function R4(t,e){this._context=t,this._t=e}R4.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(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}break}}this._x=t,this._y=e}};function Xxt(t){return new R4(t,.5)}function Jxt(t){return new R4(t,0)}function Qxt(t){return new R4(t,1)}function x0(t,e){if((o=t.length)>1)for(var n=1,r,s,i=t[e[0]],o,l=i.length;n<o;++n)for(s=i,i=t[e[n]],r=0;r<l;++r)i[r][1]+=i[r][0]=isNaN(s[r][1])?s[r][0]:s[r][1]}function bV(t){for(var e=t.length,n=new Array(e);--e>=0;)n[e]=e;return n}function Zxt(t,e){return t[e]}function eyt(t){const e=[];return e.key=t,e}function tyt(){var t=ar([]),e=bV,n=x0,r=Zxt;function s(i){var o=Array.from(t.apply(this,arguments),eyt),l,c=o.length,u=-1,d;for(const h of i)for(l=0,++u;l<c;++l)(o[l][u]=[0,+r(h,o[l].key,u,i)]).data=h;for(l=0,d=tG(e(o));l<c;++l)o[d[l]].index=l;return n(o,d),o}return s.keys=function(i){return arguments.length?(t=typeof i=="function"?i:ar(Array.from(i)),s):t},s.value=function(i){return arguments.length?(r=typeof i=="function"?i:ar(+i),s):r},s.order=function(i){return arguments.length?(e=i==null?bV:typeof i=="function"?i:ar(Array.from(i)),s):e},s.offset=function(i){return arguments.length?(n=i??x0,s):n},s}function nyt(t,e){if((r=t.length)>0){for(var n,r,s=0,i=t[0].length,o;s<i;++s){for(o=n=0;n<r;++n)o+=t[n][s][1]||0;if(o)for(n=0;n<r;++n)t[n][s][1]/=o}x0(t,e)}}function ryt(t,e){if((s=t.length)>0){for(var n=0,r=t[e[0]],s,i=r.length;n<i;++n){for(var o=0,l=0;o<s;++o)l+=t[o][n][1]||0;r[n][1]+=r[n][0]=-l/2}x0(t,e)}}function syt(t,e){if(!(!((o=t.length)>0)||!((i=(s=t[e[0]]).length)>0))){for(var n=0,r=1,s,i,o;r<i;++r){for(var l=0,c=0,u=0;l<o;++l){for(var d=t[e[l]],h=d[r][1]||0,f=d[r-1][1]||0,p=(h-f)/2,m=0;m<l;++m){var v=t[e[m]],x=v[r][1]||0,g=v[r-1][1]||0;p+=x-g}c+=h,u+=p*h}s[r-1][1]+=s[r-1][0]=n,c&&(n-=u/c)}s[r-1][1]+=s[r-1][0]=n,x0(t,e)}}function wV(t){return t==="__proto__"}function wke(t){switch(typeof t){case"number":case"symbol":return!1;case"string":return t.includes(".")||t.includes("[")||t.includes("]")}}function rG(t){var e;return typeof t=="string"||typeof t=="symbol"?t:Object.is((e=t==null?void 0:t.valueOf)==null?void 0:e.call(t),-0)?"-0":String(t)}function _ke(t){if(t==null)return"";if(typeof t=="string")return t;if(Array.isArray(t))return t.map(_ke).join(",");const e=String(t);return e==="0"&&Object.is(Number(t),-0)?"-0":e}function sG(t){if(Array.isArray(t))return t.map(rG);if(typeof t=="symbol")return[t];t=_ke(t);const e=[],n=t.length;if(n===0)return e;let r=0,s="",i="",o=!1;for(t.charCodeAt(0)===46&&e.push("");r<n;){const l=t[r];if(i)l==="\\"&&r+1<n?(r++,s+=t[r]):l===i?i="":s+=l;else if(o)l==='"'||l==="'"?i=l:l==="]"?(o=!1,e.push(s),s=""):s+=l;else if(l==="[")o=!0,s&&(e.push(s),s="");else if(l==="."){s&&(e.push(s),s="");const c=t[r+1];(c===void 0||c===".")&&e.push("")}else s+=l;r++}return s&&e.push(s),e}function fh(t,e,n){if(t==null)return n;
1263switch(typeof e){case"string":{if(wV(e))return n;const r=t[e];return r===void 0?wke(e)&&!Object.hasOwn(t,e)?fh(t,sG(e),n):n:r}case"number":case"symbol":{typeof e=="number"&&(e=rG(e));const r=t[e];return r===void 0?n:r}default:{if(Array.isArray(e))return iyt(t,e,n);if(Object.is(e==null?void 0:e.valueOf(),-0)?e="-0":e=String(e),wV(e))return n;const r=t[e];return r===void 0?n:r}}}function iyt(t,e,n){if(e.length===0)return n;let r=t;for(let s=0;s<e.length;s++){if(r==null||wV(e[s]))return n;r=r[e[s]]}return r===void 0?n:r}var ayt=4;function fg(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ayt,n=10**e,r=Math.round(t*n)/n;return Object.is(r,-0)?0:r}function Oi(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return t.reduce((s,i,o)=>{var l=n[o-1];return typeof l=="string"?s+l+i:l!==void 0?s+fg(l)+i:s+i},"")}var Vi=t=>t===0?0:t>0?1:-1,ph=t=>typeof t=="number"&&t!=+t,y0=t=>typeof t=="string"&&t.length>1&&t.indexOf("%")===t.length-1,Ct=t=>(typeof t=="number"||t instanceof Number)&&!ph(t),mh=t=>Ct(t)||typeof t=="string",oyt=0,Wk=t=>{var e=++oyt;return"".concat(t||"").concat(e)},Ta=function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Ct(e)&&typeof e!="string")return r;var i;if(y0(e)){if(n==null)return r;var o=e.indexOf("%");i=n*parseFloat(e.slice(0,o))/100}else i=+e;return ph(i)&&(i=r),s&&n!=null&&i>n&&(i=n),i},jke=t=>{if(!Array.isArray(t))return!1;for(var e=t.length,n={},r=0;r<e;r++)if(!n[String(t[r])])n[String(t[r])]=!0;else return!0;return!1};function ui(t,e,n){return Ct(t)&&Ct(e)?fg(t+n*(e-t)):e}function lyt(t,e,n){if(!(!t||!t.length))return t.find(r=>r&&(typeof e=="function"?e(r):fh(r,e))===n)}var Ks=t=>t===null||typeof t>"u",B2=t=>Ks(t)?t:"".concat(t.charAt(0).toUpperCase()).concat(t.slice(1));function Kd(t){return t!=null}function Gj(){}var cyt=["type","size","sizeType"];function _V(){return _V=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},_V.apply(null,arguments)}function gie(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function vie(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?gie(Object(n),!0).forEach(function(r){uyt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):gie(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function uyt(t,e,n){return(e=dyt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function dyt(t){var e=hyt(t,"string");return typeof e=="symbol"?e:e+""}function hyt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function fyt(t,e){if(t==null)return{};var n,r,s=pyt(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function pyt(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var Ske={symbolCircle:nG,symbolCross:Pxt,symbolDiamond:Rxt,symbolSquare:Oxt,symbolStar:Fxt,symbolTriangle:$xt,symbolWye:Bxt},myt=Math.PI/180,gyt=t=>{var e="symbol".concat(B2(t));return Ske[e]||nG},vyt=(t,e,n)=>{if(e==="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 r=18*myt;return 1.25*t*t*(Math.tan(r)-Math.tan(r*2)*Math.tan(r)**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}},xyt=(t,e)=>{Ske["symbol".concat(B2(t))]=e},Nke=t=>{var e=t.type,n=e===void 0?"circle":e,r=t.size,s=r===void 0?64:r,i=t.sizeType,o=i===void 0?"area":i,l=fyt(t,cyt),c=vie(vie({},l),{},{type:n,size:s,sizeType:o}),u="circle";typeof n=="string"&&(u=n);var d=()=>{var v=gyt(u),x=Uxt().type(v).size(vyt(s,o,u)),g=x();if(g!==null)return g},h=c.className,f=c.cx,p=c.cy,m=hh(c);return Ct(f)&&Ct(p)&&Ct(s)?b.createElement("path",_V({}
1263,m,{className:mn("recharts-symbols",h),transform:"translate(".concat(f,", ").concat(p,")"),d:d()})):null};Nke.registerSymbol=xyt;var Cke=t=>"radius"in t&&"startAngle"in t&&"endAngle"in t,yyt=(t,e)=>{if(!t||typeof t=="function"||typeof t=="boolean")return null;var n=t;if(b.isValidElement(t)&&(n=t.props),typeof n!="object"&&typeof n!="function")return null;var r={};return Object.keys(n).forEach(s=>{QK(s)&&typeof n[s]=="function"&&(r[s]=i=>n[s](n,i))}),r},byt=(t,e,n)=>r=>(t(e,n,r),null),U2=(t,e,n)=>{if(t===null||typeof t!="object"&&typeof t!="function")return null;var r=null;return Object.keys(t).forEach(s=>{var i=t[s];QK(s)&&typeof i=="function"&&(r||(r={}),r[s]=byt(i,e,n))}),r};function xie(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function wyt(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?xie(Object(n),!0).forEach(function(r){_yt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):xie(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function _yt(t,e,n){return(e=jyt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function jyt(t){var e=Syt(t,"string");return typeof e=="symbol"?e:e+""}function Syt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function za(t,e){var n=wyt({},t),r=e,s=Object.keys(e),i=s.reduce((o,l)=>(o[l]===void 0&&r[l]!==void 0&&(o[l]=r[l]),o),n);return i}function yD(){return yD=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},yD.apply(null,arguments)}function yie(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function kke(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?yie(Object(n),!0).forEach(function(r){Nyt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):yie(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Nyt(t,e,n){return(e=Cyt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Cyt(t){var e=kyt(t,"string");return typeof e=="symbol"?e:e+""}function kyt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var tc=32,Ayt={align:"center",iconSize:14,inactiveColor:"#ccc",layout:"horizontal",verticalAlign:"middle",labelStyle:{}};function Eyt(t){if(typeof t=="object"&&t!==null&&"strokeDasharray"in t)return String(t.strokeDasharray)}function Tyt(t){var e=t.data,n=t.iconType,r=t.inactiveColor,s=tc/2,i=tc/6,o=tc/3,l=e.inactive?r:e.color,c=n??e.type;if(c==="none")return null;if(c==="plainline")return b.createElement("line",{strokeWidth:4,fill:"none",stroke:l,strokeDasharray:Eyt(e.payload),x1:0,y1:s,x2:tc,y2:s,className:"recharts-legend-icon"});if(c==="line")return b.createElement("path",{strokeWidth:4,fill:"none",stroke:l,d:"M0,".concat(s,"h").concat(o,` 1264 A`).concat(i,",").concat(i,",0,1,1,").concat(2*o,",").concat(s,` 1265 H`).concat(tc,"M").concat(2*o,",").concat(s,` 1266 A`).concat(i,",").concat(i,",0,1,1,").concat(o,",").concat(s),className:"recharts-legend-icon"});if(c==="rect")return b.createElement("path",{stroke:"none",fill:l,d:"M0,".concat(tc/8,"h").concat(tc,"v").concat(tc*3/4,"h").concat(-tc,"z"),className:"recharts-legend-icon"});if(b.isValidElement(e.legendIcon)){var u=kke({},e);return delete u.legendIcon,b.cloneElement(e.legendIcon,u)}return b.createElement(Nke,{fill:l,cx:s,cy:s,size:tc,sizeType:"diameter",type:c})}function Pyt(t){var e=t.payload,n=t.iconSize,r=t.layout,s=t.formatter,i=t.inactiveColor,o=t.iconType,l=t.labelStyle,c={x:0,y:0,width:tc,height:tc},u={display:r==="horizontal"?"inline-block":"block",marginRight:10},d={display:"inline-block",verticalAlign:"middle",marginRight:4};return e.map((h,f)=>{var p=h.formatter||s,m=mn({"recharts-legend-item":!0,["legend-item-".concat(f)]:!0,inactive:h.inactive});if(h.type==="none")return null;var v=typeof l=="object"?kke({},l):{};v.color=h.inactive?i:v.color||h.color;var x=p?p(h.value,h,f):h.value;
1266return b.createElement("li",yD({className:m,style:u,key:"legend-item-".concat(f)},U2(t,h,f)),b.createElement(ZK,{width:n,height:n,viewBox:c,style:d,"aria-label":"".concat(h.value," legend icon")},b.createElement(Tyt,{data:h,iconType:o,inactiveColor:i})),b.createElement("span",{className:"recharts-legend-item-text",style:v},x))})}var Myt=t=>{var e=za(t,Ayt),n=e.payload,r=e.layout,s=e.align;if(!n||!n.length)return null;var i={padding:0,margin:0,textAlign:r==="horizontal"?s:"left"};return b.createElement("ul",{className:"recharts-default-legend",style:i},b.createElement(Pyt,yD({},e,{payload:n})))};function Ryt(t,e){const n=new Map;for(let r=0;r<t.length;r++){const s=t[r],i=e(s,r,t);n.has(i)||n.set(i,s)}return Array.from(n.values())}function Oyt(t,e){return function(...n){return t.apply(this,n.slice(0,e))}}function Ake(t){return t}function Iyt(t){return function(e){return fh(e,t)}}function jV(t){return t==null||typeof t!="object"&&typeof t!="function"}function Dyt(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Lyt(t){return Object.getOwnPropertySymbols(t).filter(e=>Object.prototype.propertyIsEnumerable.call(t,e))}function iG(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const Fyt="[object RegExp]",Eke="[object String]",Tke="[object Number]",Pke="[object Boolean]",Mke="[object Arguments]",$yt="[object Symbol]",zyt="[object Date]",Byt="[object Map]",Uyt="[object Set]",qyt="[object Array]",Vyt="[object ArrayBuffer]",Hyt="[object Object]",Wyt="[object DataView]",Kyt="[object Uint8Array]",Gyt="[object Uint8ClampedArray]",Yyt="[object Uint16Array]",Xyt="[object Uint32Array]",Jyt="[object Int8Array]",Qyt="[object Int16Array]",Zyt="[object Int32Array]",e0t="[object Float32Array]",t0t="[object Float64Array]",bie=typeof globalThis=="object"&&globalThis||typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||function(){return this}();function n0t(t){return typeof bie.Buffer<"u"&&bie.Buffer.isBuffer(t)}function r0t(t,e){return lx(t,void 0,t,new Map,e)}function lx(t,e,n,r=new Map,s=void 0){const i=s==null?void 0:s(t,e,n,r);if(i!==void 0)return i;if(jV(t))return t;if(r.has(t))return r.get(t);if(Array.isArray(t)){const o=new Array(t.length);r.set(t,o);for(let l=0;l<t.length;l++)o[l]=lx(t[l],l,n,r,s);return Object.hasOwn(t,"index")&&(o.index=t.index),Object.hasOwn(t,"input")&&(o.input=t.input),o}if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp){const o=new RegExp(t.source,t.flags);return o.lastIndex=t.lastIndex,o}if(t instanceof Map){const o=new Map;r.set(t,o);for(const[l,c]of t)o.set(l,lx(c,l,n,r,s));return o}if(t instanceof Set){const o=new Set;r.set(t,o);for(const l of t)o.add(lx(l,void 0,n,r,s));return o}if(n0t(t))return t.subarray();if(Dyt(t)){const o=new(Object.getPrototypeOf(t)).constructor(t.length);r.set(t,o);for(let l=0;l<t.length;l++)o[l]=lx(t[l],l,n,r,s);return o}if(t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer)return t.slice(0);if(t instanceof DataView){const o=new DataView(t.buffer.slice(0),t.byteOffset,t.byteLength);return r.set(t,o),nu(o,t,n,r,s),o}if(typeof File<"u"&&t instanceof File){const o=new File([t],t.name,{type:t.type});return r.set(t,o),nu(o,t,n,r,s),o}if(typeof Blob<"u"&&t instanceof Blob){const o=new Blob([t],{type:t.type});return r.set(t,o),nu(o,t,n,r,s),o}if(t instanceof Error){const o=structuredClone(t);return r.set(t,o),o.message=t.message,o.name=t.name,o.stack=t.stack,o.cause=t.cause,o.constructor=t.constructor,nu(o,t,n,r,s),o}if(t instanceof Boolean){const o=new Boolean(t.valueOf());return r.set(t,o),nu(o,t,n,r,s),o}if(t instanceof Number){const o=new Number(t.valueOf());return r.set(t,o),nu(o,t,n,r,s),o}if(t instanceof String){const o=new String(t.valueOf());return r.set(t,o),nu(o,t,n,r,s),o}if(typeof t=="object"&&s0t(t)){const o=Object.create(Object.getPrototypeOf(t));return r.set(t,o),nu(o,t,n,r,s),o}return t}function nu(t,e,n=t,r,s){const i=[...Object.keys(e),...Lyt(e)];for(let o=0;o<i.length;o++){const l=i[o],c=Object.getOwnPropertyDescriptor(t,l);(c==null||c.writable)&&(t[l]=lx(e[l],l,n,r,s))}}function s0t(t){switch(iG(t)){case Mke:case qyt:case Vyt:case Wyt:case Pke:case zyt:case e0t:case t0t:case Jyt:case Qyt:case Zyt:case Byt:case T
1266ke:case Hyt:case Fyt:case Uyt:case Eke:case $yt:case Kyt:case Gyt:case Yyt:case Xyt:return!0;default:return!1}}function i0t(t){return lx(t,void 0,t,new Map,void 0)}function BR(t,e){return t===e||Number.isNaN(t)&&Number.isNaN(e)}function Rke(t){return t!==null&&(typeof t=="object"||typeof t=="function")}function Oke(t,e,n){return typeof n!="function"?Oke(t,e,()=>{}):SV(t,e,function r(s,i,o,l,c,u){const d=n(s,i,o,l,c,u);return d!==void 0?!!d:SV(s,i,r,u,!1)},new Map,!0)}function SV(t,e,n,r,s=!1){if(e===t)return!0;switch(typeof e){case"object":return a0t(t,e,n,r);case"function":return Object.keys(e).length>0?SV(t,{...e},n,r,s):BR(t,e);default:return Rke(t)&&s?typeof e=="string"?e==="":!0:BR(t,e)}}function a0t(t,e,n,r){if(e==null)return!0;if(Array.isArray(e))return Ike(t,e,n,r);if(e instanceof Map)return o0t(t,e,n,r);if(e instanceof Set)return l0t(t,e,n,r);const s=Object.keys(e);if(t==null||jV(t))return s.length===0;if(s.length===0)return!0;if(r!=null&&r.has(e))return r.get(e)===t;r==null||r.set(e,t);try{for(let i=0;i<s.length;i++){const o=s[i];if(!jV(t)&&!(o in t)||e[o]===void 0&&t[o]!==void 0||e[o]===null&&t[o]!==null||!n(t[o],e[o],o,t,e,r))return!1}return!0}finally{r==null||r.delete(e)}}function o0t(t,e,n,r){if(e.size===0)return!0;if(!(t instanceof Map))return!1;for(const[s,i]of e.entries())if(n(t.get(s),i,s,t,e,r)===!1)return!1;return!0}function Ike(t,e,n,r){if(e.length===0)return!0;if(!Array.isArray(t))return!1;const s=new Set;for(let i=0;i<e.length;i++){const o=e[i];let l=!1;for(let c=0;c<t.length;c++){if(s.has(c))continue;const u=t[c];let d=!1;if(n(u,o,i,t,e,r)&&(d=!0),d){s.add(c),l=!0;break}}if(!l)return!1}return!0}function l0t(t,e,n,r){return e.size===0?!0:t instanceof Set?Ike([...t],[...e],n,r):!1}function Dke(t,e){return Oke(t,e,()=>{})}function c0t(t){return t=i0t(t),e=>Dke(e,t)}function u0t(t,e){return r0t(t,(n,r,s,i)=>{if(typeof t=="object"){if(iG(t)==="[object Object]"&&typeof t.constructor!="function"){const o={};return i.set(t,o),nu(o,t,s,i),o}switch(Object.prototype.toString.call(t)){case Tke:case Eke:case Pke:{const o=new t.constructor(t==null?void 0:t.valueOf());return nu(o,t),o}case Mke:{const o={};return nu(o,t),o.length=t.length,o[Symbol.iterator]=t[Symbol.iterator],o}default:return}}})}function d0t(t){return u0t(t)}const h0t=/^(?:0|[1-9]\d*)$/;function Lke(t,e=Number.MAX_SAFE_INTEGER){switch(typeof t){case"number":return Number.isInteger(t)&&t>=0&&t<e;case"symbol":return!1;case"string":return h0t.test(t)}}function f0t(t){return t!==null&&typeof t=="object"&&iG(t)==="[object Arguments]"}function p0t(t,e){let n;if(Array.isArray(e)?n=e:typeof e=="string"&&wke(e)&&(t==null?void 0:t[e])==null?n=sG(e):n=[e],n.length===0)return!1;let r=t;for(let s=0;s<n.length;s++){const i=n[s];if((r==null||!Object.hasOwn(r,i))&&!((Array.isArray(r)||f0t(r))&&Lke(i)&&i<r.length))return!1;r=r[i]}return!0}function m0t(t,e){switch(typeof t){case"object":Object.is(t==null?void 0:t.valueOf(),-0)&&(t="-0");break;case"number":t=rG(t);break}return e=d0t(e),function(n){const r=fh(n,t);return r===void 0?p0t(n,t):e===void 0?r===void 0:Dke(r,e)}}function g0t(t){if(t==null)return Ake;switch(typeof t){case"function":return t;case"object":return Array.isArray(t)&&t.length===2?m0t(t[0],t[1]):c0t(t);case"string":case"symbol":case"number":return Iyt(t)}}function v0t(t){return Number.isSafeInteger(t)&&t>=0}function Fke(t){return t!=null&&typeof t!="function"&&v0t(t.length)}function x0t(t){return typeof t=="object"&&t!==null}function y0t(t){return x0t(t)&&Fke(t)}function wie(t,e=Ake){return y0t(t)?Ryt(Array.from(t),Oyt(g0t(e),1)):[]}function $ke(t,e,n){return e===!0?wie(t,n):typeof e=="function"?wie(t,e):t}var aG=b.createContext(null),b0t=t=>t,Wn=()=>{var t=b.useContext(aG);return t?t.store.dispatch:b0t},UR=()=>{},w0t=()=>UR,_0t=(t,e)=>t===e;function mt(t){var e=b.useContext(aG),n=b.useMemo(()=>e?r=>{if(r!=null)return t(r)}:UR,[e,t]);return wNe.useSyncExternalStoreWithSelector(e?e.subscription.addNestedSub:w0t,e?e.store.getState:UR,e?e.store.getState:UR,n,_0t)}function j0t(t,e=`expected a function, instead received ${typeof t}`){if(typeof t!="function")throw new TypeError(e)}function S0t(t,e="expected all items to be functions, instead received the following types: "){if(!t.every(n=>typeof n=="function")){const n=t.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${e}[${n}]`)}}var _ie=t=>Array.isArray(t)?t:[t];function N0t(t){const e=Array.isArray(t[0])?t[0]:t;return S0t(e,"createSelector expects all input-selectors to be functions, but received the following types: "),e}function C0t(t,e){const n=[],{length:r}=t;for(let s=0;s<r;s++)n.push(t[s].apply(null,e));return n}var k0t=class{constructor(t){this.value=t}deref(){return this.value}},A0t=()=>typeof WeakRef>"u"?k0t:WeakRef,zke=A0t(),E0t=0,jie=1;function GP(){return{s:E0t,v:void 0,o:null,p:null}}function T0t(t){return t instanceof zke?t.deref():t}function Bke(t,e={}){let n=GP();const{resultEqualityCheck:r}=e;let s,i=0;function o(){let l=n;const{length:c}=arguments;for(let h=0,f=c;h<f;h++){const p=arguments[h];if(typeof p=="function"||typeof p=="object"&&p!==null){let m=l.o;m===null&&(l.o=m=new WeakMap);const v=m.get(p);v===void 0?(l=GP(),m.set(p,l)):l=v}else{let m=l.p;m===null&&(l.p=m=new Map);const v=m.get(p);v===void 0?(l=GP(),m.set(p,l)):l=v}}const u=l;let d;if(l.s===jie)d=l.v;
1266else if(d=t.apply(null,arguments),i++,r){const h=T0t(s);h!=null&&r(h,d)&&(d=h,i!==0&&i--),s=typeof d=="object"&&d!==null||typeof d=="function"?new zke(d):d}return u.s=jie,u.v=d,d}return o.clearCache=()=>{n=GP(),o.resetResultsCount()},o.resultsCount=()=>i,o.resetResultsCount=()=>{i=0},o}function P0t(t,...e){const n=typeof t=="function"?{memoize:t,memoizeOptions:e}:t,r=(...s)=>{let i=0,o=0,l,c={},u=s.pop();typeof u=="object"&&(c=u,u=s.pop()),j0t(u,`createSelector expects an output function after the inputs, but received: [${typeof u}]`);const d={...n,...c},{memoize:h,memoizeOptions:f=[],argsMemoize:p=Bke,argsMemoizeOptions:m=[]}=d,v=_ie(f),x=_ie(m),g=N0t(s),w=h(function(){return i++,u.apply(null,arguments)},...v),_=p(function(){o++;const N=C0t(g,arguments);return l=w.apply(null,N),l},...x);return Object.assign(_,{resultFunc:u,memoizedResultFunc:w,dependencies:g,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>l,recomputations:()=>i,resetRecomputations:()=>{i=0},memoize:h,argsMemoize:p})};return Object.assign(r,{withTypes:()=>r}),r}var we=P0t(Bke);function M0t(t,e=1){const n=[],r=Math.floor(e),s=(i,o)=>{for(let l=0;l<i.length;l++){const c=i[l];Array.isArray(c)&&o<r?s(c,o+1):n.push(c)}};return s(t,0),n}function NV(t,e,n){return Rke(n)&&(typeof e=="number"&&Fke(n)&&Lke(e)&&e<n.length||typeof e=="string"&&e in n)?BR(n[e],t):!1}function Sie(t){return typeof t=="symbol"?1:t===null?2:t===void 0?3:t!==t?4:0}const R0t=(t,e,n)=>{if(t!==e){const r=Sie(t),s=Sie(e);if(r===s&&r===0){if(t<e)return n==="desc"?1:-1;if(t>e)return n==="desc"?-1:1}return n==="desc"?s-r:r-s}return 0};function Uke(t){return typeof t=="symbol"||t instanceof Symbol}const O0t=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,I0t=/^\w*$/;function D0t(t,e){return Array.isArray(t)?!1:typeof t=="number"||typeof t=="boolean"||t==null||Uke(t)?!0:typeof t=="string"&&(I0t.test(t)||!O0t.test(t))||e!=null}function L0t(t,e,n,r){if(t==null)return[];n=n,Array.isArray(t)||(t=Object.values(t)),Array.isArray(e)||(e=e==null?[null]:[e]),e.length===0&&(e=[null]),Array.isArray(n)||(n=n==null?[]:[n]),n=n.map(l=>String(l));const s=(l,c)=>{let u=l;for(let d=0;d<c.length&&u!=null;++d)u=u[c[d]];return u},i=(l,c)=>c==null||l==null?c:typeof l=="object"&&"key"in l?Object.hasOwn(c,l.key)?c[l.key]:s(c,l.path):typeof l=="function"?l(c):Array.isArray(l)?s(c,l):typeof c=="object"?c[l]:c,o=e.map(l=>(Array.isArray(l)&&l.length===1&&(l=l[0]),l==null||typeof l=="function"||Array.isArray(l)||D0t(l)?l:{key:l,path:sG(l)}));return t.map(l=>({original:l,criteria:o.map(c=>i(c,l))})).slice().sort((l,c)=>{for(let u=0;u<o.length;u++){const d=R0t(l.criteria[u],c.criteria[u],n[u]);if(d!==0)return d}return 0}).map(l=>l.original)}function O4(t,...e){const n=e.length;return n>1&&NV(t,e[0],e[1])?e=[]:n>2&&NV(e[0],e[1],e[2])&&(e=[e[0]]),L0t(t,M0t(e),["asc"])}var qke=t=>t.legend.settings,F0t=t=>t.legend.size,$0t=t=>t.legend.payload,z0t=we([$0t,qke],(t,e)=>{var n=e.itemSorter,r=t.flat(1);return n?O4(r,n):r});function B0t(){return mt(z0t)}function U0t(t,e){return W0t(t)||H0t(t,e)||V0t(t,e)||q0t()}function q0t(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 1267In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function V0t(t,e){if(t){if(typeof t=="string")return Nie(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Nie(t,e):void 0}}function Nie(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function H0t(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,u=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function W0t(t){if(Array.isArray(t))return t}var YP=1;function Cie(t,e){return Math.abs(t.height-e.height)>YP||Math.abs(t.left-e.left)>YP||Math.abs(t.top-e.top)>YP||Math.abs(t.width-e.width)>YP}function kie(t){var e=t.getBoundingClientRect();return{height:e.height,left:e.left,top:e.top,width:e.width}}function Vke(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=b.useState({height:0,left:0,top:0,width:0}),n=U0t(e,2),r=n[0],s=n[1],i=b.useRef(null),o=b.useRef(r);o.current=r;var l=b.useCallback(c=>{if(i.current!=null&&(i.current.disconnect(),i.current=null),c!=null){var u=kie(c);
1267if(Cie(u,o.current)&&s(u),typeof ResizeObserver<"u"){var d=new ResizeObserver(()=>{var h=kie(c);Cie(h,o.current)&&s(h)});d.observe(c),i.current=d}}},[...t]);return b.useEffect(()=>()=>{var c;(c=i.current)===null||c===void 0||c.disconnect()},[]),[r,l]}function Pi(t){return`Minified Redux error #${t}; visit https://redux.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var K0t=typeof Symbol=="function"&&Symbol.observable||"@@observable",Aie=K0t,$z=()=>Math.random().toString(36).substring(7).split("").join("."),G0t={INIT:`@@redux/INIT${$z()}`,REPLACE:`@@redux/REPLACE${$z()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${$z()}`},bD=G0t;function oG(t){if(typeof t!="object"||t===null)return!1;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e||Object.getPrototypeOf(t)===null}function Hke(t,e,n){if(typeof t!="function")throw new Error(Pi(2));if(typeof e=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(Pi(0));if(typeof e=="function"&&typeof n>"u"&&(n=e,e=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Pi(1));return n(Hke)(t,e)}let r=t,s=e,i=new Map,o=i,l=0,c=!1;function u(){o===i&&(o=new Map,i.forEach((x,g)=>{o.set(g,x)}))}function d(){if(c)throw new Error(Pi(3));return s}function h(x){if(typeof x!="function")throw new Error(Pi(4));if(c)throw new Error(Pi(5));let g=!0;u();const w=l++;return o.set(w,x),function(){if(g){if(c)throw new Error(Pi(6));g=!1,u(),o.delete(w),i=null}}}function f(x){if(!oG(x))throw new Error(Pi(7));if(typeof x.type>"u")throw new Error(Pi(8));if(typeof x.type!="string")throw new Error(Pi(17));if(c)throw new Error(Pi(9));try{c=!0,s=r(s,x)}finally{c=!1}return(i=o).forEach(w=>{w()}),x}function p(x){if(typeof x!="function")throw new Error(Pi(10));r=x,f({type:bD.REPLACE})}function m(){const x=h;return{subscribe(g){if(typeof g!="object"||g===null)throw new Error(Pi(11));function w(){const j=g;j.next&&j.next(d())}return w(),{unsubscribe:x(w)}},[Aie](){return this}}}return f({type:bD.INIT}),{dispatch:f,subscribe:h,getState:d,replaceReducer:p,[Aie]:m}}function Y0t(t){Object.keys(t).forEach(e=>{const n=t[e];if(typeof n(void 0,{type:bD.INIT})>"u")throw new Error(Pi(12));if(typeof n(void 0,{type:bD.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Pi(13))})}function Wke(t){const e=Object.keys(t),n={};for(let i=0;i<e.length;i++){const o=e[i];typeof t[o]=="function"&&(n[o]=t[o])}const r=Object.keys(n);let s;try{Y0t(n)}catch(i){s=i}return function(o={},l){if(s)throw s;let c=!1;const u={};for(let d=0;d<r.length;d++){const h=r[d],f=n[h],p=o[h],m=f(p,l);if(typeof m>"u")throw l&&l.type,new Error(Pi(14));u[h]=m,c=c||m!==p}return c=c||r.length!==Object.keys(o).length,c?u:o}}function wD(...t){return t.length===0?e=>e:t.length===1?t[0]:t.reduce((e,n)=>(...r)=>e(n(...r)))}function X0t(...t){return e=>(n,r)=>{const s=e(n,r);let i=()=>{throw new Error(Pi(15))};const o={getState:s.getState,dispatch:(c,...u)=>i(c,...u)},l=t.map(c=>c(o));return i=wD(...l)(s.dispatch),{...s,dispatch:i}}}function Kke(t){return oG(t)&&"type"in t&&typeof t.type=="string"}var Gke=Symbol.for("immer-nothing"),Eie=Symbol.for("immer-draftable"),mo=Symbol.for("immer-state");function wu(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var El=Object,cj=El.getPrototypeOf,_D="constructor",I4="prototype",CV="configurable",jD="enumerable",qR="writable",Kk="value",rp=t=>!!t&&!!t[mo];function zu(t){var e;return t?Yke(t)||L4(t)||!!t[Eie]||!!((e=t[_D])!=null&&e[Eie])||F4(t)||$4(t):!1}var J0t=El[I4][_D].toString(),Tie=new WeakMap;function Yke(t){if(!t||!lG(t))return!1;const e=cj(t);if(e===null||e===El[I4])return!0;const n=El.hasOwnProperty.call(e,_D)&&e[_D];if(n===Object)return!0;if(!Wb(n))return!1;let r=Tie.get(n);return r===void 0&&(r=Function.toString.call(n),Tie.set(n,r)),r===J0t}function D4(t,e,n=!0){q2(t)===0?(n?Reflect.ownKeys(t):El.keys(t)).forEach(s=>{e(s,t[s],t)}):t.forEach((r,s)=>e(s,r,t))}function q2(t){const e=t[mo];return e?e.type_:L4(t)?1:F4(t)?2:$4(t)?3:0}var Pie=(t,e,n=q2(t))=>n===2?t.has(e):El[I4].hasOwnProperty.call(t,e),kV=(t,e,n=q2(t))=>n===2?t.get(e):t[e],SD=(t,e,n,r=q2(t))=>{r===2?t.set(e,n):r===3?t.add(n):t[e]=n};function Q0t(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}var L4=Array.isArray,F4=t=>t instanceof Map,$4=t=>t instanceof Set,lG=t=>typeof t=="object",Wb=t=>typeof t=="function",zz=t=>typeof t=="boolean";function Z0t(t){const e=+t;return Number.isInteger(e)&&String(e)===t}var Gh=t=>t.copy_||t.base_,cG=t=>t.modified_?t.copy_:t.base_;function AV(t,e){if(F4(t))return new Map(t);if($4(t))return new Set(t);if(L4(t))return Array[I4].slice.call(t);const n=Yke(t);if(e===!0||e==="class_only"&&!n){const r=El.getOwnPropertyDescriptors(t);delete r[mo];let s=Reflect.ownKeys(r);for(let i=0;i<s.length;
1267i++){const o=s[i],l=r[o];l[qR]===!1&&(l[qR]=!0,l[CV]=!0),(l.get||l.set)&&(r[o]={[CV]:!0,[qR]:!0,[jD]:l[jD],[Kk]:t[o]})}return El.create(cj(t),r)}else{const r=cj(t);if(r!==null&&n)return{...t};const s=El.create(r);return El.assign(s,t)}}function uG(t,e=!1){return z4(t)||rp(t)||!zu(t)||(q2(t)>1&&El.defineProperties(t,{set:XP,add:XP,clear:XP,delete:XP}),El.freeze(t),e&&D4(t,(n,r)=>{uG(r,!0)},!1)),t}function ebt(){wu(2)}var XP={[Kk]:ebt};function z4(t){return t===null||!lG(t)?!0:El.isFrozen(t)}var ND="MapSet",EV="Patches",Mie="ArrayMethods",Xke={};function b0(t){const e=Xke[t];return e||wu(0,t),e}var Rie=t=>!!Xke[t],Gk,Jke=()=>Gk,tbt=(t,e)=>({drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Rie(ND)?b0(ND):void 0,arrayMethodsPlugin_:Rie(Mie)?b0(Mie):void 0});function Oie(t,e){e&&(t.patchPlugin_=b0(EV),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function TV(t){PV(t),t.drafts_.forEach(nbt),t.drafts_=null}function PV(t){t===Gk&&(Gk=t.parent_)}var Iie=t=>Gk=tbt(Gk,t);function nbt(t){const e=t[mo];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function Die(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];if(t!==void 0&&t!==n){n[mo].modified_&&(TV(e),wu(4)),zu(t)&&(t=Lie(e,t));const{patchPlugin_:s}=e;s&&s.generateReplacementPatches_(n[mo].base_,t,e)}else t=Lie(e,n);return rbt(e,t,!0),TV(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==Gke?t:void 0}function Lie(t,e){if(z4(e))return e;const n=e[mo];if(!n)return CD(e,t.handledSet_,t);if(!B4(n,t))return e;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:r}=n;if(r)for(;r.length>0;)r.pop()(t);eAe(n,t)}return n.copy_}function rbt(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&uG(e,n)}function Qke(t){t.finalized_=!0,t.scope_.unfinalizedDrafts_--}var B4=(t,e)=>t.scope_===e,sbt=[];function Zke(t,e,n,r){const s=Gh(t),i=t.type_;if(r!==void 0&&kV(s,r,i)===e){SD(s,r,n,i);return}if(!t.draftLocations_){const l=t.draftLocations_=new Map;D4(s,(c,u)=>{if(rp(u)){const d=l.get(u)||[];d.push(c),l.set(u,d)}})}const o=t.draftLocations_.get(e)??sbt;for(const l of o)SD(s,l,n,i)}function ibt(t,e,n){t.callbacks_.push(function(s){var l;const i=e;if(!i||!B4(i,s))return;(l=s.mapSetPlugin_)==null||l.fixSetContents(i);const o=cG(i);Zke(t,i.draft_??i,o,n),eAe(i,s)})}function eAe(t,e){var r;if(t.modified_&&!t.finalized_&&(t.type_===3||t.type_===1&&t.allIndicesReassigned_||(((r=t.assigned_)==null?void 0:r.size)??0)>0)){const{patchPlugin_:s}=e;if(s){const i=s.getPath(t);i&&s.generatePatches_(t,i,e)}Qke(t)}}function abt(t,e,n){const{scope_:r}=t;if(rp(n)){const s=n[mo];B4(s,r)&&s.callbacks_.push(function(){VR(t);const o=cG(s);Zke(t,n,o,e)})}else zu(n)&&t.callbacks_.push(function(){const i=Gh(t);t.type_===3?i.has(n)&&CD(n,r.handledSet_,r):kV(i,e,t.type_)===n&&r.drafts_.length>1&&(t.assigned_.get(e)??!1)===!0&&t.copy_&&CD(kV(t.copy_,e,t.type_),r.handledSet_,r)})}function CD(t,e,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||rp(t)||e.has(t)||!zu(t)||z4(t)||(e.add(t),D4(t,(r,s)=>{if(rp(s)){const i=s[mo];if(B4(i,n)){const o=cG(i);SD(t,r,o,t.type_),Qke(i)}}else zu(s)&&CD(s,e,n)})),t}function obt(t,e){const n=L4(t),r={type_:n?1:0,scope_:e?e.scope_:Jke(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let s=r,i=kD;n&&(s=[r],i=Yk);const{revoke:o,proxy:l}=Proxy.revocable(s,i);return r.draft_=l,r.revoke_=o,[l,r]}var kD={get(t,e){if(e===mo)return t;let n=t.scope_.arrayMethodsPlugin_;const r=t.type_===1&&typeof e=="string";if(r&&n!=null&&n.isArrayOperationMethod(e))return n.createMethodInterceptor(t,e);const s=Gh(t);if(!Pie(s,e,t.type_))return lbt(t,s,e);const i=s[e];if(t.finalized_||!zu(i)||r&&t.operationMethod&&(n!=null&&n.isMutatingArrayMethod(t.operationMethod))&&Z0t(e))return i;if(i===Bz(t.base_,e)){VR(t);const o=t.type_===1?+e:e,l=RV(t.scope_,i,t,o);return t.copy_[o]=l}return i},has(t,e){return e in Gh(t)},ownKeys(t){return Reflect.ownKeys(Gh(t))},set(t,e,n){const r=tAe(Gh(t),e);if(r!=null&&r.set)return r.set.call(t.draft_,n),!0;if(!t.modified_){const s=Bz(Gh(t),e),i=s==null?void 0:s[mo];if(i&&i.base_===n)return t.copy_[e]=n,t.assigned_.set(e,!1),!0;if(Q0t(n,s)&&(n!==void 0||Pie(t.base_,e,t.type_)))return!0;VR(t),MV(t)}return t.copy_[e]===n&&(n!==void 0||e in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=n,t.assigned_.set(e,!0),abt(t,e,n)),!0},deleteProperty(t,e){return VR(t),Bz(t.base_,e)!==void 0||e in t.base_?(t.assigned_.set(e,!1),MV(t)):t.assigned_.delete(e),t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=Gh(t),r=Reflect.getOwnPropertyDescriptor(n,e);return r&&{[qR]:!0,[CV]:t.type_!==1||e!=="length",[jD]:r[jD],[Kk]:n[e]}},defineProperty(){wu(11)},getPrototypeOf(t){return cj(t.base_)},setPrototypeOf(){wu(12)}},Yk={};for(let t in kD){let e=kD[t];Yk[t]=function(){const n=arguments;return n[0]=n[0][0],e.apply(this,n)}}Yk.deleteProperty=function(t,e){return Yk.set.call(this,t,e,void 0)};
1267Yk.set=function(t,e,n){return kD.set.call(this,t[0],e,n,t[0])};function Bz(t,e){const n=t[mo];return(n?Gh(n):t)[e]}function lbt(t,e,n){var s;const r=tAe(e,n);return r?Kk in r?r[Kk]:(s=r.get)==null?void 0:s.call(t.draft_):void 0}function tAe(t,e){if(!(e in t))return;let n=cj(t);for(;n;){const r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=cj(n)}}function MV(t){t.modified_||(t.modified_=!0,t.parent_&&MV(t.parent_))}function VR(t){t.copy_||(t.assigned_=new Map,t.copy_=AV(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var cbt=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(n,r,s)=>{if(Wb(n)&&!Wb(r)){const o=r;r=n;const l=this;return function(u=o,...d){return l.produce(u,h=>r.call(this,h,...d))}}Wb(r)||wu(6),s!==void 0&&!Wb(s)&&wu(7);let i;if(zu(n)){const o=Iie(this),l=RV(o,n,void 0);let c=!0;try{i=r(l),c=!1}finally{c?TV(o):PV(o)}return Oie(o,s),Die(i,o)}else if(!n||!lG(n)){if(i=r(n),i===void 0&&(i=n),i===Gke&&(i=void 0),this.autoFreeze_&&uG(i,!0),s){const o=[],l=[];b0(EV).generateReplacementPatches_(n,i,{patches_:o,inversePatches_:l}),s(o,l)}return i}else wu(1,n)},this.produceWithPatches=(n,r)=>{if(Wb(n))return(l,...c)=>this.produceWithPatches(l,u=>n(u,...c));let s,i;return[this.produce(n,r,(l,c)=>{s=l,i=c}),s,i]},zz(e==null?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),zz(e==null?void 0:e.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),zz(e==null?void 0:e.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){zu(e)||wu(8),rp(e)&&(e=Sc(e));const n=Iie(this),r=RV(n,e,void 0);return r[mo].isManual_=!0,PV(n),r}finishDraft(e,n){const r=e&&e[mo];(!r||!r.isManual_)&&wu(9);const{scope_:s}=r;return Oie(s,n),Die(void 0,s)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,n){let r;for(r=n.length-1;r>=0;r--){const i=n[r];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}r>-1&&(n=n.slice(r+1));const s=b0(EV).applyPatches_;return rp(e)?s(e,n):this.produce(e,i=>s(i,n))}};function RV(t,e,n,r){const[s,i]=F4(e)?b0(ND).proxyMap_(e,n):$4(e)?b0(ND).proxySet_(e,n):obt(e,n);return((n==null?void 0:n.scope_)??Jke()).drafts_.push(s),i.callbacks_=(n==null?void 0:n.callbacks_)??[],i.key_=r,n&&r!==void 0?ibt(n,i,r):i.callbacks_.push(function(c){var d;(d=c.mapSetPlugin_)==null||d.fixSetContents(i);const{patchPlugin_:u}=c;i.modified_&&u&&u.generatePatches_(i,[],c)}),s}function Sc(t){return rp(t)||wu(10,t),nAe(t)}function nAe(t){if(!zu(t)||z4(t))return t;const e=t[mo];let n,r=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=AV(t,e.scope_.immer_.useStrictShallowCopy_),r=e.scope_.immer_.shouldUseStrictIteration()}else n=AV(t,!0);return D4(n,(s,i)=>{SD(n,s,nAe(i))},r),e&&(e.finalized_=!1),n}var ubt=new cbt,rAe=ubt.produce;function sAe(t){return({dispatch:n,getState:r})=>s=>i=>typeof i=="function"?i(n,r,t):s(i)}var dbt=sAe(),hbt=sAe,fbt=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?wD:wD.apply(null,arguments)};function zl(t,e){function n(...r){if(e){let s=e(...r);if(!s)throw new Error(Ol(0));return{type:t,payload:s.payload,..."meta"in s&&{meta:s.meta},..."error"in s&&{error:s.error}}}return{type:t,payload:r[0]}}return n.toString=()=>`${t}`,n.type=t,n.match=r=>Kke(r)&&r.type===t,n}var iAe=class YN extends Array{constructor(...e){super(...e),Object.setPrototypeOf(this,YN.prototype)}static get[Symbol.species](){return YN}concat(...e){return super.concat.apply(this,e)}prepend(...e){return e.length===1&&Array.isArray(e[0])?new YN(...e[0].concat(this)):new YN(...e.concat(this))}};function Fie(t){return zu(t)?rAe(t,()=>{}):t}function JP(t,e,n){return t.has(e)?t.get(e):t.set(e,n(e)).get(e)}function pbt(t){return typeof t=="boolean"}var mbt=()=>function(e){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:s=!0,actionCreatorCheck:i=!0}=e??{};let o=new iAe;return n&&(pbt(n)?o.push(dbt):o.push(hbt(n.extraArgument))),o},aAe="RTK_autoBatch",xr=()=>t=>({payload:t,meta:{[aAe]:!0}}),$ie=t=>e=>{setTimeout(e,t)},gbt=(t,e)=>n=>{let r=!1;const s=()=>{r||(r=!0,cancelAnimationFrame(i),clearTimeout(o),n())},i=t(s),o=setTimeout(s,e)},oAe=(t={type:"raf"})=>e=>(...n)=>{const r=e(...n);let s=!0,i=!1,o=!1;const l=new Set,c=t.type==="tick"?queueMicrotask:t.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?gbt(window.requestAnimationFrame,100):$ie(10):t.type==="callback"?t.queueNotification:$ie(t.timeout),u=()=>{o=!1,i&&(i=!1,l.forEach(d=>d()))};return Object.assign({},r,{subscribe(d){const h=()=>s&&d(),f=r.subscribe(h);return l.add(d),()=>{f(),l.delete(d)}},dispatch(d){var h;try{return s=!((h=d==null?void 0:d.meta)!=null&&h[aAe]),i=!s,i&&(o||(o=!0,c(u))),r.dispatch(d)}finally{s=!0}}})},vbt=t=>function(n){const{autoBatch:r=!0}=n??{};let s=new iAe(t);return r&&s.push(oAe(typeof r=="object"?r:void 0)),s};function xbt(t){const e=mbt(),{reducer:n=void 0,middleware:r,devTools:s=!0,duplicateMiddlewareCheck:i=!0,preloadedState:o=void 0,enhancers:l=void 0}=t||{};let c;if(typeof n=="function")c=n;else if(oG(n))c=Wke(n);else throw new Error(Ol(1));let u;typeof r=="function"?u=r(e):u=e();let d=wD;s&&(d=fbt({trace:!1,...typeof s=="object"&&s}));const h=X0t(...u),f=vbt(h);let p=typeof l=="function"?l(f):f();const m=d(...p);return Hke(c,o,m)}function lAe(t){const e={},n=[];let r;const s={addCase(i,o){const l=typeof i=="string"?i:i.type;if(!l)throw new Error(Ol(28));if(l in e)throw new Error(Ol(29));return e[l]=o,s},addAsyncThunk(i,o){return o.pending&&(e[i.pending.type]=o.pending),o.rejected&&(e[i.rejected.type]=o.rejected),o.fulfilled&&(e[i.fulfilled.type]=o.fulfilled),o.settled&&n.push({matcher:i.settled,reducer:o.settled}),s},addMatcher(i,o){return n.push({matcher:i,reducer:o}),s},addDefaultCase(i){return r=i,s}};return t(s),[e,n,r]}function ybt(t){return typeof t=="function"}function bbt(t,e){let[n,r,s]=lAe(e),i;if(ybt(t))i=()=>Fie(t());else{const l=Fie(t);i=()=>l}function o(l=i(),c){let u=[n[c.type],...r.filter(({matcher:d})=>d(c)).map(({reducer:d})=>d)];return u.filter(d=>!!d).length===0&&(u=[s]),u.reduce((d,h)=>{if(h)if(rp(d)){const p=h(d,c);return p===void 0?d:p}else{if(zu(d))return rAe(d,f=>h(f,c));{const f=h(d,c);if(f===void 0){if(d===null)return d;throw Error("A case reducer on a non-draftable value must not return undefined")}return f}}return d},l)}return o.getInitialState=i,o}
1267var wbt="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",_bt=(t=21)=>{let e="",n=t;for(;n--;)e+=wbt[Math.random()*64|0];return e},jbt=Symbol.for("rtk-slice-createasyncthunk");function Sbt(t,e){return`${t}/${e}`}function Nbt({creators:t}={}){var n;const e=(n=t==null?void 0:t.asyncThunk)==null?void 0:n[jbt];return function(s){const{name:i,reducerPath:o=i}=s;if(!i)throw new Error(Ol(11));typeof process<"u";const l=(typeof s.reducers=="function"?s.reducers(kbt()):s.reducers)||{},c=Object.keys(l),u={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},d={addCase(j,N){const S=typeof j=="string"?j:j.type;if(!S)throw new Error(Ol(12));if(S in u.sliceCaseReducersByType)throw new Error(Ol(13));return u.sliceCaseReducersByType[S]=N,d},addMatcher(j,N){return u.sliceMatchers.push({matcher:j,reducer:N}),d},exposeAction(j,N){return u.actionCreators[j]=N,d},exposeCaseReducer(j,N){return u.sliceCaseReducersByName[j]=N,d}};c.forEach(j=>{const N=l[j],S={reducerName:j,type:Sbt(i,j),createNotation:typeof s.reducers=="function"};Ebt(N)?Pbt(S,N,d,e):Abt(S,N,d)});function h(){const[j={},N=[],S=void 0]=typeof s.extraReducers=="function"?lAe(s.extraReducers):[s.extraReducers],C={...j,...u.sliceCaseReducersByType};return bbt(s.initialState,k=>{for(let E in C)k.addCase(E,C[E]);for(let E of u.sliceMatchers)k.addMatcher(E.matcher,E.reducer);for(let E of N)k.addMatcher(E.matcher,E.reducer);S&&k.addDefaultCase(S)})}const f=j=>j,p=new Map,m=new WeakMap;let v;function x(j,N){return v||(v=h()),v(j,N)}function g(){return v||(v=h()),v.getInitialState()}function w(j,N=!1){function S(k){let E=k[j];return typeof E>"u"&&N&&(E=JP(m,S,g)),E}function C(k=f){const E=JP(p,N,()=>new WeakMap);return JP(E,k,()=>{const P={};for(const[T,M]of Object.entries(s.selectors??{}))P[T]=Cbt(M,k,()=>JP(m,k,g),N);return P})}return{reducerPath:j,getSelectors:C,get selectors(){return C(S)},selectSlice:S}}const _={name:i,reducer:x,actions:u.actionCreators,caseReducers:u.sliceCaseReducersByName,getInitialState:g,...w(o),injectInto(j,{reducerPath:N,...S}={}){const C=N??o;return j.inject({reducerPath:C,reducer:x},S),{..._,...w(C,!0)}}};return _}}function Cbt(t,e,n,r){function s(i,...o){let l=e(i);return typeof l>"u"&&r&&(l=n()),t(l,...o)}return s.unwrapped=t,s}var Ba=Nbt();function kbt(){function t(e,n){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...n}}return t.withTypes=()=>t,{reducer(e){return Object.assign({[e.name](...n){return e(...n)}}[e.name],{_reducerDefinitionType:"reducer"})},preparedReducer(e,n){return{_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:n}},asyncThunk:t}}function Abt({type:t,reducerName:e,createNotation:n},r,s){let i,o;if("reducer"in r){if(n&&!Tbt(r))throw new Error(Ol(17));i=r.reducer,o=r.prepare}else i=r;s.addCase(t,i).exposeCaseReducer(e,i).exposeAction(e,o?zl(t,o):zl(t))}function Ebt(t){return t._reducerDefinitionType==="asyncThunk"}function Tbt(t){return t._reducerDefinitionType==="reducerWithPrepare"}function Pbt({type:t,reducerName:e},n,r,s){if(!s)throw new Error(Ol(18));const{payloadCreator:i,fulfilled:o,pending:l,rejected:c,settled:u,options:d}=n,h=s(t,i,d);r.exposeAction(e,h),o&&r.addCase(h.fulfilled,o),l&&r.addCase(h.pending,l),c&&r.addCase(h.rejected,c),u&&r.addMatcher(h.settled,u),r.exposeCaseReducer(e,{fulfilled:o||QP,pending:l||QP,rejected:c||QP,settled:u||QP})}function QP(){}var Mbt="task",cAe="listener",uAe="completed",dG="cancelled",Rbt=`task-${dG}`,Obt=`task-${uAe}`,OV=`${cAe}-${dG}`,Ibt=`${cAe}-${uAe}`,U4=class{constructor(t){Te(this,"code");Te(this,"name","TaskAbortError");Te(this,"message");this.code=t,this.message=`${Mbt} ${dG} (reason: ${t})`}},hG=(t,e)=>{if(typeof t!="function")throw new TypeError(Ol(32))},AD=()=>{},dAe=(t,e=AD)=>(t.catch(e),t),hAe=(t,e)=>(t.addEventListener("abort",e,{once:!0}),()=>t.removeEventListener("abort",e)),Uy=t=>{if(t.aborted)throw new U4(t.reason)};function fAe(t,e){let n=AD;return new Promise((r,s)=>{const i=()=>s(new U4(t.reason));if(t.aborted){i();return}n=hAe(t,i),e.finally(()=>n()).then(r,s)}).finally(()=>{n=AD})}var Dbt=async(t,e)=>{try{return await Promise.resolve(),{status:"ok",value:await t()}}catch(n){return{status:n instanceof U4?"cancelled":"rejected",error:n}}finally{e==null||e()}},ED=t=>e=>dAe(fAe(t,e).then(n=>(Uy(t),n))),pAe=t=>{const e=ED(t);return n=>e(new Promise(r=>setTimeout(r,n)))},{assign:qw}=Object,zie={},q4="listenerMiddleware",Lbt=(t,e)=>{const n=r=>hAe(t,()=>r.abort(t.reason));return(r,s)=>{hG(r);const i=new AbortController;n(i);const o=Dbt(async()=>{Uy(t),Uy(i.signal);const l=await r({pause:ED(i.signal),delay:pAe(i.signal),signal:i.signal});return Uy(i.signal),l},()=>i.abort(Obt));return s!=null&&s.autoJoin&&e.push(o.catch(AD)),{result:ED(t)(o),cancel(){i.abort(Rbt)}}}},Fbt=(t,e)=>{const n=async(r,s)=>{Uy(e);let i=()=>{};const l=[new Promise((c,u)=>{let d=t({predicate:r,effect:(h,f)=>{f.unsubscribe(),c([h,f.getState(),f.getOriginalState()])}});i=()=>{d(),u()}})];s!=null&&l.push(new Promise(c=>setTimeout(c,s,null)));try{const c=await fAe(e,Promise.race(l));return Uy(e),c}finally{i()}};return(r,s)=>dAe(n(r,s))},mAe=t=>{let{type:e,actionCreator:n,matcher:r,predicate:s,effect:i}=t;if(e)s=zl(e).match;else if(n)e=n.type,s=n.match;else if(r)s=r;else if(!s)throw new Error(Ol(21));return hG(i),{predicate:s,type:e,effect:i}},gAe=qw(t=>{const{type:e,predicate:n,effect:r}=mAe(t);return{id:_bt(),effect:r,type:e,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(Ol(22))}}},{withTypes:()=>gAe}),Bie=(t,e)=>{const{type:n,effect:r,predicate:s}=mAe(e);return Array.from(t.values()).find(i=>(typeof n=="string"?i.type===n:i.predicate===s)&&i.effect===r)},IV=t=>
1267{t.pending.forEach(e=>{e.abort(OV)})},$bt=(t,e)=>()=>{for(const n of e.keys())IV(n);t.clear()},Uie=(t,e,n)=>{try{t(e,n)}catch(r){setTimeout(()=>{throw r},0)}},vAe=qw(zl(`${q4}/add`),{withTypes:()=>vAe}),zbt=zl(`${q4}/removeAll`),xAe=qw(zl(`${q4}/remove`),{withTypes:()=>xAe}),Bbt=(...t)=>{console.error(`${q4}/error`,...t)},V2=(t={})=>{const e=new Map,n=new Map,r=p=>{const m=n.get(p)??0;n.set(p,m+1)},s=p=>{const m=n.get(p)??1;m===1?n.delete(p):n.set(p,m-1)},{extra:i,onError:o=Bbt}=t;hG(o);const l=p=>(p.unsubscribe=()=>e.delete(p.id),e.set(p.id,p),m=>{p.unsubscribe(),m!=null&&m.cancelActive&&IV(p)}),c=p=>{const m=Bie(e,p)??gAe(p);return l(m)};qw(c,{withTypes:()=>c});const u=p=>{const m=Bie(e,p);return m&&(m.unsubscribe(),p.cancelActive&&IV(m)),!!m};qw(u,{withTypes:()=>u});const d=async(p,m,v,x)=>{const g=new AbortController,w=Fbt(c,g.signal),_=[];try{p.pending.add(g),r(p),await Promise.resolve(p.effect(m,qw({},v,{getOriginalState:x,condition:(j,N)=>w(j,N).then(Boolean),take:w,delay:pAe(g.signal),pause:ED(g.signal),extra:i,signal:g.signal,fork:Lbt(g.signal,_),unsubscribe:p.unsubscribe,subscribe:()=>{e.set(p.id,p)},cancelActiveListeners:()=>{p.pending.forEach((j,N,S)=>{j!==g&&(j.abort(OV),S.delete(j))})},cancel:()=>{g.abort(OV),p.pending.delete(g)},throwIfCancelled:()=>{Uy(g.signal)}})))}catch(j){j instanceof U4||Uie(o,j,{raisedBy:"effect"})}finally{await Promise.all(_),g.abort(Ibt),s(p),p.pending.delete(g)}},h=$bt(e,n);return{middleware:p=>m=>v=>{if(!Kke(v))return m(v);if(vAe.match(v))return c(v.payload);if(zbt.match(v)){h();return}if(xAe.match(v))return u(v.payload);let x=p.getState();const g=()=>{if(x===zie)throw new Error(Ol(23));return x};let w;try{if(w=m(v),e.size>0){const _=p.getState(),j=Array.from(e.values());for(const N of j){let S=!1;try{S=N.predicate(v,_,x)}catch(C){S=!1,Uie(o,C,{raisedBy:"predicate"})}S&&d(N,v,p,g)}}}finally{x=zie}return w},startListening:c,stopListening:u,clearListeners:h}};function Ol(t){return`Minified Redux Toolkit error #${t}; visit https://redux-toolkit.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var Ubt={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},yAe=Ba({name:"chartLayout",initialState:Ubt,reducers:{setLayout(t,e){t.layoutType=e.payload},setChartSize(t,e){t.width=e.payload.width,t.height=e.payload.height},setMargin(t,e){var n,r,s,i;t.margin.top=(n=e.payload.top)!==null&&n!==void 0?n:0,t.margin.right=(r=e.payload.right)!==null&&r!==void 0?r:0,t.margin.bottom=(s=e.payload.bottom)!==null&&s!==void 0?s:0,t.margin.left=(i=e.payload.left)!==null&&i!==void 0?i:0},setScale(t,e){t.scale=e.payload}}}),V4=yAe.actions,qbt=V4.setMargin,Vbt=V4.setLayout,Hbt=V4.setChartSize,Wbt=V4.setScale,Kbt=yAe.reducer;
1267function bAe(t,e,n){return Array.isArray(t)&&t&&e+n!==0?t.slice(e,n+1):t}function An(t){return Number.isFinite(t)}function Hg(t){return typeof t=="number"&&t>0&&Number.isFinite(t)}function qie(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function mw(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?qie(Object(n),!0).forEach(function(r){Gbt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):qie(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Gbt(t,e,n){return(e=Ybt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ybt(t){var e=Xbt(t,"string");return typeof e=="symbol"?e:e+""}function Xbt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Qn(t,e,n){return Ks(t)||Ks(e)?n:mh(e)?fh(t,e,n):typeof e=="function"?e(t):n}var Jbt=(t,e,n)=>{if(e&&n){var r=n.width,s=n.height,i=e.align,o=e.verticalAlign,l=e.layout;if((l==="vertical"||l==="horizontal"&&o==="middle")&&i!=="center"&&Ct(t[i]))return mw(mw({},t),{},{[i]:t[i]+(r||0)});if((l==="horizontal"||l==="vertical"&&i==="center")&&o!=="middle"&&Ct(t[o]))return mw(mw({},t),{},{[o]:t[o]+(s||0)})}return t},uv=(t,e)=>t==="horizontal"&&e==="xAxis"||t==="vertical"&&e==="yAxis"||t==="centric"&&e==="angleAxis"||t==="radial"&&e==="radiusAxis",Qbt=(t,e)=>{if(!e||e.length!==2||!Ct(e[0])||!Ct(e[1]))return t;var n=Math.min(e[0],e[1]),r=Math.max(e[0],e[1]),s=[t[0],t[1]];return(!Ct(t[0])||t[0]<n)&&(s[0]=n),(!Ct(t[1])||t[1]>r)&&(s[1]=r),s[0]>r&&(s[0]=r),s[1]<n&&(s[1]=n),s},Zbt=t=>{var e,n=t.length;if(!(n<=0)){var r=(e=t[0])===null||e===void 0?void 0:e.length;if(!(r==null||r<=0))for(var s=0;s<r;++s)for(var i=0,o=0,l=0;l<n;++l){var c=t[l],u=c==null?void 0:c[s];if(u!=null){var d=u[1],h=u[0],f=ph(d)?h:d;f>=0?(u[0]=i,i+=f,u[1]=i):(u[0]=o,o+=f,u[1]=o)}}}},ewt=t=>{var e,n=t.length;if(!(n<=0)){var r=(e=t[0])===null||e===void 0?void 0:e.length;if(!(r==null||r<=0))for(var s=0;s<r;++s)for(var i=0,o=0;o<n;++o){var l=t[o],c=l==null?void 0:l[s];if(c!=null){var u=ph(c[1])?c[0]:c[1];u>=0?(c[0]=i,i+=u,c[1]=i):(c[0]=0,c[1]=0)}}}},twt={sign:Zbt,expand:nyt,none:x0,silhouette:ryt,wiggle:syt,positive:ewt},nwt=(t,e,n)=>{var r,s=(r=twt[n])!==null&&r!==void 0?r:x0,i=tyt().keys(e).value((l,c)=>Number(Qn(l,c,0))).order(bV).offset(s),o=i(t);return o.forEach((l,c)=>{l.forEach((u,d)=>{var h=Qn(t[d],e[c],0);Array.isArray(h)&&h.length===2&&Ct(h[0])&&Ct(h[1])&&(u[0]=h[0],u[1]=h[1])})}),o};function rwt(t){return t==null?void 0:String(t)}var Vie=t=>
1267{var e=t.axis,n=t.ticks,r=t.offset,s=t.bandSize,i=t.entry,o=t.index;if(e.type==="category")return n[o]?n[o].coordinate+r:null;var l=Qn(i,e.dataKey,e.scale.domain()[o]);if(Ks(l))return null;var c=e.scale.map(l);return Ct(c)?c-s/2+r:null},swt=t=>{var e=t.numericAxis,n=e.scale.domain();if(e.type==="number"){var r=Math.min(n[0],n[1]),s=Math.max(n[0],n[1]);return r<=0&&s>=0?0:s<0?s:r}return n[0]},iwt=t=>{var e=t.flat(2).filter(Ct);return[Math.min(...e),Math.max(...e)]},awt=t=>[t[0]===1/0?0:t[0],t[1]===-1/0?0:t[1]],owt=(t,e,n)=>{if(!(t==null||Object.keys(t).length===0))return awt(Object.keys(t).reduce((r,s)=>{var i=t[s];if(!i)return r;var o=i.stackedData,l=o.reduce((c,u)=>{var d=bAe(u,e,n),h=iwt(d);return!An(h[0])||!An(h[1])?c:[Math.min(c[0],h[0]),Math.max(c[1],h[1])]},[1/0,-1/0]);return[Math.min(l[0],r[0]),Math.max(l[1],r[1])]},[1/0,-1/0]))},Hie=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Wie=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,TD=(t,e,n)=>{if(t&&t.scale&&t.scale.bandwidth){var r=t.scale.bandwidth();if(!n||r>0)return r}if(t&&e&&e.length>=2){for(var s=O4(e,d=>d.coordinate),i=1/0,o=1,l=s.length;o<l;o++){var c=s[o],u=s[o-1];i=Math.min(((c==null?void 0:c.coordinate)||0)-((u==null?void 0:u.coordinate)||0),i)}return i===1/0?0:i}return n?void 0:0};function Kie(t){var e=t.tooltipEntrySettings,n=t.dataKey,r=t.payload,s=t.value,i=t.name;return mw(mw({},e),{},{dataKey:n,payload:r,value:s,name:i})}function H4(t,e){if(t!=null)return String(t);if(typeof e=="string")return e}var lwt=(t,e)=>{if(e==="horizontal")return t.relativeX;if(e==="vertical")return t.relativeY},cwt=(t,e)=>e==="centric"?t.angle:t.radius,vp=t=>t.layout.width,xp=t=>t.layout.height,uwt=t=>t.layout.scale,wAe=t=>t.layout.margin,W4=we(t=>t.cartesianAxis.xAxis,t=>Object.values(t)),K4=we(t=>t.cartesianAxis.yAxis,t=>Object.values(t)),_Ae="data-recharts-item-index",jAe="data-recharts-item-id",H2=60;function Gie(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function ZP(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Gie(Object(n),!0).forEach(function(r){dwt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Gie(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function dwt(t,e,n){return(e=hwt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function hwt(t){var e=fwt(t,"string");return typeof e=="symbol"?e:e+""}function fwt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var pwt=t=>t.brush.height;function mwt(t){var e=K4(t);return e.reduce((n,r)=>{if(r.orientation==="left"&&!r.mirror&&!r.hide){var s=typeof r.width=="number"?r.width:H2;return n+s}return n},0)}function gwt(t){var e=K4(t);return e.reduce((n,r)=>{if(r.orientation==="right"&&!r.mirror&&!r.hide){var s=typeof r.width=="number"?r.width:H2;return n+s}return n},0)}function vwt(t){var e=W4(t);return e.reduce((n,r)=>r.orientation==="top"&&!r.mirror&&!r.hide?n+r.height:n,0)}function xwt(t){var e=W4(t);return e.reduce((n,r)=>r.orientation==="bottom"&&!r.mirror&&!r.hide?n+r.height:n,0)}var Xs=we([vp,xp,wAe,pwt,mwt,gwt,vwt,xwt,qke,F0t],(t,e,n,r,s,i,o,l,c,u)=>{var d={left:(n.left||0)+s,right:(n.right||0)+i},h={top:(n.top||0)+o,bottom:(n.bottom||0)+l},f=ZP(ZP({},h),d),p=f.bottom;f.bottom+=r,f=Jbt(f,c,u);var m=t-f.left-f.right,v=e-f.top-f.bottom;return ZP(ZP({brushBottom:p},f),{},{width:Math.max(m,0),height:Math.max(v,0)})}),ywt=we(Xs,t=>({x:t.left,y:t.top,width:t.width,height:t.height})),fG=we(vp,xp,(t,e)=>({x:0,y:0,width:t,height:e})),bwt=b.createContext(null),Vl=()=>b.useContext(bwt)!=null,G4=t=>t.brush,Y4=we([G4,Xs,wAe],(t,e,n)=>({height:t.height,x:Ct(t.x)?t.x:e.left,y:Ct(t.y)?t.y:e.top+e.height+e.brushBottom-((n==null?void 0:n.bottom)||0),width:Ct(t.width)?t.width:e.width}));function wwt(t,e,{signal:n,edges:r}={}){let s,i=null;const o=r!=null&&r.includes("leading"),l=r==null||r.includes("trailing"),c=()=>{i!==null&&(t.apply(s,i),s=void 0,i=null)},u=()=>{l&&c(),p()};let d=null;const h=()=>{d!=null&&clearTimeout(d),d=setTimeout(()=>{d=null,u()},e)},f=()=>{d!==null&&(clearTimeout(d),d=null)},p=()=>{f(),s=void 0,i=null},m=()=>{c()},v=function(...x){if(n!=null&&n.aborted)return;s=this,i=x;const g=d==null;h(),o&&g&&c()};return v.schedule=h,v.cancel=p,v.flush=m,n==null||n.addEventListener("abort",p,{once:!0}),v}function _wt(t,e=0,n={}){typeof n!="object"&&(n={});const{leading:r=!1,trailing:s=!0,maxWait:i}=n,o=Array(2);r&&(o[0]="leading"),s&&(o[1]="trailing");let l,c=null;const u=wwt(function(...f){l=t.apply(this,f),c=null},e,{edges:o}),d=function(...f){return i!=null&&(c===null&&(c=Date.now()),Date.now()-c>=i)?(l=t.apply(this,f),c=Date.now(),u.cancel(),u.schedule(),l):(u.apply(this,f),l)},h=()=>(u.flush(),l);return d.cancel=u.cancel,d.flush=h,d}function jwt(t,e=0,n={}){const{leading:r=!0,trailing:s=!0}=n;return _wt(t,e,{leading:r,maxWait:e,trailing:s})}var Yie=function(e,n){for(var r=arguments.length,s=new Array(r>2?r-2:0),i=2;i<r;i++)s[i-2]=arguments[i];if(typeof console<"u"&&console.warn&&(n===void 0&&console.warn("LogUtils requires an error message argument"),!e))if(n===void 0)console.warn("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var o=0;console.warn(n.replace(/%s/g,()=>s[o++]))}},Gd={width:"100%",height:"100%",debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},SAe=(t,e,n)=>{var r=n.width,s=r===void 0?Gd.width:r,i=n.height,o=i===void 0?Gd.height:i,l=n.aspect,c=n.maxHeight,u=y0(s)?t:Number(s),d=y0(o)?e:Number(o);return l&&l>0&&(u?d=u/l:d&&(u=d*l),c&&d!=null&&d>c&&(d=c)),{calculatedWidth:u,calculatedHeight:d}},Swt={width:0,height:0,overflow:"visible"},Nwt={width:0,overflowX:"visible"},Cwt={height:0,overflowY:"visible"},kwt={},Awt=t=>{var e=t.width,n=t.height,r=y0(e),s=y0(n);return r&&s?Swt:r?Nwt:s?Cwt:kwt};function Ewt(t){var e=t.width,n=t.height,r=t.aspect,s=e,i=n;return s===void 0&&i===void 0?(s=Gd.width,i=Gd.height):s===void 0?s=r&&r>0?void 0:Gd.width:i===void 0&&(i=r&&r>0?void 0:Gd.height),{width:s,height:i}}var Twt=["aspect","initialDimension","width","height","minWidth","minHeight","maxHeight","children","debounce","id","className","onResize","style"];function PD(){return PD=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},PD.apply(null,arguments)}function Xie(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Jie(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};
1267e%2?Xie(Object(n),!0).forEach(function(r){Pwt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Xie(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Pwt(t,e,n){return(e=Mwt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Mwt(t){var e=Rwt(t,"string");return typeof e=="symbol"?e:e+""}function Rwt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Owt(t,e){return Fwt(t)||Lwt(t,e)||Dwt(t,e)||Iwt()}function Iwt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 1268In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Dwt(t,e){if(t){if(typeof t=="string")return Qie(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Qie(t,e):void 0}}function Qie(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Lwt(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,u=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function Fwt(t){if(Array.isArray(t))return t}function $wt(t,e){if(t==null)return{};var n,r,s=zwt(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function zwt(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var NAe=b.createContext(Gd.initialDimension);function Bwt(t){return Hg(t.width)&&Hg(t.height)}function CAe(t){var e=t.children,n=t.width,r=t.height,s=b.useMemo(()=>({width:n,height:r}),[n,r]);return Bwt(s)?b.createElement(NAe.Provider,{value:s},e):null}var pG=()=>b.useContext(NAe),Uwt=b.forwardRef((t,e)=>{var n=t.aspect,r=t.initialDimension,s=r===void 0?Gd.initialDimension:r,i=t.width,o=t.height,l=t.minWidth,c=l===void 0?Gd.minWidth:l,u=t.minHeight,d=t.maxHeight,h=t.children,f=t.debounce,p=f===void 0?Gd.debounce:f,m=t.id,v=t.className,x=t.onResize,g=t.style,w=g===void 0?{}:g,_=$wt(t,Twt),j=b.useRef(null),N=b.useRef();N.current=x,b.useImperativeHandle(e,()=>j.current);var S=b.useState({containerWidth:s.width,containerHeight:s.height}),C=Owt(S,2),k=C[0],E=C[1],P=b.useCallback((D,O)=>{E(z=>{var B=Math.round(D),G=Math.round(O);return z.containerWidth===B&&z.containerHeight===G?z:{containerWidth:B,containerHeight:G}})},[]);b.useEffect(()=>{if(j.current==null||typeof ResizeObserver>"u")return Gj;var D=U=>{var F,W=U[0];if(W!=null){var Q=W.contentRect,K=Q.width,fe=Q.height;P(K,fe),(F=N.current)===null||F===void 0||F.call(N,K,fe)}};p>0&&(D=jwt(D,p,{trailing:!0,leading:!1}));var O=new ResizeObserver(D),z=j.current.getBoundingClientRect(),B=z.width,G=z.height;return P(B,G),O.observe(j.current),()=>{O.disconnect()}},[P,p]);var T=k.containerWidth,M=k.containerHeight;Yie(!n||n>0,"The aspect(%s) must be greater than zero.",n);var R=SAe(T,M,{width:i,height:o,aspect:n,maxHeight:d}),A=R.calculatedWidth,I=R.calculatedHeight;return Yie(T<0||M<0||A!=null&&A>0||I!=null&&I>0,`The width(%s) and height(%s) of chart should be greater than 0, 1269 please check the style of container, or the props width(%s) and height(%s), 1270 or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the 1271 height and width.`,A,I,i,o,c,u,n),b.createElement("div",PD({id:m?"".concat(m):void 0,className:mn("recharts-responsive-container",v),style:Jie(Jie({},w),{},{width:i,height:o,minWidth:c,minHeight:u,maxHeight:d}),ref:j},_),b.createElement("div",{style:Awt({width:i,height:o})},b.createElement(CAe,{width:A,height:I},h)))}),DV=b.forwardRef((t,e)=>{var n=pG();if(Hg(n.width)&&Hg(n.height))return t.children;var r=Ewt({width:t.width,height:t.height,aspect:t.aspect}),s=r.width,i=r.height,o=SAe(void 0,void 0,{width:s,height:i,aspect:t.aspect,maxHeight:t.maxHeight}),l=o.calculatedWidth,c=o.calculatedHeight;return Ct(l)&&Ct(c)?b.createElement(CAe,{width:l,height:c},t.children):b.createElement(Uwt,PD({},t,{width:s,height:i,ref:e}))});function mG(t){if(t)return{x:t.x,y:t.y,upperWidth:"upperWidth"in t?t.upperWidth:t.width,lowerWidth:"lowerWidth"in t?t.lowerWidth:t.width,width:t.width,height:t.height}}var X4=()=>{var t,e=Vl(),n=mt(ywt),r=mt(Y4),s=(t=mt(G4))===null||t===void 0?void 0:t.padding;return!e||!r||!s?n:{width:r.width-s.left-s.right,height:r.height-s.top-s.bottom,x:s.left,y:s.top}},qwt={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},Vwt=()=>{var t;return(t=mt(Xs))!==null&&t!==void 0?t:qwt},kAe=()=>mt(vp),AAe=()=>mt(xp),Hwt=()=>mt(t=>t.layout.margin),Rn=t=>t.layout.layoutType,Yj=()=>mt(Rn),EAe=()=>{var t=Yj();if(t==="horizontal"||t==="vertical")return t},gG=t=>{var e=t.layout.layoutType;if(e==="centric"||e==="radial")return e},Wwt=()=>mt(gG),Kwt=()=>{var t=Yj();return t!==void 0},W2=t=>{var e=Wn(),n=Vl(),r=t.width,s=t.height,i=pG(),o=r,l=s;return i&&(o=i.width>0?i.width:r,l=i.height>0?i.height:s),b.useEffect(()=>{!n&&Hg(o)&&Hg(l)&&e(Hbt({width:o,height:l}))},[e,n,o,l]),null},TAe=Symbol.for("immer-nothing"),Zie=Symbol.for("immer-draftable"),Bl=Symbol.for("immer-state");function _u(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var Xk=Object.getPrototypeOf;function uj(t){return!!t&&!!t[Bl]}function w0(t){var e;return t?PAe(t)||Array.isArray(t)||!!t[Zie]||!!((e=t.constructor)!=null&&e[Zie])||K2(t)||Q4(t):!1}var Gwt=Object.prototype.constructor.toString(),eae=new WeakMap;function PAe(t){if(!t||typeof t!="object")return!1;const e=Object.getPrototypeOf(t);if(e===null||e===Object.prototype)return!0;const n=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;if(n===Object)return!0;
1271if(typeof n!="function")return!1;let r=eae.get(n);return r===void 0&&(r=Function.toString.call(n),eae.set(n,r)),r===Gwt}function MD(t,e,n=!0){J4(t)===0?(n?Reflect.ownKeys(t):Object.keys(t)).forEach(s=>{e(s,t[s],t)}):t.forEach((r,s)=>e(s,r,t))}function J4(t){const e=t[Bl];return e?e.type_:Array.isArray(t)?1:K2(t)?2:Q4(t)?3:0}function LV(t,e){return J4(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function MAe(t,e,n){const r=J4(t);r===2?t.set(e,n):r===3?t.add(n):t[e]=n}function Ywt(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}function K2(t){return t instanceof Map}function Q4(t){return t instanceof Set}function zv(t){return t.copy_||t.base_}function FV(t,e){if(K2(t))return new Map(t);if(Q4(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const n=PAe(t);if(e===!0||e==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(t);delete r[Bl];let s=Reflect.ownKeys(r);for(let i=0;i<s.length;i++){const o=s[i],l=r[o];l.writable===!1&&(l.writable=!0,l.configurable=!0),(l.get||l.set)&&(r[o]={configurable:!0,writable:!0,enumerable:l.enumerable,value:t[o]})}return Object.create(Xk(t),r)}else{const r=Xk(t);if(r!==null&&n)return{...t};const s=Object.create(r);return Object.assign(s,t)}}function vG(t,e=!1){return Z4(t)||uj(t)||!w0(t)||(J4(t)>1&&Object.defineProperties(t,{set:eM,add:eM,clear:eM,delete:eM}),Object.freeze(t),e&&Object.values(t).forEach(n=>vG(n,!0))),t}function Xwt(){_u(2)}var eM={value:Xwt};function Z4(t){return t===null||typeof t!="object"?!0:Object.isFrozen(t)}var Jwt={};function _0(t){const e=Jwt[t];return e||_u(0,t),e}var Jk;function RAe(){return Jk}function Qwt(t,e){return{drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function tae(t,e){e&&(_0("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function $V(t){zV(t),t.drafts_.forEach(Zwt),t.drafts_=null}function zV(t){t===Jk&&(Jk=t.parent_)}function nae(t){return Jk=Qwt(Jk,t)}function Zwt(t){const e=t[Bl];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function rae(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];return t!==void 0&&t!==n?(n[Bl].modified_&&($V(e),_u(4)),w0(t)&&(t=RD(e,t),e.parent_||OD(e,t)),e.patches_&&_0("Patches").generateReplacementPatches_(n[Bl].base_,t,e.patches_,e.inversePatches_)):t=RD(e,n,[]),$V(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==TAe?t:void 0}function RD(t,e,n){if(Z4(e))return e;const r=t.immer_.shouldUseStrictIteration(),s=e[Bl];if(!s)return MD(e,(i,o)=>sae(t,s,e,i,o,n),r),e;if(s.scope_!==t)return e;if(!s.modified_)return OD(t,s.base_,!0),s.base_;if(!s.finalized_){s.finalized_=!0,s.scope_.unfinalizedDrafts_--;const i=s.copy_;let o=i,l=!1;s.type_===3&&(o=new Set(i),i.clear(),l=!0),MD(o,(c,u)=>sae(t,s,i,c,u,n,l),r),OD(t,i,!1),n&&t.patches_&&_0("Patches").generatePatches_(s,n,t.patches_,t.inversePatches_)}return s.copy_}function sae(t,e,n,r,s,i,o){if(s==null||typeof s!="object"&&!o)return;const l=Z4(s);if(!(l&&!o)){if(uj(s)){const c=i&&e&&e.type_!==3&&!LV(e.assigned_,r)?i.concat(r):void 0,u=RD(t,s,c);if(MAe(n,r,u),uj(u))t.canAutoFreeze_=!1;else return}else o&&n.add(s);if(w0(s)&&!l){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1||e&&e.base_&&e.base_[r]===s&&l)return;RD(t,s),(!e||!e.scope_.parent_)&&typeof r!="symbol"&&(K2(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&OD(t,s)}}}function OD(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&vG(e,n)}function e1t(t,e){const n=Array.isArray(t),r={type_:n?1:0,scope_:e?e.scope_:RAe(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let s=r,i=xG;n&&(s=[r],i=Qk);const{revoke:o,proxy:l}=Proxy.revocable(s,i);return r.draft_=l,r.revoke_=o,l}var xG={get(t,e){if(e===Bl)return t;const n=zv(t);if(!LV(n,e))return t1t(t,n,e);const r=n[e];return t.finalized_||!w0(r)?r:r===Uz(t.base_,e)?(qz(t),t.copy_[e]=UV(r,t)):r},has(t,e){return e in zv(t)},ownKeys(t){return Reflect.ownKeys(zv(t))},set(t,e,n){const r=OAe(zv(t),e);if(r!=null&&r.set)return r.set.call(t.draft_,n),!0;if(!t.modified_){const s=Uz(zv(t),e),i=s==null?void 0:s[Bl];if(i&&i.base_===n)return t.copy_[e]=n,t.assigned_[e]=!1,!0;if(Ywt(n,s)&&(n!==void 0||LV(t.base_,e)))return!0;qz(t),BV(t)}return t.copy_[e]===n&&(n!==void 0||e in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=n,t.assigned_[e]=!0),!0},deleteProperty(t,e){return Uz(t.base_,e)!==void 0||e in t.base_?(t.assigned_[e]=!1,qz(t),BV(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=zv(t),r=Reflect.getOwnPropertyDescriptor(n,e);return r&&{writable:!0,configurable:t.type_!==1||e!=="length",enumerable:r.enumerable,value:n[e]}},defineProperty(){_u(11)},getPrototypeOf(t){return Xk(t.base_)},setPrototypeOf(){_u(12)}},Qk={};MD(xG,(t,e)=>{Qk[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}});Qk.deleteProperty=function(t,e){return Qk.set.call(this,t,e,void 0)};Qk.set=function(t,e,n){return xG.set.call(this,t[0],e,n,t[0])};function Uz(t,e){const n=t[Bl];return(n?zv(n):t)[e]}function t1t(t,e,n){var s;const r=OAe(e,n);return r?"value"in r?r.value:(s=r.get)==null?void 0:s.call(t.draft_):void 0}function OAe(t,e){if(!(e in t))return;let n=Xk(t);for(;n;){const r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=Xk(n)}}function BV(t){t.modified_||(t.modified_=!0,t.parent_&&BV(t.parent_))}function qz(t){t.copy_||(t.copy_=FV(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var n1t=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(e,n,r)=>{if(typeof e=="function"&&typeof n!="function"){const i=n;n=e;const o=this;return function(c=i,...u){return o.produce(c,d=>n.call(this,d,...u))}}typeof n!="function"&&_u(6),r!==void 0&&typeof r!="function"&&_u(7);let s;if(w0(e)){const i=nae(this),o=UV(e,void 0);let l=!0;try{s=n(o),l=!1}finally{l?$V(i):zV(i)}return tae(i,r),rae(s,i)}else if(!e||typeof e!="object"){if(s=n(e),s===void 0&&(s=e),s===TAe&&(s=void 0),this.autoFreeze_&&vG(s,!0),r){const i=[],o=[];_0("Patches").generateReplacementPatches_(e,s,i,o),r(i,o)}return s}else _u(1,e)},this.produceWithPatches=(e,n)=>{if(typeof e=="function")return(o,...l)=>this.produceWithPatches(o,c=>e(c,...l));let r,s;return[this.produce(e,n,(o,l)=>{r=o,s=l}),r,s]},typeof(t==null?void 0:t.autoFreeze)=="boolean"&&this.setAutoFreeze(t.autoFreeze),typeof(t==null?void 0:t.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),typeof(t==null?void 0:t.useStrictIteration)=="boolean"&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){w0(t)||_u(8),uj(t)&&(t=r1t(t));const e=nae(this),n=UV(t,void 0);return n[Bl].isManual_=!0,zV(e),n}finishDraft(t,e){const n=t&&t[Bl];(!n||!n.isManual_)&&_u(9);const{scope_:r}=n;return tae(r,e),rae(void 0,r)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,e){let n;for(n=e.length-1;n>=0;n--){const s=e[n];
1271if(s.path.length===0&&s.op==="replace"){t=s.value;break}}n>-1&&(e=e.slice(n+1));const r=_0("Patches").applyPatches_;return uj(t)?r(t,e):this.produce(t,s=>r(s,e))}};function UV(t,e){const n=K2(t)?_0("MapSet").proxyMap_(t,e):Q4(t)?_0("MapSet").proxySet_(t,e):e1t(t,e);return(e?e.scope_:RAe()).drafts_.push(n),n}function r1t(t){return uj(t)||_u(10,t),IAe(t)}function IAe(t){if(!w0(t)||Z4(t))return t;const e=t[Bl];let n,r=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=FV(t,e.scope_.immer_.useStrictShallowCopy_),r=e.scope_.immer_.shouldUseStrictIteration()}else n=FV(t,!0);return MD(n,(s,i)=>{MAe(n,s,IAe(i))},r),e&&(e.finalized_=!1),n}var s1t=new n1t;s1t.produce;var i1t={settings:{layout:"horizontal",align:"center",verticalAlign:"bottom",itemSorter:"value"},size:{width:0,height:0},payload:[]},DAe=Ba({name:"legend",initialState:i1t,reducers:{setLegendSize(t,e){t.size.width=e.payload.width,t.size.height=e.payload.height},setLegendSettings(t,e){t.settings.align=e.payload.align,t.settings.layout=e.payload.layout,t.settings.verticalAlign=e.payload.verticalAlign,t.settings.itemSorter=e.payload.itemSorter},addLegendPayload:{reducer(t,e){t.payload.push(e.payload)},prepare:xr()},replaceLegendPayload:{reducer(t,e){var n=e.payload,r=n.prev,s=n.next,i=Sc(t).payload.indexOf(r);i>-1&&(t.payload[i]=s)},prepare:xr()},removeLegendPayload:{reducer(t,e){var n=Sc(t).payload.indexOf(e.payload);n>-1&&t.payload.splice(n,1)},prepare:xr()}}}),G2=DAe.actions,iae=G2.setLegendSize,a1t=G2.setLegendSettings,LAe=G2.addLegendPayload,FAe=G2.replaceLegendPayload,$Ae=G2.removeLegendPayload,o1t=DAe.reducer,l1t={};
1271/** 1272 * @license React 1273 * use-sync-external-store-with-selector.production.js 1274 * 1275 * Copyright (c) Meta Platforms, Inc. and affiliates. 1276 * 1277 * This source code is licensed under the MIT license found in the 1278 * LICENSE file in the root directory of this source tree. 1279 */var Y2=b;function c1t(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var u1t=typeof Object.is=="function"?Object.is:c1t,d1t=Y2.useSyncExternalStore,h1t=Y2.useRef,f1t=Y2.useEffect,p1t=Y2.useMemo,m1t=Y2.useDebugValue;l1t.useSyncExternalStoreWithSelector=function(t,e,n,r,s){var i=h1t(null);if(i.current===null){var o={hasValue:!1,value:null};i.current=o}else o=i.current;i=p1t(function(){function c(p){if(!u){if(u=!0,d=p,p=r(p),s!==void 0&&o.hasValue){var m=o.value;if(s(m,p))return h=m}return h=p}if(m=h,u1t(d,p))return m;var v=r(p);return s!==void 0&&s(m,v)?(d=p,m):(d=p,h=v)}var u=!1,d,h,f=n===void 0?null:n;return[function(){return c(e())},f===null?void 0:function(){return c(f())}]},[e,n,r,s]);var l=d1t(t,i[0],i[1]);return f1t(function(){o.hasValue=!0,o.value=l},[l]),m1t(l),l};function g1t(t){t()}function v1t(){let t=null,e=null;return{clear(){t=null,e=null},notify(){g1t(()=>{let n=t;for(;n;)n.callback(),n=n.next})},get(){const n=[];let r=t;for(;r;)n.push(r),r=r.next;return n},subscribe(n){let r=!0;const s=e={callback:n,next:null,prev:e};return s.prev?s.prev.next=s:t=s,function(){!r||t===null||(r=!1,s.next?s.next.prev=s.prev:e=s.prev,s.prev?s.prev.next=s.next:t=s.next)}}}}var aae={notify(){},get:()=>[]};function x1t(t,e){let n,r=aae,s=0,i=!1;function o(v){d();const x=r.subscribe(v);let g=!1;return()=>{g||(g=!0,x(),h())}}function l(){r.notify()}function c(){m.onStateChange&&m.onStateChange()}function u(){return i}function d(){s++,n||(n=t.subscribe(c),r=v1t())}function h(){s--,n&&s===0&&(n(),n=void 0,r.clear(),r=aae)}function f(){i||(i=!0,d())}function p(){i&&(i=!1,h())}const m={addNestedSub:o,notifyNestedSubs:l,handleChangeWrapper:c,isSubscribed:u,trySubscribe:f,tryUnsubscribe:p,getListeners:()=>r};return m}var y1t=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",b1t=y1t(),w1t=()=>typeof navigator<"u"&&navigator.product==="ReactNative",_1t=w1t(),j1t=()=>b1t||_1t?b.useLayoutEffect:b.useEffect,S1t=j1t();function oae(t,e){return t===e?t!==0||e!==0||1/t===1/e:t!==t&&e!==e}function N1t(t,e){if(oae(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(let s=0;s<n.length;s++)if(!Object.prototype.hasOwnProperty.call(e,n[s])||!oae(t[n[s]],e[n[s]]))return!1;return!0}var Vz=Symbol.for("react-redux-context"),Hz=typeof globalThis<"u"?globalThis:{};function C1t(){if(!b.createContext)return{};const t=Hz[Vz]??(Hz[Vz]=new Map);let e=t.get(b.createContext);return e||(e=b.createContext(null),t.set(b.createContext,e)),e}var k1t=C1t();function A1t(t){const{children:e,context:n,serverState:r,store:s}=t,i=b.useMemo(()=>{const c=x1t(s);return{store:s,subscription:c,getServerState:r?()=>r:void 0}},[s,r]),o=b.useMemo(()=>s.getState(),[s]);S1t(()=>{const{subscription:c}=i;return c.onStateChange=c.notifyNestedSubs,c.trySubscribe(),o!==s.getState()&&c.notifyNestedSubs(),()=>{c.tryUnsubscribe(),c.onStateChange=void 0}},[i,o]);const l=n||k1t;return b.createElement(l.Provider,{value:i},e)}var E1t=A1t,T1t=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius","throttledEvents"]);function P1t(t,e){return t==null&&e==null?!0:typeof t=="number"&&typeof e=="number"?t===e||t!==t&&e!==e:t===e}function X2(t,e){var n=new Set([...Object.keys(t),...Object.keys(e)]);for(var r of n)if(T1t.has(r)){if(t[r]==null&&e[r]==null)continue;if(!N1t(t[r],e[r]))return!1}else if(!P1t(t[r],e[r]))return!1;return!0}var M1t=["contextPayload"];function qV(){return qV=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},qV.apply(null,arguments)}function R1t(t,e){return L1t(t)||D1t(t,e)||I1t(t,e)||O1t()}
1279function O1t(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 1280In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function I1t(t,e){if(t){if(typeof t=="string")return lae(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?lae(t,e):void 0}}function lae(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function D1t(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,u=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function L1t(t){if(Array.isArray(t))return t}function cae(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function dj(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?cae(Object(n),!0).forEach(function(r){F1t(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):cae(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function F1t(t,e,n){return(e=$1t(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function $1t(t){var e=z1t(t,"string");return typeof e=="symbol"?e:e+""}function z1t(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function B1t(t,e){if(t==null)return{};var n,r,s=U1t(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function U1t(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function q1t(t){return t.value}function V1t(t){var e=t.contextPayload,n=B1t(t,M1t),r=$ke(e,t.payloadUniqBy,q1t),s=dj(dj({},n),{},{payload:r});return b.isValidElement(t.content)?b.cloneElement(t.content,s):typeof t.content=="function"?b.createElement(t.content,s):b.createElement(Myt,s)}function H1t(t,e,n,r,s,i){var o=e.layout,l=e.align,c=e.verticalAlign,u,d;return(!t||(t.left===void 0||t.left===null)&&(t.right===void 0||t.right===null))&&(l==="center"&&o==="vertical"?u={left:((r||0)-i.width)/2}:u=l==="right"?{right:n&&n.right||0}:{left:n&&n.left||0}),(!t||(t.top===void 0||t.top===null)&&(t.bottom===void 0||t.bottom===null))&&(c==="middle"?d={top:((s||0)-i.height)/2}:d=c==="bottom"?{bottom:n&&n.bottom||0}:{top:n&&n.top||0}),dj(dj({},u),d)}function W1t(t){var e=t.align,n=t.layout,r=t.verticalAlign,s=t.itemSorter,i=Wn();return b.useLayoutEffect(()=>{i(a1t({align:e,layout:n,verticalAlign:r,itemSorter:s}))},[i,e,n,r,s]),null}function K1t(t){var e=t.width,n=t.height,r=Wn();return b.useLayoutEffect(()=>{r(iae({width:e,height:n}))},[r,e,n]),b.useLayoutEffect(()=>()=>{r(iae({width:0,height:0}))},[r]),null}function G1t(t,e,n,r){return t==="vertical"&&e!=null?{height:e}:t==="horizontal"?{width:n||r}:null}var Y1t={align:"center",iconSize:14,inactiveColor:"#ccc",itemSorter:"value",labelStyle:{},layout:"horizontal",verticalAlign:"bottom"};function X1t(t){var e=za(t,Y1t),n=B0t(),r=Nxt(),s=Hwt(),i=e.width,o=e.height,l=e.wrapperStyle,c=e.portal,u=Vke([n]),d=R1t(u,2),h=d[0],f=d[1],p=kAe(),m=AAe();if(p==null||m==null)return null;var v=p-((s==null?void 0:s.left)||0)-((s==null?void 0:s.right)||0),x=G1t(e.layout,o,i,v),g=c?l:dj(dj({position:"absolute",width:(x==null?void 0:x.width)||i||"auto",height:(x==null?void 0:x.height)||o||"auto"},H1t(l,e,s,p,m,h)),l),w=c??r;if(w==null||n==null)return null;var _=b.createElement("div",{className:"recharts-legend-wrapper",style:g,ref:f},b.createElement(W1t,{layout:e.layout,align:e.align,verticalAlign:e.verticalAlign,itemSorter:e.itemSorter}),!c&&b.createElement(K1t,{width:h.width,height:h.height}),b.createElement(V1t,qV({}
1280,e,x,{margin:s,chartWidth:p,chartHeight:m,contextPayload:n})));return Lc.createPortal(_,w)}var yG=b.memo(X1t,X2);yG.displayName="Legend";function VV(){return VV=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},VV.apply(null,arguments)}function uae(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function FS(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?uae(Object(n),!0).forEach(function(r){J1t(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):uae(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function J1t(t,e,n){return(e=Q1t(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Q1t(t){var e=Z1t(t,"string");return typeof e=="symbol"?e:e+""}function Z1t(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function e_t(t,e){return s_t(t)||r_t(t,e)||n_t(t,e)||t_t()}function t_t(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 1281In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function n_t(t,e){if(t){if(typeof t=="string")return dae(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?dae(t,e):void 0}}function dae(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function r_t(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,u=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function s_t(t){if(Array.isArray(t))return t}function i_t(t){return Array.isArray(t)&&mh(t[0])&&mh(t[1])?t.join(" ~ "):t}var pb={separator:" : ",contentStyle:{margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},itemStyle:{display:"block",paddingTop:4,paddingBottom:4,color:"#000"},labelStyle:{},accessibilityLayer:!1};function a_t(t,e){return e==null?t:O4(t,e)}var o_t=t=>{var e=t.separator,n=e===void 0?pb.separator:e,r=t.contentStyle,s=t.itemStyle,i=t.labelStyle,o=i===void 0?pb.labelStyle:i,l=t.payload,c=t.formatter,u=t.itemSorter,d=t.wrapperClassName,h=t.labelClassName,f=t.label,p=t.labelFormatter,m=t.accessibilityLayer,v=m===void 0?pb.accessibilityLayer:m,x=()=>{if(l&&l.length){var k={padding:0,margin:0},E=a_t(l,u),P=E.map((T,M)=>{if(!T||T.type==="none")return null;var R=T.formatter||c||i_t,A=T.value,I=T.name,D=A,O=I;if(R){var z=R(A,I,T,M,l);if(Array.isArray(z)){var B=e_t(z,2);D=B[0],O=B[1]}else if(z!=null)D=z;else return null}var G=FS(FS({},pb.itemStyle),{},{color:T.color||pb.itemStyle.color},s);return b.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(M),style:G},mh(O)?b.createElement("span",{className:"recharts-tooltip-item-name"},O):null,mh(O)?b.createElement("span",{className:"recharts-tooltip-item-separator"},n):null,b.createElement("span",{className:"recharts-tooltip-item-value"},D),b.createElement("span",{className:"recharts-tooltip-item-unit"},T.unit||""))});return b.createElement("ul",{className:"recharts-tooltip-item-list",style:k},P)}return null},g=FS(FS({},pb.contentStyle),r),w=FS({margin:0},o),_=!Ks(f),j=_?f:"",N=mn("recharts-default-tooltip",d),S=mn("recharts-tooltip-label",h);_&&p&&l!==void 0&&l!==null&&(j=p(f,l));var C=v?{role:"status","aria-live":"assertive"}:{};return b.createElement("div",VV({className:N,style:g},C),b.createElement("p",{className:S,style:w},b.isValidElement(j)?j:"".concat(j)),x())},$S="recharts-tooltip-wrapper",l_t={visibility:"hidden"};function c_t(t){var e=t.coordinate,n=t.translateX,r=t.translateY;return mn($S,{["".concat($S,"-right")]:Ct(n)&&e&&Ct(e.x)&&n>=e.x,["".concat($S,"-left")]:Ct(n)&&e&&Ct(e.x)&&n<e.x,["".concat($S,"-bottom")]:Ct(r)&&e&&Ct(e.y)&&r>=e.y,["".concat($S,"-top")]:Ct(r)&&e&&Ct(e.y)&&r<e.y})}function hae(t){var e=t.allowEscapeViewBox,n=t.coordinate,r=t.key,s=t.offset,i=t.position,o=t.reverseDirection,l=t.tooltipDimension,c=t.viewBox,u=t.viewBoxDimension;if(i&&Ct(i[r]))return i[r];var d=n[r]-l-(s>0?s:0),h=n[r]+s;
1281if(e[r])return o[r]?d:h;var f=c[r];if(f==null)return 0;if(o[r]){var p=d,m=f;return p<m?Math.max(h,f):Math.max(d,f)}if(u==null)return 0;var v=h+l,x=f+u;return v>x?Math.max(d,f):Math.max(h,f)}function u_t(t){var e=t.translateX,n=t.translateY,r=t.useTranslate3d;return{transform:r?"translate3d(".concat(e,"px, ").concat(n,"px, 0)"):"translate(".concat(e,"px, ").concat(n,"px)")}}function d_t(t){var e=t.allowEscapeViewBox,n=t.coordinate,r=t.offsetTop,s=t.offsetLeft,i=t.position,o=t.reverseDirection,l=t.tooltipBox,c=t.useTranslate3d,u=t.viewBox,d,h,f;return l.height>0&&l.width>0&&n?(h=hae({allowEscapeViewBox:e,coordinate:n,key:"x",offset:s,position:i,reverseDirection:o,tooltipDimension:l.width,viewBox:u,viewBoxDimension:u.width}),f=hae({allowEscapeViewBox:e,coordinate:n,key:"y",offset:r,position:i,reverseDirection:o,tooltipDimension:l.height,viewBox:u,viewBoxDimension:u.height}),d=u_t({translateX:h,translateY:f,useTranslate3d:c})):d=l_t,{cssProperties:d,cssClasses:c_t({translateX:h,translateY:f,coordinate:n})}}var h_t=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),J2={devToolsEnabled:!0,isSsr:h_t()};function f_t(t,e){return v_t(t)||g_t(t,e)||m_t(t,e)||p_t()}function p_t(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 1282In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function m_t(t,e){if(t){if(typeof t=="string")return fae(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?fae(t,e):void 0}}function fae(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function g_t(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,u=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function v_t(t){if(Array.isArray(t))return t}function zAe(){var t=b.useState(()=>J2.isSsr||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches),e=f_t(t,2),n=e[0],r=e[1];return b.useEffect(()=>{if(window.matchMedia){var s=window.matchMedia("(prefers-reduced-motion: reduce)"),i=()=>{r(s.matches)};return s.addEventListener("change",i),()=>{s.removeEventListener("change",i)}}},[]),n}function pae(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function mb(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?pae(Object(n),!0).forEach(function(r){x_t(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):pae(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function x_t(t,e,n){return(e=y_t(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function y_t(t){var e=b_t(t,"string");return typeof e=="symbol"?e:e+""}function b_t(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function w_t(t,e){return N_t(t)||S_t(t,e)||j_t(t,e)||__t()}function __t(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 1283In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function j_t(t,e){if(t){if(typeof t=="string")return mae(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?mae(t,e):void 0}}function mae(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function S_t(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,u=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}
1283finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function N_t(t){if(Array.isArray(t))return t}function C_t(t){if(!(t.prefersReducedMotion&&t.isAnimationActive==="auto")&&t.isAnimationActive&&t.active){var e=typeof t.animationEasing=="string"?t.animationEasing:"ease";return"transform ".concat(t.animationDuration,"ms ").concat(e)}}function k_t(t){var e,n,r,s,i,o,l=zAe(),c=b.useState(()=>({dismissed:!1,dismissedAtCoordinate:{x:0,y:0}})),u=w_t(c,2),d=u[0],h=u[1];b.useEffect(()=>{var g=w=>{if(w.key==="Escape"){var _,j,N,S;h({dismissed:!0,dismissedAtCoordinate:{x:(_=(j=t.coordinate)===null||j===void 0?void 0:j.x)!==null&&_!==void 0?_:0,y:(N=(S=t.coordinate)===null||S===void 0?void 0:S.y)!==null&&N!==void 0?N:0}})}};return document.addEventListener("keydown",g),()=>{document.removeEventListener("keydown",g)}},[(e=t.coordinate)===null||e===void 0?void 0:e.x,(n=t.coordinate)===null||n===void 0?void 0:n.y]),d.dismissed&&(((r=(s=t.coordinate)===null||s===void 0?void 0:s.x)!==null&&r!==void 0?r:0)!==d.dismissedAtCoordinate.x||((i=(o=t.coordinate)===null||o===void 0?void 0:o.y)!==null&&i!==void 0?i:0)!==d.dismissedAtCoordinate.y)&&h(mb(mb({},d),{},{dismissed:!1}));var f=d_t({allowEscapeViewBox:t.allowEscapeViewBox,coordinate:t.coordinate,offsetLeft:typeof t.offset=="number"?t.offset:t.offset.x,offsetTop:typeof t.offset=="number"?t.offset:t.offset.y,position:t.position,reverseDirection:t.reverseDirection,tooltipBox:{height:t.lastBoundingBox.height,width:t.lastBoundingBox.width},useTranslate3d:t.useTranslate3d,viewBox:t.viewBox}),p=f.cssClasses,m=f.cssProperties,v=t.hasPortalFromProps?{}:mb(mb({transition:C_t({prefersReducedMotion:l,isAnimationActive:t.isAnimationActive,active:t.active,animationDuration:t.animationDuration,animationEasing:t.animationEasing})},m),{},{pointerEvents:"none",position:"absolute",top:0,left:0}),x=mb(mb({},v),{},{visibility:!d.dismissed&&t.active&&t.hasPayload?"visible":"hidden"},t.wrapperStyle);return b.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:p,style:x,ref:t.innerRef},t.children)}var A_t=b.memo(k_t),BAe=()=>{var t;return(t=mt(e=>e.rootProps.accessibilityLayer))!==null&&t!==void 0?t:!0};function HV(){return HV=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},HV.apply(null,arguments)}function gae(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function vae(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?gae(Object(n),!0).forEach(function(r){E_t(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):gae(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function E_t(t,e,n){return(e=T_t(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function T_t(t){var e=P_t(t,"string");return typeof e=="symbol"?e:e+""}function P_t(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var xae={curveBasisClosed:Vxt,curveBasisOpen:Hxt,curveBasis:qxt,curveBumpX:Ext,curveBumpY:Txt,curveLinearClosed:Wxt,curveLinear:M4,curveMonotoneX:Kxt,curveMonotoneY:Gxt,curveNatural:Yxt,curveStep:Xxt,curveStepAfter:Qxt,curveStepBefore:Jxt},ID=t=>An(t.x)&&An(t.y),yae=t=>t.base!=null&&ID(t.base)&&ID(t),zS=t=>t.x,BS=t=>t.y,M_t=(t,e)=>{if(typeof t=="function")return t;var n="curve".concat(B2(t));if((n==="curveMonotone"||n==="curveBump")&&e){var r=xae["".concat(n).concat(e==="vertical"?"Y":"X")];if(r)return r}return xae[n]||M4},bae={connectNulls:!1,type:"linear"},R_t=t=>{var e=t.type,n=e===void 0?bae.type:e,r=t.points,s=r===void 0?[]:r,i=t.baseLine,o=t.layout,l=t.connectNulls,c=l===void 0?bae.connectNulls:l,u=M_t(n,o),d=c?s.filter(ID):s;if(Array.isArray(i)){var h,f=s.map((g,w)=>vae(vae({},g),{},{base:i[w]}));o==="vertical"?h=KP().y(BS).x1(zS).x0(g=>g.base.x):h=KP().x(zS).y1(BS).y0(g=>g.base.y);var p=h.defined(yae).curve(u),m=c?f.filter(yae):f;return p(m)}var v;o==="vertical"&&Ct(i)?v=KP().y(BS).x1(zS).x0(i):Ct(i)?v=KP().x(zS).y1(BS).y0(i):v=uke().x(zS).y(BS);var x=v.defined(ID).curve(u);return x(d)},UAe=t=>{var e=t.className,n=t.points,r=t.path,s=t.pathRef,i=Yj();if((!n||!n.length)&&!r)return null;var o={type:t.type,points:t.points,baseLine:t.baseLine,layout:t.layout||i,connectNulls:t.connectNulls},l=n&&n.length?R_t(o):r;return b.createElement("path",HV({},dh(t),yyt(t),{className:mn("recharts-curve",e),d:l===null?void 0:l,ref:s}))},O_t=["x","y","top","left","width","height","className"];function WV(){return WV=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},WV.apply(null,arguments)}function wae(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function I_t(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};
1283e%2?wae(Object(n),!0).forEach(function(r){D_t(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):wae(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function D_t(t,e,n){return(e=L_t(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function L_t(t){var e=F_t(t,"string");return typeof e=="symbol"?e:e+""}function F_t(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function $_t(t,e){if(t==null)return{};var n,r,s=z_t(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function z_t(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var B_t=(t,e,n,r,s,i)=>"M".concat(t,",").concat(s,"v").concat(r,"M").concat(i,",").concat(e,"h").concat(n),U_t=t=>{var e=t.x,n=e===void 0?0:e,r=t.y,s=r===void 0?0:r,i=t.top,o=i===void 0?0:i,l=t.left,c=l===void 0?0:l,u=t.width,d=u===void 0?0:u,h=t.height,f=h===void 0?0:h,p=t.className,m=$_t(t,O_t),v=I_t({x:n,y:s,top:o,left:c,width:d,height:f},m);return!Ct(n)||!Ct(s)||!Ct(d)||!Ct(f)||!Ct(o)||!Ct(c)?null:b.createElement("path",WV({},hh(v),{className:mn("recharts-cross",p),d:B_t(n,s,d,f,o,c)}))};function q_t(t,e,n,r){var s=r/2;return{stroke:"none",fill:"#ccc",x:t==="horizontal"?e.x-s:n.left+.5,y:t==="horizontal"?n.top+.5:e.y-s,width:t==="horizontal"?r:n.width-1,height:t==="horizontal"?n.height-1:r}}var DD=1e-4,qAe=(t,e)=>[0,3*t,3*e-6*t,3*t-3*e+1],VAe=(t,e)=>t.map((n,r)=>n*e**r).reduce((n,r)=>n+r),_ae=(t,e)=>n=>{var r=qAe(t,e);return VAe(r,n)},V_t=(t,e)=>n=>{var r=qAe(t,e),s=[...r.map((i,o)=>i*o).slice(1),0];return VAe(s,n)},H_t=t=>{var e,n=t.split("(");if(n.length!==2||n[0]!=="cubic-bezier")return null;var r=(e=n[1])===null||e===void 0||(e=e.split(")")[0])===null||e===void 0?void 0:e.split(",");if(r==null||r.length!==4)return null;var s=r.map(i=>parseFloat(i));return[s[0],s[1],s[2],s[3]]},W_t=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];if(n.length===1)switch(n[0]){case"linear":return[0,0,1,1];case"ease":return[.25,.1,.25,1];case"ease-in":return[.42,0,1,1];case"ease-out":return[.42,0,.58,1];case"ease-in-out":return[0,0,.58,1];default:{var s=H_t(n[0]);if(s)return s}}return n.length===4?n:[0,0,1,1]},K_t=(t,e,n,r)=>{var s=_ae(t,n),i=_ae(e,r),o=V_t(t,n),l=u=>u>1?1:u<0?0:u,c=u=>{for(var d=u>1?1:u,h=d,f=0;f<8;++f){var p=s(h)-d,m=o(h);if(Math.abs(p-d)<DD||m<DD)return i(h);h=l(h-p/m)}return i(h)};return c.isStepper=!1,c},jae=function(){return K_t(...W_t(...arguments))},G_t=function(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.stiff,r=n===void 0?100:n,s=e.damping,i=s===void 0?8:s,o=e.dt,l=o===void 0?16.67:o,c=1,u=[0],d=0,h=0,f=1e4,p=0;p<f;){var m=-(d-c)*r,v=h*i;if(h+=(m-v)*l/1e3,d+=h*l/1e3,u.push(d),Math.abs(d-c)<DD&&Math.abs(h)<DD)break;p++}u[u.length-1]=c;var x=u.length-1;return g=>{var w,_,j;if(g<=0)return 0;if(g>=1)return c;var N=g*x,S=Math.floor(N),C=N-S;return((w=u[S])!==null&&w!==void 0?w:0)+(((_=u[S+1])!==null&&_!==void 0?_:0)-((j=u[S])!==null&&j!==void 0?j:0))*C}},Y_t=t=>{if(typeof t=="string")switch(t){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return jae(t);case"spring":return G_t();default:if(t.split("(")[0]==="cubic-bezier")return jae(t)}return typeof t=="function"?t:null},X_t=(t,e,n)=>{var r,s=i=>{var o=e.tick(i);if(e.getState()==="active"){if(n(e.getInterpolated()),e.getProgress()===1){e.complete(),r=void 0;return}r=t.setTimeout(s,o);return}r=t.setTimeout(s,o)};return r=t.setTimeout(s,0),()=>{var i;return(i=r)===null||i===void 0?void 0:i()}},HAe=b.createContext(X_t);HAe.Provider;function J_t(t){var e=b.useContext(HAe);return b.useMemo(()=>t??e,[t,e])}function Q_t(t,e,n){return(e=Z_t(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Z_t(t){var e=ejt(t,"string");return typeof e=="symbol"?e:e+""}function ejt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Sae="init",Nae="pending",Cae="active",tjt="completed";function Wz(t){return Math.max(0,t)}class njt{getAnimationStartedTime(){return this.animationStartedTime}getBeginStartedTime(){return this.beginStartedTime}constructor(e){var n;Q_t(this,"state",Sae),this.animationId=e.animationId,this.onAnimationEnd=e.onAnimationEnd,this.animationDuration=Wz(e.animationDuration),this.animationBegin=Wz(e.animationBegin),this.progress=0,this.from=e.from,this.to=e.to,this.easing=e.easing,(n=e.onAnimationStart)===null||n===void 0||n.call(e)}getState(){return this.state}getEasing(){return this.easing}getAnimationDuration(){return this.animationDuration}tick(e){if(this.getState()===Sae)return this.state=Nae,this.beginStartedTime=e,this.animationBegin;if(this.getState()===Nae){if(this.beginStartedTime==null)throw new Error;var n=e-this.beginStartedTime;return n>=this.animationBegin?(this.state=Cae,this.animationStartedTime=e,this.nextAnimationUpdate(0)):Wz(this.animationBegin-n)}if(this.getState()===Cae){if(this.animationStartedTime==null)throw new Error;var r=e-this.animationStartedTime;return this.setProgress(r/this.animationDuration),this.nextAnimationUpdate(r)}return 0}setProgress(e){this.progress=Math.min(1,Math.max(0,e))}getProgress(){return this.progress}complete(){if(this.progress=1,this.state==="active"){var e;(e=this.onAnimationEnd)===null||e===void 0||e.call(this)}this.state=tjt}getFrom(){return this.from}getTo(){return this.to}getAnimationId(){return this.animationId}getAnimationBegin(){return this.animationBegin}}class rjt extends njt{nextAnimationUpdate(){return 0}getInterpolated(){return this.easing(ui(this.getFrom(),this.getTo(),this.getProgress()))}}class sjt{setTimeout(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=performance.now(),s=null,i=o=>{o-r>=n?e(o):s=requestAnimationFrame(i)};return s=requestAnimationFrame(i),()=>{s!=null&&cancelAnimationFrame(s)}}}function ijt(t,e){return cjt(t)||ljt(t,e)||ojt(t,e)||ajt()}
1283function ajt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 1284In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ojt(t,e){if(t){if(typeof t=="string")return kae(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?kae(t,e):void 0}}function kae(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function ljt(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,u=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function cjt(t){if(Array.isArray(t))return t}var ujt={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},Aae=0,Kz=1;function WAe(t){var e=za(t,ujt),n=e.animationId,r=e.isActive,s=e.canBegin,i=e.duration,o=e.easing,l=e.begin,c=e.onAnimationEnd,u=e.onAnimationStart,d=e.children,h=zAe(),f=r==="auto"?!J2.isSsr&&!h:r,p=J_t(e.animationController),m=b.useState(f?Aae:Kz),v=ijt(m,2),x=v[0],g=v[1];return b.useEffect(()=>{f||g(Kz)},[f]),b.useEffect(()=>{var w=Y_t(o);if(!f||!s||w==null)return Gj;var _=new sjt,j=new rjt({animationId:n,easing:w,animationDuration:i,animationBegin:l,onAnimationStart:u,onAnimationEnd:c,from:Aae,to:Kz});return p(_,j,g)},[p,n,f,s,i,o,l,u,c]),d(Number(x))}function KAe(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"animation-",n=b.useRef(Wk(e)),r=b.useRef(t);return r.current!==t&&(n.current=Wk(e),r.current=t),n.current}var djt=t=>t.replace(/([A-Z])/g,e=>"-".concat(e.toLowerCase())),hjt=(t,e,n)=>t.map(r=>"".concat(djt(r)," ").concat(e,"ms ").concat(n)).join(","),fjt=["radius"],pjt=["radius"],Eae,Tae,Pae,Mae,Rae,Oae,Iae,Dae,Lae,Fae;function $ae(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function zae(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?$ae(Object(n),!0).forEach(function(r){mjt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):$ae(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function mjt(t,e,n){return(e=gjt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function gjt(t){var e=vjt(t,"string");return typeof e=="symbol"?e:e+""}function vjt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function LD(){return LD=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},LD.apply(null,arguments)}function Bae(t,e){if(t==null)return{};var n,r,s=xjt(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function xjt(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function yjt(t,e){return jjt(t)||_jt(t,e)||wjt(t,e)||bjt()}function bjt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 1285In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function wjt(t,e){if(t){if(typeof t=="string")return Uae(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Uae(t,e):void 0}}function Uae(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function _jt(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,u=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}
1285finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function jjt(t){if(Array.isArray(t))return t}function ed(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}var qae=(t,e,n,r,s)=>{var i=fg(n),o=fg(r),l=Math.min(Math.abs(i)/2,Math.abs(o)/2),c=o>=0?1:-1,u=i>=0?1:-1,d=o>=0&&i>=0||o<0&&i<0?1:0,h;if(l>0&&Array.isArray(s)){for(var f=[0,0,0,0],p=0,m=4;p<m;p++){var v,x=(v=s[p])!==null&&v!==void 0?v:0;f[p]=x>l?l:x}h=Oi(Eae||(Eae=ed(["M",",",""])),t,e+c*f[0]),f[0]>0&&(h+=Oi(Tae||(Tae=ed(["A ",",",",0,0,",",",",",""])),f[0],f[0],d,t+u*f[0],e)),h+=Oi(Pae||(Pae=ed(["L ",",",""])),t+n-u*f[1],e),f[1]>0&&(h+=Oi(Mae||(Mae=ed(["A ",",",",0,0,",`, 1286 `,",",""])),f[1],f[1],d,t+n,e+c*f[1])),h+=Oi(Rae||(Rae=ed(["L ",",",""])),t+n,e+r-c*f[2]),f[2]>0&&(h+=Oi(Oae||(Oae=ed(["A ",",",",0,0,",`, 1287 `,",",""])),f[2],f[2],d,t+n-u*f[2],e+r)),h+=Oi(Iae||(Iae=ed(["L ",",",""])),t+u*f[3],e+r),f[3]>0&&(h+=Oi(Dae||(Dae=ed(["A ",",",",0,0,",`, 1288 `,",",""])),f[3],f[3],d,t,e+r-c*f[3])),h+="Z"}else if(l>0&&s===+s&&s>0){var g=Math.min(l,s);h=Oi(Lae||(Lae=ed(["M ",",",` 1289 A `,",",",0,0,",",",",",` 1290 L `,",",` 1291 A `,",",",0,0,",",",",",` 1292 L `,",",` 1293 A `,",",",0,0,",",",",",` 1294 L `,",",` 1295 A `,",",",0,0,",",",","," Z"])),t,e+c*g,g,g,d,t+u*g,e,t+n-u*g,e,g,g,d,t+n,e+c*g,t+n,e+r-c*g,g,g,d,t+n-u*g,e+r,t+u*g,e+r,g,g,d,t,e+r-c*g)}else h=Oi(Fae||(Fae=ed(["M ",","," h "," v "," h "," Z"])),t,e,n,r,-n);return h},Vae={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},GAe=t=>{var e=za(t,Vae),n=b.useRef(null),r=b.useState(-1),s=yjt(r,2),i=s[0],o=s[1];b.useEffect(()=>{if(n.current&&n.current.getTotalLength)try{var z=n.current.getTotalLength();z&&o(z)}catch{}},[]);var l=e.x,c=e.y,u=e.width,d=e.height,h=e.radius,f=e.className,p=e.animationEasing,m=e.animationDuration,v=e.animationBegin,x=e.isAnimationActive,g=e.isUpdateAnimationActive,w=b.useRef(u),_=b.useRef(d),j=b.useRef(l),N=b.useRef(c),S=b.useMemo(()=>({x:l,y:c,width:u,height:d,radius:h}),[l,c,u,d,h]),C=KAe(S,"rectangle-");if(l!==+l||c!==+c||u!==+u||d!==+d||u===0||d===0)return null;var k=mn("recharts-rectangle",f);if(!g){var E=hh(e);E.radius;var P=Bae(E,fjt);return b.createElement("path",LD({},P,{x:fg(l),y:fg(c),width:fg(u),height:fg(d),radius:typeof h=="number"?h:void 0,className:k,d:qae(l,c,u,d,h)}))}var T=w.current,M=_.current,R=j.current,A=N.current,I="0px ".concat(i===-1?1:i,"px"),D="".concat(i,"px ").concat(i,"px"),O=hjt(["strokeDasharray"],m,typeof p=="string"?p:Vae.animationEasing);return b.createElement(WAe,{animationId:C,key:C,canBegin:i>0,duration:m,easing:p,isActive:g,begin:v},z=>{var B=ui(T,u,z),G=ui(M,d,z),U=ui(R,l,z),F=ui(A,c,z);n.current&&(w.current=B,_.current=G,j.current=U,N.current=F);var W;x?z>0?W={transition:O,strokeDasharray:D}:W={strokeDasharray:I}:W={strokeDasharray:D};var Q=hh(e);Q.radius;var K=Bae(Q,pjt);return b.createElement("path",LD({},K,{radius:typeof h=="number"?h:void 0,className:k,d:qae(U,F,B,G,h),ref:n,style:zae(zae({},W),e.style)}))})};function Hae(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Wae(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Hae(Object(n),!0).forEach(function(r){Sjt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Hae(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Sjt(t,e,n){return(e=Njt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Njt(t){var e=Cjt(t,"string");return typeof e=="symbol"?e:e+""}function Cjt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var FD=Math.PI/180,kjt=t=>t*180/Math.PI,Cs=(t,e,n,r)=>({x:t+Math.cos(-FD*r)*n,y:e+Math.sin(-FD*r)*n}),YAe=function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0,width:0,height:0,brushBottom:0};return Math.min(Math.abs(e-(r.left||0)-(r.right||0)),Math.abs(n-(r.top||0)-(r.bottom||0)))/2},Ajt=(t,e)=>{var n=t.x,r=t.y,s=e.x,i=e.y;return Math.sqrt((n-s)**2+(r-i)**2)},Ejt=(t,e)=>{var n=t.x,r=t.y,s=e.cx,i=e.cy,o=Ajt({x:n,y:r},{x:s,y:i});if(o<=0)return{radius:o,angle:0};var l=(n-s)/o,c=Math.acos(l);return r>i&&(c=2*Math.PI-c),{radius:o,angle:kjt(c),angleInRadian:c}},Tjt=t=>{var e=t.startAngle,n=t.endAngle,r=Math.floor(e/360),s=Math.floor(n/360),i=Math.min(r,s);return{startAngle:e-i*360,endAngle:n-i*360}},Pjt=(t,e)=>{var n=e.startAngle,r=e.endAngle,s=Math.floor(n/360),i=Math.floor(r/360),o=Math.min(s,i);return t+o*360},Mjt=(t,e)=>{var n=t.relativeX,r=t.relativeY,s=Ejt({x:n,y:r},e),i=s.radius,o=s.angle,l=e.innerRadius,c=e.outerRadius;if(i<l||i>c||i===0)return null;
1295var u=Tjt(e),d=u.startAngle,h=u.endAngle,f=o,p;if(d<=h){for(;f>h;)f-=360;for(;f<d;)f+=360;p=f>=d&&f<=h}else{for(;f>d;)f-=360;for(;f<h;)f+=360;p=f>=h&&f<=d}return p?Wae(Wae({},e),{},{radius:i,angle:Pjt(f,e)}):null};function XAe(t){var e=t.cx,n=t.cy,r=t.radius,s=t.startAngle,i=t.endAngle,o=Cs(e,n,r,s),l=Cs(e,n,r,i);return{points:[o,l],cx:e,cy:n,radius:r,startAngle:s,endAngle:i}}var Kae,Gae,Yae,Xae,Jae,Qae,Zae;function KV(){return KV=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},KV.apply(null,arguments)}function cx(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}var Rjt=(t,e)=>{var n=Vi(e-t),r=Math.min(Math.abs(e-t),359.999);return n*r},tM=t=>{var e=t.cx,n=t.cy,r=t.radius,s=t.angle,i=t.sign,o=t.isExternal,l=t.cornerRadius,c=t.cornerIsExternal,u=l*(o?1:-1)+r,d=Math.asin(l/u)/FD,h=c?s:s+i*d,f=Cs(e,n,u,h),p=Cs(e,n,r,h),m=c?s-i*d:s,v=Cs(e,n,u*Math.cos(d*FD),m);return{center:f,circleTangency:p,lineTangency:v,theta:d}},JAe=t=>{var e=t.cx,n=t.cy,r=t.innerRadius,s=t.outerRadius,i=t.startAngle,o=t.endAngle,l=Rjt(i,o),c=i+l,u=Cs(e,n,s,i),d=Cs(e,n,s,c),h=Oi(Kae||(Kae=cx(["M ",",",` 1296 A `,",",`,0, 1297 `,",",`, 1298 `,",",` 1299 `])),u.x,u.y,s,s,+(Math.abs(l)>180),+(i>c),d.x,d.y);if(r>0){var f=Cs(e,n,r,i),p=Cs(e,n,r,c);h+=Oi(Gae||(Gae=cx(["L ",",",` 1300 A `,",",`,0, 1301 `,",",`, 1302 `,","," Z"])),p.x,p.y,r,r,+(Math.abs(l)>180),+(i<=c),f.x,f.y)}else h+=Oi(Yae||(Yae=cx(["L ",","," Z"])),e,n);return h},Ojt=t=>{var e=t.cx,n=t.cy,r=t.innerRadius,s=t.outerRadius,i=t.cornerRadius,o=t.forceCornerRadius,l=t.cornerIsExternal,c=t.startAngle,u=t.endAngle,d=Vi(u-c),h=tM({cx:e,cy:n,radius:s,angle:c,sign:d,cornerRadius:i,cornerIsExternal:l}),f=h.circleTangency,p=h.lineTangency,m=h.theta,v=tM({cx:e,cy:n,radius:s,angle:u,sign:-d,cornerRadius:i,cornerIsExternal:l}),x=v.circleTangency,g=v.lineTangency,w=v.theta,_=l?Math.abs(c-u):Math.abs(c-u)-m-w;if(_<0)return o?Oi(Xae||(Xae=cx(["M ",",",` 1303 a`,",",",0,0,1,",`,0 1304 a`,",",",0,0,1,",`,0 1305 `])),p.x,p.y,i,i,i*2,i,i,-i*2):JAe({cx:e,cy:n,innerRadius:r,outerRadius:s,startAngle:c,endAngle:u});var j=Oi(Jae||(Jae=cx(["M ",",",` 1306 A`,",",",0,0,",",",",",` 1307 A`,",",",0,",",",",",",",` 1308 A`,",",",0,0,",",",",",` 1309 `])),p.x,p.y,i,i,+(d<0),f.x,f.y,s,s,+(_>180),+(d<0),x.x,x.y,i,i,+(d<0),g.x,g.y);if(r>0){var N=tM({cx:e,cy:n,radius:r,angle:c,sign:d,isExternal:!0,cornerRadius:i,cornerIsExternal:l}),S=N.circleTangency,C=N.lineTangency,k=N.theta,E=tM({cx:e,cy:n,radius:r,angle:u,sign:-d,isExternal:!0,cornerRadius:i,cornerIsExternal:l}),P=E.circleTangency,T=E.lineTangency,M=E.theta,R=l?Math.abs(c-u):Math.abs(c-u)-k-M;if(R<0&&i===0)return"".concat(j,"L").concat(e,",").concat(n,"Z");j+=Oi(Qae||(Qae=cx(["L",",",` 1310 A`,",",",0,0,",",",",",` 1311 A`,",",",0,",",",",",",",` 1312 A`,",",",0,0,",",",",","Z"])),T.x,T.y,i,i,+(d<0),P.x,P.y,r,r,+(R>180),+(d>0),S.x,S.y,i,i,+(d<0),C.x,C.y)}else j+=Oi(Zae||(Zae=cx(["L",",","Z"])),e,n);return j},Ijt={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},QAe=t=>{var e=za(t,Ijt),n=e.cx,r=e.cy,s=e.innerRadius,i=e.outerRadius,o=e.cornerRadius,l=e.forceCornerRadius,c=e.cornerIsExternal,u=e.startAngle,d=e.endAngle,h=e.className;if(i<s||u===d)return null;var f=mn("recharts-sector",h),p=i-s,m=Ta(o,p,0,!0),v;return m>0&&Math.abs(u-d)<360?v=Ojt({cx:n,cy:r,innerRadius:s,outerRadius:i,cornerRadius:Math.min(m,p/2),forceCornerRadius:l,cornerIsExternal:c,startAngle:u,endAngle:d}):v=JAe({cx:n,cy:r,innerRadius:s,outerRadius:i,startAngle:u,endAngle:d}),b.createElement("path",KV({},hh(e),{className:f,d:v}))};function Djt(t,e,n){if(t==="horizontal")return[{x:e.x,y:n.top},{x:e.x,y:n.top+n.height}];if(t==="vertical")return[{x:n.left,y:e.y},{x:n.left+n.width,y:e.y}];if(Cke(e)){if(t==="centric"){var r=e.cx,s=e.cy,i=e.innerRadius,o=e.outerRadius,l=e.angle,c=Cs(r,s,i,l),u=Cs(r,s,o,l);return[{x:c.x,y:c.y},{x:u.x,y:u.y}]}return XAe(e)}}function Ljt(t){return Uke(t)?NaN:Number(t)}function Gz(t){return t?(t=Ljt(t),t===1/0||t===-1/0?(t<0?-1:1)*Number.MAX_VALUE:t===t?t:0):t===0?t:0}function ZAe(t,e,n){n&&typeof n!="number"&&NV(t,e,n)&&(e=n=void 0),t=Gz(t),e===void 0?(e=t,t=0):e=Gz(e),n=n===void 0?t<e?1:-1:Gz(n);const r=Math.max(Math.ceil((e-t)/(n||1)),0),s=new Array(r);for(let i=0;i<r;i++)s[i]=t,t+=n;return s}var Gu=t=>t.chartData,Q2=we([Gu],t=>{var e=t.chartData!=null?t.chartData.length-1:0;return{chartData:t.chartData,computedData:t.computedData,dataEndIndex:e,dataStartIndex:0}}),eF=(t,e,n,r)=>r?Q2(t):Gu(t),Fjt=(t,e,n)=>n?Q2(t):Gu(t),$jt=we([eF],t=>{var e=t.chartData,n=t.dataStartIndex,r=t.dataEndIndex;return e!=null?e.slice(n,r+1):[]}),zjt=we([Q2],t=>{var e=t.chartData,n=t.dataStartIndex,r=t.dataEndIndex;return e!=null?e.slice(n,r+1):[]}),Bjt=we([Gu],t=>{var e=t.chartData,n=t.dataStartIndex,r=t.dataEndIndex;return e!=null?e.slice(n,r+1):[]});function bG(t,e){return Hjt(t)||Vjt(t,e)||qjt(t,e)||Ujt()}
1312function Ujt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 1313In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function qjt(t,e){if(t){if(typeof t=="string")return eoe(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?eoe(t,e):void 0}}function eoe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Vjt(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,u=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function Hjt(t){if(Array.isArray(t))return t}function nh(t){if(Array.isArray(t)&&t.length===2){var e=bG(t,2),n=e[0],r=e[1];if(An(n)&&An(r))return!0}return!1}function toe(t,e,n){return n?t:[Math.min(t[0],e[0]),Math.max(t[1],e[1])]}function eEe(t,e){if(e&&typeof t!="function"&&Array.isArray(t)&&t.length===2){var n=bG(t,2),r=n[0],s=n[1],i,o;if(An(r))i=r;else if(typeof r=="function")return;if(An(s))o=s;else if(typeof s=="function")return;var l=[i,o];if(nh(l))return l}}function Wjt(t,e,n){if(!(!n&&e==null)){if(typeof t=="function"&&e!=null)try{var r=t(e,n);if(nh(r))return toe(r,e,n)}catch{}if(Array.isArray(t)&&t.length===2){var s=bG(t,2),i=s[0],o=s[1],l,c;if(i==="auto")e!=null&&(l=Math.min(...e));else if(Ct(i))l=i;else if(typeof i=="function")try{e!=null&&(l=i(e==null?void 0:e[0]))}catch{}else if(typeof i=="string"&&Hie.test(i)){var u=Hie.exec(i);if(u==null||u[1]==null||e==null)l=void 0;else{var d=+u[1];l=e[0]-d}}else l=e==null?void 0:e[0];if(o==="auto")e!=null&&(c=Math.max(...e));else if(Ct(o))c=o;else if(typeof o=="function")try{e!=null&&(c=o(e==null?void 0:e[1]))}catch{}else if(typeof o=="string"&&Wie.test(o)){var h=Wie.exec(o);if(h==null||h[1]==null||e==null)c=void 0;else{var f=+h[1];c=e[1]+f}}else c=e==null?void 0:e[1];var p=[l,c];if(nh(p))return e==null?p:toe(p,e,n)}}}var Xj=1e9,Kjt={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},_G,Tr=!0,Dc="[DecimalError] ",qy=Dc+"Invalid argument: ",wG=Dc+"E
1313xponent out of range: ",Jj=Math.floor,Bv=Math.pow,Gjt=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,kl,hi=1e7,yr=7,tEe=9007199254740991,$D=Jj(tEe/yr),ht={};ht.absoluteValue=ht.abs=function(){var t=new this.constructor(this);return t.s&&(t.s=1),t};ht.comparedTo=ht.cmp=function(t){var e,n,r,s,i=this;if(t=new i.constructor(t),i.s!==t.s)return i.s||-t.s;if(i.e!==t.e)return i.e>t.e^i.s<0?1:-1;for(r=i.d.length,s=t.d.length,e=0,n=r<s?r:s;e<n;++e)if(i.d[e]!==t.d[e])return i.d[e]>t.d[e]^i.s<0?1:-1;return r===s?0:r>s^i.s<0?1:-1};ht.decimalPlaces=ht.dp=function(){var t=this,e=t.d.length-1,n=(e-t.e)*yr;if(e=t.d[e],e)for(;e%10==0;e/=10)n--;return n<0?0:n};ht.dividedBy=ht.div=function(t){return qf(this,new this.constructor(t))};ht.dividedToIntegerBy=ht.idiv=function(t){var e=this,n=e.constructor;return er(qf(e,new n(t),0,1),n.precision)};ht.equals=ht.eq=function(t){return!this.cmp(t)};ht.exponent=function(){return As(this)};ht.greaterThan=ht.gt=function(t){return this.cmp(t)>0};ht.greaterThanOrEqualTo=ht.gte=function(t){return this.cmp(t)>=0};ht.isInteger=ht.isint=function(){return this.e>this.d.length-2};ht.isNegative=ht.isneg=function(){return this.s<0};ht.isPositive=ht.ispos=function(){return this.s>0};ht.isZero=function(){return this.s===0};ht.lessThan=ht.lt=function(t){return this.cmp(t)<0};ht.lessThanOrEqualTo=ht.lte=function(t){return this.cmp(t)<1};ht.logarithm=ht.log=function(t){var e,n=this,r=n.constructor,s=r.precision,i=s+5;if(t===void 0)t=new r(10);else if(t=new r(t),t.s<1||t.eq(kl))throw Error(Dc+"NaN");if(n.s<1)throw Error(Dc+(n.s?"NaN":"-Infinity"));return n.eq(kl)?new r(0):(Tr=!1,e=qf(Zk(n,i),Zk(t,i),i),Tr=!0,er(e,s))};ht.minus=ht.sub=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?sEe(e,t):nEe(e,(t.s=-t.s,t))};ht.modulo=ht.mod=function(t){var e,n=this,r=n.constructor,s=r.precision;if(t=new r(t),!t.s)throw Error(Dc+"NaN");return n.s?(Tr=!1,e=qf(n,t,0,1).times(t),Tr=!0,n.minus(e)):er(new r(n),s)};ht.naturalExponential=ht.exp=function(){return rEe(this)};ht.naturalLogarithm=ht.ln=function(){return Zk(this)};ht.negated=ht.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t};ht.plus=ht.add=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?nEe(e,t):sEe(e,(t.s=-t.s,t))};ht.precision=ht.sd=function(t){var e,n,r,s=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(qy+t);if(e=As(s)+1,r=s.d.length-1,n=r*yr+1,r=s.d[r],r){for(;r%10==0;r/=10)n--;for(r=s.d[0];r>=10;r/=10)n++}return t&&e>n?e:n};ht.squareRoot=ht.sqrt=function(){var t,e,n,r,s,i,o,l=this,c=l.constructor;if(l.s<1){if(!l.s)return new c(0);throw Error(Dc+"NaN")}for(t=As(l),Tr=!1,s=Math.sqrt(+l),s==0||s==1/0?(e=Yd(l.d),(e.length+t)%2==0&&(e+="0"),s=Math.sqrt(e),t=Jj((t+1)/2)-(t<0||t%2),s==1/0?e="5e"+t:(e=s.toExponential(),e=e.slice(0,e.indexOf("e")+1)+t),r=new c(e)):r=new c(s.toString()),n=c.precision,s=o=n+3;;)if(i=r,r=i.plus(qf(l,i,o+2)).times(.5),Yd(i.d).slice(0,o)===(e=Yd(r.d)).slice(0,o)){if(e=e.slice(o-3,o+1),s==o&&e=="4999"){if(er(i,n+1,0),i.times(i).eq(l)){r=i;break}}else if(e!="9999")break;o+=4}return Tr=!0,er(r,n)};ht.times=ht.mul=function(t){var e,n,r,s,i,o,l,c,u,d=this,h=d.constructor,f=d.d,p=(t=new h(t)).d;if(!d.s||!t.s)return new h(0);for(t.s*=d.s,n=d.e+t.e,c=f.length,u=p.length,c<u&&(i=f,f=p,p=i,o=c,c=u,u=o),i=[],o=c+u,r=o;r--;)i.push(0);for(r=u;--r>=0;){for(e=0,s=c+r;s>r;)l=i[s]+p[r]*f[s-r-1]+e,i[s--]=l%hi|0,e=l/hi|0;i[s]=(i[s]+e)%hi|0}for(;!i[--o];)i.pop();return e?++n:i.shift(),t.d=i,t.e=n,Tr?er(t,h.precision):t};ht.toDecimalPlaces=ht.todp=function(t,e){var n=this,r=n.constructor;return n=new r(n),t===void 0?n:(gh(t,0,Xj),e===void 0?e=r.rounding:gh(e,0,8),er(n,t+As(n)+1,e))};ht.toExponential=function(t,e){var n,r=this,s=r.constructor;return t===void 0?n=j0(r,!0):(gh(t,0,Xj),e===void 0?e=s.rounding:gh(e,0,8),r=er(new s(r),t+1,e),n=j0(r,!0,t+1)),n};ht.toFixed=function(t,e){var n,r,s=this,i=s.constructor;return t===void 0?j0(s):(gh(t,0,Xj),e===void 0?e=i.rounding:gh(e,0,8),r=er(new i(s),t+As(s)+1,e),n=j0(r.abs(),!1,t+As(r)+1),s.isneg()&&!s.isZero()?"-"+n:n)};ht.toInteger=ht.toint=function(){var t=this,e=t.constructor;return er(new e(t),As(t)+1,e.rounding)};ht.toNumber=function(){return+this};ht.toPower=ht.pow=function(t){var e,n,r,s,i,o,l=this,c=l.constructor,u=12,d=+(t=new c(t));if(!t.s)return new c(kl);if(l=new c(l),!l.s){if(t.s<1)throw Error(Dc+"Infinity");return l}if(l.eq(kl))return l;if(r=c.precision,t.eq(kl))return er(l,r);if(e=t.e,n=t.d.length-1,o=e>=n,i=l.s,o){if((n=d<0?-d:d)<=tEe){for(s=new c(kl),e=Math.ceil(r/yr+4),Tr=!1;n%2&&(s=s.times(l),roe(s.d,e)),n=Jj(n/2),n!==0;)l=l.times(l),roe(l.d,e);return Tr=!0,t.s<0?new c(kl).div(s):er(s,r)}}else if(i<0)throw Error(Dc+"NaN");return i=i<0&&t.d[Math.max(e,n)]&1?-1:1,l.s=1,Tr=!1,s=t.times(Zk(l,r+u)),Tr=!0,s=rEe(s),s.s=i,s};ht.toPrecision=function(t,e){var n,r,s=this,i=s.constructor;return t===void 0?(n=As(s),r=j0(s,n<=i.toExpNeg||n>=i.toExpPos)):(gh(t,1,Xj),e===void 0?e=i.rounding:gh(e,0,8),s=er(new i(s),t,e),n=As(s),r=j0(s,t<=n||n<=i.toExpNeg,t)),r};ht.toSignificantDigits=ht.tosd=function(t,e){var n=this,r=n.constructor;return t===void 0?(t=r.precision,e=r.rounding):(gh(t,1,Xj),e===void 0?e=r.rounding:gh(e,0,8)),er(new r(n),t,e)};ht.toString=ht.valueOf=ht.val=ht.toJSON=ht[Symbol.for("nodejs.util.inspect.custom")]=function(){var t=this,e=As(t),n=t.constructor;return j0(t,e<=n.toExpNeg||e>=n.toExpPos)};function nEe(t,e){var n,r,s,i,o,l,c,u,d=t.constructor,h=d.precision;if(!t.s||!e.s)return e.s||(e=new d(t)),Tr?er(e,h):e;if(c=t.d,u=e.d,o=t.e,s=e.e,c=c.slice(),i=o-s,i){for(i<0?(r=c,i=-i,l=u.length):(r=u,s=o,l=c.length),o=Math.ceil(h/yr),l=o>l?o+1:l+1,i>l&&(i=l,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for(l=c.length,i=u.length,l-i<0&&(i=l,r=u,u=c,c=r),n=0;i;)n=(c[--i]=c[i]+u[i]+n)/hi|0,c[i]%=hi;for(n&&(c.unshift(n),++s),l=c.length;c[--l]==0;)c.pop();return e.d=c,e.e=s,Tr?er(e,h):e}function gh(t,e,n){if(t!==~~t||t<e||t>n)throw Error(qy+t)}function Yd(t){var e,n,r,s=t.length-1,i="",o=t[0];if(s>0){for(i+=o,e=1;e<s;e++)r=t[e]+"",n=yr-r.length,n&&(i+=Gp(n)),i+=r;o=t[e],r=o+"",n=yr-r.length,n&&(i+=Gp(n))}else if(o===0)return"0";for(;o%10===0;)o/=10;return i+o}var qf=function(){function t(r,s){var i,o=0,l=r.length;for(r=r.slice();l--;)i=r[l]*s+o,r[l]=i%hi|0,o=i/hi|0;return o&&r.unshift(o),r}function e(r,s,i,o){var l,c;if(i!=o)c=i>o?1:-1;else for(l=c=0;l<i;l++)if(r[l]!=s[l]){c=r[l]>s[l]?1:-1;break}return c}function n(r,s,i){for(var o=0;i--;)r[i]-=o,o=r[i]<s[i]?1:0,r[i]=o*hi+r[i]-s[i];for(;!r[0]&&r.length>1;)r.shift()}return function(r,s,i,o){var l,c,u,d,h,f,p,m,v,x,g,w,_,j,N,S,C,k,E=r.constructor,P=r.s==s.s?1:-1,T=r.d,M=s.d;if(!r.s)return new E(r);if(!s.s)throw Error(Dc+"Division by zero");for(c=r.e-s.e,C=M.length,N=T.length,p=new E(P),m=p.d=[],u=0;M[u]==(T[u]||0);)++u;if(M[u]>(T[u]||0)&&--c,i==null?w=i=E.precision:o?w=i+(As(r)-As(s))+1:w=i,w<0)return new E(0);if(w=w/yr+2|0,u=0,C==1)for(d=0,M=M[0],w++;(u<N||d)&&w--;u++)_=d*hi+(T[u]||0),m[u]=_/M|0,d=_%M|0;else{for(d=hi/(M[0]+1)|0,d>1&&(M=t(M,d),T=t(T,d),C=M.length,N=T.length),j=C,v=T.slice(0,C),x=v.length;x<C;)v[x++]=0;k=M.slice(),k.unshift(0),S=M[0],M[1]>=hi/2&&++S;do d=0,l=e(M,v,C,x),l<0?(g=v[0],C!=x&&(g=g*hi+(v[1]||0)),d=g/S|0,d>1?(d>=hi&&(d=hi-1),h=t(M,d),f=h.length,x=v.length,l=e(h,v,f,x),l==1&&(d--,n(h,C<f?k:M,f))):(d==0&&(l=d=1),h=M.slice()),f=h.length,f<x&&h.unshift(0),n(v,h,x),l==-1&&(x=v.length,l=e(M,v,C,x),l<1&&(d++,n(v,C<x?k:M,x))),x=v.length):l===0&&(d++,v=[0]),m[u++]=d,l&&v[0]?v[x++]=T[j]||0:(v=[T[j]],x=1);while((j++<N||v[0]!==void 0)&&w--)}return m[0]||m.shift(),p.e=c,er(p,o?i+As(p)+1:i)}}();function rEe(t,e){var n,r,s,i,o,l,c=0,u=0,d=t.constructor,h=d.precision;if(As(t)>16)throw Error(wG+As(t));if(!t.s)return new d(kl);for(e==null?(Tr=!1,l=h):l=e,o=new d(.03125);t.abs().gte(.1);)t=t.times(o),u+=5;for(r=Math.log(Bv(2,u))/Math.LN10*2+5|0,l+=r,n=s=i=new d(kl),d.precision=l;;){if(s=er(s.times(t),l),n=n.times(++c),o=i.plus(qf(s,n,l)),Yd(o.d).slice(0,l)===Yd(i.d).slice(0,l)){for(;u--;)i=er(i.times(i),l);return d.precision=h,e==null?(Tr=!0,er(i,h)):i}i=o}}function As(t){for(var e=t.e*yr,n=t.d[0];n>=10;n/=10)e++;return e}function Yz(t,e,n){if(e>t.LN10.sd())throw Tr=!0,n&&(t.precision=n),Error(Dc+"LN10 precision limit exceeded");return er(new t(t.LN10),e)}function Gp(t){for(var e="";t--;)e+="0";return e}function Zk(t,e){var n,r,s,i,o,l,c,u,d,h=1,f=10,p=t,m=p.d,v=p.constructor,x=v.precision;if(p.s<1)throw Error(Dc+(p.s?"NaN":"-Infinity"));if(p.eq(kl))return new v(0);
1313if(e==null?(Tr=!1,u=x):u=e,p.eq(10))return e==null&&(Tr=!0),Yz(v,u);if(u+=f,v.precision=u,n=Yd(m),r=n.charAt(0),i=As(p),Math.abs(i)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)p=p.times(t),n=Yd(p.d),r=n.charAt(0),h++;i=As(p),r>1?(p=new v("0."+n),i++):p=new v(r+"."+n.slice(1))}else return c=Yz(v,u+2,x).times(i+""),p=Zk(new v(r+"."+n.slice(1)),u-f).plus(c),v.precision=x,e==null?(Tr=!0,er(p,x)):p;for(l=o=p=qf(p.minus(kl),p.plus(kl),u),d=er(p.times(p),u),s=3;;){if(o=er(o.times(d),u),c=l.plus(qf(o,new v(s),u)),Yd(c.d).slice(0,u)===Yd(l.d).slice(0,u))return l=l.times(2),i!==0&&(l=l.plus(Yz(v,u+2,x).times(i+""))),l=qf(l,new v(h),u),v.precision=x,e==null?(Tr=!0,er(l,x)):l;l=c,s+=2}}function noe(t,e){var n,r,s;for((n=e.indexOf("."))>-1&&(e=e.replace(".","")),(r=e.search(/e/i))>0?(n<0&&(n=r),n+=+e.slice(r+1),e=e.substring(0,r)):n<0&&(n=e.length),r=0;e.charCodeAt(r)===48;)++r;for(s=e.length;e.charCodeAt(s-1)===48;)--s;if(e=e.slice(r,s),e){if(s-=r,n=n-r-1,t.e=Jj(n/yr),t.d=[],r=(n+1)%yr,n<0&&(r+=yr),r<s){for(r&&t.d.push(+e.slice(0,r)),s-=yr;r<s;)t.d.push(+e.slice(r,r+=yr));e=e.slice(r),r=yr-e.length}else r-=s;for(;r--;)e+="0";if(t.d.push(+e),Tr&&(t.e>$D||t.e<-$D))throw Error(wG+n)}else t.s=0,t.e=0,t.d=[0];return t}function er(t,e,n){var r,s,i,o,l,c,u,d,h=t.d;for(o=1,i=h[0];i>=10;i/=10)o++;if(r=e-o,r<0)r+=yr,s=e,u=h[d=0];else{if(d=Math.ceil((r+1)/yr),i=h.length,d>=i)return t;for(u=i=h[d],o=1;i>=10;i/=10)o++;r%=yr,s=r-yr+o}if(n!==void 0&&(i=Bv(10,o-s-1),l=u/i%10|0,c=e<0||h[d+1]!==void 0||u%i,c=n<4?(l||c)&&(n==0||n==(t.s<0?3:2)):l>5||l==5&&(n==4||c||n==6&&(r>0?s>0?u/Bv(10,o-s):0:h[d-1])%10&1||n==(t.s<0?8:7))),e<1||!h[0])return c?(i=As(t),h.length=1,e=e-i-1,h[0]=Bv(10,(yr-e%yr)%yr),t.e=Jj(-e/yr)||0):(h.length=1,h[0]=t.e=t.s=0),t;if(r==0?(h.length=d,i=1,d--):(h.length=d+1,i=Bv(10,yr-r),h[d]=s>0?(u/Bv(10,o-s)%Bv(10,s)|0)*i:0),c)for(;;)if(d==0){(h[0]+=i)==hi&&(h[0]=1,++t.e);break}else{if(h[d]+=i,h[d]!=hi)break;h[d--]=0,i=1}for(r=h.length;h[--r]===0;)h.pop();if(Tr&&(t.e>$D||t.e<-$D))throw Error(wG+As(t));return t}function sEe(t,e){var n,r,s,i,o,l,c,u,d,h,f=t.constructor,p=f.precision;if(!t.s||!e.s)return e.s?e.s=-e.s:e=new f(t),Tr?er(e,p):e;if(c=t.d,h=e.d,r=e.e,u=t.e,c=c.slice(),o=u-r,o){for(d=o<0,d?(n=c,o=-o,l=h.length):(n=h,r=u,l=c.length),s=Math.max(Math.ceil(p/yr),l)+2,o>s&&(o=s,n.length=1),n.reverse(),s=o;s--;)n.push(0);n.reverse()}else{for(s=c.length,l=h.length,d=s<l,d&&(l=s),s=0;s<l;s++)if(c[s]!=h[s]){d=c[s]<h[s];break}o=0}for(d&&(n=c,c=h,h=n,e.s=-e.s),l=c.length,s=h.length-l;s>0;--s)c[l++]=0;for(s=h.length;s>o;){if(c[--s]<h[s]){for(i=s;i&&c[--i]===0;)c[i]=hi-1;--c[i],c[s]+=hi}c[s]-=h[s]}for(;c[--l]===0;)c.pop();for(;c[0]===0;c.shift())--r;return c[0]?(e.d=c,e.e=r,Tr?er(e,p):e):new f(0)}function j0(t,e,n){var r,s=As(t),i=Yd(t.d),o=i.length;return e?(n&&(r=n-o)>0?i=i.charAt(0)+"."+i.slice(1)+Gp(r):o>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(s<0?"e":"e+")+s):s<0?(i="0."+Gp(-s-1)+i,n&&(r=n-o)>0&&(i+=Gp(r))):s>=o?(i+=Gp(s+1-o),n&&(r=n-s-1)>0&&(i=i+"."+Gp(r))):((r=s+1)<o&&(i=i.slice(0,r)+"."+i.slice(r)),n&&(r=n-o)>0&&(s+1===o&&(i+="."),i+=Gp(r))),t.s<0?"-"+i:i}function roe(t,e){if(t.length>e)return t.length=e,!0}function iEe(t){var e,n,r;function s(i){var o=this;if(!(o instanceof s))return new s(i);if(o.constructor=s,i instanceof s){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(qy+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 noe(o,i.toString())}else if(typeof i!="string")throw Error(qy+i);if(i.charCodeAt(0)===45?(i=i.slice(1),o.s=-1):o.s=1,Gjt.test(i))noe(o,i);else throw Error(qy+i)}if(s.prototype=ht,s.ROUND_UP=0,s.ROUND_DOWN=1,s.ROUND_CEIL=2,s.ROUND_FLOOR=3,s.ROUND_HALF_UP=4,s.ROUND_HALF_DOWN=5,s.ROUND_HALF_EVEN=6,s.ROUND_HALF_CEIL=7,s.ROUND_HALF_FLOOR=8,s.clone=iEe,s.config=s.set=Yjt,t===void 0&&(t={}),t)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],e=0;e<r.length;)t.hasOwnProperty(n=r[e++])||(t[n]=this[n]);return s.config(t),s}function Yjt(t){if(!t||typeof t!="object")throw Error(Dc+"Object expected");var e,n,r,s=["precision",1,Xj,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(e=0;e<s.length;e+=3)if((r=t[n=s[e]])!==void 0)if(Jj(r)===r&&r>=s[e+1]&&r<=s[e+2])this[n]=r;else throw Error(qy+n+": "+r);if((r=t[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(qy+n+": "+r);return this}var _G=iEe(Kjt);kl=new _G(1);const dn=_G;function aEe(t){var e;return t===0?e=1:e=Math.floor(new dn(t).abs().log(10).toNumber())+1,e}function oEe(t,e,n){for(var r=new dn(t),s=0,i=[];r.lt(e)&&s<1e5;)i.push(r.toNumber()),r=r.add(n),s++;return i}function eA(t,e){return Zjt(t)||Qjt(t,e)||Jjt(t,e)||Xjt()}
1313function Xjt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 1314In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Jjt(t,e){if(t){if(typeof t=="string")return soe(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?soe(t,e):void 0}}function soe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Qjt(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,u=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function Zjt(t){if(Array.isArray(t))return t}var lEe=t=>{var e=eA(t,2),n=e[0],r=e[1],s=n,i=r;return n>r&&(s=r,i=n),[s,i]},jG=(t,e,n)=>{if(t.lte(0))return new dn(0);var r=aEe(t.toNumber()),s=new dn(10).pow(r),i=t.div(s),o=r!==1?.05:.1,l=new dn(Math.ceil(i.div(o).toNumber())).add(n).mul(o),c=l.mul(s);return e?new dn(c.toNumber()):new dn(Math.ceil(c.toNumber()))},cEe=(t,e,n)=>{var r;if(t.lte(0))return new dn(0);var s=[1,2,2.5,5],i=t.toNumber(),o=Math.floor(new dn(i).abs().log(10).toNumber()),l=new dn(10).pow(o),c=t.div(l).toNumber(),u=s.findIndex(p=>p>=c-1e-10);if(u===-1&&(l=l.mul(10),u=0),u+=n,u>=s.length){var d=Math.floor(u/s.length);u%=s.length,l=l.mul(new dn(10).pow(d))}var h=(r=s[u])!==null&&r!==void 0?r:1,f=new dn(h).mul(l);return e?f:new dn(Math.ceil(f.toNumber()))},eSt=(t,e,n)=>{var r=new dn(1),s=new dn(t);if(!s.isint()&&n){var i=Math.abs(t);i<1?(r=new dn(10).pow(aEe(t)-1),s=new dn(Math.floor(s.div(r).toNumber())).mul(r)):i>1&&(s=new dn(Math.floor(t)))}else t===0?s=new dn(Math.floor((e-1)/2)):n||(s=new dn(Math.floor(t)));for(var o=Math.floor((e-1)/2),l=[],c=0;c<e;c++)l.push(s.add(new dn(c-o).mul(r)).toNumber());return l},uEe=function(e,n,r,s){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:jG;if(!Number.isFinite((n-e)/(r-1)))return{step:new dn(0),tickMin:new dn(0),tickMax:new dn(0)};var l=o(new dn(n).sub(e).div(r-1),s,i),c;e<=0&&n>=0?c=new dn(0):(c=new dn(e).add(n).div(2),c=c.sub(new dn(c).mod(l)));var u=Math.ceil(c.sub(e).div(l).toNumber()),d=Math.ceil(new dn(n).sub(c).div(l).toNumber()),h=u+d+1;return h>r?uEe(e,n,r,s,i+1,o):(h<r&&(d=n>0?d+(r-h):d,u=n>0?u:u+(r-h)),{step:l,tickMin:c.sub(new dn(u).mul(l)),tickMax:c.add(new dn(d).mul(l))})},ioe=function(e){var n=eA(e,2),r=n[0],s=n[1],i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,l=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"auto",c=Math.max(i,2),u=lEe([r,s]),d=eA(u,2),h=d[0],f=d[1];if(h===-1/0||f===1/0){var p=f===1/0?[h,...Array(i-1).fill(1/0)]:[...Array(i-1).fill(-1/0),f];return r>s?p.reverse():p}if(h===f)return eSt(h,i,o);var m=l==="snap125"?cEe:jG,v=uEe(h,f,c,o,0,m),x=v.step,g=v.tickMin,w=v.tickMax,_=oEe(g,w.add(new dn(.1).mul(x)),x);return r>s?_.reverse():_},aoe=function(e,n){var r=eA(e,2),s=r[0],i=r[1],o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,l=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"auto",c=lEe([s,i]),u=eA(c,2),d=u[0],h=u[1];if(d===-1/0||h===1/0)return[s,i];if(d===h)return[d];var f=l==="snap125"?cEe:jG,p=Math.max(n,2),m=f(new dn(h).sub(d).div(p-1),o,0),v=[...oEe(new dn(d),new dn(h),m),h];return o===!1&&(v=v.map(x=>Math.round(x))),s>i?v.reverse():v},dEe=t=>t.rootProps.maxBarSize,tSt=t=>t.rootProps.barGap,hEe=t=>t.rootProps.barCategoryGap,nSt=t=>t.rootProps.barSize,Z2=t=>t.rootProps.stackOffset,fEe=t=>t.rootProps.reverseStackOrder,SG=t=>t.options.chartName,NG=t=>t.rootProps.syncId,pEe=t=>t.rootProps.syncMethod,CG=t=>t.options.eventEmitter,vi={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},Nv={allowDecimals:!1,allowDuplicatedCategory:!0,allowDataOverflow:!1,angle:0,angleAxisId:0,axisLine
1314:!0,axisLineType:"polygon",cx:0,cy:0,hide:!1,includeHidden:!1,label:!1,niceTicks:"auto",orientation:"outer",reversed:!1,scale:"auto",tick:!0,tickLine:!0,tickSize:8,type:"auto",zIndex:vi.axis},td={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,angle:0,axisLine:!0,includeHidden:!1,hide:!1,niceTicks:"auto",label:!1,orientation:"right",radiusAxisId:0,reversed:!1,scale:"auto",stroke:"#ccc",tick:!0,tickCount:5,tickLine:!0,type:"auto",zIndex:vi.axis},tF=(t,e)=>{if(!(!t||!e))return t!=null&&t.reversed?[e[1],e[0]]:e};function nF(t,e,n){if(n!=="auto")return n;if(t!=null)return uv(t,e)?"category":"number"}function ooe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function zD(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ooe(Object(n),!0).forEach(function(r){rSt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ooe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function rSt(t,e,n){return(e=sSt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function sSt(t){var e=iSt(t,"string");return typeof e=="symbol"?e:e+""}function iSt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var loe={allowDataOverflow:Nv.allowDataOverflow,allowDecimals:Nv.allowDecimals,allowDuplicatedCategory:!1,dataKey:void 0,domain:void 0,id:Nv.angleAxisId,includeHidden:!1,name:void 0,reversed:Nv.reversed,scale:Nv.scale,tick:Nv.tick,tickCount:void 0,ticks:void 0,type:Nv.type,unit:void 0,niceTicks:"auto"},coe={allowDataOverflow:td.allowDataOverflow,allowDecimals:td.allowDecimals,allowDuplicatedCategory:td.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:td.radiusAxisId,includeHidden:td.includeHidden,name:void 0,reversed:td.reversed,scale:td.scale,tick:td.tick,tickCount:td.tickCount,ticks:void 0,type:td.type,unit:void 0,niceTicks:"auto"},aSt=(t,e)=>{if(e!=null)return t.polarAxis.angleAxis[e]},kG=we([aSt,gG],(t,e)=>{var n;if(t!=null)return t;var r=(n=nF(e,"angleAxis",loe.type))!==null&&n!==void 0?n:"category";return zD(zD({},loe),{},{type:r})}),oSt=(t,e)=>t.polarAxis.radiusAxis[e],AG=we([oSt,gG],(t,e)=>{var n;if(t!=null)return t;var r=(n=nF(e,"radiusAxis",coe.type))!==null&&n!==void 0?n:"category";return zD(zD({},coe),{},{type:r})}),rF=t=>t.polarOptions,EG=we([vp,xp,Xs],YAe),mEe=we([rF,EG],(t,e)=>{if(t!=null)return Ta(t.innerRadius,e,0)}),gEe=we([rF,EG],(t,e)=>{if(t!=null)return Ta(t.outerRadius,e,e*.8)}),lSt=t=>{if(t==null)return[0,0];var e=t.startAngle,n=t.endAngle;return[e,n]},vEe=we([rF],lSt);we([kG,vEe],tF);var xEe=we([EG,mEe,gEe],(t,e,n)=>{if(!(t==null||e==null||n==null))return[e,n]});we([AG,xEe],tF);var yEe=we([Rn,rF,mEe,gEe,vp,xp],(t,e,n,r,s,i)=>{if(!(t!=="centric"&&t!=="radial"||e==null||n==null||r==null)){var o=e.cx,l=e.cy,c=e.startAngle,u=e.endAngle;return{cx:Ta(o,s,s/2),cy:Ta(l,i,i/2),innerRadius:n,outerRadius:r,startAngle:c,endAngle:u,clockWise:!1}}}),Br=(t,e)=>e,eT=(t,e,n)=>n;function TG(t){return t==null?void 0:t.id}function bEe(t,e,n){var r=e.chartData,s=r===void 0?[]:r,i=n.allowDuplicatedCategory,o=n.dataKey,l=new Map;return t.forEach(c=>{var u,d=(u=c.data)!==null&&u!==void 0?u:s;if(!(d==null||d.length===0)){var h=TG(c);d.forEach((f,p)=>{var m=o==null||i?p:String(Qn(f,o,null)),v=Qn(f,c.dataKey,0),x;l.has(m)?x=l.get(m):x={},Object.assign(x,{[h]:v}),l.set(m,x)})}}),Array.from(l.values())}function sF(t){return"stackId"in t&&t.stackId!=null&&t.dataKey!=null}var iF=(t,e)=>t===e?!0:t==null||e==null?!1:t[0]===e[0]&&t[1]===e[1];function aF(t,e){return Array.isArray(t)&&Array.isArray(e)&&t.length===0&&e.length===0?!0:t===e}function cSt(t,e){if(t.length===e.length){for(var n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}return!1}var _i=t=>{var e=Rn(t);return e==="horizontal"?"xAxis":e==="vertical"?"yAxis":e==="centric"?"angleAxis":"radiusAxis"},Qj=t=>t.tooltip.settings.axisId;function PG(t){if(t!=null){var e=t.ticks,n=t.bandwidth,r=t.range(),s=[Math.min(...r),Math.max(...r)];return{domain:()=>t.domain(),range:function(i){function o(){return i.apply(this,arguments)}return o.toString=function(){return i.toString()},o}(()=>s),rangeMin:()=>s[0],rangeMax:()=>s[1],isInRange(i){var o=s[0],l=s[1];return o<=l?i>=o&&i<=l:i>=l&&i<=o},bandwidth:n?()=>n.call(t):void 0,ticks:e?i=>e.call(t,i):void 0,map:(i,o)=>
1314{var l=t(i);if(l!=null){if(t.bandwidth&&o!==null&&o!==void 0&&o.position){var c=t.bandwidth();switch(o.position){case"middle":l+=c/2;break;case"end":l+=c;break}}return l}}}}}var wEe=(t,e)=>{if(e!=null)switch(t){case"linear":{if(!nh(e)){for(var n,r,s=0;s<e.length;s++){var i=e[s];An(i)&&((n===void 0||i<n)&&(n=i),(r===void 0||i>r)&&(r=i))}return n!==void 0&&r!==void 0?[n,r]:void 0}return e}default:return e}};function Tg(t,e){return t==null||e==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function uSt(t,e){return t==null||e==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function MG(t){let e,n,r;t.length!==2?(e=Tg,n=(l,c)=>Tg(t(l),c),r=(l,c)=>t(l)-c):(e=t===Tg||t===uSt?t:dSt,n=t,r=t);function s(l,c,u=0,d=l.length){if(u<d){if(e(c,c)!==0)return d;do{const h=u+d>>>1;n(l[h],c)<0?u=h+1:d=h}while(u<d)}return u}function i(l,c,u=0,d=l.length){if(u<d){if(e(c,c)!==0)return d;do{const h=u+d>>>1;n(l[h],c)<=0?u=h+1:d=h}while(u<d)}return u}function o(l,c,u=0,d=l.length){const h=s(l,c,u,d-1);return h>u&&r(l[h-1],c)>-r(l[h],c)?h-1:h}return{left:s,center:o,right:i}}function dSt(){return 0}function _Ee(t){return t===null?NaN:+t}function*hSt(t,e){for(let n of t)n!=null&&(n=+n)>=n&&(yield n)}const fSt=MG(Tg),tT=fSt.right;MG(_Ee).center;class uoe extends Map{constructor(e,n=gSt){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),e!=null)for(const[r,s]of e)this.set(r,s)}get(e){return super.get(doe(this,e))}has(e){return super.has(doe(this,e))}set(e,n){return super.set(pSt(this,e),n)}delete(e){return super.delete(mSt(this,e))}}function doe({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):n}function pSt({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}function mSt({_intern:t,_key:e},n){const r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}function gSt(t){return t!==null&&typeof t=="object"?t.valueOf():t}function vSt(t=Tg){if(t===Tg)return jEe;if(typeof t!="function")throw new TypeError("compare is not a function");return(e,n)=>{const r=t(e,n);return r||r===0?r:(t(n,n)===0)-(t(e,e)===0)}}function jEe(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(t<e?-1:t>e?1:0)}const xSt=Math.sqrt(50),ySt=Math.sqrt(10),bSt=Math.sqrt(2);function BD(t,e,n){const r=(e-t)/Math.max(0,n),s=Math.floor(Math.log10(r)),i=r/Math.pow(10,s),o=i>=xSt?10:i>=ySt?5:i>=bSt?2:1;let l,c,u;return s<0?(u=Math.pow(10,-s)/o,l=Math.round(t*u),c=Math.round(e*u),l/u<t&&++l,c/u>e&&--c,u=-u):(u=Math.pow(10,s)*o,l=Math.round(t/u),c=Math.round(e/u),l*u<t&&++l,c*u>e&&--c),c<l&&.5<=n&&n<2?BD(t,e,n*2):[l,c,u]}function GV(t,e,n){if(e=+e,t=+t,n=+n,!(n>0))return[];if(t===e)return[t];const r=e<t,[s,i,o]=r?BD(e,t,n):BD(t,e,n);if(!(i>=s))return[];const l=i-s+1,c=new Array(l);if(r)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]=(s+u)/-o;else for(let u=0;u<l;++u)c[u]=(s+u)*o;return c}function YV(t,e,n){return e=+e,t=+t,n=+n,BD(t,e,n)[2]}function XV(t,e,n){e=+e,t=+t,n=+n;const r=e<t,s=r?YV(e,t,n):YV(t,e,n);return(r?-1:1)*(s<0?1/-s:s)}function hoe(t,e){let n;for(const r of t)r!=null&&(n<r||n===void 0&&r>=r)&&(n=r);return n}function foe(t,e){let n;for(const r of t)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function SEe(t,e,n=0,r=1/0,s){if(e=Math.floor(e),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(t.length-1,r)),!(n<=e&&e<=r))return t;for(s=s===void 0?jEe:vSt(s);r>n;){if(r-n>600){const c=r-n+1,u=e-n+1,d=Math.log(c),h=.5*Math.exp(2*d/3),f=.5*Math.sqrt(d*h*(c-h)/c)*(u-c/2<0?-1:1),p=Math.max(n,Math.floor(e-u*h/c+f)),m=Math.min(r,Math.floor(e+(c-u)*h/c+f));SEe(t,e,p,m,s)}const i=t[e];let o=n,l=r;for(US(t,n,e),s(t[r],i)>0&&US(t,n,r);o<l;){for(US(t,o,l),++o,--l;s(t[o],i)<0;)++o;for(;s(t[l],i)>0;)--l}s(t[n],i)===0?US(t,n,l):(++l,US(t,l,r)),l<=e&&(n=l+1),e<=l&&(r=l-1)}return t}function US(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function wSt(t,e,n){if(t=Float64Array.from(hSt(t)),!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return foe(t);if(e>=1)return hoe(t);var r,s=(r-1)*e,i=Math.floor(s),o=hoe(SEe(t,i).subarray(0,i+1)),l=foe(t.subarray(i+1));return o+(l-o)*(s-i)}}function _St(t,e,n=_Ee){if(!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return+n(t[0],0,t);if(e>=1)return+n(t[r-1],r-1,t);var r,s=(r-1)*e,i=Math.floor(s),o=+n(t[i],i,t),l=+n(t[i+1],i+1,t);return o+(l-o)*(s-i)}}function jSt(t,e,n){t=+t,e=+e,n=(s=arguments.length)<2?(e=t,t=0,1):s<3?1:+n;for(var r=-1,s=Math.max(0,Math.ceil((e-t)/n))|0,i=new Array(s);++r<s;)i[r]=t+r*n;return i}function Fc(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}function yp(t,e){switch(arguments.length){case 0:break;case 1:{typeof t=="function"?this.interpolator(t):this.range(t);break}default:{this.domain(t),typeof e=="function"?this.interpolator(e):this.range(e);break}}return this}
vendor: 8,994 bytes, line 1314
1314const JV=Symbol("implicit");function RG(){var t=new uoe,e=[],n=[],r=JV;function s(i){let o=t.get(i);if(o===void 0){if(r!==JV)return r;t.set(i,o=e.push(i)-1)}return n[o%n.length]}return s.domain=function(i){if(!arguments.length)return e.slice();e=[],t=new uoe;for(const o of i)t.has(o)||t.set(o,e.push(o)-1);return s},s.range=function(i){return arguments.length?(n=Array.from(i),s):n.slice()},s.unknown=function(i){return arguments.length?(r=i,s):r},s.copy=function(){return RG(e,n).unknown(r)},Fc.apply(s,arguments),s}function OG(){var t=RG().unknown(void 0),e=t.domain,n=t.range,r=0,s=1,i,o,l=!1,c=0,u=0,d=.5;delete t.unknown;function h(){var f=e().length,p=s<r,m=p?s:r,v=p?r:s;i=(v-m)/Math.max(1,f-c+u*2),l&&(i=Math.floor(i)),m+=(v-m-i*(f-c))*d,o=i*(1-c),l&&(m=Math.round(m),o=Math.round(o));var x=jSt(f).map(function(g){return m+i*g});return n(p?x.reverse():x)}return t.domain=function(f){return arguments.length?(e(f),h()):e()},t.range=function(f){return arguments.length?([r,s]=f,r=+r,s=+s,h()):[r,s]},t.rangeRound=function(f){return[r,s]=f,r=+r,s=+s,l=!0,h()},t.bandwidth=function(){return o},t.step=function(){return i},t.round=function(f){return arguments.length?(l=!!f,h()):l},t.padding=function(f){return arguments.length?(c=Math.min(1,u=+f),h()):c},t.paddingInner=function(f){return arguments.length?(c=Math.min(1,f),h()):c},t.paddingOuter=function(f){return arguments.length?(u=+f,h()):u},t.align=function(f){return arguments.length?(d=Math.max(0,Math.min(1,f)),h()):d},t.copy=function(){return OG(e(),[r,s]).round(l).paddingInner(c).paddingOuter(u).align(d)},Fc.apply(h(),arguments)}function NEe(t){var e=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return NEe(e())},t}function SSt(){return NEe(OG.apply(null,arguments).paddingInner(1))}function IG(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function CEe(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function nT(){}var tA=.7,UD=1/tA,Vw="\\s*([+-]?\\d+)\\s*",nA="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",rh="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",NSt=/^#([0-9a-f]{3,8})$/,CSt=new RegExp(`^rgb\\(${Vw},${Vw},${Vw}\\)$`),kSt=new RegExp(`^rgb\\(${rh},${rh},${rh}\\)$`),ASt=new RegExp(`^rgba\\(${Vw},${Vw},${Vw},${nA}\\)$`),ESt=new RegExp(`^rgba\\(${rh},${rh},${rh},${nA}\\)$`),TSt=new RegExp(`^hsl\\(${nA},${rh},${rh}\\)$`),PSt=new RegExp(`^hsla\\(${nA},${rh},${rh},${nA}\\)$`),poe={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};IG(nT,rA,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:moe,formatHex:moe,formatHex8:MSt,formatHsl:RSt,formatRgb:goe,toString:goe});function moe(){return this.rgb().formatHex()}function MSt(){return this.rgb().formatHex8()}function RSt(){return kEe(this).formatHsl()}function goe(){return this.rgb().formatRgb()}function rA(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=NSt.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?voe(e):n===3?new Vo(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?nM(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?nM(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=CSt.exec(t))?new Vo(e[1],e[2],e[3],1):(e=kSt.exec(t))?new Vo(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=ASt.exec(t))?nM(e[1],e[2],e[3],e[4]):(e=ESt.exec(t))?nM(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=TSt.exec(t))?boe(e[1],e[2]/100,e[3]/100,1):(e=PSt.exec(t))?boe(e[1],e[2]/100,e[3]/100,e[4]):poe.hasOwnProperty(t)?voe(poe[t]):t==="transparent"?new Vo(NaN,NaN,NaN,0):null}function voe(t){return new Vo(t>>16&255,t>>8&255,t&255,1)}function nM(t,e,n,r){return r<=0&&(t=e=n=NaN),new Vo(t,e,n,r)}function OSt(t){return t instanceof nT||(t=rA(t)),t?(t=t.rgb(),new Vo(t.r,t.g,t.b,t.opacity)):new Vo}function QV(t,e,n,r){return arguments.length===1?OSt(t):new Vo(t,e,n,r??1)}function Vo(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}IG(Vo,QV,CEe(nT,{brighter(t){return t=t==null?UD:Math.pow(UD,t),new Vo(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?tA:Math.pow(tA,t),new Vo(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Vo(Vy(this.r),Vy(this.g),Vy(this.b),qD(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:xoe,formatHex:xoe,formatHex8:ISt,formatRgb:yoe,toString:yoe}));function xoe(){return`#${ux(this.r)}${ux(this.g)}${ux(this.b)}`}function ISt(){return`#${ux(this.r)}${ux(this.g)}${ux(this.b)}${ux((isNaN(this.opacity)?1:this.opacity)*255)}`}function yoe(){const t=qD(this.opacity);return`${t===1?"rgb(":"rgba("}${Vy(this.r)}, ${Vy(this.g)}, ${Vy(this.b)}${t===1?")":`, ${t})`}`}function qD(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Vy(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function ux(t){return t=Vy(t),(t<16?"0":"")+t.toString(16)}function boe(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new ju(t,e,n,r)}function kEe(t){if(t instanceof ju)return new ju(t.h,t.s,t.l,t.opacity);if(t instanceof nT||(t=rA(t)),!t)return new ju;if(t instanceof ju)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,s=Math.min(e,n,r),i=Math.max(e,n,r),o=NaN,l=i-s,c=(i+s)/2;return l?(e===i?o=(n-r)/l+(n<r)*6:n===i?o=(r-e)/l+2:o=(e-n)/l+4,l/=c<.5?i+s:2-i-s,o*=60):l=c>0&&c<1?0:o,new ju(o,l,c,t.opacity)}function DSt(t,e,n,r){return arguments.length===1?kEe(t):new ju(t,e,n,r??1)}function ju(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}IG(ju,DSt,CEe(nT,{brighter(t){return t=t==null?UD:Math.pow(UD,t),new ju(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?tA:Math.pow(tA,t),new ju(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,s=2*n-r;return new Vo(Xz(t>=240?t-240:t+120,s,r),Xz(t,s,r),Xz(t<120?t+240:t-120,s,r),this.opacity)},clamp(){return new ju(woe(this.h),rM(this.s),rM(this.l),qD(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 t=qD(this.opacity);return`${t===1?"hsl(":"hsla("}${woe(this.h)}, ${rM(this.s)*100}%, ${rM(this.l)*100}%${t===1?")":`, ${t})`}`}}));function woe(t){return t=(t||0)%360,t<0?t+360:t}
vendor: 4,327 bytes, line 1314
1314function rM(t){return Math.max(0,Math.min(1,t||0))}function Xz(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const DG=t=>()=>t;function LSt(t,e){return function(n){return t+n*e}}function FSt(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function $St(t){return(t=+t)==1?AEe:function(e,n){return n-e?FSt(e,n,t):DG(isNaN(e)?n:e)}}function AEe(t,e){var n=e-t;return n?LSt(t,n):DG(isNaN(t)?e:t)}const _oe=function t(e){var n=$St(e);function r(s,i){var o=n((s=QV(s)).r,(i=QV(i)).r),l=n(s.g,i.g),c=n(s.b,i.b),u=AEe(s.opacity,i.opacity);return function(d){return s.r=o(d),s.g=l(d),s.b=c(d),s.opacity=u(d),s+""}}return r.gamma=t,r}(1);function zSt(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,r=e.slice(),s;return function(i){for(s=0;s<n;++s)r[s]=t[s]*(1-i)+e[s]*i;return r}}function BSt(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function USt(t,e){var n=e?e.length:0,r=t?Math.min(n,t.length):0,s=new Array(r),i=new Array(n),o;for(o=0;o<r;++o)s[o]=Zj(t[o],e[o]);for(;o<n;++o)i[o]=e[o];return function(l){for(o=0;o<r;++o)i[o]=s[o](l);return i}}function qSt(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function VD(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function VSt(t,e){var n={},r={},s;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(s in e)s in t?n[s]=Zj(t[s],e[s]):r[s]=e[s];return function(i){for(s in n)r[s]=n[s](i);return r}}var ZV=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Jz=new RegExp(ZV.source,"g");function HSt(t){return function(){return t}}function WSt(t){return function(e){return t(e)+""}}function KSt(t,e){var n=ZV.lastIndex=Jz.lastIndex=0,r,s,i,o=-1,l=[],c=[];for(t=t+"",e=e+"";(r=ZV.exec(t))&&(s=Jz.exec(e));)(i=s.index)>n&&(i=e.slice(n,i),l[o]?l[o]+=i:l[++o]=i),(r=r[0])===(s=s[0])?l[o]?l[o]+=s:l[++o]=s:(l[++o]=null,c.push({i:o,x:VD(r,s)})),n=Jz.lastIndex;return n<e.length&&(i=e.slice(n),l[o]?l[o]+=i:l[++o]=i),l.length<2?c[0]?WSt(c[0].x):HSt(e):(e=c.length,function(u){for(var d=0,h;d<e;++d)l[(h=c[d]).i]=h.x(u);return l.join("")})}function Zj(t,e){var n=typeof e,r;return e==null||n==="boolean"?DG(e):(n==="number"?VD:n==="string"?(r=rA(e))?(e=r,_oe):KSt:e instanceof rA?_oe:e instanceof Date?qSt:BSt(e)?zSt:Array.isArray(e)?USt:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?VSt:VD)(t,e)}function LG(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}function GSt(t,e){e===void 0&&(e=t,t=Zj);for(var n=0,r=e.length-1,s=e[0],i=new Array(r<0?0:r);n<r;)i[n]=t(s,s=e[++n]);return function(o){var l=Math.max(0,Math.min(r-1,Math.floor(o*=r)));return i[l](o-l)}}function YSt(t){return function(){return t}}function HD(t){return+t}var joe=[0,1];function ao(t){return t}function eH(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:YSt(isNaN(e)?NaN:.5)}function XSt(t,e){var n;return t>e&&(n=t,t=e,e=n),function(r){return Math.max(t,Math.min(e,r))}}function JSt(t,e,n){var r=t[0],s=t[1],i=e[0],o=e[1];return s<r?(r=eH(s,r),i=n(o,i)):(r=eH(r,s),i=n(i,o)),function(l){return i(r(l))}}function QSt(t,e,n){var r=Math.min(t.length,e.length)-1,s=new Array(r),i=new Array(r),o=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++o<r;)s[o]=eH(t[o],t[o+1]),i[o]=n(e[o],e[o+1]);return function(l){var c=tT(t,l,1,r)-1;return i[c](s[c](l))}}function rT(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function oF(){var t=joe,e=joe,n=Zj,r,s,i,o=ao,l,c,u;function d(){var f=Math.min(t.length,e.length);return o!==ao&&(o=XSt(t[0],t[f-1])),l=f>2?QSt:JSt,c=u=null,h}function h(f){return f==null||isNaN(f=+f)?i:(c||(c=l(t.map(r),e,n)))(r(o(f)))}return h.invert=function(f){return o(s((u||(u=l(e,t.map(r),VD)))(f)))},h.domain=function(f){return arguments.length?(t=Array.from(f,HD),d()):t.slice()},h.range=function(f){return arguments.length?(e=Array.from(f),d()):e.slice()},h.rangeRound=function(f){return e=Array.from(f),n=LG,d()},h.clamp=function(f){return arguments.length?(o=f?!0:ao,d()):o!==ao},h.interpolate=function(f){return arguments.length?(n=f,d()):n},h.unknown=function(f){return arguments.length?(i=f,h):i},function(f,p){return r=f,s=p,d()}}function FG(){return oF()(ao,ao)}function ZSt(t){return Math.abs(t=Math.round(t))>
vendor: 6,033 bytes, line 1314
1314=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function WD(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function hj(t){return t=WD(Math.abs(t)),t?t[1]:NaN}function eNt(t,e){return function(n,r){for(var s=n.length,i=[],o=0,l=t[0],c=0;s>0&&l>0&&(c+l+1>r&&(l=Math.max(1,r-c)),i.push(n.substring(s-=l,s+l)),!((c+=l+1)>r));)l=t[o=(o+1)%t.length];return i.reverse().join(e)}}function tNt(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var nNt=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function sA(t){if(!(e=nNt.exec(t)))throw new Error("invalid format: "+t);var e;return new $G({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}sA.prototype=$G.prototype;function $G(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}$G.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 rNt(t){e:for(var e=t.length,n=1,r=-1,s;n<e;++n)switch(t[n]){case".":r=s=n;break;case"0":r===0&&(r=n),s=n;break;default:if(!+t[n])break e;r>0&&(r=0);break}return r>0?t.slice(0,r)+t.slice(s+1):t}var EEe;function sNt(t,e){var n=WD(t,e);if(!n)return t+"";var r=n[0],s=n[1],i=s-(EEe=Math.max(-8,Math.min(8,Math.floor(s/3)))*3)+1,o=r.length;return i===o?r:i>o?r+new Array(i-o+1).join("0"):i>0?r.slice(0,i)+"."+r.slice(i):"0."+new Array(1-i).join("0")+WD(t,Math.max(0,e+i-1))[0]}function Soe(t,e){var n=WD(t,e);if(!n)return t+"";var r=n[0],s=n[1];return s<0?"0."+new Array(-s).join("0")+r:r.length>s+1?r.slice(0,s+1)+"."+r.slice(s+1):r+new Array(s-r.length+2).join("0")}const Noe={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:ZSt,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Soe(t*100,e),r:Soe,s:sNt,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Coe(t){return t}var koe=Array.prototype.map,Aoe=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function iNt(t){var e=t.grouping===void 0||t.thousands===void 0?Coe:eNt(koe.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",r=t.currency===void 0?"":t.currency[1]+"",s=t.decimal===void 0?".":t.decimal+"",i=t.numerals===void 0?Coe:tNt(koe.call(t.numerals,String)),o=t.percent===void 0?"%":t.percent+"",l=t.minus===void 0?"â":t.minus+"",c=t.nan===void 0?"NaN":t.nan+"";function u(h){h=sA(h);var f=h.fill,p=h.align,m=h.sign,v=h.symbol,x=h.zero,g=h.width,w=h.comma,_=h.precision,j=h.trim,N=h.type;N==="n"?(w=!0,N="g"):Noe[N]||(_===void 0&&(_=12),j=!0,N="g"),(x||f==="0"&&p==="=")&&(x=!0,f="0",p="=");var S=v==="$"?n:v==="#"&&/[boxX]/.test(N)?"0"+N.toLowerCase():"",C=v==="$"?r:/[%p]/.test(N)?o:"",k=Noe[N],E=/[defgprs%]/.test(N);_=_===void 0?6:/[gprs]/.test(N)?Math.max(1,Math.min(21,_)):Math.max(0,Math.min(20,_));function P(T){var M=S,R=C,A,I,D;if(N==="c")R=k(T)+R,T="";else{T=+T;var O=T<0||1/T<0;if(T=isNaN(T)?c:k(Math.abs(T),_),j&&(T=rNt(T)),O&&+T==0&&m!=="+"&&(O=!1),M=(O?m==="("?m:l:m==="-"||m==="("?"":m)+M,R=(N==="s"?Aoe[8+EEe/3]:"")+R+(O&&m==="("?")":""),E){for(A=-1,I=T.length;++A<I;)if(D=T.charCodeAt(A),48>D||D>57){R=(D===46?s+T.slice(A+1):T.slice(A))+R,T=T.slice(0,A);break}}}w&&!x&&(T=e(T,1/0));var z=M.length+T.length+R.length,B=z<g?new Array(g-z+1).join(f):"";switch(w&&x&&(T=e(B+T,B.length?g-R.length:1/0),B=""),p){case"<":T=M+T+R+B;break;case"=":T=M+B+T+R;break;case"^":T=B.slice(0,z=B.length>>1)+M+T+R+B.slice(z);break;default:T=B+M+T+R;break}return i(T)}return P.toString=function(){return h+""},P}function d(h,f){var p=u((h=sA(h),h.type="f",h)),m=Math.max(-8,Math.min(8,Math.floor(hj(f)/3)))*3,v=Math.pow(10,-m),x=Aoe[8+m/3];return function(g){return p(v*g)+x}}return{format:u,formatPrefix:d}}var sM,zG,TEe;aNt({thousands:",",grouping:[3],currency:["$",""]});function aNt(t){return sM=iNt(t),zG=sM.format,TEe=sM.formatPrefix,sM}function oNt(t){return Math.max(0,-hj(Math.abs(t)))}function lNt(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(hj(e)/3)))*3-hj(Math.abs(t)))}function cNt(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,hj(e)-hj(t))+1}function PEe(t,e,n,r){var s=XV(t,e,n),i;switch(r=sA(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(t),Math.abs(e));return r.precision==null&&!isNaN(i=lNt(s,o))&&(r.precision=i),TEe(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(i=cNt(s,Math.max(Math.abs(t),Math.abs(e))))&&(r.precision=i-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(i=oNt(s))&&(r.precision=i-(r.type==="%")*2);break}}return zG(r)}function dv(t){var e=t.domain;return t.ticks=function(n){var r=e();return GV(r[0],r[r.length-1],n??10)},t.tickFormat=function(n,r){var s=e();return PEe(s[0],s[s.length-1],n??10,r)},t.nice=function(n){n==null&&(n=10);var r=e(),s=0,i=r.length-1,o=r[s],l=r[i],c,u,d=10;for(l<o&&(u=o,o=l,l=u,u=s,s=i,i=u);d-- >0;){if(u=YV(o,l,n),u===c)return r[s]=o,r[i]=l,e(r);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 t},t}function MEe(){var t=FG();return t.copy=function(){return rT(t,MEe())},Fc.apply(t,arguments),dv(t)}function REe(t){var e;function n(r){return r==null||isNaN(r=+r)?e:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(t=Array.from(r,HD),n):t.slice()},n.unknown=function(r){return arguments.length?(e=r,n):e}
1314,n.copy=function(){return REe(t).unknown(e)},t=arguments.length?Array.from(t,HD):[0,1],dv(n)}function OEe(t,e){t=t.slice();var n=0,r=t.length-1,s=t[n],i=t[r],o;return i<s&&(o=n,n=r,r=o,o=s,s=i,i=o),t[n]=e.floor(s),t[r]=e.ceil(i),t}function Eoe(t){return Math.log(t)}function Toe(t){return Math.exp(t)}function uNt(t){return-Math.log(-t)}function dNt(t){return-Math.exp(-t)}function hNt(t){return isFinite(t)?+("1e"+t):t<0?0:t}function fNt(t){return t===10?hNt:t===Math.E?Math.exp:e=>Math.pow(t,e)}function pNt(t){return t===Math.E?Math.log:t===10&&Math.log10||t===2&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}function Poe(t){return(e,n)=>-t(-e,n)}function BG(t){const e=t(Eoe,Toe),n=e.domain;let r=10,s,i;function o(){return s=pNt(r),i=fNt(r),n()[0]<0?(s=Poe(s),i=Poe(i),t(uNt,dNt)):t(Eoe,Toe),e}return e.base=function(l){return arguments.length?(r=+l,o()):r},e.domain=function(l){return arguments.length?(n(l),o()):n()},e.ticks=l=>{const c=n();let u=c[0],d=c[c.length-1];const h=d<u;h&&([u,d]=[d,u]);let f=s(u),p=s(d),m,v;const x=l==null?10:+l;let g=[];if(!(r%1)&&p-f<x){if(f=Math.floor(f),p=Math.ceil(p),u>0){for(;f<=p;++f)for(m=1;m<r;++m)if(v=f<0?m/i(-f):m*i(f),!(v<u)){if(v>d)break;g.push(v)}}else for(;f<=p;++f)for(m=r-1;m>=1;--m)if(v=f>0?m/i(-f):m*i(f),!(v<u)){if(v>d)break;g.push(v)}g.length*2<x&&(g=GV(u,d,x))}else g=GV(f,p,Math.min(p-f,x)).map(i);return h?g.reverse():g},e.tickFormat=(l,c)=>{if(l==null&&(l=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=sA(c)).precision==null&&(c.trim=!0),c=zG(c)),l===1/0)return c;const u=Math.max(1,r*l/e.ticks().length);return d=>{let h=d/i(Math.round(s(d)));return h*r<r-.5&&(h*=r),h<=u?c(d):""}},e.nice=()=>n(OEe(n(),{floor:l=>i(Math.floor(s(l))),ceil:l=>i(Math.ceil(s(l)))})),e}function IEe(){const t=BG(oF()).domain([1,10]);return t.copy=()=>rT(t,IEe()).base(t.base()),Fc.apply(t,arguments),t}function Moe(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function Roe(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function UG(t){var e=1,n=t(Moe(e),Roe(e));return n.constant=function(r){return arguments.length?t(Moe(e=+r),Roe(e)):e},dv(n)}function DEe(){var t=UG(oF());return t.copy=function(){return rT(t,DEe()).constant(t.constant())},Fc.apply(t,arguments)}function Ooe(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function mNt(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function gNt(t){return t<0?-t*t:t*t}function qG(t){var e=t(ao,ao),n=1;function r(){return n===1?t(ao,ao):n===.5?t(mNt,gNt):t(Ooe(n),Ooe(1/n))}return e.exponent=function(s){return arguments.length?(n=+s,r()):n},dv(e)}function VG(){var t=qG(oF());return t.copy=function(){return rT(t,VG()).exponent(t.exponent())},Fc.apply(t,arguments),t}function vNt(){return VG.apply(null,arguments).exponent(.5)}function Ioe(t){return Math.sign(t)*t*t}function xNt(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function LEe(){var t=FG(),e=[0,1],n=!1,r;function s(i){var o=xNt(t(i));return isNaN(o)?r:n?Math.round(o):o}return s.invert=function(i){return t.invert(Ioe(i))},s.domain=function(i){return arguments.length?(t.domain(i),s):t.domain()},s.range=function(i){return arguments.length?(t.range((e=Array.from(i,HD)).map(Ioe)),s):e.slice()},s.rangeRound=function(i){return s.range(i).round(!0)},s.round=function(i){return arguments.length?(n=!!i,s):n},s.clamp=function(i){return arguments.length?(t.clamp(i),s):t.clamp()},s.unknown=function(i){return arguments.length?(r=i,s):r},s.copy=function(){return LEe(t.domain(),e).round(n).clamp(t.clamp()).unknown(r)},Fc.apply(s,arguments),dv(s)}function FEe(){var t=[],e=[],n=[],r;function s(){var o=0,l=Math.max(1,e.length);for(n=new Array(l-1);++o<l;)n[o-1]=_St(t,o/l);return i}function i(o){return o==null||isNaN(o=+o)?r:e[tT(n,o)]}return i.invertExtent=function(o){var l=e.indexOf(o);return l<0?[NaN,NaN]:[l>0?n[l-1]:t[0],l<n.length?n[l]:t[t.length-1]]},i.domain=function(o){if(!arguments.length)return t.slice();t=[];for(let l of o)l!=null&&!isNaN(l=+l)&&t.push(l);return t.sort(Tg),s()},i.range=function(o){return arguments.length?(e=Array.from(o),s()):e.slice()},i.unknown=function(o){return arguments.length?(r=o,i):r},i.quantiles=function(){return n.slice()},i.copy=function(){return FEe().domain(t).range(e).unknown(r)},Fc.apply(i,arguments)}function $Ee(){var t=0,e=1,n=1,r=[.5],s=[0,1],i;function o(c){return c!=null&&c<=c?s[tT(r,c,0,n)]:i}function l(){var c=-1;for(r=new Array(n);++c<n;)r[c]=((c+1)*e-(c-n)*t)/(n+1);return o}return o.domain=function(c){return arguments.length?([t,e]=c,t=+t,e=+e,l()):[t,e]},o.range=function(c){return arguments.length?(n=(s=Array.from(c)).length-1,l(
1314)):s.slice()},o.invertExtent=function(c){var u=s.indexOf(c);return u<0?[NaN,NaN]:u<1?[t,r[0]]:u>=n?[r[n-1],e]:[r[u-1],r[u]]},o.unknown=function(c){return arguments.length&&(i=c),o},o.thresholds=function(){return r.slice()},o.copy=function(){return $Ee().domain([t,e]).range(s).unknown(i)},Fc.apply(dv(o),arguments)}function zEe(){var t=[.5],e=[0,1],n,r=1;function s(i){return i!=null&&i<=i?e[tT(t,i,0,r)]:n}return s.domain=function(i){return arguments.length?(t=Array.from(i),r=Math.min(t.length,e.length-1),s):t.slice()},s.range=function(i){return arguments.length?(e=Array.from(i),r=Math.min(t.length,e.length-1),s):e.slice()},s.invertExtent=function(i){var o=e.indexOf(i);return[t[o-1],t[o]]},s.unknown=function(i){return arguments.length?(n=i,s):n},s.copy=function(){return zEe().domain(t).range(e).unknown(n)},Fc.apply(s,arguments)}const Qz=new Date,Zz=new Date;function Js(t,e,n,r){function s(i){return t(i=arguments.length===0?new Date:new Date(+i)),i}return s.floor=i=>(t(i=new Date(+i)),i),s.ceil=i=>(t(i=new Date(i-1)),e(i,1),t(i),i),s.round=i=>{const o=s(i),l=s.ceil(i);return i-o<l-i?o:l},s.offset=(i,o)=>(e(i=new Date(+i),o==null?1:Math.floor(o)),i),s.range=(i,o,l)=>{const c=[];if(i=s.ceil(i),l=l==null?1:Math.floor(l),!(i<o)||!(l>0))return c;let u;do c.push(u=new Date(+i)),e(i,l),t(i);while(u<i&&i<o);return c},s.filter=i=>Js(o=>{if(o>=o)for(;t(o),!i(o);)o.setTime(o-1)},(o,l)=>{if(o>=o)if(l<0)for(;++l<=0;)for(;e(o,-1),!i(o););else for(;--l>=0;)for(;e(o,1),!i(o););}),n&&(s.count=(i,o)=>(Qz.setTime(+i),Zz.setTime(+o),t(Qz),t(Zz),Math.floor(n(Qz,Zz))),s.every=i=>(i=Math.floor(i),!isFinite(i)||!(i>0)?null:i>1?s.filter(r?o=>r(o)%i===0:o=>s.count(0,o)%i===0):s)),s}const KD=Js(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);KD.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?Js(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):KD);KD.range;const Df=1e3,Nc=Df*60,Lf=Nc*60,sp=Lf*24,HG=sp*7,Doe=sp*30,eB=sp*365,dx=Js(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*Df)},(t,e)=>(e-t)/Df,t=>t.getUTCSeconds());dx.range;const WG=Js(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Df)},(t,e)=>{t.setTime(+t+e*Nc)},(t,e)=>(e-t)/Nc,t=>t.getMinutes());WG.range;const KG=Js(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*Nc)},(t,e)=>(e-t)/Nc,t=>t.getUTCMinutes());KG.range;const GG=Js(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Df-t.getMinutes()*Nc)},(t,e)=>{t.setTime(+t+e*Lf)},(t,e)=>(e-t)/Lf,t=>t.getHours());GG.range;const YG=Js(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*Lf)},(t,e)=>(e-t)/Lf,t=>t.getUTCHours());YG.range;const sT=Js(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Nc)/sp,t=>t.getDate()-1);sT.range;const lF=Js(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/sp,t=>t.getUTCDate()-1);lF.range;const BEe=Js(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/sp,t=>Math.floor(t/sp));BEe.range;function U0(t){return Js(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,n)=>{e.setDate(e.getDate()+n*7)},(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*Nc)/HG)}const cF=U0(0),GD=U0(1),yNt=U0(2),bNt=U0(3),fj=U0(4),wNt=U0(5),_Nt=U0(6);cF.range;GD.range;yNt.range;bNt.range;fj.range;wNt.range;_Nt.range;function q0(t){return Js(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n*7)},(e,n)=>(n-e)/HG)}const uF=q0(0),YD=q0(1),jNt=q0(2),SNt=q0(3),pj=q0(4),NNt=q0(5),CNt=q0(6);uF.range;YD.range;jNt.range;SNt.range;pj.range;NNt.range;CNt.range;const XG=Js(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());XG.range;const JG=Js(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());JG.range;const ip=Js(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());ip.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:Js(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)});ip.range;const ap=Js(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());ap.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:Js(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)});ap.range;function UEe(t,e,n,r,s,i){const o=[[dx,1,Df],[dx,5,5*Df],[dx,15,15*Df],[dx,30,30*Df],[i,1,Nc],[i,5,5*Nc],[i,15,15*Nc],[i,30,30*Nc],[s,1,Lf],[s,3,3*Lf],[s,6,6*Lf],[s,12,12*Lf],[r,1,sp],[r,2,2*sp],[n,1,HG],[e,1,Doe],[e,3,3*Doe],[t,1,eB]];function l(u,d,h){const f=d<u;f&&([u,d]=[d,u]);const p=h&&typeof h.range=="function"?h:c(u,d,h),m=p?p.range(u,+d+1):[];return f?m.reverse():m}function c(u,d,h){const f=Math.abs(d-u)/h,p=MG(([,,x])=>x).right(o,f);if(p===o.length)return t.every(XV(u/eB,d/eB,h));if(p===0)return KD.every(Math.max(XV(u,d,h),1));const[m,v]=o[f/o[p-1][2]<o[p][2]/f?p-1:p];return m.every(v)}return[l,c]}const[kNt,ANt]=UEe(ap,JG,uF,BEe,YG,KG),[ENt,TNt]=UEe(ip,XG,cF,sT,GG,WG);function tB(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function nB(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function qS(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}function PNt(t){var e=t.dateTime,n=t.date,r=t.time,s=t.periods,i=t.days,o=t.shortDays,l=t.months,c=t.shortMonths,u=VS(s),d=HS(s),h=VS(i),f=HS(i),p=VS(o),m=HS(o),v=VS(l),x=HS(l),g=VS(c),w=HS(c),_={a:O,A:z,b:B,B:G,c:null,d:Uoe,e:Uoe,f:eCt,g:uCt,G:hCt,H:JNt,I:QNt,j:ZNt,L:qEe,m:tCt,M:nCt,p:U,q:F,Q:Hoe,s:Woe,S:rCt,u:sCt,U:iCt,V:aCt,w:oCt,W:lCt,x:null,X:null,y:cCt,Y:dCt,Z:fCt,"%":Voe},j={a:W,A:Q,b:K,B:fe,c:null,d:qoe,e:qoe,f:vCt,g:kCt,G:ECt,H:pCt,I:mCt,j:gCt,L:HEe,m:xCt,M:yCt,p:oe,q:ye,Q:Hoe,s:Woe,S:bCt,u:wCt,U:_Ct,V:jCt,w:SCt,W:NCt,x:null,X:null,y:CCt,Y:ACt,Z:TCt,"%":Voe}
vendor: 9,871 bytes, line 1314
1314,N={a:P,A:T,b:M,B:R,c:A,d:zoe,e:zoe,f:KNt,g:$oe,G:Foe,H:Boe,I:Boe,j:qNt,L:WNt,m:UNt,M:VNt,p:E,q:BNt,Q:YNt,s:XNt,S:HNt,u:DNt,U:LNt,V:FNt,w:INt,W:$Nt,x:I,X:D,y:$oe,Y:Foe,Z:zNt,"%":GNt};_.x=S(n,_),_.X=S(r,_),_.c=S(e,_),j.x=S(n,j),j.X=S(r,j),j.c=S(e,j);function S(le,me){return function(he){var ae=[],re=-1,L=0,X=le.length,ne,Y,J;for(he instanceof Date||(he=new Date(+he));++re<X;)le.charCodeAt(re)===37&&(ae.push(le.slice(L,re)),(Y=Loe[ne=le.charAt(++re)])!=null?ne=le.charAt(++re):Y=ne==="e"?" ":"0",(J=me[ne])&&(ne=J(he,Y)),ae.push(ne),L=re+1);return ae.push(le.slice(L,re)),ae.join("")}}function C(le,me){return function(he){var ae=qS(1900,void 0,1),re=k(ae,le,he+="",0),L,X;if(re!=he.length)return null;if("Q"in ae)return new Date(ae.Q);if("s"in ae)return new Date(ae.s*1e3+("L"in ae?ae.L:0));if(me&&!("Z"in ae)&&(ae.Z=0),"p"in ae&&(ae.H=ae.H%12+ae.p*12),ae.m===void 0&&(ae.m="q"in ae?ae.q:0),"V"in ae){if(ae.V<1||ae.V>53)return null;"w"in ae||(ae.w=1),"Z"in ae?(L=nB(qS(ae.y,0,1)),X=L.getUTCDay(),L=X>4||X===0?YD.ceil(L):YD(L),L=lF.offset(L,(ae.V-1)*7),ae.y=L.getUTCFullYear(),ae.m=L.getUTCMonth(),ae.d=L.getUTCDate()+(ae.w+6)%7):(L=tB(qS(ae.y,0,1)),X=L.getDay(),L=X>4||X===0?GD.ceil(L):GD(L),L=sT.offset(L,(ae.V-1)*7),ae.y=L.getFullYear(),ae.m=L.getMonth(),ae.d=L.getDate()+(ae.w+6)%7)}else("W"in ae||"U"in ae)&&("w"in ae||(ae.w="u"in ae?ae.u%7:"W"in ae?1:0),X="Z"in ae?nB(qS(ae.y,0,1)).getUTCDay():tB(qS(ae.y,0,1)).getDay(),ae.m=0,ae.d="W"in ae?(ae.w+6)%7+ae.W*7-(X+5)%7:ae.w+ae.U*7-(X+6)%7);return"Z"in ae?(ae.H+=ae.Z/100|0,ae.M+=ae.Z%100,nB(ae)):tB(ae)}}function k(le,me,he,ae){for(var re=0,L=me.length,X=he.length,ne,Y;re<L;){if(ae>=X)return-1;if(ne=me.charCodeAt(re++),ne===37){if(ne=me.charAt(re++),Y=N[ne in Loe?me.charAt(re++):ne],!Y||(ae=Y(le,he,ae))<0)return-1}else if(ne!=he.charCodeAt(ae++))return-1}return ae}function E(le,me,he){var ae=u.exec(me.slice(he));return ae?(le.p=d.get(ae[0].toLowerCase()),he+ae[0].length):-1}function P(le,me,he){var ae=p.exec(me.slice(he));return ae?(le.w=m.get(ae[0].toLowerCase()),he+ae[0].length):-1}function T(le,me,he){var ae=h.exec(me.slice(he));return ae?(le.w=f.get(ae[0].toLowerCase()),he+ae[0].length):-1}function M(le,me,he){var ae=g.exec(me.slice(he));return ae?(le.m=w.get(ae[0].toLowerCase()),he+ae[0].length):-1}function R(le,me,he){var ae=v.exec(me.slice(he));return ae?(le.m=x.get(ae[0].toLowerCase()),he+ae[0].length):-1}function A(le,me,he){return k(le,e,me,he)}function I(le,me,he){return k(le,n,me,he)}function D(le,me,he){return k(le,r,me,he)}function O(le){return o[le.getDay()]}function z(le){return i[le.getDay()]}function B(le){return c[le.getMonth()]}function G(le){return l[le.getMonth()]}function U(le){return s[+(le.getHours()>=12)]}function F(le){return 1+~~(le.getMonth()/3)}function W(le){return o[le.getUTCDay()]}function Q(le){return i[le.getUTCDay()]}function K(le){return c[le.getUTCMonth()]}function fe(le){return l[le.getUTCMonth()]}function oe(le){return s[+(le.getUTCHours()>=12)]}function ye(le){return 1+~~(le.getUTCMonth()/3)}return{format:function(le){var me=S(le+="",_);return me.toString=function(){return le},me},parse:function(le){var me=C(le+="",!1);return me.toString=function(){return le},me},utcFormat:function(le){var me=S(le+="",j);return me.toString=function(){return le},me},utcParse:function(le){var me=C(le+="",!0);return me.toString=function(){return le},me}}}var Loe={"-":"",_:" ",0:"0"},ji=/^\s*\d+/,MNt=/^%/,RNt=/[\\^$*+?|[\]().{}]/g;function jn(t,e,n){var r=t<0?"-":"",s=(r?-t:t)+"",i=s.length;return r+(i<n?new Array(n-i+1).join(e)+s:s)}function ONt(t){return t.replace(RNt,"\\$&")}function VS(t){return new RegExp("^(?:"+t.map(ONt).join("|")+")","i")}function HS(t){return new Map(t.map((e,n)=>[e.toLowerCase(),n]))}function INt(t,e,n){var r=ji.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function DNt(t,e,n){var r=ji.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function LNt(t,e,n){var r=ji.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function FNt(t,e,n){var r=ji.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function $Nt(t,e,n){var r=ji.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function Foe(t,e,n){var r=ji.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function $oe(t,e,n){var r=ji.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function zNt(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function BNt(t,e,n){var r=ji.exec(e.slice(n,n+1));return r?(t.q=r[0]*3-3,n+r[0].length):-1}function UNt(t,e,n){var r=ji.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function zoe(t,e,n){var r=ji.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function qNt(t,e,n){var r=ji.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function Boe(t,e,n){var r=ji.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function VNt(t,e,n){var r=ji.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function HNt(t,e,n){var r=ji.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function WNt(t,e,n){var r=ji.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function KNt(t,e,n){var r=ji.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function GNt(t,e,n){var r=MNt.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function YNt(t,e,n){var r=ji.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function XNt(t,e,n){var r=ji.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function Uoe(t,e){return jn(t.getDate(),e,2)}function JNt(t,e){return jn(t.getHours(),e,2)}function QNt(t,e){return jn(t.getHours()%12||12,e,2)}function ZNt(t,e){return jn(1+sT.count(ip(t),t),e,3)}function qEe(t,e){return jn(t.getMilliseconds(),e,3)}function eCt(t,e){return qEe(t,e)+"000"}function tCt(t,e){return jn(t.getMonth()+1,e,2)}function nCt(t,e){return jn(t.getMinutes(),e,2)}function rCt(t,e){return jn(t.getSeconds(),e,2)}function sCt(t){var e=t.getDay();return e===0?7:e}function iCt(t,e){return jn(cF.count(ip(t)-1,t),e,2)}function VEe(t){var e=t.getDay();return e>=4||e===0?fj(t):fj.ceil(t)}function aCt(t,e){return t=VEe(t),jn(fj.count(ip(t),t)+(ip(t).getDay()===4),e,2)}function oCt(t){return t.getDay()}function lCt(t,e){return jn(GD.count(ip(t)-1,t),e,2)}function cCt(t,e){return jn(t.getFullYear()%100,e,2)}function uCt(t,e){return t=VEe(t),jn(t.getFullYear()%100,e,2)}function dCt(t,e){return jn(t.getFullYear()%1e4,e,4)}function hCt(t,e){var n=t.getDay();return t=n>=4||n===0?fj(t):fj.ceil(t),jn(t.getFullYear()%1e4,e,4)}function fCt(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+jn(e/60|0,"0",2)+jn(e%60,"0",2)}function qoe(t,e){return jn(t.getUTCDate(),e,2)}function pCt(t,e){return jn(t.getUTCHours(),e,2)}function mCt(t,e){return jn(t.getUTCHours()%12||12,e,2)}function gCt(t,e){return jn(1+lF.count(ap(t),t),e,3)}function HEe(t,e){return jn(t.getUTCMilliseconds(),e,3)}function vCt(t,e){return HEe(t,e)+"000"}function xCt(t,e){return jn(t.getUTCMonth()+1,e,2)}function yCt(t,e){return jn(t.getUTCMinutes(),e,2)}function bCt(t,e){return jn(t.getUTCSeconds(),e,2)}function wCt(t){var e=t.getUTCDay();return e===0?7:e}function _Ct(t,e){return jn(uF.count(ap(t)-1,t),e,2)}function WEe(t){var e=t.getUTCDay();return e>=4||e===0?pj(t):pj.ceil(t)}function jCt(t,e){return t=WEe(t),jn(pj.count(ap(t),t)+(ap(t).getUTCDay()===4),e,2)}function SCt(t){return t.getUTCDay()}function NCt(t,e){return jn(YD.count(ap(t)-1,t),e,2)}function CCt(t,e){return jn(t.getUTCFullYear()%100,e,2)}function kCt(t,e){return t=WEe(t),jn(t.getUTCFullYear()%100,e,2)}function ACt(t,e){return jn(t.getUTCFullYear()%1e4,e,4)}function ECt(t,e){var n=t.getUTCDay();return t=n>=4||n===0?pj(t):pj.ceil(t),jn(t.getUTCFullYear()%1e4,e,4)}function TCt(){return"+0000"}function Voe(){return"%"}function Hoe(t){return+t}function Woe(t){return Math.floor(+t/1e3)}var gb,KEe,GEe;PCt({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 PCt(t){return gb=PNt(t),KEe=gb.format,gb.parse,GEe=gb.utcFormat,gb.utcParse,gb}function MCt(t){return new Date(t)}function RCt(t){return t instanceof Date?+t:+new Date(+t)}function QG(t,e,n,r,s,i,o,l,c,u){var d=FG(),h=d.invert,f=d.domain,p=u(".%L"),m=u(":%S"),v=u("%I:%M"),x=u("%I %p"),g=u("%a %d"),w=u("%b %d"),_=u("%B"),j=u("%Y");function N(S){return(c(S)<S?p:l(S)<S?m:o(S)<S?v:i(S)<S?x:r(S)<S?s(S)<S?g:w:n(S)<S?_:j)(S)}return d.invert=function(S){return new Date(h(S))},d.domain=function(S){return arguments.length?f(Array.from(S,RCt)):f().map(MCt)},d.ticks=function(S){var C=f();return t(C[0],C[C.length-1],S??10)},d.tickFormat=function(S,C){return C==null?N:u(C)},d.nice=function(S){var C=f();return(!S||typeof S.range!="function")&&(S=e(C[0],C[C.length-1],S??10)),S?f(OEe(C,S)):d},d.copy=function(){return rT(d,QG(t,e,n,r,s,i,o,l,c,u))},d}function OCt(){return Fc.apply(QG(ENt,TNt,ip,XG,cF,sT,GG,WG,dx,KEe).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function ICt(){return Fc.apply(QG(kNt,ANt,ap,JG,uF,lF,YG,KG,dx,GEe).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function dF(){var t=0,e=1,n,r,s,i,o=ao,l=!1,c;function u(h){return h==null||isNaN(h=+h)?c:o(s===0?.5:(h=(i(h)-n)*s,l?Math.max(0,Math.min(1,h)):h))}u.domain=function(h){return arguments.length?([t,e]=h,n=i(t=+t),r=i(e=+e),s=n===r?0:1/(r-n),u):[t,e]},u.clamp=function(h){return arguments.length?(l=!!h,u):l},u.interpolator=function(h){return arguments.length?(o=h,u):o};function d(h){return function(f){var p,m;
1314return arguments.length?([p,m]=f,o=h(p,m),u):[o(0),o(1)]}}return u.range=d(Zj),u.rangeRound=d(LG),u.unknown=function(h){return arguments.length?(c=h,u):c},function(h){return i=h,n=h(t),r=h(e),s=n===r?0:1/(r-n),u}}function hv(t,e){return e.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function YEe(){var t=dv(dF()(ao));return t.copy=function(){return hv(t,YEe())},yp.apply(t,arguments)}function XEe(){var t=BG(dF()).domain([1,10]);return t.copy=function(){return hv(t,XEe()).base(t.base())},yp.apply(t,arguments)}function JEe(){var t=UG(dF());return t.copy=function(){return hv(t,JEe()).constant(t.constant())},yp.apply(t,arguments)}function ZG(){var t=qG(dF());return t.copy=function(){return hv(t,ZG()).exponent(t.exponent())},yp.apply(t,arguments)}function DCt(){return ZG.apply(null,arguments).exponent(.5)}function QEe(){var t=[],e=ao;function n(r){if(r!=null&&!isNaN(r=+r))return e((tT(t,r,1)-1)/(t.length-1))}return n.domain=function(r){if(!arguments.length)return t.slice();t=[];for(let s of r)s!=null&&!isNaN(s=+s)&&t.push(s);return t.sort(Tg),n},n.interpolator=function(r){return arguments.length?(e=r,n):e},n.range=function(){return t.map((r,s)=>e(s/(t.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(s,i)=>wSt(t,i/r))},n.copy=function(){return QEe(e).domain(t)},yp.apply(n,arguments)}function hF(){var t=0,e=.5,n=1,r=1,s,i,o,l,c,u=ao,d,h=!1,f;function p(v){return isNaN(v=+v)?f:(v=.5+((v=+d(v))-i)*(r*v<r*i?l:c),u(h?Math.max(0,Math.min(1,v)):v))}p.domain=function(v){return arguments.length?([t,e,n]=v,s=d(t=+t),i=d(e=+e),o=d(n=+n),l=s===i?0:.5/(i-s),c=i===o?0:.5/(o-i),r=i<s?-1:1,p):[t,e,n]},p.clamp=function(v){return arguments.length?(h=!!v,p):h},p.interpolator=function(v){return arguments.length?(u=v,p):u};function m(v){return function(x){var g,w,_;return arguments.length?([g,w,_]=x,u=GSt(v,[g,w,_]),p):[u(0),u(.5),u(1)]}}return p.range=m(Zj),p.rangeRound=m(LG),p.unknown=function(v){return arguments.length?(f=v,p):f},function(v){return d=v,s=v(t),i=v(e),o=v(n),l=s===i?0:.5/(i-s),c=i===o?0:.5/(o-i),r=i<s?-1:1,p}}function ZEe(){var t=dv(hF()(ao));return t.copy=function(){return hv(t,ZEe())},yp.apply(t,arguments)}function e2e(){var t=BG(hF()).domain([.1,1,10]);return t.copy=function(){return hv(t,e2e()).base(t.base())},yp.apply(t,arguments)}function t2e(){var t=UG(hF());return t.copy=function(){return hv(t,t2e()).constant(t.constant())},yp.apply(t,arguments)}function eY(){var t=qG(hF());return t.copy=function(){return hv(t,eY()).exponent(t.exponent())},yp.apply(t,arguments)}function LCt(){return eY.apply(null,arguments).exponent(.5)}const n2e=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:OG,scaleDiverging:ZEe,scaleDivergingLog:e2e,scaleDivergingPow:eY,scaleDivergingSqrt:LCt,scaleDivergingSymlog:t2e,scaleIdentity:REe,scaleImplicit:JV,scaleLinear:MEe,scaleLog:IEe,scaleOrdinal:RG,scalePoint:SSt,scalePow:VG,scaleQuantile:FEe,scaleQuantize:$Ee,scaleRadial:LEe,scaleSequential:YEe,scaleSequentialLog:XEe,scaleSequentialPow:ZG,scaleSequentialQuantile:QEe,scaleSequentialSqrt:DCt,scaleSequentialSymlog:JEe,scaleSqrt:vNt,scaleSymlog:DEe,scaleThreshold:zEe,scaleTime:OCt,scaleUtc:ICt,tickFormat:PEe},Symbol.toStringTag,{value:"Module"}));function FCt(t){var e=n2e;if(t in e&&typeof e[t]=="function")return e[t]();var n="scale".concat(B2(t));if(n in e&&typeof e[n]=="function")return e[n]()}function Koe(t,e,n){if(typeof t=="function")return t.copy().domain(e).range(n);if(t!=null){var r=FCt(t);if(r!=null)return r.domain(e).range(n),r}}function tY(t,e,n,r){if(!(n==null||r==null))return typeof t.scale=="function"?Koe(t.scale,n,r):Koe(e,n,r)}function $Ct(t){return"scale".concat(B2(t))}function zCt(t){return $Ct(t)in n2e}var r2e=(t,e,n)=>{if(t!=null){var r=t.scale,s=t.type;if(r==="auto")return s==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>
1314=0||n.indexOf("ComposedChart")>=0&&!e)?"point":s==="category"?"band":"linear";if(typeof r=="string")return zCt(r)?r:"point"}};function BCt(t,e){for(var n=0,r=t.length,s=t[0]<t[t.length-1];n<r;){var i=Math.floor((n+r)/2);(s?t[i]<e:t[i]>e)?n=i+1:r=i}return n}function s2e(t,e){if(t){var n=e??t.domain(),r=n.map(i=>{var o;return(o=t(i))!==null&&o!==void 0?o:0}),s=t.range();if(!(n.length===0||s.length<2))return i=>{var o,l,c=BCt(r,i);if(c<=0)return n[0];if(c>=n.length)return n[n.length-1];var u=(o=r[c-1])!==null&&o!==void 0?o:0,d=(l=r[c])!==null&&l!==void 0?l:0;return Math.abs(i-u)<=Math.abs(i-d)?n[c-1]:n[c]}}}function UCt(t){if(t!=null)return"invert"in t&&typeof t.invert=="function"?t.invert.bind(t):s2e(t,void 0)}function Goe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function XD(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Goe(Object(n),!0).forEach(function(r){qCt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Goe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function qCt(t,e,n){return(e=VCt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function VCt(t){var e=HCt(t,"string");return typeof e=="symbol"?e:e+""}function HCt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function i2e(t,e){return YCt(t)||GCt(t,e)||KCt(t,e)||WCt()}function WCt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 1315In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function KCt(t,e){if(t){if(typeof t=="string")return Yoe(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Yoe(t,e):void 0}}function Yoe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function GCt(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,u=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function YCt(t){if(Array.isArray(t))return t}var tH=[0,"auto"],Is={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:void 0,height:30,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"bottom",padding:{left:0,right:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"category",unit:void 0,niceTicks:"auto"},a2e=(t,e)=>t.cartesianAxis.xAxis[e],bp=(t,e)=>{var n=a2e(t,e);return n??Is},Ds={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:tH,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"left",padding:{top:0,bottom:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"number",unit:void 0,niceTicks:"auto",width:H2},o2e=(t,e)=>t.cartesianAxis.yAxis[e],wp=(t,e)=>{var n=o2e(t,e);return n??Ds},XCt={domain:[0,"auto"],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:"",range:[64,64],scale:"auto",type:"number",unit:""},nY=(t,e)=>{var n=t.cartesianAxis.zAxis[e];return n??XCt},ls=(t,e,n)=>{switch(e){case"xAxis":return bp(t,n);case"yAxis":return wp(t,n);case"zAxis":return nY(t,n);case"angleAxis":return kG(t,n);case"radiusAxis":return AG(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}}
1315,JCt=(t,e,n)=>{switch(e){case"xAxis":return bp(t,n);case"yAxis":return wp(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},eS=(t,e,n)=>{switch(e){case"xAxis":return bp(t,n);case"yAxis":return wp(t,n);case"angleAxis":return kG(t,n);case"radiusAxis":return AG(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},l2e=t=>t.graphicalItems.cartesianItems.some(e=>e.type==="bar")||t.graphicalItems.polarItems.some(e=>e.type==="radialBar");function rY(t,e){return n=>{switch(t){case"xAxis":return"xAxisId"in n&&n.xAxisId===e;case"yAxis":return"yAxisId"in n&&n.yAxisId===e;case"zAxis":return"zAxisId"in n&&n.zAxisId===e;case"angleAxis":return"angleAxisId"in n&&n.angleAxisId===e;case"radiusAxis":return"radiusAxisId"in n&&n.radiusAxisId===e;default:return!1}}}var sY=t=>t.graphicalItems.cartesianItems,QCt=we([Br,eT],rY),iY=(t,e,n)=>t.filter(n).filter(r=>(e==null?void 0:e.includeHidden)===!0?!0:!r.hide),tS=we([sY,ls,QCt],iY,{memoizeOptions:{resultEqualityCheck:aF}}),c2e=we([tS],t=>t.filter(e=>e.type==="area"||e.type==="bar").filter(sF)),u2e=t=>t.filter(e=>!("stackId"in e)||e.stackId===void 0),ZCt=we([tS],u2e),aY=t=>t.map(e=>e.data).filter(Boolean).flat(1),ekt=we([tS],t=>t.some(e=>!e.data)),d2e=we([tS],aY,{memoizeOptions:{resultEqualityCheck:aF}}),oY=(t,e)=>{var n=e.chartData,r=n===void 0?[]:n,s=e.dataStartIndex,i=e.dataEndIndex;return t.length>0?t:r.slice(s,i+1)},lY=we([d2e,eF],oY),h2e=(t,e,n)=>(e==null?void 0:e.dataKey)!=null?t.map(r=>({value:Qn(r,e.dataKey)})):n.length>0?n.map(r=>r.dataKey).flatMap(r=>t.map(s=>({value:Qn(s,r)}))):t.map(r=>({value:r})),f2e=(t,e,n,r,s,i)=>{var o=r.chartData,l=o===void 0?[]:o,c=r.dataStartIndex,u=r.dataEndIndex,d=h2e(t,e,n);if(s&&(e==null?void 0:e.dataKey)!=null&&i.length>0){var h=l.slice(c,u+1),f=h.map(p=>({value:Qn(p,e.dataKey)})).filter(p=>p.value!=null);return[...f,...d]}return d},iT=we([lY,ls,tS,eF,ekt,d2e],f2e);function Hw(t){if(mh(t)||t instanceof Date){var e=Number(t);if(An(e))return e}}function Xoe(t){if(Array.isArray(t)){var e=[Hw(t[0]),Hw(t[1])];return nh(e)?e:void 0}var n=Hw(t);if(n!=null)return[n,n]}function vh(t){return t.map(Hw).filter(Kd)}function tkt(t,e){var n=Hw(t),r=Hw(e);return n==null&&r==null?0:n==null?-1:r==null?1:n-r}var nkt=we([iT],t=>t==null?void 0:t.map(e=>e.value).sort(tkt));function p2e(t,e){switch(t){case"xAxis":return e.direction==="x";case"yAxis":return e.direction==="y";default:return!1}}function rkt(t,e,n){if(!n)return[];if(!n.length)return[];var r;if(typeof e=="number"&&!ph(e))r=e;else if(Array.isArray(e)){var s=vh(e);s.length>0&&(r=Math.max(...s))}return r==null?[]:vh(n.flatMap(i=>{var o=Qn(t,i.dataKey),l,c;if(Array.isArray(o)){var u=i2e(o,2);l=u[0],c=u[1]}else l=c=o;if(!(!An(l)||!An(c)))return[r-l,r+c]}))}var Qs=t=>{var e=_i(t),n=Qj(t);return eS(t,e,n)},mj=we([Qs],t=>t==null?void 0:t.dataKey),skt=we([c2e,eF,Qs],bEe),m2e=(t,e,n,r)=>{var s={},i=e.reduce((o,l)=>{if(l.stackId==null)return o;var c=o[l.stackId];return c==null&&(c=[]),c.push(l),o[l.stackId]=c,o},s);return Object.fromEntries(Object.entries(i).map(o=>{var l=i2e(o,2),c=l[0],u=l[1],d=r?[...u].reverse():u,h=d.map(TG);return[c,{stackedData:nwt(t,h,n),graphicalItems:d}]}))},nH=we([skt,c2e,Z2,fEe],m2e),g2e=(t,e,n,r)=>{var s=e.dataStartIndex,i=e.dataEndIndex;if(r==null&&n!=="zAxis")return owt(t,s,i)},ikt=we([ls],t=>t.allowDataOverflow),cY=t=>{var e;if(t==null||!("domain"in t))return tH;if(t.domain!=null)return t.domain;if("ticks"in t&&t.ticks!=null){if(t.type==="number"){var n=vh(t.ticks);return[Math.min(...n),Math.max(...n)]}if(t.type==="category")return t.ticks.map(String)}return(e=t==null?void 0:t.domain)!==null&&e!==void 0?e:tH},uY=we([ls],cY),dY=we([uY,ikt],eEe),akt=we([nH,Gu,Br,dY],g2e,{memoizeOptions:{resultEqualityCheck:iF}}),fF=t=>t.errorBars,okt=(t,e,n)=>t.flatMap(r=>e[r.id]).filter(Boolean).filter(r=>p2e(n,r)),JD=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];
1315var s=n.filter(Boolean);if(s.length!==0){var i=s.flat(),o=Math.min(...i),l=Math.max(...i);return[o,l]}},hY=function(e,n,r,s,i){var o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:[],l,c;if(r.length>0&&r.forEach(u=>{var d,h=u.data!=null?[...u.data]:o,f=(d=s[u.id])===null||d===void 0?void 0:d.filter(p=>p2e(i,p));h.forEach(p=>{var m,v=Qn(p,(m=n.dataKey)!==null&&m!==void 0?m:u.dataKey),x=rkt(p,v,f);if(x.length>=2){var g=Math.min(...x),w=Math.max(...x);(l==null||g<l)&&(l=g),(c==null||w>c)&&(c=w)}var _=Xoe(v);_!=null&&(l=l==null?_[0]:Math.min(l,_[0]),c=c==null?_[1]:Math.max(c,_[1]))})}),(n==null?void 0:n.dataKey)!=null&&r.length===0&&e.forEach(u=>{var d=Xoe(Qn(u,n.dataKey));d!=null&&(l=l==null?d[0]:Math.min(l,d[0]),c=c==null?d[1]:Math.max(c,d[1]))}),An(l)&&An(c))return[l,c]},lkt=we([lY,ls,ZCt,fF,Br,$jt],hY,{memoizeOptions:{resultEqualityCheck:iF}});function ckt(t){var e=t.value;if(mh(e)||e instanceof Date)return e}var ukt=(t,e,n)=>{var r=t.map(ckt).filter(s=>s!=null);return n&&(e.dataKey==null||e.allowDuplicatedCategory&&jke(r))?ZAe(0,t.length):e.allowDuplicatedCategory?r:Array.from(new Set(r))},v2e=t=>t.referenceElements.dots,nS=(t,e,n)=>t.filter(r=>r.ifOverflow==="extendDomain").filter(r=>e==="xAxis"?r.xAxisId===n:r.yAxisId===n),dkt=we([v2e,Br,eT],nS),x2e=t=>t.referenceElements.areas,hkt=we([x2e,Br,eT],nS),y2e=t=>t.referenceElements.lines,fkt=we([y2e,Br,eT],nS),b2e=(t,e)=>{if(t!=null){var n=vh(t.map(r=>e==="xAxis"?r.x:r.y));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},pkt=we(dkt,Br,b2e),w2e=(t,e)=>{if(t!=null){var n=vh(t.flatMap(r=>[e==="xAxis"?r.x1:r.y1,e==="xAxis"?r.x2:r.y2]));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},mkt=we([hkt,Br],w2e);function gkt(t){var e;if(t.x!=null)return vh([t.x]);var n=(e=t.segment)===null||e===void 0?void 0:e.map(r=>r.x);return n==null||n.length===0?[]:vh(n)}function vkt(t){var e;if(t.y!=null)return vh([t.y]);var n=(e=t.segment)===null||e===void 0?void 0:e.map(r=>r.y);return n==null||n.length===0?[]:vh(n)}var _2e=(t,e)=>{if(t!=null){var n=t.flatMap(r=>e==="xAxis"?gkt(r):vkt(r));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},xkt=we([fkt,Br],_2e),ykt=we(pkt,xkt,mkt,(t,e,n)=>JD(t,n,e)),fY=(t,e,n,r,s,i,o,l)=>{if(n!=null)return n;var c=o==="vertical"&&l==="xAxis"||o==="horizontal"&&l==="yAxis",u=c?JD(r,i,s):JD(i,s);return Wjt(e,u,t.allowDataOverflow)},bkt=we([ls,uY,dY,akt,lkt,ykt,Rn,Br],fY,{memoizeOptions:{resultEqualityCheck:iF}}),wkt=[0,1],pY=(t,e,n,r,s,i,o)=>{if(!((t==null||n==null||n.length===0)&&o===void 0)){var l=t.dataKey,c=t.type,u=uv(e,i);if(u&&l==null){var d;return ZAe(0,(d=n==null?void 0:n.length)!==null&&d!==void 0?d:0)}return c==="category"?ukt(r,t,u):s==="expand"&&!u?wkt:o}},mY=we([ls,Rn,lY,iT,Z2,Br,bkt],pY),fv=we([ls,l2e,SG],r2e),gY=(t,e,n)=>{var r=e.niceTicks;if(r!=="none"){var s=cY(e),i=Array.isArray(s)&&(s[0]==="auto"||s[1]==="auto");if((r==="snap125"||r==="adaptive")&&e!=null&&e.tickCount&&nh(t)){if(i)return ioe(t,e.tickCount,e.allowDecimals,r);if(e.type==="number")return aoe(t,e.tickCount,e.allowDecimals,r)}if(r==="auto"&&n==="linear"&&e!=null&&e.tickCount){if(i&&nh(t))return ioe(t,e.tickCount,e.allowDecimals,"adaptive");if(e.type==="number"&&nh(t))return aoe(t,e.tickCount,e.allowDecimals,"adaptive")}}},vY=we([mY,eS,fv],gY),xY=(t,e,n,r)=>{if(r!=="angleAxis"&&(t==null?void 0:t.type)==="number"&&nh(e)&&Array.isArray(n)&&n.length>0){var s,i,o=e[0],l=(s=n[0])!==null&&s!==void 0?s:0,c=e[1],u=(i=n[n.length-1])!==null&&i!==void 0?i:0;return[Math.min(o,l),Math.max(c,u)]}return e},_kt=we([ls,mY,vY,Br],xY),jkt=we(iT,ls,(t,e)=>{if(!(!e||e.type!=="number")){var n=1/0,r=Array.from(vh(t.map(h=>h.value))).sort((h,f)=>h-f),s=r[0],i=r[r.length-1];if(s==null||i==null)return 1/0;var o=i-s;if(o===0)return 1/0;for(var l=0;l<r.length-1;l++){var c=r[l],u=r[l+1];if(!(c==null||u==null)){var d=u-c;n=Math.min(n,d)}}return n/o}}),j2e=we(jkt,Rn,hEe,Xs,(t,e,n,r,s)=>s,(t,e,n,r,s)=>{if(!An(t))return 0;var i=e==="vertical"?r.height:r.width;if(s==="gap")return t*i/2;if(s==="no-gap"){var o=Ta(n,t*i),l=t*i/2;return l-o-(l-o)/i*o}return 0}),Skt=(t,e,n)=>{var r=bp(t,e);return r==null||typeof r.padding!="string"?0:j2e(t,"xAxis",e,n,r.padding)},Nkt=(t,e,n)=>{var r=wp(t,e);return r==null||typeof r.padding!="string"?0:j2e(t,"yAxis",e,n,r.padding)},Ckt=we(bp,Skt,(t,e)=>{var n,r;if(t==null)return{left:0,right:0};var s=t.padding;return typeof s=="string"?{left:e,right:e}:{left:((n=s.left)!==null&&n!==void 0?n:0)+e,right:((r=s.right)!==null&&r!==void 0?r:0)+e}}),kkt=we(wp,Nkt,(t,e)=>{var n,r;if(t==null)return{top:0,bottom:0};var s=t.padding;return typeof s=="string"?{top:e,bottom:e}:{top:((n=s.top)!==null&&n!==void 0?n:0)+e,bottom:((r=s.bottom)!==null&&r!==void 0?r:0)+e}}),S2e=we([Xs,Ckt,Y4,G4,(t,e,n)=>n],(t,e,n,r,s)=>{var i=r.padding;return s?[i.left,n.width-i.right]:[t.left+e.left,t.left+t.width-e.right]}),N2e=we([Xs,Rn,kkt,Y4,G4,(t,e,n)=>n],(t,e,n,r,s,i)=>{var o=s.padding;return i?[r.height-o.bottom,o.top]:e==="horizontal"?[t.top+t.height-n.bottom,t.top+n.top]:[t.top+n.top,t.top+t.height-n.bottom]}),aT=(t,e,n,r)=>{var s;switch(e){case"xAxis":return S2e(t,n,r);case"yAxis":return N2e(t,n,r);case"zAxis":return(s=nY(t,n))===null||s===void 0?void 0:s.range;case"angleAxis":return vEe(t);case"radiusAxis":return xEe(t,n);default:return}},C2e=we([ls,aT],tF),Akt=we([fv,_kt],wEe),yY=we([ls,fv,Akt,C2e],tY),k2e=(t,e,n,r)=>{if(!(n==null||n.dataKey==null)){var s=n.type,i=n.scale,o=uv(t,r);
1315if(o&&(s==="number"||i!=="auto"))return e.map(l=>l.value)}},bY=we([Rn,iT,eS,Br],k2e),pF=we([yY],PG);we([yY],UCt);we([yY,nkt],s2e);we([tS,fF,Br],okt);function A2e(t,e){return t.id<e.id?-1:t.id>e.id?1:0}var mF=(t,e)=>e,gF=(t,e,n)=>n,Ekt=we(W4,mF,gF,(t,e,n)=>t.filter(r=>r.orientation===e).filter(r=>r.mirror===n).sort(A2e)),Tkt=we(K4,mF,gF,(t,e,n)=>t.filter(r=>r.orientation===e).filter(r=>r.mirror===n).sort(A2e)),E2e=(t,e)=>({width:t.width,height:e.height}),Pkt=(t,e)=>{var n=typeof e.width=="number"?e.width:H2;return{width:n,height:t.height}},T2e=we(Xs,bp,E2e),Mkt=(t,e,n)=>{switch(e){case"top":return t.top;case"bottom":return n-t.bottom;default:return 0}},Rkt=(t,e,n)=>{switch(e){case"left":return t.left;case"right":return n-t.right;default:return 0}},Okt=we(xp,Xs,Ekt,mF,gF,(t,e,n,r,s)=>{var i={},o;return n.forEach(l=>{var c=E2e(e,l);o==null&&(o=Mkt(e,r,t));var u=r==="top"&&!s||r==="bottom"&&s;i[l.id]=o-Number(u)*c.height,o+=(u?-1:1)*c.height}),i}),Ikt=we(vp,Xs,Tkt,mF,gF,(t,e,n,r,s)=>{var i={},o;return n.forEach(l=>{var c=Pkt(e,l);o==null&&(o=Rkt(e,r,t));var u=r==="left"&&!s||r==="right"&&s;i[l.id]=o-Number(u)*c.width,o+=(u?-1:1)*c.width}),i}),Dkt=(t,e)=>{var n=bp(t,e);if(n!=null)return Okt(t,n.orientation,n.mirror)},Lkt=we([Xs,bp,Dkt,(t,e)=>e],(t,e,n,r)=>{if(e!=null){var s=n==null?void 0:n[r];return s==null?{x:t.left,y:0}:{x:t.left,y:s}}}),Fkt=(t,e)=>{var n=wp(t,e);if(n!=null)return Ikt(t,n.orientation,n.mirror)},$kt=we([Xs,wp,Fkt,(t,e)=>e],(t,e,n,r)=>{if(e!=null){var s=n==null?void 0:n[r];return s==null?{x:0,y:t.top}:{x:s,y:t.top}}}),P2e=we(Xs,wp,(t,e)=>{var n=typeof e.width=="number"?e.width:H2;return{width:n,height:t.height}}),Joe=(t,e,n)=>{switch(e){case"xAxis":return T2e(t,n).width;case"yAxis":return P2e(t,n).height;default:return}},M2e=(t,e,n,r)=>{if(n!=null){var s=n.allowDuplicatedCategory,i=n.type,o=n.dataKey,l=uv(t,r),c=e.map(d=>d.value),u=c.filter(d=>d!=null);if(o&&l&&i==="category"&&s&&jke(u))return c}},wY=we([Rn,iT,ls,Br],M2e);we([Rn,JCt,fv,pF,wY,bY,aT,vY,Br],(t,e,n,r,s,i,o,l,c)=>{if(e!=null){var u=uv(t,c);return{angle:e.angle,interval:e.interval,minTickGap:e.minTickGap,orientation:e.orientation,tick:e.tick,tickCount:e.tickCount,tickFormatter:e.tickFormatter,ticks:e.ticks,type:e.type,unit:e.unit,axisType:c,categoricalDomain:i,duplicateDomain:s,isCategorical:u,niceTicks:l,range:o,realScaleType:n,scale:r}}});var zkt=(t,e,n,r,s,i,o,l,c)=>{if(!(e==null||r==null)){var u=uv(t,c),d=e.type,h=e.ticks,f=e.tickCount,p=n==="scaleBand"&&typeof r.bandwidth=="function"?r.bandwidth()/2:2,m=d==="category"&&r.bandwidth?r.bandwidth()/p:0;m=c==="angleAxis"&&i!=null&&i.length>=2?Vi(i[0]-i[1])*2*m:m;var v=h||s;return v?v.map((x,g)=>{var w=o?o.indexOf(x):x,_=r.map(w);return An(_)?{index:g,coordinate:_+m,value:x,offset:m}:null}).filter(Kd):u&&l?l.map((x,g)=>{var w=r.map(x);return An(w)?{coordinate:w+m,value:x,index:g,offset:m}:null}).filter(Kd):r.ticks?r.ticks(f).map((x,g)=>{var w=r.map(x);return An(w)?{coordinate:w+m,value:x,index:g,offset:m}:null}).filter(Kd):r.domain().map((x,g)=>{var w=r.map(x);return An(w)?{coordinate:w+m,value:o?o[x]:x,index:g,offset:m}:null}).filter(Kd)}},R2e=we([Rn,eS,fv,pF,vY,aT,wY,bY,Br],zkt),Bkt=(t,e,n,r,s,i,o)=>{if(!(e==null||n==null||r==null||r[0]===r[1])){var l=uv(t,o),c=e.tickCount,u=0;return u=o==="angleAxis"&&(r==null?void 0:r.length)>=2?Vi(r[0]-r[1])*2*u:u,l&&i?i.map((d,h)=>{var f=n.map(d);return An(f)?{coordinate:f+u,value:d,index:h,offset:u}:null}).filter(Kd):n.ticks?n.ticks(c).map((d,h)=>{var f=n.map(d);return An(f)?{coordinate:f+u,value:d,index:h,offset:u}:null}).filter(Kd):n.domain().map((d,h)=>{var f=n.map(d);return An(f)?{coordinate:f+u,value:s?s[d]:d,index:h,offset:u}:null}).filter(Kd)}},gj=we([Rn,eS,pF,aT,wY,bY,Br],Bkt),vj=we(ls,pF,(t,e)=>{if(!(t==null||e==null))return XD(XD({},t),{},{scale:e})}),Ukt=we([ls,fv,mY,C2e],tY),qkt=we([Ukt],PG);we((t,e,n)=>nY(t,n),qkt,(t,e)=>{if(!(t==null||e==null))return XD(XD({},t),{},{scale:e})});var Vkt=we([Rn,W4,K4],(t,e,n)=>{switch(t){case"horizontal":return e.some(r=>r.reversed)?"right-to-left":"left-to-right";case"vertical":return n.some(r=>r.reversed)?"bottom-to-top":"top-to-bottom";case"centric":case"radial":return"left-to-right";default:return}}),Hkt=(t,e,n)=>{var r;return(r=t.renderedTicks[e])===null||r===void 0?void 0:r[n]};we([Hkt],t=>{if(!(!t||t.length===0))return e=>{var n,r=1/0,s=t[0];for(var i of t){var o=Math.abs(i.coordinate-e);o<r&&(r=o,s=i)}return(n=s)===null||n===void 0?void 0:n.value}});var O2e=t=>t.options.defaultTooltipEventType,I2e=t=>t.options.validateTooltipEventTypes;function D2e(t,e,n){if(t==null)return e;var r=t?"axis":"item";return n==null?e:n.includes(r)?r:e}function oT(t,e){var n=O2e(t),r=I2e(t);return D2e(e,n,r)}function Wkt(t){return mt(e=>oT(e,t))}var L2e=(t,e)=>{var n,r=Number(e);if(!(ph(r)||e==null))return r>=0?t==null||(n=t[r])===null||n===void 0?void 0:n.value:void 0},Kkt=t=>t.tooltip.settings,rm={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},Gkt={itemInteraction:{click:rm,hover:rm},axisInteraction:{click:rm,hover:rm},keyboardInteraction:rm,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:"hover",axisId:0,active:!1,defaultIndex:void 0}},F2e=Ba({name:"tooltip",initialState:Gkt,reducers:{addTooltipEntrySettings:{reducer(t,e){t.tooltipItemPayloads.push(e.payload)},prepare:xr()},replaceTooltipEntrySettings:{reducer(t,e){var n=e.payload,r=n.prev,s=n.next,i=Sc(t).tooltipItemPayloads.indexOf(r);i>-1&&(t.tooltipItemPayloads[i]=s)},prepare:xr()},removeTooltipEntrySettings:{reducer(t,e){var n=Sc(t).tooltipItemPayloads.indexOf(e.payload);n>-1&&t.tooltipItemPayloads.splice(n,1)},prepare:xr()},setTooltipSettingsState(t,e){t.settings=e.payload},setActiveMouseOverItemIndex(t,e){t.syncInteraction.active=!1,t.syncInteraction.sourceViewBox=void 0,t.keyboardInteraction.active=!1,t.itemInteraction.hover.active=!0,t.itemInteraction.hover.index=e.payload.activeIndex,t.itemInteraction.hover.dataKey=e.payload.activeDataKey,t.itemInteraction.hover.graphicalItemId=e.payload.activeGraphicalItemId,t.itemInteraction.hover.coordinate=e.payload.activeCoordinate},mouseLeaveChart(t){t.itemInteraction.hover.active=!1,t.axisInteraction.hover.active=!1},mouseLeaveItem(t){t.itemInteraction.hover.active=!1},setActiveClickItemIndex(t,e){t.syncInteraction.active=!1,t.syncInteraction.sourceViewBox=void 0,t.itemInteraction.click.active=!0,t.keyboardInteraction.active=!1,t.itemInteraction.click.index=e.payload.activeIndex,t.itemInteraction.click.dataKey=e.payload.activeDataKey,t.itemInteraction.click.graphicalItemId=e.payload.activeGraphicalItemId,t.itemInteraction.click.coordinate=e.payload.activeCoordinate},setMouseOverAxisIndex(t,e){t.syncInteraction.active=!1,t.syncInteraction.sourceViewBox=void 0,t.axisInteraction.hover.active=!0,t.keyboardInteraction.active=!1,t.axisInteraction.hover.index=e.payload.activeIndex,t.axisInteraction.hover.dataKey=e.payload.activeDataKey,t.axisInteraction.hover.coordinate=e.payload.activeCoordinate},setMouseClickAxisIndex(t,e){t.syncInteraction.active=!1,t.syncInteraction.sourceViewBox=void 0,t.keyboardInteraction.active=!1,t.axisInteraction.click.active=!0,t.axisInteraction.click.index=e.payload.activeIndex,t.axisInteraction.click.dataKey=e.payload.activeDataKey,t.axisInteraction.click.coordinate=e.payload.activeCoordinate},setSyncInteraction(t,e){t.syncInteraction=e.payload},setKeyboardInteraction(t,e){t.keyboardInteraction.active=e.payload.active,t.keyboardInteraction.index=e.payload.activeIndex,t.keyboardInteraction.coordinate=e.payload.activeCoordinate}}}),$c=F2e.actions,Ykt=$c.addTooltipEntrySettings,Xkt=$c.replaceTooltipEntrySettings,Jkt=$c.removeTooltipEntrySettings,Qkt=$c.setTooltipSettingsState,$2e=$c.setA
1315ctiveMouseOverItemIndex,Zkt=$c.mouseLeaveItem,z2e=$c.mouseLeaveChart,eAt=$c.setActiveClickItemIndex,B2e=$c.setMouseOverAxisIndex,tAt=$c.setMouseClickAxisIndex,XN=$c.setSyncInteraction,QD=$c.setKeyboardInteraction,nAt=F2e.reducer;function Qoe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function iM(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Qoe(Object(n),!0).forEach(function(r){rAt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Qoe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function rAt(t,e,n){return(e=sAt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function sAt(t){var e=iAt(t,"string");return typeof e=="symbol"?e:e+""}function iAt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function aAt(t,e,n){return e==="axis"?n==="click"?t.axisInteraction.click:t.axisInteraction.hover:n==="click"?t.itemInteraction.click:t.itemInteraction.hover}function oAt(t){return t.index!=null}var U2e=(t,e,n,r)=>{if(e==null)return rm;var s=aAt(t,e,n);if(s==null)return rm;if(s.active)return s;if(t.keyboardInteraction.active)return t.keyboardInteraction;if(t.syncInteraction.active&&t.syncInteraction.index!=null)return t.syncInteraction;var i=t.settings.active===!0;if(oAt(s)){if(i)return iM(iM({},s),{},{active:!0})}else if(r!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return iM(iM({},rm),{},{coordinate:s.coordinate})};function lAt(t){if(typeof t=="number")return Number.isFinite(t)?t:void 0;if(t instanceof Date){var e=t.valueOf();return Number.isFinite(e)?e:void 0}var n=Number(t);return Number.isFinite(n)?n:void 0}function cAt(t,e){var n=lAt(t),r=e[0],s=e[1];if(n===void 0)return!1;var i=Math.min(r,s),o=Math.max(r,s);return n>=i&&n<=o}function uAt(t,e,n){if(n==null||e==null)return!0;var r=Qn(t,e);return r==null||!nh(n)?!0:cAt(r,n)}var IC=(t,e,n,r)=>{var s=t==null?void 0:t.index;if(s==null)return null;var i=Number(s);if(!An(i))return s;var o=0,l=1/0;e.length>0&&(l=e.length-1);var c=Math.max(o,Math.min(i,l)),u=e[c];return u==null||uAt(u,n,r)?String(c):null},q2e=(t,e,n,r,s,i,o)=>{if(i!=null){var l=o[0],c=l==null?void 0:l.getPosition(i);if(c!=null)return c;var u=s==null?void 0:s[Number(i)];if(u)switch(n){case"horizontal":return{x:u.coordinate,y:(r.top+e)/2};default:return{x:(r.left+t)/2,y:u.coordinate}}}},V2e=(t,e,n,r)=>{if(e==="axis")return t.tooltipItemPayloads;if(t.tooltipItemPayloads.length===0)return[];var s;if(n==="hover"?s=t.itemInteraction.hover.graphicalItemId:s=t.itemInteraction.click.graphicalItemId,t.syncInteraction.active&&s==null)return t.tooltipItemPayloads;if(s==null&&(r!=null||t.keyboardInteraction.active)){var i=t.tooltipItemPayloads[0];return i!=null?[i]:[]}return t.tooltipItemPayloads.filter(o=>{var l;return((l=o.settings)===null||l===void 0?void 0:l.graphicalItemId)===s})},H2e=t=>t.options.tooltipPayloadSearcher,rS=t=>t.tooltip;function Zoe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function ele(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Zoe(Object(n),!0).forEach(function(r){dAt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Zoe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function dAt(t,e,n){return(e=hAt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function hAt(t){var e=fAt(t,"string");return typeof e=="symbol"?e:e+""}function fAt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function pAt(t){if(typeof t=="string"||typeof t=="number")return t}function mAt(t){if(typeof t=="string"||typeof t=="number"||typeof t=="boolean")return t}function gAt(t){if(typeof t=="string"||typeof t=="number")return t;if(typeof t=="function")return e=>t(e)}function tle(t){if(typeof t=="string")return t}function vAt(t){if(!(t==null||typeof t!="object")){var e="name"in t?pAt(t.name):void 0,n="unit"in t?mAt(t.unit):void 0,r="dataKey"in t?gAt(t.dataKey):void 0,s="payload"in t?t.payload:void 0,i="color"in t?tle(t.color):void 0,o="fill"in t?tle(t.fill):void 0;return{name:e,unit:n,dataKey:r,payload:s,color:i,fill:o}}}function xAt(t,e){return t??e}var W2e=(t,e,n,r,s,i,o)=>
1315{if(!(e==null||i==null)){var l=n.chartData,c=n.computedData,u=n.dataStartIndex,d=n.dataEndIndex,h=[];return t.reduce((f,p)=>{var m,v=p.dataDefinedOnItem,x=p.settings,g=xAt(v,l),w=Array.isArray(g)?bAe(g,u,d):g,_=(m=x==null?void 0:x.dataKey)!==null&&m!==void 0?m:r,j=x==null?void 0:x.nameKey,N;if(r&&Array.isArray(w)&&!Array.isArray(w[0])&&o==="axis"?N=lyt(w,r,s):N=i(w,e,c,j),Array.isArray(N))N.forEach(C=>{var k,E,P=vAt(C),T=P==null?void 0:P.name,M=P==null?void 0:P.dataKey,R=P==null?void 0:P.payload,A=ele(ele({},x),{},{name:T,unit:P==null?void 0:P.unit,color:(k=P==null?void 0:P.color)!==null&&k!==void 0?k:x==null?void 0:x.color,fill:(E=P==null?void 0:P.fill)!==null&&E!==void 0?E:x==null?void 0:x.fill});f.push(Kie({tooltipEntrySettings:A,dataKey:M,payload:R,value:Qn(R,M),name:T==null?void 0:String(T)}))});else{var S;f.push(Kie({tooltipEntrySettings:x,dataKey:_,payload:N,value:Qn(N,_),name:(S=Qn(N,j))!==null&&S!==void 0?S:x==null?void 0:x.name}))}return f},h)}},_Y=we([Qs,l2e,SG],r2e),yAt=we([t=>t.graphicalItems.cartesianItems,t=>t.graphicalItems.polarItems],(t,e)=>[...t,...e]),bAt=we([_i,Qj],rY),V0=we([yAt,Qs,bAt],iY,{memoizeOptions:{resultEqualityCheck:aF}}),wAt=we([V0],t=>t.filter(sF)),K2e=we([V0],aY,{memoizeOptions:{resultEqualityCheck:aF}}),_At=we([V0],t=>t.some(e=>!e.data)),S0=we([K2e,Gu],oY),jAt=we([wAt,Gu,Qs],bEe),jY=we([S0,Qs,V0,Gu,_At,K2e],f2e),G2e=we([Qs],cY),SAt=we([Qs],t=>t.allowDataOverflow),Y2e=we([G2e,SAt],eEe),NAt=we([V0],t=>t.filter(sF)),CAt=we([jAt,NAt,Z2,fEe],m2e),kAt=we([CAt,Gu,_i,Y2e],g2e),AAt=we([V0],u2e),EAt=we([S0,Qs,AAt,fF,_i,Bjt],hY,{memoizeOptions:{resultEqualityCheck:iF}}),TAt=we([v2e,_i,Qj],nS),PAt=we([TAt,_i],b2e),MAt=we([x2e,_i,Qj],nS),RAt=we([MAt,_i],w2e),OAt=we([y2e,_i,Qj],nS),IAt=we([OAt,_i],_2e),DAt=we([PAt,IAt,RAt],JD),LAt=we([Qs,G2e,Y2e,kAt,EAt,DAt,Rn,_i],fY),xj=we([Qs,Rn,S0,jY,Z2,_i,LAt],pY),FAt=we([xj,Qs,_Y],gY),$At=we([Qs,xj,FAt,_i],xY),X2e=t=>{var e=_i(t),n=Qj(t),r=!1;return aT(t,e,n,r)},J2e=we([Qs,X2e],tF),zAt=we([Qs,_Y,$At,J2e],tY),Q2e=we([zAt],PG),BAt=we([Rn,jY,Qs,_i],M2e),UAt=we([Rn,jY,Qs,_i],k2e),qAt=(t,e,n,r,s,i,o,l)=>{if(e){var c=e.type,u=uv(t,l);if(r){var d=n==="scaleBand"&&r.bandwidth?r.bandwidth()/2:2,h=c==="category"&&r.bandwidth?r.bandwidth()/d:0;return h=l==="angleAxis"&&s!=null&&(s==null?void 0:s.length)>=2?Vi(s[0]-s[1])*2*h:h,u&&o?o.map((f,p)=>{var m=r.map(f);return An(m)?{coordinate:m+h,value:f,index:p,offset:h}:null}).filter(Kd):r.domain().map((f,p)=>{var m=r.map(f);return An(m)?{coordinate:m+h,value:i?i[f]:f,index:p,offset:h}:null}).filter(Kd)}}},_p=we([Rn,Qs,_Y,Q2e,X2e,BAt,UAt,_i],qAt),SY=we([O2e,I2e,Kkt],(t,e,n)=>D2e(n.shared,t,e)),Z2e=t=>t.tooltip.settings.trigger,NY=t=>t.tooltip.settings.defaultIndex,lT=we([rS,SY,Z2e,NY],U2e),N0=we([lT,S0,mj,xj],IC),eTe=we([_p,N0],L2e),CY=we([lT],t=>{if(t)return t.dataKey}),tTe=we([lT],t=>{if(t)return t.graphicalItemId}),nTe=we([rS,SY,Z2e,NY],V2e),VAt=we([vp,xp,Rn,Xs,_p,NY,nTe],q2e),HAt=we([lT,VAt],(t,e)=>t!=null&&t.coordinate?t.coordinate:e),WAt=we([lT],t=>{var e;return(e=t==null?void 0:t.active)!==null&&e!==void 0?e:!1}),KAt=we([nTe,N0,Gu,mj,eTe,H2e,SY],W2e);we([KAt],t=>{if(t!=null){var e=t.map(n=>n.payload).filter(n=>n!=null);return Array.from(new Set(e))}});function nle(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function rle(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?nle(Object(n),!0).forEach(function(r){GAt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):nle(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function GAt(t,e,n){return(e=YAt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function YAt(t){var e=XAt(t,"string");return typeof e=="symbol"?e:e+""}function XAt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var JAt=()=>mt(Qs),QAt=()=>{var t=JAt(),e=mt(_p),n=mt(Q2e);return TD(!t||!n?void 0:rle(rle({},t),{},{scale:n}),e)};function sle(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function vb(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};
1315e%2?sle(Object(n),!0).forEach(function(r){ZAt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):sle(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function ZAt(t,e,n){return(e=eEt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function eEt(t){var e=tEt(t,"string");return typeof e=="symbol"?e:e+""}function tEt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var nEt=(t,e,n,r)=>{var s=e.find(i=>i&&i.index===n);if(s){if(t==="horizontal")return{x:s.coordinate,y:r.relativeY};if(t==="vertical")return{x:r.relativeX,y:s.coordinate}}return{x:0,y:0}},rEt=(t,e,n,r)=>{var s=e.find(u=>u&&u.index===n);if(s){if(t==="centric"){var i=s.coordinate,o=r.radius;return vb(vb(vb({},r),Cs(r.cx,r.cy,o,i)),{},{angle:i,radius:o})}var l=s.coordinate,c=r.angle;return vb(vb(vb({},r),Cs(r.cx,r.cy,l,c)),{},{angle:c,radius:l})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function sEt(t,e){var n=t.relativeX,r=t.relativeY;return n>=e.left&&n<=e.left+e.width&&r>=e.top&&r<=e.top+e.height}var rTe=(t,e,n,r,s)=>{var i,o=(i=e==null?void 0:e.length)!==null&&i!==void 0?i:0;if(o<=1||t==null)return 0;if(r==="angleAxis"&&s!=null&&Math.abs(Math.abs(s[1]-s[0])-360)<=1e-6)for(var l=0;l<o;l++){var c,u,d,h,f,p=l>0?(c=n[l-1])===null||c===void 0?void 0:c.coordinate:(u=n[o-1])===null||u===void 0?void 0:u.coordinate,m=(d=n[l])===null||d===void 0?void 0:d.coordinate,v=l>=o-1?(h=n[0])===null||h===void 0?void 0:h.coordinate:(f=n[l+1])===null||f===void 0?void 0:f.coordinate,x=void 0;if(!(p==null||m==null||v==null))if(Vi(m-p)!==Vi(v-m)){var g=[];if(Vi(v-m)===Vi(s[1]-s[0])){x=v;var w=m+s[1]-s[0];g[0]=Math.min(w,(w+p)/2),g[1]=Math.max(w,(w+p)/2)}else{x=p;var _=v+s[1]-s[0];g[0]=Math.min(m,(_+m)/2),g[1]=Math.max(m,(_+m)/2)}var j=[Math.min(m,(x+m)/2),Math.max(m,(x+m)/2)];if(t>j[0]&&t<=j[1]||t>=g[0]&&t<=g[1]){var N;return(N=n[l])===null||N===void 0?void 0:N.index}}else{var S=Math.min(p,v),C=Math.max(p,v);if(t>(S+m)/2&&t<=(C+m)/2){var k;return(k=n[l])===null||k===void 0?void 0:k.index}}}else if(e)for(var E=0;E<o;E++){var P=e[E];if(P!=null){var T=e[E+1],M=e[E-1];if(E===0&&T!=null&&t<=(P.coordinate+T.coordinate)/2||E===o-1&&M!=null&&t>(P.coordinate+M.coordinate)/2||E>0&&E<o-1&&M!=null&&T!=null&&t>(P.coordinate+M.coordinate)/2&&t<=(P.coordinate+T.coordinate)/2)return P.index}}return-1},iEt=()=>mt(SG),kY=(t,e)=>e,sTe=(t,e,n)=>n,AY=(t,e,n,r)=>r,aEt=we(_p,t=>O4(t,e=>e.coordinate)),EY=we([rS,kY,sTe,AY],U2e),TY=we([EY,S0,mj,xj],IC),oEt=(t,e,n)=>{if(e!=null){var r=rS(t);return e==="axis"?n==="hover"?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:n==="hover"?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}},iTe=we([rS,kY,sTe,AY],V2e),ZD=we([vp,xp,Rn,Xs,_p,AY,iTe],q2e),lEt=we([EY,ZD],(t,e)=>{var n;return(n=t.coordinate)!==null&&n!==void 0?n:e}),aTe=we([_p,TY],L2e),cEt=we([iTe,TY,Gu,mj,aTe,H2e,kY],W2e),uEt=we([EY,TY],(t,e)=>({isActive:t.active&&e!=null,activeIndex:e})),dEt=(t,e,n,r,s,i,o)=>{if(!(!t||!n||!r||!s)&&sEt(t,o)){var l=lwt(t,e),c=rTe(l,i,s,n,r),u=nEt(e,s,c,t);return{activeIndex:String(c),activeCoordinate:u}}},hEt=(t,e,n,r,s,i,o)=>{if(!(!t||!r||!s||!i||!n)){var l=Mjt(t,n);if(l){var c=cwt(l,e),u=rTe(c,o,i,r,s),d=rEt(e,i,u,l);return{activeIndex:String(u),activeCoordinate:d}}}},fEt=(t,e,n,r,s,i,o,l)=>{if(!(!t||!e||!r||!s||!i))return e==="horizontal"||e==="vertical"?dEt(t,e,r,s,i,o,l):hEt(t,e,n,r,s,i,o)},pEt=we(t=>t.zIndex.zIndexMap,(t,e)=>e,(t,e,n)=>n,(t,e,n)=>{if(e!=null){var r=t[e];if(r!=null)return n?r.panoramaElement:r.element}}),mEt=we(t=>t.zIndex.zIndexMap,t=>{var e=Object.keys(t).map(r=>parseInt(r,10)).concat(Object.values(vi)),n=Array.from(new Set(e));return n.sort((r,s)=>r-s)},{memoizeOptions:{resultEqualityCheck:cSt}});function ile(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}
1315function ale(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ile(Object(n),!0).forEach(function(r){gEt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ile(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function gEt(t,e,n){return(e=vEt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function vEt(t){var e=xEt(t,"string");return typeof e=="symbol"?e:e+""}function xEt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var yEt={},bEt={zIndexMap:Object.values(vi).reduce((t,e)=>ale(ale({},t),{},{[e]:{element:void 0,panoramaElement:void 0,consumers:0}}),yEt)},wEt=new Set(Object.values(vi));function _Et(t){return wEt.has(t)}var oTe=Ba({name:"zIndex",initialState:bEt,reducers:{registerZIndexPortal:{reducer:(t,e)=>{var n=e.payload.zIndex;t.zIndexMap[n]?t.zIndexMap[n].consumers+=1:t.zIndexMap[n]={consumers:1,element:void 0,panoramaElement:void 0}},prepare:xr()},unregisterZIndexPortal:{reducer:(t,e)=>{var n=e.payload.zIndex;t.zIndexMap[n]&&(t.zIndexMap[n].consumers-=1,t.zIndexMap[n].consumers<=0&&!_Et(n)&&delete t.zIndexMap[n])},prepare:xr()},registerZIndexPortalElement:{reducer:(t,e)=>{var n=e.payload,r=n.zIndex,s=n.element,i=n.isPanorama;t.zIndexMap[r]?i?t.zIndexMap[r].panoramaElement=s:t.zIndexMap[r].element=s:t.zIndexMap[r]={consumers:0,element:i?void 0:s,panoramaElement:i?s:void 0}},prepare:xr()},unregisterZIndexPortalElement:{reducer:(t,e)=>{var n=e.payload.zIndex;t.zIndexMap[n]&&(e.payload.isPanorama?t.zIndexMap[n].panoramaElement=void 0:t.zIndexMap[n].element=void 0)},prepare:xr()}}}),vF=oTe.actions,jEt=vF.registerZIndexPortal,rB=vF.unregisterZIndexPortal,SEt=vF.registerZIndexPortalElement,NEt=vF.unregisterZIndexPortalElement,CEt=oTe.reducer;function Sh(t){var e=t.zIndex,n=t.children,r=Kwt(),s=r&&e!==void 0&&e!==0,i=Vl(),o=b.useRef(void 0),l=b.useRef(new Set),c=Wn(),u=mt(h=>pEt(h,e,i));if(b.useLayoutEffect(()=>{if(!s){var h=l.current;h.forEach(p=>{c(rB({zIndex:p}))}),h.clear(),o.current=void 0;return}if(l.current.has(e)||(c(jEt({zIndex:e})),l.current.add(e)),u){o.current=u;var f=l.current;f.forEach(p=>{p!==e&&(c(rB({zIndex:p})),f.delete(p))})}},[c,e,s,u]),b.useLayoutEffect(()=>{var h=l.current;return()=>{h.forEach(f=>{c(rB({zIndex:f}))}),h.clear()}},[c]),!s)return n;var d=u??o.current;return d?Lc.createPortal(n,d):null}function rH(){return rH=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},rH.apply(null,arguments)}function ole(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function aM(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ole(Object(n),!0).forEach(function(r){kEt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ole(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function kEt(t,e,n){return(e=AEt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function AEt(t){var e=EEt(t,"string");return typeof e=="symbol"?e:e+""}function EEt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function TEt(t){var e=t.cursor,n=t.cursorComp,r=t.cursorProps;return b.isValidElement(e)?b.cloneElement(e,r):b.createElement(n,r)}function PEt(t){var e,n=t.coordinate,r=t.payload,s=t.index,i=t.offset,o=t.tooltipAxisBandSize,l=t.layout,c=t.cursor,u=t.tooltipEventType,d=t.chart
1315Name,h=n,f=r,p=s;if(!c||!h||d!=="ScatterChart"&&u!=="axis")return null;var m,v,x;if(d==="ScatterChart")m=h,v=U_t,x=vi.cursorLine;else if(d==="BarChart")m=q_t(l,h,i,o),v=GAe,x=vi.cursorRectangle;else if(l==="radial"&&Cke(h)){var g=XAe(h),w=g.cx,_=g.cy,j=g.radius,N=g.startAngle,S=g.endAngle;m={cx:w,cy:_,startAngle:N,endAngle:S,innerRadius:j,outerRadius:j},v=QAe,x=vi.cursorLine}else m={points:Djt(l,h,i)},v=UAe,x=vi.cursorLine;var C=typeof c=="object"&&"className"in c?c.className:void 0,k=aM(aM(aM(aM({stroke:"#ccc",pointerEvents:"none"},i),m),Hk(c)),{},{payload:f,payloadIndex:p,className:mn("recharts-tooltip-cursor",C)});return b.createElement(Sh,{zIndex:(e=t.zIndex)!==null&&e!==void 0?e:x},b.createElement(TEt,{cursor:c,cursorComp:v,cursorProps:k}))}function MEt(t){var e=QAt(),n=Vwt(),r=Yj(),s=iEt();return e==null||n==null||r==null||s==null?null:b.createElement(PEt,rH({},t,{offset:n,layout:r,tooltipAxisBandSize:e,chartName:s}))}var lTe=b.createContext(null),REt=()=>b.useContext(lTe),cTe={exports:{}};(function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function s(c,u,d){this.fn=c,this.context=u,this.once=d||!1}function i(c,u,d,h,f){if(typeof d!="function")throw new TypeError("The listener must be a function");var p=new s(d,h||c,f),m=n?n+u:u;return c._events[m]?c._events[m].fn?c._events[m]=[c._events[m],p]:c._events[m].push(p):(c._events[m]=p,c._eventsCount++),c}function o(c,u){--c._eventsCount===0?c._events=new r:delete c._events[u]}function l(){this._events=new r,this._eventsCount=0}l.prototype.eventNames=function(){var u=[],d,h;if(this._eventsCount===0)return u;for(h in d=this._events)e.call(d,h)&&u.push(n?h.slice(1):h);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(d)):u},l.prototype.listeners=function(u){var d=n?n+u:u,h=this._events[d];if(!h)return[];if(h.fn)return[h.fn];for(var f=0,p=h.length,m=new Array(p);f<p;f++)m[f]=h[f].fn;return m},l.prototype.listenerCount=function(u){var d=n?n+u:u,h=this._events[d];return h?h.fn?1:h.length:0},l.prototype.emit=function(u,d,h,f,p,m){var v=n?n+u:u;if(!this._events[v])return!1;var x=this._events[v],g=arguments.length,w,_;if(x.fn){switch(x.once&&this.removeListener(u,x.fn,void 0,!0),g){case 1:return x.fn.call(x.context),!0;case 2:return x.fn.call(x.context,d),!0;case 3:return x.fn.call(x.context,d,h),!0;case 4:return x.fn.call(x.context,d,h,f),!0;case 5:return x.fn.call(x.context,d,h,f,p),!0;case 6:return x.fn.call(x.context,d,h,f,p,m),!0}for(_=1,w=new Array(g-1);_<g;_++)w[_-1]=arguments[_];x.fn.apply(x.context,w)}else{var j=x.length,N;for(_=0;_<j;_++)switch(x[_].once&&this.removeListener(u,x[_].fn,void 0,!0),g){case 1:x[_].fn.call(x[_].context);break;case 2:x[_].fn.call(x[_].context,d);break;case 3:x[_].fn.call(x[_].context,d,h);break;case 4:x[_].fn.call(x[_].context,d,h,f);break;default:if(!w)for(N=1,w=new Array(g-1);N<g;N++)w[N-1]=arguments[N];x[_].fn.apply(x[_].context,w)}}return!0},l.prototype.on=function(u,d,h){return i(this,u,d,h,!1)},l.prototype.once=function(u,d,h){return i(this,u,d,h,!0)},l.prototype.removeListener=function(u,d,h,f){var p=n?n+u:u;if(!this._events[p])return this;if(!d)return o(this,p),this;var m=this._events[p];if(m.fn)m.fn===d&&(!f||m.once)&&(!h||m.context===h)&&o(this,p);else{for(var v=0,x=[],g=m.length;v<g;v++)(m[v].fn!==d||f&&!m[v].once||h&&m[v].context!==h)&&x.push(m[v]);x.length?this._events[p]=x.length===1?x[0]:x:o(this,p)}return this},l.prototype.removeAllListeners=function(u){var d;return u?(d=n?n+u:u,this._events[d]&&o(this,d)):(this._events=new r,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=n,l.EventEmitter=l,t.exports=l})(cTe);var OEt=cTe.exports;const IEt=cp(OEt);var iA=new IEt,sH="recharts.syncEvent.tooltip",lle="recharts.syncEvent.brush",uTe=(t,e)=>{if(e&&Array.isArray(t)){var n=Number.parseInt(e,10);if(!ph(n))return t[n]}},DEt={chartName:"",tooltipPayloadSearcher:()=>{},eventEmitter:void 0,defaultTooltipEventType:"axis"},dTe=Ba({name:"options",initialState:DEt,reducers:{createEventEmitter:t=>{t.eventEmitter==null&&(t.eventEmitter=Symbol("rechartsEventEmitter"))}}}),LEt=dTe.reducer,FEt=dTe.actions.createEventEmitter;function $Et(t){return t.tooltip.syncInteraction}var zEt={chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},hTe=Ba({name:"chartData",initialState:zEt,reducers:{setChartData(t,e){if(t.chartData=e.payload,e.payload==null){t.dataStartIndex=0,t.dataEndIndex=0;return}e.payload.length>0&&t.dataEndIndex!==e.payload.length-1&&(t.dataEndIndex=e.payload.length-1)},setComputedData(t,e){t.computedData=e.payload},setDataStartEndIndexes(t,e){var n=e.payload,r=n.startIndex,s=n.endIndex;r!=null&&(t.dataStartIndex=r),s!=null&&(t.dataEndIndex=s)}}}),PY=hTe.actions,cle=PY.setChartData,BEt=PY.setDataStartEndIndexes;PY.setComputedData;var UEt=hTe.reducer,qEt=["x","y"];function ule(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function xb(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};
1315e%2?ule(Object(n),!0).forEach(function(r){VEt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ule(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function VEt(t,e,n){return(e=HEt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function HEt(t){var e=WEt(t,"string");return typeof e=="symbol"?e:e+""}function WEt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function KEt(t,e){if(t==null)return{};var n,r,s=GEt(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function GEt(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function YEt(){var t=mt(NG),e=mt(CG),n=Wn(),r=mt(pEe),s=mt(_p),i=Yj(),o=X4(),l=mt(c=>c.rootProps.className);b.useEffect(()=>{if(t==null)return Gj;var c=(u,d,h)=>{if(e!==h&&t===u){if(d.payload.active===!1){n(XN({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}if(r==="index"){var f;if(o&&d!==null&&d!==void 0&&(f=d.payload)!==null&&f!==void 0&&f.coordinate&&d.payload.sourceViewBox){var p=d.payload.coordinate,m=p.x,v=p.y,x=KEt(p,qEt),g=d.payload.sourceViewBox,w=g.x,_=g.y,j=g.width,N=g.height,S=xb(xb({},x),{},{x:o.x+(j?(m-w)/j:0)*o.width,y:o.y+(N?(v-_)/N:0)*o.height});n(xb(xb({},d),{},{payload:xb(xb({},d.payload),{},{coordinate:S})}))}else n(d);return}if(s!=null){var C;if(typeof r=="function"){var k={activeTooltipIndex:d.payload.index==null?void 0:Number(d.payload.index),isTooltipActive:d.payload.active,activeIndex:d.payload.index==null?void 0:Number(d.payload.index),activeLabel:d.payload.label,activeDataKey:d.payload.dataKey,activeCoordinate:d.payload.coordinate},E=r(s,k);C=s[E]}else r==="value"&&(C=s.find(O=>String(O.value)===d.payload.label));var P=d.payload.coordinate;if(P==null||o==null){n(XN({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}if(C==null){n(XN({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:d.payload.sourceViewBox,graphicalItemId:void 0}));return}var T=P.x,M=P.y,R=Math.min(T,o.x+o.width),A=Math.min(M,o.y+o.height),I={x:i==="horizontal"?C.coordinate:R,y:i==="horizontal"?A:C.coordinate},D=XN({active:d.payload.active,coordinate:I,dataKey:d.payload.dataKey,index:String(C.index),label:d.payload.label,sourceViewBox:d.payload.sourceViewBox,graphicalItemId:d.payload.graphicalItemId});n(D)}}};return iA.on(sH,c),()=>{iA.off(sH,c)}},[l,n,e,t,r,s,i,o])}function XEt(){var t=mt(NG),e=mt(CG),n=Wn();b.useEffect(()=>{if(t==null)return Gj;var r=(s,i,o)=>{e!==o&&t===s&&n(BEt(i))};return iA.on(lle,r),()=>{iA.off(lle,r)}},[n,e,t])}function JEt(){var t=Wn();b.useEffect(()=>{t(FEt())},[t]),YEt(),XEt()}function QEt(t,e,n,r,s,i){var o=mt(m=>oEt(m,t,e)),l=mt(tTe),c=mt(CG),u=mt(NG),d=mt(pEe),h=mt($Et),f=(h==null?void 0:h.sourceViewBox)!=null,p=X4();b.useEffect(()=>{if(!f&&u!=null&&c!=null){var m=XN({active:i,coordinate:n,dataKey:o,index:s,label:typeof r=="number"?String(r):r,sourceViewBox:p,graphicalItemId:l});iA.emit(sH,u,m,c)}},[f,n,o,l,s,r,c,u,d,i,p])}function dle(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function hle(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?dle(Object(n),!0).forEach(function(r){ZEt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):dle(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function ZEt(t,e,n){return(e=e2t(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function e2t(t){var e=t2t(t,"string");return typeof e=="symbol"?e:e+""}function t2t(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function n2t(t,e){return a2t(t)||i2t(t,e)||s2t(t,e)||r2t()}
1315function r2t(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 1316In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function s2t(t,e){if(t){if(typeof t=="string")return fle(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?fle(t,e):void 0}}function fle(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function i2t(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,u=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function a2t(t){if(Array.isArray(t))return t}function o2t(t){return t.dataKey}function l2t(t,e){return b.isValidElement(t)?b.cloneElement(t,e):typeof t=="function"?b.createElement(t,e):b.createElement(o_t,e)}var ple=[],c2t={allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",axisId:0,contentStyle:{},cursor:!0,filterNull:!0,includeHidden:!1,isAnimationActive:"auto",itemSorter:"name",itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,wrapperStyle:{}};function iH(t){var e,n,r=za(t,c2t),s=r.active,i=r.allowEscapeViewBox,o=r.animationDuration,l=r.animationEasing,c=r.content,u=r.filterNull,d=r.isAnimationActive,h=r.offset,f=r.payloadUniqBy,p=r.position,m=r.reverseDirection,v=r.useTranslate3d,x=r.wrapperStyle,g=r.cursor,w=r.shared,_=r.trigger,j=r.defaultIndex,N=r.portal,S=r.axisId,C=Wn(),k=typeof j=="number"?String(j):j;b.useEffect(()=>{C(Qkt({shared:w,trigger:_,axisId:S,active:s,defaultIndex:k}))},[C,w,_,S,s,k]);var E=X4(),P=BAe(),T=Wkt(w),M=(e=mt(he=>uEt(he,T,_,k)))!==null&&e!==void 0?e:{},R=M.activeIndex,A=M.isActive,I=mt(he=>cEt(he,T,_,k)),D=mt(he=>aTe(he,T,_,k)),O=mt(he=>lEt(he,T,_,k)),z=I,B=REt(),G=(n=s??A)!==null&&n!==void 0?n:!1,U=Vke([z,G]),F=n2t(U,2),W=F[0],Q=F[1],K=T==="axis"?D:void 0;QEt(T,_,O,K,R,G);var fe=N??B;if(fe==null||E==null||T==null)return null;var oe=z??ple;G||(oe=ple),u&&oe.length&&(oe=$ke(oe.filter(he=>he.value!=null&&(he.hide!==!0||r.includeHidden)),f,o2t));var ye=oe.length>0,le=hle(hle({},r),{},{payload:oe,label:K,active:G,activeIndex:R,coordinate:O,accessibilityLayer:P}),me=b.createElement(A_t,{allowEscapeViewBox:i,animationDuration:o,animationEasing:l,isAnimationActive:d,active:G,coordinate:O,hasPayload:ye,offset:h,position:p,reverseDirection:m,useTranslate3d:v,viewBox:E,wrapperStyle:x,lastBoundingBox:W,innerRef:Q,hasPortalFromProps:!!N},l2t(c,le));return b.createElement(b.Fragment,null,Lc.createPortal(me,fe),G&&b.createElement(MEt,{cursor:g,tooltipEventType:T,coordinate:O,payload:oe,index:R}))}var cT=t=>null;cT.displayName="Cell";function u2t(t,e,n){return(e=d2t(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function d2t(t){var e=h2t(t,"string");return typeof e=="symbol"?e:e+""}function h2t(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class f2t{constructor(e){u2t(this,"cache",new Map),this.maxSize=e}get(e){var n=this.cache.get(e);return n!==void 0&&(this.cache.delete(e),this.cache.set(e,n)),n}set(e,n){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxSize){var r=this.cache.keys().next().value;r!=null&&this.cache.delete(r)}this.cache.set(e,n)}clear(){this.cache.clear()}size(){return this.cache.size}}function mle(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function p2t(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};
1316e%2?mle(Object(n),!0).forEach(function(r){m2t(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):mle(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function m2t(t,e,n){return(e=g2t(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function g2t(t){var e=v2t(t,"string");return typeof e=="symbol"?e:e+""}function v2t(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var x2t={cacheSize:2e3,enableCache:!0},fTe=p2t({},x2t),gle=new f2t(fTe.cacheSize),y2t={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},vle="recharts_measurement_span";function b2t(t,e){var n=e.fontSize||"",r=e.fontFamily||"",s=e.fontWeight||"",i=e.fontStyle||"",o=e.letterSpacing||"",l=e.textTransform||"";return"".concat(t,"|").concat(n,"|").concat(r,"|").concat(s,"|").concat(i,"|").concat(o,"|").concat(l)}var xle=(t,e)=>{try{var n=document.getElementById(vle);n||(n=document.createElement("span"),n.setAttribute("id",vle),n.setAttribute("aria-hidden","true"),document.body.appendChild(n)),Object.assign(n.style,y2t,e),n.textContent="".concat(t);var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch{return{width:0,height:0}}},DC=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||J2.isSsr)return{width:0,height:0};if(!fTe.enableCache)return xle(e,n);var r=b2t(e,n),s=gle.get(r);if(s)return s;var i=xle(e,n);return gle.set(r,i),i},pTe;function eL(t,e){return S2t(t)||j2t(t,e)||_2t(t,e)||w2t()}function w2t(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 1317In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _2t(t,e){if(t){if(typeof t=="string")return yle(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?yle(t,e):void 0}}function yle(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function j2t(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,u=!1;try{if(i=(n=n.call(t)).next,e===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function S2t(t){if(Array.isArray(t))return t}function N2t(t,e,n){return(e=C2t(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function C2t(t){var e=k2t(t,"string");return typeof e=="symbol"?e:e+""}function k2t(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var ble=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,wle=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,A2t=/^(px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q)$/,E2t=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,T2t={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},P2t=["cm","mm","pt","pc","in","Q","px"];function M2t(t){return P2t.includes(t)}var gw="NaN";function R2t(t,e){return t*T2t[e]}class Ii{static parse(e){var n,r=(n=E2t.exec(e))!==null&&n!==void 0?n:[],s=eL(r,3),i=s[1],o=s[2];return i==null?Ii.NaN:new Ii(parseFloat(i),o??"")}constructor(e,n){this.num=e,this.unit=n,this.num=e,this.unit=n,ph(e)&&(this.unit=""),n!==""&&!A2t.test(n)&&(this.num=NaN,this.unit=""),M2t(n)&&(this.num=R2t(e,n),this.unit="px")}add(e){return this.unit!==e.unit?new Ii(NaN,""):new Ii(this.num+e.num,this.unit)}subtract(e){return this.unit!==e.unit?new Ii(NaN,""):new Ii(this.num-e.num,this.unit)}multiply(e){return this.unit!==""&&e.unit!==""&&this.unit!==e.unit?new Ii(NaN,""):new Ii(this.num*e.num,this.unit||e.unit)}divide(e){return this.unit!==""&&e.unit!==""&&this.unit!==e.unit?new Ii(NaN,""):new Ii(this.num/e.num,this.unit||e.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return ph(this.num)}}pTe=Ii;N2t(Ii,"NaN",new pTe(NaN,""));function mTe(t){if(t==null||t.includes(gw))return gw;for(var e=t;e.includes("*")||e.includes("/");){var n,r=(n=ble.exec(e))!==null&&n!==void 0?n:[],s=eL(r,4),i=s[1],o=s[2],l=s[3],c=Ii.parse(i??""),u=Ii.parse(l??""),d=o==="*"?c.multiply(u):c.divide(u);if(d.isNaN())return gw;e=e.replace(ble,d.toString())}for(;e.includes("+")||/.-\d+(?:\.\d+)?/.test(e);){var h,f=(h=wle.exec(e))!==null&&h!==void 0?h:[],p=eL(f,4),m=p[1],v=p[2],x=p[3],g=Ii.parse(m??""),w=Ii.parse(x??""),_=v==="+"?g.add(w):g.subtract(w);if(_.isNaN())return gw;e=e.replace(wle,_.toString())}return e}var _le=/\(([^()]*)\)/;function O2t(t){for(var e=t,n;(n=_le.exec(e))!=null;){var r=n,s=eL(r,2),i=s[1];e=e.replace(_le,mTe(i))}return e}function I2t(t){var e=t.replace(/\s+/g,"");return e=O2t(e),e=mTe(e),e}function D2t(t){try{return I2t(t)}catch{return gw}}function sB(t){var e=D2t(t.slice(5,-1));return e===gw?"":e}var L2t=["x","y","lineHeight","capHeight","fill","scaleToFit","textAnchor","verticalAnchor"],F2t=["dx","dy","angle","className","breakAll"];function aH(){return aH=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},aH.apply(null,arguments)}function jle(t,e){if(t==null)return{};var n,r,s=$2t(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function $2t(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function Sle(t,e){return q2t(t)||U2t(t,e)||B2t(t,e)||z2t()}
1317function z2t(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 1318In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function B2t(t,e){if(t){if(typeof t=="string")return Nle(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Nle(t,e):void 0}}function Nle(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function U2t(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,u=!1;try{if(i=(n=n.call(t)).next,e===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function q2t(t){if(Array.isArray(t))return t}var gTe=/[ \f\n\r\t\v\u2028\u2029]+/,vTe=t=>{var e=t.children,n=t.breakAll,r=t.style;try{var s=[];Ks(e)||(n?s=e.toString().split(""):s=e.toString().split(gTe));var i=s.map(l=>({word:l,width:DC(l,r).width})),o=n?0:DC(" ",r).width;return{wordsWithComputedWidth:i,spaceWidth:o}}catch{return null}};function xTe(t){return t==="start"||t==="middle"||t==="end"||t==="inherit"}function V2t(t){return Ks(t)||typeof t=="string"||typeof t=="number"||typeof t=="boolean"}var yTe=(t,e,n,r)=>t.reduce((s,i)=>{var o=i.word,l=i.width,c=s[s.length-1];if(c&&l!=null&&(e==null||r||c.width+l+n<Number(e)))c.words.push(o),c.width+=l+n;else{var u={words:[o],width:l};s.push(u)}return s},[]),bTe=t=>t.reduce((e,n)=>e.width>n.width?e:n),H2t="â¦",Cle=(t,e,n,r,s,i,o,l)=>{var c=t.slice(0,e),u=vTe({breakAll:n,style:r,children:c+H2t});if(!u)return[!1,[]];var d=yTe(u.wordsWithComputedWidth,i,o,l),h=d.length>s||bTe(d).width>Number(i);return[h,d]},W2t=(t,e,n,r,s)=>{var i=t.maxLines,o=t.children,l=t.style,c=t.breakAll,u=Ct(i),d=String(o),h=yTe(e,r,n,s);if(!u||s)return h;var f=h.length>i||bTe(h).width>Number(r);
1318if(!f)return h;for(var p=0,m=d.length-1,v=0,x;p<=m&&v<=d.length-1;){var g=Math.floor((p+m)/2),w=g-1,_=Cle(d,w,c,l,i,r,n,s),j=Sle(_,2),N=j[0],S=j[1],C=Cle(d,g,c,l,i,r,n,s),k=Sle(C,1),E=k[0];if(!N&&!E&&(p=g+1),N&&E&&(m=g-1),!N&&E){x=S;break}v++}return x||h},kle=t=>{var e=Ks(t)?[]:t.toString().split(gTe);return[{words:e,width:void 0}]},K2t=t=>{var e=t.width,n=t.scaleToFit,r=t.children,s=t.style,i=t.breakAll,o=t.maxLines;if((e||n)&&!J2.isSsr){var l,c,u=vTe({breakAll:i,children:r,style:s});if(u){var d=u.wordsWithComputedWidth,h=u.spaceWidth;l=d,c=h}else return kle(r);return W2t({breakAll:i,children:r,maxLines:o,style:s},l,c,e,!!n)}return kle(r)},wTe="#808080",G2t={angle:0,breakAll:!1,capHeight:"0.71em",fill:wTe,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},xF=b.forwardRef((t,e)=>{var n=za(t,G2t),r=n.x,s=n.y,i=n.lineHeight,o=n.capHeight,l=n.fill,c=n.scaleToFit,u=n.textAnchor,d=n.verticalAnchor,h=jle(n,L2t),f=b.useMemo(()=>K2t({breakAll:h.breakAll,children:h.children,maxLines:h.maxLines,scaleToFit:c,style:h.style,width:h.width}),[h.breakAll,h.children,h.maxLines,c,h.style,h.width]),p=h.dx,m=h.dy,v=h.angle,x=h.className,g=h.breakAll,w=jle(h,F2t);if(!mh(r)||!mh(s)||f.length===0)return null;var _=Number(r)+(Ct(p)?p:0),j=Number(s)+(Ct(m)?m:0);if(!An(_)||!An(j))return null;var N;switch(d){case"start":N=sB("calc(".concat(o,")"));break;case"middle":N=sB("calc(".concat((f.length-1)/2," * -").concat(i," + (").concat(o," / 2))"));break;default:N=sB("calc(".concat(f.length-1," * -").concat(i,")"));break}var S=[],C=f[0];if(c&&C!=null){var k=C.width,E=h.width;S.push("scale(".concat(Ct(E)&&Ct(k)?E/k:1,")"))}return v&&S.push("rotate(".concat(v,", ").concat(_,", ").concat(j,")")),S.length&&(w.transform=S.join(" ")),b.createElement("text",aH({},hh(w),{ref:e,x:_,y:j,className:mn("recharts-text",x),textAnchor:u,fill:l.includes("url")?wTe:l}),f.map((P,T)=>{var M=P.words.join(g?"":" ");return b.createElement("tspan",{x:_,dy:T===0?N:i,key:"".concat(M,"-").concat(T)},M)}))});xF.displayName="Text";function Ale(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function nd(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Ale(Object(n),!0).forEach(function(r){Y2t(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ale(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Y2t(t,e,n){return(e=X2t(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function X2t(t){var e=J2t(t,"string");return typeof e=="symbol"?e:e+""}function J2t(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Q2t=t=>{var e=t.viewBox,n=t.position,r=t.offset,s=r===void 0?0:r,i=t.parentViewBox,o=mG(e),l=o.x,c=o.y,u=o.height,d=o.upperWidth,h=o.lowerWidth,f=l,p=l+(d-h)/2,m=(f+p)/2,v=(d+h)/2,x=f+d/2,g=u>=0?1:-1,w=g*s,_=g>0?"end":"start",j=g>0?"start":"end",N=d>=0?1:-1,S=N*s,C=N>0?"end":"start",k=N>0?"start":"end",E=i;if(n==="top"){var P={x:f+d/2,y:c-w,horizontalAnchor:"middle",verticalAnchor:_};return E&&(P.height=Math.max(c-E.y,0),P.width=d),P}if(n==="bottom"){var T={x:p+h/2,y:c+u+w,horizontalAnchor:"middle",verticalAnchor:j};return E&&(T.height=Math.max(E.y+E.height-(c+u),0),T.width=h),T}if(n==="left"){var M={x:m-S,y:c+u/2,horizontalAnchor:C,verticalAnchor:"middle"};return E&&(M.width=Math.max(M.x-E.x,0),M.height=u),M}if(n==="right"){var R={x:m+v+S,y:c+u/2,horizontalAnchor:k,verticalAnchor:"middle"};return E&&(R.width=Math.max(E.x+E.width-R.x,0),R.height=u),R}var A=E?{width:v,height:u}:{};return n==="insideLeft"?nd({x:m+S,y:c+u/2,horizontalAnchor:k,verticalAnchor:"middle"},A):n==="insideRight"?nd({x:m+v-S,y:c+u/2,horizontalAnchor:C,verticalAnchor:"middle"},A):n==="insideTop"?nd({x:f+d/2,y:c+w,horizontalAnchor:"middle",verticalAnchor:j},A):n==="insideBottom"?nd({x:p+h/2,y:c+u-w,horizontalAnchor:"middle",verticalAnchor:_},A):n==="insideTopLeft"?nd({x:f+S,y:c+w,horizontalAnchor:k,verticalAnchor:j},A):n==="insideTopRight"?nd({x:f+d-S,y:c+w,horizontalAnchor:C,verticalAnchor:j},A):n==="insideBottomLeft"?nd({x:p+S,y:c+u-w,horizontalAnchor:k,verticalAnchor:_},A):n==="insideBottomRight"?nd({x:p+h-S,y:c+u-w,horizontalAnchor:C,verticalAnchor:_},A):n&&typeof n=="object"&&(Ct(n.x)||y0(n.x))&&(Ct(n.y)||y0(n.y))?nd({x:l+Ta(n.x,v),y:c+Ta(n.y,u),horizontalAnchor:"end",verticalAnchor:"end"},A):nd({x,y:c+u/2,horizontalAnchor:"middle",verticalAnchor:"middle"},A)},Z2t=["labelRef"],eTt=["content"];function Ele(t,e){if(t==null)return{};var n,r,s=tTt(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function tTt(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function Tle(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function JN(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};
1318e%2?Tle(Object(n),!0).forEach(function(r){nTt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Tle(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function nTt(t,e,n){return(e=rTt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function rTt(t){var e=sTt(t,"string");return typeof e=="symbol"?e:e+""}function sTt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Mf(){return Mf=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Mf.apply(null,arguments)}var _Te=b.createContext(null),iTt=t=>{var e=t.x,n=t.y,r=t.upperWidth,s=t.lowerWidth,i=t.width,o=t.height,l=t.children,c=b.useMemo(()=>({x:e,y:n,upperWidth:r,lowerWidth:s,width:i,height:o}),[e,n,r,s,i,o]);return b.createElement(_Te.Provider,{value:c},l)},jTe=()=>{var t=b.useContext(_Te),e=X4();return t||(e?mG(e):void 0)},aTt=b.createContext(null),oTt=()=>{var t=b.useContext(aTt),e=mt(yEe);return t||e},lTt=t=>{var e=t.value,n=t.formatter,r=Ks(t.children)?e:t.children;return typeof n=="function"?n(r):r},MY=t=>t!=null&&typeof t=="function",cTt=(t,e)=>{var n=Vi(e-t),r=Math.min(Math.abs(e-t),360);return n*r},uTt=(t,e,n,r,s)=>{var i=t.offset,o=t.className,l=s.cx,c=s.cy,u=s.innerRadius,d=s.outerRadius,h=s.startAngle,f=s.endAngle,p=s.clockWise,m=(u+d)/2,v=cTt(h,f),x=v>=0?1:-1,g,w;switch(e){case"insideStart":g=h+x*i,w=p;break;case"insideEnd":g=f-x*i,w=!p;break;case"end":g=f+x*i,w=p;break;default:throw new Error("Unsupported position ".concat(e))}w=v<=0?w:!w;var _=Cs(l,c,m,g),j=Cs(l,c,m,g+(w?1:-1)*359),N="M".concat(_.x,",").concat(_.y,` 1319 A`).concat(m,",").concat(m,",0,1,").concat(w?0:1,`, 1320 `).concat(j.x,",").concat(j.y),S=Ks(t.id)?Wk("recharts-radial-line-"):t.id;return b.createElement("text",Mf({},r,{dominantBaseline:"central",className:mn("recharts-radial-bar-label",o)}),b.createElement("defs",null,b.createElement("path",{id:S,d:N})),b.createElement("textPath",{xlinkHref:"#".concat(S)},n))},dTt=(t,e,n)=>{var r=t.cx,s=t.cy,i=t.innerRadius,o=t.outerRadius,l=t.startAngle,c=t.endAngle,u=(l+c)/2;if(n==="outside"){var d=Cs(r,s,o+e,u),h=d.x,f=d.y;return{x:h,y:f,textAnchor:h>=r?"start":"end",verticalAnchor:"middle"}}if(n==="center")return{x:r,y:s,textAnchor:"middle",verticalAnchor:"middle"};if(n==="centerTop")return{x:r,y:s,textAnchor:"middle",verticalAnchor:"start"};if(n==="centerBottom")return{x:r,y:s,textAnchor:"middle",verticalAnchor:"end"};var p=(i+o)/2,m=Cs(r,s,p,u),v=m.x,x=m.y;return{x:v,y:x,textAnchor:"middle",verticalAnchor:"middle"}},HR=t=>t!=null&&"cx"in t&&Ct(t.cx),hTt={angle:0,offset:5,zIndex:vi.label,position:"middle",textBreakAll:!1};function fTt(t){if(!HR(t))return t;var e=t.cx,n=t.cy,r=t.outerRadius,s=r*2;return{x:e-r,y:n-r,width:s,upperWidth:s,lowerWidth:s,height:s}}function Yp(t){var e=za(t,hTt),n=e.viewBox,r=e.parentViewBox,s=e.position,i=e.value,o=e.children,l=e.content,c=e.className,u=c===void 0?"":c,d=e.textBreakAll,h=e.labelRef,f=oTt(),p=jTe(),m=s==="center"?p:f??p,v,x,g;n==null?v=m:HR(n)?v=n:v=mG(n);var w=fTt(v);if(!v||Ks(i)&&Ks(o)&&!b.isValidElement(l)&&typeof l!="function")return null;var _=JN(JN({},e),{},{viewBox:v});if(b.isValidElement(l)){_.labelRef;var j=Ele(_,Z2t);return b.cloneElement(l,j)}if(typeof l=="function"){_.content;var N=Ele(_,eTt);if(x=b.createElement(l,N),b.isValidElement(x))return x}else x=lTt(e);var S=hh(e);if(HR(v)){if(s==="insideStart"||s==="insideEnd"||s==="end")return uTt(e,s,x,S,v);g=dTt(v,e.offset,e.position)}else{if(!w)return null;var C=Q2t({viewBox:w,position:s,offset:e.offset,parentViewBox:HR(r)?void 0:r,clamp:!0});g=JN(JN({x:C.x,y:C.y,textAnchor:C.horizontalAnchor,verticalAnchor:C.verticalAnchor},C.width!==void 0?{width:C.width}:{}),C.height!==void 0?{height:C.height}:{})}return b.createElement(Sh,{zIndex:e.zIndex},b.createElement(xF,Mf({ref:h,className:mn("recharts-label",u)},S,g,{textAnchor:xTe(S.textAnchor)?S.textAnchor:g.textAnchor,breakAll:d}),x))}Yp.displayName="Label";var pTt=(t,e,n)=>{if(!t)return null;var r={viewBox:e,labelRef:n};return t===!0?b.createElement(Yp,Mf({key:"label-implicit"},r)):mh(t)?b.createElement(Yp,Mf({key:"label-implicit",value:t},r)):b.isValidElement(t)?t.type===Yp?b.cloneElement(t,JN({key:"label-implicit"},r)):b.createElement(Yp,Mf({key:"label-implicit",content:t},r)):MY(t)?b.createElement(Yp,Mf({key:"label-implicit",content:t},r)):t&&typeof t=="object"?b.createElement(Yp,Mf({},t,{key:"label-implicit"},r)):null};function mTt(t){var e=t.label,n=t.labelRef,r=jTe();return pTt(e,r,n)||null}var gTt=["valueAccessor"],vTt=["dataKey","clockWise","id","textBreakAll","zIndex"];function tL(){return tL=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},tL.apply(null,arguments)}function Ple(t,e){if(t==null)return{};var n,r,s=xTt(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function xTt(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var yTt=t=>{var e=Array.isArray(t.value)?t.value[t.value.length-1]:t.value;if(V2t(e))return e},STe=b.createContext(void 0),bTt=STe.Provider,NTe=b.createContext(void 0),wTt=NTe.Provider;function _Tt(){return b.useContext(STe)}function jTt(){return b.useContext(NTe)}function WR(t){var e=t.valueAccessor,n=e===void 0?yTt:e,r=Ple(t,gTt),s=r.dataKey;r.clockWise;var i=r.id,o=r.textBreakAll,l=r.zIndex,c=Ple(r,vTt),u=_Tt(),d=jTt(),h=u||d;return!h||!h.length?null:b.createElement(Sh,{zIndex:l??vi.label},b.createElement(La,{className:"recharts-label-list"},h.map((f,p)=>{var m,v=Ks(s)?n(f,p):Qn(f.payload,s),x=Ks(i)?{}:{id:"".concat(i,"-").concat(p)};return b.createElement(Yp,tL({key:"label-".concat(p)}
1320,hh(f),c,x,{fill:(m=r.fill)!==null&&m!==void 0?m:f.fill,parentViewBox:f.parentViewBox,value:v,textBreakAll:o,viewBox:f.viewBox,index:p,zIndex:0}))})))}WR.displayName="LabelList";function CTe(t){var e=t.label;return e?e===!0?b.createElement(WR,{key:"labelList-implicit"}):b.isValidElement(e)||MY(e)?b.createElement(WR,{key:"labelList-implicit",content:e}):typeof e=="object"?b.createElement(WR,tL({key:"labelList-implicit"},e,{type:String(e.type)})):null:null}var kTe=t=>t.graphicalItems.polarItems,STt=we([Br,eT],rY),yF=we([kTe,ls,STt],iY),NTt=we([yF],aY),bF=we([NTt,Q2],oY),CTt=we([bF,ls,yF],h2e);we([bF,ls,yF],(t,e,n)=>n.length>0?t.flatMap(r=>n.flatMap(s=>{var i,o=Qn(r,(i=e.dataKey)!==null&&i!==void 0?i:s.dataKey);return{value:o,errorDomain:[]}})).filter(Boolean):(e==null?void 0:e.dataKey)!=null?t.map(r=>({value:Qn(r,e.dataKey),errorDomain:[]})):t.map(r=>({value:r,errorDomain:[]})));var Mle=()=>{},kTt=we([bF,ls,yF,fF,Br,zjt],hY),ATt=we([ls,uY,dY,Mle,kTt,Mle,Rn,Br],fY),ATe=we([ls,Rn,bF,CTt,Z2,Br,ATt],pY),ETt=we([ATe,eS,fv],gY),TTt=we([ls,ATe,ETt,Br],xY);we([fv,TTt],wEe);var PTt={radiusAxis:{},angleAxis:{}},ETe=Ba({name:"polarAxis",initialState:PTt,reducers:{addRadiusAxis(t,e){t.radiusAxis[e.payload.id]=e.payload},removeRadiusAxis(t,e){delete t.radiusAxis[e.payload.id]},addAngleAxis(t,e){t.angleAxis[e.payload.id]=e.payload},removeAngleAxis(t,e){delete t.angleAxis[e.payload.id]}}}),wF=ETe.actions;wF.addRadiusAxis;wF.removeRadiusAxis;wF.addAngleAxis;wF.removeAngleAxis;var MTt=ETe.reducer;function TTe(t){return t&&typeof t=="object"&&"className"in t&&typeof t.className=="string"?t.className:""}function Rle(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Ole(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Rle(Object(n),!0).forEach(function(r){RTt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Rle(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function RTt(t,e,n){return(e=OTt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function OTt(t){var e=ITt(t,"string");return typeof e=="symbol"?e:e+""}function ITt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var DTt=(t,e)=>e,RY=we([kTe,DTt],(t,e)=>t.filter(n=>n.type==="pie").find(n=>n.id===e)),LTt=[],OY=(t,e,n)=>(n==null?void 0:n.length)===0?LTt:n,PTe=we([Q2,RY,OY],(t,e,n)=>{var r=t.chartData;if(e!=null){var s;if((e==null?void 0:e.data)!=null&&e.data.length>0?s=e.data:s=r,(!s||!s.length)&&n!=null&&(s=n.map(i=>Ole(Ole({},e.presentationProps),i.props))),s!=null)return s}}),FTt=we([PTe,RY,OY],(t,e,n)=>{if(!(t==null||e==null))return t.map((r,s)=>{var i,o=Qn(r,e.nameKey,e.name),l;return n!=null&&(i=n[s])!==null&&i!==void 0&&(i=i.props)!==null&&i!==void 0&&i.fill?l=n[s].props.fill:typeof r=="object"&&r!=null&&"fill"in r?l=r.fill:l=e.fill,{value:H4(o,e.dataKey),dataKey:e.dataKey,color:l,payload:r,type:e.legendType}})}),$Tt=we([PTe,RY,OY,Xs],(t,e,n,r)=>{if(!(e==null||t==null))return tMt({offset:r,pieSettings:e,displayedData:t,cells:n})}),MTe={exports:{}},$n={};/** 1321 * @license React 1322 * react-is.production.min.js 1323 * 1324 * Copyright (c) Facebook, Inc. and its affiliates. 1325 * 1326 * This source code is licensed under the MIT license found in the 1327 * LICENSE file in the root directory of this source tree. 1328 */var IY=Symbol.for("react.element"),DY=Symbol.for("react.portal"),_F=Symbol.for("react.fragment"),jF=Symbol.for("react.strict_mode"),SF=Symbol.for("react.profiler"),NF=Symbol.for("react.provider"),CF=Symbol.for("react.context"),zTt=Symbol.for("react.server_context"),kF=Symbol.for("react.forward_ref"),AF=Symbol.for("react.suspense"),EF=Symbol.for("react.suspense_list"),TF=Symbol.for("react.memo"),PF=Symbol.for("react.lazy"),BTt=Symbol.for("react.offscreen"),RTe;RTe=Symbol.for("react.module.reference");function zc(t){if(typeof t=="object"&&t!==null){var e=t.$$typeof;switch(e){case IY:switch(t=t.type,t){case _F:case SF:case jF:case AF:case EF:return t;default:switch(t=t&&t.$$typeof,t){case zTt:case CF:case kF:case PF:case TF:case NF:return t;default:return e}}case DY:return e}}}$n.ContextConsumer=CF;$n.ContextProvider=NF;$n.Element=IY;$n.ForwardRef=kF;$n.Fragment=_F;$n.Lazy=PF;$n.Memo=TF;$n.Portal=DY;$n.Profiler=SF;$n.StrictMode=jF;$n.Suspense=AF;$n.SuspenseList=EF;$n.isAsyncMode=function(){return!1};$n.isConcurrentMode=function(){return!1};$n.isContextConsumer=function(t){return zc(t)===CF};$n.isContextProvider=function(t){return zc(t)===NF};$n.isElement=function(t){return typeof t=="object"&&t!==null&&t.$$typeof===IY};$n.isForwardRef=function(t){return zc(t)===kF};$n.isFragment=function(t){return zc(t)===_F};$n.isLazy=function(t){return zc(t)===PF};$n.isMemo=function(t){return zc(t)===TF};$n.isPortal=function(t){return zc(t)===DY};$n.isProfiler=function(t){return zc(t)===SF};$n.isStrictMode=function(t){return zc(t)===jF};$n.isSuspense=function(t){return zc(t)===AF};$n.isSuspenseList=function(t){return zc(t)===EF};$n.isValidElementType=function(t){return typeof t=="string"||typeof t=="function"||t===_F||t===SF||t===jF||t===AF||t===EF||t===BTt||typeof t=="object"&&t!==null&&(t.$$typeof===PF||t.$$typeof===TF||t.$$typeof===NF||t.$$typeof===CF||t.$$typeof===kF||t.$$typeof===RTe||t.getModuleId!==void 0)};$n.typeOf=zc;MTe.exports=$n;var UTt=MTe.exports,Ile=t=>
1328typeof t=="string"?t:t?t.displayName||t.name||"Component":"",Dle=null,iB=null,OTe=t=>{if(t===Dle&&Array.isArray(iB))return iB;var e=[];return b.Children.forEach(t,n=>{Ks(n)||(UTt.isFragment(n)?e=e.concat(OTe(n.props.children)):e.push(n))}),iB=e,Dle=t,e};function LY(t,e){var n=[],r=[];return Array.isArray(e)?r=e.map(s=>Ile(s)):r=[Ile(e)],OTe(t).forEach(s=>{var i=fh(s,"type.displayName")||fh(s,"type.name");i&&r.indexOf(i)!==-1&&n.push(s)}),n}function Lle(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Fle(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Lle(Object(n),!0).forEach(function(r){qTt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Lle(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function qTt(t,e,n){return(e=VTt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function VTt(t){var e=HTt(t,"string");return typeof e=="symbol"?e:e+""}function HTt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ITe(t,e){return Fle(Fle({},e),t)}function WTt(t){return b.isValidElement(t)?t.props:t}function KTt(t,e){return b.cloneElement(t,ITe(WTt(t),e))}function GTt(t){if("index"in t){var e=t.index;return typeof e=="number"||typeof e=="string"?e:void 0}}function YTt(t){return"isActive"in t&&t.isActive===!0}function DTe(t){var e=t.option,n=t.DefaultShape,r=t.shapeProps,s=t.activeClassName,i=s===void 0?"recharts-active-shape":s,o=t.inActiveClassName,l=o===void 0?"recharts-shape":o,c=GTt(r),u;return b.isValidElement(e)?u=KTt(e,r):e===n?u=b.createElement(n,r):typeof e=="function"?u=e(r,c):typeof e=="object"?u=b.createElement(n,ITe(e,r)):u=b.createElement(n,r),YTt(r)?b.createElement(La,{className:i},u):b.createElement(La,{className:l},u)}var FY=(t,e,n)=>{var r=Wn();return(s,i)=>o=>{t==null||t(s,i,o),r($2e({activeIndex:String(i),activeDataKey:e,activeCoordinate:s.tooltipPosition,activeGraphicalItemId:n}))}},$Y=t=>{var e=Wn();return(n,r)=>s=>{t==null||t(n,r,s),e(Zkt())}},zY=(t,e,n)=>{var r=Wn();return(s,i)=>o=>{t==null||t(s,i,o),r(eAt({activeIndex:String(i),activeDataKey:e,activeCoordinate:s.tooltipPosition,activeGraphicalItemId:n}))}};function LTe(t){var e=t.tooltipEntrySettings,n=Wn(),r=Vl(),s=b.useRef(null);return b.useLayoutEffect(()=>{r||(s.current===null?n(Ykt(e)):s.current!==e&&n(Xkt({prev:s.current,next:e})),s.current=e)},[e,n,r]),b.useLayoutEffect(()=>()=>{s.current&&(n(Jkt(s.current)),s.current=null)},[n]),null}function XTt(t){var e=t.legendPayload,n=Wn(),r=Vl(),s=b.useRef(null);return b.useLayoutEffect(()=>{r||(s.current===null?n(LAe(e)):s.current!==e&&n(FAe({prev:s.current,next:e})),s.current=e)},[n,r,e]),b.useLayoutEffect(()=>()=>{s.current&&(n($Ae(s.current)),s.current=null)},[n]),null}function JTt(t){var e=t.legendPayload,n=Wn(),r=mt(Rn),s=b.useRef(null);return b.useLayoutEffect(()=>{r!=="centric"&&r!=="radial"||(s.current===null?n(LAe(e)):s.current!==e&&n(FAe({prev:s.current,next:e})),s.current=e)},[n,r,e]),b.useLayoutEffect(()=>()=>{s.current&&(n($Ae(s.current)),s.current=null)},[n]),null}function QTt(t,e){return nPt(t)||tPt(t,e)||ePt(t,e)||ZTt()}function ZTt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 1329In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ePt(t,e){if(t){if(typeof t=="string")return $le(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$le(t,e):void 0}}function $le(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function tPt(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,u=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}
1329finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function nPt(t){if(Array.isArray(t))return t}var FTe="index",BY="append";function UY(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[],r=[];for(var s of n)r.push({status:"removed",prev:s});for(var i=0;i<e.length;i++){var o=t[i],l=e[i];o!=null?r.push({status:"matched",prev:o,next:l}):r.push({status:"added",next:l})}return r}function rPt(t,e){var n=t.length/e.length,r=e.map((s,i)=>t[Math.floor(i*n)]);return UY(r,e)}function sPt(t,e){var n=e.map((r,s)=>t[s]);return UY(n,e)}function iPt(t,e){for(var n=new Map,r=0;r<t.length;r++){var s=t[r];if(s!=null){var i=e(s,r);i!=null&&!n.has(i)&&n.set(i,s)}}return n}function aPt(t,e,n){var r=iPt(t,n),s=new Set,i=e.map((h,f)=>{var p=n(h,f);if(p!=null){var m=r.get(p);if(m!==void 0)return s.add(p),m}}),o=[];for(var l of r){var c=QTt(l,2),u=c[0],d=c[1];s.has(u)||o.push(d)}return UY(i,e,o)}function oPt(t,e,n){return e==null?null:t==null?e.map(r=>({status:"added",next:r})):n===FTe?rPt(t,e):n===BY?sPt(t,e):aPt(t,e,n)}function lPt(t,e){var n=b.useRef(t),r=b.useRef(e.current),s=b.useRef(!0);n.current!==t&&(n.current=t,r.current=e.current,s.current=!1);var i=b.useCallback(function(o,l){var c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(l===0){s.current=!0;return}l===1&&(r.current=o),l>0&&s.current&&c&&(e.current=o)},[e]);return{startValue:r.current,syncStepValue:i}}function cPt(t,e){return fPt(t)||hPt(t,e)||dPt(t,e)||uPt()}function uPt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 1330In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function dPt(t,e){if(t){if(typeof t=="string")return zle(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?zle(t,e):void 0}}function zle(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function hPt(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,u=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function fPt(t){if(Array.isArray(t))return t}function $Te(t,e){var n=b.useState(!1),r=cPt(n,2),s=r[0],i=r[1],o=b.useCallback(()=>{typeof t=="function"&&t(),i(!0)},[t]),l=b.useCallback(()=>{typeof e=="function"&&e(),i(!1)},[e]);return{isAnimating:s,handleAnimationStart:o,handleAnimationEnd:l}}function zTe(t){var e,n=t.animationInput,r=t.animationIdPrefix,s=t.items,i=t.previousItemsRef,o=t.isAnimationActive,l=t.animationBegin,c=t.animationDuration,u=t.animationEasing,d=t.onAnimationStart,h=t.onAnimationEnd,f=t.animationInterpolateFn,p=t.animationMatchBy,m=t.shouldUpdatePreviousRef,v=t.children,x=t.layout,g=KAe(n,r),w=lPt(g,i),_=(e=w.startValue)!==null&&e!==void 0?e:null,j=oPt(_,s,p??FTe);return b.createElement(WAe,{animationId:g,begin:l,duration:c,isActive:o,easing:u,onAnimationEnd:h,onAnimationStart:d,key:g},N=>{var S=_==null,C=s==null?s:f(j,N,x),k=m?m(N):N>0;return w.syncStepValue(C,N,k),C==null?null:v(C,N,S)})}var aB;function pPt(t,e){return xPt(t)||vPt(t,e)||gPt(t,e)||mPt()}function mPt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 1331In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function gPt(t,e){if(t){if(typeof t=="string")return Ble(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ble(t,e):void 0}}function Ble(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function vPt(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,u=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}
1331finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function xPt(t){if(Array.isArray(t))return t}var yPt=()=>{var t=b.useState(()=>Wk("uid-")),e=pPt(t,1),n=e[0];return n},bPt=(aB=kL.useId)!==null&&aB!==void 0?aB:yPt;function wPt(t,e){var n=bPt();return e||(t?"".concat(t,"-").concat(n):n)}var _Pt=b.createContext(void 0),BTe=t=>{var e=t.id,n=t.type,r=t.children,s=wPt("recharts-".concat(n),e);return b.createElement(_Pt.Provider,{value:s},r(s))},jPt={cartesianItems:[],polarItems:[]},UTe=Ba({name:"graphicalItems",initialState:jPt,reducers:{addCartesianGraphicalItem:{reducer(t,e){t.cartesianItems.push(e.payload)},prepare:xr()},replaceCartesianGraphicalItem:{reducer(t,e){var n=e.payload,r=n.prev,s=n.next,i=Sc(t).cartesianItems.indexOf(r);i>-1&&(t.cartesianItems[i]=s)},prepare:xr()},removeCartesianGraphicalItem:{reducer(t,e){var n=Sc(t).cartesianItems.indexOf(e.payload);n>-1&&t.cartesianItems.splice(n,1)},prepare:xr()},addPolarGraphicalItem:{reducer(t,e){t.polarItems.push(e.payload)},prepare:xr()},removePolarGraphicalItem:{reducer(t,e){var n=Sc(t).polarItems.indexOf(e.payload);n>-1&&t.polarItems.splice(n,1)},prepare:xr()},replacePolarGraphicalItem:{reducer(t,e){var n=e.payload,r=n.prev,s=n.next,i=Sc(t).polarItems.indexOf(r);i>-1&&(t.polarItems[i]=s)},prepare:xr()}}}),sS=UTe.actions,SPt=sS.addCartesianGraphicalItem,NPt=sS.replaceCartesianGraphicalItem,CPt=sS.removeCartesianGraphicalItem,kPt=sS.addPolarGraphicalItem,APt=sS.removePolarGraphicalItem,EPt=sS.replacePolarGraphicalItem,TPt=UTe.reducer,PPt=t=>{var e=Wn(),n=b.useRef(null);return b.useLayoutEffect(()=>{n.current===null?e(SPt(t)):n.current!==t&&e(NPt({prev:n.current,next:t})),n.current=t},[e,t]),b.useLayoutEffect(()=>()=>{n.current&&(e(CPt(n.current)),n.current=null)},[e]),null},MPt=b.memo(PPt),RPt=t=>{var e=Wn(),n=b.useRef(null);return b.useLayoutEffect(()=>{n.current===null?e(kPt(t)):n.current!==t&&e(EPt({prev:n.current,next:t})),n.current=t},[e,t]),b.useLayoutEffect(()=>()=>{n.current&&(e(APt(n.current)),n.current=null)},[e]),null},OPt=b.memo(RPt),IPt=["key"],DPt=["onMouseEnter","onClick","onMouseLeave"],LPt=["id"],FPt=["id"];function C0(){return C0=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},C0.apply(null,arguments)}function MF(t,e){if(t==null)return{};var n,r,s=$Pt(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function $Pt(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function Ule(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Ar(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Ule(Object(n),!0).forEach(function(r){zPt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ule(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function zPt(t,e,n){return(e=BPt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function BPt(t){var e=UPt(t,"string");return typeof e=="symbol"?e:e+""}function UPt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var qTe=QAe;function qPt(t){var e=b.useMemo(()=>LY(t.children,cT),[t.children]),n=mt(r=>FTt(r,t.id,e));return n==null?null:b.createElement(JTt,{legendPayload:n})}function VPt(t){if(!(t==null||typeof t=="boolean"||typeof t=="function")){if(b.isValidElement(t)){var e,n=(e=t.props)===null||e===void 0?void 0:e.fill;return typeof n=="string"?n:void 0}
1331var r=t.fill;return typeof r=="string"?r:void 0}}var HPt=b.memo(t=>{var e=t.dataKey,n=t.nameKey,r=t.sectors,s=t.stroke,i=t.strokeWidth,o=t.fill,l=t.name,c=t.hide,u=t.tooltipType,d=t.id,h=t.activeShape,f=VPt(h),p=r.map(v=>{var x=v.tooltipPayload;return f==null||x==null?x:x.map(g=>Ar(Ar({},g),{},{color:f,fill:f}))}),m={dataDefinedOnItem:p,getPosition:v=>{var x;return(x=r[Number(v)])===null||x===void 0?void 0:x.tooltipPosition},settings:{stroke:s,strokeWidth:i,fill:o,dataKey:e,nameKey:n,name:H4(l,e),hide:c,type:u,color:o,unit:"",graphicalItemId:d}};return b.createElement(LTe,{tooltipEntrySettings:m})}),WPt=(t,e)=>t>e?"start":t<e?"end":"middle",KPt=(t,e,n)=>Ta(typeof e=="function"?e(t):e,n,n*.8),GPt=(t,e,n)=>{var r=e.top,s=e.left,i=e.width,o=e.height,l=YAe(i,o),c=s+Ta(t.cx,i,i/2),u=r+Ta(t.cy,o,o/2),d=Ta(t.innerRadius,l,0),h=KPt(n,t.outerRadius,l),f=t.maxRadius||Math.sqrt(i*i+o*o)/2;return{cx:c,cy:u,innerRadius:d,outerRadius:h,maxRadius:f}},YPt=(t,e)=>{var n=Vi(e-t),r=Math.min(Math.abs(e-t),360);return n*r},XPt=(t,e)=>{if(b.isValidElement(t))return b.cloneElement(t,e);if(typeof t=="function")return t(e);var n=mn("recharts-pie-label-line",typeof t!="boolean"?t.className:"");e.key;var r=MF(e,IPt);return b.createElement(UAe,C0({},r,{type:"linear",className:n}))},JPt=(t,e,n)=>{if(b.isValidElement(t))return b.cloneElement(t,e);var r=n;if(typeof t=="function"&&(r=t(e),b.isValidElement(r)))return r;var s=mn("recharts-pie-label-text",TTe(t));return b.createElement(xF,C0({},e,{alignmentBaseline:"middle",className:s}),r)};function QPt(t){var e=t.sectors,n=t.props,r=t.showLabels,s=n.label,i=n.labelLine,o=n.dataKey;if(!r||!s||!e)return null;var l=dh(n),c=Hk(s),u=Hk(i),d=typeof s=="object"&&"offsetRadius"in s&&typeof s.offsetRadius=="number"&&s.offsetRadius||20,h=e.map((f,p)=>{var m=(f.startAngle+f.endAngle)/2,v=Cs(f.cx,f.cy,f.outerRadius+d,m),x=Ar(Ar(Ar(Ar({},l),f),{},{stroke:"none"},c),{},{index:p,textAnchor:WPt(v.x,f.cx)},v),g=Ar(Ar(Ar(Ar({},l),f),{},{fill:"none",stroke:f.fill},u),{},{index:p,points:[Cs(f.cx,f.cy,f.outerRadius,m),v],key:"line"});return b.createElement(Sh,{zIndex:vi.label,key:"label-".concat(f.startAngle,"-").concat(f.endAngle,"-").concat(f.midAngle,"-").concat(p)},b.createElement(La,null,i&&XPt(i,g),JPt(s,x,Qn(f,o))))});return b.createElement(La,{className:"recharts-pie-labels"},h)}function ZPt(t){var e=t.sectors,n=t.props,r=t.showLabels,s=n.label;return typeof s=="object"&&s!=null&&"position"in s?b.createElement(CTe,{label:s}):b.createElement(QPt,{sectors:e,props:n,showLabels:r})}function eMt(t){var e=t.sectors,n=t.activeShape,r=t.inactiveShape,s=t.allOtherPieProps,i=t.shape,o=t.id,l=t.animationElapsedTime,c=t.isAnimating,u=t.isEntrance,d=mt(N0),h=mt(CY),f=mt(tTe),p=s.onMouseEnter,m=s.onClick,v=s.onMouseLeave,x=MF(s,DPt),g=FY(p,s.dataKey,o),w=$Y(v),_=zY(m,s.dataKey,o);return e==null||e.length===0?null:b.createElement(b.Fragment,null,e.map((j,N)=>{if((j==null?void 0:j.startAngle)===0&&(j==null?void 0:j.endAngle)===0&&e.length!==1)return null;var S=f==null||f===o,C=String(N)===d&&(h==null||s.dataKey===h)&&S,k=d?r:null,E=n&&C?n:k,P=Ar(Ar({},j),{},{stroke:j.stroke,tabIndex:-1,index:N,isActive:C,animationElapsedTime:l,isAnimating:c,isEntrance:u,[_Ae]:N,[jAe]:o});return b.createElement(La,C0({key:"sector-".concat(j==null?void 0:j.startAngle,"-").concat(j==null?void 0:j.endAngle,"-").concat(j.midAngle,"-").concat(N),tabIndex:-1,className:"recharts-pie-sector"},U2(x,j,N),{onMouseEnter:g(j,N),onMouseLeave:w(j,N),onClick:_(j,N)}),b.createElement(DTe,{option:E??i,DefaultShape:qTe,shapeProps:P}))}))}function tMt(t){var e,n=t.pieSettings,r=t.displayedData,s=t.cells,i=t.offset,o=n.cornerRadius,l=n.startAngle,c=n.endAngle,u=n.dataKey,d=n.nameKey,h=n.tooltipType,f=Math.abs(n.minAngle),p=YPt(l,c),m=Math.abs(p),v=r.length<=1?0:(e=n.paddingAngle)!==null&&e!==void 0?e:0,x=r.filter(k=>Qn(k,u,0)!==0).length,g=(m>=360?x:x-1)*v,w=r.reduce((k,E)=>{var P=Qn(E,u,0);return k+(Ct(P)?P:0)},0),_=f>0&&w>0&&r.some(k=>{var E=Qn(k,u,0),P=(Ct(E)?E:0)/w;return E!==0&&P*m<f}),j=_?f:0,N=m-x*j-g,S;if(w>0){var C;S=r.map((k,E)=>{var P=Qn(k,u,0),T=Qn(k,d,E),M=GPt(n,i,k),R=(Ct(P)?P:0)/w,A,I=Ar(Ar({},k),s&&s[E]&&s[E].props),D=I!=null&&"fill"in I&&typeof I.fill=="string"?I.fill:n.fill;E?A=C.endAngle+Vi(p)*v*(P!==0?1:0):A=l;var O=A+Vi(p)*((P!==0?j:0)+R*N),z=(A+O)/2,B=(M.innerRadius+M.outerRadius)/2,G=[{name:T,value:P,payload:I,dataKey:u,type:h,color:D,fill:D,graphicalItemId:n.id}],U=Cs(M.cx,M.cy,B,z);return C=Ar(Ar(Ar(Ar({},n.presentationProps),{}
1331,{percent:R,cornerRadius:typeof o=="string"?parseFloat(o):o,name:T,tooltipPayload:G,midAngle:z,middleRadius:B,tooltipPosition:U},I),M),{},{value:P,dataKey:u,startAngle:A,endAngle:O,payload:I,paddingAngle:P!==0?Vi(p)*v:0}),C})}return S}function nMt(t){var e=t.showLabels,n=t.sectors,r=t.children,s=b.useMemo(()=>!e||!n?[]:n.map(i=>({value:i.value,payload:i.payload,clockWise:!1,parentViewBox:void 0,viewBox:{cx:i.cx,cy:i.cy,innerRadius:i.innerRadius,outerRadius:i.outerRadius,startAngle:i.startAngle,endAngle:i.endAngle,clockWise:!1},fill:i.fill})),[n,e]);return b.createElement(wTt,{value:e?s:void 0},r)}var rMt=(t,e)=>{if(t==null)return[];var n=[],r=t.find(i=>i.status!=="removed"),s=r?r.next.startAngle:0;return t.forEach((i,o)=>{if(i.status!=="removed"){var l=o>0?fh(i.next,"paddingAngle",0):0;if(i.status==="matched"){var c=ui(i.prev.endAngle-i.prev.startAngle,i.next.endAngle-i.next.startAngle,e),u=Ar(Ar({},i.next),{},{startAngle:s+l,endAngle:s+c+l});n.push(u),s=u.endAngle}else{var d=ui(0,i.next.endAngle-i.next.startAngle,e),h=Ar(Ar({},i.next),{},{startAngle:s+l,endAngle:s+d+l});n.push(h),s=h.endAngle}}}),n};function sMt(t){var e=t.props,n=t.previousSectorsRef,r=t.id,s=e.sectors,i=e.activeShape,o=e.inactiveShape,l=e.animationInterpolateFn,c=$Te(e.onAnimationStart,e.onAnimationEnd),u=c.isAnimating,d=c.handleAnimationStart,h=c.handleAnimationEnd,f=Wwt();return f==null?null:b.createElement(nMt,{showLabels:!u,sectors:s},b.createElement(zTe,{animationInput:e,animationIdPrefix:"recharts-pie-",items:s,previousItemsRef:n,isAnimationActive:e.isAnimationActive,animationBegin:e.animationBegin,animationDuration:e.animationDuration,animationEasing:e.animationEasing,onAnimationStart:d,onAnimationEnd:h,animationInterpolateFn:l,animationMatchBy:e.animationMatchBy,layout:f},(p,m,v)=>b.createElement(La,null,b.createElement(eMt,{sectors:p,activeShape:i,inactiveShape:o,allOtherPieProps:e,shape:e.shape,id:r,animationElapsedTime:m,isAnimating:u||m<1,isEntrance:v}))),b.createElement(ZPt,{showLabels:!u,sectors:s,props:e}),e.children)}var iMt={animationBegin:400,animationDuration:1500,animationEasing:"ease",animationInterpolateFn:rMt,animationMatchBy:BY,cx:"50%",cy:"50%",dataKey:"value",endAngle:360,fill:"#808080",hide:!1,innerRadius:0,isAnimationActive:"auto",label:!1,labelLine:!0,legendType:"rect",minAngle:0,nameKey:"name",outerRadius:"80%",paddingAngle:0,rootTabIndex:0,shape:qTe,startAngle:0,stroke:"#fff",zIndex:vi.area};function aMt(t){var e=t.id,n=MF(t,LPt),r=t.hide,s=t.className,i=t.rootTabIndex,o=b.useMemo(()=>LY(t.children,cT),[t.children]),l=mt(d=>$Tt(d,e,o)),c=b.useRef(null),u=mn("recharts-pie",s);return r||l==null?(c.current=null,b.createElement(La,{tabIndex:i,className:u})):b.createElement(Sh,{zIndex:t.zIndex},b.createElement(HPt,{dataKey:t.dataKey,nameKey:t.nameKey,sectors:l,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,tooltipType:t.tooltipType,id:e,activeShape:t.activeShape}),b.createElement(La,{tabIndex:i,className:u},b.createElement(sMt,{props:Ar(Ar({},n),{},{sectors:l}),previousSectorsRef:c,id:e})))}function oMt(t){var e=za(t,iMt),n=e.id,r=MF(e,FPt),s=dh(r);return b.createElement(BTe,{id:n,type:"pie"},i=>b.createElement(b.Fragment,null,b.createElement(OPt,{type:"pie",id:i,data:r.data,dataKey:r.dataKey,hide:r.hide,angleAxisId:0,radiusAxisId:0,name:r.name,nameKey:r.nameKey,tooltipType:r.tooltipType,legendType:r.legendType,fill:r.fill,cx:r.cx,cy:r.cy,startAngle:r.startAngle,endAngle:r.endAngle,paddingAngle:r.paddingAngle,minAngle:r.minAngle,innerRadius:r.innerRadius,outerRadius:r.outerRadius,cornerRadius:r.cornerRadius,presentationProps:s,maxRadius:e.maxRadius}),b.createElement(qPt,C0({},r,{id:i})),b.createElement(aMt,C0({},r,{id:i}))))}var VTe=oMt;VTe.displayName="Pie";function qle(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Vle(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};
1331e%2?qle(Object(n),!0).forEach(function(r){lMt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):qle(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function lMt(t,e,n){return(e=cMt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function cMt(t){var e=uMt(t,"string");return typeof e=="symbol"?e:e+""}function uMt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var HTe=0,dMt={xAxis:{},yAxis:{},zAxis:{}},WTe=Ba({name:"cartesianAxis",initialState:dMt,reducers:{addXAxis:{reducer(t,e){t.xAxis[e.payload.id]=e.payload},prepare:xr()},replaceXAxis:{reducer(t,e){var n=e.payload,r=n.prev,s=n.next;t.xAxis[r.id]!==void 0&&(r.id!==s.id&&delete t.xAxis[r.id],t.xAxis[s.id]=s)},prepare:xr()},removeXAxis:{reducer(t,e){delete t.xAxis[e.payload.id]},prepare:xr()},addYAxis:{reducer(t,e){t.yAxis[e.payload.id]=e.payload},prepare:xr()},replaceYAxis:{reducer(t,e){var n=e.payload,r=n.prev,s=n.next;t.yAxis[r.id]!==void 0&&(r.id!==s.id&&delete t.yAxis[r.id],t.yAxis[s.id]=s)},prepare:xr()},removeYAxis:{reducer(t,e){delete t.yAxis[e.payload.id]},prepare:xr()},addZAxis:{reducer(t,e){t.zAxis[e.payload.id]=e.payload},prepare:xr()},replaceZAxis:{reducer(t,e){var n=e.payload,r=n.prev,s=n.next;t.zAxis[r.id]!==void 0&&(r.id!==s.id&&delete t.zAxis[r.id],t.zAxis[s.id]=s)},prepare:xr()},removeZAxis:{reducer(t,e){delete t.zAxis[e.payload.id]},prepare:xr()},updateYAxisWidth(t,e){var n=e.payload,r=n.id,s=n.width,i=t.yAxis[r];if(i){var o,l=i.widthHistory||[];if(l.length===3&&l[0]===l[2]&&s===l[1]&&s!==i.width&&Math.abs(s-((o=l[0])!==null&&o!==void 0?o:0))<=1)return;var c=[...l,s].slice(-3);t.yAxis[r]=Vle(Vle({},i),{},{width:s,widthHistory:c})}}}}),Nh=WTe.actions,hMt=Nh.addXAxis,fMt=Nh.replaceXAxis,pMt=Nh.removeXAxis,mMt=Nh.addYAxis,gMt=Nh.replaceYAxis,vMt=Nh.removeYAxis;Nh.addZAxis;Nh.replaceZAxis;Nh.removeZAxis;var xMt=Nh.updateYAxisWidth,yMt=WTe.reducer,bMt=we([Xs],t=>({top:t.top,bottom:t.bottom,left:t.left,right:t.right})),wMt=we([bMt,vp,xp],(t,e,n)=>{if(!(!t||e==null||n==null))return{x:t.left,y:t.top,width:Math.max(0,e-t.left-t.right),height:Math.max(0,n-t.top-t.bottom)}}),KTe=()=>mt(wMt);function _Mt(t,e){return CMt(t)||NMt(t,e)||SMt(t,e)||jMt()}function jMt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 1332In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function SMt(t,e){if(t){if(typeof t=="string")return Hle(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Hle(t,e):void 0}}function Hle(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function NMt(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,u=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function CMt(t){if(Array.isArray(t))return t}var Wle=(t,e,n)=>{var r=n??t;if(!Ks(r))return Ta(r,e,0)},kMt=(t,e,n)=>{var r={},s=t.filter(sF),i=t.filter(u=>u.stackId==null),o=s.reduce((u,d)=>{var h=u[d.stackId];return h==null&&(h=[]),h.push(d),u[d.stackId]=h,u},r),l=Object.entries(o).map(u=>{var d,h=_Mt(u,2),f=h[0],p=h[1],m=p.map(x=>x.dataKey),v=Wle(e,n,(d=p[0])===null||d===void 0?void 0:d.barSize);return{stackId:f,dataKeys:m,barSize:v}}),c=i.map(u=>{var d=[u.dataKey].filter(f=>f!=null),h=Wle(e,n,u.barSize);return{stackId:void 0,dataKeys:d,barSize:h}});return[...l,...c]};function Kle(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function oM(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};
1332e%2?Kle(Object(n),!0).forEach(function(r){AMt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Kle(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function AMt(t,e,n){return(e=EMt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function EMt(t){var e=TMt(t,"string");return typeof e=="symbol"?e:e+""}function TMt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function PMt(t,e,n,r,s){var i,o=r.length;if(!(o<1)){var l=Ta(t,n,0,!0),c,u=[];if(An((i=r[0])===null||i===void 0?void 0:i.barSize)){var d=!1,h=n/o,f=r.reduce((w,_)=>w+(_.barSize||0),0);f+=(o-1)*l,f>=n&&(f-=(o-1)*l,l=0),f>=n&&h>0&&(d=!0,h*=.9,f=o*h);var p=Math.round((n-f)/2),m={offset:p-l,size:0};c=r.reduce((w,_)=>{var j,N={stackId:_.stackId,dataKeys:_.dataKeys,position:{offset:m.offset+m.size+l,size:d?h:(j=_.barSize)!==null&&j!==void 0?j:0}},S=[...w,N];return m=N.position,S},u)}else{var v=Ta(e,n,0,!0);n-2*v-(o-1)*l<=0&&(l=0);var x=(n-2*v-(o-1)*l)/o;x>1&&(x=Math.round(x));var g=An(s)?Math.min(x,s):x;c=r.reduce((w,_,j)=>[...w,{stackId:_.stackId,dataKeys:_.dataKeys,position:{offset:v+(x+l)*j+(x-g)/2,size:g}}],u)}return c}}var MMt=(t,e,n,r,s,i,o)=>{var l=Ks(o)?e:o,c=PMt(n,r,s!==i?s:i,t,l);return s!==i&&c!=null&&(c=c.map(u=>oM(oM({},u),{},{position:oM(oM({},u.position),{},{offset:u.position.offset-s/2})}))),c},RMt=(t,e)=>{var n=TG(e);if(!(!t||n==null||e==null)){var r=e.stackId;if(r!=null){var s=t[r];if(s){var i=s.stackedData;if(i)return i.find(o=>o.key===n)}}}},OMt=(t,e)=>{if(!(t==null||e==null)){var n=t.find(r=>r.stackId===e.stackId&&e.dataKey!=null&&r.dataKeys.includes(e.dataKey));if(n!=null)return n.position}};function IMt(t,e){return t&&typeof t=="object"&&"zIndex"in t&&typeof t.zIndex=="number"&&An(t.zIndex)?t.zIndex:e}var GTe=t=>{var e=t.chartData,n=Wn(),r=Vl();return b.useEffect(()=>r?()=>{}:(n(cle(e)),()=>{n(cle(void 0))}),[e,n,r]),null},Gle={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},YTe=Ba({name:"brush",initialState:Gle,reducers:{setBrushSettings(t,e){return e.payload==null?Gle:e.payload}}});YTe.actions.setBrushSettings;var DMt=YTe.reducer;function LMt(t){return(t%180+180)%180}var FMt=function(e){var n=e.width,r=e.height,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,i=LMt(s),o=i*Math.PI/180,l=Math.atan(r/n),c=o>l&&o<Math.PI-l?r/Math.sin(o):n/Math.cos(o);return Math.abs(c)},$Mt={dots:[],areas:[],lines:[]},XTe=Ba({name:"referenceElements",initialState:$Mt,reducers:{addDot:(t,e)=>{t.dots.push(e.payload)},removeDot:(t,e)=>{var n=Sc(t).dots.findIndex(r=>r===e.payload);n!==-1&&t.dots.splice(n,1)},addArea:(t,e)=>{t.areas.push(e.payload)},removeArea:(t,e)=>{var n=Sc(t).areas.findIndex(r=>r===e.payload);n!==-1&&t.areas.splice(n,1)},addLine:(t,e)=>{t.lines.push(e.payload)},removeLine:(t,e)=>{var n=Sc(t).lines.findIndex(r=>r===e.payload);n!==-1&&t.lines.splice(n,1)}}}),iS=XTe.actions;iS.addDot;iS.removeDot;iS.addArea;iS.removeArea;iS.addLine;iS.removeLine;var zMt=XTe.reducer;function BMt(t,e){return HMt(t)||VMt(t,e)||qMt(t,e)||UMt()}function UMt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 1333In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function qMt(t,e){if(t){if(typeof t=="string")return Yle(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Yle(t,e):void 0}}function Yle(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function VMt(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,u=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}
1333finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function HMt(t){if(Array.isArray(t))return t}var WMt=b.createContext(void 0),KMt=t=>{var e=t.children,n=b.useState("".concat(Wk("recharts"),"-clip")),r=BMt(n,1),s=r[0],i=KTe();if(i==null)return null;var o=i.x,l=i.y,c=i.width,u=i.height;return b.createElement(WMt.Provider,{value:s},b.createElement("defs",null,b.createElement("clipPath",{id:s},b.createElement("rect",{x:o,y:l,height:u,width:c}))),e)};function JTe(t,e){if(e<1)return[];if(e===1)return t;for(var n=[],r=0;r<t.length;r+=e){var s=t[r];s!==void 0&&n.push(s)}return n}function GMt(t,e,n){var r={width:t.width+e.width,height:t.height+e.height};return FMt(r,n)}function YMt(t,e,n){var r=n==="width",s=t.x,i=t.y,o=t.width,l=t.height;return e===1?{start:r?s:i,end:r?s+o:i+l}:{start:r?s+o:i+l,end:r?s:i}}function aA(t,e,n,r,s){if(t*e<t*r||t*e>t*s)return!1;var i=n();return t*(e-t*i/2-r)>=0&&t*(e+t*i/2-s)<=0}function XMt(t,e){return JTe(t,e+1)}function JMt(t,e,n,r,s){for(var i=(r||[]).slice(),o=e.start,l=e.end,c=0,u=1,d=o,h=function(){var m=r==null?void 0:r[c];if(m===void 0)return{v:JTe(r,u)};var v=c,x,g=()=>(x===void 0&&(x=n(m,v)),x),w=m.coordinate,_=c===0||aA(t,w,g,d,l);_||(c=0,d=o,u+=1),_&&(d=w+t*(g()/2+s),c+=u)},f;u<=i.length;)if(f=h(),f)return f.v;return[]}function QMt(t,e,n,r,s){var i=(r||[]).slice(),o=i.length;if(o===0)return[];for(var l=e.start,c=e.end,u=1;u<=o;u++){for(var d=(o-1)%u,h=l,f=!0,p=function(){var j=r[v];if(j==null)return 0;var N=v,S,C=()=>(S===void 0&&(S=n(j,N)),S),k=j.coordinate,E=v===d||aA(t,k,C,h,c);if(!E)return f=!1,1;E&&(h=k+t*(C()/2+s))},m,v=d;v<o&&(m=p(),!(m!==0&&m===1));v+=u);if(f){for(var x=[],g=d;g<o;g+=u){var w=r[g];w!=null&&x.push(w)}return x}}return[]}function Xle(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function ya(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Xle(Object(n),!0).forEach(function(r){ZMt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Xle(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function ZMt(t,e,n){return(e=eRt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function eRt(t){var e=tRt(t,"string");return typeof e=="symbol"?e:e+""}function tRt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function nRt(t,e,n,r,s){for(var i=(r||[]).slice(),o=i.length,l=e.start,c=e.end,u=function(f){var p=i[f];if(p==null)return 1;var m=p,v,x=()=>(v===void 0&&(v=n(p,f)),v);if(f===o-1){var g=t*(m.coordinate+t*x()/2-c);i[f]=m=ya(ya({},m),{},{tickCoord:g>0?m.coordinate-g*t:m.coordinate})}else i[f]=m=ya(ya({},m),{},{tickCoord:m.coordinate});if(m.tickCoord!=null){var w=aA(t,m.tickCoord,x,l,c);w&&(c=m.tickCoord-t*(x()/2+s),i[f]=ya(ya({},m),{},{isShow:!0}))}},d=o-1;d>=0;d--)u(d);return i}function rRt(t,e,n,r,s,i){var o=(r||[]).slice(),l=o.length,c=e.start,u=e.end;if(i){var d=r[l-1];if(d!=null){var h=n(d,l-1),f=t*(d.coordinate+t*h/2-u);if(o[l-1]=d=ya(ya({},d),{},{tickCoord:f>0?d.coordinate-f*t:d.coordinate}),d.tickCoord!=null){var p=aA(t,d.tickCoord,()=>h,c,u);p&&(u=d.tickCoord-t*(h/2+s),o[l-1]=ya(ya({},d),{},{isShow:!0}))}}}for(var m=i?l-1:l,v=function(w){var _=o[w];if(_==null)return 1;var j=_,N,S=()=>(N===void 0&&(N=n(_,w)),N);if(w===0){var C=t*(j.coordinate-t*S()/2-c);o[w]=j=ya(ya({},j),{},{tickCoord:C<0?j.coordinate-C*t:j.coordinate})}else o[w]=j=ya(ya({},j),{},{tickCoord:j.coordinate});if(j.tickCoord!=null){var k=aA(t,j.tickCoord,S,c,u);k&&(c=j.tickCoord+t*(S()/2+s),o[w]=ya(ya({},j),{},{isShow:!0}))}},x=0;x<m;x++)v(x);return o}function sRt(t,e,n){var r=t.tick,s=t.ticks,i=t.viewBox,o=t.minTickGap,l=t.orientation,c=t.
1333interval,u=t.tickFormatter,d=t.unit,h=t.angle;if(!s||!s.length||!r)return[];if(Ct(c)||J2.isSsr){var f;return(f=XMt(s,Ct(c)?c:0))!==null&&f!==void 0?f:[]}var p=[],m=l==="top"||l==="bottom"?"width":"height",v=d&&m==="width"?DC(d,{fontSize:e,letterSpacing:n}):{width:0,height:0},x=(N,S)=>{var C=typeof u=="function"?u(N.value,S):N.value;return m==="width"?GMt(DC(C,{fontSize:e,letterSpacing:n}),v,h):DC(C,{fontSize:e,letterSpacing:n})[m]},g=s[0],w=s[1],_=s.length>=2&&g!=null&&w!=null?Vi(w.coordinate-g.coordinate):1,j=YMt(i,_,m);return c==="equidistantPreserveStart"?JMt(_,j,x,s,o):c==="equidistantPreserveEnd"?QMt(_,j,x,s,o):(c==="preserveStart"||c==="preserveStartEnd"?p=rRt(_,j,x,s,o,c==="preserveStartEnd"):p=nRt(_,j,x,s,o),p.filter(N=>N.isShow))}var iRt=t=>{var e=t.ticks,n=t.label,r=t.labelGapWithTick,s=r===void 0?5:r,i=t.tickSize,o=i===void 0?0:i,l=t.tickMargin,c=l===void 0?0:l,u=0;if(e){Array.from(e).forEach(p=>{if(p){var m=p.getBoundingClientRect();m.width>u&&(u=m.width)}});var d=n?n.getBoundingClientRect().width:0,h=o+c,f=u+h+d+(n?s:0);return Math.round(f)}return 0},aRt={xAxis:{},yAxis:{}},QTe=Ba({name:"renderedTicks",initialState:aRt,reducers:{setRenderedTicks:(t,e)=>{var n=e.payload,r=n.axisType,s=n.axisId,i=n.ticks;t[r][s]=i},removeRenderedTicks:(t,e)=>{var n=e.payload,r=n.axisType,s=n.axisId;delete t[r][s]}}}),ZTe=QTe.actions,oRt=ZTe.setRenderedTicks,lRt=ZTe.removeRenderedTicks,cRt=QTe.reducer,uRt=["axisLine","width","height","className","hide","ticks","axisType","axisId"];function Jle(t,e){return pRt(t)||fRt(t,e)||hRt(t,e)||dRt()}function dRt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 1334In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hRt(t,e){if(t){if(typeof t=="string")return Qle(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Qle(t,e):void 0}}function Qle(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function fRt(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,u=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function pRt(t){if(Array.isArray(t))return t}function mRt(t,e){if(t==null)return{};var n,r,s=gRt(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function gRt(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function k0(){return k0=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},k0.apply(null,arguments)}function Zle(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Jr(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Zle(Object(n),!0).forEach(function(r){vRt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Zle(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function vRt(t,e,n){return(e=xRt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function xRt(t){var e=yRt(t,"string");return typeof e=="symbol"?e:e+""}function yRt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Hy={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
1334:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd",zIndex:vi.axis};function bRt(t){var e=t.x,n=t.y,r=t.width,s=t.height,i=t.orientation,o=t.mirror,l=t.axisLine,c=t.otherSvgProps;if(!l)return null;var u=Jr(Jr(Jr({},c),dh(l)),{},{fill:"none"});if(i==="top"||i==="bottom"){var d=+(i==="top"&&!o||i==="bottom"&&o);u=Jr(Jr({},u),{},{x1:e,y1:n+d*s,x2:e+r,y2:n+d*s})}else{var h=+(i==="left"&&!o||i==="right"&&o);u=Jr(Jr({},u),{},{x1:e+h*r,y1:n,x2:e+h*r,y2:n+s})}return b.createElement("line",k0({},u,{className:mn("recharts-cartesian-axis-line",fh(l,"className"))}))}function wRt(t,e,n,r,s,i,o,l,c){var u,d,h,f,p,m,v=l?-1:1,x=t.tickSize||o,g=Ct(t.tickCoord)?t.tickCoord:t.coordinate;switch(i){case"top":u=d=t.coordinate,f=n+ +!l*s,h=f-v*x,m=h-v*c,p=g;break;case"left":h=f=t.coordinate,d=e+ +!l*r,u=d-v*x,p=u-v*c,m=g;break;case"right":h=f=t.coordinate,d=e+ +l*r,u=d+v*x,p=u+v*c,m=g;break;default:u=d=t.coordinate,f=n+ +l*s,h=f+v*x,m=h+v*c,p=g;break}return{line:{x1:u,y1:h,x2:d,y2:f},tick:{x:p,y:m}}}function _Rt(t,e){switch(t){case"left":return e?"start":"end";case"right":return e?"end":"start";default:return"middle"}}function jRt(t,e){switch(t){case"left":case"right":return"middle";case"top":return e?"start":"end";default:return e?"end":"start"}}function SRt(t){var e=t.option,n=t.tickProps,r=t.value,s,i=mn(n.className,"recharts-cartesian-axis-tick-value");if(b.isValidElement(e))s=b.cloneElement(e,Jr(Jr({},n),{},{className:i}));else if(typeof e=="function")s=e(Jr(Jr({},n),{},{className:i}));else{var o="recharts-cartesian-axis-tick-value";typeof e!="boolean"&&(o=mn(o,TTe(e))),s=b.createElement(xF,k0({},n,{className:o}),r)}return s}function NRt(t){var e=t.ticks,n=t.axisType,r=t.axisId,s=Wn();return b.useEffect(()=>{if(r==null||n==null)return Gj;var i=e.map(o=>({value:o.value,coordinate:o.coordinate,offset:o.offset,index:o.index}));return s(oRt({ticks:i,axisId:r,axisType:n})),()=>{s(lRt({axisId:r,axisType:n}))}},[s,e,r,n]),null}var CRt=b.forwardRef((t,e)=>{var n=t.ticks,r=n===void 0?[]:n,s=t.tick,i=t.tickLine,o=t.stroke,l=t.tickFormatter,c=t.unit,u=t.padding,d=t.tickTextProps,h=t.orientation,f=t.mirror,p=t.x,m=t.y,v=t.width,x=t.height,g=t.tickSize,w=t.tickMargin,_=t.fontSize,j=t.letterSpacing,N=t.getTicksConfig,S=t.events,C=t.axisType,k=t.axisId,E=sRt(Jr(Jr({},N),{},{ticks:r}),_,j),P=dh(N),T=Hk(s),M=xTe(P.textAnchor)?P.textAnchor:_Rt(h,f),R=jRt(h,f),A={};typeof i=="object"&&(A=i);var I=Jr(Jr({},P),{},{fill:"none"},A),D=E.map(B=>Jr({entry:B},wRt(B,p,m,v,x,h,g,f,w))),O=D.map(B=>{var G=B.entry,U=B.line;return b.createElement(La,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(G.value,"-").concat(G.coordinate,"-").concat(G.tickCoord)},i&&b.createElement("line",k0({},I,U,{className:mn("recharts-cartesian-axis-tick-line",fh(i,"className"))})))}),z=D.map((B,G)=>{var U,F,W=B.entry,Q=B.tick,K=Jr(Jr(Jr(Jr({verticalAnchor:R},P),{},{textAnchor:M,stroke:"none",fill:o},Q),{},{index:G,payload:W,visibleTicksCount:E.length,tickFormatter:l,padding:u},d),{},{angle:(U=(F=d==null?void 0:d.angle)!==null&&F!==void 0?F:P.angle)!==null&&U!==void 0?U:0}),fe=Jr(Jr({},K),T);return b.createElement(La,k0({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(W.value,"-").concat(W.coordinate,"-").concat(W.tickCoord)}
1334,U2(S,W,G)),s&&b.createElement(SRt,{option:s,tickProps:fe,value:"".concat(typeof l=="function"?l(W.value,G):W.value).concat(c||"")}))});return b.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(C,"-ticks")},b.createElement(NRt,{ticks:E,axisId:k,axisType:C}),z.length>0&&b.createElement(Sh,{zIndex:vi.label},b.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(C,"-tick-labels"),ref:e},z)),O.length>0&&b.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(C,"-tick-lines")},O))}),kRt=b.forwardRef((t,e)=>{var n=t.axisLine,r=t.width,s=t.height,i=t.className,o=t.hide,l=t.ticks,c=t.axisType,u=t.axisId,d=mRt(t,uRt),h=b.useState(""),f=Jle(h,2),p=f[0],m=f[1],v=b.useState(""),x=Jle(v,2),g=x[0],w=x[1],_=b.useRef(null);b.useImperativeHandle(e,()=>({getCalculatedWidth:()=>{var N;return iRt({ticks:_.current,label:(N=t.labelRef)===null||N===void 0?void 0:N.current,labelGapWithTick:5,tickSize:t.tickSize,tickMargin:t.tickMargin})}}));var j=b.useCallback(N=>{if(N){var S=N.getElementsByClassName("recharts-cartesian-axis-tick-value");_.current=S;var C=S[0];if(C){var k=window.getComputedStyle(C),E=k.fontSize,P=k.letterSpacing;(E!==p||P!==g)&&(m(E),w(P))}}},[p,g]);return o||r!=null&&r<=0||s!=null&&s<=0?null:b.createElement(Sh,{zIndex:t.zIndex},b.createElement(La,{className:mn("recharts-cartesian-axis",i)},b.createElement(bRt,{x:t.x,y:t.y,width:r,height:s,orientation:t.orientation,mirror:t.mirror,axisLine:n,otherSvgProps:dh(t)}),b.createElement(CRt,{ref:j,axisType:c,events:d,fontSize:p,getTicksConfig:t,height:t.height,letterSpacing:g,mirror:t.mirror,orientation:t.orientation,padding:t.padding,stroke:t.stroke,tick:t.tick,tickFormatter:t.tickFormatter,tickLine:t.tickLine,tickMargin:t.tickMargin,tickSize:t.tickSize,tickTextProps:t.tickTextProps,ticks:l,unit:t.unit,width:t.width,x:t.x,y:t.y,axisId:u}),b.createElement(iTt,{x:t.x,y:t.y,width:t.width,height:t.height,lowerWidth:t.width,upperWidth:t.width},b.createElement(mTt,{label:t.label,labelRef:t.labelRef}),t.children)))}),qY=b.forwardRef((t,e)=>{var n=za(t,Hy);return b.createElement(kRt,k0({},n,{ref:e}))});qY.displayName="CartesianAxis";var ARt={},ePe=Ba({name:"errorBars",initialState:ARt,reducers:{addErrorBar:(t,e)=>{var n=e.payload,r=n.itemId,s=n.errorBar;t[r]||(t[r]=[]),t[r].push(s)},replaceErrorBar:(t,e)=>{var n=e.payload,r=n.itemId,s=n.prev,i=n.next;t[r]&&(t[r]=t[r].map(o=>o.dataKey===s.dataKey&&o.direction===s.direction?i:o))},removeErrorBar:(t,e)=>{var n=e.payload,r=n.itemId,s=n.errorBar;t[r]&&(t[r]=t[r].filter(i=>i.dataKey!==s.dataKey||i.direction!==s.direction))}}}),VY=ePe.actions;VY.addErrorBar;VY.replaceErrorBar;VY.removeErrorBar;var ERt=ePe.reducer,TRt=["children"];function PRt(t,e){if(t==null)return{};var n,r,s=MRt(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function MRt(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var RRt={data:[],xAxisId:"xAxis-0",yAxisId:"yAxis-0",dataPointFormatter:()=>({x:0,y:0,value:0}),errorBarOffset:0}
1334,ORt=b.createContext(RRt);function IRt(t){var e=t.children,n=PRt(t,TRt);return b.createElement(ORt.Provider,{value:n},e)}function tPe(t,e){var n,r,s=mt(u=>bp(u,t)),i=mt(u=>wp(u,e)),o=(n=s==null?void 0:s.allowDataOverflow)!==null&&n!==void 0?n:Is.allowDataOverflow,l=(r=i==null?void 0:i.allowDataOverflow)!==null&&r!==void 0?r:Ds.allowDataOverflow,c=o||l;return{needClip:c,needClipX:o,needClipY:l}}function DRt(t){var e=t.xAxisId,n=t.yAxisId,r=t.clipPathId,s=KTe(),i=tPe(e,n),o=i.needClipX,l=i.needClipY,c=i.needClip,u=mt(_=>S2e(_,e,!1)),d=mt(_=>N2e(_,n,!1));if(!c||!s)return null;var h=s.x,f=s.y,p=s.width,m=s.height,v=o&&u?Math.min(u[0],u[1]):h-p/2,x=l&&d?Math.min(d[0],d[1]):f-m/2,g=o&&u?Math.abs(u[1]-u[0]):p*2,w=l&&d?Math.abs(d[1]-d[0]):m*2;return b.createElement("clipPath",{id:"clipPath-".concat(r)},b.createElement("rect",{x:v,y:x,width:g,height:w}))}function H0(t,e){var n,r;return(n=(r=t.graphicalItems.cartesianItems.find(s=>s.id===e))===null||r===void 0?void 0:r.xAxisId)!==null&&n!==void 0?n:HTe}function W0(t,e){var n,r;return(n=(r=t.graphicalItems.cartesianItems.find(s=>s.id===e))===null||r===void 0?void 0:r.yAxisId)!==null&&n!==void 0?n:HTe}var LRt=["option"];function FRt(t,e){if(t==null)return{};var n,r,s=$Rt(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function $Rt(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var HY=GAe;function WY(t){var e=t.option,n=FRt(t,LRt);return b.createElement(DTe,{option:e,DefaultShape:HY,shapeProps:n,activeClassName:"recharts-active-bar",inActiveClassName:"recharts-inactive-bar"})}var zRt=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return(r,s)=>{if(Ct(e))return e;var i=Ct(r)||Ks(r);return i?e(r,s):(i||Vn(!1),n)}},BRt=(t,e,n)=>n,URt=(t,e)=>e,uT=we([sY,URt],(t,e)=>t.filter(n=>n.type==="bar").find(n=>n.id===e)),qRt=we([uT],t=>t==null?void 0:t.maxBarSize),VRt=(t,e,n,r)=>r,HRt=we([Rn,sY,H0,W0,BRt],(t,e,n,r,s)=>e.filter(i=>t==="horizontal"?i.xAxisId===n:i.yAxisId===r).filter(i=>i.isPanorama===s).filter(i=>i.hide===!1).filter(i=>i.type==="bar")),WRt=(t,e,n)=>{var r=Rn(t),s=H0(t,e),i=W0(t,e);if(!(s==null||i==null))return r==="horizontal"?nH(t,"yAxis",i,n):nH(t,"xAxis",s,n)},KRt=(t,e)=>{var n=Rn(t),r=H0(t,e),s=W0(t,e);if(!(r==null||s==null))return n==="horizontal"?Joe(t,"xAxis",r):Joe(t,"yAxis",s)},GRt=we([HRt,nSt,KRt],kMt),YRt=(t,e,n)=>{var r,s,i=uT(t,e);if(i==null)return 0;var o=H0(t,e),l=W0(t,e);if(o==null||l==null)return 0;var c=Rn(t),u=dEe(t),d=i.maxBarSize,h=Ks(d)?u:d,f,p;return c==="horizontal"?(f=vj(t,"xAxis",o,n),p=gj(t,"xAxis",o,n)):(f=vj(t,"yAxis",l,n),p=gj(t,"yAxis",l,n)),(r=(s=TD(f,p,!0))!==null&&s!==void 0?s:h)!==null&&r!==void 0?r:0},nPe=(t,e,n)=>{var r=Rn(t),s=H0(t,e),i=W0(t,e);if(!(s==null||i==null)){var o,l;return r==="horizontal"?(o=vj(t,"xAxis",s,n),l=gj(t,"xAxis",s,n)):(o=vj(t,"yAxis",i,n),l=gj(t,"yAxis",i,n)),TD(o,l)}},XRt=we([GRt,dEe,tSt,hEe,YRt,nPe,qRt],MMt),JRt=(t,e,n)=>{var r=H0(t,e);if(r!=null)return vj(t,"xAxis",r,n)},QRt=(t,e,n)=>{var r=W0(t,e);if(r!=null)return vj(t,"yAxis",r,n)},ZRt=(t,e,n)=>{var r=H0(t,e);if(r!=null)return gj(t,"xAxis",r,n)},eOt=(t,e,n)=>{var r=W0(t,e);if(r!=null)return gj(t,"yAxis",r,n)},tOt=we([XRt,uT],OMt),nOt=we([WRt,uT],RMt),rOt=we([Xs,fG,JRt,QRt,ZRt,eOt,tOt,Rn,Fjt,nPe,nOt,uT,VRt],(t,e,n,r,s,i,o,l,c,u,d,h,f)=>{var p=c.chartData,m=c.dataStartIndex,v=c.dataEndIndex;if(!(h==null||o==null||e==null||l!=="horizontal"&&l!=="vertical"||n==null||r==null||s==null||i==null||u==null)){var x=h.data,g;if(x!=null&&x.length>0?g=x:g=p==null?void 0:p.slice(m,v+1),g!=null)return DOt({layout:l,barSettings:h,pos:o,parentViewBox:e,bandSize:u,xAxis:n,yAxis:r,xAxisTicks:s,yAxisTicks:i,stackedData:d,displayedData:g,offset:t,cells:f,dataStartIndex:m})}}),sOt=["index"];function oH(){return oH=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},oH.apply(null,arguments)}function iOt(t,e){if(t==null)return{};var n,r,s=aOt(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function aOt(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var rPe=b.createContext(void 0),oOt=t=>{var e=b.useContext(rPe);if(e!=null)return e.stackId;if(t!=null)return rwt(t)},lOt=(t,e)=>"recharts-bar-stack-clip-path-".concat(t,"-").concat(e),cOt=t=>{var e=b.useContext(rPe);if(e!=null){var n=e.stackId;
1334return"url(#".concat(lOt(n,t),")")}},sPe=t=>{var e=t.index,n=iOt(t,sOt),r=cOt(e);return b.createElement(La,oH({className:"recharts-bar-stack-layer",clipPath:r},n))},uOt=["onMouseEnter","onMouseLeave","onClick"],dOt=["value","background","tooltipPosition"],hOt=["id"],fOt=["onMouseEnter","onClick","onMouseLeave"];function ece(t,e){return vOt(t)||gOt(t,e)||mOt(t,e)||pOt()}function pOt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 1335In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function mOt(t,e){if(t){if(typeof t=="string")return tce(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?tce(t,e):void 0}}function tce(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function gOt(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,u=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function vOt(t){if(Array.isArray(t))return t}function Wg(){return Wg=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Wg.apply(null,arguments)}function nce(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Us(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?nce(Object(n),!0).forEach(function(r){xOt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):nce(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function xOt(t,e,n){return(e=yOt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function yOt(t){var e=bOt(t,"string");return typeof e=="symbol"?e:e+""}function bOt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function nL(t,e){if(t==null)return{};var n,r,s=wOt(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function wOt(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var _Ot=t=>{var e=t.dataKey,n=t.name,r=t.fill,s=t.legendType,i=t.hide;return[{inactive:i,dataKey:e,type:s,color:r,value:H4(n,e),payload:t}]},jOt=b.memo(t=>{var e=t.dataKey,n=t.stroke,r=t.strokeWidth,s=t.fill,i=t.name,o=t.hide,l=t.unit,c=t.tooltipType,u=t.id,d={dataDefinedOnItem:void 0,getPosition:Gj,settings:{stroke:n,strokeWidth:r,fill:s,dataKey:e,nameKey:void 0,name:H4(i,e),hide:o,type:c,color:s,unit:l,graphicalItemId:u}};return b.createElement(LTe,{tooltipEntrySettings:d})});function SOt(t){var e=mt(N0),n=t.data,r=t.dataKey,s=t.background,i=t.allOtherBarProps,o=i.onMouseEnter,l=i.onMouseLeave,c=i.onClick,u=nL(i,uOt),d=FY(o,r,i.id),h=$Y(l),f=zY(c,r,i.id);if(!s||n==null)return null;var p=Hk(s);return b.createElement(Sh,{zIndex:IMt(s,vi.barBackground)},n.map((m,v)=>{m.value;var x=m.background;m.tooltipPosition;var g=nL(m,dOt);if(!x)return null;var w=d(m,m.originalDataIndex),_=h(m,m.originalDataIndex),j=f(m,m.originalDataIndex),N=Us(Us(Us(Us(Us({option:s,isActive:String(m.originalDataIndex)===e},g),{},{fill:"#eee"},x),p),U2(u,m,v)),{},{onMouseEnter:w,onMouseLeave:_,onClick:j,dataKey:r,index:v,className:"recharts-bar-background-rectangle"});return b.createElement(WY,Wg({key:"background-bar-".concat(v)},N))}))}function NOt(t){var e=t.showLabels,n=t.children,r=t.rects,s=r==null?void 0:r.map(i=>{var o={x:i.x,y:i.y,width:i.width,lowerWidth:i.width,upperWidth:i.width,height:i.height};return Us(Us({},o),{},{value:i.value,payload:i.payload,parentViewBox:i.parentViewBox,viewBox:o,fill:i.fill})});return b.createElement(bTt,{value:e?s:void 0},n)}function COt(t){var e=t.shape,n=t.activeBar,r=t.baseProps,s=t.entry,i=t.index,o=t.dataKey,l=mt(N0),c=mt(CY),u=n&&String(s.originalDataIndex)===l&&(c==null||o===c),d=b.useState(!1),h=ece(d,2),f=h[0],p=h[1],m=b.useState(!1),v=ece(m,2),x=v[0],g=v[1];b.useEffect(()=>{var C;return u?(p(!0),C=requestAnimationFrame(()=>{g(!0)})):g(!1),()=>{cancelAnimationFrame(C)}},[u]);var w=b.useCallback(()=>{u||p(!1)},[u]),_=u&&x,j=u||f,N;u?n===!0?N=e:N=n:N=e;var S=b.createElement(WY,Wg({},r,{name:String(r.name)},s,{isActive:_,option:N,index:i,dataKey:o,animationElapsedTime:t.animationElapsedTime,isAnimating:t.isAnimating,isEntrance:t.isEntrance,onTransitionEnd:w}));return j?b.createElement(Sh,{zIndex:vi.activeBar},b.createElement(sPe,{index:s.originalDataIndex},S)):S}function kOt(t){var e=t.shape,n=t.baseProps,r=t.entry,s=t.index,i=t.dataKey;return b.createElement(WY,Wg({},n,{name:String(n.name)},r,{isActive:!1,option:e,index:s,dataKey:i,animationElapsedTime:t.animationElapsedTime,isAnimating:t.isAnimating,isEntrance:t.isEntrance}))}function AOt(t){var e,n=t.data,r=t.props,s=t.animationElapsedTime,i=t.
1335isAnimating,o=t.isEntrance,l=(e=dh(r))!==null&&e!==void 0?e:{},c=l.id,u=nL(l,hOt),d=r.shape,h=r.dataKey,f=r.activeBar,p=r.onMouseEnter,m=r.onClick,v=r.onMouseLeave,x=nL(r,fOt),g=FY(p,h,c),w=$Y(v),_=zY(m,h,c);return n?b.createElement(b.Fragment,null,n.map((j,N)=>b.createElement(sPe,Wg({index:j.originalDataIndex,key:"rectangle-".concat(j==null?void 0:j.x,"-").concat(j==null?void 0:j.y,"-").concat(j==null?void 0:j.value,"-").concat(N),className:"recharts-bar-rectangle"},U2(x,j,N),{onMouseEnter:g(j,j.originalDataIndex),onMouseLeave:w(j,j.originalDataIndex),onClick:_(j,j.originalDataIndex)}),f?b.createElement(COt,{shape:d,activeBar:f,baseProps:u,entry:j,index:N,dataKey:h,animationElapsedTime:s,isAnimating:i,isEntrance:o}):b.createElement(kOt,{shape:d,baseProps:u,entry:j,index:N,dataKey:h,animationElapsedTime:s,isAnimating:i,isEntrance:o})))):null}var EOt=(t,e,n)=>t==null?[]:e===1?t.flatMap(r=>r.status==="removed"?[]:[r.next]):t.flatMap(r=>{if(r.status==="removed")return n==="horizontal"?[Us(Us({},r.prev),{},{height:ui(r.prev.height,0,e),y:ui(r.prev.y,r.prev.y+r.prev.height,e)})]:[Us(Us({},r.prev),{},{width:ui(r.prev.width,0,e)})];if(r.status==="matched")return[Us(Us({},r.next),{},{x:ui(r.prev.x,r.next.x,e),y:ui(r.prev.y,r.next.y,e),width:ui(r.prev.width,r.next.width,e),height:ui(r.prev.height,r.next.height,e)})];var s=r.next;return n==="horizontal"?[Us(Us({},s),{},{height:ui(0,s.height,e),y:ui(s.stackedBarStart,s.y,e)})]:[Us(Us({},s),{},{width:ui(0,s.width,e),x:ui(s.stackedBarStart,s.x,e)})]});function TOt(t){var e=t.props,n=t.previousRectanglesRef,r=e.data,s=e.isAnimationActive,i=e.animationBegin,o=e.animationDuration,l=e.animationEasing,c=e.animationInterpolateFn,u=e.layout,d=$Te(e.onAnimationStart,e.onAnimationEnd),h=d.isAnimating,f=d.handleAnimationStart,p=d.handleAnimationEnd;return b.createElement(NOt,{showLabels:!h,rects:r},b.createElement(zTe,{animationInput:r,animationIdPrefix:"recharts-bar-",items:r,previousItemsRef:n,isAnimationActive:s,animationBegin:i,animationDuration:o,animationEasing:l,onAnimationStart:f,onAnimationEnd:p,animationInterpolateFn:c,animationMatchBy:e.animationMatchBy,layout:u},(m,v,x)=>b.createElement(La,null,b.createElement(AOt,{props:e,data:m,animationElapsedTime:v,isAnimating:h||v<1,isEntrance:x}))),b.createElement(CTe,{label:e.label}),e.children)}function POt(t){var e=b.useRef(null);return b.createElement(TOt,{previousRectanglesRef:e,props:t})}var iPe=0,MOt=(t,e)=>{var n=Array.isArray(t.value)?t.value[1]:t.value;return{x:t.x,y:t.y,value:n,errorVal:Qn(t,e)}};class ROt extends b.PureComponent{render(){var e=this.props,n=e.hide,r=e.data,s=e.dataKey,i=e.className,o=e.xAxisId,l=e.yAxisId,c=e.needClip,u=e.background,d=e.id;if(n||r==null)return null;var h=mn("recharts-bar",i),f=d;return b.createElement(La,{className:h,id:d},c&&b.createElement("defs",null,b.createElement(DRt,{clipPathId:f,xAxisId:o,yAxisId:l})),b.createElement(La,{className:"recharts-bar-rectangles",clipPath:c?"url(#clipPath-".concat(f,")"):void 0},b.createElement(SOt,{data:r,dataKey:s,background:u,allOtherBarProps:this.props}),b.createElement(POt,this.props)))}}var OOt={activeBar:!1,animationBegin:0,animationDuration:400,animationEasing:"ease",animationInterpolateFn:EOt,animationMatchBy:BY,background:!1,hide:!1,isAnimationActive:"auto",label:!1,legendType:"rect",minPointSize:iPe,shape:HY,xAxisId:0,yAxisId:0,zIndex:vi.bar};function IOt(t){var e=t.xAxisId,n=t.yAxisId,r=t.hide,s=t.legendType,i=t.minPointSize,o=t.activeBar,l=t.animationBegin,c=t.animationDuration,u=t.animationEasing,d=t.isAnimationActive,h=tPe(e,n),f=h.needClip,p=Yj(),m=Vl(),v=LY(t.children,cT),x=mt(_=>rOt(_,t.id,m,v));if(p!=="vertical"&&p!=="horizontal")return null;var g,w=x==null?void 0:x[0];return w==null||w.height==null||w.width==null?g=0:g=p==="vertical"?w.height/2:w.width/2,b.createElement(IRt,{xAxisId:e,yAxisId:n,data:x,dataPointFormatter:MOt,errorBarOffset:g},b.createElement(ROt,Wg({},t,{layout:p,needClip:f,data:x,xAxisId:e,yAxisId:n,hide:r,legendType:s,minPointSize:i,activeBar:o,animationBegin:l,animationDuration:c,animationEasing:u,isAnimationActive:d})))}function DOt(t){var e=t.layout,n=t.barSettings,r=n.dataKey,s=n.minPointSize,i=n.hasCustomShape,o=t.pos,l=t.bandSize,c=t.xAxis,u=t.yAxis,d=t.xAxisTicks,h=t.yAxisTicks,f=t.stackedData,p=t.displayedData,m=t.offset,v=t.cells,x=t.parentViewBox,g=t.dataStartIndex,w=e==="horizontal"?u:c,_=f?w.scale.domain():null,j=swt({numericAxis:w}),N=w.scale.map(j);return p.map((S,C)=>{var k,E,P,T,M,R;if(f){var A=f[C+g];if(A==null)return null;
1335k=Qbt(A,_)}else k=Qn(S,r),Array.isArray(k)||(k=[j,k]);var I=zRt(s,iPe)(k[1],C);if(e==="horizontal"){var D,O=u.scale.map(k[0]),z=u.scale.map(k[1]);if(O==null||z==null)return null;E=Vie({axis:c,ticks:d,bandSize:l,offset:o.offset,entry:S,index:C}),P=(D=z??O)!==null&&D!==void 0?D:void 0,T=o.size;var B=O-z;if(M=ph(B)?0:B,R={x:E,y:m.top,width:T,height:m.height},Math.abs(I)>0&&Math.abs(M)<Math.abs(I)){var G=Vi(M||I)*(Math.abs(I)-Math.abs(M));P-=G,M+=G}}else{var U=c.scale.map(k[0]),F=c.scale.map(k[1]);if(U==null||F==null)return null;if(E=U,P=Vie({axis:u,ticks:h,bandSize:l,offset:o.offset,entry:S,index:C}),T=F-U,M=o.size,R={x:m.left,y:P,width:m.width,height:M},Math.abs(I)>0&&Math.abs(T)<Math.abs(I)){var W=Vi(T||I)*(Math.abs(I)-Math.abs(T));T+=W}}if(E==null||P==null||T==null||M==null||!i&&(T===0||M===0))return null;var Q=Us(Us({},S),{},{stackedBarStart:N,x:E,y:P,width:T,height:M,value:f?k:k[1],payload:S,background:R,tooltipPosition:{x:E+T/2,y:P+M/2},parentViewBox:x,originalDataIndex:C},v&&v[C]&&v[C].props);return Q}).filter(Boolean)}function LOt(t){var e=za(t,OOt),n=oOt(e.stackId),r=Vl();return b.createElement(BTe,{id:e.id,type:"bar"},s=>b.createElement(b.Fragment,null,b.createElement(XTt,{legendPayload:_Ot(e)}),b.createElement(jOt,{dataKey:e.dataKey,stroke:e.stroke,strokeWidth:e.strokeWidth,fill:e.fill,name:e.name,hide:e.hide,unit:e.unit,tooltipType:e.tooltipType,id:s}),b.createElement(MPt,{type:"bar",id:s,data:void 0,xAxisId:e.xAxisId,yAxisId:e.yAxisId,zAxisId:0,dataKey:e.dataKey,stackId:n,hide:e.hide,barSize:e.barSize,minPointSize:e.minPointSize,maxBarSize:e.maxBarSize,isPanorama:r,hasCustomShape:e.shape!=null&&e.shape!==HY}),b.createElement(Sh,{zIndex:e.zIndex},b.createElement(IOt,Wg({},e,{id:s})))))}var rL=b.memo(LOt,X2);rL.displayName="Bar";var FOt=["domain","range"],$Ot=["domain","range"];function rce(t,e){if(t==null)return{};var n,r,s=zOt(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function zOt(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function sce(t,e){return t===e?!0:Array.isArray(t)&&t.length===2&&Array.isArray(e)&&e.length===2?t[0]===e[0]&&t[1]===e[1]:!1}function aPe(t,e){if(t===e)return!0;var n=t.domain,r=t.range,s=rce(t,FOt),i=e.domain,o=e.range,l=rce(e,$Ot);return!sce(n,i)||!sce(r,o)?!1:X2(s,l)}var BOt=["type"],UOt=["dangerouslySetInnerHTML","ticks","scale"],qOt=["id","scale"];function lH(){return lH=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},lH.apply(null,arguments)}function ice(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function ace(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ice(Object(n),!0).forEach(function(r){VOt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ice(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function VOt(t,e,n){return(e=HOt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function HOt(t){var e=WOt(t,"string");return typeof e=="symbol"?e:e+""}function WOt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function cH(t,e){if(t==null)return{};var n,r,s=KOt(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function KOt(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function GOt(t){var e=Wn(),n=b.useRef(null),r=EAe(),s=t.type,i=cH(t,BOt),o=nF(r,"xAxis",s),l=b.useMemo(()=>
1335{if(o!=null)return ace(ace({},i),{},{type:o})},[i,o]);return b.useLayoutEffect(()=>{l!=null&&(n.current===null?e(hMt(l)):n.current!==l&&e(fMt({prev:n.current,next:l})),n.current=l)},[l,e]),b.useLayoutEffect(()=>()=>{n.current&&(e(pMt(n.current)),n.current=null)},[e]),null}var YOt=t=>{var e=t.xAxisId,n=t.className,r=mt(fG),s=Vl(),i="xAxis",o=mt(f=>R2e(f,i,e,s)),l=mt(f=>T2e(f,e)),c=mt(f=>Lkt(f,e)),u=mt(f=>a2e(f,e));if(l==null||c==null||u==null)return null;t.dangerouslySetInnerHTML,t.ticks,t.scale;var d=cH(t,UOt);u.id,u.scale;var h=cH(u,qOt);return b.createElement(qY,lH({},d,h,{x:c.x,y:c.y,width:l.width,height:l.height,className:mn("recharts-".concat(i," ").concat(i),n),viewBox:r,ticks:o,axisType:i,axisId:e}))},XOt={allowDataOverflow:Is.allowDataOverflow,allowDecimals:Is.allowDecimals,allowDuplicatedCategory:Is.allowDuplicatedCategory,angle:Is.angle,axisLine:Hy.axisLine,height:Is.height,hide:!1,includeHidden:Is.includeHidden,interval:Is.interval,label:!1,minTickGap:Is.minTickGap,mirror:Is.mirror,orientation:Is.orientation,padding:Is.padding,reversed:Is.reversed,scale:Is.scale,tick:Is.tick,tickCount:Is.tickCount,tickLine:Hy.tickLine,tickSize:Hy.tickSize,type:Is.type,niceTicks:Is.niceTicks,xAxisId:0},JOt=t=>{var e=za(t,XOt);return b.createElement(b.Fragment,null,b.createElement(GOt,{allowDataOverflow:e.allowDataOverflow,allowDecimals:e.allowDecimals,allowDuplicatedCategory:e.allowDuplicatedCategory,angle:e.angle,dataKey:e.dataKey,domain:e.domain,height:e.height,hide:e.hide,id:e.xAxisId,includeHidden:e.includeHidden,interval:e.interval,minTickGap:e.minTickGap,mirror:e.mirror,name:e.name,orientation:e.orientation,padding:e.padding,reversed:e.reversed,scale:e.scale,tick:e.tick,tickCount:e.tickCount,tickFormatter:e.tickFormatter,ticks:e.ticks,type:e.type,unit:e.unit,niceTicks:e.niceTicks}),b.createElement(YOt,e))},KY=b.memo(JOt,aPe);KY.displayName="XAxis";var QOt=["type"],ZOt=["dangerouslySetInnerHTML","ticks","scale"],eIt=["id","scale"];function uH(){return uH=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},uH.apply(null,arguments)}function oce(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function lce(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?oce(Object(n),!0).forEach(function(r){tIt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):oce(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function tIt(t,e,n){return(e=nIt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function nIt(t){var e=rIt(t,"string");return typeof e=="symbol"?e:e+""}function rIt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function dH(t,e){if(t==null)return{};var n,r,s=sIt(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function sIt(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function iIt(t){var e=Wn(),n=b.useRef(null),r=EAe(),s=t.type,i=dH(t,QOt),o=nF(r,"yAxis",s),l=b.useMemo(()=>{if(o!=null)return lce(lce({},i),{},{type:o})},[o,i]);return b.useLayoutEffect(()=>{l!=null&&(n.current===null?e(mMt(l)):n.current!==l&&e(gMt({prev:n.current,next:l})),n.current=l)},[l,e]),b.useLayoutEffect(()=>()=>{n.current&&(e(vMt(n.current)),n.current=null)},[e]),null}function aIt(t){var e=t.yAxisId,n=t.className,r=t.width,s=t.label,i=b.useRef(null),o=b.useRef(null),l=mt(fG),c=Vl(),u=Wn(),d="yAxis",h=mt(g=>P2e(g,e)),f=mt(g=>$kt(g,e)),p=mt(g=>R2e(g,d,e,c)),m=mt(g=>o2e(g,e));if(b.useLayoutEffect(()=>{if(!(r!=="auto"||!h||MY(s)||b.isValidElement(s)||m==null)){var g=i.current;if(g){var w=g.getCalculatedWidth();Math.round(h.width)!==Math.round(w)&&u(xMt({id:e,width:w}))}}},[p,h,u,s,e,r,m]),h==null||f==null||m==null)return null;t.dangerouslySetInnerHTML,t.ticks,t.scale;var v=dH(t,ZOt);m.id,m.scale;var x=dH(m,eIt);return b.createElement(qY,uH({},v,x,{ref:i,labelRef:o,x:f.x,y:f.y,tickTextProps:r==="auto"?{width:void 0}:{width:r},width:h.width,height:h.height,className:mn("recharts-".concat(d," ").concat(d),n),viewBox:l,ticks:p,axisType:d,axisId:e}))}var oIt={allowDataOverflow:Ds.allowDataOverflow,allowDecimals:Ds.allowDecimals,allowDuplicatedCategory:Ds.allowDuplicatedCategory,angle:Ds.angle,axisLine
1335:Hy.axisLine,hide:!1,includeHidden:Ds.includeHidden,interval:Ds.interval,label:!1,minTickGap:Ds.minTickGap,mirror:Ds.mirror,orientation:Ds.orientation,padding:Ds.padding,reversed:Ds.reversed,scale:Ds.scale,tick:Ds.tick,tickCount:Ds.tickCount,tickLine:Hy.tickLine,tickSize:Hy.tickSize,type:Ds.type,niceTicks:Ds.niceTicks,width:Ds.width,yAxisId:0},lIt=t=>{var e=za(t,oIt);return b.createElement(b.Fragment,null,b.createElement(iIt,{interval:e.interval,id:e.yAxisId,scale:e.scale,type:e.type,domain:e.domain,allowDataOverflow:e.allowDataOverflow,dataKey:e.dataKey,allowDuplicatedCategory:e.allowDuplicatedCategory,allowDecimals:e.allowDecimals,tickCount:e.tickCount,padding:e.padding,includeHidden:e.includeHidden,reversed:e.reversed,ticks:e.ticks,width:e.width,orientation:e.orientation,mirror:e.mirror,hide:e.hide,unit:e.unit,name:e.name,angle:e.angle,minTickGap:e.minTickGap,tick:e.tick,tickFormatter:e.tickFormatter,niceTicks:e.niceTicks}),b.createElement(aIt,e))},GY=b.memo(lIt,aPe);GY.displayName="YAxis";var cIt=(t,e)=>e,YY=we([cIt,Rn,yEe,_i,J2e,_p,aEt,Xs],fEt);function uIt(t){return"getBBox"in t.currentTarget&&typeof t.currentTarget.getBBox=="function"}function XY(t){var e=t.currentTarget.getBoundingClientRect(),n,r;if(uIt(t)){var s=t.currentTarget.getBBox();n=s.width>0?e.width/s.width:1,r=s.height>0?e.height/s.height:1}else{var i=t.currentTarget;n=i.offsetWidth>0?e.width/i.offsetWidth:1,r=i.offsetHeight>0?e.height/i.offsetHeight:1}var o=(l,c)=>({relativeX:Math.round((l-e.left)/n),relativeY:Math.round((c-e.top)/r)});return"touches"in t?Array.from(t.touches).map(l=>o(l.clientX,l.clientY)):o(t.clientX,t.clientY)}var oPe=zl("mouseClick"),lPe=V2();lPe.startListening({actionCreator:oPe,effect:(t,e)=>{var n=t.payload,r=YY(e.getState(),XY(n));(r==null?void 0:r.activeIndex)!=null&&e.dispatch(tAt({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var hH=zl("mouseMove"),cPe=V2(),yb=null,Cv=null,oB=null;cPe.startListening({actionCreator:hH,effect:(t,e)=>{var n=t.payload,r=e.getState(),s=r.eventSettings,i=s.throttleDelay,o=s.throttledEvents,l=o==="all"||(o==null?void 0:o.includes("mousemove"));yb!==null&&(cancelAnimationFrame(yb),yb=null),Cv!==null&&(typeof i!="number"||!l)&&(clearTimeout(Cv),Cv=null),oB=XY(n);var c=()=>{var u=e.getState(),d=oT(u,u.tooltip.settings.shared);if(!oB){yb=null,Cv=null;return}if(d==="axis"){var h=YY(u,oB);(h==null?void 0:h.activeIndex)!=null?e.dispatch(B2e({activeIndex:h.activeIndex,activeDataKey:void 0,activeCoordinate:h.activeCoordinate})):e.dispatch(z2e())}yb=null,Cv=null};if(!l){c();return}i==="raf"?yb=requestAnimationFrame(c):typeof i=="number"&&Cv===null&&(Cv=setTimeout(c,i))}});function dIt(t,e){return e instanceof HTMLElement?"HTMLElement <".concat(e.tagName,' class="').concat(e.className,'">'):e===window?"global.window":t==="children"&&typeof e=="object"&&e!==null?"<<CHILDREN>>":e}var cce={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},uPe=Ba({name:"rootProps",initialState:cce,reducers:{updateOptions:(t,e)=>{var n;t.accessibilityLayer=e.payload.accessibilityLayer,t.barCategoryGap=e.payload.barCategoryGap,t.barGap=(n=e.payload.barGap)!==null&&n!==void 0?n:cce.barGap,t.barSize=e.payload.barSize,t.maxBarSize=e.payload.maxBarSize,t.stackOffset=e.payload.stackOffset,t.syncId=e.payload.syncId,t.syncMethod=e.payload.syncMethod,t.className=e.payload.className,t.baseValue=e.payload.baseValue,t.reverseStackOrder=e.payload.reverseStackOrder}}}),hIt=uPe.reducer,fIt=uPe.actions.updateOptions,pIt=null,mIt={updatePolarOptions:(t,e)=>t===null?e.payload:(t.startAngle=e.payload.startAngle,t.endAngle=e.payload.endAngle,t.cx=e.payload.cx,t.cy=e.payload.cy,t.innerRadius=e.payload.innerRadius,t.outerRadius=e.payload.outerRadius,t)},dPe=Ba({name:"polarOptions",initialState:pIt,reducers:mIt}),gIt=dPe.actions.updatePolarOptions,vIt=dPe.reducer,hPe=zl("keyDown"),fPe=zl("focus"),pPe=zl("blur"),RF=V2(),bb=null,kv=null,lM=null;RF.startListening({actionCreator:hPe,effect:(t,e)=>{lM=t.payload,bb!==null&&(cancelAnimationFrame(bb),bb=null);var n=e.getState(),r=n.eventSettings,s=r.throttleDelay,i=r.throttledEvents,o=i==="all"||i.includes("keydown");
1335kv!==null&&(typeof s!="number"||!o)&&(clearTimeout(kv),kv=null);var l=()=>{try{var c=e.getState(),u=c.rootProps.accessibilityLayer!==!1;if(!u)return;var d=c.tooltip.keyboardInteraction,h=lM;if(h!=="ArrowRight"&&h!=="ArrowLeft"&&h!=="Enter")return;var f=IC(d,S0(c),mj(c),xj(c)),p=f==null?-1:Number(f),m=!Number.isFinite(p)||p<0,v=_p(c),x=S0(c),g=oT(c,c.tooltip.settings.shared);if(h==="Enter"){if(m)return;var w=ZD(c,g,"hover",String(d.index));e.dispatch(QD({active:!d.active,activeIndex:d.index,activeCoordinate:w}));return}var _=Vkt(c),j=_==="left-to-right"?1:-1,N=h==="ArrowRight"?1:-1,S;if(m){var C=mj(c),k=xj(c),E=N*j,P=I=>({active:!1,index:String(I),dataKey:void 0,graphicalItemId:void 0,coordinate:void 0});if(S=-1,E>0){for(var T=0;T<x.length;T++)if(IC(P(T),x,C,k)!=null){S=T;break}}else for(var M=x.length-1;M>=0;M--)if(IC(P(M),x,C,k)!=null){S=M;break}if(S<0)return}else{S=p+N*j;var R=(v==null?void 0:v.length)||x.length;if(R===0||S>=R||S<0)return}var A=ZD(c,g,"hover",String(S));e.dispatch(QD({active:!0,activeIndex:S.toString(),activeCoordinate:A}))}finally{bb=null,kv=null}};if(!o){l();return}s==="raf"?bb=requestAnimationFrame(l):typeof s=="number"&&kv===null&&(l(),lM=null,kv=setTimeout(()=>{lM?l():(kv=null,bb=null)},s))}});RF.startListening({actionCreator:fPe,effect:(t,e)=>{var n=e.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var s=n.tooltip.keyboardInteraction;if(!s.active&&s.index==null){var i="0",o=oT(n,n.tooltip.settings.shared),l=ZD(n,o,"hover",String(i));e.dispatch(QD({active:!0,activeIndex:i,activeCoordinate:l}))}}}});RF.startListening({actionCreator:pPe,effect:(t,e)=>{var n=e.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var s=n.tooltip.keyboardInteraction;s.active&&e.dispatch(QD({active:!1,activeIndex:s.index,activeCoordinate:s.coordinate}))}}});function mPe(t){t.persist();var e=t.currentTarget;return new Proxy(t,{get:(n,r)=>{if(r==="currentTarget")return e;var s=Reflect.get(n,r);return typeof s=="function"?s.bind(n):s}})}var Ql=zl("externalEvent"),gPe=V2(),cM=new Map,WS=new Map,lB=new Map;gPe.startListening({actionCreator:Ql,effect:(t,e)=>{var n=t.payload,r=n.handler,s=n.reactEvent;if(r!=null){var i=s.type,o=mPe(s);lB.set(i,{handler:r,reactEvent:o});var l=cM.get(i);l!==void 0&&(cancelAnimationFrame(l),cM.delete(i));var c=e.getState(),u=c.eventSettings,d=u.throttleDelay,h=u.throttledEvents,f=h,p=f==="all"||(f==null?void 0:f.includes(i)),m=WS.get(i);m!==void 0&&(typeof d!="number"||!p)&&(clearTimeout(m),WS.delete(i));var v=()=>{var w=lB.get(i);try{if(!w)return;var _=w.handler,j=w.reactEvent,N=e.getState(),S={activeCoordinate:HAt(N),activeDataKey:CY(N),activeIndex:N0(N),activeLabel:eTe(N),activeTooltipIndex:N0(N),isTooltipActive:WAt(N)};_&&_(S,j)}finally{cM.delete(i),WS.delete(i),lB.delete(i)}};if(!p){v();return}if(d==="raf"){var x=requestAnimationFrame(v);cM.set(i,x)}else if(typeof d=="number"){if(!WS.has(i)){v();var g=setTimeout(v,d);WS.set(i,g)}}else v()}}});var xIt=we([rS],t=>t.tooltipItemPayloads),yIt=we([xIt,(t,e)=>e,(t,e,n)=>n],(t,e,n)=>{if(e!=null){var r=t.find(i=>i.settings.graphicalItemId===n);if(r!=null){var s=r.getPosition;if(s!=null)return s(e)}}}),vPe=zl("touchMove"),xPe=V2(),Av=null,Mp=null,uce=null,KS=null;xPe.startListening({actionCreator:vPe,effect:(t,e)=>{var n=t.payload;if(!(n.touches==null||n.touches.length===0)){KS=mPe(n);var r=e.getState(),s=r.eventSettings,i=s.throttleDelay,o=s.throttledEvents,l=o==="all"||o.includes("touchmove");Av!==null&&(cancelAnimationFrame(Av),Av=null),Mp!==null&&(typeof i!="number"||!l)&&(clearTimeout(Mp),Mp=null),uce=Array.from(n.touches).map(u=>XY({clientX:u.clientX,clientY:u.clientY,currentTarget:n.currentTarget}));var c=()=>{if(KS!=null){var u=e.getState(),d=oT(u,u.tooltip.settings.shared);if(d==="axis"){var h,f=(h=uce)===null||h===void 0?void 0:h[0];if(f==null){Av=null,Mp=null;return}var p=YY(u,f);(p==null?void 0:p.activeIndex)!=null&&e.dispatch(B2e({activeIndex:p.activeIndex,activeDataKey:void 0,activeCoordinate:p.activeCoordinate}))}else if(d==="item"){var m,v=KS.touches[0];if(document.elementFromPoint==null||v==null)return;var x=document.elementFromPoint(v.clientX,v.clientY);if(!x||!x.getAttribute)return;var g=x.getAttribute(_Ae),w=(m=x.getAttribute(jAe))!==null&&m!==void 0?m:void 0,_=V0(u).find(S=>S.id===w);if(g==null||_==null||w==null)return;var j=_.dataKey,N=yIt(u,g,w);e.dispatch($2e({activeDataKey:j,activeIndex:g,activeCoordinate:N,activeGraphicalItemId:w}))}Av=null,Mp=null}};if(!l){c();return}i==="raf"?Av=requestAnimationFrame(c):typeof i=="number"&&Mp===null&&(c(),KS=null,Mp=setTimeout(()=>{KS?c():(Mp=null,Av=null)},i))}}});var JY={throttleDelay:"raf",throttledEvents:["mousemove","touchmove","pointermove","scroll","wheel"]},yPe=Ba({name:"eventSettings",initialState:JY,reducers:{setEventSettings:(t,e)=>{e.payload.throttleDelay!=null&&(t.throttleDelay=e.payload.throttleDelay),e.payload.throttledEvents!=null&&(t.throttledEvents=e.payload.throttledEvents)}}}
1335),bIt=yPe.actions.setEventSettings,wIt=yPe.reducer,_It=Wke({brush:DMt,cartesianAxis:yMt,chartData:UEt,errorBars:ERt,eventSettings:wIt,graphicalItems:TPt,layout:Kbt,legend:o1t,options:LEt,polarAxis:MTt,polarOptions:vIt,referenceElements:zMt,renderedTicks:cRt,rootProps:hIt,tooltip:nAt,zIndex:CEt}),jIt=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return xbt({reducer:_It,preloadedState:e,middleware:r=>{var s;return r({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((s="es6")!==null&&s!==void 0?s:"")}).concat([lPe.middleware,cPe.middleware,RF.middleware,gPe.middleware,xPe.middleware])},enhancers:r=>{var s=r;return typeof r=="function"&&(s=r()),s.concat(oAe({type:"raf"}))},devTools:{serialize:{replacer:dIt},name:"recharts-".concat(n)}})};function bPe(t){var e=t.preloadedState,n=t.children,r=t.reduxStoreName,s=Vl(),i=b.useRef(null);if(s)return n;i.current==null&&(i.current=jIt(e,r));var o=aG;return b.createElement(E1t,{context:o,store:i.current},n)}function SIt(t){var e=t.layout,n=t.margin,r=Wn(),s=Vl();return b.useEffect(()=>{s||(r(Vbt(e)),r(qbt(n)))},[r,s,e,n]),null}var wPe=b.memo(SIt,X2);function _Pe(t){var e=Wn();return b.useEffect(()=>{e(fIt(t))},[e,t]),null}var NIt=t=>{var e=Wn();return b.useEffect(()=>{e(bIt(t))},[e,t]),null},jPe=b.memo(NIt,X2);function dce(t){var e=t.zIndex,n=t.isPanorama,r=b.useRef(null),s=Wn();return b.useLayoutEffect(()=>(r.current&&s(SEt({zIndex:e,element:r.current,isPanorama:n})),()=>{s(NEt({zIndex:e,isPanorama:n}))}),[s,e,n]),b.createElement("g",{tabIndex:-1,ref:r,className:"recharts-zIndex-layer_".concat(e)})}function hce(t){var e=t.children,n=t.isPanorama,r=mt(mEt);if(!r||r.length===0)return e;var s=r.filter(o=>o<0),i=r.filter(o=>o>0);return b.createElement(b.Fragment,null,s.map(o=>b.createElement(dce,{key:o,zIndex:o,isPanorama:n})),e,i.map(o=>b.createElement(dce,{key:o,zIndex:o,isPanorama:n})))}var CIt=["children"];function kIt(t,e){if(t==null)return{};var n,r,s=AIt(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function AIt(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function sL(){return sL=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},sL.apply(null,arguments)}var EIt={width:"100%",height:"100%",display:"block"},TIt=b.forwardRef((t,e)=>{var n=kAe(),r=AAe(),s=BAe();if(!Hg(n)||!Hg(r))return null;var i=t.children,o=t.otherAttributes,l=t.title,c=t.desc,u,d;return o!=null&&(typeof o.tabIndex=="number"?u=o.tabIndex:u=s?0:void 0,typeof o.role=="string"?d=o.role:d=s?"application":void 0),b.createElement(ZK,sL({},o,{title:l,desc:c,role:d,tabIndex:u,width:n,height:r,style:EIt,ref:e}),i)}),PIt=t=>{var e=t.children,n=mt(Y4);if(!n)return null;var r=n.width,s=n.height,i=n.y,o=n.x;return b.createElement(ZK,{width:r,height:s,x:o,y:i},e)},fce=b.forwardRef((t,e)=>{var n=t.children,r=kIt(t,CIt),s=Vl();return s?b.createElement(PIt,null,b.createElement(hce,{isPanorama:!0},n)):b.createElement(TIt,sL({ref:e},r),b.createElement(hce,{isPanorama:!1},n))});function MIt(t,e){return DIt(t)||IIt(t,e)||OIt(t,e)||RIt()}function RIt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 1336In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function OIt(t,e){if(t){if(typeof t=="string")return pce(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?pce(t,e):void 0}}function pce(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function IIt(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,u=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}
1336finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function DIt(t){if(Array.isArray(t))return t}function LIt(){var t=Wn(),e=b.useState(null),n=MIt(e,2),r=n[0],s=n[1],i=mt(uwt);return b.useEffect(()=>{if(r!=null){var o=r.getBoundingClientRect(),l=o.width/r.offsetWidth;An(l)&&l!==i&&t(Wbt(l))}},[r,t,i]),s}function mce(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function FIt(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?mce(Object(n),!0).forEach(function(r){$It(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):mce(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function $It(t,e,n){return(e=zIt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function zIt(t){var e=BIt(t,"string");return typeof e=="symbol"?e:e+""}function BIt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Pg(){return Pg=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Pg.apply(null,arguments)}function iL(t,e){return HIt(t)||VIt(t,e)||qIt(t,e)||UIt()}function UIt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 1337In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function qIt(t,e){if(t){if(typeof t=="string")return gce(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?gce(t,e):void 0}}function gce(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function VIt(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,u=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function HIt(t){if(Array.isArray(t))return t}var WIt=()=>(JEt(),null);function aL(t){if(typeof t=="number")return t;if(typeof t=="string"){var e=parseFloat(t);if(!Number.isNaN(e))return e}return 0}var KIt=b.forwardRef((t,e)=>{var n,r,s=b.useRef(null),i=b.useState({containerWidth:aL((n=t.style)===null||n===void 0?void 0:n.width),containerHeight:aL((r=t.style)===null||r===void 0?void 0:r.height)}),o=iL(i,2),l=o[0],c=o[1],u=b.useCallback((h,f)=>{c(p=>{var m=Math.round(h),v=Math.round(f);return p.containerWidth===m&&p.containerHeight===v?p:{containerWidth:m,containerHeight:v}})},[]),d=b.useCallback(h=>{if(typeof e=="function"&&e(h),s.current!=null&&(s.current.disconnect(),s.current=null),h!=null&&typeof ResizeObserver<"u"){var f=h.getBoundingClientRect(),p=f.width,m=f.height;u(p,m);var v=g=>{var w=g[0];if(w!=null){var _=w.contentRect,j=_.width,N=_.height;u(j,N)}},x=new ResizeObserver(v);x.observe(h),s.current=x}},[e,u]);return b.useEffect(()=>()=>{var h=s.current;h!=null&&h.disconnect()},[u]),b.createElement(b.Fragment,null,b.createElement(W2,{width:l.containerWidth,height:l.containerHeight}),b.createElement("div",Pg({ref:d},t)))}),GIt=b.forwardRef((t,e)=>{var n=t.width,r=t.height,s=b.useState({containerWidth:aL(n),containerHeight:aL(r)}),i=iL(s,2),o=i[0],l=i[1],c=b.useCallback((d,h)=>{l(f=>{var p=Math.round(d),m=Math.round(h);return f.containerWidth===p&&f.containerHeight===m?f:{containerWidth:p,containerHeight:m}})},[]),u=b.useCallback(d=>{if(typeof e=="function"&&e(d),d!=null){var h=d.getBoundingClientRect(),f=h.width,p=h.height;c(f,p)}},[e,c]);return b.createElement(b.Fragment,null,b.createElement(W2,{width:o.containerWidth,height:o.containerHeight}),b.createElement("div",Pg({ref:u},t)))}),YIt=b.forwardRef((t,e)=>
1337{var n=t.width,r=t.height;return b.createElement(b.Fragment,null,b.createElement(W2,{width:n,height:r}),b.createElement("div",Pg({ref:e},t)))}),XIt=b.forwardRef((t,e)=>{var n=t.width,r=t.height;return typeof n=="string"||typeof r=="string"?b.createElement(GIt,Pg({},t,{ref:e})):typeof n=="number"&&typeof r=="number"?b.createElement(YIt,Pg({},t,{width:n,height:r,ref:e})):b.createElement(b.Fragment,null,b.createElement(W2,{width:n,height:r}),b.createElement("div",Pg({ref:e},t)))});function JIt(t){return t?KIt:XIt}var QIt=b.forwardRef((t,e)=>{var n=t.children,r=t.className,s=t.height,i=t.onClick,o=t.onContextMenu,l=t.onDoubleClick,c=t.onMouseDown,u=t.onMouseEnter,d=t.onMouseLeave,h=t.onMouseMove,f=t.onMouseUp,p=t.onTouchEnd,m=t.onTouchMove,v=t.onTouchStart,x=t.style,g=t.width,w=t.responsive,_=t.dispatchTouchEvents,j=_===void 0?!0:_,N=b.useRef(null),S=Wn(),C=b.useState(null),k=iL(C,2),E=k[0],P=k[1],T=b.useState(null),M=iL(T,2),R=M[0],A=M[1],I=LIt(),D=pG(),O=(D==null?void 0:D.width)>0?D.width:g,z=(D==null?void 0:D.height)>0?D.height:s,B=b.useCallback(X=>{I(X),typeof e=="function"&&e(X),P(X),A(X),X!=null&&(N.current=X)},[I,e,P,A]),G=b.useCallback(X=>{S(oPe(X)),S(Ql({handler:i,reactEvent:X}))},[S,i]),U=b.useCallback(X=>{S(hH(X)),S(Ql({handler:u,reactEvent:X}))},[S,u]),F=b.useCallback(X=>{S(z2e()),S(Ql({handler:d,reactEvent:X}))},[S,d]),W=b.useCallback(X=>{S(hH(X)),S(Ql({handler:h,reactEvent:X}))},[S,h]),Q=b.useCallback(()=>{S(fPe())},[S]),K=b.useCallback(()=>{S(pPe())},[S]),fe=b.useCallback(X=>{S(hPe(X.key))},[S]),oe=b.useCallback(X=>{S(Ql({handler:o,reactEvent:X}))},[S,o]),ye=b.useCallback(X=>{S(Ql({handler:l,reactEvent:X}))},[S,l]),le=b.useCallback(X=>{S(Ql({handler:c,reactEvent:X}))},[S,c]),me=b.useCallback(X=>{S(Ql({handler:f,reactEvent:X}))},[S,f]),he=b.useCallback(X=>{S(Ql({handler:v,reactEvent:X}))},[S,v]),ae=b.useCallback(X=>{j&&S(vPe(X)),S(Ql({handler:m,reactEvent:X}))},[S,j,m]),re=b.useCallback(X=>{S(Ql({handler:p,reactEvent:X}))},[S,p]),L=JIt(w);return b.createElement(lTe.Provider,{value:E},b.createElement(ske.Provider,{value:R},b.createElement(L,{width:O??(x==null?void 0:x.width),height:z??(x==null?void 0:x.height),className:mn("recharts-wrapper",r),style:FIt({position:"relative",cursor:"default",width:O,height:z},x),onClick:G,onContextMenu:oe,onDoubleClick:ye,onFocus:Q,onBlur:K,onKeyDown:fe,onMouseDown:le,onMouseEnter:U,onMouseLeave:F,onMouseMove:W,onMouseUp:me,onTouchEnd:re,onTouchMove:ae,onTouchStart:he,ref:B},b.createElement(WIt,null),n)))}),ZIt=["width","height","responsive","children","className","style","compact","title","desc"];function eDt(t,e){if(t==null)return{};var n,r,s=tDt(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function tDt(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var SPe=b.forwardRef((t,e)=>{var n=t.width,r=t.height,s=t.responsive,i=t.children,o=t.className,l=t.style,c=t.compact,u=t.title,d=t.desc,h=eDt(t,ZIt),f=dh(h);return c?b.createElement(b.Fragment,null,b.createElement(W2,{width:n,height:r}),b.createElement(fce,{otherAttributes:f,title:u,desc:d},i)):b.createElement(QIt,{className:o,style:l,width:n,height:r,responsive:s??!1,onClick:t.onClick,onMouseLeave:t.onMouseLeave,onMouseEnter:t.onMouseEnter,onMouseMove:t.onMouseMove,onMouseDown:t.onMouseDown,onMouseUp:t.onMouseUp,onContextMenu:t.onContextMenu,onDoubleClick:t.onDoubleClick,onTouchStart:t.onTouchStart,onTouchMove:t.onTouchMove,onTouchEnd:t.onTouchEnd},b.createElement(fce,{otherAttributes:f,title:u,desc:d,ref:e},b.createElement(KMt,null,i)))});function fH(){return fH=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},fH.apply(null,arguments)}function vce(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function nDt(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};
1337e%2?vce(Object(n),!0).forEach(function(r){rDt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):vce(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function rDt(t,e,n){return(e=sDt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function sDt(t){var e=iDt(t,"string");return typeof e=="symbol"?e:e+""}function iDt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var aDt={top:5,right:5,bottom:5,left:5},oDt=nDt({accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,layout:"horizontal",margin:aDt,responsive:!1,reverseStackOrder:!1,stackOffset:"none",syncMethod:"index"},JY),lDt=b.forwardRef(function(e,n){var r,s=za(e.categoricalChartProps,oDt),i=e.chartName,o=e.defaultTooltipEventType,l=e.validateTooltipEventTypes,c=e.tooltipPayloadSearcher,u=e.categoricalChartProps,d={chartName:i,defaultTooltipEventType:o,validateTooltipEventTypes:l,tooltipPayloadSearcher:c,eventEmitter:void 0};return b.createElement(bPe,{preloadedState:{options:d},reduxStoreName:(r=u.id)!==null&&r!==void 0?r:i},b.createElement(GTe,{chartData:u.data}),b.createElement(wPe,{layout:s.layout,margin:s.margin}),b.createElement(jPe,{throttleDelay:s.throttleDelay,throttledEvents:s.throttledEvents}),b.createElement(_Pe,{baseValue:s.baseValue,accessibilityLayer:s.accessibilityLayer,barCategoryGap:s.barCategoryGap,maxBarSize:s.maxBarSize,stackOffset:s.stackOffset,barGap:s.barGap,barSize:s.barSize,syncId:s.syncId,syncMethod:s.syncMethod,className:s.className,reverseStackOrder:s.reverseStackOrder}),b.createElement(SPe,fH({},s,{ref:n})))}),cDt=["axis","item"],NPe=b.forwardRef((t,e)=>b.createElement(lDt,{chartName:"BarChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:cDt,tooltipPayloadSearcher:uTe,categoricalChartProps:t,ref:e}));function uDt(t){var e=Wn();return b.useEffect(()=>{e(gIt(t))},[e,t]),null}var dDt=["layout"];function pH(){return pH=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},pH.apply(null,arguments)}function hDt(t,e){if(t==null)return{};var n,r,s=fDt(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function fDt(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function xce(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function pDt(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?xce(Object(n),!0).forEach(function(r){mDt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):xce(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function mDt(t,e,n){return(e=gDt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function gDt(t){var e=vDt(t,"string");return typeof e=="symbol"?e:e+""}function vDt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var xDt={top:5,right:5,bottom:5,left:5},CPe=pDt({accessibilityLayer:!0,stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:xDt,reverseStackOrder:!1,syncMethod:"index",layout:"radial",responsive:!1,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"},JY),yDt=b.forwardRef(function(e,n){var r,s=za(e.categoricalChartProps,CPe),i=s.layout,o=hDt(s,dDt),l=e.chartName,c=e.defaultTooltipEventType,u=e.validateTooltipEventTypes,d=e.tooltipPayloadSearcher,h={chartName:l,defaultTooltipEventType:c,validateTooltipEventTypes:u,tooltipPayloadSearcher:d,eventEmitter:void 0};return b.createElement(bPe,{preloadedState:{options:h},reduxStoreName:(r=s.id)!==null&&r!==void 0?r:l},b.createElement(GTe,{chartData:s.data}),b.createElement(wPe,{layout:i,margin:s.margin}),b.createElement(jPe,{throttleDelay:s.throttleDelay,throttledEvents:s.throttledEvents}),b.createElement(_Pe,{baseValue:void 0,accessibilityLayer:s.accessibilityLayer,barCategoryGap:s.barCategoryGap,maxBarSize:s.maxBarSize,stackOffset:s.stackOffset,barGap:s.barGap,barSize:s.barSize,syncId:s.syncId,syncMethod:s.syncMethod,className:s.className,reverseStackOrder:s.reverseStackOrder}),b.createElement(uDt,{cx:s.cx,cy:s.cy,startAngle:s.startAngle,endAngle:s.endAngle,innerRadius:s.innerRadius,outerRadius:s.outerRadius}),b.createElement(SPe,pH({},o,{ref:n})))});function yce(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function bce(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};
1337e%2?yce(Object(n),!0).forEach(function(r){bDt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):yce(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function bDt(t,e,n){return(e=wDt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function wDt(t){var e=_Dt(t,"string");return typeof e=="symbol"?e:e+""}function _Dt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var jDt=["item"],SDt=bce(bce({},CPe),{},{layout:"centric",startAngle:0,endAngle:360}),NDt=b.forwardRef((t,e)=>{var n=za(t,SDt);return b.createElement(yDt,{chartName:"PieChart",defaultTooltipEventType:"item",validateTooltipEventTypes:jDt,tooltipPayloadSearcher:uTe,categoricalChartProps:n,ref:e})});function CDt(){const{data:t=[]}=Ne({queryKey:["ad_stats_contracts"],queryFn:async()=>(await Z.from("ad_contracts").select("amount, support, start_date, end_date, position, impressions, clicks, magazine_issue_ids")).data||[]}),{data:e=[]}=Ne({queryKey:["ad_stats_issues"],queryFn:async()=>(await Z.from("magazine_issues").select("id, issue_number, title, page_count")).data||[]}),n=new Date,r=new Date(n.getFullYear(),n.getMonth(),1),s=new Date(n.getFullYear(),Math.floor(n.getMonth()/3)*3,1),i=new Date(n.getFullYear(),0,1),o=(g,w)=>new Date(g.start_date)>=w,l=(g,w)=>g.filter(w).reduce((_,j)=>_+Number(j.amount||0),0),c=g=>({web:l(t,w=>o(w,g)&&(w.support==="web"||w.support==="web_and_print")),mag:l(t,w=>o(w,g)&&(w.support==="print"||w.support==="web_and_print"))}),u=c(r),d=c(s),h=c(i),f={};for(let g=0;g<12;g++){const w=new Date(n.getFullYear(),g,1);f[g]={month:w.toLocaleString("fr-FR",{month:"short"}),web:0,mag:0}}t.forEach(g=>{const w=new Date(g.start_date);if(w.getFullYear()!==n.getFullYear())return;const _=w.getMonth();(g.support==="web"||g.support==="web_and_print")&&(f[_].web+=Number(g.amount||0)),(g.support==="print"||g.support==="web_and_print")&&(f[_].mag+=Number(g.amount||0))});const p=Object.values(f),m=t.filter(g=>g.support==="web"||g.support==="web_and_print"),v={};m.forEach(g=>{const w=g.position||"?";v[w]=v[w]||{imp:0,clk:0},v[w].imp+=g.impressions||0,v[w].clk+=g.clicks||0});const x=e.map(g=>{const w=t.filter(_=>(_.magazine_issue_ids||[]).includes(g.id)).reduce((_,j)=>_+Number(j.amount||0),0);return{...g,revenue:w}});return a.jsxs("div",{className:"space-y-6",children:[a.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:[{label:"Ce mois",data:u},{label:"Ce trimestre",data:d},{label:"Cette année",data:h}].map(g=>a.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:g.label}),a.jsxs("div",{className:"mt-1 font-heading text-2xl font-bold",children:[(g.data.web+g.data.mag).toFixed(0)," â¬"]}),a.jsxs("div",{className:"mt-2 flex gap-3 text-xs",children:[a.jsxs("span",{className:"text-blue-700",children:["Web : ",g.data.web.toFixed(0)," â¬"]}),a.jsxs("span",{className:"text-orange-700",children:["Magazine : ",g.data.mag.toFixed(0)," â¬"]})]})]},g.label))}),a.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[a.jsxs("h2",{className:"font-heading text-lg font-semibold mb-4",children:["Revenus mensuels â ",n.getFullYear()]}),a.jsx(DV,{width:"100%",height:280,children:a.jsxs(NPe,{data:p,children:[a.jsx(KY,{dataKey:"month"}),a.jsx(GY,{}),a.jsx(iH,{}),a.jsx(yG,{}),a.jsx(rL,{dataKey:"web",stackId:"a",fill:"#2E86C1",name:"Web"}),a.jsx(rL,{dataKey:"mag",stackId:"a",fill:"#E67E22",name:"Magazine"})]})})]}),a.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[a.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[a.jsx("h2",{className:"font-heading text-lg font-semibold mb-3",children:"Performance web par emplacement"}),a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"border-b text-left text-xs text-muted-foreground",children:a.jsxs("tr",{children:[a.jsx("th",{className:"py-2",children:"Emplacement"}),a.jsx("th",{children:"Impressions"}),a.jsx("th",{children:"Clics"}),a.jsx("th",{children:"CTR"})]})}),a.jsxs("tbody",{children:[Object.entries(v).map(([g,w])=>a.jsxs("tr",{className:"border-b last:border-0",children:[a.jsx("td",{className:"py-2",children:g}),a.jsx("td",{children:w.imp}
1337),a.jsx("td",{children:w.clk}),a.jsxs("td",{children:[w.imp?(w.clk/w.imp*100).toFixed(2):"0","%"]})]},g)),Object.keys(v).length===0&&a.jsx("tr",{children:a.jsx("td",{colSpan:4,className:"py-4 text-center text-muted-foreground",children:"Aucune donnée"})})]})]})]}),a.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[a.jsx("h2",{className:"font-heading text-lg font-semibold mb-3",children:"CA par numéro de magazine"}),a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"border-b text-left text-xs text-muted-foreground",children:a.jsxs("tr",{children:[a.jsx("th",{className:"py-2",children:"Numéro"}),a.jsx("th",{className:"text-right",children:"CA"})]})}),a.jsxs("tbody",{children:[x.map(g=>a.jsxs("tr",{className:"border-b last:border-0",children:[a.jsxs("td",{className:"py-2",children:["N°",g.issue_number," ",g.title?`â ${g.title}`:""]}),a.jsxs("td",{className:"text-right font-semibold",children:[g.revenue.toFixed(0)," â¬"]})]},g.id)),x.length===0&&a.jsx("tr",{children:a.jsx("td",{colSpan:2,className:"py-4 text-center text-muted-foreground",children:"Aucun numéro"})})]})]})]})]})]})}const cB={company_name:"Esprit Sud Magazine s.l",address_lines:["Calle Maestro Albeniz, 20","29630 Benalmadena (Malaga)"],cif:"B44798015",bic:"CAIXESBBXXX",iban:"ES82 2100 6282 1802 0025 1795",iban_notice:"Attention nouveau n° de compte / Atención nuevo número de cuenta",email:"[email protected]",website:"www.espritsud.es",facebook:"Esprit SUD Magazine",contact_editorial_name:"Frédéric ANDRE",contact_editorial_phone:"0034 636 600 838",contact_publi_name:"Luc BROES",contact_publi_phone:"0032 475 288 266",contact_graphics_name:"Claude NOUKENS",contact_graphics_phone:"0032 470 563 258",cgv_left_html:`<h3>CONDICIONES GENERALES DE VENTA</h3> 1338<h4>⢠TÃRMINOS DE PEDIDO</h4> 1339<p>ESPRIT SUD hace todo lo posible para ofrecer a los clientes la información más completa sobre los productos ofertados.</p> 1340<p>La realización de un pedido se puede realizar de acuerdo con los siguientes métodos :<br/>- Por correo electrónico, especificando el tipo de superficies.<br/>- Por teléfono, al departamento de "publicidad"<br/>- Con cita previa, en el lugar de la actividad con un responsable comercial.</p> 1341<p>Los pedidos se validan al recibir el pago.</p> 1342<h4>⢠PRECIOS Y CONDICIONES DE PAGO</h4> 1343<p>Los precios están indicados en euros, todos los impuestos incluidos. Todos los pedidos se pagan en euros. ESPRIT SUD se reserva el derecho de modificar sus precios en cualquier momento.</p> 1344<h4>⢠CONFIRMACIÃN DEL PEDIDO</h4> 1345<p>La validación por parte del Cliente de su pedido constituye la aceptación de las presentes Condiciones Generales de Venta, Ãntegramente y sin reservas.</p>`,cgv_right_html:`<h3>DETALLE DE LAS CONDICIONES DE VENTA DE LA SUSCRIPCIÃN VERSIÃN PAPEL</h3> 1346<p>Como socio comercial, también recibirás la revista en la que apareces para que puedas distribuirla a tus clientes.</p> 1347<h4>CANCELACIÃN DEL PEDIDO</h4> 1348<p>Cualquier pedido se puede cancelar contactando con el servicio de atención al cliente.</p> 1349<h4>PROPIEDAD INTELECTUAL</h4> 1350<p>Todos los elementos de la revista, su sitio web, sus redes sociales o cualquier documento emanado de ESPRIT SUD están protegidos por derechos de propiedad intelectual.</p> 1351<h4>LEY APLICABLE Y DISPUTAS</h4> 1352<p>Las presentes condiciones generales de venta están sujetas a la legislación española. En caso de litigio, los tribunales españoles tendrán competencia exclusiva.</p>`},uM=t=>t.toFixed(2).replace(".",",")+" â¬",kDt=t=>t?{full_page:"Pleine page",half_page:"1/2 pagina",quarter_page:"1/4 pagina",double_page:"Doble pagina"}[t]||t:"";function ADt(t){const{settings:e,invoice:n,advertiser:r,contract:s,magazineIssues:i=[]}=t,o=new URL(qO,window.location.origin).href,l=n.date?new Date(n.date).toLocaleDateString("es-ES"):"",c=n.date?new Date(n.date).getFullYear():new Date().getFullYear(),u=i.length?i.map(f=>`N°${f.issue_number}`).join(", "):"",d=(s==null?void 0:s.support)==="print"||(s==null?void 0:s.support)==="web_and_print"?`${c}${u?" / "+u:""}${s!=null&&s.print_format?" â "+kDt(s.print_format):""}`:s!=null&&s.start_date?`${new Date(s.start_date).toLocaleDateString("es-ES")}${s!=null&&s.end_date?" - "+new Date(s.end_date).toLocaleDateString("es-ES"):""}`:"",h=((r==null?void 0:r.address)||"").replace(/\n/g,"<br/>");return`<!DOCTYPE html><html lang="es"><head><meta charset="utf-8"><title>Factura ${n.invoice_number}</title> 1353<style> 1354 @page { size: A4; margin: 0; } 1355 * { box-sizing: border-box; } 1356 body { font-family: 'Helvetica Neue', Arial, sans-serif; color: #1a1a1a; margin: 0; font-size: 12px; } 1357 .page { width: 210mm; min-height: 297mm; padding: 18mm 18mm 0; position: relative; page-break-after: always; display: flex; flex-direction: column; } 1358 .page:last-child { page-break-after: auto; } 1359 .logo { text-align: center; margin-bottom: 24px; } 1360 .logo img { height: 70px; } 1361 .company { font-weight: 700; line-height: 1.55; font-size: 13px; } 1362 .iban-notice { background: #f4e6c4; color: #8a6a1a; font-style: italic; padding: 3px 8px; display: inline-block; margin: 6px 0; font-size: 11px; } 1363 .meta { font-weight: 700; margin-top: 8px; } 1364 .meta span { font-weight: 400; } 1365 .client { margin: 36px 0 32px; text-align: right; padding-right: 8mm; line-height: 1.55; font-size: 13px; } 1366 .client .name { font-weight: 700; } 1367 table.lines { width: 100%; border-collapse: collapse; margin-top: 6px; } 1368 table.lines th, table.lines td { border: 1px solid #999; padding: 12px 14px; } 1369 table.lines th { font-family: 'Times New Roman', serif; font-weight: 400; font-style: italic; font-size: 14px; background: #fff; } 1370 table.lines td { font-family: 'Times New Roman', serif; font-size: 13px; } 1371 table.lines td.amount, table.lines th.amount { text-align: right; } 1372 .totals { width: 55%; margin-left: 45%; margin-top: 20px; border-collapse: collapse; } 1373 .totals td { border: 1px solid #999; padding: 10px 14px; font-family: 'Times New Roman', serif; } 1374 .totals td.label { font-style: italic; font-weight: 700; color: #b08a3e; } 1375 .totals td.value { text-align: right; } 1376 .totals tr.grand td { font-weight: 700; } 1377 .footer { margin-top: auto; padding-top: 30px; } 1378 .contacts { background: linear-gradient(180deg, #d9b86a 0%, #b08a3e 100%); color: #2a1f10; text-align: center; padding: 10px 0 8px; display: grid; grid-template-columns: 1fr 1fr 1fr; font-size: 12px; }
1379 .contacts h5 { margin: 0 0 4px; font-style: italic; font-weight: 700; font-size: 14px; } 1380 .links { background: #1a1a1a; color: #fff; text-align: center; padding: 10px 0; display: grid; grid-template-columns: 1fr 1fr 1fr; font-size: 12px; } 1381 .cgv { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; font-size: 9.5px; line-height: 1.45; padding-top: 10px; } 1382 .cgv h3 { font-size: 11px; margin: 0 0 6px; } 1383 .cgv h4 { font-size: 10px; margin: 8px 0 3px; } 1384 .cgv p { margin: 0 0 5px; } 1385</style></head> 1386<body> 1387 <div class="page"> 1388 <div class="logo"><img src="${o}" alt="Esprit Sud Magazine"/></div> 1389 <div class="company"> 1390 ${e.company_name}<br/> 1391 ${e.address_lines.map(f=>f).join("<br/>")}<br/> 1392 CIF : ${e.cif}<br/> 1393 BIC : ${e.bic}<br/> 1394 IBAN : ${e.iban} 1395 <div class="iban-notice">${e.iban_notice}</div> 1396 <div class="meta">Numero Factura: <span>${n.invoice_number}</span></div> 1397 <div class="meta">Fecha: <span>${l}</span></div> 1398 </div> 1399 1400 <div class="client"> 1401 <div class="name">${(r==null?void 0:r.company_name)||""}</div> 1402 ${r!=null&&r.contact_name?`<div>${r.contact_name}</div>`:""} 1403 ${h?`<div>${h}</div>`:""} 1404 ${r!=null&&r.nif_cif?`<div>NIF/NIE : ${r.nif_cif}</div>`:""} 1405 </div> 1406 1407 <table class="lines"> 1408 <thead><tr> 1409 <th style="width:38%">Descripción</th> 1410 <th style="width:37%">Fecha publicación</th> 1411 <th class="amount" style="width:25%">Total sin IVA</th> 1412 </tr></thead> 1413 <tbody><tr> 1414 <td>Publicidad</td> 1415 <td>${d}</td> 1416 <td class="amount">${uM(Number(n.amount_ht)||0)}</td> 1417 </tr></tbody> 1418 </table> 1419 1420 <table class="totals"> 1421 <tr><td class="label">Suma <i>(Sin IVA)</i></td><td class="value">${uM(Number(n.amount_ht)||0)}</td></tr> 1422 <tr><td class="label">IVA ${n.tax_rate}%</td><td class="value">${uM(Number(n.tax_amount)||0)}</td></tr> 1423 <tr class="grand"><td class="label">Suma con IVA <i>(A pagar)</i></td><td class="value">${uM(Number(n.amount_ttc)||0)}</td></tr> 1424 </table> 1425 1426 <div class="footer"> 1427 <div class="contacts"> 1428 <div><h5>Editoriales - Publicitad</h5>${e.contact_editorial_name} - ${e.contact_editorial_phone}</div> 1429 <div><h5>Publicitad</h5>${e.contact_publi_name} - ${e.contact_publi_phone}</div> 1430 <div><h5>Gráficos</h5>${e.contact_graphics_name} - ${e.contact_graphics_phone}</div> 1431 </div> 1432 <div class="links"> 1433 <div>â ${e.email}</div> 1434 <div>ð ${e.website}</div> 1435 <div>f ${e.facebook}</div> 1436 </div> 1437 </div> 1438 </div> 1439 1440 <div class="page"> 1441 <div class="logo"><img src="${o}" alt="Esprit Sud Magazine"/></div> 1442 <div class="cgv"> 1443 <div>${e.cgv_left_html}</div> 1444 <div>${e.cgv_right_html}</div> 1445 </div> 1446 <div class="footer"> 1447 <div class="contacts"> 1448 <div><h5>Editoriales - Publicitad</h5>${e.contact_editorial_name} - ${e.contact_editorial_phone}</div> 1449 <div><h5>Publicitad</h5>${e.contact_publi_name} - ${e.contact_publi_phone}</div> 1450 <div><h5>Gráficos</h5>${e.contact_graphics_name} - ${e.contact_graphics_phone}</div> 1451 </div> 1452 <div class="links"> 1453 <div>â ${e.email}</div> 1454 <div>ð ${e.website}</div> 1455 <div>f ${e.facebook}</div> 1456 </div> 1457 </div> 1458 </div> 1459 1460 <script>window.onload = () => setTimeout(() => window.print(), 300);<\/script> 1461</body></html>`}const EDt={draft:"bg-gray-100 text-gray-700",sent:"bg-blue-100 text-blue-700",paid:"bg-green-100 text-green-700",overdue:"bg-red-100 text-red-700"},dM="invoice_settings";function TDt(){const t=St(),[e,n]=b.useState(!1),[r,s]=b.useState(null),[i,o]=b.useState(!1),{data:l=[]}=Ne({queryKey:["ad_invoices"],queryFn:async()=>(await Z.from("invoices").select("*, advertisers(*)").order("date",{ascending:!1})).data||[]}),{data:c=[]}=Ne({queryKey:["all_advertisers_simple"],queryFn:async()=>(await Z.from("advertisers").select("id, company_name").order("company_name")).data||[]}),{data:u=[]}=Ne({queryKey:["all_contracts_simple"],queryFn:async()=>(await Z.from("ad_contracts").select("id, advertiser_id, amount, support, start_date, end_date, print_format, magazine_issue_ids").order("created_at",{ascending:!1})).data||[]}),{data:d=[]}=Ne({queryKey:["all_magazine_issues_simple"],queryFn:async()=>(await Z.from("magazine_issues").select("id, issue_number, publication_date")).data||[]}),{data:h}=Ne({queryKey:["site_setting",dM],queryFn:async()=>{const{data:v}=await Z.from("site_settings").select("value").eq("key",dM).maybeSingle();return{...cB,...(v==null?void 0:v.value)||{}}}}),f=Qe({mutationFn:async v=>{const x=Number(v.amount_ht)||0,g=Number(v.tax_rate)||21,w=x*(1+g/100),j={invoice_number:v.invoice_number||`ESM-PUB-${new Date().getFullYear()}
1461-${String(l.length+1).padStart(3,"0")}`,advertiser_id:v.advertiser_id,contract_id:v.contract_id||null,amount_ht:x,tax_rate:g,tax_amount:w-x,amount_ttc:w,date:v.date,due_date:v.due_date||null,status:v.status};if(v.id){const{error:N}=await Z.from("invoices").update(j).eq("id",v.id);if(N)throw N}else{const{error:N}=await Z.from("invoices").insert(j);if(N)throw N}},onSuccess:()=>{t.invalidateQueries({queryKey:["ad_invoices"]}),ee.success("Enregistré"),n(!1),s(null)},onError:v=>ee.error(v.message)}),p=Qe({mutationFn:async v=>{const{error:x}=await Z.from("site_settings").upsert({key:dM,value:v},{onConflict:"key"});if(x)throw x},onSuccess:()=>{t.invalidateQueries({queryKey:["site_setting",dM]}),ee.success("Paramètres enregistrés"),o(!1)},onError:v=>ee.error(v.message)}),m=v=>{const x=h||cB,g=u.find(N=>N.id===v.contract_id),w=((g==null?void 0:g.magazine_issue_ids)||[]).map(N=>d.find(S=>S.id===N)).filter(Boolean),_=ADt({settings:x,invoice:v,advertiser:v.advertisers,contract:g,magazineIssues:w}),j=window.open("","_blank");j&&(j.document.write(_),j.document.close())};return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsxs(H,{variant:"outline",onClick:()=>o(!0),children:[a.jsx(MW,{className:"mr-1.5 h-4 w-4"})," Paramètres facture"]}),a.jsxs(H,{onClick:()=>{s({status:"sent",tax_rate:21,date:new Date().toISOString().slice(0,10)}),n(!0)},children:[a.jsx(dr,{className:"mr-1.5 h-4 w-4"})," Nouvelle facture"]})]}),a.jsx("div",{className:"mt-4 overflow-x-auto rounded-xl border border-border bg-card",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"border-b border-border bg-muted/40",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-3 py-3 text-left font-medium",children:"N°"}),a.jsx("th",{className:"px-3 py-3 text-left font-medium",children:"Annonceur"}),a.jsx("th",{className:"px-3 py-3 text-right font-medium",children:"Montant TTC"}),a.jsx("th",{className:"px-3 py-3 text-left font-medium",children:"Date"}),a.jsx("th",{className:"px-3 py-3 text-left font-medium",children:"Ãchéance"}),a.jsx("th",{className:"px-3 py-3 text-left font-medium",children:"Statut"}),a.jsx("th",{className:"px-3 py-3 text-right font-medium",children:"Actions"})]})}),a.jsxs("tbody",{children:[l.map(v=>{var x;return a.jsxs("tr",{className:"border-b border-border last:border-0",children:[a.jsx("td",{className:"px-3 py-2 font-mono text-xs",children:v.invoice_number}),a.jsx("td",{className:"px-3 py-2",children:((x=v.advertisers)==null?void 0:x.company_name)||"â"}),a.jsxs("td",{className:"px-3 py-2 text-right font-semibold",children:[Number(v.amount_ttc||0).toFixed(2)," â¬"]}),a.jsx("td",{className:"px-3 py-2",children:v.date}),a.jsx("td",{className:"px-3 py-2",children:v.due_date||"â"}),a.jsx("td",{className:"px-3 py-2",children:a.jsx(ke,{className:EDt[v.status]||"",children:v.status})}),a.jsx("td",{className:"px-3 py-2 text-right",children:a.jsx(H,{variant:"ghost",size:"icon",onClick:()=>m(v),title:"Imprimer / PDF",children:a.jsx(zfe,{className:"h-4 w-4"})})})]},v.id)}),l.length===0&&a.jsx("tr",{children:a.jsx("td",{colSpan:7,className:"p-8 text-center text-muted-foreground",children:"Aucune facture"})})]})]})}),a.jsx(an,{open:e,onOpenChange:v=>{n(v),v||s(null)},children:a.jsxs(nn,{className:"max-w-xl",children:[a.jsx(on,{children:a.jsxs(ln,{children:[r!=null&&r.id?"Modifier":"Nouvelle"," facture"]})}),a.jsx(PDt,{initial:r||{},advertisers:c,contracts:u,onSubmit:v=>f.mutate(v)})]})}),a.jsx(an,{open:i,onOpenChange:o,children:a.jsxs(nn,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[a.jsx(on,{children:a.jsx(ln,{children:"Paramètres de facturation"})}),a.jsx(MDt,{initial:h||cB,onSubmit:v=>p.mutate(v)})]})})]})}function PDt({initial:t,advertisers:e,contracts:n,onSubmit:r}){const[s,i]=b.useState(t),o=(h,f)=>i(p=>({...p,[h]:f})),l=Number(s.amount_ht)||0,c=Number(s.tax_rate)||21,u=l*(1+c/100),d=n.filter(h=>!s.advertiser_id||h.advertiser_id===s.advertiser_id);return a.jsxs("form",{onSubmit:h=>{h.preventDefault(),r(s)},className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx(te,{children:"Annonceur *"}),a.jsxs(lt,{value:s.advertiser_id||"",onValueChange:h=>o("advertiser_id",h),children:[a.jsx(nt,{children:a.jsx(ct,{placeholder:"Choisir"})}),a.jsx(rt,{children:e.map(h=>a.jsx(Ae,{value:h.id,children:h.company_name},h.id))})]})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Contrat lié"}),a.jsxs(lt,{value:s.contract_id||"",onValueChange:h=>o("contract_id",h),children:[a.jsx(nt,{children:a.jsx(ct,{placeholder:"Aucun"})}),a.jsx(rt,{children:d.map(h=>a.jsxs(Ae,{value:h.id,children:[h.support," â ",h.amount,"⬠(",h.start_date,")"]},h.id))})]})]}),a.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[a.jsxs("div",{children:[a.jsx(te,{children:"HT (â¬) *"}),a.jsx(ue,{type:"number",step:"0.01",required:!0,value:s.amount_ht||"",onChange:h=>o("amount_ht",h.target.value)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"TVA (%)"}),a.jsx(ue,{type:"number",step:"0.01",value:s.tax_rate||21,onChange:h=>o("tax_rate",h.target.value)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"TTC"}),a.jsx(ue,{value:u.toFixed(2),disabled:!0})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx(te,{children:"Date *"}),a.jsx(ue,{type:"date",required:!0,value:s.date||"",onChange:h=>o("date",h.target.value)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Ãchéance"}),a.jsx(ue,{type:"date",value:s.due_date||"",onChange:h=>o("due_date",h.target.value)})]})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Statut"}),a.jsxs(lt,{value:s.status||"sent",onValueChange:h=>o("status",h),children:[a.jsx(nt,{children:a.jsx(ct,{})}),a.jsxs(rt,{children:[a.jsx(Ae,{value:"draft",children:"Brouillon"}),a.jsx(Ae,{value:"sent",children:"Ãmise"}),a.jsx(Ae,{value:"paid",children:"Payée"}),a.jsx(Ae,{value:"overdue",children:"En retard"})]})]})]}),a.jsx(ss,{children:a.jsx(H,{type:"submit",disabled:!s.advertiser_id,children:"Enregistrer"})})]})}function MDt({initial:t,onSubmit:e}){const[n,r]=b.useState(t),s=(i,o)=>r(l=>({...l,[i]:o}));return a.jsxs("form",{onSubmit:i=>{i.preventDefault(),e(n)},className:"space-y-4",children:[a.jsxs("fieldset",{className:"space-y-3 rounded-lg border border-border p-4",children:[a.jsx("legend",{className:"px-2 text-sm font-semibold",children:"Société"}),a.jsxs("div",{children:[a.jsx(te,{children:"Raison sociale"}),a.jsx(ue,{value:n.company_name,onChange:i=>s("company_name",i.target.value)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Adresse (une ligne par ligne)"}),a.jsx(fn,{rows:3,value:n.address_lines.join(` 1462`),onChange:i=>s("address_lines",i.target.value.split(` 1463`))})]}),a.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[a.jsxs("div",{children:[a.jsx(te,{children:"CIF"}),a.jsx(ue,{value:n.cif,onChange:i=>s("cif",i.target.value)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"BIC"}),a.jsx(ue,{value:n.bic,onChange:i=>s("bic",i.target.value)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"IBAN"}),a.jsx(ue,{value:n.iban,onChange:i=>s("iban",i.target.value)})]})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Note IBAN (bandeau)"}),a.jsx(ue,{value:n.iban_notice,onChange:i=>s("iban_notice",i.target.value)})]})]}),a.jsxs("fieldset",{className:"space-y-3 rounded-lg border border-border p-4",children:[a.jsx("legend",{className:"px-2 text-sm font-semibold",children:"Contacts pied de page"}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx(te,{children:"Ãditorial - n
1463om"}),a.jsx(ue,{value:n.contact_editorial_name,onChange:i=>s("contact_editorial_name",i.target.value)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Ãditorial - téléphone"}),a.jsx(ue,{value:n.contact_editorial_phone,onChange:i=>s("contact_editorial_phone",i.target.value)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Publicité - nom"}),a.jsx(ue,{value:n.contact_publi_name,onChange:i=>s("contact_publi_name",i.target.value)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Publicité - téléphone"}),a.jsx(ue,{value:n.contact_publi_phone,onChange:i=>s("contact_publi_phone",i.target.value)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Graphisme - nom"}),a.jsx(ue,{value:n.contact_graphics_name,onChange:i=>s("contact_graphics_name",i.target.value)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Graphisme - téléphone"}),a.jsx(ue,{value:n.contact_graphics_phone,onChange:i=>s("contact_graphics_phone",i.target.value)})]})]}),a.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[a.jsxs("div",{children:[a.jsx(te,{children:"Email"}),a.jsx(ue,{value:n.email,onChange:i=>s("email",i.target.value)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Site web"}),a.jsx(ue,{value:n.website,onChange:i=>s("website",i.target.value)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Facebook"}),a.jsx(ue,{value:n.facebook,onChange:i=>s("facebook",i.target.value)})]})]})]}),a.jsxs("fieldset",{className:"space-y-3 rounded-lg border border-border p-4",children:[a.jsx("legend",{className:"px-2 text-sm font-semibold",children:"Conditions générales (page 2) â HTML autorisé"}),a.jsxs("div",{children:[a.jsx(te,{children:"Colonne gauche"}),a.jsx(fn,{rows:8,value:n.cgv_left_html,onChange:i=>s("cgv_left_html",i.target.value)})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Colonne droite"}),a.jsx(fn,{rows:8,value:n.cgv_right_html,onChange:i=>s("cgv_right_html",i.target.value)})]})]}),a.jsx(ss,{children:a.jsx(H,{type:"submit",children:"Enregistrer"})})]})}const GS={enabled:!1,publisher_id:"ca-pub-2978011916205324",slots:{article_top:"",article_middle:"",article_bottom:"",homepage:""}};async function RDt(t,e){const{data:n,error:r}=await Mt.from("site_settings").select("value").eq("key",t).maybeSingle();return r?e:(n==null?void 0:n.value)??e}async function ODt(t,e){const{error:n}=await Mt.from("site_settings").upsert({key:t,value:e,updated_at:new Date().toISOString()},{onConflict:"key"});if(n)throw n}function IDt(){const t=St(),{data:e=GS,isLoading:n}=Ne({queryKey:["site_settings","adsense_config"],queryFn:()=>RDt("adsense_config",GS)}),[r,s]=b.useState(GS),[i,o]=b.useState(!1);b.useEffect(()=>{s({...GS,...e,slots:{...GS.slots,...(e==null?void 0:e.slots)||{}}})},[e]);const l=async()=>{o(!0);try{await ODt("adsense_config",r),ee.success("Configuration AdSense enregistrée"),t.invalidateQueries({queryKey:["site_settings","adsense_config"]})}catch(c){ee.error(c.message)}finally{o(!1)}};return n?a.jsx(Je,{className:"h-6 w-6 animate-spin"}):a.jsxs("div",{className:"space-y-6",children:[a.jsxs(Ke,{children:[a.jsxs(Vt,{children:[a.jsx(Ht,{children:"Google AdSense"}),a.jsx(mi,{children:"Affiché uniquement sur les pages articles, en complément quand aucune publicité locale n'est disponible. Nécessite le consentement cookies du visiteur."})]}),a.jsxs(ut,{className:"space-y-5",children:[a.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border p-4",children:[a.jsxs("div",{children:[a.jsx("p",{className:"font-medium",children:"Activer Google AdSense"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Charge le script AdSense sur les articles si le visiteur a accepté les cookies."})]}),a.jsx(_n,{checked:r.enabled,onCheckedChange:c=>s({...r,enabled:c})})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{children:"Client ID (data-ad-client)"}),a.jsx(ue,{value:r.publisher_id,onChange:c=>s({...r,publisher_id:c.target.value.trim()}),placeholder:"ca-pub-XXXXXXXXXXXXXXXX"})]}),a.jsx(lj,{}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{children:"Slot â page d'accueil"}),a.jsx(ue,{value:r.slots.homepage,onChange:c=>s({...r,slots:{...r.slots,homepage:c.target.value.trim()}}),placeholder:"1234567890"})]}),a.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{children:"Slot â haut d'article"}),a.jsx(ue,{value:r.slots.article_top,onChange:c=>s({...r,slots:{...r.slots,article_top:c.target.value.trim()}}),placeholder:"1234567890"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{children:"Slot â milieu d'article"}),a.jsx(ue,{value:r.slots.article_middle,onChange:c=>s({...r,slots:{...r.slots,article_middle:c.target.value.trim()}}),placeholder:"1234567890"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{children:"Slot â bas d'article"}),a.jsx(ue,{value:r.slots.article_bottom,onChange:c=>s({...r,slots:{...r.slots,article_bottom:c.target.value.trim()}}),placeholder:"1234567890"})]})]}),a.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-border bg-muted/30 p-4 text-sm",children:[a.jsx(n2,{className:"mt-0.5 h-4 w-4 shrink-0 text-primary"}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{children:"AdSense ne s'affiche que si aucune publicité locale n'est active pour l'emplacement."}),a.jsx("p",{children:"Le script n'est chargé que si le visiteur a accepté les cookies analytiques/publicitaires."})]})]})]})]}),a.jsx("div",{className:"flex justify-end",children:a.jsxs(H,{onClick:l,disabled:i,children:[i?a.jsx(Je,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(Ra,{className:"mr-2 h-4 w-4"}),"Enregistrer"]})})]})}const mH=[{value:"new",label:"Nouveau",color:"bg-blue-500"}
1463,{value:"contacted",label:"Contacté",color:"bg-amber-500"},{value:"converted",label:"Converti",color:"bg-green-500"},{value:"lost",label:"Perdu",color:"bg-neutral-400"}];function DDt(t){return mH.find(e=>e.value===t)??mH[0]}function LDt(){const t=St(),[e,n]=b.useState(null),{data:r=[],isLoading:s}=Ne({queryKey:["advertiser_leads"],queryFn:async()=>{const{data:o,error:l}=await Mt.from("advertiser_leads").select("*").order("created_at",{ascending:!1});if(l)throw l;return o??[]}}),i=async(o,l)=>{const{error:c}=await Mt.from("advertiser_leads").update(l).eq("id",o);if(c){ee.error(c.message);return}t.invalidateQueries({queryKey:["advertiser_leads"]}),t.invalidateQueries({queryKey:["sidebar_new_leads"]}),ee.success("Mis à jour"),(e==null?void 0:e.id)===o&&n({...e,...l})};return s?a.jsx(Je,{className:"h-6 w-6 animate-spin"}):a.jsxs("div",{children:[a.jsxs("div",{className:"mb-4 flex items-center gap-3 text-sm text-muted-foreground",children:[a.jsxs("span",{children:[r.length," lead",r.length>1?"s":""]}),a.jsx("span",{children:"·"}),a.jsxs("span",{children:[r.filter(o=>o.status==="new").length," nouveau(x)"]})]}),a.jsx("div",{className:"overflow-x-auto rounded-lg border",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"bg-muted/50 text-left text-xs uppercase text-muted-foreground",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-4 py-3",children:"Nom"}),a.jsx("th",{className:"px-4 py-3",children:"Entreprise"}),a.jsx("th",{className:"px-4 py-3",children:"Intérêt"}),a.jsx("th",{className:"px-4 py-3",children:"Date"}),a.jsx("th",{className:"px-4 py-3",children:"Statut"})]})}),a.jsxs("tbody",{children:[r.map(o=>{const l=DDt(o.status);return a.jsxs("tr",{onClick:()=>n(o),className:"cursor-pointer border-t hover:bg-muted/30",children:[a.jsxs("td",{className:"px-4 py-3",children:[a.jsx("div",{className:"font-medium",children:o.name}),a.jsx("div",{className:"text-xs text-muted-foreground",children:o.email})]}),a.jsx("td",{className:"px-4 py-3",children:o.company||"â"}),a.jsx("td",{className:"px-4 py-3",children:o.interest?a.jsx(ke,{variant:"secondary",children:o.interest}):"â"}),a.jsx("td",{className:"px-4 py-3 text-xs text-muted-foreground",children:new Date(o.created_at).toLocaleDateString("fr-FR")}),a.jsx("td",{className:"px-4 py-3",children:a.jsx("span",{className:`inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-xs font-medium text-white ${l.color}`,children:l.label})})]},o.id)}),r.length===0&&a.jsx("tr",{children:a.jsx("td",{colSpan:5,className:"px-4 py-10 text-center text-muted-foreground",children:"Aucun lead pour le moment."})})]})]})}),a.jsx(an,{open:!!e,onOpenChange:o=>!o&&n(null),children:a.jsx(nn,{className:"max-w-lg",children:e&&a.jsxs(a.Fragment,{children:[a.jsx(on,{children:a.jsx(ln,{children:e.name})}),a.jsxs("div",{className:"space-y-3 text-sm",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ru,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("a",{href:`mailto:${e.email}`,className:"hover:underline",children:e.email})]}),e.phone&&a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(hk,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("a",{href:`tel:${e.phone}`,className:"hover:underline",children:e.phone})]}),e.company&&a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(M$e,{className:"h-4 w-4 text-muted-foreground"}),e.company]}),e.interest&&a.jsxs("div",{children:["Intérêt : ",a.jsx(ke,{variant:"secondary",children:e.interest})]}),a.jsxs("div",{className:"text-xs text-muted-foreground",children:["Reçu le ",new Date(e.created_at).toLocaleString("fr-FR")]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium",children:"Statut"}),a.jsxs(lt,{value:e.status,onValueChange:o=>i(e.id,{status:o}),children:[a.jsx(nt,{children:a.jsx(ct,{})}),a.jsx(rt,{children:mH.map(o=>a.jsx(Ae,{value:o.value,children:o.label},o.value))})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium",children:"Notes"}),a.jsx(fn,{defaultValue:e.notes??"",rows:4,onBlur:o=>{o.currentTarget.value!==(e.notes??"")&&i(e.id,{notes:o.currentTarget.value})}})]}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx(H,{variant:"outline",onClick:()=>n(null),children:"Fermer"}),a.jsx(H,{asChild:!0,children:a.jsx("a",{href:`mailto:${e.email}`,children:"Répondre"})})]})]})})})]})}const wb={fr:"",en:"",es:""},hM={luc_quote:{...wb},luc_photo_url:"",kit_print_pdf:"",kit_digital_pdf:"",next_issue:{...wb},stats:{print:{...wb},digital:{...wb},social:{...wb},profile:{...wb}}};async function FDt(t,e){const n=`annonceurs/${e}-${Date.now()}.pdf`,{error:r}=await Mt.storage.from("ads").upload(n,t,{upsert:!0,contentType:"application/pdf"});if(r)throw r;return Mt.storage.from("ads").getPublicUrl(n).data.publicUrl}async function $Dt(t){const e=t.name.split(".").pop()||"jpg",n=`annonceurs/luc-${Date.now()}.${e}`,{error:r}=await Mt.storage.from("ads").upload(n,t,{upsert:!0});if(r)throw r;return Mt.storage.from("ads").getPublicUrl(n).data.publicUrl}function zDt(){const t=St(),[e,n]=b.useState(hM),[r,s]=b.useState(!1),{data:i,isLoading:o}=Ne({queryKey:["annonceurs_kit"],queryFn:async()=>{const{data:p}=await Mt.from("site_settings").select("value").eq("key","annonceurs_kit").maybeSingle();return(p==null?void 0:p.value)??hM}});b.useEffect(()=>{i&&n({...hM,...i,stats:{...hM.stats,...i.stats}})},[i]);const l=async()=>{s(!0);const{error:p}=await Mt.from("site_settings").upsert({key:"annonceurs_kit",value:e,updated_at:new Date().toISOString()},{onConflict:"key"});if(s(!1),p)return ee.error(p.message);t.invalidateQueries({queryKey:["annonceurs_kit"]}),ee.success("Enregistré")},c=(p,m,v)=>n(x=>({...x,[p]:{...x[p],[m]:v}})),u=(p,m,v)=>n(x=>({...x,stats:{...x.stats,[p]:{...x.stats[p],[m]:v}}})),d=async(p,m)=>{if(m)try{const v=await FDt(m,p);n(x=>({...x,[p]:v})),ee.success("PDF téléversé")}catch(v){ee.error(v.message)}},h=async p=>{if(p)try{const m=await $Dt(p);n(v=>({...v,luc_photo_url:m})),ee.success("Photo téléversée")}catch(m){ee.error(m.message)}};if(o)return a.jsx(Je,{className:"h-6 w-6 animate-spin"});const f=["fr","en","es"];return a.jsxs("div",{className:"space-y-6",children:[a.jsxs(Ke,{children:[a.jsxs(Vt,{children:[a.jsx(Ht,{children:"Kit média â PDFs"}),a.jsx(mi,{children:"Fiches techniques envoyées après le formulaire /annonceurs."})]}),a.jsxs(ut,{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(te,{children:"Fiche technique â Magazine"}),a.jsxs("div",{className:"mt-1 flex items-center gap-3",children:[a.jsx("input",{type:"file",accept:"application/pdf",onChange:p=>{var m;return d("kit_print_pdf",((m=p.target.files)==null?void 0:m[0])??null)}}),e.kit_print_pdf&&a.jsx("a",{href:e.kit_print_pdf,target:"_blank",rel:"noopener",className:"text-sm text-primary hover:underline",children:"Voir"})]})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Fiche technique â Digital"}),a.jsxs("div",{className:"mt-1 flex items-center gap-3",children:[a.jsx("input",{type:"file",accept:"application/pdf",onChange:p=>{var m;return d("kit_digital_pdf",((m=p.target.files)==null?void 0:m[0])??null)}}),e.kit_digital_pdf&&a.jsx("a",{href:e.kit_digital_pdf,target:"_blank",rel:"noopener",className:"text-sm text-primary hover:underline",children:"Voir"})]})]})]})]}),a.jsxs(Ke,{children:[a.jsx(Vt,{children:a.jsx(Ht,{children:"Photo & citation de Luc"})}),a.jsxs(ut,{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(te,{children:"Photo"}),a.jsxs("div",{className:"mt-1 flex items-center gap-3",children:[a.jsx("input",{type:"file",accept:"image/*",onChange:p=>{var m;return h(((m=p.target.files)==null?void 0:m[0])??null)}}),e.luc_photo_url&&a.jsx("img",{src:e.luc_photo_url,className:"h-12 w-12 rounded-full object-cover",alt:"Luc"})]})]}),f.map(p=>a.jsxs("div",{children:[a.jsxs(te,{children:["Citation (",p.toUpperCase(),")"]}),a.jsx(fn,{rows:3,value:e.luc_quote[p],onChange:m=>c("luc_quote",p,m.target.value)})]},p))]})]}),a.jsxs(Ke,{children:[a.jsxs(Vt,{children:[a.jsx(Ht,{children:"Chiffres clés"}),a.jsx(mi,{children:'Mettez à jour les stats affichées dans la section "Notre impact".'})]}),a.jsx(ut,{className:"space-y-4",children:["print","digital","social","profile"].map(p=>a.jsxs("div",{className:"space-y-2 rounded-lg border p-3",children:[a.jsx("div",{className:"text-sm font-semibold capitalize",children:p==="profile"?"Profil lecteur":p}),f.map(m=>a.jsxs("div",{children:[a.jsx(te,{className:"text-xs",children:m.toUpperCase()}),a.jsx(ue,{value:e.stats[p][m],onChange:v=>u(p,m,v.target.value)})]},m))]},p))})]}),a.jsxs(Ke,{children:[a.jsx(Vt,{children:a.jsx(Ht,{children:"Bandeau prochain numéro"})}),a.jsx(ut,{className:"space-y-3",children:f.map(p=>a.jsxs("div",{children:[a.jsx(te,{children:p.toUpperCase()}),a.jsx(ue,{value:e.next_issue[p],onChange:m=>c("next_issue",p,m.target.value)})]},p))})]}),a.jsx("div",{className:"flex justify-end",children:a.jsxs(H,{onClick:l,disabled:r,children:[r?a.jsx(Je,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(Ra,{className:"mr-2 h-4 w-4"}),"Enregistrer"]})})]})}function BDt(){return a.jsxs("div",{children:[a.jsx("h1",{className:"font-heading text-2xl font-bold",children:"Régie publicitaire"}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Gestion des annonceurs, contrats web & magazine, facturation."}),a.jsxs(Qi,{defaultValue:"leads",className:"mt-6",children:[a.jsxs(wi,{className:"flex-wrap",children:[a.jsx(wt,{value:"leads",children:"Leads"}),a.jsx(wt,{value:"pipeline",children:"Pipeline"}),a.jsx(wt,{value:"advertisers",children:"Annonceurs"}),a.jsx(wt,{value:"contracts",children:"Contrats & Campagnes"}),a.jsx(wt,{value:"stats",children:"Statistiques"}),a.jsx(wt,{value:"invoices",children:"Facturation"}),a.jsx(wt,{value:"adsense",children:"AdSense"}),a.jsx(wt,{value:"kit",children:"Kit média"})]}),a.jsx(kt,{value:"leads",className:"mt-6",children:a.jsx(LDt,{})}),a.jsx(kt,{value:"pipeline",className:"mt-6",children:a.jsx(lxt,{})}),a.jsx(kt,{value:"advertisers",className:"mt-6",children:a.jsx(cxt,{})}),a.jsx(kt,{value:"contracts",className:"mt-6",children:a.jsx(fxt,{})}),a.jsx(kt,{value:"stats",className:"mt-6",children:a.jsx(CDt,{})}),a.jsx(kt,{value:"invoices",className:"mt-6",children:a.jsx(TDt,{})}),a.jsx(kt,{value:"adsense",className:"mt-6",children:a.jsx(IDt,{})}),a.jsx(kt,{value:"kit",className:"mt-6",children:a.jsx(zDt,{})})]})]})}const _b=Z;function UDt(){const t=St(),[e,n]=b.useState("all"),[r,s]=b.useState("all"),[i,o]=b.useState(""),{data:l=[],isLoading:c}=Ne({queryKey:["admin_comments",e],queryFn:async()=>{let p=_b.from("comments").select("*").order("created_at",{ascending:!1}).limit(500);e==="flagged"?p=p.eq("is_flagged",!0):e==="hidden"&&(p=p.eq("is_approved",!1));const{data:m,error:v}=await p;if(v)throw v;const x=m||[],g=[...new Set(x.map(C=>
1463C.user_id))],w=[...new Set(x.map(C=>C.article_id))],[_,j]=await Promise.all([g.length?_b.from("profiles").select("id, full_name, email").in("id",g):Promise.resolve({data:[]}),w.length?_b.from("articles").select("id, title, slug").in("id",w):Promise.resolve({data:[]})]),N=new Map((_.data||[]).map(C=>[C.id,C])),S=new Map((j.data||[]).map(C=>[C.id,C]));return x.map(C=>({...C,author:N.get(C.user_id)||null,article:S.get(C.article_id)||null}))}}),{data:u=[]}=Ne({queryKey:["admin_comments_articles"],queryFn:async()=>{const{data:p}=await _b.from("articles").select("id, title").order("title").limit(200);return p||[]}}),d=l.filter(p=>r==="all"||p.article_id===r).filter(p=>{var m,v,x;return!i||((m=p.content)==null?void 0:m.toLowerCase().includes(i.toLowerCase()))||((x=(v=p.author)==null?void 0:v.full_name)==null?void 0:x.toLowerCase().includes(i.toLowerCase()))}),h=Qe({mutationFn:async({id:p,patch:m})=>{const{error:v}=await _b.from("comments").update(m).eq("id",p);if(v)throw v},onSuccess:()=>{t.invalidateQueries({queryKey:["admin_comments"]}),t.invalidateQueries({queryKey:["sidebar_flagged_comments"]}),ee.success("Mis à jour.")},onError:()=>ee.error("Erreur.")}),f=Qe({mutationFn:async p=>{const{error:m}=await _b.from("comments").delete().eq("id",p);if(m)throw m},onSuccess:()=>{t.invalidateQueries({queryKey:["admin_comments"]}),t.invalidateQueries({queryKey:["sidebar_flagged_comments"]}),ee.success("Commentaire supprimé.")},onError:()=>ee.error("Erreur.")});return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"font-heading text-2xl font-bold",children:"Commentaires"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Modération des commentaires d'articles."})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx(H,{size:"sm",variant:e==="all"?"default":"outline",onClick:()=>n("all"),children:"Tous"}),a.jsxs(H,{size:"sm",variant:e==="flagged"?"default":"outline",onClick:()=>n("flagged"),children:[a.jsx(F_,{className:"mr-1.5 h-3.5 w-3.5"})," Signalés"]}),a.jsxs(H,{size:"sm",variant:e==="hidden"?"default":"outline",onClick:()=>n("hidden"),children:[a.jsx(Zy,{className:"mr-1.5 h-3.5 w-3.5"})," Masqués"]}),a.jsxs(lt,{value:r,onValueChange:s,children:[a.jsx(nt,{className:"h-9 w-56",children:a.jsx(ct,{placeholder:"Article"})}),a.jsxs(rt,{children:[a.jsx(Ae,{value:"all",children:"Tous les articles"}),u.map(p=>a.jsx(Ae,{value:p.id,children:p.title},p.id))]})]}),a.jsx(ue,{placeholder:"Rechercherâ¦",value:i,onChange:p=>o(p.target.value),className:"h-9 w-48"})]}),c?a.jsx("p",{className:"text-sm text-muted-foreground",children:"Chargementâ¦"}):a.jsx("div",{className:"overflow-x-auto rounded-xl border border-border bg-card",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"bg-muted",children:a.jsxs("tr",{className:"text-left",children:[a.jsx("th",{className:"px-3 py-2 font-medium",children:"Article"}),a.jsx("th",{className:"px-3 py-2 font-medium",children:"Auteur"}),a.jsx("th",{className:"px-3 py-2 font-medium",children:"Commentaire"}),a.jsx("th",{className:"px-3 py-2 font-medium",children:"Date"}),a.jsx("th",{className:"px-3 py-2 font-medium text-center",children:"Ãtat"}),a.jsx("th",{className:"px-3 py-2 font-medium text-right",children:"Actions"})]})}),a.jsxs("tbody",{children:[d.map(p=>{var m,v;return a.jsxs("tr",{className:"border-t border-border",children:[a.jsx("td",{className:"px-3 py-2 align-top max-w-[200px]",children:p.article?a.jsx(_e,{to:`/actualites/${p.article.slug}`,target:"_blank",className:"text-primary hover:underline line-clamp-2",children:p.article.title}):a.jsx("span",{className:"text-muted-foreground",children:"â"})}),a.jsx("td",{className:"px-3 py-2 align-top",children:((m=p.author)==null?void 0:m.full_name)||((v=p.author)==null?void 0:v.email)||"â"}),a.jsxs("td",{className:"px-3 py-2 align-top max-w-[320px]",children:[a.jsx("p",{className:"line-clamp-3 text-xs",children:p.content}),p.parent_id&&a.jsx(ke,{variant:"outline",className:"mt-1 text-[10px]",children:"Réponse"})]}),a.jsx("td",{className:"px-3 py-2 align-top text-xs text-muted-foreground whitespace-nowrap",children:new Date(p.created_at).toLocaleDateString("fr-FR",{day:"2-digit",month:"2-digit",year:"numeric"})}),a.jsx("td",{className:"px-3 py-2 align-top text-center",children:a.jsxs("div",{className:"flex flex-col items-center gap-1",children:[p.is_flagged&&a.jsxs(ke,{variant:"destructive",className:"text-[10px]",children:[a.jsx(F_,{className:"mr-1 h-3 w-3"}),"Signalé"]}),!p.is_approved&&a.jsx(ke,{variant:"outline",className:"text-[10px]",children:"Masqué"}),p.is_approved&&!p.is_flagged&&a.jsx(ke,{className:"text-[10px] bg-green-600",children:"Visible"})]})}),a.jsx("td",{className:"px-3 py-2 align-top",children:a.jsxs("div",{className:"flex justify-end gap-1",children:[(!p.is_approved||p.is_flagged)&&a.jsx(H,{size:"sm",variant:"outline",onClick:()=>h.mutate({id:p.id,patch:{is_approved:!0,is_flagged:!1}}
1463),title:"Approuver",children:a.jsx(Ma,{className:"h-3.5 w-3.5"})}),p.is_approved&&a.jsx(H,{size:"sm",variant:"outline",onClick:()=>h.mutate({id:p.id,patch:{is_approved:!1}}),title:"Masquer",children:a.jsx(Zy,{className:"h-3.5 w-3.5"})}),a.jsx(H,{size:"sm",variant:"outline",className:"text-destructive hover:text-destructive",onClick:()=>{confirm("Supprimer définitivement ce commentaire ?")&&f.mutate(p.id)},title:"Supprimer",children:f.isPending?a.jsx(Je,{className:"h-3.5 w-3.5 animate-spin"}):a.jsx(tr,{className:"h-3.5 w-3.5"})})]})})]},p.id)}),d.length===0&&a.jsx("tr",{children:a.jsx("td",{colSpan:6,className:"px-3 py-8 text-center text-muted-foreground",children:"Aucun commentaire."})})]})]})})]})}const uB={admin:"Admin",redacteur_chef:"Rédacteur chef",redacteur:"Rédacteur",graphiste:"Graphiste",commercial:"Commercial",gestionnaire_boutique:"Gestionnaire boutique",member:"Membre"},qDt={admin:"bg-red-100 text-red-700 border-red-200",redacteur_chef:"bg-purple-100 text-purple-700 border-purple-200",redacteur:"bg-blue-100 text-blue-700 border-blue-200",graphiste:"bg-emerald-100 text-emerald-700 border-emerald-200",commercial:"bg-amber-100 text-amber-700 border-amber-200",gestionnaire_boutique:"bg-cyan-100 text-cyan-700 border-cyan-200",member:"bg-slate-100 text-slate-600 border-slate-200"};function VDt(t,e){return(t||e||"?").split(/\s+/).filter(Boolean).slice(0,2).map(r=>{var s;return(s=r[0])==null?void 0:s.toUpperCase()}).join("")}function wce(t){return t?new Date(t).toLocaleDateString("fr-FR",{day:"2-digit",month:"short",year:"numeric"}):"â"}function HDt(){const t=St(),[e,n]=b.useState(""),[r,s]=b.useState("all"),[i,o]=b.useState("all"),[l,c]=b.useState("recent"),[u,d]=b.useState(!1),{data:h,isLoading:f}=Ne({queryKey:["admin-users-list"],queryFn:async()=>{const{data:_,error:j}=await Z.functions.invoke("admin-users",{body:{action:"list"}});if(j)throw j;return _.users}}),p=h??[],m=b.useMemo(()=>{let _=[...p];if(e.trim()){const j=e.toLowerCase();_=_.filter(N=>{var S,C;return((S=N.full_name)==null?void 0:S.toLowerCase().includes(j))||((C=N.email)==null?void 0:C.toLowerCase().includes(j))})}return r!=="all"&&(_=_.filter(j=>j.role===r)),i==="active"?_=_.filter(j=>{var N;return((N=j.carte)==null?void 0:N.status)==="active"}):i==="none"&&(_=_.filter(j=>!j.carte)),l==="recent"?_.sort((j,N)=>(N.created_at??"").localeCompare(j.created_at??"")):l==="name"?_.sort((j,N)=>(j.full_name??"").localeCompare(N.full_name??"")):l==="orders"&&_.sort((j,N)=>N.orders_count-j.orders_count),_},[p,e,r,i,l]),v=b.useMemo(()=>{const _=new Date,j=new Date(_.getFullYear(),_.getMonth(),1).toISOString();return{total:p.length,newThisMonth:p.filter(N=>(N.created_at??"")>=j).length,cartesActives:p.filter(N=>{var S;return((S=N.carte)==null?void 0:S.status)==="active"}).length,withOrders:p.filter(N=>N.orders_count>0).length}},[p]),x=Qe({mutationFn:async _=>{const{data:j,error:N}=await Z.functions.invoke("admin-users",{body:{action:"create_staff",..._}});if(N)throw N;return j},onSuccess:()=>{ee.success("Compte créé. Un email d'invitation a été envoyé."),d(!1),t.invalidateQueries({queryKey:["admin-users-list"]})},onError:_=>ee.error(_.message??"Erreur")}),[g,w]=b.useState({email:"",full_name:"",role:"redacteur"});return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-bold",children:"Utilisateurs"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Gérer les comptes membres et staff"})]}),a.jsxs(an,{open:u,onOpenChange:d,children:[a.jsx(W_,{asChild:!0,children:a.jsxs(H,{children:[a.jsx(dr,{className:"mr-2 h-4 w-4"})," Nouveau compte"]})}),a.jsxs(nn,{children:[a.jsxs(on,{children:[a.jsx(ln,{children:"Créer un compte staff"}),a.jsx(Eu,{children:"Un email d'invitation sera envoyé pour définir le mot de passe."})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx(te,{children:"Nom complet"}),a.jsx(ue,{value:g.full_name,onChange:_=>w({...g,full_name:_.target.value})})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Email"}),a.jsx(ue,{type:"email",value:g.email,onChange:_=>w({...g,email:_.target.value})})]}),a.jsxs("div",{children:[a.jsx(te,{children:"Rôle"}),a.jsxs(lt,{value:g.role,onValueChange:_=>w({...g,role:_}),children:[a.jsx(nt,{children:a.jsx(ct,{})}),a.jsx(rt,{children:Object.entries(uB).filter(([_])=>_!=="member").map(([_,j])=>a.jsx(Ae,{value:_,children:j},_))})]})]})]}),a.jsxs(ss,{children:[a.jsx(H,{variant:"ghost",onClick:()=>d(!1),children:"Annuler"}),a.jsx(H,{disabled:!g.email||!g.full_name||x.isPending,onClick:()=>
1463x.mutate(g),children:"Créer et inviter"})]})]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-4",children:[a.jsx(fM,{label:"Total utilisateurs",value:v.total,icon:RW}),a.jsx(fM,{label:"Nouveaux ce mois",value:v.newThisMonth,icon:N5e}),a.jsx(fM,{label:"Cartes Privilège actives",value:v.cartesActives,icon:Jo}),a.jsx(fM,{label:"Avec commandes",value:v.withOrders,icon:Wi})]}),a.jsx(Ke,{children:a.jsx(ut,{className:"p-4",children:a.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[a.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[a.jsx(is,{className:"absolute left-3 top-2.5 h-4 w-4 text-muted-foreground"}),a.jsx(ue,{className:"pl-9",placeholder:"Rechercher nom ou emailâ¦",value:e,onChange:_=>n(_.target.value)})]}),a.jsxs(lt,{value:r,onValueChange:s,children:[a.jsx(nt,{className:"w-[180px]",children:a.jsx(ct,{placeholder:"Rôle"})}),a.jsxs(rt,{children:[a.jsx(Ae,{value:"all",children:"Tous les rôles"}),Object.entries(uB).map(([_,j])=>a.jsx(Ae,{value:_,children:j},_))]})]}),a.jsxs(lt,{value:i,onValueChange:o,children:[a.jsx(nt,{className:"w-[180px]",children:a.jsx(ct,{placeholder:"Carte"})}),a.jsxs(rt,{children:[a.jsx(Ae,{value:"all",children:"Toutes cartes"}),a.jsx(Ae,{value:"active",children:"Avec carte active"}),a.jsx(Ae,{value:"none",children:"Sans carte"})]})]}),a.jsxs(lt,{value:l,onValueChange:c,children:[a.jsx(nt,{className:"w-[160px]",children:a.jsx(ct,{})}),a.jsxs(rt,{children:[a.jsx(Ae,{value:"recent",children:"Plus récent"}),a.jsx(Ae,{value:"name",children:"Alphabétique"}),a.jsx(Ae,{value:"orders",children:"Nb commandes"})]})]})]})})}),a.jsx(Ke,{children:a.jsx(ut,{className:"p-0",children:a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"bg-muted/50 text-left text-xs uppercase text-muted-foreground",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-4 py-3",children:"Utilisateur"}),a.jsx("th",{className:"px-4 py-3",children:"Rôle"}),a.jsx("th",{className:"px-4 py-3",children:"Carte"}),a.jsx("th",{className:"px-4 py-3",children:"Inscription"}),a.jsx("th",{className:"px-4 py-3",children:"Dernière connexion"}),a.jsx("th",{className:"px-4 py-3 text-center",children:"Commandes"}),a.jsx("th",{className:"px-4 py-3"})]})}),a.jsxs("tbody",{className:"divide-y divide-border",children:[f&&a.jsx("tr",{children:a.jsx("td",{colSpan:7,className:"p-8 text-center text-muted-foreground",children:"Chargementâ¦"})}),!f&&m.length===0&&a.jsx("tr",{children:a.jsx("td",{colSpan:7,className:"p-8 text-center text-muted-foreground",children:"Aucun utilisateur"})}),m.map(_=>{var S;const j=_.role??"member",N=((S=_.carte)==null?void 0:S.status)==="active"?a.jsx(ke,{className:"bg-emerald-100 text-emerald-700 border-emerald-200",children:"Active"}):_.carte?a.jsx(ke,{className:"bg-orange-100 text-orange-700 border-orange-200",children:"Expirée"}):a.jsx("span",{className:"text-muted-foreground",children:"â"});return a.jsxs("tr",{className:"hover:bg-muted/30",children:[a.jsx("td",{className:"px-4 py-3",children:a.jsxs(_e,{to:`/admin/utilisateurs/${_.id}`,className:"flex items-center gap-3",children:[a.jsxs(V3,{className:"h-9 w-9",children:[a.jsx(H3,{src:_.avatar_url}),a.jsx(W3,{children:VDt(_.full_name,_.email)})]}),a.jsxs("div",{children:[a.jsx("div",{className:"font-medium",children:_.full_name||"â"}),a.jsx("div",{className:"text-xs text-muted-foreground",children:_.email})]})]})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx(ke,{variant:"outline",className:qDt[j],children:uB[j]??j})}),a.jsx("td",{className:"px-4 py-3",children:N}),a.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:wce(_.created_at)}),a.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:wce(_.last_sign_in_at??_.updated_at)}),a.jsx("td",{className:"px-4 py-3 text-center",children:_.orders_count}),a.jsx("td",{className:"px-4 py-3 text-right",children:a.jsx(H,{variant:"ghost",size:"sm",asChild:!0,children:a.jsx(_e,{to:`/admin/utilisateurs/${_.id}`,children:"Détail"})})})]},_.id)})]})]})})})})]})}function fM({label:t,value:e,icon:n}){return a.jsx(Ke,{children:a.jsx(ut,{className:"p-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-xs uppercase text-muted-foreground",children:t}),a.jsx("div",{className:"mt-1 text-2xl font-bold",children:e})]}
1463),a.jsx(n,{className:"h-8 w-8 text-muted-foreground/40"})]})})})}const WDt=["admin","redacteur_chef","redacteur","graphiste","commercial","gestionnaire_boutique","member"],KDt={admin:"Admin",redacteur_chef:"Rédacteur chef",redacteur:"Rédacteur",graphiste:"Graphiste",commercial:"Commercial",gestionnaire_boutique:"Gestionnaire boutique",member:"Membre"};function jb(t){return t?new Date(t).toLocaleDateString("fr-FR",{day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"}):"â"}function GDt(t,e){return(t||e||"?").split(/\s+/).filter(Boolean).slice(0,2).map(r=>{var s;return(s=r[0])==null?void 0:s.toUpperCase()}).join("")}function YDt(){const{id:t}=Xi(),e=Gs(),n=St(),[r,s]=b.useState(0),[i,o]=b.useState(!1),[l,c]=b.useState(""),{data:u,isLoading:d}=Ne({queryKey:["admin-user",t],queryFn:async()=>{const{data:S,error:C}=await Z.functions.invoke("admin-users",{body:{action:"get",id:t}});if(C)throw C;return S},enabled:!!t}),{data:h}=Ne({queryKey:["admin-user-carte",t],queryFn:async()=>{const{data:S}=await Z.from("carte_privilege").select("*").eq("user_id",t).maybeSingle();return S},enabled:!!t}),{data:f}=Ne({queryKey:["admin-user-orders",t],queryFn:async()=>{const{data:S}=await Z.from("orders").select("id, order_number, status, total, created_at").eq("user_id",t).order("created_at",{ascending:!1});return S??[]},enabled:!!t}),{data:p}=Ne({queryKey:["admin-user-favorites",t],queryFn:async()=>{const{data:S}=await Z.from("favorites").select("article_id, created_at, articles(title, slug)").eq("user_id",t);return S??[]},enabled:!!t}),{data:m}=Ne({queryKey:["admin-user-comments",t],queryFn:async()=>{const{data:S}=await Z.from("comments").select("id, content, created_at, article_id").eq("user_id",t).order("created_at",{ascending:!1});return S??[]},enabled:!!t}),v=Qe({mutationFn:async S=>{const{error:C}=await Z.functions.invoke("admin-users",{body:{action:"update_role",id:t,role:S}});if(C)throw C},onSuccess:()=>{ee.success("Rôle mis à jour"),n.invalidateQueries({queryKey:["admin-user",t]}),n.invalidateQueries({queryKey:["admin-users-list"]})},onError:S=>ee.error(S.message??"Erreur")}),x=Qe({mutationFn:async()=>{var C;const{error:S}=await Z.functions.invoke("admin-users",{body:{action:"reset_password",email:(C=u==null?void 0:u.profile)==null?void 0:C.email}});if(S)throw S},onSuccess:()=>ee.success("Email de réinitialisation envoyé"),onError:S=>ee.error(S.message??"Erreur")}),g=Qe({mutationFn:async S=>{const{error:C}=await Z.functions.invoke("admin-users",{body:{action:"set_password",id:t,password:S}});if(C)throw C},onSuccess:()=>{ee.success("Mot de passe défini"),o(!1),c("")},onError:S=>ee.error(S.message??"Erreur")}),w=Qe({mutationFn:async()=>{const{error:S}=await Z.functions.invoke("admin-users",{body:{action:"deactivate",id:t}});if(S)throw S},onSuccess:()=>{ee.success("Compte désactivé"),n.invalidateQueries({queryKey:["admin-user",t]})},onError:S=>ee.error(S.message??"Erreur")}),_=Qe({mutationFn:async()=>{const{error:S}=await Z.functions.invoke("admin-users",{body:{action:"delete",id:t}});if(S)throw S},onSuccess:()=>{ee.success("Compte supprimé"),e("/admin/utilisateurs")},onError:S=>ee.error(S.message??"Erreur")});if(d)return a.jsx("div",{className:"p-8 text-muted-foreground",children:"Chargementâ¦"});if(!(u!=null&&u.profile))return a.jsx("div",{className:"p-8",children:"Utilisateur introuvable"});const j=u.profile,N=u.auth;return a.jsxs("div",{className:"space-y-6 max-w-5xl",children:[a.jsx("div",{className:"flex items-center justify-between",children:a.jsx(H,{variant:"ghost",size:"sm",asChild:!0,children:a.jsxs(_e,{to:"/admin/utilisateurs",children:[a.jsx(jr,{className:"mr-2 h-4 w-4"})," Retour"]})})}),a.jsx(Ke,{children:a.jsx(ut,{className:"p-6",children:a.jsxs("div",{className:"flex flex-col md:flex-row gap-6 items-start",children:[a.jsxs(V3,{className:"h-20 w-20",children:[a.jsx(H3,{src:j.avatar_url}),a.jsx(W3,{className:"text-xl",children:GDt(j.full_name,j.email)})]}),a.jsxs("div",{className:"flex-1 space-y-2",children:[a.jsx("h1",{className:"text-2xl font-bold",children:j.full_name||"â"}),a.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[a.jsx(Ru,{className:"h-4 w-4"})," ",j.email]}),j.phone&&a.jsxs("div",{className:"text-muted-foreground",children:["Tél. : ",j.p
1463hone]}),a.jsxs("div",{className:"text-sm text-muted-foreground",children:["Inscrit le ",jb(j.created_at)]}),(N==null?void 0:N.last_sign_in_at)&&a.jsxs("div",{className:"text-sm text-muted-foreground",children:["Dernière connexion : ",jb(N.last_sign_in_at)]})]}),a.jsxs("div",{className:"space-y-2 min-w-[200px]",children:[a.jsx("label",{className:"text-xs font-medium uppercase text-muted-foreground",children:"Rôle"}),a.jsxs(lt,{value:j.role??"member",onValueChange:S=>v.mutate(S),children:[a.jsx(nt,{children:a.jsx(ct,{})}),a.jsx(rt,{children:WDt.map(S=>a.jsx(Ae,{value:S,children:KDt[S]},S))})]}),a.jsxs(H,{variant:"outline",size:"sm",className:"w-full",onClick:()=>x.mutate(),disabled:x.isPending,children:[a.jsx(G6,{className:"mr-2 h-4 w-4"})," Envoyer un lien de réinitialisation"]}),a.jsxs(an,{open:i,onOpenChange:o,children:[a.jsx(W_,{asChild:!0,children:a.jsxs(H,{variant:"outline",size:"sm",className:"w-full",children:[a.jsx(G6,{className:"mr-2 h-4 w-4"})," Définir un mot de passe"]})}),a.jsxs(nn,{children:[a.jsxs(on,{children:[a.jsx(ln,{children:"Définir un mot de passe"}),a.jsxs(Eu,{children:["Le mot de passe sera appliqué immédiatement à ",j.email,". Communiquez-le à la personne pour qu'elle le change ensuite."]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"new-pwd",children:"Nouveau mot de passe"}),a.jsx(ue,{id:"new-pwd",type:"text",value:l,onChange:S=>c(S.target.value),placeholder:"8 caractères minimum",autoComplete:"off"})]}),a.jsxs(ss,{children:[a.jsx(H,{variant:"outline",onClick:()=>o(!1),children:"Annuler"}),a.jsx(H,{onClick:()=>g.mutate(l),disabled:l.length<8||g.isPending,children:g.isPending?"Enregistrementâ¦":"Enregistrer"})]})]})]})]})]})})}),h&&a.jsxs(Ke,{children:[a.jsx(Vt,{children:a.jsxs(Ht,{className:"flex items-center gap-2",children:[a.jsx(Jo,{className:"h-4 w-4"})," Carte Privilège"]})}),a.jsxs(ut,{className:"space-y-2 text-sm",children:[a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-muted-foreground",children:"N° de carte"}),a.jsx("span",{className:"font-mono",children:h.card_number})]}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-muted-foreground",children:"Statut"}),a.jsx(ke,{variant:h.status==="active"?"default":"secondary",children:h.status})]}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-muted-foreground",children:"Souscrite"}),a.jsx("span",{children:jb(h.subscribed_at)})]}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-muted-foreground",children:"Expire"}),a.jsx("span",{children:jb(h.valid_until)})]}),a.jsx(H,{variant:"link",size:"sm",asChild:!0,className:"p-0",children:a.jsx(_e,{to:"/admin/carte-privilege",children:"Voir dans Carte Privilège â"})})]})]}),a.jsxs(Ke,{children:[a.jsx(Vt,{children:a.jsxs(Ht,{className:"flex items-center gap-2",children:[a.jsx(Wi,{className:"h-4 w-4"})," Commandes (",(f==null?void 0:f.length)??0,")"]})}),a.jsx(ut,{className:"p-0",children:f!=null&&f.length?a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"bg-muted/30 text-left text-xs uppercase text-muted-foreground",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-4 py-2",children:"N°"}),a.jsx("th",{className:"px-4 py-2",children:"Date"}),a.jsx("th",{className:"px-4 py-2",children:"Total"}),a.jsx("th",{className:"px-4 py-2",children:"Statut"}),a.jsx("th",{})]})}),a.jsx("tbody",{className:"divide-y divide-border",children:f.map(S=>a.jsxs("tr",{className:"hover:bg-muted/20",children:[a.jsx("td",{className:"px-4 py-2 font-medium",children:S.order_number}),a.jsx("td",{className:"px-4 py-2 text-muted-foreground",children:jb(S.created_at)}),a.jsxs("td",{className:"px-4 py-2",children:[Number(S.total).toFixed(2)," â¬"]}),a.jsx("td",{className:"px-4 py-2",children:a.jsx(ke,{variant:"outline",children:S.status})}),a.jsx("td",{className:"px-4 py-2 text-right",children:a.jsx(_e,{to:`/admin/commandes/${S.id}`,className:"text-primary text-xs",children:"Voir â"})})]},S.id))})]}):a.jsx("div",{className:"p-6 text-center text-muted-foreground text-sm",children:"Aucune commande"})})]}),a.jsxs(Ke,{children:[a.jsx(Vt,{children:a.jsxs(Ht,{className:"flex items-center gap-2",children:[a.jsx(e3,{className:"h-4 w-4"})," Favoris (",(p==null?void 0:p.length)??0,")"]})}),a.jsx(ut,{children:p!=null&&p.length?a.jsx("ul",{className:"space-y-1 text-sm",children:p.map(S=>{var C,k;return a.jsx("li",{children:a.jsx(_e,{to:`/actualites/${((C=S.articles)==null?void 0:C.slug)??""}`,className:"hover:text-primary",children:((k=S.articles)==null?void 0:k.title)??"Article supprimé"})},S.article_id)})}):a.jsx("div",{className:"text-center text-muted-foreground text-sm py-4",children:"Aucun favori"})})]}),a.jsxs(Ke,{children:[a.jsx(Vt,{children:a.jsxs(Ht,{className:"flex items-center gap-2",children:[a.jsx(t3,{className:"h-4 w-4"})," Commentaires (",(m==null?void 0:m.length)??0,")"]})}),a.jsx(ut,{children:m!=null&&m.length?a.jsx("ul",{className:"space-y-3 text-sm",children:m.map(S=>a.jsxs("li",{className:"border-l-2 border-muted pl-3",children:[a.jsx("div",{className:"text-xs text-muted-foreground",children:jb(S.created_at)}),a.jsx("p",{className:"line-clamp-2",children:S.content})]},S.id))}):a.jsx("div",{className:"text-center text-muted-foreground text-sm py-4",children:"Aucun commentaire"})})]}),a.jsxs(Ke,{className:"border-destructive/30",children:[a.jsx(Vt,{children:a.jsx(Ht,{className:"text-destructive",children:"Zone dangereuse"})}),a.jsxs(ut,{className:"flex flex-wrap gap-3",children:[a.jsxs(H,{variant:"outline",onClick:()=>w.mutate(),disabled:w.isPending,children:[a.jsx(k5e,{className:"mr-2 h-4 w-4"})," Désactiver le compte"]}),a.jsxs(ro,{onOpenChange:S=>!S&&s(0),children:[a.jsx(U3,{asChild:!0,children:a.jsxs(H,{variant:"destructive",children:[a.jsx(tr,{className:"mr-2 h-4 w-4"})," Supprimer le compte"]})}),a.jsxs(ja,{children:[a.jsxs(Sa,{children:[a.jsx(Ca,{children:r===0?"Supprimer ce compte ?":"Confirmer la suppression définitive"}),a.jsx(ka,{children:r===0?"Cette action supprime le profil et anonymise les données liées. Ãtes-vous sûr ?":"Action irréversible. Confirmez une seconde fois pour procéder."})]}),a.jsxs(Na,{children:[a.jsx(Ea,{children:"Annuler"}),r===0?a.jsx(H,{variant:"destructive",onClick:S=>{S.preventDefault(),s(1)},children:"Continuer"}):a.jsx(Aa,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>_.mutate(),children:"Supprimer définitivement"})]})]})]})]})]})]})}const sa={sender_name:"Esprit Sud Magazine",sender_email:"[email protected]"},vw=[{key:"order_confirmed",label:"Confirmation de commande",description:"Envoyé après paiement validé.",category:"Boutique",variables:["nom","email","numero_commande","montant"],defaults:{...sa,subject:"Merci pour votre commande #{numero_commande}",body:"<p>Bonjour {nom},</p><p>Merci pour votre commande sur <strong>Esprit Sud Magazine</strong>.</p><p>Récapitulatif : commande <strong>#{numero_commande}</strong> d'un montant de <strong>{montant}â¬</strong>.</p><p>Nous préparons votre colis et vous tiendrons informé de l'expédition.</p>"}},{key:"order_shipped",label:"Commande expédiée",description:"Envoyé quand la commande passe au statut expédié.",category:"Boutique",variables:["nom","numero_commande","lien_suivi","transporteur","delai_livraison"],defaults:{...sa,subject:"Votre commande #{numero_commande} est en route !",body:'<p>Bonjour {nom},</p><p>Votre commande a été expédiée.</p><p>Suivez votre colis : <a href="{lien_suivi}">{lien_suivi}</a>.</p><p>Transporteur : <strong>{transporteur}</strong>.<br/>Livraison estimée : <strong>{delai_livraison}</strong>.</p>'}},{key:"order_delivered",label:"Commande livrée",description:"Envoyé quand la commande est marquée livrée.",category:"Boutique",variables:["nom","numero_commande"],defaults:{...sa,subject:"Votre commande #{numero_commande} a bien été livrée",body:"<p>Bonjour {nom},</p><p>Votre commande <strong>#{numero_commande}</strong> vient d'être livrée. Nous espérons qu'elle vous plaira !</p><p>à très bientôt sur Esprit Sud Magazine.</p>"}},{key:"order_cancelled",label:"Commande annulée / remboursée",description:"Envoyé en cas d'annulation ou remboursement.",category:"Boutique",variables:["nom","numero_commande","montant"],defaults:{...sa,subject:"Votre commande #{numero_commande} a été annulée",body:"<p>Bonjour {nom},</p><p>Votre commande <strong>#{numero_commande}</strong> a été annulée. Un remboursement de <strong>{montant}â¬</strong> a été initié et sera crédité sous quelques jours.</p>"}},{key:"carte_welcome",label:"Bienvenue Carte Privilège",description:"Envoyé après souscription à la Carte Privilège.",category:"Carte Privilège",variables:["nom","numero_carte","date_expiration"],defaults:{...sa,subject:"Bienvenue dans le club Esprit Sud !",body:`<p>Bonjour {nom},</p><p>Votre <strong>Carte Privilège</strong> est maintenant active !</p><p>N° de carte : <strong>{numero_carte}</strong><br/>Valable jusqu'au <strong>{date_expiration}</strong>.</p><p>Découvrez vos avantages sur <a href="https://www.espritsud.es/carte-privilege/mon-espace">votre espace membre</a>.</p>`}},{key:"carte_renewed",label:"Carte renouvelée",description:"Envoyé après renouvellement annuel.",category:"Carte Privilège",variables:["nom","numero_carte","date_expiration"],defaults:{...sa,subject:"Votre Carte Privilège a été renouvelée",body:"<p>Bonjour {nom},</p><p>Votre Carte Privilège (n°<strong>{numero_carte}</strong>) a bien été renouvelée. Elle est désormais valable jusqu'au <strong>{date_expiration}</strong>.</p><p>Merci pour votre fidélité !</p>"}},{key:"carte_expiring",label:"Carte expire bientôt",description:"Envoyé 30 jours avant expiration.",category:"Carte Privilège",variables:["nom","numero_carte","date_expiration"],defaults:{...sa,subject:"Votre Carte Privilège expire dans 30 jours",body:"<p>Bonjour {nom},</p><p>Votre Carte Privilège (n°<strong>{numero_carte}</strong>) expire le <strong>{date_expiration}</strong>.</p><p>Renouvelez-la dès maintenant pour continuer à profiter de vos réductions chez nos partenaires.</p>"}},{key:"carte_expired",label:"Carte expirée",description:"Envoyé le jour de l'expiration.",category:"Carte Privilège",variables:["nom","numero_carte"],defaults:{...sa,subject:"Votre Carte Privilège a expiré",body:"<p>Bonjour {nom},</p><p>Votre Carte Privilège (n°<strong>{numero_carte}</strong>) a expiré. Renouvelez-la pour retrouver tous vos avantages.</p>"}},{key:"carte_migration_invite",label:"Invitation migration",description:"Envoyé aux anciens abonnés Carte Privilège.",category:"Carte Privilège",variables:["nom","lien","date_expiration"],defaults:{...sa,subject:"Votre Carte Privilège Esprit Sud vous attend !",body:`<p>Bonjour {nom},</p><p>Esprit Sud Magazine fait peau neuve ! Votre Carte Privilège a été transférée sur notre nouvelle plateforme.</p><p><a href="{lien}">Cliquez ici pour activer votre compte</a>.</p><p>Votre carte est active jusqu'au <strong>{date_expiration}</strong>.</p>`}},{key:"user_welcome",label:"Bienvenue / Inscription",description:"Envoyé après création d'un compte.",category:"Compte utilisateur",variables:["nom","email"],defaults:{...sa,subject:"Bienvenue sur Esprit Sud Magazine",body:`<p>Bonjour {nom},</p><p>
1463Votre compte a bien été créé avec l'adresse <strong>{email}</strong>.</p><p>Découvrez toute l'actualité, les guides et la Carte Privilège sur <a href="https://www.espritsud.es">espritsud.es</a>.</p>`}},{key:"user_password_reset",label:"Réinitialisation mot de passe",description:"Envoyé pour réinitialiser le mot de passe.",category:"Compte utilisateur",variables:["nom","lien"],defaults:{...sa,subject:"Réinitialisez votre mot de passe",body:'<p>Bonjour {nom},</p><p>Vous avez demandé la réinitialisation de votre mot de passe.</p><p><a href="{lien}">Cliquez ici pour choisir un nouveau mot de passe</a>. Ce lien expire dans 1 heure.</p>'}},{key:"user_email_change",label:"Changement d'email",description:"Envoyé lors d'un changement d'adresse email.",category:"Compte utilisateur",variables:["nom","email","lien"],defaults:{...sa,subject:"Confirmez votre nouvelle adresse email",body:`<p>Bonjour {nom},</p><p>Une demande de changement d'email vers <strong>{email}</strong> a été effectuée.</p><p><a href="{lien}">Confirmez ce changement</a>.</p>`}},{key:"newsletter_confirm",label:"Confirmation inscription newsletter",description:"Envoyé après inscription à la newsletter.",category:"Newsletter",variables:["nom","email"],defaults:{...sa,subject:"Bienvenue dans la newsletter Esprit Sud !",body:"<p>Bonjour {nom},</p><p>Merci de rejoindre la newsletter d'Esprit Sud Magazine. Vous recevrez chaque mois nos meilleures actualités, guides et bons plans andalous.</p>"}},{key:"newsletter_unsubscribed",label:"Désabonnement confirmé",description:"Envoyé après désabonnement de la newsletter.",category:"Newsletter",variables:["email"],defaults:{...sa,subject:"Votre désabonnement est confirmé",body:"<p>Bonjour,</p><p>L'adresse <strong>{email}</strong> a bien été désabonnée de notre newsletter. à bientôt sur espritsud.es.</p>"}},{key:"advertiser_invoice",label:"Facture envoyée",description:"Envoyé aux annonceurs quand une facture est émise.",category:"Annonceurs",variables:["nom","numero_commande","montant","lien"],defaults:{...sa,subject:"Votre facture Esprit Sud n°{numero_commande}",body:`<p>Bonjour {nom},</p><p>Vous trouverez ci-joint votre facture <strong>#{numero_commande}</strong> d'un montant de <strong>{montant}â¬</strong>.</p><p><a href="{lien}">Télécharger la facture</a>.</p>`}},{key:"advertiser_payment_reminder",label:"Rappel paiement en retard",description:"Envoyé en cas de retard de paiement.",category:"Annonceurs",variables:["nom","numero_commande","montant"],defaults:{...sa,subject:"Rappel : facture #{numero_commande} en attente de règlement",body:"<p>Bonjour {nom},</p><p>Sauf erreur de notre part, la facture <strong>#{numero_commande}</strong> d'un montant de <strong>{montant}â¬</strong> reste impayée à ce jour.</p><p>Merci de procéder à son règlement dans les meilleurs délais.</p>"}}],XDt=["nom","email","numero_commande","numero_carte","date_expiration","montant","lien","lien_suivi","transporteur","delai_livraison"],kPe={primary_color:"#1B4F72",logo_url:"",header_html:`<div style="background:#1B4F72;padding:28px;text-align:center"> 1464 <h1 style="color:#C8962E;font-size:22px;margin:0;font-family:Georgia,serif">Esprit Sud Magazine</h1> 1465</div>`,footer_html:`<div style="background:#1B4F72;padding:20px;text-align:center;color:#C8962E;font-size:12px"> 1466 <p style="margin:0 0 6px">Esprit Sud Magazine â <a href="https://www.espritsud.es" style="color:#C8962E">www.espritsud.es</a></p> 1467 <p style="margin:0"> 1468 <a href="https://www.facebook.com/espritsudmag" style="color:#C8962E;margin:0 6px">Facebook</a> · 1469 <a href="https://www.instagram.com/espritsudmag" style="color:#C8962E;margin:0 6px">Instagram</a> · 1470 <a href="{unsubscribe_url}" style="color:#C8962E;margin:0 6px">Se désabonner</a> 1471 </p> 1472</div>`};function Sb(t,e){return t.replace(/\{(\w+)\}/g,(n,r)=>{const s=e[r];return s==null?`{${r}}`:String(s)})}const JDt="https://www.espritsud.es/__l5e/assets-v1/7b9bcb99-0664-4b52-b138-182377fa46a2/logo-white.png",Wc={navy:"#1B4F72",gold:"#C8962E",bg:"#F4F1EC",card:"#FFFFFF",text:"#22303C",muted:"#7A8794",border:"#E8E3DA"};function dB(t,e,n={}){const r=e.primary_color||Wc.navy,s=Wc.gold,i=e.logo_url||JDt,o=n.title||"Esprit Sud Magazine",l=new Date().getFullYear();return`<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 1473<html lang="fr" xmlns="http://www.w3.org/1999/xhtml"> 1474<head> 1475 <meta charset="utf-8" /> 1476 <meta name="viewport" content="width=device-width,initial-scale=1" /> 1477 <title>${o}</title> 1478</head> 1479<body style="margin:0;padding:0;width:100%;background:${Wc.bg};-webkit-font-smoothing:antialiased;"> 1480 <table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" style="background:${Wc.bg};"> 1481 <tr><td align="center" style="padding:28px 12px;"> 1482 <table role="presentation" width="600" cellpadding="0" cellspacing="0" border="0" style="width:100%;max-width:600px;"> 1483 1484 <tr><td align="center" bgcolor="${r}" style="background:${r};padding:28px 24px;border-radius:14px 14px 0 0;"> 1485 <img src="${i}" width="190" alt="Esprit Sud Magazine" style="display:block;width:190px;max-width:70%;height:auto;border:0;margin:0 auto;" /> 1486 </td></tr> 1487 1488 <tr><td style="height:4px;line-height:4px;font-size:0;background:${s};"> </td></tr> 1489 1490 <tr><td bgcolor="${Wc.card}" style="background:${Wc.card};padding:32px 28px;font-family:'Helvetica Neue',Arial,sans-serif;color:${Wc.text};font-size:15px;line-height:1.65;"> 1491 ${n.eyebrow?`<p style="margin:0 0 8px;font-size:11px;letter-spacing:.16em;text-transform:uppercase;color:${s};font-weight:700;">${n.eyebrow}</p>`:""} 1492 <h1 style="margin:0 0 18px;font-family:Georgia,'Times New Roman',serif;font-size:24px;line-height:1.3;color:${r};font-weight:700;">${o}</h1> 1493 ${t} 1494 </td></tr> 1495 1496 <tr><td bgcolor="${Wc.card}" style="background:${Wc.card};padding:0 28px 28px;font-family:'Helvetica Neue',Arial,sans-serif;"> 1497 <table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0"> 1498 <tr><td style="border-top:1px solid ${Wc.border};padding-top:18px;font-size:12px;color:${Wc.muted};line-height:1.7;"> 1499 <p style="margin:0 0 6px;"> 1500 <a href="https://www.espritsud.es" style="color:${r};text-decoration:none;font-weight:600;">espritsud.es</a> 1501 · 1502 <a href="https://www.espritsud.es/actualites" style="color:${r};text-decoration:none;">Actualités</a> 1503 · 1504 <a href="https://www.espritsud.es/carte-privilege" style="color:${r};text-decoration:none;">Carte Privilège</a> 1505 · 1506 <a href="https://www.espritsud.es/boutique" style="color:${r};text-decoration:none;">Boutique</a> 1507 </p> 1508 <p style="margin:0 0 6px;">Une question ? Ãcrivez-nous à <a href="mailto:[email protected]" style="color:${r};">[email protected]</a></p> 1509 ${n.footerNote?`<p style="margin:0 0 6px;">${n.footerNote}</p>`:""} 1510 <p style="margin:0;color:#A6AFB8;">© ${l} Esprit Sud Magazine â Le média francophone de l'Andalousie</p> 1511 </td></tr> 1512 </table> 1513 </td></tr> 1514 1515 <tr><td style="height:4px;line-height:4px;font-size:0;background:${s};border-radius:0 0 14px 14px;"> </td></tr> 1516 </table> 1517 </td></tr> 1518 </table> 1519</body> 1520</html>`}const Ev={nom:"Marie Dupont",email:"[email protected]",numero_commande:"ES-2026-0142",numero_carte:"CP-2026-0087",date_expiration:"31/12/2027",montant:"24,90",lien:"https://www.espritsud.es/activation/abc123",lien_suivi:"https://tracking.exemple.com/xyz",transporteur:"Colissimo",delai_livraison:"3-5 jours ouvrés",unsubscribe_url:"#"},_ce={sent:{label:"Envoyé",variant:"secondary"},delivered:{label:"Délivré",variant:"secondary"},opened:{label:"Ouvert",variant:"default"},clicked:{label:"Cliqué",variant:"default"},unsubscribed:{label:"Désinscrit",variant:"outline"},bounced:{label:"Rebond",variant:"destructive"},spam:{label:"Spam",variant:"destructive"},failed:{label:"Ãchec",variant:"destructive"},skipped:{label:"Ignoré",variant:"outline"}};async function QDt(){const{data:t}=await Mt.from("site_settings").select("value").eq("key","email_templates").maybeSingle();return(t==null?void 0:t.value)??{}}async function ZDt(t){const{error:e}=await Mt.from("site_settings").upsert({key:"email_templates",value:t,updated_at:new Date().toISOString()},{onConflict:"key"});if(e)throw e}
1520function jce(t,e){const n=vw.find(s=>s.key===e),r=t[e]||{};return{key:e,active:r.active??!0,subject:r.subject??n.defaults.subject,body:r.body??n.defaults.body,sender_name:r.sender_name??n.defaults.sender_name,sender_email:r.sender_email??n.defaults.sender_email,last_sent_at:r.last_sent_at??null,send_count:r.send_count??0}}function eLt(){const{data:t={},refetch:e,isLoading:n}=Ne({queryKey:["email_templates"],queryFn:QDt}),r=b.useMemo(()=>Array.from(new Set(vw.map(_=>_.category))),[]);async function s(w,_){const j=jce(t,w),N={...t,[w]:{...j,active:_}};try{await ZDt(N),ee.success(_?"Email activé":"Email désactivé"),e()}catch(S){ee.error(S.message)}}const[i,o]=b.useState("all"),[l,c]=b.useState("all"),[u,d]=b.useState(""),{data:h=[],isFetching:f,refetch:p}=Ne({queryKey:["email_send_log"],queryFn:async()=>{const{data:w,error:_}=await Mt.from("email_send_log").select("*").order("created_at",{ascending:!1}).limit(300);return _?[]:w||[]}}),m=h.filter(w=>!(i!=="all"&&w.template_name!==i||l!=="all"&&w.status!==l||u&&!String(w.recipient_email||"").toLowerCase().includes(u.toLowerCase()))),v=w=>{var _;return((_=vw.find(j=>j.key===w))==null?void 0:_.label)||w},x=b.useMemo(()=>{const w=m.filter(P=>P.status!=="skipped"&&P.status!=="failed").length,_=m.filter(P=>P.delivered_at||P.opened_at||P.clicked_at).length,j=m.filter(P=>P.opened_at).length,N=m.filter(P=>P.clicked_at).length,S=m.filter(P=>P.bounced_at).length,C=m.filter(P=>P.spam_at).length,k=m.filter(P=>P.status==="failed").length;return{sent:w,delivered:_,opened:j,clicked:N,bounced:S,spam:C,failed:k,pct:P=>w>0?Math.round(P/w*1e3)/10:0}},[m]),g="https://aanjkhoyzcvhokzsmifu.supabase.co/functions/v1/brevo-webhook";return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"text-2xl font-bold flex items-center gap-2",children:[a.jsx(Ru,{className:"h-6 w-6"})," E-mails transactionnels"]}),a.jsx("p",{className:"text-muted-foreground text-sm mt-1",children:"Gérez tous les e-mails envoyés automatiquement par le site."})]}),a.jsxs(Qi,{defaultValue:"templates",children:[a.jsxs(wi,{children:[a.jsx(wt,{value:"templates",children:"Modèles d'e-mails"}),a.jsx(wt,{value:"global",children:"Template global"}),a.jsx(wt,{value:"history",children:"Historique"})]}),a.jsx(kt,{value:"templates",className:"space-y-8 mt-6",children:n?a.jsx("p",{className:"text-muted-foreground",children:"Chargementâ¦"}):r.map(w=>a.jsxs("section",{children:[a.jsx("h2",{className:"text-lg font-semibold mb-3",children:w}),a.jsx("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-3",children:vw.filter(_=>_.category===w).map(_=>{const j=jce(t,_.key);return a.jsxs(Ke,{className:j.active?"":"opacity-70",children:[a.jsx(Vt,{className:"pb-3",children:a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx(Ht,{className:"text-base",children:_.label}),a.jsx(mi,{className:"text-xs mt-1",children:_.description})]}),a.jsx(_n,{checked:j.active,onCheckedChange:N=>s(_.key,N)})]})}),a.jsxs(ut,{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Objet actuel"}),a.jsx("p",{className:"text-sm line-clamp-2",children:j.subject})]}),a.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[a.jsxs("span",{children:[j.send_count||0," envoi",(j.send_count||0)>1?"s":""]}),a.jsx(ke,{variant:j.active?"default":"secondary",children:j.active?"Actif":"Inactif"})]}),a.jsx(H,{asChild:!0,size:"sm",variant:"outline",className:"w-full",children:a.jsxs(_e,{to:`/admin/emails/${_.key}`,children:[a.jsx(Oc,{className:"h-3.5 w-3.5 mr-1.5"})," Modifier"]})})]})]},_.key)})})]},w))}),a.jsx(kt,{value:"global",className:"mt-6",children:a.jsxs(Ke,{children:[a.jsxs(Vt,{children:[a.jsxs(Ht,{className:"flex items-center gap-2",children:[a.jsx(RO,{className:"h-5 w-5"})," Template global"]}),a.jsx(mi,{children:"Header et footer partagés par tous les e-mails. Modifiez le HTML pour changer le branding."})]}),a.jsx(ut,{children:a.jsx(H,{asChild:!0,children:a.jsx(_e,{to:"/admin/emails/__global__",children:"Modifier le template global"})})})]})}),a.jsxs(kt,{value:"history",className:"mt-6 space-y-4",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[a.jsxs(lt,{value:i,onValueChange:o,children:[a.jsx(nt,{className:"w-full sm:w-64",children:a.jsx(ct,{})}),a.jsxs(rt,{children:[a.jsx(Ae,{value:"all",children:"Tous les types"}),vw.map(w=>a.jsx(Ae,{value:w.key,children:w.label},w.key))]})]}),a.jsxs(lt,{value:l,onValueChange:c,children:[a.jsx(nt,{className:"w-full sm:w-44",children:a.jsx(ct,{})}),a.jsxs(rt,{children:[a.jsx(Ae,{value:"all",children:"Tous les statuts"}),a.jsx(Ae,{value:"sent",children:"Envoyé"}),a.jsx(Ae,{value:"delivered",children:"Délivré"}),a.jsx(Ae,{value:"opened",children:"Ouvert"}),a.jsx(Ae,{value:"clicked",children:"Cliqué"}),a.jsx(Ae,{value:"bounced",children:"Rebond"}),a.jsx(Ae,{value:"spam",children:"Spam"}),a.jsx(Ae,{value:"failed",children:"Ãchec"}),a.jsx(Ae,{value:"skipped",children:"Ignoré"})]})]}),a.jsx(ue,{placeholder:"Rechercher un destinataireâ¦",value:u,onChange:w=>d(w.target.value),className:"w-full sm:w-64"}),a.jsx(H,{variant:"outline",size:"sm",onClick:()=>p(),disabled:f,children:f?"Actualisationâ¦":"Actualiser"}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[m.length," envoi(s)"]})]}),a.jsx("div",{className:"grid grid-cols-2 gap-3 md:grid-cols-3 lg:grid-cols-6",children:[{label:"Envoyés",value:x.sent,sub:`${x.failed} échec(s)`},{label:"Délivrés",value:x.delivered,sub:`${x.pct(x.delivered)} %`},{label:"Ouverts",value:x.opened,sub:`${x.pct(x.opened)} %`},{label:"Cliqués",value:x.clicked,sub:`${x.pct(x.clicked)} %`},{label:"Rebonds",value:x.bounced,sub:`${x.pct(x.bounced)} %`},{label:"Spam",value:x.spam,sub:`${x.pct(x.spam)} %`}].map(w=>a.jsx(Ke,{children:a.jsxs(ut,{className:"py-4",children:[a.jsx("p",{className:"text-xs text-muted-foreground",children:w.label}),a.jsx("p",{className:"text-2xl font-semibold",children:w.value}),a.jsx("p",{className:"text-xs text-muted-foreground",children:w.sub})]})},w.label))}),a.jsx(Ke,{children:a.jsxs(ut,{className:"py-4 space-y-2",children:[a.jsx("p",{className:"text-sm font-medium",children:"Suivi des événements Brevo"}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Pour alimenter ces indicateurs, ajoutez cette URL dans Brevo â Transactionnel â Paramètres â Webhooks, en cochant les événements ",a.jsx("em",{children:"Delivered, Opened, Clicked, Hard/Soft bounce, Spam, Blocked"}),"."]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx("code",{className:"rounded bg-muted px-2 py-1 text-xs break-all",children:g}),a.jsx(H,{size:"sm",variant:"outline",onClick:()=>{navigator.clipboard.writeText(g),ee.success("URL du webhook copiée")},children:"Copier"})]})]})}),m.length===0?a.jsx(Ke,{children:a.jsx(ut,{className:"py-10 text-center text-muted-foreground text-sm",children:"Aucun envoi enregistré pour ces critères. Le journal se remplit automatiquement à chaque e-mail transactionnel déclenché par le site."})}):a.jsx(Ke,{className:"overflow-x-auto",children:a.jsxs($0,{children:[a.jsx(z0,{children:a.jsxs(qi,{children:[a.jsx(Cn,{children:"Date"}),a.jsx(Cn,{children:"Type d'événement"}),a.jsx(Cn,{children:"Destinataire"}),a.jsx(Cn,{children:"Objet"}),a.jsx(Cn,{children:"Statut"}),a.jsx(Cn,{children:"Engagement"}),a.jsx(Cn,{children:"Erreur"})]})}),a.jsx(B0,{children:m.map(w=>{var _,j;return a.jsxs(qi,{children:[a.jsx(hn,{className:"text-xs whitespace-nowrap",children:new Date(w.created_at).toLocaleStr
1520ing("fr-FR")}),a.jsx(hn,{className:"text-xs",children:v(w.template_name)}),a.jsx(hn,{className:"text-xs",children:w.recipient_email}),a.jsx(hn,{className:"text-xs max-w-[240px] truncate",title:w.subject||"",children:w.subject||"â"}),a.jsx(hn,{children:a.jsx(ke,{variant:((_=_ce[w.status])==null?void 0:_.variant)??"secondary",children:((j=_ce[w.status])==null?void 0:j.label)??w.status})}),a.jsxs(hn,{className:"text-xs whitespace-nowrap space-x-1",children:[w.opened_at&&a.jsxs(ke,{variant:"secondary",title:`Ouvert le ${new Date(w.opened_at).toLocaleString("fr-FR")}`,children:["Ouvert",w.open_count>1?` Ã${w.open_count}`:""]}),w.clicked_at&&a.jsxs(ke,{variant:"default",title:w.last_click_url||"Clic",children:["Clic",w.click_count>1?` Ã${w.click_count}`:""]}),w.bounced_at&&a.jsx(ke,{variant:"destructive",children:"Rebond"}),w.spam_at&&a.jsx(ke,{variant:"destructive",children:"Spam"}),!w.opened_at&&!w.clicked_at&&!w.bounced_at&&!w.spam_at&&a.jsx("span",{className:"text-muted-foreground",children:w.delivered_at?"Délivré":"â"})]}),a.jsx(hn,{className:"text-xs text-destructive max-w-[280px] truncate",title:w.error_message||"",children:w.error_message||"â"})]},w.id)})})]})})]})]})]})}async function tLt(){var s,i;const{data:t}=await Mt.from("site_settings").select("key,value").in("key",["email_templates","email_template_global"]),e=t||[],n=((s=e.find(o=>o.key==="email_templates"))==null?void 0:s.value)||{},r=((i=e.find(o=>o.key==="email_template_global"))==null?void 0:i.value)||kPe;return{templates:n,global:r}}async function Sce(t,e){const{error:n}=await Mt.from("site_settings").upsert({key:t,value:e,updated_at:new Date().toISOString()},{onConflict:"key"});if(n)throw n}function nLt(){const{key:t=""}=Xi();Gs();const{user:e}=Ji(),n=t==="__global__",{data:r,isLoading:s,refetch:i}=Ne({queryKey:["email_editor_data"],queryFn:tLt}),o=b.useMemo(()=>vw.find(S=>S.key===t),[t]),[l,c]=b.useState(null),[u,d]=b.useState(kPe),[h,f]=b.useState(!1),p=b.useRef(null);b.useEffect(()=>{if(r&&(d(r.global),!n&&o)){const S=r.templates[t]||{};c({key:t,active:S.active??!0,subject:S.subject??o.defaults.subject,body:S.body??o.defaults.body,sender_name:S.sender_name??o.defaults.sender_name,sender_email:S.sender_email??o.defaults.sender_email,last_sent_at:S.last_sent_at??null,send_count:S.send_count??0})}},[r,t,n,o]);function m(S){const C=p.current;if(!C||!l)return;const k=C.selectionStart??l.body.length,E=C.selectionEnd??l.body.length,P=l.body.slice(0,k)+S+l.body.slice(E);c({...l,body:P}),setTimeout(()=>{C.focus(),C.selectionStart=C.selectionEnd=k+S.length},0)}function v(S,C){const k=p.current;if(!k||!l)return;const E=k.selectionStart??0,P=k.selectionEnd??0,T=l.body.slice(E,P),M=l.body.slice(0,E)+S+T+C+l.body.slice(P);c({...l,body:M}),setTimeout(()=>k.focus(),0)}function x(){const S=window.prompt("URL du lien :","https://");S&&v(`<a href="${S}">`,"</a>")}async function g(){try{if(n)await Sce("email_template_global",u),ee.success("Template global enregistré");else if(l){const C={...(r==null?void 0:r.templates)||{},[l.key]:l};await Sce("email_templates",C),ee.success("E-mail enregistré")}i()}catch(S){ee.error(S.message)}}async function w(){if(!(!l||!(e!=null&&e.email)))try{const S=dB(Sb(l.body,Ev),u),C="[TEST] "+Sb(l.subject,Ev),{error:k}=await Mt.functions.invoke("send-app-email",{body:{template_key:l.key,to_email:e.email,to_name:"Test admin",vars:Ev,html:S,subject:C}});if(k)throw k;ee.success(`E-mail de test envoyé à ${e.email}`)}catch(S){ee.error("Envoi impossible : "+S.message)}}if(s)return a.jsx("p",{className:"text-muted-foreground",children:"Chargementâ¦"});if(n)return a.jsxs("div",{className:"space-y-6 max-w-4xl",children:[a.jsx(H,{variant:"ghost",size:"sm",asChild:!0,children:a.jsxs(_e,{to:"/admin/emails",children:[a.jsx(jr,{className:"h-4 w-4 mr-1.5"})," Retour"]})}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-bold",children:"Template global"}),a.jsx("p",{className:"text-muted-foreground text-sm",children:"Header et footer partagés par tous les e-mails."})]}),a.jsxs(Ke,{children:[a.jsx(Vt,{children:a.jsx(Ht,{children:"Couleur principale"})}),a.jsx(ut,{children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("input",{type:"color",value:u.primary_color,onChange:S=>d({...u,primary_color:S.target.value}),className:"h-10 w-16 rounded border"}),a.jsx(ue,{value:u.primary_color,onChange:S=>d({...u,primary_color:S.target.value}),className:"w-40"})]})})]}),a.jsxs(Ke,{children:[a.jsxs(Vt,{children:[a.jsx(Ht,{children:"URL du logo (optionnel)"}),a.jsx(mi,{children:"Utilisable dans votre HTML de header."})]}),a.jsx(ut,{children:a.jsx(ue,{value:u.logo_url||"",onChange:S=>d({...u,logo_url:S.target.value}),placeholder:"https://â¦/logo.png"})})]}),a.jsx(Ke,{children:a.jsxs(Vt,{children:[a.jsx(Ht,{children:"En-tête"}),a.jsx(mi,{children:"L'en-tête (logo blanc Esprit Sud sur fond bleu nuit + filet doré) est désormais commun à tous les e-mails transactionnels et généré automatiquement. Seuls la couleur principale et le logo ci-dessus sont personnalisables."})]})}),a.jsxs(Ke,{children:[a.jsxs(Vt,{children:[a.jsx(Ht,{children:"Mention complémentaire (pied de page)"}),a.jsxs(mi,{children:["Le pied de page standard (liens du site, contact, copyright) est automatique. Ce texte HTML y est ajouté. Utilisez ",a.jsx("code",{children:"{unsubscribe_url}"})," pour insérer le lien de désabonnement."]})]}),a.jsx(ut,{children:a.jsx(fn,{value:u.footer_html,onChange:S=>d({...u,footer_html:S.target.value}),rows:4,className:"font-mono text-xs"})})]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsxs(H,{onClick:g,children:[a.jsx(Ra,{className:"h-4 w-4 mr-1.5"})," Enregistrer"]}),a.jsxs(an,{children:[a.jsx(W_,{asChild:!0,children:a.jsxs(H,{variant:"outline",children:[a.jsx(Mu,{className:"h-4 w-4 mr-1.5"})," Prévisualiser"]})}),a.jsxs(nn,{className:"max-w-3xl",children:[a.jsx(on,{children:a.jsx(ln,{children:"Prévisualisation"})}),a.jsx("iframe",{title:"preview",className:"w-full h-[600px] border rounded",srcDoc:dB("<p>Contenu de l'e-mailâ¦</p>",u,{title:"Titre de l'e-mail",eyebrow:"",footerNote:Sb(u.footer_html,Ev)})})]})]})]})]});if(!o||!l)return a.jsx("p",{className:"text-muted-foreground",children:"E-mail introuvable."});const _=Array.from(new Set([...o.variables,...XDt])),j=dB(Sb(l.body,Ev),u,{title:o.label,eyebrow:o.category,footerNote:Sb(u.footer_html,Ev)}),N=Sb(l.subject,Ev);return a.jsxs("div",{className:"space-y-6 max-w-4xl",children:[a.jsx(H,{variant:"ghost",size:"sm",asChild:!0,children:a.jsxs(_e,{to:"/admin/emails",children:[a.jsx(jr,{className:"h-4 w-4 mr-1.5"})," Retour"]}
1520)}),a.jsxs("div",{className:"flex items-start justify-between gap-4 flex-wrap",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-xs uppercase tracking-wider text-muted-foreground",children:o.category}),a.jsx("h1",{className:"text-2xl font-bold",children:o.label}),a.jsx("p",{className:"text-muted-foreground text-sm mt-1",children:o.description})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(te,{htmlFor:"active",className:"text-sm",children:"Actif"}),a.jsx(_n,{id:"active",checked:l.active,onCheckedChange:S=>c({...l,active:S})})]})]}),a.jsxs(Ke,{children:[a.jsx(Vt,{children:a.jsx(Ht,{className:"text-base",children:"Paramètres"})}),a.jsxs(ut,{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(te,{children:"Objet"}),a.jsx(ue,{value:l.subject,onChange:S=>c({...l,subject:S.target.value})})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(te,{children:"Nom de l'expéditeur"}),a.jsx(ue,{value:l.sender_name||"",onChange:S=>c({...l,sender_name:S.target.value})})]}),a.jsxs("div",{children:[a.jsx(te,{children:"E-mail de l'expéditeur"}),a.jsx(ue,{value:l.sender_email||"",onChange:S=>c({...l,sender_email:S.target.value})})]})]})]})]}),a.jsxs(Ke,{children:[a.jsxs(Vt,{children:[a.jsx(Ht,{className:"text-base",children:"Contenu"}),a.jsx(mi,{children:"HTML simple. Utilisez les variables ci-dessous pour la personnalisation."})]}),a.jsxs(ut,{className:"space-y-3",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2 border rounded-md p-2 bg-muted/50",children:[a.jsx(H,{type:"button",variant:"ghost",size:"sm",onClick:()=>v("<strong>","</strong>"),children:a.jsx(Pfe,{className:"h-4 w-4"})}),a.jsx(H,{type:"button",variant:"ghost",size:"sm",onClick:()=>v("<em>","</em>"),children:a.jsx(Dfe,{className:"h-4 w-4"})}),a.jsx(H,{type:"button",variant:"ghost",size:"sm",onClick:x,children:a.jsx(TW,{className:"h-4 w-4"})}),a.jsxs(uge,{children:[a.jsx(dge,{asChild:!0,children:a.jsxs(H,{type:"button",variant:"outline",size:"sm",children:[a.jsx(A5e,{className:"h-4 w-4 mr-1.5"})," Insérer une variable"]})}),a.jsx(s9,{align:"start",children:_.map(S=>a.jsx(Vv,{onClick:()=>m(`{${S}}`),children:`{${S}}`},S))})]})]}),a.jsx(fn,{ref:p,value:l.body,onChange:S=>c({...l,body:S.target.value}),rows:14,className:"font-mono text-sm"}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Variables disponibles : ",_.map(S=>`{${S}}`).join(", ")]})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-3",children:[a.jsxs(H,{onClick:g,children:[a.jsx(Ra,{className:"h-4 w-4 mr-1.5"})," Enregistrer"]}),a.jsxs(an,{open:h,onOpenChange:f,children:[a.jsx(W_,{asChild:!0,children:a.jsxs(H,{variant:"outline",children:[a.jsx(Mu,{className:"h-4 w-4 mr-1.5"})," Prévisualiser"]})}),a.jsxs(nn,{className:"max-w-3xl",children:[a.jsx(on,{children:a.jsxs(ln,{children:["Prévisualisation â ",N]})}),a.jsx("iframe",{title:"preview",className:"w-full h-[600px] border rounded",srcDoc:j})]})]}),a.jsxs(H,{variant:"outline",onClick:w,disabled:!(e!=null&&e.email),children:[a.jsx(Jf,{className:"h-4 w-4 mr-1.5"})," Envoyer un test ",e!=null&&e.email?`(${e.email})`:""]})]})]})}const rLt=[{value:"all",label:"Tous les statuts"},{value:"draft",label:"Brouillon"},{value:"pending",label:"En attente"},{value:"published",label:"Publiée"},{value:"rejected",label:"Refusée"}];function sLt(){const t=St(),[e,n]=b.useState(""),[r,s]=b.useState("all"),{data:i=[],isLoading:o}=Ne({queryKey:["admin-directory",r],queryFn:async()=>{let x=Z.from("partner_profiles").select("id, organization_name, slug, city, address, postal_code, lat, lng, status, is_verified, esprit_sud_partner, contact_email, created_at").order("created_at",{ascending:!1}).limit(500);r!=="all"&&(x=x.eq("status",r));const{data:g,error:w}=await x;if(w)throw w;return g??[]}}),l=async(x,g)=>{const{error:w}=await Z.from("partner_profiles").update(g).eq("id",x);if(w)return ee.error(w.message);ee.success("Fiche mise à jour."),t.invalidateQueries({queryKey:["admin-directory"]})},[c,u]=b.useState(null),[d,h]=b.useState({running:!1,done:0,total:0}),f=async x=>{const{data:g,error:w}=await Z.functions.invoke("geocode-business",{body:{partner_id:x.id,address:x.address,city:x.city,postal_code:x.postal_code,country:"España"}});if(w)throw new Error(w.message);return g},p=async x=>{u(x.id);try{const g=await f(x);g!=null&&g.success?(ee.success("Fiche géolocalisée."),t.invalidateQueries({queryKey:["admin-directory"]})):ee.error((g==null?void 0:g.error)??"Adresse non trouvée.")}catch(g){ee.error(g.message)}finally{u(null)}},m=async()=>{const x=i.filter(w=>(w.lat==null||w.lng==null)&&(w.address||w.city));if(!x.length)return ee.info("Toutes les fiches sont déjà géolocalisées.");h({running:!0,done:0,total:x.length});let g=0;for(let w=0;w<x.length;w+=10){const _=x.slice(w,w+10);for(const j of _){try{const N=await f(j);N!=null&&N.success&&g++}catch{}h(N=>({...N,done:N.done+1})),await new Promise(N=>setTimeout(N,1e3))}}h({running:!1,done:0,total:0}),ee.success(`${g}/${x.length} fiches géolocalisées.`),t.invalidateQueries({queryKey:["admin-directory"]})},v=i.filter(x=>!e||`${x.organization_name} ${x.city??""} ${x.contact_email??""}`.toLowerCase().includes(e.toLowerCase()));return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"font-serif text-2xl font-bold",children:"Carnet d'adresses des Pros"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Validez, vérifiez et publiez les fiches professionnelles."})]}),a.jsx(Ke,{children:a.jsxs(ut,{className:"flex flex-wrap gap-3 p-4",children:[a.jsxs("div",{className:"relative min-w-[240px] flex-1",children:[a.jsx(is,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(ue,{className:"pl-9",placeholder:"Rechercher une fiche...",value:e,onCh
1520ange:x=>n(x.target.value)})]}),a.jsxs(lt,{value:r,onValueChange:s,children:[a.jsx(nt,{className:"w-[200px]",children:a.jsx(ct,{})}),a.jsx(rt,{children:rLt.map(x=>a.jsx(Ae,{value:x.value,children:x.label},x.value))})]}),a.jsxs(H,{variant:"outline",onClick:m,disabled:d.running,children:[a.jsx(_r,{className:"mr-2 h-4 w-4"}),d.running?`${d.done}/${d.total} fiches géolocalisées...`:"Tout géolocaliser"]})]})}),a.jsx(Ke,{children:a.jsx(ut,{className:"p-0",children:a.jsxs($0,{children:[a.jsx(z0,{children:a.jsxs(qi,{children:[a.jsx(Cn,{children:"Entreprise"}),a.jsx(Cn,{children:"Ville"}),a.jsx(Cn,{children:"Statut"}),a.jsx(Cn,{className:"text-right",children:"Actions"})]})}),a.jsxs(B0,{children:[o&&a.jsx(qi,{children:a.jsx(hn,{colSpan:4,children:"Chargement..."})}),!o&&v.length===0&&a.jsx(qi,{children:a.jsx(hn,{colSpan:4,className:"text-muted-foreground",children:"Aucune fiche."})}),v.map(x=>a.jsxs(qi,{children:[a.jsxs(hn,{children:[a.jsxs("div",{className:"flex items-center gap-2 font-medium",children:[x.organization_name,x.is_verified&&a.jsx(EW,{className:"h-4 w-4 text-primary"})]}),a.jsx("div",{className:"text-xs text-muted-foreground",children:x.contact_email})]}),a.jsx(hn,{children:x.city??"â"}),a.jsxs(hn,{children:[a.jsx(ke,{variant:x.status==="published"?"default":"secondary",children:x.status}),x.esprit_sud_partner&&a.jsx(ke,{variant:"outline",className:"ml-2",children:"Partenaire"})]}),a.jsxs(hn,{className:"space-x-2 text-right",children:[a.jsxs(H,{size:"sm",variant:"ghost",disabled:c===x.id,onClick:()=>p(x),children:["ð ",c===x.id?"...":x.lat!=null&&x.lng!=null?"Re-géolocaliser":"Géolocaliser"]}),x.status!=="published"&&a.jsx(H,{size:"sm",onClick:()=>l(x.id,{status:"published"}),children:"Publier"}),x.status==="published"&&a.jsx(H,{size:"sm",variant:"outline",onClick:()=>l(x.id,{status:"pending"}),children:"Dépublier"}),a.jsx(H,{size:"sm",variant:"ghost",onClick:()=>l(x.id,{is_verified:!x.is_verified}),children:x.is_verified?"Retirer vérifié":"Marquer vérifié"})]})]},x.id))]})]})})})]})}function iLt({request:t,open:e,onOpenChange:n,onDone:r}){var v,x,g;const[s,i]=b.useState(""),[o,l]=b.useState(null),{data:c=[],isLoading:u}=Ne({queryKey:["match-pros"],enabled:e,queryFn:async()=>{const{data:w,error:_}=await Z.from("partner_profiles").select("id, organization_name, city, photos, logo_url, business_category_id, category_id, status, contact_email").eq("status","published").order("organization_name").limit(1e3);if(_)throw _;return w??[]}}),d=(t==null?void 0:t.category_id)??null,h=((v=t==null?void 0:t.city)==null?void 0:v.name)??"",{list:f,exact:p}=b.useMemo(()=>{const w=c.filter(C=>{const k=d&&(C.business_category_id===d||C.category_id===d),E=h&&String(C.city??"").toLowerCase().includes(h.toLowerCase());return k&&(E||!h)}),_=c.filter(C=>d&&(C.business_category_id===d||C.category_id===d)),j=w.length?w:_.length?_:c,N=s.trim().toLowerCase();return{list:N?j.filter(C=>`${C.organization_name} ${C.city??""}`.toLowerCase().includes(N)):j,exact:w.length>0}},[c,d,h,s]),m=async w=>{if(t&&window.confirm(`Envoyer la mise en relation à ${w.organization_name} ?`)){l(w.id);try{const{data:_,error:j}=await Z.functions.invoke("send-recommendation-match",{body:{recommendation_id:t.id,partner_id:w.id}});if(j)throw new Error(j.message);if(_!=null&&_.error)throw new Error(_.error);ee.success(`Mise en relation envoyée à ${w.organization_name}.`),n(!1),r()}catch(_){ee.error(_.message)}finally{l(null)}}};return a.jsx(an,{open:e,onOpenChange:n,children:a.jsxs(nn,{className:"max-w-2xl",children:[a.jsxs(on,{children:[a.jsxs(ln,{children:["Mettre en relation â ",t==null?void 0:t.first_name]}),a.jsxs(Eu,{children:["Recherche : ",[(x=t==null?void 0:t.category)==null?void 0:x.name,(g=t==null?void 0:t.city)==null?void 0:g.name].filter(Boolean).join(" à ")||"non précisée"]})]}),!p&&!u&&a.jsx("p",{className:"rounded-md bg-muted px-3 py-2 text-sm text-muted-foreground",children:"Aucun pro exact trouvé â voici les autres fiches publiées."}),a.jsx(ue,{placeholder:"Rechercher un professionnel...",value:s,onChange:w=>i(w.target.value)}),a.jsxs("div",{className:"max-h-[50vh] space-y-2 overflow-y-auto pr-1",children:[u&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"Chargement..."}),!u&&f.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"Aucun résultat."}),f.map(w=>{const _=w.logo_url||(Array.isArray(w.photos)?w.photos[0]:null);return a.jsxs("div",{className:"flex items-center gap-3 rounded-lg border p-3",children:[_?a.jsx("img",{src:_,alt:w.organization_name,className:"h-12 w-12 rounded-md object-cover",loading:"lazy"}):a.jsx("div",{className:"h-12 w-12 rounded-md bg-muted"}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("div",{className:"truncate font-medium",children:w.organization_name}),a.jsx("div",{className:"truncate text-xs text-muted-foreground",children:w.
1520city??"â"})]}),d&&(w.business_category_id===d||w.category_id===d)&&a.jsx(ke,{variant:"secondary",children:"Correspond"}),a.jsx(H,{size:"sm",disabled:o===w.id,onClick:()=>m(w),children:o===w.id?"Envoi...":"Envoyer la mise en relation"})]},w.id)})]})]})})}const Nce={new:{label:"ð Nouvelle",className:"bg-amber-100 text-amber-800 hover:bg-amber-100"},in_progress:{label:"En cours",className:"bg-blue-100 text-blue-800 hover:bg-blue-100"},matched:{label:"â
Mis en relation",className:"bg-emerald-100 text-emerald-800 hover:bg-emerald-100"},answered:{label:"â
Traitée",className:"bg-emerald-100 text-emerald-800 hover:bg-emerald-100"},closed:{label:"â« Clôturé",className:"bg-muted text-muted-foreground hover:bg-muted"}};function aLt(){const t=St(),{data:e=[],isLoading:n}=Ne({queryKey:["admin-recommendations"],queryFn:async()=>{const{data:o,error:l}=await Z.from("recommendation_requests").select("*, category:business_categories(name), city:cities(name), matched:partner_profiles!recommendation_requests_matched_profile_id_fkey(organization_name)").order("created_at",{ascending:!1}).limit(300);if(l)throw l;return o??[]}}),[r,s]=b.useState(null),i=async(o,l)=>{const{error:c}=await Z.from("recommendation_requests").update({status:l}).eq("id",o);if(c)return ee.error(c.message);ee.success("Statut mis à jour."),t.invalidateQueries({queryKey:["admin-recommendations"]})};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"font-serif text-2xl font-bold",children:"Demandes de recommandation"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Mises en relation demandées depuis le Carnet d'adresses des Pros."})]}),a.jsx(Ke,{children:a.jsx(ut,{className:"p-0",children:a.jsxs($0,{children:[a.jsx(z0,{children:a.jsxs(qi,{children:[a.jsx(Cn,{children:"Demandeur"}),a.jsx(Cn,{children:"Besoin"}),a.jsx(Cn,{children:"Statut"}),a.jsx(Cn,{className:"text-right",children:"Actions"})]})}),a.jsxs(B0,{children:[n&&a.jsx(qi,{children:a.jsx(hn,{colSpan:4,children:"Chargement..."})}),!n&&e.length===0&&a.jsx(qi,{children:a.jsx(hn,{colSpan:4,className:"text-muted-foreground",children:"Aucune demande."})}),e.map(o=>{var l,c,u,d,h;return a.jsxs(qi,{children:[a.jsxs(hn,{children:[a.jsx("div",{className:"font-medium",children:o.first_name}),a.jsxs("div",{className:"text-xs text-muted-foreground",children:[o.email,o.phone?` · ${o.phone}`:""]}),a.jsx("div",{className:"text-xs text-muted-foreground",children:new Date(o.created_at).toLocaleString("fr-FR")})]}),a.jsxs(hn,{className:"max-w-md",children:[a.jsx("div",{className:"text-sm",children:o.description}),a.jsxs("div",{className:"mt-1 text-xs text-muted-foreground",children:[[(l=o.city)==null?void 0:l.name,(c=o.category)==null?void 0:c.name].filter(Boolean).join(" · "),o.budget?` · Budget : ${o.budget}`:"",o.urgency&&o.urgency!=="normal"?` · ${o.urgency}`:""]})]}),a.jsxs(hn,{children:[a.jsx(ke,{variant:"secondary",className:(u=Nce[o.status])==null?void 0:u.className,children:((d=Nce[o.status])==null?void 0:d.label)??o.status}),o.matched_at&&a.jsxs("div",{className:"mt-1 text-xs text-muted-foreground",children:["Transmis à ",((h=o.matched)==null?void 0:h.organization_name)??"un pro"," le"," ",new Date(o.matched_at).toLocaleDateString("fr-FR")]})]}),a.jsxs(hn,{className:"space-x-2 text-right",children:[a.jsx(H,{size:"sm",onClick:()=>s(o),children:o.status==="matched"?"Renvoyer":"ð¤ Mettre en relation"}),a.jsx(H,{size:"sm",variant:"outline",onClick:()=>i(o.id,"in_progress"),children:"En cours"}),a.jsx(H,{size:"sm",variant:"outline",onClick:()=>i(o.id,"closed"),children:"Clôturer"})]})]},o.id)})]})]})})}),a.jsx(iLt,{request:r,open:!!r,onOpenChange:o=>!o&&s(null),onDone:()=>t.invalidateQueries({queryKey:["admin-recommendations"]})})]})}const pM=[{value:"nouveau",label:"ð Nouveau",className:"bg-orange-100 text-orange-700 hover:bg-orange-100"},{value:"en cours",label:"ðµ En cours",className:"bg-blue-100 text-blue-700 hover:bg-blue-100"},{value:"retenu",label:"â
Retenu",className:"bg-green-100 text-green-700 hover:bg-green-100"},{value:"refusé",label:"⫠Refusé",className:"bg-gray-200 text-gray-700 hover:bg-gray-200"}];function oLt(){const{toast:t}=QE(),e=St(),[n,r]=b.useState("all"),[s,i]=b.useState("all"),{data:o=[],isLoading:l}=Ne({queryKey:["admin-applications"],queryFn:async()=>{const{data:h,error:f}=await Z.from("applications").select("*").order("created_at",{ascending:!1});if(f)throw f;return h??[]}}),c=Qe({mutationFn:async({id:h,status:f})=>{const{error:p}=await Z.from("applications").update({status:f}).eq("id",h);if(p)throw p},onSuccess:()=>
1520{e.invalidateQueries({queryKey:["admin-applications"]}),t({title:"Statut mis à jour"})},onError:h=>t({title:"Erreur",description:h.message,variant:"destructive"})}),u=b.useMemo(()=>o.filter(h=>(n==="all"||h.position===n)&&(s==="all"||h.status===s)),[o,n,s]),d=async h=>{if(h.cv_path){const{data:f,error:p}=await Z.storage.from("applications").createSignedUrl(h.cv_path,600);if(f!=null&&f.signedUrl)return window.open(f.signedUrl,"_blank","noopener");p&&console.error(p)}if(h.cv_url)return window.open(h.cv_url,"_blank","noopener");t({title:"Aucun CV",description:"Ce candidat n'a pas joint de CV.",variant:"destructive"})};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"font-heading text-2xl font-bold",children:"Candidatures"}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:[u.length," candidature(s)"]})]}),a.jsxs("div",{className:"flex flex-wrap gap-3",children:[a.jsxs(lt,{value:n,onValueChange:r,children:[a.jsx(nt,{className:"w-[260px]",children:a.jsx(ct,{placeholder:"Poste"})}),a.jsxs(rt,{children:[a.jsx(Ae,{value:"all",children:"Tous les postes"}),tI.map(h=>a.jsx(Ae,{value:h.title,children:h.title},h.id))]})]}),a.jsxs(lt,{value:s,onValueChange:i,children:[a.jsx(nt,{className:"w-[200px]",children:a.jsx(ct,{placeholder:"Statut"})}),a.jsxs(rt,{children:[a.jsx(Ae,{value:"all",children:"Tous les statuts"}),pM.map(h=>a.jsx(Ae,{value:h.value,children:h.label},h.value))]})]})]}),l?a.jsx("div",{className:"space-y-2",children:[...Array(4)].map((h,f)=>a.jsx(Xt,{className:"h-16 w-full"},f))}):u.length===0?a.jsx("p",{className:"rounded-xl border border-dashed p-10 text-center text-muted-foreground",children:"Aucune candidature."}):a.jsx("div",{className:"overflow-x-auto rounded-xl border bg-card",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"bg-muted/50 text-left text-xs uppercase text-muted-foreground",children:a.jsxs("tr",{children:[a.jsx("th",{className:"p-3",children:"Date"}),a.jsx("th",{className:"p-3",children:"Candidat"}),a.jsx("th",{className:"p-3",children:"Email"}),a.jsx("th",{className:"p-3",children:"Poste"}),a.jsx("th",{className:"p-3",children:"Langues"}),a.jsx("th",{className:"p-3",children:"Statut"}),a.jsx("th",{className:"p-3",children:"CV"})]})}),a.jsx("tbody",{children:u.map(h=>{const f=pM.find(p=>p.value===h.status)??pM[0];return a.jsxs("tr",{className:"border-t align-top",children:[a.jsx("td",{className:"whitespace-nowrap p-3 text-muted-foreground",children:new Date(h.created_at).toLocaleDateString("fr-FR")}),a.jsxs("td",{className:"p-3",children:[a.jsxs("div",{className:"font-medium",children:[h.first_name," ",h.last_name]}),h.phone&&a.jsx("div",{className:"text-xs text-muted-foreground",children:h.phone}),h.portfolio_url&&a.jsx("a",{href:h.portfolio_url,target:"_blank",rel:"noopener",className:"text-xs text-[#C8962E] underline",children:"Profil / site"})]}),a.jsx("td",{className:"p-3",children:a.jsx("a",{href:`mailto:${h.email}`,className:"text-[#C8962E] underline",children:h.email})}),a.jsx("td",{className:"p-3",children:h.position}),a.jsx("td",{className:"p-3 text-muted-foreground",children:(h.languages??[]).join(", ")||"â"}),a.jsx("td",{className:"p-3",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx(ke,{className:f.className,children:f.label}),a.jsxs(lt,{value:h.status,onValueChange:p=>c.mutate({id:h.id,status:p}),children:[a.jsx(nt,{className:"h-8 w-[150px] text-xs",children:a.jsx(ct,{})}),a.jsx(rt,{children:pM.map(p=>a.jsx(Ae,{value:p.value,children:p.label},p.value))})]})]})}),a.jsx("td",{className:"p-3",children:h.cv_path||h.cv_url?a.jsxs(H,{size:"sm",variant:"outline",onClick:()=>d(h),children:[a.jsx(dp,{className:"mr-1.5 h-3.5 w-3.5"})," Voir le CV"]}):a.jsx("span",{className:"text-muted-foreground",children:"â"})})]},h.id)})})]})})]})}const APe=[{path:"/",label:"Accueil"},{path:"/actualites",label:"Actualités"},{path:"/boutique",label:"Boutique"},{path:"/annuaire",label:"Annuaire des pros"},{path:"/carnet-adresses",label:"Carnet d'adresses"},{path:"/carte-privilege",label:"Carte Privilège"},{path:"/destinations",label:"Destinations"},{path:"/evenements",label:"Ãvénements"},{path:"/nos-magazines",label:"Nos magazines"},{path:"/points-de-depot",label:"Points de dépôt"},{path:"/recrutement",label:"Recrutement"},{path:"/annonceurs",label:"Annonceurs"},{path:"/contact",label:"Contact"},{path:"/newsletter",label:"Newsletter"},{path:"/mentions-legales",label:"Mentions légales"},{path:"/politique-confidentialite",label:"Confidentialité"},{path:"/conditions-generales-vente",label:"CGV"}];function lLt(t){return t<=40?"#DC2626":t<=70?"#D97706":"#16A34A"}function EPe(t){return t<=40?"Critique":t<=70?"à améliorer":"Bon"}async function cLt(t){return new Promise(e=>{const n=document.createElement("iframe");n.style.cssText="position:fixed;left:-9999px;top:0;width:1280px;height:900px;border:0;",n.src=t.path;const r={path:t.path,label:t.label,title:null,description:null,h1:[],h2Count:0,h3Count:0,og:{title:!1,description:!1,image:!1},twitter:!1,canonical:null,htmlLang:null,images:0,imagesLazy:0,imagesSized:0,imagesAlt:0};let s=!1;const i=c=>{if(!s){s=!0,clearTimeout(l);try{document.body.removeChild(n)}catch{}e({...r,...c})}},o=()=>{var c,u;try{const d=n.contentDocument;if(!d)return i({error:"Page inaccessible"});const h=p=>{var m,v;return((v=(m=d.querySelector(p))==null?void 0:m.content)==null?void 0:v.trim())||null},f=Array.from(d.querySelectorAll("img"));i({title:((c=d.title)==null?void 0:c.trim())||null,description:h('meta[name="description"]'),h1:Array.from(d.querySelectorAll("h1")).map(p=>{var m;return((m=p.textContent)==null?void 0:m.trim())||""}),h2Count:d.querySelectorAll("h2").length,h3Count:d.querySelectorAll("h3").length,og:{title:!!h('meta[property="og:title"]'),description:!!h('meta[property="og:description"]'),image:!!h('meta[property="og:image"]')},twitter:!!h('meta[name="twitter:card"]'),canonical:((u=d.querySelector('link[rel="canonical"]'))==null?void 0:u.href)||null,htmlLang:d.documentElement.getAttribute("lang"),images:f.length,imagesLazy:f.filter(p=>p.getAttribute("loading")==="lazy").length,imagesSized:f.filter(p=>p.getAttribute("width")&&p.getAttribute("height")).length,imagesAlt:f.filter(p=>(p.getAttribute("alt")||"").trim().length>0).length})}catch(d){i({error:d.message})}},l=setTimeout(o,6e3);n.onload=()=>setTimeout(o,1800),document.body.appendChild(n)})}async function uLt(t){const e=[];for(const g of APe)t(`Analyse de ${g.path}â¦`),e.push(await cLt(g));t("Analyse des articlesâ¦");const{data:n}=await Z.from("articles").select("id, title, slug, cover_image_url, seo_description, seo_title").eq("status","published").not("published_at","is",null),r=n||[],s=g=>{const w=[];return g.cover_image_url||w.push("Pas d'image"),(!g.seo_description||g.seo_description.trim()==="")&&w.push("Pas de meta description"),!g.slug||g.slug.trim()===""?w.push("Slug manquant"):g.slug.length>75&&w.push("Slug trop long"),(g.title||"").length>60&&w.push("Titre > 60 caractères"),w},i=r.map(g=>({title:g.title,slug:g.slug,issues:s(g)})).filter(g=>g.issues.length>0).sort((g,w)=>w.issues.length-g.issues.length).slice(0,10);t("Analyse de l'annuaireâ¦");const{data:o}=await Z.from("partner_profiles").select("id, lat, lng, photos, description, status, is_active").eq("status","published").eq("is_active",!0),l=o||[];t("Vérifications techniquesâ¦");const c=async g=>{try{const w=await fetch(g,{cache:"no-store"});return w.ok?await w.text():null}catch{return null}}
1520,[u,d]=await Promise.all([c("/robots.txt"),c("/sitemap.xml")]);let h=!1;try{h=(await fetch("/favicon.ico",{cache:"no-store"})).ok}catch{h=!1}const f=d?(d.match(/<loc>/g)||[]).length:0,p=Array.from(document.querySelectorAll('link[rel="stylesheet"]')).some(g=>g.href.includes("display=swap")),m=Array.from(document.querySelectorAll("script[src]")),v=m.length>0&&m.every(g=>g.defer||g.async||g.type==="module"),x=e.reduce((g,w)=>({images:g.images+w.images,imagesLazy:g.imagesLazy+w.imagesLazy,imagesSized:g.imagesSized+w.imagesSized,imagesAlt:g.imagesAlt+w.imagesAlt}),{images:0,imagesLazy:0,imagesSized:0,imagesAlt:0});return{generatedAt:new Date().toISOString(),pages:e,articles:{total:r.length,noImage:r.filter(g=>!g.cover_image_url).length,noMetaDescription:r.filter(g=>!g.seo_description||g.seo_description.trim()==="").length,noSlug:r.filter(g=>!g.slug||g.slug.trim()==="").length,longTitle:r.filter(g=>(g.title||"").length>60).length,worst:i},directory:{total:l.length,noGps:l.filter(g=>g.lat==null||g.lng==null).length,noPhoto:l.filter(g=>!g.photos||g.photos.length===0).length,noDescription:l.filter(g=>!(g.description||"").trim()).length},technical:{robots:!!u,sitemap:!!d&&f>0,sitemapUrls:f,favicon:h,fontDisplaySwap:p,deferredScripts:v,...x}}}function gH(t){const e=!!t.title&&t.title.length>=30&&t.title.length<=65,n=!!t.description&&t.description.length>=100&&t.description.length<=165,r=t.og.title&&t.og.description&&t.og.image,s=!!t.canonical,i=t.h1.length===1,o=!!t.htmlLang,l=[e,n,r,s,i,o];return{titleOk:e,descOk:n,ogOk:r,canonicalOk:s,h1Ok:i,langOk:o,ratio:l.filter(Boolean).length/l.length}}function Cce(t){const e=t.pages.length?t.pages.reduce((v,x)=>v+gH(x).ratio,0)/t.pages.length:0,n=Math.round(e*25),r=t.articles,s=r.total?1-(r.noImage+r.noMetaDescription+r.noSlug+r.longTitle*.5)/(r.total*3.5):1,i=Math.round(Math.max(0,Math.min(1,s))*25),o=t.directory,l=o.total?1-(o.noGps+o.noPhoto+o.noDescription)/(o.total*3):1,c=Math.round(Math.max(0,Math.min(1,l))*20),u=t.technical,d=u.images?u.imagesLazy/u.images:0,h=u.images?u.imagesSized/u.images:0,f=u.images?u.imagesAlt/u.images:1,p=[u.robots?1:0,u.sitemap?1:0,u.favicon?1:0,u.fontDisplaySwap?1:0,u.deferredScripts?1:0,d,h,f],m=Math.round(p.reduce((v,x)=>v+x,0)/p.length*30);return{meta:n,content:i,directory:c,technical:m,total:n+i+c+m}}function kce(t){const e=[],n=t.technical;n.robots||e.push({level:"critique",text:"robots.txt introuvable â les moteurs ne savent pas quoi explorer."}),n.sitemap||e.push({level:"critique",text:"sitemap.xml absent ou vide â ajouter toutes les URLs publiques."});const r=t.pages.filter(c=>!c.title);r.length&&e.push({level:"critique",text:`${r.length} page(s) sans balise titre : ${r.map(c=>c.path).join(", ")}.`});const s=t.pages.filter(c=>!c.description);s.length&&e.push({level:"critique",text:`${s.length} page(s) sans meta description : ${s.map(c=>c.path).join(", ")}.`});const i=t.pages.filter(c=>c.h1.length!==1);i.length&&e.push({level:"critique",text:`${i.length} page(s) sans H1 unique : ${i.map(c=>c.path).join(", ")}.`}),t.articles.noMetaDescription&&e.push({level:"important",text:`${t.articles.noMetaDescription} article(s) publiés sans meta description SEO.`}),t.articles.noImage&&e.push({level:"important",text:`${t.articles.noImage} article(s) publiés sans image de couverture.`}),t.directory.noGps&&e.push({level:"important",text:`${t.directory.noGps} fiche(s) annuaire sans coordonnées GPS (invisibles sur la carte).`}),t.directory.noDescription&&e.push({level:"important",text:`${t.directory.noDescription} fiche(s) annuaire sans description.`});const o=t.pages.filter(c=>c.title&&(c.title.length<30||c.title.length>65));o.length&&e.push({level:"important",text:`${o.length} titre(s) de page hors de la plage idéale 50-60 caractères.`});const l=t.pages.filter(c=>c.description&&(c.description.length<100||c.description.length>165));return l.length&&e.push({level:"important",text:`${l.length} description(s) hors de la plage idéale 120-155 caractères.`}),n.images&&n.imagesLazy/n.images<.7&&e.push({level:"amelioration",text:`Seulement ${n.imagesLazy}/${n.images} images en chargement différé (loading="lazy").`}),n.images&&n.imagesSized/n.images<.7&&e.push({level:"amelioration",text:`Seulement ${n.imagesSized}/${n.images}
1520 images avec largeur/hauteur déclarées (stabilité visuelle).`}),n.images&&n.imagesAlt/n.images<.9&&e.push({level:"amelioration",text:`${n.images-n.imagesAlt} image(s) sans texte alternatif.`}),t.articles.longTitle&&e.push({level:"amelioration",text:`${t.articles.longTitle} article(s) avec un titre de plus de 60 caractères.`}),t.directory.noPhoto&&e.push({level:"amelioration",text:`${t.directory.noPhoto} fiche(s) annuaire sans photo.`}),n.fontDisplaySwap||e.push({level:"amelioration",text:"Les polices ne semblent pas utiliser font-display: swap."}),n.deferredScripts||e.push({level:"amelioration",text:"Certains scripts ne sont ni defer ni async."}),e}const Kb=()=>a.jsx(Ma,{className:"h-4 w-4 text-green-600"}),Uv=()=>a.jsx(ks,{className:"h-4 w-4 text-red-600"});function dLt({score:t}){const e=lLt(t);return a.jsxs("div",{className:"flex items-center gap-6",children:[a.jsx("div",{className:"grid h-36 w-36 place-items-center rounded-full",style:{background:`conic-gradient(${e} ${t*3.6}deg, hsl(var(--muted)) 0deg)`},children:a.jsxs("div",{className:"grid h-28 w-28 place-items-center rounded-full bg-background",children:[a.jsx("span",{className:"font-heading text-4xl font-bold",style:{color:e},children:t}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"/ 100"})]})}),a.jsxs("div",{children:[a.jsx("p",{className:"font-heading text-2xl font-bold",style:{color:e},children:EPe(t)}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Score SEO global du site"})]})]})}function hLt(){const[t,e]=b.useState(null),[n,r]=b.useState(!1),[s,i]=b.useState(""),o=async()=>{r(!0),e(null);try{const d=await uLt(i);e(d)}finally{r(!1),i("")}},l=async()=>{if(!t)return;const{default:d}=await Ac(async()=>{const{default:v}=await import("./jspdf.es.min-DJcAk7nZ.js");return{default:v}},[]),h=new d({unit:"pt",format:"a4"}),f=Cce(t);let p=48;const m=(v,x=10,g=!1)=>{h.setFontSize(x),h.setFont("helvetica",g?"bold":"normal");for(const w of h.splitTextToSize(v,500))p>790&&(h.addPage(),p=48),h.text(w,48,p),p+=x+4};m("Audit SEO â Esprit Sud Magazine",18,!0),m(new Date(t.generatedAt).toLocaleString("fr-FR"),9),p+=8,m(`Score global : ${f.total}/100 (${EPe(f.total)})`,13,!0),m(`Meta tags ${f.meta}/25 · Articles ${f.content}/25 · Annuaire ${f.directory}/20 · Technique ${f.technical}/30`),p+=10,m("Meta tags par page",13,!0),t.pages.forEach(v=>{var g,w;const x=gH(v);m(`${v.path} â titre ${x.titleOk?"OK":"KO"} (${((g=v.title)==null?void 0:g.length)??0}) · desc ${x.descOk?"OK":"KO"} (${((w=v.description)==null?void 0:w.length)??0}) · OG ${x.ogOk?"OK":"KO"} · canonical ${x.canonicalOk?"OK":"KO"} · H1 ${v.h1.length}`)}),p+=10,m("Articles",13,!0),m(`${t.articles.total} publiés · ${t.articles.noImage} sans image · ${t.articles.noMetaDescription} sans meta description · ${t.articles.noSlug} sans slug · ${t.articles.longTitle} titres > 60 caractères`),p+=6,m("Annuaire",13,!0),m(`${t.directory.total} fiches publiées · ${t.directory.noGps} sans GPS · ${t.directory.noPhoto} sans photo · ${t.directory.noDescription} sans description`),p+=6,m("Technique",13,!0),m(`robots.txt ${t.technical.robots?"OK":"KO"} · sitemap.xml ${t.technical.sitemap?`OK (${t.technical.sitemapUrls} URLs)`:"KO"} · favicon ${t.technical.favicon?"OK":"KO"} · images ${t.technical.imagesLazy}/${t.technical.images} lazy · ${t.technical.imagesSized}/${t.technical.images} dimensionnées`),p+=10,m("Recommandations",13,!0),kce(t).forEach((v,x)=>m(`${x+1}. [${v.level}] ${v.text}`)),h.save(`audit-seo-esprit-sud-${new Date().toISOString().slice(0,10)}.pdf`)},c=t?Cce(t):null,u=t?kce(t):[];return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"font-heading text-2xl font-bold",children:"Audit SEO"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Analyse en lecture seule du site, des articles et de l'annuaire."})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(H,{onClick:o,disabled:n,children:[n?a.jsx(Je,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(Ig,{className:"mr-2 h-4 w-4"}),n?"Analyse en coursâ¦":t?"Relancer l'audit":"Lancer l'audit"]}),a.jsxs(H,{variant:"outline",onClick:l,disabled:!t,children:[a.jsx(F$e,{className:"mr-2 h-4 w-4"})," Exporter le rapport PDF"]})]})]}),n&&a.jsx("p",{className:"text-sm text-muted-foreground",children:s}),!t&&!n&&a.jsx(Ke,{children:a.jsxs(ut,{className:"py-10 text-center text-sm text-muted-foreground",children:["Lancez l'audit pour analyser ",APe.length," pages publiques, les articles publiés et les fiches de l'annuaire. Aucune donnée n'est modifiée."]})}),t&&c&&a.jsxs(a.Fragment,{children:[a.jsx(Ke,{children:a.jsxs(ut,{className:"flex flex-wrap items-center justify-between gap-6 py-6",children:[a.jsx(dLt,{score:c.total}),a.jsx("div",{className:"grid grid-cols-2 gap-4 sm:grid-cols-4",children:[{label:"Meta tags",v:c.meta,max:25},{label:"Articles",v:c.content,max:25},{label:"Annuaire",v:c.directory,max:20},{label:"Technique",v:c.technical,max:30}].map(d=>a.jsxs("div",{className:"rounded-lg border border-border p-3 text-center",children:[a.jsxs("p",{className:"font-heading text-xl font-bold",children:[d.v,a.jsxs("span",{className:"text-sm text-muted-foreground",children:["/",d.max]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:d.label})]},d.label))})]})}),a.jsxs(Ke,{children:[a.jsx(Vt,{children:a.jsxs(Ht,{className:"text-base",children:["ð Meta tags â ",c.meta,"/25"]})}),a.jsx(ut,{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border text-left text-xs uppercase text-muted-foreground",children:[a.jsx("th",{className:"py-2 pr-3",children:"Page"}),a.jsx("th",{className:"py-2 pr-3",children:"Title"}),a.jsx("th",{className:"py-2 pr-3",children:"Description"}),a.jsx("th",{className:"py-2 pr-3",children:"OG"}),a.jsx("th",{className:"py-2 pr-3",children:"Canonical"}),a.jsx("th",{className:"py-2 pr-3",children:"H1"}),a.jsx("th",{className:"py-2 pr-3",children:"lang"})]})}),a.jsx("tbody",{children:t.pages.map(d=>{var f,p;const h=gH(d);return a.jsxs("tr",{className:"border-b border-border/60 align-top",children:[a.jsxs("td",{className:"py-2 pr-3 font-medium",children:[d.label,a.jsx("div",{className:"text-xs text-muted-foreground",children:d.path})]}),a.jsxs("td",{className:"py-2 pr-3",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[h.titleOk?a.jsx(Kb,{}):a.jsx(Uv,{}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[((f=d.title)==null?void 0:f.length)??0," car."]})]}),a.jsx("div",{className:"max-w-[260px] text-xs text-muted-foreground",children:d.title||"â"})]}),a.jsxs("td",{className:"py-2 pr-3",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[h.descOk?a.jsx(Kb,{}):a.jsx(Uv,{}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[((p=d.description)==null?void 0:p.length)??0," car."]})]}),a.jsx("div",{className:"max-w-[280px] text-xs text-muted-foreground",children:d.description||"â"})]}),a.jsx("td",{className:"py-2 pr-3",children:h.ogOk?a.jsx(Kb,{}):a.jsx(Uv,{})}),a.jsx("td",{className:"py-2 pr-3",children:h.canonicalOk?a.jsx(Kb,{}):a.jsx(Uv,{})}),a.jsxs("td",{className:"py-2 pr-3",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[h.h1Ok?a.jsx(Kb,{}):a.jsx(Uv,{}),a.jsx("span",{className:"text-xs text-muted-foreground",children:d.h1.length})]}),a.jsxs("div",{className:"text-xs text-muted-foreground",children:["H2 ",d.h2Count," · H3 ",d.h3Count]})]}),a.jsx("td",{className:"py-2 pr-3",children:d.htmlLang||a.jsx(Uv,{})})]},d.path)})})]})})]}),a.jsxs(Ke,{children:[a.jsx(Vt,{children:a.jsxs(Ht,{className:"text-base",children:["ð Contenu articles â ",c.content,"/25"]})}),a.jsxs(ut,{className:"space-y-4 text-sm",children:[a.jsxs("div",{className:"grid gap-3 sm:grid-cols-4",children:[a.jsx(Rp,{label:"Articles publiés",value:t.articles.total}),a.jsx(Rp,{label:"Sans image",value:t.articles.noImage,bad:!0}
1520),a.jsx(Rp,{label:"Sans meta description",value:t.articles.noMetaDescription,bad:!0}),a.jsx(Rp,{label:"Titre > 60 car.",value:t.articles.longTitle,bad:!0})]}),t.articles.worst.length>0&&a.jsxs("div",{children:[a.jsx("p",{className:"mb-2 font-medium",children:"10 articles les plus problématiques"}),a.jsx("ul",{className:"space-y-1",children:t.articles.worst.map(d=>a.jsxs("li",{className:"flex flex-wrap items-center gap-2 border-b border-border/60 py-1",children:[a.jsx("span",{className:"flex-1 min-w-[200px]",children:d.title}),d.issues.map(h=>a.jsx(ke,{variant:"destructive",className:"text-[10px]",children:h},h))]},d.slug||d.title))})]})]})]}),a.jsxs(Ke,{children:[a.jsx(Vt,{children:a.jsxs(Ht,{className:"text-base",children:["ð¢ Fiches annuaire â ",c.directory,"/20"]})}),a.jsxs(ut,{className:"grid gap-3 sm:grid-cols-4 text-sm",children:[a.jsx(Rp,{label:"Fiches publiées",value:t.directory.total}),a.jsx(Rp,{label:"Sans GPS",value:t.directory.noGps,bad:!0}),a.jsx(Rp,{label:"Sans photo",value:t.directory.noPhoto,bad:!0}),a.jsx(Rp,{label:"Sans description",value:t.directory.noDescription,bad:!0})]})]}),a.jsxs(Ke,{children:[a.jsx(Vt,{children:a.jsxs(Ht,{className:"text-base",children:["âï¸ Technique â ",c.technical,"/30"]})}),a.jsxs(ut,{className:"space-y-2 text-sm",children:[a.jsx(Op,{ok:t.technical.robots,label:"robots.txt accessible"}),a.jsx(Op,{ok:t.technical.sitemap,label:`sitemap.xml accessible (${t.technical.sitemapUrls} URLs)`}),a.jsx(Op,{ok:t.technical.favicon,label:"favicon.ico présent"}),a.jsx(Op,{ok:t.technical.images>0&&t.technical.imagesLazy/t.technical.images>=.7,label:`Chargement différé des images (${t.technical.imagesLazy}/${t.technical.images})`}),a.jsx(Op,{ok:t.technical.images>0&&t.technical.imagesSized/t.technical.images>=.7,label:`Images avec largeur/hauteur (${t.technical.imagesSized}/${t.technical.images})`}),a.jsx(Op,{ok:t.technical.images>0&&t.technical.imagesAlt/t.technical.images>=.9,label:`Images avec texte alternatif (${t.technical.imagesAlt}/${t.technical.images})`}),a.jsx(Op,{ok:t.technical.fontDisplaySwap,label:"Polices en font-display: swap"}),a.jsx(Op,{ok:t.technical.deferredScripts,label:"Scripts en defer / async / module"})]})]}),a.jsxs(Ke,{children:[a.jsx(Vt,{children:a.jsx(Ht,{className:"text-base",children:"Recommandations prioritaires"})}),a.jsxs(ut,{className:"space-y-4 text-sm",children:[["critique","important","amelioration"].map(d=>{const h=u.filter(m=>m.level===d);if(!h.length)return null;const f=d==="critique"?"ð´":d==="important"?"ð¡":"ð¢",p=d==="critique"?"Critique":d==="important"?"Important":"Amélioration";return a.jsxs("div",{children:[a.jsxs("p",{className:"mb-1 font-medium",children:[f," ",p]}),a.jsx("ol",{className:"list-decimal space-y-1 pl-5 text-muted-foreground",children:h.map(m=>a.jsx("li",{children:m.text},m.text))})]},d)}),u.length===0&&a.jsx("p",{className:"text-muted-foreground",children:"Aucun problème détecté. ð"})]})]})]})]})}function Rp({label:t,value:e,bad:n}){return a.jsxs("div",{className:"rounded-lg border border-border p-3",children:[a.jsx("p",{className:`font-heading text-xl font-bold ${n&&e>0?"text-red-600":""}`,children:e}),a.jsx("p",{className:"text-xs text-muted-foreground",children:t})]})}function Op({ok:t,label:e}){return a.jsxs("div",{className:"flex items-center gap-2",children:[t?a.jsx(Kb,{}):a.jsx(Uv,{}),a.jsx("span",{children:e})]})}const fLt=[7,30,90],pLt={mobile:"Mobile",desktop:"Ordinateur",tablet:"Tablette"},mLt={mobile:"hsl(var(--gold))",desktop:"hsl(var(--primary))",tablet:"hsl(var(--secondary))"};function gLt(t){return t<60?`${Math.round(t)} s`:`${Math.round(t/60)} min`}function vLt(){const[t,e]=b.useState(30),{data:n,isLoading:r,error:s}=Ne({queryKey:["audio-stats",t],queryFn:async()=>{const l=new Date(Date.now()-t*864e5).toISOString(),c=[];for(let u=0;;u+=1e3){const{data:d,error:h}=await Z.from("article_audio_stats").select("article_id, article_title, event, listen_duration_seconds, completion_percent, device_type, created_at").gte("created_at",l).order("created_at",{ascending:!0}).range(u,u+999);if(h)throw h;if(c.push(...d??[]),!d||d.length<1e3)break}return c}}),i=b.useMemo(()=>
1520{const l=n??[],c=l.filter(k=>k.event==="play"),u=l.filter(k=>k.event==="stop"||k.event==="complete"),d=l.filter(k=>k.event==="complete"),h=c.length,f=u.length?u.reduce((k,E)=>k+(E.completion_percent??0),0)/u.length:0,p=u.length?u.reduce((k,E)=>k+(E.listen_duration_seconds??0),0)/u.length:0,m=h?d.length/h*100:0,v=[],x=new Map;c.forEach(k=>{const E=k.created_at.slice(0,10);x.set(E,(x.get(E)??0)+1)});const g=Math.min(t,30);for(let k=g-1;k>=0;k--){const E=new Date(Date.now()-k*864e5).toISOString().slice(0,10);v.push({day:E.slice(8,10)+"/"+E.slice(5,7),ecoutes:x.get(E)??0})}const w=new Map;l.forEach(k=>{const E=k.article_id??k.article_title??"â",P=w.get(E)??{title:k.article_title??"Sans titre",plays:0,pctSum:0,pctN:0,completes:0};k.event==="play"&&P.plays++,(k.event==="stop"||k.event==="complete")&&(P.pctSum+=k.completion_percent??0,P.pctN++),k.event==="complete"&&P.completes++,w.set(E,P)});const _=[...w.values()].sort((k,E)=>E.plays-k.plays).slice(0,5),j=new Map;c.forEach(k=>j.set(k.device_type??"desktop",(j.get(k.device_type??"desktop")??0)+1));const N=[...j.entries()].map(([k,E])=>({key:k,name:pLt[k]??k,value:E})),S=Math.round(h/t*30),C=[{label:"> 200 écoutes/mois",ok:S>200,value:`${S} / mois`},{label:"> 50% taux de complétion",ok:f>50,value:`${Math.round(f)}%`},{label:"> 30% taux lecture complète",ok:m>30,value:`${Math.round(m)}%`}];return{totalPlays:h,avgCompletion:f,avgListen:p,completeRate:m,byDay:v,top:_,devices:N,criteria:C}},[n,t]),o=i.criteria.filter(l=>l.ok).length;return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"font-heading text-2xl font-bold",children:"Statistiques du lecteur audio"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Utilisation de « Ãcouter cet article » par vos lecteurs."})]}),a.jsx("div",{className:"flex gap-2",children:fLt.map(l=>a.jsxs(H,{size:"sm",variant:t===l?"default":"outline",onClick:()=>e(l),children:[l," j"]},l))})]}),r?a.jsx("div",{className:"flex justify-center py-20",children:a.jsx(Je,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):s?a.jsx(Ke,{children:a.jsx(ut,{className:"py-8 text-sm text-muted-foreground",children:"Les statistiques ne sont pas encore disponibles : la table d'enregistrement des écoutes doit d'abord être créée dans Supabase."})}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"grid grid-cols-2 gap-4 lg:grid-cols-4",children:[{label:"Total écoutes",value:String(i.totalPlays)},{label:"Taux de complétion",value:`${Math.round(i.avgCompletion)}%`},{label:"Durée moy. écoutée",value:gLt(i.avgListen)},{label:"Taux lecture complète",value:`${Math.round(i.completeRate)}%`}].map(l=>a.jsx(Ke,{children:a.jsxs(ut,{className:"pt-6",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:l.label}),a.jsx("div",{className:"mt-1 font-heading text-3xl font-bold",children:l.value})]})},l.label))}),a.jsxs(Ke,{children:[a.jsx(Vt,{children:a.jsxs(Ht,{className:"text-base",children:["Ãcoutes par jour (",Math.min(t,30)," derniers jours)"]})}),a.jsx(ut,{className:"h-64",children:a.jsx(DV,{width:"100%",height:"100%",children:a.jsxs(NPe,{data:i.byDay,children:[a.jsx(KY,{dataKey:"day",fontSize:11,interval:"preserveStartEnd"}),a.jsx(GY,{allowDecimals:!1,fontSize:11,width:30}),a.jsx(iH,{}),a.jsx(rL,{dataKey:"ecoutes",name:"Ãcoutes",fill:"hsl(var(--gold))",radius:[4,4,0,0]})]})})})]}),a.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[a.jsxs(Ke,{className:"lg:col-span-2",children:[a.jsx(Vt,{children:a.jsx(Ht,{className:"text-base",children:"Top 5 des articles les plus écoutés"})}),a.jsx(ut,{children:i.top.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:"Aucune écoute sur la période."}):a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b text-left text-muted-foreground",children:[a.jsx("th",{className:"py-2",children:"Titre"}),a.jsx("th",{className:"py-2 text-right",children:"Ãcoutes"}),a.jsx("th",{className:"py-2 text-right",children:"% complétion moyen"}),a.jsx("th",{className:"py-2 text-right",children:"Taux complet"})]})}),a.jsx("tbody",{children:i.top.map((l,c)=>
1520a.jsxs("tr",{className:"border-b last:border-0",children:[a.jsx("td",{className:"py-2 pr-2",children:l.title}),a.jsx("td",{className:"py-2 text-right",children:l.plays}),a.jsxs("td",{className:"py-2 text-right",children:[l.pctN?Math.round(l.pctSum/l.pctN):0,"%"]}),a.jsxs("td",{className:"py-2 text-right",children:[l.plays?Math.round(l.completes/l.plays*100):0,"%"]})]},c))})]})})]}),a.jsxs(Ke,{children:[a.jsx(Vt,{children:a.jsx(Ht,{className:"text-base",children:"Mobile vs ordinateur"})}),a.jsx(ut,{className:"h-64",children:i.devices.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:"Aucune donnée."}):a.jsx(DV,{width:"100%",height:"100%",children:a.jsxs(NDt,{children:[a.jsx(VTe,{data:i.devices,dataKey:"value",nameKey:"name",outerRadius:80,label:!0,children:i.devices.map(l=>a.jsx(cT,{fill:mLt[l.key]??"hsl(var(--muted-foreground))"},l.key))}),a.jsx(iH,{}),a.jsx(yG,{})]})})})]})]}),a.jsxs(Ke,{className:"border-gold bg-cream",children:[a.jsx(Vt,{children:a.jsx(Ht,{className:"text-base",children:"ð¡ Faut-il passer à une voix premium ?"})}),a.jsxs(ut,{className:"space-y-2 text-sm",children:[a.jsx("p",{className:"text-muted-foreground",children:"Seuil recommandé pour ElevenLabs (projection sur 30 jours) :"}),a.jsx("ul",{className:"space-y-1",children:i.criteria.map(l=>a.jsxs("li",{children:[l.ok?"â
":"â"," ",l.label," ",a.jsxs("span",{className:"text-muted-foreground",children:["(actuel : ",l.value,")"]})]},l.label))}),a.jsxs("p",{className:"pt-2 font-medium",children:["Score actuel : ",o,"/3 critères atteints"]}),a.jsxs("p",{className:"font-heading text-lg font-bold",children:["â ",o===3?"Upgrade recommandé":"Pas encore"]})]})]})]})]})}const xLt=new cIe,yLt=["admin","staff","redacteur","redacteur_chef","commercial","gestionnaire_boutique"],bLt=()=>a.jsx(pIe,{client:xLt,children:a.jsx(n6e,{children:a.jsx(r6e,{children:a.jsx(t6e,{children:a.jsxs(QBe,{children:[a.jsx(pze,{}),a.jsx(kFe,{}),a.jsx(NDe,{basename:I4e(),children:a.jsxs(z4e,{children:[a.jsx(tfe,{}),a.jsx(PDe,{}),a.jsx(Y4e,{}),a.jsxs(vDe,{children:[a.jsx(Ie,{path:"/annonceurs",element:a.jsx(z7e,{})}),a.jsxs(Ie,{element:a.jsx(kqe,{}),children:[a.jsx(Ie,{path:"/",element:a.jsx(L7e,{})}),a.jsx(Ie,{path:"/boutique",element:a.jsx(B7e,{})}),a.jsx(Ie,{path:"/boutique/panier",element:a.jsx(FXe,{})}),a.jsx(Ie,{path:"/boutique/confirmation",element:a.jsx($Xe,{})}),a.jsx(Ie,{path:"/boutique/merci",element:a.jsx(zXe,{})}),a.jsx(Ie,{path:"/boutique/nos-magazines-papier",element:a.jsx(JQe,{})}),a.jsx(Ie,{path:"/boutique/:slug",element:a.jsx(PXe,{})}),a.jsx(Ie,{path:"/carte-privilege",element:a.jsx(YXe,{})}),a.jsx(Ie,{path:"/carte-privilege/mon-espace",element:a.jsx(KT,{children:a.jsx(fJe,{})})}),a.jsx(Ie,{path:"/carte-privilege/apercu-couple",element:a.jsx(pJe,{})}),a.jsx(Ie,{path:"/actualites",element:a.jsx(xJe,{})}),a.jsx(Ie,{path:"/actualites/:slug",element:a.jsx(bQe,{})}),a.jsx(Ie,{path:"/destinations",element:a.jsx(jQe,{})}),a.jsx(Ie,{path:"/destinations/:slug",element:a.jsx(SQe,{})}),a.jsx(Ie,{path:"/annuaire",element:a.jsx(grt,{})}),a.jsx(Ie,{path:"/annuaire/:slug",element:a.jsx(Bst,{})}),a.jsx(Ie,{path:"/espace-pro/ma-fiche",element:a.jsx(KT,{children:a.jsx(tit,{})})}),a.jsx(Ie,{path:"/carnet-adresses",element:a.jsx(EQe,{})}),a.jsx(Ie,{path:"/carnet-adresses/tfk/:slug",element:a.jsx(MQe,{})}),a.jsx(Ie,{path:"/carnet-adresses/:slug",element:a.jsx(TQe,{})}),a.jsx(Ie,{path:"/evenements",element:a.jsx(OQe,{})}),a.jsx(Ie,{path:"/evenements/:slug",element:a.jsx(DQe,{})}),a.jsx(Ie,{path:"/contact",element:a.jsx(LQe,{})}),a.jsx(Ie,{path:"/recrutement",element:a.jsx(KQe,{})}),a.jsx(Ie,{path:"/nos-magazines",element:a.jsx(YQe,{})}),a.jsx(Ie,{path:"/nos-magazines/:issueNumber",element:a.jsx(int,{})}),a.jsx(Ie,{path:"/nos-magazines/:issueNumber/lire",element:a.jsx(nnt,{})}),a.jsx(Ie,{path:"/points-de-depot",element:a.jsx(ont,{})}),a.jsx(Ie,{path:"/login",element:a.jsx(hnt,{})}),a.jsx(Ie,{path:"/signup",element:a.jsx(fnt,{})}),a.jsx(Ie,{path:"/reset-password",element:a.jsx(pnt,{})}),a.jsx(Ie,{path:"/mon-compte",element:a.jsx(KT,{children:a.jsx(dnt,{})})}),a.jsx(Ie,{path:"/mentions-legales",element:a.jsx(bnt,{})}),a.jsx(Ie,{path:"/politique-confidentialite",element:a.jsx(wnt,{})}),a.jsx(Ie,{path:"/politique-cookies",element:a.jsx(jnt,{})}),a.jsx(Ie,{path:"/conditions-generales-vente",element:a.jsx(_nt,{})}),a.jsx(Ie,{path:"/conditions-carte-privilege",element:a.jsx(Snt,{})}),a.jsx(Ie,{path:"/newsletter",element:a.jsx(Cnt,{})}),a.jsx(Ie,{path:"/newsletter/desabonnement",element:a.jsx(knt,{})}),a.jsx(Ie,{path:"/bienvenue",element:a.jsx(Rnt,{})}),a.jsx(Ie,{path:"/actualites/i/:id/:slug",element:a.jsx(OT,{base:"/actualites"})}),a.jsx(Ie,{path:"/actualites/c/:cat/i/:id/:slug",element:a.jsx(OT,{base:"/actualites"})}),a.jsx(Ie,{path:"/actualites/c/:cat",element:a.jsx(ms,{to:"/actualites",replace:!0})}),a.jsx(Ie,{path:"/les-avantages/i/:id/:slug",element:a.jsx(OT,{base:"/carnet-adresses"})}),a.jsx(Ie,{path:"/les-avantages/c/:cat",element:a.jsx(ms,{to:"/carte-privilege",replace:!0})}),a.jsx(Ie,{path:"/les-avantages",element:a.jsx(ms,{to:"/carte-privilege",replace:!0})}),a.jsx(Ie,{path:"/guides-voyage/c/:cat/i/:id/:slug",element:a.jsx(OT,{base:"/destinations"})}),a.jsx(Ie,{path:"/guides-voyage/c/:cat",element:a.jsx(ms,{to:"/destinations",replace:!0})}),a.jsx(Ie,{path:"/nos-magazines/c/:cat/i/:id/:slug",element:a.jsx(ms,{to:"/nos-magazines",replace:!0})}),a.jsx(Ie,{path:"/points-de-depot-esprit-sud/*",element:a.jsx(ms,{to:"/points-de-depot",replace:!0})}),a.jsx(Ie,{path:"/la-carte",element:a.jsx(ms,{to:"/carte-privilege",replace:!0})}),a.jsx(Ie,{path:"/syndication/*",element:a.jsx(ms,{to:"/",replace:!0})}),a.jsx(Ie,{path:"*",element:a.jsx(TDe,{children:a.jsx(Mnt,{})})})]}),a.jsxs(Ie,{path:"/admin",element:a.jsx(KT,{adminRoles:yLt,children:a.jsx(nit,{})}),children:[a.jsx(Ie,{index:!0,element:a.jsx(hit,{})}),a.jsx(Ie,{path:"produits",element:a.jsx(pit,{})}),a.jsx(Ie,{path:"produits/nouveau",element:a.jsx(Ene,{})}),a.jsx(Ie,{path:"produits/:id/modifier",element:a.jsx(Ene,{})}),a.jsx(Ie,{path:"commandes",element:a.jsx(yit,{})}),a.jsx(Ie,{path:"commandes/:id",element:a.jsx(Sit,{})}),a.jsx(Ie,{path:"partenaires",element:a.jsx(kit,{})}),a.jsx(Ie,{path:"partenaires/nouveau",element:a.jsx(Ise,{})}),a.jsx(Ie,{path:"partenaires/:id/modifier",element:a.jsx(Ise,{})}),a.jsx(Ie,{path:"carte-privilege",element:a.jsx(pgt,{})}),a.jsx(Ie,{path:"articles",element:a.jsx(zgt,{})}),a.jsx(Ie,{path:"articles/nouveau",element:a.jsx(Gse,{})}),a.jsx(Ie,{path:"articles/:id/modifier",element:a.jsx(Gse,{})}),a.jsx(Ie,{path:"veille-presse",element:a.jsx(Kgt,{})}),a.jsx(Ie,{path:"evenements",element:a.jsx(Jgt,{})}),a.jsx(Ie,{path:"parametres",element:a.jsx(Qgt,{})}),a.jsx(Ie,{path:"parametres-boutique",element:a.jsx(ovt,{})}),a.jsx(Ie,{path:"import",element:a.jsx(vvt,{})}),a.jsx(Ie,{path:"categories",element:a.jsx(wvt,{})}),a.jsx(Ie,{path:"magazine",element:a.jsx(jvt,{})}),a.jsx(Ie,{path:"magazine/:id",element:a.jsx(Dvt,{})}),a.jsx(Ie,{path:"pages-legales",element:a.jsx(Lvt,{})}),a.jsx(Ie,{path:"newsletter",element:a.jsx($vt,{})}),a.jsx(Ie,{path:"redirections",element:a.jsx(Uvt,{})}),a.jsx(Ie,{path:"points-de-depot",element:a.jsx(Qvt,{})}),a.jsx(Ie,{path:"destinations",element:a.jsx(txt,{})}),a.jsx(Ie,{path:"import-guides",element:a.jsx(rxt,{})}),a.jsx(Ie,{path:"codes-promo",element:a.jsx(axt,{})}),a.jsx(Ie,{path:"annonceurs",element:a.jsx(BDt,{})}),a.jsx(Ie,{path:"commentaires",element:a.jsx(UDt,{})}),a.jsx(Ie,{path:"utilisateurs",element:a.jsx(HDt,{})}),a.jsx(Ie,{path:"utilisateurs/:id",element:a.jsx(YDt,{})}),a.jsx(Ie,{path:"annuaire",element:a.jsx(sLt,{})}),a.jsx(Ie,{path:"recommandations",element:a.jsx(aLt,{})}),a.jsx(Ie,{path:"candidatures",element:a.jsx(oLt,{})}),a.jsx(Ie,{path:"seo-audit",element:a.jsx(hLt,{})}),a.jsx(Ie,{path:"audio-stats",element:a.jsx(vLt,{})}),a.jsx(Ie,{path:"emails",element:a.jsx(eLt,{})}),a.jsx(Ie,{path:"emails/:key",element:a.jsx(nLt,{})})]})]})]})})]})})})})});$4e();hW(document.getElementById("root")).render(a.jsx(ihe,{children:a.jsx(bLt,{})}));export{H as B,zye as G,_e as L,ve as R,Ac as _,Lc as a,_Lt as b,YS as c,z7 as d,cp as g,a as j,b as r};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.