@vertebr/admin 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/database/connector.d.ts.map +1 -1
- package/dist/database/connector.js +1 -0
- package/dist/database/connector.js.map +1 -1
- package/dist/database/types.d.ts +3 -1
- package/dist/database/types.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/runtime/api/catalog.d.ts +10 -0
- package/dist/runtime/api/catalog.d.ts.map +1 -1
- package/dist/runtime/api/catalog.js +14 -0
- package/dist/runtime/api/catalog.js.map +1 -1
- package/dist/runtime/api/configs.d.ts +2 -0
- package/dist/runtime/api/configs.d.ts.map +1 -1
- package/dist/runtime/api/configs.js +5 -1
- package/dist/runtime/api/configs.js.map +1 -1
- package/dist/runtime/api/fonts.d.ts +42 -0
- package/dist/runtime/api/fonts.d.ts.map +1 -0
- package/dist/runtime/api/fonts.js +152 -0
- package/dist/runtime/api/fonts.js.map +1 -0
- package/dist/runtime/api/resources.d.ts +1 -0
- package/dist/runtime/api/resources.d.ts.map +1 -1
- package/dist/runtime/api/resources.js +5 -1
- package/dist/runtime/api/resources.js.map +1 -1
- package/dist/runtime/api/routes.d.ts.map +1 -1
- package/dist/runtime/api/routes.js +31 -0
- package/dist/runtime/api/routes.js.map +1 -1
- package/dist/runtime/constants.d.ts +2 -0
- package/dist/runtime/constants.d.ts.map +1 -1
- package/dist/runtime/constants.js +13 -1
- package/dist/runtime/constants.js.map +1 -1
- package/dist/runtime/createAdmin.d.ts.map +1 -1
- package/dist/runtime/createAdmin.js +7 -0
- package/dist/runtime/createAdmin.js.map +1 -1
- package/dist/runtime/services/state.d.ts +2 -1
- package/dist/runtime/services/state.d.ts.map +1 -1
- package/dist/runtime/types/actions.d.ts +2 -0
- package/dist/runtime/types/actions.d.ts.map +1 -1
- package/dist/runtime/types/admin.d.ts +6 -1
- package/dist/runtime/types/admin.d.ts.map +1 -1
- package/dist/runtime/types/config.d.ts +10 -0
- package/dist/runtime/types/config.d.ts.map +1 -1
- package/dist/runtime/types/layout.d.ts +5 -0
- package/dist/runtime/types/layout.d.ts.map +1 -1
- package/dist/runtime/utils/http.d.ts.map +1 -1
- package/dist/runtime/utils/http.js +6 -0
- package/dist/runtime/utils/http.js.map +1 -1
- package/dist/schema.d.ts +55 -1
- package/dist/schema.d.ts.map +1 -1
- package/package.json +1 -1
- package/static/assets/index-CQszzssl.js +337 -0
- package/static/assets/index-Gk0ADe4H.css +1 -0
- package/static/index.html +6 -3
- package/static/assets/index-DKyVvFeT.js +0 -332
- package/static/assets/index-DUwFg1bw.css +0 -1
|
@@ -1,332 +0,0 @@
|
|
|
1
|
-
var qE=t=>{throw TypeError(t)};var GE=(t,e,n)=>e.has(t)||qE("Cannot "+n);var Pn=(t,e,n)=>(GE(t,e,"read from private field"),n?n.call(t):e.get(t)),WE=(t,e,n)=>e.has(t)?qE("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),zv=(t,e,n,r)=>(GE(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);function fz(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in t)){const s=Object.getOwnPropertyDescriptor(r,i);s&&Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:()=>r[i]})}}}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 i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();function hM(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var $v={exports:{}},ku={};var KE;function hz(){if(KE)return ku;KE=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(r,i,s){var o=null;if(s!==void 0&&(o=""+s),i.key!==void 0&&(o=""+i.key),"key"in i){s={};for(var l in i)l!=="key"&&(s[l]=i[l])}else s=i;return i=s.ref,{$$typeof:t,type:r,key:o,ref:i!==void 0?i:null,props:s}}return ku.Fragment=e,ku.jsx=n,ku.jsxs=n,ku}var ZE;function pz(){return ZE||(ZE=1,$v.exports=hz()),$v.exports}var b=pz(),Bv={exports:{}},We={};var YE;function mz(){if(YE)return We;YE=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),o=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),g=Symbol.iterator;function y(V){return V===null||typeof V!="object"?null:(V=g&&V[g]||V["@@iterator"],typeof V=="function"?V:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,k={};function C(V,X,fe){this.props=V,this.context=X,this.refs=k,this.updater=fe||x}C.prototype.isReactComponent={},C.prototype.setState=function(V,X){if(typeof V!="object"&&typeof V!="function"&&V!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,V,X,"setState")},C.prototype.forceUpdate=function(V){this.updater.enqueueForceUpdate(this,V,"forceUpdate")};function T(){}T.prototype=C.prototype;function _(V,X,fe){this.props=V,this.context=X,this.refs=k,this.updater=fe||x}var R=_.prototype=new T;R.constructor=_,S(R,C.prototype),R.isPureReactComponent=!0;var M=Array.isArray;function O(){}var L={H:null,A:null,T:null,S:null},P=Object.prototype.hasOwnProperty;function U(V,X,fe){var ge=fe.ref;return{$$typeof:t,type:V,key:X,ref:ge!==void 0?ge:null,props:fe}}function G(V,X){return U(V.type,X,V.props)}function oe(V){return typeof V=="object"&&V!==null&&V.$$typeof===t}function K(V){var X={"=":"=0",":":"=2"};return"$"+V.replace(/[=:]/g,function(fe){return X[fe]})}var ne=/\/+/g;function re(V,X){return typeof V=="object"&&V!==null&&V.key!=null?K(""+V.key):X.toString(36)}function me(V){switch(V.status){case"fulfilled":return V.value;case"rejected":throw V.reason;default:switch(typeof V.status=="string"?V.then(O,O):(V.status="pending",V.then(function(X){V.status==="pending"&&(V.status="fulfilled",V.value=X)},function(X){V.status==="pending"&&(V.status="rejected",V.reason=X)})),V.status){case"fulfilled":return V.value;case"rejected":throw V.reason}}throw V}function B(V,X,fe,ge,Te){var _e=typeof V;(_e==="undefined"||_e==="boolean")&&(V=null);var Le=!1;if(V===null)Le=!0;else switch(_e){case"bigint":case"string":case"number":Le=!0;break;case"object":switch(V.$$typeof){case t:case e:Le=!0;break;case h:return Le=V._init,B(Le(V._payload),X,fe,ge,Te)}}if(Le)return Te=Te(V),Le=ge===""?"."+re(V,0):ge,M(Te)?(fe="",Le!=null&&(fe=Le.replace(ne,"$&/")+"/"),B(Te,X,fe,"",function(pe){return pe})):Te!=null&&(oe(Te)&&(Te=G(Te,fe+(Te.key==null||V&&V.key===Te.key?"":(""+Te.key).replace(ne,"$&/")+"/")+Le)),X.push(Te)),1;Le=0;var ke=ge===""?".":ge+":";if(M(V))for(var se=0;se<V.length;se++)ge=V[se],_e=ke+re(ge,se),Le+=B(ge,X,fe,_e,Te);else if(se=y(V),typeof se=="function")for(V=se.call(V),se=0;!(ge=V.next()).done;)ge=ge.value,_e=ke+re(ge,se++),Le+=B(ge,X,fe,_e,Te);else if(_e==="object"){if(typeof V.then=="function")return B(me(V),X,fe,ge,Te);throw X=String(V),Error("Objects are not valid as a React child (found: "+(X==="[object Object]"?"object with keys {"+Object.keys(V).join(", ")+"}":X)+"). If you meant to render a collection of children, use an array instead.")}return Le}function z(V,X,fe){if(V==null)return V;var ge=[],Te=0;return B(V,ge,"","",function(_e){return X.call(fe,_e,Te++)}),ge}function q(V){if(V._status===-1){var X=V._result;X=X(),X.then(function(fe){(V._status===0||V._status===-1)&&(V._status=1,V._result=fe)},function(fe){(V._status===0||V._status===-1)&&(V._status=2,V._result=fe)}),V._status===-1&&(V._status=0,V._result=X)}if(V._status===1)return V._result.default;throw V._result}var de=typeof reportError=="function"?reportError:function(V){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var X=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof V=="object"&&V!==null&&typeof V.message=="string"?String(V.message):String(V),error:V});if(!window.dispatchEvent(X))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",V);return}console.error(V)},ve={map:z,forEach:function(V,X,fe){z(V,function(){X.apply(this,arguments)},fe)},count:function(V){var X=0;return z(V,function(){X++}),X},toArray:function(V){return z(V,function(X){return X})||[]},only:function(V){if(!oe(V))throw Error("React.Children.only expected to receive a single React element child.");return V}};return We.Activity=m,We.Children=ve,We.Component=C,We.Fragment=n,We.Profiler=i,We.PureComponent=_,We.StrictMode=r,We.Suspense=u,We.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=L,We.__COMPILER_RUNTIME={__proto__:null,c:function(V){return L.H.useMemoCache(V)}},We.cache=function(V){return function(){return V.apply(null,arguments)}},We.cacheSignal=function(){return null},We.cloneElement=function(V,X,fe){if(V==null)throw Error("The argument must be a React element, but you passed "+V+".");var ge=S({},V.props),Te=V.key;if(X!=null)for(_e in X.key!==void 0&&(Te=""+X.key),X)!P.call(X,_e)||_e==="key"||_e==="__self"||_e==="__source"||_e==="ref"&&X.ref===void 0||(ge[_e]=X[_e]);var _e=arguments.length-2;if(_e===1)ge.children=fe;else if(1<_e){for(var Le=Array(_e),ke=0;ke<_e;ke++)Le[ke]=arguments[ke+2];ge.children=Le}return U(V.type,Te,ge)},We.createContext=function(V){return V={$$typeof:o,_currentValue:V,_currentValue2:V,_threadCount:0,Provider:null,Consumer:null},V.Provider=V,V.Consumer={$$typeof:s,_context:V},V},We.createElement=function(V,X,fe){var ge,Te={},_e=null;if(X!=null)for(ge in X.key!==void 0&&(_e=""+X.key),X)P.call(X,ge)&&ge!=="key"&&ge!=="__self"&&ge!=="__source"&&(Te[ge]=X[ge]);var Le=arguments.length-2;if(Le===1)Te.children=fe;else if(1<Le){for(var ke=Array(Le),se=0;se<Le;se++)ke[se]=arguments[se+2];Te.children=ke}if(V&&V.defaultProps)for(ge in Le=V.defaultProps,Le)Te[ge]===void 0&&(Te[ge]=Le[ge]);return U(V,_e,Te)},We.createRef=function(){return{current:null}},We.forwardRef=function(V){return{$$typeof:l,render:V}},We.isValidElement=oe,We.lazy=function(V){return{$$typeof:h,_payload:{_status:-1,_result:V},_init:q}},We.memo=function(V,X){return{$$typeof:f,type:V,compare:X===void 0?null:X}},We.startTransition=function(V){var X=L.T,fe={};L.T=fe;try{var ge=V(),Te=L.S;Te!==null&&Te(fe,ge),typeof ge=="object"&&ge!==null&&typeof ge.then=="function"&&ge.then(O,de)}catch(_e){de(_e)}finally{X!==null&&fe.types!==null&&(X.types=fe.types),L.T=X}},We.unstable_useCacheRefresh=function(){return L.H.useCacheRefresh()},We.use=function(V){return L.H.use(V)},We.useActionState=function(V,X,fe){return L.H.useActionState(V,X,fe)},We.useCallback=function(V,X){return L.H.useCallback(V,X)},We.useContext=function(V){return L.H.useContext(V)},We.useDebugValue=function(){},We.useDeferredValue=function(V,X){return L.H.useDeferredValue(V,X)},We.useEffect=function(V,X){return L.H.useEffect(V,X)},We.useEffectEvent=function(V){return L.H.useEffectEvent(V)},We.useId=function(){return L.H.useId()},We.useImperativeHandle=function(V,X,fe){return L.H.useImperativeHandle(V,X,fe)},We.useInsertionEffect=function(V,X){return L.H.useInsertionEffect(V,X)},We.useLayoutEffect=function(V,X){return L.H.useLayoutEffect(V,X)},We.useMemo=function(V,X){return L.H.useMemo(V,X)},We.useOptimistic=function(V,X){return L.H.useOptimistic(V,X)},We.useReducer=function(V,X,fe){return L.H.useReducer(V,X,fe)},We.useRef=function(V){return L.H.useRef(V)},We.useState=function(V){return L.H.useState(V)},We.useSyncExternalStore=function(V,X,fe){return L.H.useSyncExternalStore(V,X,fe)},We.useTransition=function(){return L.H.useTransition()},We.version="19.2.8",We}var XE;function Dd(){return XE||(XE=1,Bv.exports=mz()),Bv.exports}var A=Dd();const Ve=hM(A),Id=fz({__proto__:null,default:Ve},[A]);var Vv={exports:{}},Cu={},Hv={exports:{}},Uv={};var JE;function gz(){return JE||(JE=1,(function(t){function e(B,z){var q=B.length;B.push(z);e:for(;0<q;){var de=q-1>>>1,ve=B[de];if(0<i(ve,z))B[de]=z,B[q]=ve,q=de;else break e}}function n(B){return B.length===0?null:B[0]}function r(B){if(B.length===0)return null;var z=B[0],q=B.pop();if(q!==z){B[0]=q;e:for(var de=0,ve=B.length,V=ve>>>1;de<V;){var X=2*(de+1)-1,fe=B[X],ge=X+1,Te=B[ge];if(0>i(fe,q))ge<ve&&0>i(Te,fe)?(B[de]=Te,B[ge]=q,de=ge):(B[de]=fe,B[X]=q,de=X);else if(ge<ve&&0>i(Te,q))B[de]=Te,B[ge]=q,de=ge;else break e}}return z}function i(B,z){var q=B.sortIndex-z.sortIndex;return q!==0?q:B.id-z.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,l=o.now();t.unstable_now=function(){return o.now()-l}}var u=[],f=[],h=1,m=null,g=3,y=!1,x=!1,S=!1,k=!1,C=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;function R(B){for(var z=n(f);z!==null;){if(z.callback===null)r(f);else if(z.startTime<=B)r(f),z.sortIndex=z.expirationTime,e(u,z);else break;z=n(f)}}function M(B){if(S=!1,R(B),!x)if(n(u)!==null)x=!0,O||(O=!0,K());else{var z=n(f);z!==null&&me(M,z.startTime-B)}}var O=!1,L=-1,P=5,U=-1;function G(){return k?!0:!(t.unstable_now()-U<P)}function oe(){if(k=!1,O){var B=t.unstable_now();U=B;var z=!0;try{e:{x=!1,S&&(S=!1,T(L),L=-1),y=!0;var q=g;try{t:{for(R(B),m=n(u);m!==null&&!(m.expirationTime>B&&G());){var de=m.callback;if(typeof de=="function"){m.callback=null,g=m.priorityLevel;var ve=de(m.expirationTime<=B);if(B=t.unstable_now(),typeof ve=="function"){m.callback=ve,R(B),z=!0;break t}m===n(u)&&r(u),R(B)}else r(u);m=n(u)}if(m!==null)z=!0;else{var V=n(f);V!==null&&me(M,V.startTime-B),z=!1}}break e}finally{m=null,g=q,y=!1}z=void 0}}finally{z?K():O=!1}}}var K;if(typeof _=="function")K=function(){_(oe)};else if(typeof MessageChannel<"u"){var ne=new MessageChannel,re=ne.port2;ne.port1.onmessage=oe,K=function(){re.postMessage(null)}}else K=function(){C(oe,0)};function me(B,z){L=C(function(){B(t.unstable_now())},z)}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(B){B.callback=null},t.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):P=0<B?Math.floor(1e3/B):5},t.unstable_getCurrentPriorityLevel=function(){return g},t.unstable_next=function(B){switch(g){case 1:case 2:case 3:var z=3;break;default:z=g}var q=g;g=z;try{return B()}finally{g=q}},t.unstable_requestPaint=function(){k=!0},t.unstable_runWithPriority=function(B,z){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var q=g;g=B;try{return z()}finally{g=q}},t.unstable_scheduleCallback=function(B,z,q){var de=t.unstable_now();switch(typeof q=="object"&&q!==null?(q=q.delay,q=typeof q=="number"&&0<q?de+q:de):q=de,B){case 1:var ve=-1;break;case 2:ve=250;break;case 5:ve=1073741823;break;case 4:ve=1e4;break;default:ve=5e3}return ve=q+ve,B={id:h++,callback:z,priorityLevel:B,startTime:q,expirationTime:ve,sortIndex:-1},q>de?(B.sortIndex=q,e(f,B),n(u)===null&&B===n(f)&&(S?(T(L),L=-1):S=!0,me(M,q-de))):(B.sortIndex=ve,e(u,B),x||y||(x=!0,O||(O=!0,K()))),B},t.unstable_shouldYield=G,t.unstable_wrapCallback=function(B){var z=g;return function(){var q=g;g=z;try{return B.apply(this,arguments)}finally{g=q}}}})(Uv)),Uv}var QE;function yz(){return QE||(QE=1,Hv.exports=gz()),Hv.exports}var Fv={exports:{}},zn={};var eT;function vz(){if(eT)return zn;eT=1;var t=Dd();function e(u){var f="https://react.dev/errors/"+u;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var h=2;h<arguments.length;h++)f+="&args[]="+encodeURIComponent(arguments[h])}return"Minified React error #"+u+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(e(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},i=Symbol.for("react.portal");function s(u,f,h){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:m==null?null:""+m,children:u,containerInfo:f,implementation:h}}var o=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(u,f){if(u==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return zn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,zn.createPortal=function(u,f){var h=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(e(299));return s(u,f,null,h)},zn.flushSync=function(u){var f=o.T,h=r.p;try{if(o.T=null,r.p=2,u)return u()}finally{o.T=f,r.p=h,r.d.f()}},zn.preconnect=function(u,f){typeof u=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,r.d.C(u,f))},zn.prefetchDNS=function(u){typeof u=="string"&&r.d.D(u)},zn.preinit=function(u,f){if(typeof u=="string"&&f&&typeof f.as=="string"){var h=f.as,m=l(h,f.crossOrigin),g=typeof f.integrity=="string"?f.integrity:void 0,y=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;h==="style"?r.d.S(u,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:m,integrity:g,fetchPriority:y}):h==="script"&&r.d.X(u,{crossOrigin:m,integrity:g,fetchPriority:y,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},zn.preinitModule=function(u,f){if(typeof u=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var h=l(f.as,f.crossOrigin);r.d.M(u,{crossOrigin:h,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&r.d.M(u)},zn.preload=function(u,f){if(typeof u=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var h=f.as,m=l(h,f.crossOrigin);r.d.L(u,h,{crossOrigin:m,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},zn.preloadModule=function(u,f){if(typeof u=="string")if(f){var h=l(f.as,f.crossOrigin);r.d.m(u,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:h,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else r.d.m(u)},zn.requestFormReset=function(u){r.d.r(u)},zn.unstable_batchedUpdates=function(u,f){return u(f)},zn.useFormState=function(u,f,h){return o.H.useFormState(u,f,h)},zn.useFormStatus=function(){return o.H.useHostTransitionStatus()},zn.version="19.2.8",zn}var tT;function pM(){if(tT)return Fv.exports;tT=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Fv.exports=vz(),Fv.exports}var nT;function bz(){if(nT)return Cu;nT=1;var t=yz(),e=Dd(),n=pM();function r(a){var c="https://react.dev/errors/"+a;if(1<arguments.length){c+="?args[]="+encodeURIComponent(arguments[1]);for(var d=2;d<arguments.length;d++)c+="&args[]="+encodeURIComponent(arguments[d])}return"Minified React error #"+a+"; visit "+c+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(a){return!(!a||a.nodeType!==1&&a.nodeType!==9&&a.nodeType!==11)}function s(a){var c=a,d=a;if(a.alternate)for(;c.return;)c=c.return;else{a=c;do c=a,(c.flags&4098)!==0&&(d=c.return),a=c.return;while(a)}return c.tag===3?d:null}function o(a){if(a.tag===13){var c=a.memoizedState;if(c===null&&(a=a.alternate,a!==null&&(c=a.memoizedState)),c!==null)return c.dehydrated}return null}function l(a){if(a.tag===31){var c=a.memoizedState;if(c===null&&(a=a.alternate,a!==null&&(c=a.memoizedState)),c!==null)return c.dehydrated}return null}function u(a){if(s(a)!==a)throw Error(r(188))}function f(a){var c=a.alternate;if(!c){if(c=s(a),c===null)throw Error(r(188));return c!==a?null:a}for(var d=a,p=c;;){var v=d.return;if(v===null)break;var w=v.alternate;if(w===null){if(p=v.return,p!==null){d=p;continue}break}if(v.child===w.child){for(w=v.child;w;){if(w===d)return u(v),a;if(w===p)return u(v),c;w=w.sibling}throw Error(r(188))}if(d.return!==p.return)d=v,p=w;else{for(var E=!1,N=v.child;N;){if(N===d){E=!0,d=v,p=w;break}if(N===p){E=!0,p=v,d=w;break}N=N.sibling}if(!E){for(N=w.child;N;){if(N===d){E=!0,d=w,p=v;break}if(N===p){E=!0,p=w,d=v;break}N=N.sibling}if(!E)throw Error(r(189))}}if(d.alternate!==p)throw Error(r(190))}if(d.tag!==3)throw Error(r(188));return d.stateNode.current===d?a:c}function h(a){var c=a.tag;if(c===5||c===26||c===27||c===6)return a;for(a=a.child;a!==null;){if(c=h(a),c!==null)return c;a=a.sibling}return null}var m=Object.assign,g=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),T=Symbol.for("react.consumer"),_=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),U=Symbol.for("react.activity"),G=Symbol.for("react.memo_cache_sentinel"),oe=Symbol.iterator;function K(a){return a===null||typeof a!="object"?null:(a=oe&&a[oe]||a["@@iterator"],typeof a=="function"?a:null)}var ne=Symbol.for("react.client.reference");function re(a){if(a==null)return null;if(typeof a=="function")return a.$$typeof===ne?null:a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case S:return"Fragment";case C:return"Profiler";case k:return"StrictMode";case M:return"Suspense";case O:return"SuspenseList";case U:return"Activity"}if(typeof a=="object")switch(a.$$typeof){case x:return"Portal";case _:return a.displayName||"Context";case T:return(a._context.displayName||"Context")+".Consumer";case R:var c=a.render;return a=a.displayName,a||(a=c.displayName||c.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case L:return c=a.displayName||null,c!==null?c:re(a.type)||"Memo";case P:c=a._payload,a=a._init;try{return re(a(c))}catch{}}return null}var me=Array.isArray,B=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,z=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q={pending:!1,data:null,method:null,action:null},de=[],ve=-1;function V(a){return{current:a}}function X(a){0>ve||(a.current=de[ve],de[ve]=null,ve--)}function fe(a,c){ve++,de[ve]=a.current,a.current=c}var ge=V(null),Te=V(null),_e=V(null),Le=V(null);function ke(a,c){switch(fe(_e,c),fe(Te,a),fe(ge,null),c.nodeType){case 9:case 11:a=(a=c.documentElement)&&(a=a.namespaceURI)?pE(a):0;break;default:if(a=c.tagName,c=c.namespaceURI)c=pE(c),a=mE(c,a);else switch(a){case"svg":a=1;break;case"math":a=2;break;default:a=0}}X(ge),fe(ge,a)}function se(){X(ge),X(Te),X(_e)}function pe(a){a.memoizedState!==null&&fe(Le,a);var c=ge.current,d=mE(c,a.type);c!==d&&(fe(Te,a),fe(ge,d))}function Me(a){Te.current===a&&(X(ge),X(Te)),Le.current===a&&(X(Le),bu._currentValue=q)}var ze,Fe;function ft(a){if(ze===void 0)try{throw Error()}catch(d){var c=d.stack.trim().match(/\n( *(at )?)/);ze=c&&c[1]||"",Fe=-1<d.stack.indexOf(`
|
|
2
|
-
at`)?" (<anonymous>)":-1<d.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
-
`+ze+a+Fe}var ht=!1;function Jt(a,c){if(!a||ht)return"";ht=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var p={DetermineComponentFrameRoot:function(){try{if(c){var ce=function(){throw Error()};if(Object.defineProperty(ce.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ce,[])}catch(te){var J=te}Reflect.construct(a,[],ce)}else{try{ce.call()}catch(te){J=te}a.call(ce.prototype)}}else{try{throw Error()}catch(te){J=te}(ce=a())&&typeof ce.catch=="function"&&ce.catch(function(){})}}catch(te){if(te&&J&&typeof te.stack=="string")return[te.stack,J.stack]}return[null,null]}};p.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var v=Object.getOwnPropertyDescriptor(p.DetermineComponentFrameRoot,"name");v&&v.configurable&&Object.defineProperty(p.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var w=p.DetermineComponentFrameRoot(),E=w[0],N=w[1];if(E&&N){var $=E.split(`
|
|
4
|
-
`),Y=N.split(`
|
|
5
|
-
`);for(v=p=0;p<$.length&&!$[p].includes("DetermineComponentFrameRoot");)p++;for(;v<Y.length&&!Y[v].includes("DetermineComponentFrameRoot");)v++;if(p===$.length||v===Y.length)for(p=$.length-1,v=Y.length-1;1<=p&&0<=v&&$[p]!==Y[v];)v--;for(;1<=p&&0<=v;p--,v--)if($[p]!==Y[v]){if(p!==1||v!==1)do if(p--,v--,0>v||$[p]!==Y[v]){var ie=`
|
|
6
|
-
`+$[p].replace(" at new "," at ");return a.displayName&&ie.includes("<anonymous>")&&(ie=ie.replace("<anonymous>",a.displayName)),ie}while(1<=p&&0<=v);break}}}finally{ht=!1,Error.prepareStackTrace=d}return(d=a?a.displayName||a.name:"")?ft(d):""}function jn(a,c){switch(a.tag){case 26:case 27:case 5:return ft(a.type);case 16:return ft("Lazy");case 13:return a.child!==c&&c!==null?ft("Suspense Fallback"):ft("Suspense");case 19:return ft("SuspenseList");case 0:case 15:return Jt(a.type,!1);case 11:return Jt(a.type.render,!1);case 1:return Jt(a.type,!0);case 31:return ft("Activity");default:return""}}function un(a){try{var c="",d=null;do c+=jn(a,d),d=a,a=a.return;while(a);return c}catch(p){return`
|
|
7
|
-
Error generating stack: `+p.message+`
|
|
8
|
-
`+p.stack}}var Sn=Object.prototype.hasOwnProperty,dn=t.unstable_scheduleCallback,tr=t.unstable_cancelCallback,Kr=t.unstable_shouldYield,Ar=t.unstable_requestPaint,zt=t.unstable_now,mi=t.unstable_getCurrentPriorityLevel,Zr=t.unstable_ImmediatePriority,Yr=t.unstable_UserBlockingPriority,qn=t.unstable_NormalPriority,ee=t.unstable_LowPriority,le=t.unstable_IdlePriority,I=t.log,D=t.unstable_setDisableYieldValue,j=null,W=null;function Q(a){if(typeof I=="function"&&D(a),W&&typeof W.setStrictMode=="function")try{W.setStrictMode(j,a)}catch{}}var he=Math.clz32?Math.clz32:$e,be=Math.log,Ce=Math.LN2;function $e(a){return a>>>=0,a===0?32:31-(be(a)/Ce|0)|0}var ot=256,$t=262144,nr=4194304;function kn(a){var c=a&42;if(c!==0)return c;switch(a&-a){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return a&261888;case 262144:case 524288:case 1048576:case 2097152:return a&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return a&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return a}}function gi(a,c,d){var p=a.pendingLanes;if(p===0)return 0;var v=0,w=a.suspendedLanes,E=a.pingedLanes;a=a.warmLanes;var N=p&134217727;return N!==0?(p=N&~w,p!==0?v=kn(p):(E&=N,E!==0?v=kn(E):d||(d=N&~a,d!==0&&(v=kn(d))))):(N=p&~w,N!==0?v=kn(N):E!==0?v=kn(E):d||(d=p&~a,d!==0&&(v=kn(d)))),v===0?0:c!==0&&c!==v&&(c&w)===0&&(w=v&-v,d=c&-c,w>=d||w===32&&(d&4194048)!==0)?c:v}function qo(a,c){return(a.pendingLanes&~(a.suspendedLanes&~a.pingedLanes)&c)===0}function Go(a,c){switch(a){case 1:case 2:case 4:case 8:case 64:return c+250;case 16:case 32: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 c+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function tf(){var a=nr;return nr<<=1,(nr&62914560)===0&&(nr=4194304),a}function Ja(a){for(var c=[],d=0;31>d;d++)c.push(a);return c}function Dc(a,c){a.pendingLanes|=c,c!==268435456&&(a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0)}function e2(a,c,d,p,v,w){var E=a.pendingLanes;a.pendingLanes=d,a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0,a.expiredLanes&=d,a.entangledLanes&=d,a.errorRecoveryDisabledLanes&=d,a.shellSuspendCounter=0;var N=a.entanglements,$=a.expirationTimes,Y=a.hiddenUpdates;for(d=E&~d;0<d;){var ie=31-he(d),ce=1<<ie;N[ie]=0,$[ie]=-1;var J=Y[ie];if(J!==null)for(Y[ie]=null,ie=0;ie<J.length;ie++){var te=J[ie];te!==null&&(te.lane&=-536870913)}d&=~ce}p!==0&&YS(a,p,0),w!==0&&v===0&&a.tag!==0&&(a.suspendedLanes|=w&~(E&~c))}function YS(a,c,d){a.pendingLanes|=c,a.suspendedLanes&=~c;var p=31-he(c);a.entangledLanes|=c,a.entanglements[p]=a.entanglements[p]|1073741824|d&261930}function XS(a,c){var d=a.entangledLanes|=c;for(a=a.entanglements;d;){var p=31-he(d),v=1<<p;v&c|a[p]&c&&(a[p]|=c),d&=~v}}function JS(a,c){var d=c&-c;return d=(d&42)!==0?1:_g(d),(d&(a.suspendedLanes|c))!==0?0:d}function _g(a){switch(a){case 2:a=1;break;case 8:a=4;break;case 32:a=16;break;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:a=128;break;case 268435456:a=134217728;break;default:a=0}return a}function Ag(a){return a&=-a,2<a?8<a?(a&134217727)!==0?32:268435456:8:2}function QS(){var a=z.p;return a!==0?a:(a=window.event,a===void 0?32:zE(a.type))}function ek(a,c){var d=z.p;try{return z.p=a,c()}finally{z.p=d}}var Ms=Math.random().toString(36).slice(2),Cn="__reactFiber$"+Ms,rr="__reactProps$"+Ms,Qa="__reactContainer$"+Ms,Rg="__reactEvents$"+Ms,t2="__reactListeners$"+Ms,n2="__reactHandles$"+Ms,tk="__reactResources$"+Ms,Ic="__reactMarker$"+Ms;function Mg(a){delete a[Cn],delete a[rr],delete a[Rg],delete a[t2],delete a[n2]}function el(a){var c=a[Cn];if(c)return c;for(var d=a.parentNode;d;){if(c=d[Qa]||d[Cn]){if(d=c.alternate,c.child!==null||d!==null&&d.child!==null)for(a=SE(a);a!==null;){if(d=a[Cn])return d;a=SE(a)}return c}a=d,d=a.parentNode}return null}function tl(a){if(a=a[Cn]||a[Qa]){var c=a.tag;if(c===5||c===6||c===13||c===31||c===26||c===27||c===3)return a}return null}function Lc(a){var c=a.tag;if(c===5||c===26||c===27||c===6)return a.stateNode;throw Error(r(33))}function nl(a){var c=a[tk];return c||(c=a[tk]={hoistableStyles:new Map,hoistableScripts:new Map}),c}function hn(a){a[Ic]=!0}var nk=new Set,rk={};function Wo(a,c){rl(a,c),rl(a+"Capture",c)}function rl(a,c){for(rk[a]=c,a=0;a<c.length;a++)nk.add(c[a])}var r2=RegExp("^[: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]*$"),ik={},sk={};function i2(a){return Sn.call(sk,a)?!0:Sn.call(ik,a)?!1:r2.test(a)?sk[a]=!0:(ik[a]=!0,!1)}function nf(a,c,d){if(i2(c))if(d===null)a.removeAttribute(c);else{switch(typeof d){case"undefined":case"function":case"symbol":a.removeAttribute(c);return;case"boolean":var p=c.toLowerCase().slice(0,5);if(p!=="data-"&&p!=="aria-"){a.removeAttribute(c);return}}a.setAttribute(c,""+d)}}function rf(a,c,d){if(d===null)a.removeAttribute(c);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":a.removeAttribute(c);return}a.setAttribute(c,""+d)}}function Li(a,c,d,p){if(p===null)a.removeAttribute(d);else{switch(typeof p){case"undefined":case"function":case"symbol":case"boolean":a.removeAttribute(d);return}a.setAttributeNS(c,d,""+p)}}function Rr(a){switch(typeof a){case"bigint":case"boolean":case"number":case"string":case"undefined":return a;case"object":return a;default:return""}}function ok(a){var c=a.type;return(a=a.nodeName)&&a.toLowerCase()==="input"&&(c==="checkbox"||c==="radio")}function s2(a,c,d){var p=Object.getOwnPropertyDescriptor(a.constructor.prototype,c);if(!a.hasOwnProperty(c)&&typeof p<"u"&&typeof p.get=="function"&&typeof p.set=="function"){var v=p.get,w=p.set;return Object.defineProperty(a,c,{configurable:!0,get:function(){return v.call(this)},set:function(E){d=""+E,w.call(this,E)}}),Object.defineProperty(a,c,{enumerable:p.enumerable}),{getValue:function(){return d},setValue:function(E){d=""+E},stopTracking:function(){a._valueTracker=null,delete a[c]}}}}function Ng(a){if(!a._valueTracker){var c=ok(a)?"checked":"value";a._valueTracker=s2(a,c,""+a[c])}}function ak(a){if(!a)return!1;var c=a._valueTracker;if(!c)return!0;var d=c.getValue(),p="";return a&&(p=ok(a)?a.checked?"true":"false":a.value),a=p,a!==d?(c.setValue(a),!0):!1}function sf(a){if(a=a||(typeof document<"u"?document:void 0),typeof a>"u")return null;try{return a.activeElement||a.body}catch{return a.body}}var o2=/[\n"\\]/g;function Mr(a){return a.replace(o2,function(c){return"\\"+c.charCodeAt(0).toString(16)+" "})}function Og(a,c,d,p,v,w,E,N){a.name="",E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"?a.type=E:a.removeAttribute("type"),c!=null?E==="number"?(c===0&&a.value===""||a.value!=c)&&(a.value=""+Rr(c)):a.value!==""+Rr(c)&&(a.value=""+Rr(c)):E!=="submit"&&E!=="reset"||a.removeAttribute("value"),c!=null?Dg(a,E,Rr(c)):d!=null?Dg(a,E,Rr(d)):p!=null&&a.removeAttribute("value"),v==null&&w!=null&&(a.defaultChecked=!!w),v!=null&&(a.checked=v&&typeof v!="function"&&typeof v!="symbol"),N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?a.name=""+Rr(N):a.removeAttribute("name")}function lk(a,c,d,p,v,w,E,N){if(w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(a.type=w),c!=null||d!=null){if(!(w!=="submit"&&w!=="reset"||c!=null)){Ng(a);return}d=d!=null?""+Rr(d):"",c=c!=null?""+Rr(c):d,N||c===a.value||(a.value=c),a.defaultValue=c}p=p??v,p=typeof p!="function"&&typeof p!="symbol"&&!!p,a.checked=N?a.checked:!!p,a.defaultChecked=!!p,E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"&&(a.name=E),Ng(a)}function Dg(a,c,d){c==="number"&&sf(a.ownerDocument)===a||a.defaultValue===""+d||(a.defaultValue=""+d)}function il(a,c,d,p){if(a=a.options,c){c={};for(var v=0;v<d.length;v++)c["$"+d[v]]=!0;for(d=0;d<a.length;d++)v=c.hasOwnProperty("$"+a[d].value),a[d].selected!==v&&(a[d].selected=v),v&&p&&(a[d].defaultSelected=!0)}else{for(d=""+Rr(d),c=null,v=0;v<a.length;v++){if(a[v].value===d){a[v].selected=!0,p&&(a[v].defaultSelected=!0);return}c!==null||a[v].disabled||(c=a[v])}c!==null&&(c.selected=!0)}}function ck(a,c,d){if(c!=null&&(c=""+Rr(c),c!==a.value&&(a.value=c),d==null)){a.defaultValue!==c&&(a.defaultValue=c);return}a.defaultValue=d!=null?""+Rr(d):""}function uk(a,c,d,p){if(c==null){if(p!=null){if(d!=null)throw Error(r(92));if(me(p)){if(1<p.length)throw Error(r(93));p=p[0]}d=p}d==null&&(d=""),c=d}d=Rr(c),a.defaultValue=d,p=a.textContent,p===d&&p!==""&&p!==null&&(a.value=p),Ng(a)}function sl(a,c){if(c){var d=a.firstChild;if(d&&d===a.lastChild&&d.nodeType===3){d.nodeValue=c;return}}a.textContent=c}var a2=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function dk(a,c,d){var p=c.indexOf("--")===0;d==null||typeof d=="boolean"||d===""?p?a.setProperty(c,""):c==="float"?a.cssFloat="":a[c]="":p?a.setProperty(c,d):typeof d!="number"||d===0||a2.has(c)?c==="float"?a.cssFloat=d:a[c]=(""+d).trim():a[c]=d+"px"}function fk(a,c,d){if(c!=null&&typeof c!="object")throw Error(r(62));if(a=a.style,d!=null){for(var p in d)!d.hasOwnProperty(p)||c!=null&&c.hasOwnProperty(p)||(p.indexOf("--")===0?a.setProperty(p,""):p==="float"?a.cssFloat="":a[p]="");for(var v in c)p=c[v],c.hasOwnProperty(v)&&d[v]!==p&&dk(a,v,p)}else for(var w in c)c.hasOwnProperty(w)&&dk(a,w,c[w])}function Ig(a){if(a.indexOf("-")===-1)return!1;switch(a){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 l2=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),c2=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function of(a){return c2.test(""+a)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":a}function ji(){}var Lg=null;function jg(a){return a=a.target||a.srcElement||window,a.correspondingUseElement&&(a=a.correspondingUseElement),a.nodeType===3?a.parentNode:a}var ol=null,al=null;function hk(a){var c=tl(a);if(c&&(a=c.stateNode)){var d=a[rr]||null;e:switch(a=c.stateNode,c.type){case"input":if(Og(a,d.value,d.defaultValue,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name),c=d.name,d.type==="radio"&&c!=null){for(d=a;d.parentNode;)d=d.parentNode;for(d=d.querySelectorAll('input[name="'+Mr(""+c)+'"][type="radio"]'),c=0;c<d.length;c++){var p=d[c];if(p!==a&&p.form===a.form){var v=p[rr]||null;if(!v)throw Error(r(90));Og(p,v.value,v.defaultValue,v.defaultValue,v.checked,v.defaultChecked,v.type,v.name)}}for(c=0;c<d.length;c++)p=d[c],p.form===a.form&&ak(p)}break e;case"textarea":ck(a,d.value,d.defaultValue);break e;case"select":c=d.value,c!=null&&il(a,!!d.multiple,c,!1)}}}var Pg=!1;function pk(a,c,d){if(Pg)return a(c,d);Pg=!0;try{var p=a(c);return p}finally{if(Pg=!1,(ol!==null||al!==null)&&(Wf(),ol&&(c=ol,a=al,al=ol=null,hk(c),a)))for(c=0;c<a.length;c++)hk(a[c])}}function jc(a,c){var d=a.stateNode;if(d===null)return null;var p=d[rr]||null;if(p===null)return null;d=p[c];e:switch(c){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(p=!p.disabled)||(a=a.type,p=!(a==="button"||a==="input"||a==="select"||a==="textarea")),a=!p;break e;default:a=!1}if(a)return null;if(d&&typeof d!="function")throw Error(r(231,c,typeof d));return d}var Pi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),zg=!1;if(Pi)try{var Pc={};Object.defineProperty(Pc,"passive",{get:function(){zg=!0}}),window.addEventListener("test",Pc,Pc),window.removeEventListener("test",Pc,Pc)}catch{zg=!1}var Ns=null,$g=null,af=null;function mk(){if(af)return af;var a,c=$g,d=c.length,p,v="value"in Ns?Ns.value:Ns.textContent,w=v.length;for(a=0;a<d&&c[a]===v[a];a++);var E=d-a;for(p=1;p<=E&&c[d-p]===v[w-p];p++);return af=v.slice(a,1<p?1-p:void 0)}function lf(a){var c=a.keyCode;return"charCode"in a?(a=a.charCode,a===0&&c===13&&(a=13)):a=c,a===10&&(a=13),32<=a||a===13?a:0}function cf(){return!0}function gk(){return!1}function ir(a){function c(d,p,v,w,E){this._reactName=d,this._targetInst=v,this.type=p,this.nativeEvent=w,this.target=E,this.currentTarget=null;for(var N in a)a.hasOwnProperty(N)&&(d=a[N],this[N]=d?d(w):w[N]);return this.isDefaultPrevented=(w.defaultPrevented!=null?w.defaultPrevented:w.returnValue===!1)?cf:gk,this.isPropagationStopped=gk,this}return m(c.prototype,{preventDefault:function(){this.defaultPrevented=!0;var d=this.nativeEvent;d&&(d.preventDefault?d.preventDefault():typeof d.returnValue!="unknown"&&(d.returnValue=!1),this.isDefaultPrevented=cf)},stopPropagation:function(){var d=this.nativeEvent;d&&(d.stopPropagation?d.stopPropagation():typeof d.cancelBubble!="unknown"&&(d.cancelBubble=!0),this.isPropagationStopped=cf)},persist:function(){},isPersistent:cf}),c}var Ko={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(a){return a.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},uf=ir(Ko),zc=m({},Ko,{view:0,detail:0}),u2=ir(zc),Bg,Vg,$c,df=m({},zc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ug,button:0,buttons:0,relatedTarget:function(a){return a.relatedTarget===void 0?a.fromElement===a.srcElement?a.toElement:a.fromElement:a.relatedTarget},movementX:function(a){return"movementX"in a?a.movementX:(a!==$c&&($c&&a.type==="mousemove"?(Bg=a.screenX-$c.screenX,Vg=a.screenY-$c.screenY):Vg=Bg=0,$c=a),Bg)},movementY:function(a){return"movementY"in a?a.movementY:Vg}}),yk=ir(df),d2=m({},df,{dataTransfer:0}),f2=ir(d2),h2=m({},zc,{relatedTarget:0}),Hg=ir(h2),p2=m({},Ko,{animationName:0,elapsedTime:0,pseudoElement:0}),m2=ir(p2),g2=m({},Ko,{clipboardData:function(a){return"clipboardData"in a?a.clipboardData:window.clipboardData}}),y2=ir(g2),v2=m({},Ko,{data:0}),vk=ir(v2),b2={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},x2={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"},w2={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function S2(a){var c=this.nativeEvent;return c.getModifierState?c.getModifierState(a):(a=w2[a])?!!c[a]:!1}function Ug(){return S2}var k2=m({},zc,{key:function(a){if(a.key){var c=b2[a.key]||a.key;if(c!=="Unidentified")return c}return a.type==="keypress"?(a=lf(a),a===13?"Enter":String.fromCharCode(a)):a.type==="keydown"||a.type==="keyup"?x2[a.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ug,charCode:function(a){return a.type==="keypress"?lf(a):0},keyCode:function(a){return a.type==="keydown"||a.type==="keyup"?a.keyCode:0},which:function(a){return a.type==="keypress"?lf(a):a.type==="keydown"||a.type==="keyup"?a.keyCode:0}}),C2=ir(k2),E2=m({},df,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),bk=ir(E2),T2=m({},zc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ug}),_2=ir(T2),A2=m({},Ko,{propertyName:0,elapsedTime:0,pseudoElement:0}),R2=ir(A2),M2=m({},df,{deltaX:function(a){return"deltaX"in a?a.deltaX:"wheelDeltaX"in a?-a.wheelDeltaX:0},deltaY:function(a){return"deltaY"in a?a.deltaY:"wheelDeltaY"in a?-a.wheelDeltaY:"wheelDelta"in a?-a.wheelDelta:0},deltaZ:0,deltaMode:0}),N2=ir(M2),O2=m({},Ko,{newState:0,oldState:0}),D2=ir(O2),I2=[9,13,27,32],Fg=Pi&&"CompositionEvent"in window,Bc=null;Pi&&"documentMode"in document&&(Bc=document.documentMode);var L2=Pi&&"TextEvent"in window&&!Bc,xk=Pi&&(!Fg||Bc&&8<Bc&&11>=Bc),wk=" ",Sk=!1;function kk(a,c){switch(a){case"keyup":return I2.indexOf(c.keyCode)!==-1;case"keydown":return c.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ck(a){return a=a.detail,typeof a=="object"&&"data"in a?a.data:null}var ll=!1;function j2(a,c){switch(a){case"compositionend":return Ck(c);case"keypress":return c.which!==32?null:(Sk=!0,wk);case"textInput":return a=c.data,a===wk&&Sk?null:a;default:return null}}function P2(a,c){if(ll)return a==="compositionend"||!Fg&&kk(a,c)?(a=mk(),af=$g=Ns=null,ll=!1,a):null;switch(a){case"paste":return null;case"keypress":if(!(c.ctrlKey||c.altKey||c.metaKey)||c.ctrlKey&&c.altKey){if(c.char&&1<c.char.length)return c.char;if(c.which)return String.fromCharCode(c.which)}return null;case"compositionend":return xk&&c.locale!=="ko"?null:c.data;default:return null}}var z2={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 Ek(a){var c=a&&a.nodeName&&a.nodeName.toLowerCase();return c==="input"?!!z2[a.type]:c==="textarea"}function Tk(a,c,d,p){ol?al?al.push(p):al=[p]:ol=p,c=eh(c,"onChange"),0<c.length&&(d=new uf("onChange","change",null,d,p),a.push({event:d,listeners:c}))}var Vc=null,Hc=null;function $2(a){lE(a,0)}function ff(a){var c=Lc(a);if(ak(c))return a}function _k(a,c){if(a==="change")return c}var Ak=!1;if(Pi){var qg;if(Pi){var Gg="oninput"in document;if(!Gg){var Rk=document.createElement("div");Rk.setAttribute("oninput","return;"),Gg=typeof Rk.oninput=="function"}qg=Gg}else qg=!1;Ak=qg&&(!document.documentMode||9<document.documentMode)}function Mk(){Vc&&(Vc.detachEvent("onpropertychange",Nk),Hc=Vc=null)}function Nk(a){if(a.propertyName==="value"&&ff(Hc)){var c=[];Tk(c,Hc,a,jg(a)),pk($2,c)}}function B2(a,c,d){a==="focusin"?(Mk(),Vc=c,Hc=d,Vc.attachEvent("onpropertychange",Nk)):a==="focusout"&&Mk()}function V2(a){if(a==="selectionchange"||a==="keyup"||a==="keydown")return ff(Hc)}function H2(a,c){if(a==="click")return ff(c)}function U2(a,c){if(a==="input"||a==="change")return ff(c)}function F2(a,c){return a===c&&(a!==0||1/a===1/c)||a!==a&&c!==c}var hr=typeof Object.is=="function"?Object.is:F2;function Uc(a,c){if(hr(a,c))return!0;if(typeof a!="object"||a===null||typeof c!="object"||c===null)return!1;var d=Object.keys(a),p=Object.keys(c);if(d.length!==p.length)return!1;for(p=0;p<d.length;p++){var v=d[p];if(!Sn.call(c,v)||!hr(a[v],c[v]))return!1}return!0}function Ok(a){for(;a&&a.firstChild;)a=a.firstChild;return a}function Dk(a,c){var d=Ok(a);a=0;for(var p;d;){if(d.nodeType===3){if(p=a+d.textContent.length,a<=c&&p>=c)return{node:d,offset:c-a};a=p}e:{for(;d;){if(d.nextSibling){d=d.nextSibling;break e}d=d.parentNode}d=void 0}d=Ok(d)}}function Ik(a,c){return a&&c?a===c?!0:a&&a.nodeType===3?!1:c&&c.nodeType===3?Ik(a,c.parentNode):"contains"in a?a.contains(c):a.compareDocumentPosition?!!(a.compareDocumentPosition(c)&16):!1:!1}function Lk(a){a=a!=null&&a.ownerDocument!=null&&a.ownerDocument.defaultView!=null?a.ownerDocument.defaultView:window;for(var c=sf(a.document);c instanceof a.HTMLIFrameElement;){try{var d=typeof c.contentWindow.location.href=="string"}catch{d=!1}if(d)a=c.contentWindow;else break;c=sf(a.document)}return c}function Wg(a){var c=a&&a.nodeName&&a.nodeName.toLowerCase();return c&&(c==="input"&&(a.type==="text"||a.type==="search"||a.type==="tel"||a.type==="url"||a.type==="password")||c==="textarea"||a.contentEditable==="true")}var q2=Pi&&"documentMode"in document&&11>=document.documentMode,cl=null,Kg=null,Fc=null,Zg=!1;function jk(a,c,d){var p=d.window===d?d.document:d.nodeType===9?d:d.ownerDocument;Zg||cl==null||cl!==sf(p)||(p=cl,"selectionStart"in p&&Wg(p)?p={start:p.selectionStart,end:p.selectionEnd}:(p=(p.ownerDocument&&p.ownerDocument.defaultView||window).getSelection(),p={anchorNode:p.anchorNode,anchorOffset:p.anchorOffset,focusNode:p.focusNode,focusOffset:p.focusOffset}),Fc&&Uc(Fc,p)||(Fc=p,p=eh(Kg,"onSelect"),0<p.length&&(c=new uf("onSelect","select",null,c,d),a.push({event:c,listeners:p}),c.target=cl)))}function Zo(a,c){var d={};return d[a.toLowerCase()]=c.toLowerCase(),d["Webkit"+a]="webkit"+c,d["Moz"+a]="moz"+c,d}var ul={animationend:Zo("Animation","AnimationEnd"),animationiteration:Zo("Animation","AnimationIteration"),animationstart:Zo("Animation","AnimationStart"),transitionrun:Zo("Transition","TransitionRun"),transitionstart:Zo("Transition","TransitionStart"),transitioncancel:Zo("Transition","TransitionCancel"),transitionend:Zo("Transition","TransitionEnd")},Yg={},Pk={};Pi&&(Pk=document.createElement("div").style,"AnimationEvent"in window||(delete ul.animationend.animation,delete ul.animationiteration.animation,delete ul.animationstart.animation),"TransitionEvent"in window||delete ul.transitionend.transition);function Yo(a){if(Yg[a])return Yg[a];if(!ul[a])return a;var c=ul[a],d;for(d in c)if(c.hasOwnProperty(d)&&d in Pk)return Yg[a]=c[d];return a}var zk=Yo("animationend"),$k=Yo("animationiteration"),Bk=Yo("animationstart"),G2=Yo("transitionrun"),W2=Yo("transitionstart"),K2=Yo("transitioncancel"),Vk=Yo("transitionend"),Hk=new Map,Xg="abort auxClick beforeToggle 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(" ");Xg.push("scrollEnd");function Xr(a,c){Hk.set(a,c),Wo(c,[a])}var hf=typeof reportError=="function"?reportError:function(a){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var c=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof a=="object"&&a!==null&&typeof a.message=="string"?String(a.message):String(a),error:a});if(!window.dispatchEvent(c))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",a);return}console.error(a)},Nr=[],dl=0,Jg=0;function pf(){for(var a=dl,c=Jg=dl=0;c<a;){var d=Nr[c];Nr[c++]=null;var p=Nr[c];Nr[c++]=null;var v=Nr[c];Nr[c++]=null;var w=Nr[c];if(Nr[c++]=null,p!==null&&v!==null){var E=p.pending;E===null?v.next=v:(v.next=E.next,E.next=v),p.pending=v}w!==0&&Uk(d,v,w)}}function mf(a,c,d,p){Nr[dl++]=a,Nr[dl++]=c,Nr[dl++]=d,Nr[dl++]=p,Jg|=p,a.lanes|=p,a=a.alternate,a!==null&&(a.lanes|=p)}function Qg(a,c,d,p){return mf(a,c,d,p),gf(a)}function Xo(a,c){return mf(a,null,null,c),gf(a)}function Uk(a,c,d){a.lanes|=d;var p=a.alternate;p!==null&&(p.lanes|=d);for(var v=!1,w=a.return;w!==null;)w.childLanes|=d,p=w.alternate,p!==null&&(p.childLanes|=d),w.tag===22&&(a=w.stateNode,a===null||a._visibility&1||(v=!0)),a=w,w=w.return;return a.tag===3?(w=a.stateNode,v&&c!==null&&(v=31-he(d),a=w.hiddenUpdates,p=a[v],p===null?a[v]=[c]:p.push(c),c.lane=d|536870912),w):null}function gf(a){if(50<fu)throw fu=0,lv=null,Error(r(185));for(var c=a.return;c!==null;)a=c,c=a.return;return a.tag===3?a.stateNode:null}var fl={};function Z2(a,c,d,p){this.tag=a,this.key=d,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=c,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=p,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function pr(a,c,d,p){return new Z2(a,c,d,p)}function ey(a){return a=a.prototype,!(!a||!a.isReactComponent)}function zi(a,c){var d=a.alternate;return d===null?(d=pr(a.tag,c,a.key,a.mode),d.elementType=a.elementType,d.type=a.type,d.stateNode=a.stateNode,d.alternate=a,a.alternate=d):(d.pendingProps=c,d.type=a.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=a.flags&65011712,d.childLanes=a.childLanes,d.lanes=a.lanes,d.child=a.child,d.memoizedProps=a.memoizedProps,d.memoizedState=a.memoizedState,d.updateQueue=a.updateQueue,c=a.dependencies,d.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext},d.sibling=a.sibling,d.index=a.index,d.ref=a.ref,d.refCleanup=a.refCleanup,d}function Fk(a,c){a.flags&=65011714;var d=a.alternate;return d===null?(a.childLanes=0,a.lanes=c,a.child=null,a.subtreeFlags=0,a.memoizedProps=null,a.memoizedState=null,a.updateQueue=null,a.dependencies=null,a.stateNode=null):(a.childLanes=d.childLanes,a.lanes=d.lanes,a.child=d.child,a.subtreeFlags=0,a.deletions=null,a.memoizedProps=d.memoizedProps,a.memoizedState=d.memoizedState,a.updateQueue=d.updateQueue,a.type=d.type,c=d.dependencies,a.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext}),a}function yf(a,c,d,p,v,w){var E=0;if(p=a,typeof a=="function")ey(a)&&(E=1);else if(typeof a=="string")E=ez(a,d,ge.current)?26:a==="html"||a==="head"||a==="body"?27:5;else e:switch(a){case U:return a=pr(31,d,c,v),a.elementType=U,a.lanes=w,a;case S:return Jo(d.children,v,w,c);case k:E=8,v|=24;break;case C:return a=pr(12,d,c,v|2),a.elementType=C,a.lanes=w,a;case M:return a=pr(13,d,c,v),a.elementType=M,a.lanes=w,a;case O:return a=pr(19,d,c,v),a.elementType=O,a.lanes=w,a;default:if(typeof a=="object"&&a!==null)switch(a.$$typeof){case _:E=10;break e;case T:E=9;break e;case R:E=11;break e;case L:E=14;break e;case P:E=16,p=null;break e}E=29,d=Error(r(130,a===null?"null":typeof a,"")),p=null}return c=pr(E,d,c,v),c.elementType=a,c.type=p,c.lanes=w,c}function Jo(a,c,d,p){return a=pr(7,a,p,c),a.lanes=d,a}function ty(a,c,d){return a=pr(6,a,null,c),a.lanes=d,a}function qk(a){var c=pr(18,null,null,0);return c.stateNode=a,c}function ny(a,c,d){return c=pr(4,a.children!==null?a.children:[],a.key,c),c.lanes=d,c.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation},c}var Gk=new WeakMap;function Or(a,c){if(typeof a=="object"&&a!==null){var d=Gk.get(a);return d!==void 0?d:(c={value:a,source:c,stack:un(c)},Gk.set(a,c),c)}return{value:a,source:c,stack:un(c)}}var hl=[],pl=0,vf=null,qc=0,Dr=[],Ir=0,Os=null,yi=1,vi="";function $i(a,c){hl[pl++]=qc,hl[pl++]=vf,vf=a,qc=c}function Wk(a,c,d){Dr[Ir++]=yi,Dr[Ir++]=vi,Dr[Ir++]=Os,Os=a;var p=yi;a=vi;var v=32-he(p)-1;p&=~(1<<v),d+=1;var w=32-he(c)+v;if(30<w){var E=v-v%5;w=(p&(1<<E)-1).toString(32),p>>=E,v-=E,yi=1<<32-he(c)+v|d<<v|p,vi=w+a}else yi=1<<w|d<<v|p,vi=a}function ry(a){a.return!==null&&($i(a,1),Wk(a,1,0))}function iy(a){for(;a===vf;)vf=hl[--pl],hl[pl]=null,qc=hl[--pl],hl[pl]=null;for(;a===Os;)Os=Dr[--Ir],Dr[Ir]=null,vi=Dr[--Ir],Dr[Ir]=null,yi=Dr[--Ir],Dr[Ir]=null}function Kk(a,c){Dr[Ir++]=yi,Dr[Ir++]=vi,Dr[Ir++]=Os,yi=c.id,vi=c.overflow,Os=a}var En=null,Ot=null,it=!1,Ds=null,Lr=!1,sy=Error(r(519));function Is(a){var c=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Gc(Or(c,a)),sy}function Zk(a){var c=a.stateNode,d=a.type,p=a.memoizedProps;switch(c[Cn]=a,c[rr]=p,d){case"dialog":tt("cancel",c),tt("close",c);break;case"iframe":case"object":case"embed":tt("load",c);break;case"video":case"audio":for(d=0;d<pu.length;d++)tt(pu[d],c);break;case"source":tt("error",c);break;case"img":case"image":case"link":tt("error",c),tt("load",c);break;case"details":tt("toggle",c);break;case"input":tt("invalid",c),lk(c,p.value,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name,!0);break;case"select":tt("invalid",c);break;case"textarea":tt("invalid",c),uk(c,p.value,p.defaultValue,p.children)}d=p.children,typeof d!="string"&&typeof d!="number"&&typeof d!="bigint"||c.textContent===""+d||p.suppressHydrationWarning===!0||fE(c.textContent,d)?(p.popover!=null&&(tt("beforetoggle",c),tt("toggle",c)),p.onScroll!=null&&tt("scroll",c),p.onScrollEnd!=null&&tt("scrollend",c),p.onClick!=null&&(c.onclick=ji),c=!0):c=!1,c||Is(a,!0)}function Yk(a){for(En=a.return;En;)switch(En.tag){case 5:case 31:case 13:Lr=!1;return;case 27:case 3:Lr=!0;return;default:En=En.return}}function ml(a){if(a!==En)return!1;if(!it)return Yk(a),it=!0,!1;var c=a.tag,d;if((d=c!==3&&c!==27)&&((d=c===5)&&(d=a.type,d=!(d!=="form"&&d!=="button")||kv(a.type,a.memoizedProps)),d=!d),d&&Ot&&Is(a),Yk(a),c===13){if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(r(317));Ot=wE(a)}else if(c===31){if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(r(317));Ot=wE(a)}else c===27?(c=Ot,Ks(a.type)?(a=Av,Av=null,Ot=a):Ot=c):Ot=En?Pr(a.stateNode.nextSibling):null;return!0}function Qo(){Ot=En=null,it=!1}function oy(){var a=Ds;return a!==null&&(lr===null?lr=a:lr.push.apply(lr,a),Ds=null),a}function Gc(a){Ds===null?Ds=[a]:Ds.push(a)}var ay=V(null),ea=null,Bi=null;function Ls(a,c,d){fe(ay,c._currentValue),c._currentValue=d}function Vi(a){a._currentValue=ay.current,X(ay)}function ly(a,c,d){for(;a!==null;){var p=a.alternate;if((a.childLanes&c)!==c?(a.childLanes|=c,p!==null&&(p.childLanes|=c)):p!==null&&(p.childLanes&c)!==c&&(p.childLanes|=c),a===d)break;a=a.return}}function cy(a,c,d,p){var v=a.child;for(v!==null&&(v.return=a);v!==null;){var w=v.dependencies;if(w!==null){var E=v.child;w=w.firstContext;e:for(;w!==null;){var N=w;w=v;for(var $=0;$<c.length;$++)if(N.context===c[$]){w.lanes|=d,N=w.alternate,N!==null&&(N.lanes|=d),ly(w.return,d,a),p||(E=null);break e}w=N.next}}else if(v.tag===18){if(E=v.return,E===null)throw Error(r(341));E.lanes|=d,w=E.alternate,w!==null&&(w.lanes|=d),ly(E,d,a),E=null}else E=v.child;if(E!==null)E.return=v;else for(E=v;E!==null;){if(E===a){E=null;break}if(v=E.sibling,v!==null){v.return=E.return,E=v;break}E=E.return}v=E}}function gl(a,c,d,p){a=null;for(var v=c,w=!1;v!==null;){if(!w){if((v.flags&524288)!==0)w=!0;else if((v.flags&262144)!==0)break}if(v.tag===10){var E=v.alternate;if(E===null)throw Error(r(387));if(E=E.memoizedProps,E!==null){var N=v.type;hr(v.pendingProps.value,E.value)||(a!==null?a.push(N):a=[N])}}else if(v===Le.current){if(E=v.alternate,E===null)throw Error(r(387));E.memoizedState.memoizedState!==v.memoizedState.memoizedState&&(a!==null?a.push(bu):a=[bu])}v=v.return}a!==null&&cy(c,a,d,p),c.flags|=262144}function bf(a){for(a=a.firstContext;a!==null;){if(!hr(a.context._currentValue,a.memoizedValue))return!0;a=a.next}return!1}function ta(a){ea=a,Bi=null,a=a.dependencies,a!==null&&(a.firstContext=null)}function Tn(a){return Xk(ea,a)}function xf(a,c){return ea===null&&ta(a),Xk(a,c)}function Xk(a,c){var d=c._currentValue;if(c={context:c,memoizedValue:d,next:null},Bi===null){if(a===null)throw Error(r(308));Bi=c,a.dependencies={lanes:0,firstContext:c},a.flags|=524288}else Bi=Bi.next=c;return d}var Y2=typeof AbortController<"u"?AbortController:function(){var a=[],c=this.signal={aborted:!1,addEventListener:function(d,p){a.push(p)}};this.abort=function(){c.aborted=!0,a.forEach(function(d){return d()})}},X2=t.unstable_scheduleCallback,J2=t.unstable_NormalPriority,Qt={$$typeof:_,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function uy(){return{controller:new Y2,data:new Map,refCount:0}}function Wc(a){a.refCount--,a.refCount===0&&X2(J2,function(){a.controller.abort()})}var Kc=null,dy=0,yl=0,vl=null;function Q2(a,c){if(Kc===null){var d=Kc=[];dy=0,yl=pv(),vl={status:"pending",value:void 0,then:function(p){d.push(p)}}}return dy++,c.then(Jk,Jk),c}function Jk(){if(--dy===0&&Kc!==null){vl!==null&&(vl.status="fulfilled");var a=Kc;Kc=null,yl=0,vl=null;for(var c=0;c<a.length;c++)(0,a[c])()}}function eP(a,c){var d=[],p={status:"pending",value:null,reason:null,then:function(v){d.push(v)}};return a.then(function(){p.status="fulfilled",p.value=c;for(var v=0;v<d.length;v++)(0,d[v])(c)},function(v){for(p.status="rejected",p.reason=v,v=0;v<d.length;v++)(0,d[v])(void 0)}),p}var Qk=B.S;B.S=function(a,c){j1=zt(),typeof c=="object"&&c!==null&&typeof c.then=="function"&&Q2(a,c),Qk!==null&&Qk(a,c)};var na=V(null);function fy(){var a=na.current;return a!==null?a:Tt.pooledCache}function wf(a,c){c===null?fe(na,na.current):fe(na,c.pool)}function eC(){var a=fy();return a===null?null:{parent:Qt._currentValue,pool:a}}var bl=Error(r(460)),hy=Error(r(474)),Sf=Error(r(542)),kf={then:function(){}};function tC(a){return a=a.status,a==="fulfilled"||a==="rejected"}function nC(a,c,d){switch(d=a[d],d===void 0?a.push(c):d!==c&&(c.then(ji,ji),c=d),c.status){case"fulfilled":return c.value;case"rejected":throw a=c.reason,iC(a),a;default:if(typeof c.status=="string")c.then(ji,ji);else{if(a=Tt,a!==null&&100<a.shellSuspendCounter)throw Error(r(482));a=c,a.status="pending",a.then(function(p){if(c.status==="pending"){var v=c;v.status="fulfilled",v.value=p}},function(p){if(c.status==="pending"){var v=c;v.status="rejected",v.reason=p}})}switch(c.status){case"fulfilled":return c.value;case"rejected":throw a=c.reason,iC(a),a}throw ia=c,bl}}function ra(a){try{var c=a._init;return c(a._payload)}catch(d){throw d!==null&&typeof d=="object"&&typeof d.then=="function"?(ia=d,bl):d}}var ia=null;function rC(){if(ia===null)throw Error(r(459));var a=ia;return ia=null,a}function iC(a){if(a===bl||a===Sf)throw Error(r(483))}var xl=null,Zc=0;function Cf(a){var c=Zc;return Zc+=1,xl===null&&(xl=[]),nC(xl,a,c)}function Yc(a,c){c=c.props.ref,a.ref=c!==void 0?c:null}function Ef(a,c){throw c.$$typeof===g?Error(r(525)):(a=Object.prototype.toString.call(c),Error(r(31,a==="[object Object]"?"object with keys {"+Object.keys(c).join(", ")+"}":a)))}function sC(a){function c(F,H){if(a){var Z=F.deletions;Z===null?(F.deletions=[H],F.flags|=16):Z.push(H)}}function d(F,H){if(!a)return null;for(;H!==null;)c(F,H),H=H.sibling;return null}function p(F){for(var H=new Map;F!==null;)F.key!==null?H.set(F.key,F):H.set(F.index,F),F=F.sibling;return H}function v(F,H){return F=zi(F,H),F.index=0,F.sibling=null,F}function w(F,H,Z){return F.index=Z,a?(Z=F.alternate,Z!==null?(Z=Z.index,Z<H?(F.flags|=67108866,H):Z):(F.flags|=67108866,H)):(F.flags|=1048576,H)}function E(F){return a&&F.alternate===null&&(F.flags|=67108866),F}function N(F,H,Z,ae){return H===null||H.tag!==6?(H=ty(Z,F.mode,ae),H.return=F,H):(H=v(H,Z),H.return=F,H)}function $(F,H,Z,ae){var je=Z.type;return je===S?ie(F,H,Z.props.children,ae,Z.key):H!==null&&(H.elementType===je||typeof je=="object"&&je!==null&&je.$$typeof===P&&ra(je)===H.type)?(H=v(H,Z.props),Yc(H,Z),H.return=F,H):(H=yf(Z.type,Z.key,Z.props,null,F.mode,ae),Yc(H,Z),H.return=F,H)}function Y(F,H,Z,ae){return H===null||H.tag!==4||H.stateNode.containerInfo!==Z.containerInfo||H.stateNode.implementation!==Z.implementation?(H=ny(Z,F.mode,ae),H.return=F,H):(H=v(H,Z.children||[]),H.return=F,H)}function ie(F,H,Z,ae,je){return H===null||H.tag!==7?(H=Jo(Z,F.mode,ae,je),H.return=F,H):(H=v(H,Z),H.return=F,H)}function ce(F,H,Z){if(typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint")return H=ty(""+H,F.mode,Z),H.return=F,H;if(typeof H=="object"&&H!==null){switch(H.$$typeof){case y:return Z=yf(H.type,H.key,H.props,null,F.mode,Z),Yc(Z,H),Z.return=F,Z;case x:return H=ny(H,F.mode,Z),H.return=F,H;case P:return H=ra(H),ce(F,H,Z)}if(me(H)||K(H))return H=Jo(H,F.mode,Z,null),H.return=F,H;if(typeof H.then=="function")return ce(F,Cf(H),Z);if(H.$$typeof===_)return ce(F,xf(F,H),Z);Ef(F,H)}return null}function J(F,H,Z,ae){var je=H!==null?H.key:null;if(typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint")return je!==null?null:N(F,H,""+Z,ae);if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case y:return Z.key===je?$(F,H,Z,ae):null;case x:return Z.key===je?Y(F,H,Z,ae):null;case P:return Z=ra(Z),J(F,H,Z,ae)}if(me(Z)||K(Z))return je!==null?null:ie(F,H,Z,ae,null);if(typeof Z.then=="function")return J(F,H,Cf(Z),ae);if(Z.$$typeof===_)return J(F,H,xf(F,Z),ae);Ef(F,Z)}return null}function te(F,H,Z,ae,je){if(typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint")return F=F.get(Z)||null,N(H,F,""+ae,je);if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case y:return F=F.get(ae.key===null?Z:ae.key)||null,$(H,F,ae,je);case x:return F=F.get(ae.key===null?Z:ae.key)||null,Y(H,F,ae,je);case P:return ae=ra(ae),te(F,H,Z,ae,je)}if(me(ae)||K(ae))return F=F.get(Z)||null,ie(H,F,ae,je,null);if(typeof ae.then=="function")return te(F,H,Z,Cf(ae),je);if(ae.$$typeof===_)return te(F,H,Z,xf(H,ae),je);Ef(H,ae)}return null}function Ae(F,H,Z,ae){for(var je=null,lt=null,Oe=H,Xe=H=0,rt=null;Oe!==null&&Xe<Z.length;Xe++){Oe.index>Xe?(rt=Oe,Oe=null):rt=Oe.sibling;var ct=J(F,Oe,Z[Xe],ae);if(ct===null){Oe===null&&(Oe=rt);break}a&&Oe&&ct.alternate===null&&c(F,Oe),H=w(ct,H,Xe),lt===null?je=ct:lt.sibling=ct,lt=ct,Oe=rt}if(Xe===Z.length)return d(F,Oe),it&&$i(F,Xe),je;if(Oe===null){for(;Xe<Z.length;Xe++)Oe=ce(F,Z[Xe],ae),Oe!==null&&(H=w(Oe,H,Xe),lt===null?je=Oe:lt.sibling=Oe,lt=Oe);return it&&$i(F,Xe),je}for(Oe=p(Oe);Xe<Z.length;Xe++)rt=te(Oe,F,Xe,Z[Xe],ae),rt!==null&&(a&&rt.alternate!==null&&Oe.delete(rt.key===null?Xe:rt.key),H=w(rt,H,Xe),lt===null?je=rt:lt.sibling=rt,lt=rt);return a&&Oe.forEach(function(Qs){return c(F,Qs)}),it&&$i(F,Xe),je}function Be(F,H,Z,ae){if(Z==null)throw Error(r(151));for(var je=null,lt=null,Oe=H,Xe=H=0,rt=null,ct=Z.next();Oe!==null&&!ct.done;Xe++,ct=Z.next()){Oe.index>Xe?(rt=Oe,Oe=null):rt=Oe.sibling;var Qs=J(F,Oe,ct.value,ae);if(Qs===null){Oe===null&&(Oe=rt);break}a&&Oe&&Qs.alternate===null&&c(F,Oe),H=w(Qs,H,Xe),lt===null?je=Qs:lt.sibling=Qs,lt=Qs,Oe=rt}if(ct.done)return d(F,Oe),it&&$i(F,Xe),je;if(Oe===null){for(;!ct.done;Xe++,ct=Z.next())ct=ce(F,ct.value,ae),ct!==null&&(H=w(ct,H,Xe),lt===null?je=ct:lt.sibling=ct,lt=ct);return it&&$i(F,Xe),je}for(Oe=p(Oe);!ct.done;Xe++,ct=Z.next())ct=te(Oe,F,Xe,ct.value,ae),ct!==null&&(a&&ct.alternate!==null&&Oe.delete(ct.key===null?Xe:ct.key),H=w(ct,H,Xe),lt===null?je=ct:lt.sibling=ct,lt=ct);return a&&Oe.forEach(function(dz){return c(F,dz)}),it&&$i(F,Xe),je}function kt(F,H,Z,ae){if(typeof Z=="object"&&Z!==null&&Z.type===S&&Z.key===null&&(Z=Z.props.children),typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case y:e:{for(var je=Z.key;H!==null;){if(H.key===je){if(je=Z.type,je===S){if(H.tag===7){d(F,H.sibling),ae=v(H,Z.props.children),ae.return=F,F=ae;break e}}else if(H.elementType===je||typeof je=="object"&&je!==null&&je.$$typeof===P&&ra(je)===H.type){d(F,H.sibling),ae=v(H,Z.props),Yc(ae,Z),ae.return=F,F=ae;break e}d(F,H);break}else c(F,H);H=H.sibling}Z.type===S?(ae=Jo(Z.props.children,F.mode,ae,Z.key),ae.return=F,F=ae):(ae=yf(Z.type,Z.key,Z.props,null,F.mode,ae),Yc(ae,Z),ae.return=F,F=ae)}return E(F);case x:e:{for(je=Z.key;H!==null;){if(H.key===je)if(H.tag===4&&H.stateNode.containerInfo===Z.containerInfo&&H.stateNode.implementation===Z.implementation){d(F,H.sibling),ae=v(H,Z.children||[]),ae.return=F,F=ae;break e}else{d(F,H);break}else c(F,H);H=H.sibling}ae=ny(Z,F.mode,ae),ae.return=F,F=ae}return E(F);case P:return Z=ra(Z),kt(F,H,Z,ae)}if(me(Z))return Ae(F,H,Z,ae);if(K(Z)){if(je=K(Z),typeof je!="function")throw Error(r(150));return Z=je.call(Z),Be(F,H,Z,ae)}if(typeof Z.then=="function")return kt(F,H,Cf(Z),ae);if(Z.$$typeof===_)return kt(F,H,xf(F,Z),ae);Ef(F,Z)}return typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint"?(Z=""+Z,H!==null&&H.tag===6?(d(F,H.sibling),ae=v(H,Z),ae.return=F,F=ae):(d(F,H),ae=ty(Z,F.mode,ae),ae.return=F,F=ae),E(F)):d(F,H)}return function(F,H,Z,ae){try{Zc=0;var je=kt(F,H,Z,ae);return xl=null,je}catch(Oe){if(Oe===bl||Oe===Sf)throw Oe;var lt=pr(29,Oe,null,F.mode);return lt.lanes=ae,lt.return=F,lt}}}var sa=sC(!0),oC=sC(!1),js=!1;function py(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function my(a,c){a=a.updateQueue,c.updateQueue===a&&(c.updateQueue={baseState:a.baseState,firstBaseUpdate:a.firstBaseUpdate,lastBaseUpdate:a.lastBaseUpdate,shared:a.shared,callbacks:null})}function Ps(a){return{lane:a,tag:0,payload:null,callback:null,next:null}}function zs(a,c,d){var p=a.updateQueue;if(p===null)return null;if(p=p.shared,(pt&2)!==0){var v=p.pending;return v===null?c.next=c:(c.next=v.next,v.next=c),p.pending=c,c=gf(a),Uk(a,null,d),c}return mf(a,p,c,d),gf(a)}function Xc(a,c,d){if(c=c.updateQueue,c!==null&&(c=c.shared,(d&4194048)!==0)){var p=c.lanes;p&=a.pendingLanes,d|=p,c.lanes=d,XS(a,d)}}function gy(a,c){var d=a.updateQueue,p=a.alternate;if(p!==null&&(p=p.updateQueue,d===p)){var v=null,w=null;if(d=d.firstBaseUpdate,d!==null){do{var E={lane:d.lane,tag:d.tag,payload:d.payload,callback:null,next:null};w===null?v=w=E:w=w.next=E,d=d.next}while(d!==null);w===null?v=w=c:w=w.next=c}else v=w=c;d={baseState:p.baseState,firstBaseUpdate:v,lastBaseUpdate:w,shared:p.shared,callbacks:p.callbacks},a.updateQueue=d;return}a=d.lastBaseUpdate,a===null?d.firstBaseUpdate=c:a.next=c,d.lastBaseUpdate=c}var yy=!1;function Jc(){if(yy){var a=vl;if(a!==null)throw a}}function Qc(a,c,d,p){yy=!1;var v=a.updateQueue;js=!1;var w=v.firstBaseUpdate,E=v.lastBaseUpdate,N=v.shared.pending;if(N!==null){v.shared.pending=null;var $=N,Y=$.next;$.next=null,E===null?w=Y:E.next=Y,E=$;var ie=a.alternate;ie!==null&&(ie=ie.updateQueue,N=ie.lastBaseUpdate,N!==E&&(N===null?ie.firstBaseUpdate=Y:N.next=Y,ie.lastBaseUpdate=$))}if(w!==null){var ce=v.baseState;E=0,ie=Y=$=null,N=w;do{var J=N.lane&-536870913,te=J!==N.lane;if(te?(nt&J)===J:(p&J)===J){J!==0&&J===yl&&(yy=!0),ie!==null&&(ie=ie.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});e:{var Ae=a,Be=N;J=c;var kt=d;switch(Be.tag){case 1:if(Ae=Be.payload,typeof Ae=="function"){ce=Ae.call(kt,ce,J);break e}ce=Ae;break e;case 3:Ae.flags=Ae.flags&-65537|128;case 0:if(Ae=Be.payload,J=typeof Ae=="function"?Ae.call(kt,ce,J):Ae,J==null)break e;ce=m({},ce,J);break e;case 2:js=!0}}J=N.callback,J!==null&&(a.flags|=64,te&&(a.flags|=8192),te=v.callbacks,te===null?v.callbacks=[J]:te.push(J))}else te={lane:J,tag:N.tag,payload:N.payload,callback:N.callback,next:null},ie===null?(Y=ie=te,$=ce):ie=ie.next=te,E|=J;if(N=N.next,N===null){if(N=v.shared.pending,N===null)break;te=N,N=te.next,te.next=null,v.lastBaseUpdate=te,v.shared.pending=null}}while(!0);ie===null&&($=ce),v.baseState=$,v.firstBaseUpdate=Y,v.lastBaseUpdate=ie,w===null&&(v.shared.lanes=0),Us|=E,a.lanes=E,a.memoizedState=ce}}function aC(a,c){if(typeof a!="function")throw Error(r(191,a));a.call(c)}function lC(a,c){var d=a.callbacks;if(d!==null)for(a.callbacks=null,a=0;a<d.length;a++)aC(d[a],c)}var wl=V(null),Tf=V(0);function cC(a,c){a=Yi,fe(Tf,a),fe(wl,c),Yi=a|c.baseLanes}function vy(){fe(Tf,Yi),fe(wl,wl.current)}function by(){Yi=Tf.current,X(wl),X(Tf)}var mr=V(null),jr=null;function $s(a){var c=a.alternate;fe(Kt,Kt.current&1),fe(mr,a),jr===null&&(c===null||wl.current!==null||c.memoizedState!==null)&&(jr=a)}function xy(a){fe(Kt,Kt.current),fe(mr,a),jr===null&&(jr=a)}function uC(a){a.tag===22?(fe(Kt,Kt.current),fe(mr,a),jr===null&&(jr=a)):Bs()}function Bs(){fe(Kt,Kt.current),fe(mr,mr.current)}function gr(a){X(mr),jr===a&&(jr=null),X(Kt)}var Kt=V(0);function _f(a){for(var c=a;c!==null;){if(c.tag===13){var d=c.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||Tv(d)||_v(d)))return c}else if(c.tag===19&&(c.memoizedProps.revealOrder==="forwards"||c.memoizedProps.revealOrder==="backwards"||c.memoizedProps.revealOrder==="unstable_legacy-backwards"||c.memoizedProps.revealOrder==="together")){if((c.flags&128)!==0)return c}else if(c.child!==null){c.child.return=c,c=c.child;continue}if(c===a)break;for(;c.sibling===null;){if(c.return===null||c.return===a)return null;c=c.return}c.sibling.return=c.return,c=c.sibling}return null}var Hi=0,Ye=null,wt=null,en=null,Af=!1,Sl=!1,oa=!1,Rf=0,eu=0,kl=null,tP=0;function Ht(){throw Error(r(321))}function wy(a,c){if(c===null)return!1;for(var d=0;d<c.length&&d<a.length;d++)if(!hr(a[d],c[d]))return!1;return!0}function Sy(a,c,d,p,v,w){return Hi=w,Ye=c,c.memoizedState=null,c.updateQueue=null,c.lanes=0,B.H=a===null||a.memoizedState===null?WC:Py,oa=!1,w=d(p,v),oa=!1,Sl&&(w=fC(c,d,p,v)),dC(a),w}function dC(a){B.H=ru;var c=wt!==null&&wt.next!==null;if(Hi=0,en=wt=Ye=null,Af=!1,eu=0,kl=null,c)throw Error(r(300));a===null||tn||(a=a.dependencies,a!==null&&bf(a)&&(tn=!0))}function fC(a,c,d,p){Ye=a;var v=0;do{if(Sl&&(kl=null),eu=0,Sl=!1,25<=v)throw Error(r(301));if(v+=1,en=wt=null,a.updateQueue!=null){var w=a.updateQueue;w.lastEffect=null,w.events=null,w.stores=null,w.memoCache!=null&&(w.memoCache.index=0)}B.H=KC,w=c(d,p)}while(Sl);return w}function nP(){var a=B.H,c=a.useState()[0];return c=typeof c.then=="function"?tu(c):c,a=a.useState()[0],(wt!==null?wt.memoizedState:null)!==a&&(Ye.flags|=1024),c}function ky(){var a=Rf!==0;return Rf=0,a}function Cy(a,c,d){c.updateQueue=a.updateQueue,c.flags&=-2053,a.lanes&=~d}function Ey(a){if(Af){for(a=a.memoizedState;a!==null;){var c=a.queue;c!==null&&(c.pending=null),a=a.next}Af=!1}Hi=0,en=wt=Ye=null,Sl=!1,eu=Rf=0,kl=null}function Gn(){var a={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return en===null?Ye.memoizedState=en=a:en=en.next=a,en}function Zt(){if(wt===null){var a=Ye.alternate;a=a!==null?a.memoizedState:null}else a=wt.next;var c=en===null?Ye.memoizedState:en.next;if(c!==null)en=c,wt=a;else{if(a===null)throw Ye.alternate===null?Error(r(467)):Error(r(310));wt=a,a={memoizedState:wt.memoizedState,baseState:wt.baseState,baseQueue:wt.baseQueue,queue:wt.queue,next:null},en===null?Ye.memoizedState=en=a:en=en.next=a}return en}function Mf(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function tu(a){var c=eu;return eu+=1,kl===null&&(kl=[]),a=nC(kl,a,c),c=Ye,(en===null?c.memoizedState:en.next)===null&&(c=c.alternate,B.H=c===null||c.memoizedState===null?WC:Py),a}function Nf(a){if(a!==null&&typeof a=="object"){if(typeof a.then=="function")return tu(a);if(a.$$typeof===_)return Tn(a)}throw Error(r(438,String(a)))}function Ty(a){var c=null,d=Ye.updateQueue;if(d!==null&&(c=d.memoCache),c==null){var p=Ye.alternate;p!==null&&(p=p.updateQueue,p!==null&&(p=p.memoCache,p!=null&&(c={data:p.data.map(function(v){return v.slice()}),index:0})))}if(c==null&&(c={data:[],index:0}),d===null&&(d=Mf(),Ye.updateQueue=d),d.memoCache=c,d=c.data[c.index],d===void 0)for(d=c.data[c.index]=Array(a),p=0;p<a;p++)d[p]=G;return c.index++,d}function Ui(a,c){return typeof c=="function"?c(a):c}function Of(a){var c=Zt();return _y(c,wt,a)}function _y(a,c,d){var p=a.queue;if(p===null)throw Error(r(311));p.lastRenderedReducer=d;var v=a.baseQueue,w=p.pending;if(w!==null){if(v!==null){var E=v.next;v.next=w.next,w.next=E}c.baseQueue=v=w,p.pending=null}if(w=a.baseState,v===null)a.memoizedState=w;else{c=v.next;var N=E=null,$=null,Y=c,ie=!1;do{var ce=Y.lane&-536870913;if(ce!==Y.lane?(nt&ce)===ce:(Hi&ce)===ce){var J=Y.revertLane;if(J===0)$!==null&&($=$.next={lane:0,revertLane:0,gesture:null,action:Y.action,hasEagerState:Y.hasEagerState,eagerState:Y.eagerState,next:null}),ce===yl&&(ie=!0);else if((Hi&J)===J){Y=Y.next,J===yl&&(ie=!0);continue}else ce={lane:0,revertLane:Y.revertLane,gesture:null,action:Y.action,hasEagerState:Y.hasEagerState,eagerState:Y.eagerState,next:null},$===null?(N=$=ce,E=w):$=$.next=ce,Ye.lanes|=J,Us|=J;ce=Y.action,oa&&d(w,ce),w=Y.hasEagerState?Y.eagerState:d(w,ce)}else J={lane:ce,revertLane:Y.revertLane,gesture:Y.gesture,action:Y.action,hasEagerState:Y.hasEagerState,eagerState:Y.eagerState,next:null},$===null?(N=$=J,E=w):$=$.next=J,Ye.lanes|=ce,Us|=ce;Y=Y.next}while(Y!==null&&Y!==c);if($===null?E=w:$.next=N,!hr(w,a.memoizedState)&&(tn=!0,ie&&(d=vl,d!==null)))throw d;a.memoizedState=w,a.baseState=E,a.baseQueue=$,p.lastRenderedState=w}return v===null&&(p.lanes=0),[a.memoizedState,p.dispatch]}function Ay(a){var c=Zt(),d=c.queue;if(d===null)throw Error(r(311));d.lastRenderedReducer=a;var p=d.dispatch,v=d.pending,w=c.memoizedState;if(v!==null){d.pending=null;var E=v=v.next;do w=a(w,E.action),E=E.next;while(E!==v);hr(w,c.memoizedState)||(tn=!0),c.memoizedState=w,c.baseQueue===null&&(c.baseState=w),d.lastRenderedState=w}return[w,p]}function hC(a,c,d){var p=Ye,v=Zt(),w=it;if(w){if(d===void 0)throw Error(r(407));d=d()}else d=c();var E=!hr((wt||v).memoizedState,d);if(E&&(v.memoizedState=d,tn=!0),v=v.queue,Ny(gC.bind(null,p,v,a),[a]),v.getSnapshot!==c||E||en!==null&&en.memoizedState.tag&1){if(p.flags|=2048,Cl(9,{destroy:void 0},mC.bind(null,p,v,d,c),null),Tt===null)throw Error(r(349));w||(Hi&127)!==0||pC(p,c,d)}return d}function pC(a,c,d){a.flags|=16384,a={getSnapshot:c,value:d},c=Ye.updateQueue,c===null?(c=Mf(),Ye.updateQueue=c,c.stores=[a]):(d=c.stores,d===null?c.stores=[a]:d.push(a))}function mC(a,c,d,p){c.value=d,c.getSnapshot=p,yC(c)&&vC(a)}function gC(a,c,d){return d(function(){yC(c)&&vC(a)})}function yC(a){var c=a.getSnapshot;a=a.value;try{var d=c();return!hr(a,d)}catch{return!0}}function vC(a){var c=Xo(a,2);c!==null&&cr(c,a,2)}function Ry(a){var c=Gn();if(typeof a=="function"){var d=a;if(a=d(),oa){Q(!0);try{d()}finally{Q(!1)}}}return c.memoizedState=c.baseState=a,c.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ui,lastRenderedState:a},c}function bC(a,c,d,p){return a.baseState=d,_y(a,wt,typeof p=="function"?p:Ui)}function rP(a,c,d,p,v){if(Lf(a))throw Error(r(485));if(a=c.action,a!==null){var w={payload:v,action:a,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(E){w.listeners.push(E)}};B.T!==null?d(!0):w.isTransition=!1,p(w),d=c.pending,d===null?(w.next=c.pending=w,xC(c,w)):(w.next=d.next,c.pending=d.next=w)}}function xC(a,c){var d=c.action,p=c.payload,v=a.state;if(c.isTransition){var w=B.T,E={};B.T=E;try{var N=d(v,p),$=B.S;$!==null&&$(E,N),wC(a,c,N)}catch(Y){My(a,c,Y)}finally{w!==null&&E.types!==null&&(w.types=E.types),B.T=w}}else try{w=d(v,p),wC(a,c,w)}catch(Y){My(a,c,Y)}}function wC(a,c,d){d!==null&&typeof d=="object"&&typeof d.then=="function"?d.then(function(p){SC(a,c,p)},function(p){return My(a,c,p)}):SC(a,c,d)}function SC(a,c,d){c.status="fulfilled",c.value=d,kC(c),a.state=d,c=a.pending,c!==null&&(d=c.next,d===c?a.pending=null:(d=d.next,c.next=d,xC(a,d)))}function My(a,c,d){var p=a.pending;if(a.pending=null,p!==null){p=p.next;do c.status="rejected",c.reason=d,kC(c),c=c.next;while(c!==p)}a.action=null}function kC(a){a=a.listeners;for(var c=0;c<a.length;c++)(0,a[c])()}function CC(a,c){return c}function EC(a,c){if(it){var d=Tt.formState;if(d!==null){e:{var p=Ye;if(it){if(Ot){t:{for(var v=Ot,w=Lr;v.nodeType!==8;){if(!w){v=null;break t}if(v=Pr(v.nextSibling),v===null){v=null;break t}}w=v.data,v=w==="F!"||w==="F"?v:null}if(v){Ot=Pr(v.nextSibling),p=v.data==="F!";break e}}Is(p)}p=!1}p&&(c=d[0])}}return d=Gn(),d.memoizedState=d.baseState=c,p={pending:null,lanes:0,dispatch:null,lastRenderedReducer:CC,lastRenderedState:c},d.queue=p,d=FC.bind(null,Ye,p),p.dispatch=d,p=Ry(!1),w=jy.bind(null,Ye,!1,p.queue),p=Gn(),v={state:c,dispatch:null,action:a,pending:null},p.queue=v,d=rP.bind(null,Ye,v,w,d),v.dispatch=d,p.memoizedState=a,[c,d,!1]}function TC(a){var c=Zt();return _C(c,wt,a)}function _C(a,c,d){if(c=_y(a,c,CC)[0],a=Of(Ui)[0],typeof c=="object"&&c!==null&&typeof c.then=="function")try{var p=tu(c)}catch(E){throw E===bl?Sf:E}else p=c;c=Zt();var v=c.queue,w=v.dispatch;return d!==c.memoizedState&&(Ye.flags|=2048,Cl(9,{destroy:void 0},iP.bind(null,v,d),null)),[p,w,a]}function iP(a,c){a.action=c}function AC(a){var c=Zt(),d=wt;if(d!==null)return _C(c,d,a);Zt(),c=c.memoizedState,d=Zt();var p=d.queue.dispatch;return d.memoizedState=a,[c,p,!1]}function Cl(a,c,d,p){return a={tag:a,create:d,deps:p,inst:c,next:null},c=Ye.updateQueue,c===null&&(c=Mf(),Ye.updateQueue=c),d=c.lastEffect,d===null?c.lastEffect=a.next=a:(p=d.next,d.next=a,a.next=p,c.lastEffect=a),a}function RC(){return Zt().memoizedState}function Df(a,c,d,p){var v=Gn();Ye.flags|=a,v.memoizedState=Cl(1|c,{destroy:void 0},d,p===void 0?null:p)}function If(a,c,d,p){var v=Zt();p=p===void 0?null:p;var w=v.memoizedState.inst;wt!==null&&p!==null&&wy(p,wt.memoizedState.deps)?v.memoizedState=Cl(c,w,d,p):(Ye.flags|=a,v.memoizedState=Cl(1|c,w,d,p))}function MC(a,c){Df(8390656,8,a,c)}function Ny(a,c){If(2048,8,a,c)}function sP(a){Ye.flags|=4;var c=Ye.updateQueue;if(c===null)c=Mf(),Ye.updateQueue=c,c.events=[a];else{var d=c.events;d===null?c.events=[a]:d.push(a)}}function NC(a){var c=Zt().memoizedState;return sP({ref:c,nextImpl:a}),function(){if((pt&2)!==0)throw Error(r(440));return c.impl.apply(void 0,arguments)}}function OC(a,c){return If(4,2,a,c)}function DC(a,c){return If(4,4,a,c)}function IC(a,c){if(typeof c=="function"){a=a();var d=c(a);return function(){typeof d=="function"?d():c(null)}}if(c!=null)return a=a(),c.current=a,function(){c.current=null}}function LC(a,c,d){d=d!=null?d.concat([a]):null,If(4,4,IC.bind(null,c,a),d)}function Oy(){}function jC(a,c){var d=Zt();c=c===void 0?null:c;var p=d.memoizedState;return c!==null&&wy(c,p[1])?p[0]:(d.memoizedState=[a,c],a)}function PC(a,c){var d=Zt();c=c===void 0?null:c;var p=d.memoizedState;if(c!==null&&wy(c,p[1]))return p[0];if(p=a(),oa){Q(!0);try{a()}finally{Q(!1)}}return d.memoizedState=[p,c],p}function Dy(a,c,d){return d===void 0||(Hi&1073741824)!==0&&(nt&261930)===0?a.memoizedState=c:(a.memoizedState=d,a=z1(),Ye.lanes|=a,Us|=a,d)}function zC(a,c,d,p){return hr(d,c)?d:wl.current!==null?(a=Dy(a,d,p),hr(a,c)||(tn=!0),a):(Hi&42)===0||(Hi&1073741824)!==0&&(nt&261930)===0?(tn=!0,a.memoizedState=d):(a=z1(),Ye.lanes|=a,Us|=a,c)}function $C(a,c,d,p,v){var w=z.p;z.p=w!==0&&8>w?w:8;var E=B.T,N={};B.T=N,jy(a,!1,c,d);try{var $=v(),Y=B.S;if(Y!==null&&Y(N,$),$!==null&&typeof $=="object"&&typeof $.then=="function"){var ie=eP($,p);nu(a,c,ie,br(a))}else nu(a,c,p,br(a))}catch(ce){nu(a,c,{then:function(){},status:"rejected",reason:ce},br())}finally{z.p=w,E!==null&&N.types!==null&&(E.types=N.types),B.T=E}}function oP(){}function Iy(a,c,d,p){if(a.tag!==5)throw Error(r(476));var v=BC(a).queue;$C(a,v,c,q,d===null?oP:function(){return VC(a),d(p)})}function BC(a){var c=a.memoizedState;if(c!==null)return c;c={memoizedState:q,baseState:q,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ui,lastRenderedState:q},next:null};var d={};return c.next={memoizedState:d,baseState:d,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ui,lastRenderedState:d},next:null},a.memoizedState=c,a=a.alternate,a!==null&&(a.memoizedState=c),c}function VC(a){var c=BC(a);c.next===null&&(c=a.alternate.memoizedState),nu(a,c.next.queue,{},br())}function Ly(){return Tn(bu)}function HC(){return Zt().memoizedState}function UC(){return Zt().memoizedState}function aP(a){for(var c=a.return;c!==null;){switch(c.tag){case 24:case 3:var d=br();a=Ps(d);var p=zs(c,a,d);p!==null&&(cr(p,c,d),Xc(p,c,d)),c={cache:uy()},a.payload=c;return}c=c.return}}function lP(a,c,d){var p=br();d={lane:p,revertLane:0,gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},Lf(a)?qC(c,d):(d=Qg(a,c,d,p),d!==null&&(cr(d,a,p),GC(d,c,p)))}function FC(a,c,d){var p=br();nu(a,c,d,p)}function nu(a,c,d,p){var v={lane:p,revertLane:0,gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null};if(Lf(a))qC(c,v);else{var w=a.alternate;if(a.lanes===0&&(w===null||w.lanes===0)&&(w=c.lastRenderedReducer,w!==null))try{var E=c.lastRenderedState,N=w(E,d);if(v.hasEagerState=!0,v.eagerState=N,hr(N,E))return mf(a,c,v,0),Tt===null&&pf(),!1}catch{}if(d=Qg(a,c,v,p),d!==null)return cr(d,a,p),GC(d,c,p),!0}return!1}function jy(a,c,d,p){if(p={lane:2,revertLane:pv(),gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},Lf(a)){if(c)throw Error(r(479))}else c=Qg(a,d,p,2),c!==null&&cr(c,a,2)}function Lf(a){var c=a.alternate;return a===Ye||c!==null&&c===Ye}function qC(a,c){Sl=Af=!0;var d=a.pending;d===null?c.next=c:(c.next=d.next,d.next=c),a.pending=c}function GC(a,c,d){if((d&4194048)!==0){var p=c.lanes;p&=a.pendingLanes,d|=p,c.lanes=d,XS(a,d)}}var ru={readContext:Tn,use:Nf,useCallback:Ht,useContext:Ht,useEffect:Ht,useImperativeHandle:Ht,useLayoutEffect:Ht,useInsertionEffect:Ht,useMemo:Ht,useReducer:Ht,useRef:Ht,useState:Ht,useDebugValue:Ht,useDeferredValue:Ht,useTransition:Ht,useSyncExternalStore:Ht,useId:Ht,useHostTransitionStatus:Ht,useFormState:Ht,useActionState:Ht,useOptimistic:Ht,useMemoCache:Ht,useCacheRefresh:Ht};ru.useEffectEvent=Ht;var WC={readContext:Tn,use:Nf,useCallback:function(a,c){return Gn().memoizedState=[a,c===void 0?null:c],a},useContext:Tn,useEffect:MC,useImperativeHandle:function(a,c,d){d=d!=null?d.concat([a]):null,Df(4194308,4,IC.bind(null,c,a),d)},useLayoutEffect:function(a,c){return Df(4194308,4,a,c)},useInsertionEffect:function(a,c){Df(4,2,a,c)},useMemo:function(a,c){var d=Gn();c=c===void 0?null:c;var p=a();if(oa){Q(!0);try{a()}finally{Q(!1)}}return d.memoizedState=[p,c],p},useReducer:function(a,c,d){var p=Gn();if(d!==void 0){var v=d(c);if(oa){Q(!0);try{d(c)}finally{Q(!1)}}}else v=c;return p.memoizedState=p.baseState=v,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:v},p.queue=a,a=a.dispatch=lP.bind(null,Ye,a),[p.memoizedState,a]},useRef:function(a){var c=Gn();return a={current:a},c.memoizedState=a},useState:function(a){a=Ry(a);var c=a.queue,d=FC.bind(null,Ye,c);return c.dispatch=d,[a.memoizedState,d]},useDebugValue:Oy,useDeferredValue:function(a,c){var d=Gn();return Dy(d,a,c)},useTransition:function(){var a=Ry(!1);return a=$C.bind(null,Ye,a.queue,!0,!1),Gn().memoizedState=a,[!1,a]},useSyncExternalStore:function(a,c,d){var p=Ye,v=Gn();if(it){if(d===void 0)throw Error(r(407));d=d()}else{if(d=c(),Tt===null)throw Error(r(349));(nt&127)!==0||pC(p,c,d)}v.memoizedState=d;var w={value:d,getSnapshot:c};return v.queue=w,MC(gC.bind(null,p,w,a),[a]),p.flags|=2048,Cl(9,{destroy:void 0},mC.bind(null,p,w,d,c),null),d},useId:function(){var a=Gn(),c=Tt.identifierPrefix;if(it){var d=vi,p=yi;d=(p&~(1<<32-he(p)-1)).toString(32)+d,c="_"+c+"R_"+d,d=Rf++,0<d&&(c+="H"+d.toString(32)),c+="_"}else d=tP++,c="_"+c+"r_"+d.toString(32)+"_";return a.memoizedState=c},useHostTransitionStatus:Ly,useFormState:EC,useActionState:EC,useOptimistic:function(a){var c=Gn();c.memoizedState=c.baseState=a;var d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return c.queue=d,c=jy.bind(null,Ye,!0,d),d.dispatch=c,[a,c]},useMemoCache:Ty,useCacheRefresh:function(){return Gn().memoizedState=aP.bind(null,Ye)},useEffectEvent:function(a){var c=Gn(),d={impl:a};return c.memoizedState=d,function(){if((pt&2)!==0)throw Error(r(440));return d.impl.apply(void 0,arguments)}}},Py={readContext:Tn,use:Nf,useCallback:jC,useContext:Tn,useEffect:Ny,useImperativeHandle:LC,useInsertionEffect:OC,useLayoutEffect:DC,useMemo:PC,useReducer:Of,useRef:RC,useState:function(){return Of(Ui)},useDebugValue:Oy,useDeferredValue:function(a,c){var d=Zt();return zC(d,wt.memoizedState,a,c)},useTransition:function(){var a=Of(Ui)[0],c=Zt().memoizedState;return[typeof a=="boolean"?a:tu(a),c]},useSyncExternalStore:hC,useId:HC,useHostTransitionStatus:Ly,useFormState:TC,useActionState:TC,useOptimistic:function(a,c){var d=Zt();return bC(d,wt,a,c)},useMemoCache:Ty,useCacheRefresh:UC};Py.useEffectEvent=NC;var KC={readContext:Tn,use:Nf,useCallback:jC,useContext:Tn,useEffect:Ny,useImperativeHandle:LC,useInsertionEffect:OC,useLayoutEffect:DC,useMemo:PC,useReducer:Ay,useRef:RC,useState:function(){return Ay(Ui)},useDebugValue:Oy,useDeferredValue:function(a,c){var d=Zt();return wt===null?Dy(d,a,c):zC(d,wt.memoizedState,a,c)},useTransition:function(){var a=Ay(Ui)[0],c=Zt().memoizedState;return[typeof a=="boolean"?a:tu(a),c]},useSyncExternalStore:hC,useId:HC,useHostTransitionStatus:Ly,useFormState:AC,useActionState:AC,useOptimistic:function(a,c){var d=Zt();return wt!==null?bC(d,wt,a,c):(d.baseState=a,[a,d.queue.dispatch])},useMemoCache:Ty,useCacheRefresh:UC};KC.useEffectEvent=NC;function zy(a,c,d,p){c=a.memoizedState,d=d(p,c),d=d==null?c:m({},c,d),a.memoizedState=d,a.lanes===0&&(a.updateQueue.baseState=d)}var $y={enqueueSetState:function(a,c,d){a=a._reactInternals;var p=br(),v=Ps(p);v.payload=c,d!=null&&(v.callback=d),c=zs(a,v,p),c!==null&&(cr(c,a,p),Xc(c,a,p))},enqueueReplaceState:function(a,c,d){a=a._reactInternals;var p=br(),v=Ps(p);v.tag=1,v.payload=c,d!=null&&(v.callback=d),c=zs(a,v,p),c!==null&&(cr(c,a,p),Xc(c,a,p))},enqueueForceUpdate:function(a,c){a=a._reactInternals;var d=br(),p=Ps(d);p.tag=2,c!=null&&(p.callback=c),c=zs(a,p,d),c!==null&&(cr(c,a,d),Xc(c,a,d))}};function ZC(a,c,d,p,v,w,E){return a=a.stateNode,typeof a.shouldComponentUpdate=="function"?a.shouldComponentUpdate(p,w,E):c.prototype&&c.prototype.isPureReactComponent?!Uc(d,p)||!Uc(v,w):!0}function YC(a,c,d,p){a=c.state,typeof c.componentWillReceiveProps=="function"&&c.componentWillReceiveProps(d,p),typeof c.UNSAFE_componentWillReceiveProps=="function"&&c.UNSAFE_componentWillReceiveProps(d,p),c.state!==a&&$y.enqueueReplaceState(c,c.state,null)}function aa(a,c){var d=c;if("ref"in c){d={};for(var p in c)p!=="ref"&&(d[p]=c[p])}if(a=a.defaultProps){d===c&&(d=m({},d));for(var v in a)d[v]===void 0&&(d[v]=a[v])}return d}function XC(a){hf(a)}function JC(a){console.error(a)}function QC(a){hf(a)}function jf(a,c){try{var d=a.onUncaughtError;d(c.value,{componentStack:c.stack})}catch(p){setTimeout(function(){throw p})}}function e1(a,c,d){try{var p=a.onCaughtError;p(d.value,{componentStack:d.stack,errorBoundary:c.tag===1?c.stateNode:null})}catch(v){setTimeout(function(){throw v})}}function By(a,c,d){return d=Ps(d),d.tag=3,d.payload={element:null},d.callback=function(){jf(a,c)},d}function t1(a){return a=Ps(a),a.tag=3,a}function n1(a,c,d,p){var v=d.type.getDerivedStateFromError;if(typeof v=="function"){var w=p.value;a.payload=function(){return v(w)},a.callback=function(){e1(c,d,p)}}var E=d.stateNode;E!==null&&typeof E.componentDidCatch=="function"&&(a.callback=function(){e1(c,d,p),typeof v!="function"&&(Fs===null?Fs=new Set([this]):Fs.add(this));var N=p.stack;this.componentDidCatch(p.value,{componentStack:N!==null?N:""})})}function cP(a,c,d,p,v){if(d.flags|=32768,p!==null&&typeof p=="object"&&typeof p.then=="function"){if(c=d.alternate,c!==null&&gl(c,d,v,!0),d=mr.current,d!==null){switch(d.tag){case 31:case 13:return jr===null?Kf():d.alternate===null&&Ut===0&&(Ut=3),d.flags&=-257,d.flags|=65536,d.lanes=v,p===kf?d.flags|=16384:(c=d.updateQueue,c===null?d.updateQueue=new Set([p]):c.add(p),dv(a,p,v)),!1;case 22:return d.flags|=65536,p===kf?d.flags|=16384:(c=d.updateQueue,c===null?(c={transitions:null,markerInstances:null,retryQueue:new Set([p])},d.updateQueue=c):(d=c.retryQueue,d===null?c.retryQueue=new Set([p]):d.add(p)),dv(a,p,v)),!1}throw Error(r(435,d.tag))}return dv(a,p,v),Kf(),!1}if(it)return c=mr.current,c!==null?((c.flags&65536)===0&&(c.flags|=256),c.flags|=65536,c.lanes=v,p!==sy&&(a=Error(r(422),{cause:p}),Gc(Or(a,d)))):(p!==sy&&(c=Error(r(423),{cause:p}),Gc(Or(c,d))),a=a.current.alternate,a.flags|=65536,v&=-v,a.lanes|=v,p=Or(p,d),v=By(a.stateNode,p,v),gy(a,v),Ut!==4&&(Ut=2)),!1;var w=Error(r(520),{cause:p});if(w=Or(w,d),du===null?du=[w]:du.push(w),Ut!==4&&(Ut=2),c===null)return!0;p=Or(p,d),d=c;do{switch(d.tag){case 3:return d.flags|=65536,a=v&-v,d.lanes|=a,a=By(d.stateNode,p,a),gy(d,a),!1;case 1:if(c=d.type,w=d.stateNode,(d.flags&128)===0&&(typeof c.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(Fs===null||!Fs.has(w))))return d.flags|=65536,v&=-v,d.lanes|=v,v=t1(v),n1(v,a,d,p),gy(d,v),!1}d=d.return}while(d!==null);return!1}var Vy=Error(r(461)),tn=!1;function _n(a,c,d,p){c.child=a===null?oC(c,null,d,p):sa(c,a.child,d,p)}function r1(a,c,d,p,v){d=d.render;var w=c.ref;if("ref"in p){var E={};for(var N in p)N!=="ref"&&(E[N]=p[N])}else E=p;return ta(c),p=Sy(a,c,d,E,w,v),N=ky(),a!==null&&!tn?(Cy(a,c,v),Fi(a,c,v)):(it&&N&&ry(c),c.flags|=1,_n(a,c,p,v),c.child)}function i1(a,c,d,p,v){if(a===null){var w=d.type;return typeof w=="function"&&!ey(w)&&w.defaultProps===void 0&&d.compare===null?(c.tag=15,c.type=w,s1(a,c,w,p,v)):(a=yf(d.type,null,p,c,c.mode,v),a.ref=c.ref,a.return=c,c.child=a)}if(w=a.child,!Zy(a,v)){var E=w.memoizedProps;if(d=d.compare,d=d!==null?d:Uc,d(E,p)&&a.ref===c.ref)return Fi(a,c,v)}return c.flags|=1,a=zi(w,p),a.ref=c.ref,a.return=c,c.child=a}function s1(a,c,d,p,v){if(a!==null){var w=a.memoizedProps;if(Uc(w,p)&&a.ref===c.ref)if(tn=!1,c.pendingProps=p=w,Zy(a,v))(a.flags&131072)!==0&&(tn=!0);else return c.lanes=a.lanes,Fi(a,c,v)}return Hy(a,c,d,p,v)}function o1(a,c,d,p){var v=p.children,w=a!==null?a.memoizedState:null;if(a===null&&c.stateNode===null&&(c.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),p.mode==="hidden"){if((c.flags&128)!==0){if(w=w!==null?w.baseLanes|d:d,a!==null){for(p=c.child=a.child,v=0;p!==null;)v=v|p.lanes|p.childLanes,p=p.sibling;p=v&~w}else p=0,c.child=null;return a1(a,c,w,d,p)}if((d&536870912)!==0)c.memoizedState={baseLanes:0,cachePool:null},a!==null&&wf(c,w!==null?w.cachePool:null),w!==null?cC(c,w):vy(),uC(c);else return p=c.lanes=536870912,a1(a,c,w!==null?w.baseLanes|d:d,d,p)}else w!==null?(wf(c,w.cachePool),cC(c,w),Bs(),c.memoizedState=null):(a!==null&&wf(c,null),vy(),Bs());return _n(a,c,v,d),c.child}function iu(a,c){return a!==null&&a.tag===22||c.stateNode!==null||(c.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),c.sibling}function a1(a,c,d,p,v){var w=fy();return w=w===null?null:{parent:Qt._currentValue,pool:w},c.memoizedState={baseLanes:d,cachePool:w},a!==null&&wf(c,null),vy(),uC(c),a!==null&&gl(a,c,p,!0),c.childLanes=v,null}function Pf(a,c){return c=$f({mode:c.mode,children:c.children},a.mode),c.ref=a.ref,a.child=c,c.return=a,c}function l1(a,c,d){return sa(c,a.child,null,d),a=Pf(c,c.pendingProps),a.flags|=2,gr(c),c.memoizedState=null,a}function uP(a,c,d){var p=c.pendingProps,v=(c.flags&128)!==0;if(c.flags&=-129,a===null){if(it){if(p.mode==="hidden")return a=Pf(c,p),c.lanes=536870912,iu(null,a);if(xy(c),(a=Ot)?(a=xE(a,Lr),a=a!==null&&a.data==="&"?a:null,a!==null&&(c.memoizedState={dehydrated:a,treeContext:Os!==null?{id:yi,overflow:vi}:null,retryLane:536870912,hydrationErrors:null},d=qk(a),d.return=c,c.child=d,En=c,Ot=null)):a=null,a===null)throw Is(c);return c.lanes=536870912,null}return Pf(c,p)}var w=a.memoizedState;if(w!==null){var E=w.dehydrated;if(xy(c),v)if(c.flags&256)c.flags&=-257,c=l1(a,c,d);else if(c.memoizedState!==null)c.child=a.child,c.flags|=128,c=null;else throw Error(r(558));else if(tn||gl(a,c,d,!1),v=(d&a.childLanes)!==0,tn||v){if(p=Tt,p!==null&&(E=JS(p,d),E!==0&&E!==w.retryLane))throw w.retryLane=E,Xo(a,E),cr(p,a,E),Vy;Kf(),c=l1(a,c,d)}else a=w.treeContext,Ot=Pr(E.nextSibling),En=c,it=!0,Ds=null,Lr=!1,a!==null&&Kk(c,a),c=Pf(c,p),c.flags|=4096;return c}return a=zi(a.child,{mode:p.mode,children:p.children}),a.ref=c.ref,c.child=a,a.return=c,a}function zf(a,c){var d=c.ref;if(d===null)a!==null&&a.ref!==null&&(c.flags|=4194816);else{if(typeof d!="function"&&typeof d!="object")throw Error(r(284));(a===null||a.ref!==d)&&(c.flags|=4194816)}}function Hy(a,c,d,p,v){return ta(c),d=Sy(a,c,d,p,void 0,v),p=ky(),a!==null&&!tn?(Cy(a,c,v),Fi(a,c,v)):(it&&p&&ry(c),c.flags|=1,_n(a,c,d,v),c.child)}function c1(a,c,d,p,v,w){return ta(c),c.updateQueue=null,d=fC(c,p,d,v),dC(a),p=ky(),a!==null&&!tn?(Cy(a,c,w),Fi(a,c,w)):(it&&p&&ry(c),c.flags|=1,_n(a,c,d,w),c.child)}function u1(a,c,d,p,v){if(ta(c),c.stateNode===null){var w=fl,E=d.contextType;typeof E=="object"&&E!==null&&(w=Tn(E)),w=new d(p,w),c.memoizedState=w.state!==null&&w.state!==void 0?w.state:null,w.updater=$y,c.stateNode=w,w._reactInternals=c,w=c.stateNode,w.props=p,w.state=c.memoizedState,w.refs={},py(c),E=d.contextType,w.context=typeof E=="object"&&E!==null?Tn(E):fl,w.state=c.memoizedState,E=d.getDerivedStateFromProps,typeof E=="function"&&(zy(c,d,E,p),w.state=c.memoizedState),typeof d.getDerivedStateFromProps=="function"||typeof w.getSnapshotBeforeUpdate=="function"||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(E=w.state,typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount(),E!==w.state&&$y.enqueueReplaceState(w,w.state,null),Qc(c,p,w,v),Jc(),w.state=c.memoizedState),typeof w.componentDidMount=="function"&&(c.flags|=4194308),p=!0}else if(a===null){w=c.stateNode;var N=c.memoizedProps,$=aa(d,N);w.props=$;var Y=w.context,ie=d.contextType;E=fl,typeof ie=="object"&&ie!==null&&(E=Tn(ie));var ce=d.getDerivedStateFromProps;ie=typeof ce=="function"||typeof w.getSnapshotBeforeUpdate=="function",N=c.pendingProps!==N,ie||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(N||Y!==E)&&YC(c,w,p,E),js=!1;var J=c.memoizedState;w.state=J,Qc(c,p,w,v),Jc(),Y=c.memoizedState,N||J!==Y||js?(typeof ce=="function"&&(zy(c,d,ce,p),Y=c.memoizedState),($=js||ZC(c,d,$,p,J,Y,E))?(ie||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount()),typeof w.componentDidMount=="function"&&(c.flags|=4194308)):(typeof w.componentDidMount=="function"&&(c.flags|=4194308),c.memoizedProps=p,c.memoizedState=Y),w.props=p,w.state=Y,w.context=E,p=$):(typeof w.componentDidMount=="function"&&(c.flags|=4194308),p=!1)}else{w=c.stateNode,my(a,c),E=c.memoizedProps,ie=aa(d,E),w.props=ie,ce=c.pendingProps,J=w.context,Y=d.contextType,$=fl,typeof Y=="object"&&Y!==null&&($=Tn(Y)),N=d.getDerivedStateFromProps,(Y=typeof N=="function"||typeof w.getSnapshotBeforeUpdate=="function")||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(E!==ce||J!==$)&&YC(c,w,p,$),js=!1,J=c.memoizedState,w.state=J,Qc(c,p,w,v),Jc();var te=c.memoizedState;E!==ce||J!==te||js||a!==null&&a.dependencies!==null&&bf(a.dependencies)?(typeof N=="function"&&(zy(c,d,N,p),te=c.memoizedState),(ie=js||ZC(c,d,ie,p,J,te,$)||a!==null&&a.dependencies!==null&&bf(a.dependencies))?(Y||typeof w.UNSAFE_componentWillUpdate!="function"&&typeof w.componentWillUpdate!="function"||(typeof w.componentWillUpdate=="function"&&w.componentWillUpdate(p,te,$),typeof w.UNSAFE_componentWillUpdate=="function"&&w.UNSAFE_componentWillUpdate(p,te,$)),typeof w.componentDidUpdate=="function"&&(c.flags|=4),typeof w.getSnapshotBeforeUpdate=="function"&&(c.flags|=1024)):(typeof w.componentDidUpdate!="function"||E===a.memoizedProps&&J===a.memoizedState||(c.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||E===a.memoizedProps&&J===a.memoizedState||(c.flags|=1024),c.memoizedProps=p,c.memoizedState=te),w.props=p,w.state=te,w.context=$,p=ie):(typeof w.componentDidUpdate!="function"||E===a.memoizedProps&&J===a.memoizedState||(c.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||E===a.memoizedProps&&J===a.memoizedState||(c.flags|=1024),p=!1)}return w=p,zf(a,c),p=(c.flags&128)!==0,w||p?(w=c.stateNode,d=p&&typeof d.getDerivedStateFromError!="function"?null:w.render(),c.flags|=1,a!==null&&p?(c.child=sa(c,a.child,null,v),c.child=sa(c,null,d,v)):_n(a,c,d,v),c.memoizedState=w.state,a=c.child):a=Fi(a,c,v),a}function d1(a,c,d,p){return Qo(),c.flags|=256,_n(a,c,d,p),c.child}var Uy={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Fy(a){return{baseLanes:a,cachePool:eC()}}function qy(a,c,d){return a=a!==null?a.childLanes&~d:0,c&&(a|=vr),a}function f1(a,c,d){var p=c.pendingProps,v=!1,w=(c.flags&128)!==0,E;if((E=w)||(E=a!==null&&a.memoizedState===null?!1:(Kt.current&2)!==0),E&&(v=!0,c.flags&=-129),E=(c.flags&32)!==0,c.flags&=-33,a===null){if(it){if(v?$s(c):Bs(),(a=Ot)?(a=xE(a,Lr),a=a!==null&&a.data!=="&"?a:null,a!==null&&(c.memoizedState={dehydrated:a,treeContext:Os!==null?{id:yi,overflow:vi}:null,retryLane:536870912,hydrationErrors:null},d=qk(a),d.return=c,c.child=d,En=c,Ot=null)):a=null,a===null)throw Is(c);return _v(a)?c.lanes=32:c.lanes=536870912,null}var N=p.children;return p=p.fallback,v?(Bs(),v=c.mode,N=$f({mode:"hidden",children:N},v),p=Jo(p,v,d,null),N.return=c,p.return=c,N.sibling=p,c.child=N,p=c.child,p.memoizedState=Fy(d),p.childLanes=qy(a,E,d),c.memoizedState=Uy,iu(null,p)):($s(c),Gy(c,N))}var $=a.memoizedState;if($!==null&&(N=$.dehydrated,N!==null)){if(w)c.flags&256?($s(c),c.flags&=-257,c=Wy(a,c,d)):c.memoizedState!==null?(Bs(),c.child=a.child,c.flags|=128,c=null):(Bs(),N=p.fallback,v=c.mode,p=$f({mode:"visible",children:p.children},v),N=Jo(N,v,d,null),N.flags|=2,p.return=c,N.return=c,p.sibling=N,c.child=p,sa(c,a.child,null,d),p=c.child,p.memoizedState=Fy(d),p.childLanes=qy(a,E,d),c.memoizedState=Uy,c=iu(null,p));else if($s(c),_v(N)){if(E=N.nextSibling&&N.nextSibling.dataset,E)var Y=E.dgst;E=Y,p=Error(r(419)),p.stack="",p.digest=E,Gc({value:p,source:null,stack:null}),c=Wy(a,c,d)}else if(tn||gl(a,c,d,!1),E=(d&a.childLanes)!==0,tn||E){if(E=Tt,E!==null&&(p=JS(E,d),p!==0&&p!==$.retryLane))throw $.retryLane=p,Xo(a,p),cr(E,a,p),Vy;Tv(N)||Kf(),c=Wy(a,c,d)}else Tv(N)?(c.flags|=192,c.child=a.child,c=null):(a=$.treeContext,Ot=Pr(N.nextSibling),En=c,it=!0,Ds=null,Lr=!1,a!==null&&Kk(c,a),c=Gy(c,p.children),c.flags|=4096);return c}return v?(Bs(),N=p.fallback,v=c.mode,$=a.child,Y=$.sibling,p=zi($,{mode:"hidden",children:p.children}),p.subtreeFlags=$.subtreeFlags&65011712,Y!==null?N=zi(Y,N):(N=Jo(N,v,d,null),N.flags|=2),N.return=c,p.return=c,p.sibling=N,c.child=p,iu(null,p),p=c.child,N=a.child.memoizedState,N===null?N=Fy(d):(v=N.cachePool,v!==null?($=Qt._currentValue,v=v.parent!==$?{parent:$,pool:$}:v):v=eC(),N={baseLanes:N.baseLanes|d,cachePool:v}),p.memoizedState=N,p.childLanes=qy(a,E,d),c.memoizedState=Uy,iu(a.child,p)):($s(c),d=a.child,a=d.sibling,d=zi(d,{mode:"visible",children:p.children}),d.return=c,d.sibling=null,a!==null&&(E=c.deletions,E===null?(c.deletions=[a],c.flags|=16):E.push(a)),c.child=d,c.memoizedState=null,d)}function Gy(a,c){return c=$f({mode:"visible",children:c},a.mode),c.return=a,a.child=c}function $f(a,c){return a=pr(22,a,null,c),a.lanes=0,a}function Wy(a,c,d){return sa(c,a.child,null,d),a=Gy(c,c.pendingProps.children),a.flags|=2,c.memoizedState=null,a}function h1(a,c,d){a.lanes|=c;var p=a.alternate;p!==null&&(p.lanes|=c),ly(a.return,c,d)}function Ky(a,c,d,p,v,w){var E=a.memoizedState;E===null?a.memoizedState={isBackwards:c,rendering:null,renderingStartTime:0,last:p,tail:d,tailMode:v,treeForkCount:w}:(E.isBackwards=c,E.rendering=null,E.renderingStartTime=0,E.last=p,E.tail=d,E.tailMode=v,E.treeForkCount=w)}function p1(a,c,d){var p=c.pendingProps,v=p.revealOrder,w=p.tail;p=p.children;var E=Kt.current,N=(E&2)!==0;if(N?(E=E&1|2,c.flags|=128):E&=1,fe(Kt,E),_n(a,c,p,d),p=it?qc:0,!N&&a!==null&&(a.flags&128)!==0)e:for(a=c.child;a!==null;){if(a.tag===13)a.memoizedState!==null&&h1(a,d,c);else if(a.tag===19)h1(a,d,c);else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===c)break e;for(;a.sibling===null;){if(a.return===null||a.return===c)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}switch(v){case"forwards":for(d=c.child,v=null;d!==null;)a=d.alternate,a!==null&&_f(a)===null&&(v=d),d=d.sibling;d=v,d===null?(v=c.child,c.child=null):(v=d.sibling,d.sibling=null),Ky(c,!1,v,d,w,p);break;case"backwards":case"unstable_legacy-backwards":for(d=null,v=c.child,c.child=null;v!==null;){if(a=v.alternate,a!==null&&_f(a)===null){c.child=v;break}a=v.sibling,v.sibling=d,d=v,v=a}Ky(c,!0,d,null,w,p);break;case"together":Ky(c,!1,null,null,void 0,p);break;default:c.memoizedState=null}return c.child}function Fi(a,c,d){if(a!==null&&(c.dependencies=a.dependencies),Us|=c.lanes,(d&c.childLanes)===0)if(a!==null){if(gl(a,c,d,!1),(d&c.childLanes)===0)return null}else return null;if(a!==null&&c.child!==a.child)throw Error(r(153));if(c.child!==null){for(a=c.child,d=zi(a,a.pendingProps),c.child=d,d.return=c;a.sibling!==null;)a=a.sibling,d=d.sibling=zi(a,a.pendingProps),d.return=c;d.sibling=null}return c.child}function Zy(a,c){return(a.lanes&c)!==0?!0:(a=a.dependencies,!!(a!==null&&bf(a)))}function dP(a,c,d){switch(c.tag){case 3:ke(c,c.stateNode.containerInfo),Ls(c,Qt,a.memoizedState.cache),Qo();break;case 27:case 5:pe(c);break;case 4:ke(c,c.stateNode.containerInfo);break;case 10:Ls(c,c.type,c.memoizedProps.value);break;case 31:if(c.memoizedState!==null)return c.flags|=128,xy(c),null;break;case 13:var p=c.memoizedState;if(p!==null)return p.dehydrated!==null?($s(c),c.flags|=128,null):(d&c.child.childLanes)!==0?f1(a,c,d):($s(c),a=Fi(a,c,d),a!==null?a.sibling:null);$s(c);break;case 19:var v=(a.flags&128)!==0;if(p=(d&c.childLanes)!==0,p||(gl(a,c,d,!1),p=(d&c.childLanes)!==0),v){if(p)return p1(a,c,d);c.flags|=128}if(v=c.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),fe(Kt,Kt.current),p)break;return null;case 22:return c.lanes=0,o1(a,c,d,c.pendingProps);case 24:Ls(c,Qt,a.memoizedState.cache)}return Fi(a,c,d)}function m1(a,c,d){if(a!==null)if(a.memoizedProps!==c.pendingProps)tn=!0;else{if(!Zy(a,d)&&(c.flags&128)===0)return tn=!1,dP(a,c,d);tn=(a.flags&131072)!==0}else tn=!1,it&&(c.flags&1048576)!==0&&Wk(c,qc,c.index);switch(c.lanes=0,c.tag){case 16:e:{var p=c.pendingProps;if(a=ra(c.elementType),c.type=a,typeof a=="function")ey(a)?(p=aa(a,p),c.tag=1,c=u1(null,c,a,p,d)):(c.tag=0,c=Hy(null,c,a,p,d));else{if(a!=null){var v=a.$$typeof;if(v===R){c.tag=11,c=r1(null,c,a,p,d);break e}else if(v===L){c.tag=14,c=i1(null,c,a,p,d);break e}}throw c=re(a)||a,Error(r(306,c,""))}}return c;case 0:return Hy(a,c,c.type,c.pendingProps,d);case 1:return p=c.type,v=aa(p,c.pendingProps),u1(a,c,p,v,d);case 3:e:{if(ke(c,c.stateNode.containerInfo),a===null)throw Error(r(387));p=c.pendingProps;var w=c.memoizedState;v=w.element,my(a,c),Qc(c,p,null,d);var E=c.memoizedState;if(p=E.cache,Ls(c,Qt,p),p!==w.cache&&cy(c,[Qt],d,!0),Jc(),p=E.element,w.isDehydrated)if(w={element:p,isDehydrated:!1,cache:E.cache},c.updateQueue.baseState=w,c.memoizedState=w,c.flags&256){c=d1(a,c,p,d);break e}else if(p!==v){v=Or(Error(r(424)),c),Gc(v),c=d1(a,c,p,d);break e}else for(a=c.stateNode.containerInfo,a.nodeType===9?a=a.body:a=a.nodeName==="HTML"?a.ownerDocument.body:a,Ot=Pr(a.firstChild),En=c,it=!0,Ds=null,Lr=!0,d=oC(c,null,p,d),c.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling;else{if(Qo(),p===v){c=Fi(a,c,d);break e}_n(a,c,p,d)}c=c.child}return c;case 26:return zf(a,c),a===null?(d=TE(c.type,null,c.pendingProps,null))?c.memoizedState=d:it||(d=c.type,a=c.pendingProps,p=th(_e.current).createElement(d),p[Cn]=c,p[rr]=a,An(p,d,a),hn(p),c.stateNode=p):c.memoizedState=TE(c.type,a.memoizedProps,c.pendingProps,a.memoizedState),null;case 27:return pe(c),a===null&&it&&(p=c.stateNode=kE(c.type,c.pendingProps,_e.current),En=c,Lr=!0,v=Ot,Ks(c.type)?(Av=v,Ot=Pr(p.firstChild)):Ot=v),_n(a,c,c.pendingProps.children,d),zf(a,c),a===null&&(c.flags|=4194304),c.child;case 5:return a===null&&it&&((v=p=Ot)&&(p=VP(p,c.type,c.pendingProps,Lr),p!==null?(c.stateNode=p,En=c,Ot=Pr(p.firstChild),Lr=!1,v=!0):v=!1),v||Is(c)),pe(c),v=c.type,w=c.pendingProps,E=a!==null?a.memoizedProps:null,p=w.children,kv(v,w)?p=null:E!==null&&kv(v,E)&&(c.flags|=32),c.memoizedState!==null&&(v=Sy(a,c,nP,null,null,d),bu._currentValue=v),zf(a,c),_n(a,c,p,d),c.child;case 6:return a===null&&it&&((a=d=Ot)&&(d=HP(d,c.pendingProps,Lr),d!==null?(c.stateNode=d,En=c,Ot=null,a=!0):a=!1),a||Is(c)),null;case 13:return f1(a,c,d);case 4:return ke(c,c.stateNode.containerInfo),p=c.pendingProps,a===null?c.child=sa(c,null,p,d):_n(a,c,p,d),c.child;case 11:return r1(a,c,c.type,c.pendingProps,d);case 7:return _n(a,c,c.pendingProps,d),c.child;case 8:return _n(a,c,c.pendingProps.children,d),c.child;case 12:return _n(a,c,c.pendingProps.children,d),c.child;case 10:return p=c.pendingProps,Ls(c,c.type,p.value),_n(a,c,p.children,d),c.child;case 9:return v=c.type._context,p=c.pendingProps.children,ta(c),v=Tn(v),p=p(v),c.flags|=1,_n(a,c,p,d),c.child;case 14:return i1(a,c,c.type,c.pendingProps,d);case 15:return s1(a,c,c.type,c.pendingProps,d);case 19:return p1(a,c,d);case 31:return uP(a,c,d);case 22:return o1(a,c,d,c.pendingProps);case 24:return ta(c),p=Tn(Qt),a===null?(v=fy(),v===null&&(v=Tt,w=uy(),v.pooledCache=w,w.refCount++,w!==null&&(v.pooledCacheLanes|=d),v=w),c.memoizedState={parent:p,cache:v},py(c),Ls(c,Qt,v)):((a.lanes&d)!==0&&(my(a,c),Qc(c,null,null,d),Jc()),v=a.memoizedState,w=c.memoizedState,v.parent!==p?(v={parent:p,cache:p},c.memoizedState=v,c.lanes===0&&(c.memoizedState=c.updateQueue.baseState=v),Ls(c,Qt,p)):(p=w.cache,Ls(c,Qt,p),p!==v.cache&&cy(c,[Qt],d,!0))),_n(a,c,c.pendingProps.children,d),c.child;case 29:throw c.pendingProps}throw Error(r(156,c.tag))}function qi(a){a.flags|=4}function Yy(a,c,d,p,v){if((c=(a.mode&32)!==0)&&(c=!1),c){if(a.flags|=16777216,(v&335544128)===v)if(a.stateNode.complete)a.flags|=8192;else if(H1())a.flags|=8192;else throw ia=kf,hy}else a.flags&=-16777217}function g1(a,c){if(c.type!=="stylesheet"||(c.state.loading&4)!==0)a.flags&=-16777217;else if(a.flags|=16777216,!NE(c))if(H1())a.flags|=8192;else throw ia=kf,hy}function Bf(a,c){c!==null&&(a.flags|=4),a.flags&16384&&(c=a.tag!==22?tf():536870912,a.lanes|=c,Al|=c)}function su(a,c){if(!it)switch(a.tailMode){case"hidden":c=a.tail;for(var d=null;c!==null;)c.alternate!==null&&(d=c),c=c.sibling;d===null?a.tail=null:d.sibling=null;break;case"collapsed":d=a.tail;for(var p=null;d!==null;)d.alternate!==null&&(p=d),d=d.sibling;p===null?c||a.tail===null?a.tail=null:a.tail.sibling=null:p.sibling=null}}function Dt(a){var c=a.alternate!==null&&a.alternate.child===a.child,d=0,p=0;if(c)for(var v=a.child;v!==null;)d|=v.lanes|v.childLanes,p|=v.subtreeFlags&65011712,p|=v.flags&65011712,v.return=a,v=v.sibling;else for(v=a.child;v!==null;)d|=v.lanes|v.childLanes,p|=v.subtreeFlags,p|=v.flags,v.return=a,v=v.sibling;return a.subtreeFlags|=p,a.childLanes=d,c}function fP(a,c,d){var p=c.pendingProps;switch(iy(c),c.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Dt(c),null;case 1:return Dt(c),null;case 3:return d=c.stateNode,p=null,a!==null&&(p=a.memoizedState.cache),c.memoizedState.cache!==p&&(c.flags|=2048),Vi(Qt),se(),d.pendingContext&&(d.context=d.pendingContext,d.pendingContext=null),(a===null||a.child===null)&&(ml(c)?qi(c):a===null||a.memoizedState.isDehydrated&&(c.flags&256)===0||(c.flags|=1024,oy())),Dt(c),null;case 26:var v=c.type,w=c.memoizedState;return a===null?(qi(c),w!==null?(Dt(c),g1(c,w)):(Dt(c),Yy(c,v,null,p,d))):w?w!==a.memoizedState?(qi(c),Dt(c),g1(c,w)):(Dt(c),c.flags&=-16777217):(a=a.memoizedProps,a!==p&&qi(c),Dt(c),Yy(c,v,a,p,d)),null;case 27:if(Me(c),d=_e.current,v=c.type,a!==null&&c.stateNode!=null)a.memoizedProps!==p&&qi(c);else{if(!p){if(c.stateNode===null)throw Error(r(166));return Dt(c),null}a=ge.current,ml(c)?Zk(c):(a=kE(v,p,d),c.stateNode=a,qi(c))}return Dt(c),null;case 5:if(Me(c),v=c.type,a!==null&&c.stateNode!=null)a.memoizedProps!==p&&qi(c);else{if(!p){if(c.stateNode===null)throw Error(r(166));return Dt(c),null}if(w=ge.current,ml(c))Zk(c);else{var E=th(_e.current);switch(w){case 1:w=E.createElementNS("http://www.w3.org/2000/svg",v);break;case 2:w=E.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;default:switch(v){case"svg":w=E.createElementNS("http://www.w3.org/2000/svg",v);break;case"math":w=E.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;case"script":w=E.createElement("div"),w.innerHTML="<script><\/script>",w=w.removeChild(w.firstChild);break;case"select":w=typeof p.is=="string"?E.createElement("select",{is:p.is}):E.createElement("select"),p.multiple?w.multiple=!0:p.size&&(w.size=p.size);break;default:w=typeof p.is=="string"?E.createElement(v,{is:p.is}):E.createElement(v)}}w[Cn]=c,w[rr]=p;e:for(E=c.child;E!==null;){if(E.tag===5||E.tag===6)w.appendChild(E.stateNode);else if(E.tag!==4&&E.tag!==27&&E.child!==null){E.child.return=E,E=E.child;continue}if(E===c)break e;for(;E.sibling===null;){if(E.return===null||E.return===c)break e;E=E.return}E.sibling.return=E.return,E=E.sibling}c.stateNode=w;e:switch(An(w,v,p),v){case"button":case"input":case"select":case"textarea":p=!!p.autoFocus;break e;case"img":p=!0;break e;default:p=!1}p&&qi(c)}}return Dt(c),Yy(c,c.type,a===null?null:a.memoizedProps,c.pendingProps,d),null;case 6:if(a&&c.stateNode!=null)a.memoizedProps!==p&&qi(c);else{if(typeof p!="string"&&c.stateNode===null)throw Error(r(166));if(a=_e.current,ml(c)){if(a=c.stateNode,d=c.memoizedProps,p=null,v=En,v!==null)switch(v.tag){case 27:case 5:p=v.memoizedProps}a[Cn]=c,a=!!(a.nodeValue===d||p!==null&&p.suppressHydrationWarning===!0||fE(a.nodeValue,d)),a||Is(c,!0)}else a=th(a).createTextNode(p),a[Cn]=c,c.stateNode=a}return Dt(c),null;case 31:if(d=c.memoizedState,a===null||a.memoizedState!==null){if(p=ml(c),d!==null){if(a===null){if(!p)throw Error(r(318));if(a=c.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(r(557));a[Cn]=c}else Qo(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;Dt(c),a=!1}else d=oy(),a!==null&&a.memoizedState!==null&&(a.memoizedState.hydrationErrors=d),a=!0;if(!a)return c.flags&256?(gr(c),c):(gr(c),null);if((c.flags&128)!==0)throw Error(r(558))}return Dt(c),null;case 13:if(p=c.memoizedState,a===null||a.memoizedState!==null&&a.memoizedState.dehydrated!==null){if(v=ml(c),p!==null&&p.dehydrated!==null){if(a===null){if(!v)throw Error(r(318));if(v=c.memoizedState,v=v!==null?v.dehydrated:null,!v)throw Error(r(317));v[Cn]=c}else Qo(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;Dt(c),v=!1}else v=oy(),a!==null&&a.memoizedState!==null&&(a.memoizedState.hydrationErrors=v),v=!0;if(!v)return c.flags&256?(gr(c),c):(gr(c),null)}return gr(c),(c.flags&128)!==0?(c.lanes=d,c):(d=p!==null,a=a!==null&&a.memoizedState!==null,d&&(p=c.child,v=null,p.alternate!==null&&p.alternate.memoizedState!==null&&p.alternate.memoizedState.cachePool!==null&&(v=p.alternate.memoizedState.cachePool.pool),w=null,p.memoizedState!==null&&p.memoizedState.cachePool!==null&&(w=p.memoizedState.cachePool.pool),w!==v&&(p.flags|=2048)),d!==a&&d&&(c.child.flags|=8192),Bf(c,c.updateQueue),Dt(c),null);case 4:return se(),a===null&&vv(c.stateNode.containerInfo),Dt(c),null;case 10:return Vi(c.type),Dt(c),null;case 19:if(X(Kt),p=c.memoizedState,p===null)return Dt(c),null;if(v=(c.flags&128)!==0,w=p.rendering,w===null)if(v)su(p,!1);else{if(Ut!==0||a!==null&&(a.flags&128)!==0)for(a=c.child;a!==null;){if(w=_f(a),w!==null){for(c.flags|=128,su(p,!1),a=w.updateQueue,c.updateQueue=a,Bf(c,a),c.subtreeFlags=0,a=d,d=c.child;d!==null;)Fk(d,a),d=d.sibling;return fe(Kt,Kt.current&1|2),it&&$i(c,p.treeForkCount),c.child}a=a.sibling}p.tail!==null&&zt()>qf&&(c.flags|=128,v=!0,su(p,!1),c.lanes=4194304)}else{if(!v)if(a=_f(w),a!==null){if(c.flags|=128,v=!0,a=a.updateQueue,c.updateQueue=a,Bf(c,a),su(p,!0),p.tail===null&&p.tailMode==="hidden"&&!w.alternate&&!it)return Dt(c),null}else 2*zt()-p.renderingStartTime>qf&&d!==536870912&&(c.flags|=128,v=!0,su(p,!1),c.lanes=4194304);p.isBackwards?(w.sibling=c.child,c.child=w):(a=p.last,a!==null?a.sibling=w:c.child=w,p.last=w)}return p.tail!==null?(a=p.tail,p.rendering=a,p.tail=a.sibling,p.renderingStartTime=zt(),a.sibling=null,d=Kt.current,fe(Kt,v?d&1|2:d&1),it&&$i(c,p.treeForkCount),a):(Dt(c),null);case 22:case 23:return gr(c),by(),p=c.memoizedState!==null,a!==null?a.memoizedState!==null!==p&&(c.flags|=8192):p&&(c.flags|=8192),p?(d&536870912)!==0&&(c.flags&128)===0&&(Dt(c),c.subtreeFlags&6&&(c.flags|=8192)):Dt(c),d=c.updateQueue,d!==null&&Bf(c,d.retryQueue),d=null,a!==null&&a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(d=a.memoizedState.cachePool.pool),p=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(p=c.memoizedState.cachePool.pool),p!==d&&(c.flags|=2048),a!==null&&X(na),null;case 24:return d=null,a!==null&&(d=a.memoizedState.cache),c.memoizedState.cache!==d&&(c.flags|=2048),Vi(Qt),Dt(c),null;case 25:return null;case 30:return null}throw Error(r(156,c.tag))}function hP(a,c){switch(iy(c),c.tag){case 1:return a=c.flags,a&65536?(c.flags=a&-65537|128,c):null;case 3:return Vi(Qt),se(),a=c.flags,(a&65536)!==0&&(a&128)===0?(c.flags=a&-65537|128,c):null;case 26:case 27:case 5:return Me(c),null;case 31:if(c.memoizedState!==null){if(gr(c),c.alternate===null)throw Error(r(340));Qo()}return a=c.flags,a&65536?(c.flags=a&-65537|128,c):null;case 13:if(gr(c),a=c.memoizedState,a!==null&&a.dehydrated!==null){if(c.alternate===null)throw Error(r(340));Qo()}return a=c.flags,a&65536?(c.flags=a&-65537|128,c):null;case 19:return X(Kt),null;case 4:return se(),null;case 10:return Vi(c.type),null;case 22:case 23:return gr(c),by(),a!==null&&X(na),a=c.flags,a&65536?(c.flags=a&-65537|128,c):null;case 24:return Vi(Qt),null;case 25:return null;default:return null}}function y1(a,c){switch(iy(c),c.tag){case 3:Vi(Qt),se();break;case 26:case 27:case 5:Me(c);break;case 4:se();break;case 31:c.memoizedState!==null&&gr(c);break;case 13:gr(c);break;case 19:X(Kt);break;case 10:Vi(c.type);break;case 22:case 23:gr(c),by(),a!==null&&X(na);break;case 24:Vi(Qt)}}function ou(a,c){try{var d=c.updateQueue,p=d!==null?d.lastEffect:null;if(p!==null){var v=p.next;d=v;do{if((d.tag&a)===a){p=void 0;var w=d.create,E=d.inst;p=w(),E.destroy=p}d=d.next}while(d!==v)}}catch(N){vt(c,c.return,N)}}function Vs(a,c,d){try{var p=c.updateQueue,v=p!==null?p.lastEffect:null;if(v!==null){var w=v.next;p=w;do{if((p.tag&a)===a){var E=p.inst,N=E.destroy;if(N!==void 0){E.destroy=void 0,v=c;var $=d,Y=N;try{Y()}catch(ie){vt(v,$,ie)}}}p=p.next}while(p!==w)}}catch(ie){vt(c,c.return,ie)}}function v1(a){var c=a.updateQueue;if(c!==null){var d=a.stateNode;try{lC(c,d)}catch(p){vt(a,a.return,p)}}}function b1(a,c,d){d.props=aa(a.type,a.memoizedProps),d.state=a.memoizedState;try{d.componentWillUnmount()}catch(p){vt(a,c,p)}}function au(a,c){try{var d=a.ref;if(d!==null){switch(a.tag){case 26:case 27:case 5:var p=a.stateNode;break;case 30:p=a.stateNode;break;default:p=a.stateNode}typeof d=="function"?a.refCleanup=d(p):d.current=p}}catch(v){vt(a,c,v)}}function bi(a,c){var d=a.ref,p=a.refCleanup;if(d!==null)if(typeof p=="function")try{p()}catch(v){vt(a,c,v)}finally{a.refCleanup=null,a=a.alternate,a!=null&&(a.refCleanup=null)}else if(typeof d=="function")try{d(null)}catch(v){vt(a,c,v)}else d.current=null}function x1(a){var c=a.type,d=a.memoizedProps,p=a.stateNode;try{e:switch(c){case"button":case"input":case"select":case"textarea":d.autoFocus&&p.focus();break e;case"img":d.src?p.src=d.src:d.srcSet&&(p.srcset=d.srcSet)}}catch(v){vt(a,a.return,v)}}function Xy(a,c,d){try{var p=a.stateNode;LP(p,a.type,d,c),p[rr]=c}catch(v){vt(a,a.return,v)}}function w1(a){return a.tag===5||a.tag===3||a.tag===26||a.tag===27&&Ks(a.type)||a.tag===4}function Jy(a){e:for(;;){for(;a.sibling===null;){if(a.return===null||w1(a.return))return null;a=a.return}for(a.sibling.return=a.return,a=a.sibling;a.tag!==5&&a.tag!==6&&a.tag!==18;){if(a.tag===27&&Ks(a.type)||a.flags&2||a.child===null||a.tag===4)continue e;a.child.return=a,a=a.child}if(!(a.flags&2))return a.stateNode}}function Qy(a,c,d){var p=a.tag;if(p===5||p===6)a=a.stateNode,c?(d.nodeType===9?d.body:d.nodeName==="HTML"?d.ownerDocument.body:d).insertBefore(a,c):(c=d.nodeType===9?d.body:d.nodeName==="HTML"?d.ownerDocument.body:d,c.appendChild(a),d=d._reactRootContainer,d!=null||c.onclick!==null||(c.onclick=ji));else if(p!==4&&(p===27&&Ks(a.type)&&(d=a.stateNode,c=null),a=a.child,a!==null))for(Qy(a,c,d),a=a.sibling;a!==null;)Qy(a,c,d),a=a.sibling}function Vf(a,c,d){var p=a.tag;if(p===5||p===6)a=a.stateNode,c?d.insertBefore(a,c):d.appendChild(a);else if(p!==4&&(p===27&&Ks(a.type)&&(d=a.stateNode),a=a.child,a!==null))for(Vf(a,c,d),a=a.sibling;a!==null;)Vf(a,c,d),a=a.sibling}function S1(a){var c=a.stateNode,d=a.memoizedProps;try{for(var p=a.type,v=c.attributes;v.length;)c.removeAttributeNode(v[0]);An(c,p,d),c[Cn]=a,c[rr]=d}catch(w){vt(a,a.return,w)}}var Gi=!1,nn=!1,ev=!1,k1=typeof WeakSet=="function"?WeakSet:Set,pn=null;function pP(a,c){if(a=a.containerInfo,wv=lh,a=Lk(a),Wg(a)){if("selectionStart"in a)var d={start:a.selectionStart,end:a.selectionEnd};else e:{d=(d=a.ownerDocument)&&d.defaultView||window;var p=d.getSelection&&d.getSelection();if(p&&p.rangeCount!==0){d=p.anchorNode;var v=p.anchorOffset,w=p.focusNode;p=p.focusOffset;try{d.nodeType,w.nodeType}catch{d=null;break e}var E=0,N=-1,$=-1,Y=0,ie=0,ce=a,J=null;t:for(;;){for(var te;ce!==d||v!==0&&ce.nodeType!==3||(N=E+v),ce!==w||p!==0&&ce.nodeType!==3||($=E+p),ce.nodeType===3&&(E+=ce.nodeValue.length),(te=ce.firstChild)!==null;)J=ce,ce=te;for(;;){if(ce===a)break t;if(J===d&&++Y===v&&(N=E),J===w&&++ie===p&&($=E),(te=ce.nextSibling)!==null)break;ce=J,J=ce.parentNode}ce=te}d=N===-1||$===-1?null:{start:N,end:$}}else d=null}d=d||{start:0,end:0}}else d=null;for(Sv={focusedElem:a,selectionRange:d},lh=!1,pn=c;pn!==null;)if(c=pn,a=c.child,(c.subtreeFlags&1028)!==0&&a!==null)a.return=c,pn=a;else for(;pn!==null;){switch(c=pn,w=c.alternate,a=c.flags,c.tag){case 0:if((a&4)!==0&&(a=c.updateQueue,a=a!==null?a.events:null,a!==null))for(d=0;d<a.length;d++)v=a[d],v.ref.impl=v.nextImpl;break;case 11:case 15:break;case 1:if((a&1024)!==0&&w!==null){a=void 0,d=c,v=w.memoizedProps,w=w.memoizedState,p=d.stateNode;try{var Ae=aa(d.type,v);a=p.getSnapshotBeforeUpdate(Ae,w),p.__reactInternalSnapshotBeforeUpdate=a}catch(Be){vt(d,d.return,Be)}}break;case 3:if((a&1024)!==0){if(a=c.stateNode.containerInfo,d=a.nodeType,d===9)Ev(a);else if(d===1)switch(a.nodeName){case"HEAD":case"HTML":case"BODY":Ev(a);break;default:a.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((a&1024)!==0)throw Error(r(163))}if(a=c.sibling,a!==null){a.return=c.return,pn=a;break}pn=c.return}}function C1(a,c,d){var p=d.flags;switch(d.tag){case 0:case 11:case 15:Ki(a,d),p&4&&ou(5,d);break;case 1:if(Ki(a,d),p&4)if(a=d.stateNode,c===null)try{a.componentDidMount()}catch(E){vt(d,d.return,E)}else{var v=aa(d.type,c.memoizedProps);c=c.memoizedState;try{a.componentDidUpdate(v,c,a.__reactInternalSnapshotBeforeUpdate)}catch(E){vt(d,d.return,E)}}p&64&&v1(d),p&512&&au(d,d.return);break;case 3:if(Ki(a,d),p&64&&(a=d.updateQueue,a!==null)){if(c=null,d.child!==null)switch(d.child.tag){case 27:case 5:c=d.child.stateNode;break;case 1:c=d.child.stateNode}try{lC(a,c)}catch(E){vt(d,d.return,E)}}break;case 27:c===null&&p&4&&S1(d);case 26:case 5:Ki(a,d),c===null&&p&4&&x1(d),p&512&&au(d,d.return);break;case 12:Ki(a,d);break;case 31:Ki(a,d),p&4&&_1(a,d);break;case 13:Ki(a,d),p&4&&A1(a,d),p&64&&(a=d.memoizedState,a!==null&&(a=a.dehydrated,a!==null&&(d=kP.bind(null,d),UP(a,d))));break;case 22:if(p=d.memoizedState!==null||Gi,!p){c=c!==null&&c.memoizedState!==null||nn,v=Gi;var w=nn;Gi=p,(nn=c)&&!w?Zi(a,d,(d.subtreeFlags&8772)!==0):Ki(a,d),Gi=v,nn=w}break;case 30:break;default:Ki(a,d)}}function E1(a){var c=a.alternate;c!==null&&(a.alternate=null,E1(c)),a.child=null,a.deletions=null,a.sibling=null,a.tag===5&&(c=a.stateNode,c!==null&&Mg(c)),a.stateNode=null,a.return=null,a.dependencies=null,a.memoizedProps=null,a.memoizedState=null,a.pendingProps=null,a.stateNode=null,a.updateQueue=null}var jt=null,sr=!1;function Wi(a,c,d){for(d=d.child;d!==null;)T1(a,c,d),d=d.sibling}function T1(a,c,d){if(W&&typeof W.onCommitFiberUnmount=="function")try{W.onCommitFiberUnmount(j,d)}catch{}switch(d.tag){case 26:nn||bi(d,c),Wi(a,c,d),d.memoizedState?d.memoizedState.count--:d.stateNode&&(d=d.stateNode,d.parentNode.removeChild(d));break;case 27:nn||bi(d,c);var p=jt,v=sr;Ks(d.type)&&(jt=d.stateNode,sr=!1),Wi(a,c,d),gu(d.stateNode),jt=p,sr=v;break;case 5:nn||bi(d,c);case 6:if(p=jt,v=sr,jt=null,Wi(a,c,d),jt=p,sr=v,jt!==null)if(sr)try{(jt.nodeType===9?jt.body:jt.nodeName==="HTML"?jt.ownerDocument.body:jt).removeChild(d.stateNode)}catch(w){vt(d,c,w)}else try{jt.removeChild(d.stateNode)}catch(w){vt(d,c,w)}break;case 18:jt!==null&&(sr?(a=jt,vE(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,d.stateNode),jl(a)):vE(jt,d.stateNode));break;case 4:p=jt,v=sr,jt=d.stateNode.containerInfo,sr=!0,Wi(a,c,d),jt=p,sr=v;break;case 0:case 11:case 14:case 15:Vs(2,d,c),nn||Vs(4,d,c),Wi(a,c,d);break;case 1:nn||(bi(d,c),p=d.stateNode,typeof p.componentWillUnmount=="function"&&b1(d,c,p)),Wi(a,c,d);break;case 21:Wi(a,c,d);break;case 22:nn=(p=nn)||d.memoizedState!==null,Wi(a,c,d),nn=p;break;default:Wi(a,c,d)}}function _1(a,c){if(c.memoizedState===null&&(a=c.alternate,a!==null&&(a=a.memoizedState,a!==null))){a=a.dehydrated;try{jl(a)}catch(d){vt(c,c.return,d)}}}function A1(a,c){if(c.memoizedState===null&&(a=c.alternate,a!==null&&(a=a.memoizedState,a!==null&&(a=a.dehydrated,a!==null))))try{jl(a)}catch(d){vt(c,c.return,d)}}function mP(a){switch(a.tag){case 31:case 13:case 19:var c=a.stateNode;return c===null&&(c=a.stateNode=new k1),c;case 22:return a=a.stateNode,c=a._retryCache,c===null&&(c=a._retryCache=new k1),c;default:throw Error(r(435,a.tag))}}function Hf(a,c){var d=mP(a);c.forEach(function(p){if(!d.has(p)){d.add(p);var v=CP.bind(null,a,p);p.then(v,v)}})}function or(a,c){var d=c.deletions;if(d!==null)for(var p=0;p<d.length;p++){var v=d[p],w=a,E=c,N=E;e:for(;N!==null;){switch(N.tag){case 27:if(Ks(N.type)){jt=N.stateNode,sr=!1;break e}break;case 5:jt=N.stateNode,sr=!1;break e;case 3:case 4:jt=N.stateNode.containerInfo,sr=!0;break e}N=N.return}if(jt===null)throw Error(r(160));T1(w,E,v),jt=null,sr=!1,w=v.alternate,w!==null&&(w.return=null),v.return=null}if(c.subtreeFlags&13886)for(c=c.child;c!==null;)R1(c,a),c=c.sibling}var Jr=null;function R1(a,c){var d=a.alternate,p=a.flags;switch(a.tag){case 0:case 11:case 14:case 15:or(c,a),ar(a),p&4&&(Vs(3,a,a.return),ou(3,a),Vs(5,a,a.return));break;case 1:or(c,a),ar(a),p&512&&(nn||d===null||bi(d,d.return)),p&64&&Gi&&(a=a.updateQueue,a!==null&&(p=a.callbacks,p!==null&&(d=a.shared.hiddenCallbacks,a.shared.hiddenCallbacks=d===null?p:d.concat(p))));break;case 26:var v=Jr;if(or(c,a),ar(a),p&512&&(nn||d===null||bi(d,d.return)),p&4){var w=d!==null?d.memoizedState:null;if(p=a.memoizedState,d===null)if(p===null)if(a.stateNode===null){e:{p=a.type,d=a.memoizedProps,v=v.ownerDocument||v;t:switch(p){case"title":w=v.getElementsByTagName("title")[0],(!w||w[Ic]||w[Cn]||w.namespaceURI==="http://www.w3.org/2000/svg"||w.hasAttribute("itemprop"))&&(w=v.createElement(p),v.head.insertBefore(w,v.querySelector("head > title"))),An(w,p,d),w[Cn]=a,hn(w),p=w;break e;case"link":var E=RE("link","href",v).get(p+(d.href||""));if(E){for(var N=0;N<E.length;N++)if(w=E[N],w.getAttribute("href")===(d.href==null||d.href===""?null:d.href)&&w.getAttribute("rel")===(d.rel==null?null:d.rel)&&w.getAttribute("title")===(d.title==null?null:d.title)&&w.getAttribute("crossorigin")===(d.crossOrigin==null?null:d.crossOrigin)){E.splice(N,1);break t}}w=v.createElement(p),An(w,p,d),v.head.appendChild(w);break;case"meta":if(E=RE("meta","content",v).get(p+(d.content||""))){for(N=0;N<E.length;N++)if(w=E[N],w.getAttribute("content")===(d.content==null?null:""+d.content)&&w.getAttribute("name")===(d.name==null?null:d.name)&&w.getAttribute("property")===(d.property==null?null:d.property)&&w.getAttribute("http-equiv")===(d.httpEquiv==null?null:d.httpEquiv)&&w.getAttribute("charset")===(d.charSet==null?null:d.charSet)){E.splice(N,1);break t}}w=v.createElement(p),An(w,p,d),v.head.appendChild(w);break;default:throw Error(r(468,p))}w[Cn]=a,hn(w),p=w}a.stateNode=p}else ME(v,a.type,a.stateNode);else a.stateNode=AE(v,p,a.memoizedProps);else w!==p?(w===null?d.stateNode!==null&&(d=d.stateNode,d.parentNode.removeChild(d)):w.count--,p===null?ME(v,a.type,a.stateNode):AE(v,p,a.memoizedProps)):p===null&&a.stateNode!==null&&Xy(a,a.memoizedProps,d.memoizedProps)}break;case 27:or(c,a),ar(a),p&512&&(nn||d===null||bi(d,d.return)),d!==null&&p&4&&Xy(a,a.memoizedProps,d.memoizedProps);break;case 5:if(or(c,a),ar(a),p&512&&(nn||d===null||bi(d,d.return)),a.flags&32){v=a.stateNode;try{sl(v,"")}catch(Ae){vt(a,a.return,Ae)}}p&4&&a.stateNode!=null&&(v=a.memoizedProps,Xy(a,v,d!==null?d.memoizedProps:v)),p&1024&&(ev=!0);break;case 6:if(or(c,a),ar(a),p&4){if(a.stateNode===null)throw Error(r(162));p=a.memoizedProps,d=a.stateNode;try{d.nodeValue=p}catch(Ae){vt(a,a.return,Ae)}}break;case 3:if(ih=null,v=Jr,Jr=nh(c.containerInfo),or(c,a),Jr=v,ar(a),p&4&&d!==null&&d.memoizedState.isDehydrated)try{jl(c.containerInfo)}catch(Ae){vt(a,a.return,Ae)}ev&&(ev=!1,M1(a));break;case 4:p=Jr,Jr=nh(a.stateNode.containerInfo),or(c,a),ar(a),Jr=p;break;case 12:or(c,a),ar(a);break;case 31:or(c,a),ar(a),p&4&&(p=a.updateQueue,p!==null&&(a.updateQueue=null,Hf(a,p)));break;case 13:or(c,a),ar(a),a.child.flags&8192&&a.memoizedState!==null!=(d!==null&&d.memoizedState!==null)&&(Ff=zt()),p&4&&(p=a.updateQueue,p!==null&&(a.updateQueue=null,Hf(a,p)));break;case 22:v=a.memoizedState!==null;var $=d!==null&&d.memoizedState!==null,Y=Gi,ie=nn;if(Gi=Y||v,nn=ie||$,or(c,a),nn=ie,Gi=Y,ar(a),p&8192)e:for(c=a.stateNode,c._visibility=v?c._visibility&-2:c._visibility|1,v&&(d===null||$||Gi||nn||la(a)),d=null,c=a;;){if(c.tag===5||c.tag===26){if(d===null){$=d=c;try{if(w=$.stateNode,v)E=w.style,typeof E.setProperty=="function"?E.setProperty("display","none","important"):E.display="none";else{N=$.stateNode;var ce=$.memoizedProps.style,J=ce!=null&&ce.hasOwnProperty("display")?ce.display:null;N.style.display=J==null||typeof J=="boolean"?"":(""+J).trim()}}catch(Ae){vt($,$.return,Ae)}}}else if(c.tag===6){if(d===null){$=c;try{$.stateNode.nodeValue=v?"":$.memoizedProps}catch(Ae){vt($,$.return,Ae)}}}else if(c.tag===18){if(d===null){$=c;try{var te=$.stateNode;v?bE(te,!0):bE($.stateNode,!1)}catch(Ae){vt($,$.return,Ae)}}}else if((c.tag!==22&&c.tag!==23||c.memoizedState===null||c===a)&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===a)break e;for(;c.sibling===null;){if(c.return===null||c.return===a)break e;d===c&&(d=null),c=c.return}d===c&&(d=null),c.sibling.return=c.return,c=c.sibling}p&4&&(p=a.updateQueue,p!==null&&(d=p.retryQueue,d!==null&&(p.retryQueue=null,Hf(a,d))));break;case 19:or(c,a),ar(a),p&4&&(p=a.updateQueue,p!==null&&(a.updateQueue=null,Hf(a,p)));break;case 30:break;case 21:break;default:or(c,a),ar(a)}}function ar(a){var c=a.flags;if(c&2){try{for(var d,p=a.return;p!==null;){if(w1(p)){d=p;break}p=p.return}if(d==null)throw Error(r(160));switch(d.tag){case 27:var v=d.stateNode,w=Jy(a);Vf(a,w,v);break;case 5:var E=d.stateNode;d.flags&32&&(sl(E,""),d.flags&=-33);var N=Jy(a);Vf(a,N,E);break;case 3:case 4:var $=d.stateNode.containerInfo,Y=Jy(a);Qy(a,Y,$);break;default:throw Error(r(161))}}catch(ie){vt(a,a.return,ie)}a.flags&=-3}c&4096&&(a.flags&=-4097)}function M1(a){if(a.subtreeFlags&1024)for(a=a.child;a!==null;){var c=a;M1(c),c.tag===5&&c.flags&1024&&c.stateNode.reset(),a=a.sibling}}function Ki(a,c){if(c.subtreeFlags&8772)for(c=c.child;c!==null;)C1(a,c.alternate,c),c=c.sibling}function la(a){for(a=a.child;a!==null;){var c=a;switch(c.tag){case 0:case 11:case 14:case 15:Vs(4,c,c.return),la(c);break;case 1:bi(c,c.return);var d=c.stateNode;typeof d.componentWillUnmount=="function"&&b1(c,c.return,d),la(c);break;case 27:gu(c.stateNode);case 26:case 5:bi(c,c.return),la(c);break;case 22:c.memoizedState===null&&la(c);break;case 30:la(c);break;default:la(c)}a=a.sibling}}function Zi(a,c,d){for(d=d&&(c.subtreeFlags&8772)!==0,c=c.child;c!==null;){var p=c.alternate,v=a,w=c,E=w.flags;switch(w.tag){case 0:case 11:case 15:Zi(v,w,d),ou(4,w);break;case 1:if(Zi(v,w,d),p=w,v=p.stateNode,typeof v.componentDidMount=="function")try{v.componentDidMount()}catch(Y){vt(p,p.return,Y)}if(p=w,v=p.updateQueue,v!==null){var N=p.stateNode;try{var $=v.shared.hiddenCallbacks;if($!==null)for(v.shared.hiddenCallbacks=null,v=0;v<$.length;v++)aC($[v],N)}catch(Y){vt(p,p.return,Y)}}d&&E&64&&v1(w),au(w,w.return);break;case 27:S1(w);case 26:case 5:Zi(v,w,d),d&&p===null&&E&4&&x1(w),au(w,w.return);break;case 12:Zi(v,w,d);break;case 31:Zi(v,w,d),d&&E&4&&_1(v,w);break;case 13:Zi(v,w,d),d&&E&4&&A1(v,w);break;case 22:w.memoizedState===null&&Zi(v,w,d),au(w,w.return);break;case 30:break;default:Zi(v,w,d)}c=c.sibling}}function tv(a,c){var d=null;a!==null&&a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(d=a.memoizedState.cachePool.pool),a=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(a=c.memoizedState.cachePool.pool),a!==d&&(a!=null&&a.refCount++,d!=null&&Wc(d))}function nv(a,c){a=null,c.alternate!==null&&(a=c.alternate.memoizedState.cache),c=c.memoizedState.cache,c!==a&&(c.refCount++,a!=null&&Wc(a))}function Qr(a,c,d,p){if(c.subtreeFlags&10256)for(c=c.child;c!==null;)N1(a,c,d,p),c=c.sibling}function N1(a,c,d,p){var v=c.flags;switch(c.tag){case 0:case 11:case 15:Qr(a,c,d,p),v&2048&&ou(9,c);break;case 1:Qr(a,c,d,p);break;case 3:Qr(a,c,d,p),v&2048&&(a=null,c.alternate!==null&&(a=c.alternate.memoizedState.cache),c=c.memoizedState.cache,c!==a&&(c.refCount++,a!=null&&Wc(a)));break;case 12:if(v&2048){Qr(a,c,d,p),a=c.stateNode;try{var w=c.memoizedProps,E=w.id,N=w.onPostCommit;typeof N=="function"&&N(E,c.alternate===null?"mount":"update",a.passiveEffectDuration,-0)}catch($){vt(c,c.return,$)}}else Qr(a,c,d,p);break;case 31:Qr(a,c,d,p);break;case 13:Qr(a,c,d,p);break;case 23:break;case 22:w=c.stateNode,E=c.alternate,c.memoizedState!==null?w._visibility&2?Qr(a,c,d,p):lu(a,c):w._visibility&2?Qr(a,c,d,p):(w._visibility|=2,El(a,c,d,p,(c.subtreeFlags&10256)!==0||!1)),v&2048&&tv(E,c);break;case 24:Qr(a,c,d,p),v&2048&&nv(c.alternate,c);break;default:Qr(a,c,d,p)}}function El(a,c,d,p,v){for(v=v&&((c.subtreeFlags&10256)!==0||!1),c=c.child;c!==null;){var w=a,E=c,N=d,$=p,Y=E.flags;switch(E.tag){case 0:case 11:case 15:El(w,E,N,$,v),ou(8,E);break;case 23:break;case 22:var ie=E.stateNode;E.memoizedState!==null?ie._visibility&2?El(w,E,N,$,v):lu(w,E):(ie._visibility|=2,El(w,E,N,$,v)),v&&Y&2048&&tv(E.alternate,E);break;case 24:El(w,E,N,$,v),v&&Y&2048&&nv(E.alternate,E);break;default:El(w,E,N,$,v)}c=c.sibling}}function lu(a,c){if(c.subtreeFlags&10256)for(c=c.child;c!==null;){var d=a,p=c,v=p.flags;switch(p.tag){case 22:lu(d,p),v&2048&&tv(p.alternate,p);break;case 24:lu(d,p),v&2048&&nv(p.alternate,p);break;default:lu(d,p)}c=c.sibling}}var cu=8192;function Tl(a,c,d){if(a.subtreeFlags&cu)for(a=a.child;a!==null;)O1(a,c,d),a=a.sibling}function O1(a,c,d){switch(a.tag){case 26:Tl(a,c,d),a.flags&cu&&a.memoizedState!==null&&tz(d,Jr,a.memoizedState,a.memoizedProps);break;case 5:Tl(a,c,d);break;case 3:case 4:var p=Jr;Jr=nh(a.stateNode.containerInfo),Tl(a,c,d),Jr=p;break;case 22:a.memoizedState===null&&(p=a.alternate,p!==null&&p.memoizedState!==null?(p=cu,cu=16777216,Tl(a,c,d),cu=p):Tl(a,c,d));break;default:Tl(a,c,d)}}function D1(a){var c=a.alternate;if(c!==null&&(a=c.child,a!==null)){c.child=null;do c=a.sibling,a.sibling=null,a=c;while(a!==null)}}function uu(a){var c=a.deletions;if((a.flags&16)!==0){if(c!==null)for(var d=0;d<c.length;d++){var p=c[d];pn=p,L1(p,a)}D1(a)}if(a.subtreeFlags&10256)for(a=a.child;a!==null;)I1(a),a=a.sibling}function I1(a){switch(a.tag){case 0:case 11:case 15:uu(a),a.flags&2048&&Vs(9,a,a.return);break;case 3:uu(a);break;case 12:uu(a);break;case 22:var c=a.stateNode;a.memoizedState!==null&&c._visibility&2&&(a.return===null||a.return.tag!==13)?(c._visibility&=-3,Uf(a)):uu(a);break;default:uu(a)}}function Uf(a){var c=a.deletions;if((a.flags&16)!==0){if(c!==null)for(var d=0;d<c.length;d++){var p=c[d];pn=p,L1(p,a)}D1(a)}for(a=a.child;a!==null;){switch(c=a,c.tag){case 0:case 11:case 15:Vs(8,c,c.return),Uf(c);break;case 22:d=c.stateNode,d._visibility&2&&(d._visibility&=-3,Uf(c));break;default:Uf(c)}a=a.sibling}}function L1(a,c){for(;pn!==null;){var d=pn;switch(d.tag){case 0:case 11:case 15:Vs(8,d,c);break;case 23:case 22:if(d.memoizedState!==null&&d.memoizedState.cachePool!==null){var p=d.memoizedState.cachePool.pool;p!=null&&p.refCount++}break;case 24:Wc(d.memoizedState.cache)}if(p=d.child,p!==null)p.return=d,pn=p;else e:for(d=a;pn!==null;){p=pn;var v=p.sibling,w=p.return;if(E1(p),p===d){pn=null;break e}if(v!==null){v.return=w,pn=v;break e}pn=w}}}var gP={getCacheForType:function(a){var c=Tn(Qt),d=c.data.get(a);return d===void 0&&(d=a(),c.data.set(a,d)),d},cacheSignal:function(){return Tn(Qt).controller.signal}},yP=typeof WeakMap=="function"?WeakMap:Map,pt=0,Tt=null,et=null,nt=0,yt=0,yr=null,Hs=!1,_l=!1,rv=!1,Yi=0,Ut=0,Us=0,ca=0,iv=0,vr=0,Al=0,du=null,lr=null,sv=!1,Ff=0,j1=0,qf=1/0,Gf=null,Fs=null,fn=0,qs=null,Rl=null,Xi=0,ov=0,av=null,P1=null,fu=0,lv=null;function br(){return(pt&2)!==0&&nt!==0?nt&-nt:B.T!==null?pv():QS()}function z1(){if(vr===0)if((nt&536870912)===0||it){var a=$t;$t<<=1,($t&3932160)===0&&($t=262144),vr=a}else vr=536870912;return a=mr.current,a!==null&&(a.flags|=32),vr}function cr(a,c,d){(a===Tt&&(yt===2||yt===9)||a.cancelPendingCommit!==null)&&(Ml(a,0),Gs(a,nt,vr,!1)),Dc(a,d),((pt&2)===0||a!==Tt)&&(a===Tt&&((pt&2)===0&&(ca|=d),Ut===4&&Gs(a,nt,vr,!1)),xi(a))}function $1(a,c,d){if((pt&6)!==0)throw Error(r(327));var p=!d&&(c&127)===0&&(c&a.expiredLanes)===0||qo(a,c),v=p?xP(a,c):uv(a,c,!0),w=p;do{if(v===0){_l&&!p&&Gs(a,c,0,!1);break}else{if(d=a.current.alternate,w&&!vP(d)){v=uv(a,c,!1),w=!1;continue}if(v===2){if(w=c,a.errorRecoveryDisabledLanes&w)var E=0;else E=a.pendingLanes&-536870913,E=E!==0?E:E&536870912?536870912:0;if(E!==0){c=E;e:{var N=a;v=du;var $=N.current.memoizedState.isDehydrated;if($&&(Ml(N,E).flags|=256),E=uv(N,E,!1),E!==2){if(rv&&!$){N.errorRecoveryDisabledLanes|=w,ca|=w,v=4;break e}w=lr,lr=v,w!==null&&(lr===null?lr=w:lr.push.apply(lr,w))}v=E}if(w=!1,v!==2)continue}}if(v===1){Ml(a,0),Gs(a,c,0,!0);break}e:{switch(p=a,w=v,w){case 0:case 1:throw Error(r(345));case 4:if((c&4194048)!==c)break;case 6:Gs(p,c,vr,!Hs);break e;case 2:lr=null;break;case 3:case 5:break;default:throw Error(r(329))}if((c&62914560)===c&&(v=Ff+300-zt(),10<v)){if(Gs(p,c,vr,!Hs),gi(p,0,!0)!==0)break e;Xi=c,p.timeoutHandle=gE(B1.bind(null,p,d,lr,Gf,sv,c,vr,ca,Al,Hs,w,"Throttled",-0,0),v);break e}B1(p,d,lr,Gf,sv,c,vr,ca,Al,Hs,w,null,-0,0)}}break}while(!0);xi(a)}function B1(a,c,d,p,v,w,E,N,$,Y,ie,ce,J,te){if(a.timeoutHandle=-1,ce=c.subtreeFlags,ce&8192||(ce&16785408)===16785408){ce={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ji},O1(c,w,ce);var Ae=(w&62914560)===w?Ff-zt():(w&4194048)===w?j1-zt():0;if(Ae=nz(ce,Ae),Ae!==null){Xi=w,a.cancelPendingCommit=Ae(K1.bind(null,a,c,w,d,p,v,E,N,$,ie,ce,null,J,te)),Gs(a,w,E,!Y);return}}K1(a,c,w,d,p,v,E,N,$)}function vP(a){for(var c=a;;){var d=c.tag;if((d===0||d===11||d===15)&&c.flags&16384&&(d=c.updateQueue,d!==null&&(d=d.stores,d!==null)))for(var p=0;p<d.length;p++){var v=d[p],w=v.getSnapshot;v=v.value;try{if(!hr(w(),v))return!1}catch{return!1}}if(d=c.child,c.subtreeFlags&16384&&d!==null)d.return=c,c=d;else{if(c===a)break;for(;c.sibling===null;){if(c.return===null||c.return===a)return!0;c=c.return}c.sibling.return=c.return,c=c.sibling}}return!0}function Gs(a,c,d,p){c&=~iv,c&=~ca,a.suspendedLanes|=c,a.pingedLanes&=~c,p&&(a.warmLanes|=c),p=a.expirationTimes;for(var v=c;0<v;){var w=31-he(v),E=1<<w;p[w]=-1,v&=~E}d!==0&&YS(a,d,c)}function Wf(){return(pt&6)===0?(hu(0),!1):!0}function cv(){if(et!==null){if(yt===0)var a=et.return;else a=et,Bi=ea=null,Ey(a),xl=null,Zc=0,a=et;for(;a!==null;)y1(a.alternate,a),a=a.return;et=null}}function Ml(a,c){var d=a.timeoutHandle;d!==-1&&(a.timeoutHandle=-1,zP(d)),d=a.cancelPendingCommit,d!==null&&(a.cancelPendingCommit=null,d()),Xi=0,cv(),Tt=a,et=d=zi(a.current,null),nt=c,yt=0,yr=null,Hs=!1,_l=qo(a,c),rv=!1,Al=vr=iv=ca=Us=Ut=0,lr=du=null,sv=!1,(c&8)!==0&&(c|=c&32);var p=a.entangledLanes;if(p!==0)for(a=a.entanglements,p&=c;0<p;){var v=31-he(p),w=1<<v;c|=a[v],p&=~w}return Yi=c,pf(),d}function V1(a,c){Ye=null,B.H=ru,c===bl||c===Sf?(c=rC(),yt=3):c===hy?(c=rC(),yt=4):yt=c===Vy?8:c!==null&&typeof c=="object"&&typeof c.then=="function"?6:1,yr=c,et===null&&(Ut=1,jf(a,Or(c,a.current)))}function H1(){var a=mr.current;return a===null?!0:(nt&4194048)===nt?jr===null:(nt&62914560)===nt||(nt&536870912)!==0?a===jr:!1}function U1(){var a=B.H;return B.H=ru,a===null?ru:a}function F1(){var a=B.A;return B.A=gP,a}function Kf(){Ut=4,Hs||(nt&4194048)!==nt&&mr.current!==null||(_l=!0),(Us&134217727)===0&&(ca&134217727)===0||Tt===null||Gs(Tt,nt,vr,!1)}function uv(a,c,d){var p=pt;pt|=2;var v=U1(),w=F1();(Tt!==a||nt!==c)&&(Gf=null,Ml(a,c)),c=!1;var E=Ut;e:do try{if(yt!==0&&et!==null){var N=et,$=yr;switch(yt){case 8:cv(),E=6;break e;case 3:case 2:case 9:case 6:mr.current===null&&(c=!0);var Y=yt;if(yt=0,yr=null,Nl(a,N,$,Y),d&&_l){E=0;break e}break;default:Y=yt,yt=0,yr=null,Nl(a,N,$,Y)}}bP(),E=Ut;break}catch(ie){V1(a,ie)}while(!0);return c&&a.shellSuspendCounter++,Bi=ea=null,pt=p,B.H=v,B.A=w,et===null&&(Tt=null,nt=0,pf()),E}function bP(){for(;et!==null;)q1(et)}function xP(a,c){var d=pt;pt|=2;var p=U1(),v=F1();Tt!==a||nt!==c?(Gf=null,qf=zt()+500,Ml(a,c)):_l=qo(a,c);e:do try{if(yt!==0&&et!==null){c=et;var w=yr;t:switch(yt){case 1:yt=0,yr=null,Nl(a,c,w,1);break;case 2:case 9:if(tC(w)){yt=0,yr=null,G1(c);break}c=function(){yt!==2&&yt!==9||Tt!==a||(yt=7),xi(a)},w.then(c,c);break e;case 3:yt=7;break e;case 4:yt=5;break e;case 7:tC(w)?(yt=0,yr=null,G1(c)):(yt=0,yr=null,Nl(a,c,w,7));break;case 5:var E=null;switch(et.tag){case 26:E=et.memoizedState;case 5:case 27:var N=et;if(E?NE(E):N.stateNode.complete){yt=0,yr=null;var $=N.sibling;if($!==null)et=$;else{var Y=N.return;Y!==null?(et=Y,Zf(Y)):et=null}break t}}yt=0,yr=null,Nl(a,c,w,5);break;case 6:yt=0,yr=null,Nl(a,c,w,6);break;case 8:cv(),Ut=6;break e;default:throw Error(r(462))}}wP();break}catch(ie){V1(a,ie)}while(!0);return Bi=ea=null,B.H=p,B.A=v,pt=d,et!==null?0:(Tt=null,nt=0,pf(),Ut)}function wP(){for(;et!==null&&!Kr();)q1(et)}function q1(a){var c=m1(a.alternate,a,Yi);a.memoizedProps=a.pendingProps,c===null?Zf(a):et=c}function G1(a){var c=a,d=c.alternate;switch(c.tag){case 15:case 0:c=c1(d,c,c.pendingProps,c.type,void 0,nt);break;case 11:c=c1(d,c,c.pendingProps,c.type.render,c.ref,nt);break;case 5:Ey(c);default:y1(d,c),c=et=Fk(c,Yi),c=m1(d,c,Yi)}a.memoizedProps=a.pendingProps,c===null?Zf(a):et=c}function Nl(a,c,d,p){Bi=ea=null,Ey(c),xl=null,Zc=0;var v=c.return;try{if(cP(a,v,c,d,nt)){Ut=1,jf(a,Or(d,a.current)),et=null;return}}catch(w){if(v!==null)throw et=v,w;Ut=1,jf(a,Or(d,a.current)),et=null;return}c.flags&32768?(it||p===1?a=!0:_l||(nt&536870912)!==0?a=!1:(Hs=a=!0,(p===2||p===9||p===3||p===6)&&(p=mr.current,p!==null&&p.tag===13&&(p.flags|=16384))),W1(c,a)):Zf(c)}function Zf(a){var c=a;do{if((c.flags&32768)!==0){W1(c,Hs);return}a=c.return;var d=fP(c.alternate,c,Yi);if(d!==null){et=d;return}if(c=c.sibling,c!==null){et=c;return}et=c=a}while(c!==null);Ut===0&&(Ut=5)}function W1(a,c){do{var d=hP(a.alternate,a);if(d!==null){d.flags&=32767,et=d;return}if(d=a.return,d!==null&&(d.flags|=32768,d.subtreeFlags=0,d.deletions=null),!c&&(a=a.sibling,a!==null)){et=a;return}et=a=d}while(a!==null);Ut=6,et=null}function K1(a,c,d,p,v,w,E,N,$){a.cancelPendingCommit=null;do Yf();while(fn!==0);if((pt&6)!==0)throw Error(r(327));if(c!==null){if(c===a.current)throw Error(r(177));if(w=c.lanes|c.childLanes,w|=Jg,e2(a,d,w,E,N,$),a===Tt&&(et=Tt=null,nt=0),Rl=c,qs=a,Xi=d,ov=w,av=v,P1=p,(c.subtreeFlags&10256)!==0||(c.flags&10256)!==0?(a.callbackNode=null,a.callbackPriority=0,EP(qn,function(){return Q1(),null})):(a.callbackNode=null,a.callbackPriority=0),p=(c.flags&13878)!==0,(c.subtreeFlags&13878)!==0||p){p=B.T,B.T=null,v=z.p,z.p=2,E=pt,pt|=4;try{pP(a,c,d)}finally{pt=E,z.p=v,B.T=p}}fn=1,Z1(),Y1(),X1()}}function Z1(){if(fn===1){fn=0;var a=qs,c=Rl,d=(c.flags&13878)!==0;if((c.subtreeFlags&13878)!==0||d){d=B.T,B.T=null;var p=z.p;z.p=2;var v=pt;pt|=4;try{R1(c,a);var w=Sv,E=Lk(a.containerInfo),N=w.focusedElem,$=w.selectionRange;if(E!==N&&N&&N.ownerDocument&&Ik(N.ownerDocument.documentElement,N)){if($!==null&&Wg(N)){var Y=$.start,ie=$.end;if(ie===void 0&&(ie=Y),"selectionStart"in N)N.selectionStart=Y,N.selectionEnd=Math.min(ie,N.value.length);else{var ce=N.ownerDocument||document,J=ce&&ce.defaultView||window;if(J.getSelection){var te=J.getSelection(),Ae=N.textContent.length,Be=Math.min($.start,Ae),kt=$.end===void 0?Be:Math.min($.end,Ae);!te.extend&&Be>kt&&(E=kt,kt=Be,Be=E);var F=Dk(N,Be),H=Dk(N,kt);if(F&&H&&(te.rangeCount!==1||te.anchorNode!==F.node||te.anchorOffset!==F.offset||te.focusNode!==H.node||te.focusOffset!==H.offset)){var Z=ce.createRange();Z.setStart(F.node,F.offset),te.removeAllRanges(),Be>kt?(te.addRange(Z),te.extend(H.node,H.offset)):(Z.setEnd(H.node,H.offset),te.addRange(Z))}}}}for(ce=[],te=N;te=te.parentNode;)te.nodeType===1&&ce.push({element:te,left:te.scrollLeft,top:te.scrollTop});for(typeof N.focus=="function"&&N.focus(),N=0;N<ce.length;N++){var ae=ce[N];ae.element.scrollLeft=ae.left,ae.element.scrollTop=ae.top}}lh=!!wv,Sv=wv=null}finally{pt=v,z.p=p,B.T=d}}a.current=c,fn=2}}function Y1(){if(fn===2){fn=0;var a=qs,c=Rl,d=(c.flags&8772)!==0;if((c.subtreeFlags&8772)!==0||d){d=B.T,B.T=null;var p=z.p;z.p=2;var v=pt;pt|=4;try{C1(a,c.alternate,c)}finally{pt=v,z.p=p,B.T=d}}fn=3}}function X1(){if(fn===4||fn===3){fn=0,Ar();var a=qs,c=Rl,d=Xi,p=P1;(c.subtreeFlags&10256)!==0||(c.flags&10256)!==0?fn=5:(fn=0,Rl=qs=null,J1(a,a.pendingLanes));var v=a.pendingLanes;if(v===0&&(Fs=null),Ag(d),c=c.stateNode,W&&typeof W.onCommitFiberRoot=="function")try{W.onCommitFiberRoot(j,c,void 0,(c.current.flags&128)===128)}catch{}if(p!==null){c=B.T,v=z.p,z.p=2,B.T=null;try{for(var w=a.onRecoverableError,E=0;E<p.length;E++){var N=p[E];w(N.value,{componentStack:N.stack})}}finally{B.T=c,z.p=v}}(Xi&3)!==0&&Yf(),xi(a),v=a.pendingLanes,(d&261930)!==0&&(v&42)!==0?a===lv?fu++:(fu=0,lv=a):fu=0,hu(0)}}function J1(a,c){(a.pooledCacheLanes&=c)===0&&(c=a.pooledCache,c!=null&&(a.pooledCache=null,Wc(c)))}function Yf(){return Z1(),Y1(),X1(),Q1()}function Q1(){if(fn!==5)return!1;var a=qs,c=ov;ov=0;var d=Ag(Xi),p=B.T,v=z.p;try{z.p=32>d?32:d,B.T=null,d=av,av=null;var w=qs,E=Xi;if(fn=0,Rl=qs=null,Xi=0,(pt&6)!==0)throw Error(r(331));var N=pt;if(pt|=4,I1(w.current),N1(w,w.current,E,d),pt=N,hu(0,!1),W&&typeof W.onPostCommitFiberRoot=="function")try{W.onPostCommitFiberRoot(j,w)}catch{}return!0}finally{z.p=v,B.T=p,J1(a,c)}}function eE(a,c,d){c=Or(d,c),c=By(a.stateNode,c,2),a=zs(a,c,2),a!==null&&(Dc(a,2),xi(a))}function vt(a,c,d){if(a.tag===3)eE(a,a,d);else for(;c!==null;){if(c.tag===3){eE(c,a,d);break}else if(c.tag===1){var p=c.stateNode;if(typeof c.type.getDerivedStateFromError=="function"||typeof p.componentDidCatch=="function"&&(Fs===null||!Fs.has(p))){a=Or(d,a),d=t1(2),p=zs(c,d,2),p!==null&&(n1(d,p,c,a),Dc(p,2),xi(p));break}}c=c.return}}function dv(a,c,d){var p=a.pingCache;if(p===null){p=a.pingCache=new yP;var v=new Set;p.set(c,v)}else v=p.get(c),v===void 0&&(v=new Set,p.set(c,v));v.has(d)||(rv=!0,v.add(d),a=SP.bind(null,a,c,d),c.then(a,a))}function SP(a,c,d){var p=a.pingCache;p!==null&&p.delete(c),a.pingedLanes|=a.suspendedLanes&d,a.warmLanes&=~d,Tt===a&&(nt&d)===d&&(Ut===4||Ut===3&&(nt&62914560)===nt&&300>zt()-Ff?(pt&2)===0&&Ml(a,0):iv|=d,Al===nt&&(Al=0)),xi(a)}function tE(a,c){c===0&&(c=tf()),a=Xo(a,c),a!==null&&(Dc(a,c),xi(a))}function kP(a){var c=a.memoizedState,d=0;c!==null&&(d=c.retryLane),tE(a,d)}function CP(a,c){var d=0;switch(a.tag){case 31:case 13:var p=a.stateNode,v=a.memoizedState;v!==null&&(d=v.retryLane);break;case 19:p=a.stateNode;break;case 22:p=a.stateNode._retryCache;break;default:throw Error(r(314))}p!==null&&p.delete(c),tE(a,d)}function EP(a,c){return dn(a,c)}var Xf=null,Ol=null,fv=!1,Jf=!1,hv=!1,Ws=0;function xi(a){a!==Ol&&a.next===null&&(Ol===null?Xf=Ol=a:Ol=Ol.next=a),Jf=!0,fv||(fv=!0,_P())}function hu(a,c){if(!hv&&Jf){hv=!0;do for(var d=!1,p=Xf;p!==null;){if(a!==0){var v=p.pendingLanes;if(v===0)var w=0;else{var E=p.suspendedLanes,N=p.pingedLanes;w=(1<<31-he(42|a)+1)-1,w&=v&~(E&~N),w=w&201326741?w&201326741|1:w?w|2:0}w!==0&&(d=!0,sE(p,w))}else w=nt,w=gi(p,p===Tt?w:0,p.cancelPendingCommit!==null||p.timeoutHandle!==-1),(w&3)===0||qo(p,w)||(d=!0,sE(p,w));p=p.next}while(d);hv=!1}}function TP(){nE()}function nE(){Jf=fv=!1;var a=0;Ws!==0&&PP()&&(a=Ws);for(var c=zt(),d=null,p=Xf;p!==null;){var v=p.next,w=rE(p,c);w===0?(p.next=null,d===null?Xf=v:d.next=v,v===null&&(Ol=d)):(d=p,(a!==0||(w&3)!==0)&&(Jf=!0)),p=v}fn!==0&&fn!==5||hu(a),Ws!==0&&(Ws=0)}function rE(a,c){for(var d=a.suspendedLanes,p=a.pingedLanes,v=a.expirationTimes,w=a.pendingLanes&-62914561;0<w;){var E=31-he(w),N=1<<E,$=v[E];$===-1?((N&d)===0||(N&p)!==0)&&(v[E]=Go(N,c)):$<=c&&(a.expiredLanes|=N),w&=~N}if(c=Tt,d=nt,d=gi(a,a===c?d:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),p=a.callbackNode,d===0||a===c&&(yt===2||yt===9)||a.cancelPendingCommit!==null)return p!==null&&p!==null&&tr(p),a.callbackNode=null,a.callbackPriority=0;if((d&3)===0||qo(a,d)){if(c=d&-d,c===a.callbackPriority)return c;switch(p!==null&&tr(p),Ag(d)){case 2:case 8:d=Yr;break;case 32:d=qn;break;case 268435456:d=le;break;default:d=qn}return p=iE.bind(null,a),d=dn(d,p),a.callbackPriority=c,a.callbackNode=d,c}return p!==null&&p!==null&&tr(p),a.callbackPriority=2,a.callbackNode=null,2}function iE(a,c){if(fn!==0&&fn!==5)return a.callbackNode=null,a.callbackPriority=0,null;var d=a.callbackNode;if(Yf()&&a.callbackNode!==d)return null;var p=nt;return p=gi(a,a===Tt?p:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),p===0?null:($1(a,p,c),rE(a,zt()),a.callbackNode!=null&&a.callbackNode===d?iE.bind(null,a):null)}function sE(a,c){if(Yf())return null;$1(a,c,!0)}function _P(){$P(function(){(pt&6)!==0?dn(Zr,TP):nE()})}function pv(){if(Ws===0){var a=yl;a===0&&(a=ot,ot<<=1,(ot&261888)===0&&(ot=256)),Ws=a}return Ws}function oE(a){return a==null||typeof a=="symbol"||typeof a=="boolean"?null:typeof a=="function"?a:of(""+a)}function aE(a,c){var d=c.ownerDocument.createElement("input");return d.name=c.name,d.value=c.value,a.id&&d.setAttribute("form",a.id),c.parentNode.insertBefore(d,c),a=new FormData(a),d.parentNode.removeChild(d),a}function AP(a,c,d,p,v){if(c==="submit"&&d&&d.stateNode===v){var w=oE((v[rr]||null).action),E=p.submitter;E&&(c=(c=E[rr]||null)?oE(c.formAction):E.getAttribute("formAction"),c!==null&&(w=c,E=null));var N=new uf("action","action",null,p,v);a.push({event:N,listeners:[{instance:null,listener:function(){if(p.defaultPrevented){if(Ws!==0){var $=E?aE(v,E):new FormData(v);Iy(d,{pending:!0,data:$,method:v.method,action:w},null,$)}}else typeof w=="function"&&(N.preventDefault(),$=E?aE(v,E):new FormData(v),Iy(d,{pending:!0,data:$,method:v.method,action:w},w,$))},currentTarget:v}]})}}for(var mv=0;mv<Xg.length;mv++){var gv=Xg[mv],RP=gv.toLowerCase(),MP=gv[0].toUpperCase()+gv.slice(1);Xr(RP,"on"+MP)}Xr(zk,"onAnimationEnd"),Xr($k,"onAnimationIteration"),Xr(Bk,"onAnimationStart"),Xr("dblclick","onDoubleClick"),Xr("focusin","onFocus"),Xr("focusout","onBlur"),Xr(G2,"onTransitionRun"),Xr(W2,"onTransitionStart"),Xr(K2,"onTransitionCancel"),Xr(Vk,"onTransitionEnd"),rl("onMouseEnter",["mouseout","mouseover"]),rl("onMouseLeave",["mouseout","mouseover"]),rl("onPointerEnter",["pointerout","pointerover"]),rl("onPointerLeave",["pointerout","pointerover"]),Wo("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Wo("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Wo("onBeforeInput",["compositionend","keypress","textInput","paste"]),Wo("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Wo("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Wo("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var pu="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(" "),NP=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(pu));function lE(a,c){c=(c&4)!==0;for(var d=0;d<a.length;d++){var p=a[d],v=p.event;p=p.listeners;e:{var w=void 0;if(c)for(var E=p.length-1;0<=E;E--){var N=p[E],$=N.instance,Y=N.currentTarget;if(N=N.listener,$!==w&&v.isPropagationStopped())break e;w=N,v.currentTarget=Y;try{w(v)}catch(ie){hf(ie)}v.currentTarget=null,w=$}else for(E=0;E<p.length;E++){if(N=p[E],$=N.instance,Y=N.currentTarget,N=N.listener,$!==w&&v.isPropagationStopped())break e;w=N,v.currentTarget=Y;try{w(v)}catch(ie){hf(ie)}v.currentTarget=null,w=$}}}}function tt(a,c){var d=c[Rg];d===void 0&&(d=c[Rg]=new Set);var p=a+"__bubble";d.has(p)||(cE(c,a,2,!1),d.add(p))}function yv(a,c,d){var p=0;c&&(p|=4),cE(d,a,p,c)}var Qf="_reactListening"+Math.random().toString(36).slice(2);function vv(a){if(!a[Qf]){a[Qf]=!0,nk.forEach(function(d){d!=="selectionchange"&&(NP.has(d)||yv(d,!1,a),yv(d,!0,a))});var c=a.nodeType===9?a:a.ownerDocument;c===null||c[Qf]||(c[Qf]=!0,yv("selectionchange",!1,c))}}function cE(a,c,d,p){switch(zE(c)){case 2:var v=sz;break;case 8:v=oz;break;default:v=Dv}d=v.bind(null,c,d,a),v=void 0,!zg||c!=="touchstart"&&c!=="touchmove"&&c!=="wheel"||(v=!0),p?v!==void 0?a.addEventListener(c,d,{capture:!0,passive:v}):a.addEventListener(c,d,!0):v!==void 0?a.addEventListener(c,d,{passive:v}):a.addEventListener(c,d,!1)}function bv(a,c,d,p,v){var w=p;if((c&1)===0&&(c&2)===0&&p!==null)e:for(;;){if(p===null)return;var E=p.tag;if(E===3||E===4){var N=p.stateNode.containerInfo;if(N===v)break;if(E===4)for(E=p.return;E!==null;){var $=E.tag;if(($===3||$===4)&&E.stateNode.containerInfo===v)return;E=E.return}for(;N!==null;){if(E=el(N),E===null)return;if($=E.tag,$===5||$===6||$===26||$===27){p=w=E;continue e}N=N.parentNode}}p=p.return}pk(function(){var Y=w,ie=jg(d),ce=[];e:{var J=Hk.get(a);if(J!==void 0){var te=uf,Ae=a;switch(a){case"keypress":if(lf(d)===0)break e;case"keydown":case"keyup":te=C2;break;case"focusin":Ae="focus",te=Hg;break;case"focusout":Ae="blur",te=Hg;break;case"beforeblur":case"afterblur":te=Hg;break;case"click":if(d.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":te=yk;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":te=f2;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":te=_2;break;case zk:case $k:case Bk:te=m2;break;case Vk:te=R2;break;case"scroll":case"scrollend":te=u2;break;case"wheel":te=N2;break;case"copy":case"cut":case"paste":te=y2;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":te=bk;break;case"toggle":case"beforetoggle":te=D2}var Be=(c&4)!==0,kt=!Be&&(a==="scroll"||a==="scrollend"),F=Be?J!==null?J+"Capture":null:J;Be=[];for(var H=Y,Z;H!==null;){var ae=H;if(Z=ae.stateNode,ae=ae.tag,ae!==5&&ae!==26&&ae!==27||Z===null||F===null||(ae=jc(H,F),ae!=null&&Be.push(mu(H,ae,Z))),kt)break;H=H.return}0<Be.length&&(J=new te(J,Ae,null,d,ie),ce.push({event:J,listeners:Be}))}}if((c&7)===0){e:{if(J=a==="mouseover"||a==="pointerover",te=a==="mouseout"||a==="pointerout",J&&d!==Lg&&(Ae=d.relatedTarget||d.fromElement)&&(el(Ae)||Ae[Qa]))break e;if((te||J)&&(J=ie.window===ie?ie:(J=ie.ownerDocument)?J.defaultView||J.parentWindow:window,te?(Ae=d.relatedTarget||d.toElement,te=Y,Ae=Ae?el(Ae):null,Ae!==null&&(kt=s(Ae),Be=Ae.tag,Ae!==kt||Be!==5&&Be!==27&&Be!==6)&&(Ae=null)):(te=null,Ae=Y),te!==Ae)){if(Be=yk,ae="onMouseLeave",F="onMouseEnter",H="mouse",(a==="pointerout"||a==="pointerover")&&(Be=bk,ae="onPointerLeave",F="onPointerEnter",H="pointer"),kt=te==null?J:Lc(te),Z=Ae==null?J:Lc(Ae),J=new Be(ae,H+"leave",te,d,ie),J.target=kt,J.relatedTarget=Z,ae=null,el(ie)===Y&&(Be=new Be(F,H+"enter",Ae,d,ie),Be.target=Z,Be.relatedTarget=kt,ae=Be),kt=ae,te&&Ae)t:{for(Be=OP,F=te,H=Ae,Z=0,ae=F;ae;ae=Be(ae))Z++;ae=0;for(var je=H;je;je=Be(je))ae++;for(;0<Z-ae;)F=Be(F),Z--;for(;0<ae-Z;)H=Be(H),ae--;for(;Z--;){if(F===H||H!==null&&F===H.alternate){Be=F;break t}F=Be(F),H=Be(H)}Be=null}else Be=null;te!==null&&uE(ce,J,te,Be,!1),Ae!==null&&kt!==null&&uE(ce,kt,Ae,Be,!0)}}e:{if(J=Y?Lc(Y):window,te=J.nodeName&&J.nodeName.toLowerCase(),te==="select"||te==="input"&&J.type==="file")var lt=_k;else if(Ek(J))if(Ak)lt=U2;else{lt=V2;var Oe=B2}else te=J.nodeName,!te||te.toLowerCase()!=="input"||J.type!=="checkbox"&&J.type!=="radio"?Y&&Ig(Y.elementType)&&(lt=_k):lt=H2;if(lt&&(lt=lt(a,Y))){Tk(ce,lt,d,ie);break e}Oe&&Oe(a,J,Y),a==="focusout"&&Y&&J.type==="number"&&Y.memoizedProps.value!=null&&Dg(J,"number",J.value)}switch(Oe=Y?Lc(Y):window,a){case"focusin":(Ek(Oe)||Oe.contentEditable==="true")&&(cl=Oe,Kg=Y,Fc=null);break;case"focusout":Fc=Kg=cl=null;break;case"mousedown":Zg=!0;break;case"contextmenu":case"mouseup":case"dragend":Zg=!1,jk(ce,d,ie);break;case"selectionchange":if(q2)break;case"keydown":case"keyup":jk(ce,d,ie)}var Xe;if(Fg)e:{switch(a){case"compositionstart":var rt="onCompositionStart";break e;case"compositionend":rt="onCompositionEnd";break e;case"compositionupdate":rt="onCompositionUpdate";break e}rt=void 0}else ll?kk(a,d)&&(rt="onCompositionEnd"):a==="keydown"&&d.keyCode===229&&(rt="onCompositionStart");rt&&(xk&&d.locale!=="ko"&&(ll||rt!=="onCompositionStart"?rt==="onCompositionEnd"&&ll&&(Xe=mk()):(Ns=ie,$g="value"in Ns?Ns.value:Ns.textContent,ll=!0)),Oe=eh(Y,rt),0<Oe.length&&(rt=new vk(rt,a,null,d,ie),ce.push({event:rt,listeners:Oe}),Xe?rt.data=Xe:(Xe=Ck(d),Xe!==null&&(rt.data=Xe)))),(Xe=L2?j2(a,d):P2(a,d))&&(rt=eh(Y,"onBeforeInput"),0<rt.length&&(Oe=new vk("onBeforeInput","beforeinput",null,d,ie),ce.push({event:Oe,listeners:rt}),Oe.data=Xe)),AP(ce,a,Y,d,ie)}lE(ce,c)})}function mu(a,c,d){return{instance:a,listener:c,currentTarget:d}}function eh(a,c){for(var d=c+"Capture",p=[];a!==null;){var v=a,w=v.stateNode;if(v=v.tag,v!==5&&v!==26&&v!==27||w===null||(v=jc(a,d),v!=null&&p.unshift(mu(a,v,w)),v=jc(a,c),v!=null&&p.push(mu(a,v,w))),a.tag===3)return p;a=a.return}return[]}function OP(a){if(a===null)return null;do a=a.return;while(a&&a.tag!==5&&a.tag!==27);return a||null}function uE(a,c,d,p,v){for(var w=c._reactName,E=[];d!==null&&d!==p;){var N=d,$=N.alternate,Y=N.stateNode;if(N=N.tag,$!==null&&$===p)break;N!==5&&N!==26&&N!==27||Y===null||($=Y,v?(Y=jc(d,w),Y!=null&&E.unshift(mu(d,Y,$))):v||(Y=jc(d,w),Y!=null&&E.push(mu(d,Y,$)))),d=d.return}E.length!==0&&a.push({event:c,listeners:E})}var DP=/\r\n?/g,IP=/\u0000|\uFFFD/g;function dE(a){return(typeof a=="string"?a:""+a).replace(DP,`
|
|
9
|
-
`).replace(IP,"")}function fE(a,c){return c=dE(c),dE(a)===c}function St(a,c,d,p,v,w){switch(d){case"children":typeof p=="string"?c==="body"||c==="textarea"&&p===""||sl(a,p):(typeof p=="number"||typeof p=="bigint")&&c!=="body"&&sl(a,""+p);break;case"className":rf(a,"class",p);break;case"tabIndex":rf(a,"tabindex",p);break;case"dir":case"role":case"viewBox":case"width":case"height":rf(a,d,p);break;case"style":fk(a,p,w);break;case"data":if(c!=="object"){rf(a,"data",p);break}case"src":case"href":if(p===""&&(c!=="a"||d!=="href")){a.removeAttribute(d);break}if(p==null||typeof p=="function"||typeof p=="symbol"||typeof p=="boolean"){a.removeAttribute(d);break}p=of(""+p),a.setAttribute(d,p);break;case"action":case"formAction":if(typeof p=="function"){a.setAttribute(d,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof w=="function"&&(d==="formAction"?(c!=="input"&&St(a,c,"name",v.name,v,null),St(a,c,"formEncType",v.formEncType,v,null),St(a,c,"formMethod",v.formMethod,v,null),St(a,c,"formTarget",v.formTarget,v,null)):(St(a,c,"encType",v.encType,v,null),St(a,c,"method",v.method,v,null),St(a,c,"target",v.target,v,null)));if(p==null||typeof p=="symbol"||typeof p=="boolean"){a.removeAttribute(d);break}p=of(""+p),a.setAttribute(d,p);break;case"onClick":p!=null&&(a.onclick=ji);break;case"onScroll":p!=null&&tt("scroll",a);break;case"onScrollEnd":p!=null&&tt("scrollend",a);break;case"dangerouslySetInnerHTML":if(p!=null){if(typeof p!="object"||!("__html"in p))throw Error(r(61));if(d=p.__html,d!=null){if(v.children!=null)throw Error(r(60));a.innerHTML=d}}break;case"multiple":a.multiple=p&&typeof p!="function"&&typeof p!="symbol";break;case"muted":a.muted=p&&typeof p!="function"&&typeof p!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(p==null||typeof p=="function"||typeof p=="boolean"||typeof p=="symbol"){a.removeAttribute("xlink:href");break}d=of(""+p),a.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",d);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":p!=null&&typeof p!="function"&&typeof p!="symbol"?a.setAttribute(d,""+p):a.removeAttribute(d);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":p&&typeof p!="function"&&typeof p!="symbol"?a.setAttribute(d,""):a.removeAttribute(d);break;case"capture":case"download":p===!0?a.setAttribute(d,""):p!==!1&&p!=null&&typeof p!="function"&&typeof p!="symbol"?a.setAttribute(d,p):a.removeAttribute(d);break;case"cols":case"rows":case"size":case"span":p!=null&&typeof p!="function"&&typeof p!="symbol"&&!isNaN(p)&&1<=p?a.setAttribute(d,p):a.removeAttribute(d);break;case"rowSpan":case"start":p==null||typeof p=="function"||typeof p=="symbol"||isNaN(p)?a.removeAttribute(d):a.setAttribute(d,p);break;case"popover":tt("beforetoggle",a),tt("toggle",a),nf(a,"popover",p);break;case"xlinkActuate":Li(a,"http://www.w3.org/1999/xlink","xlink:actuate",p);break;case"xlinkArcrole":Li(a,"http://www.w3.org/1999/xlink","xlink:arcrole",p);break;case"xlinkRole":Li(a,"http://www.w3.org/1999/xlink","xlink:role",p);break;case"xlinkShow":Li(a,"http://www.w3.org/1999/xlink","xlink:show",p);break;case"xlinkTitle":Li(a,"http://www.w3.org/1999/xlink","xlink:title",p);break;case"xlinkType":Li(a,"http://www.w3.org/1999/xlink","xlink:type",p);break;case"xmlBase":Li(a,"http://www.w3.org/XML/1998/namespace","xml:base",p);break;case"xmlLang":Li(a,"http://www.w3.org/XML/1998/namespace","xml:lang",p);break;case"xmlSpace":Li(a,"http://www.w3.org/XML/1998/namespace","xml:space",p);break;case"is":nf(a,"is",p);break;case"innerText":case"textContent":break;default:(!(2<d.length)||d[0]!=="o"&&d[0]!=="O"||d[1]!=="n"&&d[1]!=="N")&&(d=l2.get(d)||d,nf(a,d,p))}}function xv(a,c,d,p,v,w){switch(d){case"style":fk(a,p,w);break;case"dangerouslySetInnerHTML":if(p!=null){if(typeof p!="object"||!("__html"in p))throw Error(r(61));if(d=p.__html,d!=null){if(v.children!=null)throw Error(r(60));a.innerHTML=d}}break;case"children":typeof p=="string"?sl(a,p):(typeof p=="number"||typeof p=="bigint")&&sl(a,""+p);break;case"onScroll":p!=null&&tt("scroll",a);break;case"onScrollEnd":p!=null&&tt("scrollend",a);break;case"onClick":p!=null&&(a.onclick=ji);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!rk.hasOwnProperty(d))e:{if(d[0]==="o"&&d[1]==="n"&&(v=d.endsWith("Capture"),c=d.slice(2,v?d.length-7:void 0),w=a[rr]||null,w=w!=null?w[d]:null,typeof w=="function"&&a.removeEventListener(c,w,v),typeof p=="function")){typeof w!="function"&&w!==null&&(d in a?a[d]=null:a.hasAttribute(d)&&a.removeAttribute(d)),a.addEventListener(c,p,v);break e}d in a?a[d]=p:p===!0?a.setAttribute(d,""):nf(a,d,p)}}}function An(a,c,d){switch(c){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":tt("error",a),tt("load",a);var p=!1,v=!1,w;for(w in d)if(d.hasOwnProperty(w)){var E=d[w];if(E!=null)switch(w){case"src":p=!0;break;case"srcSet":v=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,c));default:St(a,c,w,E,d,null)}}v&&St(a,c,"srcSet",d.srcSet,d,null),p&&St(a,c,"src",d.src,d,null);return;case"input":tt("invalid",a);var N=w=E=v=null,$=null,Y=null;for(p in d)if(d.hasOwnProperty(p)){var ie=d[p];if(ie!=null)switch(p){case"name":v=ie;break;case"type":E=ie;break;case"checked":$=ie;break;case"defaultChecked":Y=ie;break;case"value":w=ie;break;case"defaultValue":N=ie;break;case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(r(137,c));break;default:St(a,c,p,ie,d,null)}}lk(a,w,N,$,Y,E,v,!1);return;case"select":tt("invalid",a),p=E=w=null;for(v in d)if(d.hasOwnProperty(v)&&(N=d[v],N!=null))switch(v){case"value":w=N;break;case"defaultValue":E=N;break;case"multiple":p=N;default:St(a,c,v,N,d,null)}c=w,d=E,a.multiple=!!p,c!=null?il(a,!!p,c,!1):d!=null&&il(a,!!p,d,!0);return;case"textarea":tt("invalid",a),w=v=p=null;for(E in d)if(d.hasOwnProperty(E)&&(N=d[E],N!=null))switch(E){case"value":p=N;break;case"defaultValue":v=N;break;case"children":w=N;break;case"dangerouslySetInnerHTML":if(N!=null)throw Error(r(91));break;default:St(a,c,E,N,d,null)}uk(a,p,v,w);return;case"option":for($ in d)d.hasOwnProperty($)&&(p=d[$],p!=null)&&($==="selected"?a.selected=p&&typeof p!="function"&&typeof p!="symbol":St(a,c,$,p,d,null));return;case"dialog":tt("beforetoggle",a),tt("toggle",a),tt("cancel",a),tt("close",a);break;case"iframe":case"object":tt("load",a);break;case"video":case"audio":for(p=0;p<pu.length;p++)tt(pu[p],a);break;case"image":tt("error",a),tt("load",a);break;case"details":tt("toggle",a);break;case"embed":case"source":case"link":tt("error",a),tt("load",a);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(Y in d)if(d.hasOwnProperty(Y)&&(p=d[Y],p!=null))switch(Y){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,c));default:St(a,c,Y,p,d,null)}return;default:if(Ig(c)){for(ie in d)d.hasOwnProperty(ie)&&(p=d[ie],p!==void 0&&xv(a,c,ie,p,d,void 0));return}}for(N in d)d.hasOwnProperty(N)&&(p=d[N],p!=null&&St(a,c,N,p,d,null))}function LP(a,c,d,p){switch(c){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var v=null,w=null,E=null,N=null,$=null,Y=null,ie=null;for(te in d){var ce=d[te];if(d.hasOwnProperty(te)&&ce!=null)switch(te){case"checked":break;case"value":break;case"defaultValue":$=ce;default:p.hasOwnProperty(te)||St(a,c,te,null,p,ce)}}for(var J in p){var te=p[J];if(ce=d[J],p.hasOwnProperty(J)&&(te!=null||ce!=null))switch(J){case"type":w=te;break;case"name":v=te;break;case"checked":Y=te;break;case"defaultChecked":ie=te;break;case"value":E=te;break;case"defaultValue":N=te;break;case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(r(137,c));break;default:te!==ce&&St(a,c,J,te,p,ce)}}Og(a,E,N,$,Y,ie,w,v);return;case"select":te=E=N=J=null;for(w in d)if($=d[w],d.hasOwnProperty(w)&&$!=null)switch(w){case"value":break;case"multiple":te=$;default:p.hasOwnProperty(w)||St(a,c,w,null,p,$)}for(v in p)if(w=p[v],$=d[v],p.hasOwnProperty(v)&&(w!=null||$!=null))switch(v){case"value":J=w;break;case"defaultValue":N=w;break;case"multiple":E=w;default:w!==$&&St(a,c,v,w,p,$)}c=N,d=E,p=te,J!=null?il(a,!!d,J,!1):!!p!=!!d&&(c!=null?il(a,!!d,c,!0):il(a,!!d,d?[]:"",!1));return;case"textarea":te=J=null;for(N in d)if(v=d[N],d.hasOwnProperty(N)&&v!=null&&!p.hasOwnProperty(N))switch(N){case"value":break;case"children":break;default:St(a,c,N,null,p,v)}for(E in p)if(v=p[E],w=d[E],p.hasOwnProperty(E)&&(v!=null||w!=null))switch(E){case"value":J=v;break;case"defaultValue":te=v;break;case"children":break;case"dangerouslySetInnerHTML":if(v!=null)throw Error(r(91));break;default:v!==w&&St(a,c,E,v,p,w)}ck(a,J,te);return;case"option":for(var Ae in d)J=d[Ae],d.hasOwnProperty(Ae)&&J!=null&&!p.hasOwnProperty(Ae)&&(Ae==="selected"?a.selected=!1:St(a,c,Ae,null,p,J));for($ in p)J=p[$],te=d[$],p.hasOwnProperty($)&&J!==te&&(J!=null||te!=null)&&($==="selected"?a.selected=J&&typeof J!="function"&&typeof J!="symbol":St(a,c,$,J,p,te));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Be in d)J=d[Be],d.hasOwnProperty(Be)&&J!=null&&!p.hasOwnProperty(Be)&&St(a,c,Be,null,p,J);for(Y in p)if(J=p[Y],te=d[Y],p.hasOwnProperty(Y)&&J!==te&&(J!=null||te!=null))switch(Y){case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(r(137,c));break;default:St(a,c,Y,J,p,te)}return;default:if(Ig(c)){for(var kt in d)J=d[kt],d.hasOwnProperty(kt)&&J!==void 0&&!p.hasOwnProperty(kt)&&xv(a,c,kt,void 0,p,J);for(ie in p)J=p[ie],te=d[ie],!p.hasOwnProperty(ie)||J===te||J===void 0&&te===void 0||xv(a,c,ie,J,p,te);return}}for(var F in d)J=d[F],d.hasOwnProperty(F)&&J!=null&&!p.hasOwnProperty(F)&&St(a,c,F,null,p,J);for(ce in p)J=p[ce],te=d[ce],!p.hasOwnProperty(ce)||J===te||J==null&&te==null||St(a,c,ce,J,p,te)}function hE(a){switch(a){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function jP(){if(typeof performance.getEntriesByType=="function"){for(var a=0,c=0,d=performance.getEntriesByType("resource"),p=0;p<d.length;p++){var v=d[p],w=v.transferSize,E=v.initiatorType,N=v.duration;if(w&&N&&hE(E)){for(E=0,N=v.responseEnd,p+=1;p<d.length;p++){var $=d[p],Y=$.startTime;if(Y>N)break;var ie=$.transferSize,ce=$.initiatorType;ie&&hE(ce)&&($=$.responseEnd,E+=ie*($<N?1:(N-Y)/($-Y)))}if(--p,c+=8*(w+E)/(v.duration/1e3),a++,10<a)break}}if(0<a)return c/a/1e6}return navigator.connection&&(a=navigator.connection.downlink,typeof a=="number")?a:5}var wv=null,Sv=null;function th(a){return a.nodeType===9?a:a.ownerDocument}function pE(a){switch(a){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function mE(a,c){if(a===0)switch(c){case"svg":return 1;case"math":return 2;default:return 0}return a===1&&c==="foreignObject"?0:a}function kv(a,c){return a==="textarea"||a==="noscript"||typeof c.children=="string"||typeof c.children=="number"||typeof c.children=="bigint"||typeof c.dangerouslySetInnerHTML=="object"&&c.dangerouslySetInnerHTML!==null&&c.dangerouslySetInnerHTML.__html!=null}var Cv=null;function PP(){var a=window.event;return a&&a.type==="popstate"?a===Cv?!1:(Cv=a,!0):(Cv=null,!1)}var gE=typeof setTimeout=="function"?setTimeout:void 0,zP=typeof clearTimeout=="function"?clearTimeout:void 0,yE=typeof Promise=="function"?Promise:void 0,$P=typeof queueMicrotask=="function"?queueMicrotask:typeof yE<"u"?function(a){return yE.resolve(null).then(a).catch(BP)}:gE;function BP(a){setTimeout(function(){throw a})}function Ks(a){return a==="head"}function vE(a,c){var d=c,p=0;do{var v=d.nextSibling;if(a.removeChild(d),v&&v.nodeType===8)if(d=v.data,d==="/$"||d==="/&"){if(p===0){a.removeChild(v),jl(c);return}p--}else if(d==="$"||d==="$?"||d==="$~"||d==="$!"||d==="&")p++;else if(d==="html")gu(a.ownerDocument.documentElement);else if(d==="head"){d=a.ownerDocument.head,gu(d);for(var w=d.firstChild;w;){var E=w.nextSibling,N=w.nodeName;w[Ic]||N==="SCRIPT"||N==="STYLE"||N==="LINK"&&w.rel.toLowerCase()==="stylesheet"||d.removeChild(w),w=E}}else d==="body"&&gu(a.ownerDocument.body);d=v}while(d);jl(c)}function bE(a,c){var d=a;a=0;do{var p=d.nextSibling;if(d.nodeType===1?c?(d._stashedDisplay=d.style.display,d.style.display="none"):(d.style.display=d._stashedDisplay||"",d.getAttribute("style")===""&&d.removeAttribute("style")):d.nodeType===3&&(c?(d._stashedText=d.nodeValue,d.nodeValue=""):d.nodeValue=d._stashedText||""),p&&p.nodeType===8)if(d=p.data,d==="/$"){if(a===0)break;a--}else d!=="$"&&d!=="$?"&&d!=="$~"&&d!=="$!"||a++;d=p}while(d)}function Ev(a){var c=a.firstChild;for(c&&c.nodeType===10&&(c=c.nextSibling);c;){var d=c;switch(c=c.nextSibling,d.nodeName){case"HTML":case"HEAD":case"BODY":Ev(d),Mg(d);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(d.rel.toLowerCase()==="stylesheet")continue}a.removeChild(d)}}function VP(a,c,d,p){for(;a.nodeType===1;){var v=d;if(a.nodeName.toLowerCase()!==c.toLowerCase()){if(!p&&(a.nodeName!=="INPUT"||a.type!=="hidden"))break}else if(p){if(!a[Ic])switch(c){case"meta":if(!a.hasAttribute("itemprop"))break;return a;case"link":if(w=a.getAttribute("rel"),w==="stylesheet"&&a.hasAttribute("data-precedence"))break;if(w!==v.rel||a.getAttribute("href")!==(v.href==null||v.href===""?null:v.href)||a.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin)||a.getAttribute("title")!==(v.title==null?null:v.title))break;return a;case"style":if(a.hasAttribute("data-precedence"))break;return a;case"script":if(w=a.getAttribute("src"),(w!==(v.src==null?null:v.src)||a.getAttribute("type")!==(v.type==null?null:v.type)||a.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin))&&w&&a.hasAttribute("async")&&!a.hasAttribute("itemprop"))break;return a;default:return a}}else if(c==="input"&&a.type==="hidden"){var w=v.name==null?null:""+v.name;if(v.type==="hidden"&&a.getAttribute("name")===w)return a}else return a;if(a=Pr(a.nextSibling),a===null)break}return null}function HP(a,c,d){if(c==="")return null;for(;a.nodeType!==3;)if((a.nodeType!==1||a.nodeName!=="INPUT"||a.type!=="hidden")&&!d||(a=Pr(a.nextSibling),a===null))return null;return a}function xE(a,c){for(;a.nodeType!==8;)if((a.nodeType!==1||a.nodeName!=="INPUT"||a.type!=="hidden")&&!c||(a=Pr(a.nextSibling),a===null))return null;return a}function Tv(a){return a.data==="$?"||a.data==="$~"}function _v(a){return a.data==="$!"||a.data==="$?"&&a.ownerDocument.readyState!=="loading"}function UP(a,c){var d=a.ownerDocument;if(a.data==="$~")a._reactRetry=c;else if(a.data!=="$?"||d.readyState!=="loading")c();else{var p=function(){c(),d.removeEventListener("DOMContentLoaded",p)};d.addEventListener("DOMContentLoaded",p),a._reactRetry=p}}function Pr(a){for(;a!=null;a=a.nextSibling){var c=a.nodeType;if(c===1||c===3)break;if(c===8){if(c=a.data,c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"||c==="F!"||c==="F")break;if(c==="/$"||c==="/&")return null}}return a}var Av=null;function wE(a){a=a.nextSibling;for(var c=0;a;){if(a.nodeType===8){var d=a.data;if(d==="/$"||d==="/&"){if(c===0)return Pr(a.nextSibling);c--}else d!=="$"&&d!=="$!"&&d!=="$?"&&d!=="$~"&&d!=="&"||c++}a=a.nextSibling}return null}function SE(a){a=a.previousSibling;for(var c=0;a;){if(a.nodeType===8){var d=a.data;if(d==="$"||d==="$!"||d==="$?"||d==="$~"||d==="&"){if(c===0)return a;c--}else d!=="/$"&&d!=="/&"||c++}a=a.previousSibling}return null}function kE(a,c,d){switch(c=th(d),a){case"html":if(a=c.documentElement,!a)throw Error(r(452));return a;case"head":if(a=c.head,!a)throw Error(r(453));return a;case"body":if(a=c.body,!a)throw Error(r(454));return a;default:throw Error(r(451))}}function gu(a){for(var c=a.attributes;c.length;)a.removeAttributeNode(c[0]);Mg(a)}var zr=new Map,CE=new Set;function nh(a){return typeof a.getRootNode=="function"?a.getRootNode():a.nodeType===9?a:a.ownerDocument}var Ji=z.d;z.d={f:FP,r:qP,D:GP,C:WP,L:KP,m:ZP,X:XP,S:YP,M:JP};function FP(){var a=Ji.f(),c=Wf();return a||c}function qP(a){var c=tl(a);c!==null&&c.tag===5&&c.type==="form"?VC(c):Ji.r(a)}var Dl=typeof document>"u"?null:document;function EE(a,c,d){var p=Dl;if(p&&typeof c=="string"&&c){var v=Mr(c);v='link[rel="'+a+'"][href="'+v+'"]',typeof d=="string"&&(v+='[crossorigin="'+d+'"]'),CE.has(v)||(CE.add(v),a={rel:a,crossOrigin:d,href:c},p.querySelector(v)===null&&(c=p.createElement("link"),An(c,"link",a),hn(c),p.head.appendChild(c)))}}function GP(a){Ji.D(a),EE("dns-prefetch",a,null)}function WP(a,c){Ji.C(a,c),EE("preconnect",a,c)}function KP(a,c,d){Ji.L(a,c,d);var p=Dl;if(p&&a&&c){var v='link[rel="preload"][as="'+Mr(c)+'"]';c==="image"&&d&&d.imageSrcSet?(v+='[imagesrcset="'+Mr(d.imageSrcSet)+'"]',typeof d.imageSizes=="string"&&(v+='[imagesizes="'+Mr(d.imageSizes)+'"]')):v+='[href="'+Mr(a)+'"]';var w=v;switch(c){case"style":w=Il(a);break;case"script":w=Ll(a)}zr.has(w)||(a=m({rel:"preload",href:c==="image"&&d&&d.imageSrcSet?void 0:a,as:c},d),zr.set(w,a),p.querySelector(v)!==null||c==="style"&&p.querySelector(yu(w))||c==="script"&&p.querySelector(vu(w))||(c=p.createElement("link"),An(c,"link",a),hn(c),p.head.appendChild(c)))}}function ZP(a,c){Ji.m(a,c);var d=Dl;if(d&&a){var p=c&&typeof c.as=="string"?c.as:"script",v='link[rel="modulepreload"][as="'+Mr(p)+'"][href="'+Mr(a)+'"]',w=v;switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":w=Ll(a)}if(!zr.has(w)&&(a=m({rel:"modulepreload",href:a},c),zr.set(w,a),d.querySelector(v)===null)){switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(d.querySelector(vu(w)))return}p=d.createElement("link"),An(p,"link",a),hn(p),d.head.appendChild(p)}}}function YP(a,c,d){Ji.S(a,c,d);var p=Dl;if(p&&a){var v=nl(p).hoistableStyles,w=Il(a);c=c||"default";var E=v.get(w);if(!E){var N={loading:0,preload:null};if(E=p.querySelector(yu(w)))N.loading=5;else{a=m({rel:"stylesheet",href:a,"data-precedence":c},d),(d=zr.get(w))&&Rv(a,d);var $=E=p.createElement("link");hn($),An($,"link",a),$._p=new Promise(function(Y,ie){$.onload=Y,$.onerror=ie}),$.addEventListener("load",function(){N.loading|=1}),$.addEventListener("error",function(){N.loading|=2}),N.loading|=4,rh(E,c,p)}E={type:"stylesheet",instance:E,count:1,state:N},v.set(w,E)}}}function XP(a,c){Ji.X(a,c);var d=Dl;if(d&&a){var p=nl(d).hoistableScripts,v=Ll(a),w=p.get(v);w||(w=d.querySelector(vu(v)),w||(a=m({src:a,async:!0},c),(c=zr.get(v))&&Mv(a,c),w=d.createElement("script"),hn(w),An(w,"link",a),d.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},p.set(v,w))}}function JP(a,c){Ji.M(a,c);var d=Dl;if(d&&a){var p=nl(d).hoistableScripts,v=Ll(a),w=p.get(v);w||(w=d.querySelector(vu(v)),w||(a=m({src:a,async:!0,type:"module"},c),(c=zr.get(v))&&Mv(a,c),w=d.createElement("script"),hn(w),An(w,"link",a),d.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},p.set(v,w))}}function TE(a,c,d,p){var v=(v=_e.current)?nh(v):null;if(!v)throw Error(r(446));switch(a){case"meta":case"title":return null;case"style":return typeof d.precedence=="string"&&typeof d.href=="string"?(c=Il(d.href),d=nl(v).hoistableStyles,p=d.get(c),p||(p={type:"style",instance:null,count:0,state:null},d.set(c,p)),p):{type:"void",instance:null,count:0,state:null};case"link":if(d.rel==="stylesheet"&&typeof d.href=="string"&&typeof d.precedence=="string"){a=Il(d.href);var w=nl(v).hoistableStyles,E=w.get(a);if(E||(v=v.ownerDocument||v,E={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},w.set(a,E),(w=v.querySelector(yu(a)))&&!w._p&&(E.instance=w,E.state.loading=5),zr.has(a)||(d={rel:"preload",as:"style",href:d.href,crossOrigin:d.crossOrigin,integrity:d.integrity,media:d.media,hrefLang:d.hrefLang,referrerPolicy:d.referrerPolicy},zr.set(a,d),w||QP(v,a,d,E.state))),c&&p===null)throw Error(r(528,""));return E}if(c&&p!==null)throw Error(r(529,""));return null;case"script":return c=d.async,d=d.src,typeof d=="string"&&c&&typeof c!="function"&&typeof c!="symbol"?(c=Ll(d),d=nl(v).hoistableScripts,p=d.get(c),p||(p={type:"script",instance:null,count:0,state:null},d.set(c,p)),p):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,a))}}function Il(a){return'href="'+Mr(a)+'"'}function yu(a){return'link[rel="stylesheet"]['+a+"]"}function _E(a){return m({},a,{"data-precedence":a.precedence,precedence:null})}function QP(a,c,d,p){a.querySelector('link[rel="preload"][as="style"]['+c+"]")?p.loading=1:(c=a.createElement("link"),p.preload=c,c.addEventListener("load",function(){return p.loading|=1}),c.addEventListener("error",function(){return p.loading|=2}),An(c,"link",d),hn(c),a.head.appendChild(c))}function Ll(a){return'[src="'+Mr(a)+'"]'}function vu(a){return"script[async]"+a}function AE(a,c,d){if(c.count++,c.instance===null)switch(c.type){case"style":var p=a.querySelector('style[data-href~="'+Mr(d.href)+'"]');if(p)return c.instance=p,hn(p),p;var v=m({},d,{"data-href":d.href,"data-precedence":d.precedence,href:null,precedence:null});return p=(a.ownerDocument||a).createElement("style"),hn(p),An(p,"style",v),rh(p,d.precedence,a),c.instance=p;case"stylesheet":v=Il(d.href);var w=a.querySelector(yu(v));if(w)return c.state.loading|=4,c.instance=w,hn(w),w;p=_E(d),(v=zr.get(v))&&Rv(p,v),w=(a.ownerDocument||a).createElement("link"),hn(w);var E=w;return E._p=new Promise(function(N,$){E.onload=N,E.onerror=$}),An(w,"link",p),c.state.loading|=4,rh(w,d.precedence,a),c.instance=w;case"script":return w=Ll(d.src),(v=a.querySelector(vu(w)))?(c.instance=v,hn(v),v):(p=d,(v=zr.get(w))&&(p=m({},d),Mv(p,v)),a=a.ownerDocument||a,v=a.createElement("script"),hn(v),An(v,"link",p),a.head.appendChild(v),c.instance=v);case"void":return null;default:throw Error(r(443,c.type))}else c.type==="stylesheet"&&(c.state.loading&4)===0&&(p=c.instance,c.state.loading|=4,rh(p,d.precedence,a));return c.instance}function rh(a,c,d){for(var p=d.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),v=p.length?p[p.length-1]:null,w=v,E=0;E<p.length;E++){var N=p[E];if(N.dataset.precedence===c)w=N;else if(w!==v)break}w?w.parentNode.insertBefore(a,w.nextSibling):(c=d.nodeType===9?d.head:d,c.insertBefore(a,c.firstChild))}function Rv(a,c){a.crossOrigin==null&&(a.crossOrigin=c.crossOrigin),a.referrerPolicy==null&&(a.referrerPolicy=c.referrerPolicy),a.title==null&&(a.title=c.title)}function Mv(a,c){a.crossOrigin==null&&(a.crossOrigin=c.crossOrigin),a.referrerPolicy==null&&(a.referrerPolicy=c.referrerPolicy),a.integrity==null&&(a.integrity=c.integrity)}var ih=null;function RE(a,c,d){if(ih===null){var p=new Map,v=ih=new Map;v.set(d,p)}else v=ih,p=v.get(d),p||(p=new Map,v.set(d,p));if(p.has(a))return p;for(p.set(a,null),d=d.getElementsByTagName(a),v=0;v<d.length;v++){var w=d[v];if(!(w[Ic]||w[Cn]||a==="link"&&w.getAttribute("rel")==="stylesheet")&&w.namespaceURI!=="http://www.w3.org/2000/svg"){var E=w.getAttribute(c)||"";E=a+E;var N=p.get(E);N?N.push(w):p.set(E,[w])}}return p}function ME(a,c,d){a=a.ownerDocument||a,a.head.insertBefore(d,c==="title"?a.querySelector("head > title"):null)}function ez(a,c,d){if(d===1||c.itemProp!=null)return!1;switch(a){case"meta":case"title":return!0;case"style":if(typeof c.precedence!="string"||typeof c.href!="string"||c.href==="")break;return!0;case"link":if(typeof c.rel!="string"||typeof c.href!="string"||c.href===""||c.onLoad||c.onError)break;return c.rel==="stylesheet"?(a=c.disabled,typeof c.precedence=="string"&&a==null):!0;case"script":if(c.async&&typeof c.async!="function"&&typeof c.async!="symbol"&&!c.onLoad&&!c.onError&&c.src&&typeof c.src=="string")return!0}return!1}function NE(a){return!(a.type==="stylesheet"&&(a.state.loading&3)===0)}function tz(a,c,d,p){if(d.type==="stylesheet"&&(typeof p.media!="string"||matchMedia(p.media).matches!==!1)&&(d.state.loading&4)===0){if(d.instance===null){var v=Il(p.href),w=c.querySelector(yu(v));if(w){c=w._p,c!==null&&typeof c=="object"&&typeof c.then=="function"&&(a.count++,a=sh.bind(a),c.then(a,a)),d.state.loading|=4,d.instance=w,hn(w);return}w=c.ownerDocument||c,p=_E(p),(v=zr.get(v))&&Rv(p,v),w=w.createElement("link"),hn(w);var E=w;E._p=new Promise(function(N,$){E.onload=N,E.onerror=$}),An(w,"link",p),d.instance=w}a.stylesheets===null&&(a.stylesheets=new Map),a.stylesheets.set(d,c),(c=d.state.preload)&&(d.state.loading&3)===0&&(a.count++,d=sh.bind(a),c.addEventListener("load",d),c.addEventListener("error",d))}}var Nv=0;function nz(a,c){return a.stylesheets&&a.count===0&&ah(a,a.stylesheets),0<a.count||0<a.imgCount?function(d){var p=setTimeout(function(){if(a.stylesheets&&ah(a,a.stylesheets),a.unsuspend){var w=a.unsuspend;a.unsuspend=null,w()}},6e4+c);0<a.imgBytes&&Nv===0&&(Nv=62500*jP());var v=setTimeout(function(){if(a.waitingForImages=!1,a.count===0&&(a.stylesheets&&ah(a,a.stylesheets),a.unsuspend)){var w=a.unsuspend;a.unsuspend=null,w()}},(a.imgBytes>Nv?50:800)+c);return a.unsuspend=d,function(){a.unsuspend=null,clearTimeout(p),clearTimeout(v)}}:null}function sh(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ah(this,this.stylesheets);else if(this.unsuspend){var a=this.unsuspend;this.unsuspend=null,a()}}}var oh=null;function ah(a,c){a.stylesheets=null,a.unsuspend!==null&&(a.count++,oh=new Map,c.forEach(rz,a),oh=null,sh.call(a))}function rz(a,c){if(!(c.state.loading&4)){var d=oh.get(a);if(d)var p=d.get(null);else{d=new Map,oh.set(a,d);for(var v=a.querySelectorAll("link[data-precedence],style[data-precedence]"),w=0;w<v.length;w++){var E=v[w];(E.nodeName==="LINK"||E.getAttribute("media")!=="not all")&&(d.set(E.dataset.precedence,E),p=E)}p&&d.set(null,p)}v=c.instance,E=v.getAttribute("data-precedence"),w=d.get(E)||p,w===p&&d.set(null,v),d.set(E,v),this.count++,p=sh.bind(this),v.addEventListener("load",p),v.addEventListener("error",p),w?w.parentNode.insertBefore(v,w.nextSibling):(a=a.nodeType===9?a.head:a,a.insertBefore(v,a.firstChild)),c.state.loading|=4}}var bu={$$typeof:_,Provider:null,Consumer:null,_currentValue:q,_currentValue2:q,_threadCount:0};function iz(a,c,d,p,v,w,E,N,$){this.tag=1,this.containerInfo=a,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ja(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ja(0),this.hiddenUpdates=Ja(null),this.identifierPrefix=p,this.onUncaughtError=v,this.onCaughtError=w,this.onRecoverableError=E,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=$,this.incompleteTransitions=new Map}function OE(a,c,d,p,v,w,E,N,$,Y,ie,ce){return a=new iz(a,c,d,E,$,Y,ie,ce,N),c=1,w===!0&&(c|=24),w=pr(3,null,null,c),a.current=w,w.stateNode=a,c=uy(),c.refCount++,a.pooledCache=c,c.refCount++,w.memoizedState={element:p,isDehydrated:d,cache:c},py(w),a}function DE(a){return a?(a=fl,a):fl}function IE(a,c,d,p,v,w){v=DE(v),p.context===null?p.context=v:p.pendingContext=v,p=Ps(c),p.payload={element:d},w=w===void 0?null:w,w!==null&&(p.callback=w),d=zs(a,p,c),d!==null&&(cr(d,a,c),Xc(d,a,c))}function LE(a,c){if(a=a.memoizedState,a!==null&&a.dehydrated!==null){var d=a.retryLane;a.retryLane=d!==0&&d<c?d:c}}function Ov(a,c){LE(a,c),(a=a.alternate)&&LE(a,c)}function jE(a){if(a.tag===13||a.tag===31){var c=Xo(a,67108864);c!==null&&cr(c,a,67108864),Ov(a,67108864)}}function PE(a){if(a.tag===13||a.tag===31){var c=br();c=_g(c);var d=Xo(a,c);d!==null&&cr(d,a,c),Ov(a,c)}}var lh=!0;function sz(a,c,d,p){var v=B.T;B.T=null;var w=z.p;try{z.p=2,Dv(a,c,d,p)}finally{z.p=w,B.T=v}}function oz(a,c,d,p){var v=B.T;B.T=null;var w=z.p;try{z.p=8,Dv(a,c,d,p)}finally{z.p=w,B.T=v}}function Dv(a,c,d,p){if(lh){var v=Iv(p);if(v===null)bv(a,c,p,ch,d),$E(a,p);else if(lz(v,a,c,d,p))p.stopPropagation();else if($E(a,p),c&4&&-1<az.indexOf(a)){for(;v!==null;){var w=tl(v);if(w!==null)switch(w.tag){case 3:if(w=w.stateNode,w.current.memoizedState.isDehydrated){var E=kn(w.pendingLanes);if(E!==0){var N=w;for(N.pendingLanes|=2,N.entangledLanes|=2;E;){var $=1<<31-he(E);N.entanglements[1]|=$,E&=~$}xi(w),(pt&6)===0&&(qf=zt()+500,hu(0))}}break;case 31:case 13:N=Xo(w,2),N!==null&&cr(N,w,2),Wf(),Ov(w,2)}if(w=Iv(p),w===null&&bv(a,c,p,ch,d),w===v)break;v=w}v!==null&&p.stopPropagation()}else bv(a,c,p,null,d)}}function Iv(a){return a=jg(a),Lv(a)}var ch=null;function Lv(a){if(ch=null,a=el(a),a!==null){var c=s(a);if(c===null)a=null;else{var d=c.tag;if(d===13){if(a=o(c),a!==null)return a;a=null}else if(d===31){if(a=l(c),a!==null)return a;a=null}else if(d===3){if(c.stateNode.current.memoizedState.isDehydrated)return c.tag===3?c.stateNode.containerInfo:null;a=null}else c!==a&&(a=null)}}return ch=a,null}function zE(a){switch(a){case"beforetoggle":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"toggle":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 2;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"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(mi()){case Zr:return 2;case Yr:return 8;case qn:case ee:return 32;case le:return 268435456;default:return 32}default:return 32}}var jv=!1,Zs=null,Ys=null,Xs=null,xu=new Map,wu=new Map,Js=[],az="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".split(" ");function $E(a,c){switch(a){case"focusin":case"focusout":Zs=null;break;case"dragenter":case"dragleave":Ys=null;break;case"mouseover":case"mouseout":Xs=null;break;case"pointerover":case"pointerout":xu.delete(c.pointerId);break;case"gotpointercapture":case"lostpointercapture":wu.delete(c.pointerId)}}function Su(a,c,d,p,v,w){return a===null||a.nativeEvent!==w?(a={blockedOn:c,domEventName:d,eventSystemFlags:p,nativeEvent:w,targetContainers:[v]},c!==null&&(c=tl(c),c!==null&&jE(c)),a):(a.eventSystemFlags|=p,c=a.targetContainers,v!==null&&c.indexOf(v)===-1&&c.push(v),a)}function lz(a,c,d,p,v){switch(c){case"focusin":return Zs=Su(Zs,a,c,d,p,v),!0;case"dragenter":return Ys=Su(Ys,a,c,d,p,v),!0;case"mouseover":return Xs=Su(Xs,a,c,d,p,v),!0;case"pointerover":var w=v.pointerId;return xu.set(w,Su(xu.get(w)||null,a,c,d,p,v)),!0;case"gotpointercapture":return w=v.pointerId,wu.set(w,Su(wu.get(w)||null,a,c,d,p,v)),!0}return!1}function BE(a){var c=el(a.target);if(c!==null){var d=s(c);if(d!==null){if(c=d.tag,c===13){if(c=o(d),c!==null){a.blockedOn=c,ek(a.priority,function(){PE(d)});return}}else if(c===31){if(c=l(d),c!==null){a.blockedOn=c,ek(a.priority,function(){PE(d)});return}}else if(c===3&&d.stateNode.current.memoizedState.isDehydrated){a.blockedOn=d.tag===3?d.stateNode.containerInfo:null;return}}}a.blockedOn=null}function uh(a){if(a.blockedOn!==null)return!1;for(var c=a.targetContainers;0<c.length;){var d=Iv(a.nativeEvent);if(d===null){d=a.nativeEvent;var p=new d.constructor(d.type,d);Lg=p,d.target.dispatchEvent(p),Lg=null}else return c=tl(d),c!==null&&jE(c),a.blockedOn=d,!1;c.shift()}return!0}function VE(a,c,d){uh(a)&&d.delete(c)}function cz(){jv=!1,Zs!==null&&uh(Zs)&&(Zs=null),Ys!==null&&uh(Ys)&&(Ys=null),Xs!==null&&uh(Xs)&&(Xs=null),xu.forEach(VE),wu.forEach(VE)}function dh(a,c){a.blockedOn===c&&(a.blockedOn=null,jv||(jv=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,cz)))}var fh=null;function HE(a){fh!==a&&(fh=a,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){fh===a&&(fh=null);for(var c=0;c<a.length;c+=3){var d=a[c],p=a[c+1],v=a[c+2];if(typeof p!="function"){if(Lv(p||d)===null)continue;break}var w=tl(d);w!==null&&(a.splice(c,3),c-=3,Iy(w,{pending:!0,data:v,method:d.method,action:p},p,v))}}))}function jl(a){function c($){return dh($,a)}Zs!==null&&dh(Zs,a),Ys!==null&&dh(Ys,a),Xs!==null&&dh(Xs,a),xu.forEach(c),wu.forEach(c);for(var d=0;d<Js.length;d++){var p=Js[d];p.blockedOn===a&&(p.blockedOn=null)}for(;0<Js.length&&(d=Js[0],d.blockedOn===null);)BE(d),d.blockedOn===null&&Js.shift();if(d=(a.ownerDocument||a).$$reactFormReplay,d!=null)for(p=0;p<d.length;p+=3){var v=d[p],w=d[p+1],E=v[rr]||null;if(typeof w=="function")E||HE(d);else if(E){var N=null;if(w&&w.hasAttribute("formAction")){if(v=w,E=w[rr]||null)N=E.formAction;else if(Lv(v)!==null)continue}else N=E.action;typeof N=="function"?d[p+1]=N:(d.splice(p,3),p-=3),HE(d)}}}function UE(){function a(w){w.canIntercept&&w.info==="react-transition"&&w.intercept({handler:function(){return new Promise(function(E){return v=E})},focusReset:"manual",scroll:"manual"})}function c(){v!==null&&(v(),v=null),p||setTimeout(d,20)}function d(){if(!p&&!navigation.transition){var w=navigation.currentEntry;w&&w.url!=null&&navigation.navigate(w.url,{state:w.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var p=!1,v=null;return navigation.addEventListener("navigate",a),navigation.addEventListener("navigatesuccess",c),navigation.addEventListener("navigateerror",c),setTimeout(d,100),function(){p=!0,navigation.removeEventListener("navigate",a),navigation.removeEventListener("navigatesuccess",c),navigation.removeEventListener("navigateerror",c),v!==null&&(v(),v=null)}}}function Pv(a){this._internalRoot=a}hh.prototype.render=Pv.prototype.render=function(a){var c=this._internalRoot;if(c===null)throw Error(r(409));var d=c.current,p=br();IE(d,p,a,c,null,null)},hh.prototype.unmount=Pv.prototype.unmount=function(){var a=this._internalRoot;if(a!==null){this._internalRoot=null;var c=a.containerInfo;IE(a.current,2,null,a,null,null),Wf(),c[Qa]=null}};function hh(a){this._internalRoot=a}hh.prototype.unstable_scheduleHydration=function(a){if(a){var c=QS();a={blockedOn:null,target:a,priority:c};for(var d=0;d<Js.length&&c!==0&&c<Js[d].priority;d++);Js.splice(d,0,a),d===0&&BE(a)}};var FE=e.version;if(FE!=="19.2.8")throw Error(r(527,FE,"19.2.8"));z.findDOMNode=function(a){var c=a._reactInternals;if(c===void 0)throw typeof a.render=="function"?Error(r(188)):(a=Object.keys(a).join(","),Error(r(268,a)));return a=f(c),a=a!==null?h(a):null,a=a===null?null:a.stateNode,a};var uz={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:B,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ph=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ph.isDisabled&&ph.supportsFiber)try{j=ph.inject(uz),W=ph}catch{}}return Cu.createRoot=function(a,c){if(!i(a))throw Error(r(299));var d=!1,p="",v=XC,w=JC,E=QC;return c!=null&&(c.unstable_strictMode===!0&&(d=!0),c.identifierPrefix!==void 0&&(p=c.identifierPrefix),c.onUncaughtError!==void 0&&(v=c.onUncaughtError),c.onCaughtError!==void 0&&(w=c.onCaughtError),c.onRecoverableError!==void 0&&(E=c.onRecoverableError)),c=OE(a,1,!1,null,null,d,p,null,v,w,E,UE),a[Qa]=c.current,vv(a),new Pv(c)},Cu.hydrateRoot=function(a,c,d){if(!i(a))throw Error(r(299));var p=!1,v="",w=XC,E=JC,N=QC,$=null;return d!=null&&(d.unstable_strictMode===!0&&(p=!0),d.identifierPrefix!==void 0&&(v=d.identifierPrefix),d.onUncaughtError!==void 0&&(w=d.onUncaughtError),d.onCaughtError!==void 0&&(E=d.onCaughtError),d.onRecoverableError!==void 0&&(N=d.onRecoverableError),d.formState!==void 0&&($=d.formState)),c=OE(a,1,!0,c,d??null,p,v,$,w,E,N,UE),c.context=DE(null),d=c.current,p=br(),p=_g(p),v=Ps(p),v.callback=null,zs(d,v,p),d=p,c.current.lanes=d,Dc(c,d),xi(c),a[Qa]=c.current,vv(a),new hh(c)},Cu.version="19.2.8",Cu}var rT;function xz(){if(rT)return Vv.exports;rT=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Vv.exports=bz(),Vv.exports}var wz=xz();const Sz=()=>{};var iT={};const mM=function(t){const e=[];let n=0;for(let r=0;r<t.length;r++){let i=t.charCodeAt(r);i<128?e[n++]=i:i<2048?(e[n++]=i>>6|192,e[n++]=i&63|128):(i&64512)===55296&&r+1<t.length&&(t.charCodeAt(r+1)&64512)===56320?(i=65536+((i&1023)<<10)+(t.charCodeAt(++r)&1023),e[n++]=i>>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128)}return e},kz=function(t){const e=[];let n=0,r=0;for(;n<t.length;){const i=t[n++];if(i<128)e[r++]=String.fromCharCode(i);else if(i>191&&i<224){const s=t[n++];e[r++]=String.fromCharCode((i&31)<<6|s&63)}else if(i>239&&i<365){const s=t[n++],o=t[n++],l=t[n++],u=((i&7)<<18|(s&63)<<12|(o&63)<<6|l&63)-65536;e[r++]=String.fromCharCode(55296+(u>>10)),e[r++]=String.fromCharCode(56320+(u&1023))}else{const s=t[n++],o=t[n++];e[r++]=String.fromCharCode((i&15)<<12|(s&63)<<6|o&63)}}return e.join("")},gM={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let i=0;i<t.length;i+=3){const s=t[i],o=i+1<t.length,l=o?t[i+1]:0,u=i+2<t.length,f=u?t[i+2]:0,h=s>>2,m=(s&3)<<4|l>>4;let g=(l&15)<<2|f>>6,y=f&63;u||(y=64,o||(g=64)),r.push(n[h],n[m],n[g],n[y])}return r.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(mM(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):kz(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let i=0;i<t.length;){const s=n[t.charAt(i++)],l=i<t.length?n[t.charAt(i)]:0;++i;const f=i<t.length?n[t.charAt(i)]:64;++i;const m=i<t.length?n[t.charAt(i)]:64;if(++i,s==null||l==null||f==null||m==null)throw new Cz;const g=s<<2|l>>4;if(r.push(g),f!==64){const y=l<<4&240|f>>2;if(r.push(y),m!==64){const x=f<<6&192|m;r.push(x)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t,t>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}};class Cz extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const Ez=function(t){const e=mM(t);return gM.encodeByteArray(e,!0)},yM=function(t){return Ez(t).replace(/\./g,"")},vM=function(t){try{return gM.decodeString(t,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function Tz(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}const _z=()=>Tz().__FIREBASE_DEFAULTS__,Az=()=>{if(typeof process>"u"||typeof iT>"u")return;const t=iT.__FIREBASE_DEFAULTS__;if(t)return JSON.parse(t)},Rz=()=>{if(typeof document>"u")return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=t&&vM(t[1]);return e&&JSON.parse(e)},Fx=()=>{try{return Sz()||_z()||Az()||Rz()}catch(t){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`);return}},Mz=t=>Fx()?.emulatorHosts?.[t],bM=()=>Fx()?.config,xM=t=>Fx()?.[`_${t}`];class wM{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}wrapCallback(e){return(n,r)=>{n?this.reject(n):this.resolve(r),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(n):e(n,r))}}}function Jn(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function Nz(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(Jn())}function Oz(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function Dz(){const t=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof t=="object"&&t.id!==void 0}function Iz(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function Lz(){const t=Jn();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}function jz(){try{return typeof indexedDB=="object"}catch{return!1}}function Pz(){return new Promise((t,e)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(r);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(r),t(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{e(i.error?.message||"")}}catch(n){e(n)}})}const zz="FirebaseError";class zo extends Error{constructor(e,n,r){super(n),this.code=e,this.customData=r,this.name=zz,Object.setPrototypeOf(this,zo.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Ld.prototype.create)}}class Ld{constructor(e,n,r){this.service=e,this.serviceName=n,this.errors=r}create(e,...n){const r=n[0]||{},i=`${this.service}/${e}`,s=this.errors[e],o=s?$z(s,r):"Error",l=`${this.serviceName}: ${o} (${i}).`;return new zo(i,l,r)}}function $z(t,e){try{let n=0,r="";for(;n<t.length;){const i=t.indexOf("{$",n);if(i===-1){r+=t.substring(n);break}const s=t.indexOf("}",i+2);if(s===-1){r+=t.substring(n);break}const o=t.substring(i+2,s),l=e[o];r+=t.substring(n,i)+(l!=null?String(l):`<${o}?>`),n=s+1}return r}catch{return t}}function Bz(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function sc(t,e){if(t===e)return!0;const n=Object.keys(t),r=Object.keys(e);for(const i of n){if(!r.includes(i))return!1;const s=t[i],o=e[i];if(sT(s)&&sT(o)){if(!sc(s,o))return!1}else if(s!==o)return!1}for(const i of r)if(!n.includes(i))return!1;return!0}function sT(t){return t!==null&&typeof t=="object"}function jd(t){const e=[];for(const[n,r]of Object.entries(t))Array.isArray(r)?r.forEach(i=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function ju(t){const e={};return t.replace(/^\?/,"").split("&").forEach(r=>{if(r){const[i,s]=r.split("=");e[decodeURIComponent(i)]=decodeURIComponent(s)}}),e}function Pu(t){const e=t.indexOf("?");if(!e)return"";const n=t.indexOf("#",e);return t.substring(e,n>0?n:void 0)}function Vz(t,e){const n=new Hz(t,e);return n.subscribe.bind(n)}class Hz{constructor(e,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{e(this)}).catch(r=>{this.error(r)})}next(e){this.forEachObserver(n=>{n.next(e)})}error(e){this.forEachObserver(n=>{n.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,n,r){let i;if(e===void 0&&n===void 0&&r===void 0)throw new Error("Missing Observer.");Uz(e,["next","error","complete"])?i=e:i={next:e,error:n,complete:r},i.next===void 0&&(i.next=qv),i.error===void 0&&(i.error=qv),i.complete===void 0&&(i.complete=qv);const s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch{}}),this.observers.push(i),s}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let n=0;n<this.observers.length;n++)this.sendOne(n,e)}sendOne(e,n){this.task.then(()=>{if(this.observers!==void 0&&this.observers[e]!==void 0)try{n(this.observers[e])}catch(r){typeof console<"u"&&console.error&&console.error(r)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function Uz(t,e){if(typeof t!="object"||t===null)return!1;for(const n of e)if(n in t&&typeof t[n]=="function")return!0;return!1}function qv(){}function _s(t){return t&&t._delegate?t._delegate:t}function qx(t){try{return(t.startsWith("http://")||t.startsWith("https://")?new URL(t).hostname:t).endsWith(".cloudworkstations.dev")}catch{return!1}}async function Fz(t){return(await fetch(t,{credentials:"include"})).ok}class oc{constructor(e,n,r){this.name=e,this.instanceFactory=n,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}const ha="[DEFAULT]";class qz{constructor(e,n){this.name=e,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const n=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(n)){const r=new wM;if(this.instancesDeferred.set(n,r),this.isInitialized(n)||this.shouldAutoInitialize())try{const i=this.getOrInitializeService({instanceIdentifier:n});i&&r.resolve(i)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){const n=this.normalizeInstanceIdentifier(e?.identifier),r=e?.optional??!1;if(this.isInitialized(n)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:n})}catch(i){if(r)return null;throw i}else{if(r)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(Wz(e))try{this.getOrInitializeService({instanceIdentifier:ha})}catch{}for(const[n,r]of this.instancesDeferred.entries()){const i=this.normalizeInstanceIdentifier(n);try{const s=this.getOrInitializeService({instanceIdentifier:i});r.resolve(s)}catch{}}}}clearInstance(e=ha){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const e=Array.from(this.instances.values());await Promise.all([...e.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...e.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=ha){return this.instances.has(e)}getOptions(e=ha){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:n={}}=e,r=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const i=this.getOrInitializeService({instanceIdentifier:r,options:n});for(const[s,o]of this.instancesDeferred.entries()){const l=this.normalizeInstanceIdentifier(s);r===l&&o.resolve(i)}return i}onInit(e,n){const r=this.normalizeInstanceIdentifier(n),i=this.onInitCallbacks.get(r)??new Set;i.add(e),this.onInitCallbacks.set(r,i);const s=this.instances.get(r);return s&&e(s,r),()=>{i.delete(e)}}invokeOnInitCallbacks(e,n){const r=this.onInitCallbacks.get(n);if(r)for(const i of r)try{i(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:Gz(e),options:n}),this.instances.set(e,r),this.instancesOptions.set(e,n),this.invokeOnInitCallbacks(r,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,r)}catch{}return r||null}normalizeInstanceIdentifier(e=ha){return this.component?this.component.multipleInstances?e:ha:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function Gz(t){return t===ha?void 0:t}function Wz(t){return t.instantiationMode==="EAGER"}class Kz{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const n=this.getProvider(e.name);if(n.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);n.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);const n=new qz(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}}var _t;(function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"})(_t||(_t={}));const Zz={debug:_t.DEBUG,verbose:_t.VERBOSE,info:_t.INFO,warn:_t.WARN,error:_t.ERROR,silent:_t.SILENT},Yz=_t.INFO,Xz={[_t.DEBUG]:"log",[_t.VERBOSE]:"log",[_t.INFO]:"info",[_t.WARN]:"warn",[_t.ERROR]:"error"},Jz=(t,e,...n)=>{if(e<t.logLevel)return;const r=new Date().toISOString(),i=Xz[e];if(i)console[i](`[${r}] ${t.name}:`,...n);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)};class SM{constructor(e){this.name=e,this._logLevel=Yz,this._logHandler=Jz,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in _t))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?Zz[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if(typeof e!="function")throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,_t.DEBUG,...e),this._logHandler(this,_t.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,_t.VERBOSE,...e),this._logHandler(this,_t.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,_t.INFO,...e),this._logHandler(this,_t.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,_t.WARN,...e),this._logHandler(this,_t.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,_t.ERROR,...e),this._logHandler(this,_t.ERROR,...e)}}const Qz=(t,e)=>e.some(n=>t instanceof n);let oT,aT;function e$(){return oT||(oT=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function t$(){return aT||(aT=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const kM=new WeakMap,o0=new WeakMap,CM=new WeakMap,Gv=new WeakMap,Gx=new WeakMap;function n$(t){const e=new Promise((n,r)=>{const i=()=>{t.removeEventListener("success",s),t.removeEventListener("error",o)},s=()=>{n(xo(t.result)),i()},o=()=>{r(t.error),i()};t.addEventListener("success",s),t.addEventListener("error",o)});return e.then(n=>{n instanceof IDBCursor&&kM.set(n,t)}).catch(()=>{}),Gx.set(e,t),e}function r$(t){if(o0.has(t))return;const e=new Promise((n,r)=>{const i=()=>{t.removeEventListener("complete",s),t.removeEventListener("error",o),t.removeEventListener("abort",o)},s=()=>{n(),i()},o=()=>{r(t.error||new DOMException("AbortError","AbortError")),i()};t.addEventListener("complete",s),t.addEventListener("error",o),t.addEventListener("abort",o)});o0.set(t,e)}let a0={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return o0.get(t);if(e==="objectStoreNames")return t.objectStoreNames||CM.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return xo(t[e])},set(t,e,n){return t[e]=n,!0},has(t,e){return t instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in t}};function i$(t){a0=t(a0)}function s$(t){return t===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){const r=t.call(Wv(this),e,...n);return CM.set(r,e.sort?e.sort():[e]),xo(r)}:t$().includes(t)?function(...e){return t.apply(Wv(this),e),xo(kM.get(this))}:function(...e){return xo(t.apply(Wv(this),e))}}function o$(t){return typeof t=="function"?s$(t):(t instanceof IDBTransaction&&r$(t),Qz(t,e$())?new Proxy(t,a0):t)}function xo(t){if(t instanceof IDBRequest)return n$(t);if(Gv.has(t))return Gv.get(t);const e=o$(t);return e!==t&&(Gv.set(t,e),Gx.set(e,t)),e}const Wv=t=>Gx.get(t);function a$(t,e,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){const o=indexedDB.open(t,e),l=xo(o);return r&&o.addEventListener("upgradeneeded",u=>{r(xo(o.result),u.oldVersion,u.newVersion,xo(o.transaction),u)}),n&&o.addEventListener("blocked",u=>n(u.oldVersion,u.newVersion,u)),l.then(u=>{s&&u.addEventListener("close",()=>s()),i&&u.addEventListener("versionchange",f=>i(f.oldVersion,f.newVersion,f))}).catch(()=>{}),l}const l$=["get","getKey","getAll","getAllKeys","count"],c$=["put","add","delete","clear"],Kv=new Map;function lT(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(Kv.get(e))return Kv.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,i=c$.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||l$.includes(n)))return;const s=async function(o,...l){const u=this.transaction(o,i?"readwrite":"readonly");let f=u.store;return r&&(f=f.index(l.shift())),(await Promise.all([f[n](...l),i&&u.done]))[0]};return Kv.set(e,s),s}i$(t=>({...t,get:(e,n,r)=>lT(e,n)||t.get(e,n,r),has:(e,n)=>!!lT(e,n)||t.has(e,n)}));class u${constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(d$(n)){const r=n.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(n=>n).join(" ")}}function d$(t){return t.getComponent()?.type==="VERSION"}const l0="@firebase/app",cT="0.16.0";const Ss=new SM("@firebase/app"),f$="@firebase/app-compat",h$="@firebase/analytics-compat",p$="@firebase/analytics",m$="@firebase/app-check-compat",g$="@firebase/app-check",y$="@firebase/auth",v$="@firebase/auth-compat",b$="@firebase/database",x$="@firebase/data-connect",w$="@firebase/database-compat",S$="@firebase/functions",k$="@firebase/functions-compat",C$="@firebase/installations",E$="@firebase/installations-compat",T$="@firebase/messaging",_$="@firebase/messaging-compat",A$="@firebase/performance",R$="@firebase/performance-compat",M$="@firebase/remote-config",N$="@firebase/remote-config-compat",O$="@firebase/storage",D$="@firebase/storage-compat",I$="@firebase/firestore",L$="@firebase/ai",j$="@firebase/firestore-compat",P$="firebase",z$="12.17.0";const c0="[DEFAULT]",$$={[l0]:"fire-core",[f$]:"fire-core-compat",[p$]:"fire-analytics",[h$]:"fire-analytics-compat",[g$]:"fire-app-check",[m$]:"fire-app-check-compat",[y$]:"fire-auth",[v$]:"fire-auth-compat",[b$]:"fire-rtdb",[x$]:"fire-data-connect",[w$]:"fire-rtdb-compat",[S$]:"fire-fn",[k$]:"fire-fn-compat",[C$]:"fire-iid",[E$]:"fire-iid-compat",[T$]:"fire-fcm",[_$]:"fire-fcm-compat",[A$]:"fire-perf",[R$]:"fire-perf-compat",[M$]:"fire-rc",[N$]:"fire-rc-compat",[O$]:"fire-gcs",[D$]:"fire-gcs-compat",[I$]:"fire-fst",[j$]:"fire-fst-compat",[L$]:"fire-vertex","fire-js":"fire-js",[P$]:"fire-js-all"};const dd=new Map,B$=new Map,u0=new Map;function uT(t,e){try{t.container.addComponent(e)}catch(n){Ss.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function fd(t){const e=t.name;if(u0.has(e))return Ss.debug(`There were multiple attempts to register component ${e}.`),!1;u0.set(e,t);for(const n of dd.values())uT(n,t);for(const n of B$.values())uT(n,t);return!0}function EM(t,e){const n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}function si(t){return t==null?!1:t.settings!==void 0}const V$={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different {$mismatchedParam}. Existing: '{$oldValue}'. New: '{$newValue}'.","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},us=new Ld("app","Firebase",V$);class H${constructor(e,n,r){this._isDeleted=!1,this._options={...e},this._config={...n},this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new oc("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw us.create("app-deleted",{appName:this._name})}}const Pd=z$;function TM(t,e={}){let n=t;typeof e!="object"&&(e={name:e});const r={name:c0,automaticDataCollectionEnabled:!0,...e},i=r.name;if(typeof i!="string"||!i)throw us.create("bad-app-name",{appName:String(i)});if(n||(n=bM()),!n)throw us.create("no-options");const s=dd.get(i);if(s)if(sc(n,s.options)){if(sc(r,s.config))return s;throw us.create("duplicate-app",{appName:i,mismatchedParam:"config",oldValue:JSON.stringify(s.config),newValue:JSON.stringify(r)})}else throw us.create("duplicate-app",{appName:i,mismatchedParam:"options",oldValue:JSON.stringify(s.options),newValue:JSON.stringify(n)});const o=new Kz(i);for(const u of u0.values())o.addComponent(u);const l=new H$(n,r,o);return dd.set(i,l),l}function _M(t=c0){const e=dd.get(t);if(!e&&t===c0&&bM())return TM();if(!e)throw us.create("no-app",{appName:t});return e}function U$(){return Array.from(dd.values())}function Xl(t,e,n){let r=$$[t]??t;n&&(r+=`-${n}`);const i=r.match(/\s|\//),s=e.match(/\s|\//);if(i||s){const o=[`Unable to register library "${r}" with version "${e}":`];i&&o.push(`library name "${r}" contains illegal characters (whitespace or "/")`),i&&s&&o.push("and"),s&&o.push(`version name "${e}" contains illegal characters (whitespace or "/")`),Ss.warn(o.join(" "));return}fd(new oc(`${r}-version`,()=>({library:r,version:e}),"VERSION"))}const F$="firebase-heartbeat-database",q$=1,hd="firebase-heartbeat-store";let Zv=null;function AM(){return Zv||(Zv=a$(F$,q$,{upgrade:(t,e)=>{switch(e){case 0:try{t.createObjectStore(hd)}catch(n){console.warn(n)}}}}).catch(t=>{throw us.create("idb-open",{originalErrorMessage:t.message})})),Zv}async function G$(t){try{const n=(await AM()).transaction(hd),r=await n.objectStore(hd).get(RM(t));return await n.done,r}catch(e){if(e instanceof zo)Ss.warn(e.message);else{const n=us.create("idb-get",{originalErrorMessage:e?.message});Ss.warn(n.message)}}}async function dT(t,e){try{const r=(await AM()).transaction(hd,"readwrite");await r.objectStore(hd).put(e,RM(t)),await r.done}catch(n){if(n instanceof zo)Ss.warn(n.message);else{const r=us.create("idb-set",{originalErrorMessage:n?.message});Ss.warn(r.message)}}}function RM(t){return`${t.name}!${t.options.appId}`}const W$=1024,K$=30;class Z${constructor(e){this.container=e,this._heartbeatsCache=null;const n=this.container.getProvider("app").getImmediate();this._storage=new X$(n),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}async triggerHeartbeat(){try{const n=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),r=fT();if(this._heartbeatsCache?.heartbeats==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null)||this._heartbeatsCache.lastSentHeartbeatDate===r||this._heartbeatsCache.heartbeats.some(i=>i.date===r))return;if(this._heartbeatsCache.heartbeats.push({date:r,agent:n}),this._heartbeatsCache.heartbeats.length>K$){const i=J$(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(i,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(e){Ss.warn(e)}}async getHeartbeatsHeader(){try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null||this._heartbeatsCache.heartbeats.length===0)return"";const e=fT(),{heartbeatsToSend:n,unsentEntries:r}=Y$(this._heartbeatsCache.heartbeats),i=yM(JSON.stringify({version:2,heartbeats:n}));return this._heartbeatsCache.lastSentHeartbeatDate=e,r.length>0?(this._heartbeatsCache.heartbeats=r,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),i}catch(e){return Ss.warn(e),""}}}function fT(){return new Date().toISOString().substring(0,10)}function Y$(t,e=W$){const n=[];let r=t.slice();for(const i of t){const s=n.find(o=>o.agent===i.agent);if(s){if(s.dates.push(i.date),hT(n)>e){s.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),hT(n)>e){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}class X${constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return jz()?Pz().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const n=await G$(this.app);return n?.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){if(await this._canUseIndexedDBPromise){const r=await this.read();return dT(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){if(await this._canUseIndexedDBPromise){const r=await this.read();return dT(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...e.heartbeats]})}else return}}function hT(t){return yM(JSON.stringify({version:2,heartbeats:t})).length}function J$(t){if(t.length===0)return-1;let e=0,n=t[0].date;for(let r=1;r<t.length;r++)t[r].date<n&&(n=t[r].date,e=r);return e}function Q$(t){fd(new oc("platform-logger",e=>new u$(e),"PRIVATE")),fd(new oc("heartbeat",e=>new Z$(e),"PRIVATE")),Xl(l0,cT,t),Xl(l0,cT,"esm2020"),Xl("fire-js","")}Q$("");var eB="firebase",tB="12.17.1";Xl(eB,tB,"app");function MM(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}const nB=MM,NM=new Ld("auth","Firebase",MM());const pp=new SM("@firebase/auth");function OM(t,...e){pp.logLevel<=_t.WARN&&pp.warn(`Auth (${Pd}): ${t}`,...e)}function Xh(t,...e){pp.logLevel<=_t.ERROR&&pp.error(`Auth (${Pd}): ${t}`,...e)}function Gr(t,...e){throw Kx(t,...e)}function ui(t,...e){return Kx(t,...e)}function Wx(t,e,n){const r={...nB(),[e]:n};return new Ld("auth","Firebase",r).create(e,{appName:t.name})}function wo(t){return Wx(t,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function rB(t,e,n){const r=n;if(!(e instanceof r))throw r.name!==e.constructor.name&&Gr(t,"argument-error"),Wx(t,"argument-error",`Type of ${e.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function Kx(t,...e){if(typeof t!="string"){const n=e[0],r=[...e.slice(1)];return r[0]&&(r[0].appName=t.name),t._errorFactory.create(n,...r)}return NM.create(t,...e)}function He(t,e,...n){if(!t)throw Kx(e,...n)}function ds(t){const e="INTERNAL ASSERTION FAILED: "+t;throw Xh(e),new Error(e)}function ks(t,e){t||ds(e)}function d0(){return typeof self<"u"&&self.location?.href||""}function iB(){return pT()==="http:"||pT()==="https:"}function pT(){return typeof self<"u"&&self.location?.protocol||null}function sB(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(iB()||Dz()||"connection"in navigator)?navigator.onLine:!0}function oB(){if(typeof navigator>"u")return null;const t=navigator;return t.languages&&t.languages[0]||t.language||null}class zd{constructor(e,n){this.shortDelay=e,this.longDelay=n,ks(n>e,"Short delay should be less than long delay!"),this.isMobile=Nz()||Iz()}get(){return sB()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}function Zx(t,e){ks(t.emulator,"Emulator should always be set here");const{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}class DM{static initialize(e,n,r){this.fetchImpl=e,n&&(this.headersImpl=n),r&&(this.responseImpl=r)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;ds("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;ds("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;ds("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}const aB={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};const lB=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],cB=new zd(3e4,6e4);function Fa(t,e){return t.tenantId&&!e.tenantId?{...e,tenantId:t.tenantId}:e}async function $o(t,e,n,r,i={}){return IM(t,i,async()=>{let s={},o={};r&&(e==="GET"?o=r:s={body:JSON.stringify(r)});const l=jd({...o,key:t.config.apiKey}).slice(1),u=await t._getAdditionalHeaders();u["Content-Type"]="application/json",t.languageCode&&(u["X-Firebase-Locale"]=t.languageCode);const f={method:e,headers:u,...s};return Oz()||(f.referrerPolicy="strict-origin-when-cross-origin"),t.emulatorConfig&&qx(t.emulatorConfig.host)&&(f.credentials="include"),DM.fetch()(await LM(t,t.config.apiHost,n,l),f)})}async function IM(t,e,n){t._canInitEmulator=!1;const r={...aB,...e};try{const i=new dB(t),s=await Promise.race([n(),i.promise]);i.clearNetworkTimeout();const o=await s.json();if("needConfirmation"in o)throw mh(t,"account-exists-with-different-credential",o);if(s.ok&&!("errorMessage"in o))return o;{const l=s.ok?o.errorMessage:o.error.message,[u,f]=l.split(" : ");if(u==="FEDERATED_USER_ID_ALREADY_LINKED")throw mh(t,"credential-already-in-use",o);if(u==="EMAIL_EXISTS")throw mh(t,"email-already-in-use",o);if(u==="USER_DISABLED")throw mh(t,"user-disabled",o);const h=r[u]||u.toLowerCase().replace(/[_\s]+/g,"-");if(f)throw Wx(t,h,f);Gr(t,h)}}catch(i){if(i instanceof zo)throw i;Gr(t,"network-request-failed",{message:String(i)})}}async function Mm(t,e,n,r,i={}){const s=await $o(t,e,n,r,i);return"mfaPendingCredential"in s&&Gr(t,"multi-factor-auth-required",{_serverResponse:s}),s}async function LM(t,e,n,r){const i=`${e}${n}?${r}`,s=t,o=s.config.emulator?Zx(t.config,i):`${t.config.apiScheme}://${i}`;return lB.includes(n)&&(await s._persistenceManagerAvailable,s._getPersistenceType()==="COOKIE")?s._getPersistence()._getFinalTarget(o).toString():o}function uB(t){switch(t){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class dB{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,r)=>{this.timer=setTimeout(()=>r(ui(this.auth,"network-request-failed")),cB.get())})}}function mh(t,e,n){const r={appName:t.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const i=ui(t,e,r);return i.customData._tokenResponse=n,i}function mT(t){return t!==void 0&&t.enterprise!==void 0}class fB{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(const n of this.recaptchaEnforcementState)if(n.provider&&n.provider===e)return uB(n.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}isAnyProviderEnabled(){return this.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")||this.isProviderEnabled("PHONE_PROVIDER")}}async function hB(t,e){return $o(t,"GET","/v2/recaptchaConfig",Fa(t,e))}async function pB(t,e){return $o(t,"POST","/v1/accounts:delete",e)}async function mp(t,e){return $o(t,"POST","/v1/accounts:lookup",e)}function Wu(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function mB(t,e=!1){const n=_s(t),r=await n.getIdToken(e),i=Yx(r);He(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");const s=typeof i.firebase=="object"?i.firebase:void 0,o=s?.sign_in_provider;return{claims:i,token:r,authTime:Wu(Yv(i.auth_time)),issuedAtTime:Wu(Yv(i.iat)),expirationTime:Wu(Yv(i.exp)),signInProvider:o||null,signInSecondFactor:s?.sign_in_second_factor||null}}function Yv(t){return Number(t)*1e3}function Yx(t){const[e,n,r]=t.split(".");if(e===void 0||n===void 0||r===void 0)return Xh("JWT malformed, contained fewer than 3 sections"),null;try{const i=vM(n);return i?JSON.parse(i):(Xh("Failed to decode base64 JWT payload"),null)}catch(i){return Xh("Caught error parsing JWT payload as JSON",i?.toString()),null}}function gT(t){const e=Yx(t);return He(e,"internal-error"),He(typeof e.exp<"u","internal-error"),He(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}async function pd(t,e,n=!1){if(n)return e;try{return await e}catch(r){throw r instanceof zo&&gB(r)&&t.auth.currentUser===t&&await t.auth.signOut(),r}}function gB({code:t}){return t==="auth/user-disabled"||t==="auth/user-token-expired"}class yB{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){if(e){const n=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),n}else{this.errorBackoff=3e4;const r=(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5;return Math.max(0,r)}}schedule(e=!1){if(!this.isRunning)return;const n=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},n)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){e?.code==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}}class f0{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=Wu(this.lastLoginAt),this.creationTime=Wu(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}async function gp(t){const e=t.auth,n=await t.getIdToken(),r=await pd(t,mp(e,{idToken:n}));He(r?.users.length,e,"internal-error");const i=r.users[0];t._notifyReloadListener(i);const s=i.providerUserInfo?.length?jM(i.providerUserInfo):[],o=bB(t.providerData,s),l=t.isAnonymous,u=!(t.email&&i.passwordHash)&&!o?.length,f=l?u:!1,h={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:o,metadata:new f0(i.createdAt,i.lastLoginAt),isAnonymous:f};Object.assign(t,h)}async function vB(t){const e=_s(t);await gp(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function bB(t,e){return[...t.filter(r=>!e.some(i=>i.providerId===r.providerId)),...e]}function jM(t){return t.map(({providerId:e,...n})=>({providerId:e,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}))}async function xB(t,e){const n=await IM(t,{},async()=>{const r=jd({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=t.config,o=await LM(t,i,"/v1/token",`key=${s}`),l=await t._getAdditionalHeaders();l["Content-Type"]="application/x-www-form-urlencoded";const u={method:"POST",headers:l,body:r};return t.emulatorConfig&&qx(t.emulatorConfig.host)&&(u.credentials="include"),DM.fetch()(o,u)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function wB(t,e){return $o(t,"POST","/v2/accounts:revokeToken",Fa(t,e))}class Jl{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){He(e.idToken,"internal-error"),He(typeof e.idToken<"u","internal-error"),He(typeof e.refreshToken<"u","internal-error");const n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):gT(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){He(e.length!==0,"internal-error");const n=gT(e);this.updateTokensAndExpiration(e,null,n)}async getToken(e,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(He(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,n){const{accessToken:r,refreshToken:i,expiresIn:s}=await xB(e,n);this.updateTokensAndExpiration(r,i,Number(s))}updateTokensAndExpiration(e,n,r){this.refreshToken=n||null,this.accessToken=e||null,this.expirationTime=Date.now()+r*1e3}static fromJSON(e,n){const{refreshToken:r,accessToken:i,expirationTime:s}=n,o=new Jl;return r&&(He(typeof r=="string","internal-error",{appName:e}),o.refreshToken=r),i&&(He(typeof i=="string","internal-error",{appName:e}),o.accessToken=i),s&&(He(typeof s=="number","internal-error",{appName:e}),o.expirationTime=s),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new Jl,this.toJSON())}_performRefresh(){return ds("not implemented")}}function eo(t,e){He(typeof t=="string"||typeof t>"u","internal-error",{appName:e})}class li{constructor({uid:e,auth:n,stsTokenManager:r,...i}){this.providerId="firebase",this.proactiveRefresh=new yB(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=n,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=i.displayName||null,this.email=i.email||null,this.emailVerified=i.emailVerified||!1,this.phoneNumber=i.phoneNumber||null,this.photoURL=i.photoURL||null,this.isAnonymous=i.isAnonymous||!1,this.tenantId=i.tenantId||null,this.providerData=i.providerData?[...i.providerData]:[],this.metadata=new f0(i.createdAt||void 0,i.lastLoginAt||void 0)}async getIdToken(e){const n=await pd(this,this.stsTokenManager.getToken(this.auth,e));return He(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return mB(this,e)}reload(){return vB(this)}_assign(e){this!==e&&(He(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(n=>({...n})),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){const n=new li({...this,auth:e,stsTokenManager:this.stsTokenManager._clone()});return n.metadata._copy(this.metadata),n}_onReload(e){He(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,n=!1){let r=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),r=!0),n&&await gp(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(si(this.auth.app))return Promise.reject(wo(this.auth));const e=await this.getIdToken();return await pd(this,pB(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return{uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>({...e})),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId,...this.metadata.toJSON(),apiKey:this.auth.config.apiKey,appName:this.auth.name}}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,n){const r=n.displayName??void 0,i=n.email??void 0,s=n.phoneNumber??void 0,o=n.photoURL??void 0,l=n.tenantId??void 0,u=n._redirectEventId??void 0,f=n.createdAt??void 0,h=n.lastLoginAt??void 0,{uid:m,emailVerified:g,isAnonymous:y,providerData:x,stsTokenManager:S}=n;He(m&&S,e,"internal-error");const k=Jl.fromJSON(this.name,S);He(typeof m=="string",e,"internal-error"),eo(r,e.name),eo(i,e.name),He(typeof g=="boolean",e,"internal-error"),He(typeof y=="boolean",e,"internal-error"),eo(s,e.name),eo(o,e.name),eo(l,e.name),eo(u,e.name),eo(f,e.name),eo(h,e.name);const C=new li({uid:m,auth:e,email:i,emailVerified:g,displayName:r,isAnonymous:y,photoURL:o,phoneNumber:s,tenantId:l,stsTokenManager:k,createdAt:f,lastLoginAt:h});return x&&Array.isArray(x)&&(C.providerData=x.map(T=>({...T}))),u&&(C._redirectEventId=u),C}static async _fromIdTokenResponse(e,n,r=!1){const i=new Jl;i.updateFromServerResponse(n);const s=new li({uid:n.localId,auth:e,stsTokenManager:i,isAnonymous:r});return await gp(s),s}static async _fromGetAccountInfoResponse(e,n,r){const i=n.users[0];He(i.localId!==void 0,"internal-error");const s=i.providerUserInfo!==void 0?jM(i.providerUserInfo):[],o=!(i.email&&i.passwordHash)&&!s?.length,l=new Jl;l.updateFromIdToken(r);const u=new li({uid:i.localId,auth:e,stsTokenManager:l,isAnonymous:o}),f={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:s,metadata:new f0(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!s?.length};return Object.assign(u,f),u}}const yT=new Map;function fs(t){ks(t instanceof Function,"Expected a class definition");let e=yT.get(t);return e?(ks(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,yT.set(t,e),e)}class PM{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,n){this.storage[e]=n}async _get(e){const n=this.storage[e];return n===void 0?null:n}async _remove(e){delete this.storage[e]}_addListener(e,n){}_removeListener(e,n){}}PM.type="NONE";const vT=PM;function Jh(t,e,n){return`firebase:${t}:${e}:${n}`}class Ql{constructor(e,n,r){this.persistence=e,this.auth=n,this.userKey=r;const{config:i,name:s}=this.auth;this.fullUserKey=Jh(this.userKey,i.apiKey,s),this.fullPersistenceKey=Jh("persistence",i.apiKey,s),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){const e=await this.persistence._get(this.fullUserKey);if(!e)return null;if(typeof e=="string"){const n=await mp(this.auth,{idToken:e}).catch(()=>{});return n?li._fromGetAccountInfoResponse(this.auth,n,e):null}return li._fromJSON(this.auth,e)}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;const n=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,n)return this.setCurrentUser(n)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,n,r="authUser"){if(!n.length)return new Ql(fs(vT),e,r);const i=(await Promise.all(n.map(async f=>{if(await f._isAvailable())return f}))).filter(f=>f);let s=i[0]||fs(vT);const o=Jh(r,e.config.apiKey,e.name);let l=null;for(const f of n)try{const h=await f._get(o);if(h){let m;if(typeof h=="string"){const g=await mp(e,{idToken:h}).catch(()=>{});if(!g)break;m=await li._fromGetAccountInfoResponse(e,g,h)}else m=li._fromJSON(e,h);f!==s&&(l=m),s=f;break}}catch{}const u=i.filter(f=>f._shouldAllowMigration);return!s._shouldAllowMigration||!u.length?new Ql(s,e,r):(s=u[0],l&&await s._set(o,l.toJSON()),await Promise.all(n.map(async f=>{if(f!==s)try{await f._remove(o)}catch{}})),new Ql(s,e,r))}}function bT(t){const e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(VM(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(zM(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(UM(e))return"Blackberry";if(FM(e))return"Webos";if($M(e))return"Safari";if((e.includes("chrome/")||BM(e))&&!e.includes("edge/"))return"Chrome";if(HM(e))return"Android";{const n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,r=t.match(n);if(r?.length===2)return r[1]}return"Other"}function zM(t=Jn()){return/firefox\//i.test(t)}function $M(t=Jn()){const e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function BM(t=Jn()){return/crios\//i.test(t)}function VM(t=Jn()){return/iemobile/i.test(t)}function HM(t=Jn()){return/android/i.test(t)}function UM(t=Jn()){return/blackberry/i.test(t)}function FM(t=Jn()){return/webos/i.test(t)}function Xx(t=Jn()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function SB(t=Jn()){return Xx(t)&&!!window.navigator?.standalone}function kB(){return Lz()&&document.documentMode===10}function qM(t=Jn()){return Xx(t)||HM(t)||FM(t)||UM(t)||/windows phone/i.test(t)||VM(t)}function GM(t,e=[]){let n;switch(t){case"Browser":n=bT(Jn());break;case"Worker":n=`${bT(Jn())}-${t}`;break;default:n=t}const r=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${Pd}/${r}`}class CB{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){const r=s=>new Promise((o,l)=>{try{const u=e(s);o(u)}catch(u){l(u)}});r.onAbort=n,this.queue.push(r);const i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;const n=[];try{for(const r of this.queue)await r(e),r.onAbort&&n.push(r.onAbort)}catch(r){n.reverse();for(const i of n)try{i()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:r?.message})}}}async function EB(t,e={}){return $o(t,"GET","/v2/passwordPolicy",Fa(t,e))}const TB=6;class _B{constructor(e){const n=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=n.minPasswordLength??TB,n.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=n.maxPasswordLength),n.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=n.containsLowercaseCharacter),n.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=n.containsUppercaseCharacter),n.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=n.containsNumericCharacter),n.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=n.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=e.allowedNonAlphanumericCharacters?.join("")??"",this.forceUpgradeOnSignin=e.forceUpgradeOnSignin??!1,this.schemaVersion=e.schemaVersion}validatePassword(e){const n={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,n),this.validatePasswordCharacterOptions(e,n),n.isValid&&(n.isValid=n.meetsMinPasswordLength??!0),n.isValid&&(n.isValid=n.meetsMaxPasswordLength??!0),n.isValid&&(n.isValid=n.containsLowercaseLetter??!0),n.isValid&&(n.isValid=n.containsUppercaseLetter??!0),n.isValid&&(n.isValid=n.containsNumericCharacter??!0),n.isValid&&(n.isValid=n.containsNonAlphanumericCharacter??!0),n}validatePasswordLengthOptions(e,n){const r=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;r&&(n.meetsMinPasswordLength=e.length>=r),i&&(n.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let r;for(let i=0;i<e.length;i++)r=e.charAt(i),this.updatePasswordCharacterOptionsStatuses(n,r>="a"&&r<="z",r>="A"&&r<="Z",r>="0"&&r<="9",this.allowedNonAlphanumericCharacters.includes(r))}updatePasswordCharacterOptionsStatuses(e,n,r,i,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=r)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}}class AB{constructor(e,n,r,i){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=r,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new xT(this),this.idTokenSubscription=new xT(this),this.beforeStateQueue=new CB(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=NM,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion,this._persistenceManagerAvailable=new Promise(s=>this._resolvePersistenceManagerAvailable=s)}_initializeWithPersistence(e,n){return n&&(this._popupRedirectResolver=fs(n)),this._initializationPromise=this.queue(async()=>{if(!this._deleted&&(this.persistenceManager=await Ql.create(this,e),this._resolvePersistenceManagerAvailable?.(),!this._deleted)){if(this._popupRedirectResolver?._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=this.currentUser?.uid||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{const n=await mp(this,{idToken:e}),r=await li._fromGetAccountInfoResponse(this,n,e);await this.directlySetCurrentUser(r)}catch(n){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",n),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){if(si(this.app)){const s=this.app.settings.authIdToken;return s?new Promise(o=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(s).then(o,o))}):this.directlySetCurrentUser(null)}const n=await this.assertedPersistence.getCurrentUser();let r=n,i=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const s=this.redirectUser?._redirectEventId,o=r?._redirectEventId,l=await this.tryRedirectSignIn(e);(!s||s===o)&&l?.user&&(r=l.user,i=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(i)try{await this.beforeStateQueue.runMiddleware(r)}catch(s){r=n,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(s))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return He(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}async tryRedirectSignIn(e){let n=null;try{n=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return n}async reloadAndSetCurrentUserOrClear(e){try{await gp(e)}catch(n){if(n?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=oB()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(si(this.app))return Promise.reject(wo(this));const n=e?_s(e):null;return n&&He(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(n&&n._clone(this))}async _updateCurrentUser(e,n=!1){if(!this._deleted)return e&&He(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),n||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return si(this.app)?Promise.reject(wo(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return si(this.app)?Promise.reject(wo(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(fs(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const n=this._getPasswordPolicyInternal();return n.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):n.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const e=await EB(this),n=new _B(e);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new Ld("auth","Firebase",e())}onAuthStateChanged(e,n,r){return this.registerStateListener(this.authStateSubscription,e,n,r)}beforeAuthStateChanged(e,n){return this.beforeStateQueue.pushCallback(e,n)}onIdTokenChanged(e,n,r){return this.registerStateListener(this.idTokenSubscription,e,n,r)}authStateReady(){return new Promise((e,n)=>{if(this.currentUser)e();else{const r=this.onAuthStateChanged(()=>{r(),e()},n)}})}async revokeAccessToken(e){if(this.currentUser){const n=await this.currentUser.getIdToken(),r={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:n};this.tenantId!=null&&(r.tenantId=this.tenantId),await wB(this,r)}}toJSON(){return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:this._currentUser?.toJSON()}}async _setRedirectUser(e,n){const r=await this.getOrInitRedirectPersistenceManager(n);return e===null?r.removeCurrentUser():r.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const n=e&&fs(e)||this._popupRedirectResolver;He(n,this,"argument-error"),this.redirectPersistenceManager=await Ql.create(this,[fs(n._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){return this._isInitialized&&await this.queue(async()=>{}),this._currentUser?._redirectEventId===e?this._currentUser:this.redirectUser?._redirectEventId===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const e=this.currentUser?.uid??null;this.lastNotifiedUid!==e&&(this.lastNotifiedUid=e,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,n,r,i){if(this._deleted)return()=>{};const s=typeof n=="function"?n:n.next.bind(n);let o=!1;const l=this._isInitialized?Promise.resolve():this._initializationPromise;if(He(l,this,"internal-error"),l.then(()=>{o||s(this.currentUser)}),typeof n=="function"){const u=e.addObserver(n,r,i);return()=>{o=!0,u()}}else{const u=e.addObserver(n);return()=>{o=!0,u()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return He(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=GM(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){const e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);const n=await this.heartbeatServiceProvider.getImmediate({optional:!0})?.getHeartbeatsHeader();n&&(e["X-Firebase-Client"]=n);const r=await this._getAppCheckToken();return r&&(e["X-Firebase-AppCheck"]=r),e}async _getAppCheckToken(){if(si(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const e=await this.appCheckServiceProvider.getImmediate({optional:!0})?.getToken();return e?.error&&OM(`Error while retrieving App Check token: ${e.error}`),e?.token}}function qa(t){return _s(t)}class xT{constructor(e){this.auth=e,this.observer=null,this.addObserver=Vz(n=>this.observer=n)}get next(){return He(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}let Nm={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function RB(t){Nm=t}function WM(t){return Nm.loadJS(t)}function MB(){return Nm.recaptchaEnterpriseScript}function NB(){return Nm.gapiScript}function OB(t){return`__${t}${Math.floor(Math.random()*1e6)}`}class DB{constructor(){this.enterprise=new IB}ready(e){e()}execute(e,n){return Promise.resolve("token")}render(e,n){return""}}class IB{ready(e){e()}execute(e,n){return Promise.resolve("token")}render(e,n){return""}}const LB="recaptcha-enterprise",KM="NO_RECAPTCHA",wT="onFirebaseAuthREInstanceReady";class lo{constructor(e){this.type=LB,this.auth=qa(e)}async verify(e="verify",n=!1){async function r(s){if(!n){if(s.tenantId==null&&s._agentRecaptchaConfig!=null)return s._agentRecaptchaConfig.siteKey;if(s.tenantId!=null&&s._tenantRecaptchaConfigs[s.tenantId]!==void 0)return s._tenantRecaptchaConfigs[s.tenantId].siteKey}return new Promise(async(o,l)=>{hB(s,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(u=>{if(u.recaptchaKey===void 0)l(new Error("recaptcha Enterprise site key undefined"));else{const f=new fB(u);return s.tenantId==null?s._agentRecaptchaConfig=f:s._tenantRecaptchaConfigs[s.tenantId]=f,o(f.siteKey)}}).catch(u=>{l(u)})})}function i(s,o,l){const u=window.grecaptcha;mT(u)?u.enterprise.ready(()=>{u.enterprise.execute(s,{action:e}).then(f=>{o(f)}).catch(()=>{o(KM)})}):l(Error("No reCAPTCHA enterprise script loaded."))}return this.auth.settings.appVerificationDisabledForTesting?new DB().execute("siteKey",{action:"verify"}):new Promise((s,o)=>{r(this.auth).then(async l=>{if(!n&&mT(window.grecaptcha)&&lo.scriptInjectionDeferred)await lo.scriptInjectionDeferred.promise,i(l,s,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}let u=MB();u.length!==0&&(u+=l+`&onload=${wT}`),lo.scriptInjectionDeferred=new wM,window[wT]=()=>{lo.scriptInjectionDeferred?.resolve()},WM(u).then(()=>lo.scriptInjectionDeferred?.promise).then(()=>{i(l,s,o)}).catch(f=>{o(f)})}}).catch(l=>{o(l)})})}}lo.scriptInjectionDeferred=null;async function ST(t,e,n,r=!1,i=!1){const s=new lo(t);let o;if(i)o=KM;else try{o=await s.verify(n)}catch{o=await s.verify(n,!0)}const l={...e};if(n==="mfaSmsEnrollment"||n==="mfaSmsSignIn"){if("phoneEnrollmentInfo"in l){const u=l.phoneEnrollmentInfo.phoneNumber,f=l.phoneEnrollmentInfo.recaptchaToken;Object.assign(l,{phoneEnrollmentInfo:{phoneNumber:u,recaptchaToken:f,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in l){const u=l.phoneSignInInfo.recaptchaToken;Object.assign(l,{phoneSignInInfo:{recaptchaToken:u,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return l}return r?Object.assign(l,{captchaResp:o}):Object.assign(l,{captchaResponse:o}),Object.assign(l,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(l,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),l}async function kT(t,e,n,r,i){if(t._getRecaptchaConfig()?.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const s=await ST(t,e,n,n==="getOobCode");return r(t,s)}else return r(t,e).catch(async s=>{if(s.code==="auth/missing-recaptcha-token"){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);const o=await ST(t,e,n,n==="getOobCode");return r(t,o)}else return Promise.reject(s)})}function jB(t,e){const n=EM(t,"auth");if(n.isInitialized()){const i=n.getImmediate(),s=n.getOptions();if(sc(s,e??{}))return i;Gr(i,"already-initialized")}return n.initialize({options:e})}function PB(t,e){const n=e?.persistence||[],r=(Array.isArray(n)?n:[n]).map(fs);e?.errorMap&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,e?.popupRedirectResolver)}function zB(t,e,n){const r=qa(t);He(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");const i=!1,s=ZM(e),{host:o,port:l}=$B(e),u=l===null?"":`:${l}`,f={url:`${s}//${o}${u}/`},h=Object.freeze({host:o,port:l,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})});if(!r._canInitEmulator){He(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),He(sc(f,r.config.emulator)&&sc(h,r.emulatorConfig),r,"emulator-config-failed");return}r.config.emulator=f,r.emulatorConfig=h,r.settings.appVerificationDisabledForTesting=!0,qx(o)?Fz(`${s}//${o}${u}`):BB()}function ZM(t){const e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function $B(t){const e=ZM(t),n=/(\/\/)?([^?#/]+)/.exec(t.substr(e.length));if(!n)return{host:"",port:null};const r=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(r);if(i){const s=i[1];return{host:s,port:CT(r.substr(s.length+1))}}else{const[s,o]=r.split(":");return{host:s,port:CT(o)}}}function CT(t){if(!t)return null;const e=Number(t);return isNaN(e)?null:e}function BB(){function t(){const e=document.createElement("p"),n=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",n.position="fixed",n.width="100%",n.backgroundColor="#ffffff",n.border=".1em solid #000000",n.color="#b50000",n.bottom="0px",n.left="0px",n.margin="0px",n.zIndex="10000",n.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",t):t())}class Jx{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return ds("not implemented")}_getIdTokenResponse(e){return ds("not implemented")}_linkToIdToken(e,n){return ds("not implemented")}_getReauthenticationResolver(e){return ds("not implemented")}}async function VB(t,e){return $o(t,"POST","/v1/accounts:signUp",e)}async function HB(t,e){return Mm(t,"POST","/v1/accounts:signInWithPassword",Fa(t,e))}async function UB(t,e){return Mm(t,"POST","/v1/accounts:signInWithEmailLink",Fa(t,e))}async function FB(t,e){return Mm(t,"POST","/v1/accounts:signInWithEmailLink",Fa(t,e))}class md extends Jx{constructor(e,n,r,i=null){super("password",r),this._email=e,this._password=n,this._tenantId=i}static _fromEmailAndPassword(e,n){return new md(e,n,"password")}static _fromEmailAndCode(e,n,r=null){return new md(e,n,"emailLink",r)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){const n=typeof e=="string"?JSON.parse(e):e;if(n?.email&&n?.password){if(n.signInMethod==="password")return this._fromEmailAndPassword(n.email,n.password);if(n.signInMethod==="emailLink")return this._fromEmailAndCode(n.email,n.password,n.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":const n={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return kT(e,n,"signInWithPassword",HB);case"emailLink":return UB(e,{email:this._email,oobCode:this._password});default:Gr(e,"internal-error")}}async _linkToIdToken(e,n){switch(this.signInMethod){case"password":const r={idToken:n,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return kT(e,r,"signUpPassword",VB);case"emailLink":return FB(e,{idToken:n,email:this._email,oobCode:this._password});default:Gr(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}async function ec(t,e){return Mm(t,"POST","/v1/accounts:signInWithIdp",Fa(t,e))}const qB="http://localhost";class Ra extends Jx{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const n=new Ra(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(n.idToken=e.idToken),e.accessToken&&(n.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(n.nonce=e.nonce),e.pendingToken&&(n.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(n.accessToken=e.oauthToken,n.secret=e.oauthTokenSecret):Gr("argument-error"),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){const n=typeof e=="string"?JSON.parse(e):e,{providerId:r,signInMethod:i,...s}=n;if(!r||!i)return null;const o=new Ra(r,i);return o.idToken=s.idToken||void 0,o.accessToken=s.accessToken||void 0,o.secret=s.secret,o.nonce=s.nonce,o.pendingToken=s.pendingToken||null,o}_getIdTokenResponse(e){const n=this.buildRequest();return ec(e,n)}_linkToIdToken(e,n){const r=this.buildRequest();return r.idToken=n,ec(e,r)}_getReauthenticationResolver(e){const n=this.buildRequest();return n.autoCreate=!1,ec(e,n)}buildRequest(){const e={requestUri:qB,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{const n={};this.idToken&&(n.id_token=this.idToken),this.accessToken&&(n.access_token=this.accessToken),this.secret&&(n.oauth_token_secret=this.secret),n.providerId=this.providerId,this.nonce&&!this.pendingToken&&(n.nonce=this.nonce),e.postBody=jd(n)}return e}}function GB(t){switch(t){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}function WB(t){const e=ju(Pu(t)).link,n=e?ju(Pu(e)).deep_link_id:null,r=ju(Pu(t)).deep_link_id;return(r?ju(Pu(r)).link:null)||r||n||e||t}class Qx{constructor(e){const n=ju(Pu(e)),r=n.apiKey??null,i=n.oobCode??null,s=GB(n.mode??null);He(r&&i&&s,"argument-error"),this.apiKey=r,this.operation=s,this.code=i,this.continueUrl=n.continueUrl??null,this.languageCode=n.lang??null,this.tenantId=n.tenantId??null}static parseLink(e){const n=WB(e);try{return new Qx(n)}catch{return null}}}class Ec{constructor(){this.providerId=Ec.PROVIDER_ID}static credential(e,n){return md._fromEmailAndPassword(e,n)}static credentialWithLink(e,n){const r=Qx.parseLink(n);return He(r,"argument-error"),md._fromEmailAndCode(e,r.code,r.tenantId)}}Ec.PROVIDER_ID="password";Ec.EMAIL_PASSWORD_SIGN_IN_METHOD="password";Ec.EMAIL_LINK_SIGN_IN_METHOD="emailLink";class ew{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}}class $d extends ew{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}class co extends $d{constructor(){super("facebook.com")}static credential(e){return Ra._fromParams({providerId:co.PROVIDER_ID,signInMethod:co.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return co.credentialFromTaggedObject(e)}static credentialFromError(e){return co.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return co.credential(e.oauthAccessToken)}catch{return null}}}co.FACEBOOK_SIGN_IN_METHOD="facebook.com";co.PROVIDER_ID="facebook.com";class cs extends $d{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return Ra._fromParams({providerId:cs.PROVIDER_ID,signInMethod:cs.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:n})}static credentialFromResult(e){return cs.credentialFromTaggedObject(e)}static credentialFromError(e){return cs.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:n,oauthAccessToken:r}=e;if(!n&&!r)return null;try{return cs.credential(n,r)}catch{return null}}}cs.GOOGLE_SIGN_IN_METHOD="google.com";cs.PROVIDER_ID="google.com";class uo extends $d{constructor(){super("github.com")}static credential(e){return Ra._fromParams({providerId:uo.PROVIDER_ID,signInMethod:uo.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return uo.credentialFromTaggedObject(e)}static credentialFromError(e){return uo.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return uo.credential(e.oauthAccessToken)}catch{return null}}}uo.GITHUB_SIGN_IN_METHOD="github.com";uo.PROVIDER_ID="github.com";class fo extends $d{constructor(){super("twitter.com")}static credential(e,n){return Ra._fromParams({providerId:fo.PROVIDER_ID,signInMethod:fo.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:n})}static credentialFromResult(e){return fo.credentialFromTaggedObject(e)}static credentialFromError(e){return fo.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:n,oauthTokenSecret:r}=e;if(!n||!r)return null;try{return fo.credential(n,r)}catch{return null}}}fo.TWITTER_SIGN_IN_METHOD="twitter.com";fo.PROVIDER_ID="twitter.com";class ac{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,n,r,i=!1){const s=await li._fromIdTokenResponse(e,r,i),o=ET(r);return new ac({user:s,providerId:o,_tokenResponse:r,operationType:n})}static async _forOperation(e,n,r){await e._updateTokensIfNecessary(r,!0);const i=ET(r);return new ac({user:e,providerId:i,_tokenResponse:r,operationType:n})}}function ET(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}class yp extends zo{constructor(e,n,r,i){super(n.code,n.message),this.operationType=r,this.user=i,Object.setPrototypeOf(this,yp.prototype),this.customData={appName:e.name,tenantId:e.tenantId??void 0,_serverResponse:n.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(e,n,r,i){return new yp(e,n,r,i)}}function YM(t,e,n,r){return(e==="reauthenticate"?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?yp._fromErrorAndOperation(t,s,e,r):s})}async function KB(t,e,n=!1){const r=await pd(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return ac._forOperation(t,"link",r)}async function ZB(t,e,n=!1){const{auth:r}=t;if(si(r.app))return Promise.reject(wo(r));const i="reauthenticate";try{const s=await pd(t,YM(r,i,e,t),n);He(s.idToken,r,"internal-error");const o=Yx(s.idToken);He(o,r,"internal-error");const{sub:l}=o;return He(t.uid===l,r,"user-mismatch"),ac._forOperation(t,i,s)}catch(s){throw s?.code==="auth/user-not-found"&&Gr(r,"user-mismatch"),s}}async function XM(t,e,n=!1){if(si(t.app))return Promise.reject(wo(t));const r="signIn",i=await YM(t,r,e),s=await ac._fromIdTokenResponse(t,r,i);return n||await t._updateCurrentUser(s.user),s}async function YB(t,e){return XM(qa(t),e)}async function XB(t){const e=qa(t);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}function JB(t,e,n){return si(t.app)?Promise.reject(wo(t)):YB(_s(t),Ec.credential(e,n)).catch(async r=>{throw r.code==="auth/password-does-not-meet-requirements"&&XB(t),r})}function QB(t,e,n,r){return _s(t).onIdTokenChanged(e,n,r)}function e3(t,e,n){return _s(t).beforeAuthStateChanged(e,n)}function t3(t,e,n,r){return _s(t).onAuthStateChanged(e,n,r)}function TT(t){return _s(t).signOut()}const vp="__sak";class JM{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(vp,"1"),this.storage.removeItem(vp),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,n){return this.storage.setItem(e,JSON.stringify(n)),Promise.resolve()}_get(e){const n=this.storage.getItem(e);return Promise.resolve(n?JSON.parse(n):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}}const n3=1e3,r3=10;class QM extends JM{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=qM(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const n of Object.keys(this.listeners)){const r=this.storage.getItem(n),i=this.localCache[n];r!==i&&e(n,i,r)}}onStorageEvent(e,n=!1){if(!e.key){this.forAllChangedKeys((o,l,u)=>{this.notifyListeners(o,u)});return}const r=e.key;n?this.detachListener():this.stopPolling();const i=()=>{const o=this.storage.getItem(r);!n&&this.localCache[r]===o||this.notifyListeners(r,o)},s=this.storage.getItem(r);kB()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,r3):i()}notifyListeners(e,n){this.localCache[e]=n;const r=this.listeners[e];if(r)for(const i of Array.from(r))i(n&&JSON.parse(n))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,n,r)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:n,newValue:r}),!0)})},n3)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,n){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,n){await super._set(e,n),this.localCache[e]=JSON.stringify(n)}async _get(e){const n=await super._get(e);return this.localCache[e]=JSON.stringify(n),n}async _remove(e){await super._remove(e),delete this.localCache[e]}}QM.type="LOCAL";const i3=QM;class eN extends JM{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}}eN.type="SESSION";const tN=eN;function s3(t){return Promise.all(t.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}class Om{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const n=this.receivers.find(i=>i.isListeningto(e));if(n)return n;const r=new Om(e);return this.receivers.push(r),r}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const n=e,{eventId:r,eventType:i,data:s}=n.data,o=this.handlersMap[i];if(!o?.size)return;n.ports[0].postMessage({status:"ack",eventId:r,eventType:i});const l=Array.from(o).map(async f=>f(n.origin,s)),u=await s3(l);n.ports[0].postMessage({status:"done",eventId:r,eventType:i,response:u})}_subscribe(e,n){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(n)}_unsubscribe(e,n){this.handlersMap[e]&&n&&this.handlersMap[e].delete(n),(!n||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}Om.receivers=[];function tw(t="",e=10){let n="";for(let r=0;r<e;r++)n+=Math.floor(Math.random()*10);return t+n}class o3{constructor(e){this.target=e,this.handlers=new Set}removeMessageHandler(e){e.messageChannel&&(e.messageChannel.port1.removeEventListener("message",e.onMessage),e.messageChannel.port1.close()),this.handlers.delete(e)}async _send(e,n,r=50){const i=typeof MessageChannel<"u"?new MessageChannel:null;if(!i)throw new Error("connection_unavailable");let s,o;return new Promise((l,u)=>{const f=tw("",20);i.port1.start();const h=setTimeout(()=>{u(new Error("unsupported_event"))},r);o={messageChannel:i,onMessage(m){const g=m;if(g.data.eventId===f)switch(g.data.status){case"ack":clearTimeout(h),s=setTimeout(()=>{u(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),l(g.data.response);break;default:clearTimeout(h),clearTimeout(s),u(new Error("invalid_response"));break}}},this.handlers.add(o),i.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:f,data:n},[i.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}}function Ai(){return window}function a3(t){Ai().location.href=t}function nN(){return typeof Ai().WorkerGlobalScope<"u"&&typeof Ai().importScripts=="function"}async function l3(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function c3(){return navigator?.serviceWorker?.controller||null}function u3(){return nN()?self:null}const rN="firebaseLocalStorageDb",d3=1,bp="firebaseLocalStorage",iN="fbase_key";class Bd{constructor(e){this.request=e}toPromise(){return new Promise((e,n)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{n(this.request.error)})})}}function Dm(t,e){return t.transaction([bp],e?"readwrite":"readonly").objectStore(bp)}function f3(){const t=indexedDB.deleteDatabase(rN);return new Bd(t).toPromise()}function sN(){const t=indexedDB.open(rN,d3);return new Promise((e,n)=>{t.addEventListener("error",()=>{n(t.error)}),t.addEventListener("upgradeneeded",()=>{const r=t.result;try{r.createObjectStore(bp,{keyPath:iN})}catch(i){n(i)}}),t.addEventListener("success",async()=>{const r=t.result;r.objectStoreNames.contains(bp)?e(r):(r.close(),await f3(),e(await sN()))})})}async function _T(t,e,n){const r=Dm(t,!0).put({[iN]:e,value:n});return new Bd(r).toPromise()}async function h3(t,e){const n=Dm(t,!1).get(e),r=await new Bd(n).toPromise();return r===void 0?null:r.value}function AT(t,e){const n=Dm(t,!0).delete(e);return new Bd(n).toPromise()}const p3=800,m3=3;class oN{registerLifecycleListeners(){typeof window<"u"&&typeof window.addEventListener=="function"&&(window.addEventListener("pagehide",this.onPageHide),window.addEventListener("pageshow",this.onPageShow)),typeof document<"u"&&typeof document.addEventListener=="function"&&document.addEventListener("visibilitychange",this.onVisibilityChange)}unregisterLifecycleListeners(){typeof window<"u"&&typeof window.removeEventListener=="function"&&(window.removeEventListener("pagehide",this.onPageHide),window.removeEventListener("pageshow",this.onPageShow)),typeof document<"u"&&typeof document.removeEventListener=="function"&&document.removeEventListener("visibilitychange",this.onVisibilityChange)}constructor(){this.type="LOCAL",this.dbPromise=null,this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.isHiding=!1,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this.onPageHide=()=>{this.isHiding=!0,this.stopPolling(),this.dbPromise&&(this.dbPromise.then(e=>e.close()).catch(()=>{}),this.dbPromise=null)},this.onPageShow=()=>{this.isHiding&&(this.isHiding=!1,Object.keys(this.listeners).length>0&&this.startPolling())},this.onVisibilityChange=()=>{typeof document<"u"&&(document.visibilityState==="hidden"?this.onPageHide():document.visibilityState==="visible"&&this.onPageShow())},this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){if(this.isHiding)throw new Error("Database is closing/hidden");return this.dbPromise?this.dbPromise:(this.dbPromise=sN(),this.dbPromise.catch(()=>{this.dbPromise=null}),this.dbPromise)}async _withRetries(e){let n=0;for(;;)try{const r=await this._openDb();return await e(r)}catch(r){if(this.isHiding||n++>m3)throw r;this.dbPromise&&((await this.dbPromise).close(),this.dbPromise=null)}}async initializeServiceWorkerMessaging(){return nN()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Om._getInstance(u3()),this.receiver._subscribe("keyChanged",async(e,n)=>({keyProcessed:(await this._poll()).includes(n.key)})),this.receiver._subscribe("ping",async(e,n)=>["keyChanged"])}async initializeSender(){if(this.activeServiceWorker=await l3(),!this.activeServiceWorker)return;this.sender=new o3(this.activeServiceWorker);const e=await this.sender._send("ping",{},800);e&&e[0]?.fulfilled&&e[0]?.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||c3()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{return indexedDB?(await this._withRetries(async e=>{await _T(e,vp,"1"),await AT(e,vp)}),!0):!1}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,n){return this._withPendingWrite(async()=>(await this._withRetries(r=>_T(r,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){const n=await this._withRetries(r=>h3(r,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>AT(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){if(this.isHiding)return[];try{const e=await this._withRetries(i=>{const s=Dm(i,!1).getAll();return new Bd(s).toPromise()});if(this.isHiding)return[];if(!e)return[];if(this.pendingWrites!==0)return[];const n=[],r=new Set;if(e.length!==0)for(const{fbase_key:i,value:s}of e)r.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(s)&&(this.notifyListeners(i,s),n.push(i));for(const i of Object.keys(this.localCache))this.localCache[i]&&!r.has(i)&&(this.notifyListeners(i,null),n.push(i));return n}catch(e){return this.isHiding||OM(`Firebase Auth cross-tab polling failed with error: ${e}`),[]}}notifyListeners(e,n){this.localCache[e]=n;const r=this.listeners[e];if(r)for(const i of Array.from(r))i(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),p3)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,n){Object.keys(this.listeners).length===0&&(this.startPolling(),this.registerLifecycleListeners()),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.stopPolling(),this.unregisterLifecycleListeners())}}oN.type="LOCAL";const g3=oN;new zd(3e4,6e4);function aN(t,e){return e?fs(e):(He(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}class nw extends Jx{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return ec(e,this._buildIdpRequest())}_linkToIdToken(e,n){return ec(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return ec(e,this._buildIdpRequest())}_buildIdpRequest(e){const n={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(n.idToken=e),n}}function y3(t){return XM(t.auth,new nw(t),t.bypassAuthState)}function v3(t){const{auth:e,user:n}=t;return He(n,e,"internal-error"),ZB(n,new nw(t),t.bypassAuthState)}async function b3(t){const{auth:e,user:n}=t;return He(n,e,"internal-error"),KB(n,new nw(t),t.bypassAuthState)}class lN{constructor(e,n,r,i,s=!1){this.auth=e,this.resolver=r,this.user=i,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(n)?n:[n]}execute(){return new Promise(async(e,n)=>{this.pendingPromise={resolve:e,reject:n};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(r){this.reject(r)}})}async onAuthEvent(e){const{urlResponse:n,sessionId:r,postBody:i,tenantId:s,error:o,type:l}=e;if(o){this.reject(o);return}const u={auth:this.auth,requestUri:n,sessionId:r,tenantId:s||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(l)(u))}catch(f){this.reject(f)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return y3;case"linkViaPopup":case"linkViaRedirect":return b3;case"reauthViaPopup":case"reauthViaRedirect":return v3;default:Gr(this.auth,"internal-error")}}resolve(e){ks(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){ks(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}const x3=new zd(2e3,1e4);async function w3(t,e,n){if(si(t.app))return Promise.reject(ui(t,"operation-not-supported-in-this-environment"));const r=qa(t);rB(t,e,ew);const i=aN(r,n);return new ya(r,"signInViaPopup",e,i).executeNotNull()}class ya extends lN{constructor(e,n,r,i,s){super(e,n,i,s),this.provider=r,this.authWindow=null,this.pollId=null,ya.currentPopupAction&&ya.currentPopupAction.cancel(),ya.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return He(e,this.auth,"internal-error"),e}async onExecution(){ks(this.filter.length===1,"Popup operations only handle one event");const e=tw();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(n=>{this.reject(n)}),this.resolver._isIframeWebStorageSupported(this.auth,n=>{n||this.reject(ui(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){return this.authWindow?.associatedEvent||null}cancel(){this.reject(ui(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,ya.currentPopupAction=null}pollUserCancellation(){const e=()=>{if(this.authWindow?.window?.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(ui(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,x3.get())};e()}}ya.currentPopupAction=null;const S3="pendingRedirect",Qh=new Map;class k3 extends lN{constructor(e,n,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,r),this.eventId=null}async execute(){let e=Qh.get(this.auth._key());if(!e){try{const r=await C3(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(r)}catch(n){e=()=>Promise.reject(n)}Qh.set(this.auth._key(),e)}return this.bypassAuthState||Qh.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){const n=await this.auth._redirectUserForId(e.eventId);if(n)return this.user=n,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}}async function C3(t,e){const n=_3(e),r=T3(t);if(!await r._isAvailable())return!1;const i=await r._get(n)==="true";return await r._remove(n),i}function E3(t,e){Qh.set(t._key(),e)}function T3(t){return fs(t._redirectPersistence)}function _3(t){return Jh(S3,t.config.apiKey,t.name)}async function A3(t,e,n=!1){if(si(t.app))return Promise.reject(wo(t));const r=qa(t),i=aN(r,e),o=await new k3(r,i,n).execute();return o&&!n&&(delete o.user._redirectEventId,await r._persistUserIfCurrent(o.user),await r._setRedirectUser(null,e)),o}const R3=600*1e3;class M3{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let n=!1;return this.consumers.forEach(r=>{this.isEventForConsumer(e,r)&&(n=!0,this.sendToConsumer(e,r),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!N3(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){if(e.error&&!cN(e)){const r=e.error.code?.split("auth/")[1]||"internal-error";n.onError(ui(this.auth,r))}else n.onAuthEvent(e)}isEventForConsumer(e,n){const r=n.eventId===null||!!e.eventId&&e.eventId===n.eventId;return n.filter.includes(e.type)&&r}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=R3&&this.cachedEventUids.clear(),this.cachedEventUids.has(RT(e))}saveEventToCache(e){this.cachedEventUids.add(RT(e)),this.lastProcessedEventTime=Date.now()}}function RT(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter(e=>e).join("-")}function cN({type:t,error:e}){return t==="unknown"&&e?.code==="auth/no-auth-event"}function N3(t){switch(t.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return cN(t);default:return!1}}async function O3(t,e={}){return $o(t,"GET","/v1/projects",e)}const D3=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,I3=/^https?/;async function L3(t){if(t.config.emulator)return;const{authorizedDomains:e}=await O3(t);for(const n of e)try{if(j3(n))return}catch{}Gr(t,"unauthorized-domain")}function j3(t){const e=d0(),{protocol:n,hostname:r}=new URL(e);if(t.startsWith("chrome-extension://")){const o=new URL(t);return o.hostname===""&&r===""?n==="chrome-extension:"&&t.replace("chrome-extension://","")===e.replace("chrome-extension://",""):n==="chrome-extension:"&&o.hostname===r}if(!I3.test(n))return!1;if(D3.test(t))return r===t;const i=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(r)}const P3=new zd(3e4,6e4);function MT(){const t=Ai().___jsl;if(t?.H){for(const e of Object.keys(t.H))if(t.H[e].r=t.H[e].r||[],t.H[e].L=t.H[e].L||[],t.H[e].r=[...t.H[e].L],t.CP)for(let n=0;n<t.CP.length;n++)t.CP[n]=null}}function z3(t){return new Promise((e,n)=>{function r(){MT(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{MT(),n(ui(t,"network-request-failed"))},timeout:P3.get()})}if(Ai().gapi?.iframes?.Iframe)e(gapi.iframes.getContext());else if(Ai().gapi?.load)r();else{const i=OB("iframefcb");return Ai()[i]=()=>{gapi.load?r():n(ui(t,"network-request-failed"))},WM(`${NB()}?onload=${i}`).catch(s=>n(s))}}).catch(e=>{throw ep=null,e})}let ep=null;function $3(t){return ep=ep||z3(t),ep}const B3=new zd(5e3,15e3),V3="__/auth/iframe",H3="emulator/auth/iframe",U3={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},F3=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function q3(t){const e=t.config;He(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?Zx(e,H3):`https://${t.config.authDomain}/${V3}`,r={apiKey:e.apiKey,appName:t.name,v:Pd},i=F3.get(t.config.apiHost);i&&(r.eid=i);const s=t._getFrameworks();return s.length&&(r.fw=s.join(",")),`${n}?${jd(r).slice(1)}`}async function G3(t){const e=await $3(t),n=Ai().gapi;return He(n,t,"internal-error"),e.open({where:document.body,url:q3(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:U3,dontclear:!0},r=>new Promise(async(i,s)=>{await r.restyle({setHideOnLeave:!1});const o=ui(t,"network-request-failed"),l=Ai().setTimeout(()=>{s(o)},B3.get());function u(){Ai().clearTimeout(l),i(r)}r.ping(u).then(u,()=>{s(o)})}))}const W3={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},K3=500,Z3=600,Y3="_blank",X3="http://localhost";class NT{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function J3(t,e,n,r=K3,i=Z3){const s=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-r)/2,0).toString();let l="";const u={...W3,width:r.toString(),height:i.toString(),top:s,left:o},f=Jn().toLowerCase();n&&(l=BM(f)?Y3:n),zM(f)&&(e=e||X3,u.scrollbars="yes");const h=Object.entries(u).reduce((g,[y,x])=>`${g}${y}=${x},`,"");if(SB(f)&&l!=="_self")return Q3(e||"",l),new NT(null);const m=window.open(e||"",l,h);He(m,t,"popup-blocked");try{m.focus()}catch{}return new NT(m)}function Q3(t,e){const n=document.createElement("a");n.href=t,n.target=e;const r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}const eV="__/auth/handler",tV="emulator/auth/handler",nV=encodeURIComponent("fac");async function OT(t,e,n,r,i,s){He(t.config.authDomain,t,"auth-domain-config-required"),He(t.config.apiKey,t,"invalid-api-key");const o={apiKey:t.config.apiKey,appName:t.name,authType:n,redirectUrl:r,v:Pd,eventId:i};if(e instanceof ew){e.setDefaultLanguage(t.languageCode),o.providerId=e.providerId||"",Bz(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[h,m]of Object.entries({}))o[h]=m}if(e instanceof $d){const h=e.getScopes().filter(m=>m!=="");h.length>0&&(o.scopes=h.join(","))}t.tenantId&&(o.tid=t.tenantId);const l=o;for(const h of Object.keys(l))l[h]===void 0&&delete l[h];const u=await t._getAppCheckToken(),f=u?`#${nV}=${encodeURIComponent(u)}`:"";return`${rV(t)}?${jd(l).slice(1)}${f}`}function rV({config:t}){return t.emulator?Zx(t,tV):`https://${t.authDomain}/${eV}`}const Xv="webStorageSupport";class iV{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=tN,this._completeRedirectFn=A3,this._overrideRedirectResult=E3}async _openPopup(e,n,r,i){ks(this.eventManagers[e._key()]?.manager,"_initialize() not called before _openPopup()");const s=await OT(e,n,r,d0(),i);return J3(e,s,tw())}async _openRedirect(e,n,r,i){await this._originValidation(e);const s=await OT(e,n,r,d0(),i);return a3(s),new Promise(()=>{})}_initialize(e){const n=e._key();if(this.eventManagers[n]){const{manager:i,promise:s}=this.eventManagers[n];return i?Promise.resolve(i):(ks(s,"If manager is not set, promise should be"),s)}const r=this.initAndGetManager(e);return this.eventManagers[n]={promise:r},r.catch(()=>{delete this.eventManagers[n]}),r}async initAndGetManager(e){const n=await G3(e),r=new M3(e);return n.register("authEvent",i=>(He(i?.authEvent,e,"invalid-auth-event"),{status:r.onEvent(i.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:r},this.iframes[e._key()]=n,r}_isIframeWebStorageSupported(e,n){this.iframes[e._key()].send(Xv,{type:Xv},i=>{const s=i?.[0]?.[Xv];s!==void 0&&n(!!s),Gr(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=L3(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return qM()||$M()||Xx()}}const sV=iV;var DT="@firebase/auth",IT="1.13.4";class oV{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){return this.assertAuthConfigured(),this.auth.currentUser?.uid||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;const n=this.auth.onIdTokenChanged(r=>{e(r?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,n),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();const n=this.internalListeners.get(e);n&&(this.internalListeners.delete(e),n(),this.updateProactiveRefresh())}assertAuthConfigured(){He(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}function aV(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function lV(t){fd(new oc("auth",(e,{options:n})=>{const r=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:o,authDomain:l}=r.options;He(o&&!o.includes(":"),"invalid-api-key",{appName:r.name});const u={apiKey:o,authDomain:l,clientPlatform:t,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:GM(t)},f=new AB(r,i,s,u);return PB(f,n),f},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,r)=>{e.getProvider("auth-internal").initialize()})),fd(new oc("auth-internal",e=>{const n=qa(e.getProvider("auth").getImmediate());return(r=>new oV(r))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),Xl(DT,IT,aV(t)),Xl(DT,IT,"esm2020")}const cV=300,uV=xM("authIdTokenMaxAge")||cV;let LT=null;const dV=t=>async e=>{const n=e&&await e.getIdTokenResult(),r=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(r&&r>uV)return;const i=n?.token;LT!==i&&(LT=i,await fetch(t,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};function fV(t=_M()){const e=EM(t,"auth");if(e.isInitialized())return e.getImmediate();const n=jB(t,{popupRedirectResolver:sV,persistence:[g3,i3,tN]}),r=xM("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){const s=new URL(r,location.origin);if(location.origin===s.origin){const o=dV(s.toString());e3(n,o,()=>o(n.currentUser)),QB(n,l=>o(l))}}const i=Mz("auth");return i&&zB(n,`http://${i}`),n}function hV(){return document.getElementsByTagName("head")?.[0]??document}RB({loadJS(t){return new Promise((e,n)=>{const r=document.createElement("script");r.setAttribute("src",t),r.onload=e,r.onerror=i=>{const s=ui("internal-error");s.customData=i,n(s)},r.type="text/javascript",r.charset="UTF-8",hV().appendChild(r)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});lV("Browser");function pV(t=6e4){const e=new Map,n=new Map;function r(o,l,u){if(!u?.fresh){const h=e.get(o);if(h&&Date.now()-h.at<t)return Promise.resolve(h.value);const m=n.get(o);if(m)return m}const f=l().then(h=>(e.set(o,{value:h,at:Date.now()}),n.delete(o),h)).catch(h=>{throw n.delete(o),h});return n.set(o,f),f}function i(o,l){e.set(o,{value:l,at:Date.now()})}function s(o){if(!o){e.clear(),n.clear();return}for(const l of[...e.keys()])(l===o||l.startsWith(`${o}:`))&&e.delete(l);for(const l of[...n.keys()])(l===o||l.startsWith(`${o}:`))&&n.delete(l)}return{get:r,set:i,invalidate:s}}const mV="x-vertebr-env";async function gh(t,e){const n=await t.arrayBuffer(),r=new Uint8Array(n);let i="";const s=32768;for(let l=0;l<r.length;l+=s)i+=String.fromCharCode(...r.subarray(l,l+s));return{name:e||typeof File<"u"&&t instanceof File&&t.name||"upload",type:t.type||"application/octet-stream",data:btoa(i)}}function h0(t,e){const n=typeof t=="string"?{apiBase:t,getEnvironment:(()=>"")}:t,r=n.apiBase.replace(/\/$/,""),i=pV(n.cacheTtlMs??6e4);async function s(o,l,u){const f=n.getEnvironment().trim(),m=(await n.getAccessToken?.())?.trim(),g=await fetch(`${r}${o}`,{...l,headers:{Accept:"application/json","Content-Type":"application/json",...f?{[mV]:f}:{},...u?.auth!==!1&&m?{Authorization:`Bearer ${m}`}:{},...l?.headers??{}}});if(!g.ok){const y=await g.text();let x=y||`Request failed (${g.status})`;try{const S=JSON.parse(y);typeof S.error=="string"&&S.error.trim()?x=S.error:S.error&&typeof S.error=="object"&&typeof S.error.message=="string"&&S.error.message.trim()?x=S.error.message:typeof S.message=="string"&&S.message.trim()&&(x=S.message)}catch{}throw new Error(x)}return await g.json()}return{getBootstrap:o=>i.get("bootstrap",()=>s("/bootstrap",void 0,{auth:!1}),o),getCatalog:o=>i.get("catalog",()=>s(""),o),getMetrics:o=>{const l=o?.range?.trim()||"14d";return i.get(`metrics:${l}`,()=>s(`/metrics?range=${encodeURIComponent(l)}`),o)},getPublicControls:o=>i.get("controls",async()=>(await s("/public/controls",void 0,{auth:!1})).configs??{},o),getPublicResource:(o,l)=>i.get(`public-resource:${o}`,()=>s(`/public/resources/${encodeURIComponent(o)}`,void 0,{auth:!1}),l),listResource:(o,l)=>i.get(`resource:${o}`,()=>s(`/resources/${encodeURIComponent(o)}`),l),createResource:async(o,l)=>{const u=await s(`/resources/${encodeURIComponent(o)}`,{method:"POST",body:JSON.stringify(l)});return i.invalidate(`resource:${o}`),i.invalidate(`public-resource:${o}`),u},updateResource:async(o,l,u)=>{const f=await s(`/resources/${encodeURIComponent(o)}/${encodeURIComponent(l)}`,{method:"PUT",body:JSON.stringify(u)});return i.invalidate(`resource:${o}`),i.invalidate(`public-resource:${o}`),f},deleteResource:async(o,l)=>{const u=await s(`/resources/${encodeURIComponent(o)}/${encodeURIComponent(l)}`,{method:"DELETE"});return i.invalidate(`resource:${o}`),i.invalidate(`public-resource:${o}`),u},runResourceAction:async(o,l,u,f)=>{const h=await s(`/resources/${encodeURIComponent(o)}/${encodeURIComponent(l)}/actions/${encodeURIComponent(u)}`,{method:"POST",body:JSON.stringify(f??{})});return i.invalidate(`resource:${o}`),i.invalidate(`public-resource:${o}`),h},runCollectionAction:async(o,l,u)=>{const f=await s(`/resources/${encodeURIComponent(o)}/collection-actions/${encodeURIComponent(l)}`,{method:"POST",body:JSON.stringify(u??{})});return i.invalidate(`resource:${o}`),i.invalidate(`public-resource:${o}`),f},previewResourceMail:async(o,l,u,f)=>s(`/resources/${encodeURIComponent(o)}/${encodeURIComponent(l)}/mail/${encodeURIComponent(u)}/preview`,{method:"POST",body:JSON.stringify(f??{})}),getEmails:o=>i.get("emails",()=>s("/emails"),o),previewEmails:async o=>s("/emails/preview",{method:"POST",body:JSON.stringify(o)}),sendEmails:async o=>{const l=await s("/emails/send",{method:"POST",body:JSON.stringify(o)});return i.invalidate("emails"),i.invalidate(`resource:${o.resourceId}`),l},scheduleEmails:async o=>{const l=await s("/emails/schedule",{method:"POST",body:JSON.stringify(o)});return i.invalidate("emails"),l},cancelEmailCampaign:async o=>{const l=await s(`/emails/campaigns/${encodeURIComponent(o)}`,{method:"DELETE"});return i.invalidate("emails"),l},saveEmailLibraryTemplate:async o=>{const l=await s("/emails/library",{method:"POST",body:JSON.stringify(o)});return i.invalidate("emails"),l},deleteEmailLibraryTemplate:async o=>{const l=await s(`/emails/library/${encodeURIComponent(o)}`,{method:"DELETE"});return i.invalidate("emails"),l},uploadResourceFile:async(o,l,u,f)=>{const h=await gh(u,f);return s(`/resources/${encodeURIComponent(o)}/uploads/${encodeURIComponent(l)}`,{method:"POST",body:JSON.stringify(h)})},uploadResourceFiles:async(o,l,u)=>{const f={files:await Promise.all(u.map(h=>gh(h)))};return s(`/resources/${encodeURIComponent(o)}/uploads/${encodeURIComponent(l)}/bulk`,{method:"POST",body:JSON.stringify(f)})},getGallery:o=>i.get("gallery",()=>s("/gallery"),o),uploadGalleryFile:async(o,l)=>{const u=await gh(o,l),f=await s("/gallery/upload",{method:"POST",body:JSON.stringify(u)});return i.invalidate("gallery"),f},uploadGalleryFiles:async o=>{const l={files:await Promise.all(o.map(f=>gh(f)))},u=await s("/gallery/upload/bulk",{method:"POST",body:JSON.stringify(l)});return i.invalidate("gallery"),u},deleteGalleryItem:async o=>{const l=await s(`/gallery/${encodeURIComponent(o)}`,{method:"DELETE"});return i.invalidate("gallery"),l},getConfig:(o,l)=>i.get(`config:${o}`,()=>s(`/configs/${encodeURIComponent(o)}`),l),setConfig:async(o,l)=>{const u=await s(`/configs/${encodeURIComponent(o)}`,{method:"PUT",body:JSON.stringify(l)}),f={id:u.id,label:o,schema:{},environment:u.environment,value:u.value};return i.set(`config:${o}`,f),i.invalidate("controls"),f},invalidateCache:o=>i.invalidate(o)}}function rw(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ga=rw();function uN(t){Ga=t}var Ku={exec:()=>null};function gt(t,e=""){let n=typeof t=="string"?t:t.source;const r={replace:(i,s)=>{let o=typeof s=="string"?s:s.source;return o=o.replace(Kn.caret,"$1"),n=n.replace(i,o),r},getRegex:()=>new RegExp(n,e)};return r}var Kn={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},gV=/^(?:[ \t]*(?:\n|$))+/,yV=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,vV=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Vd=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,bV=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,iw=/(?:[*+-]|\d{1,9}[.)])/,dN=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,fN=gt(dN).replace(/bull/g,iw).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),xV=gt(dN).replace(/bull/g,iw).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),sw=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,wV=/^[^\n]+/,ow=/(?!\s*\])(?:\\.|[^\[\]\\])+/,SV=gt(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ow).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),kV=gt(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,iw).getRegex(),Im="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",aw=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,CV=gt("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",aw).replace("tag",Im).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),hN=gt(sw).replace("hr",Vd).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Im).getRegex(),EV=gt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",hN).getRegex(),lw={blockquote:EV,code:yV,def:SV,fences:vV,heading:bV,hr:Vd,html:CV,lheading:fN,list:kV,newline:gV,paragraph:hN,table:Ku,text:wV},jT=gt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Vd).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Im).getRegex(),TV={...lw,lheading:xV,table:jT,paragraph:gt(sw).replace("hr",Vd).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",jT).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Im).getRegex()},_V={...lw,html:gt(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",aw).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Ku,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:gt(sw).replace("hr",Vd).replace("heading",` *#{1,6} *[^
|
|
10
|
-
]`).replace("lheading",fN).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},AV=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,RV=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,pN=/^( {2,}|\\)\n(?!\s*$)/,MV=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Lm=/[\p{P}\p{S}]/u,cw=/[\s\p{P}\p{S}]/u,mN=/[^\s\p{P}\p{S}]/u,NV=gt(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,cw).getRegex(),gN=/(?!~)[\p{P}\p{S}]/u,OV=/(?!~)[\s\p{P}\p{S}]/u,DV=/(?:[^\s\p{P}\p{S}]|~)/u,IV=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,yN=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,LV=gt(yN,"u").replace(/punct/g,Lm).getRegex(),jV=gt(yN,"u").replace(/punct/g,gN).getRegex(),vN="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",PV=gt(vN,"gu").replace(/notPunctSpace/g,mN).replace(/punctSpace/g,cw).replace(/punct/g,Lm).getRegex(),zV=gt(vN,"gu").replace(/notPunctSpace/g,DV).replace(/punctSpace/g,OV).replace(/punct/g,gN).getRegex(),$V=gt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,mN).replace(/punctSpace/g,cw).replace(/punct/g,Lm).getRegex(),BV=gt(/\\(punct)/,"gu").replace(/punct/g,Lm).getRegex(),VV=gt(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),HV=gt(aw).replace("(?:-->|$)","-->").getRegex(),UV=gt("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",HV).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),xp=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,FV=gt(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",xp).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),bN=gt(/^!?\[(label)\]\[(ref)\]/).replace("label",xp).replace("ref",ow).getRegex(),xN=gt(/^!?\[(ref)\](?:\[\])?/).replace("ref",ow).getRegex(),qV=gt("reflink|nolink(?!\\()","g").replace("reflink",bN).replace("nolink",xN).getRegex(),uw={_backpedal:Ku,anyPunctuation:BV,autolink:VV,blockSkip:IV,br:pN,code:RV,del:Ku,emStrongLDelim:LV,emStrongRDelimAst:PV,emStrongRDelimUnd:$V,escape:AV,link:FV,nolink:xN,punctuation:NV,reflink:bN,reflinkSearch:qV,tag:UV,text:MV,url:Ku},GV={...uw,link:gt(/^!?\[(label)\]\((.*?)\)/).replace("label",xp).getRegex(),reflink:gt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",xp).getRegex()},p0={...uw,emStrongRDelimAst:zV,emStrongLDelim:jV,url:gt(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},WV={...p0,br:gt(pN).replace("{2,}","*").getRegex(),text:gt(p0.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},yh={normal:lw,gfm:TV,pedantic:_V},Eu={normal:uw,gfm:p0,breaks:WV,pedantic:GV},KV={"&":"&","<":"<",">":">",'"':""","'":"'"},PT=t=>KV[t];function wi(t,e){if(e){if(Kn.escapeTest.test(t))return t.replace(Kn.escapeReplace,PT)}else if(Kn.escapeTestNoEncode.test(t))return t.replace(Kn.escapeReplaceNoEncode,PT);return t}function zT(t){try{t=encodeURI(t).replace(Kn.percentDecode,"%")}catch{return null}return t}function $T(t,e){const n=t.replace(Kn.findPipe,(s,o,l)=>{let u=!1,f=o;for(;--f>=0&&l[f]==="\\";)u=!u;return u?"|":" |"}),r=n.split(Kn.splitPipe);let i=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;i<r.length;i++)r[i]=r[i].trim().replace(Kn.slashPipe,"|");return r}function Tu(t,e,n){const r=t.length;if(r===0)return"";let i=0;for(;i<r&&t.charAt(r-i-1)===e;)i++;return t.slice(0,r-i)}function ZV(t,e){if(t.indexOf(e[1])===-1)return-1;let n=0;for(let r=0;r<t.length;r++)if(t[r]==="\\")r++;else if(t[r]===e[0])n++;else if(t[r]===e[1]&&(n--,n<0))return r;return n>0?-2:-1}function BT(t,e,n,r,i){const s=e.href,o=e.title||null,l=t[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;const u={type:t[0].charAt(0)==="!"?"image":"link",raw:n,href:s,title:o,text:l,tokens:r.inlineTokens(l)};return r.state.inLink=!1,u}function YV(t,e,n){const r=t.match(n.other.indentCodeCompensation);if(r===null)return e;const i=r[1];return e.split(`
|
|
11
|
-
`).map(s=>{const o=s.match(n.other.beginningSpace);if(o===null)return s;const[l]=o;return l.length>=i.length?s.slice(i.length):s}).join(`
|
|
12
|
-
`)}var wp=class{options;rules;lexer;constructor(t){this.options=t||Ga}space(t){const e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){const e=this.rules.block.code.exec(t);if(e){const n=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?n:Tu(n,`
|
|
13
|
-
`)}}}fences(t){const e=this.rules.block.fences.exec(t);if(e){const n=e[0],r=YV(n,e[3]||"",this.rules);return{type:"code",raw:n,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:r}}}heading(t){const e=this.rules.block.heading.exec(t);if(e){let n=e[2].trim();if(this.rules.other.endingHash.test(n)){const r=Tu(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(t){const e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:Tu(e[0],`
|
|
14
|
-
`)}}blockquote(t){const e=this.rules.block.blockquote.exec(t);if(e){let n=Tu(e[0],`
|
|
15
|
-
`).split(`
|
|
16
|
-
`),r="",i="";const s=[];for(;n.length>0;){let o=!1;const l=[];let u;for(u=0;u<n.length;u++)if(this.rules.other.blockquoteStart.test(n[u]))l.push(n[u]),o=!0;else if(!o)l.push(n[u]);else break;n=n.slice(u);const f=l.join(`
|
|
17
|
-
`),h=f.replace(this.rules.other.blockquoteSetextReplace,`
|
|
18
|
-
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
|
|
19
|
-
${f}`:f,i=i?`${i}
|
|
20
|
-
${h}`:h;const m=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(h,s,!0),this.lexer.state.top=m,n.length===0)break;const g=s.at(-1);if(g?.type==="code")break;if(g?.type==="blockquote"){const y=g,x=y.raw+`
|
|
21
|
-
`+n.join(`
|
|
22
|
-
`),S=this.blockquote(x);s[s.length-1]=S,r=r.substring(0,r.length-y.raw.length)+S.raw,i=i.substring(0,i.length-y.text.length)+S.text;break}else if(g?.type==="list"){const y=g,x=y.raw+`
|
|
23
|
-
`+n.join(`
|
|
24
|
-
`),S=this.list(x);s[s.length-1]=S,r=r.substring(0,r.length-g.raw.length)+S.raw,i=i.substring(0,i.length-y.raw.length)+S.raw,n=x.substring(s.at(-1).raw.length).split(`
|
|
25
|
-
`);continue}}return{type:"blockquote",raw:r,tokens:s,text:i}}}list(t){let e=this.rules.block.list.exec(t);if(e){let n=e[1].trim();const r=n.length>1,i={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");const s=this.rules.other.listItemRegex(n);let o=!1;for(;t;){let u=!1,f="",h="";if(!(e=s.exec(t))||this.rules.block.hr.test(t))break;f=e[0],t=t.substring(f.length);let m=e[2].split(`
|
|
26
|
-
`,1)[0].replace(this.rules.other.listReplaceTabs,C=>" ".repeat(3*C.length)),g=t.split(`
|
|
27
|
-
`,1)[0],y=!m.trim(),x=0;if(this.options.pedantic?(x=2,h=m.trimStart()):y?x=e[1].length+1:(x=e[2].search(this.rules.other.nonSpaceChar),x=x>4?1:x,h=m.slice(x),x+=e[1].length),y&&this.rules.other.blankLine.test(g)&&(f+=g+`
|
|
28
|
-
`,t=t.substring(g.length+1),u=!0),!u){const C=this.rules.other.nextBulletRegex(x),T=this.rules.other.hrRegex(x),_=this.rules.other.fencesBeginRegex(x),R=this.rules.other.headingBeginRegex(x),M=this.rules.other.htmlBeginRegex(x);for(;t;){const O=t.split(`
|
|
29
|
-
`,1)[0];let L;if(g=O,this.options.pedantic?(g=g.replace(this.rules.other.listReplaceNesting," "),L=g):L=g.replace(this.rules.other.tabCharGlobal," "),_.test(g)||R.test(g)||M.test(g)||C.test(g)||T.test(g))break;if(L.search(this.rules.other.nonSpaceChar)>=x||!g.trim())h+=`
|
|
30
|
-
`+L.slice(x);else{if(y||m.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||_.test(m)||R.test(m)||T.test(m))break;h+=`
|
|
31
|
-
`+g}!y&&!g.trim()&&(y=!0),f+=O+`
|
|
32
|
-
`,t=t.substring(O.length+1),m=L.slice(x)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(f)&&(o=!0));let S=null,k;this.options.gfm&&(S=this.rules.other.listIsTask.exec(h),S&&(k=S[0]!=="[ ] ",h=h.replace(this.rules.other.listReplaceTask,""))),i.items.push({type:"list_item",raw:f,task:!!S,checked:k,loose:!1,text:h,tokens:[]}),i.raw+=f}const l=i.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let u=0;u<i.items.length;u++)if(this.lexer.state.top=!1,i.items[u].tokens=this.lexer.blockTokens(i.items[u].text,[]),!i.loose){const f=i.items[u].tokens.filter(m=>m.type==="space"),h=f.length>0&&f.some(m=>this.rules.other.anyLine.test(m.raw));i.loose=h}if(i.loose)for(let u=0;u<i.items.length;u++)i.items[u].loose=!0;return i}}html(t){const e=this.rules.block.html.exec(t);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(t){const e=this.rules.block.def.exec(t);if(e){const n=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:n,raw:e[0],href:r,title:i}}}table(t){const e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;const n=$T(e[1]),r=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
33
|
-
`):[],s={type:"table",raw:e[0],header:[],align:[],rows:[]};if(n.length===r.length){for(const o of r)this.rules.other.tableAlignRight.test(o)?s.align.push("right"):this.rules.other.tableAlignCenter.test(o)?s.align.push("center"):this.rules.other.tableAlignLeft.test(o)?s.align.push("left"):s.align.push(null);for(let o=0;o<n.length;o++)s.header.push({text:n[o],tokens:this.lexer.inline(n[o]),header:!0,align:s.align[o]});for(const o of i)s.rows.push($T(o,s.header.length).map((l,u)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:s.align[u]})));return s}}lheading(t){const e=this.rules.block.lheading.exec(t);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(t){const e=this.rules.block.paragraph.exec(t);if(e){const n=e[1].charAt(e[1].length-1)===`
|
|
34
|
-
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:n,tokens:this.lexer.inline(n)}}}text(t){const e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){const e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){const e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){const e=this.rules.inline.link.exec(t);if(e){const n=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;const s=Tu(n.slice(0,-1),"\\");if((n.length-s.length)%2===0)return}else{const s=ZV(e[2],"()");if(s===-2)return;if(s>-1){const l=(e[0].indexOf("!")===0?5:4)+e[1].length+s;e[2]=e[2].substring(0,s),e[0]=e[0].substring(0,l).trim(),e[3]=""}}let r=e[2],i="";if(this.options.pedantic){const s=this.rules.other.pedanticHrefTitle.exec(r);s&&(r=s[1],i=s[3])}else i=e[3]?e[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),BT(e,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let n;if((n=this.rules.inline.reflink.exec(t))||(n=this.rules.inline.nolink.exec(t))){const r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=e[r.toLowerCase()];if(!i){const s=n[0].charAt(0);return{type:"text",raw:s,text:s}}return BT(n,i,n[0],this.lexer,this.rules)}}emStrong(t,e,n=""){let r=this.rules.inline.emStrongLDelim.exec(t);if(!r||r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))return;if(!(r[1]||r[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const s=[...r[0]].length-1;let o,l,u=s,f=0;const h=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,e=e.slice(-1*t.length+s);(r=h.exec(e))!=null;){if(o=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!o)continue;if(l=[...o].length,r[3]||r[4]){u+=l;continue}else if((r[5]||r[6])&&s%3&&!((s+l)%3)){f+=l;continue}if(u-=l,u>0)continue;l=Math.min(l,l+u+f);const m=[...r[0]][0].length,g=t.slice(0,s+r.index+m+l);if(Math.min(s,l)%2){const x=g.slice(1,-1);return{type:"em",raw:g,text:x,tokens:this.lexer.inlineTokens(x)}}const y=g.slice(2,-2);return{type:"strong",raw:g,text:y,tokens:this.lexer.inlineTokens(y)}}}}codespan(t){const e=this.rules.inline.code.exec(t);if(e){let n=e[2].replace(this.rules.other.newLineCharGlobal," ");const r=this.rules.other.nonSpaceChar.test(n),i=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&i&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:e[0],text:n}}}br(t){const e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t){const e=this.rules.inline.del.exec(t);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(t){const e=this.rules.inline.autolink.exec(t);if(e){let n,r;return e[2]==="@"?(n=e[1],r="mailto:"+n):(n=e[1],r=n),{type:"link",raw:e[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(t){let e;if(e=this.rules.inline.url.exec(t)){let n,r;if(e[2]==="@")n=e[0],r="mailto:"+n;else{let i;do i=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(i!==e[0]);n=e[0],e[1]==="www."?r="http://"+e[0]:r=e[0]}return{type:"link",raw:e[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(t){const e=this.rules.inline.text.exec(t);if(e){const n=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:n}}}},hs=class m0{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Ga,this.options.tokenizer=this.options.tokenizer||new wp,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const n={other:Kn,block:yh.normal,inline:Eu.normal};this.options.pedantic?(n.block=yh.pedantic,n.inline=Eu.pedantic):this.options.gfm&&(n.block=yh.gfm,this.options.breaks?n.inline=Eu.breaks:n.inline=Eu.gfm),this.tokenizer.rules=n}static get rules(){return{block:yh,inline:Eu}}static lex(e,n){return new m0(n).lex(e)}static lexInline(e,n){return new m0(n).inlineTokens(e)}lex(e){e=e.replace(Kn.carriageReturn,`
|
|
35
|
-
`),this.blockTokens(e,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){const r=this.inlineQueue[n];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,n=[],r=!1){for(this.options.pedantic&&(e=e.replace(Kn.tabCharGlobal," ").replace(Kn.spaceLine,""));e;){let i;if(this.options.extensions?.block?.some(o=>(i=o.call({lexer:this},e,n))?(e=e.substring(i.raw.length),n.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);const o=n.at(-1);i.raw.length===1&&o!==void 0?o.raw+=`
|
|
36
|
-
`:n.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);const o=n.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=`
|
|
37
|
-
`+i.raw,o.text+=`
|
|
38
|
-
`+i.text,this.inlineQueue.at(-1).src=o.text):n.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);const o=n.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=`
|
|
39
|
-
`+i.raw,o.text+=`
|
|
40
|
-
`+i.raw,this.inlineQueue.at(-1).src=o.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title});continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),n.push(i);continue}let s=e;if(this.options.extensions?.startBlock){let o=1/0;const l=e.slice(1);let u;this.options.extensions.startBlock.forEach(f=>{u=f.call({lexer:this},l),typeof u=="number"&&u>=0&&(o=Math.min(o,u))}),o<1/0&&o>=0&&(s=e.substring(0,o+1))}if(this.state.top&&(i=this.tokenizer.paragraph(s))){const o=n.at(-1);r&&o?.type==="paragraph"?(o.raw+=`
|
|
41
|
-
`+i.raw,o.text+=`
|
|
42
|
-
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):n.push(i),r=s.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);const o=n.at(-1);o?.type==="text"?(o.raw+=`
|
|
43
|
-
`+i.raw,o.text+=`
|
|
44
|
-
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):n.push(i);continue}if(e){const o="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(o);break}else throw new Error(o)}}return this.state.top=!0,n}inline(e,n=[]){return this.inlineQueue.push({src:e,tokens:n}),n}inlineTokens(e,n=[]){let r=e,i=null;if(this.tokens.links){const l=Object.keys(this.tokens.links);if(l.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)l.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,i.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(i=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)r=r.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let s=!1,o="";for(;e;){s||(o=""),s=!1;let l;if(this.options.extensions?.inline?.some(f=>(l=f.call({lexer:this},e,n))?(e=e.substring(l.raw.length),n.push(l),!0):!1))continue;if(l=this.tokenizer.escape(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.tag(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.link(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(l.raw.length);const f=n.at(-1);l.type==="text"&&f?.type==="text"?(f.raw+=l.raw,f.text+=l.text):n.push(l);continue}if(l=this.tokenizer.emStrong(e,r,o)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.codespan(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.br(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.del(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.autolink(e)){e=e.substring(l.raw.length),n.push(l);continue}if(!this.state.inLink&&(l=this.tokenizer.url(e))){e=e.substring(l.raw.length),n.push(l);continue}let u=e;if(this.options.extensions?.startInline){let f=1/0;const h=e.slice(1);let m;this.options.extensions.startInline.forEach(g=>{m=g.call({lexer:this},h),typeof m=="number"&&m>=0&&(f=Math.min(f,m))}),f<1/0&&f>=0&&(u=e.substring(0,f+1))}if(l=this.tokenizer.inlineText(u)){e=e.substring(l.raw.length),l.raw.slice(-1)!=="_"&&(o=l.raw.slice(-1)),s=!0;const f=n.at(-1);f?.type==="text"?(f.raw+=l.raw,f.text+=l.text):n.push(l);continue}if(e){const f="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(f);break}else throw new Error(f)}}return n}},gd=class{options;parser;constructor(t){this.options=t||Ga}space(t){return""}code({text:t,lang:e,escaped:n}){const r=(e||"").match(Kn.notSpaceStart)?.[0],i=t.replace(Kn.endingNewline,"")+`
|
|
45
|
-
`;return r?'<pre><code class="language-'+wi(r)+'">'+(n?i:wi(i,!0))+`</code></pre>
|
|
46
|
-
`:"<pre><code>"+(n?i:wi(i,!0))+`</code></pre>
|
|
47
|
-
`}blockquote({tokens:t}){return`<blockquote>
|
|
48
|
-
${this.parser.parse(t)}</blockquote>
|
|
49
|
-
`}html({text:t}){return t}heading({tokens:t,depth:e}){return`<h${e}>${this.parser.parseInline(t)}</h${e}>
|
|
50
|
-
`}hr(t){return`<hr>
|
|
51
|
-
`}list(t){const e=t.ordered,n=t.start;let r="";for(let o=0;o<t.items.length;o++){const l=t.items[o];r+=this.listitem(l)}const i=e?"ol":"ul",s=e&&n!==1?' start="'+n+'"':"";return"<"+i+s+`>
|
|
52
|
-
`+r+"</"+i+`>
|
|
53
|
-
`}listitem(t){let e="";if(t.task){const n=this.checkbox({checked:!!t.checked});t.loose?t.tokens[0]?.type==="paragraph"?(t.tokens[0].text=n+" "+t.tokens[0].text,t.tokens[0].tokens&&t.tokens[0].tokens.length>0&&t.tokens[0].tokens[0].type==="text"&&(t.tokens[0].tokens[0].text=n+" "+wi(t.tokens[0].tokens[0].text),t.tokens[0].tokens[0].escaped=!0)):t.tokens.unshift({type:"text",raw:n+" ",text:n+" ",escaped:!0}):e+=n+" "}return e+=this.parser.parse(t.tokens,!!t.loose),`<li>${e}</li>
|
|
54
|
-
`}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>
|
|
55
|
-
`}table(t){let e="",n="";for(let i=0;i<t.header.length;i++)n+=this.tablecell(t.header[i]);e+=this.tablerow({text:n});let r="";for(let i=0;i<t.rows.length;i++){const s=t.rows[i];n="";for(let o=0;o<s.length;o++)n+=this.tablecell(s[o]);r+=this.tablerow({text:n})}return r&&(r=`<tbody>${r}</tbody>`),`<table>
|
|
56
|
-
<thead>
|
|
57
|
-
`+e+`</thead>
|
|
58
|
-
`+r+`</table>
|
|
59
|
-
`}tablerow({text:t}){return`<tr>
|
|
60
|
-
${t}</tr>
|
|
61
|
-
`}tablecell(t){const e=this.parser.parseInline(t.tokens),n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>
|
|
62
|
-
`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${wi(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:n}){const r=this.parser.parseInline(n),i=zT(t);if(i===null)return r;t=i;let s='<a href="'+t+'"';return e&&(s+=' title="'+wi(e)+'"'),s+=">"+r+"</a>",s}image({href:t,title:e,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));const i=zT(t);if(i===null)return wi(n);t=i;let s=`<img src="${t}" alt="${n}"`;return e&&(s+=` title="${wi(e)}"`),s+=">",s}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:wi(t.text)}},dw=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}},ps=class g0{options;renderer;textRenderer;constructor(e){this.options=e||Ga,this.options.renderer=this.options.renderer||new gd,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new dw}static parse(e,n){return new g0(n).parse(e)}static parseInline(e,n){return new g0(n).parseInline(e)}parse(e,n=!0){let r="";for(let i=0;i<e.length;i++){const s=e[i];if(this.options.extensions?.renderers?.[s.type]){const l=s,u=this.options.extensions.renderers[l.type].call({parser:this},l);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(l.type)){r+=u||"";continue}}const o=s;switch(o.type){case"space":{r+=this.renderer.space(o);continue}case"hr":{r+=this.renderer.hr(o);continue}case"heading":{r+=this.renderer.heading(o);continue}case"code":{r+=this.renderer.code(o);continue}case"table":{r+=this.renderer.table(o);continue}case"blockquote":{r+=this.renderer.blockquote(o);continue}case"list":{r+=this.renderer.list(o);continue}case"html":{r+=this.renderer.html(o);continue}case"paragraph":{r+=this.renderer.paragraph(o);continue}case"text":{let l=o,u=this.renderer.text(l);for(;i+1<e.length&&e[i+1].type==="text";)l=e[++i],u+=`
|
|
63
|
-
`+this.renderer.text(l);n?r+=this.renderer.paragraph({type:"paragraph",raw:u,text:u,tokens:[{type:"text",raw:u,text:u,escaped:!0}]}):r+=u;continue}default:{const l='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return r}parseInline(e,n=this.renderer){let r="";for(let i=0;i<e.length;i++){const s=e[i];if(this.options.extensions?.renderers?.[s.type]){const l=this.options.extensions.renderers[s.type].call({parser:this},s);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(s.type)){r+=l||"";continue}}const o=s;switch(o.type){case"escape":{r+=n.text(o);break}case"html":{r+=n.html(o);break}case"link":{r+=n.link(o);break}case"image":{r+=n.image(o);break}case"strong":{r+=n.strong(o);break}case"em":{r+=n.em(o);break}case"codespan":{r+=n.codespan(o);break}case"br":{r+=n.br(o);break}case"del":{r+=n.del(o);break}case"text":{r+=n.text(o);break}default:{const l='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return r}},tp=class{options;block;constructor(t){this.options=t||Ga}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}provideLexer(){return this.block?hs.lex:hs.lexInline}provideParser(){return this.block?ps.parse:ps.parseInline}},wN=class{defaults=rw();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=ps;Renderer=gd;TextRenderer=dw;Lexer=hs;Tokenizer=wp;Hooks=tp;constructor(...t){this.use(...t)}walkTokens(t,e){let n=[];for(const r of t)switch(n=n.concat(e.call(this,r)),r.type){case"table":{const i=r;for(const s of i.header)n=n.concat(this.walkTokens(s.tokens,e));for(const s of i.rows)for(const o of s)n=n.concat(this.walkTokens(o.tokens,e));break}case"list":{const i=r;n=n.concat(this.walkTokens(i.items,e));break}default:{const i=r;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(s=>{const o=i[s].flat(1/0);n=n.concat(this.walkTokens(o,e))}):i.tokens&&(n=n.concat(this.walkTokens(i.tokens,e)))}}return n}use(...t){const e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(n=>{const r={...n};if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){const s=e.renderers[i.name];s?e.renderers[i.name]=function(...o){let l=i.renderer.apply(this,o);return l===!1&&(l=s.apply(this,o)),l}:e.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const s=e[i.level];s?s.unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),r.extensions=e),n.renderer){const i=this.defaults.renderer||new gd(this.defaults);for(const s in n.renderer){if(!(s in i))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;const o=s,l=n.renderer[o],u=i[o];i[o]=(...f)=>{let h=l.apply(i,f);return h===!1&&(h=u.apply(i,f)),h||""}}r.renderer=i}if(n.tokenizer){const i=this.defaults.tokenizer||new wp(this.defaults);for(const s in n.tokenizer){if(!(s in i))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;const o=s,l=n.tokenizer[o],u=i[o];i[o]=(...f)=>{let h=l.apply(i,f);return h===!1&&(h=u.apply(i,f)),h}}r.tokenizer=i}if(n.hooks){const i=this.defaults.hooks||new tp;for(const s in n.hooks){if(!(s in i))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;const o=s,l=n.hooks[o],u=i[o];tp.passThroughHooks.has(s)?i[o]=f=>{if(this.defaults.async)return Promise.resolve(l.call(i,f)).then(m=>u.call(i,m));const h=l.call(i,f);return u.call(i,h)}:i[o]=(...f)=>{let h=l.apply(i,f);return h===!1&&(h=u.apply(i,f)),h}}r.hooks=i}if(n.walkTokens){const i=this.defaults.walkTokens,s=n.walkTokens;r.walkTokens=function(o){let l=[];return l.push(s.call(this,o)),i&&(l=l.concat(i.call(this,o))),l}}this.defaults={...this.defaults,...r}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return hs.lex(t,e??this.defaults)}parser(t,e){return ps.parse(t,e??this.defaults)}parseMarkdown(t){return(n,r)=>{const i={...r},s={...this.defaults,...i},o=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&i.async===!1)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n>"u"||n===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));s.hooks&&(s.hooks.options=s,s.hooks.block=t);const l=s.hooks?s.hooks.provideLexer():t?hs.lex:hs.lexInline,u=s.hooks?s.hooks.provideParser():t?ps.parse:ps.parseInline;if(s.async)return Promise.resolve(s.hooks?s.hooks.preprocess(n):n).then(f=>l(f,s)).then(f=>s.hooks?s.hooks.processAllTokens(f):f).then(f=>s.walkTokens?Promise.all(this.walkTokens(f,s.walkTokens)).then(()=>f):f).then(f=>u(f,s)).then(f=>s.hooks?s.hooks.postprocess(f):f).catch(o);try{s.hooks&&(n=s.hooks.preprocess(n));let f=l(n,s);s.hooks&&(f=s.hooks.processAllTokens(f)),s.walkTokens&&this.walkTokens(f,s.walkTokens);let h=u(f,s);return s.hooks&&(h=s.hooks.postprocess(h)),h}catch(f){return o(f)}}}onError(t,e){return n=>{if(n.message+=`
|
|
64
|
-
Please report this to https://github.com/markedjs/marked.`,t){const r="<p>An error occurred:</p><pre>"+wi(n.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(n);throw n}}},Ma=new wN;function Ct(t,e){return Ma.parse(t,e)}Ct.options=Ct.setOptions=function(t){return Ma.setOptions(t),Ct.defaults=Ma.defaults,uN(Ct.defaults),Ct};Ct.getDefaults=rw;Ct.defaults=Ga;Ct.use=function(...t){return Ma.use(...t),Ct.defaults=Ma.defaults,uN(Ct.defaults),Ct};Ct.walkTokens=function(t,e){return Ma.walkTokens(t,e)};Ct.parseInline=Ma.parseInline;Ct.Parser=ps;Ct.parser=ps.parse;Ct.Renderer=gd;Ct.TextRenderer=dw;Ct.Lexer=hs;Ct.lexer=hs.lex;Ct.Tokenizer=wp;Ct.Hooks=tp;Ct.parse=Ct;Ct.options;Ct.setOptions;Ct.use;Ct.walkTokens;Ct.parseInline;ps.parse;hs.lex;function _u(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function VT(t){const e=t.trim();return e?e.startsWith("//")?`https:${e}`:/^(https?:|mailto:|\/|#)/i.test(e)?e:null:null}class XV extends gd{html(){return""}link({href:e,title:n,tokens:r}){const i=this.parser.parseInline(r),s=VT(e);if(!s)return i;const o=n?` title="${_u(n)}"`:"";return`<a href="${_u(s)}"${o} rel="noopener noreferrer">${i}</a>`}image({href:e,title:n,text:r}){const i=VT(e);if(!i)return"";const s=n?` title="${_u(n)}"`:"";return`<img src="${_u(i)}" alt="${_u(r)}"${s} loading="lazy" />`}}new wN({gfm:!0,breaks:!1,renderer:new XV});const JV="vertebr:theme";function QV(t){try{const e=localStorage.getItem(t);if(e==="light"||e==="dark")return e}catch{}return null}function eH(t,e){try{localStorage.setItem(t,e)}catch{}}function tH(t){document.documentElement.setAttribute("data-vb-theme",t)}function nH(t=JV){const[e,n]=A.useState(()=>QV(t)??"dark");A.useEffect(()=>{tH(e),eH(t,e)},[e,t]);const r=A.useCallback(s=>{n(s)},[]),i=A.useCallback(()=>{n(s=>s==="dark"?"light":"dark")},[]);return{theme:e,setTheme:r,toggleTheme:i}}const SN=[{id:"7d",label:"Last 7 days"},{id:"14d",label:"Last 14 days"},{id:"30d",label:"Last 30 days"},{id:"this_month",label:"This month"},{id:"last_month",label:"Last month"}],rH="14d",iH=new Set(SN.map(t=>t.id));function sH(t){return t&&iH.has(t)?t:rH}var Hd=t=>t.type==="checkbox",jm=t=>t.type==="file",mo=t=>t instanceof Date,Nn=t=>t==null;const fw=t=>typeof t=="object";var Vt=t=>!Nn(t)&&!Array.isArray(t)&&fw(t)&&!mo(t),y0=t=>Vt(t)&&t.target?Hd(t.target)?t.target.checked:jm(t.target)?t.target.files:t.target.value:t,kN=(t,e)=>e.split(".").some((n,r,i)=>!isNaN(Number(n))&&t.has(i.slice(0,r).join("."))),CN=t=>{const e=t.constructor&&t.constructor.prototype;return Vt(e)&&e.hasOwnProperty("isPrototypeOf")},Pm=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Bt(t){if(t instanceof Date)return new Date(t);const e=typeof FileList<"u"&&t instanceof FileList;if(Pm&&(t instanceof Blob||e))return t;const n=Array.isArray(t);if(!n&&!(Vt(t)&&CN(t)))return t;const r=n?[]:Object.create(Object.getPrototypeOf(t));for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=Bt(t[i]));return r}const ro={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},oi={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},ei={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},EN="root",hw=["__proto__","constructor","prototype"],oH=/^\w*$/;var Ud=t=>oH.test(t),Lt=t=>t===void 0;const aH=/[.[\]'"]/;var zm=t=>t.split(aH).filter(Boolean),we=(t,e,n)=>{if(!e||!Vt(t))return n;const r=Ud(e)?[e]:zm(e);if(r.some(s=>hw.includes(s)))return n;const i=r.reduce((s,o)=>Nn(s)?void 0:s[o],t);return Lt(i)||i===t?Lt(t[e])?n:t[e]:i},wr=t=>typeof t=="boolean",Vn=t=>typeof t=="function",mt=(t,e,n)=>{let r=-1;const i=Ud(e)?[e]:zm(e),s=i.length,o=s-1;for(;++r<s;){const l=i[r];let u=n;if(r!==o){const f=t[l];u=Vt(f)||Array.isArray(f)?f:isNaN(+i[r+1])?{}:[]}if(hw.includes(l))return;t[l]=u,t=t[l]}};const TN=Ve.createContext(null);TN.displayName="HookFormControlContext";const pw=()=>Ve.useContext(TN);var _N=(t,e,n,r=!0)=>{const i={};for(const s in t)Object.defineProperty(i,s,{get:()=>{const o=s;return e._proxyFormState[o]!==oi.all&&(e._proxyFormState[o]=!r||oi.all),n&&(n[o]=!0),t[o]}});return i};const mw=Pm?Ve.useLayoutEffect:Ve.useEffect;function lH(t){const e=pw(),{control:n=e,disabled:r,name:i,exact:s}=t||{},[o,l]=Ve.useState(()=>({...n._formState,defaultValues:n._defaultValues})),u=Ve.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return mw(()=>n._subscribe({name:i,formState:u.current,exact:s,callback:f=>{!r&&l({...n._formState,...f,defaultValues:n._defaultValues})}}),[i,r,s]),Ve.useEffect(()=>{u.current.isValid&&n._setValid(!0)},[n]),Ve.useMemo(()=>_N(o,n,u.current,!1),[o,n])}var On=t=>typeof t=="string",v0=(t,e,n,r,i)=>On(t)?(r&&e.watch.add(t),we(n,t,i)):Array.isArray(t)?t.map(s=>(r&&e.watch.add(s),we(n,s))):(r&&(e.watchAll=!0),n),b0=t=>Nn(t)||!fw(t);const HT=(t,e)=>e.length===0&&!Array.isArray(t)&&!CN(t);function Sr(t,e,n=new WeakMap){if(t===e)return!0;if(b0(t)||b0(e))return Object.is(t,e);if(mo(t)&&mo(e))return Object.is(t.getTime(),e.getTime());const r=Object.keys(t),i=Object.keys(e);if(r.length!==i.length)return!1;if(HT(t,r)||HT(e,i))return Object.is(t,e);if(!r.length&&Array.isArray(t)!==Array.isArray(e))return!1;const s=n.get(t);if(s&&s.has(e))return!0;if(s)s.add(e);else{const o=new WeakSet;o.add(e),n.set(t,o)}for(const o of r){const l=t[o];if(!(o in e))return!1;if(o!=="ref"){const u=e[o];if(mo(l)&&mo(u)||(Vt(l)||Array.isArray(l))&&(Vt(u)||Array.isArray(u))?!Sr(l,u,n):!Object.is(l,u))return!1}}return!0}function AN(t){const e=pw(),{control:n=e,name:r,defaultValue:i,disabled:s,exact:o,compute:l}=t||{},u=Ve.useRef(i),f=Ve.useRef(l),h=Ve.useRef(void 0),m=Ve.useRef(n),g=Ve.useRef(r);f.current=l;const[y,x]=Ve.useState(()=>{const R=n._getWatch(r,u.current);return f.current?f.current(R):R}),S=Ve.useCallback(R=>{const M=v0(r,n._names,R||n._formValues,!1,u.current);return f.current?f.current(M):M},[n._formValues,n._names,r]),k=Ve.useCallback(R=>{if(!s){const M=v0(r,n._names,R||n._formValues,!1,u.current);if(f.current){const O=f.current(M);Sr(O,h.current)||(x(O),h.current=O)}else x(M)}},[n._formValues,n._names,s,r]);mw(()=>((m.current!==n||!Sr(g.current,r))&&(m.current=n,g.current=r,k()),n._subscribe({name:r,formState:{values:!0},exact:o,callback:R=>{k(R.values)}})),[n,o,r,k]),Ve.useEffect(()=>n._removeUnmounted());const C=m.current!==n,T=g.current,_=Ve.useMemo(()=>{if(s)return null;const R=!C&&!Sr(T,r);return C||R?S():null},[s,C,r,T,S]);return _!==null?_:y}function cH(t){const e=pw(),{name:n,disabled:r,control:i=e,shouldUnregister:s,defaultValue:o,exact:l=!0}=t,u=kN(i._names.array,n),f=Ve.useMemo(()=>we(i._formValues,n,we(i._defaultValues,n,o)),[i,n,o]),h=AN({control:i,name:n,defaultValue:f,exact:l}),m=lH({control:i,name:n,exact:l}),g=Ve.useRef(t),y=Ve.useRef(null),x=Ve.useRef(i.register(n,{...t.rules,value:h,...wr(t.disabled)?{disabled:t.disabled}:{}}));g.current=t;const S=Ve.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!we(m.errors,n)},isDirty:{enumerable:!0,get:()=>!!we(m.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!we(m.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!we(m.validatingFields,n)},error:{enumerable:!0,get:()=>we(m.errors,n)}}),[m,n]),k=Ve.useCallback(R=>{const M=y0(R);return we(i._fields,n)||(x.current=i.register(n,{...g.current.rules,value:M})),x.current.onChange({target:{value:y0(R),name:n},type:ro.CHANGE})},[n,i]),C=Ve.useCallback(()=>x.current.onBlur({target:{value:we(i._formValues,n),name:n},type:ro.BLUR}),[n,i._formValues]),T=Ve.useCallback(R=>{R&&(y.current={focus:()=>Vn(R.focus)&&R.focus(),select:()=>Vn(R.select)&&R.select(),setCustomValidity:O=>Vn(R.setCustomValidity)&&R.setCustomValidity(O),reportValidity:()=>Vn(R.reportValidity)&&R.reportValidity()});const M=we(i._fields,n);M&&M._f&&R&&(M._f.ref=y.current)},[i._fields,n]),_=Ve.useMemo(()=>({name:n,value:h,...wr(r)||m.disabled?{disabled:m.disabled||r}:{},onChange:k,onBlur:C,ref:T}),[n,r,m.disabled,k,C,T,h]);return Ve.useEffect(()=>{const R=i._options.shouldUnregister||s;x.current=i.register(n,{...g.current.rules,...wr(g.current.disabled)?{disabled:g.current.disabled}:{}});const M=(O,L)=>{const P=we(i._fields,O);P&&P._f&&(P._f.mount=L)};if(M(n,!0),R){const O=Bt(we(s?i._defaultValues:i._options.values||i._defaultValues,n,we(i._options.defaultValues,n,g.current.defaultValue)));mt(i._defaultValues,n,O),Lt(we(i._formValues,n))&&mt(i._formValues,n,O)}if(!u&&i.register(n),y.current){const O=we(i._fields,n);O&&O._f&&(O._f.ref=y.current)}return()=>{(u?R&&!i._state.action:R)?i.unregister(n):M(n,!1)}},[n,i,u,s]),Ve.useEffect(()=>{i._setDisabledField({disabled:r,name:n})},[r,n,i]),Ve.useMemo(()=>({field:_,formState:m,fieldState:S}),[_,m,S])}const ua=t=>t.render(cH(t));var vh=t=>({isOnSubmit:!t||t===oi.onSubmit,isOnBlur:t===oi.onBlur,isOnChange:t===oi.onChange,isOnAll:t===oi.all,isOnTouch:t===oi.onTouched}),Jv=(t,e,n)=>{if(n)return!1;if(e.watchAll||e.watch.has(t))return!0;for(const r of e.watch)if(t.startsWith(r)&&t.charAt(r.length)===".")return!0;return!1};const Zu=(t,e,n,r)=>{for(const i of n||Object.keys(t)){if(i==="_f")continue;const s=n?we(t,i):t[i];if(s){const{_f:o}=s;if(o){if(o.refs&&o.refs[0]&&e(o.refs[0],i)&&!r)return!0;if(o.ref&&e(o.ref,o.name)&&!r)return!0;if(Zu(s,e))break}else if((Vt(s)||Array.isArray(s))&&Zu(s,e))break}}};var UT=(t,e,n)=>{const r=we(t,n),i=Array.isArray(r)?r:[];return mt(i,EN,e[n]),mt(t,n,i),t},Rn=t=>Vt(t)&&!Object.keys(t).length,Sp=t=>{if(!Pm)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},gw=t=>t.type==="radio",kp=t=>t instanceof RegExp,yw=(t,e,n,r,i)=>e?{...n[t],types:{...n[t]&&n[t].types?n[t].types:{},[r]:i||!0}}:{};const FT={value:!1,isValid:!1},qT={value:!0,isValid:!0};var RN=t=>{if(Array.isArray(t)){if(t.length>1){const e=t.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:e,isValid:!!e.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!Lt(t[0].attributes.value)?Lt(t[0].value)||t[0].value===""?qT:{value:t[0].value,isValid:!0}:qT:FT}return FT};const GT={isValid:!1,value:null};var MN=t=>Array.isArray(t)?t.reduce((e,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:e,GT):GT;function WT(t,e,n="validate"){if(On(t)||Array.isArray(t)&&t.every(On)||wr(t)&&!t)return{type:n,message:On(t)?t:"",ref:e}}var Pl=t=>Vt(t)&&!kp(t)?t:{value:t,message:""},KT=async(t,e,n,r,i,s)=>{const{ref:o,refs:l,required:u,maxLength:f,minLength:h,min:m,max:g,pattern:y,validate:x,name:S,valueAsNumber:k,mount:C}=t._f,T=we(n,S);if(!C||e.has(S))return{};const _=l?l[0]:o,R=K=>{if(i&&_.reportValidity){const ne=wr(K)?"":K||"";l?l.forEach(re=>re.setCustomValidity(ne)):_.setCustomValidity(ne),_.reportValidity()}},M={},O=gw(o),L=Hd(o),P=O||L,U=(k||jm(o))&&Lt(o.value)&&Lt(T)||Sp(o)&&o.value===""||T===""||Array.isArray(T)&&!T.length,G=yw.bind(null,S,r,M),oe=(K,ne,re,me=ei.maxLength,B=ei.minLength)=>{const z=K?ne:re;M[S]={type:K?me:B,message:z,ref:o,...G(K?me:B,z)}};if(s?!Array.isArray(T)||!T.length:u&&(!P&&(U||Nn(T))||wr(T)&&!T||L&&!RN(l).isValid||O&&!MN(l).isValid)){const{value:K,message:ne}=On(u)?{value:!!u,message:u}:Pl(u);if(K&&(M[S]={type:ei.required,message:ne,ref:_,...G(ei.required,ne)},!r))return R(ne),M}if(!U&&(!Nn(m)||!Nn(g))){let K,ne;const re=Pl(g),me=Pl(m);if(!Nn(T)&&!isNaN(T)){const B=o.valueAsNumber||T&&+T;Nn(re.value)||(K=B>re.value),Nn(me.value)||(ne=B<me.value)}else{const B=o.valueAsDate||new Date(T),z=ve=>new Date(new Date().toDateString()+" "+ve),q=o.type=="time",de=o.type=="week";On(re.value)&&T&&(K=q?z(T)>z(re.value):de?T>re.value:B>new Date(re.value)),On(me.value)&&T&&(ne=q?z(T)<z(me.value):de?T<me.value:B<new Date(me.value))}if((K||ne)&&(oe(!!K,re.message,me.message,ei.max,ei.min),!r))return R(M[S].message),M}if((f||h)&&!U&&(On(T)||s&&Array.isArray(T))){const K=Pl(f),ne=Pl(h),re=!Nn(K.value)&&T.length>+K.value,me=!Nn(ne.value)&&T.length<+ne.value;if((re||me)&&(oe(re,K.message,ne.message),!r))return R(M[S].message),M}if(y&&!U&&On(T)){const{value:K,message:ne}=Pl(y);if(kp(K)&&!T.match(K)&&(M[S]={type:ei.pattern,message:ne,ref:o,...G(ei.pattern,ne)},!r))return R(ne),M}if(x){if(Vn(x)){const K=await x(T,n),ne=WT(K,_);if(ne&&(M[S]={...ne,...G(ei.validate,ne.message)},!r))return R(ne.message),M}else if(Vt(x)){let K={};for(const ne in x){if(!Rn(K)&&!r)break;const re=WT(await x[ne](T,n),_,ne);re&&(K={...re,...G(ne,re.message)},R(re.message),r&&(M[S]=K))}if(!Rn(K)&&(M[S]={ref:_,...K},!r))return M}}return R(!0),M},np=t=>Array.isArray(t)?t:[t],NN=t=>Array.isArray(t)?t.filter(Boolean):[];function uH(t,e){const n=e.length-1;let r=0;for(;r<n;){if(Nn(t)){t=void 0;break}t=t[e[r]],r++}return t}function dH(t){for(const e in t)if(t.hasOwnProperty(e)&&!Lt(t[e]))return!1;return!0}function Yt(t,e){if(On(e)&&Object.prototype.hasOwnProperty.call(t,e))return delete t[e],t;const n=Array.isArray(e)?e:Ud(e)?[e]:zm(e);if(n.some(o=>hw.includes(String(o))))return t;const r=n.length===1?t:uH(t,n),i=n.length-1,s=n[i];return r&&delete r[s],i!==0&&(Vt(r)&&Rn(r)||Array.isArray(r)&&dH(r))&&Yt(t,n.slice(0,-1)),t}const ON=t=>{const e={};for(const n of Object.keys(t))if(fw(t[n])&&t[n]!==null&&!mo(t[n])){const r=ON(t[n]);for(const i of Object.keys(r))e[`${n}.${i}`]=r[i]}else e[n]=t[n];return e},fH=Ve.createContext(null);fH.displayName="HookFormContext";var ZT=()=>{let t=[];return{get observers(){return t},next:i=>{for(const s of t)s.next&&s.next(i)},subscribe:i=>(t.push(i),{unsubscribe:()=>{t=t.filter(s=>s!==i)}}),unsubscribe:()=>{t=[]}}};function DN(t,e){const n={};for(const r in t)if(t.hasOwnProperty(r)){const i=t[r],s=e[r];if(i&&Vt(i)&&s){const o=DN(i,s);Vt(o)&&(n[r]=o)}else t[r]&&(n[r]=s)}return n}var IN=t=>t.type==="select-multiple",hH=t=>gw(t)||Hd(t),Qv=t=>Sp(t)&&t.isConnected;function YT(t){return Array.isArray(t)||Vt(t)}function LN(t,e,n="",r=[]){for(const i in t){const s=n?`${n}.${i}`:i,o=t[i];YT(o)&&YT(we(e,s))?LN(o,e,s,r):r.push(s)}return r}var pH=t=>{for(const e in t)if(Vn(t[e]))return!0;return!1};function jN(t){return Array.isArray(t)||Vt(t)&&!pH(t)}function PN(t){return!!(t&&"_f"in t)}function zN(t){return Array.isArray(t)?!t.some(e=>!Lt(e)):!Object.keys(t).length}function x0(t,e){Array.isArray(t)?t[e]=void 0:delete t[e]}function w0(t,e={},n){for(const r in t){const i=t[r],s=n&&n[r];jN(i)&&(!Array.isArray(i)||!PN(s))?(e[r]=Array.isArray(i)?[]:{},w0(i,e[r],s),zN(e[r])&&x0(e,r)):Lt(i)||(e[r]=!0)}return e}function pa(t,e,n,r){n||(n=w0(e,{},r));for(const i in t){const s=t[i],o=r&&r[i];jN(s)&&(!Array.isArray(s)||!PN(o))?(Lt(e)||b0(n[i])?n[i]=w0(s,Array.isArray(s)?[]:{},o):pa(s,Nn(e)?{}:e[i],n[i],o),zN(n[i])&&x0(n,i)):Sr(s,e[i])?x0(n,i):n[i]=!0}return n}var $N=(t,{valueAsNumber:e,valueAsDate:n,setValueAs:r})=>Lt(t)?t:e?t===""?NaN:t&&+t:n&&On(t)?new Date(t):r?r(t):t;function XT(t){const e=t.ref;return jm(e)?e.files:gw(e)?MN(t.refs).value:IN(e)?[...e.selectedOptions].map(({value:n})=>n):Hd(e)?RN(t.refs).value:$N(e.value,t)}var mH=(t,e,n,r)=>{const i={};for(const s of t){const o=we(e,s);o&&mt(i,s,o._f)}return{criteriaMode:n,names:[...t],fields:i,shouldUseNativeValidation:r}},Au=t=>Lt(t)?t:kp(t)?t.source:Vt(t)?kp(t.value)?t.value.source:t.value:t;const JT="AsyncFunction";var gH=t=>{if(!t||!t.validate)return!1;if(Vn(t.validate))return t.validate.constructor.name===JT;if(Vt(t.validate)){for(const e in t.validate)if(t.validate[e].constructor.name===JT)return!0}return!1},yH=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate);function QT(t,e,n){const r=we(t,n);if(r||Ud(n))return{error:r,name:n};const i=n.split(".");for(;i.length;){const s=i.join("."),o=we(e,s),l=we(t,s);if(o&&!Array.isArray(o)&&n!==s)return{name:n};if(l&&l.type)return{name:s,error:l};if(l&&l.root&&l.root.type)return{name:`${s}.root`,error:l.root};i.pop()}return{name:n}}var vH=(t,e,n,r)=>{n(t);const i=Object.keys(t).filter(s=>s!=="name");return!i.length||r&&i.length>=Object.keys(e).length||i.find(s=>e[s]===(!r||oi.all))},bH=(t,e,n)=>!t||!e||t===e||np(t).some(r=>r&&(n?r===e||r.startsWith(e+"."):r.startsWith(e)||e.startsWith(r))),xH=(t,e,n,r,i)=>i.isOnAll?!1:!n&&i.isOnTouch?!(e||t):(n?r.isOnBlur:i.isOnBlur)?!t:(n?r.isOnChange:i.isOnChange)?t:!0,wH=(t,e)=>!NN(we(t,e)).length&&Yt(t,e);const SH={mode:oi.onSubmit,reValidateMode:oi.onChange,shouldFocusError:!0},eb="form",kH=(t,e)=>{for(const n in t)n in e||delete t[n];Object.assign(t,e)},BN={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function CH(t={}){let e={...SH,...t},n={...Bt(BN),isLoading:Vn(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1},r={},i=Vt(e.defaultValues)||Vt(e.values)?Bt(e.defaultValues||e.values)||{}:{},s=e.shouldUnregister?{}:Bt(i),o={action:!1,mount:!1,watch:!1,keepIsValid:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set};const u={},f={};let h=0,m=vh(e.mode),g=vh(e.reValidateMode);const y={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},x={...y};let S={...x};const k={array:ZT(),state:ZT()};let C=0;const T=e.criteriaMode===oi.all,_=(I,D)=>j=>{clearTimeout(f[I]),f[I]=setTimeout(D,j)},R=async I=>{if(!o.keepIsValid&&!e.disabled&&(x.isValid||S.isValid||I)){const D=++C;let j;e.resolver?(j=Rn((await re()).errors),D===C&&M()):j=await z({fields:r,onlyCheckValid:!0,eventType:ro.VALID}),D===C&&j!==n.isValid&&k.state.next({isValid:j})}},M=(I,D)=>{!e.disabled&&(x.isValidating||x.validatingFields||S.isValidating||S.validatingFields)&&((I||Array.from(l.mount)).forEach(j=>{j&&(D?mt(n.validatingFields,j,D):Yt(n.validatingFields,j))}),k.state.next({validatingFields:n.validatingFields,isValidating:!Rn(n.validatingFields)}))},O=()=>{n.dirtyFields=pa(i,s,void 0,r)},L=(I,D=[],j,W,Q=!0,he=!0)=>{if(W&&j&&!e.disabled){if(o.action=!0,he&&Array.isArray(we(r,I))){const be=j(we(r,I),W.argA,W.argB);Q&&mt(r,I,be)}if(he&&Array.isArray(we(n.errors,I))){const be=j(we(n.errors,I),W.argA,W.argB);Q&&mt(n.errors,I,be),wH(n.errors,I)}if((x.touchedFields||S.touchedFields)&&he&&Array.isArray(we(n.touchedFields,I))){const be=j(we(n.touchedFields,I),W.argA,W.argB);Q&&mt(n.touchedFields,I,be)}(x.dirtyFields||S.dirtyFields)&&O(),k.state.next({name:I,isDirty:de(I,D),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else mt(s,I,D)},P=(I,D)=>{mt(n.errors,I,D),n.errors={...n.errors},k.state.next({errors:n.errors})},U=I=>{n.errors=I,k.state.next({errors:n.errors,isValid:!1})},G=I=>{const D=Ud(I)?[I]:zm(I);let j=s,W=i;for(let Q=0;Q<D.length-1;Q++){const he=D[Q];if(j=Nn(j)?j:j[he],W=Nn(W)?W:W[he],j===null&&W!==null)return!0}return!1},oe=(I,D,j,W)=>{const Q=we(r,I);if(Q){if(G(I))return;const he=Lt(we(s,I)),be=we(s,I,Lt(j)?we(i,I):j);Lt(be)||W&&W.defaultChecked||D?mt(s,I,D?be:XT(Q._f)):X(I,be),o.mount&&!o.action&&(R(),he&&n.isDirty&&(x.isDirty||S.isDirty)&&(de()||(n.isDirty=!1,k.state.next({...n}))),t.shouldUnregister&&he&&!Lt(we(s,I))&&Jv(I,l)&&(o.watch=!0))}},K=(I,D,j,W,Q)=>{let he=!1,be=!1;const Ce={name:I};if(!e.disabled||W===!0){if(!j||W){const $e=Sr(we(i,I),D);(x.isDirty||S.isDirty)&&(be=n.isDirty,n.isDirty=Ce.isDirty=!$e||de(),he=be!==Ce.isDirty),be=!!we(n.dirtyFields,I),$e!==n.isDirty?kH(n.dirtyFields,pa(i,s,void 0,r)):$e?Yt(n.dirtyFields,I):mt(n.dirtyFields,I,!0),Ce.dirtyFields=n.dirtyFields,he=he||(x.dirtyFields||S.dirtyFields)&&be!==!$e}if(j){const $e=we(n.touchedFields,I);$e||(mt(n.touchedFields,I,j),Ce.touchedFields=n.touchedFields,he=he||(x.touchedFields||S.touchedFields)&&$e!==j)}he&&Q&&k.state.next(Ce)}return he?Ce:{}},ne=(I,D,j,W)=>{const Q=we(n.errors,I),he=(x.isValid||S.isValid)&&wr(D)&&n.isValid!==D;if(e.delayError&&j?(u[I]=_(I,()=>P(I,j)),u[I](e.delayError)):(clearTimeout(f[I]),delete u[I],j?mt(n.errors,I,j):Yt(n.errors,I),n.errors={...n.errors}),(j?!Sr(Q,j):Q)||!Rn(W)||he){const be={...W,...he&&wr(D)?{isValid:D}:{},errors:n.errors,name:I};n={...n,...be},k.state.next(be)}},re=async I=>(M(I,!0),await e.resolver(s,e.context,mH(I||l.mount,r,e.criteriaMode,e.shouldUseNativeValidation))),me=async I=>{const{errors:D}=await re(I);if(M(I),I){for(const j of I){const W=we(D,j);W?l.array.has(j)&&Vt(W)&&!Object.keys(W).some(Q=>!Number.isNaN(Number(Q)))?UT(n.errors,{[j]:W},j):mt(n.errors,j,W):Yt(n.errors,j)}n.errors={...n.errors}}else n.errors=D;return D},B=async({name:I,eventType:D})=>{if(t.validate){const j=await t.validate({formValues:s,formState:n,name:I,eventType:D});if(Vt(j))for(const W in j){const Q=j[W];Q&&Fe(`${eb}.${W}`,{message:On(Q.message)?Q.message:"",type:Q.type||ei.validate})}else On(j)||!j?Fe(eb,{message:j||"",type:ei.validate}):ze(eb);return j}return!0},z=async({fields:I,onlyCheckValid:D,name:j,eventType:W,context:Q={valid:!0,runRootValidation:!1}})=>{if(t.validate&&(Q.runRootValidation=!0,!await B({name:j,eventType:W})&&(Q.valid=!1,D)))return Q.valid;for(const he in I){const be=I[he];if(be){const{_f:Ce,...$e}=be;if(Ce){const ot=l.array.has(Ce.name),$t=be._f&&gH(be._f),nr=x.validatingFields||x.isValidating||S.validatingFields||S.isValidating;$t&&nr&&M([Ce.name],!0);const kn=await KT(be,l.disabled,s,T,e.shouldUseNativeValidation&&!D,ot);if($t&&nr&&M([Ce.name]),kn[Ce.name]&&(Q.valid=!1,D)||(!D&&(we(kn,Ce.name)?ot?UT(n.errors,kn,Ce.name):mt(n.errors,Ce.name,kn[Ce.name]):Yt(n.errors,Ce.name)),t.shouldUseNativeValidation&&kn[Ce.name]))break}!Rn($e)&&await z({context:Q,onlyCheckValid:D,fields:$e,name:he,eventType:W})}}return Q.valid},q=()=>{for(const I of l.unMount){const D=we(r,I);D&&(D._f.refs?D._f.refs.every(j=>!Qv(j)):!Qv(D._f.ref))&&jn(I)}l.unMount=new Set},de=(I,D)=>(I&&D&&mt(s,I,D),!Sr(o.mount?s:i,i)),ve=(I,D,j)=>v0(I,l,{...o.mount?s:Lt(D)?i:On(I)?{[I]:D}:D},j,D),V=I=>NN(we(o.mount?s:i,I,e.shouldUnregister?we(i,I,[]):[])),X=(I,D,j={},W=!1,Q=!1)=>{const he=we(r,I);let be=D;if(he){const Ce=he._f;Ce&&(!Ce.disabled&&mt(s,I,$N(D,Ce)),be=Sp(Ce.ref)&&Nn(D)?"":D,IN(Ce.ref)?[...Ce.ref.options].forEach($e=>$e.selected=be.includes($e.value)):Ce.refs?Hd(Ce.ref)?Ce.refs.forEach($e=>{(!$e.defaultChecked||!$e.disabled)&&(Array.isArray(be)?$e.checked=!!be.find(ot=>ot===$e.value):$e.checked=be===$e.value||!!be)}):Ce.refs.forEach($e=>$e.checked=$e.value===be):jm(Ce.ref)?Ce.ref.value="":(Ce.ref.value=be,!Ce.ref.type&&!Q&&k.state.next({name:I,values:W?s:Bt(s)})))}(j.shouldDirty||j.shouldTouch)&&K(I,be,j.shouldTouch,j.shouldDirty,!Q),j.shouldValidate&&se(I,{delayError:j.delayError})},fe=(I,D,j,W=!1,Q=!1)=>{l.array.has(I)&&k.array.next({name:I,values:W?s:Bt(s)});for(const he in D){if(!D.hasOwnProperty(he))return;const be=D[he],Ce=I+"."+he,$e=we(r,Ce);(l.array.has(I)||Vt(be)||$e&&!$e._f)&&!mo(be)?fe(Ce,be,j,W,Q):X(Ce,be,j,W,Q)}},ge=(I,D,j,W,Q=!1)=>{const he=we(r,I),be=l.array.has(I),Ce=W?D:Bt(D),$e=we(s,I),ot=Sr($e,Ce);if(ot||mt(s,I,Ce),be)k.array.next({name:I,values:W?s:Bt(s)}),(x.isDirty||x.dirtyFields||S.isDirty||S.dirtyFields)&&j.shouldDirty&&(O(),Q||k.state.next({name:I,dirtyFields:n.dirtyFields,isDirty:de(I,Ce)}));else{const $t=Array.isArray(Ce)&&!Ce.length||Rn(Ce);!he||he._f||Nn(Ce)||$t?X(I,Ce,j,W,Q):fe(I,Ce,j,W,Q)}if(!ot&&!Q){const $t=Jv(I,l),nr=W?s:Bt(s);k.state.next({...$t&&n,name:o.mount||$t?I:void 0,values:nr})}},Te=(I,D,j={})=>ge(I,D,j,!1),_e=(I,D={})=>{const j=Vn(I)?I(s):I;if(!Sr(s,j)){s={...s,...j};const W=ON(j);for(const Q of l.mount)Q in W&&ge(Q,W[Q],D,!0,!0);k.state.next({...n,name:void 0,type:void 0,...h?{values:s}:{}}),D.shouldValidate&&R()}},Le=async I=>{o.mount=!0;const D=I.target;let j=D.name,W=!0;const Q=we(r,j),he=be=>{W=Number.isNaN(be)||mo(be)&&isNaN(be.getTime())||Sr(be,we(s,j,be))};if(Q){let be,Ce;const $e=D.type?XT(Q._f):y0(I),ot=I.type===ro.BLUR||I.type===ro.FOCUS_OUT,$t=!yH(Q._f)&&!t.validate&&!e.resolver&&!we(n.errors,j)&&!Q._f.deps,nr=$t||xH(ot,we(n.touchedFields,j),n.isSubmitted,g,m),kn=Jv(j,l,ot);if(mt(s,j,$e),ot){if(!D||!D.readOnly){Q._f.onBlur&&Q._f.onBlur(I);const Go=u[j];Go&&Go(0)}}else Q._f.onChange&&Q._f.onChange(I);const gi=K(j,$e,ot),qo=!Rn(gi)||kn;if(!ot&&k.state.next({name:j,type:I.type,...h?{values:Bt(s)}:{}}),nr)return(!$t||!n.isValid)&&(x.isValid||S.isValid)&&(e.mode==="onBlur"?ot&&R():ot||R()),qo&&k.state.next({name:j,...kn?{}:gi});if(!e.resolver&&t.validate&&await B({name:j,eventType:I.type}),!ot&&kn&&k.state.next({...n}),e.resolver){const{errors:Go}=await re([j]);if(M([j]),he($e),!W){!Rn(gi)&&k.state.next(gi);return}const tf=QT(n.errors,r,j),Ja=QT(Go,r,tf.name||j);be=Ja.error,j=Ja.name,Ce=Rn(Go)}else M([j],!0),be=(await KT(Q,l.disabled,s,T,e.shouldUseNativeValidation))[j],M([j]),he($e),W&&(be?Ce=!1:(x.isValid||S.isValid)&&(Ce=await z({fields:r,onlyCheckValid:!0,name:j,eventType:I.type})));W&&(Q._f.deps&&(!Array.isArray(Q._f.deps)||Q._f.deps.length>0)&&se(Q._f.deps),ne(j,Ce,be,gi))}},ke=(I,D)=>{if(we(n.errors,D)&&I.focus)return I.focus(),1},se=async(I,D={})=>{let j,W;const Q=np(I);if(e.resolver){const he=await me(Lt(I)?I:Q);j=Rn(he),W=I?!Q.some(be=>we(he,be)):j}else I?(W=(await Promise.all(Q.map(async he=>{const be=we(r,he);return await z({fields:be&&be._f?{[he]:be}:be,eventType:ro.TRIGGER})}))).every(Boolean),!(!W&&!n.isValid)&&R()):W=j=await z({fields:r,name:I,eventType:ro.TRIGGER});if(D.delayError&&e.delayError&&On(I)){const he=we(n.errors,I);he?(Yt(n.errors,I),u[I]=_(I,()=>P(I,he)),u[I](e.delayError)):(clearTimeout(f[I]),delete u[I])}return k.state.next({...!On(I)||(x.isValid||S.isValid)&&j!==n.isValid?{}:{name:I},...e.resolver||!I?{isValid:j}:{},errors:n.errors}),D.shouldFocus&&!W&&Zu(r,ke,I?Q:l.mount),W},pe=(I,D)=>{let j={...o.mount?s:i};return D&&(j=DN(D.dirtyFields?n.dirtyFields:n.touchedFields,j)),Lt(I)?j:On(I)?we(j,I):I.map(W=>we(j,W))},Me=(I,D)=>({invalid:!!we((D||n).errors,I),isDirty:!!we((D||n).dirtyFields,I),error:we((D||n).errors,I),isValidating:!!we(n.validatingFields,I),isTouched:!!we((D||n).touchedFields,I)}),ze=I=>{const D=I?np(I):void 0;D?.forEach(j=>Yt(n.errors,j)),D?D.forEach(j=>{k.state.next({name:j,errors:n.errors})}):(n.errors={},k.state.next({errors:n.errors}))},Fe=(I,D,j)=>{const W=(we(r,I,{_f:{}})._f||{}).ref,Q=we(n.errors,I)||{},{ref:he,message:be,type:Ce,...$e}=Q;mt(n.errors,I,{...$e,...D,ref:W}),k.state.next({name:I,errors:n.errors,isValid:!1}),j&&j.shouldFocus&&W&&W.focus&&W.focus()},ft=(I,D)=>{if(Vn(I)){h++;const{unsubscribe:j}=k.state.subscribe({next:Q=>"values"in Q&&I(Q.values||ve(void 0,D),Q)});let W=!1;return{unsubscribe:()=>{W||(W=!0,h--,j())}}}return ve(I,D,!0)},ht=I=>{var D;const j=!!(!((D=I.formState)===null||D===void 0)&&D.values);j&&h++;const{unsubscribe:W}=k.state.subscribe({next:he=>{if(bH(I.name,he.name,I.exact)&&vH(he,I.formState||x,Yr,I.reRenderRoot)){const be={...s};I.callback({values:be,...n,...he,defaultValues:i})}}});if(!j)return W;let Q=!1;return()=>{Q||(Q=!0,h--,W())}},Jt=I=>(o.mount=!0,S={...S,...I.formState},ht({...I,formState:{...y,...I.formState}})),jn=(I,D={})=>{for(const j of I?np(I):l.mount)l.mount.delete(j),l.array.delete(j),D.keepValue||(Yt(r,j),Yt(s,j)),!D.keepError&&Yt(n.errors,j),!D.keepDirty&&Yt(n.dirtyFields,j),!D.keepTouched&&Yt(n.touchedFields,j),!D.keepIsValidating&&Yt(n.validatingFields,j),!e.shouldUnregister&&!D.keepDefaultValue&&Yt(i,j);k.state.next({values:Bt(s)}),k.state.next({...n,...D.keepDirty?{isDirty:de()}:{}}),!D.keepIsValid&&R()},un=({disabled:I,name:D})=>{if(wr(I)&&o.mount||I||l.disabled.has(D)){const Q=l.disabled.has(D)!==!!I;I?l.disabled.add(D):l.disabled.delete(D),Q&&o.mount&&!o.action&&R()}},Sn=(I,D={})=>{let j=we(r,I);const W=wr(D.disabled)||wr(e.disabled),Q=!l.registerName.has(I)&&j&&j._f&&!j._f.mount;return mt(r,I,{...j||{},_f:{...j&&j._f?j._f:{ref:{name:I}},name:I,mount:!0,...D}}),l.mount.add(I),j&&!Q?un({disabled:wr(D.disabled)?D.disabled:e.disabled,name:I}):oe(I,!0,D.value),{...W?{disabled:D.disabled||e.disabled}:{},...e.progressive?{required:!!D.required,min:Au(D.min),max:Au(D.max),minLength:Au(D.minLength),maxLength:Au(D.maxLength),pattern:Au(D.pattern)}:{},name:I,onChange:Le,onBlur:Le,ref:he=>{if(he){l.registerName.add(I),Sn(I,D),l.registerName.delete(I),j=we(r,I);const be=Lt(he.value)&&he.querySelectorAll&&he.querySelectorAll("input,select,textarea")[0]||he,Ce=hH(be),$e=j._f.refs||[];if(Ce?$e.find($t=>$t===be):be===j._f.ref)return;const ot={...j._f};Ce?(ot.refs=[...$e.filter(Qv),be,...Array.isArray(we(i,I))?[{}]:[]],ot.ref={type:be.type,name:I}):(ot.ref=be,delete ot.refs),mt(r,I,{_f:ot}),oe(I,!1,void 0,be)}else j=we(r,I,{}),j._f&&(j._f.mount=!1),(e.shouldUnregister||D.shouldUnregister)&&!(kN(l.array,I)&&o.action)&&l.unMount.add(I)}}},dn=()=>e.shouldFocusError&&!e.shouldUseNativeValidation&&Zu(r,ke,l.mount),tr=I=>{wr(I)&&(k.state.next({disabled:I}),Zu(r,(D,j)=>{const W=we(r,j);W&&(D.disabled=W._f.disabled||I,Array.isArray(W._f.refs)&&W._f.refs.forEach(Q=>{Q.disabled=W._f.disabled||I}))},0,!1))},Kr=(I,D)=>async j=>{let W,Q;j&&(j.preventDefault&&j.preventDefault(),j.persist&&j.persist());let he=Bt(s);if(k.state.next({isSubmitting:!0}),e.resolver){const{errors:be,values:Ce}=await re();M(),n.errors=be,he=Bt(Ce)}else await z({fields:r,eventType:ro.SUBMIT});if(l.disabled.size)for(const be of l.disabled)Yt(he,be);if(Yt(n.errors,EN),Rn(n.errors)){k.state.next({errors:{}});try{W=await I(he,j)}catch(be){Q=be}}else D&&await D({...n.errors},j),dn(),setTimeout(dn);if(k.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Rn(n.errors)&&!Q,submitCount:n.submitCount+1,errors:n.errors}),Q)throw Q;return W},Ar=(I,D={})=>{we(r,I)&&(Lt(D.defaultValue)?Te(I,Bt(we(i,I))):(Te(I,D.defaultValue),mt(i,I,Bt(D.defaultValue))),D.keepTouched||Yt(n.touchedFields,I),D.keepDirty||(Yt(n.dirtyFields,I),n.isDirty=D.defaultValue?de(I,Bt(we(i,I))):de()),D.keepError||(Yt(n.errors,I),x.isValid&&R()),k.state.next({...n}))},zt=(I,D={})=>{const j=I?Bt(I):i,W=Bt(j),Q=Rn(I),he=W,be=r;if(D.keepDefaultValues||(i=j),!D.keepValues){if(D.keepDirtyValues){const Ce=new Set([...l.mount,...LN(pa(i,s,void 0,be),n.dirtyFields)]);for(const $e of Array.from(Ce)){const ot=we(n.dirtyFields,$e),$t=we(s,$e),nr=we(he,$e);ot&&!Lt($t)?mt(he,$e,$t):!ot&&!Lt(nr)&&Te($e,nr)}}else{if(Pm&&Lt(I))for(const Ce of l.mount){const $e=we(r,Ce);if($e&&$e._f){const ot=Array.isArray($e._f.refs)?$e._f.refs[0]:$e._f.ref;if(Sp(ot)){const $t=ot.closest("form");if($t){$t.reset();break}}}}if(D.keepFieldsRef)for(const Ce of l.mount)Te(Ce,we(he,Ce));else r={}}if(e.shouldUnregister){if(s=D.keepDefaultValues?Bt(i):{},D.keepFieldsRef)for(const Ce of l.mount)mt(s,Ce,we(he,Ce))}else s=Bt(he);k.array.next({values:{...he}}),k.state.next({name:void 0,type:void 0,values:{...he}})}l={mount:D.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!x.isValid||!!D.keepIsValid||!!D.keepDirtyValues||!e.shouldUnregister&&!Rn(he),o.watch=!!e.shouldUnregister,o.keepIsValid=!!D.keepIsValid,o.action=!1,D.keepErrors||(n.errors={}),k.state.next({submitCount:D.keepSubmitCount?n.submitCount:0,isDirty:Q?!1:D.keepDirty?n.isDirty:D.keepValues?de():!!(D.keepDefaultValues&&!Sr(I,i)),isSubmitted:D.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:Q?{}:D.keepDirtyValues?D.keepDefaultValues&&s?pa(i,s,void 0,be):n.dirtyFields:D.keepDefaultValues&&I?pa(i,I,void 0,be):D.keepDirty?n.dirtyFields:{},touchedFields:D.keepTouched?n.touchedFields:{},errors:D.keepErrors?n.errors:{},isSubmitSuccessful:D.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:i})},mi=(I,D)=>zt(Vn(I)?I(s):I,{...e.resetOptions,...D}),Zr=(I,D={})=>{const j=we(r,I),W=j&&j._f;if(W){const Q=W.refs?W.refs[0]:W.ref;Q.focus&&setTimeout(()=>{Q.focus(),D.shouldSelect&&Vn(Q.select)&&Q.select()})}},Yr=I=>{const{name:D,type:j,values:W,...Q}=I;n={...n,...Q}},le={control:{register:Sn,unregister:jn,getFieldState:Me,handleSubmit:Kr,setError:Fe,_subscribe:ht,_runSchema:re,_updateIsValidating:M,_focusError:dn,_getWatch:ve,_getDirty:de,_setValid:R,_setFieldArray:L,_setDisabledField:un,_setErrors:U,_getFieldArray:V,_reset:zt,_resetDefaultValues:()=>Vn(e.defaultValues)&&e.defaultValues().then(I=>{mi(I,e.resetOptions),k.state.next({isLoading:!1})}),_removeUnmounted:q,_disableForm:tr,_subjects:k,_proxyFormState:x,get _fields(){return r},get _formValues(){return s},get _state(){return o},set _state(I){o=I},get _defaultValues(){return i},get _names(){return l},set _names(I){l=I},get _formState(){return n},get _options(){return e},set _options(I){e={...e,...I},m=vh(e.mode),g=vh(e.reValidateMode)}},subscribe:Jt,trigger:se,register:Sn,handleSubmit:Kr,watch:ft,setValue:Te,setValues:_e,getValues:pe,reset:mi,resetField:Ar,resetDefaultValues:(I,D={})=>{if(i=Bt(I),!D.keepDirty){const j=pa(i,s,void 0,r);n.dirtyFields=j,n.isDirty=!Rn(j)}D.keepIsValid||R(),k.state.next({...n,defaultValues:i})},clearErrors:ze,unregister:jn,setError:Fe,setFocus:Zr,getFieldState:Me};return{...le,formControl:le}}function EH(t={}){const e=Ve.useRef(void 0),n=Ve.useRef(void 0),r=Ve.useRef(t.formControl),[i,s]=Ve.useState(()=>({...Bt(BN),isLoading:Vn(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1,defaultValues:Vn(t.defaultValues)?void 0:t.defaultValues}));if(!e.current||t.formControl&&r.current!==t.formControl)if(r.current=t.formControl,t.formControl)e.current={...t.formControl,formState:i},t.defaultValues&&!Vn(t.defaultValues)&&t.formControl.reset(t.defaultValues,t.resetOptions);else{const{formControl:l,...u}=CH(t);e.current={...u,formState:i}}const o=e.current.control;return o._options=t,mw(()=>{const l=o._subscribe({formState:o._proxyFormState,callback:()=>s({...o._formState,defaultValues:o._defaultValues}),reRenderRoot:!0});return s(u=>({...u,isReady:!0})),o._formState.isReady=!0,l},[o]),Ve.useEffect(()=>o._disableForm(t.disabled),[o,t.disabled]),Ve.useEffect(()=>{t.mode&&(o._options.mode=t.mode),t.reValidateMode&&(o._options.reValidateMode=t.reValidateMode)},[o,t.mode,t.reValidateMode]),Ve.useEffect(()=>{t.errors&&(o._setErrors(t.errors),o._focusError())},[o,t.errors]),Ve.useEffect(()=>{t.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,t.shouldUnregister]),Ve.useEffect(()=>{if(o._proxyFormState.isDirty){const l=o._getDirty();l!==i.isDirty&&o._subjects.state.next({isDirty:l})}},[o,i.isDirty]),Ve.useEffect(()=>{var l;t.values&&!Sr(t.values,n.current)?(o._reset(t.values,{keepFieldsRef:!0,...o._options.resetOptions}),!((l=o._options.resetOptions)===null||l===void 0)&&l.keepIsValid||o._setValid(),n.current=t.values,s(u=>({...u}))):o._resetDefaultValues()},[o,t.values]),Ve.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),e.current.formState=Ve.useMemo(()=>_N(i,o),[o,i]),e.current}const e_=(t,e,n)=>{if(t&&"reportValidity"in t){const r=we(n,e);t.setCustomValidity(r&&r.message||""),t.reportValidity()}},S0=(t,e)=>{for(const n in e.fields){const r=e.fields[n];r&&r.ref&&"reportValidity"in r.ref?e_(r.ref,n,t):r&&r.refs&&r.refs.forEach(i=>e_(i,n,t))}},t_=(t,e)=>{e.shouldUseNativeValidation&&S0(t,e);const n={};for(const r in t){const i=we(e.fields,r),s=Object.assign(t[r]||{},{ref:i&&i.refs?i.refs[0]:i&&i.ref});if(TH(e.names||Object.keys(t),r)){const o=Object.assign({},we(n,r));mt(o,"root",s),mt(n,r,o)}else mt(n,r,s)}return n},TH=(t,e)=>{const n=n_(e).replace(/[.*+?^${}()|\\]/g,"\\$&");return t.some(r=>n_(r).match(`^${n}\\.\\d+`))};function n_(t){return t.replace(/[\[\]]/g,"")}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 r_(t,e){try{var n=t()}catch(r){return e(r)}return n&&n.then?n.then(void 0,e):n}function _H(t,e){for(var n=Object.create(null);t.length;){var r=t[0],i=r.code,s=r.message,o=r.path.join(".");if(!n[o])if("unionErrors"in r){var l,u,f=r.unionErrors.reduce(function(g,y){return y.errors.length<g.errors.length?y:g}).errors[0];n[o]={message:(l=f?.message)!=null?l:s,type:(u=f?.code)!=null?u:i}}else n[o]={message:s,type:i};if("unionErrors"in r&&r.unionErrors.forEach(function(g){return g.errors.forEach(function(y){return t.push(y)})}),e){var h=n[o].types,m=h&&h[r.code];n[o]=yw(o,e,n,i,m?[].concat(m,r.message):r.message)}t.shift()}return n}function AH(t,e){for(var n=Object.create(null),r=function(){var i=t[0],s=i.code,o=i.message,l=i.path.join(".");if(!n[l])if(i.code==="invalid_union"&&i.errors.length>0){var u,f,h=i.errors.reduce(function(y,x){return x.length<y.length?x:y})[0];n[l]={message:(u=h?.message)!=null?u:o,type:(f=h?.code)!=null?f:s}}else n[l]={message:o,type:s};if(i.code==="invalid_union"&&i.errors.forEach(function(y){return y.forEach(function(x){return t.push(k0({},x,{path:[].concat(i.path,x.path)}))})}),e){var m=n[l].types,g=m&&m[i.code];n[l]=yw(l,e,n,s,g?[].concat(g,i.message):i.message)}t.shift()};t.length;)r();return n}function RH(t,e,n){if(n===void 0&&(n={}),(function(r){return"_zod"in r&&typeof r._zod=="object"})(t))return function(r,i,s){try{return Promise.resolve(r_(function(){function o(u){return s.shouldUseNativeValidation&&S0({},s),{errors:{},values:n.raw?Object.assign({},r):u}}var l=t;return n.mode==="sync"?o(l.parse(r,e)):Promise.resolve(l.parseAsync(r,e)).then(o)},function(o){if((function(l){var u;return!(l==null||(u=l._zod)==null||(u=u.traits)==null||!u.has("$ZodError"))})(o))return{values:{},errors:t_(AH(o.issues,!s.shouldUseNativeValidation&&s.criteriaMode==="all"),s)};throw o}))}catch(o){return Promise.reject(o)}};if((function(r){return"_def"in r&&typeof r._def=="object"})(t))return function(r,i,s){try{return Promise.resolve(r_(function(){return Promise.resolve(t[n.mode==="sync"?"parse":"parseAsync"](r,e)).then(function(o){return s.shouldUseNativeValidation&&S0({},s),{errors:{},values:n.raw?Object.assign({},r):o}})},function(o){if((function(l){return Array.isArray(l?.issues)})(o))return{values:{},errors:t_(_H(o.errors,!s.shouldUseNativeValidation&&s.criteriaMode==="all"),s)};throw o}))}catch(o){return Promise.reject(o)}};throw new Error("Invalid input: not a Zod schema")}var dt;(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function n(i){throw new Error}t.assertNever=n,t.arrayToEnum=i=>{const s={};for(const o of i)s[o]=o;return s},t.getValidEnumValues=i=>{const s=t.objectKeys(i).filter(l=>typeof i[i[l]]!="number"),o={};for(const l of s)o[l]=i[l];return t.objectValues(o)},t.objectValues=i=>t.objectKeys(i).map(function(s){return i[s]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const s=[];for(const o in i)Object.prototype.hasOwnProperty.call(i,o)&&s.push(o);return s},t.find=(i,s)=>{for(const o of i)if(s(o))return o},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,s=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(s)}t.joinValues=r,t.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(dt||(dt={}));var i_;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(i_||(i_={}));const Ne=dt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),io=t=>{switch(typeof t){case"undefined":return Ne.undefined;case"string":return Ne.string;case"number":return Number.isNaN(t)?Ne.nan:Ne.number;case"boolean":return Ne.boolean;case"function":return Ne.function;case"bigint":return Ne.bigint;case"symbol":return Ne.symbol;case"object":return Array.isArray(t)?Ne.array:t===null?Ne.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Ne.promise:typeof Map<"u"&&t instanceof Map?Ne.map:typeof Set<"u"&&t instanceof Set?Ne.set:typeof Date<"u"&&t instanceof Date?Ne.date:Ne.object;default:return Ne.unknown}},xe=dt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Cs extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(s){return s.message},r={_errors:[]},i=s=>{for(const o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let l=r,u=0;for(;u<o.path.length;){const f=o.path[u];u===o.path.length-1?(l[f]=l[f]||{_errors:[]},l[f]._errors.push(n(o))):l[f]=l[f]||{_errors:[]},l=l[f],u++}}};return i(this),r}static assert(e){if(!(e instanceof Cs))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,dt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},r=[];for(const i of this.issues)if(i.path.length>0){const s=i.path[0];n[s]=n[s]||[],n[s].push(e(i))}else r.push(e(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Cs.create=t=>new Cs(t);const C0=(t,e)=>{let n;switch(t.code){case xe.invalid_type:t.received===Ne.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case xe.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,dt.jsonStringifyReplacer)}`;break;case xe.unrecognized_keys:n=`Unrecognized key(s) in object: ${dt.joinValues(t.keys,", ")}`;break;case xe.invalid_union:n="Invalid input";break;case xe.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${dt.joinValues(t.options)}`;break;case xe.invalid_enum_value:n=`Invalid enum value. Expected ${dt.joinValues(t.options)}, received '${t.received}'`;break;case xe.invalid_arguments:n="Invalid function arguments";break;case xe.invalid_return_type:n="Invalid function return type";break;case xe.invalid_date:n="Invalid date";break;case xe.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:dt.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case xe.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case xe.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case xe.custom:n="Invalid input";break;case xe.invalid_intersection_types:n="Intersection results could not be merged";break;case xe.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case xe.not_finite:n="Number must be finite";break;default:n=e.defaultError,dt.assertNever(t)}return{message:n}};let MH=C0;function NH(){return MH}const OH=t=>{const{data:e,path:n,errorMaps:r,issueData:i}=t,s=[...n,...i.path||[]],o={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let l="";const u=r.filter(f=>!!f).slice().reverse();for(const f of u)l=f(o,{data:e,defaultError:l}).message;return{...i,path:s,message:l}};function Ee(t,e){const n=NH(),r=OH({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===C0?void 0:C0].filter(i=>!!i)});t.common.issues.push(r)}class Tr{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const r=[];for(const i of n){if(i.status==="aborted")return Ke;i.status==="dirty"&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){const r=[];for(const i of n){const s=await i.key,o=await i.value;r.push({key:s,value:o})}return Tr.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const i of n){const{key:s,value:o}=i;if(s.status==="aborted"||o.status==="aborted")return Ke;s.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(r[s.value]=o.value)}return{status:e.value,value:r}}}const Ke=Object.freeze({status:"aborted"}),zu=t=>({status:"dirty",value:t}),Wr=t=>({status:"valid",value:t}),s_=t=>t.status==="aborted",o_=t=>t.status==="dirty",lc=t=>t.status==="valid",Cp=t=>typeof Promise<"u"&&t instanceof Promise;var De;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(De||(De={}));class Ro{constructor(e,n,r,i){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const a_=(t,e)=>{if(lc(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Cs(t.common.issues);return this._error=n,this._error}}};function Qe(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:i}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(o,l)=>{const{message:u}=t;return o.code==="invalid_enum_value"?{message:u??l.defaultError}:typeof l.data>"u"?{message:u??r??l.defaultError}:o.code!=="invalid_type"?{message:l.defaultError}:{message:u??n??l.defaultError}},description:i}}class at{get description(){return this._def.description}_getType(e){return io(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:io(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Tr,ctx:{common:e.parent.common,data:e.data,parsedType:io(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Cp(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){const r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:io(e)},i=this._parseSync({data:e,path:r.path,parent:r});return a_(r,i)}"~validate"(e){const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:io(e)};if(!this["~standard"].async)try{const r=this._parseSync({data:e,path:[],parent:n});return lc(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(r=>lc(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(e,n){const r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){const r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:io(e)},i=this._parse({data:e,path:r.path,parent:r}),s=await(Cp(i)?i:Promise.resolve(i));return a_(r,s)}refine(e,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,s)=>{const o=e(i),l=()=>s.addIssue({code:xe.custom,...r(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(u=>u?!0:(l(),!1)):o?!0:(l(),!1)})}refinement(e,n){return this._refinement((r,i)=>e(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(e){return new dc({schema:this,typeName:Ze.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return So.create(this,this._def)}nullable(){return fc.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ri.create(this)}promise(){return Ap.create(this,this._def)}or(e){return Tp.create([this,e],this._def)}and(e){return _p.create(this,e,this._def)}transform(e){return new dc({...Qe(this._def),schema:this,typeName:Ze.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new _0({...Qe(this._def),innerType:this,defaultValue:n,typeName:Ze.ZodDefault})}brand(){return new tU({typeName:Ze.ZodBranded,type:this,...Qe(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new A0({...Qe(this._def),innerType:this,catchValue:n,typeName:Ze.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return vw.create(this,e)}readonly(){return R0.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const DH=/^c[^\s-]{8,}$/i,IH=/^[0-9a-z]+$/,LH=/^[0-9A-HJKMNP-TV-Z]{26}$/i,jH=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,PH=/^[a-z0-9_-]{21}$/i,zH=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,$H=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,BH=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,VH="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let tb;const HH=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,UH=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,FH=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,qH=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,GH=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,WH=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,VN="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",KH=new RegExp(`^${VN}$`);function HN(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function ZH(t){return new RegExp(`^${HN(t)}$`)}function YH(t){let e=`${VN}T${HN(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function XH(t,e){return!!((e==="v4"||!e)&&HH.test(t)||(e==="v6"||!e)&&FH.test(t))}function JH(t,e){if(!zH.test(t))return!1;try{const[n]=t.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(r));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function QH(t,e){return!!((e==="v4"||!e)&&UH.test(t)||(e==="v6"||!e)&&qH.test(t))}class go extends at{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Ne.string){const s=this._getOrReturnCtx(e);return Ee(s,{code:xe.invalid_type,expected:Ne.string,received:s.parsedType}),Ke}const r=new Tr;let i;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(i=this._getOrReturnCtx(e,i),Ee(i,{code:xe.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")e.data.length>s.value&&(i=this._getOrReturnCtx(e,i),Ee(i,{code:xe.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){const o=e.data.length>s.value,l=e.data.length<s.value;(o||l)&&(i=this._getOrReturnCtx(e,i),o?Ee(i,{code:xe.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):l&&Ee(i,{code:xe.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")BH.test(e.data)||(i=this._getOrReturnCtx(e,i),Ee(i,{validation:"email",code:xe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")tb||(tb=new RegExp(VH,"u")),tb.test(e.data)||(i=this._getOrReturnCtx(e,i),Ee(i,{validation:"emoji",code:xe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")jH.test(e.data)||(i=this._getOrReturnCtx(e,i),Ee(i,{validation:"uuid",code:xe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")PH.test(e.data)||(i=this._getOrReturnCtx(e,i),Ee(i,{validation:"nanoid",code:xe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")DH.test(e.data)||(i=this._getOrReturnCtx(e,i),Ee(i,{validation:"cuid",code:xe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")IH.test(e.data)||(i=this._getOrReturnCtx(e,i),Ee(i,{validation:"cuid2",code:xe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")LH.test(e.data)||(i=this._getOrReturnCtx(e,i),Ee(i,{validation:"ulid",code:xe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),Ee(i,{validation:"url",code:xe.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),Ee(i,{validation:"regex",code:xe.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(e,i),Ee(i,{code:xe.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(i=this._getOrReturnCtx(e,i),Ee(i,{code:xe.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(i=this._getOrReturnCtx(e,i),Ee(i,{code:xe.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?YH(s).test(e.data)||(i=this._getOrReturnCtx(e,i),Ee(i,{code:xe.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?KH.test(e.data)||(i=this._getOrReturnCtx(e,i),Ee(i,{code:xe.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?ZH(s).test(e.data)||(i=this._getOrReturnCtx(e,i),Ee(i,{code:xe.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?$H.test(e.data)||(i=this._getOrReturnCtx(e,i),Ee(i,{validation:"duration",code:xe.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?XH(e.data,s.version)||(i=this._getOrReturnCtx(e,i),Ee(i,{validation:"ip",code:xe.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?JH(e.data,s.alg)||(i=this._getOrReturnCtx(e,i),Ee(i,{validation:"jwt",code:xe.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?QH(e.data,s.version)||(i=this._getOrReturnCtx(e,i),Ee(i,{validation:"cidr",code:xe.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?GH.test(e.data)||(i=this._getOrReturnCtx(e,i),Ee(i,{validation:"base64",code:xe.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?WH.test(e.data)||(i=this._getOrReturnCtx(e,i),Ee(i,{validation:"base64url",code:xe.invalid_string,message:s.message}),r.dirty()):dt.assertNever(s);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(i=>e.test(i),{validation:n,code:xe.invalid_string,...De.errToObj(r)})}_addCheck(e){return new go({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...De.errToObj(e)})}url(e){return this._addCheck({kind:"url",...De.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...De.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...De.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...De.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...De.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...De.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...De.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...De.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...De.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...De.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...De.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...De.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...De.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...De.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...De.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...De.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...De.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...De.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...De.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...De.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...De.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...De.errToObj(n)})}nonempty(e){return this.min(1,De.errToObj(e))}trim(){return new go({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new go({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new go({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}go.create=t=>new go({checks:[],typeName:Ze.ZodString,coerce:t?.coerce??!1,...Qe(t)});function eU(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,i=n>r?n:r,s=Number.parseInt(t.toFixed(i).replace(".","")),o=Number.parseInt(e.toFixed(i).replace(".",""));return s%o/10**i}class cc extends at{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Ne.number){const s=this._getOrReturnCtx(e);return Ee(s,{code:xe.invalid_type,expected:Ne.number,received:s.parsedType}),Ke}let r;const i=new Tr;for(const s of this._def.checks)s.kind==="int"?dt.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),Ee(r,{code:xe.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),Ee(r,{code:xe.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),Ee(r,{code:xe.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?eU(e.data,s.value)!==0&&(r=this._getOrReturnCtx(e,r),Ee(r,{code:xe.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),Ee(r,{code:xe.not_finite,message:s.message}),i.dirty()):dt.assertNever(s);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,De.toString(n))}gt(e,n){return this.setLimit("min",e,!1,De.toString(n))}lte(e,n){return this.setLimit("max",e,!0,De.toString(n))}lt(e,n){return this.setLimit("max",e,!1,De.toString(n))}setLimit(e,n,r,i){return new cc({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:De.toString(i)}]})}_addCheck(e){return new cc({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:De.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:De.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:De.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:De.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:De.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:De.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:De.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:De.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:De.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&dt.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}}cc.create=t=>new cc({checks:[],typeName:Ze.ZodNumber,coerce:t?.coerce||!1,...Qe(t)});class yd extends at{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Ne.bigint)return this._getInvalidInput(e);let r;const i=new Tr;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),Ee(r,{code:xe.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),Ee(r,{code:xe.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),Ee(r,{code:xe.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):dt.assertNever(s);return{status:i.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return Ee(n,{code:xe.invalid_type,expected:Ne.bigint,received:n.parsedType}),Ke}gte(e,n){return this.setLimit("min",e,!0,De.toString(n))}gt(e,n){return this.setLimit("min",e,!1,De.toString(n))}lte(e,n){return this.setLimit("max",e,!0,De.toString(n))}lt(e,n){return this.setLimit("max",e,!1,De.toString(n))}setLimit(e,n,r,i){return new yd({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:De.toString(i)}]})}_addCheck(e){return new yd({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:De.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:De.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:De.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:De.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:De.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}yd.create=t=>new yd({checks:[],typeName:Ze.ZodBigInt,coerce:t?.coerce??!1,...Qe(t)});class E0 extends at{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Ne.boolean){const r=this._getOrReturnCtx(e);return Ee(r,{code:xe.invalid_type,expected:Ne.boolean,received:r.parsedType}),Ke}return Wr(e.data)}}E0.create=t=>new E0({typeName:Ze.ZodBoolean,coerce:t?.coerce||!1,...Qe(t)});class Ep extends at{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Ne.date){const s=this._getOrReturnCtx(e);return Ee(s,{code:xe.invalid_type,expected:Ne.date,received:s.parsedType}),Ke}if(Number.isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return Ee(s,{code:xe.invalid_date}),Ke}const r=new Tr;let i;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(i=this._getOrReturnCtx(e,i),Ee(i,{code:xe.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(i=this._getOrReturnCtx(e,i),Ee(i,{code:xe.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):dt.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Ep({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:De.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:De.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}Ep.create=t=>new Ep({checks:[],coerce:t?.coerce||!1,typeName:Ze.ZodDate,...Qe(t)});class l_ extends at{_parse(e){if(this._getType(e)!==Ne.symbol){const r=this._getOrReturnCtx(e);return Ee(r,{code:xe.invalid_type,expected:Ne.symbol,received:r.parsedType}),Ke}return Wr(e.data)}}l_.create=t=>new l_({typeName:Ze.ZodSymbol,...Qe(t)});class c_ extends at{_parse(e){if(this._getType(e)!==Ne.undefined){const r=this._getOrReturnCtx(e);return Ee(r,{code:xe.invalid_type,expected:Ne.undefined,received:r.parsedType}),Ke}return Wr(e.data)}}c_.create=t=>new c_({typeName:Ze.ZodUndefined,...Qe(t)});class u_ extends at{_parse(e){if(this._getType(e)!==Ne.null){const r=this._getOrReturnCtx(e);return Ee(r,{code:xe.invalid_type,expected:Ne.null,received:r.parsedType}),Ke}return Wr(e.data)}}u_.create=t=>new u_({typeName:Ze.ZodNull,...Qe(t)});class d_ extends at{constructor(){super(...arguments),this._any=!0}_parse(e){return Wr(e.data)}}d_.create=t=>new d_({typeName:Ze.ZodAny,...Qe(t)});class f_ extends at{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Wr(e.data)}}f_.create=t=>new f_({typeName:Ze.ZodUnknown,...Qe(t)});class Mo extends at{_parse(e){const n=this._getOrReturnCtx(e);return Ee(n,{code:xe.invalid_type,expected:Ne.never,received:n.parsedType}),Ke}}Mo.create=t=>new Mo({typeName:Ze.ZodNever,...Qe(t)});class h_ extends at{_parse(e){if(this._getType(e)!==Ne.undefined){const r=this._getOrReturnCtx(e);return Ee(r,{code:xe.invalid_type,expected:Ne.void,received:r.parsedType}),Ke}return Wr(e.data)}}h_.create=t=>new h_({typeName:Ze.ZodVoid,...Qe(t)});class Ri extends at{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),i=this._def;if(n.parsedType!==Ne.array)return Ee(n,{code:xe.invalid_type,expected:Ne.array,received:n.parsedType}),Ke;if(i.exactLength!==null){const o=n.data.length>i.exactLength.value,l=n.data.length<i.exactLength.value;(o||l)&&(Ee(n,{code:o?xe.too_big:xe.too_small,minimum:l?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(Ee(n,{code:xe.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(Ee(n,{code:xe.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,l)=>i.type._parseAsync(new Ro(n,o,n.path,l)))).then(o=>Tr.mergeArray(r,o));const s=[...n.data].map((o,l)=>i.type._parseSync(new Ro(n,o,n.path,l)));return Tr.mergeArray(r,s)}get element(){return this._def.type}min(e,n){return new Ri({...this._def,minLength:{value:e,message:De.toString(n)}})}max(e,n){return new Ri({...this._def,maxLength:{value:e,message:De.toString(n)}})}length(e,n){return new Ri({...this._def,exactLength:{value:e,message:De.toString(n)}})}nonempty(e){return this.min(1,e)}}Ri.create=(t,e)=>new Ri({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Ze.ZodArray,...Qe(e)});function Gl(t){if(t instanceof sn){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=So.create(Gl(r))}return new sn({...t._def,shape:()=>e})}else return t instanceof Ri?new Ri({...t._def,type:Gl(t.element)}):t instanceof So?So.create(Gl(t.unwrap())):t instanceof fc?fc.create(Gl(t.unwrap())):t instanceof Na?Na.create(t.items.map(e=>Gl(e))):t}class sn extends at{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=dt.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==Ne.object){const f=this._getOrReturnCtx(e);return Ee(f,{code:xe.invalid_type,expected:Ne.object,received:f.parsedType}),Ke}const{status:r,ctx:i}=this._processInputParams(e),{shape:s,keys:o}=this._getCached(),l=[];if(!(this._def.catchall instanceof Mo&&this._def.unknownKeys==="strip"))for(const f in i.data)o.includes(f)||l.push(f);const u=[];for(const f of o){const h=s[f],m=i.data[f];u.push({key:{status:"valid",value:f},value:h._parse(new Ro(i,m,i.path,f)),alwaysSet:f in i.data})}if(this._def.catchall instanceof Mo){const f=this._def.unknownKeys;if(f==="passthrough")for(const h of l)u.push({key:{status:"valid",value:h},value:{status:"valid",value:i.data[h]}});else if(f==="strict")l.length>0&&(Ee(i,{code:xe.unrecognized_keys,keys:l}),r.dirty());else if(f!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const f=this._def.catchall;for(const h of l){const m=i.data[h];u.push({key:{status:"valid",value:h},value:f._parse(new Ro(i,m,i.path,h)),alwaysSet:h in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const f=[];for(const h of u){const m=await h.key,g=await h.value;f.push({key:m,value:g,alwaysSet:h.alwaysSet})}return f}).then(f=>Tr.mergeObjectSync(r,f)):Tr.mergeObjectSync(r,u)}get shape(){return this._def.shape()}strict(e){return De.errToObj,new sn({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{const i=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:De.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new sn({...this._def,unknownKeys:"strip"})}passthrough(){return new sn({...this._def,unknownKeys:"passthrough"})}extend(e){return new sn({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new sn({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Ze.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new sn({...this._def,catchall:e})}pick(e){const n={};for(const r of dt.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new sn({...this._def,shape:()=>n})}omit(e){const n={};for(const r of dt.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new sn({...this._def,shape:()=>n})}deepPartial(){return Gl(this)}partial(e){const n={};for(const r of dt.objectKeys(this.shape)){const i=this.shape[r];e&&!e[r]?n[r]=i:n[r]=i.optional()}return new sn({...this._def,shape:()=>n})}required(e){const n={};for(const r of dt.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof So;)s=s._def.innerType;n[r]=s}return new sn({...this._def,shape:()=>n})}keyof(){return UN(dt.objectKeys(this.shape))}}sn.create=(t,e)=>new sn({shape:()=>t,unknownKeys:"strip",catchall:Mo.create(),typeName:Ze.ZodObject,...Qe(e)});sn.strictCreate=(t,e)=>new sn({shape:()=>t,unknownKeys:"strict",catchall:Mo.create(),typeName:Ze.ZodObject,...Qe(e)});sn.lazycreate=(t,e)=>new sn({shape:t,unknownKeys:"strip",catchall:Mo.create(),typeName:Ze.ZodObject,...Qe(e)});class Tp extends at{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function i(s){for(const l of s)if(l.result.status==="valid")return l.result;for(const l of s)if(l.result.status==="dirty")return n.common.issues.push(...l.ctx.common.issues),l.result;const o=s.map(l=>new Cs(l.ctx.common.issues));return Ee(n,{code:xe.invalid_union,unionErrors:o}),Ke}if(n.common.async)return Promise.all(r.map(async s=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(i);{let s;const o=[];for(const u of r){const f={...n,common:{...n.common,issues:[]},parent:null},h=u._parseSync({data:n.data,path:n.path,parent:f});if(h.status==="valid")return h;h.status==="dirty"&&!s&&(s={result:h,ctx:f}),f.common.issues.length&&o.push(f.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const l=o.map(u=>new Cs(u));return Ee(n,{code:xe.invalid_union,unionErrors:l}),Ke}}get options(){return this._def.options}}Tp.create=(t,e)=>new Tp({options:t,typeName:Ze.ZodUnion,...Qe(e)});function T0(t,e){const n=io(t),r=io(e);if(t===e)return{valid:!0,data:t};if(n===Ne.object&&r===Ne.object){const i=dt.objectKeys(e),s=dt.objectKeys(t).filter(l=>i.indexOf(l)!==-1),o={...t,...e};for(const l of s){const u=T0(t[l],e[l]);if(!u.valid)return{valid:!1};o[l]=u.data}return{valid:!0,data:o}}else if(n===Ne.array&&r===Ne.array){if(t.length!==e.length)return{valid:!1};const i=[];for(let s=0;s<t.length;s++){const o=t[s],l=e[s],u=T0(o,l);if(!u.valid)return{valid:!1};i.push(u.data)}return{valid:!0,data:i}}else return n===Ne.date&&r===Ne.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class _p extends at{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),i=(s,o)=>{if(s_(s)||s_(o))return Ke;const l=T0(s.value,o.value);return l.valid?((o_(s)||o_(o))&&n.dirty(),{status:n.value,value:l.data}):(Ee(r,{code:xe.invalid_intersection_types}),Ke)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,o])=>i(s,o)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}_p.create=(t,e,n)=>new _p({left:t,right:e,typeName:Ze.ZodIntersection,...Qe(n)});class Na extends at{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ne.array)return Ee(r,{code:xe.invalid_type,expected:Ne.array,received:r.parsedType}),Ke;if(r.data.length<this._def.items.length)return Ee(r,{code:xe.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ke;!this._def.rest&&r.data.length>this._def.items.length&&(Ee(r,{code:xe.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((o,l)=>{const u=this._def.items[l]||this._def.rest;return u?u._parse(new Ro(r,o,r.path,l)):null}).filter(o=>!!o);return r.common.async?Promise.all(s).then(o=>Tr.mergeArray(n,o)):Tr.mergeArray(n,s)}get items(){return this._def.items}rest(e){return new Na({...this._def,rest:e})}}Na.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Na({items:t,typeName:Ze.ZodTuple,rest:null,...Qe(e)})};class p_ extends at{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ne.map)return Ee(r,{code:xe.invalid_type,expected:Ne.map,received:r.parsedType}),Ke;const i=this._def.keyType,s=this._def.valueType,o=[...r.data.entries()].map(([l,u],f)=>({key:i._parse(new Ro(r,l,r.path,[f,"key"])),value:s._parse(new Ro(r,u,r.path,[f,"value"]))}));if(r.common.async){const l=new Map;return Promise.resolve().then(async()=>{for(const u of o){const f=await u.key,h=await u.value;if(f.status==="aborted"||h.status==="aborted")return Ke;(f.status==="dirty"||h.status==="dirty")&&n.dirty(),l.set(f.value,h.value)}return{status:n.value,value:l}})}else{const l=new Map;for(const u of o){const f=u.key,h=u.value;if(f.status==="aborted"||h.status==="aborted")return Ke;(f.status==="dirty"||h.status==="dirty")&&n.dirty(),l.set(f.value,h.value)}return{status:n.value,value:l}}}}p_.create=(t,e,n)=>new p_({valueType:e,keyType:t,typeName:Ze.ZodMap,...Qe(n)});class vd extends at{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ne.set)return Ee(r,{code:xe.invalid_type,expected:Ne.set,received:r.parsedType}),Ke;const i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(Ee(r,{code:xe.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(Ee(r,{code:xe.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const s=this._def.valueType;function o(u){const f=new Set;for(const h of u){if(h.status==="aborted")return Ke;h.status==="dirty"&&n.dirty(),f.add(h.value)}return{status:n.value,value:f}}const l=[...r.data.values()].map((u,f)=>s._parse(new Ro(r,u,r.path,f)));return r.common.async?Promise.all(l).then(u=>o(u)):o(l)}min(e,n){return new vd({...this._def,minSize:{value:e,message:De.toString(n)}})}max(e,n){return new vd({...this._def,maxSize:{value:e,message:De.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}vd.create=(t,e)=>new vd({valueType:t,minSize:null,maxSize:null,typeName:Ze.ZodSet,...Qe(e)});class m_ extends at{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}m_.create=(t,e)=>new m_({getter:t,typeName:Ze.ZodLazy,...Qe(e)});class g_ extends at{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return Ee(n,{received:n.data,code:xe.invalid_literal,expected:this._def.value}),Ke}return{status:"valid",value:e.data}}get value(){return this._def.value}}g_.create=(t,e)=>new g_({value:t,typeName:Ze.ZodLiteral,...Qe(e)});function UN(t,e){return new uc({values:t,typeName:Ze.ZodEnum,...Qe(e)})}class uc extends at{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return Ee(n,{expected:dt.joinValues(r),received:n.parsedType,code:xe.invalid_type}),Ke}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return Ee(n,{received:n.data,code:xe.invalid_enum_value,options:r}),Ke}return Wr(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return uc.create(e,{...this._def,...n})}exclude(e,n=this._def){return uc.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}}uc.create=UN;class y_ extends at{_parse(e){const n=dt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==Ne.string&&r.parsedType!==Ne.number){const i=dt.objectValues(n);return Ee(r,{expected:dt.joinValues(i),received:r.parsedType,code:xe.invalid_type}),Ke}if(this._cache||(this._cache=new Set(dt.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const i=dt.objectValues(n);return Ee(r,{received:r.data,code:xe.invalid_enum_value,options:i}),Ke}return Wr(e.data)}get enum(){return this._def.values}}y_.create=(t,e)=>new y_({values:t,typeName:Ze.ZodNativeEnum,...Qe(e)});class Ap extends at{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Ne.promise&&n.common.async===!1)return Ee(n,{code:xe.invalid_type,expected:Ne.promise,received:n.parsedType}),Ke;const r=n.parsedType===Ne.promise?n.data:Promise.resolve(n.data);return Wr(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Ap.create=(t,e)=>new Ap({type:t,typeName:Ze.ZodPromise,...Qe(e)});class dc extends at{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ze.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),i=this._def.effect||null,s={addIssue:o=>{Ee(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){const o=i.transform(r.data,s);if(r.common.async)return Promise.resolve(o).then(async l=>{if(n.value==="aborted")return Ke;const u=await this._def.schema._parseAsync({data:l,path:r.path,parent:r});return u.status==="aborted"?Ke:u.status==="dirty"||n.value==="dirty"?zu(u.value):u});{if(n.value==="aborted")return Ke;const l=this._def.schema._parseSync({data:o,path:r.path,parent:r});return l.status==="aborted"?Ke:l.status==="dirty"||n.value==="dirty"?zu(l.value):l}}if(i.type==="refinement"){const o=l=>{const u=i.refinement(l,s);if(r.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l};if(r.common.async===!1){const l=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return l.status==="aborted"?Ke:(l.status==="dirty"&&n.dirty(),o(l.value),{status:n.value,value:l.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(l=>l.status==="aborted"?Ke:(l.status==="dirty"&&n.dirty(),o(l.value).then(()=>({status:n.value,value:l.value}))))}if(i.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!lc(o))return Ke;const l=i.transform(o.value,s);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:l}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>lc(o)?Promise.resolve(i.transform(o.value,s)).then(l=>({status:n.value,value:l})):Ke);dt.assertNever(i)}}dc.create=(t,e,n)=>new dc({schema:t,typeName:Ze.ZodEffects,effect:e,...Qe(n)});dc.createWithPreprocess=(t,e,n)=>new dc({schema:e,effect:{type:"preprocess",transform:t},typeName:Ze.ZodEffects,...Qe(n)});class So extends at{_parse(e){return this._getType(e)===Ne.undefined?Wr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}So.create=(t,e)=>new So({innerType:t,typeName:Ze.ZodOptional,...Qe(e)});class fc extends at{_parse(e){return this._getType(e)===Ne.null?Wr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}fc.create=(t,e)=>new fc({innerType:t,typeName:Ze.ZodNullable,...Qe(e)});class _0 extends at{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===Ne.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}_0.create=(t,e)=>new _0({innerType:t,typeName:Ze.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Qe(e)});class A0 extends at{_parse(e){const{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Cp(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Cs(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Cs(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}A0.create=(t,e)=>new A0({innerType:t,typeName:Ze.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Qe(e)});class v_ extends at{_parse(e){if(this._getType(e)!==Ne.nan){const r=this._getOrReturnCtx(e);return Ee(r,{code:xe.invalid_type,expected:Ne.nan,received:r.parsedType}),Ke}return{status:"valid",value:e.data}}}v_.create=t=>new v_({typeName:Ze.ZodNaN,...Qe(t)});class tU extends at{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class vw extends at{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Ke:s.status==="dirty"?(n.dirty(),zu(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Ke:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(e,n){return new vw({in:e,out:n,typeName:Ze.ZodPipeline})}}class R0 extends at{_parse(e){const n=this._def.innerType._parse(e),r=i=>(lc(i)&&(i.value=Object.freeze(i.value)),i);return Cp(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}}R0.create=(t,e)=>new R0({innerType:t,typeName:Ze.ZodReadonly,...Qe(e)});var Ze;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Ze||(Ze={}));const b_=go.create,nU=cc.create,rU=E0.create;Mo.create;const iU=Ri.create,sU=sn.create;Tp.create;_p.create;Na.create;uc.create;Ap.create;So.create;fc.create;function oU(t){const e={};for(const[n,r]of Object.entries(t)){let i;switch(r.type){case"number":i=nU(),r.min!=null&&(i=i.min(r.min)),r.max!=null&&(i=i.max(r.max));break;case"boolean":i=rU();break;case"file[]":case"enum[]":i=iU(b_());break;default:i=b_()}r.required||(i=i.optional()),e[n]=i}return sU(e)}function $m(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").trim()}function Yu(t,e){const n=e?.optionLabels?.[t]?.trim();return n||$m(t)}function aU(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function lU(t,e,n){const r=e.label?.trim()||$m(t),i=r.replace(new RegExp(`^${aU(n)}\\s+`,"i"),"");if(/^inventory$/i.test(n)){const s=r.replace(/^stock\s+/i,"").trim();if(s&&s!==r)return s}return/^pricing$/i.test(n)&&/cents/i.test(r)?r.replace(/\s*\(cents\)/i,"").trim()||r:i||r}const cU=/(description|body|content|summary|bio|copy|caption|details)/i;function FN(t,e){if(e?.type==="richtext")return!0;const n=`${t} ${e?.label??""}`;return cU.test(n)}function x_(t){const e=typeof t=="string"?t.trim():"";return e?{characters:e.length,words:e.split(/\s+/).filter(Boolean).length}:{characters:0,words:0}}function bd(t){return/^https?:\/\//i.test(t)||t.startsWith("//")}function Oa(t,e){if(e?.type==="file[]")return!0;const n=`${t} ${e?.label??""}`;return/(image|img|photo|avatar|thumbnail|thumb|cover)/i.test(n)}function qN(t){if(typeof t=="string"&&bd(t))return{url:t};if(t&&typeof t=="object"&&"url"in t){const e=t.url,n=t.name;if(typeof e=="string"&&bd(e))return{url:e,name:typeof n=="string"?n:void 0}}return null}function uU(t,e){const n=[];for(const[r,i]of Object.entries(t)){if(!Oa(r,i))continue;const s=i.label?.trim()||r,o=e?.[r],l=Array.isArray(o)?o:[o];l.forEach((u,f)=>{const h=qN(u);h&&n.push({id:`${r}:${f}`,url:h.url,name:h.name||(l.length>1?`${s} ${f+1}`:s),field:r})})}return n}function M0(t){const e=Array.isArray(t)?t:t==null||t===""?[]:[t],n=[];for(const r of e){const i=qN(r);i&&n.push(i.url)}return n}function dU(t,e){const n=`${t} ${e?.label??""}`;return/(stock|inventory|qty|quantity)/i.test(n)}function Bm(t,e){if(/^show[A-Z]/.test(t))return!1;if(/^specs$/i.test(e?.group??""))return!0;const n=`${t} ${e?.label??""}`;return/(material|fit|care|fabric|composition|^details$)/i.test(n)}function GN(t,e){const n=`${t} ${e?.label??""}`;return/(detail|notes|bio|bullets|body|message|html)/i.test(n)}function fU(t,e,n){if(e.type==="boolean"||e.type==="enum[]"||e.type==="richtext"||FN(t,e)||GN(t,e)||n==="record"&&Oa(t,e))return"full"}function bw(t){return`show${t.charAt(0).toUpperCase()}${t.slice(1)}`}function hU(t){const e={...t};for(const[n,r]of Object.entries(t)){if(r.type==="boolean"||!Bm(n,r))continue;const i=bw(n);e[i]||(e[i]={type:"boolean",default:!0,label:`Show ${r.label??$m(n)}`})}return e}function pU(t,e){const n={...e};for(const[r,i]of Object.entries(t)){if(i.type==="boolean"||!Bm(r,i))continue;const s=bw(r);!(s in n)||n[s]==null?n[s]=!0:n[s]=n[s]!==!1}return n}function mU(t){return t.charAt(0).toLowerCase()+t.slice(1)}function gU(t,e){const n=bw(t),r=[n];t==="priceCents"&&r.push("showPrice");for(const i of r)if(e[i]?.type==="boolean")return i;return Bm(t,e[t])?n:null}const N0={Pricing:"showPrice",Inventory:"showStock",Content:"showDescription"};function yU(t){return Object.keys(N0).find(e=>N0[e]===t)}function vU(t,e){if(!/^show[A-Z]/.test(t)||e[t]?.type!=="boolean")return!1;if(yU(t))return!0;const n=mU(t.slice(4));return e[n]?!0:t==="showPrice"&&!!e.priceCents}function xw(t,e){const n=N0[t];return n&&e[n]?.type==="boolean"?n:null}function bU(t,e,n){const r=gU(t,e);return!r||n&&xw(n,e)===r?null:r}const w_=["Details","Content","Specs","Pricing","Inventory","Media","Display","Status"];function xU(t,e){if(e.group?.trim())return e.group.trim();const r=(e.label?.trim()||$m(t)).split(/\s+/).filter(Boolean);return r.length>=2?r[0]:"General"}function wU(t,e){if(e.group?.trim())return e.group.trim();const n=t.toLowerCase(),r=(e.label??"").toLowerCase(),i=`${n} ${r}`;return/(image|img|photo|avatar|thumbnail|thumb|cover|media_url)/i.test(i)?"Media":/(price|cost|cents|amount|msrp)/i.test(i)?"Pricing":/(stock|inventory|qty|quantity)/i.test(i)?"Inventory":/^display$/i.test(e.group??"")||/^show[A-Z]/.test(t)?"Display":e.type==="boolean"||/(^|_)(active|enabled|published|status|visible)(_|$)/i.test(n)||/^(active|enabled|published|status|visible)$/i.test(r)?"Status":e.type==="richtext"||/(description|body|content|summary|bio)/i.test(i)?"Content":Bm(t,e)?"Specs":"Details"}function SU(t,e){if(e!=="record")return t;const n=r=>{const i=w_.indexOf(r);return i===-1?w_.length+1:i};return[...t].sort((r,i)=>n(r.id)-n(i.id))}function kU(t,e){const n=[],r=new Map,i=new Set;for(const o of Object.entries(t)){const[l,u]=o;if(vU(l,t))continue;const f=e==="record"?wU(l,u):xU(l,u);u.group?.trim()&&i.add(f),r.has(f)||(r.set(f,[]),n.push(f)),r.get(f).push(o)}if(e==="config")for(const[o,l]of[...r.entries()]){if(l.length>1||i.has(o)||o==="General")continue;r.has("General")||(r.set("General",[]),n.unshift("General")),r.get("General").push(...l),r.delete(o);const u=n.indexOf(o);u>=0&&n.splice(u,1)}const s=n.filter(o=>r.has(o)).map(o=>({id:o,label:o,fields:r.get(o)}));return SU(s,e)}function Rp(t){const e=Array.isArray(t)?t:[t];for(const n of e){if(typeof n=="string"&&bd(n))return n;if(n&&typeof n=="object"&&"url"in n){const r=n.url;if(typeof r=="string"&&bd(r))return r}}return null}function CU(t,e){for(const[n,r]of Object.entries(t))if(Oa(n,r)&&Rp(e?.[n]))return n;for(const[n,r]of Object.entries(t))if(Oa(n,r))return n;return null}function EU(t){return t.join(",")}function Fd({meta:t,disabled:e,multiple:n=!1,label:r,onUpload:i}){const s=A.useRef(null),[o,l]=A.useState(!1),[u,f]=A.useState(null),[h,m]=A.useState(!1),g=async y=>{if(!y||e||o)return;const x=Array.from(y);if(x.length){l(!0),f(null);try{await i(n?x:x.slice(0,1))}catch(S){f(S instanceof Error?S.message:"Upload failed")}finally{l(!1),s.current&&(s.current.value="")}}};return b.jsxs("div",{className:"vertebr-upload",children:[b.jsxs("div",{className:"vertebr-upload-drop","data-busy":o?"true":void 0,"data-drag":h?"true":void 0,onDragEnter:y=>{y.preventDefault(),m(!0)},onDragOver:y=>{y.preventDefault(),m(!0)},onDragLeave:y=>{y.preventDefault(),m(!1)},onDrop:y=>{y.preventDefault(),m(!1),g(y.dataTransfer.files)},children:[b.jsx("p",{className:"vertebr-upload-copy",children:o?"Uploading…":r??(n?"Drop images here or browse":"Drop an image here or browse")}),b.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",disabled:e||o,onClick:()=>s.current?.click(),children:n?"Choose images":"Choose image"}),b.jsx("input",{ref:s,type:"file",accept:EU(t.accept),multiple:n,hidden:!0,onChange:y=>{g(y.target.files)}})]}),u?b.jsx("p",{className:"vertebr-upload-error",role:"alert",children:u}):null]})}var Tc=pM();const TU=hM(Tc);var _U=Object.defineProperty,ww=(t,e)=>_U(t,"name",{value:e,configurable:!0});function O0(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}ww(O0,"setRef");function WN(...t){return e=>{let n=!1;const r=t.map(i=>{const s=O0(i,e);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let i=0;i<r.length;i++){const s=r[i];typeof s=="function"?s():O0(t[i],null)}}}}ww(WN,"composeRefs");function Xt(...t){return A.useCallback(WN(...t),t)}ww(Xt,"useComposedRefs");var AU=Object.defineProperty,hi=(t,e)=>AU(t,"name",{value:e,configurable:!0});function Da(t){const e=A.forwardRef((n,r)=>{let{children:i,...s}=n,o=null,l=!1;const u=[];D0(i)&&typeof bh=="function"&&(i=bh(i._payload)),A.Children.forEach(i,g=>{if(XN(g)){l=!0;const y=g;let x="child"in y.props?y.props.child:y.props.children;D0(x)&&typeof bh=="function"&&(x=bh(x._payload)),o=MU(y,x),u.push(o?.props?.children)}else u.push(g)}),o?o=A.cloneElement(o,void 0,u):!l&&A.Children.count(i)===1&&A.isValidElement(i)&&(o=i);const f=o?YN(o):void 0,h=Xt(r,f);if(!o){if(i||i===0)throw new Error(l?DU(t):OU(t));return i}const m=ZN(s,o.props??{});return o.type!==A.Fragment&&(m.ref=r?h:f),A.cloneElement(o,m)});return e.displayName=`${t}.Slot`,e}hi(Da,"createSlot");var KN=Symbol.for("radix.slottable");function RU(t){const e=hi(n=>"child"in n?n.children(n.child):n.children,"Slottable");return e.displayName=`${t}.Slottable`,e.__radixId=KN,e}hi(RU,"createSlottable");var MU=hi((t,e)=>{if("child"in t.props){const n=t.props.child;return A.isValidElement(n)?A.cloneElement(n,void 0,t.props.children(n.props.children)):null}return A.isValidElement(e)?e:null},"getSlottableElementFromSlottable");function ZN(t,e){const n={...e};for(const r in e){const i=t[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...l)=>{const u=s(...l);return i(...l),u}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}hi(ZN,"mergeProps");function YN(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}hi(YN,"getElementRef");function XN(t){return A.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===KN}hi(XN,"isSlottable");var NU=Symbol.for("react.lazy");function D0(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===NU&&"_payload"in t&&JN(t._payload)}hi(D0,"isLazyComponent");function JN(t){return typeof t=="object"&&t!==null&&"then"in t}hi(JN,"isPromiseLike");var OU=hi(t=>`${t} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),DU=hi(t=>`${t} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),bh=Id[" use ".trim().toString()],IU=Object.defineProperty,LU=(t,e)=>IU(t,"name",{value:e,configurable:!0}),jU=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],xn=jU.reduce((t,e)=>{const n=Da(`Primitive.${e}`),r=A.forwardRef((i,s)=>{const{asChild:o,...l}=i,u=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),b.jsx(u,{...l,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function QN(t,e){t&&Tc.flushSync(()=>t.dispatchEvent(e))}LU(QN,"dispatchDiscreteCustomEvent");var PU=Object.defineProperty,zU=(t,e)=>PU(t,"name",{value:e,configurable:!0}),$U=A.forwardRef(zU(function(e,n){return b.jsx(xn.label,{...e,ref:n,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(e.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}})},"Label")),S_=$U,BU=Object.defineProperty,_c=(t,e)=>BU(t,"name",{value:e,configurable:!0}),eO=!!(typeof window<"u"&&window.document&&window.document.createElement);function on(t,e,{checkForDefaultPrevented:n=!0}={}){return _c(function(i){if(t?.(i),n===!1||!i||!i.defaultPrevented)return e?.(i)},"handleEvent")}_c(on,"composeEventHandlers");function VU(t){if(!eO)throw new Error("Cannot access window outside of the DOM");return t?.ownerDocument?.defaultView??window}_c(VU,"getOwnerWindow");function I0(t){if(!eO)throw new Error("Cannot access document outside of the DOM");return t?.ownerDocument??document}_c(I0,"getOwnerDocument");function tO(t,e=!1){const{activeElement:n}=I0(t);if(!n?.nodeName)return null;if(nO(n)&&n.contentDocument)return tO(n.contentDocument.body,e);if(e){const r=n.getAttribute("aria-activedescendant");if(r){const i=I0(n).getElementById(r);if(i)return i}}return n}_c(tO,"getActiveElement");function nO(t){return t.tagName==="IFRAME"}_c(nO,"isFrame");var HU=Object.defineProperty,Hr=(t,e)=>HU(t,"name",{value:e,configurable:!0});function UU(t,e){const n=A.createContext(e);n.displayName=t+"Context";const r=Hr(s=>{const{children:o,...l}=s,u=A.useMemo(()=>l,Object.values(l));return b.jsx(n.Provider,{value:u,children:o})},"Provider");r.displayName=t+"Provider";function i(s,o={}){const{optional:l=!1}=o,u=A.useContext(n);if(u)return u;if(e!==void 0)return e;if(!l)throw new Error(`\`${s}\` must be used within \`${t}\``)}return Hr(i,"useContext"),[r,i]}Hr(UU,"createContext");function Ac(t,e=[]){let n=[];function r(s,o){const l=A.createContext(o);l.displayName=s+"Context";const u=n.length;n=[...n,o];const f=Hr(m=>{const{scope:g,children:y,...x}=m,S=g?.[t]?.[u]||l,k=A.useMemo(()=>x,Object.values(x));return b.jsx(S.Provider,{value:k,children:y})},"Provider");f.displayName=s+"Provider";function h(m,g,y={}){const{optional:x=!1}=y,S=g?.[t]?.[u]||l,k=A.useContext(S);if(k)return k;if(o!==void 0)return o;if(!x)throw new Error(`\`${m}\` must be used within \`${s}\``)}return Hr(h,"useContext"),[f,h]}Hr(r,"createContext");const i=Hr(()=>{const s=n.map(o=>A.createContext(o));return Hr(function(l){const u=l?.[t]||s;return A.useMemo(()=>({[`__scope${t}`]:{...l,[t]:u}}),[l,u])},"useScope")},"createScope");return i.scopeName=t,[r,rO(i,...e)]}Hr(Ac,"createContextScope");function rO(...t){const e=t[0];if(t.length===1)return e;const n=Hr(()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return Hr(function(s){const o=r.reduce((l,{useScope:u,scopeName:f})=>{const m=u(s)[`__scope${f}`];return{...l,...m}},{});return A.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])},"useComposedScopes")},"createScope");return n.scopeName=e.scopeName,n}Hr(rO,"composeContextScopes");var Xn=globalThis?.document?A.useLayoutEffect:()=>{},FU=Object.defineProperty,qU=(t,e)=>FU(t,"name",{value:e,configurable:!0}),k_=Id[" useEffectEvent ".trim().toString()],C_=Id[" useInsertionEffect ".trim().toString()];function iO(t){if(typeof k_=="function")return k_(t);const e=A.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof C_=="function"?C_(()=>{e.current=t}):Xn(()=>{e.current=t}),A.useMemo(()=>((...n)=>e.current?.(...n)),[])}qU(iO,"useEffectEvent");var GU=Object.defineProperty,qd=(t,e)=>GU(t,"name",{value:e,configurable:!0}),WU=Id[" useInsertionEffect ".trim().toString()]||Xn;function Mp({prop:t,defaultProp:e,onChange:n=qd(()=>{},"onChange"),caller:r}){const[i,s,o]=sO({defaultProp:e,onChange:n}),l=t!==void 0,u=l?t:i,f=A.useCallback(h=>{if(l){const m=oO(h)?h(t):h;m!==t&&o.current?.(m)}else s(h)},[l,t,s,o]);return[u,f]}qd(Mp,"useControllableState");function sO({defaultProp:t,onChange:e}){const[n,r]=A.useState(t),i=A.useRef(n),s=A.useRef(e);return WU(()=>{s.current=e},[e]),A.useEffect(()=>{i.current!==n&&(s.current?.(n),i.current=n)},[n,i]),[n,r,s]}qd(sO,"useUncontrolledState");function oO(t){return typeof t=="function"}qd(oO,"isFunction");var E_=Symbol("RADIX:SYNC_STATE");function KU(t,e,n,r){const{prop:i,defaultProp:s,onChange:o,caller:l}=e,u=i!==void 0,f=iO(o),h=[{...n,state:s}];r&&h.push(r);const[m,g]=A.useReducer((k,C)=>{if(C.type===E_)return{...k,state:C.state};const T=t(k,C);return u&&!Object.is(T.state,k.state)&&f(T.state),T},...h),y=m.state,x=A.useRef(y);A.useEffect(()=>{x.current!==y&&(x.current=y,u||f(y))},[y,x,u]);const S=A.useMemo(()=>i!==void 0?{...m,state:i}:m,[m,i]);return A.useEffect(()=>{u&&!Object.is(i,m.state)&&g({type:E_,state:i})},[i,m.state,u]),[S,g]}qd(KU,"useControllableStateReducer");var ZU=Object.defineProperty,YU=(t,e)=>ZU(t,"name",{value:e,configurable:!0});function Sw(t){const[e,n]=A.useState(void 0);return Xn(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let o,l;if("borderBoxSize"in s){const u=s.borderBoxSize,f=Array.isArray(u)?u[0]:u;o=f.inlineSize,l=f.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}YU(Sw,"useSize");var XU=Object.defineProperty,No=(t,e)=>XU(t,"name",{value:e,configurable:!0}),kw="Switch",[JU,ete]=Ac(kw),[QU,Cw]=JU(kw);function aO(t){const{__scopeSwitch:e,checked:n,children:r,defaultChecked:i,disabled:s,form:o,name:l,onCheckedChange:u,required:f,value:h="on",internal_do_not_use_render:m}=t,[g,y]=Mp({prop:n,defaultProp:i??!1,onChange:u,caller:kw}),[x,S]=A.useState(null),[k,C]=A.useState(null),T=A.useRef(!1),[_,R]=A.useReducer(L=>L+1,0),M=x?!!o||!!x.closest("form"):!0,O={checked:g,setChecked:y,disabled:s,control:x,setControl:S,name:l,form:o,value:h,hasConsumerStoppedPropagationRef:T,userInteractionCount:_,onUserInteraction:R,required:f,defaultChecked:i,isFormControl:M,bubbleInput:k,setBubbleInput:C};return b.jsx(QU,{scope:e,...O,children:lO(m)?m(O):r})}No(aO,"SwitchProvider");var eF="SwitchTrigger",tF=A.forwardRef(No(function({__scopeSwitch:e,onClick:n,...r},i){const{control:s,form:o,value:l,disabled:u,checked:f,required:h,setControl:m,setChecked:g,hasConsumerStoppedPropagationRef:y,onUserInteraction:x,isFormControl:S,bubbleInput:k}=Cw(eF,e),C=Xt(i,m),T=A.useRef(f);return A.useEffect(()=>{const _=o?s?.ownerDocument.getElementById(o):s?.form;if(_ instanceof HTMLFormElement){const R=No(()=>g(T.current),"reset");return _.addEventListener("reset",R),()=>_.removeEventListener("reset",R)}},[s,o,g]),b.jsx(xn.button,{type:"button",role:"switch","aria-checked":f,"aria-required":h,"data-state":Ew(f),"data-disabled":u?"":void 0,disabled:u,value:l,...r,ref:C,onClick:on(n,_=>{x(),g(R=>!R),k&&S&&(y.current=_.isPropagationStopped(),y.current||_.stopPropagation())})})},"SwitchTrigger")),nF=A.forwardRef(No(function(e,n){const{__scopeSwitch:r,name:i,checked:s,defaultChecked:o,required:l,disabled:u,value:f,onCheckedChange:h,form:m,...g}=e;return b.jsx(aO,{__scopeSwitch:r,checked:s,defaultChecked:o,disabled:u,required:l,onCheckedChange:h,name:i,form:m,value:f,internal_do_not_use_render:({isFormControl:y})=>b.jsxs(b.Fragment,{children:[b.jsx(tF,{...g,ref:n,__scopeSwitch:r}),y&&b.jsx(oF,{__scopeSwitch:r})]})})},"Switch")),rF="SwitchThumb",iF=A.forwardRef(No(function(e,n){const{__scopeSwitch:r,...i}=e,s=Cw(rF,r);return b.jsx(xn.span,{"data-state":Ew(s.checked),"data-disabled":s.disabled?"":void 0,...i,ref:n})},"SwitchThumb")),sF="SwitchBubbleInput",oF=A.forwardRef(No(function({__scopeSwitch:e,onClick:n,...r},i){const{control:s,hasConsumerStoppedPropagationRef:o,userInteractionCount:l,checked:u,defaultChecked:f,required:h,disabled:m,name:g,value:y,form:x,bubbleInput:S,setBubbleInput:k}=Cw(sF,e),C=Xt(i,k),T=Sw(s),_=A.useRef(!1),R=A.useRef(u),M=A.useRef(l);A.useEffect(()=>{const L=S;if(!L)return;const P=window.HTMLInputElement.prototype,G=Object.getOwnPropertyDescriptor(P,"checked").set,oe=l!==M.current;M.current=l;const K=R.current!==u;R.current=u;const ne=!(oe&&o.current);if(K&&G){_.current=!oe;const re=new Event("click",{bubbles:ne});G.call(L,u),L.dispatchEvent(re),_.current=!1}},[S,u,o,l]);const O=A.useRef(u);return b.jsx(xn.input,{type:"checkbox","aria-hidden":!0,defaultChecked:f??O.current,required:h,disabled:m,name:g,value:y,form:x,...r,tabIndex:-1,ref:C,onClick:on(n,L=>{_.current&&L.stopPropagation()}),style:{...r.style,...T,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"SwitchBubbleInput"));function lO(t){return typeof t=="function"}No(lO,"isFunction");function Ew(t){return t?"checked":"unchecked"}No(Ew,"getState");function cO({name:t,label:e,form:n}){const r=n.watch(t)!==!1;return A.useEffect(()=>{n.register(t)},[n,t]),b.jsx("button",{type:"button",className:"vertebr-visibility-btn","aria-pressed":r,"aria-label":r?`Hide ${e} on storefront`:`Show ${e} on storefront`,title:r?"Visible on storefront":"Hidden on storefront",onClick:()=>n.setValue(t,!r,{shouldDirty:!0,shouldTouch:!0}),children:r?b.jsx(aF,{}):b.jsx(lF,{})})}function aF(){return b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[b.jsx("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"}),b.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function lF(){return b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[b.jsx("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"}),b.jsx("path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242"}),b.jsx("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"}),b.jsx("path",{d:"m2 2 20 20"})]})}const cF=/(cents|priceCents|amountCents)/i,T_=/(price|amount|cost|total|msrp)/i;function Tw(t,e){return cF.test(t)||/cents/i.test(e?.label??"")}function uO(t,e){return Tw(t,e)?!0:T_.test(t)||T_.test(e?.label??"")}function dO(t,e){return e?t/100:t}function uF(t,e){return e?Math.round(t*100):t}function L0(t,e){const n=e?.asCents??!0,r=e?.currency??"USD",i=dO(t,n);try{return new Intl.NumberFormat(void 0,{style:"currency",currency:r,minimumFractionDigits:2,maximumFractionDigits:2}).format(i)}catch{return`$${i.toFixed(2)}`}}function nb(t,e=!0){return typeof t!="number"||!Number.isFinite(t)?"":dO(t,e).toFixed(2)}function dF(t,e=!0){const n=t.replace(/[^0-9.-]/g,"");if(!n||n==="-"||n==="."||n==="-.")return;const r=Number(n);if(Number.isFinite(r))return uF(r,e)}var rb={exports:{}},ib={};var __;function fF(){if(__)return ib;__=1;var t=Dd();function e(m,g){return m===g&&(m!==0||1/m===1/g)||m!==m&&g!==g}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,i=t.useEffect,s=t.useLayoutEffect,o=t.useDebugValue;function l(m,g){var y=g(),x=r({inst:{value:y,getSnapshot:g}}),S=x[0].inst,k=x[1];return s(function(){S.value=y,S.getSnapshot=g,u(S)&&k({inst:S})},[m,y,g]),i(function(){return u(S)&&k({inst:S}),m(function(){u(S)&&k({inst:S})})},[m]),o(y),y}function u(m){var g=m.getSnapshot;m=m.value;try{var y=g();return!n(m,y)}catch{return!0}}function f(m,g){return g()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:l;return ib.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:h,ib}var A_;function fO(){return A_||(A_=1,rb.exports=fF()),rb.exports}var hO=fO();function Mn(t){this.content=t}Mn.prototype={constructor:Mn,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,i=r.find(t),s=r.content.slice();return i==-1?s.push(n||t,e):(s[i+1]=e,n&&(s[i]=n)),new Mn(s)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Mn(n)},addToStart:function(t,e){return new Mn([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Mn(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),s=r.find(t);return i.splice(s==-1?i.length:s,0,e,n),new Mn(i)},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=Mn.from(t),t.size?new Mn(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Mn.from(t),t.size?new Mn(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Mn.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}};Mn.from=function(t){if(t instanceof Mn)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Mn(e)};function pO(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),s=e.child(r);if(i==s){n+=i.nodeSize;continue}if(!i.sameMarkup(s))return n;if(i.isText&&i.text!=s.text){let o=i.text,l=s.text,u=0;for(;o[u]==l[u];u++)n++;return u&&u<o.length&&u<l.length&&yO(o.charCodeAt(u-1))&&gO(o.charCodeAt(u))&&n--,n}if(i.content.size||s.content.size){let o=pO(i.content,s.content,n+1);if(o!=null)return o}n+=i.nodeSize}}function mO(t,e,n,r){for(let i=t.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:n,b:r};let o=t.child(--i),l=e.child(--s),u=o.nodeSize;if(o==l){n-=u,r-=u;continue}if(!o.sameMarkup(l))return{a:n,b:r};if(o.isText&&o.text!=l.text){let f=o.text,h=l.text,m=f.length,g=h.length;for(;m>0&&g>0&&f[m-1]==h[g-1];)m--,g--,n--,r--;return m&&g&&m<f.length&&yO(f.charCodeAt(m-1))&&gO(f.charCodeAt(m))&&(n++,r++),{a:n,b:r}}if(o.content.size||l.content.size){let f=mO(o.content,l.content,n-1,r-1);if(f)return f}n-=u,r-=u}}function gO(t){return t>=56320&&t<57344}function yO(t){return t>=55296&&t<56320}class ue{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,i=0,s){for(let o=0,l=0;l<n;o++){let u=this.content[o],f=l+u.nodeSize;if(f>e&&r(u,i+l,s||null,o)!==!1&&u.content.size){let h=l+1;u.nodesBetween(Math.max(0,e-h),Math.min(u.content.size,n-h),r,i+h)}l=f}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let s="",o=!0;return this.nodesBetween(e,n,(l,u)=>{let f=l.isText?l.text.slice(Math.max(e,u)-u,n-u):l.isLeaf?i?typeof i=="function"?i(l):i:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&f||l.isTextblock)&&r&&(o?o=!1:s+=r),s+=f},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new ue(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let s=0,o=0;o<n;s++){let l=this.content[s],u=o+l.nodeSize;u>e&&((o<e||u>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),i+=l.nodeSize),o=u}return new ue(r,i)}cutByIndex(e,n){return e==n?ue.empty:e==0&&n==this.content.length?this:new ue(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),s=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new ue(i,s)}addToStart(e){return new ue([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new ue(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 i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return pO(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return mO(this,e,n,r)}findIndex(e){if(e==0)return xh(0,e);if(e==this.size)return xh(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 i=this.child(n),s=r+i.nodeSize;if(s>=e)return s==e?xh(n+1,s):xh(n,r);r=s}}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 ue.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return ue.fromArray(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return ue.empty;let n,r=0;for(let i=0;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(n||(n=e.slice(0,i)),n[n.length-1]=s.withText(n[n.length-1].text+s.text)):n&&n.push(s)}return new ue(n||e,r)}static from(e){if(!e)return ue.empty;if(e instanceof ue)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new ue([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}ue.empty=new ue([],0);const sb={index:0,offset:0};function xh(t,e){return sb.index=t,sb.offset=e,sb}function Np(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(!Np(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Np(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let At=class j0{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))n||(n=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(s)}}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&&Np(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 i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}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 j0.none;if(e instanceof j0)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};At.none=[];class xd extends Error{}class Se{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=bO(this.content,e+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new Se(r,this.openStart,this.openEnd)}removeBetween(e,n){return new Se(vO(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 Se.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Se(ue.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.lastChild)i++;return new Se(e,r,i)}}Se.empty=new Se(ue.empty,0,0);function vO(t,e,n){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r),{index:o,offset:l}=t.findIndex(n);if(i==e||s.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,s.copy(vO(s.content,e-i-1,n-i-1)))}function bO(t,e,n,r,i,s){let{index:o,offset:l}=t.findIndex(e),u=t.maybeChild(o);if(l==e||u.isText)return s&&r<=0&&i<=0&&!s.canReplace(o,o,n)?null:t.cut(0,e).append(n).append(t.cut(e));let f=bO(u.content,e-l-1,n,o==0?r-1:0,o==t.childCount-1?i-1:0,u);return f&&t.replaceChild(o,u.copy(f))}function hF(t,e,n){if(n.openStart>t.depth)throw new xd("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new xd("Inconsistent open depths");return xO(t,e,n,0)}function xO(t,e,n,r){let i=t.index(r),s=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let o=xO(t,e,n,r+1);return s.copy(s.content.replaceChild(i,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 Ea(o,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=pF(n,t);return Ea(s,SO(t,o,l,e,r))}else return Ea(s,Op(t,e,r))}function wO(t,e){if(!e.type.compatibleContent(t.type))throw new xd("Cannot join "+e.type.name+" onto "+t.type.name)}function P0(t,e,n){let r=t.node(n);return wO(r,e.node(n)),r}function Ca(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 Xu(t,e,n,r){let i=(e||t).node(n),s=0,o=e?e.index(n):i.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&(Ca(t.nodeAfter,r),s++));for(let l=s;l<o;l++)Ca(i.child(l),r);e&&e.depth==n&&e.textOffset&&Ca(e.nodeBefore,r)}function Ea(t,e){if(!t.type.validContent(e))throw new xd("Invalid content for node "+t.type.name);return t.copy(e)}function SO(t,e,n,r,i){let s=t.depth>i&&P0(t,e,i+1),o=r.depth>i&&P0(n,r,i+1),l=[];return Xu(null,t,i,l),s&&o&&e.index(i)==n.index(i)?(wO(s,o),Ca(Ea(s,SO(t,e,n,r,i+1)),l)):(s&&Ca(Ea(s,Op(t,e,i+1)),l),Xu(e,n,i,l),o&&Ca(Ea(o,Op(n,r,i+1)),l)),Xu(r,null,i,l),new ue(l)}function Op(t,e,n){let r=[];if(Xu(null,t,n,r),t.depth>n){let i=P0(t,e,n+1);Ca(Ea(i,Op(t,e,n+1)),r)}return Xu(e,null,n,r),new ue(r)}function pF(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let s=n-1;s>=0;s--)i=e.node(s).copy(ue.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class wd{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],i=e.child(n);return r?e.child(n).cut(r):i}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],i=n==0?0:this.path[n*3-1]+1;for(let s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return At.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let l=r;r=i,i=l}let s=r.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].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 Dp(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=[],i=0,s=n;for(let o=e;;){let{index:l,offset:u}=o.content.findIndex(s),f=s-u;if(r.push(o,l,i+u),!f||(o=o.child(l),o.isText))break;s=f-1,i+=u+1}return new wd(n,r,s)}static resolveCached(e,n){let r=R_.get(e);if(r)for(let s=0;s<r.elts.length;s++){let o=r.elts[s];if(o.pos==n)return o}else R_.set(e,r=new mF);let i=r.elts[r.i]=wd.resolve(e,n);return r.i=(r.i+1)%gF,i}}class mF{constructor(){this.elts=[],this.i=0}}const gF=12,R_=new WeakMap;class Dp{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 yF=Object.create(null);let ko=class z0{constructor(e,n,r,i=At.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||ue.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,i=0){this.content.nodesBetween(e,n,r,i,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,i){return this.content.textBetween(e,n,r,i)}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&&Np(this.attrs,n||e.defaultAttrs||yF)&&At.sameSet(this.marks,r||At.none)}copy(e=null){return e==this.content?this:new z0(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new z0(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 Se.empty;let i=this.resolve(e),s=this.resolve(n),o=r?0:i.sharedDepth(n),l=i.start(o),f=i.node(o).content.cut(i.pos-l,s.pos-l);return new Se(f,i.depth-o,s.depth-o)}replace(e,n,r){return hF(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+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 i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return wd.resolveCached(this,e)}resolveNoCache(e){return wd.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}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()+")"),kO(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=ue.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),l=o&&o.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let u=i;u<s;u++)if(!this.type.allowsMarks(r.child(u).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),o=s&&s.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=At.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(!At.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);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 i=ue.fromJSON(e,n.content),s=e.nodeType(n.type).create(n.attrs,i,r);return s.type.checkAttrs(s.attrs),s}};ko.prototype.text=void 0;class Ip extends ko{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):kO(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 Ip(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Ip(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 kO(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Ia{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new vF(e,n);if(r.next==null)return Ia.empty;let i=CO(r);r.next&&r.err("Unexpected trailing text");let s=EF(CF(i));return TF(s,r),s}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 i=this;for(let s=n;i&&s<r;s++)i=i.matchType(e.child(s).type);return i}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 i=[this];function s(o,l){let u=o.matchFragment(e,r);if(u&&(!n||u.validEnd))return ue.from(l.map(f=>f.createAndFill()));for(let f=0;f<o.next.length;f++){let{type:h,next:m}=o.next[f];if(!(h.isText||h.hasRequiredAttrs())&&i.indexOf(m)==-1){i.push(m);let g=s(m,l.concat(h));if(g)return g}}return null}return s(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 i=r.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let l=i;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:l,next:u}=s.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in n)&&(!i.type||u.validEnd)&&(r.push({match:l.contentMatch,type:l,via:i}),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 i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)s+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return s}).join(`
|
|
65
|
-
`)}}Ia.empty=new Ia(!0);class vF{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 CO(t){let e=[];do e.push(bF(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function bF(t){let e=[];do e.push(xF(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function xF(t){let e=kF(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=wF(t,e);else break;return e}function M_(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function wF(t,e){let n=M_(t),r=n;return t.eat(",")&&(t.next!="}"?r=M_(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function SF(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let s in n){let o=n[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function kF(t){if(t.eat("(")){let e=CO(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=SF(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 CF(t){let e=[[]];return i(s(t,0),n()),e;function n(){return e.push([])-1}function r(o,l,u){let f={term:u,to:l};return e[o].push(f),f}function i(o,l){o.forEach(u=>u.to=l)}function s(o,l){if(o.type=="choice")return o.exprs.reduce((u,f)=>u.concat(s(f,l)),[]);if(o.type=="seq")for(let u=0;;u++){let f=s(o.exprs[u],l);if(u==o.exprs.length-1)return f;i(f,l=n())}else if(o.type=="star"){let u=n();return r(l,u),i(s(o.expr,u),u),[r(u)]}else if(o.type=="plus"){let u=n();return i(s(o.expr,l),u),i(s(o.expr,u),u),[r(u)]}else{if(o.type=="opt")return[r(l)].concat(s(o.expr,l));if(o.type=="range"){let u=l;for(let f=0;f<o.min;f++){let h=n();i(s(o.expr,u),h),u=h}if(o.max==-1)i(s(o.expr,u),u);else for(let f=o.min;f<o.max;f++){let h=n();r(u,h),i(s(o.expr,u),h),u=h}return[r(u)]}else{if(o.type=="name")return[r(l,void 0,o.value)];throw new Error("Unknown expr type")}}}}function EO(t,e){return e-t}function N_(t,e){let n=[];return r(e),n.sort(EO);function r(i){let s=t[i];if(s.length==1&&!s[0].term)return r(s[0].to);n.push(i);for(let o=0;o<s.length;o++){let{term:l,to:u}=s[o];!l&&n.indexOf(u)==-1&&r(u)}}}function EF(t){let e=Object.create(null);return n(N_(t,0));function n(r){let i=[];r.forEach(o=>{t[o].forEach(({term:l,to:u})=>{if(!l)return;let f;for(let h=0;h<i.length;h++)i[h][0]==l&&(f=i[h][1]);N_(t,u).forEach(h=>{f||i.push([l,f=[]]),f.indexOf(h)==-1&&f.push(h)})})});let s=e[r.join(",")]=new Ia(r.indexOf(t.length-1)>-1);for(let o=0;o<i.length;o++){let l=i[o][1].sort(EO);s.next.push({type:i[o][0],next:e[l.join(",")]||n(l)})}return s}}function TF(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],s=!i.validEnd,o=[];for(let l=0;l<i.next.length;l++){let{type:u,next:f}=i.next[l];o.push(u.name),s&&!(u.isText||u.hasRequiredAttrs())&&(s=!1),r.indexOf(f)==-1&&r.push(f)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function TO(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 _O(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let s=t[r];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function AO(t,e,n,r){for(let i in e)if(!(i in t))throw new RangeError(`Unsupported attribute ${i} for ${n} of type ${r}`);for(let i in t)t[i].validate&&t[i].validate(e[i])}function RO(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new AF(t,r,e[r]);return n}let O_=class MO{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=RO(e,r.attrs),this.defaultAttrs=TO(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==Ia.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:_O(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new ko(this,this.computeAttrs(e),ue.from(n),At.setFrom(r))}createChecked(e=null,n,r){return n=ue.from(n),this.checkContent(n),new ko(this,this.computeAttrs(e),n,At.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=ue.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let i=this.contentMatch.matchFragment(n),s=i&&i.fillBefore(ue.empty,!0);return s?new ko(this,e,n.append(s),At.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){AO(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:At.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,o)=>r[s]=new MO(s,n,o));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function _F(t,e,n){let r=n.split("|");return i=>{let s=i===null?"null":typeof i;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${s}`)}}class AF{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?_F(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Vm{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=RO(e,i.attrs),this.excluded=null;let s=TO(this.attrs);this.instance=s?new At(this,s):null}create(e=null){return!e&&this.instance?this.instance:new At(this,_O(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new Vm(s,i++,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){AO(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class NO{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=Mn.from(e.nodes),n.marks=Mn.from(e.marks||{}),this.nodes=O_.compile(this.spec.nodes,this),this.marks=Vm.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",l=s.spec.marks;if(s.contentMatch=r[o]||(r[o]=Ia.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=l=="_"?null:l?D_(this,l.split(" ")):l==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:D_(this,o.split(" "))}this.nodeFromJSON=i=>ko.fromJSON(this,i),this.markFromJSON=i=>At.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof O_){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,i)}text(e,n){let r=this.nodes.text;return new Ip(r,r.defaultAttrs,e,At.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 D_(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],s=t.marks[i],o=s;if(s)n.push(s);else for(let l in t.marks){let u=t.marks[l];(i=="_"||u.spec.group&&u.spec.group.split(" ").indexOf(i)>-1)&&n.push(o=u)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function RF(t){return t.tag!=null}function MF(t){return t.style!=null}class ys{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(RF(i))this.tags.push(i);else if(MF(i)){let s=/[^=]*/.exec(i.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,n={}){let r=new L_(this,n,!1);return r.addAll(e,At.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new L_(this,n,!0);return r.addAll(e,At.none,n.from,n.to),Se.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(DF(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||n.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,n,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],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 u=o.getAttrs(n);if(u===!1)continue;o.attrs=u||void 0}return o}}}static schemaRules(e){let n=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o<n.length;o++){let l=n[o];if((l.priority==null?50:l.priority)<s)break}n.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{r(o=j_(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{r(o=j_(o)),o.node||o.ignore||o.mark||(o.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new ys(e,ys.schemaRules(e)))}}const OO={address:!0,article:!0,aside:!0,blockquote:!0,body:!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},NF={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},DO={ol:!0,ul:!0},Sd=1,$0=2,Ju=4;function I_(t,e,n){return e!=null?(e?Sd:0)|(e==="full"?$0:0):t&&t.whitespace=="pre"?Sd|$0:n&~Ju}class wh{constructor(e,n,r,i,s,o){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=At.none,this.match=s||(o&Ju?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(ue.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Sd)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let n=ue.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(ue.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&&!OO.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class L_{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,s,o=I_(null,n.preserveWhitespace,0)|(r?Ju:0);i?s=new wh(i.type,i.attrs,At.none,!0,n.topMatch||i.type.contentMatch,o):r?s=new wh(null,null,At.none,!0,null,o):s=new wh(e.schema.topNodeType,null,At.none,!0,null,o),this.nodes=[s],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,i=this.top,s=i.options&$0?"full":this.localPreserveWS||(i.options&Sd)>0,{schema:o}=this.parser;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)if(s==="full")r=r.replace(/\r\n?/g,`
|
|
66
|
-
`);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let u=0;u<l.length;u++)u&&this.insertNode(o.linebreakReplacement.create(),n,!0),l[u]&&this.insertNode(o.text(l[u]),n,!/\S/.test(l[u]));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=i.content[i.content.length-1],u=e.previousSibling;(!l||u&&u.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 i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),l;DO.hasOwnProperty(o)&&this.parser.normalizeLists&&OF(e);let u=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(u?u.ignore:NF.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,n);else if(!u||u.skip||u.closeParent){u&&u.closeParent?this.open=Math.max(0,this.open-1):u&&u.skip.nodeType&&(e=u.skip);let f,h=this.needsBlock;if(OO.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),f=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let m=u&&u.skip?n:this.readStyles(e,n);m&&this.addAll(e,m),f&&this.sync(s),this.needsBlock=h}else{let f=this.readStyles(e,n);f&&this.addElementByRule(e,u,f,u.consuming===!1?l:void 0)}this.localPreserveWS=i}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
67
|
-
`),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 i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],o=r.getPropertyValue(s);if(o)for(let l=void 0;;){let u=this.parser.matchStyle(s,o,this,l);if(!u)break;if(u.ignore)return null;if(u.clearMark?n=n.filter(f=>!u.clearMark(f)):n=n.concat(this.parser.schema.marks[u.mark].create(u.attrs)),u.consuming===!1)l=u;else break}}return n}addElementByRule(e,n,r,i){let s,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 u=this.enter(o,n.attrs||null,r,n.preserveWhitespace);u&&(s=!0,r=u)}else{let u=this.parser.schema.marks[n.mark];r=r.concat(u.create(n.attrs))}let l=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(u=>this.insertNode(u,r,!1));else{let u=e;typeof n.contentElement=="string"?u=e.querySelector(n.contentElement):typeof n.contentElement=="function"?u=n.contentElement(e):n.contentElement&&(u=n.contentElement),this.findAround(e,u,!0),this.addAll(u,r),this.findAround(e,u,!1)}s&&this.sync(l)&&this.open--}addAll(e,n,r,i){let s=r||0;for(let o=r?e.childNodes[r]:e.firstChild,l=i==null?null:e.childNodes[i];o!=l;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,n);this.findAtPoint(e,s)}findPlace(e,n,r){let i,s;for(let o=this.open,l=0;o>=0;o--){let u=this.nodes[o],f=u.findWrapping(e);if(f&&(!i||i.length>f.length+l)&&(i=f,s=u,!f.length))break;if(u.solid){if(r)break;l+=2}}if(!i)return null;this.sync(s);for(let o=0;o<i.length;o++)n=this.enterInner(i[o],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(n=this.enterInner(s,null,n))}let i=this.findPlace(e,n,r);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let o=At.none;for(let l of i.concat(e.marks))(s.type?s.type.allowsMarkType(l.type):P_(l.type,e.type))&&(o=l.addToSet(o));return s.content.push(e.mark(o)),!0}return!1}enter(e,n,r,i){let s=this.findPlace(e.create(n),r,!1);return s&&(s=this.enterInner(e,n,r,!0,i)),s}enterInner(e,n,r,i=!1,s){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let l=I_(e,s,o.options);o.options&Ju&&o.content.length==0&&(l|=Ju);let u=At.none;return r=r.filter(f=>(o.type?o.type.allowsMarkType(f.type):P_(f.type,e))?(u=f.addToSet(u),!1):!0),this.nodes.push(new wh(e,n,u,i,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|=Sd)}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 i=r.length-1;i>=0;i--)e+=r[i].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 i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].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,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),o=(l,u)=>{for(;l>=0;l--){let f=n[l];if(f==""){if(l==n.length-1||l==0)continue;for(;u>=s;u--)if(o(l-1,u))return!0;return!1}else{let h=u>0||u==0&&i?this.nodes[u].type:r&&u>=s?r.node(u-s).type:null;if(!h||h.name!=f&&!h.isInGroup(f))return!1;u--}}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;if(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 OF(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&DO.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function DF(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function j_(t){let e={};for(let n in t)e[n]=t[n];return e}function P_(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let s=[],o=l=>{s.push(l);for(let u=0;u<l.edgeCount;u++){let{type:f,next:h}=l.edge(u);if(f==e||s.indexOf(h)<0&&o(h))return!0}};if(o(i.contentMatch))return!0}}class Wa{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=Sh(n).createDocumentFragment());let i=r,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let l=0,u=0;for(;l<s.length&&u<o.marks.length;){let f=o.marks[u];if(!this.marks[f.type.name]){u++;continue}if(!f.eq(s[l][0])||f.type.spec.spanning===!1)break;l++,u++}for(;l<s.length;)i=s.pop()[1];for(;u<o.marks.length;){let f=o.marks[u++],h=this.serializeMark(f,o.isInline,n);h&&(s.push([f,i]),i.appendChild(h.dom),i=h.contentDOM||h.dom)}}i.appendChild(this.serializeNodeInner(o,n))}),r}serializeNodeInner(e,n){if(e.isText)return Sh(n).createTextNode(e.text);let{dom:r,contentDOM:i}=rp(Sh(n),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,i)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let i=e.marks.length-1;i>=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,n);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&rp(Sh(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return typeof n=="string"?{dom:e.createTextNode(n)}:rp(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Wa(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=z_(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return z_(e.marks)}}function z_(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Sh(t){return t.document||window.document}const $_=new WeakMap;function IF(t){let e=$_.get(t);return e===void 0&&$_.set(t,e=LF(t)),e}function LF(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 i=0;i<r.length;i++)n(r[i]);else for(let i in r)n(r[i])}return n(t),e}function rp(t,e,n,r){if(e.nodeType==1)return{dom:e};if(e.dom&&e.dom.nodeType==1)return e;let i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=IF(r))&&s.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=i.indexOf(" ");o>0&&(n=i.slice(0,o),i=i.slice(o+1));let l,u=n?t.createElementNS(n,i):t.createElement(i),f=e[1],h=1;if(f&&typeof f=="object"&&f.nodeType==null&&!Array.isArray(f)){h=2;for(let m in f)if(f[m]!=null){let g=m.indexOf(" ");g>0?u.setAttributeNS(m.slice(0,g),m.slice(g+1),f[m]):m=="style"&&u.style?u.style.cssText=f[m]:u.setAttribute(m,f[m])}}for(let m=h;m<e.length;m++){let g=e[m];if(g===0){if(m<e.length-1||m>h)throw new RangeError("Content hole must be the only child of its parent node");return{dom:u,contentDOM:u}}else if(typeof g=="string")u.appendChild(t.createTextNode(g));else{let{dom:y,contentDOM:x}=rp(t,g,n,r);if(u.appendChild(y),x){if(l)throw new RangeError("Multiple content holes");l=x}}}return{dom:u,contentDOM:l}}const IO=65535,LO=Math.pow(2,16);function jF(t,e){return t+e*LO}function B_(t){return t&IO}function PF(t){return(t-(t&IO))/LO}const jO=1,PO=2,ip=4,zO=8;class B0{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&zO)>0}get deletedBefore(){return(this.delInfo&(jO|ip))>0}get deletedAfter(){return(this.delInfo&(PO|ip))>0}get deletedAcross(){return(this.delInfo&ip)>0}}class kr{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&kr.empty)return kr.empty}recover(e){let n=0,r=B_(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+PF(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 i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let u=this.ranges[l]-(this.inverted?i:0);if(u>e)break;let f=this.ranges[l+s],h=this.ranges[l+o],m=u+f;if(e<=m){let g=f?e==u?-1:e==m?1:n:n,y=u+i+(g<0?0:h);if(r)return y;let x=e==(n<0?u:m)?null:jF(l/3,e-u),S=e==u?PO:e==m?jO:ip;return(n<0?e!=u:e!=m)&&(S|=zO),new B0(y,S,x)}i+=h-f}return r?e+i:new B0(e+i,0,null)}touches(e,n){let r=0,i=B_(n),s=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let u=this.ranges[l]-(this.inverted?r:0);if(u>e)break;let f=this.ranges[l+s],h=u+f;if(e<=h&&l==i*3)return!0;r+=this.ranges[l+o]-f}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],l=o-(this.inverted?s:0),u=o+(this.inverted?0:s),f=this.ranges[i+n],h=this.ranges[i+r];e(l,l+f,u,u+h),s+=h-f}}invert(){return new kr(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?kr.empty:new kr(e<0?[0,-e,0]:[0,0,e])}}kr.empty=new kr([]);class kd{constructor(e,n,r=0,i=e?e.length:0){this.mirror=n,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new kd(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 i=e.getMirror(n);this.appendMap(e._maps[n],i!=null&&i<n?r+i: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 i=e.getMirror(n);this.appendMap(e._maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new kd;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 i=0;for(let s=this.from;s<this.to;s++){let o=this._maps[s],l=o.mapResult(e,n);if(l.recover!=null){let u=this.getMirror(s);if(u!=null&&u>s&&u<this.to){s=u,e=this._maps[u].recover(l.recover);continue}}i|=l.delInfo,e=l.pos}return r?e:new B0(e,i,null)}}const ob=Object.create(null);class Fn{getMap(){return kr.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=ob[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 ob)throw new RangeError("Duplicate use of step JSON ID "+e);return ob[e]=n,n.prototype.jsonID=e,n}}class ln{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new ln(e,null)}static fail(e){return new ln(null,e)}static fromReplace(e,n,r,i){try{return ln.ok(e.replace(n,r,i))}catch(s){if(s instanceof xd)return ln.fail(s.message);throw s}}}function _w(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(_w(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return ue.fromArray(r)}class yo extends Fn{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),i=r.node(r.sharedDepth(this.to)),s=new Se(_w(n.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),n.openStart,n.openEnd);return ln.fromReplace(e,this.from,this.to,s)}invert(){return new ci(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 yo(n.pos,r.pos,this.mark)}merge(e){return e instanceof yo&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new yo(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 yo(n.from,n.to,e.markFromJSON(n.mark))}}Fn.jsonID("addMark",yo);class ci extends Fn{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 Se(_w(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return ln.fromReplace(e,this.from,this.to,r)}invert(){return new yo(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 ci(n.pos,r.pos,this.mark)}merge(e){return e instanceof ci&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ci(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 ci(n.from,n.to,e.markFromJSON(n.mark))}}Fn.jsonID("removeMark",ci);class vo extends Fn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return ln.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return ln.fromReplace(e,this.pos,this.pos+1,new Se(ue.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 i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new vo(this.pos,n.marks[i]);return new vo(this.pos,this.mark)}}return new La(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new vo(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 vo(n.pos,e.markFromJSON(n.mark))}}Fn.jsonID("addNodeMark",vo);class La extends Fn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return ln.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return ln.fromReplace(e,this.pos,this.pos+1,new Se(ue.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new vo(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new La(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 La(n.pos,e.markFromJSON(n.mark))}}Fn.jsonID("removeNodeMark",La);class an extends Fn{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&V0(e,this.from,this.to)?ln.fail("Structure replace would overwrite content"):ln.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new kr([this.from,this.to-this.from,this.slice.size])}invert(e){return new an(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&&an.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new an(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof an)||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?Se.empty:new Se(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new an(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?Se.empty:new Se(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new an(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 an(n.from,n.to,Se.fromJSON(e,n.slice),!!n.structure)}}an.MAP_BIAS=1;Fn.jsonID("replace",an);class vn extends Fn{constructor(e,n,r,i,s,o,l=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=l}apply(e){if(this.structure&&(V0(e,this.from,this.gapFrom)||V0(e,this.gapTo,this.to)))return ln.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return ln.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?ln.fromReplace(e,this.from,this.to,r):ln.fail("Content does not fit in gap")}getMap(){return new kr([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 vn(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),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new vn(n.pos,r.pos,i,s,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 vn(n.from,n.to,n.gapFrom,n.gapTo,Se.fromJSON(e,n.slice),n.insert,!!n.structure)}}Fn.jsonID("replaceAround",vn);function V0(t,e,n){let r=t.resolve(e),i=n-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function zF(t,e,n,r){let i=[],s=[],o,l;t.doc.nodesBetween(e,n,(u,f,h)=>{if(!u.isInline)return;let m=u.marks;if(!r.isInSet(m)&&h.type.allowsMarkType(r.type)){let g=Math.max(f,e),y=Math.min(f+u.nodeSize,n),x=r.addToSet(m);for(let S=0;S<m.length;S++)m[S].isInSet(x)||(o&&o.to==g&&o.mark.eq(m[S])?o.to=y:i.push(o=new ci(g,y,m[S])));l&&l.to==g?l.to=y:s.push(l=new yo(g,y,r))}}),i.forEach(u=>t.step(u)),s.forEach(u=>t.step(u))}function $F(t,e,n,r){let i=[],s=0;t.doc.nodesBetween(e,n,(o,l)=>{if(!o.isInline)return;s++;let u=null;if(r instanceof Vm){let f=o.marks,h;for(;h=r.isInSet(f);)(u||(u=[])).push(h),f=h.removeFromSet(f)}else r?r.isInSet(o.marks)&&(u=[r]):u=o.marks;if(u&&u.length){let f=Math.min(l+o.nodeSize,n);for(let h=0;h<u.length;h++){let m=u[h],g;for(let y=0;y<i.length;y++){let x=i[y];x.step==s-1&&m.eq(i[y].style)&&(g=x)}g?(g.to=f,g.step=s):i.push({style:m,from:Math.max(l,e),to:f,step:s})}}}),i.forEach(o=>t.step(new ci(o.from,o.to,o.style)))}function Aw(t,e,n,r=n.contentMatch,i=!0){let s=t.doc.nodeAt(e),o=[],l=e+1;for(let u=0;u<s.childCount;u++){let f=s.child(u),h=l+f.nodeSize,m=r.matchType(f.type);if(!m)o.push(new an(l,h,Se.empty));else{r=m;for(let g=0;g<f.marks.length;g++)n.allowsMarkType(f.marks[g].type)||t.step(new ci(l,h,f.marks[g]));if(i&&f.isText&&n.whitespace!="pre"){let g,y=/\r?\n|\r/g,x;for(;g=y.exec(f.text);)x||(x=new Se(ue.from(n.schema.text(" ",n.allowedMarks(f.marks))),0,0)),o.push(new an(l+g.index,l+g.index+g[0].length,x))}}l=h}if(!r.validEnd){let u=r.fillBefore(ue.empty,!0);t.replace(l,l,new Se(u,0,0))}for(let u=o.length-1;u>=0;u--)t.step(o[u])}function BF(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Rc(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,s=0;;--r){let o=t.$from.node(r),l=t.$from.index(r)+i,u=t.$to.indexAfter(r)-s;if(r<t.depth&&o.canReplace(l,u,n))return r;if(r==0||o.type.spec.isolating||!BF(o,l,u))break;l&&(i=1),u<o.childCount&&(s=1)}return null}function VF(t,e,n){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),l=i.after(s+1),u=o,f=l,h=ue.empty,m=0;for(let x=s,S=!1;x>n;x--)S||r.index(x)>0?(S=!0,h=ue.from(r.node(x).copy(h)),m++):u--;let g=ue.empty,y=0;for(let x=s,S=!1;x>n;x--)S||i.after(x+1)<i.end(x)?(S=!0,g=ue.from(i.node(x).copy(g)),y++):f++;t.step(new vn(u,f,o,l,new Se(h.append(g),m,y),h.size-m,!0))}function Rw(t,e,n=null,r=t){let i=HF(t,e),s=i&&UF(r,e);return s?i.map(V_).concat({type:e,attrs:n}).concat(s.map(V_)):null}function V_(t){return{type:t,attrs:null}}function HF(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.contentMatchAt(r).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return n.canReplaceWith(r,i,o)?s:null}function UF(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.child(r),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let u=(o.length?o[o.length-1]:e).contentMatch;for(let f=r;u&&f<i;f++)u=u.matchType(n.child(f).type);return!u||!u.validEnd?null:o}function FF(t,e,n){let r=ue.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=ue.from(n[o].type.create(n[o].attrs,r))}let i=e.start,s=e.end;t.step(new vn(i,s,i,s,new Se(r,0,0),n.length,!0))}function qF(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=t.steps.length;t.doc.nodesBetween(e,n,(o,l)=>{let u=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,u)&&GF(t.doc,t.mapping.slice(s).map(l),r)){let f=null;if(r.schema.linebreakReplacement){let y=r.whitespace=="pre",x=!!r.contentMatch.matchType(r.schema.linebreakReplacement);y&&!x?f=!1:!y&&x&&(f=!0)}f===!1&&BO(t,o,l,s),Aw(t,t.mapping.slice(s).map(l,1),r,void 0,f===null);let h=t.mapping.slice(s),m=h.map(l,1),g=h.map(l+o.nodeSize,1);return t.step(new vn(m,g,m+1,g-1,new Se(ue.from(r.create(u,null,o.marks)),0,0),1,!0)),f===!0&&$O(t,o,l,s),!1}})}function $O(t,e,n,r){e.forEach((i,s)=>{if(i.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(i.text);){let u=t.mapping.slice(r).map(n+1+s+o.index);t.replaceWith(u,u+1,e.type.schema.linebreakReplacement.create())}}})}function BO(t,e,n,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+s);t.replaceWith(o,o+1,e.type.schema.text(`
|
|
68
|
-
`))}})}function GF(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function WF(t,e,n,r,i){let s=t.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let o=n.create(r,null,i||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,o);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new vn(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new Se(ue.from(o),0,0),1,!0))}function vs(t,e,n=1,r){let i=t.resolve(e),s=i.depth-n,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let f=i.depth-1,h=n-2;f>s;f--,h--){let m=i.node(f),g=i.index(f);if(m.type.spec.isolating)return!1;let y=m.content.cutByIndex(g,m.childCount),x=r&&r[h+1];x&&(y=y.replaceChild(0,x.type.create(x.attrs)));let S=r&&r[h]||m;if(!m.canReplace(g+1,m.childCount)||!S.type.validContent(y))return!1}let l=i.indexAfter(s),u=r&&r[0];return i.node(s).canReplaceWith(l,l,u?u.type:i.node(s+1).type)}function KF(t,e,n=1,r){let i=t.doc.resolve(e),s=ue.empty,o=ue.empty;for(let l=i.depth,u=i.depth-n,f=n-1;l>u;l--,f--){s=ue.from(i.node(l).copy(s));let h=r&&r[f];o=ue.from(h?h.type.create(h.attrs,o):i.node(l).copy(o))}t.step(new an(e,e,new Se(s.append(o),n,n),!0))}function Bo(t,e){let n=t.resolve(e),r=n.index();return VO(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function ZF(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),o=s.type==r?t.type.schema.nodes.text:s.type;if(n=n.matchType(o),!n||!t.type.allowsMarks(s.marks))return!1}return n.validEnd}function VO(t,e){return!!(t&&e&&!t.isLeaf&&ZF(t,e))}function Hm(t,e,n=-1){let r=t.resolve(e);for(let i=r.depth;;i--){let s,o,l=r.index(i);if(i==r.depth?(s=r.nodeBefore,o=r.nodeAfter):n>0?(s=r.node(i+1),l++,o=r.node(i).maybeChild(l)):(s=r.node(i).maybeChild(l-1),o=r.node(i+1)),s&&!s.isTextblock&&VO(s,o)&&r.node(i).canReplace(l,l+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function YF(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,s=t.doc.resolve(e-n),o=s.node().type;if(i&&o.inlineContent){let h=o.whitespace=="pre",m=!!o.contentMatch.matchType(i);h&&!m?r=!1:!h&&m&&(r=!0)}let l=t.steps.length;if(r===!1){let h=t.doc.resolve(e+n);BO(t,h.node(),h.before(),l)}o.inlineContent&&Aw(t,e+n-1,o,s.node().contentMatchAt(s.index()),r==null);let u=t.mapping.slice(l),f=u.map(e-n);if(t.step(new an(f,u.map(e+n,-1),Se.empty,!0)),r===!0){let h=t.doc.resolve(f);$O(t,h.node(),h.before(),t.steps.length)}return t}function XF(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 i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,n))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,n))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function HO(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let s=0;s<n.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.size?2:1);s++)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,u=r.index(o)+(l>0?1:0),f=r.node(o),h=!1;if(s==1)h=f.canReplace(u,u,i);else{let m=f.contentMatchAt(u).findWrapping(i.firstChild.type);h=m&&f.canReplaceWith(u,u,m[0])}if(h)return l==0?r.pos:l<0?r.before(o+1):r.after(o+1)}return null}function Um(t,e,n=e,r=Se.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return UO(i,s,r)?new an(e,n,r):new JF(i,s,r).fit()}function UO(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class JF{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=ue.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=ue.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let f=this.findFittable();f?this.placeNodes(f):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,o=r.depth,l=i.depth;for(;o&&l&&s.childCount==1;)s=s.firstChild.content,o--,l--;let u=new Se(s,o,l);return e>-1?new vn(r.pos,e,this.$to.pos,this.$to.end(),u,n):u.size||r.pos!=this.$to.pos?new an(r.pos,i.pos,u):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=n.firstChild;if(n.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}n=s.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=ab(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let l=this.depth;l>=0;l--){let{type:u,match:f}=this.frontier[l],h,m=null;if(n==1&&(o?f.matchType(o.type)||(m=f.fillBefore(ue.from(o),!1)):s&&u.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:l,parent:s,inject:m};if(n==2&&o&&(h=f.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:l,parent:s,wrap:h};if(s&&f.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=ab(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new Se(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=ab(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new Se($u(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new Se($u(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:s}){for(;this.depth>n;)this.closeFrontierNode();if(s)for(let S=0;S<s.length;S++)this.openFrontierNode(s[S]);let o=this.unplaced,l=r?r.content:o.content,u=o.openStart-e,f=0,h=[],{match:m,type:g}=this.frontier[n];if(i){for(let S=0;S<i.childCount;S++)h.push(i.child(S));m=m.matchFragment(i)}let y=l.size+e-(o.content.size-o.openEnd);for(;f<l.childCount;){let S=l.child(f),k=m.matchType(S.type);if(!k)break;f++,(f>1||u==0||S.content.size)&&(m=k,h.push(FO(S.mark(g.allowedMarks(S.marks)),f==1?u:0,f==l.childCount?y:-1)))}let x=f==l.childCount;x||(y=-1),this.placed=Bu(this.placed,n,ue.from(h)),this.frontier[n].match=m,x&&y<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let S=0,k=l;S<y;S++){let C=k.lastChild;this.frontier.push({type:C.type,match:C.contentMatchAt(C.childCount)}),k=C.content}this.unplaced=x?e==0?Se.empty:new Se($u(o.content,e-1,1),e-1,y<0?o.openEnd:e-1):new Se($u(o.content,e,f),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!lb(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,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],s=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),o=lb(e,n,i,r,s);if(o){for(let l=n-1;l>=0;l--){let{match:u,type:f}=this.frontier[l],h=lb(e,l,f,u,!0);if(!h||h.childCount)continue e}return{depth:n,fit:o,move:s?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=Bu(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Bu(this.placed,this.depth,ue.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(ue.empty,!0);n.childCount&&(this.placed=Bu(this.placed,this.frontier.length,n))}}function $u(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy($u(t.firstChild.content,e-1,n)))}function Bu(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Bu(t.lastChild.content,e-1,n)))}function ab(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function FO(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,FO(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(ue.empty,!0)))),t.copy(r)}function lb(t,e,n,r,i){let s=t.node(e),o=i?t.indexAfter(e):t.index(e);if(o==s.childCount&&!n.compatibleContent(s.type))return null;let l=r.fillBefore(s.content,!0,o);return l&&!QF(n,s.content,o)?l:null}function QF(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function e4(t){return t.spec.defining||t.spec.definingForContent}function t4(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),s=t.doc.resolve(n);if(UO(i,s,r))return t.step(new an(e,n,r));let o=GO(i,s);o[o.length-1]==0&&o.pop();let l=-(i.depth+1);o.unshift(l);for(let g=i.depth,y=i.pos-1;g>0;g--,y--){let x=i.node(g).type.spec;if(x.defining||x.definingAsContext||x.isolating)break;o.indexOf(g)>-1?l=g:i.before(g)==y&&o.splice(1,0,-g)}let u=o.indexOf(l),f=[],h=r.openStart;for(let g=r.content,y=0;;y++){let x=g.firstChild;if(f.push(x),y==r.openStart)break;g=x.content}for(let g=h-1;g>=0;g--){let y=f[g],x=e4(y.type);if(x&&!y.sameMarkup(i.node(Math.abs(l)-1)))h=g;else if(x||!y.type.isTextblock)break}for(let g=r.openStart;g>=0;g--){let y=(g+h+1)%(r.openStart+1),x=f[y];if(x)for(let S=0;S<o.length;S++){let k=o[(S+u)%o.length],C=!0;k<0&&(C=!1,k=-k);let T=i.node(k-1),_=i.index(k-1);if(T.canReplaceWith(_,_,x.type,x.marks))return t.replace(i.before(k),C?s.after(k):n,new Se(qO(r.content,0,r.openStart,y),y,r.openEnd))}}let m=t.steps.length;for(let g=o.length-1;g>=0&&(t.replace(e,n,r),!(t.steps.length>m));g--){let y=o[g];y<0||(e=i.before(y),n=s.after(y))}}function qO(t,e,n,r,i){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(qO(s.content,e+1,n,r,s)))}if(e>r){let s=i.contentMatchAt(0),o=s.fillBefore(t).append(t);t=o.append(s.matchFragment(o).fillBefore(ue.empty,!0))}return t}function n4(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=XF(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new Se(ue.from(r),0,0))}function r4(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let o=r.sharedDepth(n),l=!1;for(let u=r.depth;u>o;u--)r.node(u).type.spec.isolating&&(l=!0);for(let u=i.depth;u>o;u--)i.node(u).type.spec.isolating&&(l=!0);if(!l){for(let u=r.depth;u>0&&e==r.start(u);u--)e=r.before(u);for(let u=i.depth;u>0&&n==i.start(u);u--)n=i.before(u);r=t.doc.resolve(e),i=t.doc.resolve(n)}}let s=GO(r,i);for(let o=0;o<s.length;o++){let l=s[o],u=o==s.length-1;if(u&&l==0||r.node(l).type.contentMatch.validEnd)return t.delete(r.start(l),i.end(l));if(l>0&&(u||r.node(l-1).canReplace(r.index(l-1),i.indexAfter(l-1))))return t.delete(r.before(l),i.after(l))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&i.end(o)-n!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return t.delete(r.before(o),n);t.delete(e,n)}function GO(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let s=t.start(i);if(s<t.pos-(t.depth-i)||e.end(i)>e.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&n.push(i)}return n}class tc extends Fn{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 ln.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return ln.fromReplace(e,this.pos,this.pos+1,new Se(ue.from(i),0,n.isLeaf?0:1))}getMap(){return kr.empty}invert(e){return new tc(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 tc(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 tc(n.pos,n.attr,n.value)}}Fn.jsonID("attr",tc);class Cd extends Fn{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return ln.ok(r)}getMap(){return kr.empty}invert(e){return new Cd(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 Cd(n.attr,n.value)}}Fn.jsonID("docAttr",Cd);let hc=class extends Error{};hc=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};hc.prototype=Object.create(Error.prototype);hc.prototype.constructor=hc;hc.prototype.name="TransformError";class Mw{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new kd}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new hc(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 i=this.mapping.maps[r];r&&(e=i.map(e,1),n=i.map(n,-1)),i.forEach((s,o,l,u)=>{e=Math.min(e,l),n=Math.max(n,u)})}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=Se.empty){let i=Um(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new Se(ue.from(r),0,0))}delete(e,n){return this.replace(e,n,Se.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return t4(this,e,n,r),this}replaceRangeWith(e,n,r){return n4(this,e,n,r),this}deleteRange(e,n){return r4(this,e,n),this}lift(e,n){return VF(this,e,n),this}join(e,n=1){return YF(this,e,n),this}wrap(e,n){return FF(this,e,n),this}setBlockType(e,n=e,r,i=null){return qF(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return WF(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new tc(e,n,r)),this}setDocAttribute(e,n){return this.step(new Cd(e,n)),this}addNodeMark(e,n){return this.step(new vo(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 At)n.isInSet(r.marks)&&this.step(new La(e,n));else{let i=r.marks,s,o=[];for(;s=n.isInSet(i);)o.push(new La(e,s)),i=s.removeFromSet(i);for(let l=o.length-1;l>=0;l--)this.step(o[l])}return this}split(e,n=1,r){return KF(this,e,n,r),this}addMark(e,n,r){return zF(this,e,n,r),this}removeMark(e,n,r){return $F(this,e,n,r),this}clearIncompatible(e,n,r){return Aw(this,e,n,r),this}}const cb=Object.create(null);class Ue{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new WO(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=Se.empty){let r=n.content.lastChild,i=null;for(let l=0;l<n.openEnd;l++)i=r,r=r.lastChild;let s=e.steps.length,o=this.ranges;for(let l=0;l<o.length;l++){let{$from:u,$to:f}=o[l],h=e.mapping.slice(s);e.replaceRange(h.map(u.pos),h.map(f.pos),l?Se.empty:n),l==0&&F_(e,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:o,$to:l}=i[s],u=e.mapping.slice(r),f=u.map(o.pos),h=u.map(l.pos);s?e.deleteRange(f,h):(e.replaceRangeWith(f,h,n),F_(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new Ie(e):Wl(e.node(0),e.parent,e.pos,e.index(),n,r);if(i)return i;for(let s=e.depth-1;s>=0;s--){let o=n<0?Wl(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):Wl(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Er(e.node(0))}static atStart(e){return Wl(e,e,0,0,1)||new Er(e)}static atEnd(e){return Wl(e,e,e.content.size,e.childCount,-1)||new Er(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=cb[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 cb)throw new RangeError("Duplicate use of selection JSON ID "+e);return cb[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Ie.between(this.$anchor,this.$head).getBookmark()}}Ue.prototype.visible=!0;class WO{constructor(e,n){this.$from=e,this.$to=n}}let H_=!1;function U_(t){!H_&&!t.parent.inlineContent&&(H_=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Ie extends Ue{constructor(e,n=e){U_(e),U_(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 Ue.near(r);let i=e.resolve(n.map(this.anchor));return new Ie(i.parent.inlineContent?i:r,r)}replace(e,n=Se.empty){if(super.replace(e,n),n==Se.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof Ie&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Fm(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 Ie(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let s=Ue.findFrom(n,r,!0)||Ue.findFrom(n,-r,!0);if(s)n=s.$head;else return Ue.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(Ue.findFrom(e,-r,!0)||Ue.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new Ie(e,n)}}Ue.jsonID("text",Ie);class Fm{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Fm(e.map(this.anchor),e.map(this.head))}resolve(e){return Ie.between(e.resolve(this.anchor),e.resolve(this.head))}}class Pe extends Ue{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:i}=n.mapResult(this.anchor),s=e.resolve(i);return r?Ue.near(s):new Pe(s)}content(){return new Se(ue.from(this.node),0,0)}eq(e){return e instanceof Pe&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Nw(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Pe(e.resolve(n.anchor))}static create(e,n){return new Pe(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Pe.prototype.visible=!1;Ue.jsonID("node",Pe);class Nw{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Fm(r,r):new Nw(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&Pe.isSelectable(r)?new Pe(n):Ue.near(n)}}class Er extends Ue{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=Se.empty){if(n==Se.empty){e.delete(0,e.doc.content.size);let r=Ue.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Er(e)}map(e){return new Er(e)}eq(e){return e instanceof Er}getBookmark(){return i4}}Ue.jsonID("all",Er);const i4={map(){return this},resolve(t){return new Er(t)}};function Wl(t,e,n,r,i,s=!1){if(e.inlineContent)return Ie.create(t,n);for(let o=r-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let l=e.child(o);if(l.isAtom){if(!s&&Pe.isSelectable(l))return Pe.create(t,n-(i<0?l.nodeSize:0))}else{let u=Wl(t,l,n+i,i<0?l.childCount:0,i,s);if(u)return u}n+=l.nodeSize*i}return null}function F_(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof an||i instanceof vn))return;let s=t.mapping.maps[r],o;s.forEach((l,u,f,h)=>{o==null&&(o=h)}),t.setSelection(Ue.near(t.doc.resolve(o),n))}const q_=1,kh=2,G_=4;class s4 extends Mw{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|q_)&~kh,this.storedMarks=null,this}get selectionSet(){return(this.updated&q_)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=kh,this}ensureMarks(e){return At.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&kh)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~kh,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)||At.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let s=this.storedMarks;if(!s){let o=this.doc.resolve(n);s=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(e,s)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(Ue.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|=G_,this}get scrolledIntoView(){return(this.updated&G_)>0}}function W_(t,e){return!e||!t?t:t.bind(e)}class Vu{constructor(e,n,r){this.name=e,this.init=W_(n.init,r),this.apply=W_(n.apply,r)}}const o4=[new Vu("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Vu("selection",{init(t,e){return t.selection||Ue.atStart(e.doc)},apply(t){return t.selection}}),new Vu("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Vu("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class ub{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=o4.slice(),n&&n.forEach(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 Vu(r.key,r.spec.state,r))})}}class va{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 i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),i=null;for(;;){let s=!1;for(let o=0;o<this.config.plugins.length;o++){let l=this.config.plugins[o];if(l.spec.appendTransaction){let u=i?i[o].n:0,f=i?i[o].state:this,h=u<n.length&&l.spec.appendTransaction.call(l,u?n.slice(u):n,f,r);if(h&&r.filterTransaction(h,o)){if(h.setMeta("appendedTransaction",e),!i){i=[];for(let m=0;m<this.config.plugins.length;m++)i.push(m<o?{state:r,n:n.length}:{state:this,n:0})}n.push(h),r=r.applyInner(h),s=!0}i&&(i[o]={state:r,n:n.length})}}if(!s)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new va(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let s=r[i];n[s.name]=s.apply(e,this[s.name],this,n)}return n}get tr(){return new s4(this)}static create(e){let n=new ub(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new va(n);for(let i=0;i<n.fields.length;i++)r[n.fields[i].name]=n.fields[i].init(e,r);return r}reconfigure(e){let n=new ub(this.schema,e.plugins),r=n.fields,i=new va(n);for(let s=0;s<r.length;s++){let o=r[s].name;i[o]=this.hasOwnProperty(o)?this[o]:r[s].init(e,i)}return i}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 i=e[r],s=i.spec.state;s&&s.toJSON&&(n[r]=s.toJSON.call(i,this[i.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 i=new ub(e.schema,e.plugins),s=new va(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=ko.fromJSON(e.schema,n.doc);else if(o.name=="selection")s.selection=Ue.fromJSON(s.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(s.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let u=r[l],f=u.spec.state;if(u.key==o.name&&f&&f.fromJSON&&Object.prototype.hasOwnProperty.call(n,l)){s[o.name]=f.fromJSON.call(u,e,n[l],s);return}}s[o.name]=o.init(e,s)}}),s}}function KO(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=KO(i,e,{})),n[r]=i}return n}class Nt{constructor(e){this.spec=e,this.props={},e.props&&KO(e.props,this,this.props),this.key=e.key?e.key.key:ZO("plugin")}getState(e){return e[this.key]}}const db=Object.create(null);function ZO(t){return t in db?t+"$"+ ++db[t]:(db[t]=0,t+"$")}class Wt{constructor(e="key"){this.key=ZO(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const YO=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function XO(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const JO=(t,e,n)=>{let r=XO(t,n);if(!r)return!1;let i=Ow(r);if(!i){let o=r.blockRange(),l=o&&Rc(o);return l==null?!1:(e&&e(t.tr.lift(o,l).scrollIntoView()),!0)}let s=i.nodeBefore;if(aD(t,i,e,-1))return!0;if(r.parent.content.size==0&&(pc(s,"end")||Pe.isSelectable(s)))for(let o=r.depth;;o--){let l=Um(t.doc,r.before(o),r.after(o),Se.empty);if(l&&l.slice.size<l.to-l.from){if(e){let u=t.tr.step(l);u.setSelection(pc(s,"end")?Ue.findFrom(u.doc.resolve(u.mapping.map(i.pos,-1)),-1):Pe.create(u.doc,i.pos-s.nodeSize)),e(u.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},a4=(t,e,n)=>{let r=XO(t,n);if(!r)return!1;let i=Ow(r);return i?QO(t,i,e):!1},l4=(t,e,n)=>{let r=tD(t,n);if(!r)return!1;let i=Dw(r);return i?QO(t,i,e):!1};function QO(t,e,n){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let h=i.lastChild;if(!h)return!1;i=h}let o=e.nodeAfter,l=o,u=e.pos+1;for(;!l.isTextblock;u++){if(l.type.spec.isolating)return!1;let h=l.firstChild;if(!h)return!1;l=h}let f=Um(t.doc,s,u,Se.empty);if(!f||f.from!=s||f instanceof an&&f.slice.size>=u-s)return!1;if(n){let h=t.tr.step(f);h.setSelection(Ie.create(h.doc,s)),n(h.scrollIntoView())}return!0}function pc(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 eD=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;s=Ow(r)}let o=s&&s.nodeBefore;return!o||!Pe.isSelectable(o)?!1:(e&&e(t.tr.setSelection(Pe.create(t.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function Ow(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 tD(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const nD=(t,e,n)=>{let r=tD(t,n);if(!r)return!1;let i=Dw(r);if(!i)return!1;let s=i.nodeAfter;if(aD(t,i,e,1))return!0;if(r.parent.content.size==0&&(pc(s,"start")||Pe.isSelectable(s))){let o=Um(t.doc,r.before(),r.after(),Se.empty);if(o&&o.slice.size<o.to-o.from){if(e){let l=t.tr.step(o);l.setSelection(pc(s,"start")?Ue.findFrom(l.doc.resolve(l.mapping.map(i.pos)),1):Pe.create(l.doc,l.mapping.map(i.pos))),e(l.scrollIntoView())}return!0}}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},rD=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;s=Dw(r)}let o=s&&s.nodeAfter;return!o||!Pe.isSelectable(o)?!1:(e&&e(t.tr.setSelection(Pe.create(t.doc,s.pos)).scrollIntoView()),!0)};function Dw(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 c4=(t,e)=>{let n=t.selection,r=n instanceof Pe,i;if(r){if(n.node.isTextblock||!Bo(t.doc,n.from))return!1;i=n.from}else if(i=Hm(t.doc,n.from,-1),i==null)return!1;if(e){let s=t.tr.join(i);r&&s.setSelection(Pe.create(s.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},u4=(t,e)=>{let n=t.selection,r;if(n instanceof Pe){if(n.node.isTextblock||!Bo(t.doc,n.to))return!1;r=n.to}else if(r=Hm(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},d4=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),s=i&&Rc(i);return s==null?!1:(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)},iD=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
|
|
69
|
-
`).scrollIntoView()),!0)};function Iw(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 f4=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),s=n.indexAfter(-1),o=Iw(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let l=n.after(),u=t.tr.replaceWith(l,l,o.createAndFill());u.setSelection(Ue.near(u.doc.resolve(l),1)),e(u.scrollIntoView())}return!0},sD=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof Er||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=Iw(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,l=t.tr.insert(o,s.createAndFill());l.setSelection(Ie.create(l.doc,o+1)),e(l.scrollIntoView())}return!0},oD=(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 s=n.before();if(vs(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),i=r&&Rc(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function h4(t){return(e,n)=>{if(e.selection instanceof Pe&&e.selection.node.isBlock){let{$from:y}=e.selection;return!y.parentOffset||!vs(e.doc,y.pos)?!1:(n&&n(e.tr.split(y.pos).scrollIntoView()),!0)}if(!e.selection.$from.depth)return!1;let r=e.tr;!e.selection.empty&&(e.selection instanceof Ie||e.selection instanceof Er)&&r.deleteSelection();let{$from:i}=r.selection,s=r.steps.length,o=[],l,u,f=!1,h=!1;for(let y=i.depth;;y--)if(i.node(y).isBlock){f=i.end(y)==i.pos+(i.depth-y),h=i.start(y)==i.pos-(i.depth-y),u=Iw(i.node(y-1).contentMatchAt(i.indexAfter(y-1))),o.unshift(f&&u?{type:u}:null),l=y;break}else{if(y==1)return!1;o.unshift(null)}let m=i.pos,g=vs(r.doc,m,o.length,o);if(g||(o[0]=u?{type:u}:null,g=vs(r.doc,m,o.length,o)),!g)return!1;if(r.split(m,o.length,o),!f&&h&&i.node(l).type!=u){let y=r.mapping.slice(s),x=y.map(i.before(l)),S=r.doc.resolve(x);u&&i.node(l-1).canReplaceWith(S.index(),S.index()+1,u)&&r.setNodeMarkup(y.map(i.before(l)),u)}return n&&n(r.scrollIntoView()),!0}}const p4=h4(),m4=(t,e)=>{let{$from:n,to:r}=t.selection,i,s=n.sharedDepth(r);return s==0?!1:(i=n.before(s),e&&e(t.tr.setSelection(Pe.create(t.doc,i))),!0)};function g4(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,s=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||Bo(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function aD(t,e,n,r){let i=e.nodeBefore,s=e.nodeAfter,o,l,u=i.type.spec.isolating||s.type.spec.isolating;if(!u&&g4(t,e,n))return!0;let f=!u&&e.parent.canReplace(e.index(),e.index()+1);if(f&&(o=(l=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&l.matchType(o[0]||s.type).validEnd){if(n){let y=e.pos+s.nodeSize,x=ue.empty;for(let C=o.length-1;C>=0;C--)x=ue.from(o[C].create(null,x));x=ue.from(i.copy(x));let S=t.tr.step(new vn(e.pos-1,y,e.pos,y,new Se(x,1,0),o.length,!0)),k=S.doc.resolve(y+2*o.length);k.nodeAfter&&k.nodeAfter.type==i.type&&Bo(S.doc,k.pos)&&S.join(k.pos),n(S.scrollIntoView())}return!0}let h=s.type.spec.isolating||r>0&&u?null:Ue.findFrom(e,1),m=h&&h.$from.blockRange(h.$to),g=m&&Rc(m);if(g!=null&&g>=e.depth)return n&&n(t.tr.lift(m,g).scrollIntoView()),!0;if(f&&pc(s,"start",!0)&&pc(i,"end")){let y=i,x=[];for(;x.push(y),!y.isTextblock;)y=y.lastChild;let S=s,k=1;for(;!S.isTextblock;S=S.firstChild)k++;if(y.canReplace(y.childCount,y.childCount,S.content)){if(n){let C=ue.empty;for(let _=x.length-1;_>=0;_--)C=ue.from(x[_].copy(C));let T=t.tr.step(new vn(e.pos-x.length,e.pos+s.nodeSize,e.pos+k,e.pos+s.nodeSize-k,new Se(C,x.length,0),0,!0));n(T.scrollIntoView())}return!0}}return!1}function lD(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(n&&n(e.tr.setSelection(Ie.create(e.doc,t<0?i.start(s):i.end(s)))),!0):!1}}const y4=lD(-1),v4=lD(1);function b4(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s),l=o&&Rw(o,t,e);return l?(r&&r(n.tr.wrap(o,l).scrollIntoView()),!0):!1}}function K_(t,e=null){return function(n,r){let i=!1;for(let s=0;s<n.selection.ranges.length&&!i;s++){let{$from:{pos:o},$to:{pos:l}}=n.selection.ranges[s];n.doc.nodesBetween(o,l,(u,f)=>{if(i)return!1;if(!(!u.isTextblock||u.hasMarkup(t,e)))if(u.type==t)i=!0;else{let h=n.doc.resolve(f),m=h.index();i=h.parent.canReplaceWith(m,m+1,t)}})}if(!i)return!1;if(r){let s=n.tr;for(let o=0;o<n.selection.ranges.length;o++){let{$from:{pos:l},$to:{pos:u}}=n.selection.ranges[o];s.setBlockType(l,u,t,e)}r(s.scrollIntoView())}return!0}}function Lw(...t){return function(e,n,r){for(let i=0;i<t.length;i++)if(t[i](e,n,r))return!0;return!1}}Lw(YO,JO,eD);Lw(YO,nD,rD);Lw(iD,sD,oD,p4);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function x4(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s);if(!o)return!1;let l=r?n.tr:null;return w4(l,o,t,e)?(r&&r(l.scrollIntoView()),!0):!1}}function w4(t,e,n,r=null){let i=!1,s=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 u=o.resolve(e.start-2);s=new Dp(u,u,e.depth),e.endIndex<e.parent.childCount&&(e=new Dp(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let l=Rw(s,n,r,e);return l?(t&&S4(t,e,l,i,n),!0):!1}function S4(t,e,n,r,i){let s=ue.empty;for(let h=n.length-1;h>=0;h--)s=ue.from(n[h].type.create(n[h].attrs,s));t.step(new vn(e.start-(r?2:0),e.end,e.start,e.end,new Se(s,0,0),n.length,!0));let o=0;for(let h=0;h<n.length;h++)n[h].type==i&&(o=h+1);let l=n.length-o,u=e.start+n.length-(r?2:0),f=e.parent;for(let h=e.startIndex,m=e.endIndex,g=!0;h<m;h++,g=!1)!g&&vs(t.doc,u,l)&&(t.split(u,l),u+=2*l),u+=f.child(h).nodeSize;return t}function k4(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,o=>o.childCount>0&&o.firstChild.type==t);return s?n?r.node(s.depth-1).type==t?C4(e,n,t,s):E4(e,n,s):!0:!1}}function C4(t,e,n,r){let i=t.tr,s=r.end,o=r.$to.end(r.depth);s<o&&(i.step(new vn(s-1,o,s,o,new Se(ue.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Dp(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));const l=Rc(r);if(l==null)return!1;i.lift(r,l);let u=i.doc.resolve(i.mapping.map(s,-1)-1);return Bo(i.doc,u.pos)&&u.nodeBefore.type==u.nodeAfter.type&&i.join(u.pos),e(i.scrollIntoView()),!0}function E4(t,e,n){let r=t.tr,i=n.parent;for(let y=n.end,x=n.endIndex-1,S=n.startIndex;x>S;x--)y-=i.child(x).nodeSize,r.delete(y-1,y+1);let s=r.doc.resolve(n.start),o=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,u=n.endIndex==i.childCount,f=s.node(-1),h=s.index(-1);if(!f.canReplace(h+(l?0:1),h+1,o.content.append(u?ue.empty:ue.from(i))))return!1;let m=s.pos,g=m+o.nodeSize;return r.step(new vn(m-(l?1:0),g+(u?1:0),m+1,g-1,new Se((l?ue.empty:ue.from(i.copy(ue.empty))).append(u?ue.empty:ue.from(i.copy(ue.empty))),l?0:1,u?0:1),l?0:1)),e(r.scrollIntoView()),!0}function T4(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,f=>f.childCount>0&&f.firstChild.type==t);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let l=s.parent,u=l.child(o-1);if(u.type!=t)return!1;if(n){let f=u.lastChild&&u.lastChild.type==l.type,h=ue.from(f?t.create():null),m=new Se(ue.from(t.create(null,ue.from(l.type.create(null,h)))),f?3:1,0),g=s.start,y=s.end;n(e.tr.step(new vn(g-(f?3:1),y,g,y,m,1,!0)).scrollIntoView())}return!0}}const Dn=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},mc=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let H0=null;const ss=function(t,e,n){let r=H0||(H0=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},_4=function(){H0=null},ja=function(t,e,n,r){return n&&(Z_(t,e,n,r,-1)||Z_(t,e,n,r,1))},A4=/^(img|br|input|textarea|hr)$/i;function Z_(t,e,n,r,i){for(var s;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Ur(t))){let o=t.parentNode;if(!o||o.nodeType!=1||Gd(t)||A4.test(t.nodeName)||t.contentEditable=="false")return!1;e=Dn(t)+(i<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else t=o,e=i<0?Ur(t):0}else return!1}}function Ur(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function R4(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=Ur(t)}else if(t.parentNode&&!Gd(t))e=Dn(t),t=t.parentNode;else return null}}function M4(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&&!Gd(t))e=Dn(t)+1,t=t.parentNode;else return null}}function N4(t,e,n){for(let r=e==0,i=e==Ur(t);r||i;){if(t==n)return!0;let s=Dn(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,i=i&&s==Ur(t)}}function Gd(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 qm=function(t){return t.focusNode&&ja(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function ma(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function O4(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function D4(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Ur(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Ur(r.startContainer),r.startOffset)}}}const Mi=typeof navigator<"u"?navigator:null,Y_=typeof document<"u"?document:null,Vo=Mi&&Mi.userAgent||"",U0=/Edge\/(\d+)/.exec(Vo),cD=/MSIE \d/.exec(Vo),F0=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Vo),dr=!!(cD||F0||U0),Co=cD?document.documentMode:F0?+F0[1]:U0?+U0[1]:0,Fr=!dr&&/gecko\/(\d+)/i.test(Vo);Fr&&+(/Firefox\/(\d+)/.exec(Vo)||[0,0])[1];const q0=!dr&&/Chrome\/(\d+)/.exec(Vo),Ln=!!q0,uD=q0?+q0[1]:0,Hn=!dr&&!!Mi&&/Apple Computer/.test(Mi.vendor),gc=Hn&&(/Mobile\/\w+/.test(Vo)||!!Mi&&Mi.maxTouchPoints>2),Vr=gc||(Mi?/Mac/.test(Mi.platform):!1),dD=Mi?/Win/.test(Mi.platform):!1,ms=/Android \d/.test(Vo),Wd=!!Y_&&"webkitFontSmoothing"in Y_.documentElement.style,I4=Wd?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function L4(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 Qi(t,e){return typeof t=="number"?t:t[e]}function j4(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 X_(t,e,n){if(!G0(e)&&e.left==0)return;let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(o.nodeType!=1){o=mc(o);continue}let l=o,u=l==s.body,f=u?L4(s):j4(l),h=0,m=0;if(e.top<f.top+Qi(r,"top")?m=-(f.top-e.top+Qi(i,"top")):e.bottom>f.bottom-Qi(r,"bottom")&&(m=e.bottom-e.top>f.bottom-f.top?e.top+Qi(i,"top")-f.top:e.bottom-f.bottom+Qi(i,"bottom")),e.left<f.left+Qi(r,"left")?h=-(f.left-e.left+Qi(i,"left")):e.right>f.right-Qi(r,"right")&&(h=e.right-f.right+Qi(i,"right")),h||m)if(u)s.defaultView.scrollBy(h,m);else{let y=l.scrollLeft,x=l.scrollTop;m&&(l.scrollTop+=m),h&&(l.scrollLeft+=h);let S=l.scrollLeft-y,k=l.scrollTop-x;e={left:e.left-S,top:e.top-k,right:e.right-S,bottom:e.bottom-k}}let g=u?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(g))break;o=g=="absolute"?o.offsetParent:mc(o)}}function P4(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,o=n+1;o<Math.min(innerHeight,e.bottom);o+=5){let l=t.root.elementFromPoint(s,o);if(!l||l==t.dom||!t.dom.contains(l))continue;let u=l.getBoundingClientRect();if(u.top>=n-20){r=l,i=u.top;break}}return{refDOM:r,refTop:i,stack:fD(t.dom)}}function fD(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=mc(r));return e}function z4({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;hD(n,r==0?0:r-e)}function hD(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:i,left:s}=t[n];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let zl=null;function $4(t){if(t.setActive)return t.setActive();if(zl)return t.focus(zl);let e=fD(t);t.focus(zl==null?{get preventScroll(){return zl={preventScroll:!0},!0}}:void 0),zl||(zl=!1,hD(e,0))}function pD(t,e){let n,r=2e8,i,s=0,o=e.top,l=e.top,u,f;for(let h=t.firstChild,m=0;h;h=h.nextSibling,m++){let g;if(h.nodeType==1)g=h.getClientRects();else if(h.nodeType==3)g=ss(h).getClientRects();else continue;for(let y=0;y<g.length;y++){let x=g[y];if(x.top<=o&&x.bottom>=l){o=Math.max(x.bottom,o),l=Math.min(x.top,l);let S=x.left>e.left?x.left-e.left:x.right<e.left?e.left-x.right:0;if(S<r){n=h,r=S,i=S&&n.nodeType==3?{left:x.right<e.left?x.right:x.left,top:e.top}:e,h.nodeType==1&&S&&(s=m+(e.left>=(x.left+x.right)/2?1:0));continue}}else x.top>e.top&&!u&&x.left<=e.left&&x.right>=e.left&&(u=h,f={left:Math.max(x.left,Math.min(x.right,e.left)),top:x.top});!n&&(e.left>=x.right&&e.top>=x.top||e.left>=x.left&&e.top>=x.bottom)&&(s=m+1)}}return!n&&u&&(n=u,i=f,r=0),n&&n.nodeType==3?B4(n,i):!n||r&&n.nodeType==1?{node:t,offset:s}:pD(n,i)}function B4(t,e){let n=t.nodeValue.length,r=document.createRange(),i;for(let s=0;s<n;s++){r.setEnd(t,s+1),r.setStart(t,s);let o=no(r,1);if(o.top!=o.bottom&&jw(e,o)){i={node:t,offset:s+(e.left>=(o.left+o.right)/2?1:0)};break}}return r.detach(),i||{node:t,offset:0}}function jw(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function V4(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function H4(t,e,n){let{node:r,offset:i}=pD(e,n),s=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();s=o.left!=o.right&&n.left>(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,i,s)}function U4(t,e,n,r){let i=-1;for(let s=e,o=!1;s!=t.dom;){let l=t.docView.nearestDesc(s,!0),u;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((u=l.dom.getBoundingClientRect()).width||u.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!o&&u.left>r.left||u.top>r.top?i=l.posBefore:(!o&&u.right<r.left||u.bottom<r.top)&&(i=l.posAfter),o=!0),!l.contentDOM&&i<0&&!l.node.isText))return(l.node.isBlock?r.top<(u.top+u.bottom)/2:r.left<(u.left+u.right)/2)?l.posBefore:l.posAfter;s=l.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function mD(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),s=i;;){let o=t.childNodes[s];if(o.nodeType==1){let l=o.getClientRects();for(let u=0;u<l.length;u++){let f=l[u];if(jw(e,f))return mD(o,e,f)}}if((s=(s+1)%r)==i)break}return t}function F4(t,e){let n=t.dom.ownerDocument,r,i=0,s=D4(n,e.left,e.top);s&&({node:r,offset:i}=s);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 f=t.dom.getBoundingClientRect();if(!jw(e,f)||(o=mD(t.dom,e,f),!o))return null}if(Hn)for(let f=o;r&&f;f=mc(f))f.draggable&&(r=void 0);if(o=V4(o,e),r){if(Fr&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let h=r.childNodes[i],m;h.nodeName=="IMG"&&(m=h.getBoundingClientRect()).right<=e.left&&m.bottom>e.top&&i++}let f;Wd&&i&&r.nodeType==1&&(f=r.childNodes[i-1]).nodeType==1&&f.contentEditable=="false"&&f.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(l=U4(t,r,i,e))}l==null&&(l=H4(t,o,e));let u=t.docView.nearestDesc(o,!0);return{pos:l,inside:u?u.posAtStart-u.border:-1}}function G0(t){return t.top<t.bottom||t.left<t.right}function no(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(G0(r))return r}return Array.prototype.find.call(n,G0)||t.getBoundingClientRect()}const q4=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function gD(t,e,n){let{node:r,offset:i,atom:s}=t.docView.domFromPos(e,n<0?-1:1),o=Wd||Fr;if(r.nodeType==3)if(o&&(q4.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let u=no(ss(r,i,i),n);if(Fr&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let f=no(ss(r,i-1,i-1),-1);if(f.top==u.top){let h=no(ss(r,i,i+1),-1);if(h.top!=u.top)return Ru(h,h.left<f.left)}}return u}else{let u=i,f=i,h=n<0?1:-1;return n<0&&!i?(f++,h=-1):n>=0&&i==r.nodeValue.length?(u--,h=1):n<0?u--:f++,Ru(no(ss(r,u,f),h),h<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(n<0||i==Ur(r))){let u=r.childNodes[i-1];if(u.nodeType==1)return fb(u.getBoundingClientRect(),!1)}if(s==null&&i<Ur(r)){let u=r.childNodes[i];if(u.nodeType==1)return fb(u.getBoundingClientRect(),!0)}return fb(r.getBoundingClientRect(),n>=0)}if(s==null&&i&&(n<0||i==Ur(r))){let u=r.childNodes[i-1],f=u.nodeType==3?ss(u,Ur(u)-(o?0:1)):u.nodeType==1&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(f)return Ru(no(f,1),!1)}if(s==null&&i<Ur(r)){let u=r.childNodes[i];for(;u.pmViewDesc&&u.pmViewDesc.ignoreForCoords;)u=u.nextSibling;let f=u?u.nodeType==3?ss(u,0,o?0:1):u.nodeType==1?u:null:null;if(f)return Ru(no(f,-1),!0)}return Ru(no(r.nodeType==3?ss(r):r,-n),n>=0)}function Ru(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 fb(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 yD(t,e,n){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}function G4(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return yD(t,e,()=>{let{node:s}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let l=t.docView.nearestDesc(s,!0);if(!l)break;if(l.node.isBlock){s=l.contentDOM||l.dom;break}s=l.dom.parentNode}let o=gD(t,i.pos,1);for(let l=s.firstChild;l;l=l.nextSibling){let u;if(l.nodeType==1)u=l.getClientRects();else if(l.nodeType==3)u=ss(l,0,l.nodeValue.length).getClientRects();else continue;for(let f=0;f<u.length;f++){let h=u[f];if(h.bottom>h.top+1&&(n=="up"?o.top-h.top>(h.bottom-o.top)*2:h.bottom-o.bottom>(o.bottom-h.top)*2))return!1}}return!0})}const W4=/[\u0590-\u08ac]/;function K4(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,l=t.domSelection();return l?!W4.test(r.parent.textContent)||!l.modify?n=="left"||n=="backward"?s:o:yD(t,e,()=>{let{focusNode:u,focusOffset:f,anchorNode:h,anchorOffset:m}=t.domSelectionRange(),g=l.caretBidiLevel;l.modify("move",n,"character");let y=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:x,focusOffset:S}=t.domSelectionRange(),k=x&&!y.contains(x.nodeType==1?x:x.parentNode)||u==x&&f==S;try{l.collapse(h,m),u&&(u!=h||f!=m)&&l.extend&&l.extend(u,f)}catch{}return g!=null&&(l.caretBidiLevel=g),k}):r.pos==r.start()||r.pos==r.end()}let J_=null,Q_=null,eA=!1;function Z4(t,e,n){return J_==e&&Q_==n?eA:(J_=e,Q_=n,eA=n=="up"||n=="down"?G4(t,e,n):K4(t,e,n))}const qr=0,tA=1,ba=2,di=3;class Kd{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=qr,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(e){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 i=this.children[n];if(i==e)return r;r+=i.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 s,o;if(e==this.contentDOM)s=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(o)+o.size:this.posAtStart}else{let s,o;if(e==this.contentDOM)s=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(o):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=n>Dn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!n||s.node))if(r&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return s}}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 i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let i=this.children[n],s=r+i.size;if(r==e&&s!=r){for(;!i.border&&i.children.length;)for(let o=0;o<i.children.length;o++){let l=i.children[o];if(l.size){i=l;break}}return i}if(e<s)return i.descAt(e-r-i.border);r=s}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let s=0;r<this.children.length;r++){let o=this.children[r],l=s+o.size;if(l>e||o instanceof bD){i=e-s;break}s=l}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof vD&&s.side>=0;r--);if(n<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&n&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,n):{node:this.contentDOM,offset:s?Dn(s.dom)+1:0}}else{let s,o=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,o=!1);return s&&o&&!s.border&&!s.domAtom?s.domFromPos(0,n):{node:this.contentDOM,offset:s?Dn(s.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 i=-1,s=-1;for(let o=r,l=0;;l++){let u=this.children[l],f=o+u.size;if(i==-1&&e<=f){let h=o+u.border;if(e>=h&&n<=f-u.border&&u.node&&u.contentDOM&&this.contentDOM.contains(u.contentDOM))return u.parseRange(e,n,h);e=o;for(let m=l;m>0;m--){let g=this.children[m-1];if(g.size&&g.dom.parentNode==this.contentDOM&&!g.emptyChildAt(1)){i=Dn(g.dom)+1;break}e-=g.size}i==-1&&(i=0)}if(i>-1&&(f>n||l==this.children.length-1)){n=f;for(let h=l+1;h<this.children.length;h++){let m=this.children[h];if(m.size&&m.dom.parentNode==this.contentDOM&&!m.emptyChildAt(-1)){s=Dn(m.dom);break}n+=m.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=f}return{node:this.contentDOM,from:e,to:n,fromOffset:i,toOffset:s}}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,i=!1){let s=Math.min(e,n),o=Math.max(e,n);for(let y=0,x=0;y<this.children.length;y++){let S=this.children[y],k=x+S.size;if(s>x&&o<k)return S.setSelection(e-x-S.border,n-x-S.border,r,i);x=k}let l=this.domFromPos(e,e?-1:1),u=n==e?l:this.domFromPos(n,n?-1:1),f=r.root.getSelection(),h=r.domSelectionRange(),m=!1;if((Fr||Hn)&&e==n){let{node:y,offset:x}=l;if(y.nodeType==3){if(m=!!(x&&y.nodeValue[x-1]==`
|
|
70
|
-
`),m&&x==y.nodeValue.length)for(let S=y,k;S;S=S.parentNode){if(k=S.nextSibling){k.nodeName=="BR"&&(l=u={node:k.parentNode,offset:Dn(k)+1});break}let C=S.pmViewDesc;if(C&&C.node&&C.node.isBlock)break}}else{let S=y.childNodes[x-1];m=S&&(S.nodeName=="BR"||S.contentEditable=="false")}}if(Fr&&h.focusNode&&h.focusNode!=u.node&&h.focusNode.nodeType==1){let y=h.focusNode.childNodes[h.focusOffset];y&&y.contentEditable=="false"&&(i=!0)}if(!(i||m&&Hn)&&ja(l.node,l.offset,h.anchorNode,h.anchorOffset)&&ja(u.node,u.offset,h.focusNode,h.focusOffset))return;let g=!1;if((f.extend||e==n)&&!(m&&Fr)){f.collapse(l.node,l.offset);try{e!=n&&f.extend(u.node,u.offset),g=!0}catch{}}if(!g){if(e>n){let x=l;l=u,u=x}let y=document.createRange();y.setEnd(u.node,u.offset),y.setStart(l.node,l.offset),f.removeAllRanges(),f.addRange(y)}}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,i=0;i<this.children.length;i++){let s=this.children[i],o=r+s.size;if(r==o?e<=o&&n>=r:e<o&&n>r){let l=r+s.border,u=o-s.border;if(e>=l&&n<=u){this.dirty=e==r||n==o?ba:tA,e==l&&n==u&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=di:s.markDirty(e-l,n-l);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?ba:di}r=o}this.dirty=ba}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?ba:tA;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class vD extends Kd{constructor(e,n,r,i){let s,o=n.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!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,s=this}matchesWidget(e){return this.dirty==qr&&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 Y4 extends Kd{constructor(e,n,r,i){super(e,[],n,null),this.textDOM=r,this.text=i}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 Eo extends Kd{constructor(e,n,r,i,s){super(e,[],r,i),this.mark=n,this.spec=s}static create(e,n,r,i){let s=i.nodeViews[n.type.name],o=s&&s(n,i,r);return(!o||!o.dom)&&(o=Wa.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new Eo(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&di||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=di&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=qr){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=qr}}slice(e,n,r){let i=Eo.create(this.parent,this.mark,!0,r),s=this.children,o=this.size;n<o&&(s=K0(s,n,o,r)),e>0&&(s=K0(s,0,e,r));for(let l=0;l<s.length;l++)s[l].parent=i;return i.children=s,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class To extends Kd{constructor(e,n,r,i,s,o,l){super(e,[],s,o),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=l}static create(e,n,r,i,s,o){let l=s.nodeViews[n.type.name],u,f=l&&l(n,s,()=>{if(!u)return o;if(u.parent)return u.parent.posBeforeChild(u)},r,i),h=f&&f.dom,m=f&&f.contentDOM;if(n.isText){if(!h)h=document.createTextNode(n.text);else if(h.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else h||({dom:h,contentDOM:m}=Wa.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!m&&!n.isText&&h.nodeName!="BR"&&(h.hasAttribute("contenteditable")||(h.contentEditable="false"),n.type.spec.draggable&&(h.draggable=!0));let g=h;return h=SD(h,r,n),f?u=new X4(e,n,r,i,h,m||null,g,f):n.isText?new Gm(e,n,r,i,h,g):new To(e,n,r,i,h,m||null,g)}parseRule(e){if(this.node.type.spec.reparseInView)return null;let n={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(n.preserveWhitespace="full"),!this.contentDOM)n.getContent=()=>this.node.content;else if(!this.contentLost)n.contentElement=this.contentDOM;else{for(let r=this.children.length-1;r>=0;r--){let i=this.children[r];if(this.dom.contains(i.dom.parentNode)){n.contentElement=i.dom.parentNode;break}}if(!n.contentElement){let r=e&&e.find(i=>i.nodeType==1&&e.indexOf(i.parentNode)<0&&this.dom.contains(i));r?n.contentElement=r:n.getContent=()=>ue.empty}}return n}matchesNode(e,n,r){return this.dirty==qr&&e.eq(this.node)&&Lp(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,i=n,s=e.composing?this.localCompositionInfo(e,n):null,o=s&&s.pos>-1?s:null,l=s&&s.pos<0,u=new Q4(this,o&&o.node,e);n6(this.node,this.innerDeco,(f,h,m)=>{f.spec.marks?u.syncToMarks(f.spec.marks,r,e,h):f.type.side>=0&&!m&&u.syncToMarks(h==this.node.childCount?At.none:this.node.child(h).marks,r,e,h),u.placeWidget(f,e,i)},(f,h,m,g)=>{u.syncToMarks(f.marks,r,e,g);let y;u.findNodeMatch(f,h,m,g)||l&&e.state.selection.from>i&&e.state.selection.to<i+f.nodeSize&&(y=u.findIndexWithChild(s.node))>-1&&u.updateNodeAt(f,h,m,y,e)||u.updateNextNode(f,h,m,e,g,i)||u.addNode(f,h,m,e,i),i+=f.nodeSize}),u.syncToMarks([],r,e,0),this.node.isTextblock&&u.addTextblockHacks(),u.destroyRest(),(u.changed||this.dirty==ba)&&(o&&this.protectLocalComposition(e,o),xD(this.contentDOM,this.children,e),gc&&r6(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof Ie)||r<n||i>n+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let o=s.nodeValue,l=i6(this.node.content,o,r-n,i-n);return l<0?null:{node:s,pos:l,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let s=n;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new Y4(this,s,n,i);e.input.compositionNodes.push(o),this.children=K0(this.children,r,r+i.length,e,o)}update(e,n,r,i){return this.dirty==di||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,i),!0)}updateInner(e,n,r,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=qr}updateOuterDeco(e){if(Lp(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=wD(this.dom,this.nodeDOM,W0(this.outerDeco,this.node,n),W0(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 nA(t,e,n,r,i){SD(r,e,t);let s=new To(void 0,t,e,n,r,r,r);return s.contentDOM&&s.updateChildren(i,0),s}class Gm extends To{constructor(e,n,r,i,s,o){super(e,n,r,i,s,null,o)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,i){return this.dirty==di||this.dirty!=qr&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=qr||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=qr,!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 i=this.node.cut(e,n),s=document.createTextNode(i.text);return new Gm(this.parent,i,this.outerDeco,this.innerDeco,s,s)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=di)}get domAtom(){return!1}isText(e){return this.node.text==e}}class bD extends Kd{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==qr&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class X4 extends To{constructor(e,n,r,i,s,o,l,u){super(e,n,r,i,s,o,l),this.spec=u}update(e,n,r,i){if(this.dirty==di)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,n,r);return s&&this.updateInner(e,n,r,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,i){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,i)}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 xD(t,e,n){let r=t.firstChild,i=!1;for(let s=0;s<e.length;s++){let o=e[s],l=o.dom;if(l.parentNode==t){for(;l!=r;)r=rA(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(l,r);if(o instanceof Eo){let u=r?r.previousSibling:t.lastChild;xD(o.contentDOM,o.children,n),r=u?u.nextSibling:t.firstChild}}for(;r;)r=rA(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const Qu=function(t){t&&(this.nodeName=t)};Qu.prototype=Object.create(null);const xa=[new Qu];function W0(t,e,n){if(t.length==0)return xa;let r=n?xa[0]:new Qu,i=[r];for(let s=0;s<t.length;s++){let o=t[s].type.attrs;if(o){o.nodeName&&i.push(r=new Qu(o.nodeName));for(let l in o){let u=o[l];u!=null&&(n&&i.length==1&&i.push(r=new Qu(e.isInline?"span":"div")),l=="class"?r.class=(r.class?r.class+" ":"")+u:l=="style"?r.style=(r.style?r.style+";":"")+u:l!="nodeName"&&(r[l]=u))}}}return i}function wD(t,e,n,r){if(n==xa&&r==xa)return e;let i=e;for(let s=0;s<r.length;s++){let o=r[s],l=n[s];if(s){let u;l&&l.nodeName==o.nodeName&&i!=t&&(u=i.parentNode)&&u.nodeName.toLowerCase()==o.nodeName||(u=document.createElement(o.nodeName),u.pmIsDeco=!0,u.appendChild(i),l=xa[0]),i=u}J4(i,l||xa[0],o)}return i}function J4(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):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let s=0;s<r.length;s++)i.indexOf(r[s])==-1&&t.classList.remove(r[s]);for(let s=0;s<i.length;s++)r.indexOf(i[s])==-1&&t.classList.add(i[s]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)t.style.removeProperty(i[1])}n.style&&(t.style.cssText+=n.style)}}function SD(t,e,n){return wD(t,t,xa,W0(e,n,t.nodeType!=1))}function Lp(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 rA(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class Q4{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=e6(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,i){let s=0,o=this.stack.length>>1,l=Math.min(o,e.length);for(;s<l&&(s==o-1?this.top:this.stack[s+1<<1]).matchesMark(e[s])&&e[s].type.spec.spanning!==!1;)s++;for(;s<o;)this.destroyRest(),this.top.dirty=qr,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let u=-1,f=this.top.children.length;i<this.preMatch.index&&(f=Math.min(this.index+3,f));for(let h=this.index;h<f;h++){let m=this.top.children[h];if(m.matchesMark(e[o])&&!this.isLocked(m.dom)){u=h;break}}if(u<0&&this.index<this.top.children.length){let h=this.top.children[this.index];h instanceof Eo&&h.dirty!=di&&h.mark.type==e[o].type&&h.spec.update&&!this.isLocked(h.dom)&&h.spec.update(e[o])&&(h.mark=e[o],u=this.index,this.changed=!0)}if(u>-1)u>this.index&&(this.changed=!0,this.destroyBetween(this.index,u)),this.top=this.top.children[this.index];else{let h=Eo.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,h),this.top=h,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,i){let s=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))s=this.top.children.indexOf(o,this.index);else for(let l=this.index,u=Math.min(this.top.children.length,l+5);l<u;l++){let f=this.top.children[l];if(f.matchesNode(e,n,r)&&!this.preMatch.matched.has(f)){s=l;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,n,r,i,s){let o=this.top.children[i];return o.dirty==di&&o.dom==o.contentDOM&&(o.dirty=ba),o.update(e,n,r,s)?(this.destroyBetween(this.index,i),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 i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=n}}updateNextNode(e,n,r,i,s,o){for(let l=this.index;l<this.top.children.length;l++){let u=this.top.children[l];if(u instanceof To){let f=this.preMatch.matched.get(u);if(f!=null&&f!=s)return!1;let h=u.dom,m,g=this.isLocked(h)&&!(e.isText&&u.node&&u.node.isText&&u.nodeDOM.nodeValue==e.text&&u.dirty!=di&&Lp(n,u.outerDeco));if(!g&&u.update(e,n,r,i))return this.destroyBetween(this.index,l),u.dom!=h&&(this.changed=!0),this.index++,!0;if(!g&&(m=this.recreateWrapper(u,e,n,r,i,o)))return this.destroyBetween(this.index,l),this.top.children[this.index]=m,m.contentDOM&&(m.dirty=ba,m.updateChildren(i,o+1),m.dirty=qr),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,i,s,o){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!Lp(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let l=To.create(this.top,n,r,i,s,o);if(l.contentDOM){l.children=e.children,e.children=[];for(let u of l.children)u.parent=l}return e.destroy(),l}addNode(e,n,r,i,s){let o=To.create(this.top,e,n,r,i,s);o.contentDOM&&o.updateChildren(i,s+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,n,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let s=new vD(this.top,e,n,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof Eo;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Gm)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Hn||Ln)&&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 i=new bD(this.top,[],r,null);n!=this.top?n.children.push(i):n.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function e6(t,e){let n=e,r=n.children.length,i=t.childCount,s=new Map,o=[];e:for(;i>0;){let l;for(;;)if(r){let f=n.children[r-1];if(f instanceof Eo)n=f,r=f.children.length;else{l=f,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let u=l.node;if(u){if(u!=t.child(i-1))break;--i,s.set(l,i),o.push(l)}}return{index:i,matched:s,matches:o.reverse()}}function t6(t,e){return t.type.side-e.type.side}function n6(t,e,n,r){let i=e.locals(t),s=0;if(i.length==0){for(let f=0;f<t.childCount;f++){let h=t.child(f);r(h,i,e.forChild(s,h),f),s+=h.nodeSize}return}let o=0,l=[],u=null;for(let f=0;;){let h,m;for(;o<i.length&&i[o].to==s;){let k=i[o++];k.widget&&(h?(m||(m=[h])).push(k):h=k)}if(h)if(m){m.sort(t6);for(let k=0;k<m.length;k++)n(m[k],f,!!u)}else n(h,f,!!u);let g,y;if(u)y=-1,g=u,u=null;else if(f<t.childCount)y=f,g=t.child(f++);else break;for(let k=0;k<l.length;k++)l[k].to<=s&&l.splice(k--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)l.push(i[o++]);let x=s+g.nodeSize;if(g.isText){let k=x;o<i.length&&i[o].from<k&&(k=i[o].from);for(let C=0;C<l.length;C++)l[C].to<k&&(k=l[C].to);k<x&&(u=g.cut(k-s),g=g.cut(0,k-s),x=k,y=-1)}else for(;o<i.length&&i[o].to<x;)o++;let S=g.isInline&&!g.isLeaf?l.filter(k=>!k.inline):l.slice();r(g,S,e.forChild(s,g),y),s=x}}function r6(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 i6(t,e,n,r){for(let i=0,s=0;i<t.childCount&&s<=r;){let o=t.child(i++),l=s;if(s+=o.nodeSize,!o.isText)continue;let u=o.text;for(;i<t.childCount;){let f=t.child(i++);if(s+=f.nodeSize,!f.isText)break;u+=f.text}if(s>=n){if(s>=r&&u.slice(r-e.length-l,r-l)==e)return r-e.length;let f=l<r?u.lastIndexOf(e,r-l-1):-1;if(f>=0&&f+e.length+l>=n)return l+f;if(n==r&&u.length>=r+e.length-l&&u.slice(r-l,r-l+e.length)==e)return r}}return-1}function K0(t,e,n,r,i){let s=[];for(let o=0,l=0;o<t.length;o++){let u=t[o],f=l,h=l+=u.size;f>=n||h<=e?s.push(u):(f<e&&s.push(u.slice(0,e-f,r)),i&&(s.push(i),i=void 0),h>n&&s.push(u.slice(n-f,u.size,r)))}return s}function Pw(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),s=i&&i.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let l=r.resolve(o),u,f;if(qm(n)){for(u=o;i&&!i.node;)i=i.parent;let m=i.node;if(i&&m.isAtom&&Pe.isSelectable(m)&&i.parent&&!(m.isInline&&N4(n.focusNode,n.focusOffset,i.dom))){let g=i.posBefore;f=new Pe(o==g?l:r.resolve(g))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let m=o,g=o;for(let y=0;y<n.rangeCount;y++){let x=n.getRangeAt(y);m=Math.min(m,t.docView.posFromDOM(x.startContainer,x.startOffset,1)),g=Math.max(g,t.docView.posFromDOM(x.endContainer,x.endOffset,-1))}if(m<0)return null;[u,o]=g==t.state.selection.anchor?[g,m]:[m,g],l=r.resolve(o)}else u=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(u<0)return null}let h=r.resolve(u);if(!f){let m=e=="pointer"||t.state.selection.head<l.pos&&!s?1:-1;f=zw(t,h,l,m)}return f}function kD(t){return t.editable?t.hasFocus():ED(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function bs(t,e=!1){let n=t.state.selection;if(CD(t,n),!kD(t))return;let r=t.input.mouseDown;if(!e&&Ln&&r){let i=t.domSelectionRange(),s=t.domObserver.currentSelection;if(i.anchorNode&&s.anchorNode&&ja(i.anchorNode,i.anchorOffset,s.anchorNode,s.anchorOffset)&&r.delaySelUpdate()){t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)o6(t);else{let{anchor:i,head:s}=n,o,l;iA&&!(n instanceof Ie)&&(n.$from.parent.inlineContent||(o=sA(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(l=sA(t,n.to))),t.docView.setSelection(i,s,t,e),iA&&(o&&oA(o),l&&oA(l)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&s6(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}const iA=Hn||Ln&&uD<63;function sA(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),i=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(Hn&&i&&i.contentEditable=="false")return hb(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return hb(i);if(s)return hb(s)}}function hb(t){return t.contentEditable="true",Hn&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function oA(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function s6(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!kD(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function o6(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Dn(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&dr&&Co<=11&&(n.disabled=!0,n.disabled=!1)}function CD(t,e){if(e instanceof Pe){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(aA(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else aA(t)}function aA(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function zw(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||Ie.between(e,n,r)}function lA(t){return t.editable&&!t.hasFocus()?!1:ED(t)}function ED(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 a6(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return ja(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Z0(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&Ue.findFrom(s,e)}function so(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function cA(t,e,n){let r=t.state.selection;if(r instanceof Ie)if(n.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=t.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return so(t,new Ie(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=Z0(t.state,e);return i&&i instanceof Pe?so(t,i):!1}else if(!(Vr&&n.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let l=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=t.docView.descAt(l))&&!o.contentDOM?Pe.isSelectable(s)?so(t,new Pe(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):Wd?so(t,new Ie(t.state.doc.resolve(e<0?l:l+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Pe&&r.node.isInline)return so(t,new Ie(e>0?r.$to:r.$from));{let i=Z0(t.state,e);return i?so(t,i):!1}}}function jp(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function ed(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function $l(t,e){return e<0?l6(t):c6(t)}function l6(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,o=!1;for(Fr&&n.nodeType==1&&r<jp(n)&&ed(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let l=n.childNodes[r-1];if(ed(l,-1))i=n,s=--r;else if(l.nodeType==3)n=l,r=n.nodeValue.length;else break}}else{if(TD(n))break;{let l=n.previousSibling;for(;l&&ed(l,-1);)i=n.parentNode,s=Dn(l),l=l.previousSibling;if(l)n=l,r=jp(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?Y0(t,n,r):i&&Y0(t,i,s)}function c6(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=jp(n),s,o;for(;;)if(r<i){if(n.nodeType!=1)break;let l=n.childNodes[r];if(ed(l,1))s=n,o=++r;else break}else{if(TD(n))break;{let l=n.nextSibling;for(;l&&ed(l,1);)s=l.parentNode,o=Dn(l)+1,l=l.nextSibling;if(l)n=l,r=0,i=jp(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}s&&Y0(t,s,o)}function TD(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function u6(t,e){for(;t&&e==t.childNodes.length&&!Gd(t);)e=Dn(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 d6(t,e){for(;t&&!e&&!Gd(t);)e=Dn(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 Y0(t,e,n){if(e.nodeType!=3){let s,o;(o=u6(e,n))?(e=o,n=0):(s=d6(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(qm(r)){let s=document.createRange();s.setEnd(e,n),s.setStart(e,n),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&bs(t)},50)}function uA(t,e){let n=t.state.doc.resolve(e);if(!(Ln||dD)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<n.end()){let s=t.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function dA(t,e,n){let r=t.state.selection;if(r instanceof Ie&&!r.empty||n.indexOf("s")>-1||Vr&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=Z0(t.state,e);if(o&&o instanceof Pe)return so(t,o)}if(!i.parent.inlineContent){let o=e<0?i:s,l=r instanceof Er?Ue.near(o,e):Ue.findFrom(o,e);return l?so(t,l):!1}return!1}function fA(t,e){if(!(t.state.selection instanceof Ie))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let o=t.state.tr;return e<0?o.delete(n.pos-s.nodeSize,n.pos):o.delete(n.pos,n.pos+s.nodeSize),t.dispatch(o),!0}return!1}function hA(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function f6(t){if(!Hn||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;hA(t,r,"true"),setTimeout(()=>hA(t,r,"false"),20)}return!1}function h6(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function p6(t,e){let n=e.keyCode,r=h6(e);if(n==8||Vr&&n==72&&r=="c")return fA(t,-1)||$l(t,-1);if(n==46&&!e.shiftKey||Vr&&n==68&&r=="c")return fA(t,1)||$l(t,1);if(n==13||n==27)return!0;if(n==37||Vr&&n==66&&r=="c"){let i=n==37?uA(t,t.state.selection.from)=="ltr"?-1:1:-1;return cA(t,i,r)||$l(t,i)}else if(n==39||Vr&&n==70&&r=="c"){let i=n==39?uA(t,t.state.selection.from)=="ltr"?1:-1:1;return cA(t,i,r)||$l(t,i)}else{if(n==38||Vr&&n==80&&r=="c")return dA(t,-1,r)||$l(t,-1);if(n==40||Vr&&n==78&&r=="c")return f6(t)||dA(t,1,r)||$l(t,1);if(r==(Vr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function $w(t,e){t.someProp("transformCopied",y=>{e=y(e,t)});let n=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let y=r.firstChild;n.push(y.type.name,y.attrs!=y.type.defaultAttrs?y.attrs:null),r=y.content}let o=t.someProp("clipboardSerializer")||Wa.fromSchema(t.state.schema),l=OD(),u=l.createElement("div");u.appendChild(o.serializeFragment(r,{document:l}));let f=u.firstChild,h,m=0;for(;f&&f.nodeType==1&&(h=ND[f.nodeName.toLowerCase()]);){for(let y=h.length-1;y>=0;y--){let x=l.createElement(h[y]);for(;u.firstChild;)x.appendChild(u.firstChild);u.appendChild(x),m++}f=u.firstChild}f&&f.nodeType==1&&f.setAttribute("data-pm-slice",`${i} ${s}${m?` -${m}`:""} ${JSON.stringify(n)}`);let g=t.someProp("clipboardTextSerializer",y=>y(e,t))||e.content.textBetween(0,e.content.size,`
|
|
71
|
-
|
|
72
|
-
`);return{dom:u,text:g,slice:e}}function _D(t,e,n,r,i){let s=i.parent.type.spec.code,o,l;if(!n&&!e)return null;let u=!!e&&(r||s||!n);if(u){if(t.someProp("transformPastedText",g=>{e=g(e,s||r,t)}),s)return l=new Se(ue.from(t.state.schema.text(e.replace(/\r\n?/g,`
|
|
73
|
-
`))),0,0),t.someProp("transformPasted",g=>{l=g(l,t,!0)}),l;let m=t.someProp("clipboardTextParser",g=>g(e,i,r,t));if(m)l=m;else{let g=i.marks(),{schema:y}=t.state,x=Wa.fromSchema(y);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(S=>{let k=o.appendChild(document.createElement("p"));S&&k.appendChild(x.serializeNode(y.text(S,g)))})}}else t.someProp("transformPastedHTML",m=>{n=m(n,t)}),o=v6(n),Wd&&b6(o);let f=o&&o.querySelector("[data-pm-slice]"),h=f&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(f.getAttribute("data-pm-slice")||"");if(h&&h[3])for(let m=+h[3];m>0;m--){let g=o.firstChild;for(;g&&g.nodeType!=1;)g=g.nextSibling;if(!g)break;o=g}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||ys.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(u||h),context:i,ruleFromNode(g){return g.nodeName=="BR"&&!g.nextSibling&&g.parentNode&&!m6.test(g.parentNode.nodeName)?{ignore:!0}:null}})),h)l=x6(pA(l,+h[1],+h[2]),h[4]);else if(l=Se.maxOpen(g6(l.content,i),!0),l.openStart||l.openEnd){let m=0,g=0;for(let y=l.content.firstChild;m<l.openStart&&!y.type.spec.isolating;m++,y=y.firstChild);for(let y=l.content.lastChild;g<l.openEnd&&!y.type.spec.isolating;g++,y=y.lastChild);l=pA(l,m,g)}return t.someProp("transformPasted",m=>{l=m(l,t,u)}),l}const m6=/^(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 g6(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),s,o=[];if(t.forEach(l=>{if(!o)return;let u=i.findWrapping(l.type),f;if(!u)return o=null;if(f=o.length&&s.length&&RD(u,s,l,o[o.length-1],0))o[o.length-1]=f;else{o.length&&(o[o.length-1]=MD(o[o.length-1],s.length));let h=AD(l,u);o.push(h),i=i.matchType(h.type),s=u}}),o)return ue.from(o)}return t}function AD(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,ue.from(t));return t}function RD(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=RD(t,e,n,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(ue.from(AD(n,t,i+1))))}}function MD(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,MD(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(ue.empty,!0);return t.copy(n.append(r))}function X0(t,e,n,r,i,s){let o=e<0?t.firstChild:t.lastChild,l=o.content;return t.childCount>1&&(s=0),i<r-1&&(l=X0(l,e,n,r,i+1,s)),i>=n&&(l=e<0?o.contentMatchAt(0).fillBefore(l,s<=i).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(ue.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(l))}function pA(t,e,n){return e<t.openStart&&(t=new Se(X0(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new Se(X0(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const ND={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};function OD(){return document.implementation.createHTMLDocument("title")}let pb=null;function y6(t){let e=window.trustedTypes;return e?(pb||(pb=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),pb.createHTML(t)):t}function v6(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=OD(),r=n.body,i=/<([a-z][^>\s]+)/i.exec(t),s;if((s=i&&ND[i[1].toLowerCase()])&&(t=s.map(o=>"<"+o+">").join("")+t+s.map(o=>"</"+o+">").reverse().join("")),r.innerHTML=y6(t),s)for(let o=0;o<s.length;o++)r=r.querySelector(s[o])||r;for(let o=0;o<n.styleSheets.length;o++){let l=n.styleSheets[o];for(let u=0;u<l.rules.length;u++){let f=l.rules[u];if(f instanceof CSSStyleRule){let h=r.querySelectorAll(f.selectorText);for(let m=0;m<h.length;m++)h[m].style.cssText+=f.style.cssText}}}return r}function b6(t){let e=t.querySelectorAll(Ln?"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 x6(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:i,openStart:s,openEnd:o}=t;for(let l=r.length-2;l>=0;l-=2){let u=n.nodes[r[l]];if(!u||u.hasRequiredAttrs())break;i=ue.from(u.create(r[l+1],i)),s++,o++}return new Se(i,s,o)}const Qn={},er={},w6={touchstart:!0,touchmove:!0};class S6{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 k6(t){for(let e in Qn){let n=Qn[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{E6(t,r)&&!Bw(t,r)&&(t.editable||!(r.type in er))&&n(t,r)},w6[e]?{passive:!0}:void 0)}Hn&&t.dom.addEventListener("input",()=>null),J0(t)}function gs(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function C6(t){t.input.mouseDown&&t.input.mouseDown.done(),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 J0(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Bw(t,r))})}function Bw(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function E6(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 T6(t,e){!Bw(t,e)&&Qn[e.type]&&(t.editable||!(e.type in er))&&Qn[e.type](t,e)}er.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!jD(t)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(ms&&Ln&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),gc&&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",i=>i(t,ma(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||p6(t,n)?n.preventDefault():gs(t,"key")};er.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};er.keypress=(t,e)=>{let n=e;if(jD(t)||!n.charCode||n.ctrlKey&&!n.altKey||Vr&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof Ie)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode),s=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,i,s))&&t.dispatch(s()),n.preventDefault()}};function Zd(t){return{left:t.clientX,top:t.clientY}}function _6(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Vw(t,e,n,r,i){if(r==-1)return!1;let s=t.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(t.someProp(e,l=>o>s.depth?l(t,n,s.nodeAfter,s.before(o),i,!0):l(t,n,s.node(o),s.before(o),i,!1)))return!0;return!1}function Yd(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 A6(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&Pe.isSelectable(r)?(Yd(t,new Pe(n)),!0):!1}function R6(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof Pe&&(r=n.node);let s=t.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let l=o>s.depth?s.nodeAfter:s.node(o);if(Pe.isSelectable(l)){r&&n.$from.depth>0&&o>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?i=s.before(n.$from.depth):i=s.before(o);break}}return i!=null?(Yd(t,Pe.create(t.state.doc,i)),!0):!1}function M6(t,e,n,r,i){return Vw(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?R6(t,n):A6(t,n))}function N6(t,e,n,r){return Vw(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function O6(t,e,n,r){return Vw(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||D6(t,n,r)}function D6(t,e,n){if(n.button!=0)return!1;let r=DD(t,e,!0),i=t.state.doc;return r?(Yd(t,r),r instanceof Ie&&i.eq(t.state.doc)&&(t.input.mouseDown=new L6(t,r)),!0):!1}function DD(t,e,n){let r=t.state.doc;if(e==-1)return r.inlineContent?Ie.create(r,0,r.content.size):null;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),l=i.before(s);if(o.inlineContent)return Ie.create(r,l+1,l+1+o.content.size);if(n&&Pe.isSelectable(o))return Pe.create(r,l)}return null}function Hw(t){return Pp(t)}const ID=Vr?"metaKey":"ctrlKey";Qn.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Hw(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&_6(n,t.input.lastClick)&&!n[ID]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:s,button:n.button},t.input.mouseDown&&t.input.mouseDown.done();let o=t.posAtCoords(Zd(n));o&&(s=="singleClick"?t.input.mouseDown=new I6(t,o,n,!!r):(s=="doubleClick"?N6:O6)(t,o.pos,o.inside,n)?n.preventDefault():gs(t,"pointer"))};class LD{constructor(e){this.view=e,this.mightDrag=null,e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this))}up(e){this.done()}move(e){e.buttons==0&&this.done()}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}}class I6 extends LD{constructor(e,n,r,i){super(e),this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.startDoc=e.state.doc,this.selectNode=!!r[ID],this.allowDefault=r.shiftKey;let s,o;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),o=n.inside;else{let h=e.state.doc.resolve(n.pos);s=h.parent,o=h.depth?h.before():0}const l=i?null:r.target,u=l?e.docView.nearestDesc(l,!0):null;this.target=u&&u.nodeDOM.nodeType==1?u.nodeDOM:null;let{selection:f}=e.state;r.button==0&&(s.type.spec.draggable&&s.type.spec.selectable!==!1||f instanceof Pe&&f.from<=o&&f.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Fr&&!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()),gs(e,"pointer")}done(){super.done(),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(()=>{this.view.isDestroyed||bs(this.view)})}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(Zd(e))),this.updateAllowDefault(e),this.allowDefault||!n?gs(this.view,"pointer"):M6(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Hn&&this.mightDrag&&!this.mightDrag.node.isAtom||Ln&&!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)?(Yd(this.view,Ue.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):gs(this.view,"pointer")}move(e){this.updateAllowDefault(e),gs(this.view,"pointer"),super.move(e)}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return this.allowDefault?(this.delayedSelectionSync=!0,!0):!1}}class L6 extends LD{constructor(e,n){super(e),this.startSelection=n,this.startDoc=e.state.doc}move(e){if(e.buttons==0||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc)){this.done();return}e.preventDefault(),gs(this.view,"pointer");let n=this.view.posAtCoords(Zd(e)),r=n&&DD(this.view,n.inside,!1);if(!r)return;let{doc:i}=this.view.state,s=this.startSelection,[o,l]=r.from<s.from?[s.to,r.from]:[s.from,r.to];Yd(this.view,Ie.create(i,o,l))}}Qn.touchstart=t=>{t.input.lastTouch=Date.now(),Hw(t),gs(t,"pointer")};Qn.touchmove=t=>{t.input.lastTouch=Date.now(),gs(t,"pointer")};Qn.contextmenu=t=>Hw(t);function jD(t,e){return t.composing?!0:Hn&&Math.abs(Date.now()-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const j6=ms?5e3:-1;er.compositionstart=er.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Ie&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Ln&&dD&&P6(t)))t.markCursor=t.state.storedMarks||n.marks(),Pp(t,!0),t.markCursor=null;else if(Pp(t,!e.selection.empty),Fr&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){let l=t.domSelection();l&&l.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}t.input.composing=!0}PD(t,j6)};function P6(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"}er.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Date.now(),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++,PD(t,20))};function PD(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Pp(t),e))}function zD(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Date.now());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function z6(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=R4(e.focusNode,e.focusOffset),r=M4(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,s=t.domObserver.lastChangedTextNode;if(n==s||r==s)return s;if(!i||!i.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 Pp(t,e=!1){if(!(ms&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),zD(t),e||t.docView&&t.docView.dirty){let n=Pw(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 $6(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(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Ed=dr&&Co<15||gc&&I4<604;Qn.copy=er.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=Ed?null:n.clipboardData,o=r.content(),{dom:l,text:u}=$w(t,o);s?(n.preventDefault(),s.clearData(),s.setData("text/html",l.innerHTML),s.setData("text/plain",u)):$6(t,l),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function B6(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function V6(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 i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Td(t,r.value,null,i,e):Td(t,r.textContent,r.innerHTML,i,e)},50)}function Td(t,e,n,r,i){let s=_D(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",u=>u(t,i,s||Se.empty)))return!0;if(!s)return!1;let o=B6(s),l=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(s);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function $D(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," "):""}er.paste=(t,e)=>{let n=e;if(t.composing&&!ms)return;let r=Ed?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Td(t,$D(r),r.getData("text/html"),i,n)?n.preventDefault():V6(t,n)};class BD{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const H6=Vr?"altKey":"ctrlKey";function VD(t,e){let n;return t.someProp("dragCopies",r=>{n=n||r(e)}),n!=null?!n:!e[H6]}Qn.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,s=i.empty?null:t.posAtCoords(Zd(n)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof Pe?i.to-1:i.to))){if(r&&r.mightDrag)o=Pe.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let m=t.docView.nearestDesc(n.target,!0);m&&m.node.type.spec.draggable&&m!=t.docView&&(o=Pe.create(t.state.doc,m.posBefore))}}let l=(o||t.state.selection).content(),{dom:u,text:f,slice:h}=$w(t,l);(!n.dataTransfer.files.length||!Ln||uD>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Ed?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",Ed||n.dataTransfer.setData("text/plain",f),t.dragging=new BD(h,VD(t,n),o)};Qn.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};er.dragover=er.dragenter=(t,e)=>e.preventDefault();er.drop=(t,e)=>{try{U6(t,e,t.dragging)}finally{t.dragging=null}};function U6(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Zd(e));if(!r)return;let i=t.state.doc.resolve(r.pos),s=n&&n.slice;s?t.someProp("transformPasted",y=>{s=y(s,t,!1)}):s=_D(t,$D(e.dataTransfer),Ed?null:e.dataTransfer.getData("text/html"),!1,i);let o=!!(n&&VD(t,e));if(t.someProp("handleDrop",y=>y(t,e,s||Se.empty,o))){e.preventDefault();return}if(!s)return;e.preventDefault();let l=s?HO(t.state.doc,i.pos,s):i.pos;l==null&&(l=i.pos);let u=t.state.tr;if(o){let{node:y}=n;y?y.replace(u):u.deleteSelection()}let f=u.mapping.map(l),h=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,m=u.doc;if(h?u.replaceRangeWith(f,f,s.content.firstChild):u.replaceRange(f,f,s),u.doc.eq(m))return;let g=u.doc.resolve(f);if(h&&Pe.isSelectable(s.content.firstChild)&&g.nodeAfter&&g.nodeAfter.sameMarkup(s.content.firstChild))u.setSelection(new Pe(g));else{let y=u.mapping.map(l);u.mapping.maps[u.mapping.maps.length-1].forEach((x,S,k,C)=>y=C),u.setSelection(zw(t,g,u.doc.resolve(y)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))}Qn.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())&&bs(t)},20))};Qn.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)};Qn.beforeinput=(t,e)=>{if(ms&&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",s=>s(t,ma(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in er)Qn[t]=er[t];function _d(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 zp{constructor(e,n){this.toDOM=e,this.spec=n||Ta,this.side=this.spec.side||0}map(e,n,r,i){let{pos:s,deleted:o}=e.mapResult(n.from+i,this.side<0?-1:1);return o?null:new yn(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof zp&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&_d(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class _o{constructor(e,n){this.attrs=e,this.spec=n||Ta}map(e,n,r,i){let s=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new yn(s,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof _o&&_d(this.attrs,e.attrs)&&_d(this.spec,e.spec)}static is(e){return e.type instanceof _o}destroy(){}}class Uw{constructor(e,n){this.attrs=e,this.spec=n||Ta}map(e,n,r,i){let s=e.mapResult(n.from+i,1);if(s.deleted)return null;let o=e.mapResult(n.to+i,-1);return o.deleted||o.pos<=s.pos?null:new yn(s.pos-r,o.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),s;return i==n.from&&!(s=e.child(r)).isText&&i+s.nodeSize==n.to}eq(e){return this==e||e instanceof Uw&&_d(this.attrs,e.attrs)&&_d(this.spec,e.spec)}destroy(){}}class yn{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new yn(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 yn(e,e,new zp(n,r))}static inline(e,n,r,i){return new yn(e,n,new _o(r,i))}static node(e,n,r,i){return new yn(e,n,new Uw(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof _o}get widget(){return this.type instanceof zp}}const Kl=[],Ta={};class bt{constructor(e,n){this.local=e.length?e:Kl,this.children=n.length?n:Kl}static create(e,n){return n.length?$p(n,e,0,Ta):Bn}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,s){for(let o=0;o<this.local.length;o++){let l=this.local[o];l.from<=n&&l.to>=e&&(!s||s(l.spec))&&r.push(l.copy(l.from+i,l.to+i))}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,i+l,s)}}map(e,n,r){return this==Bn||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Ta)}mapInner(e,n,r,i,s){let o;for(let l=0;l<this.local.length;l++){let u=this.local[l].map(e,r,i);u&&u.type.valid(n,u)?(o||(o=[])).push(u):s.onRemove&&s.onRemove(this.local[l].spec)}return this.children.length?F6(this.children,o||[],e,n,r,i,s):o?new bt(o.sort(_a),Kl):Bn}add(e,n){return n.length?this==Bn?bt.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,s=0;e.forEach((l,u)=>{let f=u+r,h;if(h=UD(n,l,f)){for(i||(i=this.children.slice());s<i.length&&i[s]<u;)s+=3;i[s]==u?i[s+2]=i[s+2].addInner(l,h,f+1):i.splice(s,0,u,u+l.nodeSize,$p(h,l,f+1,Ta)),s+=3}});let o=HD(s?FD(n):n,-r);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||o.splice(l--,1);return new bt(o.length?this.local.concat(o).sort(_a):this.local,i||this.children)}remove(e){return e.length==0||this==Bn?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let o,l=r[s]+n,u=r[s+1]+n;for(let h=0,m;h<e.length;h++)(m=e[h])&&m.from>l&&m.to<u&&(e[h]=null,(o||(o=[])).push(m));if(!o)continue;r==this.children&&(r=this.children.slice());let f=r[s+2].removeInner(o,l+1);f!=Bn?r[s+2]=f:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let l=0;l<i.length;l++)i[l].eq(o,n)&&(i==this.local&&(i=this.local.slice()),i.splice(l--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new bt(i,r):Bn}forChild(e,n){if(this==Bn)return this;if(n.isLeaf)return bt.empty;let r,i;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 s=e+1,o=s+n.content.size;for(let l=0;l<this.local.length;l++){let u=this.local[l];if(u.from<o&&u.to>s&&u.type instanceof _o){let f=Math.max(s,u.from)-s,h=Math.min(o,u.to)-s;f<h&&(i||(i=[])).push(u.copy(f,h))}}if(i){let l=new bt(i.sort(_a),Kl);return r?new ho([l,r]):l}return r||Bn}eq(e){if(this==e)return!0;if(!(e instanceof bt)||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 Fw(this.localsInner(e))}localsInner(e){if(this==Bn)return Kl;if(e.inlineContent||!this.local.some(_o.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof _o||n.push(this.local[r]);return n}forEachSet(e){e(this)}}bt.empty=new bt([],[]);bt.removeOverlap=Fw;const Bn=bt.empty;class ho{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,Ta));return ho.from(r)}forChild(e,n){if(n.isLeaf)return bt.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=Bn&&(s instanceof ho?r=r.concat(s.members):r.push(s))}return ho.from(r)}eq(e){if(!(e instanceof ho)||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 i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!n)n=s;else{r&&(n=n.slice(),r=!1);for(let o=0;o<s.length;o++)n.push(s[o])}}return n?Fw(r?n:n.sort(_a)):Kl}static from(e){switch(e.length){case 0:return Bn;case 1:return e[0];default:return new ho(e.every(n=>n instanceof bt)?e:e.reduce((n,r)=>n.concat(r instanceof bt?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function F6(t,e,n,r,i,s,o){let l=t.slice();for(let f=0,h=s;f<n.maps.length;f++){let m=0;n.maps[f].forEach((g,y,x,S)=>{let k=S-x-(y-g);for(let C=0;C<l.length;C+=3){let T=l[C+1];if(T<0||g>T+h-m)continue;let _=l[C]+h-m;y>=_?l[C+1]=g<=_?-2:-1:g>=h&&k&&(l[C]+=k,l[C+1]+=k)}m+=k}),h=n.maps[f].map(h,-1)}let u=!1;for(let f=0;f<l.length;f+=3)if(l[f+1]<0){if(l[f+1]==-2){u=!0,l[f+1]=-1;continue}let h=n.map(t[f]+s),m=h-i;if(m<0||m>=r.content.size){u=!0;continue}let g=n.map(t[f+1]+s,-1),y=g-i,{index:x,offset:S}=r.content.findIndex(m),k=r.maybeChild(x);if(k&&S==m&&S+k.nodeSize==y){let C=l[f+2].mapInner(n,k,h+1,t[f]+s+1,o);C!=Bn?(l[f]=m,l[f+1]=y,l[f+2]=C):(l[f+1]=-2,u=!0)}else u=!0}if(u){let f=q6(l,t,e,n,i,s,o),h=$p(f,r,0,o);e=h.local;for(let m=0;m<l.length;m+=3)l[m+1]<0&&(l.splice(m,3),m-=3);for(let m=0,g=0;m<h.children.length;m+=3){let y=h.children[m];for(;g<l.length&&l[g]<y;)g+=3;l.splice(g,0,h.children[m],h.children[m+1],h.children[m+2])}}return new bt(e.sort(_a),l)}function HD(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new yn(i.from+e,i.to+e,i.type))}return n}function q6(t,e,n,r,i,s,o){function l(u,f){for(let h=0;h<u.local.length;h++){let m=u.local[h].map(r,i,f);m?n.push(m):o.onRemove&&o.onRemove(u.local[h].spec)}for(let h=0;h<u.children.length;h+=3)l(u.children[h+2],u.children[h]+f+1)}for(let u=0;u<t.length;u+=3)t[u+1]==-1&&l(t[u+2],e[u]+s+1);return n}function UD(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let s=0,o;s<t.length;s++)(o=t[s])&&o.from>n&&o.to<r&&((i||(i=[])).push(o),t[s]=null);return i}function FD(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function $p(t,e,n,r){let i=[],s=!1;e.forEach((l,u)=>{let f=UD(t,l,u+n);if(f){s=!0;let h=$p(f,l,n+u+1,r);h!=Bn&&i.push(u,u+l.nodeSize,h)}});let o=HD(s?FD(t):t,-n).sort(_a);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||i.length?new bt(o,i):Bn}function _a(t,e){return t.from-e.from||t.to-e.to}function Fw(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let i=n+1;i<e.length;i++){let s=e[i];if(s.from==r.from){s.to!=r.to&&(e==t&&(e=t.slice()),e[i]=s.copy(s.from,r.to),mA(e,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,s.from),mA(e,i,r.copy(s.from,r.to)));break}}}return e}function mA(t,e,n){for(;e<t.length&&_a(n,t[e])>0;)e++;t.splice(e,0,n)}function mb(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Bn&&e.push(r)}),t.cursorWrapper&&e.push(bt.create(t.state.doc,[t.cursorWrapper.deco])),ho.from(e)}const G6={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},W6=dr&&Co<=11;class K6{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 Z6{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new K6,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);dr&&Co<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():Hn&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),W6&&(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,G6)),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(lA(this.view)){if(this.suppressingSelectionUpdates)return bs(this.view);if(dr&&Co<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&ja(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 s=e.focusNode;s;s=mc(s))n.add(s);for(let s=e.anchorNode;s;s=mc(s))if(n.has(s)){r=s;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.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(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&lA(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,l=!1,u=[];if(e.editable)for(let h=0;h<n.length;h++){let m=this.registerMutation(n[h],u);m&&(s=s<0?m.from:Math.min(m.from,s),o=o<0?m.to:Math.max(m.to,o),m.typeOver&&(l=!0))}if(u.some(h=>h.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46||Ln&&(e.composing||e.input.compositionEndedAt>Date.now()-50)&&n.some(h=>h.type=="childList"&&h.removedNodes.length))){for(let h of u)if(h.nodeName=="BR"&&h.parentNode){let m=h.nextSibling;for(;m&&m.nodeType==1;){if(m.contentEditable=="false"){h.parentNode.removeChild(h);break}m=m.firstChild}}}else if(Fr&&u.length){let h=u.filter(m=>m.nodeName=="BR");if(h.length==2){let[m,g]=h;m.parentNode&&m.parentNode.parentNode==g.parentNode?g.remove():m.remove()}else{let{focusNode:m}=this.currentSelection;for(let g of h){let y=g.parentNode;y&&y.nodeName=="LI"&&(!m||J6(e,m)!=y)&&g.remove()}}}let f=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&qm(r)&&(f=Pw(e))&&f.eq(Ue.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,bs(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),Y6(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,Q6(e,u)),this.handleDOMChange(s,o,l,u),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||bs(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 h=0;h<e.addedNodes.length;h++){let m=e.addedNodes[h];n.push(m),m.nodeType==3&&(this.lastChangedTextNode=m)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,s=e.nextSibling;if(dr&&Co<=11&&e.addedNodes.length)for(let h=0;h<e.addedNodes.length;h++){let{previousSibling:m,nextSibling:g}=e.addedNodes[h];(!m||Array.prototype.indexOf.call(e.addedNodes,m)<0)&&(i=m),(!g||Array.prototype.indexOf.call(e.addedNodes,g)<0)&&(s=g)}let o=i&&i.parentNode==e.target?Dn(i)+1:0,l=r.localPosFromDOM(e.target,o,-1),u=s&&s.parentNode==e.target?Dn(s):e.target.childNodes.length,f=r.localPosFromDOM(e.target,u,1);return{from:l,to:f}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let gA=new WeakMap,yA=!1;function Y6(t){if(!gA.has(t)&&(gA.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Fr,yA)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."),yA=!0}}function vA(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=t.domAtPos(t.state.selection.anchor);return ja(o.node,o.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function X6(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return vA(t,i)}let n;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?vA(t,n):null}function J6(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 Q6(t,e){var n;let{focusNode:r,focusOffset:i}=t.domSelectionRange();for(let s of e)if(((n=s.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let o=s.nextSibling;for(;o&&o.nodeName!="TD"&&o.nodeName!="TH";)o=o.nextSibling;if(o){let l=o;for(;;){let u=l.firstChild;if(!u||u.nodeType!=1||u.contentEditable=="false"||/^(BR|IMG)$/.test(u.nodeName))break;l=u}l.insertBefore(s,l.firstChild),r==s&&t.domSelection().collapse(s,i)}else s.parentNode.removeChild(s)}}function e5(t,e,n,r){let{node:i,fromOffset:s,toOffset:o,from:l,to:u}=t.docView.parseRange(e,n),f=t.domSelectionRange(),h,m=f.anchorNode;if(m&&t.dom.contains(m.nodeType==1?m:m.parentNode)&&(h=[{node:m,offset:f.anchorOffset}],qm(f)||h.push({node:f.focusNode,offset:f.focusOffset})),Ln&&t.input.lastKeyCode===8)for(let C=o;C>s;C--){let T=i.childNodes[C-1],_=T.pmViewDesc;if(T.nodeName=="BR"&&!_){o=C;break}if(!_||_.size)break}let g=t.state.doc,y=t.someProp("domParser")||ys.fromSchema(t.state.schema),x=g.resolve(l),S=null,k=y.parse(i,{topNode:x.parent,topMatch:x.parent.contentMatchAt(x.index()),topOpen:!0,from:s,to:o,preserveWhitespace:x.parent.type.whitespace=="pre"?"full":!0,findPositions:h,ruleFromNode:t5(r),context:x});if(h&&h[0].pos!=null){let C=h[0].pos,T=h[1]&&h[1].pos;T==null&&(T=C),S={anchor:C+l,head:T+l}}return{doc:k,sel:S,from:l,to:u}}const t5=t=>e=>{let n=e.pmViewDesc;if(n)return n.parseRule(t);if(e.nodeName=="BR"&&e.parentNode){if(Hn&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let r=document.createElement("div");return r.appendChild(document.createElement("li")),{skip:r}}else if(e.parentNode.lastChild==e||Hn&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null},n5=/^(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 r5(t,e,n,r,i){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let L=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,P=Pw(t,L);if(P&&!t.state.selection.eq(P)){if(Ln&&ms&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",G=>G(t,ma(13,"Enter"))))return;let U=t.state.tr.setSelection(P);L=="pointer"?U.setMeta("pointer",!0):L=="key"&&U.scrollIntoView(),s&&U.setMeta("composition",s),t.dispatch(U)}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 u=t.state.selection,f=e5(t,e,n,i),h=t.state.doc,m=h.slice(f.from,f.to),g,y;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(g=t.state.selection.to,y="end"):(g=t.state.selection.from,y="start"),t.input.lastKeyCode=null;let x=o5(m.content,f.doc.content,f.from,g,y);if(x&&t.input.domChangeCount++,(gc&&t.input.lastIOSEnter>Date.now()-225||ms)&&i.some(L=>L.nodeType==1&&!n5.test(L.nodeName))&&(!x||x.endA>=x.endB)&&t.someProp("handleKeyDown",L=>L(t,ma(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!x)if(r&&u instanceof Ie&&!u.empty&&u.$head.sameParent(u.$anchor)&&!t.composing&&!(f.sel&&f.sel.anchor!=f.sel.head))x={start:u.from,endA:u.to,endB:u.to};else{if(f.sel){let L=bA(t,t.state.doc,f.sel);if(L&&!L.eq(t.state.selection)){let P=t.state.tr.setSelection(L);s&&P.setMeta("composition",s),t.dispatch(P)}}return}t.state.selection.from<t.state.selection.to&&x.start==x.endB&&t.state.selection instanceof Ie&&(x.start>t.state.selection.from&&x.start<=t.state.selection.from+2&&t.state.selection.from>=f.from?x.start=t.state.selection.from:x.endA<t.state.selection.to&&x.endA>=t.state.selection.to-2&&t.state.selection.to<=f.to&&(x.endB+=t.state.selection.to-x.endA,x.endA=t.state.selection.to)),dr&&Co<=11&&x.endB==x.start+1&&x.endA==x.start&&x.start>f.from&&f.doc.textBetween(x.start-f.from-1,x.start-f.from+1)==" "&&(x.start--,x.endA--,x.endB--);let S=f.doc.resolveNoCache(x.start-f.from),k=f.doc.resolveNoCache(x.endB-f.from),C=h.resolve(x.start),T=S.sameParent(k)&&S.parent.inlineContent&&C.end()>=x.endA;if((gc&&t.input.lastIOSEnter>Date.now()-225&&(!T||i.some(L=>L.nodeName=="DIV"||L.nodeName=="P"))||!T&&S.pos<f.doc.content.size&&(!S.sameParent(k)||!S.parent.inlineContent)&&S.pos<k.pos&&!/\S/.test(f.doc.textBetween(S.pos,k.pos,"","")))&&t.someProp("handleKeyDown",L=>L(t,ma(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>x.start&&s5(h,x.start,x.endA,S,k)&&t.someProp("handleKeyDown",L=>L(t,ma(8,"Backspace")))){ms&&Ln&&t.domObserver.suppressSelectionUpdates();return}Ln&&x.endB==x.start&&(t.input.lastChromeDelete=Date.now()),ms&&!T&&S.start()!=k.start()&&k.parentOffset==0&&S.depth==k.depth&&f.sel&&f.sel.anchor==f.sel.head&&f.sel.head==x.endA&&(x.endB-=2,k=f.doc.resolveNoCache(x.endB-f.from),setTimeout(()=>{t.someProp("handleKeyDown",function(L){return L(t,ma(13,"Enter"))})},20));let _=x.start,R=x.endA,M=L=>{let P=L||t.state.tr.replace(_,R,f.doc.slice(x.start-f.from,x.endB-f.from));if(f.sel){let U=bA(t,P.doc,f.sel);U&&!(Ln&&t.composing&&U.empty&&(x.start!=x.endB||t.input.lastChromeDelete<Date.now()-100)&&(U.head==_||U.head==P.mapping.map(R)-1)||dr&&U.empty&&U.head==_)&&P.setSelection(U)}return s&&P.setMeta("composition",s),P.scrollIntoView()},O;if(T)if(S.pos==k.pos){dr&&Co<=11&&S.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>bs(t),20));let L=M(t.state.tr.delete(_,R)),P=h.resolve(x.start).marksAcross(h.resolve(x.endA));P&&L.ensureMarks(P),t.dispatch(L)}else if(x.endA==x.endB&&(O=i5(S.parent.content.cut(S.parentOffset,k.parentOffset),C.parent.content.cut(C.parentOffset,x.endA-C.start())))){let L=M(t.state.tr);O.type=="add"?L.addMark(_,R,O.mark):L.removeMark(_,R,O.mark),t.dispatch(L)}else if(S.parent.child(S.index()).isText&&S.index()==k.index()-(k.textOffset?0:1)){let L=S.parent.textBetween(S.parentOffset,k.parentOffset),P=()=>M(t.state.tr.insertText(L,_,R));t.someProp("handleTextInput",U=>U(t,_,R,L,P))||t.dispatch(P())}else t.dispatch(M());else t.dispatch(M())}function bA(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:zw(t,e.resolve(n.anchor),e.resolve(n.head))}function i5(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,s=r,o,l,u;for(let h=0;h<r.length;h++)i=r[h].removeFromSet(i);for(let h=0;h<n.length;h++)s=n[h].removeFromSet(s);if(i.length==1&&s.length==0)l=i[0],o="add",u=h=>h.mark(l.addToSet(h.marks));else if(i.length==0&&s.length==1)l=s[0],o="remove",u=h=>h.mark(l.removeFromSet(h.marks));else return null;let f=[];for(let h=0;h<e.childCount;h++)f.push(u(e.child(h)));if(ue.from(f).eq(t))return{mark:l,type:o}}function s5(t,e,n,r,i){if(n-e<=i.pos-r.pos||gb(r,!0,!1)<i.pos)return!1;let s=t.resolve(e);if(!r.parent.isTextblock){let l=s.nodeAfter;return l!=null&&n==e+l.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=t.resolve(gb(s,!0,!0));return!o.parent.isTextblock||o.pos>n||gb(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function gb(t,e,n){let r=t.depth,i=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let s=t.node(r).maybeChild(t.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function o5(t,e,n,r,i){let s=t.findDiffStart(e,n),o=n+t.size,l=n+e.size;if(s==null)return null;let{a:u,b:f}=t.findDiffEnd(e,o,l);if(i=="end"){let h=Math.max(0,s-Math.min(u,f));r-=u+h-s}if(u<s&&o<l){let h=r<=s&&r>=u?s-r:0;s-=h,f=s+(f-u),u=s}else if(f<s){let h=r<=s&&r>=f?s-r:0;s-=h,u=s+(u-f),f=s}return{start:s,endA:u,endB:f}}class qD{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 S6,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(CA),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=SA(this),wA(this),this.nodeViews=kA(this),this.docView=nA(this.state.doc,xA(this),mb(this),this.dom,this),this.domObserver=new Z6(this,(r,i,s,o)=>r5(this,r,i,s,o)),this.domObserver.start(),k6(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&&J0(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(CA),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 i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(zD(this),o=!0),this.state=e;let l=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(l||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let y=kA(this);l5(y,this.nodeViews)&&(this.nodeViews=y,s=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&J0(this),this.editable=SA(this),wA(this);let u=mb(this),f=xA(this),h=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",m=s||!this.docView.matchesNode(e.doc,f,u);(m||!e.selection.eq(i.selection))&&(o=!0);let g=h=="preserve"&&o&&this.dom.style.overflowAnchor==null&&P4(this);if(o){this.domObserver.stop();let y=m&&(dr||Ln)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&a5(i.selection,e.selection);if(m){let S=Ln?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=z6(this)),(s||!this.docView.update(e.doc,f,u,this))&&(this.docView.updateOuterDeco(f),this.docView.destroy(),this.docView=nA(e.doc,f,u,this.dom,this)),S&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(y=!0)}let x=this.input.mouseDown;y||!(x&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&a6(this)&&x.delaySelUpdate())?bs(this,y):(CD(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),h=="reset"?this.dom.scrollTop=0:h=="to selection"?this.scrollToSelection():g&&z4(g)}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 Pe){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&X_(this,n.getBoundingClientRect(),e)}else X_(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,i=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let s=r.from+(this.state.doc.content.size-n.doc.content.size);(s>0&&s<this.state.doc.content.size&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new BD(e.slice,e.move,i<0?void 0:Pe.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let o=0;o<this.directPlugins.length;o++){let l=this.directPlugins[o].props[e];if(l!=null&&(i=n?n(l):l))return i}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let l=s[o].props[e];if(l!=null&&(i=n?n(l):l))return i}}hasFocus(){if(dr){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&&$4(this.dom),bs(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 F4(this,e)}coordsAtPos(e,n=1){return gD(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 i=this.docView.posFromDOM(e,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return Z4(this,n||this.state,e)}pasteHTML(e,n){return Td(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Td(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return $w(this,e)}destroy(){this.docView&&(C6(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],mb(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,_4())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return T6(this,e)}domSelectionRange(){let e=this.domSelection();return e?Hn&&this.root.nodeType===11&&O4(this.dom.ownerDocument)==this.dom&&X6(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}qD.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function xA(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"),[yn.node(0,t.state.doc.content.size,e)]}function wA(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:yn.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function SA(t){return!t.someProp("editable",e=>e(t.state)===!1)}function a5(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 kA(t){let e=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function l5(t,e){let n=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)r++;return n!=r}function CA(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 Oo={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:"'"},Bp={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},c5=typeof navigator<"u"&&/Mac/.test(navigator.platform),u5=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var In=0;In<10;In++)Oo[48+In]=Oo[96+In]=String(In);for(var In=1;In<=24;In++)Oo[In+111]="F"+In;for(var In=65;In<=90;In++)Oo[In]=String.fromCharCode(In+32),Bp[In]=String.fromCharCode(In);for(var yb in Oo)Bp.hasOwnProperty(yb)||(Bp[yb]=Oo[yb]);function d5(t){var e=c5&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||u5&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Bp:Oo)[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 f5=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),h5=typeof navigator<"u"&&/Win/.test(navigator.platform);function p5(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,s,o;for(let l=0;l<e.length-1;l++){let u=e[l];if(/^(cmd|meta|m)$/i.test(u))o=!0;else if(/^a(lt)?$/i.test(u))r=!0;else if(/^(c|ctrl|control)$/i.test(u))i=!0;else if(/^s(hift)?$/i.test(u))s=!0;else if(/^mod$/i.test(u))f5?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+u)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),o&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function m5(t){let e=Object.create(null);for(let n in t)e[p5(n)]=t[n];return e}function vb(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 g5(t){return new Nt({props:{handleKeyDown:qw(t)}})}function qw(t){let e=m5(t);return function(n,r){let i=d5(r),s,o=e[vb(i,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let l=e[vb(i,r,!1)];if(l&&l(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(h5&&r.ctrlKey&&r.altKey)&&(s=Oo[r.keyCode])&&s!=i){let l=e[vb(s,r)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}var y5=Object.defineProperty,Gw=(t,e)=>{for(var n in e)y5(t,n,{get:e[n],enumerable:!0})};function Wm(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:i}=n,{storedMarks:s}=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 s},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,s=n.storedMarks,n}}}var Km=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:i}=n,s=this.buildProps(i);return Object.fromEntries(Object.entries(t).map(([o,l])=>[o,(...f)=>{const h=l(...f)(s);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(i),h}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:i}=this,{view:s}=r,o=[],l=!!t,u=t||i.tr,f=()=>(!l&&e&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(u),o.every(m=>m===!0)),h={...Object.fromEntries(Object.entries(n).map(([m,g])=>[m,(...x)=>{const S=this.buildProps(u,e),k=g(...x)(S);return o.push(k),h}])),run:f};return h}createCan(t){const{rawCommands:e,state:n}=this,r=!1,i=t||n.tr,s=this.buildProps(i,r);return{...Object.fromEntries(Object.entries(e).map(([l,u])=>[l,(...f)=>u(...f)({...s,dispatch:void 0})])),chain:()=>this.createChain(i,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:i}=this,{view:s}=r,o={tr:t,editor:r,view:s,state:Wm({state:i,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,u])=>[l,(...f)=>u(...f)(o)]))}};return o}},ti={};Gw(ti,{blur:()=>v5,clearContent:()=>b5,clearNodes:()=>x5,command:()=>w5,createParagraphNear:()=>S5,cut:()=>k5,deleteCurrentNode:()=>C5,deleteNode:()=>E5,deleteRange:()=>T5,deleteSelection:()=>R5,enter:()=>M5,exitCode:()=>N5,extendMarkRange:()=>O5,first:()=>D5,focus:()=>L5,forEach:()=>j5,insertContent:()=>P5,insertContentAt:()=>$5,insertDefaultBlock:()=>B5,joinBackward:()=>U5,joinDown:()=>H5,joinForward:()=>F5,joinItemBackward:()=>q5,joinItemForward:()=>G5,joinTextblockBackward:()=>W5,joinTextblockForward:()=>K5,joinUp:()=>V5,keyboardShortcut:()=>Y5,lift:()=>X5,liftEmptyBlock:()=>J5,liftListItem:()=>Q5,newlineInCode:()=>eq,resetAttributes:()=>tq,scrollIntoView:()=>nq,selectAll:()=>rq,selectNodeBackward:()=>iq,selectNodeForward:()=>sq,selectParentNode:()=>oq,selectTextblockEnd:()=>aq,selectTextblockStart:()=>lq,setContent:()=>cq,setMark:()=>Aq,setMeta:()=>Rq,setNode:()=>Mq,setNodeSelection:()=>Nq,setTextDirection:()=>Oq,setTextSelection:()=>Dq,sinkListItem:()=>Iq,splitBlock:()=>Lq,splitListItem:()=>jq,toggleList:()=>zq,toggleMark:()=>$q,toggleNode:()=>Bq,toggleWrap:()=>Vq,undoInputRule:()=>Hq,unsetAllMarks:()=>Uq,unsetMark:()=>Fq,unsetTextDirection:()=>qq,updateAttributes:()=>Gq,wrapIn:()=>Wq,wrapInList:()=>Kq});var v5=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())==null||n.removeAllRanges())}),!0),b5=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),x5=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:s,$to:o})=>{t.doc.nodesBetween(s.pos,o.pos,(l,u)=>{if(l.type.isText)return;const{doc:f,mapping:h}=e,m=f.resolve(h.map(u)),g=f.resolve(h.map(u+l.nodeSize)),y=m.blockRange(g);if(!y)return;const x=Rc(y);if(l.type.isTextblock){const{defaultType:S}=m.parent.contentMatchAt(m.index());e.setNodeMarkup(y.start,S)}(x||x===0)&&e.lift(y,x)})}),!0},w5=t=>e=>t(e),S5=()=>({state:t,dispatch:e})=>sD(t,e),k5=(t,e)=>({editor:n,tr:r})=>{const{state:i}=n,s=i.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,s.content),r.setSelection(new Ie(r.doc.resolve(Math.max(o-1,0)))),!0},C5=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const i=t.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(e){const l=i.before(s),u=i.after(s);t.delete(l,u).scrollIntoView()}return!0}return!1};function cn(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 E5=t=>({tr:e,state:n,dispatch:r})=>{const i=cn(t,n.schema),s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===i){if(r){const u=s.before(o),f=s.after(o);e.delete(u,f).scrollIntoView()}return!0}return!1},T5=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},_5=t=>t.content?/^text(\*|\+)/.test(t.content):!1,EA=(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 _5(r)?n==="left"?t.start()-1:t.end()+1:t.pos},A5=(t,e,n)=>{const r=EA(t,n,"left"),i=EA(e,n,"right");return{from:r,to:i}},R5=()=>({state:t,dispatch:e})=>{if(t.selection.empty)return!1;if(e){const n=t.tr,{ranges:r}=t.selection,i=n.steps.length;r.forEach(s=>{const o=n.mapping.slice(i),l=n.doc.resolve(o.map(s.$from.pos)),u=n.doc.resolve(o.map(s.$to.pos)),{from:f,to:h}=A5(l,u,t.schema);n.deleteRange(f,h)}),n.selection.empty||n.setSelection(Ie.near(n.doc.resolve(n.selection.from))),n.scrollIntoView(),e(n)}return!0},M5=()=>({commands:t})=>t.keyboardShortcut("Enter"),N5=()=>({state:t,dispatch:e})=>f4(t,e);function Ww(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Vp(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:Ww(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function GD(t,e,n={}){return t.find(r=>r.type===e&&Vp(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function TA(t,e,n={}){return!!GD(t,e,n)}function Kw(t,e,n){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if((!r.node||!r.node.marks.some(f=>f.type===e))&&(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(f=>f.type===e))return;if(!n){const f=r.node.marks.find(h=>h.type===e);f&&(n=f.attrs)}if(!GD([...r.node.marks],e,n))return;let s=r.index,o=t.start()+r.offset,l=s+1,u=o+r.node.nodeSize;for(;s>0&&TA([...t.parent.child(s-1).marks],e,n);)s-=1,o-=t.parent.child(s).nodeSize;for(;l<t.parent.childCount&&TA([...t.parent.child(l).marks],e,n);)u+=t.parent.child(l).nodeSize,l+=1;return{from:o,to:u}}function As(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 O5=(t,e)=>({tr:n,state:r,dispatch:i})=>{const s=As(t,r.schema),{doc:o,selection:l}=n,{$from:u,from:f,to:h}=l;if(i){const m=Kw(u,s,e);if(m&&m.from<=f&&m.to>=h){const g=Ie.create(o,m.from,m.to);n.setSelection(g)}}return!0},D5=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 WD(t){return t instanceof Ie}function wa(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function Q0(t,e=null){if(!e)return null;const n=Ue.atStart(t),r=Ue.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,s=r.to;return e==="all"?Ie.create(t,wa(0,i,s),wa(t.content.size,i,s)):Ie.create(t,wa(e,i,s),wa(e,i,s))}function _A(){return["Android"].includes(navigator.platform)||/android/i.test(navigator.userAgent)}function Hp(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function I5(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var L5=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{(Hp()||_A())&&r.dom.focus(),I5()&&!Hp()&&!_A()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e?.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&t===null||t===!1)return!0}catch{return!1}if(s&&t===null&&!WD(n.state.selection))return o(),!0;const l=Q0(i.doc,t)||n.state.selection,u=n.state.selection.eq(l);return s&&(u||i.setSelection(l),u&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},j5=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),P5=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),KD=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&&KD(r)}return t};function Hu(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 KD(n)}function yc(t,e,n){if(t instanceof ko||t instanceof ue)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,i=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return ue.fromArray(t.map(l=>e.nodeFromJSON(l)));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}catch(s){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",s),yc("",e,n)}if(i){if(n.errorOnInvalidContent){let o=!1,l="";const u=new NO({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:f=>(o=!0,l=typeof f=="string"?f:f.outerHTML,null)}]}})});if(n.slice?ys.fromSchema(u).parseSlice(Hu(t),n.parseOptions):ys.fromSchema(u).parse(Hu(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const s=ys.fromSchema(e);return n.slice?s.parseSlice(Hu(t),n.parseOptions).content:s.parse(Hu(t),n.parseOptions)}return yc("",e,n)}function ZD(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof an||i instanceof vn))return;const s=t.mapping.maps[r];let o=0;s.forEach((l,u,f,h)=>{o===0&&(o=h)}),t.setSelection(Ue.near(t.doc.resolve(o),n))}var z5=t=>!("type"in t),$5=(t,e,n)=>({tr:r,dispatch:i,editor:s})=>{var o;if(i){n={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let l;const u=k=>{s.emit("contentError",{editor:s,error:k,disableCollaboration:()=>{"collaboration"in s.storage&&typeof s.storage.collaboration=="object"&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},f={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{yc(e,s.schema,{parseOptions:f,errorOnInvalidContent:!0})}catch(k){u(k)}try{l=yc(e,s.schema,{parseOptions:f,errorOnInvalidContent:(o=n.errorOnInvalidContent)!=null?o:s.options.enableContentCheck})}catch(k){return u(k),!1}let{from:h,to:m}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},g=!0,y=!0;if((z5(l)?l:[l]).forEach(k=>{k.check(),g=g?k.isText&&k.marks.length===0:!1,y=y?k.isBlock:!1}),h===m&&y){const{parent:k}=r.doc.resolve(h);k.isTextblock&&!k.type.spec.code&&!k.childCount&&(h-=1,m+=1)}let S;if(g){if(Array.isArray(e))S=e.map(k=>k.text||"").join("");else if(e instanceof ue){let k="";e.forEach(C=>{C.text&&(k+=C.text)}),S=k}else typeof e=="object"&&e&&e.text?S=e.text:S=e;r.insertText(S,h,m)}else{S=l;const k=r.doc.resolve(h),C=k.node(),T=k.parentOffset===0,_=C.isText||C.isTextblock,R=C.content.size>0;T&&_&&R&&y&&(h=Math.max(0,h-1)),r.replaceWith(h,m,S)}n.updateSelection&&ZD(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:h,text:S}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:h,text:S})}return!0};function YD(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}var B5=(t={})=>({tr:e,dispatch:n,editor:r})=>{const{pos:i,attrs:s,content:o,updateSelection:l=!0}=t;let u;typeof i=="number"?u=e.doc.resolve(i):i?u=i:u=e.selection.$from;const f=YD(u.parent.contentMatchAt(u.index()));if(!f)return!1;const h=Object.keys(f.spec.attrs||{}),m=s?Object.fromEntries(Object.entries(s).filter(([y])=>h.includes(y))):{};let g;if(o){const y=yc(o,r.schema);g=f.createAndFill(m,y)}else g=f.createAndFill(m);return g?(n&&(e.insert(u.pos,g),l&&ZD(e,e.steps.length-1,-1)),!0):!1},V5=()=>({state:t,dispatch:e})=>c4(t,e),H5=()=>({state:t,dispatch:e})=>u4(t,e),U5=()=>({state:t,dispatch:e})=>JO(t,e),F5=()=>({state:t,dispatch:e})=>nD(t,e),q5=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Hm(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},G5=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Hm(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},W5=()=>({state:t,dispatch:e})=>a4(t,e),K5=()=>({state:t,dispatch:e})=>l4(t,e);function XD(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function Z5(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,s,o;for(let l=0;l<e.length-1;l+=1){const u=e[l];if(/^(cmd|meta|m)$/i.test(u))o=!0;else if(/^a(lt)?$/i.test(u))r=!0;else if(/^(c|ctrl|control)$/i.test(u))i=!0;else if(/^s(hift)?$/i.test(u))s=!0;else if(/^mod$/i.test(u))Hp()||XD()?o=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${u}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),s&&(n=`Shift-${n}`),n}var Y5=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const s=Z5(t).split(/-(?!$)/),o=s.find(f=>!["Alt","Ctrl","Meta","Shift"].includes(f)),l=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),u=e.captureTransaction(()=>{n.someProp("handleKeyDown",f=>f(n,l))});return u?.steps.forEach(f=>{const h=f.map(r.mapping);h&&i&&r.maybeStep(h)}),!0};function Do(t,e,n={}){const{from:r,to:i,empty:s}=t.selection,o=e?cn(e,t.schema):null,l=[];t.doc.nodesBetween(r,i,(m,g)=>{if(m.isText)return;const y=Math.max(r,g),x=Math.min(i,g+m.nodeSize);l.push({node:m,from:y,to:x})});const u=i-r,f=l.filter(m=>o?o.name===m.node.type.name:!0).filter(m=>Vp(m.node.attrs,n,{strict:!1}));return s?!!f.length:f.reduce((m,g)=>m+g.to-g.from,0)>=u}var X5=(t,e={})=>({state:n,dispatch:r})=>{const i=cn(t,n.schema);return Do(n,i,e)?d4(n,r):!1},J5=()=>({state:t,dispatch:e})=>oD(t,e),Q5=t=>({state:e,dispatch:n})=>{const r=cn(t,e.schema);return k4(r)(e,n)},eq=()=>({state:t,dispatch:e})=>iD(t,e);function Zm(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function AA(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,i)=>(n.includes(i)||(r[i]=t[i]),r),{})}var tq=(t,e)=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const l=Zm(typeof t=="string"?t:t.name,r.schema);if(!l)return!1;l==="node"&&(s=cn(t,r.schema)),l==="mark"&&(o=As(t,r.schema));let u=!1;return n.selection.ranges.forEach(f=>{r.doc.nodesBetween(f.$from.pos,f.$to.pos,(h,m)=>{s&&s===h.type&&(u=!0,i&&n.setNodeMarkup(m,void 0,AA(h.attrs,e))),o&&h.marks.length&&h.marks.forEach(g=>{o===g.type&&(u=!0,i&&n.addMark(m,m+h.nodeSize,o.create(AA(g.attrs,e))))})})}),u},nq=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),rq=()=>({tr:t,dispatch:e})=>{if(e){const n=new Er(t.doc);t.setSelection(n)}return!0},iq=()=>({state:t,dispatch:e})=>eD(t,e),sq=()=>({state:t,dispatch:e})=>rD(t,e),oq=()=>({state:t,dispatch:e})=>m4(t,e),aq=()=>({state:t,dispatch:e})=>v4(t,e),lq=()=>({state:t,dispatch:e})=>y4(t,e);function ex(t,e,n={},r={}){return yc(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var cq=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:s,dispatch:o,commands:l})=>{const{doc:u}=s;if(r.preserveWhitespace!=="full"){const f=ex(t,i.schema,r,{errorOnInvalidContent:e??i.options.enableContentCheck});return o&&s.replaceWith(0,u.content.size,f).setMeta("preventUpdate",!n),!0}return o&&s.setMeta("preventUpdate",!n),l.insertContentAt({from:0,to:u.content.size},t,{parseOptions:r,errorOnInvalidContent:e??i.options.enableContentCheck})};function JD(t,e){const n=As(e,t.schema),{from:r,to:i,empty:s}=t.selection,o=[];s?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,u=>{o.push(...u.marks)});const l=o.find(u=>u.type.name===n.name);return l?{...l.attrs}:{}}function QD(t,e){const n=new Mw(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function uq(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(i,s)=>{n(i)&&r.push({node:i,pos:s})}),r}function eI(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 Ym(t){return e=>eI(e.$from,t)}function Re(t,e,n){return t.config[e]===void 0&&t.parent?Re(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?Re(t.parent,e,n):null}):t.config[e]}function Xm(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=Re(e,"addExtensions",n);return r?[e,...Xm(r())]:e}).flat(10)}function Zw(t,e){const n=Wa.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}function tI(t){return typeof t=="function"}function ut(t,e=void 0,...n){return tI(t)?e?t.bind(e)(...n):t(...n):t}function dq(t={}){return Object.keys(t).length===0&&t.constructor===Object}function vc(t){const e=t.filter(i=>i.type==="extension"),n=t.filter(i=>i.type==="node"),r=t.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function nI(t){const e=[],{nodeExtensions:n,markExtensions:r}=vc(t),i=[...n,...r],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(f=>f.name!=="text").map(f=>f.name),l=r.map(f=>f.name),u=[...o,...l];return t.forEach(f=>{const h={name:f.name,options:f.options,storage:f.storage,extensions:i},m=Re(f,"addGlobalAttributes",h);if(!m)return;m().forEach(y=>{let x;Array.isArray(y.types)?x=y.types:y.types==="*"?x=u:y.types==="nodes"?x=o:y.types==="marks"?x=l:x=[],x.forEach(S=>{Object.entries(y.attributes).forEach(([k,C])=>{e.push({type:S,name:k,attribute:{...s,...C}})})})})}),i.forEach(f=>{const h={name:f.name,options:f.options,storage:f.storage},m=Re(f,"addAttributes",h);if(!m)return;const g=m();Object.entries(g).forEach(([y,x])=>{const S={...s,...x};typeof S?.default=="function"&&(S.default=S.default()),S?.isRequired&&S?.default===void 0&&delete S.default,e.push({type:f.name,name:y,attribute:S})})}),e}function fq(t){const e=[];let n="",r=!1,i=!1,s=0;const o=t.length;for(let l=0;l<o;l+=1){const u=t[l];if(u==="'"&&!i){r=!r,n+=u;continue}if(u==='"'&&!r){i=!i,n+=u;continue}if(!r&&!i){if(u==="("){s+=1,n+=u;continue}if(u===")"&&s>0){s-=1,n+=u;continue}if(u===";"&&s===0){e.push(n),n="";continue}}n+=u}return n&&e.push(n),e}function RA(t){const e=[],n=fq(t||""),r=n.length;for(let i=0;i<r;i+=1){const s=n[i],o=s.indexOf(":");if(o===-1)continue;const l=s.slice(0,o).trim(),u=s.slice(o+1).trim();l&&u&&e.push([l,u])}return e}function Mt(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([i,s])=>{if(!r[i]){r[i]=s;return}if(i==="class"){const l=s?String(s).split(" "):[],u=r[i]?r[i].split(" "):[],f=l.filter(h=>!u.includes(h));r[i]=[...u,...f].join(" ")}else if(i==="style"){const l=new Map([...RA(r[i]),...RA(s)]);r[i]=Array.from(l.entries()).map(([u,f])=>`${u}: ${f}`).join("; ")}else r[i]=s}),r},{})}function bc(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)=>Mt(n,r),{})}function hq(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function MA(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 i=e.reduce((s,o)=>{const l=o.attribute.parseHTML?o.attribute.parseHTML(n):hq(n.getAttribute(o.name));return l==null?s:{...s,[o.name]:l}},{});return{...r,...i}}}}function NA(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&dq(n)?!1:n!=null))}function OA(t){var e,n;const r={};return!((e=t?.attribute)!=null&&e.isRequired)&&"default"in(t?.attribute||{})&&(r.default=t.attribute.default),((n=t?.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=t.attribute.validate),[t.name,r]}function rI(t,e){var n;const r=nI(t),{nodeExtensions:i,markExtensions:s}=vc(t),o=(n=i.find(f=>Re(f,"topNode")))==null?void 0:n.name,l=Object.fromEntries(i.map(f=>{const h=r.filter(C=>C.type===f.name),m={name:f.name,options:f.options,storage:f.storage,editor:e},g=t.reduce((C,T)=>{const _=Re(T,"extendNodeSchema",m);return{...C,..._?_(f):{}}},{}),y=NA({...g,content:ut(Re(f,"content",m)),marks:ut(Re(f,"marks",m)),group:ut(Re(f,"group",m)),inline:ut(Re(f,"inline",m)),atom:ut(Re(f,"atom",m)),selectable:ut(Re(f,"selectable",m)),draggable:ut(Re(f,"draggable",m)),code:ut(Re(f,"code",m)),whitespace:ut(Re(f,"whitespace",m)),linebreakReplacement:ut(Re(f,"linebreakReplacement",m)),defining:ut(Re(f,"defining",m)),isolating:ut(Re(f,"isolating",m)),attrs:Object.fromEntries(h.map(OA))}),x=ut(Re(f,"parseHTML",m));x&&(y.parseDOM=x.map(C=>MA(C,h)));const S=Re(f,"renderHTML",m);S&&(y.toDOM=C=>S({node:C,HTMLAttributes:bc(C,h)}));const k=Re(f,"renderText",m);return k&&(y.toText=k),[f.name,y]})),u=Object.fromEntries(s.map(f=>{const h=r.filter(k=>k.type===f.name),m={name:f.name,options:f.options,storage:f.storage,editor:e},g=t.reduce((k,C)=>{const T=Re(C,"extendMarkSchema",m);return{...k,...T?T(f):{}}},{}),y=NA({...g,inclusive:ut(Re(f,"inclusive",m)),excludes:ut(Re(f,"excludes",m)),group:ut(Re(f,"group",m)),spanning:ut(Re(f,"spanning",m)),code:ut(Re(f,"code",m)),attrs:Object.fromEntries(h.map(OA))}),x=ut(Re(f,"parseHTML",m));x&&(y.parseDOM=x.map(k=>MA(k,h)));const S=Re(f,"renderHTML",m);return S&&(y.toDOM=k=>S({mark:k,HTMLAttributes:bc(k,h)})),[f.name,y]}));return new NO({topNode:o,nodes:l,marks:u})}function pq(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function nc(t){return t.sort((n,r)=>{const i=Re(n,"priority")||100,s=Re(r,"priority")||100;return i>s?-1:i<s?1:0})}function Yw(t){const e=nc(Xm(t)),n=pq(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 iI(t,e){const n=Yw(t);return rI(n,e)}function mq(t,e){const n=iI(e),r=Hu(t);return ys.fromSchema(n).parse(r).toJSON()}function sI(t,e,n){const{from:r,to:i}=e,{blockSeparator:s=`
|
|
74
|
-
|
|
75
|
-
`,textSerializers:o={}}=n||{};let l="";return t.nodesBetween(r,i,(u,f,h,m)=>{var g;u.isBlock&&f>r&&(l+=s);const y=o?.[u.type.name];if(y)return h&&(l+=y({node:u,pos:f,parent:h,index:m,range:e})),!1;u.isText&&(l+=(g=u?.text)==null?void 0:g.slice(Math.max(r,f)-f,i-f))}),l}function gq(t,e){const n={from:0,to:t.content.size};return sI(t,n,e)}function oI(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function yq(t,e){const n=cn(e,t.schema),{from:r,to:i}=t.selection,s=[];t.doc.nodesBetween(r,i,l=>{s.push(l)});const o=s.reverse().find(l=>l.type.name===n.name);return o?{...o.attrs}:{}}function aI(t,e){const n=Zm(typeof e=="string"?e:e.name,t.schema);return n==="node"?yq(t,e):n==="mark"?JD(t,e):{}}function vq(t,e=JSON.stringify){const n={};return t.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function bq(t){const e=vq(t);return e.length===1?e:e.filter((n,r)=>!e.filter((s,o)=>o!==r).some(s=>n.oldRange.from>=s.oldRange.from&&n.oldRange.to<=s.oldRange.to&&n.newRange.from>=s.newRange.from&&n.newRange.to<=s.newRange.to))}function Xw(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,s)=>{const o=[];if(i.ranges.length)i.forEach((l,u)=>{o.push({from:l,to:u})});else{const{from:l,to:u}=n[s];if(l===void 0||u===void 0)return;o.push({from:l,to:u})}o.forEach(({from:l,to:u})=>{const f=e.slice(s).map(l,-1),h=e.slice(s).map(u),m=e.invert().map(f,-1),g=e.invert().map(h);r.push({oldRange:{from:m,to:g},newRange:{from:f,to:h}})})}),bq(r)}function Jw(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const s=n.resolve(t),o=Kw(s,i.type);o&&r.push({mark:i,...o})}):n.nodesBetween(t,e,(i,s)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(o=>({from:s,to:s+i.nodeSize,mark:o})))}),r}var xq=(t,e,n,r=20)=>{const i=t.doc.resolve(n);let s=r,o=null;for(;s>0&&o===null;){const l=i.node(s);l?.type.name===e?o=l:s-=1}return[o,s]};function Mu(t,e){return e.nodes[t]||e.marks[t]||null}function sp(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=t.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}var wq=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,s,o,l)=>{var u,f;const h=((f=(u=i.type.spec).toText)==null?void 0:f.call(u,{node:i,pos:s,parent:o,index:l}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?h:h.slice(0,Math.max(0,r-s))}),n};function tx(t,e,n={}){const{empty:r,ranges:i}=t.selection,s=e?As(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(m=>s?s.name===m.type.name:!0).find(m=>Vp(m.attrs,n,{strict:!1}));let o=0;const l=[];if(i.forEach(({$from:m,$to:g})=>{const y=m.pos,x=g.pos;t.doc.nodesBetween(y,x,(S,k)=>{if(s&&S.inlineContent&&!S.type.allowsMarkType(s))return!1;if(!S.isText&&!S.marks.length)return;const C=Math.max(y,k),T=Math.min(x,k+S.nodeSize),_=T-C;o+=_,l.push(...S.marks.map(R=>({mark:R,from:C,to:T})))})}),o===0)return!1;const u=l.filter(m=>s?s.name===m.mark.type.name:!0).filter(m=>Vp(m.mark.attrs,n,{strict:!1})).reduce((m,g)=>m+g.to-g.from,0),f=l.filter(m=>s?m.mark.type!==s&&m.mark.type.excludes(s):!0).reduce((m,g)=>m+g.to-g.from,0);return(u>0?u+f:u)>=o}function Sq(t,e,n={}){if(!e)return Do(t,null,n)||tx(t,null,n);const r=Zm(e,t.schema);return r==="node"?Do(t,e,n):r==="mark"?tx(t,e,n):!1}var kq=(t,e)=>{const{$from:n,$to:r,$anchor:i}=t.selection;if(e){const s=Ym(l=>l.type.name===e)(t.selection);if(!s)return!1;const o=t.doc.resolve(s.pos+1);return i.pos+1===o.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},Cq=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function DA(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function bb(t,e){const{nodeExtensions:n}=vc(e),r=n.find(o=>o.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=ut(Re(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function Xd(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(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 i=!0;return t.content.forEach(s=>{i!==!1&&(Xd(s,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function lI(t){return t instanceof Pe}var cI=class uI{constructor(e){this.position=e}static fromJSON(e){return new uI(e.position)}toJSON(){return{position:this.position}}};function Eq(t,e){const n=e.mapping.mapResult(t.position);return{position:new cI(n.pos),mapResult:n}}function Tq(t){return new cI(t)}function _q(t,e,n){var r;const{selection:i}=e;let s=null;if(WD(i)&&(s=i.$cursor),s){const l=(r=t.storedMarks)!=null?r:s.marks();return s.parent.type.allowsMarkType(n)&&(!!n.isInSet(l)||!l.some(f=>f.type.excludes(n)))}const{ranges:o}=i;return o.some(({$from:l,$to:u})=>{let f=l.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(l.pos,u.pos,(h,m,g)=>{if(f)return!1;if(h.isInline){const y=!g||g.type.allowsMarkType(n),x=!!n.isInSet(h.marks)||!h.marks.some(S=>S.type.excludes(n));f=y&&x}return!f}),f})}var Aq=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=n,{empty:o,ranges:l}=s,u=As(t,r.schema);if(i)if(o){const f=JD(r,u);n.addStoredMark(u.create({...f,...e}))}else l.forEach(f=>{const h=f.$from.pos,m=f.$to.pos;r.doc.nodesBetween(h,m,(g,y)=>{const x=Math.max(y,h),S=Math.min(y+g.nodeSize,m);g.marks.find(C=>C.type===u)?g.marks.forEach(C=>{u===C.type&&n.addMark(x,S,u.create({...C.attrs,...e}))}):n.addMark(x,S,u.create(e))})});return _q(r,n,u)},Rq=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),Mq=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const s=cn(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:l})=>K_(s,{...o,...e})(n)?!0:l.clearNodes()).command(({state:l})=>K_(s,{...o,...e})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Nq=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=wa(t,0,r.content.size),s=Pe.create(r,i);e.setSelection(s)}return!0},Oq=(t,e)=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=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=s.from,l=s.to),i&&n.doc.nodesBetween(o,l,(u,f)=>{u.isText||n.setNodeMarkup(f,void 0,{...u.attrs,dir:t})}),!0},Dq=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:s}=typeof t=="number"?{from:t,to:t}:t,o=Ie.atStart(r).from,l=Ie.atEnd(r).to,u=wa(i,o,l),f=wa(s,o,l),h=Ie.create(r,u,f);e.setSelection(h)}return!0},Iq=t=>({state:e,dispatch:n})=>{const r=cn(t,e.schema);return T4(r)(e,n)};function IA(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(i=>e?.includes(i.type.name));t.tr.ensureMarks(r)}}var Lq=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:s,doc:o}=e,{$from:l,$to:u}=s,f=i.extensionManager.attributes,h=sp(f,l.node().type.name,l.node().attrs);if(s instanceof Pe&&s.node.isBlock)return!l.parentOffset||!vs(o,l.pos)?!1:(r&&(t&&IA(n,i.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const m=u.parentOffset===u.parent.content.size,g=l.depth===0?void 0:YD(l.node(-1).contentMatchAt(l.indexAfter(-1)));let y=m&&g?[{type:g,attrs:h}]:void 0,x=vs(e.doc,e.mapping.map(l.pos),1,y);if(!y&&!x&&vs(e.doc,e.mapping.map(l.pos),1,g?[{type:g}]:void 0)&&(x=!0,y=g?[{type:g,attrs:h}]:void 0),r){if(x&&(s instanceof Ie&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,y),g&&!m&&!l.parentOffset&&l.parent.type!==g)){const S=e.mapping.map(l.before()),k=e.doc.resolve(S);l.node(-1).canReplaceWith(k.index(),k.index()+1,g)&&e.setNodeMarkup(e.mapping.map(l.before()),g)}t&&IA(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return x},jq=(t,e={})=>({tr:n,state:r,dispatch:i,editor:s})=>{var o;const l=cn(t,r.schema),{$from:u,$to:f}=r.selection,h=r.selection.node;if(h&&h.isBlock||u.depth<2||!u.sameParent(f))return!1;const m=u.node(-1);if(m.type!==l)return!1;const g=s.extensionManager.attributes;if(u.parent.content.size===0&&u.node(-1).childCount===u.indexAfter(-1)){if(u.depth===2||u.node(-3).type!==l||u.index(-2)!==u.node(-2).childCount-1)return!1;if(i){let C=ue.empty;const T=u.index(-1)?1:u.index(-2)?2:3;for(let P=u.depth-T;P>=u.depth-3;P-=1)C=ue.from(u.node(P).copy(C));const _=u.indexAfter(-1)<u.node(-2).childCount?1:u.indexAfter(-2)<u.node(-3).childCount?2:3,R={...sp(g,u.node().type.name,u.node().attrs),...e},M=((o=l.contentMatch.defaultType)==null?void 0:o.createAndFill(R))||void 0;C=C.append(ue.from(l.createAndFill(null,M)||void 0));const O=u.before(u.depth-(T-1));n.replace(O,u.after(-_),new Se(C,4-T,0));let L=-1;n.doc.nodesBetween(O,n.doc.content.size,(P,U)=>{if(L>-1)return!1;P.isTextblock&&P.content.size===0&&(L=U+1)}),L>-1&&n.setSelection(Ie.near(n.doc.resolve(L))),n.scrollIntoView()}return!0}const y=f.pos===u.end()?m.contentMatchAt(0).defaultType:null,x={...sp(g,m.type.name,m.attrs),...e},S={...sp(g,u.node().type.name,u.node().attrs),...e};n.delete(u.pos,f.pos);const k=y?[{type:l,attrs:x},{type:y,attrs:S}]:[{type:l,attrs:x}];if(!vs(n.doc,u.pos,2))return!1;if(i){const{selection:C,storedMarks:T}=r,{splittableMarks:_}=s.extensionManager,R=T||C.$to.parentOffset&&C.$from.marks();if(n.split(u.pos,2,k).scrollIntoView(),!R||!i)return!0;const M=R.filter(O=>_.includes(O.type.name));n.ensureMarks(M)}return!0};function LA(t){return!t||t==="1"?null:t}function dI(t,e){return LA(t)===LA(e)}var xb=(t,e)=>{const n=Ym(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 i=t.doc.nodeAt(r);return!(n.node.type===i?.type&&Bo(t.doc,n.pos))||!dI(n.node.attrs.type,i?.attrs.type)||t.join(n.pos),!0},wb=(t,e)=>{const n=Ym(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 i=t.doc.nodeAt(r);return!(n.node.type===i?.type&&Bo(t.doc,r))||!dI(n.node.attrs.type,i?.attrs.type)||t.join(r),!0};function Pq(t){const e=t.doc,n=e.firstChild;if(!n)return null;const r=e.resolve(1),i=e.resolve(n.nodeSize-1);return Ie.between(r,i)}var zq=(t,e,n,r={})=>({editor:i,tr:s,state:o,dispatch:l,chain:u,commands:f,can:h})=>{const{extensions:m,splittableMarks:g}=i.extensionManager,y=cn(t,o.schema),x=cn(e,o.schema),{selection:S,storedMarks:k}=o,{$from:C,$to:T}=S,_=C.blockRange(T),R=k||S.$to.parentOffset&&S.$from.marks();if(!_)return!1;const M=Ym(ne=>bb(ne.type.name,m))(S),O=S.from===0&&S.to===o.doc.content.size,L=o.doc.content.content,P=L.length===1?L[0]:null,U=O&&P&&bb(P.type.name,m)?{node:P,pos:0}:null,G=M??U,oe=!!M&&_.depth>=1&&_.depth-M.depth<=1,K=!!U;if((oe||K)&&G){if(G.node.type===y)return O&&K?u().command(({tr:ne,dispatch:re})=>{const me=Pq(ne);return me?(ne.setSelection(me),re&&re(ne),!0):!1}).liftListItem(x).run():f.liftListItem(x);if(bb(G.node.type.name,m)&&y.validContent(G.node.content))return u().command(()=>(s.setNodeMarkup(G.pos,y),!0)).command(()=>xb(s,y)).command(()=>wb(s,y)).run()}return!n||!R||!l?u().command(()=>h().wrapInList(y,r)?!0:f.clearNodes()).wrapInList(y,r).command(()=>xb(s,y)).command(()=>wb(s,y)).run():u().command(()=>{const ne=h().wrapInList(y,r),re=R.filter(me=>g.includes(me.type.name));return s.ensureMarks(re),ne?!0:f.clearNodes()}).wrapInList(y,r).command(()=>xb(s,y)).command(()=>wb(s,y)).run()},$q=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=n,o=As(t,r.schema);return tx(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},Bq=(t,e,n={})=>({state:r,commands:i})=>{const s=cn(t,r.schema),o=cn(e,r.schema),l=Do(r,s,n);let u;return r.selection.$anchor.sameParent(r.selection.$head)&&(u=r.selection.$anchor.parent.attrs),l?i.setNode(o,u):i.setNode(s,{...u,...n})},Vq=(t,e={})=>({state:n,commands:r})=>{const i=cn(t,n.schema);return Do(n,i,e)?r.lift(i):r.wrapIn(i,e)},Hq=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const i=n[r];let s;if(i.spec.isInputRules&&(s=i.getState(t))){if(e){const o=t.tr,l=s.transform;for(let u=l.steps.length-1;u>=0;u-=1)o.step(l.steps[u].invert(l.docs[u]));if(s.text){const u=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,t.schema.text(s.text,u))}else o.delete(s.from,s.to)}return!0}}return!1},Uq=(t={})=>({tr:e,dispatch:n,editor:r})=>{const{ignoreClearable:i=!1}=t,{selection:s}=e,{empty:o,ranges:l}=s;if(o)return!0;const{nonClearableMarks:u}=r.extensionManager;if(n){const f=Object.values(r.schema.marks).filter(h=>i||!u.includes(h.name));l.forEach(h=>{for(const m of f)e.removeMark(h.$from.pos,h.$to.pos,m)})}return!0},Fq=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:l}=n,u=As(t,r.schema),{$from:f,empty:h,ranges:m}=l;if(!i)return!0;if(h&&o){let{from:g,to:y}=l;const x=(s=f.marks().find(k=>k.type===u))==null?void 0:s.attrs,S=Kw(f,u,x);S&&(g=S.from,y=S.to),n.removeMark(g,y,u)}else m.forEach(g=>{n.removeMark(g.$from.pos,g.$to.pos,u)});return n.removeStoredMark(u),!0},qq=t=>({tr:e,state:n,dispatch:r})=>{const{selection:i}=n;let s,o;return typeof t=="number"?(s=t,o=t):t&&"from"in t&&"to"in t?(s=t.from,o=t.to):(s=i.from,o=i.to),r&&e.doc.nodesBetween(s,o,(l,u)=>{if(l.isText)return;const f={...l.attrs};delete f.dir,e.setNodeMarkup(u,void 0,f)}),!0},Gq=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const l=Zm(typeof t=="string"?t:t.name,r.schema);if(!l)return!1;l==="node"&&(s=cn(t,r.schema)),l==="mark"&&(o=As(t,r.schema));let u=!1;return n.selection.ranges.forEach(f=>{const h=f.$from.pos,m=f.$to.pos;let g,y,x,S;n.selection.empty?r.doc.nodesBetween(h,m,(k,C)=>{s&&s===k.type&&(u=!0,x=Math.max(C,h),S=Math.min(C+k.nodeSize,m),g=C,y=k)}):r.doc.nodesBetween(h,m,(k,C)=>{C<h&&s&&s===k.type&&(u=!0,x=Math.max(C,h),S=Math.min(C+k.nodeSize,m),g=C,y=k),C>=h&&C<=m&&(s&&s===k.type&&(u=!0,i&&n.setNodeMarkup(C,void 0,{...k.attrs,...e})),o&&k.marks.length&&k.marks.forEach(T=>{if(o===T.type&&(u=!0,i)){const _=Math.max(C,h),R=Math.min(C+k.nodeSize,m);n.addMark(_,R,o.create({...T.attrs,...e}))}}))}),y&&(g!==void 0&&i&&n.setNodeMarkup(g,void 0,{...y.attrs,...e}),o&&y.marks.length&&y.marks.forEach(k=>{o===k.type&&i&&n.addMark(x,S,o.create({...k.attrs,...e}))}))}),u},Wq=(t,e={})=>({state:n,dispatch:r})=>{const i=cn(t,n.schema);return b4(i,e)(n,r)},Kq=(t,e={})=>({state:n,dispatch:r})=>{const i=cn(t,n.schema);return x4(i,e)(n,r)},Zq=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}};function xc(t,e){if(t===e)return!0;if(!t||!e)return!1;const n=Object.keys(t),r=Object.keys(e);return n.length!==r.length?!1:n.every(i=>Object.prototype.hasOwnProperty.call(e,i)&&Object.is(t[i],e[i]))}function Yq(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof Pe){const s=r.index();return r.parent.canReplaceWith(s,s+1,e)}let i=r.depth;for(;i>=0;){const s=r.index(i);if(r.node(i).contentMatchAt(s).matchType(e))return!0;i-=1}return!1}function Xq(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(i),i}function jA(t){return t.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/&/g,"&")}function Jq(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function Qq(t){return typeof t=="number"}function e9(t){return Object.prototype.toString.call(t).slice(8,-1)}function Ch(t){return e9(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}var t9={};Gw(t9,{createAtomBlockMarkdownSpec:()=>n9,createBlockMarkdownSpec:()=>r9,createInlineMarkdownSpec:()=>o9,parseAttributes:()=>Qw,parseIndentedBlocks:()=>nx,renderNestedMarkdownContent:()=>tS,serializeAttributes:()=>eS});function Qw(t){if(!t?.trim())return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,f=>(n.push(f),`__QUOTED_${n.length-1}__`)),i=r.match(/(?:^|\s)\.([\w-]+)/g);if(i){const f=i.map(h=>h.trim().slice(1));e.class=f.join(" ")}const s=r.match(/(?:^|\s)#([\w-]+)/);s&&(e.id=s[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(o)).forEach(([,f,h])=>{var m;const g=parseInt(((m=h.match(/__QUOTED_(\d+)__/))==null?void 0:m[1])||"0",10),y=n[g];y&&(e[f]=y.slice(1,-1))});const u=r.replace(/(?:^|\s)\.([\w-]+)/g,"").replace(/(?:^|\s)#([\w-]+)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return u&&u.split(/\s+/).filter(Boolean).forEach(h=>{h.match(/^[a-zA-Z][\w-]*$/)&&(e[h]=!0)}),e}function eS(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 n9(t){const{nodeName:e,name:n,parseAttributes:r=Qw,serializeAttributes:i=eS,defaultAttributes:s={},requiredAttributes:o=[],allowedAttributes:l}=t,u=n||e,f=h=>{if(!l)return h;const m={};return l.forEach(g=>{g in h&&(m[g]=h[g])}),m};return{parseMarkdown:(h,m)=>{const g={...s,...h.attributes};return m.createNode(e,g,[])},markdownTokenizer:{name:e,level:"block",start(h){var m;const g=new RegExp(`^:::${u}(?:\\s|$)`,"m"),y=(m=h.match(g))==null?void 0:m.index;return y!==void 0?y:-1},tokenize(h,m,g){const y=new RegExp(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),x=h.match(y);if(!x)return;const S=x[1]||"",k=r(S);if(!o.find(T=>!(T in k)))return{type:e,raw:x[0],attributes:k}}},renderMarkdown:h=>{const m=f(h.attrs||{}),g=i(m),y=g?` {${g}}`:"";return`:::${u}${y} :::`}}}function r9(t){const{nodeName:e,name:n,getContent:r,parseAttributes:i=Qw,serializeAttributes:s=eS,defaultAttributes:o={},content:l="block",allowedAttributes:u}=t,f=n||e,h=m=>{if(!u)return m;const g={};return u.forEach(y=>{y in m&&(g[y]=m[y])}),g};return{parseMarkdown:(m,g)=>{let y;if(r){const S=r(m);y=typeof S=="string"?[{type:"text",text:S}]:S}else l==="block"?y=g.parseChildren(m.tokens||[]):y=g.parseInline(m.tokens||[]);const x={...o,...m.attributes};return g.createNode(e,x,y)},markdownTokenizer:{name:e,level:"block",start(m){var g;const y=new RegExp(`^:::${f}`,"m"),x=(g=m.match(y))==null?void 0:g.index;return x!==void 0?x:-1},tokenize(m,g,y){var x;const S=new RegExp(`^:::${f}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),k=m.match(S);if(!k)return;const[C,T=""]=k,_=i(T);let R=1;const M=C.length;let O="";const L=/^:::([\w-]*)(\s.*)?/gm,P=m.slice(M);for(L.lastIndex=0;;){const U=L.exec(P);if(U===null)break;const G=U.index,oe=U[1];if(!((x=U[2])!=null&&x.endsWith(":::"))){if(oe)R+=1;else if(R-=1,R===0){const K=P.slice(0,G);O=K.trim();const ne=m.slice(0,M+G+U[0].length);let re=[];if(O)if(l==="block")for(re=y.blockTokens(K),re.forEach(me=>{me.text&&(!me.tokens||me.tokens.length===0)&&(me.tokens=y.inlineTokens(me.text))});re.length>0;){const me=re[re.length-1];if(me.type==="paragraph"&&(!me.text||me.text.trim()===""))re.pop();else break}else re=y.inlineTokens(O);return{type:e,raw:ne,attributes:_,content:O,tokens:re}}}}}},renderMarkdown:(m,g)=>{const y=h(m.attrs||{}),x=s(y),S=x?` {${x}}`:"",k=g.renderChildren(m.content||[],`
|
|
76
|
-
|
|
77
|
-
`);return`:::${f}${S}
|
|
78
|
-
|
|
79
|
-
${k}
|
|
80
|
-
|
|
81
|
-
:::`}}}function i9(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,i,s,o]=r;e[i]=s||o,r=n.exec(t)}return e}function s9(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function o9(t){const{nodeName:e,name:n,getContent:r,parseAttributes:i=i9,serializeAttributes:s=s9,defaultAttributes:o={},selfClosing:l=!1,allowedAttributes:u}=t,f=n||e,h=g=>{if(!u)return g;const y={};return u.forEach(x=>{const S=typeof x=="string"?x:x.name,k=typeof x=="string"?void 0:x.skipIfDefault;if(S in g){const C=g[S];if(k!==void 0&&C===k)return;y[S]=C}}),y},m=f.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(g,y)=>{const x={...o,...g.attributes};if(l)return y.createNode(e,x);const S=r?r(g):g.content||"";return S?y.createNode(e,x,[y.createTextNode(S)]):y.createNode(e,x,[])},markdownTokenizer:{name:e,level:"inline",start(g){const y=l?new RegExp(`\\[${m}\\s*[^\\]]*\\]`):new RegExp(`\\[${m}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${m}\\]`),x=g.match(y),S=x?.index;return S!==void 0?S:-1},tokenize(g,y,x){const S=l?new RegExp(`^\\[${m}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${m}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${m}\\]`),k=g.match(S);if(!k)return;let C="",T="";if(l){const[,R]=k;T=R}else{const[,R,M]=k;T=R,C=M||""}const _=i(T.trim());return{type:e,raw:k[0],content:C.trim(),attributes:_}}},renderMarkdown:g=>{let y="";r?y=r(g):g.content&&g.content.length>0&&(y=g.content.filter(C=>C.type==="text").map(C=>C.text).join(""));const x=h(g.attrs||{}),S=s(x),k=S?` ${S}`:"";return l?`[${f}${k}]`:`[${f}${k}]${y}[/${f}]`}}}function nx(t,e,n){var r,i,s,o;const l=t.split(`
|
|
82
|
-
`),u=[];let f="",h=0;const m=e.baseIndentSize||2;for(;h<l.length;){const g=l[h],y=g.match(e.itemPattern);if(!y){if(u.length>0)break;if(g.trim()===""){h+=1,f=`${f}${g}
|
|
83
|
-
`;continue}else return}const x=e.extractItemData(y),{indentLevel:S,mainContent:k}=x;f=`${f}${g}
|
|
84
|
-
`;const C=[k];for(h+=1;h<l.length;){const M=l[h];if(M.trim()===""){const L=l.slice(h+1).findIndex(G=>G.trim()!=="");if(L===-1)break;if((((i=(r=l[h+1+L].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:i.length)||0)>S){C.push(M),f=`${f}${M}
|
|
85
|
-
`,h+=1;continue}else break}if((((o=(s=M.match(/^(\s*)/))==null?void 0:s[1])==null?void 0:o.length)||0)>S)C.push(M),f=`${f}${M}
|
|
86
|
-
`,h+=1;else break}let T;const _=C.slice(1);if(_.length>0){const M=_.map(O=>O.slice(S+m)).join(`
|
|
87
|
-
`);M.trim()&&(e.customNestedParser?T=e.customNestedParser(M):T=n.blockTokens(M))}const R=e.createToken(x,T);u.push(R)}if(u.length!==0)return{items:u,raw:f}}function tS(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const i=typeof n=="function"?n(r):n,[s,...o]=t.content,l=e.renderChildren([s]);let u=`${i}${l}`;return o&&o.length>0&&o.forEach((f,h)=>{var m,g;const y=(g=(m=e.renderChild)==null?void 0:m.call(e,f,h+1))!=null?g:e.renderChildren([f]);if(y!=null){const x=y.split(`
|
|
88
|
-
`).map(S=>S?e.indent(S):e.indent("")).join(`
|
|
89
|
-
`);u+=f.type==="paragraph"?`
|
|
90
|
-
|
|
91
|
-
${x}`:`
|
|
92
|
-
${x}`}}),u}function PA(t){return typeof t.type=="string"?t.type:t.type.name}function a9(t,e){if(t.length!==e.length)return!1;const n=Array.from({length:e.length},()=>!1);return t.every(r=>{const i=PA(r),s=e.findIndex((o,l)=>!n[l]&&i===PA(o)&&xc(r.attrs,o.attrs));return s===-1?!1:(n[s]=!0,!0)})}function fI(t,e){const n={...t};return Ch(t)&&Ch(e)&&Object.keys(e).forEach(r=>{Ch(e[r])&&Ch(t[r])?n[r]=fI(t[r],e[r]):n[r]=e[r]}),n}function l9(t,e,n={}){const{state:r}=e,{doc:i,tr:s}=r,o=t;i.descendants((l,u)=>{const f=s.mapping.map(u),h=s.mapping.map(u)+l.nodeSize;let m=null;if(l.marks.forEach(y=>{if(y!==o)return!1;m=y}),!m)return;let g=!1;if(Object.keys(n).forEach(y=>{n[y]!==m.attrs[y]&&(g=!0)}),g){const y=t.type.create({...t.attrs,...n});s.removeMark(f,h,t.type),s.addMark(f,h,y)}}),s.docChanged&&e.view.dispatch(s)}var Jd=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},c9=(t,e)=>{if(Ww(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 Eh(t){var e;const{editor:n,from:r,to:i,text:s,rules:o,plugin:l}=t,{view:u}=n;if(u.composing)return!1;const f=u.state.doc.resolve(r);if(f.parent.type.spec.code||(e=f.nodeBefore||f.nodeAfter)!=null&&e.marks.find(g=>g.type.spec.code))return!1;let h=!1;const m=wq(f)+s;return o.forEach(g=>{if(h)return;const y=c9(m,g.find);if(!y)return;const x=y[0].length-s.length;if(x>0){const O=f.parentOffset-x;if(O<0||f.parent.textBetween(O,f.parentOffset)!==y[0].slice(0,x))return}const S=u.state.tr,k=Wm({state:u.state,transaction:S}),C={from:r-(y[0].length-s.length),to:i},{commands:T,chain:_,can:R}=new Km({editor:n,state:k});g.handler({state:k,range:C,match:y,commands:T,chain:_,can:R})===null||!S.steps.length||(g.undoable&&S.setMeta(l,{transform:S,from:r,to:i,text:s}),u.dispatch(S),h=!0)}),h}function u9(t){const{editor:e,rules:n}=t,r=new Nt({state:{init(){return null},apply(i,s,o){const l=i.getMeta(r);if(l)return l;const u=i.getMeta("applyInputRules");return u&&setTimeout(()=>{let{text:h}=u;typeof h=="string"?h=h:h=Zw(ue.from(h),o.schema);const{from:m}=u,g=m+h.length;Eh({editor:e,from:m,to:g,text:h,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,o,l){return Eh({editor:e,from:s,to:o,text:l,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&Eh({editor:e,from:s.pos,to:s.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?Eh({editor:e,from:o.pos,to:o.pos,text:`
|
|
93
|
-
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}var nS=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{...ut(Re(this,"addOptions",{name:this.name}))}}get storage(){return{...ut(Re(this,"addStorage",{name:this.name,options:this.options}))}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>fI(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}},Ka=class hI extends nS{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new hI(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const o=i.marks();if(!!!o.find(f=>f?.type.name===n.name))return!1;const u=o.find(f=>f?.type.name===n.name);return u&&r.removeStoredMark(u),r.insertText(" ",i.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)}},pI=class{constructor(t){this.find=t.find,this.handler=t.handler}},d9=(t,e,n)=>{if(Ww(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(i=>{const s=[i.text];return s.index=i.index,s.input=t,s.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(i.replaceWith)),s}):[]};function f9(t){const{editor:e,state:n,from:r,to:i,rule:s,pasteEvent:o,dropEvent:l}=t,{commands:u,chain:f,can:h}=new Km({editor:e,state:n}),m=[];return n.doc.nodesBetween(r,i,(y,x)=>{var S,k,C,T,_;if((k=(S=y.type)==null?void 0:S.spec)!=null&&k.code||!(y.isText||y.isTextblock||y.isInline))return;const R=(_=(T=(C=y.content)==null?void 0:C.size)!=null?T:y.nodeSize)!=null?_:0,M=Math.max(r,x),O=Math.min(i,x+R);if(M>=O)return;const L=y.isText?y.text||"":y.textBetween(M-x,O-x,void 0,"");d9(L,s.find,o).forEach(U=>{if(U.index===void 0)return;const G=M+U.index+1,oe=G+U[0].length,K={from:n.tr.mapping.map(G),to:n.tr.mapping.map(oe)},ne=s.handler({state:n,range:K,match:U,commands:u,chain:f,can:h,pasteEvent:o,dropEvent:l});m.push(ne)})}),m.every(y=>y!==null)}var Th=null,h9=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function p9(t){const{editor:e,rules:n}=t;let r=null,i=!1,s=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const u=({state:h,from:m,to:g,rule:y,pasteEvt:x})=>{const S=h.tr,k=Wm({state:h,transaction:S});if(!(!f9({editor:e,state:k,from:Math.max(m-1,0),to:g.b-1,rule:y,pasteEvent:x,dropEvent:l})||!S.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,S}};return n.map(h=>new Nt({view(m){const g=x=>{var S;r=(S=m.dom.parentElement)!=null&&S.contains(x.target)?m.dom.parentElement:null,r&&(Th=e)},y=()=>{Th&&(Th=null)};return window.addEventListener("dragstart",g),window.addEventListener("dragend",y),{destroy(){window.removeEventListener("dragstart",g),window.removeEventListener("dragend",y)}}},props:{handleDOMEvents:{drop:(m,g)=>{if(s=r===m.dom.parentElement,l=g,!s){const y=Th;y?.isEditable&&setTimeout(()=>{const x=y.state.selection;x&&y.commands.deleteRange({from:x.from,to:x.to})},10)}return!1},paste:(m,g)=>{var y;const x=(y=g.clipboardData)==null?void 0:y.getData("text/html");return o=g,i=!!x?.includes("data-pm-slice"),!1}}},appendTransaction:(m,g,y)=>{const x=m[0],S=x.getMeta("uiEvent")==="paste"&&!i,k=x.getMeta("uiEvent")==="drop"&&!s,C=x.getMeta("applyPasteRules"),T=!!C;if(!S&&!k&&!T)return;if(T){let{text:M}=C;typeof M=="string"?M=M:M=Zw(ue.from(M),y.schema);const{from:O}=C,L=O+M.length,P=h9(M);return u({rule:h,state:y,from:O,to:{b:L},pasteEvt:P})}const _=g.doc.content.findDiffStart(y.doc.content),R=g.doc.content.findDiffEnd(y.doc.content);if(!(!Qq(_)||!R||_===R.b))return u({rule:h,state:y,from:_,to:R,pasteEvt:o})}}))}var Jm=class{constructor(t,e){this.splittableMarks=[],this.nonClearableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=Yw(t),this.schema=rI(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:Mu(e.name,this.schema)},r=Re(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return nc([...this.extensions].reverse()).flatMap(r=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Mu(r.name,this.schema)},s=[],o=Re(r,"addKeyboardShortcuts",i);let l={};if(r.type==="mark"&&Re(r,"exitable",i)&&(l.ArrowRight=()=>Ka.handleExit({editor:t,mark:r})),o){const g=Object.fromEntries(Object.entries(o()).map(([y,x])=>[y,()=>x({editor:t})]));l={...l,...g}}const u=g5(l);s.push(u);const f=Re(r,"addInputRules",i);if(DA(r,t.options.enableInputRules)&&f){const g=f();if(g&&g.length){const y=u9({editor:t,rules:g}),x=Array.isArray(y)?y:[y];s.push(...x)}}const h=Re(r,"addPasteRules",i);if(DA(r,t.options.enablePasteRules)&&h){const g=h();if(g&&g.length){const y=p9({editor:t,rules:g});s.push(...y)}}const m=Re(r,"addProseMirrorPlugins",i);if(m){const g=m();s.push(...g)}return s})}get attributes(){return nI(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=vc(this.extensions);return Object.fromEntries(e.filter(n=>!!Re(n,"addNodeView")).map(n=>{const r=this.attributes.filter(u=>u.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:cn(n.name,this.schema)},s=Re(n,"addNodeView",i);if(!s)return[];const o=s();if(!o)return[];const l=(u,f,h,m,g)=>{const y=bc(u,r);return o({node:u,view:f,getPos:h,decorations:m,innerDecorations:g,editor:t,extension:n,HTMLAttributes:y})};return[n.name,l]}))}dispatchTransaction(t){const{editor:e}=this;return nc([...this.extensions].reverse()).reduceRight((r,i)=>{const s={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:Mu(i.name,this.schema)},o=Re(i,"dispatchTransaction",s);return o?l=>{o.call(s,{transaction:l,next:r})}:r},t)}transformPastedHTML(t){const{editor:e}=this;return nc([...this.extensions]).reduce((r,i)=>{const s={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:Mu(i.name,this.schema)},o=Re(i,"transformPastedHTML",s);return o?(l,u)=>{const f=r(l,u);return o.call(s,f)}:r},t||(r=>r))}get markViews(){const{editor:t}=this,{markExtensions:e}=vc(this.extensions);return Object.fromEntries(e.filter(n=>!!Re(n,"addMarkView")).map(n=>{const r=this.attributes.filter(l=>l.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:As(n.name,this.schema)},s=Re(n,"addMarkView",i);if(!s)return[];const o=(l,u,f)=>{const h=bc(l,r);return s()({mark:l,view:u,inline:f,editor:t,extension:n,HTMLAttributes:h,updateAttributes:m=>{l9(l,t,m)}})};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 i={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Mu(e.name,this.schema)};e.type==="mark"&&(((n=ut(Re(e,"keepOnSplit",i)))==null||n)&&this.splittableMarks.push(e.name),(r=ut(Re(e,"clearable",i)))==null||r||this.nonClearableMarks.push(e.name));const s=Re(e,"onBeforeCreate",i),o=Re(e,"onCreate",i),l=Re(e,"onUpdate",i),u=Re(e,"onSelectionUpdate",i),f=Re(e,"onTransaction",i),h=Re(e,"onFocus",i),m=Re(e,"onBlur",i),g=Re(e,"onDestroy",i);s&&this.editor.on("beforeCreate",s),o&&this.editor.on("create",o),l&&this.editor.on("update",l),u&&this.editor.on("selectionUpdate",u),f&&this.editor.on("transaction",f),h&&this.editor.on("focus",h),m&&this.editor.on("blur",m),g&&this.editor.on("destroy",g)})}};Jm.resolve=Yw;Jm.sort=nc;Jm.flatten=Xm;var m9={};Gw(m9,{ClipboardTextSerializer:()=>gI,Commands:()=>yI,Delete:()=>vI,Drop:()=>bI,Editable:()=>xI,FocusEvents:()=>SI,Keymap:()=>kI,Paste:()=>CI,Tabindex:()=>EI,TextDirection:()=>TI,focusEventsPluginKey:()=>wI});var Pt=class mI extends nS{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new mI(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},gI=Pt.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Nt({key:new Wt("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,s=oI(n),{blockSeparator:o}=this.options,l={...o!==void 0?{blockSeparator:o}:{},textSerializers:s};return[...i.ranges].sort((f,h)=>f.$from.pos-h.$from.pos).map(({$from:f,$to:h})=>sI(r,{from:f.pos,to:h.pos},l)).join(o??`
|
|
94
|
-
|
|
95
|
-
`)}}})]}}),yI=Pt.create({name:"commands",addCommands(){return{...ti}}}),vI=Pt.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,i;const s=()=>{var o,l,u,f;if((f=(u=(l=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:l.filterTransaction)==null?void 0:u.call(l,t))!=null?f:t.getMeta("y-sync$"))return;const h=QD(t.before,[t,...e]);Xw(h).forEach(y=>{h.mapping.mapResult(y.oldRange.from).deletedAfter&&h.mapping.mapResult(y.oldRange.to).deletedBefore&&h.before.nodesBetween(y.oldRange.from,y.oldRange.to,(x,S)=>{const k=S+x.nodeSize-2,C=y.oldRange.from<=S&&k<=y.oldRange.to;this.editor.emit("delete",{type:"node",node:x,from:S,to:k,newFrom:h.mapping.map(S),newTo:h.mapping.map(k),deletedRange:y.oldRange,newRange:y.newRange,partial:!C,editor:this.editor,transaction:t,combinedTransform:h})})});const g=h.mapping;h.steps.forEach((y,x)=>{var S,k;if(y instanceof ci){const C=g.slice(x).map(y.from,-1),T=g.slice(x).map(y.to),_=g.invert().map(C,-1),R=g.invert().map(T),M=C>0?(S=h.doc.nodeAt(C-1))==null?void 0:S.marks.some(L=>L.eq(y.mark)):!1,O=(k=h.doc.nodeAt(T))==null?void 0:k.marks.some(L=>L.eq(y.mark));this.editor.emit("delete",{type:"mark",mark:y.mark,from:y.from,to:y.to,deletedRange:{from:_,to:R},newRange:{from:C,to:T},partial:!!(O||M),editor:this.editor,transaction:t,combinedTransform:h})}})};(i=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||i?setTimeout(s,0):s()}}),bI=Pt.create({name:"drop",addProseMirrorPlugins(){return[new Nt({key:new Wt("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),xI=Pt.create({name:"editable",addProseMirrorPlugins(){return[new Nt({key:new Wt("editable"),props:{editable:()=>this.editor.options.editable}})]}}),wI=new Wt("focusEvents"),SI=Pt.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Nt({key:wI,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}}}})]}}),kI=Pt.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:l})=>{const{selection:u,doc:f}=l,{empty:h,$anchor:m}=u,{pos:g,parent:y}=m,x=m.parent.isTextblock&&g>0?l.doc.resolve(g-1):m,S=x.parent.type.spec.isolating,k=m.pos-m.parentOffset,C=S&&x.parent.childCount===1?k===m.pos:Ue.atStart(f).from===g;return!h||!y.type.isTextblock||y.textContent.length||!C||C&&m.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()},i={...r},s={...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 Hp()||XD()?s:i},addProseMirrorPlugins(){return[new Nt({key:new Wt("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(S=>S.getMeta("composition")))return;const r=t.some(S=>S.docChanged)&&!e.doc.eq(n.doc),i=t.some(S=>S.getMeta("preventClearDocument"));if(!r||i)return;const{empty:s,from:o,to:l}=e.selection,u=Ue.atStart(e.doc).from,f=Ue.atEnd(e.doc).to;if(s||!(o===u&&l===f)||!Xd(n.doc))return;const g=n.tr,y=Wm({state:n,transaction:g}),{commands:x}=new Km({editor:this.editor,state:y});if(x.clearNodes(),!!g.steps.length)return g}})]}}),CI=Pt.create({name:"paste",addProseMirrorPlugins(){return[new Nt({key:new Wt("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),EI=Pt.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new Nt({key:new Wt("tabindex"),props:{attributes:()=>{var t;return!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:(t=this.options.value)!=null?t:"0"}}}})]}}),TI=Pt.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=vc(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 Nt({key:new Wt("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),g9=class Uu{constructor(e,n,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=i}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 Uu(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 Uu(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 Uu(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const i=n.isBlock&&!n.isTextblock,s=n.isAtom&&!n.isText,o=n.isInline,l=this.pos+r+(s?0:1);if(l<0||l>this.resolvedPos.doc.nodeSize-2)return;const u=this.resolvedPos.doc.resolve(l);if(!i&&!o&&u.depth<=this.depth)return;const f=new Uu(u,this.editor,i,i||o?n:null);i&&(f.actualDepth=this.depth+1),e.push(f)}),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,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(n).length>0){const s=i.node.attrs,o=Object.keys(n);for(let l=0;l<o.length;l+=1){const u=o[l];if(s[u]!==n[u])break}}else r=i;i=i.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const s=Object.keys(n);return this.children.forEach(o=>{r&&i.length>0||(o.node.type.name===e&&s.every(u=>n[u]===o.node.attrs[u])&&i.push(o),!(r&&i.length>0)&&(i=i.concat(o.querySelectorAll(e,n,r))))}),i}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},y9=`.ProseMirror {
|
|
96
|
-
position: relative;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.ProseMirror {
|
|
100
|
-
word-wrap: break-word;
|
|
101
|
-
white-space: pre-wrap;
|
|
102
|
-
white-space: break-spaces;
|
|
103
|
-
-webkit-font-variant-ligatures: none;
|
|
104
|
-
font-variant-ligatures: none;
|
|
105
|
-
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
.ProseMirror [contenteditable="false"] {
|
|
109
|
-
white-space: normal;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
|
|
113
|
-
white-space: pre-wrap;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
.ProseMirror pre {
|
|
117
|
-
white-space: pre-wrap;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
img.ProseMirror-separator {
|
|
121
|
-
display: inline !important;
|
|
122
|
-
border: none !important;
|
|
123
|
-
margin: 0 !important;
|
|
124
|
-
width: 0 !important;
|
|
125
|
-
height: 0 !important;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
.ProseMirror-gapcursor {
|
|
129
|
-
display: none;
|
|
130
|
-
pointer-events: none;
|
|
131
|
-
position: absolute;
|
|
132
|
-
margin: 0;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
.ProseMirror-gapcursor:after {
|
|
136
|
-
content: "";
|
|
137
|
-
display: block;
|
|
138
|
-
position: absolute;
|
|
139
|
-
top: -2px;
|
|
140
|
-
width: 20px;
|
|
141
|
-
border-top: 1px solid black;
|
|
142
|
-
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
@keyframes ProseMirror-cursor-blink {
|
|
146
|
-
to {
|
|
147
|
-
visibility: hidden;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
.ProseMirror-hideselection *::selection {
|
|
152
|
-
background: transparent;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
.ProseMirror-hideselection *::-moz-selection {
|
|
156
|
-
background: transparent;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
.ProseMirror-hideselection * {
|
|
160
|
-
caret-color: transparent;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
.ProseMirror-focused .ProseMirror-gapcursor {
|
|
164
|
-
display: block;
|
|
165
|
-
}`,v9=class extends Zq{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:n})=>{throw n},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:Eq,createMappablePosition:Tq},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:n,slice:r,moved:i})=>this.options.onDrop(n,r,i)),this.on("paste",({event:n,slice:r})=>this.options.onPaste(n,r)),this.on("delete",this.options.onDelete);const e=this.createDoc();if(!this.editorState){const n=Q0(e,this.options.autofocus);this.editorState=va.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?.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=Xq(y9,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=tI(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(i=>{const s=typeof i=="string"?`${i}$`:i.key;n=n.filter(o=>!o.key.startsWith(s))}),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 s=[...this.options.enableCoreExtensions?[xI,gI.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),yI,SI,kI,EI.configure({value:(r=(n=this.options.coreExtensionOptions)==null?void 0:n.tabindex)==null?void 0:r.value}),bI,CI,vI,TI.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?.type));this.extensionManager=new Jm(s,this)}createCommandManager(){this.commandManager=new Km({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=ex(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;const n=ex(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1});return this.editorState=va.create({doc:n,schema:this.schema,selection:Q0(n,this.options.autofocus)||void 0}),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(r=>r.name!=="collaboration"),this.createExtensionManager()}}),this.editorState.doc}return t}createView(t){const{editorProps:e,enableExtensionDispatchTransaction:n}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r,s=e.transformPastedHTML,o=this.extensionManager.transformPastedHTML(s);this.editorView=new qD(t,{...e,attributes:{role:"textbox",...e?.attributes},dispatchTransaction:i,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 u=this.view.dom;u.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(f=>{var h;return(h=this.capturedTransaction)==null?void 0:h.step(f)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),i=n.includes(t),s=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!i)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(f=>f.getMeta("focus")||f.getMeta("blur")),l=o?.getMeta("focus"),u=o?.getMeta("blur");l&&this.emit("focus",{editor:this,event:l.event,transaction:o}),u&&this.emit("blur",{editor:this,event:u.event,transaction:o}),!(t.getMeta("preventUpdate")||!n.some(f=>f.docChanged)||s.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return aI(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return Sq(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Zw(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
|
|
166
|
-
|
|
167
|
-
`,textSerializers:n={}}=t||{};return gq(this.state.doc,{blockSeparator:e,textSerializers:{...oI(this.schema),...n}})}get isEmpty(){return Xd(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.isAtom?e.nodeAfter:null;return new g9(e,this,!1,n)}get $doc(){return this.$pos(0)}};function Pa(t){return new Jd({find:t.find,handler:({state:e,range:n,match:r})=>{const i=ut(t.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:s}=e,o=r[r.length-1],l=r[0];if(o){const u=l.search(/\S/),f=n.from+l.indexOf(o),h=f+o.length;if(Jw(n.from,n.to,e.doc).filter(y=>y.mark.type.excluded.find(S=>S===t.type&&S!==y.mark.type)).filter(y=>y.to>f).length)return null;h<n.to&&s.delete(h,n.to),f>n.from&&s.delete(n.from+u,f);const g=n.from+u+o.length;s.addMark(n.from+u,g,t.type.create(i||{})),s.removeStoredMark(t.type)}},undoable:t.undoable})}function _I(t){return new Jd({find:t.find,handler:({state:e,range:n,match:r})=>{const i=ut(t.getAttributes,void 0,r)||{},{tr:s}=e,o=n.from;let l=n.to;const u=t.type.create(i);if(r[1]){const f=r[0].lastIndexOf(r[1]);let h=o+f;h>l?h=l:l=h+r[1].length;const m=r[0][r[0].length-1];s.insertText(m,o+r[0].length-1),s.replaceWith(h,l,u)}else if(r[0]){const f=t.type.isInline?o:o-1;s.insert(f,t.type.create(i)).delete(s.mapping.map(o),s.mapping.map(l))}s.scrollIntoView()},undoable:t.undoable})}function rx(t){return new Jd({find:t.find,handler:({state:e,range:n,match:r})=>{const i=e.doc.resolve(n.from),s=ut(t.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,s)},undoable:t.undoable})}function wc(t){return new Jd({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{const s=ut(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),u=o.doc.resolve(n.from).blockRange(),f=u&&Rw(u,t.type,s);if(!f)return null;if(o.wrap(u,f),t.keepMarks&&t.editor){const{selection:m,storedMarks:g}=e,{splittableMarks:y}=t.editor.extensionManager,x=g||m.$to.parentOffset&&m.$from.marks();if(x){const S=x.filter(k=>y.includes(k.type.name));o.ensureMarks(S)}}if(t.keepAttributes){const m=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(m,s).run()}const h=o.doc.resolve(n.from-1).nodeBefore;h&&h.type===t.type&&Bo(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,h))&&o.join(n.from-1)},undoable:t.undoable})}var b9=t=>"touches"in t,x9=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 u=l.clientX-this.startX,f=l.clientY-this.startY;this.handleResize(u,f)},this.handleTouchMove=l=>{if(!this.isResizing||!this.activeHandle)return;const u=l.touches[0];if(!u)return;const f=u.clientX-this.startX,h=u.clientY-this.startY;this.handleResize(f,h)},this.handleMouseUp=()=>{if(!this.isResizing)return;const l=this.element.offsetWidth,u=this.element.offsetHeight;this.onCommit(l,u),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,i,s,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?.options)!=null&&r.directions&&(this.directions=t.options.directions),(i=t.options)!=null&&i.preserveAspectRatio&&(this.preserveAspectRatio=t.options.preserveAspectRatio),(s=t.options)!=null&&s.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"),i=e.includes("left"),s=e.includes("right");n&&(t.style.top="0"),r&&(t.style.bottom="0"),i&&(t.style.left="0"),s&&(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)})}removeHandles(){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,b9(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:i}=this.calculateNewDimensions(this.activeHandle,t,e),s=this.applyConstraints(r,i,n);this.element.style.width=`${s.width}px`,this.element.style.height=`${s.height}px`,this.onResize&&this.onResize(s.width,s.height)}calculateNewDimensions(t,e,n){let r=this.startWidth,i=this.startHeight;const s=t.includes("right"),o=t.includes("left"),l=t.includes("bottom"),u=t.includes("top");return s?r=this.startWidth+e:o&&(r=this.startWidth-e),l?i=this.startHeight+n:u&&(i=this.startHeight-n),(t==="right"||t==="left")&&(r=this.startWidth+(s?e:-e)),(t==="top"||t==="bottom")&&(i=this.startHeight+(l?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,i,t):{width:r,height:i}}applyConstraints(t,e,n){var r,i,s,o;if(!n){let f=Math.max(this.minSize.width,t),h=Math.max(this.minSize.height,e);return(r=this.maxSize)!=null&&r.width&&(f=Math.min(this.maxSize.width,f)),(i=this.maxSize)!=null&&i.height&&(h=Math.min(this.maxSize.height,h)),{width:f,height:h}}let l=t,u=e;return l<this.minSize.width&&(l=this.minSize.width,u=l/this.aspectRatio),u<this.minSize.height&&(u=this.minSize.height,l=u*this.aspectRatio),(s=this.maxSize)!=null&&s.width&&l>this.maxSize.width&&(l=this.maxSize.width,u=l/this.aspectRatio),(o=this.maxSize)!=null&&o.height&&u>this.maxSize.height&&(u=this.maxSize.height,l=u*this.aspectRatio),{width:l,height:u}}applyAspectRatio(t,e,n){const r=n==="left"||n==="right",i=n==="top"||n==="bottom";return r?{width:t,height:t/this.aspectRatio}:i?{width:e*this.aspectRatio,height:e}:{width:t,height:t/this.aspectRatio}}},wn=class AI extends nS{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new AI(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function Io(t){return new pI({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const s=ut(t.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:o}=e,l=r[r.length-1],u=r[0];let f=n.to;if(l){const h=u.search(/\S/),m=n.from+u.indexOf(l),g=m+l.length;if(Jw(n.from,n.to,e.doc).filter(S=>S.mark.type.excluded.find(C=>C===t.type&&C!==S.mark.type)).filter(S=>S.to>m).length)return null;g<n.to&&o.delete(g,n.to),m>n.from&&o.delete(n.from+h,m),f=n.from+h+l.length,o.addMark(n.from+h,f,t.type.create(s||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(t.type)}}})}const{getOwnPropertyNames:w9,getOwnPropertySymbols:S9}=Object,{hasOwnProperty:k9}=Object.prototype;function Sb(t,e){return function(r,i,s){return t(r,i,s)&&e(r,i,s)}}function _h(t){return function(n,r,i){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,i);const{cache:s}=i,o=s.get(n),l=s.get(r);if(o&&l)return o===r&&l===n;s.set(n,r),s.set(r,n);const u=t(n,r,i);return s.delete(n),s.delete(r),u}}function C9(t){return t?.[Symbol.toStringTag]}function zA(t){return w9(t).concat(S9(t))}const E9=Object.hasOwn||((t,e)=>k9.call(t,e));function Za(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const T9="__v",_9="__o",A9="_owner",{getOwnPropertyDescriptor:$A,keys:BA}=Object;function R9(t,e){return t.byteLength===e.byteLength&&Up(new Uint8Array(t),new Uint8Array(e))}function M9(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 N9(t,e){return t.byteLength===e.byteLength&&Up(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function O9(t,e){return Za(t.getTime(),e.getTime())}function D9(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function I9(t,e){return t===e}function VA(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const i=new Array(r),s=t.entries();let o,l,u=0;for(;(o=s.next())&&!o.done;){const f=e.entries();let h=!1,m=0;for(;(l=f.next())&&!l.done;){if(i[m]){m++;continue}const g=o.value,y=l.value;if(n.equals(g[0],y[0],u,m,t,e,n)&&n.equals(g[1],y[1],g[0],y[0],t,e,n)){h=i[m]=!0;break}m++}if(!h)return!1;u++}return!0}const L9=Za;function j9(t,e,n){const r=BA(t);let i=r.length;if(BA(e).length!==i)return!1;for(;i-- >0;)if(!RI(t,e,n,r[i]))return!1;return!0}function Nu(t,e,n){const r=zA(t);let i=r.length;if(zA(e).length!==i)return!1;let s,o,l;for(;i-- >0;)if(s=r[i],!RI(t,e,n,s)||(o=$A(t,s),l=$A(e,s),(o||l)&&(!o||!l||o.configurable!==l.configurable||o.enumerable!==l.enumerable||o.writable!==l.writable)))return!1;return!0}function P9(t,e){return Za(t.valueOf(),e.valueOf())}function z9(t,e){return t.source===e.source&&t.flags===e.flags}function HA(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const i=new Array(r),s=t.values();let o,l;for(;(o=s.next())&&!o.done;){const u=e.values();let f=!1,h=0;for(;(l=u.next())&&!l.done;){if(!i[h]&&n.equals(o.value,l.value,o.value,l.value,t,e,n)){f=i[h]=!0;break}h++}if(!f)return!1}return!0}function Up(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 $9(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 RI(t,e,n,r){return(r===A9||r===_9||r===T9)&&(t.$$typeof||e.$$typeof)?!0:E9(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const B9="[object ArrayBuffer]",V9="[object Arguments]",H9="[object Boolean]",U9="[object DataView]",F9="[object Date]",q9="[object Error]",G9="[object Map]",W9="[object Number]",K9="[object Object]",Z9="[object RegExp]",Y9="[object Set]",X9="[object String]",J9={"[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},Q9="[object URL]",e8=Object.prototype.toString;function t8({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:s,areMapsEqual:o,areNumbersEqual:l,areObjectsEqual:u,arePrimitiveWrappersEqual:f,areRegExpsEqual:h,areSetsEqual:m,areTypedArraysEqual:g,areUrlsEqual:y,unknownTagComparators:x}){return function(k,C,T){if(k===C)return!0;if(k==null||C==null)return!1;const _=typeof k;if(_!==typeof C)return!1;if(_!=="object")return _==="number"?l(k,C,T):_==="function"?s(k,C,T):!1;const R=k.constructor;if(R!==C.constructor)return!1;if(R===Object)return u(k,C,T);if(Array.isArray(k))return e(k,C,T);if(R===Date)return r(k,C,T);if(R===RegExp)return h(k,C,T);if(R===Map)return o(k,C,T);if(R===Set)return m(k,C,T);const M=e8.call(k);if(M===F9)return r(k,C,T);if(M===Z9)return h(k,C,T);if(M===G9)return o(k,C,T);if(M===Y9)return m(k,C,T);if(M===K9)return typeof k.then!="function"&&typeof C.then!="function"&&u(k,C,T);if(M===Q9)return y(k,C,T);if(M===q9)return i(k,C,T);if(M===V9)return u(k,C,T);if(J9[M])return g(k,C,T);if(M===B9)return t(k,C,T);if(M===U9)return n(k,C,T);if(M===H9||M===W9||M===X9)return f(k,C,T);if(x){let O=x[M];if(!O){const L=C9(k);L&&(O=x[L])}if(O)return O(k,C,T)}return!1}}function n8({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:R9,areArraysEqual:n?Nu:M9,areDataViewsEqual:N9,areDatesEqual:O9,areErrorsEqual:D9,areFunctionsEqual:I9,areMapsEqual:n?Sb(VA,Nu):VA,areNumbersEqual:L9,areObjectsEqual:n?Nu:j9,arePrimitiveWrappersEqual:P9,areRegExpsEqual:z9,areSetsEqual:n?Sb(HA,Nu):HA,areTypedArraysEqual:n?Sb(Up,Nu):Up,areUrlsEqual:$9,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const i=_h(r.areArraysEqual),s=_h(r.areMapsEqual),o=_h(r.areObjectsEqual),l=_h(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:i,areMapsEqual:s,areObjectsEqual:o,areSetsEqual:l})}return r}function r8(t){return function(e,n,r,i,s,o,l){return t(e,n,l)}}function i8({circular:t,comparator:e,createState:n,equals:r,strict:i}){if(n)return function(l,u){const{cache:f=t?new WeakMap:void 0,meta:h}=n();return e(l,u,{cache:f,equals:r,meta:h,strict:i})};if(t)return function(l,u){return e(l,u,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};const s={cache:void 0,equals:r,meta:void 0,strict:i};return function(l,u){return e(l,u,s)}}const s8=Ho();Ho({strict:!0});Ho({circular:!0});Ho({circular:!0,strict:!0});Ho({createInternalComparator:()=>Za});Ho({strict:!0,createInternalComparator:()=>Za});Ho({circular:!0,createInternalComparator:()=>Za});Ho({circular:!0,createInternalComparator:()=>Za,strict:!0});function Ho(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:i=!1}=t,s=n8(t),o=t8(s),l=n?n(o):r8(o);return i8({circular:e,comparator:o,createState:r,equals:l,strict:i})}var kb={exports:{}},Cb={};var UA;function o8(){if(UA)return Cb;UA=1;var t=Dd(),e=fO();function n(f,h){return f===h&&(f!==0||1/f===1/h)||f!==f&&h!==h}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,s=t.useRef,o=t.useEffect,l=t.useMemo,u=t.useDebugValue;return Cb.useSyncExternalStoreWithSelector=function(f,h,m,g,y){var x=s(null);if(x.current===null){var S={hasValue:!1,value:null};x.current=S}else S=x.current;x=l(function(){function C(O){if(!T){if(T=!0,_=O,O=g(O),y!==void 0&&S.hasValue){var L=S.value;if(y(L,O))return R=L}return R=O}if(L=R,r(_,O))return L;var P=g(O);return y!==void 0&&y(L,P)?(_=O,L):(_=O,R=P)}var T=!1,_,R,M=m===void 0?null:m;return[function(){return C(h())},M===null?void 0:function(){return C(M())}]},[h,m,g,y]);var k=i(f,x[0],x[1]);return o(function(){S.hasValue=!0,S.value=k},[k]),u(k),k},Cb}var FA;function a8(){return FA||(FA=1,kb.exports=o8()),kb.exports}var l8=a8(),c8=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},u8=({contentComponent:t})=>{const e=hO.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return b.jsx(b.Fragment,{children:Object.values(e)})};function d8(){const t=new Set;let e={},n=!1;const r=()=>{n||!t.size||(n=!0,queueMicrotask(()=>{n=!1,t.forEach(i=>i())}))};return{subscribe(i){return t.add(i),()=>{t.delete(i)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(i,s){e={...e,[i]:TU.createPortal(s.reactElement,s.element,i)},r()},removeRenderer(i){const s={...e};delete s[i],e=s,r()}}}var f8=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=d8(),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 b.jsxs(b.Fragment,{children:[b.jsx("div",{ref:c8(e,this.editorContentRef),...n}),t?.contentComponent&&b.jsx(u8,{contentComponent:t.contentComponent})]})}},h8=A.forwardRef((t,e)=>{const n=Ve.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return Ve.createElement(f8,{key:n,innerRef:e,...t})}),MI=Ve.memo(h8),p8=typeof window<"u"?A.useLayoutEffect:A.useEffect,m8=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},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){let e;const n=i=>{i?.transaction!==void 0&&i.transaction===e||(e=i?.transaction,this.transactionNumber+=1,this.subscribers.forEach(s=>s()))},r=this.editor;return r.on("transaction",n),r.on("update",n),()=>{r.off("transaction",n),r.off("update",n)}}}};function NI(t){var e;const[n]=A.useState(()=>new m8(t.editor)),r=l8.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:s8);return p8(()=>n.watch(t.editor),[t.editor,n]),A.useDebugValue(r),r}var g8=!1,OI=typeof window>"u",y8=OI||!!(typeof window<"u"&&window.next),v8=class DI{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;return OI?(n&&g8&&console.warn("SSR detected. `immediatelyRender` has been set to false to avoid hydration mismatches"),n=!1):y8&&e===void 0&&(n=!1),n?this.createEditor():null}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var i,s;return(s=(i=this.options.current).onBeforeCreate)==null?void 0:s.call(i,...r)},onBlur:(...r)=>{var i,s;return(s=(i=this.options.current).onBlur)==null?void 0:s.call(i,...r)},onCreate:(...r)=>{var i,s;return(s=(i=this.options.current).onCreate)==null?void 0:s.call(i,...r)},onDestroy:(...r)=>{var i,s;return(s=(i=this.options.current).onDestroy)==null?void 0:s.call(i,...r)},onFocus:(...r)=>{var i,s;return(s=(i=this.options.current).onFocus)==null?void 0:s.call(i,...r)},onSelectionUpdate:(...r)=>{var i,s;return(s=(i=this.options.current).onSelectionUpdate)==null?void 0:s.call(i,...r)},onTransaction:(...r)=>{var i,s;return(s=(i=this.options.current).onTransaction)==null?void 0:s.call(i,...r)},onUpdate:(...r)=>{var i,s;return(s=(i=this.options.current).onUpdate)==null?void 0:s.call(i,...r)},onContentError:(...r)=>{var i,s;return(s=(i=this.options.current).onContentError)==null?void 0:s.call(i,...r)},onDrop:(...r)=>{var i,s;return(s=(i=this.options.current).onDrop)==null?void 0:s.call(i,...r)},onPaste:(...r)=>{var i,s;return(s=(i=this.options.current).onPaste)==null?void 0:s.call(i,...r)},onDelete:(...r)=>{var i,s;return(s=(i=this.options.current).onDelete)==null?void 0:s.call(i,...r)},onMount:(...r)=>{var i,s;return(s=(i=this.options.current).onMount)==null?void 0:s.call(i,...r)},onUnmount:(...r)=>{var i,s;return(s=(i=this.options.current).onUnmount)==null?void 0:s.call(i,...r)}};return new v9(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((i,s)=>{var o;return i===((o=n.extensions)==null?void 0:o[s])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?DI.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,i)=>r===e[i]))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 b8(t={},e=[]){const n=A.useRef(t);n.current=t;const[r]=A.useState(()=>new v8(n)),i=hO.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return A.useDebugValue(i),A.useEffect(r.onRender(e)),NI({editor:i,selector:({transactionNumber:s})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&s===0?0:s+1}),i}var II=A.createContext({editor:null});II.Consumer;var x8=A.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),w8=()=>A.useContext(x8);Ve.forwardRef((t,e)=>{const{onDragStart:n}=w8(),r=t.as||"div";return b.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});Ve.createContext({markViewContentRef:()=>{}});var rS=A.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});rS.displayName="TiptapContext";var S8=()=>A.useContext(rS);function LI({children:t,...e}){const n="editor"in e?e.editor:e.instance;if(!n)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const r=A.useMemo(()=>({editor:n}),[n]),i=A.useMemo(()=>({editor:n}),[n]);return b.jsx(II.Provider,{value:i,children:b.jsx(rS.Provider,{value:r,children:t})})}LI.displayName="Tiptap";function jI({...t}){const{editor:e}=S8();return b.jsx(MI,{editor:e,...t})}jI.displayName="Tiptap.Content";Object.assign(LI,{Content:jI});var Fp=(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]},k8=(t,e)=>{var n;const{state:r,view:i}=t,{selection:s}=r;if(!s.empty)return!1;const{$from:o}=s;if(o.parentOffset!==0)return!1;const l=o.depth-1;if(l<0)return!1;const u=o.node(l),f=o.index(l);if(f===0)return!1;if(u.type===e)return t.commands.lift(e.name);const h=u.child(f-1);if(h.type!==e||!((n=h.lastChild)!=null&&n.isTextblock))return!1;const m=o.before(),y=m-1-1,{tr:x}=r;return x.delete(m,o.after()).insert(y,o.parent.content),x.setSelection(Ie.create(x.doc,y)),i.dispatch(x.scrollIntoView()),!0},C8=/^\s*>\s$/,E8=wn.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return Fp("blockquote",{...Mt(this.options.HTMLAttributes,t),children:Fp("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((i,s)=>{var o,l;const h=((l=(o=e.renderChild)==null?void 0:o.call(e,i,s))!=null?l:e.renderChildren([i])).split(`
|
|
168
|
-
`).map(m=>m.trim()===""?n:`${n} ${m}`);r.push(h.join(`
|
|
169
|
-
`))}),r.join(`
|
|
170
|
-
${n}
|
|
171
|
-
`)},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:()=>k8(this.editor,this.type)}},addInputRules(){return[wc({find:C8,type:this.type})]}}),T8=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,_8=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,A8=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,R8=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,M8=Ka.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 Fp("strong",{...Mt(this.options.HTMLAttributes,t),children:Fp("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()}},addInputRules(){return[Pa({find:T8,type:this.type}),Pa({find:A8,type:this.type})]},addPasteRules(){return[Io({find:_8,type:this.type}),Io({find:R8,type:this.type})]}}),N8=t=>{const e=/`([^`]+)`(?!`)$/.exec(t);return!e||e.index>0&&t[e.index-1]==="`"?null:{index:e.index,text:e[0],replaceWith:e[1]}},O8=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},D8=Ka.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Mt(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[Pa({find:N8,type:this.type})]},addPasteRules(){return[Io({find:O8,type:this.type})]}}),Eb=4,I8=/^```([a-z]+)?[\s\n]$/,L8=/^~~~([a-z]+)?[\s\n]$/,j8=wn.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,exitOnArrowUp:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Eb,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 s=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(o=>o.startsWith(n)).map(o=>o.replace(n,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",Mt(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 i=((n=t.attrs)==null?void 0:n.language)||"";return t.content?r=[`\`\`\`${i}`,e.renderChildren(t.content),"```"].join(`
|
|
172
|
-
`):r=`\`\`\`${i}
|
|
173
|
-
|
|
174
|
-
\`\`\``,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:Eb,{state:r}=t,{selection:i}=r,{$from:s,empty:o}=i;if(s.parent.type!==this.type)return!1;const l=" ".repeat(n);return o?t.commands.insertContent(l):t.commands.command(({tr:u})=>{const{from:f,to:h}=i,y=r.doc.textBetween(f,h,`
|
|
175
|
-
`,`
|
|
176
|
-
`).split(`
|
|
177
|
-
`).map(x=>l+x).join(`
|
|
178
|
-
`);return u.replaceWith(f,h,r.schema.text(y)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:Eb,{state:r}=t,{selection:i}=r,{$from:s,empty:o}=i;return s.parent.type!==this.type?!1:o?t.commands.command(({tr:l})=>{var u;const{pos:f}=s,h=s.start(),m=s.end(),y=r.doc.textBetween(h,m,`
|
|
179
|
-
`,`
|
|
180
|
-
`).split(`
|
|
181
|
-
`);let x=0,S=0;const k=f-h;for(let O=0;O<y.length;O+=1){if(S+y[O].length>=k){x=O;break}S+=y[O].length+1}const T=((u=y[x].match(/^ */))==null?void 0:u[0])||"",_=Math.min(T.length,n);if(_===0)return!0;let R=h;for(let O=0;O<x;O+=1)R+=y[O].length+1;return l.delete(R,R+_),f-R<=_&&l.setSelection(Ie.create(l.doc,R)),!0}):t.commands.command(({tr:l})=>{const{from:u,to:f}=i,g=r.doc.textBetween(u,f,`
|
|
182
|
-
`,`
|
|
183
|
-
`).split(`
|
|
184
|
-
`).map(y=>{var x;const S=((x=y.match(/^ */))==null?void 0:x[0])||"",k=Math.min(S.length,n);return y.slice(k)}).join(`
|
|
185
|
-
`);return l.replaceWith(u,f,r.schema.text(g)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;const s=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
|
|
186
|
-
|
|
187
|
-
`);return!s||!o?!1:t.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowUp:({editor:t})=>{if(!this.options.exitOnArrowUp)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type||r.parentOffset!==0)return!1;const s=r.before();return s>0?!1:t.commands.insertDefaultBlock({pos:s})},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:i,empty:s}=n;if(!s||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const l=i.after();return l===void 0?!1:r.nodeAt(l)?t.commands.command(({tr:f})=>(f.setSelection(Ue.near(r.resolve(l))),!0)):t.commands.exitCode()}}},addInputRules(){return[rx({find:I8,type:this.type,getAttributes:t=>({language:t[1]})}),rx({find:L8,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Nt({key:new Wt("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"),i=r?JSON.parse(r):void 0,s=i?.mode;if(!n||!s)return!1;const{tr:o,schema:l}=t.state,u=l.text(n.replace(/\r\n?/g,`
|
|
188
|
-
`));return o.replaceSelectionWith(this.type.create({language:s},u)),o.selection.$from.parent.type!==this.type&&o.setSelection(Ie.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),P8=wn.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
|
|
189
|
-
|
|
190
|
-
`):""}),z8=wn.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",Mt(this.options.HTMLAttributes,t)]},renderText(){return`
|
|
191
|
-
`},renderMarkdown:()=>`
|
|
192
|
-
`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:i,storedMarks:s}=n;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:l}=r.extensionManager,u=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:f,dispatch:h})=>{if(h&&u&&o){const m=u.filter(g=>l.includes(g.type.name));f.ensureMarks(m)}return!0}).scrollIntoView().run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),$8=wn.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]}`,Mt(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,i="#".repeat(r);return t.content?`${i} ${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=>rx({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),B8=wn.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Mt(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!Yq(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,i=t();return lI(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:s,tr:o,dispatch:l})=>{if(l){const{$to:u}=o.selection,f=u.end();if(u.nodeAfter)u.nodeAfter.isTextblock?o.setSelection(Ie.create(o.doc,u.pos+1)):u.nodeAfter.isBlock?o.setSelection(Pe.create(o.doc,u.pos)):o.setSelection(Ie.create(o.doc,u.pos));else{const h=s.schema.nodes[this.options.nextNodeType]||u.parent.type.contentMatch.defaultType,m=h?.create();m&&(o.insert(f,m),o.setSelection(Ie.create(o.doc,f+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[_I({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),V8=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,H8=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,U8=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,F8=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,q8=Ka.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",Mt(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[Pa({find:V8,type:this.type}),Pa({find:U8,type:this.type})]},addPasteRules(){return[Io({find:H8,type:this.type}),Io({find:F8,type:this.type})]}});const G8="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",W8="ελ1υ2бг1ел3дети4ею2католик6ом3мкд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",ix="numeric",sx="ascii",ox="alpha",td="asciinumeric",Fu="alphanumeric",ax="domain",PI="emoji",K8="scheme",Z8="slashscheme",Tb="whitespace";function Y8(t,e){return t in e||(e[t]=[]),e[t]}function Sa(t,e,n){e[ix]&&(e[td]=!0,e[Fu]=!0),e[sx]&&(e[td]=!0,e[ox]=!0),e[td]&&(e[Fu]=!0),e[ox]&&(e[Fu]=!0),e[Fu]&&(e[ax]=!0),e[PI]&&(e[ax]=!0);for(const r in e){const i=Y8(r,n);i.indexOf(t)<0&&i.push(t)}}function X8(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function ur(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}ur.groups={};ur.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 i=e.jr[r][0],s=e.jr[r][1];if(s&&i.test(t))return s}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let i=0;i<t.length;i++)this.tt(t[i],e,n,r)},tr(t,e,n,r){r=r||ur.groups;let i;return e&&e.j?i=e:(i=new ur(e),n&&r&&Sa(e,n,r)),this.jr.push([t,i]),i},ts(t,e,n,r){let i=this;const s=t.length;if(!s)return i;for(let o=0;o<s-1;o++)i=i.tt(t[o]);return i.tt(t[s-1],e,n,r)},tt(t,e,n,r){r=r||ur.groups;const i=this;if(e&&e.j)return i.j[t]=e,e;const s=e;let o,l=i.go(t);if(l?(o=new ur,Object.assign(o.j,l.j),o.jr.push.apply(o.jr,l.jr),o.jd=l.jd,o.t=l.t):o=new ur,s){if(r)if(o.t&&typeof o.t=="string"){const u=Object.assign(X8(o.t,r),n);Sa(s,u,r)}else n&&Sa(s,n,r);o.t=s}return i.j[t]=o,o}};const Je=(t,e,n,r,i)=>t.ta(e,n,r,i),Ft=(t,e,n,r,i)=>t.tr(e,n,r,i),qA=(t,e,n,r,i)=>t.ts(e,n,r,i),ye=(t,e,n,r,i)=>t.tt(e,n,r,i),rs="WORD",lx="UWORD",zI="ASCIINUMERICAL",$I="ALPHANUMERICAL",Ad="LOCALHOST",cx="TLD",ux="UTLD",op="SCHEME",Zl="SLASH_SCHEME",iS="NUM",dx="WS",sS="NL",nd="OPENBRACE",rd="CLOSEBRACE",qp="OPENBRACKET",Gp="CLOSEBRACKET",Wp="OPENPAREN",Kp="CLOSEPAREN",Zp="OPENANGLEBRACKET",Yp="CLOSEANGLEBRACKET",Xp="FULLWIDTHLEFTPAREN",Jp="FULLWIDTHRIGHTPAREN",Qp="LEFTCORNERBRACKET",em="RIGHTCORNERBRACKET",tm="LEFTWHITECORNERBRACKET",nm="RIGHTWHITECORNERBRACKET",rm="FULLWIDTHLESSTHAN",im="FULLWIDTHGREATERTHAN",sm="AMPERSAND",om="APOSTROPHE",am="ASTERISK",oo="AT",lm="BACKSLASH",cm="BACKTICK",um="CARET",ka="COLON",oS="COMMA",dm="DOLLAR",ki="DOT",fm="EQUALS",aS="EXCLAMATION",Br="HYPHEN",id="PERCENT",hm="PIPE",pm="PLUS",mm="POUND",sd="QUERY",lS="QUOTE",BI="FULLWIDTHMIDDLEDOT",cS="SEMI",Ci="SLASH",od="TILDE",gm="UNDERSCORE",VI="EMOJI",ym="SYM";var HI=Object.freeze({__proto__:null,ALPHANUMERICAL:$I,AMPERSAND:sm,APOSTROPHE:om,ASCIINUMERICAL:zI,ASTERISK:am,AT:oo,BACKSLASH:lm,BACKTICK:cm,CARET:um,CLOSEANGLEBRACKET:Yp,CLOSEBRACE:rd,CLOSEBRACKET:Gp,CLOSEPAREN:Kp,COLON:ka,COMMA:oS,DOLLAR:dm,DOT:ki,EMOJI:VI,EQUALS:fm,EXCLAMATION:aS,FULLWIDTHGREATERTHAN:im,FULLWIDTHLEFTPAREN:Xp,FULLWIDTHLESSTHAN:rm,FULLWIDTHMIDDLEDOT:BI,FULLWIDTHRIGHTPAREN:Jp,HYPHEN:Br,LEFTCORNERBRACKET:Qp,LEFTWHITECORNERBRACKET:tm,LOCALHOST:Ad,NL:sS,NUM:iS,OPENANGLEBRACKET:Zp,OPENBRACE:nd,OPENBRACKET:qp,OPENPAREN:Wp,PERCENT:id,PIPE:hm,PLUS:pm,POUND:mm,QUERY:sd,QUOTE:lS,RIGHTCORNERBRACKET:em,RIGHTWHITECORNERBRACKET:nm,SCHEME:op,SEMI:cS,SLASH:Ci,SLASH_SCHEME:Zl,SYM:ym,TILDE:od,TLD:cx,UNDERSCORE:gm,UTLD:ux,UWORD:lx,WORD:rs,WS:dx});const es=/[a-z]/,Ou=new RegExp("\\p{L}","u"),_b=new RegExp("\\p{Emoji}","u"),ts=/\d/,Ab=/\s/,GA="\r",Rb=`
|
|
193
|
-
`,J8="️",Q8="",Mb="";let Ah=null,Rh=null;function eG(t=[]){const e={};ur.groups=e;const n=new ur;Ah==null&&(Ah=WA(G8)),Rh==null&&(Rh=WA(W8)),ye(n,"'",om),ye(n,"{",nd),ye(n,"}",rd),ye(n,"[",qp),ye(n,"]",Gp),ye(n,"(",Wp),ye(n,")",Kp),ye(n,"<",Zp),ye(n,">",Yp),ye(n,"(",Xp),ye(n,")",Jp),ye(n,"「",Qp),ye(n,"」",em),ye(n,"『",tm),ye(n,"』",nm),ye(n,"<",rm),ye(n,">",im),ye(n,"&",sm),ye(n,"*",am),ye(n,"@",oo),ye(n,"`",cm),ye(n,"^",um),ye(n,":",ka),ye(n,",",oS),ye(n,"$",dm),ye(n,".",ki),ye(n,"=",fm),ye(n,"!",aS),ye(n,"-",Br),ye(n,"%",id),ye(n,"|",hm),ye(n,"+",pm),ye(n,"#",mm),ye(n,"?",sd),ye(n,'"',lS),ye(n,"/",Ci),ye(n,";",cS),ye(n,"~",od),ye(n,"_",gm),ye(n,"\\",lm),ye(n,"・",BI);const r=Ft(n,ts,iS,{[ix]:!0});Ft(r,ts,r);const i=Ft(r,es,zI,{[td]:!0}),s=Ft(r,Ou,$I,{[Fu]:!0}),o=Ft(n,es,rs,{[sx]:!0});Ft(o,ts,i),Ft(o,es,o),Ft(i,ts,i),Ft(i,es,i);const l=Ft(n,Ou,lx,{[ox]:!0});Ft(l,es),Ft(l,ts,s),Ft(l,Ou,l),Ft(s,ts,s),Ft(s,es),Ft(s,Ou,s);const u=ye(n,Rb,sS,{[Tb]:!0}),f=ye(n,GA,dx,{[Tb]:!0}),h=Ft(n,Ab,dx,{[Tb]:!0});ye(n,Mb,h),ye(f,Rb,u),ye(f,Mb,h),Ft(f,Ab,h),ye(h,GA),ye(h,Rb),Ft(h,Ab,h),ye(h,Mb,h);const m=Ft(n,_b,VI,{[PI]:!0});ye(m,"#"),Ft(m,_b,m),ye(m,J8,m);const g=ye(m,Q8);ye(g,"#"),Ft(g,_b,m);const y=[[es,o],[ts,i]],x=[[es,null],[Ou,l],[ts,s]];for(let S=0;S<Ah.length;S++)to(n,Ah[S],cx,rs,y);for(let S=0;S<Rh.length;S++)to(n,Rh[S],ux,lx,x);Sa(cx,{tld:!0,ascii:!0},e),Sa(ux,{utld:!0,alpha:!0},e),to(n,"file",op,rs,y),to(n,"mailto",op,rs,y),to(n,"http",Zl,rs,y),to(n,"https",Zl,rs,y),to(n,"ftp",Zl,rs,y),to(n,"ftps",Zl,rs,y),Sa(op,{scheme:!0,ascii:!0},e),Sa(Zl,{slashscheme:!0,ascii:!0},e),t=t.sort((S,k)=>S[0]>k[0]?1:-1);for(let S=0;S<t.length;S++){const k=t[S][0],T=t[S][1]?{[K8]:!0}:{[Z8]:!0};k.indexOf("-")>=0?T[ax]=!0:es.test(k)?ts.test(k)?T[td]=!0:T[sx]=!0:T[ix]=!0,qA(n,k,k,T)}return qA(n,"localhost",Ad,{ascii:!0}),n.jd=new ur(ym),{start:n,tokens:Object.assign({groups:e},HI)}}function UI(t,e){const n=tG(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=n.length,i=[];let s=0,o=0;for(;o<r;){let l=t,u=null,f=0,h=null,m=-1,g=-1;for(;o<r&&(u=l.go(n[o]));)l=u,l.accepts()?(m=0,g=0,h=l):m>=0&&(m+=n[o].length,g++),f+=n[o].length,s+=n[o].length,o++;s-=m,o-=g,f-=m,i.push({t:h.t,v:e.slice(s-f,s),s:s-f,e:s})}return i}function tG(t){const e=[],n=t.length;let r=0;for(;r<n;){let i=t.charCodeAt(r),s,o=i<55296||i>56319||r+1===n||(s=t.charCodeAt(r+1))<56320||s>57343?t[r]:t.slice(r,r+2);e.push(o),r+=o.length}return e}function to(t,e,n,r,i){let s;const o=e.length;for(let l=0;l<o-1;l++){const u=e[l];t.j[u]?s=t.j[u]:(s=new ur(r),s.jr=i.slice(),t.j[u]=s),t=s}return s=new ur(n),s.jr=i.slice(),t.j[e[o-1]]=s,s}function WA(t){const e=[],n=[];let r=0,i="0123456789";for(;r<t.length;){let s=0;for(;i.indexOf(t[r+s])>=0;)s++;if(s>0){e.push(n.join(""));for(let o=parseInt(t.substring(r,r+s),10);o>0;o--)n.pop();r+=s}else n.push(t[r]),r++}return e}const Rd={defaultProtocol:"http",events:null,format:KA,formatHref:KA,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function uS(t,e=null){let n=Object.assign({},Rd);t&&(n=Object.assign(n,t instanceof uS?t.o:t));const r=n.ignoreTags,i=[];for(let s=0;s<r.length;s++)i.push(r[s].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=i}uS.prototype={o:Rd,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let i=this.o[t];return i&&(typeof i=="object"?(i=n.t in i?i[n.t]:Rd[t],typeof i=="function"&&r&&(i=i(e,n))):typeof i=="function"&&r&&(i=i(e,n.t,n)),i)},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 KA(t){return t}function FI(t,e){this.t="token",this.v=t,this.tk=e}FI.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=Rd.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),i=t.get("tagName",n,e),s=this.toFormattedString(t),o={},l=t.get("className",n,e),u=t.get("target",n,e),f=t.get("rel",n,e),h=t.getObj("attributes",n,e),m=t.getObj("events",n,e);return o.href=r,l&&(o.class=l),u&&(o.target=u),f&&(o.rel=f),h&&Object.assign(o,h),{tagName:i,attributes:o,content:s,eventListeners:m}}};function Qm(t,e){class n extends FI{constructor(i,s){super(i,s),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const nG=Qm("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),ZA=Qm("text"),rG=Qm("nl"),Mh=Qm("url",{isLink:!0,toHref(t=Rd.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==Ad&&t[1].t===ka}}),$r=t=>new ur(t);function iG({groups:t}){const e=t.domain.concat([sm,am,oo,lm,cm,um,dm,fm,Br,iS,id,hm,pm,mm,Ci,ym,od,gm]),n=[om,ka,oS,ki,aS,id,sd,lS,cS,Zp,Yp,nd,rd,Gp,qp,Wp,Kp,Xp,Jp,Qp,em,tm,nm,rm,im],r=[sm,om,am,lm,cm,um,dm,fm,Br,nd,rd,id,hm,pm,mm,sd,Ci,ym,od,gm],i=$r(),s=ye(i,od);Je(s,r,s),Je(s,t.domain,s);const o=$r(),l=$r(),u=$r();Je(i,t.domain,o),Je(i,t.scheme,l),Je(i,t.slashscheme,u),Je(o,r,s),Je(o,t.domain,o);const f=ye(o,oo);ye(s,oo,f),ye(l,oo,f),ye(u,oo,f);const h=ye(s,ki);Je(h,r,s),Je(h,t.domain,s);const m=$r();Je(f,t.domain,m),Je(m,t.domain,m);const g=ye(m,ki);Je(g,t.domain,m);const y=$r(nG);Je(g,t.tld,y),Je(g,t.utld,y),ye(f,Ad,y);const x=ye(m,Br);ye(x,Br,x),Je(x,t.domain,m),Je(y,t.domain,m),ye(y,ki,g),ye(y,Br,x);const S=ye(o,Br),k=ye(o,ki);ye(S,Br,S),Je(S,t.domain,o),Je(k,r,s),Je(k,t.domain,o);const C=$r(Mh);Je(k,t.tld,C),Je(k,t.utld,C),Je(C,t.domain,o),Je(C,r,s),ye(C,ki,k),ye(C,Br,S),ye(C,oo,f);const T=ye(C,ka),_=$r(Mh);Je(T,t.numeric,_);const R=$r(Mh),M=$r();Je(R,e,R),Je(R,n,M),Je(M,e,R),Je(M,n,M),ye(C,Ci,R),ye(_,Ci,R);const O=ye(l,ka),L=ye(u,ka),P=ye(L,Ci),U=ye(P,Ci);Je(l,t.domain,o),ye(l,ki,k),ye(l,Br,S),Je(u,t.domain,o),ye(u,ki,k),ye(u,Br,S),Je(O,t.domain,R),ye(O,Ci,R),ye(O,sd,R),Je(U,t.domain,R),Je(U,e,R),ye(U,Ci,R);const G=[[nd,rd],[qp,Gp],[Wp,Kp],[Zp,Yp],[Xp,Jp],[Qp,em],[tm,nm],[rm,im]];for(let oe=0;oe<G.length;oe++){const[K,ne]=G[oe],re=ye(R,K);ye(M,K,re);const me=$r(Mh);Je(re,e,me);const B=$r();Je(re,n,B),ye(re,ne,R),Je(me,e,me),Je(me,n,B),Je(B,e,me),Je(B,n,B),ye(me,ne,R),ye(B,ne,R)}return ye(i,Ad,C),ye(i,sS,rG),{start:i,tokens:HI}}function sG(t,e,n){let r=n.length,i=0,s=[],o=[];for(;i<r;){let l=t,u=null,f=null,h=0,m=null,g=-1;for(;i<r&&!(u=l.go(n[i].t));)o.push(n[i++]);for(;i<r&&(f=u||l.go(n[i].t));)u=null,l=f,l.accepts()?(g=0,m=l):g>=0&&g++,i++,h++;if(g<0)i-=h,i<r&&(o.push(n[i]),i++);else{o.length>0&&(s.push(Nb(ZA,e,o)),o=[]),i-=g,h-=g;const y=m.t,x=n.slice(i-h,i);s.push(Nb(y,e,x))}}return o.length>0&&s.push(Nb(ZA,e,o)),s}function Nb(t,e,n){const r=n[0].s,i=n[n.length-1].e,s=e.slice(r,i);return new t(s,n)}const oG=typeof console<"u"&&console&&console.warn||(()=>{}),aG="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",It={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function lG(){return ur.groups={},It.scanner=null,It.parser=null,It.tokenQueue=[],It.pluginQueue=[],It.customSchemes=[],It.initialized=!1,It}function YA(t,e=!1){if(It.initialized&&oG(`linkifyjs: already initialized - will not register custom scheme "${t}" ${aG}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
|
|
194
|
-
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
195
|
-
2. Cannot start or end with "-"
|
|
196
|
-
3. "-" cannot repeat`);It.customSchemes.push([t,e])}function cG(){It.scanner=eG(It.customSchemes);for(let t=0;t<It.tokenQueue.length;t++)It.tokenQueue[t][1]({scanner:It.scanner});It.parser=iG(It.scanner.tokens);for(let t=0;t<It.pluginQueue.length;t++)It.pluginQueue[t][1]({scanner:It.scanner,parser:It.parser});return It.initialized=!0,It}function dS(t){return It.initialized||cG(),sG(It.parser.start,t,UI(It.scanner.start,t))}dS.scan=UI;function qI(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 uS(n),i=dS(t),s=[];for(let o=0;o<i.length;o++){const l=i[o];l.isLink&&(!e||l.t===e)&&r.check(l)&&s.push(l.toFormattedObject(r))}return s}var fS="[\0- -\u2029 ]",uG=new RegExp(fS),dG=new RegExp(`${fS}$`),fG=new RegExp(fS,"g");function hG(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function pG(t){return new Nt({key:new Wt("autolink"),appendTransaction:(e,n,r)=>{const i=e.some(f=>f.docChanged)&&!n.doc.eq(r.doc),s=e.some(f=>f.getMeta("preventAutolink"));if(!i||s)return;const{tr:o}=r,l=QD(n.doc,[...e]);if(Xw(l).forEach(({newRange:f})=>{const h=uq(r.doc,f,y=>y.isTextblock);let m,g;if(h.length>1)m=h[0],g=r.doc.textBetween(m.pos,m.pos+m.node.nodeSize,void 0," ");else if(h.length){const y=r.doc.textBetween(f.from,f.to," "," ");if(!dG.test(y))return;m=h[0],g=r.doc.textBetween(m.pos,f.to,void 0," ")}if(m&&g){const y=g.split(uG).filter(Boolean);if(y.length<=0)return!1;const x=y[y.length-1],S=m.pos+g.lastIndexOf(x);if(!x)return!1;const k=dS(x).map(C=>C.toObject(t.defaultProtocol));if(!hG(k))return!1;k.filter(C=>C.isLink).map(C=>({...C,from:S+C.start+1,to:S+C.end+1})).filter(C=>r.schema.marks.code?!r.doc.rangeHasMark(C.from,C.to,r.schema.marks.code):!0).filter(C=>t.validate(C.value)).filter(C=>t.shouldAutoLink(C.value)).forEach(C=>{Jw(C.from,C.to,r.doc).some(T=>T.mark.type===t.type)||o.addMark(C.from,C.to,t.type.create({href:C.href}))})}}),!!o.steps.length)return o}})}function mG(t){return new Nt({key:new Wt("handleClickLink"),props:{handleClick:(e,n,r)=>{var i,s;if(r.button!==0||!e.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{const u=r.target;if(!u)return!1;const f=t.editor.view.dom;o=u.closest("a"),o&&!f.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 u=aI(e.state,t.type.name),f=(i=o.href)!=null?i:u.href,h=(s=o.target)!=null?s:u.target;f&&(window.open(f,h),l=!0)}return l}}})}var gG=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)$/,yG=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)/g;function GI(t,e){let n=0;for(let r=e-1;r>=0&&t[r]==="\\";r-=1)n+=1;return n%2===1}function vG(t,e){let n=0,r=0;for(;r<e;){if(t[r]!=="`"){r+=1;continue}if(n===0&&GI(t,r)){r+=1;continue}let i=0;for(;r<e&&t[r]==="`";)i+=1,r+=1;n===0?n=i:i===n&&(n=0)}return n>0}function WI(t,e,n){var r,i;const[,s,o]=e;return(e.index?t[e.index-1]:void 0)==="!"||GI(t,(r=e.index)!=null?r:0)||vG(t,(i=e.index)!=null?i:0)?!1:!!s.trim()&&n(o)}function KI(t){var e,n;const[r,i,s,,o,l,u]=t,f=(e=o??l)!=null?e:u;return{index:(n=t.index)!=null?n:0,text:r,replaceWith:i,data:{href:s,title:f||null,markdown:!0}}}function bG(t,e){return t.index<e.index+e.text.length&&e.index<t.index+t.text.length}function ZI(t){var e,n,r;return{href:(e=t.data)==null?void 0:e.href,title:(r=(n=t.data)==null?void 0:n.title)!=null?r:null}}function xG(t){const e=Pa({find:n=>{const r=gG.exec(n);return!r||!WI(n,r,t.isAllowedHref)?null:KI(r)},type:t.type,getAttributes:ZI});return new Jd({find:e.find,handler:n=>{const r=e.handler(n);return r!==null&&n.state.tr.steps.length&&n.state.tr.setMeta("preventAutolink",!0),r}})}function wG(t){const e=Io({find:n=>{var r,i;const s=[];for(const l of n.matchAll(yG))WI(n,l,t.isAllowedHref)&&s.push(KI(l));const o=((i=(r=t.findPlainUrls)==null?void 0:r.call(t,n))!=null?i:[]).filter(l=>!s.some(u=>bG(u,l)));return[...s,...o]},type:t.type,getAttributes:ZI});return new pI({find:e.find,handler:n=>{var r;const i=e.handler(n);return i!==null&&n.state.tr.steps.length&&((r=n.match.data)!=null&&r.markdown)&&n.state.tr.setMeta("preventAutolink",!0),i}})}function SG(t){return new Nt({key:new Wt("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:i}=t,{state:s}=e,{selection:o}=s,{empty:l}=o;if(l)return!1;let u="";r.content.forEach(h=>{u+=h.textContent});const f=qI(u,{defaultProtocol:t.defaultProtocol}).find(h=>h.isLink&&h.value===u);return!u||!f||i!==void 0&&!i(f.value)?!1:t.editor.commands.setMark(t.type,{href:f.href})}}})}function ns(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&n.push(i)}),!t||t.replace(fG,"").match(new RegExp(`^(?:(?:${n.map(r=>r.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join("|")}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`,"i"))}var kG=Ka.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"){YA(t);return}YA(t.scheme,t.optionalSlashes)})},onDestroy(){lG()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,markdownLinks:!1,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!ns(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 i=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(i)||!/\./.test(i))}}},addAttributes(){var t,e,n;return{href:{default:null,parseHTML(r){return r.getAttribute("href")}},target:{default:(t=this.options.HTMLAttributes.target)!=null?t:null},rel:{default:(e=this.options.HTMLAttributes.rel)!=null?e:null},class:{default:(n=this.options.HTMLAttributes.class)!=null?n:null},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!ns(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=>!!ns(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Mt(this.options.HTMLAttributes,t),0]:["a",Mt(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,i,s;const o=(r=(n=t.attrs)==null?void 0:n.href)!=null?r:"",l=(s=(i=t.attrs)==null?void 0:i.title)!=null?s:"",u=e.renderChildren(t);return l?`[${u}](${o} "${l}")`:`[${u}](${o})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!ns(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=>!!ns(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()}},addInputRules(){return this.options.markdownLinks?[xG({type:this.type,isAllowedHref:t=>this.options.isAllowedUri(t,{defaultValidate:e=>!!ns(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})})]:[]},addPasteRules(){const t=e=>{const n=[];if(e){const{protocols:r,defaultProtocol:i}=this.options;qI(e).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:l=>!!ns(l,r),protocols:r,defaultProtocol:i})).forEach(o=>{this.options.shouldAutoLink(o.value)&&n.push({text:o.value,data:{href:o.href},index:o.start})})}return n};return this.options.markdownLinks?[wG({type:this.type,isAllowedHref:e=>this.options.isAllowedUri(e,{defaultValidate:n=>!!ns(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}),findPlainUrls:t})]:[Io({find:t,type:this.type,getAttributes:e=>{var n;return{href:(n=e.data)==null?void 0:n.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(pG({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!ns(i,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(mG({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(SG({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),CG=Object.defineProperty,EG=(t,e)=>{for(var n in e)CG(t,n,{get:e[n],enumerable:!0})},TG="listItem",XA="textStyle",JA=/^\s*([-+*])\s$/,YI=wn.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",Mt(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,`
|
|
197
|
-
`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(TG,this.editor.getAttributes(XA)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=wc({find:JA,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=wc({find:JA,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(XA),editor:this.editor})),[t]}}),_G=(t,e,n)=>{const{selection:r}=t;if(!r.empty)return null;const{$from:i}=r;if(!i.parent.isTextblock||i.parentOffset!==i.parent.content.size)return null;let s=-1;for(let y=i.depth;y>0;y-=1)if(i.node(y).type.name===e){s=y;break}if(s<0)return null;const o=i.node(s),l=i.index(s);if(l+1>=o.childCount)return null;const u=o.child(l+1);if(!n.includes(u.type.name))return null;const f=t.schema.nodes[e];let h=!1;if(u.forEach(y=>{y.type===f&&y.childCount>1&&(h=!0)}),!h)return null;const m=t.doc.resolve(i.after()).nodeAfter;if(!m||!n.includes(m.type.name))return null;const g=[];return m.forEach(y=>{g.push(y)}),g.length===0?null:{listItemDepth:s,nestedList:m,nestedListPos:i.after(),insertPos:i.after(s),items:g}},AG=(t,e,n,r)=>{const i=_G(t,n,r);if(!i)return!1;const{selection:s}=t,{nestedList:o,nestedListPos:l,insertPos:u,items:f}=i,h=t.tr;h.delete(l,l+o.nodeSize);const m=h.mapping.map(u);return h.insert(m,ue.from(f)),h.setSelection(s.map(h.doc,h.mapping)),e&&e(h),!0},RG=(t,e,n)=>AG(t.state,t.view.dispatch,e,n),XI=(t,e)=>Pt.create({name:`${t}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){const n=()=>RG(this.editor,t,e);return{Delete:n,"Mod-Delete":n}}}),JI=[[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"]],Nh="abcdefghijklmnopqrstuvwxyz",MG="[a-zA-Z]{1,2}",QI=String.raw`\d+|[ivxlcdmIVXLCDM]+|${MG}`;function eg(t){let e=t,n="";for(const[r,i]of JI)for(;e>=r;)n+=i,e-=r;return n}function hS(t){return eg(t).toUpperCase()}function eL(t){const e=t.toLowerCase();let n=0,r=0;for(;n<e.length;){let i=!1;for(const[s,o]of JI)if(e.startsWith(o,n)){r+=s,n+=o.length,i=!0;break}if(!i)return 0}return r}function NG(t){if(!/^[ivxlcdmIVXLCDM]+$/.test(t))return!1;const e=eL(t);return e<=0?!1:(t===t.toLowerCase()?eg(e):hS(e))===t}function OG(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 vm(t){if(t<=26)return Nh[t-1];const e=Math.floor((t-1)/26)-1,n=(t-1)%26;return e<0?Nh[n]:Nh[e]+Nh[n]}function tg(t){if(!(!t||/^\d+$/.test(t))){if(NG(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 pS(t){if(/^\d+$/.test(t))return parseInt(t,10);const e=tg(t);if(e==="i"||e==="I")return eL(t);if(e==="a"||e==="A"){const r=OG(t);return r>0?r:1}const n=parseInt(t,10);return Number.isNaN(n)?1:n}function DG(t,e){if(t==="numeric")return String(e);switch(t){case"a":return vm(e);case"A":return vm(e).toUpperCase();case"i":return eg(e);case"I":return hS(e);default:return String(e)}}function IG(t){var e;if(t.length===0)return!1;const n=(e=tg(t[0]))!=null?e:"numeric",r=pS(t[0]);if(r<1)return!1;for(let i=0;i<t.length;i++){const s=DG(n,r+i);if(t[i]!==s)return!1}return!0}function LG(t){return{type:tg(t),start:pS(t)}}function jG(t){const{type:e,start:n}=LG(t),r={};return e&&(r.type=e),n!==1&&(r.start=n),r}function PG(t,e,n=". "){const r=e+1;if(!t||t==="1")return`${r}${n}`;switch(t){case"a":return`${vm(r)}${n}`;case"A":return`${vm(r).toUpperCase()}${n}`;case"i":return`${eg(r)}${n}`;case"I":return`${hS(r)}${n}`;default:return`${r}${n}`}}function zG(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?.type==="list"&&r.ordered&&r.raw===t.text)}function $G(t,e){return e.tokenizeInline?e.parseInline(e.tokenizeInline(t)):e.parseInline([{type:"text",raw:t,text:t}])}var tL=wn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Mt(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 i=[];if(t.tokens&&t.tokens.length>0){if(zG(t))return{type:"listItem",content:[{type:"paragraph",content:$G(t.text||"",e)}]};if(t.tokens.some(o=>o.type==="paragraph"))i=r(t.tokens);else{const o=t.tokens[0];if(o&&o.type==="text"&&o.tokens&&o.tokens.length>0){if(i=[{type:"paragraph",content:e.parseInline(o.tokens)}],t.tokens.length>1){const u=t.tokens.slice(1),f=r(u);i.push(...f)}}else i=r(t.tokens)}}return i.length===0&&(i=[{type:"paragraph",content:[]}]),{type:"listItem",content:i}},renderMarkdown:(t,e,n)=>tS(t,e,r=>{var i,s,o,l;if(r.parentType==="bulletList")return"- ";if(r.parentType==="orderedList"){const u=((s=(i=r.meta)==null?void 0:i.parentAttrs)==null?void 0:s.start)||1,f=(l=(o=r.meta)==null?void 0:o.parentAttrs)==null?void 0:l.type,h=u-1+(r.index||0);return PG(f,h,". ")}return"- "},n),addExtensions(){return[XI(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)}}}),BG={};EG(BG,{findListItemPos:()=>ng,getNextListDepth:()=>mS,handleBackspace:()=>fx,handleDelete:()=>hx,hasListBefore:()=>nL,hasListItemAfter:()=>VG,hasListItemBefore:()=>HG,listItemHasSubList:()=>UG,nextListIsDeeper:()=>rL,nextListIsHigher:()=>iL});var ng=(t,e)=>{const{$from:n}=e.selection,r=cn(t,e.schema);let i=null,s=n.depth,o=n.pos,l=null;for(;s>0&&l===null;)i=n.node(s),i.type===r?l=s:(s-=1,o-=1);return l===null?null:{$pos:e.doc.resolve(o),depth:l}},mS=(t,e)=>{const n=ng(t,e);if(!n)return!1;const[,r]=xq(e,t,n.$pos.pos+4);return r},nL=(t,e,n)=>{const{$anchor:r}=t.selection,i=Math.max(0,r.pos-2),s=t.doc.resolve(i).node();return!(!s||!n.includes(s.type.name))},fx=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!Do(t.state,e)&&nL(t.state,e,n)){const{$anchor:r}=t.state.selection,i=t.state.doc.resolve(r.before()-1),s=[];i.node().descendants((u,f)=>{u.type.name===e&&s.push({node:u,pos:f})});const o=s.at(-1);if(!o)return!1;const l=t.state.doc.resolve(i.start()+o.pos+1);return t.chain().cut({from:r.start()-1,to:r.end()+1},l.end()).joinForward().run()}return!Do(t.state,e)||!Cq(t.state)?!1:t.chain().liftListItem(e).run()},rL=(t,e)=>{const n=mS(t,e),r=ng(t,e);return!r||!n?!1:n>r.depth},iL=(t,e)=>{const n=mS(t,e),r=ng(t,e);return!r||!n?!1:n<r.depth},hx=(t,e)=>{if(!Do(t.state,e)||!kq(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:i}=n;return!n.empty&&r.sameParent(i)?!1:rL(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():iL(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},VG=(t,e)=>{var n;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-r.parentOffset-2);return!(i.index()===i.parent.childCount-1||((n=i.nodeAfter)==null?void 0:n.type.name)!==t)},HG=(t,e)=>{var n;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-2);return!(i.index()===0||((n=i.nodeBefore)==null?void 0:n.type.name)!==t)},UG=(t,e,n)=>{if(!n)return!1;const r=cn(t,e.schema);let i=!1;return n.descendants(s=>{s.type===r&&(i=!0)}),i},sL=Pt.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&hx(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&&hx(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&&fx(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&&fx(t,n,r)&&(e=!0)}),e}}}}),px=new RegExp(`^(\\s*)(${QI})([.)])\\s+(.*)$`),FG=/^\s/,qu={heading:/^#{1,6}(?:\s|$)/,bulletItem:/^[-+*]\s+/,codeFence:/^(?:```|~~~)/,thematicBreak:/^(?:(?:-[ \t]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})$/};function qG(t){return px.test(t.trimStart())}function GG(t){const e=t.trimStart();return qu.bulletItem.test(e)||qG(e)||qu.heading.test(e)||qu.thematicBreak.test(e)&&!e.startsWith("-")||/^>\s?/.test(e)||qu.codeFence.test(e)}function WG(t){return Object.values(qu).some(e=>e.test(t))}function KG(t){const e=[],n=[];let r=!1;return t.forEach(i=>{if(r){n.push(i);return}if(i.trim()===""){r=!0,n.push(i);return}if(e.length>0&&GG(i)){r=!0,n.push(i);return}e.push(i)}),{paragraphLines:e,blockLines:n}}function ZG(t){const e=[];let n=0,r=0;for(;n<t.length;){const i=t[n],s=i.match(px);if(!s)break;const[,o,l,u,f]=s,h=o.length,m=parseInt(l,10),g=isNaN(m)?tg(l):void 0,y=isNaN(m)?pS(l):m,x=[f];let S=n+1;const k=[i];let C=!1;for(;S<t.length;){const T=t[S];if(T.match(px))break;if(T.trim()==="")k.push(T),x.push(""),C=!0,S+=1;else if(T.match(FG)){const R=T.length-T.trimStart().length,M=h+l.length+1;k.push(T),x.push(T.slice(Math.min(R,M))),S+=1}else{if(C||WG(T))break;k.push(T),x.push(T),S+=1}}e.push({indent:h,number:y,type:g,content:x.join(`
|
|
198
|
-
`).trim(),contentLines:x,raw:k.join(`
|
|
199
|
-
`)}),r=S,n=S}return[e,r]}var YG=new RegExp(`^(${QI})([.)])\\s+(.+)$`);function XG(t){const e=t.split(`
|
|
200
|
-
`).filter(s=>s.trim().length>0);if(e.length===0)return null;const n=[];for(const s of e){const o=s.trim().match(YG);if(!o)return null;n.push({marker:o[1],content:o[3]})}const r=n.map(s=>s.marker);return IG(r)?{type:"orderedList",attrs:jG(n[0].marker),content:n.map(s=>({type:"listItem",content:[{type:"paragraph",content:[{type:"text",text:s.content}]}]}))}:null}function oL(t,e,n){const r=[];let i=0;for(;i<t.length;){const s=t[i];if(s.indent===e){const{paragraphLines:o,blockLines:l}=KG(s.contentLines),u=o.join(`
|
|
201
|
-
`).trim(),f=[];u&&f.push({type:"paragraph",raw:u,tokens:n.inlineTokens(u)});const h=l.join(`
|
|
202
|
-
`).trim();if(h){const y=n.blockTokens(h);f.push(...y)}let m=i+1;const g=[];for(;m<t.length&&t[m].indent>e;)g.push(t[m]),m+=1;if(g.length>0){const y=Math.min(...g.map(S=>S.indent)),x=oL(g,y,n);f.push({type:"list",ordered:!0,start:g[0].number,typeMarker:g[0].type,items:x,raw:g.map(S=>S.raw).join(`
|
|
203
|
-
`)})}r.push({type:"list_item",raw:s.raw,tokens:f}),i=m}else i+=1}return r}function JG(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(i=>{if(i.type==="paragraph"||i.type==="list"||i.type==="blockquote"||i.type==="code")r.push(...e.parseChildren([i]));else if(i.type==="text"&&i.tokens){const s=e.parseChildren([i]);r.push({type:"paragraph",content:s})}else{const s=e.parseChildren([i]);s.length>0&&r.push(...s)}}),{type:"listItem",content:r}})}var QG="listItem",QA="textStyle",eR=/^(\d+)\.\s$/;function tR(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 aL=wn.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 i=tR(n);if(i)return i}const r=t.querySelector("li");if(r){const i=r.getAttribute("style");if(i){const s=tR(i);if(s)return s}}return null}}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,type:n,...r}=t,i=Mt(this.options.HTMLAttributes,r);return e!==1&&(i.start=e),n&&n!=="1"&&(i.type=n),["ol",i,0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const n=t.start||1,r=t.typeMarker,i=t.items?JG(t.items,e):[],s={};return n!==1&&(s.start=n),r&&(s.type=r),Object.keys(s).length>0?{type:"orderedList",attrs:s,content:i}:{type:"orderedList",content:i}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
|
|
204
|
-
`):"",markdownTokenizer:{name:"orderedList",level:"block",start:()=>-1,tokenize:(t,e,n)=>{var r,i;const s=t.split(`
|
|
205
|
-
`),[o,l]=ZG(s);if(o.length===0)return;const u=oL(o,o[0].indent,n);if(u.length===0)return;const f=((r=o[0])==null?void 0:r.number)||1,h=(i=o[0])==null?void 0:i.type;return{type:"list",ordered:!0,start:f,typeMarker:h,items:u,raw:s.slice(0,l).join(`
|
|
206
|
-
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(QG,this.editor.getAttributes(QA)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins(){return[new Nt({props:{handlePaste:(t,e)=>{var n,r;const i=(n=e.clipboardData)==null?void 0:n.getData("text/html");if(i?.trim())return!1;const s=(r=e.clipboardData)==null?void 0:r.getData("text/plain");if(!s)return!1;const o=XG(s);if(!o)return!1;try{const l=t.state.schema.nodeFromJSON(o),u=t.state.tr.replaceSelectionWith(l);return t.dispatch(u),!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=wc({find:eR,type:this.type,getAttributes:n=>({start:+n[1]}),joinPredicate:t});return(this.options.keepMarks||this.options.keepAttributes)&&(e=wc({find:eR,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:n=>({start:+n[1],...this.editor.getAttributes(QA)}),joinPredicate:t,editor:this.editor})),[e]}}),eW=/^\s*(\[([( |x])?\])\s$/,tW=wn.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",Mt(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 i=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return tS(t,e,i)},addExtensions(){return this.options.nested?[XI(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 i=document.createElement("li"),s=document.createElement("label"),o=document.createElement("span"),l=document.createElement("input"),u=document.createElement("div"),f=m=>{var g,y;l.ariaLabel=((y=(g=this.options.a11y)==null?void 0:g.checkboxLabel)==null?void 0:y.call(g,m,l.checked))||`Task item checkbox for ${m.textContent||"empty task item"}`};f(t),s.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",m=>m.preventDefault()),l.addEventListener("change",m=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:g}=m.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:y})=>{const x=n();if(typeof x!="number")return!1;const S=y.doc.nodeAt(x);return y.setNodeMarkup(x,void 0,{...S?.attrs,checked:g}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,g)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([m,g])=>{i.setAttribute(m,g)}),i.dataset.checked=t.attrs.checked,l.checked=t.attrs.checked,s.append(l,o),i.append(s,u),Object.entries(e).forEach(([m,g])=>{i.setAttribute(m,g)});let h=new Set(Object.keys(e));return{dom:i,contentDOM:u,update:m=>{if(m.type!==this.type)return!1;i.dataset.checked=m.attrs.checked,l.checked=m.attrs.checked,f(m);const g=r.extensionManager.attributes,y=bc(m,g),x=new Set(Object.keys(y)),S=this.options.HTMLAttributes;return h.forEach(k=>{x.has(k)||(k in S?i.setAttribute(k,S[k]):i.removeAttribute(k))}),Object.entries(y).forEach(([k,C])=>{C==null?k in S?i.setAttribute(k,S[k]):i.removeAttribute(k):i.setAttribute(k,C)}),h=x,!0}}}},addInputRules(){return[wc({find:eW,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),nW=wn.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",Mt(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,`
|
|
207
|
-
`):"",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=s=>{const o=nx(s,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,u)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:n.inlineTokens(l.mainContent),nestedTokens:u}),customNestedParser:r},n);if(o){const l={type:"taskList",raw:o.raw,items:o.items},u=s.slice(o.raw.length);return u.trim()?[l,...n.blockTokens(u)]:[l]}return n.blockTokens(s)},i=nx(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:s=>({indentLevel:s[1].length,mainContent:s[4],checked:s[3].toLowerCase()==="x"}),createToken:(s,o)=>({type:"taskItem",raw:"",mainContent:s.mainContent,indentLevel:s.indentLevel,checked:s.checked,text:s.mainContent,tokens:n.inlineTokens(s.mainContent),nestedTokens:o}),customNestedParser:r},n);if(i)return{type:"taskList",raw:i.raw,items:i.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()}}});Pt.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(YI.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(tL.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(sL.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(aL.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(tW.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(nW.configure(this.options.taskList)),t}});var Oh=" ",Ob=" ",rW=wn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Mt(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===Oh||n[0].text===Oh||n[0].raw===Ob||n[0].text===Ob)&&r.length===1&&r[0].type==="text"&&(r[0].text===Oh||r[0].text===Ob)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e,n)=>{var r,i;if(!t)return"";const s=Array.isArray(t.content)?t.content:[];if(s.length===0){const o=Array.isArray((r=n?.previousNode)==null?void 0:r.content)?n.previousNode.content:[];return((i=n?.previousNode)==null?void 0:i.type)==="paragraph"&&o.length===0?Oh:""}return e.renderChildren(s)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),iW=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,sW=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,oW=Ka.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",Mt(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.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[Pa({find:iW,type:this.type})]},addPasteRules(){return[Io({find:sW,type:this.type})]}}),aW=wn.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),lW=Ka.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",Mt(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 i=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!i)return;const s=i[2].trim();return{type:"underline",raw:i[0],text:s,tokens:n.inlineTokens(s)}}},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()}}});function cW(t={}){return new Nt({view(e){return new uW(e,t)}})}class uW{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,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(i=>{let s=o=>{this[i](o)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){if(this.cursorPos!=null&&n.doc!=e.state.doc)if(this.lastDragEvent){let r=this.computeTarget(this.lastDragEvent);r==this.cursorPos?this.updateOverlay():this.setCursor(r)}else 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,i=this.editorView.dom,s=i.getBoundingClientRect(),o=s.width/i.offsetWidth,l=s.height/i.offsetHeight;if(n){let m=e.nodeBefore,g=e.nodeAfter;if(m||g){let y=this.editorView.nodeDOM(this.cursorPos-(m?m.nodeSize:0));if(y){let x=y.getBoundingClientRect(),S=m?x.bottom:x.top;m&&g&&(S=(S+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let k=this.width/2*l;r={left:x.left,right:x.right,top:S-k,bottom:S+k}}}}if(!r){let m=this.editorView.coordsAtPos(this.cursorPos),g=this.width/2*o;r={left:m.left-g,right:m.left+g,top:m.top,bottom:m.bottom}}let u=this.editorView.dom.offsetParent;this.element||(this.element=u.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 f,h;if(!u||u==document.body&&getComputedStyle(u).position=="static")f=-pageXOffset,h=-pageYOffset;else{let m=u.getBoundingClientRect(),g=m.width/u.offsetWidth,y=m.height/u.offsetHeight;f=m.left-u.scrollLeft*g,h=m.top-u.scrollTop*y}this.element.style.left=(r.left-f)/o+"px",this.element.style.top=(r.top-h)/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)}computeTarget(e){let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),i=r&&r.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,n,e):i;if(!n||s)return null;let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=HO(this.editorView.state.doc,o,this.editorView.dragging.slice);l!=null&&(o=l)}return o}dragover(e){if(!this.editorView.editable)return;this.lastDragEvent=e;let n=this.computeTarget(e);n!=null&&(this.setCursor(n),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class qt extends Ue{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return qt.valid(r)?new qt(r):Ue.near(r)}content(){return Se.empty}eq(e){return e instanceof qt&&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 qt(e.resolve(n.pos))}getBookmark(){return new gS(this.anchor)}static valid(e){let n=e.parent;if(n.inlineContent||!dW(e)||!fW(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let i=n.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&qt.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let l=e.node(o);if(n>0?e.indexAfter(o)<l.childCount:e.index(o)>0){s=l.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=n;let u=e.doc.resolve(i);if(qt.valid(u))return u}for(;;){let o=n>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!Pe.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*n),r=!1;continue e}break}s=o,i+=n;let l=e.doc.resolve(i);if(qt.valid(l))return l}return null}}}qt.prototype.visible=!1;qt.findFrom=qt.findGapCursorFrom;Ue.jsonID("gapcursor",qt);class gS{constructor(e){this.pos=e}map(e){return new gS(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return qt.valid(n)?new qt(n):Ue.near(n)}}function lL(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function dW(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 i=r.child(n-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||lL(i.type))return!0;if(i.inlineContent)return!1}}return!0}function fW(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 i=r.child(n);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||lL(i.type))return!0;if(i.inlineContent)return!1}}return!0}function hW(){return new Nt({props:{decorations:yW,createSelectionBetween(t,e,n){return e.pos==n.pos&&qt.valid(n)?new qt(n):null},handleClick:mW,handleKeyDown:pW,handleDOMEvents:{beforeinput:gW}}})}const pW=qw({ArrowLeft:Dh("horiz",-1),ArrowRight:Dh("horiz",1),ArrowUp:Dh("vert",-1),ArrowDown:Dh("vert",1)});function Dh(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,s){let o=r.selection,l=e>0?o.$to:o.$from,u=o.empty;if(o instanceof Ie){if(!s.endOfTextblock(n)||l.depth==0)return!1;u=!1,l=r.doc.resolve(e>0?l.after():l.before())}let f=qt.findGapCursorFrom(l,e,u);return f?(i&&i(r.tr.setSelection(new qt(f))),!0):!1}}function mW(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!qt.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&Pe.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new qt(r))),!0)}function gW(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof qt))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 i=ue.empty;for(let o=r.length-1;o>=0;o--)i=ue.from(r[o].createAndFill(null,i));let s=t.state.tr.replace(n.pos,n.pos,new Se(i,0,0));return s.setSelection(Ie.near(s.doc.resolve(n.pos+1))),t.dispatch(s),!1}function yW(t){if(!(t.selection instanceof qt))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",bt.create(t.doc,[yn.widget(t.selection.head,e,{key:"gapcursor"})])}var bm=200,bn=function(){};bn.prototype.append=function(e){return e.length?(e=bn.from(e),!this.length&&e||e.length<bm&&this.leafAppend(e)||this.length<bm&&e.leafPrepend(this)||this.appendInner(e)):this};bn.prototype.prepend=function(e){return e.length?bn.from(e).append(this):this};bn.prototype.appendInner=function(e){return new vW(this,e)};bn.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?bn.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};bn.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};bn.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)};bn.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},n,r),i};bn.from=function(e){return e instanceof bn?e:e&&e.length?new cL(e):bn.empty};var cL=(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(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,l){for(var u=s;u<o;u++)if(i(this.values[u],l+u)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,l){for(var u=s-1;u>=o;u--)if(i(this.values[u],l+u)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=bm)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=bm)return new e(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(bn);bn.empty=new cL([]);var vW=(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,i,s,o){var l=this.left.length;if(i<l&&this.left.forEachInner(r,i,Math.min(s,l),o)===!1||s>l&&this.right.forEachInner(r,Math.max(i-l,0),Math.min(this.length,s)-l,o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,o){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(r,i-l,Math.max(s,l)-l,o+l)===!1||s<l&&this.left.forEachInvertedInner(r,Math.min(i,l),s,o)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(r,i):r>=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,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})(bn);const bW=500;class ai{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 i,s;n&&(i=this.remapping(r,this.items.length),s=i.maps.length);let o=e.tr,l,u,f=[],h=[];return this.items.forEach((m,g)=>{if(!m.step){i||(i=this.remapping(r,g+1),s=i.maps.length),s--,h.push(m);return}if(i){h.push(new Ei(m.map));let y=m.step.map(i.slice(s)),x;y&&o.maybeStep(y).doc&&(x=o.mapping.maps[o.mapping.maps.length-1],f.push(new Ei(x,void 0,void 0,f.length+h.length))),s--,x&&i.appendMap(x,s)}else o.maybeStep(m.step);if(m.selection)return l=i?m.selection.map(i.slice(s)):m.selection,u=new ai(this.items.slice(0,r).append(h.reverse().concat(f)),this.eventCount-1),!1},this.items.length,0),{remaining:u,transform:o,selection:l}}addTransform(e,n,r,i){let s=[],o=this.eventCount,l=this.items,u=!i&&l.length?l.get(l.length-1):null;for(let h=0;h<e.steps.length;h++){let m=e.steps[h].invert(e.docs[h]),g=new Ei(e.mapping.maps[h],m,n),y;(y=u&&u.merge(g))&&(g=y,h?s.pop():l=l.slice(0,l.length-1)),s.push(g),n&&(o++,n=void 0),i||(u=g)}let f=o-r.depth;return f>wW&&(l=xW(l,f),o-=f),new ai(l.append(s),o)}remapping(e,n){let r=new kd;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new ai(this.items.append(e.map(n=>new Ei(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),s=e.mapping,o=e.steps.length,l=this.eventCount;this.items.forEach(g=>{g.selection&&l--},i);let u=n;this.items.forEach(g=>{let y=s.getMirror(--u);if(y==null)return;o=Math.min(o,y);let x=s.maps[y];if(g.step){let S=e.steps[y].invert(e.docs[y]),k=g.selection&&g.selection.map(s.slice(u+1,y));k&&l++,r.push(new Ei(x,S,k))}else r.push(new Ei(x))},i);let f=[];for(let g=n;g<o;g++)f.push(new Ei(s.maps[g]));let h=this.items.slice(0,i).append(f).append(r),m=new ai(h,l);return m.emptyItemCount()>bW&&(m=m.compress(this.items.length-r.length)),m}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,i=[],s=0;return this.items.forEach((o,l)=>{if(l>=e)i.push(o),o.selection&&s++;else if(o.step){let u=o.step.map(n.slice(r)),f=u&&u.getMap();if(r--,f&&n.appendMap(f,r),u){let h=o.selection&&o.selection.map(n.slice(r));h&&s++;let m=new Ei(f.invert(),u,h),g,y=i.length-1;(g=i.length&&i[y].merge(m))?i[y]=g:i.push(m)}}else o.map&&r--},this.items.length,0),new ai(bn.from(i.reverse()),s)}}ai.empty=new ai(bn.empty,0);function xW(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class Ei{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new Ei(n.getMap().invert(),n,this.selection)}}}class ao{constructor(e,n,r,i,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const wW=20;function SW(t,e,n,r){let i=n.getMeta(Aa),s;if(i)return i.historyState;n.getMeta(EW)&&(t=new ao(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(Aa))return o.getMeta(Aa).redo?new ao(t.done.addTransform(n,void 0,r,ap(e)),t.undone,nR(n.mapping.maps),t.prevTime,t.prevComposition):new ao(t.done,t.undone.addTransform(n,void 0,r,ap(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),u=t.prevTime==0||!o&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-r.newGroupDelay||!kW(n,t.prevRanges)),f=o?Db(t.prevRanges,n.mapping):nR(n.mapping.maps);return new ao(t.done.addTransform(n,u?e.selection.getBookmark():void 0,r,ap(e)),ai.empty,f,n.time,l??t.prevComposition)}else return(s=n.getMeta("rebased"))?new ao(t.done.rebased(n,s),t.undone.rebased(n,s),Db(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new ao(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Db(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function kW(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&i>=e[s]&&(n=!0)}),n}function nR(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,s,o)=>e.push(s,o));return e}function Db(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),s=e.map(t[r+1],-1);i<=s&&n.push(i,s)}return n}function CW(t,e,n){let r=ap(e),i=Aa.get(e).spec.config,s=(n?t.undone:t.done).popEvent(e,r);if(!s)return null;let o=s.selection.resolve(s.transform.doc),l=(n?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),u=new ao(n?l:s.remaining,n?s.remaining:l,null,0,-1);return s.transform.setSelection(o).setMeta(Aa,{redo:n,historyState:u})}let Ib=!1,rR=null;function ap(t){let e=t.plugins;if(rR!=e){Ib=!1,rR=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Ib=!0;break}}return Ib}const Aa=new Wt("history"),EW=new Wt("closeHistory");function TW(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Nt({key:Aa,state:{init(){return new ao(ai.empty,ai.empty,null,0,-1)},apply(e,n,r){return SW(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?dL:r=="historyRedo"?fL:null;return!i||!e.editable?!1:(n.preventDefault(),i(e.state,e.dispatch))}}}})}function uL(t,e){return(n,r)=>{let i=Aa.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let s=CW(i,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const dL=uL(!1,!0),fL=uL(!0,!0);Pt.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?.node||this.editor.state.doc;if((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?.node||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new Nt({key:new Wt("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const i=this.options.limit,s=this.options.autoTrim;if(i==null||i===0||s===!1){t=!0;return}const o=this.storage.characters({node:r.doc});if(o>i){const l=o-i,u=0,f=l;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const h=r.tr.deleteRange(u,f);return t=!0,h}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const i=this.storage.characters({node:n.doc}),s=this.storage.characters({node:e.doc});if(s<=r||i>r&&s>r&&s<=i)return!0;if(i>r&&s>r&&s>i||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,u=s-r,f=l-u,h=l;return e.deleteRange(f,h),!(this.storage.characters({node:e.doc})>r)}})]}});var _W=Pt.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[cW(this.options)]}});Pt.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Nt({key:new Wt("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:i}=e,s=[];if(!n||!r)return bt.create(t,[]);let o=0;this.options.mode==="deepest"&&t.descendants((u,f)=>{if(u.isText)return;if(!(i>=f&&i<=f+u.nodeSize-1))return!1;o+=1});let l=0;return t.descendants((u,f)=>{if(u.isText||!(i>=f&&i<=f+u.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";s.push(yn.node(f,f+u.nodeSize,{class:this.options.className}))}),bt.create(t,s)}}})]}});var AW=Pt.create({name:"gapCursor",addProseMirrorPlugins(){return[hW()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=ut(Re(t,"allowGapCursor",n)))!=null?e:null}}}),hL="placeholder",iR=new Wt("tiptap__placeholder");function pL(t){const{editor:e,placeholder:n,dataAttribute:r,pos:i,node:s,isEmptyDoc:o,hasAnchor:l,classes:{emptyNode:u,emptyEditor:f}}=t,h=[u];return o&&h.push(f),yn.node(i,i+s.nodeSize,{class:h.join(" "),[r]:typeof n=="function"?n({editor:e,node:s,pos:i,hasAnchor:l}):n})}function mL(t,e){return typeof t=="function"?t(e):t}function gL({editor:t,options:e,dataAttribute:n,doc:r,selection:i,from:s,to:o}){const{anchor:l}=i,u=[],f=t.isEmpty;return r.nodesBetween(s,o,(h,m)=>{const g=l>=m&&l<=m+h.nodeSize,y=!h.isLeaf&&Xd(h);return h.type.isTextblock&&(g||!e.showOnlyCurrent)&&y&&u.push(pL({editor:t,isEmptyDoc:f,dataAttribute:n,hasAnchor:g,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:mL(e.emptyNodeClass,{editor:t,node:h,pos:m,hasAnchor:g})},node:h,pos:m})),e.includeChildren}),u}function yL({editor:t,options:e,dataAttribute:n,doc:r,selection:i}){if(!(t.isEditable||!e.showOnlyWhenEditable))return null;const{anchor:o}=i,l=[],u=t.isEmpty;if(e.showOnlyCurrent&&!e.includeChildren){const h=r.resolve(o),m=h.depth>0?h.node(1):h.nodeAfter,g=h.depth>0?h.before(1):o;if(m&&m.type.isTextblock&&Xd(m)){const y=o>=g&&o<=g+m.nodeSize;l.push(pL({editor:t,isEmptyDoc:u,dataAttribute:n,hasAnchor:y,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:mL(e.emptyNodeClass,{editor:t,node:m,pos:g,hasAnchor:y})},node:m,pos:g}))}}else l.push(...gL({editor:t,options:e,dataAttribute:n,doc:r,selection:i,from:0,to:r.content.size}));return bt.create(r,l)}function ad(t,e){var n;const r=t.resolve(e);if(r.depth===0){const o=(n=r.nodeAfter)!=null?n:r.nodeBefore;if(!o)return{from:e,to:e};const l=r.nodeAfter?e:e-o.nodeSize;return{from:l,to:l+o.nodeSize}}const i=r.before(1),s=r.node(1);return{from:i,to:i+s.nodeSize}}function ld(t,e){return{from:Math.max(0,e.from-1),to:Math.min(t.content.size,e.to-1)}}function RW(t,e,n){const r=[];return t.forEach((i,s)=>{const o=s,l=o+i.nodeSize,u=o+1,f=l+1;u<n&&f>e&&r.push({from:o,to:l})}),r}function MW(t){if(t.length===0)return[];const e=[...t].sort((r,i)=>r.from-i.from),n=[{...e[0]}];for(let r=1;r<e.length;r+=1){const i=n[n.length-1],s=e[r];s.from<=i.to?i.to=Math.max(i.to,s.to):n.push({...s})}return n}function NW(t,e){const n=RW(t,e.from,e.to);return n.push(ld(t,ad(t,e.from))),e.to>e.from?n.push(ld(t,ad(t,Math.min(e.to,t.content.size+1)-1))):e.from<t.content.size+1&&n.push(ld(t,ad(t,Math.min(e.from+1,t.content.size)))),n}function OW(t,e,n){const r=[];if(t.docChanged){const i=Xw(t);for(const s of i)r.push(...NW(n.doc,s.newRange))}return t.selectionSet&&(r.push(ld(n.doc,ad(n.doc,t.mapping.map(e.selection.anchor)))),r.push(ld(n.doc,ad(n.doc,n.selection.anchor)))),MW(r)}function DW(t,e,n){const r=Math.max(0,Math.min(t,n.content.size)),i=Math.max(r,Math.min(e,n.content.size));return{from:r,to:i}}function IW({decorations:t,ranges:e,editor:n,options:r,dataAttribute:i,doc:s,selection:o}){let l=t;for(const u of e){const{from:f,to:h}=DW(u.from,u.to,s),m=l.find(f,h).filter(y=>y.from>=f&&y.to<=h);m.length&&(l=l.remove(m));const g=gL({editor:n,options:r,dataAttribute:i,doc:s,selection:o,from:f,to:h});g.length&&(l=l.add(s,g))}return l}function LW({editor:t,options:e,dataAttribute:n}){return{init(r,i){const s=yL({editor:t,options:e,dataAttribute:n,doc:i.doc,selection:i.selection});return s??bt.empty},apply(r,i,s,o){if(!r.docChanged&&!r.selectionSet)return i;const l=i.map(r.mapping,r.doc),u=OW(r,s,o);return IW({decorations:l,ranges:u,editor:t,options:e,dataAttribute:n,doc:o.doc,selection:o.selection})}}}function jW(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}function PW({editor:t,options:e}){const n=e.dataAttribute?`data-${jW(e.dataAttribute)}`:`data-${hL}`,r=e.showOnlyCurrent&&!e.includeChildren;return new Nt({key:iR,...r?{}:{state:LW({editor:t,options:e,dataAttribute:n})},props:{decorations:r?({doc:i,selection:s})=>yL({editor:t,options:e,dataAttribute:n,doc:i,selection:s}):i=>{var s;return e.showOnlyWhenEditable&&!t.isEditable?bt.empty:(s=iR.getState(i))!=null?s:bt.empty}}})}var zW=Pt.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:hL,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[PW({editor:this.editor,options:this.options})]}});function mx(t,e){return!t.selection.empty&&!lI(t.selection)&&e.isEditable}function $W(t,e){return mx(t,e)&&!e.isFocused&&!e.view.dragging}function BW(){var t;(t=window.getSelection())==null||t.removeAllRanges()}function VW(t){t.focus()}Pt.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new Nt({key:new Wt("selection"),props:{decorations(n){return $W(n,t)?bt.create(n.doc,[yn.inline(n.selection.from,n.selection.to,{class:e.className})]):null},handleDOMEvents:{blur(n){return mx(n.state,t)&&BW(),!1},focus(n){return mx(n.state,t)&&requestAnimationFrame(()=>{!t.isDestroyed&&n.hasFocus()&&VW(n)}),!1}}}})]}});var HW="skipTrailingNode";function sR({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var UW=Pt.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new Wt(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(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(n).includes(i.name));return[new Nt({key:e,appendTransaction:(i,s,o)=>{const{doc:l,tr:u,schema:f}=o,h=e.getState(o),m=l.content.size,g=f.nodes[n];if(!i.some(y=>y.getMeta(HW))&&h)return u.insert(m,g.create())},state:{init:(i,s)=>{const o=s.tr.doc.lastChild;return!sR({node:o,types:r})},apply:(i,s)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return s;const o=i.doc.lastChild;return!sR({node:o,types:r})}}})]}}),FW=Pt.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>dL(t,e),redo:()=>({state:t,dispatch:e})=>fL(t,e)}},addProseMirrorPlugins(){return[TW(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()}}}),qW=Pt.create({name:"starterKit",addExtensions(){var t,e,n,r;const i=[];return this.options.bold!==!1&&i.push(M8.configure(this.options.bold)),this.options.blockquote!==!1&&i.push(E8.configure(this.options.blockquote)),this.options.bulletList!==!1&&i.push(YI.configure(this.options.bulletList)),this.options.code!==!1&&i.push(D8.configure(this.options.code)),this.options.codeBlock!==!1&&i.push(j8.configure(this.options.codeBlock)),this.options.document!==!1&&i.push(P8.configure(this.options.document)),this.options.dropcursor!==!1&&i.push(_W.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&i.push(AW.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&i.push(z8.configure(this.options.hardBreak)),this.options.heading!==!1&&i.push($8.configure(this.options.heading)),this.options.undoRedo!==!1&&i.push(FW.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&i.push(B8.configure(this.options.horizontalRule)),this.options.italic!==!1&&i.push(q8.configure(this.options.italic)),this.options.listItem!==!1&&i.push(tL.configure(this.options.listItem)),this.options.listKeymap!==!1&&i.push(sL.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&i.push(kG.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&i.push(aL.configure(this.options.orderedList)),this.options.paragraph!==!1&&i.push(rW.configure(this.options.paragraph)),this.options.strike!==!1&&i.push(oW.configure(this.options.strike)),this.options.text!==!1&&i.push(aW.configure(this.options.text)),this.options.underline!==!1&&i.push(lW.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&i.push(UW.configure((r=this.options)==null?void 0:r.trailingNode)),i}}),GW=qW;function yS(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ya=yS();function vL(t){Ya=t}var ga={exec:()=>null};function st(t,e=""){let n=typeof t=="string"?t:t.source,r={replace:(i,s)=>{let o=typeof s=="string"?s:s.source;return o=o.replace(Zn.caret,"$1"),n=n.replace(i,o),r},getRegex:()=>new RegExp(n,e)};return r}var WW=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Zn={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}>`)},KW=/^(?:[ \t]*(?:\n|$))+/,ZW=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,YW=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Qd=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,XW=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,vS=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,bL=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,xL=st(bL).replace(/bull/g,vS).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),JW=st(bL).replace(/bull/g,vS).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),bS=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,QW=/^[^\n]+/,xS=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,e7=st(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",xS).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),t7=st(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,vS).getRegex(),rg="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",wS=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,n7=st("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",wS).replace("tag",rg).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),wL=st(bS).replace("hr",Qd).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",rg).getRegex(),r7=st(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",wL).getRegex(),SS={blockquote:r7,code:ZW,def:e7,fences:YW,heading:XW,hr:Qd,html:n7,lheading:xL,list:t7,newline:KW,paragraph:wL,table:ga,text:QW},oR=st("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Qd).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",rg).getRegex(),i7={...SS,lheading:JW,table:oR,paragraph:st(bS).replace("hr",Qd).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",oR).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",rg).getRegex()},s7={...SS,html:st(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",wS).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:ga,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:st(bS).replace("hr",Qd).replace("heading",` *#{1,6} *[^
|
|
208
|
-
]`).replace("lheading",xL).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},o7=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,a7=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,SL=/^( {2,}|\\)\n(?!\s*$)/,l7=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Mc=/[\p{P}\p{S}]/u,ig=/[\s\p{P}\p{S}]/u,kS=/[^\s\p{P}\p{S}]/u,c7=st(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,ig).getRegex(),kL=/(?!~)[\p{P}\p{S}]/u,u7=/(?!~)[\s\p{P}\p{S}]/u,d7=/(?:[^\s\p{P}\p{S}]|~)/u,f7=st(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",WW?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),CL=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,h7=st(CL,"u").replace(/punct/g,Mc).getRegex(),p7=st(CL,"u").replace(/punct/g,kL).getRegex(),EL="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",m7=st(EL,"gu").replace(/notPunctSpace/g,kS).replace(/punctSpace/g,ig).replace(/punct/g,Mc).getRegex(),g7=st(EL,"gu").replace(/notPunctSpace/g,d7).replace(/punctSpace/g,u7).replace(/punct/g,kL).getRegex(),y7=st("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,kS).replace(/punctSpace/g,ig).replace(/punct/g,Mc).getRegex(),v7=st(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Mc).getRegex(),b7="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",x7=st(b7,"gu").replace(/notPunctSpace/g,kS).replace(/punctSpace/g,ig).replace(/punct/g,Mc).getRegex(),w7=st(/\\(punct)/,"gu").replace(/punct/g,Mc).getRegex(),S7=st(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),k7=st(wS).replace("(?:-->|$)","-->").getRegex(),C7=st("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",k7).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),xm=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,E7=st(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",xm).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),TL=st(/^!?\[(label)\]\[(ref)\]/).replace("label",xm).replace("ref",xS).getRegex(),_L=st(/^!?\[(ref)\](?:\[\])?/).replace("ref",xS).getRegex(),T7=st("reflink|nolink(?!\\()","g").replace("reflink",TL).replace("nolink",_L).getRegex(),aR=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,CS={_backpedal:ga,anyPunctuation:w7,autolink:S7,blockSkip:f7,br:SL,code:a7,del:ga,delLDelim:ga,delRDelim:ga,emStrongLDelim:h7,emStrongRDelimAst:m7,emStrongRDelimUnd:y7,escape:o7,link:E7,nolink:_L,punctuation:c7,reflink:TL,reflinkSearch:T7,tag:C7,text:l7,url:ga},_7={...CS,link:st(/^!?\[(label)\]\((.*?)\)/).replace("label",xm).getRegex(),reflink:st(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",xm).getRegex()},gx={...CS,emStrongRDelimAst:g7,emStrongLDelim:p7,delLDelim:v7,delRDelim:x7,url:st(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",aR).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:st(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",aR).getRegex()},A7={...gx,br:st(SL).replace("{2,}","*").getRegex(),text:st(gx.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Ih={normal:SS,gfm:i7,pedantic:s7},Du={normal:CS,gfm:gx,breaks:A7,pedantic:_7},R7={"&":"&","<":"<",">":">",'"':""","'":"'"},lR=t=>R7[t];function Si(t,e){if(e){if(Zn.escapeTest.test(t))return t.replace(Zn.escapeReplace,lR)}else if(Zn.escapeTestNoEncode.test(t))return t.replace(Zn.escapeReplaceNoEncode,lR);return t}function cR(t){try{t=encodeURI(t).replace(Zn.percentDecode,"%")}catch{return null}return t}function uR(t,e){let n=t.replace(Zn.findPipe,(s,o,l)=>{let u=!1,f=o;for(;--f>=0&&l[f]==="\\";)u=!u;return u?"|":" |"}),r=n.split(Zn.splitPipe),i=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;i<r.length;i++)r[i]=r[i].trim().replace(Zn.slashPipe,"|");return r}function Iu(t,e,n){let r=t.length;if(r===0)return"";let i=0;for(;i<r&&t.charAt(r-i-1)===e;)i++;return t.slice(0,r-i)}function M7(t,e){if(t.indexOf(e[1])===-1)return-1;let n=0;for(let r=0;r<t.length;r++)if(t[r]==="\\")r++;else if(t[r]===e[0])n++;else if(t[r]===e[1]&&(n--,n<0))return r;return n>0?-2:-1}function N7(t,e=0){let n=e,r="";for(let i of t)if(i===" "){let s=4-n%4;r+=" ".repeat(s),n+=s}else r+=i,n++;return r}function dR(t,e,n,r,i){let s=e.href,o=e.title||null,l=t[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;let u={type:t[0].charAt(0)==="!"?"image":"link",raw:n,href:s,title:o,text:l,tokens:r.inlineTokens(l)};return r.state.inLink=!1,u}function O7(t,e,n){let r=t.match(n.other.indentCodeCompensation);if(r===null)return e;let i=r[1];return e.split(`
|
|
209
|
-
`).map(s=>{let o=s.match(n.other.beginningSpace);if(o===null)return s;let[l]=o;return l.length>=i.length?s.slice(i.length):s}).join(`
|
|
210
|
-
`)}var wm=class{options;rules;lexer;constructor(t){this.options=t||Ya}space(t){let e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){let e=this.rules.block.code.exec(t);if(e){let n=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?n:Iu(n,`
|
|
211
|
-
`)}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let n=e[0],r=O7(n,e[3]||"",this.rules);return{type:"code",raw:n,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:r}}}heading(t){let e=this.rules.block.heading.exec(t);if(e){let n=e[2].trim();if(this.rules.other.endingHash.test(n)){let r=Iu(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(t){let e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:Iu(e[0],`
|
|
212
|
-
`)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let n=Iu(e[0],`
|
|
213
|
-
`).split(`
|
|
214
|
-
`),r="",i="",s=[];for(;n.length>0;){let o=!1,l=[],u;for(u=0;u<n.length;u++)if(this.rules.other.blockquoteStart.test(n[u]))l.push(n[u]),o=!0;else if(!o)l.push(n[u]);else break;n=n.slice(u);let f=l.join(`
|
|
215
|
-
`),h=f.replace(this.rules.other.blockquoteSetextReplace,`
|
|
216
|
-
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
|
|
217
|
-
${f}`:f,i=i?`${i}
|
|
218
|
-
${h}`:h;let m=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(h,s,!0),this.lexer.state.top=m,n.length===0)break;let g=s.at(-1);if(g?.type==="code")break;if(g?.type==="blockquote"){let y=g,x=y.raw+`
|
|
219
|
-
`+n.join(`
|
|
220
|
-
`),S=this.blockquote(x);s[s.length-1]=S,r=r.substring(0,r.length-y.raw.length)+S.raw,i=i.substring(0,i.length-y.text.length)+S.text;break}else if(g?.type==="list"){let y=g,x=y.raw+`
|
|
221
|
-
`+n.join(`
|
|
222
|
-
`),S=this.list(x);s[s.length-1]=S,r=r.substring(0,r.length-g.raw.length)+S.raw,i=i.substring(0,i.length-y.raw.length)+S.raw,n=x.substring(s.at(-1).raw.length).split(`
|
|
223
|
-
`);continue}}return{type:"blockquote",raw:r,tokens:s,text:i}}}list(t){let e=this.rules.block.list.exec(t);if(e){let n=e[1].trim(),r=n.length>1,i={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");let s=this.rules.other.listItemRegex(n),o=!1;for(;t;){let u=!1,f="",h="";if(!(e=s.exec(t))||this.rules.block.hr.test(t))break;f=e[0],t=t.substring(f.length);let m=N7(e[2].split(`
|
|
224
|
-
`,1)[0],e[1].length),g=t.split(`
|
|
225
|
-
`,1)[0],y=!m.trim(),x=0;if(this.options.pedantic?(x=2,h=m.trimStart()):y?x=e[1].length+1:(x=m.search(this.rules.other.nonSpaceChar),x=x>4?1:x,h=m.slice(x),x+=e[1].length),y&&this.rules.other.blankLine.test(g)&&(f+=g+`
|
|
226
|
-
`,t=t.substring(g.length+1),u=!0),!u){let S=this.rules.other.nextBulletRegex(x),k=this.rules.other.hrRegex(x),C=this.rules.other.fencesBeginRegex(x),T=this.rules.other.headingBeginRegex(x),_=this.rules.other.htmlBeginRegex(x),R=this.rules.other.blockquoteBeginRegex(x);for(;t;){let M=t.split(`
|
|
227
|
-
`,1)[0],O;if(g=M,this.options.pedantic?(g=g.replace(this.rules.other.listReplaceNesting," "),O=g):O=g.replace(this.rules.other.tabCharGlobal," "),C.test(g)||T.test(g)||_.test(g)||R.test(g)||S.test(g)||k.test(g))break;if(O.search(this.rules.other.nonSpaceChar)>=x||!g.trim())h+=`
|
|
228
|
-
`+O.slice(x);else{if(y||m.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||C.test(m)||T.test(m)||k.test(m))break;h+=`
|
|
229
|
-
`+g}y=!g.trim(),f+=M+`
|
|
230
|
-
`,t=t.substring(M.length+1),m=O.slice(x)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(f)&&(o=!0)),i.items.push({type:"list_item",raw:f,task:!!this.options.gfm&&this.rules.other.listIsTask.test(h),loose:!1,text:h,tokens:[]}),i.raw+=f}let l=i.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let u of i.items){if(this.lexer.state.top=!1,u.tokens=this.lexer.blockTokens(u.text,[]),u.task){if(u.text=u.text.replace(this.rules.other.listReplaceTask,""),u.tokens[0]?.type==="text"||u.tokens[0]?.type==="paragraph"){u.tokens[0].raw=u.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),u.tokens[0].text=u.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let h=this.lexer.inlineQueue.length-1;h>=0;h--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[h].src)){this.lexer.inlineQueue[h].src=this.lexer.inlineQueue[h].src.replace(this.rules.other.listReplaceTask,"");break}}let f=this.rules.other.listTaskCheckbox.exec(u.raw);if(f){let h={type:"checkbox",raw:f[0]+" ",checked:f[0]!=="[ ]"};u.checked=h.checked,i.loose?u.tokens[0]&&["paragraph","text"].includes(u.tokens[0].type)&&"tokens"in u.tokens[0]&&u.tokens[0].tokens?(u.tokens[0].raw=h.raw+u.tokens[0].raw,u.tokens[0].text=h.raw+u.tokens[0].text,u.tokens[0].tokens.unshift(h)):u.tokens.unshift({type:"paragraph",raw:h.raw,text:h.raw,tokens:[h]}):u.tokens.unshift(h)}}if(!i.loose){let f=u.tokens.filter(m=>m.type==="space"),h=f.length>0&&f.some(m=>this.rules.other.anyLine.test(m.raw));i.loose=h}}if(i.loose)for(let u of i.items){u.loose=!0;for(let f of u.tokens)f.type==="text"&&(f.type="paragraph")}return i}}html(t){let e=this.rules.block.html.exec(t);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(t){let e=this.rules.block.def.exec(t);if(e){let n=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:n,raw:e[0],href:r,title:i}}}table(t){let e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let n=uR(e[1]),r=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
231
|
-
`):[],s={type:"table",raw:e[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let o of r)this.rules.other.tableAlignRight.test(o)?s.align.push("right"):this.rules.other.tableAlignCenter.test(o)?s.align.push("center"):this.rules.other.tableAlignLeft.test(o)?s.align.push("left"):s.align.push(null);for(let o=0;o<n.length;o++)s.header.push({text:n[o],tokens:this.lexer.inline(n[o]),header:!0,align:s.align[o]});for(let o of i)s.rows.push(uR(o,s.header.length).map((l,u)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:s.align[u]})));return s}}lheading(t){let e=this.rules.block.lheading.exec(t);if(e){let n=e[1].trim();return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:n,tokens:this.lexer.inline(n)}}}paragraph(t){let e=this.rules.block.paragraph.exec(t);if(e){let n=e[1].charAt(e[1].length-1)===`
|
|
232
|
-
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:n,tokens:this.lexer.inline(n)}}}text(t){let e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){let e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){let e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){let e=this.rules.inline.link.exec(t);if(e){let n=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let s=Iu(n.slice(0,-1),"\\");if((n.length-s.length)%2===0)return}else{let s=M7(e[2],"()");if(s===-2)return;if(s>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+s;e[2]=e[2].substring(0,s),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let r=e[2],i="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(r);s&&(r=s[1],i=s[3])}else i=e[3]?e[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),dR(e,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let n;if((n=this.rules.inline.reflink.exec(t))||(n=this.rules.inline.nolink.exec(t))){let r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=e[r.toLowerCase()];if(!i){let s=n[0].charAt(0);return{type:"text",raw:s,text:s}}return dR(n,i,n[0],this.lexer,this.rules)}}emStrong(t,e,n=""){let r=this.rules.inline.emStrongLDelim.exec(t);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let i=[...r[0]].length-1,s,o,l=i,u=0,f=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(f.lastIndex=0,e=e.slice(-1*t.length+i);(r=f.exec(e))!==null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s)continue;if(o=[...s].length,r[3]||r[4]){l+=o;continue}else if((r[5]||r[6])&&i%3&&!((i+o)%3)){u+=o;continue}if(l-=o,l>0)continue;o=Math.min(o,o+l+u);let h=[...r[0]][0].length,m=t.slice(0,i+r.index+h+o);if(Math.min(i,o)%2){let y=m.slice(1,-1);return{type:"em",raw:m,text:y,tokens:this.lexer.inlineTokens(y)}}let g=m.slice(2,-2);return{type:"strong",raw:m,text:g,tokens:this.lexer.inlineTokens(g)}}}}codespan(t){let e=this.rules.inline.code.exec(t);if(e){let n=e[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(n),i=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&i&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:e[0],text:n}}}br(t){let e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t,e,n=""){let r=this.rules.inline.delLDelim.exec(t);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let i=[...r[0]].length-1,s,o,l=i,u=this.rules.inline.delRDelim;for(u.lastIndex=0,e=e.slice(-1*t.length+i);(r=u.exec(e))!==null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s||(o=[...s].length,o!==i))continue;if(r[3]||r[4]){l+=o;continue}if(l-=o,l>0)continue;o=Math.min(o,o+l);let f=[...r[0]][0].length,h=t.slice(0,i+r.index+f+o),m=h.slice(i,-i);return{type:"del",raw:h,text:m,tokens:this.lexer.inlineTokens(m)}}}}autolink(t){let e=this.rules.inline.autolink.exec(t);if(e){let n,r;return e[2]==="@"?(n=e[1],r="mailto:"+n):(n=e[1],r=n),{type:"link",raw:e[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(t){let e;if(e=this.rules.inline.url.exec(t)){let n,r;if(e[2]==="@")n=e[0],r="mailto:"+n;else{let i;do i=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(i!==e[0]);n=e[0],e[1]==="www."?r="http://"+e[0]:r=e[0]}return{type:"link",raw:e[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(t){let e=this.rules.inline.text.exec(t);if(e){let n=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:n}}}},ri=class yx{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Ya,this.options.tokenizer=this.options.tokenizer||new wm,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:Zn,block:Ih.normal,inline:Du.normal};this.options.pedantic?(n.block=Ih.pedantic,n.inline=Du.pedantic):this.options.gfm&&(n.block=Ih.gfm,this.options.breaks?n.inline=Du.breaks:n.inline=Du.gfm),this.tokenizer.rules=n}static get rules(){return{block:Ih,inline:Du}}static lex(e,n){return new yx(n).lex(e)}static lexInline(e,n){return new yx(n).inlineTokens(e)}lex(e){e=e.replace(Zn.carriageReturn,`
|
|
233
|
-
`),this.blockTokens(e,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let r=this.inlineQueue[n];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,n=[],r=!1){for(this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(Zn.tabCharGlobal," ").replace(Zn.spaceLine,""));e;){let i;if(this.options.extensions?.block?.some(o=>(i=o.call({lexer:this},e,n))?(e=e.substring(i.raw.length),n.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let o=n.at(-1);i.raw.length===1&&o!==void 0?o.raw+=`
|
|
234
|
-
`:n.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let o=n.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=(o.raw.endsWith(`
|
|
235
|
-
`)?"":`
|
|
236
|
-
`)+i.raw,o.text+=`
|
|
237
|
-
`+i.text,this.inlineQueue.at(-1).src=o.text):n.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let o=n.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=(o.raw.endsWith(`
|
|
238
|
-
`)?"":`
|
|
239
|
-
`)+i.raw,o.text+=`
|
|
240
|
-
`+i.raw,this.inlineQueue.at(-1).src=o.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},n.push(i));continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),n.push(i);continue}let s=e;if(this.options.extensions?.startBlock){let o=1/0,l=e.slice(1),u;this.options.extensions.startBlock.forEach(f=>{u=f.call({lexer:this},l),typeof u=="number"&&u>=0&&(o=Math.min(o,u))}),o<1/0&&o>=0&&(s=e.substring(0,o+1))}if(this.state.top&&(i=this.tokenizer.paragraph(s))){let o=n.at(-1);r&&o?.type==="paragraph"?(o.raw+=(o.raw.endsWith(`
|
|
241
|
-
`)?"":`
|
|
242
|
-
`)+i.raw,o.text+=`
|
|
243
|
-
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):n.push(i),r=s.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let o=n.at(-1);o?.type==="text"?(o.raw+=(o.raw.endsWith(`
|
|
244
|
-
`)?"":`
|
|
245
|
-
`)+i.raw,o.text+=`
|
|
246
|
-
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):n.push(i);continue}if(e){let o="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(o);break}else throw new Error(o)}}return this.state.top=!0,n}inline(e,n=[]){return this.inlineQueue.push({src:e,tokens:n}),n}inlineTokens(e,n=[]){this.tokenizer.lexer=this;let r=e,i=null;if(this.tokens.links){let u=Object.keys(this.tokens.links);if(u.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(r))!==null;)u.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(r))!==null;)r=r.slice(0,i.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let s;for(;(i=this.tokenizer.rules.inline.blockSkip.exec(r))!==null;)s=i[2]?i[2].length:0,r=r.slice(0,i.index+s)+"["+"a".repeat(i[0].length-s-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=this.options.hooks?.emStrongMask?.call({lexer:this},r)??r;let o=!1,l="";for(;e;){o||(l=""),o=!1;let u;if(this.options.extensions?.inline?.some(h=>(u=h.call({lexer:this},e,n))?(e=e.substring(u.raw.length),n.push(u),!0):!1))continue;if(u=this.tokenizer.escape(e)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.tag(e)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.link(e)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(u.raw.length);let h=n.at(-1);u.type==="text"&&h?.type==="text"?(h.raw+=u.raw,h.text+=u.text):n.push(u);continue}if(u=this.tokenizer.emStrong(e,r,l)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.codespan(e)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.br(e)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.del(e,r,l)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.autolink(e)){e=e.substring(u.raw.length),n.push(u);continue}if(!this.state.inLink&&(u=this.tokenizer.url(e))){e=e.substring(u.raw.length),n.push(u);continue}let f=e;if(this.options.extensions?.startInline){let h=1/0,m=e.slice(1),g;this.options.extensions.startInline.forEach(y=>{g=y.call({lexer:this},m),typeof g=="number"&&g>=0&&(h=Math.min(h,g))}),h<1/0&&h>=0&&(f=e.substring(0,h+1))}if(u=this.tokenizer.inlineText(f)){e=e.substring(u.raw.length),u.raw.slice(-1)!=="_"&&(l=u.raw.slice(-1)),o=!0;let h=n.at(-1);h?.type==="text"?(h.raw+=u.raw,h.text+=u.text):n.push(u);continue}if(e){let h="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(h);break}else throw new Error(h)}}return n}},Sm=class{options;parser;constructor(t){this.options=t||Ya}space(t){return""}code({text:t,lang:e,escaped:n}){let r=(e||"").match(Zn.notSpaceStart)?.[0],i=t.replace(Zn.endingNewline,"")+`
|
|
247
|
-
`;return r?'<pre><code class="language-'+Si(r)+'">'+(n?i:Si(i,!0))+`</code></pre>
|
|
248
|
-
`:"<pre><code>"+(n?i:Si(i,!0))+`</code></pre>
|
|
249
|
-
`}blockquote({tokens:t}){return`<blockquote>
|
|
250
|
-
${this.parser.parse(t)}</blockquote>
|
|
251
|
-
`}html({text:t}){return t}def(t){return""}heading({tokens:t,depth:e}){return`<h${e}>${this.parser.parseInline(t)}</h${e}>
|
|
252
|
-
`}hr(t){return`<hr>
|
|
253
|
-
`}list(t){let e=t.ordered,n=t.start,r="";for(let o=0;o<t.items.length;o++){let l=t.items[o];r+=this.listitem(l)}let i=e?"ol":"ul",s=e&&n!==1?' start="'+n+'"':"";return"<"+i+s+`>
|
|
254
|
-
`+r+"</"+i+`>
|
|
255
|
-
`}listitem(t){return`<li>${this.parser.parse(t.tokens)}</li>
|
|
256
|
-
`}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>
|
|
257
|
-
`}table(t){let e="",n="";for(let i=0;i<t.header.length;i++)n+=this.tablecell(t.header[i]);e+=this.tablerow({text:n});let r="";for(let i=0;i<t.rows.length;i++){let s=t.rows[i];n="";for(let o=0;o<s.length;o++)n+=this.tablecell(s[o]);r+=this.tablerow({text:n})}return r&&(r=`<tbody>${r}</tbody>`),`<table>
|
|
258
|
-
<thead>
|
|
259
|
-
`+e+`</thead>
|
|
260
|
-
`+r+`</table>
|
|
261
|
-
`}tablerow({text:t}){return`<tr>
|
|
262
|
-
${t}</tr>
|
|
263
|
-
`}tablecell(t){let e=this.parser.parseInline(t.tokens),n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>
|
|
264
|
-
`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${Si(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:n}){let r=this.parser.parseInline(n),i=cR(t);if(i===null)return r;t=i;let s='<a href="'+t+'"';return e&&(s+=' title="'+Si(e)+'"'),s+=">"+r+"</a>",s}image({href:t,title:e,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=cR(t);if(i===null)return Si(n);t=i;let s=`<img src="${t}" alt="${Si(n)}"`;return e&&(s+=` title="${Si(e)}"`),s+=">",s}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:Si(t.text)}},ES=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}checkbox({raw:t}){return t}},ii=class vx{options;renderer;textRenderer;constructor(e){this.options=e||Ya,this.options.renderer=this.options.renderer||new Sm,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ES}static parse(e,n){return new vx(n).parse(e)}static parseInline(e,n){return new vx(n).parseInline(e)}parse(e){this.renderer.parser=this;let n="";for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let o=i,l=this.options.extensions.renderers[o.type].call({parser:this},o);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(o.type)){n+=l||"";continue}}let s=i;switch(s.type){case"space":{n+=this.renderer.space(s);break}case"hr":{n+=this.renderer.hr(s);break}case"heading":{n+=this.renderer.heading(s);break}case"code":{n+=this.renderer.code(s);break}case"table":{n+=this.renderer.table(s);break}case"blockquote":{n+=this.renderer.blockquote(s);break}case"list":{n+=this.renderer.list(s);break}case"checkbox":{n+=this.renderer.checkbox(s);break}case"html":{n+=this.renderer.html(s);break}case"def":{n+=this.renderer.def(s);break}case"paragraph":{n+=this.renderer.paragraph(s);break}case"text":{n+=this.renderer.text(s);break}default:{let o='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return n}parseInline(e,n=this.renderer){this.renderer.parser=this;let r="";for(let i=0;i<e.length;i++){let s=e[i];if(this.options.extensions?.renderers?.[s.type]){let l=this.options.extensions.renderers[s.type].call({parser:this},s);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(s.type)){r+=l||"";continue}}let o=s;switch(o.type){case"escape":{r+=n.text(o);break}case"html":{r+=n.html(o);break}case"link":{r+=n.link(o);break}case"image":{r+=n.image(o);break}case"checkbox":{r+=n.checkbox(o);break}case"strong":{r+=n.strong(o);break}case"em":{r+=n.em(o);break}case"codespan":{r+=n.codespan(o);break}case"br":{r+=n.br(o);break}case"del":{r+=n.del(o);break}case"text":{r+=n.text(o);break}default:{let l='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return r}},Gu=class{options;block;constructor(t){this.options=t||Ya}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}emStrongMask(t){return t}provideLexer(t=this.block){return t?ri.lex:ri.lexInline}provideParser(t=this.block){return t?ii.parse:ii.parseInline}},D7=class{defaults=yS();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=ii;Renderer=Sm;TextRenderer=ES;Lexer=ri;Tokenizer=wm;Hooks=Gu;constructor(...t){this.use(...t)}walkTokens(t,e){let n=[];for(let r of t)switch(n=n.concat(e.call(this,r)),r.type){case"table":{let i=r;for(let s of i.header)n=n.concat(this.walkTokens(s.tokens,e));for(let s of i.rows)for(let o of s)n=n.concat(this.walkTokens(o.tokens,e));break}case"list":{let i=r;n=n.concat(this.walkTokens(i.items,e));break}default:{let i=r;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(s=>{let o=i[s].flat(1/0);n=n.concat(this.walkTokens(o,e))}):i.tokens&&(n=n.concat(this.walkTokens(i.tokens,e)))}}return n}use(...t){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(n=>{let r={...n};if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let s=e.renderers[i.name];s?e.renderers[i.name]=function(...o){let l=i.renderer.apply(this,o);return l===!1&&(l=s.apply(this,o)),l}:e.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=e[i.level];s?s.unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),r.extensions=e),n.renderer){let i=this.defaults.renderer||new Sm(this.defaults);for(let s in n.renderer){if(!(s in i))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let o=s,l=n.renderer[o],u=i[o];i[o]=(...f)=>{let h=l.apply(i,f);return h===!1&&(h=u.apply(i,f)),h||""}}r.renderer=i}if(n.tokenizer){let i=this.defaults.tokenizer||new wm(this.defaults);for(let s in n.tokenizer){if(!(s in i))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let o=s,l=n.tokenizer[o],u=i[o];i[o]=(...f)=>{let h=l.apply(i,f);return h===!1&&(h=u.apply(i,f)),h}}r.tokenizer=i}if(n.hooks){let i=this.defaults.hooks||new Gu;for(let s in n.hooks){if(!(s in i))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let o=s,l=n.hooks[o],u=i[o];Gu.passThroughHooks.has(s)?i[o]=f=>{if(this.defaults.async&&Gu.passThroughHooksRespectAsync.has(s))return(async()=>{let m=await l.call(i,f);return u.call(i,m)})();let h=l.call(i,f);return u.call(i,h)}:i[o]=(...f)=>{if(this.defaults.async)return(async()=>{let m=await l.apply(i,f);return m===!1&&(m=await u.apply(i,f)),m})();let h=l.apply(i,f);return h===!1&&(h=u.apply(i,f)),h}}r.hooks=i}if(n.walkTokens){let i=this.defaults.walkTokens,s=n.walkTokens;r.walkTokens=function(o){let l=[];return l.push(s.call(this,o)),i&&(l=l.concat(i.call(this,o))),l}}this.defaults={...this.defaults,...r}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return ri.lex(t,e??this.defaults)}parser(t,e){return ii.parse(t,e??this.defaults)}parseMarkdown(t){return(e,n)=>{let r={...n},i={...this.defaults,...r},s=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return s(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=t),i.async)return(async()=>{let o=i.hooks?await i.hooks.preprocess(e):e,l=await(i.hooks?await i.hooks.provideLexer(t):t?ri.lex:ri.lexInline)(o,i),u=i.hooks?await i.hooks.processAllTokens(l):l;i.walkTokens&&await Promise.all(this.walkTokens(u,i.walkTokens));let f=await(i.hooks?await i.hooks.provideParser(t):t?ii.parse:ii.parseInline)(u,i);return i.hooks?await i.hooks.postprocess(f):f})().catch(s);try{i.hooks&&(e=i.hooks.preprocess(e));let o=(i.hooks?i.hooks.provideLexer(t):t?ri.lex:ri.lexInline)(e,i);i.hooks&&(o=i.hooks.processAllTokens(o)),i.walkTokens&&this.walkTokens(o,i.walkTokens);let l=(i.hooks?i.hooks.provideParser(t):t?ii.parse:ii.parseInline)(o,i);return i.hooks&&(l=i.hooks.postprocess(l)),l}catch(o){return s(o)}}}onError(t,e){return n=>{if(n.message+=`
|
|
265
|
-
Please report this to https://github.com/markedjs/marked.`,t){let r="<p>An error occurred:</p><pre>"+Si(n.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(n);throw n}}},za=new D7;function xt(t,e){return za.parse(t,e)}xt.options=xt.setOptions=function(t){return za.setOptions(t),xt.defaults=za.defaults,vL(xt.defaults),xt};xt.getDefaults=yS;xt.defaults=Ya;xt.use=function(...t){return za.use(...t),xt.defaults=za.defaults,vL(xt.defaults),xt};xt.walkTokens=function(t,e){return za.walkTokens(t,e)};xt.parseInline=za.parseInline;xt.Parser=ii;xt.parser=ii.parse;xt.Renderer=Sm;xt.TextRenderer=ES;xt.Lexer=ri;xt.lexer=ri.lex;xt.Tokenizer=wm;xt.Hooks=Gu;xt.parse=xt;xt.options;xt.setOptions;xt.use;xt.walkTokens;xt.parseInline;ii.parse;ri.lex;var I7=/\n[^\S\n]*(?:\n[^\S\n]*)+$/;function L7(t){return t.flatMap((e,n)=>{var r;if(e.type==="space"||((r=t[n+1])==null?void 0:r.type)==="space")return[e];const i=(e.raw||"").match(I7);return i?[{...e,raw:(e.raw||"").slice(0,-i[0].length)},{type:"space",raw:i[0]}]:[e]})}function j7(t,e){const r=e.split(`
|
|
266
|
-
`).flatMap(i=>[i,""]).map(i=>`${t}${i}`).join(`
|
|
267
|
-
`);return r.slice(0,r.length-1)}function P7(t,e){const n=[];return Array.from(t.entries()).forEach(([r,i])=>{if(!e){n.push(r);return}(e.marks||[]).find(o=>o.type===r&&xc(o.attrs,i.attrs))||n.push(r)}),n}function z7(t,e){const n=[];return Array.from(e.entries()).forEach(([r,i])=>{const s=t.get(r);(!s||!xc(s.attrs,i.attrs))&&n.push({type:r,mark:i})}),n}function $7(t,e,n,r){const i=!n,s=n&&(!n.marks||n.marks.length===0),o=n&&n.marks&&!r(e,new Map(n.marks.map(u=>[u.type,u]))),l=[];return(i||s||o)&&(n&&n.marks?Array.from(t.entries()).reverse().forEach(([u,f])=>{n.marks.find(m=>m.type===u&&xc(m.attrs,f.attrs))||l.push(u)}):(i||s)&&l.push(...Array.from(t.keys()).reverse())),l}function B7(t,e){let n="";return Array.from(t.keys()).reverse().forEach(r=>{const i=t.get(r),s=e(r,i);s&&(n=s+n)}),t.clear(),n}function V7(t,e,n){let r="";return Array.from(t.entries()).forEach(([i,s])=>{const o=n(i,s);o&&(r+=o),e.set(i,s)}),r}function Lb(t){const n=(t.raw||t.text||"").match(/^(\s*)[-+*]\s+\[([ xX])\]\s+/);return n?{isTask:!0,checked:n[2].toLowerCase()==="x",indentLevel:n[1].length}:{isTask:!1,indentLevel:0}}function Lh(t,e){return typeof t!="string"?"json":e}var H7=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","circle","clippath","defs","ellipse","foreignobject","g","image","line","lineargradient","mask","path","polygon","polyline","radialgradient","rect","stop","switch","symbol","textpath","tspan","use","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]),U7=/<\/?([a-zA-Z][\w-]*)/g;function F7(t){const e=[];let n;for(;(n=U7.exec(t))!==null;)e.push(n[1].toLowerCase());return e}function q7(t){const e=t.toLowerCase();return e.includes("-")?!1:!H7.has(e)}function G7(t,e){return F7(t).some(r=>q7(r)?!e.has(r):!1)}var W7=class{constructor(t){this.activeParseLexer=null,this.extensionRanks=new Map,this.baseExtensions=[],this.extensions=[],this.codeTypes=new Set,this.schemaParseDomTagsCache=null,this.lastParseResult=null;var e,n,r,i,s;this.markedInstance=(e=t?.marked)!=null?e:xt,this.indentStyle=(r=(n=t?.indentation)==null?void 0:n.style)!=null?r:"space",this.indentSize=(s=(i=t?.indentation)==null?void 0:i.size)!=null?s:2,this.baseExtensions=t?.extensions||[],t?.markedOptions&&typeof this.markedInstance.setOptions=="function"&&this.markedInstance.setOptions(t.markedOptions),this.registry=new Map,this.nodeTypeRegistry=new Map,t?.extensions&&(this.baseExtensions=t.extensions,nc(Xm(t.extensions)).forEach(l=>this.registerExtension(l)))}get instance(){return this.markedInstance}get indentCharacter(){return this.indentStyle==="space"?" ":" "}get indentString(){return this.indentCharacter.repeat(this.indentSize)}hasMarked(){return!!this.markedInstance}registerExtension(t){var e,n;this.extensions.push(t);const r=ut(Re(t,"code")),i=t.name;r&&this.codeTypes.add(i),this.extensionRanks.has(i)||this.extensionRanks.set(i,this.extensionRanks.size);const s=Re(t,"markdownTokenName")||i,o=Re(t,"parseMarkdown"),l=Re(t,"renderMarkdown"),u=Re(t,"markdownTokenizer"),f=(e=Re(t,"markdownOptions"))!=null?e:null,h=(n=f?.indentsContent)!=null?n:!1,m=f?.htmlReopen,g={tokenName:s,nodeName:i,parseMarkdown:o,renderMarkdown:l,isIndenting:h,htmlReopen:m,tokenizer:u};if(s&&o){const y=this.registry.get(s)||[];y.push(g),this.registry.set(s,y)}if(l){const y=this.nodeTypeRegistry.get(i)||[];y.push(g),this.nodeTypeRegistry.set(i,y)}u&&this.hasMarked()&&this.registerTokenizer(u)}createLexer(){return new this.markedInstance.Lexer(this.markedInstance.defaults)}createTokenizerHelpers(t){return{inlineTokens:e=>t.inlineTokens(e),blockTokens:e=>t.blockTokens(e)}}tokenizeInline(t){var e;return((e=this.activeParseLexer)!=null?e:this.createLexer()).inlineTokens(t)}registerTokenizer(t){if(!this.hasMarked())return;const{name:e,start:n,level:r="inline",tokenize:i}=t,s=this.createTokenizerHelpers.bind(this),o=this.createLexer.bind(this);let l;n?l=typeof n=="function"?n:f=>f.indexOf(n):l=f=>{const h=i(f,[],this.createTokenizerHelpers(this.createLexer()));return h&&h.raw?f.indexOf(h.raw):-1};const u={name:e,level:r,start:l,tokenizer(f,h){const m=this.lexer?s(this.lexer):s(o()),g=i(f,h,m);if(g&&g.type)return{...g,type:g.type||e,raw:g.raw||"",tokens:g.tokens||[]}},childTokens:[]};this.markedInstance.use({extensions:[u]})}getHandlersForToken(t){try{return this.registry.get(t)||[]}catch{return[]}}getHandlerForToken(t){const e=this.getHandlersForToken(t);if(e.length>0)return e[0];const n=this.getHandlersForNodeType(t);return n.length>0?n[0]:void 0}getHandlersForNodeType(t){try{return this.nodeTypeRegistry.get(t)||[]}catch{return[]}}serialize(t){if(!t)return"";const e=this.renderNodes(t,t);return this.isEmptyOutput(e)?"":e}isEmptyOutput(t){return!t||t.trim()===""?!0:t.replace(/ /g,"").replace(/\u00A0/g,"").trim()===""}parse(t){if(!this.hasMarked())throw new Error("No marked instance available for parsing");const e=this.activeParseLexer,n=this.createLexer();this.activeParseLexer=n;try{const r=n.lex(t);return{type:"doc",content:this.parseTokens(r,!0)}}finally{this.activeParseLexer=e}}parseTokens(t,e=!1){const n=e?L7(t):t,r=n.reduce((o,l,u)=>(l.type!=="space"&&o.push(u),o),[]);let i=-1,s=0;return n.flatMap((o,l)=>{for(var u;s<r.length&&r[s]<l;)i=r[s],s+=1;if(e&&o.type==="space"){const h=(u=r[s])!=null?u:-1;return this.createImplicitEmptyParagraphsFromSpace(o,i,h)}const f=this.parseToken(o,e);return f===null?[]:Array.isArray(f)?f:[f]})}createImplicitEmptyParagraphsFromSpace(t,e,n){const r=this.countParagraphSeparators(t.raw||"");if(r===0)return[];const s=Math.max(r-(e===-1||n===-1?0:1),0);return Array.from({length:s},()=>({type:"paragraph",content:[]}))}countParagraphSeparators(t){return(t.replace(/\r\n/g,`
|
|
268
|
-
`).match(/\n\n/g)||[]).length}parseToken(t,e=!1){if(!t.type)return null;if(t.type==="list")return this.parseListToken(t);const n=this.getHandlersForToken(t.type),r=this.createParseHelpers();if(n.find(s=>{if(!s.parseMarkdown)return!1;const o=s.parseMarkdown(t,r),l=this.normalizeParseResult(o);return l&&(!Array.isArray(l)||l.length>0)?(this.lastParseResult=l,!0):!1})&&this.lastParseResult){const s=this.lastParseResult;return this.lastParseResult=null,s}return this.parseFallbackToken(t,e)}parseListToken(t){if(!t.items||t.items.length===0)return this.parseTokenWithHandlers(t);const e=t.items.some(l=>Lb(l).isTask),n=t.items.some(l=>!Lb(l).isTask);if(!e||!n||this.getHandlersForToken("taskList").length===0)return this.parseTokenWithHandlers(t);const r=[];let i=[],s=null;for(let l=0;l<t.items.length;l+=1){const u=t.items[l],{isTask:f,checked:h,indentLevel:m}=Lb(u);let g=u;if(f){const S=(u.raw||u.text||"").split(`
|
|
269
|
-
`),k=S[0].match(/^\s*[-+*]\s+\[([ xX])\]\s+(.*)$/),C=k?k[2]:"";let T=[];if(S.length>1&&S.slice(1).join(`
|
|
270
|
-
`).trim()){const R=S.slice(1),M=R.filter(O=>O.trim());if(M.length>0){const O=Math.min(...M.map(U=>U.length-U.trimStart().length)),P=R.map(U=>U.trim()?U.slice(O):"").join(`
|
|
271
|
-
`).trim();P&&(T=this.markedInstance.lexer(`${P}
|
|
272
|
-
`))}}g={type:"taskItem",raw:"",mainContent:C,indentLevel:m,checked:h??!1,text:C,tokens:this.tokenizeInline(C),nestedTokens:T}}const y=f?"taskList":"list";s!==y?(i.length>0&&r.push({type:s,items:i}),i=[g],s=y):i.push(g)}i.length>0&&r.push({type:s,items:i});const o=[];for(let l=0;l<r.length;l+=1){const u=r[l],f={...t,type:u.type,items:u.items},h=this.parseToken(f);h&&(Array.isArray(h)?o.push(...h):o.push(h))}return o.length>0?o:null}parseTokenWithHandlers(t){if(!t.type)return null;const e=this.getHandlersForToken(t.type),n=this.createParseHelpers();if(e.find(i=>{if(!i.parseMarkdown)return!1;const s=i.parseMarkdown(t,n),o=this.normalizeParseResult(s);return o&&(!Array.isArray(o)||o.length>0)?(this.lastParseResult=o,!0):!1})&&this.lastParseResult){const i=this.lastParseResult;return this.lastParseResult=null,i}return this.parseFallbackToken(t)}createParseHelpers(){return{parseInline:t=>this.parseInlineTokens(t),tokenizeInline:t=>this.tokenizeInline(t),parseChildren:t=>this.parseTokens(t),parseBlockChildren:t=>this.parseTokens(t,!0),createTextNode:(t,e)=>({type:"text",text:t,marks:e||void 0}),createNode:(t,e,n)=>{const r={type:t,attrs:e||void 0,content:n||void 0};return(!e||Object.keys(e).length===0)&&delete r.attrs,r},applyMark:(t,e,n)=>({mark:t,content:e,attrs:n&&Object.keys(n).length>0?n:void 0})}}escapeRegex(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}parseInlineTokens(t){var e,n,r,i;const s=[];for(let o=0;o<t.length;o+=1){const l=t[o];if(l.type==="text")s.push({type:"text",text:jA(l.text||"")});else if(l.type==="escape")s.push({type:"text",text:l.text||""});else if(l.type==="html"){const u=((n=(e=l.raw)!=null?e:l.text)!=null?n:"").toString(),f=/^<\/[\s]*[\w-]+/i.test(u),h=u.match(/^<[\s]*([\w-]+)(\s|>|\/|$)/i);if(!f&&h&&!/\/>$/.test(u)){const g=h[1],y=this.escapeRegex(g),x=new RegExp(`^<\\/\\s*${y}\\b`,"i");let S=-1;const k=[u];for(let C=o+1;C<t.length;C+=1){const T=t[C],_=((i=(r=T.raw)!=null?r:T.text)!=null?i:"").toString();if(k.push(_),T.type==="html"&&x.test(_)){S=C;break}}if(S!==-1){const C=k.join(""),T={type:"html",raw:C,text:C,block:!1},_=this.parseHTMLToken(T);if(_){const R=this.normalizeParseResult(_);Array.isArray(R)?s.push(...R):R&&s.push(R)}o=S;continue}}const m=this.parseHTMLToken(l);if(m){const g=this.normalizeParseResult(m);Array.isArray(g)?s.push(...g):g&&s.push(g)}}else if(l.type){const u=this.getHandlerForToken(l.type);if(u&&u.parseMarkdown){const f=this.createParseHelpers(),h=u.parseMarkdown(l,f);if(this.isMarkResult(h)){const m=this.applyMarkToContent(h.mark,h.content,h.attrs);s.push(...m)}else{const m=this.normalizeParseResult(h);Array.isArray(m)?s.push(...m):m&&s.push(m)}}else l.tokens&&s.push(...this.parseInlineTokens(l.tokens))}}for(let o=s.length-1;o>0;o-=1){const l=s[o],u=s[o-1];if(l.type==="text"&&u.type==="text"){const f=l.marks||[],h=u.marks||[];a9(f,h)&&(u.text=(u.text||"")+(l.text||""),s.splice(o,1))}}return s}applyMarkToContent(t,e,n){return e.map(r=>{if(r.type==="text"){const i=r.marks||[],s=n?{type:t,attrs:n}:{type:t};return{...r,marks:[...i,s]}}return{...r,content:r.content?this.applyMarkToContent(t,r.content,n):void 0}})}isMarkResult(t){return t&&typeof t=="object"&&"mark"in t}normalizeParseResult(t){return t?this.isMarkResult(t)?t.content:t:null}parseFallbackToken(t,e=!1){switch(t.type){case"paragraph":return{type:"paragraph",content:t.tokens?this.parseInlineTokens(t.tokens):[]};case"heading":return{type:"heading",attrs:{level:t.depth||1},content:t.tokens?this.parseInlineTokens(t.tokens):[]};case"text":return{type:"text",text:jA(t.text||"")};case"html":return this.parseHTMLToken(t);case"escape":return{type:"text",text:t.text||""};case"space":return null;default:return t.tokens?this.parseTokens(t.tokens,e):null}}parseHTMLToken(t){const e=t.text||t.raw||"";if(!e.trim())return null;if(this.isUnrecognizedHtml(e))return this.htmlAsLiteralText(e,!!t.block);if(typeof window>"u"||typeof window.DOMParser>"u")return this.htmlAsLiteralText(e,!!t.block);try{const n=mq(e,this.baseExtensions);return n.type==="doc"&&n.content?t.block?n.content:n.content.length===1&&n.content[0].type==="paragraph"&&n.content[0].content?n.content[0].content:n.content:n}catch(n){throw new Error(`Failed to parse HTML in markdown: ${n}`)}}isUnrecognizedHtml(t){return G7(t,this.getSchemaParseDomTags())}getSchemaParseDomTags(){if(this.schemaParseDomTagsCache)return this.schemaParseDomTagsCache;const t=new Set;try{const e=iI(this.baseExtensions),n=r=>{const i=r?.parseDOM;Array.isArray(i)&&i.forEach(s=>{if(typeof s?.tag=="string"){const o=s.tag.match(/^[a-zA-Z][\w-]*/);o&&t.add(o[0].toLowerCase())}})};Object.values(e.nodes).forEach(r=>n(r.spec)),Object.values(e.marks).forEach(r=>n(r.spec))}catch{}return this.schemaParseDomTagsCache=t,t}htmlAsLiteralText(t,e){const n=t.replace(/\s+$/,"");return n?e?{type:"paragraph",content:[{type:"text",text:n}]}:{type:"text",text:n}:null}encodeTextForMarkdown(t,e,n){return n?.type!=null&&this.codeTypes.has(n.type)||(e.marks||[]).some(i=>this.codeTypes.has(typeof i=="string"?i:i.type))?t:this.escapeMarkdownSyntax(Jq(t))}escapeMarkdownSyntax(t){return t.replace(/([\\`*_[\]~])/g,"\\$1")}renderNodeToMarkdown(t,e,n=0,r=0,i={}){var s;if(t.type==="text")return this.encodeTextForMarkdown(t.text||"",t,e);if(!t.type)return"";const o=this.getHandlerForToken(t.type);if(!o)return"";const l=Array.isArray(e?.content)&&n>0?e.content[n-1]:void 0,u={renderChildren:(m,g)=>{const y=o.isIndenting?r+1:r;return!Array.isArray(m)&&m.content?this.renderNodes(m.content,t,g||"",n,y):this.renderNodes(m,t,g||"",n,y)},renderChild:(m,g)=>{const y=o.isIndenting?r+1:r;return this.renderNodeToMarkdown(m,t,g,y)},indent:m=>this.indentString+m,wrapInBlock:j7},f={index:n,level:r,parentType:e?.type,previousNode:l,meta:{parentAttrs:e?.attrs,...i}};return((s=o.renderMarkdown)==null?void 0:s.call(o,t,u,f))||""}renderNodes(t,e,n="",r=0,i=0){return Array.isArray(t)?this.renderNodesWithMarkBoundaries(t,e,n,i):t.type?this.renderNodeToMarkdown(t,e,r,i):""}renderNodesWithMarkBoundaries(t,e,n="",r=0){const i=[],s=new Map,o=new Set,l=new Map;return t.forEach((u,f)=>{const h=f<t.length-1?t[f+1]:null;if(u.type)if(u.type==="text"){let m=this.encodeTextForMarkdown(u.text||"",u,e);const g=new Map((u.marks||[]).map(M=>[M.type,M])),y=this.getMarksToOpenForSerialization(s,g,h),x=P7(g,h),S=x.filter(M=>s.has(M)),k=S.length>0&&y.length>0;let C="";if(x.length>0&&!k){const M=m.match(/(\s+)$/);M&&(C=M[1],m=m.slice(0,-C.length))}k||x.slice().reverse().forEach(M=>{if(!s.has(M))return;const O=g.get(M),L=this.getMarkClosing(M,O,l.get(M));L&&(m+=L),s.has(M)&&(s.delete(M),l.delete(M))});let T="";if(y.length>0){const M=m.match(/^(\s+)/);M&&(T=M[1],m=m.slice(T.length))}y.forEach(({type:M,mark:O})=>{const L=o.has(M)?"html":"markdown",P=this.getMarkOpening(M,O,L);P&&(m=P+m),l.set(M,L),o.delete(M)}),k||y.slice().reverse().forEach(({type:M,mark:O})=>{s.set(M,O)}),m=T+m;let _;if(k){const M=new Set((h?.marks||[]).map(P=>P.type));y.forEach(({type:P})=>{M.has(P)&&this.getHtmlReopenTags(P)&&o.add(P)});const O=Array.from(s.keys()),L=S.slice().sort((P,U)=>O.indexOf(U)-O.indexOf(P));_=[...y.map(P=>P.type),...L]}else _=$7(s,g,h,this.markSetsEqual.bind(this));let R="";if(_.length>0){const M=m.match(/(\s+)$/);M&&(R=M[1],m=m.slice(0,-R.length))}_.forEach(M=>{var O;const L=(O=s.get(M))!=null?O:g.get(M),P=this.getMarkClosing(M,L,l.get(M));P&&(m+=P),s.delete(M),l.delete(M)}),m+=R,m+=C,i.push(m)}else{const m=new Set((u.marks||[]).map(C=>C.type)),g=new Map,y=new Map;s.forEach((C,T)=>{var _;m.has(T)&&(g.set(T,C),y.set(T,(_=l.get(T))!=null?_:"markdown"))});const x=B7(s,(C,T)=>this.getMarkClosing(C,T,l.get(C)));l.clear();const S=this.renderNodeToMarkdown(u,e,f,r),k=u.type==="hardBreak"?"":V7(g,s,(C,T)=>{var _;const R=(_=y.get(C))!=null?_:"markdown";return l.set(C,R),this.getMarkOpening(C,T,R)});i.push(x+S+k)}}),i.join(n)}getMarkOpening(t,e,n="markdown"){var r;if(n==="html")return((r=this.getHtmlReopenTags(t))==null?void 0:r.open)||"";const i=this.getHandlersForNodeType(t),s=i.length>0?i[0]:void 0;if(!s||!s.renderMarkdown)return"";const o="__TIPTAP_MARKDOWN_PLACEHOLDER__",l={type:t,attrs:e.attrs||{},content:[{type:"text",text:o}]};try{const u=s.renderMarkdown(l,{renderChildren:()=>o,renderChild:()=>o,indent:h=>h,wrapInBlock:(h,m)=>h+m},{index:0,level:0,parentType:"text",meta:{}}),f=u.indexOf(o);return f>=0?u.substring(0,f):""}catch(u){throw new Error(`Failed to get mark opening for ${t}: ${u}`)}}getMarkClosing(t,e,n="markdown"){var r;if(n==="html")return((r=this.getHtmlReopenTags(t))==null?void 0:r.close)||"";const i=this.getHandlersForNodeType(t),s=i.length>0?i[0]:void 0;if(!s||!s.renderMarkdown)return"";const o="__TIPTAP_MARKDOWN_PLACEHOLDER__",l={type:t,attrs:e.attrs||{},content:[{type:"text",text:o}]};try{const u=s.renderMarkdown(l,{renderChildren:()=>o,renderChild:()=>o,indent:m=>m,wrapInBlock:(m,g)=>m+g},{index:0,level:0,parentType:"text",meta:{}}),f=u.indexOf(o),h=f+o.length;return f>=0?u.substring(h):""}catch(u){throw new Error(`Failed to get mark closing for ${t}: ${u}`)}}getHtmlReopenTags(t){const e=this.getHandlersForNodeType(t),n=e.length>0?e[0]:void 0;return n?.htmlReopen}markSetsEqual(t,e){return t.size!==e.size?!1:Array.from(t.entries()).every(([n,r])=>{const i=e.get(n);return i&&xc(r.attrs,i.attrs)})}getMarksToOpenForSerialization(t,e,n){const r=z7(t,e);if(r.length<=1)return r;const i=n?.marks||[],s=(f,h)=>i.some(m=>m.type===f&&xc(m.attrs,h)),o=(f,h)=>{var m,g;const y=(m=this.extensionRanks.get(f.type))!=null?m:Number.MAX_SAFE_INTEGER,x=(g=this.extensionRanks.get(h.type))!=null?g:Number.MAX_SAFE_INTEGER;return y!==x?x-y:f.type.localeCompare(h.type)},l=r.filter(f=>!s(f.type,f.mark.attrs)).sort(o),u=r.filter(f=>s(f.type,f.mark.attrs)).sort(o);return[...l,...u]}},fR=W7,K7=Pt.create({name:"markdown",addOptions(){return{indentation:{style:"space",size:2},marked:void 0,markedOptions:{}}},addCommands(){return{setContent:(t,e)=>{if(!e?.contentType||Lh(t,e?.contentType)!=="markdown"||!this.editor.markdown)return ti.setContent(t,e);const r=this.editor.markdown.parse(t);return ti.setContent(r,e)},insertContent:(t,e)=>{if(!e?.contentType||Lh(t,e?.contentType)!=="markdown"||!this.editor.markdown)return ti.insertContent(t,e);const r=this.editor.markdown.parse(t);return ti.insertContent(r,e)},insertContentAt:(t,e,n)=>{if(!n?.contentType||Lh(e,n?.contentType)!=="markdown"||!this.editor.markdown)return ti.insertContentAt(t,e,n);const i=this.editor.markdown.parse(e);return ti.insertContentAt(t,i,n)}}},addStorage(){return{manager:new fR({indentation:this.options.indentation,marked:this.options.marked,markedOptions:this.options.markedOptions,extensions:[]})}},onBeforeCreate(){var t;if(this.editor.markdown){console.error("[tiptap][markdown]: There is already a `markdown` property on the editor instance. This might lead to unexpected behavior.");return}if(this.storage.manager=new fR({indentation:this.options.indentation,marked:this.options.marked,markedOptions:this.options.markedOptions,extensions:this.editor.extensionManager.baseExtensions}),this.editor.markdown=this.storage.manager,this.editor.getMarkdown=()=>this.storage.manager.serialize(this.editor.getJSON()),!this.editor.options.contentType||Lh(this.editor.options.content,this.editor.options.contentType)!=="markdown")return;if(!this.editor.markdown)throw new Error('[tiptap][markdown]: The `contentType` option is set to "markdown", but the Markdown extension is not added to the editor. Please add the Markdown extension to use this feature.');if(this.editor.options.content===void 0||typeof this.editor.options.content!="string")throw new Error('[tiptap][markdown]: The `contentType` option is set to "markdown", but the initial content is not a string. Please provide the initial content as a markdown string.');const n=this.editor.markdown.parse(this.editor.options.content);(t=n.content)!=null&&t.length&&(this.editor.options.content=n)}}),Z7=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Y7=wn.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",Mt(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,i,s,o;const l=(n=(e=t.attrs)==null?void 0:e.src)!=null?n:"",u=(i=(r=t.attrs)==null?void 0:r.alt)!=null?i:"",f=(o=(s=t.attrs)==null?void 0:s.title)!=null?o:"";return f?``:``},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,i=new Set(["src","width","height"]);return({node:s,getPos:o,HTMLAttributes:l,editor:u})=>{const f=document.createElement("img");f.draggable=!1;const h=Mt(this.options.HTMLAttributes,l);Object.entries(h).forEach(([k,C])=>{if(C!=null)switch(k){case"src":case"width":case"height":break;default:f.setAttribute(k,C);break}}),h.src!==null&&(f.src=h.src);let m={...l};const g=k=>{if(typeof k=="string"&&k!==""){f.getAttribute("src")!==k&&(f.src=k);return}f.hasAttribute("src")&&f.removeAttribute("src"),f.src!==""&&(f.src="")};g(l.src);const y=k=>{if(k.type!==s.type)return!1;const C=u.extensionManager.attributes.filter(_=>_.type===k.type.name),T=bc(k,C);return Object.keys(m).forEach(_=>{!i.has(_)&&!(_ in T)&&f.removeAttribute(_)}),Object.entries(T).forEach(([_,R])=>{i.has(_)||(R!=null?f.setAttribute(_,R):f.removeAttribute(_))}),g(T.src),m=T,!0},x=new x9({element:f,editor:u,node:s,getPos:o,onResize:(k,C)=>{f.style.width=`${k}px`,f.style.height=`${C}px`},onCommit:(k,C)=>{const T=o();T!==void 0&&this.editor.chain().setNodeSelection(T).updateAttributes(this.name,{width:k,height:C}).run()},onUpdate:y,options:{directions:t,min:{width:e,height:n},preserveAspectRatio:r===!0}}),S=x.dom;return S.style.visibility="hidden",S.style.pointerEvents="none",f.onload=()=>{S.style.visibility="",S.style.pointerEvents=""},x}},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[_I({find:Z7,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),X7=Y7;let bx,xx;if(typeof WeakMap<"u"){let t=new WeakMap;bx=e=>t.get(e),xx=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;bx=r=>{for(let i=0;i<t.length;i+=2)if(t[i]==r)return t[i+1]},xx=(r,i)=>(n==10&&(n=0),t[n++]=r,t[n++]=i)}var Gt=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,i=e/this.width|0;let s=r+1,o=i+1;for(let l=1;s<this.width&&this.map[e+l]==n;l++)s++;for(let l=1;o<this.height&&this.map[e+this.width*l]==n;l++)o++;return{left:r,top:i,right:s,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:i,top:s,bottom:o}=this.findCell(t);return e=="horiz"?(n<0?r==0:i==this.width)?null:this.map[s*this.width+(n<0?r-1:i)]:(n<0?s==0:o==this.height)?null:this.map[r+this.width*(n<0?s-1:o)]}rectBetween(t,e){const{left:n,right:r,top:i,bottom:s}=this.findCell(t),{left:o,right:l,top:u,bottom:f}=this.findCell(e);return{left:Math.min(n,o),top:Math.min(i,u),right:Math.max(r,l),bottom:Math.max(s,f)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let i=t.left;i<t.right;i++){const s=r*this.width+i,o=this.map[s];n[o]||(n[o]=!0,!(i==t.left&&i&&this.map[s-1]==o||r==t.top&&r&&this.map[s-this.width]==o)&&e.push(o))}return e}positionAt(t,e,n){for(let r=0,i=0;;r++){const s=i+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]<i;)o++;return o==l?s-1:this.map[o]}i=s}}static get(t){return bx(t)||xx(t,J7(t))}};function J7(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=Q7(t),n=t.childCount,r=[];let i=0,s=null;const o=[];for(let f=0,h=e*n;f<h;f++)r[f]=0;for(let f=0,h=0;f<n;f++){const m=t.child(f);h++;for(let x=0;;x++){for(;i<r.length&&r[i]!=0;)i++;if(x==m.childCount)break;const S=m.child(x),{colspan:k,rowspan:C,colwidth:T}=S.attrs;for(let _=0;_<C;_++){if(_+f>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:h,n:C-_});break}const R=i+_*e;for(let M=0;M<k;M++){r[R+M]==0?r[R+M]=h:(s||(s=[])).push({type:"collision",row:f,pos:h,n:k-M});const O=T&&T[M];if(O){const L=(R+M)%e*2,P=o[L];P==null||P!=O&&o[L+1]==1?(o[L]=O,o[L+1]=1):P==O&&o[L+1]++}}}i+=k,h+=S.nodeSize}const g=(f+1)*e;let y=0;for(;i<g;)r[i++]==0&&y++;y&&(s||(s=[])).push({type:"missing",row:f,n:y}),h++}(e===0||n===0)&&(s||(s=[])).push({type:"zero_sized"});const l=new Gt(e,n,r,s);let u=!1;for(let f=0;!u&&f<o.length;f+=2)o[f]!=null&&o[f+1]<n&&(u=!0);return u&&eK(l,o,t),l}function Q7(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const i=t.child(r);let s=0;if(n)for(let o=0;o<r;o++){const l=t.child(o);for(let u=0;u<l.childCount;u++){const f=l.child(u);o+f.attrs.rowspan>r&&(s+=f.attrs.colspan)}}for(let o=0;o<i.childCount;o++){const l=i.child(o);s+=l.attrs.colspan,l.attrs.rowspan>1&&(n=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function eK(t,e,n){t.problems||(t.problems=[]);const r={};for(let i=0;i<t.map.length;i++){const s=t.map[i];if(r[s])continue;r[s]=!0;const o=n.nodeAt(s);if(!o)throw new RangeError(`No cell with offset ${s} found`);let l=null;const u=o.attrs;for(let f=0;f<u.colspan;f++){const h=e[(i+f)%t.width*2];h!=null&&(!u.colwidth||u.colwidth[f]!=h)&&((l||(l=tK(u)))[f]=h)}l&&t.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:l})}}function tK(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function Un(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const r=t.nodes[n],i=r.spec.tableRole;i&&(e[i]=r)}}return e}const po=new Wt("selectingCells");function $a(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 nK(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 pi(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 sg(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=$a(e.$head)||rK(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function rK(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 wx(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function iK(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function TS(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function AL(t,e,n){const r=t.node(-1),i=Gt.get(r),s=t.start(-1),o=i.nextCell(t.pos-s,e,n);return o==null?null:t.node(0).resolve(s+o)}function Ba(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(i=>i>0)||(r.colwidth=null)),r}function RL(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let i=0;i<n;i++)r.colwidth.splice(e,0,0)}return r}function sK(t,e,n){const r=Un(e.type.schema).header_cell;for(let i=0;i<t.height;i++)if(e.nodeAt(t.map[n+i*t.width]).type!=r)return!1;return!0}var Rt=class is extends Ue{constructor(e,n=e){const r=e.node(-1),i=Gt.get(r),s=e.start(-1),o=i.rectBetween(e.pos-s,n.pos-s),l=e.node(0),u=i.cellsInRect(o).filter(h=>h!=n.pos-s);u.unshift(n.pos-s);const f=u.map(h=>{const m=r.nodeAt(h);if(!m)throw new RangeError(`No cell with offset ${h} found`);const g=s+h+1;return new WO(l.resolve(g),l.resolve(g+m.content.size))});super(f[0].$from,f[0].$to,f),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),i=e.resolve(n.map(this.$headCell.pos));if(wx(r)&&wx(i)&&TS(r,i)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?is.rowSelection(r,i):s&&this.isColSelection()?is.colSelection(r,i):new is(r,i)}return Ie.between(r,i)}content(){const e=this.$anchorCell.node(-1),n=Gt.get(e),r=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),s={},o=[];for(let u=i.top;u<i.bottom;u++){const f=[];for(let h=u*n.width+i.left,m=i.left;m<i.right;m++,h++){const g=n.map[h];if(s[g])continue;s[g]=!0;const y=n.findCell(g);let x=e.nodeAt(g);if(!x)throw new RangeError(`No cell with offset ${g} found`);const S=i.left-y.left,k=y.right-i.right;if(S>0||k>0){let C=x.attrs;if(S>0&&(C=Ba(C,0,S)),k>0&&(C=Ba(C,C.colspan-k,k)),y.left<i.left){if(x=x.type.createAndFill(C),!x)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(C)}`)}else x=x.type.create(C,x.content)}if(y.top<i.top||y.bottom>i.bottom){const C={...x.attrs,rowspan:Math.min(y.bottom,i.bottom)-Math.max(y.top,i.top)};y.top<i.top?x=x.type.createAndFill(C):x=x.type.create(C,x.content)}f.push(x)}o.push(e.child(u).copy(ue.from(f)))}const l=this.isColSelection()&&this.isRowSelection()?e:o;return new Se(ue.from(l),1,1)}replace(e,n=Se.empty){const r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){const{$from:l,$to:u}=i[o],f=e.mapping.slice(r);e.replace(f.map(l.pos),f.map(u.pos),o?Se.empty:n)}const s=Ue.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,n){this.replace(e,new Se(ue.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=Gt.get(n),i=this.$anchorCell.start(-1),s=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let o=0;o<s.length;o++)e(n.nodeAt(s[o]),i+s[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,i=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),i=Gt.get(r),s=e.start(-1),o=i.findCell(e.pos-s),l=i.findCell(n.pos-s),u=e.node(0);return o.top<=l.top?(o.top>0&&(e=u.resolve(s+i.map[o.left])),l.bottom<i.height&&(n=u.resolve(s+i.map[i.width*(i.height-1)+l.right-1]))):(l.top>0&&(n=u.resolve(s+i.map[l.left])),o.bottom<i.height&&(e=u.resolve(s+i.map[i.width*(i.height-1)+o.right-1]))),new is(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=Gt.get(e),r=this.$anchorCell.start(-1),i=n.colCount(this.$anchorCell.pos-r),s=n.colCount(this.$headCell.pos-r);if(Math.min(i,s)>0)return!1;const o=i+this.$anchorCell.nodeAfter.attrs.colspan,l=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,l)==n.width}eq(e){return e instanceof is&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),i=Gt.get(r),s=e.start(-1),o=i.findCell(e.pos-s),l=i.findCell(n.pos-s),u=e.node(0);return o.left<=l.left?(o.left>0&&(e=u.resolve(s+i.map[o.top*i.width])),l.right<i.width&&(n=u.resolve(s+i.map[i.width*(l.top+1)-1]))):(l.left>0&&(n=u.resolve(s+i.map[l.top*i.width])),o.right<i.width&&(e=u.resolve(s+i.map[i.width*(o.top+1)-1]))),new is(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new is(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new is(e.resolve(n),e.resolve(r))}getBookmark(){return new oK(this.$anchorCell.pos,this.$headCell.pos)}};Rt.prototype.visible=!1;Ue.jsonID("cell",Rt);var oK=class ML{constructor(e,n){this.anchor=e,this.head=n}map(e){return new ML(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&&TS(n,r)?new Rt(n,r):Ue.near(r,1)}};function aK(t){if(!(t.selection instanceof Rt))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(yn.node(r,r+n.nodeSize,{class:"selectedCell"}))}),bt.create(t.doc,e)}function lK({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,r=e.pos,i=t.depth;for(;i>=0&&!(t.after(i+1)<t.end(i));i--,n++);for(let s=e.depth;s>=0&&!(e.before(s+1)>e.start(s));s--,r--);return n==r&&/row|table/.test(t.node(i).type.spec.tableRole)}function cK({$from:t,$to:e}){let n,r;for(let i=t.depth;i>0;i--){const s=t.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){n=s;break}}for(let i=e.depth;i>0;i--){const s=e.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){r=s;break}}return n!==r&&e.parentOffset===0}function uK(t,e,n){const r=(e||t).selection,i=(e||t).doc;let s,o;if(r instanceof Pe&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")s=Rt.create(i,r.from);else if(o=="row"){const l=i.resolve(r.from+1);s=Rt.rowSelection(l,l)}else if(!n){const l=Gt.get(r.node),u=r.from+1,f=u+l.map[l.width*l.height-1];s=Rt.create(i,u+1,f)}}else r instanceof Ie&&lK(r)?s=Ie.create(i,r.from):r instanceof Ie&&cK(r)&&(s=Ie.create(i,r.$from.start(),r.$from.end()));return s&&(e||(e=t.tr)).setSelection(s),e}const dK=new Wt("fix-tables");function NL(t,e,n,r){const i=t.childCount,s=e.childCount;e:for(let o=0,l=0;o<s;o++){const u=e.child(o);for(let f=l,h=Math.min(i,o+3);f<h;f++)if(t.child(f)==u){l=f+1,n+=u.nodeSize;continue e}r(u,n),l<i&&t.child(l).sameMarkup(u)?NL(t.child(l),u,n+1,r):u.nodesBetween(0,u.content.size,r,n+1),n+=u.nodeSize}}function OL(t,e){let n;const r=(i,s)=>{i.type.spec.tableRole=="table"&&(n=fK(t,i,s,n))};return e?e.doc!=t.doc&&NL(e.doc,t.doc,0,r):t.doc.descendants(r),n}function fK(t,e,n,r){const i=Gt.get(e);if(!i.problems)return r;r||(r=t.tr);const s=[];for(let u=0;u<i.height;u++)s.push(0);for(let u=0;u<i.problems.length;u++){const f=i.problems[u];if(f.type=="collision"){const h=e.nodeAt(f.pos);if(!h)continue;const m=h.attrs;for(let g=0;g<m.rowspan;g++)s[f.row+g]+=f.n;r.setNodeMarkup(r.mapping.map(n+1+f.pos),null,Ba(m,m.colspan-f.n,f.n))}else if(f.type=="missing")s[f.row]+=f.n;else if(f.type=="overlong_rowspan"){const h=e.nodeAt(f.pos);if(!h)continue;r.setNodeMarkup(r.mapping.map(n+1+f.pos),null,{...h.attrs,rowspan:h.attrs.rowspan-f.n})}else if(f.type=="colwidth mismatch"){const h=e.nodeAt(f.pos);if(!h)continue;r.setNodeMarkup(r.mapping.map(n+1+f.pos),null,{...h.attrs,colwidth:f.colwidth})}else if(f.type=="zero_sized"){const h=r.mapping.map(n);r.delete(h,h+e.nodeSize)}}let o,l;for(let u=0;u<s.length;u++)s[u]&&(o==null&&(o=u),l=u);for(let u=0,f=n+1;u<i.height;u++){const h=e.child(u),m=f+h.nodeSize,g=s[u];if(g>0){let y="cell";h.firstChild&&(y=h.firstChild.type.spec.tableRole);const x=[];for(let k=0;k<g;k++){const C=Un(t.schema)[y].createAndFill();C&&x.push(C)}const S=(u==0||o==u-1)&&l==u?f+1:m-1;r.insert(r.mapping.map(S),x)}f=m}return r.setMeta(dK,{fixTables:!0})}function Ii(t){const e=t.selection,n=sg(t),r=n.node(-1),i=n.start(-1),s=Gt.get(r);return{...e instanceof Rt?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(n.pos-i),tableStart:i,map:s,table:r}}function DL(t,{map:e,tableStart:n,table:r},i){let s=i>0?-1:0;sK(e,r,i+s)&&(s=i==0||i==e.width?null:0);for(let o=0;o<e.height;o++){const l=o*e.width+i;if(i>0&&i<e.width&&e.map[l-1]==e.map[l]){const u=e.map[l],f=r.nodeAt(u);t.setNodeMarkup(t.mapping.map(n+u),null,RL(f.attrs,i-e.colCount(u))),o+=f.attrs.rowspan-1}else{const u=s==null?Un(r.type.schema).cell:r.nodeAt(e.map[l+s]).type,f=e.positionAt(o,i,r);t.insert(t.mapping.map(n+f),u.createAndFill())}}return t}function hK(t,e){if(!pi(t))return!1;if(e){const n=Ii(t);e(DL(t.tr,n,n.left))}return!0}function pK(t,e){if(!pi(t))return!1;if(e){const n=Ii(t);e(DL(t.tr,n,n.right))}return!0}function mK(t,{map:e,table:n,tableStart:r},i){const s=t.mapping.maps.length;for(let o=0;o<e.height;){const l=o*e.width+i,u=e.map[l],f=n.nodeAt(u),h=f.attrs;if(i>0&&e.map[l-1]==u||i<e.width-1&&e.map[l+1]==u)t.setNodeMarkup(t.mapping.slice(s).map(r+u),null,Ba(h,i-e.colCount(u)));else{const m=t.mapping.slice(s).map(r+u);t.delete(m,m+f.nodeSize)}o+=h.rowspan}}function gK(t,e){if(!pi(t))return!1;if(e){const n=Ii(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let i=n.right-1;mK(r,n,i),i!=n.left;i--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=Gt.get(s)}e(r)}return!0}function yK(t,e,n){var r;const i=Un(e.type.schema).header_cell;for(let s=0;s<t.width;s++)if(((r=e.nodeAt(t.map[s+n*t.width]))===null||r===void 0?void 0:r.type)!=i)return!1;return!0}function IL(t,{map:e,tableStart:n,table:r},i){let s=n;for(let f=0;f<i;f++)s+=r.child(f).nodeSize;const o=[];let l=i>0?-1:0;yK(e,r,i+l)&&(l=i==0||i==e.height?null:0);for(let f=0,h=e.width*i;f<e.width;f++,h++)if(i>0&&i<e.height&&e.map[h]==e.map[h-e.width]){const m=e.map[h],g=r.nodeAt(m).attrs;t.setNodeMarkup(n+m,null,{...g,rowspan:g.rowspan+1}),f+=g.colspan-1}else{var u;const m=l==null?Un(r.type.schema).cell:(u=r.nodeAt(e.map[h+l*e.width]))===null||u===void 0?void 0:u.type,g=m?.createAndFill();g&&o.push(g)}return t.insert(s,Un(r.type.schema).row.create(null,o)),t}function vK(t,e){if(!pi(t))return!1;if(e){const n=Ii(t);e(IL(t.tr,n,n.top))}return!0}function bK(t,e){if(!pi(t))return!1;if(e){const n=Ii(t);e(IL(t.tr,n,n.bottom))}return!0}function xK(t,{map:e,table:n,tableStart:r},i){let s=0;for(let f=0;f<i;f++)s+=n.child(f).nodeSize;const o=s+n.child(i).nodeSize,l=t.mapping.maps.length;t.delete(s+r,o+r);const u=new Set;for(let f=0,h=i*e.width;f<e.width;f++,h++){const m=e.map[h];if(!u.has(m)){if(u.add(m),i>0&&m==e.map[h-e.width]){const g=n.nodeAt(m).attrs;t.setNodeMarkup(t.mapping.slice(l).map(m+r),null,{...g,rowspan:g.rowspan-1}),f+=g.colspan-1}else if(i<e.height&&m==e.map[h+e.width]){const g=n.nodeAt(m),y=g.attrs,x=g.type.create({...y,rowspan:g.attrs.rowspan-1},g.content),S=e.positionAt(i+1,f,n);t.insert(t.mapping.slice(l).map(r+S),x),f+=y.colspan-1}}}}function wK(t,e){if(!pi(t))return!1;if(e){const n=Ii(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let i=n.bottom-1;xK(r,n,i),i!=n.top;i--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=Gt.get(n.table)}e(r)}return!0}function hR(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function SK({width:t,height:e,map:n},r){let i=r.top*t+r.left,s=i,o=(r.bottom-1)*t+r.left,l=i+(r.right-r.left-1);for(let u=r.top;u<r.bottom;u++){if(r.left>0&&n[s]==n[s-1]||r.right<t&&n[l]==n[l+1])return!0;s+=t,l+=t}for(let u=r.left;u<r.right;u++){if(r.top>0&&n[i]==n[i-t]||r.bottom<e&&n[o]==n[o+t])return!0;i++,o++}return!1}function pR(t,e){const n=t.selection;if(!(n instanceof Rt)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=Ii(t),{map:i}=r;if(SK(i,r))return!1;if(e){const s=t.tr,o={};let l=ue.empty,u,f;for(let h=r.top;h<r.bottom;h++)for(let m=r.left;m<r.right;m++){const g=i.map[h*i.width+m],y=r.table.nodeAt(g);if(!(o[g]||!y))if(o[g]=!0,u==null)u=g,f=y;else{hR(y)||(l=l.append(y.content));const x=s.mapping.map(g+r.tableStart);s.delete(x,x+y.nodeSize)}}if(u==null||f==null)return!0;if(s.setNodeMarkup(u+r.tableStart,null,{...RL(f.attrs,f.attrs.colspan,r.right-r.left-f.attrs.colspan),rowspan:r.bottom-r.top}),l.size>0){const h=u+1+f.content.size,m=hR(f)?u+1:h;s.replaceWith(m+r.tableStart,h+r.tableStart,l)}s.setSelection(new Rt(s.doc.resolve(u+r.tableStart))),e(s)}return!0}function mR(t,e){const n=Un(t.schema);return kK(({node:r})=>n[r.type.spec.tableRole])(t,e)}function kK(t){return(e,n)=>{const r=e.selection;let i,s;if(r instanceof Rt){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,s=r.$anchorCell.pos}else{var o;if(i=nK(r.$from),!i)return!1;s=(o=$a(r.$from))===null||o===void 0?void 0:o.pos}if(i==null||s==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let l=i.attrs;const u=[],f=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});const h=Ii(e),m=e.tr;for(let y=0;y<h.right-h.left;y++)u.push(f?{...l,colwidth:f&&f[y]?[f[y]]:null}:l);let g;for(let y=h.top;y<h.bottom;y++){let x=h.map.positionAt(y,h.left,h.table);y==h.top&&(x+=i.nodeSize);for(let S=h.left,k=0;S<h.right;S++,k++)S==h.left&&y==h.top||m.insert(g=m.mapping.map(x+h.tableStart,1),t({node:i,row:y,col:S}).createAndFill(u[k]))}m.setNodeMarkup(s,t({node:i,row:h.top,col:h.left}),u[0]),r instanceof Rt&&m.setSelection(new Rt(m.doc.resolve(r.$anchorCell.pos),g?m.doc.resolve(g):void 0)),n(m)}return!0}}function CK(t,e){return function(n,r){if(!pi(n))return!1;const i=sg(n);if(i.nodeAfter.attrs[t]===e)return!1;if(r){const s=n.tr;n.selection instanceof Rt?n.selection.forEachCell((o,l)=>{o.attrs[t]!==e&&s.setNodeMarkup(l,null,{...o.attrs,[t]:e})}):s.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[t]:e}),r(s)}return!0}}function EK(t){return function(e,n){if(!pi(e))return!1;if(n){const r=Un(e.schema),i=Ii(e),s=e.tr,o=i.map.cellsInRect(t=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:t=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),l=o.map(u=>i.table.nodeAt(u));for(let u=0;u<o.length;u++)l[u].type==r.header_cell&&s.setNodeMarkup(i.tableStart+o[u],r.cell,l[u].attrs);if(s.steps.length===0)for(let u=0;u<o.length;u++)s.setNodeMarkup(i.tableStart+o[u],r.header_cell,l[u].attrs);n(s)}return!0}}function gR(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 i=0;i<r.length;i++){const s=e.table.nodeAt(r[i]);if(s&&s.type!==n.header_cell)return!1}return!0}function Md(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?EK(t):function(n,r){if(!pi(n))return!1;if(r){const i=Un(n.schema),s=Ii(n),o=n.tr,l=gR("row",s,i),u=gR("column",s,i),f=(t==="column"?l:t==="row"&&u)?1:0,h=t=="column"?{left:0,top:f,right:1,bottom:s.map.height}:t=="row"?{left:f,top:0,right:s.map.width,bottom:1}:s,m=t=="column"?u?i.cell:i.header_cell:t=="row"?l?i.cell:i.header_cell:i.cell;s.map.cellsInRect(h).forEach(g=>{const y=g+s.tableStart,x=o.doc.nodeAt(y);x&&o.setNodeMarkup(y,m,x.attrs)}),r(o)}return!0}}Md("row",{useDeprecatedLogic:!0});Md("column",{useDeprecatedLogic:!0});const TK=Md("cell",{useDeprecatedLogic:!0});function _K(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,i=t.before();r>=0;r--){const s=t.node(-1).child(r),o=s.lastChild;if(o)return i-1-o.nodeSize;i-=s.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),i=t.after();r<n.childCount;r++){const s=n.child(r);if(s.childCount)return i+1;i+=s.nodeSize}}return null}function yR(t){return function(e,n){if(!pi(e))return!1;const r=_K(sg(e),t);if(r==null)return!1;if(n){const i=e.doc.resolve(r);n(e.tr.setSelection(Ie.between(i,iK(i))).scrollIntoView())}return!0}}function AK(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 jh(t,e){const n=t.selection;if(!(n instanceof Rt))return!1;if(e){const r=t.tr,i=Un(t.schema).cell.createAndFill().content;n.forEachCell((s,o)=>{s.content.eq(i)||r.replace(r.mapping.map(o+1),r.mapping.map(o+s.nodeSize-1),new Se(i,0,0))}),r.docChanged&&e(r)}return!0}function RK(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 i=e.child(0),s=i.type.spec.tableRole,o=i.type.schema,l=[];if(s=="row")for(let u=0;u<e.childCount;u++){let f=e.child(u).content;const h=u?0:Math.max(0,n-1),m=u<e.childCount-1?0:Math.max(0,r-1);(h||m)&&(f=Sx(Un(o).row,new Se(f,h,m)).content),l.push(f)}else if(s=="cell"||s=="header_cell")l.push(n||r?Sx(Un(o).row,new Se(e,n,r)).content:e);else return null;return MK(o,l)}function MK(t,e){const n=[];for(let i=0;i<e.length;i++){const s=e[i];for(let o=s.childCount-1;o>=0;o--){const{rowspan:l,colspan:u}=s.child(o).attrs;for(let f=i;f<i+l;f++)n[f]=(n[f]||0)+u}}let r=0;for(let i=0;i<n.length;i++)r=Math.max(r,n[i]);for(let i=0;i<n.length;i++)if(i>=e.length&&e.push(ue.empty),n[i]<r){const s=Un(t).cell.createAndFill(),o=[];for(let l=n[i];l<r;l++)o.push(s);e[i]=e[i].append(ue.from(o))}return{height:e.length,width:r,rows:e}}function Sx(t,e){const n=t.createAndFill();return new Mw(n).replace(0,n.content.size,e).doc}function NK({width:t,height:e,rows:n},r,i){if(t!=r){const s=[],o=[];for(let l=0;l<n.length;l++){const u=n[l],f=[];for(let h=s[l]||0,m=0;h<r;m++){let g=u.child(m%u.childCount);h+g.attrs.colspan>r&&(g=g.type.createChecked(Ba(g.attrs,g.attrs.colspan,h+g.attrs.colspan-r),g.content)),f.push(g),h+=g.attrs.colspan;for(let y=1;y<g.attrs.rowspan;y++)s[l+y]=(s[l+y]||0)+g.attrs.colspan}o.push(ue.from(f))}n=o,t=r}if(e!=i){const s=[];for(let o=0,l=0;o<i;o++,l++){const u=[],f=n[l%e];for(let h=0;h<f.childCount;h++){let m=f.child(h);o+m.attrs.rowspan>i&&(m=m.type.create({...m.attrs,rowspan:Math.max(1,i-m.attrs.rowspan)},m.content)),u.push(m)}s.push(ue.from(u))}n=s,e=i}return{width:t,height:e,rows:n}}function OK(t,e,n,r,i,s,o){const l=t.doc.type.schema,u=Un(l);let f,h;if(i>e.width)for(let m=0,g=0;m<e.height;m++){const y=n.child(m);g+=y.nodeSize;const x=[];let S;y.lastChild==null||y.lastChild.type==u.cell?S=f||(f=u.cell.createAndFill()):S=h||(h=u.header_cell.createAndFill());for(let k=e.width;k<i;k++)x.push(S);t.insert(t.mapping.slice(o).map(g-1+r),x)}if(s>e.height){const m=[];for(let x=0,S=(e.height-1)*e.width;x<Math.max(e.width,i);x++){const k=x>=e.width?!1:n.nodeAt(e.map[S+x]).type==u.header_cell;m.push(k?h||(h=u.header_cell.createAndFill()):f||(f=u.cell.createAndFill()))}const g=u.row.create(null,ue.from(m)),y=[];for(let x=e.height;x<s;x++)y.push(g);t.insert(t.mapping.slice(o).map(r+n.nodeSize-2),y)}return!!(f||h)}function vR(t,e,n,r,i,s,o,l){if(o==0||o==e.height)return!1;let u=!1;for(let f=i;f<s;f++){const h=o*e.width+f,m=e.map[h];if(e.map[h-e.width]==m){u=!0;const g=n.nodeAt(m),{top:y,left:x}=e.findCell(m);t.setNodeMarkup(t.mapping.slice(l).map(m+r),null,{...g.attrs,rowspan:o-y}),t.insert(t.mapping.slice(l).map(e.positionAt(o,x,n)),g.type.createAndFill({...g.attrs,rowspan:y+g.attrs.rowspan-o})),f+=g.attrs.colspan-1}}return u}function bR(t,e,n,r,i,s,o,l){if(o==0||o==e.width)return!1;let u=!1;for(let f=i;f<s;f++){const h=f*e.width+o,m=e.map[h];if(e.map[h-1]==m){u=!0;const g=n.nodeAt(m),y=e.colCount(m),x=t.mapping.slice(l).map(m+r);t.setNodeMarkup(x,null,Ba(g.attrs,o-y,g.attrs.colspan-(o-y))),t.insert(x+g.nodeSize,g.type.createAndFill(Ba(g.attrs,0,o-y))),f+=g.attrs.rowspan-1}}return u}function xR(t,e,n,r,i){let s=n?t.doc.nodeAt(n-1):t.doc;if(!s)throw new Error("No table found");let o=Gt.get(s);const{top:l,left:u}=r,f=u+i.width,h=l+i.height,m=t.tr;let g=0;function y(){if(s=n?m.doc.nodeAt(n-1):m.doc,!s)throw new Error("No table found");o=Gt.get(s),g=m.mapping.maps.length}OK(m,o,s,n,f,h,g)&&y(),vR(m,o,s,n,u,f,l,g)&&y(),vR(m,o,s,n,u,f,h,g)&&y(),bR(m,o,s,n,l,h,u,g)&&y(),bR(m,o,s,n,l,h,f,g)&&y();for(let x=l;x<h;x++){const S=o.positionAt(x,u,s),k=o.positionAt(x,f,s);m.replace(m.mapping.slice(g).map(S+n),m.mapping.slice(g).map(k+n),new Se(i.rows[x-l],0,0))}y(),m.setSelection(new Rt(m.doc.resolve(n+o.positionAt(l,u,s)),m.doc.resolve(n+o.positionAt(h-1,f-1,s)))),e(m)}const DK=qw({ArrowLeft:Ph("horiz",-1),ArrowRight:Ph("horiz",1),ArrowUp:Ph("vert",-1),ArrowDown:Ph("vert",1),"Shift-ArrowLeft":zh("horiz",-1),"Shift-ArrowRight":zh("horiz",1),"Shift-ArrowUp":zh("vert",-1),"Shift-ArrowDown":zh("vert",1),Backspace:jh,"Mod-Backspace":jh,Delete:jh,"Mod-Delete":jh});function lp(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function Ph(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;if(s instanceof Rt)return lp(n,r,Ue.near(s.$headCell,e));if(t!="horiz"&&!s.empty)return!1;const o=LL(i,t,e);if(o==null)return!1;if(t=="horiz")return lp(n,r,Ue.near(n.doc.resolve(s.head+e),e));{const l=n.doc.resolve(o),u=AL(l,t,e);let f;return u?f=Ue.near(u,1):e<0?f=Ue.near(n.doc.resolve(l.before(-1)),-1):f=Ue.near(n.doc.resolve(l.after(-1)),1),lp(n,r,f)}}}function zh(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;let o;if(s instanceof Rt)o=s;else{const u=LL(i,t,e);if(u==null)return!1;o=new Rt(n.doc.resolve(u))}const l=AL(o.$headCell,t,e);return l?lp(n,r,new Rt(o.$anchorCell,l)):!1}}function IK(t,e){const n=t.state.doc,r=$a(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new Rt(r))),!0):!1}function LK(t,e,n){if(!pi(t.state))return!1;let r=RK(n);const i=t.state.selection;if(i instanceof Rt){r||(r={width:1,height:1,rows:[ue.from(Sx(Un(t.state.schema).cell,n))]});const s=i.$anchorCell.node(-1),o=i.$anchorCell.start(-1),l=Gt.get(s).rectBetween(i.$anchorCell.pos-o,i.$headCell.pos-o);return r=NK(r,l.right-l.left,l.bottom-l.top),xR(t.state,t.dispatch,o,l,r),!0}else if(r){const s=sg(t.state),o=s.start(-1);return xR(t.state,t.dispatch,o,Gt.get(s.node(-1)).findCell(s.pos-o),r),!0}else return!1}function jK(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=wR(t,e.target);let i;if(e.shiftKey&&t.state.selection instanceof Rt)s(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=$a(t.state.selection.$anchor))!=null&&((n=jb(t,e))===null||n===void 0?void 0:n.pos)!=i.pos)s(i,e),e.preventDefault();else if(!r)return;function s(u,f){let h=jb(t,f);const m=po.getState(t.state)==null;if(!h||!TS(u,h))if(m)h=u;else return;const g=new Rt(u,h);if(m||!t.state.selection.eq(g)){const y=t.state.tr.setSelection(g);m&&y.setMeta(po,u.pos),t.dispatch(y)}}function o(){t.root.removeEventListener("mouseup",o),t.root.removeEventListener("dragstart",o),t.root.removeEventListener("mousemove",l),po.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(po,-1))}function l(u){const f=u,h=po.getState(t.state);let m;if(h!=null)m=t.state.doc.resolve(h);else if(wR(t,f.target)!=r&&(m=jb(t,e),!m))return o();m&&s(m,f)}t.root.addEventListener("mouseup",o),t.root.addEventListener("dragstart",o),t.root.addEventListener("mousemove",l)}function LL(t,e,n){if(!(t.state.selection instanceof Ie))return null;const{$head:r}=t.state.selection;for(let i=r.depth-1;i>=0;i--){const s=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const o=r.before(i),l=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(l)?o:null}}return null}function wR(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function jb(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&$a(t.state.doc.resolve(r))||$a(t.state.doc.resolve(i))}var PK=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")),kx(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,kx(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function kx(t,e,n,r,i,s){let o=0,l=!0,u=e.firstChild;const f=t.firstChild;if(f){for(let m=0,g=0;m<f.childCount;m++){const{colspan:y,colwidth:x}=f.child(m).attrs;for(let S=0;S<y;S++,g++){const k=i==g?s:x&&x[S],C=k?k+"px":"";if(o+=k||r,k||(l=!1),u)u.style.width!=C&&(u.style.width=C),u=u.nextSibling;else{const T=document.createElement("col");T.style.width=C,e.appendChild(T)}}}for(;u;){var h;const m=u.nextSibling;(h=u.parentNode)===null||h===void 0||h.removeChild(u),u=m}l?(n.style.width=o+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=o+"px")}}const Cr=new Wt("tableColumnResizing");function zK({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=PK,lastColumnResizable:i=!0}={}){const s=new Nt({key:Cr,state:{init(o,l){var u;const f=(u=s.spec)===null||u===void 0||(u=u.props)===null||u===void 0?void 0:u.nodeViews,h=Un(l.schema).table.name;return r&&f&&(f[h]=(m,g)=>new r(m,n,g)),new $K(-1,!1)},apply(o,l){return l.apply(o)}},props:{attributes:o=>{const l=Cr.getState(o);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,l)=>{BK(o,l,t,i)},mouseleave:o=>{VK(o)},mousedown:(o,l)=>{HK(o,l,e,n)}},decorations:o=>{const l=Cr.getState(o);if(l&&l.activeHandle>-1)return WK(o,l.activeHandle)},nodeViews:{}}});return s}var $K=class cp{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(Cr);if(r&&r.setHandle!=null)return new cp(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new cp(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return wx(e.doc.resolve(i))||(i=-1),new cp(i,n.dragging)}return n}};function BK(t,e,n,r){if(!t.editable)return;const i=Cr.getState(t.state);if(i&&!i.dragging){const s=FK(e.target);let o=-1;if(s){const{left:l,right:u}=s.getBoundingClientRect();e.clientX-l<=n?o=SR(t,e,"left",n):u-e.clientX<=n&&(o=SR(t,e,"right",n))}if(o!=i.activeHandle){if(!r&&o!==-1){const l=t.state.doc.resolve(o),u=l.node(-1),f=Gt.get(u),h=l.start(-1);if(f.colCount(l.pos-h)+l.nodeAfter.attrs.colspan-1==f.width-1)return}jL(t,o)}}}function VK(t){if(!t.editable)return;const e=Cr.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&jL(t,-1)}function HK(t,e,n,r){var i;if(!t.editable)return!1;const s=(i=t.dom.ownerDocument.defaultView)!==null&&i!==void 0?i:window,o=Cr.getState(t.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const l=t.state.doc.nodeAt(o.activeHandle),u=UK(t,o.activeHandle,l.attrs);t.dispatch(t.state.tr.setMeta(Cr,{setDragging:{startX:e.clientX,startWidth:u}}));function f(m){s.removeEventListener("mouseup",f),s.removeEventListener("mousemove",h);const g=Cr.getState(t.state);g?.dragging&&(qK(t,g.activeHandle,kR(g.dragging,m,n)),t.dispatch(t.state.tr.setMeta(Cr,{setDragging:null})))}function h(m){if(!m.which)return f(m);const g=Cr.getState(t.state);if(g&&g.dragging){const y=kR(g.dragging,m,n);CR(t,g.activeHandle,y,r)}}return CR(t,o.activeHandle,u,r),s.addEventListener("mouseup",f),s.addEventListener("mousemove",h),e.preventDefault(),!0}function UK(t,e,{colspan:n,colwidth:r}){const i=r&&r[r.length-1];if(i)return i;const s=t.domAtPos(e);let o=s.node.childNodes[s.offset].offsetWidth,l=n;if(r)for(let u=0;u<n;u++)r[u]&&(o-=r[u],l--);return o/l}function FK(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function SR(t,e,n,r){const i=n=="right"?-r:r,s=t.posAtCoords({left:e.clientX+i,top:e.clientY});if(!s)return-1;const{pos:o}=s,l=$a(t.state.doc.resolve(o));if(!l)return-1;if(n=="right")return l.pos;const u=Gt.get(l.node(-1)),f=l.start(-1),h=u.map.indexOf(l.pos-f);return h%u.width==0?-1:f+u.map[h-1]}function kR(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function jL(t,e){t.dispatch(t.state.tr.setMeta(Cr,{setHandle:e}))}function qK(t,e,n){const r=t.state.doc.resolve(e),i=r.node(-1),s=Gt.get(i),o=r.start(-1),l=s.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,u=t.state.tr;for(let f=0;f<s.height;f++){const h=f*s.width+l;if(f&&s.map[h]==s.map[h-s.width])continue;const m=s.map[h],g=i.nodeAt(m).attrs,y=g.colspan==1?0:l-s.colCount(m);if(g.colwidth&&g.colwidth[y]==n)continue;const x=g.colwidth?g.colwidth.slice():GK(g.colspan);x[y]=n,u.setNodeMarkup(o+m,null,{...g,colwidth:x})}u.docChanged&&t.dispatch(u)}function CR(t,e,n,r){const i=t.state.doc.resolve(e),s=i.node(-1),o=i.start(-1),l=Gt.get(s).colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1;let u=t.domAtPos(i.start(-1)).node;for(;u&&u.nodeName!="TABLE";)u=u.parentNode;u&&kx(s,u.firstChild,u,r,l,n)}function GK(t){return Array(t).fill(0)}function WK(t,e){const n=[],r=t.doc.resolve(e),i=r.node(-1);if(!i)return bt.empty;const s=Gt.get(i),o=r.start(-1),l=s.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;for(let f=0;f<s.height;f++){const h=l+f*s.width;if((l==s.width-1||s.map[h]!=s.map[h+1])&&(f==0||s.map[h]!=s.map[h-s.width])){var u;const m=s.map[h],g=o+m+i.nodeAt(m).nodeSize-1,y=document.createElement("div");y.className="column-resize-handle",!((u=Cr.getState(t))===null||u===void 0)&&u.dragging&&n.push(yn.node(o+m,o+m+i.nodeAt(m).nodeSize,{class:"column-resize-dragging"})),n.push(yn.widget(g,y))}}return bt.create(t.doc,n)}function KK({allowTableNodeSelection:t=!1}={}){return new Nt({key:po,state:{init(){return null},apply(e,n){const r=e.getMeta(po);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;const{deleted:i,pos:s}=e.mapping.mapResult(n);return i?null:s}},props:{decorations:aK,handleDOMEvents:{mousedown:jK},createSelectionBetween(e){return po.getState(e.state)!=null?e.state.selection:null},handleTripleClick:IK,handleKeyDown:DK,handlePaste:LK},appendTransaction(e,n,r){return uK(r,OL(r,n),t)}})}function km(t){return t==="left"||t==="right"||t==="center"?t:null}function ZK(t){const e=(t.style.textAlign||"").trim().toLowerCase(),n=(t.getAttribute("align")||"").trim().toLowerCase();return km(e||n)}function YK(t){return km(t?.align)}function PL(){return{default:null,parseHTML:t=>ZK(t),renderHTML:t=>t.align?{style:`text-align: ${t.align}`}:{}}}function XK(t){var e;const n=t.parentElement,r=t.closest("table");if(!n||!r)return null;const i=Array.from(n.children).indexOf(t),s=(e=r.querySelectorAll("colgroup > col")[i])==null?void 0:e.getAttribute("width");return s?[parseInt(s,10)]:null}function zL(t){const e=t.getAttribute("colwidth");return e?e.split(",").map(n=>parseInt(n,10)):XK(t)}var JK=/[ \t\r\n\f]+/g;function $L(t){var e;return t.children.length>0?!1:((e=t.textContent)!=null?e:"").replace(JK,"")===""}function BL(t){const e=t.createAndFill();if(!e)throw new Error(`[tiptap error]: "${t.name}" has no default content to backfill.`);return e.content}var QK=wn.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:zL},align:PL()}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td",getAttrs:t=>$L(t)?{}:!1,getContent:(t,e)=>BL(e.nodes[this.name])},{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",Mt(this.options.HTMLAttributes,t),0]}}),eZ=wn.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:zL},align:PL()}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th",getAttrs:t=>$L(t)?{}:!1,getContent:(t,e)=>BL(e.nodes[this.name])},{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",Mt(this.options.HTMLAttributes,t),0]}}),tZ=wn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",Mt(this.options.HTMLAttributes,t),0]}});function Cx(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function ER(t,e,n,r,i,s){var o;let l=0,u=!0,f=e.firstChild;const h=t.firstChild;if(h!==null)for(let g=0,y=0;g<h.childCount;g+=1){const{colspan:x,colwidth:S}=h.child(g).attrs;for(let k=0;k<x;k+=1,y+=1){const C=i===y?s:S&&S[k],T=C?`${C}px`:"";if(l+=C||r,C||(u=!1),f){if(f.style.width!==T){const[_,R]=Cx(r,C);f.style.setProperty(_,R)}f=f.nextSibling}else{const _=document.createElement("col"),[R,M]=Cx(r,C);_.style.setProperty(R,M),e.appendChild(_)}}}for(;f;){const g=f.nextSibling;(o=f.parentNode)==null||o.removeChild(f),f=g}const m=t.attrs.style&&typeof t.attrs.style=="string"&&/\bwidth\s*:/i.test(t.attrs.style);u&&!m?(n.style.width=`${l}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${l}px`)}var nZ=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[i,s]of Object.entries(r))s!=null&&(i==="style"?this.table.style.cssText=String(s):this.table.setAttribute(i,String(s)));t.attrs.style&&(this.table.style.cssText=t.attrs.style),this.colgroup=this.table.appendChild(document.createElement("colgroup")),ER(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,ER(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 rZ(t,e,n,r){let i=0,s=!0;const o=[],l=t.firstChild;if(!l)return{};for(let m=0,g=0;m<l.childCount;m+=1){const{colspan:y,colwidth:x}=l.child(m).attrs;for(let S=0;S<y;S+=1,g+=1){const k=n===g?r:x&&x[S];i+=k||e,k||(s=!1);const[C,T]=Cx(e,k);o.push(["col",{style:`${C}: ${T}`}])}}const u=s?`${i}px`:"",f=s?"":`${i}px`;return{colgroup:["colgroup",{},...o],tableWidth:u,tableMinWidth:f}}function TR(t,e){return t.createAndFill()}function iZ(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 sZ(t,e,n,r,i){const s=iZ(t),o=[],l=[];for(let f=0;f<n;f+=1){const h=TR(s.cell);if(h&&l.push(h),r){const m=TR(s.header_cell);m&&o.push(m)}}const u=[];for(let f=0;f<e;f+=1)u.push(s.row.createChecked(null,r&&f===0?o:l));return s.table.createChecked(null,u)}function oZ(t){return t instanceof Rt}var $h=({editor:t})=>{const{selection:e}=t.state;if(!oZ(e))return!1;let n=0;const r=eI(e.ranges[0].$from,s=>s.type.name==="table");return r?.node.descendants(s=>{if(s.type.name==="table")return!1;["tableCell","tableHeader"].includes(s.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},aZ="";function lZ(t){let e="",n=0;for(;n<t.length;){if(t[n]==="\\"&&n+1<t.length){e+=t[n]+t[n+1],n+=2;continue}if(t[n]!=="`"){e+=t[n++];continue}let r=0;for(;n+r<t.length&&t[n+r]==="`";)r+=1;let i=n+r,s=!1;for(;i<t.length;){if(t[i]!=="`"){i+=1;continue}let o=0;for(;i+o<t.length&&t[i+o]==="`";)o+=1;if(o===r){const l=t.slice(n+r,i);e+=t.slice(n,n+r)+l.replace(new RegExp("(?<!\\\\)\\|","g"),"\\|")+t.slice(i,i+r),n=i+r,s=!0;break}i+=o}s||(e+=t.slice(n,n+r),n+=r)}return e}function cZ(t){return t.split(`
|
|
273
|
-
`).map(e=>!e.includes("|")||!e.includes("`")?e:lZ(e)).join(`
|
|
274
|
-
`)}function uZ(t){return(t||"").replace(/\s+/g," ").trim()}function dZ(t,e,n={}){var r;const i=(r=n.cellLineSeparator)!=null?r:aZ;if(!t||!t.content||t.content.length===0)return"";const s=[];t.content.forEach(S=>{const k=[];S.content&&S.content.forEach(C=>{let T="";C.content&&Array.isArray(C.content)&&C.content.length>1?T=C.content.map(L=>e.renderChildren(L)).join(i):T=C.content?e.renderChildren(C.content):"";const _=uZ(T.split(i).join(`
|
|
275
|
-
`).replace(/[ \t]*\r?\n[ \t]*/g,"<br>")),R=C.type==="tableHeader",M=YK(C.attrs);k.push({text:_,isHeader:R,align:M})}),s.push(k)});const o=s.reduce((S,k)=>Math.max(S,k.length),0);if(o===0)return"";const l=Array.from({length:o}).fill(0);s.forEach(S=>{var k;for(let C=0;C<o;C+=1){const _=(((k=S[C])==null?void 0:k.text)||"").length;_>l[C]&&(l[C]=_),l[C]<3&&(l[C]=3)}});const u=(S,k)=>S+" ".repeat(Math.max(0,k-S.length)),f=s[0],h=f.some(S=>S.isHeader),m=Array.from({length:o}).fill(null);s.forEach(S=>{var k;for(let C=0;C<o;C+=1)!m[C]&&((k=S[C])!=null&&k.align)&&(m[C]=S[C].align)});let g=`
|
|
276
|
-
`;const y=Array.from({length:o}).map((S,k)=>h&&f[k]&&f[k].text||"");return g+=`| ${y.map((S,k)=>u(S,l[k])).join(" | ")} |
|
|
277
|
-
`,g+=`| ${l.map((S,k)=>{const C=Math.max(3,S),T=m[k];return T==="left"?`:${"-".repeat(C)}`:T==="right"?`${"-".repeat(C)}:`:T==="center"?`:${"-".repeat(C)}:`:"-".repeat(C)}).join(" | ")} |
|
|
278
|
-
`,(h?s.slice(1):s).forEach(S=>{g+=`| ${Array.from({length:o}).fill(0).map((k,C)=>u(S[C]&&S[C].text||"",l[C])).join(" | ")} |
|
|
279
|
-
`}),g}var fZ=dZ,hZ=wn.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:nZ,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:i}=rZ(t,this.options.cellMinWidth),s=e.style;function o(){return s||(r?`width: ${r}`:`min-width: ${i}`)}const l=["table",Mt(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 i=[];t.header.forEach((s,o)=>{var l;const u=km((l=r[o])!=null?l:s.align),f=u?{align:u}:{};i.push(e.createNode("tableHeader",f,[{type:"paragraph",content:e.parseInline(s.tokens)}]))}),n.push(e.createNode("tableRow",{},i))}return t.rows&&t.rows.forEach(i=>{const s=[];i.forEach((o,l)=>{var u;const f=km((u=r[l])!=null?u:o.align),h=f?{align:f}:{};s.push(e.createNode("tableCell",h,[{type:"paragraph",content:e.parseInline(o.tokens)}]))}),n.push(e.createNode("tableRow",{},s))}),e.createNode("table",void 0,n)},renderMarkdown:(t,e)=>fZ(t,e),markdownTokenizer:{name:"table",level:"block",start:t=>{const e=t.split(`
|
|
280
|
-
`);if(e.length<2)return-1;const n=e[1];return!/^[ \t|:]*-[ \t|:-]*$/.test(n)||!n.includes("|")?-1:e[0].includes("|")?0:-1},tokenize(t,e,n){const r=t.indexOf(`
|
|
281
|
-
|
|
282
|
-
`),i=r>=0?t.slice(0,r):t,s=i.split(`
|
|
283
|
-
`);if(s.length<2)return;const o=s[1];if(!/^[ \t|:]*-[ \t|:-]*$/.test(o)||!o.includes("|"))return;const l=cZ(i);if(l===i)return;const f=n.blockTokens(l)[0];if(f?.type!=="table"||!f.raw)return;const h=f.raw.split(`
|
|
284
|
-
`).length,m=t.split(`
|
|
285
|
-
`).slice(0,h).join(`
|
|
286
|
-
`);return{...f,raw:m}}},addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:s})=>{const o=sZ(s.schema,t,e,n);if(i){const l=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(Ie.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>hK(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>pK(t,e),deleteColumn:()=>({state:t,dispatch:e})=>gK(t,e),addRowBefore:()=>({state:t,dispatch:e})=>vK(t,e),addRowAfter:()=>({state:t,dispatch:e})=>bK(t,e),deleteRow:()=>({state:t,dispatch:e})=>wK(t,e),deleteTable:()=>({state:t,dispatch:e})=>AK(t,e),mergeCells:()=>({state:t,dispatch:e})=>pR(t,e),splitCell:()=>({state:t,dispatch:e})=>mR(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>Md("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>Md("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>TK(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>pR(t,e)?!0:mR(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>CK(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>yR(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>yR(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&OL(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=Rt.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:$h,"Mod-Backspace":$h,Delete:$h,"Mod-Delete":$h}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[zK({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],KK({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:i})=>{const s=Mt(this.options.HTMLAttributes,i);return new e(n,this.options.cellMinWidth,r,s)}},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:ut(Re(t,"tableRole",e))}}}),pZ=Pt.create({name:"tableKit",addExtensions(){const t=[];return this.options.table!==!1&&t.push(hZ.configure(this.options.table)),this.options.tableCell!==!1&&t.push(QK.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(eZ.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(tZ.configure(this.options.tableRow)),t}});function mZ({recordImages:t=[],galleryUpload:e,onListGallery:n,onUploadGallery:r,onClose:i,onInsert:s}){const o=!!n,[l,u]=A.useState(t.length?"record":"gallery"),[f,h]=A.useState([]),[m,g]=A.useState(!1),[y,x]=A.useState(null),[S,k]=A.useState({}),[C,T]=A.useState("");A.useEffect(()=>{const G=K=>{K.key==="Escape"&&i()};window.addEventListener("keydown",G);const oe=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{window.removeEventListener("keydown",G),document.body.style.overflow=oe}},[i]),A.useEffect(()=>{if(!o)return;let G=!1;return g(!0),x(null),n().then(oe=>{G||h(oe)}).catch(oe=>{G||x(oe instanceof Error?oe.message:"Could not load gallery")}).finally(()=>{G||g(!1)}),()=>{G=!0}},[o,n]);const _=A.useMemo(()=>t.map(G=>({id:`record:${G.id}`,url:G.url,name:G.name,source:"record"})),[t]),R=A.useMemo(()=>f.map(G=>({id:`gallery:${G.id}`,url:G.url,name:G.name??G.id,source:"gallery"})),[f]),M=l==="record"?_:R,O=Object.values(S),L=!!(e&&r),P=G=>{k(oe=>{const K={...oe};return K[G.id]?delete K[G.id]:K[G.id]=G,K})},U=()=>{const G=C.trim();if(!G)return;const oe={id:`url:${G}`,url:G,name:"Image",source:"url"};k(K=>({...K,[oe.id]:oe})),T("")};return b.jsx("div",{className:"vertebr-modal-backdrop",role:"presentation",onClick:i,children:b.jsxs("div",{className:"vertebr-modal",role:"dialog","aria-modal":"true","aria-label":"Insert images",onClick:G=>G.stopPropagation(),children:[b.jsxs("header",{className:"vertebr-modal-head",children:[b.jsxs("div",{className:"vertebr-modal-heading",children:[b.jsx("p",{className:"vertebr-modal-eyebrow",children:"Media"}),b.jsx("h2",{children:"Insert images"})]}),b.jsx("button",{type:"button",className:"vertebr-btn",onClick:i,children:"Close"})]}),b.jsxs("div",{className:"vertebr-modal-body vertebr-picker-body",children:[t.length>0&&o?b.jsxs("div",{className:"vertebr-picker-tabs",role:"tablist",children:[b.jsxs("button",{type:"button",role:"tab","aria-selected":l==="record","data-active":l==="record"||void 0,onClick:()=>u("record"),children:["Product photos",b.jsx("span",{children:_.length})]}),b.jsxs("button",{type:"button",role:"tab","aria-selected":l==="gallery","data-active":l==="gallery"||void 0,onClick:()=>u("gallery"),children:["Gallery",b.jsx("span",{children:m?"…":R.length})]})]}):null,l==="gallery"&&L?b.jsx(Fd,{meta:{field:"gallery",accept:e.accept,maxBytes:e.maxBytes},multiple:!0,label:"Drop images to add them to the gallery",onUpload:async G=>{const oe=await r(G);h(K=>[...oe,...K]),k(K=>{const ne={...K};for(const re of oe){const me={id:`gallery:${re.id}`,url:re.url,name:re.name??re.id,source:"gallery"};ne[me.id]=me}return ne})}}):null,b.jsxs("label",{className:"vertebr-field",children:[b.jsx("span",{children:"Or paste an image URL"}),b.jsxs("div",{className:"vertebr-picker-url",children:[b.jsx("input",{type:"url",value:C,placeholder:"https://",onChange:G=>T(G.target.value),onKeyDown:G=>{G.key==="Enter"&&(G.preventDefault(),U())}}),b.jsx("button",{type:"button",className:"vertebr-btn",disabled:!C.trim(),onClick:U,children:"Add"})]})]}),y?b.jsx("p",{className:"vertebr-status","data-tone":"danger",children:y}):null,m&&l==="gallery"?b.jsx("div",{className:"vertebr-empty",children:"Loading gallery…"}):M.length===0?b.jsx("div",{className:"vertebr-empty",children:l==="record"?"No product photos on this record yet.":o?"No images in the gallery yet.":"No gallery is configured. Paste a URL or add product photos."}):b.jsx("div",{className:"vertebr-picker-grid",children:M.map(G=>{const oe=!!S[G.id];return b.jsxs("button",{type:"button",className:"vertebr-picker-tile","data-selected":oe||void 0,onClick:()=>P(G),children:[b.jsx("span",{className:"vertebr-picker-thumb",children:b.jsx("img",{src:G.url,alt:""})}),b.jsx("span",{className:"vertebr-picker-name",children:G.name})]},G.id)})})]}),b.jsxs("footer",{className:"vertebr-picker-foot",children:[b.jsxs("span",{className:"vertebr-picker-count",children:[O.length," selected"]}),b.jsxs("button",{type:"button",className:"vertebr-btn vertebr-btn-primary",disabled:O.length===0,onClick:()=>s(O),children:["Insert ",O.length||"",O.length===1?" image":" images"]})]})]})})}function _R(t,e){t&&(typeof t=="function"?t(e):t.current=e)}function Wn({active:t,disabled:e,title:n,onClick:r,children:i}){return b.jsx("button",{type:"button",className:"vertebr-md-btn","data-active":t||void 0,disabled:e,title:n,onMouseDown:s=>s.preventDefault(),onClick:r,children:i})}function gZ({id:t,name:e,value:n,readOnly:r,placeholder:i="Write a description…",recordImages:s,galleryUpload:o,onListGallery:l,onUploadGallery:u,onBlur:f,onChange:h,inputRef:m}){const g=typeof n=="string"?n:"",y=A.useRef(h),x=A.useRef(f),S=A.useRef(g),[k,C]=A.useState(!1);y.current=h,x.current=f;const T=b8({immediatelyRender:!1,shouldRerenderOnTransaction:!1,content:g,contentType:"markdown",editable:!r,extensions:[GW.configure({heading:{levels:[2,3]},underline:!1,link:{openOnClick:!1,defaultProtocol:"https"}}),X7.configure({inline:!1,allowBase64:!1}),pZ.configure({table:{resizable:!1}}),zW.configure({placeholder:i}),K7.configure({markedOptions:{gfm:!0}})],editorProps:{attributes:{id:t,class:"vertebr-md-content"}},onUpdate:({editor:P})=>{const U=P.getMarkdown();S.current=U,y.current(U)},onBlur:()=>{x.current?.()}});A.useEffect(()=>{if(T)return _R(m,T.view.dom),()=>_R(m,null)},[T,m]),A.useEffect(()=>{T&&T.setEditable(!r)},[T,r]),A.useEffect(()=>{if(T&&g!==S.current){if(g===T.getMarkdown()){S.current=g;return}T.commands.setContent(g,{contentType:"markdown",emitUpdate:!1}),S.current=g}},[T,g]);const _=NI({editor:T,selector:({editor:P})=>({bold:P?.isActive("bold")??!1,italic:P?.isActive("italic")??!1,strike:P?.isActive("strike")??!1,code:P?.isActive("code")??!1,codeBlock:P?.isActive("codeBlock")??!1,heading:P?.isActive("heading")??!1,quote:P?.isActive("blockquote")??!1,bullet:P?.isActive("bulletList")??!1,ordered:P?.isActive("orderedList")??!1,table:P?.isActive("table")??!1,link:P?.isActive("link")??!1,stats:x_(P?.getText()??g)})}),R=_?.stats??x_(g),M=r||!T,O=()=>{if(!T||r)return;const P=T.getAttributes("link").href,U=window.prompt("Link URL",typeof P=="string"&&P?P:"https://");if(U!==null){if(!U.trim()){T.chain().focus().extendMarkRange("link").unsetLink().run();return}T.chain().focus().extendMarkRange("link").setLink({href:U.trim()}).run()}},L=P=>{!T||P.length===0||(T.chain().focus().insertContent(P.map(U=>({type:"image",attrs:{src:U.url,alt:U.name}}))).run(),C(!1))};return b.jsxs("div",{className:"vertebr-field-prose",onKeyDown:P=>{(P.metaKey||P.ctrlKey)&&P.key.toLowerCase()==="k"&&(P.preventDefault(),O())},children:[e?b.jsx("input",{type:"hidden",name:e,value:g,readOnly:!0}):null,b.jsxs("div",{className:"vertebr-md-toolbar",role:"toolbar","aria-label":"Format",children:[b.jsx(Wn,{active:_?.bold,disabled:M,title:"Bold",onClick:()=>T?.chain().focus().toggleBold().run(),children:b.jsx("span",{className:"vertebr-md-glyph",children:"B"})}),b.jsx(Wn,{active:_?.italic,disabled:M,title:"Italic",onClick:()=>T?.chain().focus().toggleItalic().run(),children:b.jsx("span",{className:"vertebr-md-glyph vertebr-md-italic",children:"I"})}),b.jsx(Wn,{active:_?.strike,disabled:M,title:"Strikethrough",onClick:()=>T?.chain().focus().toggleStrike().run(),children:b.jsx("span",{className:"vertebr-md-glyph vertebr-md-strike",children:"S"})}),b.jsx(Wn,{active:_?.code,disabled:M,title:"Inline code",onClick:()=>T?.chain().focus().toggleCode().run(),children:"</>"}),b.jsx(Wn,{active:_?.codeBlock,disabled:M,title:"Code block",onClick:()=>T?.chain().focus().toggleCodeBlock().run(),children:"{ }"}),b.jsx("span",{className:"vertebr-md-sep","aria-hidden":"true"}),b.jsx(Wn,{active:_?.heading,disabled:M,title:"Heading",onClick:()=>T?.chain().focus().toggleHeading({level:2}).run(),children:"H"}),b.jsx(Wn,{active:_?.quote,disabled:M,title:"Quote",onClick:()=>T?.chain().focus().toggleBlockquote().run(),children:"“"}),b.jsx(Wn,{active:_?.bullet,disabled:M,title:"Bulleted list",onClick:()=>T?.chain().focus().toggleBulletList().run(),children:"•"}),b.jsx(Wn,{active:_?.ordered,disabled:M,title:"Numbered list",onClick:()=>T?.chain().focus().toggleOrderedList().run(),children:"1."}),b.jsx("span",{className:"vertebr-md-sep","aria-hidden":"true"}),b.jsx(Wn,{active:_?.table,disabled:M,title:"Table",onClick:()=>T?.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),children:"Table"}),_?.table?b.jsxs(b.Fragment,{children:[b.jsx(Wn,{disabled:M,title:"Add column",onClick:()=>T?.chain().focus().addColumnAfter().run(),children:"+Col"}),b.jsx(Wn,{disabled:M,title:"Add row",onClick:()=>T?.chain().focus().addRowAfter().run(),children:"+Row"}),b.jsx(Wn,{disabled:M,title:"Delete table",onClick:()=>T?.chain().focus().deleteTable().run(),children:"Del"})]}):null,b.jsx(Wn,{active:_?.link,disabled:M,title:"Link",onClick:O,children:"Link"}),b.jsx(Wn,{disabled:M,title:"Insert images",onClick:()=>C(!0),children:"Image"})]}),b.jsx(MI,{editor:T}),b.jsxs("p",{className:"vertebr-field-prose-meta",children:["Markdown",b.jsx("span",{"aria-hidden":"true",children:" · "}),R.words," ",R.words===1?"word":"words",b.jsx("span",{"aria-hidden":"true",children:" · "}),R.characters," ",R.characters===1?"character":"characters"]}),k?b.jsx(mZ,{recordImages:s,galleryUpload:o,onListGallery:l,onUploadGallery:u,onClose:()=>C(!1),onInsert:L}):null]})}var yZ=Object.defineProperty,vZ=(t,e)=>yZ(t,"name",{value:e,configurable:!0});function Ex(t,[e,n]){return Math.min(n,Math.max(e,t))}vZ(Ex,"clamp");var bZ=Object.defineProperty,gn=(t,e)=>bZ(t,"name",{value:e,configurable:!0});function VL(t){const e=t+"CollectionProvider",[n,r]=Ac(e),[i,s]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=gn(S=>{const{scope:k,children:C}=S,T=A.useRef(null),_=A.useRef(new Map).current;return b.jsx(i,{scope:k,itemMap:_,collectionRef:T,children:C})},"CollectionProvider");o.displayName=e;const l=t+"CollectionSlot",u=Da(l),f=A.forwardRef((S,k)=>{const{scope:C,children:T}=S,_=s(l,C),R=Xt(k,_.collectionRef);return b.jsx(u,{ref:R,children:T})});f.displayName=l;const h=t+"CollectionItemSlot",m="data-radix-collection-item",g=Da(h),y=A.forwardRef((S,k)=>{const{scope:C,children:T,..._}=S,R=A.useRef(null),M=Xt(k,R),O=s(h,C);return A.useEffect(()=>(O.itemMap.set(R,{ref:R,..._}),()=>{O.itemMap.delete(R)})),b.jsx(g,{[m]:"",ref:M,children:T})});y.displayName=h;function x(S){const k=s(t+"CollectionConsumer",S);return A.useCallback(()=>{const T=k.collectionRef.current;if(!T)return[];const _=Array.from(T.querySelectorAll(`[${m}]`));return Array.from(k.itemMap.values()).sort((O,L)=>_.indexOf(O.ref.current)-_.indexOf(L.ref.current))},[k.collectionRef,k.itemMap])}return gn(x,"useCollection"),[{Provider:o,Slot:f,ItemSlot:y},x,r]}gn(VL,"createCollection");var AR=new WeakMap,rn,xr,Pb=(xr=class extends Map{constructor(n){super(n);WE(this,rn);zv(this,rn,[...super.keys()]),AR.set(this,!0)}set(n,r){return AR.get(this)&&(this.has(n)?Pn(this,rn)[Pn(this,rn).indexOf(n)]=n:Pn(this,rn).push(n)),super.set(n,r),this}insert(n,r,i){const s=this.has(r),o=Pn(this,rn).length,l=_S(n);let u=l>=0?l:o+l;const f=u<0||u>=o?-1:u;if(f===this.size||s&&f===this.size-1||f===-1)return this.set(r,i),this;const h=this.size+(s?0:1);l<0&&u++;const m=[...Pn(this,rn)];let g,y=!1;for(let x=u;x<h;x++)if(u===x){let S=m[x];m[x]===r&&(S=m[x+1]),s&&this.delete(r),g=this.get(S),this.set(r,i)}else{!y&&m[x-1]===r&&(y=!0);const S=m[y?x:x-1],k=g;g=this.get(S),this.delete(S),this.set(S,k)}return this}with(n,r,i){const s=new xr(this);return s.insert(n,r,i),s}before(n){const r=Pn(this,rn).indexOf(n)-1;if(!(r<0))return this.entryAt(r)}setBefore(n,r,i){const s=Pn(this,rn).indexOf(n);return s===-1?this:this.insert(s,r,i)}after(n){let r=Pn(this,rn).indexOf(n);if(r=r===-1||r===this.size-1?-1:r+1,r!==-1)return this.entryAt(r)}setAfter(n,r,i){const s=Pn(this,rn).indexOf(n);return s===-1?this:this.insert(s+1,r,i)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return zv(this,rn,[]),super.clear()}delete(n){const r=super.delete(n);return r&&Pn(this,rn).splice(Pn(this,rn).indexOf(n),1),r}deleteAt(n){const r=this.keyAt(n);return r!==void 0?this.delete(r):!1}at(n){const r=up(Pn(this,rn),n);if(r!==void 0)return this.get(r)}entryAt(n){const r=up(Pn(this,rn),n);if(r!==void 0)return[r,this.get(r)]}indexOf(n){return Pn(this,rn).indexOf(n)}keyAt(n){return up(Pn(this,rn),n)}from(n,r){const i=this.indexOf(n);if(i===-1)return;let s=i+r;return s<0&&(s=0),s>=this.size&&(s=this.size-1),this.at(s)}keyFrom(n,r){const i=this.indexOf(n);if(i===-1)return;let s=i+r;return s<0&&(s=0),s>=this.size&&(s=this.size-1),this.keyAt(s)}find(n,r){let i=0;for(const s of this){if(Reflect.apply(n,r,[s,i,this]))return s;i++}}findIndex(n,r){let i=0;for(const s of this){if(Reflect.apply(n,r,[s,i,this]))return i;i++}return-1}filter(n,r){const i=[];let s=0;for(const o of this)Reflect.apply(n,r,[o,s,this])&&i.push(o),s++;return new xr(i)}map(n,r){const i=[];let s=0;for(const o of this)i.push([o[0],Reflect.apply(n,r,[o,s,this])]),s++;return new xr(i)}reduce(...n){const[r,i]=n;let s=0,o=i??this.at(0);for(const l of this)s===0&&n.length===1?o=l:o=Reflect.apply(r,this,[o,l,s,this]),s++;return o}reduceRight(...n){const[r,i]=n;let s=i??this.at(-1);for(let o=this.size-1;o>=0;o--){const l=this.at(o);o===this.size-1&&n.length===1?s=l:s=Reflect.apply(r,this,[s,l,o,this])}return s}toSorted(n){const r=[...this.entries()].sort(n);return new xr(r)}toReversed(){const n=new xr;for(let r=this.size-1;r>=0;r--){const i=this.keyAt(r),s=this.get(i);n.set(i,s)}return n}toSpliced(...n){const r=[...this.entries()];return r.splice(...n),new xr(r)}slice(n,r){const i=new xr;let s=this.size-1;if(n===void 0)return i;n<0&&(n=n+this.size),r!==void 0&&r>0&&(s=r-1);for(let o=n;o<=s;o++){const l=this.keyAt(o),u=this.get(l);i.set(l,u)}return i}every(n,r){let i=0;for(const s of this){if(!Reflect.apply(n,r,[s,i,this]))return!1;i++}return!0}some(n,r){let i=0;for(const s of this){if(Reflect.apply(n,r,[s,i,this]))return!0;i++}return!1}},rn=new WeakMap,gn(xr,"OrderedDict"),xr);function up(t,e){if("at"in Array.prototype)return Array.prototype.at.call(t,e);const n=HL(t,e);return n===-1?void 0:t[n]}gn(up,"at");function HL(t,e){const n=t.length,r=_S(e),i=r>=0?r:n+r;return i<0||i>=n?-1:i}gn(HL,"toSafeIndex");function _S(t){return t!==t||t===0?0:Math.trunc(t)}gn(_S,"toSafeInteger");function xZ(t){const e=t+"CollectionProvider",[n,r]=Ac(e),[i,s]=n(e,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new Pb,setItemMap:gn(()=>{},"setItemMap")}),o=gn(({state:_,...R})=>_?b.jsx(u,{...R,state:_}):b.jsx(l,{...R}),"CollectionProvider");o.displayName=e;const l=gn(_=>{const R=k();return b.jsx(u,{..._,state:R})},"CollectionInit");l.displayName=e+"Init";const u=gn(_=>{const{scope:R,children:M,state:O}=_,L=A.useRef(null),[P,U]=A.useState(null),G=Xt(L,U),[oe,K]=O;return A.useEffect(()=>{if(!P)return;const ne=qL(()=>{});return ne.observe(P,{childList:!0,subtree:!0}),()=>{ne.disconnect()}},[P]),b.jsx(i,{scope:R,itemMap:oe,setItemMap:K,collectionRef:G,collectionRefObject:L,collectionElement:P,children:M})},"CollectionProviderImpl");u.displayName=e+"Impl";const f=t+"CollectionSlot",h=Da(f),m=A.forwardRef((_,R)=>{const{scope:M,children:O}=_,L=s(f,M),P=Xt(R,L.collectionRef);return b.jsx(h,{ref:P,children:O})});m.displayName=f;const g=t+"CollectionItemSlot",y="data-radix-collection-item",x=Da(g),S=A.forwardRef((_,R)=>{const{scope:M,children:O,...L}=_,P=A.useRef(null),[U,G]=A.useState(null),oe=Xt(R,P,G),K=s(g,M),{setItemMap:ne}=K,re=A.useRef(L);UL(re.current,L)||(re.current=L);const me=re.current;return A.useEffect(()=>{const B=me;return ne(z=>U?z.has(U)?z.set(U,{...B,element:U}).toSorted(Tx):(z.set(U,{...B,element:U}),z.toSorted(Tx)):z),()=>{ne(z=>!U||!z.has(U)?z:(z.delete(U),new Pb(z)))}},[U,me,ne]),b.jsx(x,{[y]:"",ref:oe,children:O})});S.displayName=g;function k(){return A.useState(new Pb)}gn(k,"useInitCollection");function C(_){const{itemMap:R}=s(t+"CollectionConsumer",_);return R}return gn(C,"useCollection"),[{Provider:o,Slot:m,ItemSlot:S},{createCollectionScope:r,useCollection:C,useInitCollection:k}]}gn(xZ,"createCollection");function UL(t,e){if(t===e)return!0;if(typeof t!="object"||typeof e!="object"||t==null||e==null)return!1;const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(const i of n)if(!Object.prototype.hasOwnProperty.call(e,i)||t[i]!==e[i])return!1;return!0}gn(UL,"shallowEqual");function FL(t,e){return!!(e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_PRECEDING)}gn(FL,"isElementPreceding");function Tx(t,e){return!t[1].element||!e[1].element?0:FL(t[1].element,e[1].element)?-1:1}gn(Tx,"sortByDocumentPosition");function qL(t){return new MutationObserver(n=>{for(const r of n)if(r.type==="childList"){t();return}})}gn(qL,"getChildListObserver");var wZ=Object.defineProperty,SZ=(t,e)=>wZ(t,"name",{value:e,configurable:!0}),kZ=A.createContext(void 0);function GL(t){const e=A.useContext(kZ);return t||e||"ltr"}SZ(GL,"useDirection");var CZ=Object.defineProperty,EZ=(t,e)=>CZ(t,"name",{value:e,configurable:!0});function Ni(t){const e=A.useRef(t);return A.useEffect(()=>{e.current=t}),A.useMemo(()=>((...n)=>e.current?.(...n)),[])}EZ(Ni,"useCallbackRef");var TZ=Object.defineProperty,mn=(t,e)=>TZ(t,"name",{value:e,configurable:!0}),_x="dismissableLayer.update",_Z="dismissableLayer.pointerDownOutside",AZ="dismissableLayer.focusOutside",RR,WL=A.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),RZ=A.forwardRef(mn(function(e,n){const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:i=!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:l,onInteractOutside:u,onDismiss:f,...h}=e,m=A.useContext(WL),[g,y]=A.useState(null),x=g?.ownerDocument??globalThis?.document,[,S]=A.useState({}),k=Xt(n,y),C=Array.from(m.layers),[T]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),_=T?C.indexOf(T):-1,R=g?C.indexOf(g):-1,M=m.layersWithOutsidePointerEventsDisabled.size>0,O=R>=_,L=A.useRef(!1),P=KL(K=>{o?.(K),u?.(K),K.defaultPrevented||f?.()},{ownerDocument:x,deferPointerDownOutside:i,isDeferredPointerDownOutsideRef:L,dismissableSurfaces:m.dismissableSurfaces,shouldHandlePointerDownOutside:A.useCallback(K=>{if(!(K instanceof Node))return!1;const ne=[...m.branches].some(re=>re.contains(K));return O&&!ne},[m.branches,O])}),U=ZL(K=>{if(i&&L.current)return;const ne=K.target;[...m.branches].some(me=>me.contains(ne))||(l?.(K),u?.(K),K.defaultPrevented||f?.())},x),G=g?R===C.length-1:!1,oe=Ni(K=>{K.key==="Escape"&&(s?.(K),!K.defaultPrevented&&f&&(K.preventDefault(),f()))});return A.useEffect(()=>{if(G)return x.addEventListener("keydown",oe,{capture:!0}),()=>x.removeEventListener("keydown",oe,{capture:!0})},[x,G,oe]),A.useEffect(()=>{if(g)return r&&(m.layersWithOutsidePointerEventsDisabled.size===0&&(RR=x.body.style.pointerEvents,x.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(g)),m.layers.add(g),Ax(),()=>{r&&(m.layersWithOutsidePointerEventsDisabled.delete(g),m.layersWithOutsidePointerEventsDisabled.size===0&&(x.body.style.pointerEvents=RR))}},[g,x,r,m]),A.useEffect(()=>()=>{g&&(m.layers.delete(g),m.layersWithOutsidePointerEventsDisabled.delete(g),Ax())},[g,m]),A.useEffect(()=>{const K=mn(()=>S({}),"handleUpdate");return document.addEventListener(_x,K),()=>document.removeEventListener(_x,K)},[]),b.jsx(xn.div,{...h,ref:k,style:{pointerEvents:M?O?"auto":"none":void 0,...e.style},onFocusCapture:on(e.onFocusCapture,U.onFocusCapture),onBlurCapture:on(e.onBlurCapture,U.onBlurCapture),onPointerDownCapture:on(e.onPointerDownCapture,P.onPointerDownCapture)})},"DismissableLayer"));function MZ(){const t=A.useContext(WL),[e,n]=A.useState(null);return A.useEffect(()=>{if(e)return t.dismissableSurfaces.add(e),()=>{t.dismissableSurfaces.delete(e)}},[e,t.dismissableSurfaces]),n}mn(MZ,"useDismissableLayerSurface");var NZ=mn(()=>!0,"IS_TRUE");function KL(t,e){const{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:s,shouldHandlePointerDownOutside:o=NZ}=e,l=Ni(t),u=A.useRef(!1),f=A.useRef(!1),h=A.useRef(new Map),m=A.useRef(()=>{});return A.useEffect(()=>{function g(){f.current=!1,i.current=!1,h.current.clear()}mn(g,"resetOutsideInteraction");function y(){return Array.from(h.current.values()).some(Boolean)}mn(y,"isOutsideInteractionIntercepted");function x(_){if(!f.current)return;const R=_.target;R instanceof Node&&[...s].some(O=>O.contains(R))||h.current.set(_.type,!0),_.type==="click"&&window.setTimeout(()=>{f.current&&m.current()},0)}mn(x,"handleInteractionCapture");function S(_){f.current&&h.current.set(_.type,!1)}mn(S,"handleInteractionBubble");const k=mn(_=>{if(_.target&&!u.current){let R=function(){n.removeEventListener("click",m.current);const O=y();g(),O||AS(_Z,l,M,{discrete:!0})};if(mn(R,"handleAndDispatchPointerDownOutsideEvent"),!o(_.target)){n.removeEventListener("click",m.current),g(),u.current=!1;return}const M={originalEvent:_};f.current=!0,i.current=r&&_.button===0,h.current.clear(),!r||_.button!==0?R():(n.removeEventListener("click",m.current),m.current=R,n.addEventListener("click",m.current,{once:!0}))}else n.removeEventListener("click",m.current),g();u.current=!1},"handlePointerDown"),C=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const _ of C)n.addEventListener(_,x,!0),n.addEventListener(_,S);const T=window.setTimeout(()=>{n.addEventListener("pointerdown",k)},0);return()=>{window.clearTimeout(T),n.removeEventListener("pointerdown",k),n.removeEventListener("click",m.current);for(const _ of C)n.removeEventListener(_,x,!0),n.removeEventListener(_,S)}},[n,l,r,i,s,o]),{onPointerDownCapture:mn(()=>u.current=!0,"onPointerDownCapture")}}mn(KL,"usePointerDownOutside");function ZL(t,e=globalThis?.document){const n=Ni(t),r=A.useRef(!1);return A.useEffect(()=>{const i=mn(s=>{s.target&&!r.current&&AS(AZ,n,{originalEvent:s},{discrete:!1})},"handleFocus");return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,n]),{onFocusCapture:mn(()=>r.current=!0,"onFocusCapture"),onBlurCapture:mn(()=>r.current=!1,"onBlurCapture")}}mn(ZL,"useFocusOutside");function Ax(){const t=new CustomEvent(_x);document.dispatchEvent(t)}mn(Ax,"dispatchUpdate");function AS(t,e,n,{discrete:r}){const i=n.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&i.addEventListener(t,e,{once:!0}),r?QN(i,s):i.dispatchEvent(s)}mn(AS,"handleAndDispatchCustomEvent");var OZ=Object.defineProperty,RS=(t,e)=>OZ(t,"name",{value:e,configurable:!0}),Bh=0,Bl=null;function DZ(t){return MS(),t.children}RS(DZ,"FocusGuards");function MS(){A.useEffect(()=>{Bl||(Bl={start:Rx(),end:Rx()});const{start:t,end:e}=Bl;return document.body.firstElementChild!==t&&document.body.insertAdjacentElement("afterbegin",t),document.body.lastElementChild!==e&&document.body.insertAdjacentElement("beforeend",e),Bh++,()=>{Bh===1&&(Bl?.start.remove(),Bl?.end.remove(),Bl=null),Bh=Math.max(0,Bh-1)}},[])}RS(MS,"useFocusGuards");function Rx(){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}RS(Rx,"createFocusGuard");var IZ=Object.defineProperty,Yn=(t,e)=>IZ(t,"name",{value:e,configurable:!0}),zb="focusScope.autoFocusOnMount",$b="focusScope.autoFocusOnUnmount",MR={bubbles:!1,cancelable:!0},LZ=A.forwardRef(Yn(function(e,n){const{loop:r=!1,trapped:i=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...l}=e,[u,f]=A.useState(null),h=Ni(s),m=Ni(o),g=A.useRef(null),y=Xt(n,f),x=A.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;A.useEffect(()=>{if(i){let k=function(R){if(x.paused||!u)return;const M=R.target;u.contains(M)?g.current=M:as(g.current,{select:!0})},C=function(R){if(x.paused||!u)return;const M=R.relatedTarget;M!==null&&(u.contains(M)||as(g.current,{select:!0}))},T=function(R){if(document.activeElement===document.body)for(const O of R)O.removedNodes.length>0&&as(u)};Yn(k,"handleFocusIn"),Yn(C,"handleFocusOut"),Yn(T,"handleMutations"),document.addEventListener("focusin",k),document.addEventListener("focusout",C);const _=new MutationObserver(T);return u&&_.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",k),document.removeEventListener("focusout",C),_.disconnect()}}},[i,u,x.paused]),A.useEffect(()=>{if(u){NR.add(x);const k=document.activeElement;if(!u.contains(k)){const T=new CustomEvent(zb,MR);u.addEventListener(zb,h),u.dispatchEvent(T),T.defaultPrevented||(YL(tj(NS(u)),{select:!0}),document.activeElement===k&&as(u))}return()=>{u.removeEventListener(zb,h),setTimeout(()=>{const T=new CustomEvent($b,MR);u.addEventListener($b,m),u.dispatchEvent(T),T.defaultPrevented||as(k??document.body,{select:!0}),u.removeEventListener($b,m),NR.remove(x)},0)}}},[u,h,m,x]);const S=A.useCallback(k=>{if(!r&&!i||x.paused)return;const C=k.key==="Tab"&&!k.altKey&&!k.ctrlKey&&!k.metaKey,T=document.activeElement;if(C&&T){const _=k.currentTarget,[R,M]=XL(_);R&&M?!k.shiftKey&&T===M?(k.preventDefault(),r&&as(R,{select:!0})):k.shiftKey&&T===R&&(k.preventDefault(),r&&as(M,{select:!0})):T===_&&k.preventDefault()}},[r,i,x.paused]);return b.jsx(xn.div,{tabIndex:-1,...l,ref:y,onKeyDown:S})},"FocusScope"));function YL(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(as(r,{select:e}),document.activeElement!==n)return}Yn(YL,"focusFirst");function XL(t){const e=NS(t),n=Mx(e,t),r=Mx(e.reverse(),t);return[n,r]}Yn(XL,"getTabbableEdges");function NS(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:Yn(r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)e.push(n.currentNode);return e}Yn(NS,"getTabbableCandidates");function Mx(t,e){const n=typeof e.checkVisibility=="function"&&e.checkVisibility({checkVisibilityCSS:!0});for(const r of t)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):JL(r,{upTo:e})))return r}Yn(Mx,"findVisible");function JL(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}Yn(JL,"isHidden");function QL(t){return t instanceof HTMLInputElement&&"select"in t}Yn(QL,"isSelectableInput");function as(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&QL(t)&&e&&t.select()}}Yn(as,"focus");var NR=ej();function ej(){let t=[];return{add(e){const n=t[0];e!==n&&n?.pause(),t=Nx(t,e),t.unshift(e)},remove(e){t=Nx(t,e),t[0]?.resume()}}}Yn(ej,"createFocusScopesStack");function Nx(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}Yn(Nx,"arrayRemove");function tj(t){return t.filter(e=>e.tagName!=="A")}Yn(tj,"removeLinks");var jZ=Object.defineProperty,PZ=(t,e)=>jZ(t,"name",{value:e,configurable:!0}),zZ=Id[" useId ".trim().toString()]||(()=>{}),$Z=0;function OS(t){const[e,n]=A.useState(zZ());return Xn(()=>{t||n(r=>r??String($Z++))},[t]),t||(e?`radix-${e}`:"")}PZ(OS,"useId");const BZ=["top","right","bottom","left"],Lo=Math.min,xs=Math.max,Cm=Math.round,Vh=Math.floor,ws=t=>({x:t,y:t}),VZ={left:"right",right:"left",bottom:"top",top:"bottom"};function nj(t,e,n){return xs(t,Lo(e,n))}function Es(t,e){return typeof t=="function"?t(e):t}function jo(t){return t.split("-")[0]}function Nc(t){return t.split("-")[1]}function DS(t){return t==="x"?"y":"x"}function IS(t){return t==="y"?"height":"width"}function _i(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function LS(t){return DS(_i(t))}function HZ(t,e,n){n===void 0&&(n=!1);const r=Nc(t),i=LS(t),s=IS(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=Em(o)),[o,Em(o)]}function UZ(t){const e=Em(t);return[Ox(t),e,Ox(e)]}function Ox(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const OR=["left","right"],DR=["right","left"],FZ=["top","bottom"],qZ=["bottom","top"];function GZ(t,e,n){switch(t){case"top":case"bottom":return n?e?DR:OR:e?OR:DR;case"left":case"right":return e?FZ:qZ;default:return[]}}function WZ(t,e,n,r){const i=Nc(t);let s=GZ(jo(t),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(Ox)))),s}function Em(t){const e=jo(t);return VZ[e]+t.slice(e.length)}function KZ(t){var e,n,r,i;return{top:(e=t.top)!=null?e:0,right:(n=t.right)!=null?n:0,bottom:(r=t.bottom)!=null?r:0,left:(i=t.left)!=null?i:0}}function rj(t){return typeof t!="number"?KZ(t):{top:t,right:t,bottom:t,left:t}}function Tm(t){const{x:e,y:n,width:r,height:i}=t;return{width:r,height:i,top:n,left:e,right:e+r,bottom:n+i,x:e,y:n}}function IR(t,e,n){let{reference:r,floating:i}=t;const s=_i(e),o=LS(e),l=IS(o),u=jo(e),f=s==="y",h=r.x+r.width/2-i.width/2,m=r.y+r.height/2-i.height/2,g=r[l]/2-i[l]/2;let y;switch(u){case"top":y={x:h,y:r.y-i.height};break;case"bottom":y={x:h,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:m};break;case"left":y={x:r.x-i.width,y:m};break;default:y={x:r.x,y:r.y}}const x=Nc(e);return x&&(y[o]+=g*(x==="end"?1:-1)*(n&&f?-1:1)),y}async function ZZ(t,e){var n;e===void 0&&(e={});const{x:r,y:i,platform:s,rects:o,elements:l,strategy:u}=t,{boundary:f="clippingAncestors",rootBoundary:h="viewport",elementContext:m="floating",altBoundary:g=!1,padding:y=0}=Es(e,t),x=rj(y),k=l[g?m==="floating"?"reference":"floating":m],C=Tm(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(k)))==null||n?k:k.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:f,rootBoundary:h,strategy:u})),T=m==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,_=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),R=await(s.isElement==null?void 0:s.isElement(_))&&await(s.getScale==null?void 0:s.getScale(_))||{x:1,y:1},M=Tm(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:T,offsetParent:_,strategy:u}):T);return{top:(C.top-M.top+x.top)/R.y,bottom:(M.bottom-C.bottom+x.bottom)/R.y,left:(C.left-M.left+x.left)/R.x,right:(M.right-C.right+x.right)/R.x}}const YZ=50,XZ=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,l=o.detectOverflow?o:{...o,detectOverflow:ZZ},u=await(o.isRTL==null?void 0:o.isRTL(e));let f=await o.getElementRects({reference:t,floating:e,strategy:i}),{x:h,y:m}=IR(f,r,u),g=r,y=0;const x={};for(let S=0;S<s.length;S++){const k=s[S];if(!k)continue;const{name:C,fn:T}=k,{x:_,y:R,data:M,reset:O}=await T({x:h,y:m,initialPlacement:r,placement:g,strategy:i,middlewareData:x,rects:f,platform:l,elements:{reference:t,floating:e}});h=_??h,m=R??m,x[C]={...x[C],...M},O&&y<YZ&&(y++,typeof O=="object"&&(O.placement&&(g=O.placement),O.rects&&(f=O.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:i}):O.rects),{x:h,y:m}=IR(f,g,u)),S=-1)}return{x:h,y:m,placement:g,strategy:i,middlewareData:x}},JZ=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:i,rects:s,platform:o,elements:l,middlewareData:u}=e,{element:f,padding:h=0}=Es(t,e)||{};if(f==null)return{};const m=rj(h),g={x:n,y:r},y=LS(i),x=IS(y),S=await o.getDimensions(f),k=y==="y",C=k?"top":"left",T=k?"bottom":"right",_=k?"clientHeight":"clientWidth",R=s.reference[x]+s.reference[y]-g[y]-s.floating[x],M=g[y]-s.reference[y],O=await(o.getOffsetParent==null?void 0:o.getOffsetParent(f));let L=O?O[_]:0;(!L||!await(o.isElement==null?void 0:o.isElement(O)))&&(L=l.floating[_]||s.floating[x]);const P=R/2-M/2,U=L/2-S[x]/2-1,G=Lo(m[C],U),oe=Lo(m[T],U),K=L-S[x]-oe,ne=L/2-S[x]/2+P,re=nj(G,ne,K),me=!u.arrow&&Nc(i)!=null&&ne!==re&&s.reference[x]/2-(ne<G?G:oe)-S[x]/2<0,B=me?ne<G?ne-G:ne-K:0;return{[y]:g[y]+B,data:{[y]:re,centerOffset:ne-re-B,...me&&{alignmentOffset:B}},reset:me}}}),QZ=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:l,platform:u,elements:f}=e,{mainAxis:h=!0,crossAxis:m=!0,fallbackPlacements:g,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:S=!0,...k}=Es(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const C=jo(i),T=_i(l),_=jo(l)===l,R=await(u.isRTL==null?void 0:u.isRTL(f.floating)),M=g||(_||!S?[Em(l)]:UZ(l)),O=x!=="none";!g&&O&&M.push(...WZ(l,S,x,R));const L=[l,...M],P=await u.detectOverflow(e,k),U=[];let G=((r=s.flip)==null?void 0:r.overflows)||[];if(h&&U.push(P[C]),m){const re=HZ(i,o,R);U.push(P[re[0]],P[re[1]])}if(G=[...G,{placement:i,overflows:U}],!U.every(re=>re<=0)){var oe,K;const re=(((oe=s.flip)==null?void 0:oe.index)||0)+1,me=L[re];if(me&&(!(m==="alignment"?T!==_i(me):!1)||G.every(q=>_i(q.placement)===T?q.overflows[0]>0:!0)))return{data:{index:re,overflows:G},reset:{placement:me}};let B=(K=G.filter(z=>z.overflows[0]<=0).sort((z,q)=>z.overflows[1]-q.overflows[1])[0])==null?void 0:K.placement;if(!B)switch(y){case"bestFit":{var ne;const z=(ne=G.filter(q=>{if(O){const de=_i(q.placement);return de===T||de==="y"}return!0}).map(q=>[q.placement,q.overflows.filter(de=>de>0).reduce((de,ve)=>de+ve,0)]).sort((q,de)=>q[1]-de[1])[0])==null?void 0:ne[0];z&&(B=z);break}case"initialPlacement":B=l;break}if(i!==B)return{reset:{placement:B}}}return{}}}};function LR(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function jR(t){return BZ.some(e=>t[e]>=0)}const eY=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:i="referenceHidden",...s}=Es(t,e);switch(i){case"referenceHidden":{const o=await r.detectOverflow(e,{...s,elementContext:"reference"}),l=LR(o,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:jR(l)}}}case"escaped":{const o=await r.detectOverflow(e,{...s,altBoundary:!0}),l=LR(o,n.floating);return{data:{escapedOffsets:l,escaped:jR(l)}}}default:return{}}}}},ij=new Set(["left","top"]);async function tY(t,e){const{placement:n,platform:r,elements:i}=t,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=jo(n),l=Nc(n),u=_i(n)==="y",f=ij.has(o)?-1:1,h=s&&u?-1:1,m=Es(e,t);let{mainAxis:g,crossAxis:y,alignmentAxis:x}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return l&&typeof x=="number"&&(y=l==="end"?x*-1:x),u?{x:y*h,y:g*f}:{x:g*f,y:y*h}}const nY=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:i,y:s,placement:o,middlewareData:l}=e,u=await tY(e,t);return o===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:i+u.x,y:s+u.y,data:{...u,placement:o}}}}},rY=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i,platform:s}=e,{mainAxis:o=!0,crossAxis:l=!1,limiter:u={fn:T=>{let{x:_,y:R}=T;return{x:_,y:R}}},...f}=Es(t,e),h={x:n,y:r},m=await s.detectOverflow(e,f),g=_i(i),y=DS(g);let x=h[y],S=h[g];const k=(T,_)=>nj(_+m[T==="y"?"top":"left"],_,_-m[T==="y"?"bottom":"right"]);o&&(x=k(y,x)),l&&(S=k(g,S));const C=u.fn({...e,[y]:x,[g]:S});return{...C,data:{x:C.x-n,y:C.y-r,enabled:{[y]:o,[g]:l}}}}}},iY=function(t){return t===void 0&&(t={}),{options:t,fn(e){var n,r;const{x:i,y:s,placement:o,rects:l,middlewareData:u}=e,{offset:f=0,mainAxis:h=!0,crossAxis:m=!0}=Es(t,e),g={x:i,y:s},y=_i(o),x=DS(y);let S=g[x],k=g[y];const C=Es(f,e),T=typeof C=="number"?{mainAxis:C,crossAxis:0}:{mainAxis:(n=C.mainAxis)!=null?n:0,crossAxis:(r=C.crossAxis)!=null?r:0};if(h){const M=x==="y"?"height":"width",O=l.reference[x]-l.floating[M]+T.mainAxis,L=l.reference[x]+l.reference[M]-T.mainAxis;S<O?S=O:S>L&&(S=L)}if(m){var _,R;const M=x==="y"?"width":"height",O=ij.has(jo(o)),L=l.reference[y]-l.floating[M]+(O&&((_=u.offset)==null?void 0:_[y])||0)+(O?0:T.crossAxis),P=l.reference[y]+l.reference[M]+(O?0:((R=u.offset)==null?void 0:R[y])||0)-(O?T.crossAxis:0);k<L?k=L:k>P&&(k=P)}return{[x]:S,[y]:k}}}},sY=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){const{placement:n,rects:r,platform:i,elements:s}=e,{apply:o=()=>{},...l}=Es(t,e),u=await i.detectOverflow(e,l),f=jo(n),h=Nc(n),m=_i(n)==="y",{width:g,height:y}=r.floating;let x,S;f==="top"||f==="bottom"?(x=f,S=h===(await(i.isRTL==null?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(S=f,x=h==="end"?"top":"bottom");const k=y-u.top-u.bottom,C=g-u.left-u.right,T=Lo(y-u[x],k),_=Lo(g-u[S],C),R=e.middlewareData.shift,M=!R;let O=T,L=_;R!=null&&R.enabled.x&&(L=C),R!=null&&R.enabled.y&&(O=k),M&&!h&&(m?L=g-2*xs(u.left,u.right):O=y-2*xs(u.top,u.bottom)),await o({...e,availableWidth:L,availableHeight:O});const P=await i.getDimensions(s.floating);return g!==P.width||y!==P.height?{reset:{rects:!0}}:{}}}};function og(){return typeof window<"u"}function Oc(t){return sj(t)?(t.nodeName||"").toLowerCase():"#document"}function fr(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Rs(t){var e;return(e=(sj(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function sj(t){return og()?t instanceof Node||t instanceof fr(t).Node:!1}function Oi(t){return og()?t instanceof Element||t instanceof fr(t).Element:!1}function Uo(t){return og()?t instanceof HTMLElement||t instanceof fr(t).HTMLElement:!1}function PR(t){return!og()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof fr(t).ShadowRoot}function ag(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=Di(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&i!=="inline"&&i!=="contents"}function oY(t){return/^(table|td|th)$/.test(Oc(t))}function lg(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const aY=/transform|translate|scale|rotate|perspective|filter/,lY=/paint|layout|strict|content/,da=t=>!!t&&t!=="none";let Bb;function jS(t){const e=Oi(t)?Di(t):t;return da(e.transform)||da(e.translate)||da(e.scale)||da(e.rotate)||da(e.perspective)||!PS()&&(da(e.backdropFilter)||da(e.filter))||aY.test(e.willChange||"")||lY.test(e.contain||"")}function cY(t){let e=Va(t);for(;Uo(e)&&!Nd(e);){if(jS(e))return e;if(lg(e))return null;e=Va(e)}return null}function PS(){return Bb==null&&(Bb=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Bb}function Nd(t){return/^(html|body|#document)$/.test(Oc(t))}function Di(t){return fr(t).getComputedStyle(t)}function cg(t){return Oi(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Va(t){if(Oc(t)==="html")return t;const e=t.assignedSlot||t.parentNode||PR(t)&&t.host||Rs(t);return PR(e)?e.host:e}function oj(t){const e=Va(t);return Nd(e)?(t.ownerDocument||t).body:Uo(e)&&ag(e)?e:oj(e)}function Od(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=oj(t),s=i===((r=t.ownerDocument)==null?void 0:r.body),o=fr(i);if(s){const l=Dx(o);return e.concat(o,o.visualViewport||[],ag(i)?i:[],l&&n?Od(l):[])}else return e.concat(i,Od(i,[],n))}function Dx(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function aj(t){const e=Di(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=Uo(t),s=i?t.offsetWidth:n,o=i?t.offsetHeight:r,l=Cm(n)!==s||Cm(r)!==o;return l&&(n=s,r=o),{width:n,height:r,$:l}}function zS(t){return Oi(t)?t:t.contextElement}function rc(t){const e=zS(t);if(!Uo(e))return ws(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:s}=aj(e);let o=(s?Cm(n.width):n.width)/r,l=(s?Cm(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const uY=ws(0);function lj(t){const e=fr(t);return!PS()||!e.visualViewport?uY:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function dY(t,e,n){return e===void 0&&(e=!1),!!n&&e&&n===fr(t)}function Ha(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),s=zS(t);let o=ws(1);e&&(r?Oi(r)&&(o=rc(r)):o=rc(t));const l=dY(s,n,r)?lj(s):ws(0);let u=(i.left+l.x)/o.x,f=(i.top+l.y)/o.y,h=i.width/o.x,m=i.height/o.y;if(s&&r){const g=fr(s),y=Oi(r)?fr(r):r;let x=g,S=Dx(x);for(;S&&y!==x;){const k=rc(S),C=S.getBoundingClientRect(),T=Di(S),_=C.left+(S.clientLeft+parseFloat(T.paddingLeft))*k.x,R=C.top+(S.clientTop+parseFloat(T.paddingTop))*k.y;u*=k.x,f*=k.y,h*=k.x,m*=k.y,u+=_,f+=R,x=fr(S),S=Dx(x)}}return Tm({width:h,height:m,x:u,y:f})}function ug(t,e){const n=cg(t).scrollLeft;return e?e.left+n:Ha(Rs(t)).left+n}function cj(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-ug(t,n),i=n.top+e.scrollTop;return{x:r,y:i}}function fY(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const s=i==="fixed",o=Rs(r),l=e?lg(e.floating):!1;if(r===o||l&&s)return n;let u={scrollLeft:0,scrollTop:0},f=ws(1);const h=ws(0),m=Uo(r);if((m||!s)&&((Oc(r)!=="body"||ag(o))&&(u=cg(r)),m)){const y=Ha(r);f=rc(r),h.x=y.x+r.clientLeft,h.y=y.y+r.clientTop}const g=o&&!m&&!s?cj(o,u):ws(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-u.scrollLeft*f.x+h.x+g.x,y:n.y*f.y-u.scrollTop*f.y+h.y+g.y}}function hY(t){return t.getClientRects?Array.from(t.getClientRects()):[]}function pY(t){const e=cg(t),n=t.ownerDocument.body,r=xs(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),i=xs(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let s=-e.scrollLeft+ug(t);const o=-e.scrollTop;return Di(n).direction==="rtl"&&(s+=xs(t.clientWidth,n.clientWidth)-r),{width:r,height:i,x:s,y:o}}const mY=25;function gY(t,e,n){n===void 0&&(n="viewport");const r=n==="layoutViewport",i=fr(t),s=Rs(t),o=i.visualViewport;let l=s.clientWidth,u=s.clientHeight,f=0,h=0;if(o){const g=!PS()||e==="fixed";r?g||(f=-o.offsetLeft,h=-o.offsetTop):(l=o.width,u=o.height,g&&(f=o.offsetLeft,h=o.offsetTop))}if(ug(s)<=0){const g=s.ownerDocument,y=g.body,x=getComputedStyle(y),S=g.compatMode==="CSS1Compat"&&parseFloat(x.marginLeft)+parseFloat(x.marginRight)||0,k=Math.abs(s.clientWidth-y.clientWidth-S),C=getComputedStyle(s).scrollbarGutter==="stable both-edges"?k/2:k;C<=mY&&(l-=C)}return{width:l,height:u,x:f,y:h}}function yY(t,e){const n=Ha(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,s=rc(t),o=t.clientWidth*s.x,l=t.clientHeight*s.y,u=i*s.x,f=r*s.y;return{width:o,height:l,x:u,y:f}}function zR(t,e,n){let r;if(e==="viewport"||e==="layoutViewport")r=gY(t,n,e);else if(e==="document")r=pY(Rs(t));else if(Oi(e))r=yY(e,n);else{const i=lj(t);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return Tm(r)}function vY(t,e){const n=e.get(t);if(n)return n;let r=Od(t,[],!1).filter(l=>Oi(l)&&Oc(l)!=="body"),i=null;const s=Di(t).position==="fixed";let o=s?Va(t):t;for(;Oi(o)&&!Nd(o);){const l=Di(o),u=jS(o),f=i?i.position:s?"fixed":"";!u&&(f==="fixed"||f==="absolute"&&l.position==="static")?r=r.filter(m=>m!==o):i=l,o=Va(o)}return e.set(t,r),r}function bY(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const o=[...n==="clippingAncestors"?lg(e)?[]:vY(e,this._c):[].concat(n),r],l=zR(e,o[0],i);let u=l.top,f=l.right,h=l.bottom,m=l.left;for(let g=1;g<o.length;g++){const y=zR(e,o[g],i);u=xs(y.top,u),f=Lo(y.right,f),h=Lo(y.bottom,h),m=xs(y.left,m)}return{width:f-m,height:h-u,x:m,y:u}}function xY(t){const{width:e,height:n}=aj(t);return{width:e,height:n}}function wY(t,e,n){const r=Uo(e),i=Rs(e),s=n==="fixed",o=Ha(t,!0,s,e);let l={scrollLeft:0,scrollTop:0};const u=ws(0);if((r||!s)&&((Oc(e)!=="body"||ag(i))&&(l=cg(e)),r)){const g=Ha(e,!0,s,e);u.x=g.x+e.clientLeft,u.y=g.y+e.clientTop}!r&&i&&(u.x=ug(i));const f=i&&!r&&!s?cj(i,l):ws(0),h=o.left+l.scrollLeft-u.x-f.x,m=o.top+l.scrollTop-u.y-f.y;return{x:h,y:m,width:o.width,height:o.height}}function Vb(t){return Di(t).position==="static"}function $R(t,e){if(!Uo(t)||Di(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Rs(t)===n&&(n=n.ownerDocument.body),n}function uj(t,e){const n=fr(t);if(lg(t))return n;if(!Uo(t)){let i=Va(t);for(;i&&!Nd(i);){if(Oi(i)&&!Vb(i))return i;i=Va(i)}return n}let r=$R(t,e);for(;r&&oY(r)&&Vb(r);)r=$R(r,e);return r&&Nd(r)&&Vb(r)&&!jS(r)?n:r||cY(t)||n}const SY=async function(t){const e=this.getOffsetParent||uj,n=this.getDimensions,r=await n(t.floating);return{reference:wY(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function kY(t){return Di(t).direction==="rtl"}const CY={convertOffsetParentRelativeRectToViewportRelativeRect:fY,getDocumentElement:Rs,getClippingRect:bY,getOffsetParent:uj,getElementRects:SY,getClientRects:hY,getDimensions:xY,getScale:rc,isElement:Oi,isRTL:kY};function dj(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function EY(t,e,n){let r=null,i;const s=Rs(t);function o(){var h;clearTimeout(i),(h=r)==null||h.disconnect(),r=null}function l(h,m){h===void 0&&(h=!1),m===void 0&&(m=1),o();const g=t.getBoundingClientRect(),{left:y,top:x,width:S,height:k}=g;if(h||e(),!S||!k)return;const C=Vh(x),T=Vh(s.clientWidth-(y+S)),_=Vh(s.clientHeight-(x+k)),R=Vh(y),O={rootMargin:-C+"px "+-T+"px "+-_+"px "+-R+"px",threshold:xs(0,Lo(1,m))||1};let L=!0;function P(U){const G=U[0].intersectionRatio;if(!dj(g,t.getBoundingClientRect()))return l();if(G!==m){if(!L)return l();G?l(!1,G):i=setTimeout(()=>{l(!1,1e-7)},1e3)}L=!1}try{r=new IntersectionObserver(P,{...O,root:s.ownerDocument})}catch{r=new IntersectionObserver(P,O)}r.observe(t)}const u=fr(t),f=()=>l(n);return u.addEventListener("resize",f),l(!0),()=>{u.removeEventListener("resize",f),o()}}function TY(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,f=zS(t),h=i||s?[...f?Od(f):[],...e?Od(e):[]]:[];h.forEach(C=>{i&&C.addEventListener("scroll",n),s&&C.addEventListener("resize",n)});const m=f&&l?EY(f,n,s):null;let g=-1,y=null;o&&(y=new ResizeObserver(C=>{let[T]=C;T&&T.target===f&&y&&e&&(y.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var _;(_=y)==null||_.observe(e)})),n()}),f&&!u&&y.observe(f),e&&y.observe(e));let x,S=u?Ha(t):null;u&&k();function k(){const C=Ha(t);S&&!dj(S,C)&&n(),S=C,x=requestAnimationFrame(k)}return n(),()=>{var C;h.forEach(T=>{i&&T.removeEventListener("scroll",n),s&&T.removeEventListener("resize",n)}),m?.(),(C=y)==null||C.disconnect(),y=null,u&&cancelAnimationFrame(x)}}const _Y=nY,AY=rY,RY=QZ,MY=sY,NY=eY,BR=JZ,OY=iY,DY=(t,e,n)=>{const r=new Map,i=n??{},s={...CY,...i.platform,_c:r};return XZ(t,e,{...i,platform:s})};var IY=typeof document<"u",LY=function(){},dp=IY?A.useLayoutEffect:LY;function _m(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,i;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(!_m(t[r],e[r]))return!1;return!0}if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&t.$$typeof)&&!_m(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function fj(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function VR(t,e){const n=fj(t);return Math.round(e*n)/n}function Hb(t){const e=A.useRef(t);return dp(()=>{e.current=t}),e}function jY(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:o}={},transform:l=!0,whileElementsMounted:u,open:f}=t,[h,m]=A.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[g,y]=A.useState(r);_m(g,r)||y(r);const[x,S]=A.useState(null),[k,C]=A.useState(null),T=A.useCallback(q=>{q!==O.current&&(O.current=q,S(q))},[]),_=A.useCallback(q=>{q!==L.current&&(L.current=q,C(q))},[]),R=s||x,M=o||k,O=A.useRef(null),L=A.useRef(null),P=A.useRef(h),U=u!=null,G=Hb(u),oe=Hb(i),K=Hb(f),ne=A.useCallback(()=>{if(!O.current||!L.current)return;const q={placement:e,strategy:n,middleware:g};oe.current&&(q.platform=oe.current),DY(O.current,L.current,q).then(de=>{const ve={...de,isPositioned:K.current!==!1};re.current&&!_m(P.current,ve)&&(P.current=ve,Tc.flushSync(()=>{m(ve)}))})},[g,e,n,oe,K]);dp(()=>{f===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,m(q=>({...q,isPositioned:!1})))},[f]);const re=A.useRef(!1);dp(()=>(re.current=!0,()=>{re.current=!1}),[]),dp(()=>{if(R&&(O.current=R),M&&(L.current=M),R&&M){if(G.current)return G.current(R,M,ne);ne()}},[R,M,ne,G,U]);const me=A.useMemo(()=>({reference:O,floating:L,setReference:T,setFloating:_}),[T,_]),B=A.useMemo(()=>({reference:R,floating:M}),[R,M]),z=A.useMemo(()=>{const q={position:n,left:0,top:0};if(!B.floating)return q;const de=VR(B.floating,h.x),ve=VR(B.floating,h.y);return l?{...q,transform:"translate("+de+"px, "+ve+"px)",...fj(B.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:de,top:ve}},[n,l,B.floating,h.x,h.y]);return A.useMemo(()=>({...h,update:ne,refs:me,elements:B,floatingStyles:z}),[h,ne,me,B,z])}const PY=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:i}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?BR({element:r.current,padding:i}).fn(n):{}:r?BR({element:r,padding:i}).fn(n):{}}}},zY=(t,e)=>{const n=_Y(t);return{name:n.name,fn:n.fn,options:[t,e]}},$Y=(t,e)=>{const n=AY(t);return{name:n.name,fn:n.fn,options:[t,e]}},BY=(t,e)=>({fn:OY(t).fn,options:[t,e]}),VY=(t,e)=>{const n=RY(t);return{name:n.name,fn:n.fn,options:[t,e]}},HY=(t,e)=>{const n=MY(t);return{name:n.name,fn:n.fn,options:[t,e]}},UY=(t,e)=>{const n=NY(t);return{name:n.name,fn:n.fn,options:[t,e]}},FY=(t,e)=>{const n=PY(t);return{name:n.name,fn:n.fn,options:[t,e]}};var qY=Object.defineProperty,Ao=(t,e)=>qY(t,"name",{value:e,configurable:!0}),hj="Popper",[pj,mj]=Ac(hj),[GY,gj]=pj(hj),WY=Ao(t=>{const{__scopePopper:e,children:n}=t,[r,i]=A.useState(null),[s,o]=A.useState(void 0);return b.jsx(GY,{scope:e,anchor:r,onAnchorChange:i,placementState:s,setPlacementState:o,children:n})},"Popper"),KY="PopperAnchor",ZY=A.forwardRef(Ao(function(e,n){const{__scopePopper:r,virtualRef:i,...s}=e,o=gj(KY,r),l=A.useRef(null),u=o.onAnchorChange,f=A.useCallback(S=>{l.current=S,S&&u(S)},[u]),h=Xt(n,f),m=A.useRef(null);A.useEffect(()=>{if(!i)return;const S=m.current;m.current=i.current,S!==m.current&&u(m.current)});const g=o.placementState&&dg(o.placementState),y=g?.[0],x=g?.[1];return i?null:b.jsx(xn.div,{"data-radix-popper-side":y,"data-radix-popper-align":x,...s,ref:h})},"PopperAnchor")),yj="PopperContent",[YY,nte]=pj(yj),XY=A.forwardRef(Ao(function(e,n){const{__scopePopper:r,side:i="bottom",sideOffset:s=0,align:o="center",alignOffset:l=0,arrowPadding:u=0,avoidCollisions:f=!0,collisionBoundary:h=[],collisionPadding:m=0,sticky:g="partial",hideWhenDetached:y=!1,updatePositionStrategy:x="optimized",onPlaced:S,...k}=e,C=gj(yj,r),[T,_]=A.useState(null),R=Xt(n,_),[M,O]=A.useState(null),L=Sw(M),P=L?.width??0,U=L?.height??0,G=i+(o!=="center"?"-"+o:""),oe=typeof m=="number"?m:{top:0,right:0,bottom:0,left:0,...m},K=Array.isArray(h)?h:[h],ne=K.length>0,re={padding:oe,boundary:K.filter(vj),altBoundary:ne},{refs:me,floatingStyles:B,placement:z,isPositioned:q,middlewareData:de}=jY({strategy:"fixed",placement:G,whileElementsMounted:Ao((...se)=>TY(...se,{animationFrame:x==="always"}),"whileElementsMounted"),elements:{reference:C.anchor},middleware:[zY({mainAxis:s+U,alignmentAxis:l}),f&&$Y({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?BY():void 0,...re}),f&&VY({...re}),HY({...re,apply:Ao(({elements:se,rects:pe,availableWidth:Me,availableHeight:ze})=>{const{width:Fe,height:ft}=pe.reference,ht=se.floating.style;ht.setProperty("--radix-popper-available-width",`${Me}px`),ht.setProperty("--radix-popper-available-height",`${ze}px`),ht.setProperty("--radix-popper-anchor-width",`${Fe}px`),ht.setProperty("--radix-popper-anchor-height",`${ft}px`)},"apply")}),M&&FY({element:M,padding:u}),JY({arrowWidth:P,arrowHeight:U}),y&&UY({strategy:"referenceHidden",...re,boundary:ne?re.boundary:void 0})]}),ve=C.setPlacementState;Xn(()=>(ve(z),()=>{ve(void 0)}),[z,ve]);const[V,X]=dg(z),fe=Ni(S);Xn(()=>{q&&fe?.()},[q,fe]);const ge=de.arrow?.x,Te=de.arrow?.y,_e=de.arrow?.centerOffset!==0,[Le,ke]=A.useState();return Xn(()=>{T&&ke(window.getComputedStyle(T).zIndex)},[T]),b.jsx("div",{ref:me.setFloating,"data-radix-popper-content-wrapper":"",style:{...B,transform:q?B.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Le,"--radix-popper-transform-origin":[de.transformOrigin?.x,de.transformOrigin?.y].join(" "),...de.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:b.jsx(YY,{scope:r,placedSide:V,placedAlign:X,onArrowChange:O,arrowX:ge,arrowY:Te,shouldHideArrow:_e,children:b.jsx(xn.div,{"data-side":V,"data-align":X,...k,ref:R,style:{...k.style,animation:q?k.style?.animation:"none"}})})})},"PopperContent"));function vj(t){return t!==null}Ao(vj,"isNotNull");var JY=Ao(t=>({name:"transformOrigin",options:t,fn(e){const{placement:n,rects:r,middlewareData:i}=e,o=i.arrow?.centerOffset!==0,l=o?0:t.arrowWidth,u=o?0:t.arrowHeight,[f,h]=dg(n),m={start:"0%",center:"50%",end:"100%"}[h],g=(i.arrow?.x??0)+l/2,y=(i.arrow?.y??0)+u/2;let x="",S="";return f==="bottom"?(x=o?m:`${g}px`,S=`${-u}px`):f==="top"?(x=o?m:`${g}px`,S=`${r.floating.height+u}px`):f==="right"?(x=`${-u}px`,S=o?m:`${y}px`):f==="left"&&(x=`${r.floating.width+u}px`,S=o?m:`${y}px`),{data:{x,y:S}}}}),"transformOrigin");function dg(t){const[e,n="center"]=t.split("-");return[e,n]}Ao(dg,"getSideAndAlignFromPlacement");var QY=WY,eX=ZY,tX=XY,nX=Object.defineProperty,rX=(t,e)=>nX(t,"name",{value:e,configurable:!0}),iX=A.forwardRef(rX(function(e,n){const{container:r,...i}=e,[s,o]=A.useState(!1);Xn(()=>o(!0),[]);const l=r||s&&globalThis?.document?.body;return l?Tc.createPortal(b.jsx(xn.div,{...i,ref:n}),l):null},"Portal")),sX=Object.defineProperty,Ts=(t,e)=>sX(t,"name",{value:e,configurable:!0});function bj(t,e){return A.useReducer((n,r)=>e[n][r]??n,t)}Ts(bj,"useStateMachine");var oX=Ts(t=>{const{present:e,children:n}=t,r=xj(e),i=typeof n=="function"?n({present:r.isPresent}):A.Children.only(n),s=wj(r.ref,Sj(i));return typeof n=="function"||r.isPresent?A.cloneElement(i,{ref:s}):null},"Presence");function xj(t){const[e,n]=A.useState(),r=A.useRef(null),i=A.useRef(t),s=A.useRef("none"),o=A.useRef(void 0),l=t?"mounted":"unmounted",[u,f]=bj(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return A.useEffect(()=>{u==="mounted"?(s.current=o.current??Yl(r.current),o.current=void 0):s.current="none"},[u]),Xn(()=>{const h=r.current,m=i.current;if(m!==t){const y=s.current,x=Yl(h);t?(o.current=x,f("MOUNT")):x==="none"||h?.display==="none"?f("UNMOUNT"):f(m&&y!==x?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,f]),Xn(()=>{if(e){let h;const m=e.ownerDocument.defaultView??window,g=Ts(x=>{const k=Yl(r.current).includes(CSS.escape(x.animationName));if(x.target===e&&k&&(f("ANIMATION_END"),!i.current)){const C=e.style.animationFillMode;e.style.animationFillMode="forwards",h=m.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=C)})}},"handleAnimationEnd"),y=Ts(x=>{x.target===e&&(s.current=Yl(r.current))},"handleAnimationStart");return e.addEventListener("animationstart",y),e.addEventListener("animationcancel",g),e.addEventListener("animationend",g),()=>{m.clearTimeout(h),e.removeEventListener("animationstart",y),e.removeEventListener("animationcancel",g),e.removeEventListener("animationend",g)}}else f("ANIMATION_END")},[e,f]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:A.useCallback(h=>{if(h){const m=getComputedStyle(h);r.current=m,o.current=Yl(m)}else r.current=null;n(h)},[])}}Ts(xj,"usePresence");function Ix(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}Ts(Ix,"setRef");function wj(...t){const e=A.useRef(t);return e.current=t,A.useCallback(n=>{const r=e.current;let i=!1;const s=r.map(o=>{const l=Ix(o,n);return!i&&typeof l=="function"&&(i=!0),l});if(i)return()=>{for(let o=0;o<s.length;o++){const l=s[o];typeof l=="function"?l():Ix(r[o],null)}}},[])}Ts(wj,"useStableComposedRefs");function Yl(t){return t?.animationName||"none"}Ts(Yl,"getAnimationName");function Sj(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}Ts(Sj,"getElementRef");var aX=Object.defineProperty,lX=(t,e)=>aX(t,"name",{value:e,configurable:!0});function kj(t){const e=A.useRef({value:t,previous:t});return A.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}lX(kj,"usePrevious");var cX=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"}),uX=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Vl=new WeakMap,Hh=new WeakMap,Uh={},Ub=0,Cj=function(t){return t&&(t.host||Cj(t.parentNode))},dX=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=Cj(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})},fX=function(t,e,n,r){var i=dX(e,Array.isArray(t)?t:[t]);Uh[n]||(Uh[n]=new WeakMap);var s=Uh[n],o=[],l=new Set,u=new Set(i),f=function(m){!m||l.has(m)||(l.add(m),f(m.parentNode))};i.forEach(f);var h=function(m){!m||u.has(m)||Array.prototype.forEach.call(m.children,function(g){if(l.has(g))h(g);else try{var y=g.getAttribute(r),x=y!==null&&y!=="false",S=(Vl.get(g)||0)+1,k=(s.get(g)||0)+1;Vl.set(g,S),s.set(g,k),o.push(g),S===1&&x&&Hh.set(g,!0),k===1&&g.setAttribute(n,"true"),x||g.setAttribute(r,"true")}catch(C){console.error("aria-hidden: cannot operate on ",g,C)}})};return h(e),l.clear(),Ub++,function(){o.forEach(function(m){var g=Vl.get(m)-1,y=s.get(m)-1;Vl.set(m,g),s.set(m,y),g||(Hh.has(m)||m.removeAttribute(r),Hh.delete(m)),y||m.removeAttribute(n)}),Ub--,Ub||(Vl=new WeakMap,Vl=new WeakMap,Hh=new WeakMap,Uh={})}},hX=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=uX(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),fX(r,i,n,"aria-hidden")):function(){return null}},Ti=function(){return Ti=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Ti.apply(this,arguments)};function Ej(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 i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n}function pX(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,s;r<i;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return t.concat(s||Array.prototype.slice.call(e))}var fp="right-scroll-bar-position",hp="width-before-scroll-bar",mX="with-scroll-bars-hidden",gX="--removed-body-scroll-bar-size";function Fb(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function yX(t,e){var n=A.useState(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=e,n.facade}var vX=typeof window<"u"?A.useLayoutEffect:A.useEffect,HR=new WeakMap;function bX(t,e){var n=yX(null,function(r){return t.forEach(function(i){return Fb(i,r)})});return vX(function(){var r=HR.get(n);if(r){var i=new Set(r),s=new Set(t),o=n.current;i.forEach(function(l){s.has(l)||Fb(l,null)}),s.forEach(function(l){i.has(l)||Fb(l,o)})}HR.set(n,t)},[t]),n}function xX(t){return t}function wX(t,e){e===void 0&&(e=xX);var n=[],r=!1,i={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(s){var o=e(s,r);return n.push(o),function(){n=n.filter(function(l){return l!==o})}},assignSyncMedium:function(s){for(r=!0;n.length;){var o=n;n=[],o.forEach(s)}n={push:function(l){return s(l)},filter:function(){return n}}},assignMedium:function(s){r=!0;var o=[];if(n.length){var l=n;n=[],l.forEach(s),o=n}var u=function(){var h=o;o=[],h.forEach(s)},f=function(){return Promise.resolve().then(u)};f(),n={push:function(h){o.push(h),f()},filter:function(h){return o=o.filter(h),n}}}};return i}function SX(t){t===void 0&&(t={});var e=wX(null);return e.options=Ti({async:!0,ssr:!1},t),e}var Tj=function(t){var e=t.sideCar,n=Ej(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 A.createElement(r,Ti({},n))};Tj.isSideCarExport=!0;function kX(t,e){return t.useMedium(e),Tj}var _j=SX(),qb=function(){},fg=A.forwardRef(function(t,e){var n=A.useRef(null),r=A.useState({onScrollCapture:qb,onWheelCapture:qb,onTouchMoveCapture:qb}),i=r[0],s=r[1],o=t.forwardProps,l=t.children,u=t.className,f=t.removeScrollBar,h=t.enabled,m=t.shards,g=t.sideCar,y=t.noRelative,x=t.noIsolation,S=t.inert,k=t.allowPinchZoom,C=t.as,T=C===void 0?"div":C,_=t.gapMode,R=Ej(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),M=g,O=bX([n,e]),L=Ti(Ti({},R),i);return A.createElement(A.Fragment,null,h&&A.createElement(M,{sideCar:_j,removeScrollBar:f,shards:m,noRelative:y,noIsolation:x,inert:S,setCallbacks:s,allowPinchZoom:!!k,lockRef:n,gapMode:_}),o?A.cloneElement(A.Children.only(l),Ti(Ti({},L),{ref:O})):A.createElement(T,Ti({},L,{className:u,ref:O}),l))});fg.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};fg.classNames={fullWidth:hp,zeroRight:fp};var CX=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function EX(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=CX();return e&&t.setAttribute("nonce",e),t}function TX(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function _X(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var AX=function(){var t=0,e=null;return{add:function(n){t==0&&(e=EX())&&(TX(e,n),_X(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},RX=function(){var t=AX();return function(e,n){A.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},Aj=function(){var t=RX(),e=function(n){var r=n.styles,i=n.dynamic;return t(r,i),null};return e},MX={left:0,top:0,right:0,gap:0},Gb=function(t){return parseInt(t||"",10)||0},NX=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],r=e[t==="padding"?"paddingTop":"marginTop"],i=e[t==="padding"?"paddingRight":"marginRight"];return[Gb(n),Gb(r),Gb(i)]},OX=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return MX;var e=NX(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])}},DX=Aj(),ic="data-scroll-locked",IX=function(t,e,n,r){var i=t.left,s=t.top,o=t.right,l=t.gap;return n===void 0&&(n="margin"),`
|
|
287
|
-
.`.concat(mX,` {
|
|
288
|
-
overflow: hidden `).concat(r,`;
|
|
289
|
-
padding-right: `).concat(l,"px ").concat(r,`;
|
|
290
|
-
}
|
|
291
|
-
body[`).concat(ic,`] {
|
|
292
|
-
overflow: hidden `).concat(r,`;
|
|
293
|
-
overscroll-behavior: contain;
|
|
294
|
-
`).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&`
|
|
295
|
-
padding-left: `.concat(i,`px;
|
|
296
|
-
padding-top: `).concat(s,`px;
|
|
297
|
-
padding-right: `).concat(o,`px;
|
|
298
|
-
margin-left:0;
|
|
299
|
-
margin-top:0;
|
|
300
|
-
margin-right: `).concat(l,"px ").concat(r,`;
|
|
301
|
-
`),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),`
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
.`).concat(fp,` {
|
|
305
|
-
right: `).concat(l,"px ").concat(r,`;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
.`).concat(hp,` {
|
|
309
|
-
margin-right: `).concat(l,"px ").concat(r,`;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
.`).concat(fp," .").concat(fp,` {
|
|
313
|
-
right: 0 `).concat(r,`;
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
.`).concat(hp," .").concat(hp,` {
|
|
317
|
-
margin-right: 0 `).concat(r,`;
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
body[`).concat(ic,`] {
|
|
321
|
-
`).concat(gX,": ").concat(l,`px;
|
|
322
|
-
}
|
|
323
|
-
`)},UR=function(){var t=parseInt(document.body.getAttribute(ic)||"0",10);return isFinite(t)?t:0},LX=function(){A.useEffect(function(){return document.body.setAttribute(ic,(UR()+1).toString()),function(){var t=UR()-1;t<=0?document.body.removeAttribute(ic):document.body.setAttribute(ic,t.toString())}},[])},jX=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,i=r===void 0?"margin":r;LX();var s=A.useMemo(function(){return OX(i)},[i]);return A.createElement(DX,{styles:IX(s,!e,i,n?"":"!important")})},Lx=!1;if(typeof window<"u")try{var Fh=Object.defineProperty({},"passive",{get:function(){return Lx=!0,!0}});window.addEventListener("test",Fh,Fh),window.removeEventListener("test",Fh,Fh)}catch{Lx=!1}var Hl=Lx?{passive:!1}:!1,PX=function(t){return t.tagName==="TEXTAREA"},Rj=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!PX(t)&&n[e]==="visible")},zX=function(t){return Rj(t,"overflowY")},$X=function(t){return Rj(t,"overflowX")},FR=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=Mj(t,r);if(i){var s=Nj(t,r),o=s[1],l=s[2];if(o>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},BX=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},VX=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},Mj=function(t,e){return t==="v"?zX(e):$X(e)},Nj=function(t,e){return t==="v"?BX(e):VX(e)},HX=function(t,e){return t==="h"&&e==="rtl"?-1:1},UX=function(t,e,n,r,i){var s=HX(t,window.getComputedStyle(e).direction),o=s*r,l=n.target,u=e.contains(l),f=!1,h=o>0,m=0,g=0;do{if(!l)break;var y=Nj(t,l),x=y[0],S=y[1],k=y[2],C=S-k-s*x;(x||C)&&Mj(t,l)&&(m+=C,g+=x);var T=l.parentNode;l=T&&T.nodeType===Node.DOCUMENT_FRAGMENT_NODE?T.host:T}while(!u&&l!==document.body||u&&(e.contains(l)||e===l));return(h&&Math.abs(m)<1||!h&&Math.abs(g)<1)&&(f=!0),f},qh=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},qR=function(t){return[t.deltaX,t.deltaY]},GR=function(t){return t&&"current"in t?t.current:t},FX=function(t,e){return t[0]===e[0]&&t[1]===e[1]},qX=function(t){return`
|
|
324
|
-
.block-interactivity-`.concat(t,` {pointer-events: none;}
|
|
325
|
-
.allow-interactivity-`).concat(t,` {pointer-events: all;}
|
|
326
|
-
`)},GX=0,Ul=[];function WX(t){var e=A.useRef([]),n=A.useRef([0,0]),r=A.useRef(),i=A.useState(GX++)[0],s=A.useState(Aj)[0],o=A.useRef(t);A.useEffect(function(){o.current=t},[t]),A.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var S=pX([t.lockRef.current],(t.shards||[]).map(GR),!0).filter(Boolean);return S.forEach(function(k){return k.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),S.forEach(function(k){return k.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var l=A.useCallback(function(S,k){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!o.current.allowPinchZoom;var C=qh(S),T=n.current,_="deltaX"in S?S.deltaX:T[0]-C[0],R="deltaY"in S?S.deltaY:T[1]-C[1],M,O=S.target,L=Math.abs(_)>Math.abs(R)?"h":"v";if("touches"in S&&L==="h"&&O.type==="range")return!1;var P=window.getSelection(),U=P&&P.anchorNode,G=U?U===O||U.contains(O):!1;if(G)return!1;var oe=FR(L,O);if(!oe)return!0;if(oe?M=L:(M=L==="v"?"h":"v",oe=FR(L,O)),!oe)return!1;if(!r.current&&"changedTouches"in S&&(_||R)&&(r.current=M),!M)return!0;var K=r.current||M;return UX(K,k,S,K==="h"?_:R)},[]),u=A.useCallback(function(S){var k=S;if(!(!Ul.length||Ul[Ul.length-1]!==s)){var C="deltaY"in k?qR(k):qh(k),T=e.current.filter(function(M){return M.name===k.type&&(M.target===k.target||k.target===M.shadowParent)&&FX(M.delta,C)})[0];if(T&&T.should){k.cancelable&&k.preventDefault();return}if(!T){var _=(o.current.shards||[]).map(GR).filter(Boolean).filter(function(M){return M.contains(k.target)}),R=_.length>0?l(k,_[0]):!o.current.noIsolation;R&&k.cancelable&&k.preventDefault()}}},[]),f=A.useCallback(function(S,k,C,T){var _={name:S,delta:k,target:C,should:T,shadowParent:KX(C)};e.current.push(_),setTimeout(function(){e.current=e.current.filter(function(R){return R!==_})},1)},[]),h=A.useCallback(function(S){n.current=qh(S),r.current=void 0},[]),m=A.useCallback(function(S){f(S.type,qR(S),S.target,l(S,t.lockRef.current))},[]),g=A.useCallback(function(S){f(S.type,qh(S),S.target,l(S,t.lockRef.current))},[]);A.useEffect(function(){return Ul.push(s),t.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:g}),document.addEventListener("wheel",u,Hl),document.addEventListener("touchmove",u,Hl),document.addEventListener("touchstart",h,Hl),function(){Ul=Ul.filter(function(S){return S!==s}),document.removeEventListener("wheel",u,Hl),document.removeEventListener("touchmove",u,Hl),document.removeEventListener("touchstart",h,Hl)}},[]);var y=t.removeScrollBar,x=t.inert;return A.createElement(A.Fragment,null,x?A.createElement(s,{styles:qX(i)}):null,y?A.createElement(jX,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function KX(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const ZX=kX(_j,WX);var Oj=A.forwardRef(function(t,e){return A.createElement(fg,Ti({},t,{ref:e,sideCar:ZX}))});Oj.classNames=fg.classNames;var YX=Object.defineProperty,Et=(t,e)=>YX(t,"name",{value:e,configurable:!0}),XX=[" ","Enter","ArrowUp","ArrowDown"],JX=[" ","Enter"],Sc="Select",[hg,$S,QX]=VL(Sc),[Xa,rte]=Ac(Sc,[QX,mj]),BS=mj(),[eJ,Fo]=Xa(Sc),[tJ,nJ]=Xa(Sc);function Dj(t){const{__scopeSelect:e,children:n,open:r,defaultOpen:i,onOpenChange:s,value:o,defaultValue:l,onValueChange:u,dir:f,name:h,autoComplete:m,disabled:g,required:y,form:x,internal_do_not_use_render:S}=t,k=BS(e),[C,T]=A.useState(null),[_,R]=A.useState(null),[M,O]=A.useState(!1),L=GL(f),[P,U]=Mp({prop:r,defaultProp:i??!1,onChange:s,caller:Sc}),[G,oe]=Mp({prop:o,defaultProp:l,onChange:u,caller:Sc}),K=A.useRef(null),ne=A.useRef(G);A.useEffect(()=>{const X=x?C?.ownerDocument.getElementById(x):C?.form;if(X instanceof HTMLFormElement){const fe=Et(()=>oe(ne.current),"reset");return X.addEventListener("reset",fe),()=>X.removeEventListener("reset",fe)}},[x,C,oe]);const re=C?!!x||!!C.closest("form"):!0,[me,B]=A.useState(new Set),z=OS(),q=Array.from(me).map(X=>X.props.value).join(";"),de=A.useCallback(X=>{B(fe=>new Set(fe).add(X))},[]),ve=A.useCallback(X=>{B(fe=>{const ge=new Set(fe);return ge.delete(X),ge})},[]),V={required:y,trigger:C,onTriggerChange:T,valueNode:_,onValueNodeChange:R,valueNodeHasChildren:M,onValueNodeHasChildrenChange:O,contentId:z,value:G,onValueChange:oe,open:P,onOpenChange:U,dir:L,triggerPointerDownPosRef:K,disabled:g,name:h,autoComplete:m,form:x,nativeOptions:me,nativeSelectKey:q,isFormControl:re};return b.jsx(QY,{...k,children:b.jsx(eJ,{scope:e,...V,children:b.jsx(hg.Provider,{scope:e,children:b.jsx(tJ,{scope:e,onNativeOptionAdd:de,onNativeOptionRemove:ve,children:jj(S)?S(V):n})})})})}Et(Dj,"SelectProvider");var pg=Et(t=>{const{__scopeSelect:e,children:n,...r}=t;return b.jsx(Dj,{__scopeSelect:e,...r,internal_do_not_use_render:({isFormControl:i})=>b.jsxs(b.Fragment,{children:[n,i?b.jsx(vJ,{__scopeSelect:e}):null]})})},"Select"),rJ="SelectTrigger",mg=A.forwardRef(Et(function(e,n){const{__scopeSelect:r,disabled:i=!1,...s}=e,o=BS(r),l=Fo(rJ,r),u=l.disabled||i,f=Xt(n,l.onTriggerChange),h=$S(r),m=A.useRef("touch"),[g,y,x]=VS(k=>{const C=h().filter(R=>!R.disabled),T=C.find(R=>R.value===l.value),_=HS(C,k,T);_!==void 0&&l.onValueChange(_.value)}),S=Et(k=>{u||(l.onOpenChange(!0),x()),k&&(l.triggerPointerDownPosRef.current={x:Math.round(k.pageX),y:Math.round(k.pageY)})},"handleOpen");return b.jsx(eX,{asChild:!0,...o,children:b.jsx(xn.button,{type:"button",role:"combobox","aria-controls":l.open?l.contentId:void 0,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:u,"data-disabled":u?"":void 0,"data-placeholder":ef(l.value)?"":void 0,...s,ref:f,onClick:on(s.onClick,k=>{k.currentTarget.focus(),m.current!=="mouse"&&S(k)}),onPointerDown:on(s.onPointerDown,k=>{m.current=k.pointerType;const C=k.target;C.hasPointerCapture(k.pointerId)&&C.releasePointerCapture(k.pointerId),k.button===0&&k.ctrlKey===!1&&k.pointerType==="mouse"&&(S(k),k.preventDefault())}),onKeyDown:on(s.onKeyDown,k=>{const C=g.current!=="";!(k.ctrlKey||k.altKey||k.metaKey)&&k.key.length===1&&y(k.key),!(C&&k.key===" ")&&XX.includes(k.key)&&(S(),k.preventDefault())})})})},"SelectTrigger")),iJ="SelectValue",gg=A.forwardRef(Et(function(e,n){const{__scopeSelect:r,className:i,style:s,children:o,placeholder:l="",...u}=e,f=Fo(iJ,r),{onValueNodeHasChildrenChange:h}=f,m=o!==void 0,g=Xt(n,f.onValueNodeChange);Xn(()=>{h(m)},[h,m]);const y=ef(f.value);return b.jsx(xn.span,{...u,asChild:y?!1:u.asChild,ref:g,style:{pointerEvents:"none"},children:b.jsx(A.Fragment,{children:y?l:o},y?"placeholder":"value")})},"SelectValue")),yg=A.forwardRef(Et(function(e,n){const{__scopeSelect:r,children:i,...s}=e;return b.jsx(xn.span,{"aria-hidden":!0,...s,ref:n,children:i||"▼"})},"SelectIcon")),sJ="SelectPortal",[oJ,aJ]=Xa(sJ,{forceMount:void 0}),vg=Et(t=>{const{__scopeSelect:e,forceMount:n,...r}=t;return b.jsx(oJ,{scope:t.__scopeSelect,forceMount:n,children:b.jsx(iX,{asChild:!0,...r})})},"SelectPortal"),Ua="SelectContent",bg=A.forwardRef(Et(function(e,n){const r=aJ(Ua,e.__scopeSelect),{forceMount:i=r.forceMount,...s}=e,o=Fo(Ua,e.__scopeSelect),[l,u]=A.useState();return Xn(()=>{u(new DocumentFragment)},[]),b.jsx(oX,{present:i||o.open,children:({present:f})=>f?b.jsx(uJ,{...s,ref:n}):b.jsx(lJ,{...s,fragment:l})})},"SelectContent")),lJ=A.forwardRef(Et(function(e,n){const{__scopeSelect:r,children:i,fragment:s}=e;return s?Tc.createPortal(b.jsx(Ij,{scope:r,children:b.jsx(hg.Slot,{scope:r,children:b.jsx("div",{ref:n,children:i})})}),s):null},"SelectContentFragment")),ni=10,[Ij,xg]=Xa(Ua),cJ=Da("SelectContent.RemoveScroll"),uJ=A.forwardRef(Et(function(e,n){const{__scopeSelect:r}=e,{position:i="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:o,onPointerDownOutside:l,side:u,sideOffset:f,align:h,alignOffset:m,arrowPadding:g,collisionBoundary:y,collisionPadding:x,sticky:S,hideWhenDetached:k,avoidCollisions:C,...T}=e,_=Fo(Ua,r),[R,M]=A.useState(null),[O,L]=A.useState(null),P=Xt(n,M),[U,G]=A.useState(null),[oe,K]=A.useState(null),ne=$S(r),[re,me]=A.useState(!1),B=A.useRef(!1);A.useEffect(()=>{if(R)return hX(R)},[R]),MS();const z=A.useCallback(ke=>{const[se,...pe]=ne().map(Fe=>Fe.ref.current),[Me]=pe.slice(-1),ze=document.activeElement;for(const Fe of ke)if(Fe===ze||(Fe?.scrollIntoView({block:"nearest"}),Fe===se&&O&&(O.scrollTop=0),Fe===Me&&O&&(O.scrollTop=O.scrollHeight),Fe?.focus(),document.activeElement!==ze))return},[ne,O]),q=A.useCallback(()=>z([U,R]),[z,U,R]);A.useEffect(()=>{re&&q()},[re,q]);const{onOpenChange:de,triggerPointerDownPosRef:ve}=_;A.useEffect(()=>{if(R){let ke={x:0,y:0};const se=Et(Me=>{ke={x:Math.abs(Math.round(Me.pageX)-(ve.current?.x??0)),y:Math.abs(Math.round(Me.pageY)-(ve.current?.y??0))}},"handlePointerMove"),pe=Et(Me=>{ke.x<=10&&ke.y<=10?Me.preventDefault():Me.composedPath().includes(R)||de(!1),document.removeEventListener("pointermove",se),ve.current=null},"handlePointerUp");return ve.current!==null&&(document.addEventListener("pointermove",se),document.addEventListener("pointerup",pe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",se),document.removeEventListener("pointerup",pe,{capture:!0})}}},[R,de,ve]),A.useEffect(()=>{const ke=Et(()=>de(!1),"close");return window.addEventListener("blur",ke),window.addEventListener("resize",ke),()=>{window.removeEventListener("blur",ke),window.removeEventListener("resize",ke)}},[de]);const[V,X]=VS(ke=>{const se=ne().filter(ze=>!ze.disabled),pe=se.find(ze=>ze.ref.current===document.activeElement),Me=HS(se,ke,pe);Me&&setTimeout(()=>Me.ref.current?.focus())}),fe=A.useCallback((ke,se,pe)=>{const Me=!B.current&&!pe;(_.value!==void 0&&_.value===se||Me)&&(G(ke),Me&&(B.current=!0))},[_.value]),ge=A.useCallback(()=>R?.focus(),[R]),Te=A.useCallback((ke,se,pe)=>{const Me=!B.current&&!pe;(_.value!==void 0&&_.value===se||Me)&&K(ke)},[_.value]),_e=i==="popper"?WR:dJ,Le=_e===WR?{side:u,sideOffset:f,align:h,alignOffset:m,arrowPadding:g,collisionBoundary:y,collisionPadding:x,sticky:S,hideWhenDetached:k,avoidCollisions:C}:{};return b.jsx(Ij,{scope:r,content:R,viewport:O,onViewportChange:L,itemRefCallback:fe,selectedItem:U,onItemLeave:ge,itemTextRefCallback:Te,focusSelectedItem:q,selectedItemText:oe,position:i,isPositioned:re,searchRef:V,children:b.jsx(Oj,{as:cJ,allowPinchZoom:!0,children:b.jsx(LZ,{asChild:!0,trapped:_.open,onMountAutoFocus:ke=>{ke.preventDefault()},onUnmountAutoFocus:on(s,ke=>{_.trigger?.focus({preventScroll:!0}),ke.preventDefault()}),children:b.jsx(RZ,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:ke=>ke.preventDefault(),onDismiss:()=>_.onOpenChange(!1),children:b.jsx(_e,{role:"listbox",id:_.contentId,"data-state":_.open?"open":"closed",dir:_.dir,onContextMenu:ke=>ke.preventDefault(),...T,...Le,onPlaced:()=>me(!0),ref:P,style:{display:"flex",flexDirection:"column",outline:"none",...T.style},onKeyDown:on(T.onKeyDown,ke=>{const se=ke.ctrlKey||ke.altKey||ke.metaKey;if(ke.key==="Tab"&&ke.preventDefault(),!se&&ke.key.length===1&&X(ke.key),["ArrowUp","ArrowDown","Home","End"].includes(ke.key)){let Me=ne().filter(ze=>!ze.disabled).map(ze=>ze.ref.current);if(["ArrowUp","End"].includes(ke.key)&&(Me=Me.slice().reverse()),["ArrowUp","ArrowDown"].includes(ke.key)){const ze=ke.target,Fe=Me.indexOf(ze);Me=Me.slice(Fe+1)}setTimeout(()=>z(Me)),ke.preventDefault()}})})})})})})},"SelectContentImpl")),dJ=A.forwardRef(Et(function(e,n){const{__scopeSelect:r,onPlaced:i,...s}=e,o=Fo(Ua,r),l=xg(Ua,r),[u,f]=A.useState(null),[h,m]=A.useState(null),g=Xt(n,m),y=$S(r),x=A.useRef(!1),S=A.useRef(!0),{viewport:k,selectedItem:C,selectedItemText:T,focusSelectedItem:_}=l,R=A.useCallback(()=>{if(o.trigger&&o.valueNode&&u&&h&&k&&C&&T){const P=o.trigger.getBoundingClientRect(),U=h.getBoundingClientRect(),G=o.valueNode.getBoundingClientRect(),oe=T.getBoundingClientRect();if(o.dir!=="rtl"){const ze=oe.left-U.left,Fe=G.left-ze,ft=P.left-Fe,ht=P.width+ft,Jt=Math.max(ht,U.width),jn=window.innerWidth-ni,un=Ex(Fe,[ni,Math.max(ni,jn-Jt)]);u.style.minWidth=ht+"px",u.style.left=un+"px"}else{const ze=U.right-oe.right,Fe=window.innerWidth-G.right-ze,ft=window.innerWidth-P.right-Fe,ht=P.width+ft,Jt=Math.max(ht,U.width),jn=window.innerWidth-ni,un=Ex(Fe,[ni,Math.max(ni,jn-Jt)]);u.style.minWidth=ht+"px",u.style.right=un+"px"}const K=y(),ne=window.innerHeight-ni*2,re=k.scrollHeight,me=window.getComputedStyle(h),B=parseInt(me.borderTopWidth,10),z=parseInt(me.paddingTop,10),q=parseInt(me.borderBottomWidth,10),de=parseInt(me.paddingBottom,10),ve=B+z+re+de+q,V=Math.min(C.offsetHeight*5,ve),X=window.getComputedStyle(k),fe=parseInt(X.paddingTop,10),ge=parseInt(X.paddingBottom,10),Te=P.top+P.height/2-ni,_e=ne-Te,Le=C.offsetHeight/2,ke=C.offsetTop+Le,se=B+z+ke,pe=ve-se;if(se<=Te){const ze=K.length>0&&C===K[K.length-1].ref.current;u.style.bottom="0px";const Fe=h.clientHeight-k.offsetTop-k.offsetHeight,ft=Math.max(_e,Le+(ze?ge:0)+Fe+q),ht=se+ft;u.style.height=ht+"px"}else{const ze=K.length>0&&C===K[0].ref.current;u.style.top="0px";const ft=Math.max(Te,B+k.offsetTop+(ze?fe:0)+Le)+pe;u.style.height=ft+"px",k.scrollTop=se-Te+k.offsetTop}u.style.margin=`${ni}px 0`,u.style.minHeight=V+"px",u.style.maxHeight=ne+"px",i?.(),requestAnimationFrame(()=>x.current=!0)}},[y,o.trigger,o.valueNode,u,h,k,C,T,o.dir,i]);Xn(()=>R(),[R]);const[M,O]=A.useState();Xn(()=>{h&&O(window.getComputedStyle(h).zIndex)},[h]);const L=A.useCallback(P=>{P&&S.current===!0&&(R(),_?.(),S.current=!1)},[R,_]);return b.jsx(fJ,{scope:r,contentWrapper:u,shouldExpandOnScrollRef:x,onScrollButtonChange:L,children:b.jsx("div",{ref:f,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:M},children:b.jsx(xn.div,{...s,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})},"SelectItemAlignedPosition")),WR=A.forwardRef(Et(function(e,n){const{__scopeSelect:r,align:i="start",collisionPadding:s=ni,...o}=e,l=BS(r);return b.jsx(tX,{...l,...o,ref:n,align:i,collisionPadding:s,style:{boxSizing:"border-box",...o.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)"}})},"SelectPopperPosition")),[fJ,hJ]=Xa(Ua,{}),KR="SelectViewport",wg=A.forwardRef(Et(function(e,n){const{__scopeSelect:r,nonce:i,...s}=e,o=xg(KR,r),l=hJ(KR,r),u=Xt(n,o.onViewportChange),f=A.useRef(0);return b.jsxs(b.Fragment,{children:[b.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:i}),b.jsx(hg.Slot,{scope:r,children:b.jsx(xn.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:u,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:on(s.onScroll,h=>{const m=h.currentTarget,{contentWrapper:g,shouldExpandOnScrollRef:y}=l;if(y?.current&&g){const x=Math.abs(f.current-m.scrollTop);if(x>0){const S=window.innerHeight-ni*2,k=parseFloat(g.style.minHeight),C=parseFloat(g.style.height),T=Math.max(k,C);if(T<S){const _=T+x,R=Math.min(S,_),M=_-R;g.style.height=R+"px",g.style.bottom==="0px"&&(m.scrollTop=M>0?M:0,g.style.justifyContent="flex-end")}}}f.current=m.scrollTop})})})]})},"SelectViewport")),pJ="SelectGroup",[ite,ste]=Xa(pJ),jx="SelectItem",[mJ,Lj]=Xa(jx),Sg=A.forwardRef(Et(function(e,n){const{__scopeSelect:r,value:i,disabled:s=!1,textValue:o,...l}=e,u=Fo(jx,r),f=xg(jx,r),h=u.value===i,[m,g]=A.useState(o??""),[y,x]=A.useState(!1),S=Ni(R=>f.itemRefCallback?.(R,i,s)),k=Xt(n,S),C=OS(),T=A.useRef("touch"),_=Et(()=>{s||(u.onValueChange(i),u.onOpenChange(!1))},"handleSelect");return b.jsx(mJ,{scope:r,value:i,disabled:s,textId:C,isSelected:h,onItemTextChange:A.useCallback(R=>{g(M=>M||(R?.textContent??"").trim())},[]),children:b.jsx(hg.ItemSlot,{scope:r,value:i,disabled:s,textValue:m,children:b.jsx(xn.div,{role:"option","aria-labelledby":C,"data-highlighted":y?"":void 0,"aria-selected":h&&y,"data-state":h?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...l,ref:k,onFocus:on(l.onFocus,()=>x(!0)),onBlur:on(l.onBlur,()=>x(!1)),onClick:on(l.onClick,()=>{T.current!=="mouse"&&_()}),onPointerUp:on(l.onPointerUp,()=>{T.current==="mouse"&&_()}),onPointerDown:on(l.onPointerDown,R=>{T.current=R.pointerType}),onPointerMove:on(l.onPointerMove,R=>{T.current=R.pointerType,s?f.onItemLeave?.():T.current==="mouse"&&R.currentTarget.focus({preventScroll:!0})}),onPointerLeave:on(l.onPointerLeave,R=>{R.currentTarget===document.activeElement&&f.onItemLeave?.()}),onKeyDown:on(l.onKeyDown,R=>{s||R.target!==R.currentTarget||f.searchRef?.current!==""&&R.key===" "||(JX.includes(R.key)&&_(),R.key===" "&&R.preventDefault())})})})})},"SelectItem")),Gh="SelectItemText",kg=A.forwardRef(Et(function(e,n){const{__scopeSelect:r,className:i,style:s,...o}=e,l=Fo(Gh,r),u=xg(Gh,r),f=Lj(Gh,r),h=nJ(Gh,r),[m,g]=A.useState(null),y=Ni(_=>u.itemTextRefCallback?.(_,f.value,f.disabled)),x=Xt(n,g,f.onItemTextChange,y),S=m?.textContent,k=A.useMemo(()=>b.jsx("option",{value:f.value,disabled:f.disabled,children:S},f.value),[f.disabled,f.value,S]),{onNativeOptionAdd:C,onNativeOptionRemove:T}=h;return Xn(()=>(C(k),()=>T(k)),[C,T,k]),b.jsxs(b.Fragment,{children:[b.jsx(xn.span,{id:f.textId,...o,ref:x}),f.isSelected&&l.valueNode&&!l.valueNodeHasChildren&&!ef(l.value)?Tc.createPortal(o.children,l.valueNode):null]})},"SelectItemText")),gJ="SelectItemIndicator",Cg=A.forwardRef(Et(function(e,n){const{__scopeSelect:r,...i}=e;return Lj(gJ,r).isSelected?b.jsx(xn.span,{"aria-hidden":!0,...i,ref:n}):null},"SelectItemIndicator")),yJ="SelectBubbleInput",vJ=A.forwardRef(Et(function({__scopeSelect:e,...n},r){const i=Fo(yJ,e),{value:s,onValueChange:o,required:l,disabled:u,name:f,autoComplete:h,form:m}=i,{nativeOptions:g,nativeSelectKey:y}=i,x=A.useRef(null),S=Xt(r,x),k=s??"",C=kj(k),T=Array.from(g).some(_=>(_.props.value??"")==="");return A.useEffect(()=>{const _=x.current;if(!_)return;const R=window.HTMLSelectElement.prototype,O=Object.getOwnPropertyDescriptor(R,"value").set;if(C!==k&&O){const L=new Event("change",{bubbles:!0});O.call(_,k),_.dispatchEvent(L)}},[C,k]),b.jsxs(xn.select,{"aria-hidden":!0,required:l,tabIndex:-1,name:f,autoComplete:h,disabled:u,form:m,onChange:_=>o(_.target.value),...n,style:{...cX,...n.style},ref:S,defaultValue:k,children:[ef(s)&&!T?b.jsx("option",{value:""}):null,Array.from(g)]},y)},"SelectBubbleInput"));function jj(t){return typeof t=="function"}Et(jj,"isFunction");function ef(t){return t===""||t===void 0}Et(ef,"shouldShowPlaceholder");function VS(t){const e=Ni(t),n=A.useRef(""),r=A.useRef(0),i=A.useCallback(o=>{const l=n.current+o;e(l),Et((function u(f){n.current=f,window.clearTimeout(r.current),f!==""&&(r.current=window.setTimeout(()=>u(""),1e3))}),"updateSearch")(l)},[e]),s=A.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return A.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,s]}Et(VS,"useTypeaheadSearch");function HS(t,e,n){const i=e.length>1&&Array.from(e).every(f=>f===e[0])?e[0]:e,s=n?t.indexOf(n):-1;let o=Pj(t,Math.max(s,0));i.length===1&&(o=o.filter(f=>f!==n));const u=o.find(f=>f.textValue.toLowerCase().startsWith(i.toLowerCase()));return u!==n?u:void 0}Et(HS,"findNextItem");function Pj(t,e){return t.map((n,r)=>t[(e+r)%t.length])}Et(Pj,"wrapArray");function US({id:t,value:e,field:n,readOnly:r,onChange:i}){const s=n.options?.filter(Boolean)??[],o=typeof e=="string"&&s.includes(e)?e:s[0]??"";return s.length===0?b.jsx("input",{id:t,type:"text",readOnly:r,value:o,disabled:!0}):b.jsxs(pg,{value:o,onValueChange:i,disabled:r,children:[b.jsxs(mg,{id:t,className:"vertebr-select-trigger",children:[b.jsx("span",{className:"vertebr-select-value",children:b.jsx(gg,{children:Yu(o,n)})}),b.jsx(yg,{className:"vertebr-select-icon",children:b.jsx(bJ,{})})]}),b.jsx(vg,{children:b.jsx(bg,{className:"vertebr-select-content",position:"popper",sideOffset:6,children:b.jsx(wg,{className:"vertebr-select-viewport",children:s.map(l=>b.jsxs(Sg,{value:l,className:"vertebr-select-item",children:[b.jsx(kg,{children:Yu(l,n)}),b.jsx(Cg,{className:"vertebr-select-check",children:b.jsx(xJ,{})})]},l))})})})]})}function bJ(){return b.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:b.jsx("path",{d:"M2.5 4.5 6 8l3.5-3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function xJ(){return b.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:b.jsx("path",{d:"M2.5 6.2 5 8.7 9.5 3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function wJ(t){return Array.isArray(t)?t.map(e=>String(e).trim()).filter(Boolean):[]}function SJ(t,e){const n=new Set(t),r=e.filter(s=>n.has(s)),i=t.filter(s=>!r.includes(s));return[...r.map(s=>({id:s,on:!0})),...i.map(s=>({id:s,on:!1}))]}function kJ({id:t,value:e,field:n,readOnly:r,onChange:i}){const s=n.options?.filter(Boolean)??[],o=wJ(e),l=SJ(s,o),u=f=>{i(f.filter(h=>h.on).map(h=>h.id))};return b.jsx("ul",{id:t,className:"vertebr-enum-list",children:l.map((f,h)=>b.jsxs("li",{className:"vertebr-enum-list-row","data-on":f.on,children:[b.jsxs("label",{className:"vertebr-enum-list-label",children:[b.jsx("input",{type:"checkbox",checked:f.on,disabled:r,onChange:m=>{const g=l.map(y=>y.id===f.id?{...y,on:m.target.checked}:y);u(g)}}),b.jsx("span",{children:Yu(f.id,n)})]}),b.jsxs("div",{className:"vertebr-enum-list-move",children:[b.jsx("button",{type:"button","aria-label":`Move ${Yu(f.id,n)} up`,disabled:r||h===0,onClick:()=>{if(h===0)return;const m=[...l],g=m[h];m[h]=m[h-1],m[h-1]=g,u(m)},children:"↑"}),b.jsx("button",{type:"button","aria-label":`Move ${Yu(f.id,n)} down`,disabled:r||h===l.length-1,onClick:()=>{if(h>=l.length-1)return;const m=[...l],g=m[h];m[h]=m[h+1],m[h+1]=g,u(m)},children:"↓"})]})]},f.id))})}function CJ({id:t,name:e,value:n,asCents:r=!0,readOnly:i,onBlur:s,onChange:o,inputRef:l}){const[u,f]=A.useState(()=>nb(n,r));A.useEffect(()=>{f(nb(n,r))},[n,r]);const h=typeof n=="number"&&Number.isFinite(n)?L0(n,{asCents:r}):null;return b.jsxs("div",{className:"vertebr-field-money",children:[b.jsx("span",{className:"vertebr-field-money-prefix","aria-hidden":"true",children:"$"}),b.jsx("input",{id:t,name:e,ref:l,type:"text",inputMode:"decimal",autoComplete:"off",readOnly:i,value:u,placeholder:"0.00","aria-label":h?`Price ${h}`:"Price",onChange:m=>{const g=m.target.value;f(g),o(dF(g,r))},onBlur:()=>{f(nb(n,r)),s?.()}})]})}function Px({fieldKey:t,field:e,groupLabel:n,variant:r,schema:i,watched:s,form:o,uploads:l,onUpload:u,galleryUpload:f,onListGallery:h,onUploadGallery:m,hideImagePreview:g,hideUpload:y,visibilityGroup:x}){const S=lU(t,e,n),k=bU(t,i,x??n),C=!k||s?.[k]!==!1,T=!g&&e.type!=="file[]"&&Oa(t,e)&&!!Rp(s?.[t]);return e.type==="boolean"?b.jsxs("div",{className:"vertebr-switch-row",children:[b.jsx(S_,{htmlFor:t,children:S}),b.jsx(ua,{control:o.control,name:t,render:({field:_})=>b.jsx(nF,{className:"vertebr-switch",id:t,checked:!!_.value,onCheckedChange:_.onChange,children:b.jsx(iF,{className:"vertebr-switch-thumb"})})})]}):b.jsxs("div",{className:"vertebr-field","data-span":fU(t,e,r),"data-kind":Oa(t,e)?"image":void 0,"data-storefront":k?C?"on":"off":void 0,children:[b.jsxs("div",{className:"vertebr-field-head",children:[b.jsx(S_,{htmlFor:t,children:S}),k?b.jsx(cO,{name:k,label:S,form:o}):null]}),T?b.jsxs("div",{className:"vertebr-field-media",children:[b.jsx("img",{src:Rp(s[t])??"",alt:""}),b.jsx("input",{id:t,type:"text",readOnly:e.readOnly,...o.register(t)})]}):e.type==="richtext"||FN(t,e)?b.jsx(ua,{control:o.control,name:t,render:({field:_})=>b.jsx(gZ,{id:t,name:_.name,inputRef:_.ref,value:typeof _.value=="string"?_.value:"",readOnly:e.readOnly,recordImages:uU(i,s),galleryUpload:f,onListGallery:h,onUploadGallery:m,onBlur:_.onBlur,onChange:_.onChange})}):e.type==="file[]"?b.jsx(ua,{control:o.control,name:t,render:({field:_})=>{const R=M0(_.value);return b.jsx("div",{className:"vertebr-field-files",children:R.length>0?b.jsx("ul",{className:"vertebr-field-files-list",children:R.map(M=>b.jsxs("li",{children:[b.jsx("img",{src:M,alt:""}),b.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",onClick:()=>_.onChange(R.filter(O=>O!==M)),children:"Remove"})]},M))}):b.jsx("p",{className:"vertebr-field-files-empty",children:"No photos yet"})})}}):e.type==="number"&&uO(t,e)?b.jsx(ua,{control:o.control,name:t,render:({field:_})=>b.jsx(CJ,{id:t,name:_.name,inputRef:_.ref,value:_.value,asCents:Tw(t,e)||/^pricing$/i.test(n),readOnly:e.readOnly,onBlur:_.onBlur,onChange:_.onChange})}):e.type==="number"?b.jsx(ua,{control:o.control,name:t,render:({field:_})=>b.jsx("input",{id:t,type:"number",readOnly:e.readOnly,value:typeof _.value=="number"&&Number.isFinite(_.value)?_.value:"",onBlur:_.onBlur,onChange:R=>{const M=R.target.value;_.onChange(M===""?void 0:Number(M))},name:_.name,ref:_.ref})}):e.type==="enum"?b.jsx(ua,{control:o.control,name:t,render:({field:_})=>b.jsx(US,{id:t,value:_.value,field:e,readOnly:e.readOnly,onChange:_.onChange})}):e.type==="enum[]"?b.jsx(ua,{control:o.control,name:t,render:({field:_})=>b.jsx(kJ,{id:t,value:_.value,field:e,readOnly:e.readOnly,onChange:_.onChange})}):GN(t,e)?b.jsx("textarea",{id:t,rows:5,readOnly:e.readOnly,...o.register(t)}):b.jsx("input",{id:t,type:"text",readOnly:e.readOnly,...o.register(t)}),!y&&l?.[t]&&u&&!e.readOnly?b.jsx(Fd,{meta:l[t],multiple:e.type==="file[]",onUpload:async _=>{const M=(await u(t,_)).map(O=>O.url).filter(Boolean);if(M.length){if(e.type==="file[]"){o.setValue(t,[...M0(o.getValues(t)),...M],{shouldDirty:!0,shouldTouch:!0});return}o.setValue(t,M[0],{shouldDirty:!0,shouldTouch:!0})}}}):null]})}function zj({form:t,isDirty:e,status:n,tone:r,onDiscard:i,submitLabel:s="Save changes"}){return b.jsxs("div",{className:"vertebr-actions",children:[b.jsx("button",{className:"vertebr-btn vertebr-btn-primary",type:"submit",disabled:t.formState.isSubmitting||!e,children:t.formState.isSubmitting?"Saving…":s}),e?b.jsx("button",{className:"vertebr-btn",type:"button",onClick:i,children:"Discard"}):null,e?b.jsx("span",{className:"vertebr-dirty",children:"Unsaved"}):n?b.jsx("span",{className:"vertebr-status","data-tone":r,children:n}):null,b.jsx("span",{className:"vertebr-actions-spacer"}),b.jsx("span",{className:"vertebr-kbd",children:"⌘S"})]})}function EJ({schema:t,groups:e,watched:n,form:r,uploads:i,onUpload:s,galleryUpload:o,onListGallery:l,onUploadGallery:u,onSubmit:f,isDirty:h,status:m,tone:g,onDiscard:y,submitLabel:x}){const S=CU(t,n),k=S?Rp(n?.[S])??"":"",C=e.filter(R=>/^(Media|Display|Status)$/i.test(R.id)),T=e.filter(R=>!/^(Media|Display|Status)$/i.test(R.id)),_={variant:"record",schema:t,watched:n,form:r,uploads:i,onUpload:s,galleryUpload:o,onListGallery:l,onUploadGallery:u};return b.jsxs("form",{className:"vertebr-form","data-variant":"record",onSubmit:f,children:[b.jsx("div",{className:"vertebr-form-scroll",children:b.jsxs("div",{className:"vertebr-record-layout",children:[b.jsxs("aside",{className:"vertebr-record-aside",children:[b.jsx("div",{className:"vertebr-record-preview",children:k&&bd(k)?b.jsx("img",{src:k,alt:""}):b.jsx("div",{className:"vertebr-record-preview-empty",children:"No image"})}),S&&i?.[S]&&s?b.jsx(Fd,{meta:i[S],label:"Drop a new image or browse",onUpload:async R=>{const[M]=await s(S,R);M?.url&&r.setValue(S,M.url,{shouldDirty:!0,shouldTouch:!0})}}):null,C.map(R=>b.jsxs("div",{className:"vertebr-record-block","data-layout":/^inventory$/i.test(R.id)?"chips":void 0,children:[b.jsx(ZR,{groupId:R.id,label:R.label,schema:t,form:r}),b.jsx("div",{className:"vertebr-form-fields","data-layout":dU(R.fields[0]?.[0]??"",R.fields[0]?.[1])?"chips":void 0,children:R.fields.map(([M,O])=>b.jsx(Px,{fieldKey:M,field:O,groupLabel:R.label,visibilityGroup:R.id,hideImagePreview:!0,hideUpload:M===S,..._},M))})]},R.id))]}),b.jsx("div",{className:"vertebr-record-main",children:T.map(R=>{const M=/^inventory$/i.test(R.id),O=/^specs$/i.test(R.id),L=xw(R.id,t),P=!L||n?.[L]!==!1;return b.jsxs("div",{className:"vertebr-record-block","data-layout":M?"chips":O?"specs":void 0,"data-storefront":L?P?"on":"off":void 0,children:[b.jsx(ZR,{groupId:R.id,label:R.label,schema:t,form:r}),b.jsx("div",{className:"vertebr-form-fields","data-layout":M?"chips":O?"specs":void 0,children:R.fields.map(([U,G])=>b.jsx(Px,{fieldKey:U,field:G,groupLabel:R.label,visibilityGroup:R.id,..._},U))})]},R.id)})})]})}),b.jsx(zj,{form:r,isDirty:h,status:m,tone:g,onDiscard:y,submitLabel:x})]})}function ZR({groupId:t,label:e,schema:n,form:r}){const i=xw(t,n);return b.jsxs("div",{className:"vertebr-record-block-label",children:[b.jsx("span",{children:e}),i?b.jsx(cO,{name:i,label:e,form:r}):null]})}function TJ({schema:t,groups:e,watched:n,form:r,uploads:i,onUpload:s,galleryUpload:o,onListGallery:l,onUploadGallery:u,onSubmit:f,isDirty:h,status:m,tone:g,onDiscard:y,submitLabel:x,hideActions:S}){const k=e.length===1;return b.jsxs("form",{className:"vertebr-form","data-variant":"config",onSubmit:f,children:[b.jsx("div",{className:"vertebr-form-scroll",children:e.map(C=>b.jsxs("div",{className:"vertebr-form-section","data-plain":k?"true":void 0,children:[k?null:b.jsxs("div",{className:"vertebr-form-section-head",children:[b.jsx("h3",{children:C.label}),b.jsx("span",{className:"vertebr-form-section-count",children:C.fields.length})]}),b.jsx("div",{className:"vertebr-form-fields",children:C.fields.map(([T,_])=>b.jsx(Px,{fieldKey:T,field:_,groupLabel:C.label,variant:"config",schema:t,watched:n,form:r,uploads:i,onUpload:s,galleryUpload:o,onListGallery:l,onUploadGallery:u},T))})]},C.id))}),S?null:b.jsx(zj,{form:r,isDirty:h,status:m,tone:g,onDiscard:y,submitLabel:x})]})}function Eg({schema:t,value:e,onSave:n,submitLabel:r,variant:i="config",uploads:s,onUpload:o,galleryUpload:l,onListGallery:u,onUploadGallery:f,onChange:h,hideActions:m}){const g=A.useMemo(()=>i==="record"?hU(t):t,[t,i]),y=A.useMemo(()=>i==="record"?pU(g,e):e,[g,e,i]),x=A.useMemo(()=>oU(g),[g]),S=A.useMemo(()=>kU(g,i),[g,i]),[k,C]=A.useState(null),[T,_]=A.useState(),R=EH({resolver:RH(x),defaultValues:y}),M=AN({control:R.control});A.useEffect(()=>{h?.(M??{})},[M,h]),A.useEffect(()=>{R.reset(y)},[y,R]);const O=R.handleSubmit(async G=>{C("Saving…"),_(void 0);try{await n(G),C("Saved"),_("ok")}catch(oe){C(oe instanceof Error?oe.message:"Save failed"),_("danger")}}),L=R.formState.isDirty;A.useEffect(()=>{const G=oe=>{(oe.metaKey||oe.ctrlKey)&&oe.key.toLowerCase()==="s"&&(oe.preventDefault(),O())};return window.addEventListener("keydown",G),()=>window.removeEventListener("keydown",G)},[O]);const U={schema:g,groups:S,watched:M,form:R,uploads:s,onUpload:o,galleryUpload:l,onListGallery:u,onUploadGallery:f,onSubmit:O,isDirty:L,status:k,tone:T,onDiscard:()=>{R.reset(y),C(null),_(void 0)},submitLabel:r,hideActions:m};return i==="record"?b.jsx(EJ,{...U}):b.jsx(TJ,{...U})}function YR(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").replace(/\bcents\b/i,"").trim()}function Wb(t){return Object.fromEntries(Object.entries(t).map(([e,n])=>typeof n=="string"?[e,{type:n,label:YR(e),required:!0}]:[e,{...n,label:n.label??YR(e),required:n.required??!0}]))}function FS(t){return Object.fromEntries(Object.entries(t).map(([e,n])=>n.type==="boolean"?[e,!1]:n.type==="number"?[e,0]:n.type==="enum"&&n.options?.length?[e,n.default??n.options[0]??""]:[e,n.default??""]))}function XR({title:t,count:e=0,eyebrow:n,schema:r,submitLabel:i,onClose:s,onSubmit:o}){return A.useEffect(()=>{const l=f=>{f.key==="Escape"&&s()};window.addEventListener("keydown",l);const u=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{window.removeEventListener("keydown",l),document.body.style.overflow=u}},[s]),b.jsx("div",{className:"vertebr-modal-backdrop",role:"presentation",onClick:s,children:b.jsxs("div",{className:"vertebr-modal vertebr-modal-form",role:"dialog","aria-modal":"true","aria-label":t,onClick:l=>l.stopPropagation(),children:[b.jsxs("header",{className:"vertebr-modal-head",children:[b.jsxs("div",{className:"vertebr-modal-heading",children:[b.jsx("p",{className:"vertebr-modal-eyebrow",children:n??(e===1?"1 person":`${e} people`)}),b.jsx("h2",{children:t})]}),b.jsx("div",{className:"vertebr-modal-actions",children:b.jsx("button",{type:"button",className:"vertebr-btn",onClick:s,"aria-label":"Close",children:"Close"})})]}),b.jsx("div",{className:"vertebr-modal-body",children:b.jsx(Eg,{variant:"config",schema:r,value:FS(r),submitLabel:i,onSave:async l=>{await o(l),s()}})})]})})}function Fl(t){return t.trim()}function Am({options:t,value:e,loading:n,disabled:r,placeholder:i="Select…",emptyLabel:s="Nothing available",searchPlaceholder:o="Search…",onChange:l}){const u=A.useId(),f=A.useRef(null),[h,m]=A.useState(!1),[g,y]=A.useState(""),x=A.useMemo(()=>new Set(e.map(Fl)),[e]),S=A.useMemo(()=>{const R=g.trim().toLowerCase();return R?t.filter(M=>`${M.label} ${M.secondary??""} ${M.id}`.toLowerCase().includes(R)):t},[t,g]);A.useEffect(()=>{if(!h)return;const R=O=>{f.current?.contains(O.target)||m(!1)},M=O=>{O.key==="Escape"&&m(!1)};return window.addEventListener("mousedown",R),window.addEventListener("keydown",M),()=>{window.removeEventListener("mousedown",R),window.removeEventListener("keydown",M)}},[h]);const k=R=>{const M=Fl(R),O=new Set(x);O.has(M)?O.delete(M):O.add(M),l(t.map(L=>Fl(L.id)).filter(L=>O.has(L)))},C=()=>{const R=new Set(x);for(const M of S)R.add(Fl(M.id));l(t.map(M=>Fl(M.id)).filter(M=>R.has(M)))},T=()=>l([]),_=e.length===0?n?"Loading…":t.length===0?s:i:e.length===1?t.find(R=>R.id===e[0])?.label??e[0]:`${e.length} selected`;return b.jsxs("div",{className:"vertebr-email-select",ref:f,"data-open":h?"true":void 0,children:[b.jsxs("button",{type:"button",className:"vertebr-select-trigger vertebr-email-select-trigger","aria-haspopup":"listbox","aria-expanded":h,"aria-controls":u,disabled:r||n||t.length===0,onClick:()=>m(R=>!R),children:[b.jsx("span",{className:"vertebr-select-value",children:_}),b.jsx("span",{className:"vertebr-select-icon","aria-hidden":"true",children:b.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",children:b.jsx("path",{d:"M2.5 4.5 6 8l3.5-3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),h?b.jsxs("div",{className:"vertebr-email-select-panel",id:u,role:"listbox",children:[t.length>6?b.jsxs("div",{className:"vertebr-email-select-toolbar",children:[b.jsx("input",{type:"search",value:g,placeholder:o,"aria-label":"Search",onChange:R=>y(R.target.value)}),b.jsxs("div",{className:"vertebr-email-select-actions",children:[b.jsx("button",{type:"button",onClick:C,children:"All"}),b.jsx("button",{type:"button",onClick:T,disabled:e.length===0,children:"Clear"})]})]}):b.jsx("div",{className:"vertebr-email-select-toolbar vertebr-email-select-toolbar-compact",children:b.jsxs("div",{className:"vertebr-email-select-actions",children:[b.jsx("button",{type:"button",onClick:C,children:"All"}),b.jsx("button",{type:"button",onClick:T,disabled:e.length===0,children:"Clear"})]})}),b.jsx("ul",{className:"vertebr-email-select-list",children:S.length===0?b.jsx("li",{className:"vertebr-email-select-empty",children:"No matches"}):S.map(R=>{const M=x.has(Fl(R.id));return b.jsx("li",{children:b.jsxs("label",{"data-on":M?"true":void 0,"data-media":R.imageUrl?"true":void 0,children:[b.jsx("input",{type:"checkbox",checked:M,onChange:()=>k(R.id)}),R.imageUrl?b.jsx("img",{className:"vertebr-email-select-thumb",src:R.imageUrl,alt:"",loading:"lazy"}):null,b.jsxs("span",{className:"vertebr-email-select-copy",children:[b.jsx("span",{className:"vertebr-email-select-primary",children:R.label}),R.secondary?b.jsx("span",{className:"vertebr-email-select-secondary",children:R.secondary}):null]})]})},R.id)})})]}):null]})}function _J({options:t,value:e,loading:n,disabled:r,onChange:i}){const s=t.map(o=>({id:o.email.trim().toLowerCase(),label:o.email,secondary:o.label}));return b.jsx(Am,{options:s,value:e,loading:n,disabled:r,placeholder:"Select emails…",emptyLabel:"No emails on this list",searchPlaceholder:"Search emails…",onChange:i})}function JR(t){const e=Date.parse(t);return Number.isFinite(e)?new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(e):t}function AJ(t){return t.replace(/^library:/i,"").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").trim()}function RJ(t){return t==="row"?"Row":t==="campaign"?"Schedule":"Board"}function $j(t){const e=t.reference?.trim();if(e&&e.toUpperCase()!=="MM-PENDING")return e;const i=(t.subject??"").match(/(?:—|-|–)\s*((?:MM|ORD|ORDER)[-_][A-Z0-9-]+|[A-Z]{2,}[-_][A-Z0-9-]{3,})\s*$/i)?.[1]?.trim();return!i||i.toUpperCase()==="MM-PENDING"?"":i}function MJ(t){const e=$j(t),n=t.subject?.trim()??"";if(!n)return t.templateLabel??"Email";let r=n;return e&&(r=r.replace(new RegExp(`\\s*[—\\-–]\\s*${e}\\s*$`,"i"),"").trim()),r.replace(/\s*[—\-–]\s*MM-PENDING\s*$/i,"").trim()||n}function NJ(t){if(t.recipients?.[0]){const e=Math.max(0,t.recipientCount-1);return e>0?`${t.recipients[0]} +${e}`:t.recipients[0]}return t.recipientCount>1?`${t.recipientCount} recipients`:""}function OJ(t){return t.failed&&t.failed>0?`${t.sent} / ${t.failed} failed`:`${t.sent} / ${t.recipientCount}`}function QR(t){return t==="sent"?{label:"Sent",tone:"ok"}:t==="partial"?{label:"Partial"}:t==="failed"?{label:"Failed"}:{label:"Scheduled",tone:"neutral"}}function ql(){return b.jsx("span",{className:"vertebr-cell-empty",children:"—"})}function DJ({campaigns:t,history:e,canSchedule:n,canHistory:r,busy:i,onCancel:s}){const[o,l]=A.useState("all"),u=A.useMemo(()=>t.filter(y=>y.status==="scheduled").slice().sort((y,x)=>Date.parse(y.sendAt)-Date.parse(x.sendAt)),[t]),f=A.useMemo(()=>{const y=u.map(S=>({kind:"scheduled",id:S.id,campaign:S})),x=e.map(S=>({kind:"history",id:S.id,entry:S}));return o==="scheduled"?y:o==="history"?x:[...y,...x]},[o,u,e]),h=!!s&&o!=="history",m=async y=>{s&&window.confirm(`Cancel scheduled email to ${y.resourceLabel??y.resourceId}?`)&&await s(y.id)},g=o==="scheduled"?n?"No drops scheduled yet.":"Host has not enabled scheduling.":o==="history"?r?"No sends recorded yet.":"Host has not enabled send history.":!n&&!r?"Host has not enabled activity.":"No activity yet.";return b.jsxs("div",{className:"vertebr-emails-activity",children:[b.jsxs("div",{className:"vertebr-table-toolbar",children:[b.jsx("div",{className:"vertebr-table-toolbar-start",children:b.jsxs("div",{className:"vertebr-emails-segment",role:"group","aria-label":"Activity",children:[b.jsx("button",{type:"button","data-active":o==="all"?"true":void 0,onClick:()=>l("all"),children:"All"}),b.jsx("button",{type:"button","data-active":o==="scheduled"?"true":void 0,onClick:()=>l("scheduled"),children:"Scheduled"}),b.jsx("button",{type:"button","data-active":o==="history"?"true":void 0,onClick:()=>l("history"),children:"History"})]})}),b.jsx("span",{className:"vertebr-count",children:f.length})]}),f.length===0?b.jsx("div",{className:"vertebr-empty",children:g}):b.jsx("div",{className:"vertebr-table-wrap",children:b.jsxs("table",{className:"vertebr-table",children:[b.jsx("thead",{children:b.jsxs("tr",{children:[b.jsx("th",{children:"When"}),b.jsx("th",{children:"Status"}),b.jsx("th",{children:"Subject"}),b.jsx("th",{children:"Confirmation"}),b.jsx("th",{children:"To"}),b.jsx("th",{children:"Audience"}),b.jsx("th",{children:"Template"}),b.jsx("th",{children:"Via"}),b.jsx("th",{children:"Delivery"}),h?b.jsx("th",{className:"vertebr-col-actions",children:"Actions"}):null]})}),b.jsx("tbody",{children:f.map(y=>{if(y.kind==="scheduled"){const T=y.campaign,_=QR("scheduled");return b.jsxs("tr",{children:[b.jsx("td",{children:b.jsx("span",{className:"vertebr-cell-datetime",children:JR(T.sendAt)})}),b.jsx("td",{children:b.jsx("span",{className:"vertebr-badge","data-tone":_.tone,children:_.label})}),b.jsx("td",{children:T.subject?.trim()||b.jsx(ql,{})}),b.jsx("td",{children:b.jsx(ql,{})}),b.jsx("td",{children:T.recipientCount??b.jsx(ql,{})}),b.jsx("td",{children:T.resourceLabel??T.resourceId}),b.jsx("td",{children:T.templateLabel??T.templateId}),b.jsx("td",{children:"Schedule"}),b.jsx("td",{children:b.jsx(ql,{})}),h?b.jsx("td",{className:"vertebr-col-actions",children:b.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",disabled:i,onClick:()=>{m(T)},children:"Cancel"})}):null]},`scheduled:${y.id}`)}const x=y.entry,S=QR(x.status),k=$j(x),C=NJ(x);return b.jsxs("tr",{children:[b.jsx("td",{children:b.jsx("span",{className:"vertebr-cell-datetime",children:JR(x.at)})}),b.jsx("td",{children:b.jsx("span",{className:"vertebr-badge","data-tone":S.tone,children:S.label})}),b.jsx("td",{children:MJ(x)}),b.jsx("td",{children:k||b.jsx(ql,{})}),b.jsx("td",{children:C||b.jsx(ql,{})}),b.jsx("td",{children:x.resourceLabel??x.resourceId}),b.jsx("td",{children:x.templateLabel??AJ(x.templateId)}),b.jsx("td",{children:RJ(x.source)}),b.jsx("td",{children:OJ(x)}),h?b.jsx("td",{className:"vertebr-col-actions"}):null]},`history:${y.id}`)})})]})})]})}function IJ({value:t,options:e,onChange:n,ariaLabel:r,size:i="md"}){const[s,o]=A.useState(!1),l=A.useRef(null),u=A.useId(),f=e.find(h=>h.id===t)??e[0];return A.useEffect(()=>{if(!s)return;const h=g=>{l.current?.contains(g.target)||o(!1)},m=g=>{g.key==="Escape"&&o(!1)};return document.addEventListener("mousedown",h),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",h),document.removeEventListener("keydown",m)}},[s]),b.jsxs("div",{className:"vertebr-emails-nav","data-size":i,"data-open":s||void 0,ref:l,children:[b.jsxs("button",{type:"button",className:"vertebr-emails-nav-trigger","aria-label":r,"aria-haspopup":"listbox","aria-expanded":s,"aria-controls":u,onClick:()=>o(h=>!h),children:[b.jsxs("span",{className:"vertebr-emails-nav-current",children:[b.jsx("span",{className:"vertebr-emails-nav-label",children:f?.label}),f?.count!=null?b.jsx("span",{className:"vertebr-emails-nav-count",children:f.count}):null]}),b.jsx("span",{className:"vertebr-emails-nav-chevron","aria-hidden":"true",children:"▾"})]}),s?b.jsx("ul",{id:u,className:"vertebr-emails-nav-menu",role:"listbox","aria-label":r,children:e.map(h=>{const m=h.id===t;return b.jsx("li",{role:"presentation",children:b.jsxs("button",{type:"button",role:"option","aria-selected":m,"data-active":m||void 0,className:"vertebr-emails-nav-option",onClick:()=>{n(h.id),o(!1)},children:[b.jsxs("span",{className:"vertebr-emails-nav-option-main",children:[b.jsx("span",{className:"vertebr-emails-nav-label",children:h.label}),h.count!=null?b.jsx("span",{className:"vertebr-emails-nav-count",children:h.count}):null]}),h.hint?b.jsx("span",{className:"vertebr-emails-nav-hint",children:h.hint}):null]})},h.id)})}):null]})}const LJ=new Set(["custom","promo","custom_discount"]);function jJ(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").trim()}function PJ(t){const e=new Set,n=[];for(const r of t){const i=r.input?.preset;if(!(!i||typeof i=="string")&&!(i.type!=="enum"||!i.options?.length))for(const s of i.options)!s||LJ.has(s)||s.startsWith("library:")||e.has(s)||(e.add(s),n.push({id:s,label:i.optionLabels?.[s]?.trim()||jJ(s)}))}return n}function Kb(t){return{id:t?.id??`lib_${crypto.randomUUID().replace(/-/g,"").slice(0,12)}`,label:t?.label??"",subject:t?.subject??"",body:t?.body??"",productIds:t?.productIds??[],discountId:t?.discountId,discountCode:t?.discountCode??"",discountOffer:t?.discountOffer??"",discountExpires:t?.discountExpires??"",fromPreset:t?.fromPreset,kind:t?.kind,eyebrow:t?.eyebrow??"",headline:t?.headline??"",confirmationLabel:t?.confirmationLabel??"",shippingNote:t?.shippingNote??"",footer:t?.footer??"",signOff:t?.signOff??"",createdAt:t?.createdAt}}function zJ(t){return/order_?confirm|receipt|invoice/i.test(t)?"order":/discount|offer|sale|flash/i.test(t)?"discount":/promo|drop|restock/i.test(t)?"promo":"account"}function $J(t){return Array.isArray(t)?t.join(", "):t}function BJ(t,e){return{preset:e?`library:${t.id}`:t.kind==="discount"?"custom_discount":t.kind==="promo"?"promo":"custom",kind:t.kind,subject:t.subject,body:t.body,productIds:t.productIds,discountId:t.discountId,discountCode:t.discountCode,discountOffer:t.discountOffer,discountExpires:t.discountExpires,eyebrow:t.eyebrow,headline:t.headline,confirmationLabel:t.confirmationLabel,shippingNote:t.shippingNote,footer:t.footer,signOff:t.signOff}}function VJ(t){return t.kind==="order"?!0:!t.subject.trim()||!t.body.trim()?!1:t.kind==="discount"?!!(t.discountCode.trim()&&t.discountOffer.trim()):!0}function HJ({templates:t,library:e,products:n,discounts:r=[],canLibrary:i,busy:s,previewResourceId:o,previewTemplateId:l,onPreview:u,onSaveLibrary:f,onDeleteLibrary:h}){const m=A.useMemo(()=>PJ(t),[t]),[g,y]=A.useState(null),[x,S]=A.useState(!1),[k,C]=A.useState(null),[T,_]=A.useState("all"),[R,M]=A.useState(null),[O,L]=A.useState(!1),P=!!(g&&e.some(z=>z.id===g.id)),U=A.useMemo(()=>n.map(z=>({id:z.id,label:z.label,secondary:z.priceLabel,imageUrl:z.imageUrl})),[n]),G=A.useCallback(async()=>{if(!g||!u||!o||!l){M(null);return}if(!VJ(g)){M(null);return}L(!0);try{const z=await u({resourceId:o,templateId:l,input:BJ(g,P)});M(z)}catch{M(null)}finally{L(!1)}},[g,u,o,l,P]);A.useEffect(()=>{const z=window.setTimeout(()=>{G()},280);return()=>window.clearTimeout(z)},[G]);const oe=z=>{C(null),y(Kb({label:`${z.label} copy`,fromPreset:z.id,kind:zJ(z.id)}))},K=z=>{C(null),y(Kb({id:z.id,label:z.label,subject:z.subject,body:z.body,productIds:z.productIds??[],discountId:z.discountId,discountCode:z.discountCode??"",discountOffer:z.discountOffer??"",discountExpires:z.discountExpires??"",fromPreset:z.fromPreset,kind:z.kind,eyebrow:z.eyebrow??"",headline:z.headline??"",confirmationLabel:z.confirmationLabel??"",shippingNote:z.shippingNote??"",footer:z.footer??"",signOff:z.signOff??"",createdAt:z.createdAt}))},ne=()=>{C(null),y(Kb({kind:"promo"}))},re=async()=>{if(!g||!f)return;const z=g.label.trim(),q=g.subject.trim(),de=g.body.trim();if(!z||!q||!de){C("Label, subject, and body are required.");return}if(g.kind==="discount"&&(!g.discountCode.trim()||!g.discountOffer.trim())){C("Discount templates need a code and offer label.");return}S(!0),C(null);try{const ve=new Date().toISOString();await f({id:g.id,label:z,subject:q,body:de,productIds:g.productIds.length?g.productIds:void 0,discountId:g.kind==="discount"&&g.discountId||void 0,discountCode:g.kind==="discount"&&g.discountCode.trim()||void 0,discountOffer:g.kind==="discount"&&g.discountOffer.trim()||void 0,discountExpires:g.kind==="discount"&&g.discountExpires.trim()||void 0,fromPreset:g.fromPreset,kind:g.kind,eyebrow:g.kind==="order"&&g.eyebrow.trim()||void 0,headline:g.kind==="order"&&g.headline.trim()||void 0,confirmationLabel:g.kind==="order"&&g.confirmationLabel.trim()||void 0,shippingNote:g.kind==="order"&&g.shippingNote.trim()||void 0,footer:g.kind==="order"&&g.footer.trim()||void 0,signOff:g.kind==="order"&&g.signOff.trim()||void 0,createdAt:g.createdAt??ve,updatedAt:ve}),y(null)}catch(ve){C(ve instanceof Error?ve.message:"Save failed")}finally{S(!1)}},me=async z=>{if(h&&window.confirm(`Delete template “${z.label}”?`)){S(!0),C(null);try{await h(z.id),g?.id===z.id&&y(null)}catch(q){C(q instanceof Error?q.message:"Delete failed")}finally{S(!1)}}},B=s||x||!i||!f;return b.jsx("div",{className:"vertebr-emails-library","data-editing":g?"true":void 0,children:g?b.jsxs("div",{className:"vertebr-emails-library-editor",children:[b.jsxs("header",{children:[b.jsx("h3",{children:P?"Edit template":"Save as custom"}),b.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",disabled:x,onClick:()=>{y(null),M(null)},children:"Close"})]}),b.jsxs("div",{className:"vertebr-emails-layout",children:[b.jsxs("div",{className:"vertebr-emails-compose",children:[b.jsxs("div",{className:"vertebr-emails-fields",children:[b.jsxs("label",{className:"vertebr-mail-field",children:[b.jsx("span",{children:"Label"}),b.jsx("input",{type:"text",value:g.label,disabled:x,onChange:z=>y(q=>q&&{...q,label:z.target.value})})]}),b.jsx("div",{className:"vertebr-emails-segment",role:"group","aria-label":"Kind",children:[["account","Account"],["promo","Promo"],["discount","Discount"],["order","Order"]].map(([z,q])=>b.jsx("button",{type:"button","data-active":g.kind===z?"true":void 0,disabled:x||g.kind==="order",onClick:()=>y(de=>de&&{...de,kind:z}),children:q},z))}),b.jsxs("label",{className:"vertebr-mail-field",children:[b.jsx("span",{children:"Subject"}),b.jsx("input",{type:"text",value:g.subject,disabled:x,onChange:z=>y(q=>q&&{...q,subject:z.target.value})})]}),b.jsxs("label",{className:"vertebr-mail-field",children:[b.jsx("span",{children:g.kind==="order"?"Intro":"Body"}),b.jsx("textarea",{rows:g.kind==="order"?4:7,value:g.body,disabled:x,onChange:z=>y(q=>q&&{...q,body:z.target.value})})]}),g.kind==="order"?b.jsxs(b.Fragment,{children:[b.jsxs("label",{className:"vertebr-mail-field",children:[b.jsx("span",{children:"Eyebrow"}),b.jsx("input",{type:"text",value:g.eyebrow,disabled:x,onChange:z=>y(q=>q&&{...q,eyebrow:z.target.value})})]}),b.jsxs("label",{className:"vertebr-mail-field",children:[b.jsx("span",{children:"Headline"}),b.jsx("input",{type:"text",value:g.headline,disabled:x,onChange:z=>y(q=>q&&{...q,headline:z.target.value})})]}),b.jsxs("label",{className:"vertebr-mail-field",children:[b.jsx("span",{children:"Confirmation label"}),b.jsx("input",{type:"text",value:g.confirmationLabel,disabled:x,onChange:z=>y(q=>q&&{...q,confirmationLabel:z.target.value})})]}),b.jsxs("label",{className:"vertebr-mail-field",children:[b.jsx("span",{children:"Shipping note"}),b.jsx("textarea",{rows:2,value:g.shippingNote,disabled:x,onChange:z=>y(q=>q&&{...q,shippingNote:z.target.value})})]}),b.jsxs("label",{className:"vertebr-mail-field",children:[b.jsx("span",{children:"Footer"}),b.jsx("textarea",{rows:2,value:g.footer,disabled:x,onChange:z=>y(q=>q&&{...q,footer:z.target.value})})]}),b.jsxs("label",{className:"vertebr-mail-field",children:[b.jsx("span",{children:"Sign-off"}),b.jsx("input",{type:"text",value:g.signOff,disabled:x,onChange:z=>y(q=>q&&{...q,signOff:z.target.value})})]}),b.jsxs("p",{className:"vertebr-mail-compose-hint",children:["Tokens: ","{{confirmationNumber}}",", ","{{email}}",","," ","{{total}}"]})]}):null,g.kind==="discount"?b.jsxs(b.Fragment,{children:[r.length>0?b.jsxs("label",{className:"vertebr-mail-field",children:[b.jsx("span",{children:"Discount"}),b.jsxs("select",{value:g.discountId??"",disabled:x,onChange:z=>{const q=z.target.value,de=r.find(ve=>ve.id===q);y(ve=>ve&&{...ve,discountId:q||void 0,discountCode:de?.code??ve.discountCode,discountOffer:de?.offerLabel??de?.label??ve.discountOffer,discountExpires:de?.expiresLabel??ve.discountExpires})},children:[b.jsx("option",{value:"",children:"Manual code…"}),r.map(z=>b.jsxs("option",{value:z.id,children:[z.label,z.code?` (${z.code})`:""]},z.id))]})]}):null,b.jsxs("label",{className:"vertebr-mail-field",children:[b.jsx("span",{children:"Discount code"}),b.jsx("input",{type:"text",value:g.discountCode,disabled:x,placeholder:"WELCOME20",onChange:z=>y(q=>q&&{...q,discountCode:z.target.value})})]}),b.jsxs("label",{className:"vertebr-mail-field",children:[b.jsx("span",{children:"Offer label"}),b.jsx("input",{type:"text",value:g.discountOffer,disabled:x,placeholder:"20% off",onChange:z=>y(q=>q&&{...q,discountOffer:z.target.value})})]}),b.jsxs("label",{className:"vertebr-mail-field",children:[b.jsx("span",{children:"Expires (optional)"}),b.jsx("input",{type:"text",value:g.discountExpires,disabled:x,placeholder:"Expires Mar 1",onChange:z=>y(q=>q&&{...q,discountExpires:z.target.value})})]})]}):null,U.length>0?b.jsxs("label",{className:"vertebr-mail-field",children:[b.jsx("span",{children:"Products"}),b.jsx(Am,{options:U,value:g.productIds,disabled:x,placeholder:"Add products with photos…",emptyLabel:"No products",onChange:z=>y(q=>q&&{...q,productIds:z})})]}):null,g.fromPreset?b.jsxs("p",{className:"vertebr-emails-library-meta",children:["From system preset ",b.jsx("code",{children:g.fromPreset})]}):null,k?b.jsx("p",{className:"vertebr-mail-compose-error",children:k}):null]}),b.jsx("div",{className:"vertebr-mail-compose-foot",children:b.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-primary",disabled:x||!f,onClick:()=>{re()},children:x?"Saving…":"Save template"})})]}),b.jsx("div",{className:"vertebr-emails-side",children:b.jsxs("div",{className:"vertebr-mail-preview",children:[b.jsxs("div",{className:"vertebr-mail-preview-meta",children:[b.jsxs("p",{children:[b.jsx("span",{children:"To"}),b.jsx("strong",{children:R?$J(R.to):O?"Updating…":"Sample recipient"})]}),b.jsxs("p",{children:[b.jsx("span",{children:"Subject"}),b.jsx("strong",{children:R?.subject??(O?"Updating…":g.subject||"—")})]})]}),b.jsx("div",{className:"vertebr-mail-preview-stage",children:b.jsx("div",{className:"vertebr-mail-preview-frame",children:R?.html?b.jsx("iframe",{title:"Email preview",sandbox:"",srcDoc:R.html}):R?.text?b.jsx("pre",{children:R.text}):b.jsx("div",{className:"vertebr-mail-preview-empty",children:O?"Rendering host template…":!o||!l?"No sample audience to preview against.":g.kind==="discount"&&(!g.discountCode.trim()||!g.discountOffer.trim())?"Add a discount code and offer to preview.":"Write a subject and body to preview."})})})]})})]})]}):b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:"vertebr-emails-subnav",children:[b.jsx(IJ,{size:"sm",ariaLabel:"Templates subsection",value:T,onChange:_,options:[{id:"all",label:"All templates",count:m.length+e.length,hint:"Presets and saved"},{id:"system",label:"System presets",count:m.length,hint:"Built-in starting points"},{id:"saved",label:"Saved templates",count:e.length,hint:"Owner-edited copies"}]}),i&&f&&T!=="system"?b.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",disabled:B,onClick:ne,children:"New"}):null]}),b.jsxs("div",{className:"vertebr-emails-library-cols","data-section":T,children:[T!=="saved"?b.jsxs("section",{className:"vertebr-emails-library-section",children:[b.jsxs("header",{children:[b.jsx("h3",{children:"System presets"}),b.jsx("span",{className:"vertebr-count",children:m.length})]}),m.length===0?b.jsx("p",{className:"vertebr-emails-campaigns-empty",children:"No system presets exposed on template inputs."}):b.jsx("ul",{children:m.map(z=>b.jsxs("li",{children:[b.jsxs("div",{children:[b.jsx("strong",{children:z.label}),b.jsx("span",{children:z.id})]}),i&&f?b.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",disabled:B,onClick:()=>oe(z),children:"Duplicate"}):null]},z.id))})]}):null,T!=="system"?b.jsxs("section",{className:"vertebr-emails-library-section",children:[b.jsxs("header",{children:[b.jsx("h3",{children:"Saved templates"}),b.jsx("span",{className:"vertebr-count",children:e.length})]}),i?e.length===0?b.jsx("p",{className:"vertebr-emails-campaigns-empty",children:"No saved templates yet. Duplicate a system preset or create one."}):b.jsx("ul",{children:e.map(z=>b.jsxs("li",{children:[b.jsxs("div",{children:[b.jsx("strong",{children:z.label}),b.jsxs("span",{children:[z.fromPreset?`from ${z.fromPreset}`:"custom",z.kind==="discount"?" · discount":"",z.kind==="order"?" · order":"",z.discountCode?` · ${z.discountCode}`:"",z.productIds?.length?` · ${z.productIds.length} products`:""]}),z.subject?b.jsx("span",{className:"vertebr-emails-campaign-subject",children:z.subject}):null]}),b.jsxs("div",{className:"vertebr-emails-library-actions",children:[b.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",disabled:B,onClick:()=>K(z),children:"Edit"}),h&&z.kind!=="order"?b.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",disabled:B,onClick:()=>{me(z)},children:"Delete"}):null]})]},z.id))}):b.jsx("p",{className:"vertebr-emails-campaigns-empty",children:"Host has not enabled the template library."})]}):null]})]})})}const UJ=new Set(["custom","promo","custom_discount"]),FJ=new Set(["discount","welcome_offer","flash_sale","custom_discount"]),qJ=new Set(["discountId","discountCode","discountOffer","discountExpires"]);function kc(t){return typeof t=="string"?t:String(t??"")}function qS(t){return t.startsWith("library:")}function GJ(t){return UJ.has(t)||qS(t)}function GS(t,e){if(FJ.has(t))return!0;if(!qS(t))return!1;const n=t.slice(8);return e.some(r=>r.id===n&&r.kind==="discount")}function WJ(t,e){const n=`${t} ${e.label??""}`;return e.type==="richtext"||/(body|message|html|notes)/i.test(n)}function Bj(t,e){if(!t.preset)return!0;const n=kc(e.preset);return!n||GJ(n)}function Vj(t,e,n,r=[]){if(t==="subject"||t==="body")return Bj(e,n);if(qJ.has(t)){const i=kc(n.preset);return!(!GS(i,r)||t==="discountId"&&!e.discountId?.options?.length)}return!0}function eM(t,e,n=[]){return Object.entries(t).every(([r,i])=>{if(!Vj(r,t,e,n))return!0;const s=(r==="subject"||r==="body")&&Bj(t,e),o=(r==="discountCode"||r==="discountOffer")&&GS(kc(e.preset),n);return i.required===!1&&!s&&!o?!0:i.type==="enum[]"?i.required===!1?!0:Array.isArray(e[r])&&e[r].length>0:i.type!=="string"&&i.type!=="richtext"&&i.type!=="enum"?!0:!!kc(e[r]).trim()})}function KJ(t){return t?Object.fromEntries(Object.entries(t).map(([e,n])=>typeof n=="string"?[e,{type:n,label:e,required:!0}]:[e,n])):{}}function ZJ(t,e,n,r){const i={...t};if(i.preset?.type==="enum"&&e.length>0){const s=e.map(u=>`library:${u.id}`),o=Object.fromEntries(e.map(u=>[`library:${u.id}`,u.label])),l=[...i.preset.options??[]];for(const u of s)l.includes(u)||l.push(u);i.preset={...i.preset,options:l,optionLabels:{...i.preset.optionLabels??{},...o}}}if(i.productIds&&n&&n.length>0){const s=n.map(l=>l.id),o=Object.fromEntries(n.map(l=>[l.id,l.label]));i.productIds={...i.productIds,type:"enum[]",options:s,optionLabels:{...i.productIds.optionLabels??{},...o},default:Array.isArray(i.productIds.default)?i.productIds.default:[]}}if(i.discountId&&r&&r.length>0){const s=r.map(l=>l.id),o=Object.fromEntries(r.map(l=>[l.id,l.offerLabel?`${l.label}${l.code?` (${l.code})`:""}`:l.label]));i.discountId={...i.discountId,type:"enum",options:s,optionLabels:{...i.discountId.optionLabels??{},...o},required:!1}}return i}function YJ(t){const e=FS(t);for(const[n,r]of Object.entries(t))r.type==="enum[]"&&!Array.isArray(e[n])&&(e[n]=Array.isArray(r.default)?r.default:[]);return e}function XJ(t,e,n,r){if(!qS(e))return t;const i=e.slice(8),s=n.find(o=>o.id===i);return s?{...t,preset:e,subject:s.subject,body:s.body,...r.productIds?{productIds:s.productIds??[]}:{},...r.discountId?{discountId:s.discountId??""}:{},...r.discountCode?{discountCode:s.discountCode??""}:{},...r.discountOffer?{discountOffer:s.discountOffer??""}:{},...r.discountExpires?{discountExpires:s.discountExpires??""}:{}}:t}function JJ(t){return Array.isArray(t)?t.join(", "):t}function QJ(t){const e=Date.parse(t);return Number.isFinite(e)?new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(e):t}function eQ(){const t=new Date(Date.now()+36e5);t.setMinutes(0,0,0);const e=n=>String(n).padStart(2,"0");return`${t.getFullYear()}-${e(t.getMonth()+1)}-${e(t.getDate())}T${e(t.getHours())}:${e(t.getMinutes())}`}function tQ(t){return Array.isArray(t)?t.map(e=>String(e).trim()).filter(Boolean):[]}function nQ({data:t,loading:e,tab:n,onRefresh:r,onLoadRecipients:i,onPreview:s,onSend:o,onSchedule:l,onCancel:u,onSaveLibrary:f,onDeleteLibrary:h}){const m=t.audiences,g=t.library??[],y=t.products??[],x=t.discounts??[],S=t.history??[],[k]=A.useState("compose"),C=n??k,T=A.useMemo(()=>m.map(ee=>({id:ee.id,label:ee.label})),[m]),[_,R]=A.useState(()=>m[0]?[m[0].id]:[]),M=A.useMemo(()=>m.filter(ee=>_.includes(ee.id)),[m,_]),O=A.useMemo(()=>M.length===0?[]:t.templates.filter(ee=>M.every(le=>le.templates.includes(ee.id))),[t.templates,M]),[L,P]=A.useState(O[0]?.id??""),U=O.find(ee=>ee.id===L)??O[0],G=A.useMemo(()=>ZJ(KJ(U?.input),g,y,x),[x,g,y,U]),oe=A.useMemo(()=>YJ(G),[G]),[K,ne]=A.useState(oe),[re,me]=A.useState("all"),[B,z]=A.useState([]),[q,de]=A.useState([]),[ve,V]=A.useState(!1),[X,fe]=A.useState("now"),[ge,Te]=A.useState(eQ),[_e,Le]=A.useState(null),[ke,se]=A.useState(!1),[pe,Me]=A.useState(!1),[ze,Fe]=A.useState(null),[ft,ht]=A.useState(null);A.useEffect(()=>{R(ee=>{const le=ee.filter(I=>m.some(D=>D.id===I));return le.length>0?le:m[0]?[m[0].id]:[]})},[m]),A.useEffect(()=>{if(!U){P("");return}O.some(ee=>ee.id===L)||P(U.id)},[U,L,O]),A.useEffect(()=>{ne(oe)},[oe]),A.useEffect(()=>{z([])},[_]);const Jt=M.map(ee=>ee.id).join("|");A.useEffect(()=>{if(M.length===0){de([]);return}let ee=!1;return V(!0),Promise.all(M.map(async le=>(await i(le.id)).map(D=>({...D,resourceId:le.id,label:D.label?`${D.label} · ${le.label}`:le.label})))).then(le=>{if(ee)return;const I=new Set,D=[];for(const j of le)for(const W of j){const Q=W.email.trim().toLowerCase();!Q||I.has(Q)||(I.add(Q),D.push({...W,email:Q}))}D.sort((j,W)=>j.email.localeCompare(W.email)),de(D)}).catch(le=>{ee||(de([]),Fe(le instanceof Error?le.message:"Failed to load emails"))}).finally(()=>{ee||V(!1)}),()=>{ee=!0}},[Jt,i,M]);const jn=M[0],un=M.length>0&&!!U&&(!Object.keys(G).length||eM(G,K,g))&&(re==="all"||B.length>0)&&(X==="now"||!!ge)&&!pe,Sn=A.useMemo(()=>{if(re!=="emails"||B.length===0)return;const ee=q.find(le=>le.email.trim().toLowerCase()===B[0]?.toLowerCase());return ee?.id??ee?.email??B[0]},[q,re,B]),dn=A.useMemo(()=>{if(re==="emails"&&B[0]){const ee=q.find(le=>le.email.trim().toLowerCase()===B[0]?.toLowerCase());if(ee?.resourceId)return ee.resourceId}return jn?.id},[jn?.id,q,re,B]),tr=A.useCallback(async()=>{if(C==="compose"){if(!dn||!U){Le(null);return}if(Object.keys(G).length&&!eM(G,K,g)){Le(null);return}se(!0),Fe(null);try{const ee=await s({resourceId:dn,templateId:U.id,rowId:Sn,input:Object.keys(G).length?K:void 0});Le(ee)}catch(ee){Le(null),Fe(ee instanceof Error?ee.message:"Preview failed")}finally{se(!1)}}},[K,s,dn,Sn,G,C,U]);A.useEffect(()=>{const ee=window.setTimeout(()=>{tr()},280);return()=>window.clearTimeout(ee)},[tr]);const Kr=ee=>{const le=q.find(I=>I.email.trim().toLowerCase()===ee.toLowerCase());return le?.resourceId?[le.resourceId]:M.map(I=>I.id)},Ar=async()=>{if(!(!un||!U||M.length===0)){Me(!0),Fe(null),ht(null);try{const ee=Object.keys(G).length?K:void 0;if(X==="later"){if(!l)throw new Error("Scheduling is not available.");const le=new Date(ge).toISOString();if(re==="all")for(const I of M)await l({resourceId:I.id,templateId:U.id,input:ee,audience:{mode:"all"},sendAt:le});else{const I=new Map;for(const D of B)for(const j of Kr(D)){const W=I.get(j)??[];W.push(D),I.set(j,W)}for(const[D,j]of I)await l({resourceId:D,templateId:U.id,input:ee,audience:{mode:"emails",emails:j},sendAt:le})}ht(`Scheduled for ${QJ(le)}.`)}else{let le=0,I=0;if(re==="all")for(const D of M){const j=await o({resourceId:D.id,templateId:U.id,input:ee,audience:{mode:"all"}});le+=j.sent,I+=j.failed}else{const D=new Map;for(const j of B)for(const W of Kr(j)){const Q=D.get(W)??[];Q.push(j),D.set(W,Q)}for(const[j,W]of D){const Q=await o({resourceId:j,templateId:U.id,input:ee,audience:{mode:"emails",emails:W}});le+=Q.sent,I+=Q.failed}}ht(I>0?`Sent ${le}. ${I} failed.`:`Sent ${le}.`)}await r()}catch(ee){Fe(ee instanceof Error?ee.message:"Request failed")}finally{Me(!1)}}},zt=async ee=>{if(u){Me(!0),Fe(null);try{await u(ee),await r()}catch(le){Fe(le instanceof Error?le.message:"Cancel failed")}finally{Me(!1)}}},mi=async ee=>{f&&(await f(ee),await r())},Zr=async ee=>{h&&(await h(ee),await r())},Yr=Object.entries(G).filter(([ee])=>Vj(ee,G,K,g)),qn=(ee,le)=>{ne(I=>{let D={...I,[ee]:le};if(ee==="preset"&&typeof le=="string"){D=XJ(D,le,g,G);const j=le==="drop_live"||le==="restock"||le==="promo"||GS(le,g)||g.some(Q=>`library:${Q.id}`===le&&(Q.kind==="promo"||(Q.productIds?.length??0)>0)),W=Array.isArray(D.productIds)?D.productIds:[];j&&W.length===0&&y[0]&&G.productIds&&(D={...D,productIds:[y[0].id]})}if(ee==="discountId"&&typeof le=="string"){const j=x.find(W=>W.id===le);j&&(D={...D,discountCode:j.code??D.discountCode??"",discountOffer:j.offerLabel??j.label??D.discountOffer??"",discountExpires:j.expiresLabel??D.discountExpires??""})}return D})};return m.length===0?b.jsxs("div",{className:"vertebr-emails",children:[b.jsx("div",{className:"vertebr-panel-head",children:b.jsx("h2",{children:t.label})}),b.jsxs("div",{className:"vertebr-empty",children:["No mail-enabled resources yet. Opt a resource in with"," ",b.jsx("code",{children:'mail: ["sendEmail"]'}),"."]})]}):b.jsxs("div",{className:"vertebr-emails",children:[b.jsxs("div",{className:"vertebr-panel-head",children:[b.jsx("h2",{children:t.label}),b.jsx("div",{className:"vertebr-panel-head-actions",children:b.jsx("button",{type:"button",className:"vertebr-btn",onClick:()=>{r()},disabled:e||pe,children:e?"Refreshing…":"Refresh"})})]}),C==="compose"?b.jsxs("div",{className:"vertebr-emails-layout",children:[b.jsxs("form",{className:"vertebr-emails-compose",onSubmit:ee=>{ee.preventDefault(),Ar()},children:[b.jsxs("div",{className:"vertebr-emails-fields",children:[b.jsxs("label",{className:"vertebr-mail-field",children:[b.jsx("span",{children:"Audience"}),b.jsx(Am,{options:T,value:_,disabled:pe,placeholder:"Select audiences…",emptyLabel:"No audiences",onChange:ee=>{if(ee.length===0&&m[0]){R([m[0].id]);return}R(ee)}})]}),b.jsxs("div",{className:"vertebr-emails-segment",role:"group","aria-label":"Scope",children:[b.jsx("button",{type:"button","data-active":re==="all"?"true":void 0,onClick:()=>me("all"),children:"Entire list"}),b.jsx("button",{type:"button","data-active":re==="emails"?"true":void 0,onClick:()=>me("emails"),children:"Specific emails"})]}),re==="emails"?b.jsxs("label",{className:"vertebr-mail-field",children:[b.jsx("span",{children:"Emails"}),b.jsx(_J,{options:q,value:B,loading:ve,disabled:pe,onChange:z})]}):null,b.jsxs("label",{className:"vertebr-mail-field",children:[b.jsx("span",{children:"Template"}),b.jsx("select",{value:U?.id??"",onChange:ee=>P(ee.target.value),children:O.map(ee=>b.jsx("option",{value:ee.id,children:ee.label},ee.id))})]}),Yr.map(([ee,le])=>{const I=WJ(ee,le);return b.jsxs("label",{className:"vertebr-mail-field",children:[b.jsx("span",{children:le.label??ee}),le.type==="enum"?b.jsx(US,{id:`emails-${ee}`,value:K[ee],field:le,onChange:D=>qn(ee,D)}):le.type==="enum[]"?b.jsx(Am,{options:(le.options??[]).map(D=>{const j=ee==="productIds"?y.find(W=>W.id===D):void 0;return{id:D,label:le.optionLabels?.[D]??D,secondary:j?.priceLabel,imageUrl:j?.imageUrl}}),value:tQ(K[ee]),disabled:pe,placeholder:ee==="productIds"?"Add products with photos…":`Select ${le.label??ee}…`,emptyLabel:"Nothing available",onChange:D=>qn(ee,D)}):I?b.jsx("textarea",{rows:6,value:kc(K[ee]),onChange:D=>qn(ee,D.target.value)}):b.jsx("input",{type:"text",value:kc(K[ee]),onChange:D=>qn(ee,D.target.value)})]},ee)}),b.jsxs("div",{className:"vertebr-emails-segment",role:"group","aria-label":"When",children:[b.jsx("button",{type:"button","data-active":X==="now"?"true":void 0,onClick:()=>fe("now"),children:"Send now"}),b.jsx("button",{type:"button","data-active":X==="later"?"true":void 0,disabled:!t.canSchedule||!l,onClick:()=>fe("later"),children:"Schedule"})]}),X==="later"?b.jsxs("label",{className:"vertebr-mail-field",children:[b.jsx("span",{children:"Send at"}),b.jsx("input",{type:"datetime-local",value:ge,onChange:ee=>Te(ee.target.value)})]}):null,ze?b.jsx("p",{className:"vertebr-mail-compose-error",children:ze}):null,ft?b.jsx("p",{className:"vertebr-emails-notice",children:ft}):null]}),b.jsx("div",{className:"vertebr-mail-compose-foot",children:b.jsx("button",{type:"submit",className:"vertebr-btn vertebr-btn-primary",disabled:!un,children:pe?X==="later"?"Scheduling…":"Sending…":X==="later"?"Schedule email":re==="all"?"Send to list":"Send"})})]}),b.jsx("div",{className:"vertebr-emails-side",children:b.jsxs("div",{className:"vertebr-mail-preview",children:[b.jsxs("div",{className:"vertebr-mail-preview-meta",children:[b.jsxs("p",{children:[b.jsx("span",{children:"To"}),b.jsx("strong",{children:_e?JJ(_e.to):re==="all"?M.length===0?"—":M.length===1?`Everyone on ${M[0]?.label}`:`Everyone on ${M.length} lists`:B.length>0?B.length===1?B[0]:`${B.length} selected`:"—"})]}),b.jsxs("p",{children:[b.jsx("span",{children:"Subject"}),b.jsx("strong",{children:_e?.subject??(ke?"Updating…":"—")})]})]}),b.jsx("div",{className:"vertebr-mail-preview-stage",children:b.jsx("div",{className:"vertebr-mail-preview-frame",children:_e?.html?b.jsx("iframe",{title:"Email preview",sandbox:"",srcDoc:_e.html}):_e?.text?b.jsx("pre",{children:_e.text}):b.jsx("div",{className:"vertebr-mail-preview-empty",children:ke?"Rendering host template…":"Pick an audience and template to preview."})})})]})})]}):null,C==="templates"?b.jsx(HJ,{templates:t.templates,library:g,products:y,discounts:x,canLibrary:t.canLibrary,busy:pe,previewResourceId:t.audiences[0]?.id,previewTemplateId:t.templates.find(ee=>ee.id==="sendEmail")?.id??t.templates[0]?.id,onPreview:s,onSaveLibrary:f?mi:void 0,onDeleteLibrary:h?Zr:void 0}):null,C==="activity"?b.jsx(DJ,{campaigns:t.campaigns,history:S,canSchedule:t.canSchedule,canHistory:t.canHistory,busy:pe,onCancel:u?zt:void 0}):null]})}function rQ({label:t="Gallery",items:e,accept:n,maxBytes:r,canDelete:i,loading:s,onRefresh:o,onUpload:l,onDelete:u}){const f={field:"gallery",accept:n,maxBytes:r};return b.jsxs("div",{className:"vertebr-gallery",children:[b.jsxs("div",{className:"vertebr-panel-head",children:[b.jsx("h2",{children:t}),b.jsxs("div",{className:"vertebr-gallery-head-actions",children:[b.jsx("span",{className:"vertebr-count",children:e.length}),o?b.jsx("button",{type:"button",className:"vertebr-btn",onClick:o,disabled:s,children:s?"Refreshing…":"Refresh"}):null]})]}),b.jsxs("div",{className:"vertebr-gallery-body",children:[b.jsx(Fd,{meta:f,multiple:!0,label:"Drop images here or browse to add to the gallery",onUpload:l}),e.length===0?b.jsx("div",{className:"vertebr-empty",children:"No images in the gallery yet."}):b.jsx("div",{className:"vertebr-gallery-grid",children:e.map(h=>b.jsxs("article",{className:"vertebr-gallery-card",children:[b.jsx("a",{className:"vertebr-gallery-thumb",href:h.url,target:"_blank",rel:"noreferrer",title:h.name??h.url,children:b.jsx("img",{src:h.url,alt:h.name??"",loading:"lazy"})}),b.jsxs("div",{className:"vertebr-gallery-meta",children:[b.jsx("strong",{title:h.name??h.id,children:h.name??h.id}),b.jsx("a",{href:h.url,target:"_blank",rel:"noreferrer",children:h.url.replace(/^https?:\/\//i,"")})]}),i&&u?b.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet vertebr-btn-danger-quiet",onClick:()=>{window.confirm("Delete this image from the gallery?")&&u(h.id)},children:"Delete"}):null]},h.id))})]})]})}const Zb=3;function iQ(t){const e=Math.max(0,...t),n=Math.min(0,...t),r=e-n||1;return{min:n,max:e,span:r}}function sQ(t,e){if(!(t>0))return e==="usd"?100:4;if(e!=="usd"){const o=Math.ceil(t);return o<=4?4:o<=6?6:o<=8?8:o<=10?10:Math.ceil(o/5)*5}const n=t*1.08,r=10**Math.floor(Math.log10(n)),i=n/r;return(i<=1?1:i<=2?2:i<=2.5?2.5:i<=5?5:10)*r}function oQ(t,e){if(e==="usd")return[0,t/2,t];const n=t<=4||t<=10?2:t/4,r=[];for(let i=0;i<t-1e-9;i+=n)r.push(i);return r.push(t),r}function cd(t){return t[0]?t.map((n,r)=>`${r===0?"M":"L"} ${n.x} ${n.y}`).join(" "):""}function aQ({series:t,tone:e="neutral"}){if(t.length<2)return null;const n=72,r=28,{min:i,span:s}=iQ(t),o=t.map((f,h)=>({x:h/(t.length-1)*n,y:r-(f-i)/s*(r-2)-1})),l=o[o.length-1],u=l?`${cd(o)} L ${l.x} ${r} L 0 ${r} Z`:"";return b.jsxs("svg",{className:"vertebr-sparkline","data-tone":e,viewBox:`0 0 ${n} ${r}`,width:n,height:r,"aria-hidden":"true",children:[u?b.jsx("path",{d:u,fill:"currentColor",opacity:"0.16"}):null,b.jsx("path",{d:cd(o),fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinejoin:"round",strokeLinecap:"round"})]})}function lQ(t,e){return e==="usd"?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:Number.isInteger(t)||Math.abs(t)>=100?0:2}).format(t):new Intl.NumberFormat("en-US",{maximumFractionDigits:0}).format(t)}function cQ(){return b.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:b.jsx("path",{d:"M2.5 4.5 6 8l3.5-3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function uQ(){return b.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:b.jsx("path",{d:"M2.5 6.2 4.8 8.5 9.5 3.8",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function dQ({charts:t,value:e,onChange:n}){return b.jsxs(pg,{value:e,onValueChange:n,children:[b.jsxs(mg,{className:"vertebr-select-trigger vertebr-chart-series","aria-label":"Chart series",children:[b.jsx("span",{className:"vertebr-select-value",children:b.jsx(gg,{})}),b.jsx(yg,{className:"vertebr-select-icon",children:b.jsx(cQ,{})})]}),b.jsx(vg,{children:b.jsx(bg,{className:"vertebr-select-content",position:"popper",sideOffset:6,children:b.jsx(wg,{className:"vertebr-select-viewport",children:t.map(r=>b.jsxs(Sg,{value:r.id,className:"vertebr-select-item",children:[b.jsx(kg,{children:r.label}),b.jsx(Cg,{className:"vertebr-select-check",children:b.jsx(uQ,{})})]},r.id))})})})]})}function fQ({charts:t,chartId:e,onChartIdChange:n,compareLabel:r="Previous period"}){const i=t.find(se=>se.id===e)??t[0],s=i?.unit,o=A.useMemo(()=>t.filter(se=>se.id!==i?.id&&(se.unit??"count")===(s??"count")),[t,i?.id,s]),l=o.length>0,[u,f]=A.useState("period"),[h,m]=A.useState([]),[g,y]=A.useState(null);if(A.useEffect(()=>{y(null)},[i?.id,u,h.join("|")]),A.useEffect(()=>{!l&&u==="metrics"&&f("period")},[l,u]),A.useEffect(()=>{m(se=>se.filter(pe=>o.some(Me=>Me.id===pe)))},[o]),!i)return b.jsx("article",{className:"vertebr-chart",children:b.jsx("p",{className:"vertebr-chart-empty",children:"No activity in this window."})});const x=u==="metrics"&&l,S=o.filter(se=>h.includes(se.id)).slice(0,Zb-1),k=x?[i,...S]:[i],C=i.points.map(se=>se.label),T=960,_=220,R={top:12,right:16,bottom:28,left:52},M=T-R.left-R.right,O=_-R.top-R.bottom,L=k.flatMap(se=>se.points.map(pe=>pe.value)),P=x?[]:(i.comparePoints??[]).map(se=>se.value),U=!x&&P.length>0,G=sQ(Math.max(0,...L,...P),i.unit),oe=(se,pe)=>R.left+(pe<=1?M/2:se/(pe-1)*M),K=k.map(se=>se.points.map((pe,Me)=>{const ze=oe(Me,C.length||se.points.length),Fe=R.top+O-Math.max(0,pe.value)/G*O;return{x:ze,y:Fe,value:pe.value,label:pe.label}})),ne=K[0]??[],re=P.map((se,pe)=>{const Me=oe(pe,C.length||P.length),ze=R.top+O-Math.max(0,se)/G*O;return{x:Me,y:ze,value:se,label:i.comparePoints?.[pe]?.label??""}}),me=oQ(G,i.unit),B=Math.max(1,Math.ceil(ne.length/7)),z=i.points.reduce((se,pe)=>se+pe.value,0),q=ne.length===0||k.every(se=>se.points.every(pe=>pe.value===0)),de=g??(ne.length>0?ne.length-1:null),ve=`vb-chart-fill-${i.id}`,V=se=>lQ(se,i.unit),X=U&&de!=null?re[de]:void 0,fe=cd(ne),ge=ne[0],Te=ne[ne.length-1],_e=R.top+O,Le=!x&&ge&&Te?`${fe} L ${Te.x} ${_e} L ${ge.x} ${_e} Z`:"",ke=se=>{m(pe=>pe.includes(se)?pe.filter(Me=>Me!==se):pe.length>=Zb-1?pe:[...pe,se])};return b.jsxs("article",{className:"vertebr-chart","data-empty":q?"true":void 0,"data-mode":x?"metrics":"period",children:[b.jsxs("div",{className:"vertebr-chart-head",children:[b.jsxs("div",{className:"vertebr-chart-head-start",children:[t.length>1?b.jsx(dQ,{charts:t,value:i.id,onChange:n}):b.jsx("p",{className:"vertebr-chart-kicker",children:i.label}),l?b.jsxs("div",{className:"vertebr-chart-mode",role:"group","aria-label":"Chart mode",children:[b.jsx("button",{type:"button",className:"vertebr-chart-mode-btn","data-active":u==="period"?"true":void 0,onClick:()=>f("period"),children:"vs previous"}),b.jsx("button",{type:"button",className:"vertebr-chart-mode-btn","data-active":u==="metrics"?"true":void 0,onClick:()=>{f("metrics"),m(se=>se.length>0?se:o.slice(0,1).map(pe=>pe.id))},children:"Compare metrics"})]}):null,x?b.jsx("div",{className:"vertebr-chart-metric-toggles",children:o.map(se=>{const pe=h.includes(se.id),Me=!pe&&S.length>=Zb-1;return b.jsx("button",{type:"button",className:"vertebr-chart-metric-toggle","data-on":pe?"true":void 0,disabled:Me,onClick:()=>ke(se.id),children:se.label},se.id)})}):U?b.jsxs("p",{className:"vertebr-chart-legend",children:[b.jsxs("span",{children:[b.jsx("i",{"data-series":"current"}),"Current"]}),b.jsxs("span",{children:[b.jsx("i",{"data-series":"previous"}),r]})]}):null,x?b.jsx("p",{className:"vertebr-chart-legend",children:k.map((se,pe)=>b.jsxs("span",{children:[b.jsx("i",{"data-series":`m${pe}`}),se.label]},se.id))}):null]}),b.jsx("p",{className:"vertebr-chart-total",children:x?"—":V(z)})]}),ne.length===0?b.jsx("p",{className:"vertebr-chart-empty",children:"No activity in this window."}):b.jsxs("div",{className:"vertebr-chart-plot",children:[b.jsxs("svg",{className:"vertebr-chart-svg",viewBox:`0 0 ${T} ${_}`,role:"img","aria-label":x?k.map(se=>se.label).join(" vs "):i.label,onMouseLeave:()=>y(null),onMouseMove:se=>{const pe=se.currentTarget.getBoundingClientRect(),Me=(se.clientX-pe.left)/pe.width*T;let ze=0,Fe=1/0;ne.forEach((ft,ht)=>{const Jt=Math.abs(ft.x-Me);Jt<Fe&&(Fe=Jt,ze=ht)}),y(ze)},children:[b.jsx("defs",{children:b.jsxs("linearGradient",{id:ve,x1:"0",y1:"0",x2:"0",y2:"1",children:[b.jsx("stop",{offset:"0%",stopColor:"var(--vb-accent)",stopOpacity:"0.32"}),b.jsx("stop",{offset:"100%",stopColor:"var(--vb-accent)",stopOpacity:"0"})]})}),me.map((se,pe)=>{const Me=R.top+O-se/G*O;return b.jsxs("g",{children:[b.jsx("line",{className:se===0?"vertebr-chart-baseline":"vertebr-chart-grid",x1:R.left,x2:T-R.right,y1:Me,y2:Me}),b.jsx("text",{className:"vertebr-chart-axis",x:R.left-8,y:Me+3,textAnchor:"end",children:V(se)})]},`${se}-${pe}`)}),Le?b.jsx("path",{className:"vertebr-chart-area",d:Le,fill:`url(#${ve})`}):null,U?b.jsx("path",{className:"vertebr-chart-line-compare",d:cd(re),fill:"none"}):null,K.map((se,pe)=>b.jsx("path",{className:pe===0&&!x?"vertebr-chart-line":"vertebr-chart-line-metric","data-series":x||pe>0?`m${pe}`:void 0,d:cd(se),fill:"none"},k[pe]?.id??pe)),de!=null?b.jsx("line",{className:"vertebr-chart-crosshair",x1:ne[de]?.x,x2:ne[de]?.x,y1:R.top,y2:R.top+O}):null,ne.map((se,pe)=>pe%B===0||pe===ne.length-1?b.jsx("text",{className:"vertebr-chart-axis",x:se.x,y:_-8,textAnchor:pe===0?"start":pe===ne.length-1?"end":"middle",children:se.label},`label-${se.label}-${pe}`):null),K.map((se,pe)=>se.map((Me,ze)=>de===ze?b.jsx("circle",{className:pe===0&&!x?"vertebr-chart-dot":"vertebr-chart-dot-metric","data-series":x||pe>0?`m${pe}`:void 0,"data-active":"true",cx:Me.x,cy:Me.y,r:pe===0?4.2:3.4},`dot-${k[pe]?.id}-${ze}`):null)),X?b.jsx("circle",{className:"vertebr-chart-dot-compare",cx:X.x,cy:X.y,r:3.4}):null]}),de!=null&&ne[de]?b.jsxs("div",{className:"vertebr-chart-tooltip",style:{left:`${Math.min(88,Math.max(12,ne[de].x/T*100))}%`},children:[b.jsx("span",{children:ne[de].label}),x?k.map((se,pe)=>b.jsxs("strong",{className:"vertebr-chart-tooltip-row","data-series":`m${pe}`,children:[se.label," ",V(se.points[de]?.value??0)]},se.id)):b.jsxs(b.Fragment,{children:[b.jsx("strong",{children:V(ne[de].value)}),X?b.jsxs("span",{className:"vertebr-chart-tooltip-compare",children:["Prev ",V(X.value),X.label?` · ${X.label}`:""]}):null]})]}):null]})]})}function hQ(t){const e=Math.abs(t),n=e>=10?e.toFixed(0):e.toFixed(1);return t>0?`+${n}%`:t<0?`−${n}%`:"0%"}function pQ(t){return t>0?"up":t<0?"down":"flat"}function tM({value:t}){return t==null?b.jsx("span",{className:"vertebr-metrics-table-empty",children:"—"}):b.jsx("span",{className:"vertebr-metric-delta","data-dir":pQ(t),children:hQ(t)})}function mQ(){return b.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:b.jsx("path",{d:"M2.5 6.2 4.8 8.5 9.5 3.8",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function gQ(){return b.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:b.jsx("path",{d:"M2.5 4.5 6 8l3.5-3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function yQ({value:t,onChange:e,disabled:n}){return b.jsxs(pg,{value:t,onValueChange:r=>e(r),disabled:n,children:[b.jsxs(mg,{className:"vertebr-select-trigger vertebr-metrics-range","aria-label":"Metrics range",children:[b.jsx("span",{className:"vertebr-select-value",children:b.jsx(gg,{})}),b.jsx(yg,{className:"vertebr-select-icon",children:b.jsx(gQ,{})})]}),b.jsx(vg,{children:b.jsx(bg,{className:"vertebr-select-content",position:"popper",sideOffset:6,children:b.jsx(wg,{className:"vertebr-select-viewport",children:SN.map(r=>b.jsxs(Sg,{value:r.id,className:"vertebr-select-item",children:[b.jsx(kg,{children:r.label}),b.jsx(Cg,{className:"vertebr-select-check",children:b.jsx(mQ,{})})]},r.id))})})})]})}function vQ({label:t="Overview",windowLabel:e,compareLabel:n,metrics:r,charts:i=[],range:s,onRangeChange:o,onRefresh:l,loading:u}){const f=r.filter(_=>_.featured).slice(0,4),h=f.length>0?f:r.slice(0,4),m=new Set(h.map(_=>_.id)),g=r.filter(_=>!m.has(_.id)),[y,x]=A.useState(!0),S=A.useMemo(()=>new Set(i.map(_=>_.id)),[i]),[k,C]=A.useState(()=>i[0]?.id??""),T=S.has(k)?k:i[0]?.id??"";return b.jsxs("div",{className:"vertebr-metrics",children:[b.jsxs("div",{className:"vertebr-panel-head",children:[b.jsxs("div",{children:[b.jsx("h2",{children:t}),e?b.jsx("p",{className:"vertebr-metrics-window",children:e}):null]}),o||l?b.jsxs("div",{className:"vertebr-panel-head-actions",children:[o&&s?b.jsx(yQ,{value:s,onChange:o,disabled:u}):null,l?b.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",onClick:l,disabled:u,children:u?"Refreshing…":"Refresh"}):null]}):null]}),r.length===0&&i.length===0?b.jsx("div",{className:"vertebr-empty",children:"No metrics registered yet."}):b.jsxs("div",{className:"vertebr-metrics-body",children:[h.length>0?b.jsx("section",{className:"vertebr-metrics-block",children:b.jsx("div",{className:"vertebr-metrics-kpis",children:h.map(_=>{const R=S.has(_.id);return b.jsxs("article",{className:"vertebr-kpi","data-tone":_.tone??"neutral","data-selectable":R?"true":void 0,"data-active":R&&_.id===T?"true":void 0,role:R?"button":void 0,tabIndex:R?0:void 0,onClick:R?()=>C(_.id):void 0,onKeyDown:R?M=>{(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),C(_.id))}:void 0,children:[b.jsxs("div",{className:"vertebr-kpi-top",children:[b.jsx("p",{className:"vertebr-metric-label",children:_.label}),_.series&&_.series.length>1?b.jsx(aQ,{series:_.series,tone:_.tone}):null]}),b.jsx("p",{className:"vertebr-kpi-value",children:_.value}),b.jsxs("div",{className:"vertebr-kpi-foot",children:[_.delta!=null?b.jsx(tM,{value:_.delta}):null,_.hint?b.jsx("span",{className:"vertebr-metric-hint",children:_.hint}):null]})]},_.id)})})}):null,i.length>0&&T?b.jsx("section",{className:"vertebr-metrics-block",children:b.jsx(fQ,{charts:i,chartId:T,onChartIdChange:C,compareLabel:n})}):null,g.length>0?b.jsx("section",{className:"vertebr-metrics-block",children:b.jsxs("div",{className:"vertebr-metrics-table-wrap","data-collapsed":y?void 0:"true",children:[b.jsxs("button",{type:"button",className:"vertebr-metrics-table-head","aria-expanded":y,onClick:()=>x(_=>!_),children:[b.jsx("p",{className:"vertebr-chart-kicker",children:"Breakdown"}),b.jsx("span",{className:"vertebr-metrics-chevron","aria-hidden":"true"})]}),y?b.jsxs("table",{className:"vertebr-table vertebr-metrics-table",children:[b.jsx("thead",{children:b.jsxs("tr",{children:[b.jsx("th",{children:"Metric"}),b.jsx("th",{children:"Value"}),b.jsx("th",{children:"Change"}),b.jsx("th",{children:"Notes"})]})}),b.jsx("tbody",{children:g.map(_=>b.jsxs("tr",{"data-tone":_.tone??"neutral",children:[b.jsxs("td",{children:[b.jsx("span",{className:"vertebr-metrics-table-label",children:_.label}),_.section?b.jsx("span",{className:"vertebr-metrics-table-section",children:_.section}):null]}),b.jsx("td",{className:"vertebr-metrics-table-value",children:_.value}),b.jsx("td",{children:b.jsx(tM,{value:_.delta})}),b.jsx("td",{className:"vertebr-metrics-table-notes",children:_.hint??"—"})]},_.id))})]}):null]})}):null]})]})}function bo(t,e){return typeof t=="function"?t(e):t}function _r(t,e){return n=>{e.setState(r=>({...r,[t]:bo(n,r[t])}))}}function Tg(t){return t instanceof Function}function bQ(t){return Array.isArray(t)&&t.every(e=>typeof e=="number")}function xQ(t,e){const n=[],r=i=>{i.forEach(s=>{n.push(s);const o=e(s);o!=null&&o.length&&r(o)})};return r(t),n}function qe(t,e,n){let r=[],i;return s=>{let o;n.key&&n.debug&&(o=Date.now());const l=t(s);if(!(l.length!==r.length||l.some((h,m)=>r[m]!==h)))return i;r=l;let f;if(n.key&&n.debug&&(f=Date.now()),i=e(...l),n==null||n.onChange==null||n.onChange(i),n.key&&n.debug&&n!=null&&n.debug()){const h=Math.round((Date.now()-o)*100)/100,m=Math.round((Date.now()-f)*100)/100,g=m/16,y=(x,S)=>{for(x=String(x);x.length<S;)x=" "+x;return x};console.info(`%c⏱ ${y(m,5)} /${y(h,5)} ms`,`
|
|
327
|
-
font-size: .6rem;
|
|
328
|
-
font-weight: bold;
|
|
329
|
-
color: hsl(${Math.max(0,Math.min(120-120*g,120))}deg 100% 31%);`,n?.key)}return i}}function Ge(t,e,n,r){return{debug:()=>{var i;return(i=t?.debugAll)!=null?i:t[e]},key:!1,onChange:r}}function wQ(t,e,n,r){const i=()=>{var o;return(o=s.getValue())!=null?o:t.options.renderFallbackValue},s={id:`${e.id}_${n.id}`,row:e,column:n,getValue:()=>e.getValue(r),renderValue:i,getContext:qe(()=>[t,n,e,s],(o,l,u,f)=>({table:o,column:l,row:u,cell:f,getValue:f.getValue,renderValue:f.renderValue}),Ge(t.options,"debugCells"))};return t._features.forEach(o=>{o.createCell==null||o.createCell(s,n,e,t)},{}),s}function SQ(t,e,n,r){var i,s;const l={...t._getDefaultColumnDef(),...e},u=l.accessorKey;let f=(i=(s=l.id)!=null?s:u?typeof String.prototype.replaceAll=="function"?u.replaceAll(".","_"):u.replace(/\./g,"_"):void 0)!=null?i:typeof l.header=="string"?l.header:void 0,h;if(l.accessorFn?h=l.accessorFn:u&&(u.includes(".")?h=g=>{let y=g;for(const S of u.split(".")){var x;y=(x=y)==null?void 0:x[S]}return y}:h=g=>g[l.accessorKey]),!f)throw new Error;let m={id:`${String(f)}`,accessorFn:h,parent:r,depth:n,columnDef:l,columns:[],getFlatColumns:qe(()=>[!0],()=>{var g;return[m,...(g=m.columns)==null?void 0:g.flatMap(y=>y.getFlatColumns())]},Ge(t.options,"debugColumns")),getLeafColumns:qe(()=>[t._getOrderColumnsFn()],g=>{var y;if((y=m.columns)!=null&&y.length){let x=m.columns.flatMap(S=>S.getLeafColumns());return g(x)}return[m]},Ge(t.options,"debugColumns"))};for(const g of t._features)g.createColumn==null||g.createColumn(m,t);return m}const $n="debugHeaders";function nM(t,e,n){var r;let s={id:(r=n.id)!=null?r:e.id,column:e,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const o=[],l=u=>{u.subHeaders&&u.subHeaders.length&&u.subHeaders.map(l),o.push(u)};return l(s),o},getContext:()=>({table:t,header:s,column:e})};return t._features.forEach(o=>{o.createHeader==null||o.createHeader(s,t)}),s}const kQ={createTable:t=>{t.getHeaderGroups=qe(()=>[t.getAllColumns(),t.getVisibleLeafColumns(),t.getState().columnPinning.left,t.getState().columnPinning.right],(e,n,r,i)=>{var s,o;const l=(s=r?.map(m=>n.find(g=>g.id===m)).filter(Boolean))!=null?s:[],u=(o=i?.map(m=>n.find(g=>g.id===m)).filter(Boolean))!=null?o:[],f=n.filter(m=>!(r!=null&&r.includes(m.id))&&!(i!=null&&i.includes(m.id)));return Wh(e,[...l,...f,...u],t)},Ge(t.options,$n)),t.getCenterHeaderGroups=qe(()=>[t.getAllColumns(),t.getVisibleLeafColumns(),t.getState().columnPinning.left,t.getState().columnPinning.right],(e,n,r,i)=>(n=n.filter(s=>!(r!=null&&r.includes(s.id))&&!(i!=null&&i.includes(s.id))),Wh(e,n,t,"center")),Ge(t.options,$n)),t.getLeftHeaderGroups=qe(()=>[t.getAllColumns(),t.getVisibleLeafColumns(),t.getState().columnPinning.left],(e,n,r)=>{var i;const s=(i=r?.map(o=>n.find(l=>l.id===o)).filter(Boolean))!=null?i:[];return Wh(e,s,t,"left")},Ge(t.options,$n)),t.getRightHeaderGroups=qe(()=>[t.getAllColumns(),t.getVisibleLeafColumns(),t.getState().columnPinning.right],(e,n,r)=>{var i;const s=(i=r?.map(o=>n.find(l=>l.id===o)).filter(Boolean))!=null?i:[];return Wh(e,s,t,"right")},Ge(t.options,$n)),t.getFooterGroups=qe(()=>[t.getHeaderGroups()],e=>[...e].reverse(),Ge(t.options,$n)),t.getLeftFooterGroups=qe(()=>[t.getLeftHeaderGroups()],e=>[...e].reverse(),Ge(t.options,$n)),t.getCenterFooterGroups=qe(()=>[t.getCenterHeaderGroups()],e=>[...e].reverse(),Ge(t.options,$n)),t.getRightFooterGroups=qe(()=>[t.getRightHeaderGroups()],e=>[...e].reverse(),Ge(t.options,$n)),t.getFlatHeaders=qe(()=>[t.getHeaderGroups()],e=>e.map(n=>n.headers).flat(),Ge(t.options,$n)),t.getLeftFlatHeaders=qe(()=>[t.getLeftHeaderGroups()],e=>e.map(n=>n.headers).flat(),Ge(t.options,$n)),t.getCenterFlatHeaders=qe(()=>[t.getCenterHeaderGroups()],e=>e.map(n=>n.headers).flat(),Ge(t.options,$n)),t.getRightFlatHeaders=qe(()=>[t.getRightHeaderGroups()],e=>e.map(n=>n.headers).flat(),Ge(t.options,$n)),t.getCenterLeafHeaders=qe(()=>[t.getCenterFlatHeaders()],e=>e.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),Ge(t.options,$n)),t.getLeftLeafHeaders=qe(()=>[t.getLeftFlatHeaders()],e=>e.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),Ge(t.options,$n)),t.getRightLeafHeaders=qe(()=>[t.getRightFlatHeaders()],e=>e.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),Ge(t.options,$n)),t.getLeafHeaders=qe(()=>[t.getLeftHeaderGroups(),t.getCenterHeaderGroups(),t.getRightHeaderGroups()],(e,n,r)=>{var i,s,o,l,u,f;return[...(i=(s=e[0])==null?void 0:s.headers)!=null?i:[],...(o=(l=n[0])==null?void 0:l.headers)!=null?o:[],...(u=(f=r[0])==null?void 0:f.headers)!=null?u:[]].map(h=>h.getLeafHeaders()).flat()},Ge(t.options,$n))}};function Wh(t,e,n,r){var i,s;let o=0;const l=function(g,y){y===void 0&&(y=1),o=Math.max(o,y),g.filter(x=>x.getIsVisible()).forEach(x=>{var S;(S=x.columns)!=null&&S.length&&l(x.columns,y+1)},0)};l(t);let u=[];const f=(g,y)=>{const x={depth:y,id:[r,`${y}`].filter(Boolean).join("_"),headers:[]},S=[];g.forEach(k=>{const C=[...S].reverse()[0],T=k.column.depth===x.depth;let _,R=!1;if(T&&k.column.parent?_=k.column.parent:(_=k.column,R=!0),C&&C?.column===_)C.subHeaders.push(k);else{const M=nM(n,_,{id:[r,y,_.id,k?.id].filter(Boolean).join("_"),isPlaceholder:R,placeholderId:R?`${S.filter(O=>O.column===_).length}`:void 0,depth:y,index:S.length});M.subHeaders.push(k),S.push(M)}x.headers.push(k),k.headerGroup=x}),u.push(x),y>0&&f(S,y-1)},h=e.map((g,y)=>nM(n,g,{depth:o,index:y}));f(h,o-1),u.reverse();const m=g=>g.filter(x=>x.column.getIsVisible()).map(x=>{let S=0,k=0,C=[0];x.subHeaders&&x.subHeaders.length?(C=[],m(x.subHeaders).forEach(_=>{let{colSpan:R,rowSpan:M}=_;S+=R,C.push(M)})):S=1;const T=Math.min(...C);return k=k+T,x.colSpan=S,x.rowSpan=k,{colSpan:S,rowSpan:k}});return m((i=(s=u[0])==null?void 0:s.headers)!=null?i:[]),u}const CQ=(t,e,n,r,i,s,o)=>{let l={id:e,index:r,original:n,depth:i,parentId:o,_valuesCache:{},_uniqueValuesCache:{},getValue:u=>{if(l._valuesCache.hasOwnProperty(u))return l._valuesCache[u];const f=t.getColumn(u);if(f!=null&&f.accessorFn)return l._valuesCache[u]=f.accessorFn(l.original,r),l._valuesCache[u]},getUniqueValues:u=>{if(l._uniqueValuesCache.hasOwnProperty(u))return l._uniqueValuesCache[u];const f=t.getColumn(u);if(f!=null&&f.accessorFn)return f.columnDef.getUniqueValues?(l._uniqueValuesCache[u]=f.columnDef.getUniqueValues(l.original,r),l._uniqueValuesCache[u]):(l._uniqueValuesCache[u]=[l.getValue(u)],l._uniqueValuesCache[u])},renderValue:u=>{var f;return(f=l.getValue(u))!=null?f:t.options.renderFallbackValue},subRows:[],getLeafRows:()=>xQ(l.subRows,u=>u.subRows),getParentRow:()=>l.parentId?t.getRow(l.parentId,!0):void 0,getParentRows:()=>{let u=[],f=l;for(;;){const h=f.getParentRow();if(!h)break;u.push(h),f=h}return u.reverse()},getAllCells:qe(()=>[t.getAllLeafColumns()],u=>u.map(f=>wQ(t,l,f,f.id)),Ge(t.options,"debugRows")),_getAllCellsByColumnId:qe(()=>[l.getAllCells()],u=>u.reduce((f,h)=>(f[h.column.id]=h,f),{}),Ge(t.options,"debugRows"))};for(let u=0;u<t._features.length;u++){const f=t._features[u];f==null||f.createRow==null||f.createRow(l,t)}return l},EQ={createColumn:(t,e)=>{t._getFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,t.id),t.getFacetedRowModel=()=>t._getFacetedRowModel?t._getFacetedRowModel():e.getPreFilteredRowModel(),t._getFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,t.id),t.getFacetedUniqueValues=()=>t._getFacetedUniqueValues?t._getFacetedUniqueValues():new Map,t._getFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,t.id),t.getFacetedMinMaxValues=()=>{if(t._getFacetedMinMaxValues)return t._getFacetedMinMaxValues()}}},Hj=(t,e,n)=>{var r,i;const s=n==null||(r=n.toString())==null?void 0:r.toLowerCase();return!!(!((i=t.getValue(e))==null||(i=i.toString())==null||(i=i.toLowerCase())==null)&&i.includes(s))};Hj.autoRemove=t=>fi(t);const Uj=(t,e,n)=>{var r;return!!(!((r=t.getValue(e))==null||(r=r.toString())==null)&&r.includes(n))};Uj.autoRemove=t=>fi(t);const Fj=(t,e,n)=>{var r;return((r=t.getValue(e))==null||(r=r.toString())==null?void 0:r.toLowerCase())===n?.toLowerCase()};Fj.autoRemove=t=>fi(t);const qj=(t,e,n)=>{var r;return(r=t.getValue(e))==null?void 0:r.includes(n)};qj.autoRemove=t=>fi(t);const Gj=(t,e,n)=>!n.some(r=>{var i;return!((i=t.getValue(e))!=null&&i.includes(r))});Gj.autoRemove=t=>fi(t)||!(t!=null&&t.length);const Wj=(t,e,n)=>n.some(r=>{var i;return(i=t.getValue(e))==null?void 0:i.includes(r)});Wj.autoRemove=t=>fi(t)||!(t!=null&&t.length);const Kj=(t,e,n)=>t.getValue(e)===n;Kj.autoRemove=t=>fi(t);const Zj=(t,e,n)=>t.getValue(e)==n;Zj.autoRemove=t=>fi(t);const WS=(t,e,n)=>{let[r,i]=n;const s=t.getValue(e);return s>=r&&s<=i};WS.resolveFilterValue=t=>{let[e,n]=t,r=typeof e!="number"?parseFloat(e):e,i=typeof n!="number"?parseFloat(n):n,s=e===null||Number.isNaN(r)?-1/0:r,o=n===null||Number.isNaN(i)?1/0:i;if(s>o){const l=s;s=o,o=l}return[s,o]};WS.autoRemove=t=>fi(t)||fi(t[0])&&fi(t[1]);const ls={includesString:Hj,includesStringSensitive:Uj,equalsString:Fj,arrIncludes:qj,arrIncludesAll:Gj,arrIncludesSome:Wj,equals:Kj,weakEquals:Zj,inNumberRange:WS};function fi(t){return t==null||t===""}const TQ={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:t=>({columnFilters:[],...t}),getDefaultOptions:t=>({onColumnFiltersChange:_r("columnFilters",t),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(t,e)=>{t.getAutoFilterFn=()=>{const n=e.getCoreRowModel().flatRows[0],r=n?.getValue(t.id);return typeof r=="string"?ls.includesString:typeof r=="number"?ls.inNumberRange:typeof r=="boolean"||r!==null&&typeof r=="object"?ls.equals:Array.isArray(r)?ls.arrIncludes:ls.weakEquals},t.getFilterFn=()=>{var n,r;return Tg(t.columnDef.filterFn)?t.columnDef.filterFn:t.columnDef.filterFn==="auto"?t.getAutoFilterFn():(n=(r=e.options.filterFns)==null?void 0:r[t.columnDef.filterFn])!=null?n:ls[t.columnDef.filterFn]},t.getCanFilter=()=>{var n,r,i;return((n=t.columnDef.enableColumnFilter)!=null?n:!0)&&((r=e.options.enableColumnFilters)!=null?r:!0)&&((i=e.options.enableFilters)!=null?i:!0)&&!!t.accessorFn},t.getIsFiltered=()=>t.getFilterIndex()>-1,t.getFilterValue=()=>{var n;return(n=e.getState().columnFilters)==null||(n=n.find(r=>r.id===t.id))==null?void 0:n.value},t.getFilterIndex=()=>{var n,r;return(n=(r=e.getState().columnFilters)==null?void 0:r.findIndex(i=>i.id===t.id))!=null?n:-1},t.setFilterValue=n=>{e.setColumnFilters(r=>{const i=t.getFilterFn(),s=r?.find(h=>h.id===t.id),o=bo(n,s?s.value:void 0);if(rM(i,o,t)){var l;return(l=r?.filter(h=>h.id!==t.id))!=null?l:[]}const u={id:t.id,value:o};if(s){var f;return(f=r?.map(h=>h.id===t.id?u:h))!=null?f:[]}return r!=null&&r.length?[...r,u]:[u]})}},createRow:(t,e)=>{t.columnFilters={},t.columnFiltersMeta={}},createTable:t=>{t.setColumnFilters=e=>{const n=t.getAllLeafColumns(),r=i=>{var s;return(s=bo(e,i))==null?void 0:s.filter(o=>{const l=n.find(u=>u.id===o.id);if(l){const u=l.getFilterFn();if(rM(u,o.value,l))return!1}return!0})};t.options.onColumnFiltersChange==null||t.options.onColumnFiltersChange(r)},t.resetColumnFilters=e=>{var n,r;t.setColumnFilters(e?[]:(n=(r=t.initialState)==null?void 0:r.columnFilters)!=null?n:[])},t.getPreFilteredRowModel=()=>t.getCoreRowModel(),t.getFilteredRowModel=()=>(!t._getFilteredRowModel&&t.options.getFilteredRowModel&&(t._getFilteredRowModel=t.options.getFilteredRowModel(t)),t.options.manualFiltering||!t._getFilteredRowModel?t.getPreFilteredRowModel():t._getFilteredRowModel())}};function rM(t,e,n){return(t&&t.autoRemove?t.autoRemove(e,n):!1)||typeof e>"u"||typeof e=="string"&&!e}const _Q=(t,e,n)=>n.reduce((r,i)=>{const s=i.getValue(t);return r+(typeof s=="number"?s:0)},0),AQ=(t,e,n)=>{let r;return n.forEach(i=>{const s=i.getValue(t);s!=null&&(r>s||r===void 0&&s>=s)&&(r=s)}),r},RQ=(t,e,n)=>{let r;return n.forEach(i=>{const s=i.getValue(t);s!=null&&(r<s||r===void 0&&s>=s)&&(r=s)}),r},MQ=(t,e,n)=>{let r,i;return n.forEach(s=>{const o=s.getValue(t);o!=null&&(r===void 0?o>=o&&(r=i=o):(r>o&&(r=o),i<o&&(i=o)))}),[r,i]},NQ=(t,e)=>{let n=0,r=0;if(e.forEach(i=>{let s=i.getValue(t);s!=null&&(s=+s)>=s&&(++n,r+=s)}),n)return r/n},OQ=(t,e)=>{if(!e.length)return;const n=e.map(s=>s.getValue(t));if(!bQ(n))return;if(n.length===1)return n[0];const r=Math.floor(n.length/2),i=n.sort((s,o)=>s-o);return n.length%2!==0?i[r]:(i[r-1]+i[r])/2},DQ=(t,e)=>Array.from(new Set(e.map(n=>n.getValue(t))).values()),IQ=(t,e)=>new Set(e.map(n=>n.getValue(t))).size,LQ=(t,e)=>e.length,Yb={sum:_Q,min:AQ,max:RQ,extent:MQ,mean:NQ,median:OQ,unique:DQ,uniqueCount:IQ,count:LQ},jQ={getDefaultColumnDef:()=>({aggregatedCell:t=>{var e,n;return(e=(n=t.getValue())==null||n.toString==null?void 0:n.toString())!=null?e:null},aggregationFn:"auto"}),getInitialState:t=>({grouping:[],...t}),getDefaultOptions:t=>({onGroupingChange:_r("grouping",t),groupedColumnMode:"reorder"}),createColumn:(t,e)=>{t.toggleGrouping=()=>{e.setGrouping(n=>n!=null&&n.includes(t.id)?n.filter(r=>r!==t.id):[...n??[],t.id])},t.getCanGroup=()=>{var n,r;return((n=t.columnDef.enableGrouping)!=null?n:!0)&&((r=e.options.enableGrouping)!=null?r:!0)&&(!!t.accessorFn||!!t.columnDef.getGroupingValue)},t.getIsGrouped=()=>{var n;return(n=e.getState().grouping)==null?void 0:n.includes(t.id)},t.getGroupedIndex=()=>{var n;return(n=e.getState().grouping)==null?void 0:n.indexOf(t.id)},t.getToggleGroupingHandler=()=>{const n=t.getCanGroup();return()=>{n&&t.toggleGrouping()}},t.getAutoAggregationFn=()=>{const n=e.getCoreRowModel().flatRows[0],r=n?.getValue(t.id);if(typeof r=="number")return Yb.sum;if(Object.prototype.toString.call(r)==="[object Date]")return Yb.extent},t.getAggregationFn=()=>{var n,r;if(!t)throw new Error;return Tg(t.columnDef.aggregationFn)?t.columnDef.aggregationFn:t.columnDef.aggregationFn==="auto"?t.getAutoAggregationFn():(n=(r=e.options.aggregationFns)==null?void 0:r[t.columnDef.aggregationFn])!=null?n:Yb[t.columnDef.aggregationFn]}},createTable:t=>{t.setGrouping=e=>t.options.onGroupingChange==null?void 0:t.options.onGroupingChange(e),t.resetGrouping=e=>{var n,r;t.setGrouping(e?[]:(n=(r=t.initialState)==null?void 0:r.grouping)!=null?n:[])},t.getPreGroupedRowModel=()=>t.getFilteredRowModel(),t.getGroupedRowModel=()=>(!t._getGroupedRowModel&&t.options.getGroupedRowModel&&(t._getGroupedRowModel=t.options.getGroupedRowModel(t)),t.options.manualGrouping||!t._getGroupedRowModel?t.getPreGroupedRowModel():t._getGroupedRowModel())},createRow:(t,e)=>{t.getIsGrouped=()=>!!t.groupingColumnId,t.getGroupingValue=n=>{if(t._groupingValuesCache.hasOwnProperty(n))return t._groupingValuesCache[n];const r=e.getColumn(n);return r!=null&&r.columnDef.getGroupingValue?(t._groupingValuesCache[n]=r.columnDef.getGroupingValue(t.original),t._groupingValuesCache[n]):t.getValue(n)},t._groupingValuesCache={}},createCell:(t,e,n,r)=>{t.getIsGrouped=()=>e.getIsGrouped()&&e.id===n.groupingColumnId,t.getIsPlaceholder=()=>!t.getIsGrouped()&&e.getIsGrouped(),t.getIsAggregated=()=>{var i;return!t.getIsGrouped()&&!t.getIsPlaceholder()&&!!((i=n.subRows)!=null&&i.length)}}};function PQ(t,e,n){if(!(e!=null&&e.length)||!n)return t;const r=t.filter(s=>!e.includes(s.id));return n==="remove"?r:[...e.map(s=>t.find(o=>o.id===s)).filter(Boolean),...r]}const zQ={getInitialState:t=>({columnOrder:[],...t}),getDefaultOptions:t=>({onColumnOrderChange:_r("columnOrder",t)}),createColumn:(t,e)=>{t.getIndex=qe(n=>[ud(e,n)],n=>n.findIndex(r=>r.id===t.id),Ge(e.options,"debugColumns")),t.getIsFirstColumn=n=>{var r;return((r=ud(e,n)[0])==null?void 0:r.id)===t.id},t.getIsLastColumn=n=>{var r;const i=ud(e,n);return((r=i[i.length-1])==null?void 0:r.id)===t.id}},createTable:t=>{t.setColumnOrder=e=>t.options.onColumnOrderChange==null?void 0:t.options.onColumnOrderChange(e),t.resetColumnOrder=e=>{var n;t.setColumnOrder(e?[]:(n=t.initialState.columnOrder)!=null?n:[])},t._getOrderColumnsFn=qe(()=>[t.getState().columnOrder,t.getState().grouping,t.options.groupedColumnMode],(e,n,r)=>i=>{let s=[];if(!(e!=null&&e.length))s=i;else{const o=[...e],l=[...i];for(;l.length&&o.length;){const u=o.shift(),f=l.findIndex(h=>h.id===u);f>-1&&s.push(l.splice(f,1)[0])}s=[...s,...l]}return PQ(s,n,r)},Ge(t.options,"debugTable"))}},Xb=()=>({left:[],right:[]}),$Q={getInitialState:t=>({columnPinning:Xb(),...t}),getDefaultOptions:t=>({onColumnPinningChange:_r("columnPinning",t)}),createColumn:(t,e)=>{t.pin=n=>{const r=t.getLeafColumns().map(i=>i.id).filter(Boolean);e.setColumnPinning(i=>{var s,o;if(n==="right"){var l,u;return{left:((l=i?.left)!=null?l:[]).filter(m=>!(r!=null&&r.includes(m))),right:[...((u=i?.right)!=null?u:[]).filter(m=>!(r!=null&&r.includes(m))),...r]}}if(n==="left"){var f,h;return{left:[...((f=i?.left)!=null?f:[]).filter(m=>!(r!=null&&r.includes(m))),...r],right:((h=i?.right)!=null?h:[]).filter(m=>!(r!=null&&r.includes(m)))}}return{left:((s=i?.left)!=null?s:[]).filter(m=>!(r!=null&&r.includes(m))),right:((o=i?.right)!=null?o:[]).filter(m=>!(r!=null&&r.includes(m)))}})},t.getCanPin=()=>t.getLeafColumns().some(r=>{var i,s,o;return((i=r.columnDef.enablePinning)!=null?i:!0)&&((s=(o=e.options.enableColumnPinning)!=null?o:e.options.enablePinning)!=null?s:!0)}),t.getIsPinned=()=>{const n=t.getLeafColumns().map(l=>l.id),{left:r,right:i}=e.getState().columnPinning,s=n.some(l=>r?.includes(l)),o=n.some(l=>i?.includes(l));return s?"left":o?"right":!1},t.getPinnedIndex=()=>{var n,r;const i=t.getIsPinned();return i?(n=(r=e.getState().columnPinning)==null||(r=r[i])==null?void 0:r.indexOf(t.id))!=null?n:-1:0}},createRow:(t,e)=>{t.getCenterVisibleCells=qe(()=>[t._getAllVisibleCells(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,r,i)=>{const s=[...r??[],...i??[]];return n.filter(o=>!s.includes(o.column.id))},Ge(e.options,"debugRows")),t.getLeftVisibleCells=qe(()=>[t._getAllVisibleCells(),e.getState().columnPinning.left],(n,r)=>(r??[]).map(s=>n.find(o=>o.column.id===s)).filter(Boolean).map(s=>({...s,position:"left"})),Ge(e.options,"debugRows")),t.getRightVisibleCells=qe(()=>[t._getAllVisibleCells(),e.getState().columnPinning.right],(n,r)=>(r??[]).map(s=>n.find(o=>o.column.id===s)).filter(Boolean).map(s=>({...s,position:"right"})),Ge(e.options,"debugRows"))},createTable:t=>{t.setColumnPinning=e=>t.options.onColumnPinningChange==null?void 0:t.options.onColumnPinningChange(e),t.resetColumnPinning=e=>{var n,r;return t.setColumnPinning(e?Xb():(n=(r=t.initialState)==null?void 0:r.columnPinning)!=null?n:Xb())},t.getIsSomeColumnsPinned=e=>{var n;const r=t.getState().columnPinning;if(!e){var i,s;return!!((i=r.left)!=null&&i.length||(s=r.right)!=null&&s.length)}return!!((n=r[e])!=null&&n.length)},t.getLeftLeafColumns=qe(()=>[t.getAllLeafColumns(),t.getState().columnPinning.left],(e,n)=>(n??[]).map(r=>e.find(i=>i.id===r)).filter(Boolean),Ge(t.options,"debugColumns")),t.getRightLeafColumns=qe(()=>[t.getAllLeafColumns(),t.getState().columnPinning.right],(e,n)=>(n??[]).map(r=>e.find(i=>i.id===r)).filter(Boolean),Ge(t.options,"debugColumns")),t.getCenterLeafColumns=qe(()=>[t.getAllLeafColumns(),t.getState().columnPinning.left,t.getState().columnPinning.right],(e,n,r)=>{const i=[...n??[],...r??[]];return e.filter(s=>!i.includes(s.id))},Ge(t.options,"debugColumns"))}};function BQ(t){return t||(typeof document<"u"?document:null)}const Kh={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Jb=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),VQ={getDefaultColumnDef:()=>Kh,getInitialState:t=>({columnSizing:{},columnSizingInfo:Jb(),...t}),getDefaultOptions:t=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:_r("columnSizing",t),onColumnSizingInfoChange:_r("columnSizingInfo",t)}),createColumn:(t,e)=>{t.getSize=()=>{var n,r,i;const s=e.getState().columnSizing[t.id];return Math.min(Math.max((n=t.columnDef.minSize)!=null?n:Kh.minSize,(r=s??t.columnDef.size)!=null?r:Kh.size),(i=t.columnDef.maxSize)!=null?i:Kh.maxSize)},t.getStart=qe(n=>[n,ud(e,n),e.getState().columnSizing],(n,r)=>r.slice(0,t.getIndex(n)).reduce((i,s)=>i+s.getSize(),0),Ge(e.options,"debugColumns")),t.getAfter=qe(n=>[n,ud(e,n),e.getState().columnSizing],(n,r)=>r.slice(t.getIndex(n)+1).reduce((i,s)=>i+s.getSize(),0),Ge(e.options,"debugColumns")),t.resetSize=()=>{e.setColumnSizing(n=>{let{[t.id]:r,...i}=n;return i})},t.getCanResize=()=>{var n,r;return((n=t.columnDef.enableResizing)!=null?n:!0)&&((r=e.options.enableColumnResizing)!=null?r:!0)},t.getIsResizing=()=>e.getState().columnSizingInfo.isResizingColumn===t.id},createHeader:(t,e)=>{t.getSize=()=>{let n=0;const r=i=>{if(i.subHeaders.length)i.subHeaders.forEach(r);else{var s;n+=(s=i.column.getSize())!=null?s:0}};return r(t),n},t.getStart=()=>{if(t.index>0){const n=t.headerGroup.headers[t.index-1];return n.getStart()+n.getSize()}return 0},t.getResizeHandler=n=>{const r=e.getColumn(t.column.id),i=r?.getCanResize();return s=>{if(!r||!i||(s.persist==null||s.persist(),Qb(s)&&s.touches&&s.touches.length>1))return;const o=t.getSize(),l=t?t.getLeafHeaders().map(C=>[C.column.id,C.column.getSize()]):[[r.id,r.getSize()]],u=Qb(s)?Math.round(s.touches[0].clientX):s.clientX,f={},h=(C,T)=>{typeof T=="number"&&(e.setColumnSizingInfo(_=>{var R,M;const O=e.options.columnResizeDirection==="rtl"?-1:1,L=(T-((R=_?.startOffset)!=null?R:0))*O,P=Math.max(L/((M=_?.startSize)!=null?M:0),-.999999);return _.columnSizingStart.forEach(U=>{let[G,oe]=U;f[G]=Math.round(Math.max(oe+oe*P,0)*100)/100}),{..._,deltaOffset:L,deltaPercentage:P}}),(e.options.columnResizeMode==="onChange"||C==="end")&&e.setColumnSizing(_=>({..._,...f})))},m=C=>h("move",C),g=C=>{h("end",C),e.setColumnSizingInfo(T=>({...T,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},y=BQ(n),x={moveHandler:C=>m(C.clientX),upHandler:C=>{y?.removeEventListener("mousemove",x.moveHandler),y?.removeEventListener("mouseup",x.upHandler),g(C.clientX)}},S={moveHandler:C=>(C.cancelable&&(C.preventDefault(),C.stopPropagation()),m(C.touches[0].clientX),!1),upHandler:C=>{var T;y?.removeEventListener("touchmove",S.moveHandler),y?.removeEventListener("touchend",S.upHandler),C.cancelable&&(C.preventDefault(),C.stopPropagation()),g((T=C.touches[0])==null?void 0:T.clientX)}},k=HQ()?{passive:!1}:!1;Qb(s)?(y?.addEventListener("touchmove",S.moveHandler,k),y?.addEventListener("touchend",S.upHandler,k)):(y?.addEventListener("mousemove",x.moveHandler,k),y?.addEventListener("mouseup",x.upHandler,k)),e.setColumnSizingInfo(C=>({...C,startOffset:u,startSize:o,deltaOffset:0,deltaPercentage:0,columnSizingStart:l,isResizingColumn:r.id}))}}},createTable:t=>{t.setColumnSizing=e=>t.options.onColumnSizingChange==null?void 0:t.options.onColumnSizingChange(e),t.setColumnSizingInfo=e=>t.options.onColumnSizingInfoChange==null?void 0:t.options.onColumnSizingInfoChange(e),t.resetColumnSizing=e=>{var n;t.setColumnSizing(e?{}:(n=t.initialState.columnSizing)!=null?n:{})},t.resetHeaderSizeInfo=e=>{var n;t.setColumnSizingInfo(e?Jb():(n=t.initialState.columnSizingInfo)!=null?n:Jb())},t.getTotalSize=()=>{var e,n;return(e=(n=t.getHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?e:0},t.getLeftTotalSize=()=>{var e,n;return(e=(n=t.getLeftHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?e:0},t.getCenterTotalSize=()=>{var e,n;return(e=(n=t.getCenterHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?e:0},t.getRightTotalSize=()=>{var e,n;return(e=(n=t.getRightHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?e:0}}};let Zh=null;function HQ(){if(typeof Zh=="boolean")return Zh;let t=!1;try{const e={get passive(){return t=!0,!1}},n=()=>{};window.addEventListener("test",n,e),window.removeEventListener("test",n)}catch{t=!1}return Zh=t,Zh}function Qb(t){return t.type==="touchstart"}const UQ={getInitialState:t=>({columnVisibility:{},...t}),getDefaultOptions:t=>({onColumnVisibilityChange:_r("columnVisibility",t)}),createColumn:(t,e)=>{t.toggleVisibility=n=>{t.getCanHide()&&e.setColumnVisibility(r=>({...r,[t.id]:n??!t.getIsVisible()}))},t.getIsVisible=()=>{var n,r;const i=t.columns;return(n=i.length?i.some(s=>s.getIsVisible()):(r=e.getState().columnVisibility)==null?void 0:r[t.id])!=null?n:!0},t.getCanHide=()=>{var n,r;return((n=t.columnDef.enableHiding)!=null?n:!0)&&((r=e.options.enableHiding)!=null?r:!0)},t.getToggleVisibilityHandler=()=>n=>{t.toggleVisibility==null||t.toggleVisibility(n.target.checked)}},createRow:(t,e)=>{t._getAllVisibleCells=qe(()=>[t.getAllCells(),e.getState().columnVisibility],n=>n.filter(r=>r.column.getIsVisible()),Ge(e.options,"debugRows")),t.getVisibleCells=qe(()=>[t.getLeftVisibleCells(),t.getCenterVisibleCells(),t.getRightVisibleCells()],(n,r,i)=>[...n,...r,...i],Ge(e.options,"debugRows"))},createTable:t=>{const e=(n,r)=>qe(()=>[r(),r().filter(i=>i.getIsVisible()).map(i=>i.id).join("_")],i=>i.filter(s=>s.getIsVisible==null?void 0:s.getIsVisible()),Ge(t.options,"debugColumns"));t.getVisibleFlatColumns=e("getVisibleFlatColumns",()=>t.getAllFlatColumns()),t.getVisibleLeafColumns=e("getVisibleLeafColumns",()=>t.getAllLeafColumns()),t.getLeftVisibleLeafColumns=e("getLeftVisibleLeafColumns",()=>t.getLeftLeafColumns()),t.getRightVisibleLeafColumns=e("getRightVisibleLeafColumns",()=>t.getRightLeafColumns()),t.getCenterVisibleLeafColumns=e("getCenterVisibleLeafColumns",()=>t.getCenterLeafColumns()),t.setColumnVisibility=n=>t.options.onColumnVisibilityChange==null?void 0:t.options.onColumnVisibilityChange(n),t.resetColumnVisibility=n=>{var r;t.setColumnVisibility(n?{}:(r=t.initialState.columnVisibility)!=null?r:{})},t.toggleAllColumnsVisible=n=>{var r;n=(r=n)!=null?r:!t.getIsAllColumnsVisible(),t.setColumnVisibility(t.getAllLeafColumns().reduce((i,s)=>({...i,[s.id]:n||!(s.getCanHide!=null&&s.getCanHide())}),{}))},t.getIsAllColumnsVisible=()=>!t.getAllLeafColumns().some(n=>!(n.getIsVisible!=null&&n.getIsVisible())),t.getIsSomeColumnsVisible=()=>t.getAllLeafColumns().some(n=>n.getIsVisible==null?void 0:n.getIsVisible()),t.getToggleAllColumnsVisibilityHandler=()=>n=>{var r;t.toggleAllColumnsVisible((r=n.target)==null?void 0:r.checked)}}};function ud(t,e){return e?e==="center"?t.getCenterVisibleLeafColumns():e==="left"?t.getLeftVisibleLeafColumns():t.getRightVisibleLeafColumns():t.getVisibleLeafColumns()}const FQ={createTable:t=>{t._getGlobalFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,"__global__"),t.getGlobalFacetedRowModel=()=>t.options.manualFiltering||!t._getGlobalFacetedRowModel?t.getPreFilteredRowModel():t._getGlobalFacetedRowModel(),t._getGlobalFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,"__global__"),t.getGlobalFacetedUniqueValues=()=>t._getGlobalFacetedUniqueValues?t._getGlobalFacetedUniqueValues():new Map,t._getGlobalFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,"__global__"),t.getGlobalFacetedMinMaxValues=()=>{if(t._getGlobalFacetedMinMaxValues)return t._getGlobalFacetedMinMaxValues()}}},qQ={getInitialState:t=>({globalFilter:void 0,...t}),getDefaultOptions:t=>({onGlobalFilterChange:_r("globalFilter",t),globalFilterFn:"auto",getColumnCanGlobalFilter:e=>{var n;const r=(n=t.getCoreRowModel().flatRows[0])==null||(n=n._getAllCellsByColumnId()[e.id])==null?void 0:n.getValue();return typeof r=="string"||typeof r=="number"}}),createColumn:(t,e)=>{t.getCanGlobalFilter=()=>{var n,r,i,s;return((n=t.columnDef.enableGlobalFilter)!=null?n:!0)&&((r=e.options.enableGlobalFilter)!=null?r:!0)&&((i=e.options.enableFilters)!=null?i:!0)&&((s=e.options.getColumnCanGlobalFilter==null?void 0:e.options.getColumnCanGlobalFilter(t))!=null?s:!0)&&!!t.accessorFn}},createTable:t=>{t.getGlobalAutoFilterFn=()=>ls.includesString,t.getGlobalFilterFn=()=>{var e,n;const{globalFilterFn:r}=t.options;return Tg(r)?r:r==="auto"?t.getGlobalAutoFilterFn():(e=(n=t.options.filterFns)==null?void 0:n[r])!=null?e:ls[r]},t.setGlobalFilter=e=>{t.options.onGlobalFilterChange==null||t.options.onGlobalFilterChange(e)},t.resetGlobalFilter=e=>{t.setGlobalFilter(e?void 0:t.initialState.globalFilter)}}},GQ={getInitialState:t=>({expanded:{},...t}),getDefaultOptions:t=>({onExpandedChange:_r("expanded",t),paginateExpandedRows:!0}),createTable:t=>{let e=!1,n=!1;t._autoResetExpanded=()=>{var r,i;if(!e){t._queue(()=>{e=!0});return}if((r=(i=t.options.autoResetAll)!=null?i:t.options.autoResetExpanded)!=null?r:!t.options.manualExpanding){if(n)return;n=!0,t._queue(()=>{t.resetExpanded(),n=!1})}},t.setExpanded=r=>t.options.onExpandedChange==null?void 0:t.options.onExpandedChange(r),t.toggleAllRowsExpanded=r=>{r??!t.getIsAllRowsExpanded()?t.setExpanded(!0):t.setExpanded({})},t.resetExpanded=r=>{var i,s;t.setExpanded(r?{}:(i=(s=t.initialState)==null?void 0:s.expanded)!=null?i:{})},t.getCanSomeRowsExpand=()=>t.getPrePaginationRowModel().flatRows.some(r=>r.getCanExpand()),t.getToggleAllRowsExpandedHandler=()=>r=>{r.persist==null||r.persist(),t.toggleAllRowsExpanded()},t.getIsSomeRowsExpanded=()=>{const r=t.getState().expanded;return r===!0||Object.values(r).some(Boolean)},t.getIsAllRowsExpanded=()=>{const r=t.getState().expanded;return typeof r=="boolean"?r===!0:!(!Object.keys(r).length||t.getRowModel().flatRows.some(i=>!i.getIsExpanded()))},t.getExpandedDepth=()=>{let r=0;return(t.getState().expanded===!0?Object.keys(t.getRowModel().rowsById):Object.keys(t.getState().expanded)).forEach(s=>{const o=s.split(".");r=Math.max(r,o.length)}),r},t.getPreExpandedRowModel=()=>t.getSortedRowModel(),t.getExpandedRowModel=()=>(!t._getExpandedRowModel&&t.options.getExpandedRowModel&&(t._getExpandedRowModel=t.options.getExpandedRowModel(t)),t.options.manualExpanding||!t._getExpandedRowModel?t.getPreExpandedRowModel():t._getExpandedRowModel())},createRow:(t,e)=>{t.toggleExpanded=n=>{e.setExpanded(r=>{var i;const s=r===!0?!0:!!(r!=null&&r[t.id]);let o={};if(r===!0?Object.keys(e.getRowModel().rowsById).forEach(l=>{o[l]=!0}):o=r,n=(i=n)!=null?i:!s,!s&&n)return{...o,[t.id]:!0};if(s&&!n){const{[t.id]:l,...u}=o;return u}return r})},t.getIsExpanded=()=>{var n;const r=e.getState().expanded;return!!((n=e.options.getIsRowExpanded==null?void 0:e.options.getIsRowExpanded(t))!=null?n:r===!0||r?.[t.id])},t.getCanExpand=()=>{var n,r,i;return(n=e.options.getRowCanExpand==null?void 0:e.options.getRowCanExpand(t))!=null?n:((r=e.options.enableExpanding)!=null?r:!0)&&!!((i=t.subRows)!=null&&i.length)},t.getIsAllParentsExpanded=()=>{let n=!0,r=t;for(;n&&r.parentId;)r=e.getRow(r.parentId,!0),n=r.getIsExpanded();return n},t.getToggleExpandedHandler=()=>{const n=t.getCanExpand();return()=>{n&&t.toggleExpanded()}}}},zx=0,$x=10,e0=()=>({pageIndex:zx,pageSize:$x}),WQ={getInitialState:t=>({...t,pagination:{...e0(),...t?.pagination}}),getDefaultOptions:t=>({onPaginationChange:_r("pagination",t)}),createTable:t=>{let e=!1,n=!1;t._autoResetPageIndex=()=>{var r,i;if(!e){t._queue(()=>{e=!0});return}if((r=(i=t.options.autoResetAll)!=null?i:t.options.autoResetPageIndex)!=null?r:!t.options.manualPagination){if(n)return;n=!0,t._queue(()=>{t.resetPageIndex(),n=!1})}},t.setPagination=r=>{const i=s=>bo(r,s);return t.options.onPaginationChange==null?void 0:t.options.onPaginationChange(i)},t.resetPagination=r=>{var i;t.setPagination(r?e0():(i=t.initialState.pagination)!=null?i:e0())},t.setPageIndex=r=>{t.setPagination(i=>{let s=bo(r,i.pageIndex);const o=typeof t.options.pageCount>"u"||t.options.pageCount===-1?Number.MAX_SAFE_INTEGER:t.options.pageCount-1;return s=Math.max(0,Math.min(s,o)),{...i,pageIndex:s}})},t.resetPageIndex=r=>{var i,s;t.setPageIndex(r?zx:(i=(s=t.initialState)==null||(s=s.pagination)==null?void 0:s.pageIndex)!=null?i:zx)},t.resetPageSize=r=>{var i,s;t.setPageSize(r?$x:(i=(s=t.initialState)==null||(s=s.pagination)==null?void 0:s.pageSize)!=null?i:$x)},t.setPageSize=r=>{t.setPagination(i=>{const s=Math.max(1,bo(r,i.pageSize)),o=i.pageSize*i.pageIndex,l=Math.floor(o/s);return{...i,pageIndex:l,pageSize:s}})},t.setPageCount=r=>t.setPagination(i=>{var s;let o=bo(r,(s=t.options.pageCount)!=null?s:-1);return typeof o=="number"&&(o=Math.max(-1,o)),{...i,pageCount:o}}),t.getPageOptions=qe(()=>[t.getPageCount()],r=>{let i=[];return r&&r>0&&(i=[...new Array(r)].fill(null).map((s,o)=>o)),i},Ge(t.options,"debugTable")),t.getCanPreviousPage=()=>t.getState().pagination.pageIndex>0,t.getCanNextPage=()=>{const{pageIndex:r}=t.getState().pagination,i=t.getPageCount();return i===-1?!0:i===0?!1:r<i-1},t.previousPage=()=>t.setPageIndex(r=>r-1),t.nextPage=()=>t.setPageIndex(r=>r+1),t.firstPage=()=>t.setPageIndex(0),t.lastPage=()=>t.setPageIndex(t.getPageCount()-1),t.getPrePaginationRowModel=()=>t.getExpandedRowModel(),t.getPaginationRowModel=()=>(!t._getPaginationRowModel&&t.options.getPaginationRowModel&&(t._getPaginationRowModel=t.options.getPaginationRowModel(t)),t.options.manualPagination||!t._getPaginationRowModel?t.getPrePaginationRowModel():t._getPaginationRowModel()),t.getPageCount=()=>{var r;return(r=t.options.pageCount)!=null?r:Math.ceil(t.getRowCount()/t.getState().pagination.pageSize)},t.getRowCount=()=>{var r;return(r=t.options.rowCount)!=null?r:t.getPrePaginationRowModel().rows.length}}},t0=()=>({top:[],bottom:[]}),KQ={getInitialState:t=>({rowPinning:t0(),...t}),getDefaultOptions:t=>({onRowPinningChange:_r("rowPinning",t)}),createRow:(t,e)=>{t.pin=(n,r,i)=>{const s=r?t.getLeafRows().map(u=>{let{id:f}=u;return f}):[],o=i?t.getParentRows().map(u=>{let{id:f}=u;return f}):[],l=new Set([...o,t.id,...s]);e.setRowPinning(u=>{var f,h;if(n==="bottom"){var m,g;return{top:((m=u?.top)!=null?m:[]).filter(S=>!(l!=null&&l.has(S))),bottom:[...((g=u?.bottom)!=null?g:[]).filter(S=>!(l!=null&&l.has(S))),...Array.from(l)]}}if(n==="top"){var y,x;return{top:[...((y=u?.top)!=null?y:[]).filter(S=>!(l!=null&&l.has(S))),...Array.from(l)],bottom:((x=u?.bottom)!=null?x:[]).filter(S=>!(l!=null&&l.has(S)))}}return{top:((f=u?.top)!=null?f:[]).filter(S=>!(l!=null&&l.has(S))),bottom:((h=u?.bottom)!=null?h:[]).filter(S=>!(l!=null&&l.has(S)))}})},t.getCanPin=()=>{var n;const{enableRowPinning:r,enablePinning:i}=e.options;return typeof r=="function"?r(t):(n=r??i)!=null?n:!0},t.getIsPinned=()=>{const n=[t.id],{top:r,bottom:i}=e.getState().rowPinning,s=n.some(l=>r?.includes(l)),o=n.some(l=>i?.includes(l));return s?"top":o?"bottom":!1},t.getPinnedIndex=()=>{var n,r;const i=t.getIsPinned();if(!i)return-1;const s=(n=i==="top"?e.getTopRows():e.getBottomRows())==null?void 0:n.map(o=>{let{id:l}=o;return l});return(r=s?.indexOf(t.id))!=null?r:-1}},createTable:t=>{t.setRowPinning=e=>t.options.onRowPinningChange==null?void 0:t.options.onRowPinningChange(e),t.resetRowPinning=e=>{var n,r;return t.setRowPinning(e?t0():(n=(r=t.initialState)==null?void 0:r.rowPinning)!=null?n:t0())},t.getIsSomeRowsPinned=e=>{var n;const r=t.getState().rowPinning;if(!e){var i,s;return!!((i=r.top)!=null&&i.length||(s=r.bottom)!=null&&s.length)}return!!((n=r[e])!=null&&n.length)},t._getPinnedRows=(e,n,r)=>{var i;return((i=t.options.keepPinnedRows)==null||i?(n??[]).map(o=>{const l=t.getRow(o,!0);return l.getIsAllParentsExpanded()?l:null}):(n??[]).map(o=>e.find(l=>l.id===o))).filter(Boolean).map(o=>({...o,position:r}))},t.getTopRows=qe(()=>[t.getRowModel().rows,t.getState().rowPinning.top],(e,n)=>t._getPinnedRows(e,n,"top"),Ge(t.options,"debugRows")),t.getBottomRows=qe(()=>[t.getRowModel().rows,t.getState().rowPinning.bottom],(e,n)=>t._getPinnedRows(e,n,"bottom"),Ge(t.options,"debugRows")),t.getCenterRows=qe(()=>[t.getRowModel().rows,t.getState().rowPinning.top,t.getState().rowPinning.bottom],(e,n,r)=>{const i=new Set([...n??[],...r??[]]);return e.filter(s=>!i.has(s.id))},Ge(t.options,"debugRows"))}},ZQ={getInitialState:t=>({rowSelection:{},...t}),getDefaultOptions:t=>({onRowSelectionChange:_r("rowSelection",t),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:t=>{t.setRowSelection=e=>t.options.onRowSelectionChange==null?void 0:t.options.onRowSelectionChange(e),t.resetRowSelection=e=>{var n;return t.setRowSelection(e?{}:(n=t.initialState.rowSelection)!=null?n:{})},t.toggleAllRowsSelected=e=>{t.setRowSelection(n=>{e=typeof e<"u"?e:!t.getIsAllRowsSelected();const r={...n},i=t.getPreGroupedRowModel().flatRows;return e?i.forEach(s=>{s.getCanSelect()&&(r[s.id]=!0)}):i.forEach(s=>{delete r[s.id]}),r})},t.toggleAllPageRowsSelected=e=>t.setRowSelection(n=>{const r=typeof e<"u"?e:!t.getIsAllPageRowsSelected(),i={...n};return t.getRowModel().rows.forEach(s=>{Bx(i,s.id,r,!0,t)}),i}),t.getPreSelectedRowModel=()=>t.getCoreRowModel(),t.getSelectedRowModel=qe(()=>[t.getState().rowSelection,t.getCoreRowModel()],(e,n)=>Object.keys(e).length?n0(t,n):{rows:[],flatRows:[],rowsById:{}},Ge(t.options,"debugTable")),t.getFilteredSelectedRowModel=qe(()=>[t.getState().rowSelection,t.getFilteredRowModel()],(e,n)=>Object.keys(e).length?n0(t,n):{rows:[],flatRows:[],rowsById:{}},Ge(t.options,"debugTable")),t.getGroupedSelectedRowModel=qe(()=>[t.getState().rowSelection,t.getSortedRowModel()],(e,n)=>Object.keys(e).length?n0(t,n):{rows:[],flatRows:[],rowsById:{}},Ge(t.options,"debugTable")),t.getIsAllRowsSelected=()=>{const e=t.getFilteredRowModel().flatRows,{rowSelection:n}=t.getState();let r=!!(e.length&&Object.keys(n).length);return r&&e.some(i=>i.getCanSelect()&&!n[i.id])&&(r=!1),r},t.getIsAllPageRowsSelected=()=>{const e=t.getPaginationRowModel().flatRows.filter(i=>i.getCanSelect()),{rowSelection:n}=t.getState();let r=!!e.length;return r&&e.some(i=>!n[i.id])&&(r=!1),r},t.getIsSomeRowsSelected=()=>{var e;const n=Object.keys((e=t.getState().rowSelection)!=null?e:{}).length;return n>0&&n<t.getFilteredRowModel().flatRows.length},t.getIsSomePageRowsSelected=()=>{const e=t.getPaginationRowModel().flatRows;return t.getIsAllPageRowsSelected()?!1:e.filter(n=>n.getCanSelect()).some(n=>n.getIsSelected()||n.getIsSomeSelected())},t.getToggleAllRowsSelectedHandler=()=>e=>{t.toggleAllRowsSelected(e.target.checked)},t.getToggleAllPageRowsSelectedHandler=()=>e=>{t.toggleAllPageRowsSelected(e.target.checked)}},createRow:(t,e)=>{t.toggleSelected=(n,r)=>{const i=t.getIsSelected();e.setRowSelection(s=>{var o;if(n=typeof n<"u"?n:!i,t.getCanSelect()&&i===n)return s;const l={...s};return Bx(l,t.id,n,(o=r?.selectChildren)!=null?o:!0,e),l})},t.getIsSelected=()=>{const{rowSelection:n}=e.getState();return KS(t,n)},t.getIsSomeSelected=()=>{const{rowSelection:n}=e.getState();return Vx(t,n)==="some"},t.getIsAllSubRowsSelected=()=>{const{rowSelection:n}=e.getState();return Vx(t,n)==="all"},t.getCanSelect=()=>{var n;return typeof e.options.enableRowSelection=="function"?e.options.enableRowSelection(t):(n=e.options.enableRowSelection)!=null?n:!0},t.getCanSelectSubRows=()=>{var n;return typeof e.options.enableSubRowSelection=="function"?e.options.enableSubRowSelection(t):(n=e.options.enableSubRowSelection)!=null?n:!0},t.getCanMultiSelect=()=>{var n;return typeof e.options.enableMultiRowSelection=="function"?e.options.enableMultiRowSelection(t):(n=e.options.enableMultiRowSelection)!=null?n:!0},t.getToggleSelectedHandler=()=>{const n=t.getCanSelect();return r=>{var i;n&&t.toggleSelected((i=r.target)==null?void 0:i.checked)}}}},Bx=(t,e,n,r,i)=>{var s;const o=i.getRow(e,!0);n?(o.getCanMultiSelect()||Object.keys(t).forEach(l=>delete t[l]),o.getCanSelect()&&(t[e]=!0)):delete t[e],r&&(s=o.subRows)!=null&&s.length&&o.getCanSelectSubRows()&&o.subRows.forEach(l=>Bx(t,l.id,n,r,i))};function n0(t,e){const n=t.getState().rowSelection,r=[],i={},s=function(o,l){return o.map(u=>{var f;const h=KS(u,n);if(h&&(r.push(u),i[u.id]=u),(f=u.subRows)!=null&&f.length&&(u={...u,subRows:s(u.subRows)}),h)return u}).filter(Boolean)};return{rows:s(e.rows),flatRows:r,rowsById:i}}function KS(t,e){var n;return(n=e[t.id])!=null?n:!1}function Vx(t,e,n){var r;if(!((r=t.subRows)!=null&&r.length))return!1;let i=!0,s=!1;return t.subRows.forEach(o=>{if(!(s&&!i)&&(o.getCanSelect()&&(KS(o,e)?s=!0:i=!1),o.subRows&&o.subRows.length)){const l=Vx(o,e);l==="all"?s=!0:(l==="some"&&(s=!0),i=!1)}}),i?"all":s?"some":!1}const Hx=/([0-9]+)/gm,YQ=(t,e,n)=>Yj(Po(t.getValue(n)).toLowerCase(),Po(e.getValue(n)).toLowerCase()),XQ=(t,e,n)=>Yj(Po(t.getValue(n)),Po(e.getValue(n))),JQ=(t,e,n)=>ZS(Po(t.getValue(n)).toLowerCase(),Po(e.getValue(n)).toLowerCase()),QQ=(t,e,n)=>ZS(Po(t.getValue(n)),Po(e.getValue(n))),eee=(t,e,n)=>{const r=t.getValue(n),i=e.getValue(n);return r>i?1:r<i?-1:0},tee=(t,e,n)=>ZS(t.getValue(n),e.getValue(n));function ZS(t,e){return t===e?0:t>e?1:-1}function Po(t){return typeof t=="number"?isNaN(t)||t===1/0||t===-1/0?"":String(t):typeof t=="string"?t:""}function Yj(t,e){const n=t.split(Hx).filter(Boolean),r=e.split(Hx).filter(Boolean);for(;n.length&&r.length;){const i=n.shift(),s=r.shift(),o=parseInt(i,10),l=parseInt(s,10),u=[o,l].sort();if(isNaN(u[0])){if(i>s)return 1;if(s>i)return-1;continue}if(isNaN(u[1]))return isNaN(o)?-1:1;if(o>l)return 1;if(l>o)return-1}return n.length-r.length}const Lu={alphanumeric:YQ,alphanumericCaseSensitive:XQ,text:JQ,textCaseSensitive:QQ,datetime:eee,basic:tee},nee={getInitialState:t=>({sorting:[],...t}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:t=>({onSortingChange:_r("sorting",t),isMultiSortEvent:e=>e.shiftKey}),createColumn:(t,e)=>{t.getAutoSortingFn=()=>{const n=e.getFilteredRowModel().flatRows.slice(10);let r=!1;for(const i of n){const s=i?.getValue(t.id);if(Object.prototype.toString.call(s)==="[object Date]")return Lu.datetime;if(typeof s=="string"&&(r=!0,s.split(Hx).length>1))return Lu.alphanumeric}return r?Lu.text:Lu.basic},t.getAutoSortDir=()=>{const n=e.getFilteredRowModel().flatRows[0];return typeof n?.getValue(t.id)=="string"?"asc":"desc"},t.getSortingFn=()=>{var n,r;if(!t)throw new Error;return Tg(t.columnDef.sortingFn)?t.columnDef.sortingFn:t.columnDef.sortingFn==="auto"?t.getAutoSortingFn():(n=(r=e.options.sortingFns)==null?void 0:r[t.columnDef.sortingFn])!=null?n:Lu[t.columnDef.sortingFn]},t.toggleSorting=(n,r)=>{const i=t.getNextSortingOrder(),s=typeof n<"u"&&n!==null;e.setSorting(o=>{const l=o?.find(y=>y.id===t.id),u=o?.findIndex(y=>y.id===t.id);let f=[],h,m=s?n:i==="desc";if(o!=null&&o.length&&t.getCanMultiSort()&&r?l?h="toggle":h="add":o!=null&&o.length&&u!==o.length-1?h="replace":l?h="toggle":h="replace",h==="toggle"&&(s||i||(h="remove")),h==="add"){var g;f=[...o,{id:t.id,desc:m}],f.splice(0,f.length-((g=e.options.maxMultiSortColCount)!=null?g:Number.MAX_SAFE_INTEGER))}else h==="toggle"?f=o.map(y=>y.id===t.id?{...y,desc:m}:y):h==="remove"?f=o.filter(y=>y.id!==t.id):f=[{id:t.id,desc:m}];return f})},t.getFirstSortDir=()=>{var n,r;return((n=(r=t.columnDef.sortDescFirst)!=null?r:e.options.sortDescFirst)!=null?n:t.getAutoSortDir()==="desc")?"desc":"asc"},t.getNextSortingOrder=n=>{var r,i;const s=t.getFirstSortDir(),o=t.getIsSorted();return o?o!==s&&((r=e.options.enableSortingRemoval)==null||r)&&(!(n&&(i=e.options.enableMultiRemove)!=null)||i)?!1:o==="desc"?"asc":"desc":s},t.getCanSort=()=>{var n,r;return((n=t.columnDef.enableSorting)!=null?n:!0)&&((r=e.options.enableSorting)!=null?r:!0)&&!!t.accessorFn},t.getCanMultiSort=()=>{var n,r;return(n=(r=t.columnDef.enableMultiSort)!=null?r:e.options.enableMultiSort)!=null?n:!!t.accessorFn},t.getIsSorted=()=>{var n;const r=(n=e.getState().sorting)==null?void 0:n.find(i=>i.id===t.id);return r?r.desc?"desc":"asc":!1},t.getSortIndex=()=>{var n,r;return(n=(r=e.getState().sorting)==null?void 0:r.findIndex(i=>i.id===t.id))!=null?n:-1},t.clearSorting=()=>{e.setSorting(n=>n!=null&&n.length?n.filter(r=>r.id!==t.id):[])},t.getToggleSortingHandler=()=>{const n=t.getCanSort();return r=>{n&&(r.persist==null||r.persist(),t.toggleSorting==null||t.toggleSorting(void 0,t.getCanMultiSort()?e.options.isMultiSortEvent==null?void 0:e.options.isMultiSortEvent(r):!1))}}},createTable:t=>{t.setSorting=e=>t.options.onSortingChange==null?void 0:t.options.onSortingChange(e),t.resetSorting=e=>{var n,r;t.setSorting(e?[]:(n=(r=t.initialState)==null?void 0:r.sorting)!=null?n:[])},t.getPreSortedRowModel=()=>t.getGroupedRowModel(),t.getSortedRowModel=()=>(!t._getSortedRowModel&&t.options.getSortedRowModel&&(t._getSortedRowModel=t.options.getSortedRowModel(t)),t.options.manualSorting||!t._getSortedRowModel?t.getPreSortedRowModel():t._getSortedRowModel())}},ree=[kQ,UQ,zQ,$Q,EQ,TQ,FQ,qQ,nee,jQ,GQ,WQ,KQ,ZQ,VQ];function iee(t){var e,n;const r=[...ree,...(e=t._features)!=null?e:[]];let i={_features:r};const s=i._features.reduce((g,y)=>Object.assign(g,y.getDefaultOptions==null?void 0:y.getDefaultOptions(i)),{}),o=g=>i.options.mergeOptions?i.options.mergeOptions(s,g):{...s,...g};let u={...{},...(n=t.initialState)!=null?n:{}};i._features.forEach(g=>{var y;u=(y=g.getInitialState==null?void 0:g.getInitialState(u))!=null?y:u});const f=[];let h=!1;const m={_features:r,options:{...s,...t},initialState:u,_queue:g=>{f.push(g),h||(h=!0,Promise.resolve().then(()=>{for(;f.length;)f.shift()();h=!1}).catch(y=>setTimeout(()=>{throw y})))},reset:()=>{i.setState(i.initialState)},setOptions:g=>{const y=bo(g,i.options);i.options=o(y)},getState:()=>i.options.state,setState:g=>{i.options.onStateChange==null||i.options.onStateChange(g)},_getRowId:(g,y,x)=>{var S;return(S=i.options.getRowId==null?void 0:i.options.getRowId(g,y,x))!=null?S:`${x?[x.id,y].join("."):y}`},getCoreRowModel:()=>(i._getCoreRowModel||(i._getCoreRowModel=i.options.getCoreRowModel(i)),i._getCoreRowModel()),getRowModel:()=>i.getPaginationRowModel(),getRow:(g,y)=>{let x=(y?i.getPrePaginationRowModel():i.getRowModel()).rowsById[g];if(!x&&(x=i.getCoreRowModel().rowsById[g],!x))throw new Error;return x},_getDefaultColumnDef:qe(()=>[i.options.defaultColumn],g=>{var y;return g=(y=g)!=null?y:{},{header:x=>{const S=x.header.column.columnDef;return S.accessorKey?S.accessorKey:S.accessorFn?S.id:null},cell:x=>{var S,k;return(S=(k=x.renderValue())==null||k.toString==null?void 0:k.toString())!=null?S:null},...i._features.reduce((x,S)=>Object.assign(x,S.getDefaultColumnDef==null?void 0:S.getDefaultColumnDef()),{}),...g}},Ge(t,"debugColumns")),_getColumnDefs:()=>i.options.columns,getAllColumns:qe(()=>[i._getColumnDefs()],g=>{const y=function(x,S,k){return k===void 0&&(k=0),x.map(C=>{const T=SQ(i,C,k,S),_=C;return T.columns=_.columns?y(_.columns,T,k+1):[],T})};return y(g)},Ge(t,"debugColumns")),getAllFlatColumns:qe(()=>[i.getAllColumns()],g=>g.flatMap(y=>y.getFlatColumns()),Ge(t,"debugColumns")),_getAllFlatColumnsById:qe(()=>[i.getAllFlatColumns()],g=>g.reduce((y,x)=>(y[x.id]=x,y),{}),Ge(t,"debugColumns")),getAllLeafColumns:qe(()=>[i.getAllColumns(),i._getOrderColumnsFn()],(g,y)=>{let x=g.flatMap(S=>S.getLeafColumns());return y(x)},Ge(t,"debugColumns")),getColumn:g=>i._getAllFlatColumnsById()[g]};Object.assign(i,m);for(let g=0;g<i._features.length;g++){const y=i._features[g];y==null||y.createTable==null||y.createTable(i)}return i}function see(){return t=>qe(()=>[t.options.data],e=>{const n={rows:[],flatRows:[],rowsById:{}},r=function(i,s,o){s===void 0&&(s=0);const l=[];for(let f=0;f<i.length;f++){const h=CQ(t,t._getRowId(i[f],f,o),i[f],f,s,void 0,o?.id);if(n.flatRows.push(h),n.rowsById[h.id]=h,l.push(h),t.options.getSubRows){var u;h.originalSubRows=t.options.getSubRows(i[f],f),(u=h.originalSubRows)!=null&&u.length&&(h.subRows=r(h.originalSubRows,s+1,h))}}return l};return n.rows=r(e),n},Ge(t.options,"debugTable","getRowModel",()=>t._autoResetPageIndex()))}function iM(t,e){return t?oee(t)?A.createElement(t,e):t:null}function oee(t){return aee(t)||typeof t=="function"||lee(t)}function aee(t){return typeof t=="function"&&(()=>{const e=Object.getPrototypeOf(t);return e.prototype&&e.prototype.isReactComponent})()}function lee(t){return typeof t=="object"&&typeof t.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(t.$$typeof.description)}function cee(t){const e={state:{},onStateChange:()=>{},renderFallbackValue:null,...t},[n]=A.useState(()=>({current:iee(e)})),[r,i]=A.useState(()=>n.current.initialState);return n.current.setOptions(s=>({...s,...t,state:{...r,...t.state},onStateChange:o=>{i(o),t.onStateChange==null||t.onStateChange(o)}})),n.current}function uee({uploads:t,canCreate:e,fieldLabels:n,onClose:r,onUpload:i,onCreateFromUploads:s}){const o=A.useMemo(()=>Object.keys(t),[t]),[l,u]=A.useState(o[0]??""),[f,h]=A.useState(!!e),[m,g]=A.useState([]),[y,x]=A.useState(null),S=t[l];return A.useEffect(()=>{!o.includes(l)&&o[0]&&u(o[0])},[l,o]),A.useEffect(()=>{const k=T=>{T.key==="Escape"&&r()};window.addEventListener("keydown",k);const C=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{window.removeEventListener("keydown",k),document.body.style.overflow=C}},[r]),S?b.jsx("div",{className:"vertebr-modal-backdrop",role:"presentation",onClick:r,children:b.jsxs("div",{className:"vertebr-modal vertebr-modal-sm",role:"dialog","aria-modal":"true","aria-label":"Bulk image upload",onClick:k=>k.stopPropagation(),children:[b.jsxs("header",{className:"vertebr-modal-head",children:[b.jsxs("div",{className:"vertebr-modal-heading",children:[b.jsx("p",{className:"vertebr-modal-eyebrow",children:"Media"}),b.jsx("h2",{children:"Bulk image upload"})]}),b.jsx("button",{type:"button",className:"vertebr-btn",onClick:r,children:"Close"})]}),b.jsxs("div",{className:"vertebr-modal-body",children:[o.length>1?b.jsxs("label",{className:"vertebr-field",children:[b.jsx("span",{children:"Target field"}),b.jsx("select",{className:"vertebr-native-select",value:l,onChange:k=>{u(k.target.value),g([]),x(null)},children:o.map(k=>b.jsx("option",{value:k,children:n[k]??k},k))})]}):null,e&&s?b.jsxs("label",{className:"vertebr-upload-check",children:[b.jsx("input",{type:"checkbox",checked:f,onChange:k=>h(k.target.checked)}),b.jsx("span",{children:"Create a record for each uploaded image"})]}):null,b.jsx(Fd,{meta:S,multiple:!0,onUpload:async k=>{x(`Uploading ${k.length} image${k.length===1?"":"s"}…`);const C=await i(l,k);g(C),f&&s?(x("Creating records…"),await s(l,C),x(`Uploaded ${C.length} and created records.`)):x(`Uploaded ${C.length} image${C.length===1?"":"s"}.`)}}),y?b.jsx("p",{className:"vertebr-upload-status",children:y}):null,m.length>0?b.jsx("ul",{className:"vertebr-upload-results",children:m.map(k=>b.jsxs("li",{children:[b.jsx("img",{src:k.url,alt:""}),b.jsxs("div",{children:[b.jsx("strong",{children:k.name??"Image"}),b.jsx("a",{href:k.url,target:"_blank",rel:"noreferrer",children:k.url})]})]},k.url))}):null]})]})}):null}function dee({columns:t,visibility:e,onChange:n}){const[r,i]=A.useState(!1),s=A.useRef(null),o=A.useId(),l=t.filter(f=>e[f.id]===!1).length;A.useEffect(()=>{if(!r)return;const f=m=>{s.current?.contains(m.target)||i(!1)},h=m=>{m.key==="Escape"&&i(!1)};return window.addEventListener("mousedown",f),window.addEventListener("keydown",h),()=>{window.removeEventListener("mousedown",f),window.removeEventListener("keydown",h)}},[r]);const u=t.length-l;return b.jsxs("div",{className:"vertebr-col-menu",ref:s,children:[b.jsxs("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet","aria-expanded":r,"aria-controls":o,onClick:()=>i(f=>!f),children:["Columns",l>0?b.jsx("span",{className:"vertebr-col-menu-count",children:u}):null]}),r?b.jsxs("div",{className:"vertebr-col-menu-panel",id:o,role:"menu",children:[b.jsxs("div",{className:"vertebr-col-menu-head",children:[b.jsx("span",{children:"Visible fields"}),b.jsx("button",{type:"button",className:"vertebr-link-btn",onClick:()=>{const f={};for(const h of t)f[h.id]=!0;n(f)},children:"Show all"})]}),b.jsx("ul",{className:"vertebr-col-menu-list",children:t.map(f=>{const h=e[f.id]!==!1;return b.jsx("li",{children:b.jsxs("label",{className:"vertebr-col-menu-item",children:[b.jsx("input",{type:"checkbox",checked:h,disabled:h&&u<=1,onChange:()=>{const m={...e,[f.id]:!h};n(m)}}),b.jsx("span",{children:f.label})]})},f.id)})})]}):null]})}const fee=/(url|href|link|src)/i,hee=/\.(png|jpe?g|gif|webp|svg|avif)(\?|#|$)/i;function Xj(t){return/^https?:\/\//i.test(t)||t.startsWith("//")}function pee(t){return Xj(t)?hee.test(t)?!0:/(image|img|media|cdn|photo)/i.test(t):!1}function sM(t){if(t instanceof Date&&!Number.isNaN(t.getTime()))return t.toLocaleString();if(t&&typeof t=="object"&&"toDate"in t&&typeof t.toDate=="function")try{return t.toDate().toLocaleString()}catch{return null}if(typeof t=="string"||typeof t=="number"){const e=new Date(t);if(!Number.isNaN(e.getTime()))return e.toLocaleString()}return null}function Ux({fieldKey:t,field:e,value:n,variant:r="table"}){const i=r==="detail";if(n==null||n==="")return b.jsx("span",{className:"vertebr-cell-empty",children:"—"});const s=e?.type;if(s==="boolean"||typeof n=="boolean"){const u=!!n;return b.jsx("span",{className:"vertebr-badge","data-tone":u?"ok":"neutral",children:mee(t,e,u)})}if(s==="datetime"){const u=sM(n);if(u)return b.jsx("span",{className:"vertebr-cell-datetime",children:u})}if((s==="number"||typeof n=="number")&&typeof n=="number"&&Number.isFinite(n))return Tw(t,e)?b.jsx("span",{className:"vertebr-cell-money",children:L0(n,{asCents:!0})}):uO(t,e)?b.jsx("span",{className:"vertebr-cell-money",children:L0(n,{asCents:!1})}):b.jsx("span",{className:"vertebr-cell-number",children:new Intl.NumberFormat().format(n)});const o=M0(n);if(o.length>0&&(s==="file[]"||Oa(t,e)||o.every(pee)))return b.jsx(gee,{urls:o,detail:i});if(Array.isArray(n)){if(n.length===0)return b.jsx("span",{className:"vertebr-cell-empty",children:"—"});if(n.every(u=>typeof u=="string"))return b.jsx("div",{className:"vertebr-chip-row",children:n.map(u=>b.jsx("span",{className:"vertebr-chip",title:u,children:u},u))})}if(typeof n=="string")return fee.test(t)||Xj(n)?b.jsx("a",{className:"vertebr-cell-link",href:n.startsWith("//")?`https:${n}`:n,target:"_blank",rel:"noreferrer",title:n,onClick:u=>u.stopPropagation(),children:i?n:n.replace(/^https?:\/\//i,"")}):!i&&(s==="richtext"||n.length>80)?b.jsx("span",{className:"vertebr-cell-clamp",title:n,children:n}):i&&(s==="richtext"||n.length>80)?b.jsx("p",{className:"vertebr-cell-prose",children:n}):b.jsx("span",{className:"vertebr-cell-text",children:n});const l=sM(n);return l?b.jsx("span",{className:"vertebr-cell-datetime",children:l}):typeof n=="object"?b.jsx("code",{className:"vertebr-cell-json",title:JSON.stringify(n),children:JSON.stringify(n)}):b.jsx("span",{className:"vertebr-cell-text",children:String(n)})}function mee(t,e,n){const r=`${t} ${e?.label??""}`;return/^show[A-Z]/.test(t)||/\bshow\b/i.test(e?.label??"")?n?"Shown":"Hidden":/\bactive\b/i.test(r)?n?"Active":"Inactive":n?"On":"Off"}function gee({urls:t,detail:e}){if(e)return b.jsx("div",{className:"vertebr-cell-thumbs vertebr-cell-thumbs-detail",children:t.map((i,s)=>b.jsxs("a",{className:"vertebr-cell-media vertebr-cell-media-detail",href:i,target:"_blank",rel:"noreferrer",title:i,onClick:o=>o.stopPropagation(),children:[b.jsx("img",{src:i,alt:"",loading:"lazy"}),b.jsx("span",{className:"vertebr-cell-link",children:i})]},`${i}:${s}`))});const n=t.slice(0,3),r=t.length-n.length;return b.jsxs("div",{className:"vertebr-cell-thumbs",title:t[0],children:[n.map((i,s)=>b.jsx("img",{src:i,alt:"",loading:"lazy"},`${i}:${s}`)),r>0?b.jsxs("span",{className:"vertebr-cell-thumbs-more",children:["+",r]}):null]})}function yee({title:t,schema:e,value:n,uploads:r,onUpload:i,galleryUpload:s,onListGallery:o,onUploadGallery:l,onClose:u,onCreate:f}){return A.useEffect(()=>{const h=g=>{g.key==="Escape"&&u()};window.addEventListener("keydown",h);const m=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{window.removeEventListener("keydown",h),document.body.style.overflow=m}},[u]),b.jsx("div",{className:"vertebr-modal-backdrop",role:"presentation",onClick:u,children:b.jsxs("div",{className:"vertebr-modal vertebr-modal-form",role:"dialog","aria-modal":"true","aria-label":t,onClick:h=>h.stopPropagation(),children:[b.jsxs("header",{className:"vertebr-modal-head",children:[b.jsxs("div",{className:"vertebr-modal-heading",children:[b.jsx("p",{className:"vertebr-modal-eyebrow",children:"New record"}),b.jsx("h2",{children:t})]}),b.jsx("div",{className:"vertebr-modal-actions",children:b.jsx("button",{type:"button",className:"vertebr-btn",onClick:u,"aria-label":"Close",children:"Close"})})]}),b.jsx("div",{className:"vertebr-modal-body",children:b.jsx(Eg,{variant:"record",schema:e,value:n,uploads:r,onUpload:i,galleryUpload:s,onListGallery:o,onUploadGallery:l,submitLabel:t,onSave:async h=>{await f(h),u()}})})]})})}const vee=new Set(["custom","promo","custom_discount"]),bee=new Set(["discount","welcome_offer","flash_sale","custom_discount"]),xee=new Set(["discountId","discountCode","discountOffer","discountExpires"]);function wee(t){return Array.isArray(t)?t.join(", "):t}function Cc(t){return typeof t=="string"?t:String(t??"")}function See(t,e){const n=`${t} ${e.label??""}`;return e.type==="richtext"||/(body|message|html|notes)/i.test(n)}function Rm(t,e){if(!t.preset)return!0;const n=Cc(e.preset);return!n||vee.has(n)}function Jj(t){return bee.has(t)}function Qj(t,e,n){if(t==="subject"||t==="body")return Rm(e,n);if(xee.has(t)){const r=Cc(n.preset);return!(!Jj(r)||t==="discountId"&&!e.discountId?.options?.length)}return!0}function oM(t,e){return Object.entries(t).every(([n,r])=>{if(!Qj(n,t,e))return!0;const i=(n==="subject"||n==="body")&&Rm(t,e),s=(n==="discountCode"||n==="discountOffer")&&Jj(Cc(e.preset));return r.required===!1&&!i&&!s||r.type!=="string"&&r.type!=="richtext"&&r.type!=="enum"?!0:!!Cc(e[n]).trim()})}function aM(t){if(!(t instanceof Error))return"Request failed";const e=t.message.trim();if(!e.startsWith("{"))return e;try{const n=JSON.parse(e);if(typeof n.error=="string"&&n.error.trim())return n.error;if(n.error&&typeof n.error=="object"&&typeof n.error.message=="string"&&n.error.message.trim())return n.error.message;if(typeof n.message=="string"&&n.message.trim())return n.message}catch{}return e}function kee({title:t,count:e,schema:n,submitLabel:r,onClose:i,onPreview:s,onSubmit:o}){const l=A.useMemo(()=>FS(n),[n]),u=A.useMemo(()=>Object.entries(n),[n]),f=u.length>0,[h,m]=A.useState(l),[g,y]=A.useState(null),[x,S]=A.useState(null),[k,C]=A.useState(!1),[T,_]=A.useState(!1),R=!T&&(!f||oM(n,h)),M=u.filter(([P])=>Qj(P,n,h)),O=A.useCallback(async P=>{if(f&&!oM(n,P)){y(null),S(null);return}C(!0),S(null);try{const U=await s(P);y(U)}catch(U){y(null),S(aM(U))}finally{C(!1)}},[f,s,n]);A.useEffect(()=>{const P=G=>{G.key==="Escape"&&i()};window.addEventListener("keydown",P);const U=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{window.removeEventListener("keydown",P),document.body.style.overflow=U}},[i]),A.useEffect(()=>{if(!f){O({});return}const P=window.setTimeout(()=>{O(h)},280);return()=>window.clearTimeout(P)},[h,f,O]);const L=async()=>{if(R){_(!0);try{await o(f?h:{}),i()}catch(P){S(aM(P))}finally{_(!1)}}};return b.jsx("div",{className:"vertebr-modal-backdrop",role:"presentation",onClick:i,children:b.jsxs("div",{className:"vertebr-modal vertebr-modal-form vertebr-mail-modal",role:"dialog","aria-modal":"true","aria-label":t,onClick:P=>P.stopPropagation(),children:[b.jsxs("header",{className:"vertebr-modal-head",children:[b.jsxs("div",{className:"vertebr-modal-heading",children:[b.jsx("p",{className:"vertebr-modal-eyebrow",children:e===1?"1 person":`${e} people`}),b.jsx("h2",{children:t})]}),b.jsx("div",{className:"vertebr-modal-actions",children:b.jsx("button",{type:"button",className:"vertebr-btn",onClick:i,"aria-label":"Close",children:"Close"})})]}),b.jsxs("div",{className:"vertebr-mail-layout",children:[b.jsxs("form",{className:"vertebr-mail-compose",onSubmit:P=>{P.preventDefault(),L()},children:[f?b.jsxs("div",{className:"vertebr-mail-fields",children:[M.map(([P,U])=>{const G=See(P,U);return b.jsxs("label",{className:"vertebr-mail-field",children:[b.jsx("span",{children:U.label??P}),U.type==="enum"?b.jsx(US,{id:`mail-${P}`,value:h[P],field:U,onChange:oe=>m(K=>({...K,[P]:oe}))}):G?b.jsx("textarea",{rows:7,value:Cc(h[P]),placeholder:"Plain text — the host template styles it.",onChange:oe=>m(K=>({...K,[P]:oe.target.value}))}):b.jsx("input",{type:"text",value:Cc(h[P]),onChange:oe=>m(K=>({...K,[P]:oe.target.value}))})]},P)}),n.preset&&!Rm(n,h)?b.jsx("p",{className:"vertebr-mail-compose-hint",children:"Preview updates from the selected preset. Switch to Custom to write your own copy."}):null]}):b.jsx("p",{className:"vertebr-mail-compose-note",children:"Host template — Vertebr only delivers it."}),x?b.jsx("p",{className:"vertebr-mail-compose-error",children:x}):null,b.jsx("div",{className:"vertebr-mail-compose-foot",children:b.jsx("button",{type:"submit",className:"vertebr-btn vertebr-btn-primary",disabled:!R,children:T?"Sending…":r})})]}),b.jsxs("div",{className:"vertebr-mail-preview",children:[b.jsxs("div",{className:"vertebr-mail-preview-meta",children:[b.jsxs("p",{children:[b.jsx("span",{children:"To"}),b.jsx("strong",{children:g?wee(g.to):e===1?"—":`${e} recipients`})]}),b.jsxs("p",{children:[b.jsx("span",{children:"Subject"}),b.jsx("strong",{children:g?.subject??(k?"Updating…":"—")})]})]}),b.jsx("div",{className:"vertebr-mail-preview-stage",children:b.jsx("div",{className:"vertebr-mail-preview-frame",children:g?.html?b.jsx("iframe",{title:"Email preview",sandbox:"",srcDoc:g.html}):g?.text?b.jsx("pre",{children:g.text}):b.jsx("div",{className:"vertebr-mail-preview-empty",children:x??(k?"Rendering host template…":f?n.preset&&Rm(n,h)?"Write a subject and body to preview.":n.preset?"Pick a preset to preview.":"Write a subject and body to preview.":"Loading preview…")})})})]})]})]})})}function Cee(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").replace(/\bcents\b/i,"").trim()}function Eee(t,e){for(const[n,r]of Object.entries(e)){if(typeof r!="string"||!/^https?:\/\//i.test(r))continue;const i=t[n];if(/(image|img|photo|avatar|thumbnail|thumb|cover)/i.test(n)||/(image|img|photo)/i.test(i?.label??"")||/(image|img|media|cdn|photo)/i.test(r))return r}return null}function Tee({schema:t,row:e,title:n,canEdit:r,onClose:i,onEdit:s}){const o=Object.keys(t),l=o.length>0?o.map(f=>[f,e[f]]):Object.entries(e),u=Eee(t,e);return A.useEffect(()=>{const f=m=>{m.key==="Escape"&&i()};window.addEventListener("keydown",f);const h=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{window.removeEventListener("keydown",f),document.body.style.overflow=h}},[i]),b.jsx("div",{className:"vertebr-modal-backdrop",role:"presentation",onClick:i,children:b.jsxs("div",{className:"vertebr-modal",role:"dialog","aria-modal":"true","aria-label":n,onClick:f=>f.stopPropagation(),children:[b.jsxs("header",{className:"vertebr-modal-head",children:[b.jsxs("div",{className:"vertebr-modal-heading",children:[b.jsx("p",{className:"vertebr-modal-eyebrow",children:"Record"}),b.jsx("h2",{children:n})]}),b.jsxs("div",{className:"vertebr-modal-actions",children:[r&&s?b.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-primary",onClick:s,children:"Edit"}):null,b.jsx("button",{type:"button",className:"vertebr-btn",onClick:i,"aria-label":"Close",children:"Close"})]})]}),b.jsxs("div",{className:"vertebr-modal-body",children:[u?b.jsx("div",{className:"vertebr-modal-hero",children:b.jsx("img",{src:u,alt:""})}):null,b.jsx("dl",{className:"vertebr-modal-fields",children:l.map(([f,h])=>b.jsxs("div",{className:"vertebr-modal-field",children:[b.jsx("dt",{children:t[f]?.label??Cee(f)}),b.jsx("dd",{children:b.jsx(Ux,{fieldKey:f,field:t[f],value:h,variant:"detail"})})]},f))})]})]})})}function lM(t){return!!(t?.input&&Object.keys(t.input).length>0)}function cM(t){return!!t?.mail}function _ee(t,e){const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}function fa(t,e){for(const n of e){const r=t[n];if(typeof r=="string"&&r.trim())return r;if(typeof r=="number")return String(r)}return null}function r0(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").replace(/\bcents\b/i,"").trim()}function uM(t,e){for(const n of["name","title","label",...e]){const r=t[n];if(typeof r=="string"&&r.trim())return r}return"Record"}function Aee(t,e){if(!(!t||typeof localStorage>"u"))try{localStorage.setItem(`vertebr:columns:v2:${t}`,JSON.stringify(e))}catch{}}function Ree(t,e,n){return!!(/^show[A-Z]/.test(t)||e?.type==="richtext"||t==="updatedAt"||t==="createdAt"||(t==="imageSrc"||t==="imageAlt")&&"images"in n||t==="slug"&&"name"in n||e?.type==="string"&&/^(details|description)$/i.test(t))}function Mee(t){const e={};for(const[n,r]of Object.entries(t))Ree(n,r,t)&&(e[n]=!1);return e}function dM(t,e){const n=Mee(e);if(!t||typeof localStorage>"u")return n;try{const r=localStorage.getItem(`vertebr:columns:v2:${t}`);if(!r)return n;const i=JSON.parse(r);return!i||typeof i!="object"?n:{...n,...i}}catch{return n}}function Nee(t){const e=t?.trim();return e?`Add ${(/ies$/i.test(e)?e.replace(/ies$/i,"y"):/s$/i.test(e)?e.slice(0,-1):e).toLowerCase()}`:"Add record"}function Oee(t){return t.replace(/\.[^.]+$/,"").replace(/[_-]+/g," ").replace(/\s+/g," ").trim()}function Dee({schema:t,items:e,permissions:n,actions:r={},label:i,uploads:s,rowIdKeys:o=["id","slug","uid","email"],storageKey:l,onUpdate:u,onCreate:f,onDelete:h,onAction:m,onActionDone:g,onPreviewMail:y,collectionActions:x={},onCollectionAction:S,onUpload:k,galleryUpload:C,onListGallery:T,onUploadGallery:_}){const[R,M]=A.useState(null),[O,L]=A.useState(!1),[P,U]=A.useState(null),[G,oe]=A.useState(!1),[K,ne]=A.useState(null),[re,me]=A.useState(new Set),[B,z]=A.useState(null),[q,de]=A.useState(null),ve=A.useRef(null),[V,X]=A.useState({overflow:!1,canLeft:!1,canRight:!1}),[fe,ge]=A.useState(()=>dM(l,t)),Te=!!(n?.update&&u),_e=!!(n?.create&&f),Le=!!(n?.delete&&h),ke=Nee(i),se=!!(s&&k&&Object.keys(s).length),pe=Object.entries(r),Me=Object.entries(x),ze=Object.keys(t),Fe=!!(m&&pe.length>0);A.useEffect(()=>{const D=new Set(e.map(j=>fa(j,o)).filter(j=>!!j));me(j=>{const W=new Set([...j].filter(Q=>D.has(Q)));return W.size===j.size?j:W})},[e,o]);const ft=A.useCallback(async(D,j,W)=>{if(!m||j.length===0)return;ne(D);const Q=[];try{for(const he of j)try{await m(he,D,W)}catch(be){Q.push(`${he}: ${be instanceof Error?be.message:"Failed"}`)}await g?.(),me(new Set),Q.length>0&&window.alert(`Finished with ${Q.length} error(s).
|
|
330
|
-
|
|
331
|
-
${Q.slice(0,8).join(`
|
|
332
|
-
`)}`)}finally{ne(null)}},[m,g]),ht=A.useCallback((D,j)=>{const W=r[D];if(!W||j.length===0||!m)return;if(cM(W)||lM(W)){z({actionId:D,rowIds:j});return}const Q=j.length===1?"this person":`${j.length} people`;window.confirm(`${W.label} for ${Q}?`)&&ft(D,j)},[r,m,ft]),Jt=A.useCallback(async(D,j)=>{if(S){ne(D);try{await S(D,j),await g?.()}catch(W){window.alert(W instanceof Error?W.message:"Action failed")}finally{ne(null)}}},[S,g]),jn=A.useCallback(D=>{const j=x[D];if(!(!j||!S)){if(lM(j)){de(D);return}window.confirm(`${j.label}?`)&&Jt(D)}},[x,S,Jt]);A.useEffect(()=>{ge(dM(l,t))},[l]),A.useEffect(()=>{Aee(l,fe)},[l,fe]);const un=A.useCallback(()=>{const D=ve.current;if(!D){X({overflow:!1,canLeft:!1,canRight:!1});return}const j=D.scrollWidth>D.clientWidth+2;X({overflow:j,canLeft:j&&D.scrollLeft>2,canRight:j&&D.scrollLeft+D.clientWidth<D.scrollWidth-2})},[]);A.useEffect(()=>{const D=ve.current;if(!D)return;un();const j=()=>un();D.addEventListener("scroll",j,{passive:!0});const W=new ResizeObserver(un);W.observe(D);const Q=D.querySelector("table");return Q&&W.observe(Q),()=>{D.removeEventListener("scroll",j),W.disconnect()}},[un,e.length,fe]);const Sn=D=>{const j=ve.current;if(!j)return;const W=Math.max(220,Math.round(j.clientWidth*.55));j.scrollBy({left:D==="left"?-W:W,behavior:"smooth"})},dn=A.useMemo(()=>ze.map(D=>({id:D,label:t[D]?.label??r0(D)})),[ze,t]),tr=A.useMemo(()=>{const D=[];if(Fe){const j=e.map(Q=>fa(Q,o)).filter(Q=>!!Q),W=j.length>0&&j.every(Q=>re.has(Q));D.push({id:"_select",enableHiding:!1,header:()=>b.jsx("input",{type:"checkbox",className:"vertebr-row-check",checked:W,"aria-label":"Select all",onChange:()=>{me(Q=>j.every(he=>Q.has(he))?new Set:new Set(j))}}),cell:({row:Q})=>{const he=fa(Q.original,o);return he?b.jsx("input",{type:"checkbox",className:"vertebr-row-check",checked:re.has(he),"aria-label":"Select row",onClick:be=>be.stopPropagation(),onChange:()=>me(be=>_ee(be,he))}):null},size:44})}return D.push(...ze.length===0?[{id:"raw",header:"Item",cell:({row:j})=>b.jsx(Ux,{fieldKey:"raw",value:j.original})}]:ze.map(j=>{const W=t[j],Q=/(image|img|photo|avatar|thumbnail|thumb|cover)/i.test(j)||/(image|img|photo)/i.test(W?.label??"");return{id:j,accessorKey:j,header:W?.label??r0(j),meta:{fieldKey:j,field:W},cell:({getValue:he})=>b.jsx(Ux,{fieldKey:j,field:W,value:he()}),size:Q?220:void 0}})),D.push({id:"_actions",header:()=>b.jsx("span",{className:"vertebr-sr-only",children:"Actions"}),enableHiding:!1,cell:({row:j})=>{const W=fa(j.original,o);return b.jsxs("div",{className:"vertebr-row-actions",onClick:Q=>Q.stopPropagation(),onKeyDown:Q=>Q.stopPropagation(),children:[b.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",onClick:()=>U(j.original),children:"View"}),Te?b.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",onClick:()=>M(j.original),children:"Edit"}):null,W?pe.map(([Q,he])=>b.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",disabled:K!=null,onClick:()=>ht(Q,[W]),children:he.label},Q)):null,Le&&W?b.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet vertebr-btn-danger-quiet",onClick:()=>{window.confirm("Delete this row? This cannot be undone.")&&h?.(W)},children:"Delete"}):null]})}}),D},[t,ze,e,re,Fe,Te,Le,pe,K,ht,h,o]),Kr=cee({data:e,columns:tr,state:{columnVisibility:fe},onColumnVisibilityChange:ge,getCoreRowModel:see()}),Ar=R?fa(R,o):null,zt=Object.fromEntries(Object.entries(t).filter(([,D])=>!D.readOnly||D.required).map(([D,j])=>[D,j.readOnly?{...j,readOnly:!1}:j])),mi=Object.fromEntries(Object.entries(zt).map(([D,j])=>[D,j.default??(j.type==="boolean"?!1:j.type==="number"?void 0:j.type==="file[]"?[]:"")]));if(R&&Ar&&u){const D=Object.fromEntries(Object.entries(t).filter(([,W])=>!W.readOnly)),j=uM(R,o);return b.jsxs("div",{className:"vertebr-resource-edit",children:[b.jsxs("div",{className:"vertebr-resource-edit-head",children:[b.jsxs("div",{className:"vertebr-resource-edit-heading",children:[b.jsx("p",{className:"vertebr-resource-edit-eyebrow",children:"Editing record"}),b.jsx("h2",{children:j}),b.jsx("p",{className:"vertebr-resource-edit-id",children:Ar})]}),b.jsx("button",{type:"button",className:"vertebr-btn",onClick:()=>M(null),children:"Back"})]}),b.jsx(Eg,{variant:"record",schema:D,value:R,uploads:s,onUpload:k,galleryUpload:C,onListGallery:T,onUploadGallery:_,onSave:async W=>{await u(Ar,W),M(null)}})]})}const Zr=b.jsxs("div",{className:"vertebr-table-toolbar",children:[b.jsxs("div",{className:"vertebr-table-toolbar-start",children:[dn.length>0?b.jsx(dee,{columns:dn,visibility:fe,onChange:ge}):null,se?b.jsxs("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet vertebr-btn-icon",onClick:()=>oe(!0),children:[b.jsx(Pee,{}),"Bulk upload"]}):null,Me.map(([D,j])=>b.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",disabled:K!=null,onClick:()=>jn(D),children:j.label},D)),Fe&&re.size>0?b.jsxs(b.Fragment,{children:[b.jsxs("span",{className:"vertebr-count",children:[re.size," selected"]}),pe.map(([D,j])=>b.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",disabled:K!=null,onClick:()=>ht(D,[...re]),children:j.label},D)),b.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",onClick:()=>me(new Set),children:"Clear"})]}):null]}),V.overflow?b.jsxs("div",{className:"vertebr-table-scroll-controls",role:"group","aria-label":"Scroll columns",children:[b.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet vertebr-btn-icon vertebr-table-scroll-btn",disabled:!V.canLeft,onClick:()=>Sn("left"),"aria-label":"Scroll columns left",children:b.jsx(Lee,{})}),b.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet vertebr-btn-icon vertebr-table-scroll-btn",disabled:!V.canRight,onClick:()=>Sn("right"),"aria-label":"Scroll columns right",children:b.jsx(jee,{})})]}):null]}),Yr=G&&s&&k?b.jsx(uee,{uploads:s,canCreate:_e,fieldLabels:Object.fromEntries(Object.keys(s).map(D=>[D,t[D]?.label??r0(D)])),onClose:()=>oe(!1),onUpload:k,onCreateFromUploads:_e&&f?async(D,j)=>{for(const W of j){const Q=Oee(W.name??"Image");await f({[D]:W.url,name:Q,title:Q})}}:void 0}):null,qn=O&&f?b.jsx(yee,{title:ke,schema:zt,value:mi,uploads:s,onUpload:k,galleryUpload:C,onListGallery:T,onUploadGallery:_,onClose:()=>L(!1),onCreate:f}):null,ee=B?cM(r[B.actionId])&&y?b.jsx(kee,{title:r[B.actionId]?.label??"Send email",count:B.rowIds.length,schema:Wb(r[B.actionId]?.input??{}),submitLabel:K?"Sending…":B.rowIds.length===1?"Send":`Send to ${B.rowIds.length}`,onClose:()=>z(null),onPreview:D=>y(B.rowIds[0],B.actionId,D),onSubmit:D=>ft(B.actionId,B.rowIds,D)}):r[B.actionId]?.input?b.jsx(XR,{title:r[B.actionId]?.label??"Run action",count:B.rowIds.length,schema:Wb(r[B.actionId].input),submitLabel:K?"Sending…":B.rowIds.length===1?r[B.actionId]?.label??"Send":`Send to ${B.rowIds.length}`,onClose:()=>z(null),onSubmit:D=>ft(B.actionId,B.rowIds,D)}):null:null,le=q&&x[q]?.input?b.jsx(XR,{title:x[q]?.label??"Run action",eyebrow:"This resource",schema:Wb(x[q].input),submitLabel:K?"Working…":"Run",onClose:()=>de(null),onSubmit:D=>Jt(q,D)}):null,I=b.jsxs("div",{className:"vertebr-panel-head",children:[b.jsx("h2",{children:"Records"}),b.jsxs("div",{className:"vertebr-panel-head-actions",children:[_e?b.jsxs("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet vertebr-btn-icon",onClick:()=>L(!0),children:[b.jsx(Iee,{}),ke]}):null,b.jsx("span",{className:"vertebr-count",children:e.length})]})]});return e.length===0?b.jsxs("div",{className:"vertebr-resource-body",children:[I,se||dn.length>0||Me.length>0?Zr:null,b.jsx("div",{className:"vertebr-empty",children:"No rows yet."}),Yr,qn,ee,le]}):b.jsxs("div",{className:"vertebr-resource-body",children:[I,Zr,b.jsx("div",{className:"vertebr-table-wrap",ref:ve,"data-overflow":V.overflow?"true":void 0,"data-overflow-left":V.canLeft?"true":void 0,"data-overflow-right":V.canRight?"true":void 0,children:b.jsxs("table",{className:"vertebr-table",children:[b.jsx("thead",{children:Kr.getHeaderGroups().map(D=>b.jsx("tr",{children:D.headers.map(j=>b.jsx("th",{className:j.column.id==="_actions"?"vertebr-col-actions":j.column.id==="_select"?"vertebr-col-select":void 0,children:j.isPlaceholder?null:iM(j.column.columnDef.header,j.getContext())},j.id))},D.id))}),b.jsx("tbody",{children:Kr.getRowModel().rows.map(D=>b.jsx("tr",{className:"vertebr-table-row-clickable","data-selected":Fe&&fa(D.original,o)&&re.has(fa(D.original,o))?"true":void 0,tabIndex:0,onClick:()=>U(D.original),onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),U(D.original))},children:D.getVisibleCells().map(j=>b.jsx("td",{className:j.column.id==="_actions"?"vertebr-col-actions":j.column.id==="_select"?"vertebr-col-select":void 0,children:iM(j.column.columnDef.cell,j.getContext())},j.id))},D.id))})]})}),P?b.jsx(Tee,{schema:t,row:P,title:uM(P,o),canEdit:Te,onClose:()=>U(null),onEdit:()=>{M(P),U(null)}}):null,ee,le,Yr,qn]})}function Iee(){return b.jsxs("svg",{className:"vertebr-btn-glyph",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[b.jsx("path",{d:"M12 5v14"}),b.jsx("path",{d:"M5 12h14"})]})}function Lee(){return b.jsx("svg",{className:"vertebr-btn-glyph",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:b.jsx("path",{d:"m15 18-6-6 6-6"})})}function jee(){return b.jsx("svg",{className:"vertebr-btn-glyph",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:b.jsx("path",{d:"m9 18 6-6-6-6"})})}function Pee(){return b.jsxs("svg",{className:"vertebr-btn-glyph",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[b.jsx("path",{d:"M16 5h6"}),b.jsx("path",{d:"M19 2v6"}),b.jsx("rect",{x:"3",y:"7",width:"14",height:"14",rx:"2"}),b.jsx("circle",{cx:"8.5",cy:"12.5",r:"1.5"}),b.jsx("path",{d:"m17 21-4.5-4.5L7 21"})]})}function zee({client:t,catalog:e,selection:n,authRequired:r,loading:i,isPageSelection:s,metricsData:o,metricsLoading:l,metricsRange:u,onMetricsRangeChange:f,onRefreshMetrics:h,galleryData:m,galleryLoading:g,onRefreshGallery:y,emailsData:x,emailsLoading:S,onRefreshEmails:k,resourceData:C,onRefreshResource:T,configData:_,onConfigSaved:R,galleryPicker:M}){return e?b.jsx("div",{className:"vertebr-content",children:b.jsxs("section",{className:"vertebr-panel",children:[n?.kind==="overview"?b.jsx(vQ,{label:o?.label??e.metrics?.label,windowLabel:o?.windowLabel,compareLabel:o?.compareLabel,metrics:o?.metrics??[],charts:o?.charts??[],range:u,onRangeChange:f,loading:l,onRefresh:()=>{h()}}):null,n?.kind==="gallery"&&m?b.jsx(rQ,{label:m.label,items:m.items,accept:m.accept,maxBytes:m.maxBytes,canDelete:m.canDelete,loading:g,onRefresh:()=>{y()},onUpload:async O=>{O.length===1&&O[0]?await t.uploadGalleryFile(O[0]):await t.uploadGalleryFiles(O),await y()},onDelete:m.canDelete?async O=>{await t.deleteGalleryItem(O),await y()}:void 0}):null,n?.kind==="emails"&&x?b.jsx(nQ,{data:x,loading:S,tab:n.tab??"compose",onRefresh:()=>{k()},onLoadRecipients:async O=>{const L=await t.listResource(O,{fresh:!0}),P=new Set,U=[];for(const G of L.items){const oe=String(G.email??"").trim().toLowerCase();if(!oe.includes("@")||P.has(oe))continue;P.add(oe);const K=String(G.id??G.uid??G.slug??oe),ne=String(G.displayName??G.name??"").trim();U.push({email:oe,id:K,...ne?{label:ne}:{}})}return U.sort((G,oe)=>G.email.localeCompare(oe.email)),U},onPreview:O=>t.previewEmails(O),onSend:async O=>{const L=await t.sendEmails(O);return{sent:L.sent,failed:L.failed}},onSchedule:x.canSchedule?async O=>{await t.scheduleEmails(O)}:void 0,onCancel:x.canSchedule?async O=>{await t.cancelEmailCampaign(O)}:void 0,onSaveLibrary:x.canLibrary?async O=>{await t.saveEmailLibraryTemplate(O)}:void 0,onDeleteLibrary:x.canLibrary?async O=>{await t.deleteEmailLibraryTemplate(O)}:void 0}):null,n?.kind==="resource"&&C?b.jsx(Dee,{schema:C.schema,items:C.items,label:C.label,permissions:C.permissions,actions:C.actions,collectionActions:C.collectionActions,uploads:C.uploads,storageKey:C.id,onUpdate:C.permissions.update?async(O,L)=>{await t.updateResource(C.id,O,L),await T()}:void 0,onCreate:C.permissions.create?async O=>{await t.createResource(C.id,O),await T()}:void 0,onDelete:C.permissions.delete?async O=>{await t.deleteResource(C.id,O),await T()}:void 0,onAction:async(O,L,P)=>{await t.runResourceAction(C.id,O,L,P)},onActionDone:T,onPreviewMail:async(O,L,P)=>t.previewResourceMail(C.id,O,L,P),onCollectionAction:async(O,L)=>{await t.runCollectionAction(C.id,O,L)},onUpload:C.uploads?async(O,L)=>{if(L.length===1&&L[0]){const U=await t.uploadResourceFile(C.id,O,L[0]);return[{url:U.url,name:U.name}]}return(await t.uploadResourceFiles(C.id,O,L)).files}:void 0,...M}):null,n?.kind==="config"&&_?b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:"vertebr-panel-head",children:[b.jsx("h2",{children:s?"Page content":"Settings"}),b.jsxs("span",{className:"vertebr-count",children:[Object.keys(_.schema).length," fields"]})]}),b.jsx(Eg,{schema:_.schema,value:_.value,onSave:async O=>{const L=await t.setConfig(_.id,O);R({..._,value:L.value})},...M})]}):null]})}):b.jsx("div",{className:"vertebr-content",children:b.jsx("section",{className:"vertebr-panel",children:b.jsx("div",{className:"vertebr-empty",children:r?"Authenticated access required for this environment.":i?"Loading…":"Unable to load catalog."})})})}function $ee({catalogLoaded:t,authRequired:e,selection:n,isPageSelection:r}){return!t&&e?"Provide an access token to load this environment.":n?.kind==="overview"?"Commerce, growth, and catalog for the selected environment.":n?.kind==="gallery"?"Browse and upload shared media assets.":n?.kind==="emails"?"Send or schedule branded email to a list or specific people.":n?.kind==="resource"?"Manage records scoped to the selected environment.":n?.kind==="config"?r?"Edit content for this page.":"Owner-managed config for this environment.":"Select a panel."}function Bee({activeLabel:t,activeEnv:e,catalogLoaded:n,authRequired:r,selection:i,isPageSelection:s,error:o}){return b.jsxs("header",{className:"vertebr-header",children:[b.jsxs("div",{children:[b.jsxs("div",{className:"vertebr-heading-row",children:[b.jsx("h1",{children:t}),e?b.jsx("span",{className:"vertebr-env-badge","data-tone":e.tone??"neutral",children:e.label}):null]}),b.jsx("p",{children:$ee({catalogLoaded:n,authRequired:r,selection:i,isPageSelection:s})})]}),o?b.jsx("span",{className:"vertebr-status","data-tone":"danger",children:o}):null]})}function Vee({environments:t,value:e,onChange:n}){const r=t.find(i=>i.id===e);return b.jsxs(pg,{value:e,onValueChange:n,children:[b.jsxs(mg,{className:"vertebr-select-trigger","aria-label":"Environment","data-tone":r?.tone??"neutral",children:[b.jsxs("span",{className:"vertebr-select-value",children:[b.jsx("span",{className:"vertebr-select-dot","data-tone":r?.tone??"neutral"}),b.jsx(gg,{placeholder:"Select environment"})]}),b.jsx(yg,{className:"vertebr-select-icon",children:b.jsx(Hee,{})})]}),b.jsx(vg,{children:b.jsx(bg,{className:"vertebr-select-content",position:"popper",sideOffset:6,children:b.jsx(wg,{className:"vertebr-select-viewport",children:t.map(i=>b.jsxs(Sg,{value:i.id,className:"vertebr-select-item","data-tone":i.tone??"neutral",children:[b.jsxs("span",{className:"vertebr-select-value",children:[b.jsx("span",{className:"vertebr-select-dot","data-tone":i.tone??"neutral"}),b.jsx(kg,{children:i.label})]}),i.auth?.required?b.jsx("span",{className:"vertebr-env-lock",children:"auth"}):null,b.jsx(Cg,{className:"vertebr-select-check",children:b.jsx(Uee,{})})]},i.id))})})})]})}function Hee(){return b.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:b.jsx("path",{d:"M2.5 4.5 6 8l3.5-3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function Uee(){return b.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:b.jsx("path",{d:"M2.5 6.2 4.8 8.5 9.5 3.8",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function Fee({theme:t,onChange:e}){return b.jsxs("div",{className:"vertebr-theme",children:[b.jsx("div",{className:"vertebr-nav-label",children:"Appearance"}),b.jsxs("div",{className:"vertebr-theme-toggle",role:"group","aria-label":"Color theme",children:[b.jsxs("button",{type:"button",className:"vertebr-theme-option","data-active":t==="light","aria-pressed":t==="light",onClick:()=>e("light"),children:[b.jsx(qee,{}),"Light"]}),b.jsxs("button",{type:"button",className:"vertebr-theme-option","data-active":t==="dark","aria-pressed":t==="dark",onClick:()=>e("dark"),children:[b.jsx(Gee,{}),"Dark"]})]})]})}function qee(){return b.jsxs("svg",{className:"vertebr-theme-icon",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[b.jsx("circle",{cx:"12",cy:"12",r:"4"}),b.jsx("path",{d:"M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"})]})}function Gee(){return b.jsx("svg",{className:"vertebr-theme-icon",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:b.jsx("path",{d:"M21 14.5A8.5 8.5 0 0 1 9.5 3 7 7 0 1 0 21 14.5z"})})}function Wee({item:t}){const e=!!t.children?.length,n=t.children?.some(o=>o.active)??!1,r=t.active||n,[i,s]=A.useState(r);return A.useEffect(()=>{r&&s(!0)},[r]),e?b.jsxs("div",{className:"vertebr-nav-item","data-has-children":"true","data-open":i||void 0,children:[b.jsxs("div",{className:"vertebr-nav-parent",children:[b.jsx("button",{type:"button",className:"vertebr-nav-parent-label","data-active":r&&!n,"data-section":r||void 0,onClick:()=>{s(!0),t.onSelect()},children:t.label}),b.jsx("button",{type:"button",className:"vertebr-nav-parent-toggle","aria-label":i?`Collapse ${t.label}`:`Expand ${t.label}`,"aria-expanded":i,onClick:()=>s(o=>!o),children:b.jsx("span",{"aria-hidden":"true",children:i?"▾":"▸"})})]}),i?b.jsx("div",{className:"vertebr-nav-sub",role:"group",children:t.children.map(o=>b.jsx("button",{type:"button",className:"vertebr-nav-subitem","data-active":o.active,onClick:()=>{s(!0),o.onSelect()},children:o.label},o.key))}):null]}):b.jsx("button",{type:"button","data-active":t.active,onClick:t.onSelect,children:t.label})}function Kee({brand:t,title:e,envList:n,environment:r,onEnvironmentChange:i,navGroups:s,getAccessToken:o,authUserLabel:l,onSignOut:u,authRequired:f,activeEnv:h,token:m,tokenDraft:g,onTokenDraftChange:y,onSaveToken:x,onClearToken:S,theme:k,onThemeChange:C}){return b.jsxs("aside",{className:"vertebr-sidebar",children:[b.jsxs("div",{className:"vertebr-sidebar-top",children:[b.jsxs("div",{className:"vertebr-brand",children:[b.jsx("strong",{children:t}),b.jsx("span",{children:e})]}),n.length>0?b.jsxs("div",{className:"vertebr-env",children:[b.jsx("div",{className:"vertebr-nav-label",children:"Environment"}),b.jsx(Vee,{environments:n,value:r,onChange:i})]}):null,b.jsx("nav",{className:"vertebr-nav",children:s.map(T=>b.jsxs("div",{className:"vertebr-nav-group",children:[b.jsx("div",{className:"vertebr-nav-label",children:T.label}),T.items.map(_=>b.jsx(Wee,{item:_},_.key))]},T.label))})]}),b.jsxs("div",{className:"vertebr-sidebar-bottom",children:[o&&l?b.jsxs("div",{className:"vertebr-auth",children:[b.jsx("div",{className:"vertebr-nav-label",children:"Signed in"}),b.jsx("p",{className:"vertebr-auth-hint",children:l}),u?b.jsx("button",{type:"button",className:"vertebr-btn",onClick:()=>{u()},children:"Sign out"}):null]}):null,!o&&(f||m)?b.jsxs("div",{className:"vertebr-auth",children:[b.jsx("div",{className:"vertebr-nav-label",children:"Access"}),b.jsx("p",{className:"vertebr-auth-hint",children:f?`This environment requires auth${h?.auth?.claimKey?` (${h.auth.claimKey})`:""}.`:"Optional access token for protected environments."}),b.jsx("input",{className:"vertebr-auth-input",type:"password",placeholder:"Bearer token",value:g,onChange:T=>y(T.target.value),autoComplete:"off"}),b.jsxs("div",{className:"vertebr-auth-actions",children:[b.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-primary",onClick:x,children:"Use token"}),m?b.jsx("button",{type:"button",className:"vertebr-btn",onClick:S,children:"Clear"}):null]})]}):null,b.jsx(Fee,{theme:k,onChange:C})]})]})}function Zee(t){const e=[],n=new Map;for(const r of t){const i=r.group.trim()||"Resources";n.has(i)||(n.set(i,[]),e.push(i)),n.get(i).push(r)}return e.map(r=>({label:r,items:n.get(r)}))}function i0(t){try{return localStorage.getItem(t)}catch{return null}}function Yh(t,e){try{localStorage.setItem(t,e)}catch{}}function fM(t){try{localStorage.removeItem(t)}catch{}}function Yee({apiBase:t="/admin/api",title:e="Control plane",envStorageKey:n="vertebr:env",tokenStorageKey:r="vertebr:token",themeStorageKey:i="vertebr:theme",metricsRangeStorageKey:s="vertebr:metrics-range",getAccessToken:o,authUserLabel:l,onSignOut:u}){const{theme:f,setTheme:h}=nH(i),[m,g]=A.useState(()=>i0(n)??""),[y,x]=A.useState(()=>i0(r)??""),[S,k]=A.useState(y),C=A.useCallback(()=>m,[m]),T=A.useMemo(()=>h0({apiBase:t,getEnvironment:C,getAccessToken:o??(()=>y||null)}),[t,C,o,y]),[_,R]=A.useState(null),[M,O]=A.useState(null),[L,P]=A.useState({kind:"overview"}),[U,G]=A.useState(null),[oe,K]=A.useState(null),[ne,re]=A.useState(null),[me,B]=A.useState(!1),[z,q]=A.useState(()=>sH(i0(s))),[de,ve]=A.useState(null),[V,X]=A.useState(!1),[fe,ge]=A.useState(null),[Te,_e]=A.useState(!1),[Le,ke]=A.useState(null),[se,pe]=A.useState(!0);A.useEffect(()=>{let ee=!1;return(async()=>{try{const le=await T.getBootstrap();if(ee)return;R(le);const I=le.environments.map(j=>j.id),D=m&&I.includes(m)&&m||le.defaultEnvironment;D!==m&&(g(D),Yh(n,D))}catch(le){ee||ke(le instanceof Error?le.message:"Failed to load bootstrap")}})(),()=>{ee=!0}},[T,m,n]),A.useEffect(()=>{if(!_||!m)return;let ee=!1;return(async()=>{try{pe(!0),ke(null);const le=await T.getCatalog();if(ee)return;O(le),P(I=>{if(I?.kind==="overview"||I?.kind==="gallery"&&le.gallery||I?.kind==="emails"&&le.emails||I?.kind==="resource"&&le.resources.some(W=>W.id===I.id)||I?.kind==="config"&&le.configs.some(W=>W.id===I.id))return I;if(le.metrics)return{kind:"overview"};const D=le.resources[0];if(D)return{kind:"resource",id:D.id};if(le.gallery)return{kind:"gallery"};if(le.emails)return{kind:"emails",tab:"compose"};const j=le.configs[0];return j?{kind:"config",id:j.id}:{kind:"overview"}})}catch(le){ee||(O(null),ke(le instanceof Error?le.message:"Failed to load catalog"))}finally{ee||pe(!1)}})(),()=>{ee=!0}},[T,_,m]),A.useEffect(()=>{if(!L||!M)return;let ee=!1;return(async()=>{try{if(ke(null),L.kind==="overview"){B(!0);const le=await T.getMetrics({range:z});ee||(re(le),G(null),K(null),ve(null),ge(null))}else if(L.kind==="gallery"){X(!0);const le=await T.getGallery();ee||(ve(le),G(null),K(null),re(null),ge(null))}else if(L.kind==="emails"){_e(!0);const le=await T.getEmails();ee||(ge(le),G(null),K(null),re(null),ve(null))}else if(L.kind==="resource"){const le=await T.listResource(L.id);ee||(G(le),K(null),re(null),ve(null),ge(null))}else{const le=await T.getConfig(L.id);ee||(K(le),G(null),re(null),ve(null),ge(null))}}catch(le){ee||ke(le instanceof Error?le.message:"Failed to load panel")}finally{ee||(B(!1),X(!1),_e(!1))}})(),()=>{ee=!0}},[T,L,M,m,z]);const Me=A.useCallback(async()=>{if(L?.kind!=="resource")return;const ee=await T.listResource(L.id);G(ee)},[T,L]),ze=A.useCallback(async()=>{B(!0);try{const ee=await T.getMetrics({range:z,fresh:!0});re(ee)}finally{B(!1)}},[T,z]),Fe=A.useCallback(ee=>{q(ee),Yh(s,ee)},[s]),ft=A.useCallback(async()=>{X(!0);try{const ee=await T.getGallery({fresh:!0});ve(ee)}finally{X(!1)}},[T]),ht=A.useCallback(async()=>{_e(!0);try{const ee=await T.getEmails({fresh:!0});ge(ee)}finally{_e(!1)}},[T]),Jt=A.useCallback(async()=>(await T.getGallery()).items,[T]),jn=A.useCallback(async ee=>{if(ee.length===1&&ee[0]){const{item:I}=await T.uploadGalleryFile(ee[0]);return[I]}const{items:le}=await T.uploadGalleryFiles(ee);return le},[T]),un=M?.gallery?{galleryUpload:{accept:M.gallery.accept,maxBytes:M.gallery.maxBytes},onListGallery:Jt,onUploadGallery:jn}:{},Sn=M?.environments??_?.environments??[],dn=Sn.find(ee=>ee.id===m),tr=!!dn?.auth?.required,Ar=(L?.kind==="config"?M?.configs.find(ee=>ee.id===L.id):void 0)?.section==="page",zt=ee=>{if(ee===m)return;const le=Sn.find(I=>I.id===ee);le?.tone==="danger"&&!window.confirm(`Switch to ${le.label}? Writes will affect this environment.`)||(Yh(n,ee),g(ee),G(null),K(null),ve(null))},mi=()=>{const ee=S.trim();x(ee),ee?Yh(r,ee):fM(r)},Zr=()=>{x(""),k(""),fM(r)},Yr=A.useMemo(()=>{if(!M)return[];const ee=[];M.metrics&&ee.push({key:"overview",group:M.metrics.group??"Analytics",label:M.metrics.label,active:L?.kind==="overview",onSelect:()=>P({kind:"overview"})});for(const le of M.resources)ee.push({key:`resource:${le.id}`,group:le.group??"Resources",label:le.label,active:L?.kind==="resource"&&L.id===le.id,onSelect:()=>P({kind:"resource",id:le.id})});if(M.gallery&&ee.push({key:"gallery",group:M.gallery.group??"Resources",label:M.gallery.label,active:L?.kind==="gallery",onSelect:()=>P({kind:"gallery"})}),M.emails){const le=L?.kind==="emails"?L.tab??"compose":null;ee.push({key:"emails",group:M.emails.group??"Growth",label:M.emails.label,active:L?.kind==="emails",onSelect:()=>P({kind:"emails",tab:"compose"}),children:[{key:"emails:compose",label:"Compose",active:le==="compose",onSelect:()=>P({kind:"emails",tab:"compose"})},{key:"emails:templates",label:"Templates",active:le==="templates",onSelect:()=>P({kind:"emails",tab:"templates"})},{key:"emails:activity",label:"Activity",active:le==="activity",onSelect:()=>P({kind:"emails",tab:"activity"})}]})}for(const le of M.configs){const I=le.section==="page"?"Pages":"Config";ee.push({key:`config:${le.id}`,group:le.group??I,label:le.label,active:L?.kind==="config"&&L.id===le.id,onSelect:()=>P({kind:"config",id:le.id})})}return Zee(ee)},[M,L]);if(!_&&se)return b.jsx("div",{className:"vertebr-loading",children:"Loading Vertebr…"});if(Le&&!_)return b.jsx("div",{className:"vertebr-error",children:Le});const qn=L?.kind==="overview"?M?.metrics?.label??"Overview":L?.kind==="gallery"?M?.gallery?.label??"Gallery":L?.kind==="emails"?M?.emails?.label??"Emails":L?.kind==="resource"?M?.resources.find(ee=>ee.id===L.id)?.label:L?.kind==="config"?M?.configs.find(ee=>ee.id===L.id)?.label:null;return b.jsxs("div",{className:"vertebr-root","data-env":m,children:[b.jsx(Kee,{brand:_?.brand??M?.brand??"Vertebr",title:e,envList:Sn,environment:m,onEnvironmentChange:zt,navGroups:Yr,getAccessToken:o,authUserLabel:l,onSignOut:u,authRequired:tr,activeEnv:dn,token:y,tokenDraft:S,onTokenDraftChange:k,onSaveToken:mi,onClearToken:Zr,theme:f,onThemeChange:h}),b.jsxs("main",{className:"vertebr-main",children:[b.jsx(Bee,{activeLabel:qn??(M?"Dashboard":"Sign in"),activeEnv:dn,catalogLoaded:!!M,authRequired:tr,selection:L,isPageSelection:Ar,error:Le}),b.jsx(zee,{client:T,catalog:M,selection:L,authRequired:tr,loading:se,isPageSelection:Ar,metricsData:ne,metricsLoading:me,metricsRange:z,onMetricsRangeChange:Fe,onRefreshMetrics:ze,galleryData:de,galleryLoading:V,onRefreshGallery:ft,emailsData:fe,emailsLoading:Te,onRefreshEmails:ht,resourceData:U,onRefreshResource:Me,configData:oe,onConfigSaved:K,galleryPicker:un})]})]})}A.createContext(null);A.createContext(null);const s0="/admin/api";function Xee(t){const e=t.environments.map(r=>r.auth?.client).find(r=>r?.provider==="firebase");if(!e)return null;const n=U$().length?_M():TM(e.config);return fV(n)}function Jee(){const[t,e]=A.useState(null),[n,r]=A.useState(null),[i,s]=A.useState(null),[o,l]=A.useState(!1),[u,f]=A.useState("idle"),[h,m]=A.useState(""),[g,y]=A.useState(""),[x,S]=A.useState(null),[k,C]=A.useState(!1),T=A.useMemo(()=>h0({apiBase:s0,getEnvironment:()=>""}),[]);A.useEffect(()=>{let O=!1;return T.getBootstrap().then(L=>{if(O)return;e(L);const P=Xee(L);r(P),P||l(!0)}).catch(L=>{O||(S(L instanceof Error?L.message:"Could not load auth"),l(!0))}),()=>{O=!0}},[T]),A.useEffect(()=>{if(n)return t3(n,O=>{s(O),f(O?"checking":"idle"),l(!0)})},[n]),A.useEffect(()=>{if(!t||!i)return;let O=!1;return(async()=>{f("checking");const L=localStorage.getItem("vertebr:env"),P=[...L?[L]:[],...t.environments.map(U=>U.id)].filter((U,G,oe)=>oe.indexOf(U)===G);for(const U of P)try{await h0({apiBase:s0,getEnvironment:()=>U,getAccessToken:()=>i.getIdToken()}).getCatalog(),O||(localStorage.setItem("vertebr:env",U),f("allowed"));return}catch{}O||f("denied")})(),()=>{O=!0}},[t,i]);const _=t?.environments.map(O=>O.auth?.client).find(O=>O?.provider==="firebase")?.methods??["email"],R=async O=>{if(O.preventDefault(),!!n){C(!0),S(null);try{await JB(n,h.trim(),g)}catch(L){S(L instanceof Error?L.message:"Sign-in failed")}finally{C(!1)}}},M=async()=>{if(n){C(!0),S(null);try{await w3(n,new cs)}catch(O){S(O instanceof Error?O.message:"Sign-in failed")}finally{C(!1)}}};return o?!n||!t?b.jsx("div",{className:"vertebr-error",children:x??"No browser auth provider is configured."}):i?u==="checking"||u==="idle"?b.jsx("div",{className:"vertebr-loading",children:"Checking admin access…"}):u==="denied"?b.jsx("main",{className:"vertebr-login",children:b.jsxs("section",{className:"vertebr-login-card",children:[b.jsxs("div",{className:"vertebr-brand",children:[b.jsx("strong",{children:t.brand}),b.jsx("span",{children:"Access denied"})]}),b.jsxs("div",{children:[b.jsx("h1",{children:"Administrator access required"}),b.jsxs("p",{children:["Signed in as ",i.email??i.uid,", but this account is not approved for any Vertebr environment."]})]}),b.jsx("button",{className:"vertebr-btn",type:"button",onClick:()=>{TT(n)},children:"Sign out"})]})}):b.jsx(Yee,{apiBase:s0,title:"Owner control plane",getAccessToken:()=>i.getIdToken(),authUserLabel:i.email??i.uid,onSignOut:()=>TT(n)}):b.jsx("main",{className:"vertebr-login",children:b.jsxs("section",{className:"vertebr-login-card",children:[b.jsxs("div",{className:"vertebr-brand",children:[b.jsx("strong",{children:t.brand}),b.jsx("span",{children:"Admin access"})]}),b.jsxs("div",{children:[b.jsx("h1",{children:"Sign in"}),b.jsx("p",{children:"Use an approved administrator account. Storefront accounts do not receive dashboard access."})]}),_.includes("email")?b.jsxs("form",{className:"vertebr-login-form",onSubmit:R,children:[b.jsxs("label",{className:"vertebr-field",children:[b.jsx("span",{children:"Email"}),b.jsx("input",{type:"email",autoComplete:"username",required:!0,value:h,onChange:O=>m(O.target.value)})]}),b.jsxs("label",{className:"vertebr-field",children:[b.jsx("span",{children:"Password"}),b.jsx("input",{type:"password",autoComplete:"current-password",required:!0,value:g,onChange:O=>y(O.target.value)})]}),b.jsx("button",{className:"vertebr-btn vertebr-btn-primary",type:"submit",disabled:k,children:k?"Signing in…":"Sign in"})]}):null,_.includes("google")?b.jsx("button",{className:"vertebr-btn",type:"button",disabled:k,onClick:()=>{M()},children:"Continue with Google"}):null,x?b.jsx("p",{className:"vertebr-status","data-tone":"danger",children:x}):null]})}):b.jsx("div",{className:"vertebr-loading",children:"Checking admin session…"})}wz.createRoot(document.getElementById("root")).render(b.jsx(A.StrictMode,{children:b.jsx(Jee,{})}));
|